#include "metadata/profiler-private.h"
#include "utils/dtrace.h"
#include "utils/mono-counters.h"
-#include "utils/mono-logger-internal.h"
+#include "utils/mono-logger-internals.h"
#include "utils/mono-time.h"
-#include "utils/mono-semaphore.h"
-#include "metadata/sgen-bridge-internal.h"
+#include "utils/mono-os-semaphore.h"
+#include "metadata/sgen-bridge-internals.h"
extern void mono_sgen_register_moved_object (void *obj, void *destination);
extern void mono_sgen_gc_event_moves (void);
INTERNAL_MEM_MAX
};
+static inline mword
+sgen_mono_array_size (GCVTable vtable, MonoArray *array, mword *bounds_size, mword descr)
+{
+ mword size, size_without_bounds;
+ int element_size;
+
+ if ((descr & DESC_TYPE_MASK) == DESC_TYPE_VECTOR)
+ element_size = ((descr) >> VECTOR_ELSIZE_SHIFT) & MAX_ELEMENT_SIZE;
+ else
+ element_size = vtable->klass->sizes.element_size;
+
+ size_without_bounds = size = MONO_SIZEOF_MONO_ARRAY + element_size * mono_array_length_fast (array);
+
+ if (G_UNLIKELY (array->bounds)) {
+ size += sizeof (mono_array_size_t) - 1;
+ size &= ~(sizeof (mono_array_size_t) - 1);
+ size += sizeof (MonoArrayBounds) * vtable->klass->rank;
+ }
+
+ if (bounds_size)
+ *bounds_size = size - size_without_bounds;
+ return size;
+}
+
#define SGEN_CLIENT_OBJECT_HEADER_SIZE (sizeof (GCObject))
#define SGEN_CLIENT_MINIMUM_OBJECT_SIZE SGEN_CLIENT_OBJECT_HEADER_SIZE
if (klass == mono_defaults.string_class) {
return G_STRUCT_OFFSET (MonoString, chars) + 2 * mono_string_length_fast ((MonoString*) o) + 2;
} else if (klass->rank) {
- MonoArray *array = (MonoArray*)o;
- size_t size = sizeof (MonoArray) + klass->sizes.element_size * mono_array_length_fast (array);
- if (G_UNLIKELY (array->bounds)) {
- size += sizeof (mono_array_size_t) - 1;
- size &= ~(sizeof (mono_array_size_t) - 1);
- size += sizeof (MonoArrayBounds) * klass->rank;
- }
- return size;
+ return sgen_mono_array_size (vtable, (MonoArray*)o, NULL, 0);
} else {
/* from a created object: the class must be inited already */
return klass->instance_size;
} else if (descr == SGEN_DESC_STRING) {
return G_STRUCT_OFFSET (MonoString, chars) + 2 * mono_string_length_fast ((MonoString*) o) + 2;
} else if (type == DESC_TYPE_VECTOR) {
- int element_size = ((descr) >> VECTOR_ELSIZE_SHIFT) & MAX_ELEMENT_SIZE;
- MonoArray *array = (MonoArray*)o;
- size_t size = sizeof (MonoArray) + element_size * mono_array_length_fast (array);
-
- /*
- * Non-vector arrays with a single dimension whose lower bound is zero are
- * allocated without bounds.
- */
- if ((descr & VECTOR_KIND_ARRAY) && array->bounds) {
- size += sizeof (mono_array_size_t) - 1;
- size &= ~(sizeof (mono_array_size_t) - 1);
- size += sizeof (MonoArrayBounds) * ((MonoVTable*)vtable)->klass->rank;
- }
- return size;
+ return sgen_mono_array_size (vtable, (MonoArray*)o, NULL, descr);
}
return sgen_client_slow_object_get_size (vtable, o);
static gboolean G_GNUC_UNUSED
sgen_client_object_has_critical_finalizer (GCObject *obj)
{
- MonoClass *class;
+ MonoClass *klass;
if (!mono_defaults.critical_finalizer_object)
return FALSE;
- class = SGEN_LOAD_VTABLE (obj)->klass;
+ klass = SGEN_LOAD_VTABLE (obj)->klass;
- return mono_class_has_parent_fast (class, mono_defaults.critical_finalizer_object);
+ return mono_class_has_parent_fast (klass, mono_defaults.critical_finalizer_object);
}
const char* sgen_client_vtable_get_namespace (GCVTable vtable);
}
static void G_GNUC_UNUSED
-sgen_client_binary_protocol_block_set_state (gpointer addr, size_t size, int old, int new)
+sgen_client_binary_protocol_block_set_state (gpointer addr, size_t size, int old, int new_)
{
}
#endif
}
+static void G_GNUC_UNUSED
+sgen_client_binary_protocol_mod_union_remset (gpointer obj, gpointer ptr, gpointer value, gpointer value_vtable)
+{
+}
+
static void G_GNUC_UNUSED
sgen_client_binary_protocol_ptr_update (gpointer ptr, gpointer old_value, gpointer new_value, gpointer vtable, size_t size)
{
}
static void G_GNUC_UNUSED
-sgen_client_binary_protocol_dislink_update (gpointer link, gpointer obj, gboolean track, gboolean staged)
+sgen_client_binary_protocol_dislink_add (gpointer link, gpointer obj, gboolean track)
+{
+}
+
+static void G_GNUC_UNUSED
+sgen_client_binary_protocol_dislink_update (gpointer link, gpointer obj, gboolean track)
{
#ifdef ENABLE_DTRACE
if (MONO_GC_WEAK_UPDATE_ENABLED ()) {
}
static void G_GNUC_UNUSED
-sgen_client_binary_protocol_dislink_update_staged (gpointer link, gpointer obj, gboolean track, int index)
-{
-}
-
-static void G_GNUC_UNUSED
-sgen_client_binary_protocol_dislink_process_staged (gpointer link, gpointer obj, int index)
+sgen_client_binary_protocol_dislink_remove (gpointer link, gboolean track)
{
}
typedef MonoSemType SgenSemaphore;
-#define SGEN_SEMAPHORE_INIT(sem,initial) MONO_SEM_INIT ((sem), (initial))
-#define SGEN_SEMAPHORE_POST(sem) MONO_SEM_POST ((sem))
-#define SGEN_SEMAPHORE_WAIT(sem) MONO_SEM_WAIT ((sem))
+#define SGEN_SEMAPHORE_INIT(sem,initial) mono_os_sem_init ((sem), (initial))
+#define SGEN_SEMAPHORE_POST(sem) mono_os_sem_post ((sem))
+#define SGEN_SEMAPHORE_WAIT(sem) mono_os_sem_wait ((sem), MONO_SEM_FLAGS_NONE)
gboolean sgen_has_critical_method (void);
gboolean sgen_is_critical_method (MonoMethod *method);
gboolean sgen_has_managed_allocator (void);
void sgen_scan_for_registered_roots_in_domain (MonoDomain *domain, int root_type);
+void sgen_null_links_for_domain (MonoDomain *domain);
#endif