Merge pull request #1624 from esdrubal/getprocesstimes
[mono.git] / mono / metadata / sgen-pinning.h
index 75b0f63047229b83bcd1bb2d64d8debcab8e5728..8f9ac73b9910704b395374cf7f6e083158f83e99 100644 (file)
@@ -1,24 +1,21 @@
 /*
+ * sgen-pinning.h: All about pinning objects.
+ *
  * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
+ * Copyright (C) 2012 Xamarin Inc
  *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
  *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 #ifndef __MONO_SGEN_PINNING_H__
 #define __MONO_SGEN_PINNING_H__
@@ -30,21 +27,36 @@ enum {
        PIN_TYPE_MAX
 };
 
-void mono_sgen_pin_stage_ptr (void *ptr) MONO_INTERNAL;
-void mono_sgen_optimize_pin_queue (int start_slot) MONO_INTERNAL;
-void mono_sgen_init_pinning (void) MONO_INTERNAL;
-void mono_sgen_finish_pinning (void) MONO_INTERNAL;
-void mono_sgen_pin_queue_clear_discarded_entries (GCMemSection *section, int max_pin_slot) MONO_INTERNAL;
-int mono_sgen_get_pinned_count (void) MONO_INTERNAL;
-void mono_sgen_pinning_setup_section (GCMemSection *section);
+void sgen_pin_stage_ptr (void *ptr);
+void sgen_optimize_pin_queue (void);
+void sgen_init_pinning (void);
+void sgen_finish_pinning (void);
+void sgen_pin_queue_clear_discarded_entries (GCMemSection *section, size_t max_pin_slot);
+size_t sgen_get_pinned_count (void);
+void sgen_pinning_setup_section (GCMemSection *section);
+void sgen_pinning_trim_queue_to_section (GCMemSection *section);
+
+void sgen_dump_pin_queue (void);
 
-void mono_sgen_dump_pin_queue (void) MONO_INTERNAL;
+gboolean sgen_find_optimized_pin_queue_area (void *start, void *end, size_t *first_out, size_t *last_out);
+void sgen_find_section_pin_queue_start_end (GCMemSection *section);
+void** sgen_pinning_get_entry (size_t index);
+void sgen_pin_objects_in_section (GCMemSection *section, ScanCopyContext ctx);
 
 /* Pinning stats */
 
-void mono_sgen_pin_stats_register_address (char *addr, int pin_type) MONO_INTERNAL;
-size_t mono_sgen_pin_stats_get_pinned_byte_count (int pin_type) MONO_INTERNAL;
-ObjectList *mono_sgen_pin_stats_get_object_list (void) MONO_INTERNAL;
-void mono_sgen_pin_stats_reset (void) MONO_INTERNAL;
+void sgen_pin_stats_register_address (char *addr, int pin_type);
+size_t sgen_pin_stats_get_pinned_byte_count (int pin_type);
+ObjectList *sgen_pin_stats_get_object_list (void);
+void sgen_pin_stats_reset (void);
+
+/* Perpetual pinning, aka cementing */
+
+void sgen_cement_init (gboolean enabled);
+void sgen_cement_reset (void);
+gboolean sgen_cement_lookup (char *obj);
+gboolean sgen_cement_lookup_or_register (char *obj);
+void sgen_pin_cemented_objects (void);
+void sgen_cement_clear_below_threshold (void);
 
 #endif