g_error (__VA_ARGS__); \
} } while (0)
+#ifndef HOST_WIN32
+# define LOG_TIMESTAMP \
+ do { \
+ time_t t; \
+ struct tm tod; \
+ time(&t); \
+ localtime_r(&t, &tod); \
+ strftime(logTime, sizeof(logTime), "%Y-%m-%d %H:%M:%S", &tod); \
+ } while (0)
+#else
+# define LOG_TIMESTAMP \
+ do { \
+ time_t t; \
+ struct tm *tod; \
+ time(&t); \
+ tod = localtime(&t); \
+ strftime(logTime, sizeof(logTime), "%F %T", tod); \
+ } while (0)
+#endif
#define SGEN_LOG(level, format, ...) do { \
if (G_UNLIKELY ((level) <= SGEN_MAX_DEBUG_LEVEL && (level) <= gc_debug_level)) { \
- mono_gc_printf (gc_debug_file, format "\n", ##__VA_ARGS__); \
+ char logTime[80]; \
+ LOG_TIMESTAMP; \
+ mono_gc_printf (gc_debug_file, "%s " format "\n", logTime, ##__VA_ARGS__); \
} } while (0)
#define SGEN_COND_LOG(level, cond, format, ...) do { \
- if (G_UNLIKELY ((level) <= SGEN_MAX_DEBUG_LEVEL && (level) <= gc_debug_level)) { \
- if (cond) \
- mono_gc_printf (gc_debug_file, format "\n", ##__VA_ARGS__); \
+ if (G_UNLIKELY ((level) <= SGEN_MAX_DEBUG_LEVEL && (level) <= gc_debug_level)) { \
+ if (cond) { \
+ char logTime[80]; \
+ LOG_TIMESTAMP; \
+ mono_gc_printf (gc_debug_file, "%s " format "\n", logTime, ##__VA_ARGS__); \
+ } \
} } while (0)
extern int gc_debug_level;
List of what each bit on of the vtable gc bits means.
*/
enum {
+ // When the Java bridge has determined an object is "bridged", it uses these two bits to cache that information.
SGEN_GC_BIT_BRIDGE_OBJECT = 1,
SGEN_GC_BIT_BRIDGE_OPAQUE_OBJECT = 2,
SGEN_GC_BIT_FINALIZER_AWARE = 4,
void sgen_conservatively_pin_objects_from (void **start, void **end, void *start_nursery, void *end_nursery, int pin_type);
+gboolean sgen_gc_initialized (void);
+
/* Keep in sync with description_for_type() in sgen-internal.c! */
enum {
INTERNAL_MEM_PIN_QUEUE,
gboolean sgen_have_pending_finalizers (void);
void sgen_object_register_for_finalization (GCObject *obj, void *user_data);
-int sgen_gather_finalizers_if (SgenObjectPredicateFunc predicate, void *user_data, GCObject **out_array, int out_size);
+void sgen_finalize_if (SgenObjectPredicateFunc predicate, void *user_data, volatile gboolean *suspend);
void sgen_remove_finalizers_if (SgenObjectPredicateFunc predicate, void *user_data, int generation);
void sgen_register_disappearing_link (GCObject *obj, void **link, gboolean track, gboolean in_gc);
void sgen_ensure_free_space (size_t size, int generation);
void sgen_gc_collect (int generation);
-void sgen_perform_collection (size_t requested_size, int generation_to_collect, const char *reason, gboolean wait_to_finish);
+void sgen_perform_collection (size_t requested_size, int generation_to_collect, const char *reason, gboolean wait_to_finish, gboolean stw);
int sgen_gc_collection_count (int generation);
/* FIXME: what exactly does this return? */