#include "metadata/object-internals.h"
typedef MonoObject GCObject;
-typedef MonoVTable GCVTable;
+typedef MonoVTable* GCVTable;
-/* FIXME: This should return a GCVTable* and be a function. */
+/* FIXME: This should return a GCVTable and be a function. */
#define SGEN_LOAD_VTABLE_UNCHECKED(obj) ((void*)(((GCObject*)(obj))->vtable))
static inline mword
-sgen_vtable_get_descriptor (GCVTable *vtable)
+sgen_vtable_get_descriptor (GCVTable vtable)
{
return (mword)vtable->gc_descr;
}
static mword /*__attribute__((noinline)) not sure if this hint is a good idea*/
-sgen_client_slow_object_get_size (GCVTable *vtable, GCObject* o)
+sgen_client_slow_object_get_size (GCVTable vtable, GCObject* o)
{
MonoClass *klass = ((MonoVTable*)vtable)->klass;
* collector.
*/
static MONO_NEVER_INLINE mword
-sgen_client_par_object_get_size (GCVTable *vtable, GCObject* o)
+sgen_client_par_object_get_size (GCVTable vtable, GCObject* o)
{
mword descr = sgen_vtable_get_descriptor (vtable);
mword type = descr & DESC_TYPE_MASK;
#define SGEN_CLIENT_MINIMUM_OBJECT_SIZE SGEN_CLIENT_OBJECT_HEADER_SIZE
static MONO_ALWAYS_INLINE size_t G_GNUC_UNUSED
-sgen_client_array_element_size (GCVTable *gc_vtable)
+sgen_client_array_element_size (GCVTable gc_vtable)
{
MonoVTable *vt = (MonoVTable*)gc_vtable;
return mono_array_element_size (vt->klass);
}
static MONO_ALWAYS_INLINE void G_GNUC_UNUSED
-sgen_client_pre_copy_checks (char *destination, GCVTable *gc_vtable, void *obj, mword objsize)
+sgen_client_pre_copy_checks (char *destination, GCVTable gc_vtable, void *obj, mword objsize)
{
MonoVTable *vt = (MonoVTable*)gc_vtable;
SGEN_ASSERT (9, vt->klass->inited, "vtable %p for class %s:%s was not initialized", vt, vt->klass->name_space, vt->klass->name);
}
static MONO_ALWAYS_INLINE void G_GNUC_UNUSED
-sgen_client_update_copied_object (char *destination, GCVTable *gc_vtable, void *obj, mword objsize)
+sgen_client_update_copied_object (char *destination, GCVTable gc_vtable, void *obj, mword objsize)
{
MonoVTable *vt = (MonoVTable*)gc_vtable;
if (G_UNLIKELY (vt->rank && ((MonoArray*)obj)->bounds)) {
return mono_class_has_parent_fast (class, mono_defaults.critical_finalizer_object);
}
-const char* sgen_client_vtable_get_namespace (GCVTable *vtable);
-const char* sgen_client_vtable_get_name (GCVTable *vtable);
+const char* sgen_client_vtable_get_namespace (GCVTable vtable);
+const char* sgen_client_vtable_get_name (GCVTable vtable);
static gboolean G_GNUC_UNUSED
sgen_client_bridge_need_processing (void)
{
#ifdef ENABLE_DTRACE
if (MONO_GC_WEAK_UPDATE_ENABLED ()) {
- GCVTable *vt = obj ? (GCVTable*)SGEN_LOAD_VTABLE (obj) : NULL;
+ GCVTable vt = obj ? (GCVTable)SGEN_LOAD_VTABLE (obj) : NULL;
MONO_GC_WEAK_UPDATE ((mword)link,
(mword)obj,
obj ? (mword)sgen_safe_object_get_size (obj) : (mword)0,
*/
/* Vtable of the objects used to fill out nursery fragments before a collection */
-static GCVTable *array_fill_vtable;
+static GCVTable array_fill_vtable;
-static GCVTable*
+static GCVTable
get_array_fill_vtable (void)
{
if (!array_fill_vtable) {
vtable->gc_descr = mono_gc_make_descr_for_array (TRUE, &bmap, 0, 1);
vtable->rank = 1;
- array_fill_vtable = (GCVTable*)vtable;
+ array_fill_vtable = vtable;
}
return array_fill_vtable;
}
#ifdef ENABLE_DTRACE
if (G_UNLIKELY (MONO_GC_FINALIZE_ENQUEUE_ENABLED ())) {
int gen = sgen_ptr_in_nursery (obj) ? GENERATION_NURSERY : GENERATION_OLD;
- GCVTable *vt = (GCVTable*)SGEN_LOAD_VTABLE (obj);
+ GCVTable vt = (GCVTable)SGEN_LOAD_VTABLE (obj);
MONO_GC_FINALIZE_ENQUEUE ((mword)obj, sgen_safe_object_get_size (obj),
sgen_client_vtable_get_namespace (vt), sgen_client_vtable_get_name (vt), gen,
sgen_client_object_has_critical_finalizer (obj));
MonoVTable *vt = (MonoVTable*)SGEN_LOAD_VTABLE (obj);
MonoClass *klass = vt->klass;
- SGEN_ASSERT (0, SGEN_VTABLE_HAS_REFERENCES ((GCVTable*)vt), "Why would we ever call this on reference-free objects?");
+ SGEN_ASSERT (0, SGEN_VTABLE_HAS_REFERENCES (vt), "Why would we ever call this on reference-free objects?");
if (vt->rank) {
guint8 *card_data, *card_base;
#ifndef DISABLE_CRITICAL_REGION
ENTER_CRITICAL_REGION;
- arr = sgen_try_alloc_obj_nolock ((GCVTable*)vtable, size);
+ arr = sgen_try_alloc_obj_nolock (vtable, size);
if (arr) {
/*This doesn't require fencing since EXIT_CRITICAL_REGION already does it for us*/
arr->max_length = (mono_array_size_t)max_length;
LOCK_GC;
- arr = sgen_alloc_obj_nolock ((GCVTable*)vtable, size);
+ arr = sgen_alloc_obj_nolock (vtable, size);
if (G_UNLIKELY (!arr)) {
UNLOCK_GC;
return mono_gc_out_of_memory (size);
if (G_UNLIKELY (alloc_events))
mono_profiler_allocation (&arr->obj);
- SGEN_ASSERT (6, SGEN_ALIGN_UP (size) == SGEN_ALIGN_UP (sgen_client_par_object_get_size ((GCVTable*)vtable, (GCObject*)arr)), "Vector has incorrect size.");
+ SGEN_ASSERT (6, SGEN_ALIGN_UP (size) == SGEN_ALIGN_UP (sgen_client_par_object_get_size (vtable, (GCObject*)arr)), "Vector has incorrect size.");
return arr;
}
#ifndef DISABLE_CRITICAL_REGION
ENTER_CRITICAL_REGION;
- arr = sgen_try_alloc_obj_nolock ((GCVTable*)vtable, size);
+ arr = sgen_try_alloc_obj_nolock (vtable, size);
if (arr) {
/*This doesn't require fencing since EXIT_CRITICAL_REGION already does it for us*/
arr->max_length = (mono_array_size_t)max_length;
LOCK_GC;
- arr = sgen_alloc_obj_nolock ((GCVTable*)vtable, size);
+ arr = sgen_alloc_obj_nolock (vtable, size);
if (G_UNLIKELY (!arr)) {
UNLOCK_GC;
return mono_gc_out_of_memory (size);
if (G_UNLIKELY (alloc_events))
mono_profiler_allocation (&arr->obj);
- SGEN_ASSERT (6, SGEN_ALIGN_UP (size) == SGEN_ALIGN_UP (sgen_client_par_object_get_size ((GCVTable*)vtable, (GCObject*)arr)), "Array has incorrect size.");
+ SGEN_ASSERT (6, SGEN_ALIGN_UP (size) == SGEN_ALIGN_UP (sgen_client_par_object_get_size (vtable, (GCObject*)arr)), "Array has incorrect size.");
return arr;
}
#ifndef DISABLE_CRITICAL_REGION
ENTER_CRITICAL_REGION;
- str = sgen_try_alloc_obj_nolock ((GCVTable*)vtable, size);
+ str = sgen_try_alloc_obj_nolock (vtable, size);
if (str) {
/*This doesn't require fencing since EXIT_CRITICAL_REGION already does it for us*/
str->length = len;
LOCK_GC;
- str = sgen_alloc_obj_nolock ((GCVTable*)vtable, size);
+ str = sgen_alloc_obj_nolock (vtable, size);
if (G_UNLIKELY (!str)) {
UNLOCK_GC;
return mono_gc_out_of_memory (size);
}
gboolean
-sgen_client_vtable_is_inited (GCVTable *gc_vtable)
+sgen_client_vtable_is_inited (MonoVTable *vt)
{
- MonoVTable *vt = (MonoVTable*)gc_vtable;
return vt->klass->inited;
}
const char*
-sgen_client_vtable_get_namespace (GCVTable *gc_vtable)
+sgen_client_vtable_get_namespace (MonoVTable *vt)
{
- MonoVTable *vt = (MonoVTable*)gc_vtable;
return vt->klass->name_space;
}
const char*
-sgen_client_vtable_get_name (GCVTable *gc_vtable)
+sgen_client_vtable_get_name (MonoVTable *vt)
{
- MonoVTable *vt = (MonoVTable*)gc_vtable;
return vt->klass->name;
}
if (bridge_accounting_enabled) {
for (i = 0; i < num_sccs; ++i) {
for (j = 0; j < api_sccs [i]->num_objs; ++j) {
- GCVTable *vtable = SGEN_LOAD_VTABLE (api_sccs [i]->objs [j]);
+ GCVTable vtable = SGEN_LOAD_VTABLE (api_sccs [i]->objs [j]);
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC,
"OBJECT %s (%p) SCC [%d] %s",
sgen_client_vtable_get_namespace (vtable), sgen_client_vtable_get_name (vtable), api_sccs [i]->objs [j],
if (bridge_accounting_enabled) {
for (i = 0; i < num_sccs; ++i) {
for (j = 0; j < api_sccs [i]->num_objs; ++j) {
- GCVTable *vtable = SGEN_LOAD_VTABLE (api_sccs [i]->objs [j]);
+ GCVTable vtable = SGEN_LOAD_VTABLE (api_sccs [i]->objs [j]);
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC,
"OBJECT %s.%s (%p) SCC [%d] %s",
sgen_client_vtable_get_namespace (vtable), sgen_client_vtable_get_name (vtable), api_sccs [i]->objs [j],
static const char*
safe_name_bridge (GCObject *obj)
{
- GCVTable *vt = (GCVTable*)SGEN_LOAD_VTABLE (obj);
+ GCVTable vt = (GCVTable)SGEN_LOAD_VTABLE (obj);
return vt->klass->name;
}
#endif
static void*
-alloc_degraded (GCVTable *vtable, size_t size, gboolean for_mature)
+alloc_degraded (GCVTable vtable, size_t size, gboolean for_mature)
{
void *p;
* a search for the pinned object in SGEN_SCAN_START_SIZE chunks.
*/
void*
-sgen_alloc_obj_nolock (GCVTable *vtable, size_t size)
+sgen_alloc_obj_nolock (GCVTable vtable, size_t size)
{
/* FIXME: handle OOM */
void **p;
}
void*
-sgen_try_alloc_obj_nolock (GCVTable *vtable, size_t size)
+sgen_try_alloc_obj_nolock (GCVTable vtable, size_t size)
{
void **p;
char *new_next;
}
void*
-sgen_alloc_obj (GCVTable *vtable, size_t size)
+sgen_alloc_obj (GCVTable vtable, size_t size)
{
void *res;
TLAB_ACCESS_INIT;
}
ENTER_CRITICAL_REGION;
- res = sgen_try_alloc_obj_nolock ((GCVTable*)vtable, size);
+ res = sgen_try_alloc_obj_nolock (vtable, size);
if (res) {
EXIT_CRITICAL_REGION;
return res;
EXIT_CRITICAL_REGION;
#endif
LOCK_GC;
- res = sgen_alloc_obj_nolock ((GCVTable*)vtable, size);
+ res = sgen_alloc_obj_nolock (vtable, size);
UNLOCK_GC;
if (G_UNLIKELY (!res))
sgen_client_out_of_memory (size);
* We may want to explicitly free these objects.
*/
void*
-sgen_alloc_obj_pinned (GCVTable *vtable, size_t size)
+sgen_alloc_obj_pinned (GCVTable vtable, size_t size)
{
void **p;
if (size > SGEN_MAX_SMALL_OBJ_SIZE) {
/* large objects are always pinned anyway */
- p = sgen_los_alloc_large_inner ((GCVTable*)vtable, size);
+ p = sgen_los_alloc_large_inner (vtable, size);
} else {
SGEN_ASSERT (9, sgen_client_vtable_is_inited (vtable), "class %s:%s is not initialized", sgen_client_vtable_get_namespace (vtable), sgen_client_vtable_get_name (vtable));
- p = major_collector.alloc_small_pinned_obj ((GCVTable*)vtable, size, SGEN_VTABLE_HAS_REFERENCES ((GCVTable*)vtable));
+ p = major_collector.alloc_small_pinned_obj (vtable, size, SGEN_VTABLE_HAS_REFERENCES (vtable));
}
if (G_LIKELY (p)) {
SGEN_LOG (6, "Allocated pinned object %p, vtable: %p (%s), size: %zd", p, vtable, sgen_client_vtable_get_name (vtable), size);
}
void*
-sgen_alloc_obj_mature (GCVTable *vtable, size_t size)
+sgen_alloc_obj_mature (GCVTable vtable, size_t size)
{
void *res;
size = ALIGN_UP (size);
LOCK_GC;
- res = alloc_degraded ((GCVTable*)vtable, size, TRUE);
+ res = alloc_degraded (vtable, size, TRUE);
UNLOCK_GC;
return res;
* The slow path for getting an object's size. We're passing in the vtable because we've
* already fetched it.
*/
-mword sgen_client_slow_object_get_size (GCVTable *vtable, GCObject* o);
+mword sgen_client_slow_object_get_size (GCVTable vtable, GCObject* o);
/*
* Fill the given range with a dummy object. If the range is too short to be filled with an
/*
* Only used for debugging. `sgen_client_vtable_get_namespace()` may return NULL.
*/
-gboolean sgen_client_vtable_is_inited (GCVTable *vtable);
-const char* sgen_client_vtable_get_namespace (GCVTable *vtable);
-const char* sgen_client_vtable_get_name (GCVTable *vtable);
+gboolean sgen_client_vtable_is_inited (GCVTable vtable);
+const char* sgen_client_vtable_get_namespace (GCVTable vtable);
+const char* sgen_client_vtable_get_name (GCVTable vtable);
/*
* Called before starting collections. The world is already stopped. No action is
* anymore, which is the case in the parallel collector.
*/
static MONO_ALWAYS_INLINE void
-par_copy_object_no_checks (char *destination, GCVTable *vt, void *obj, mword objsize, SgenGrayQueue *queue)
+par_copy_object_no_checks (char *destination, GCVTable vt, void *obj, mword objsize, SgenGrayQueue *queue)
{
sgen_client_pre_copy_checks (destination, vt, obj, objsize);
binary_protocol_copy (obj, destination, vt, objsize);
static MONO_NEVER_INLINE void*
copy_object_no_checks (void *obj, SgenGrayQueue *queue)
{
- GCVTable *vt = SGEN_LOAD_VTABLE_UNCHECKED (obj);
+ GCVTable vt = SGEN_LOAD_VTABLE_UNCHECKED (obj);
gboolean has_references = SGEN_VTABLE_HAS_REFERENCES (vt);
mword objsize = SGEN_ALIGN_UP (sgen_client_par_object_get_size (vt, obj));
/* FIXME: Does this not mark the newly allocated object? */
static void
describe_pointer (char *ptr, gboolean need_setup)
{
- GCVTable *vtable;
+ GCVTable vtable;
mword desc;
int type;
char *start;
if (!start)
return;
ptr = start;
- vtable = (GCVTable*)LOAD_VTABLE (ptr);
+ vtable = (GCVTable)LOAD_VTABLE (ptr);
} else {
if (sgen_ptr_is_in_los (ptr, &start)) {
if (ptr == start)
printf ("Pointer is at offset 0x%x of object %p in LOS space.\n", (int)(ptr - start), start);
ptr = start;
mono_sgen_los_describe_pointer (ptr);
- vtable = (GCVTable*)LOAD_VTABLE (ptr);
+ vtable = (GCVTable)LOAD_VTABLE (ptr);
} else if (major_collector.ptr_is_in_non_pinned_space (ptr, &start)) {
if (ptr == start)
printf ("Pointer is the start of object %p in oldspace.\n", start);
printf ("Pointer inside oldspace.\n");
if (start)
ptr = start;
- vtable = (GCVTable*)major_collector.describe_pointer (ptr);
+ vtable = (GCVTable)major_collector.describe_pointer (ptr);
} else if (major_collector.obj_is_from_pinned_alloc (ptr)) {
// FIXME: Handle pointers to the inside of objects
printf ("Pointer is inside a pinned chunk.\n");
- vtable = (GCVTable*)LOAD_VTABLE (ptr);
+ vtable = (GCVTable)LOAD_VTABLE (ptr);
} else {
printf ("Pointer unknown.\n");
return;
}
printf ("Class: %s.%s\n", sgen_client_vtable_get_namespace (vtable), sgen_client_vtable_get_name (vtable));
- desc = sgen_vtable_get_descriptor ((GCVTable*)vtable);
+ desc = sgen_vtable_get_descriptor (vtable);
printf ("Descriptor: %lx\n", (long)desc);
type = desc & DESC_TYPE_MASK;
#define HANDLE_PTR(ptr,obj) do { \
if (*(ptr) && sgen_ptr_in_nursery ((char*)*(ptr))) { \
if (!sgen_get_remset ()->find_address ((char*)(ptr)) && !sgen_cement_lookup (*(ptr))) { \
- GCVTable *__vt = SGEN_LOAD_VTABLE ((obj)); \
+ GCVTable __vt = SGEN_LOAD_VTABLE ((obj)); \
SGEN_LOG (0, "Oldspace->newspace reference %p at offset %zd in object %p (%s.%s) not found in remsets.", *(ptr), (char*)(ptr) - (char*)(obj), (obj), sgen_client_vtable_get_namespace (__vt), sgen_client_vtable_get_name (__vt)); \
binary_protocol_missing_remset ((obj), __vt, (int) ((char*)(ptr) - (char*)(obj)), *(ptr), (gpointer)LOAD_VTABLE(*(ptr)), object_is_pinned (*(ptr))); \
if (!object_is_pinned (*(ptr))) \
static void
check_consistency_callback (char *start, size_t size, void *dummy)
{
- GCVTable *vt = (GCVTable*)LOAD_VTABLE (start);
- mword desc = sgen_vtable_get_descriptor ((GCVTable*)vt);
+ GCVTable vt = (GCVTable)LOAD_VTABLE (start);
+ mword desc = sgen_vtable_get_descriptor (vt);
SGEN_LOG (8, "Scanning object %p, vtable: %p (%s)", start, vt, sgen_client_vtable_get_name (vt));
#include "sgen-scan-object.h"
#define HANDLE_PTR(ptr,obj) do { \
if (*(ptr) && !sgen_ptr_in_nursery ((char*)*(ptr)) && !is_major_or_los_object_marked ((char*)*(ptr))) { \
if (!sgen_get_remset ()->find_address_with_cards (start, cards, (char*)(ptr))) { \
- GCVTable *__vt = SGEN_LOAD_VTABLE ((obj)); \
+ GCVTable __vt = SGEN_LOAD_VTABLE ((obj)); \
SGEN_LOG (0, "major->major reference %p at offset %zd in object %p (%s.%s) not found in remsets.", *(ptr), (char*)(ptr) - (char*)(obj), (obj), sgen_client_vtable_get_namespace (__vt), sgen_client_vtable_get_name (__vt)); \
binary_protocol_missing_remset ((obj), __vt, (int) ((char*)(ptr) - (char*)(obj)), *(ptr), (gpointer)LOAD_VTABLE(*(ptr)), object_is_pinned (*(ptr))); \
missing_remsets = TRUE; \
check_mod_union_callback (char *start, size_t size, void *dummy)
{
gboolean in_los = (gboolean) (size_t) dummy;
- GCVTable *vt = (GCVTable*)LOAD_VTABLE (start);
- mword desc = sgen_vtable_get_descriptor ((GCVTable*)vt);
+ GCVTable vt = (GCVTable)LOAD_VTABLE (start);
+ mword desc = sgen_vtable_get_descriptor (vt);
guint8 *cards;
SGEN_LOG (8, "Scanning object %p, vtable: %p (%s)", start, vt, sgen_client_vtable_get_name (vt));
bad_pointer_spew (char *obj, char **slot)
{
char *ptr = *slot;
- GCVTable *vtable = (GCVTable*)LOAD_VTABLE (obj);
+ GCVTable vtable = (GCVTable)LOAD_VTABLE (obj);
SGEN_LOG (0, "Invalid object pointer %p at offset %zd in object %p (%s.%s):", ptr,
(char*)slot - obj,
missing_remset_spew (char *obj, char **slot)
{
char *ptr = *slot;
- GCVTable *vtable = (GCVTable*)LOAD_VTABLE (obj);
+ GCVTable vtable = (GCVTable)LOAD_VTABLE (obj);
SGEN_LOG (0, "Oldspace->newspace reference %p at offset %zd in object %p (%s.%s) not found in remsets.",
ptr, (char*)slot - obj, obj,
verify_scan_starts (cur, cur + size);
is_array_fill = sgen_client_object_is_array_fill ((GCObject*)cur);
if (do_dump_nursery_content) {
- GCVTable *vtable = SGEN_LOAD_VTABLE (cur);
+ GCVTable vtable = SGEN_LOAD_VTABLE (cur);
if (cur > hole_start)
SGEN_LOG (0, "HOLE [%p %p %d]", hole_start, cur, (int)(cur - hole_start));
SGEN_LOG (0, "OBJ [%p %p %d %d %s.%s %d]", cur, cur + size, (int)size, (int)ss,
#undef HANDLE_PTR
#define HANDLE_PTR(ptr,obj) do { \
if ((GCObject*)*(ptr) == key) { \
- GCVTable *vtable = SGEN_LOAD_VTABLE (*(ptr)); \
+ GCVTable vtable = SGEN_LOAD_VTABLE (*(ptr)); \
g_print ("found ref to %p in object %p (%s.%s) at offset %zd\n", \
key, (obj), sgen_client_vtable_get_namespace (vtable), sgen_client_vtable_get_name (vtable), ((char*)(ptr) - (char*)(obj))); \
} \
int i;
for (i = 0; i < size / sizeof (mword); ++i) {
if (words [i] == (mword)key) {
- GCVTable *vtable = SGEN_LOAD_VTABLE (start);
+ GCVTable vtable = SGEN_LOAD_VTABLE (start);
g_print ("found possible ref to %p in object %p (%s.%s) at offset %zd\n",
key, start, sgen_client_vtable_get_namespace (vtable), sgen_client_vtable_get_name (vtable), i * sizeof (mword));
}
{
MonoVTable *vt = (MonoVTable*)SGEN_LOAD_VTABLE (start);
MonoDomain *domain = vt->domain;
- mword desc = sgen_vtable_get_descriptor ((GCVTable*)vt);
+ mword desc = sgen_vtable_get_descriptor (vt);
#include "sgen-scan-object.h"
}
while (start < end) {
guint size;
- //GCVTable *vt;
+ //GCVTable vt;
//MonoClass *class;
if (!*(void**)start) {
if (!occ_start)
occ_start = start;
- //vt = (GCVTable*)SGEN_LOAD_VTABLE (start);
+ //vt = (GCVTable)SGEN_LOAD_VTABLE (start);
//class = vt->klass;
size = SGEN_ALIGN_UP (safe_object_get_size ((GCObject*) start));
/* this one is untested */
#define OBJ_COMPLEX_ARR_FOREACH_PTR(desc,obj) do { \
/* there are pointers */ \
- GCVTable *vt = (GCVTable*)SGEN_LOAD_VTABLE (obj); \
+ GCVTable vt = (GCVTable)SGEN_LOAD_VTABLE (obj); \
gsize *mbitmap_data = sgen_get_complex_descriptor ((desc)); \
gsize mbwords = (*mbitmap_data++) - 1; \
gsize el_size = sgen_client_array_element_size (vt); \
if (user_data) {
if (sgen_hash_table_replace (hash_table, obj, NULL, NULL)) {
- GCVTable *vt = SGEN_LOAD_VTABLE_UNCHECKED (obj);
+ GCVTable vt = SGEN_LOAD_VTABLE_UNCHECKED (obj);
SGEN_LOG (5, "Added finalizer for object: %p (%s) (%d) to %s table", obj, sgen_client_vtable_get_name (vt), hash_table->num_entries, sgen_generation_name (generation));
}
} else {
if (sgen_hash_table_remove (hash_table, obj, NULL)) {
- GCVTable *vt = SGEN_LOAD_VTABLE_UNCHECKED (obj);
+ GCVTable vt = SGEN_LOAD_VTABLE_UNCHECKED (obj);
SGEN_LOG (5, "Removed finalizer for object: %p (%s) (%d)", obj, sgen_client_vtable_get_name (vt), hash_table->num_entries);
}
}
typedef struct {
gboolean is_split;
- char* (*alloc_for_promotion) (GCVTable *vtable, char *obj, size_t objsize, gboolean has_references);
+ char* (*alloc_for_promotion) (GCVTable vtable, char *obj, size_t objsize, gboolean has_references);
SgenObjectOperations serial_ops;
void* (*alloc_heap) (mword nursery_size, mword nursery_align, int nursery_bits);
gboolean (*is_object_live) (char *obj);
- void* (*alloc_small_pinned_obj) (GCVTable *vtable, size_t size, gboolean has_references);
- void* (*alloc_degraded) (GCVTable *vtable, size_t size);
+ void* (*alloc_small_pinned_obj) (GCVTable vtable, size_t size, gboolean has_references);
+ void* (*alloc_degraded) (GCVTable vtable, size_t size);
SgenObjectOperations major_ops_serial;
SgenObjectOperations major_ops_concurrent_start;
SgenObjectOperations major_ops_concurrent;
SgenObjectOperations major_ops_concurrent_finish;
- void* (*alloc_object) (GCVTable *vtable, size_t size, gboolean has_references);
+ void* (*alloc_object) (GCVTable vtable, size_t size, gboolean has_references);
void (*free_pinned_object) (char *obj, size_t size);
/*
void (*print_gc_param_usage) (void);
void (*post_param_init) (SgenMajorCollector *collector);
gboolean (*is_valid_object) (char *object);
- GCVTable* (*describe_pointer) (char *pointer);
+ GCVTable (*describe_pointer) (char *pointer);
guint8* (*get_cardtable_mod_union_for_object) (char *object);
long long (*get_and_reset_num_major_objects_marked) (void);
void (*count_cards) (long long *num_total_cards, long long *num_marked_cards);
static inline mword
sgen_obj_get_descriptor (char *obj)
{
- GCVTable *vtable = SGEN_LOAD_VTABLE_UNCHECKED (obj);
+ GCVTable vtable = SGEN_LOAD_VTABLE_UNCHECKED (obj);
SGEN_ASSERT (9, !SGEN_POINTER_IS_TAGGED_ANY (vtable), "Object can't be tagged");
return sgen_vtable_get_descriptor (vtable);
}
static inline mword
sgen_obj_get_descriptor_safe (char *obj)
{
- GCVTable *vtable = (GCVTable*)SGEN_LOAD_VTABLE (obj);
+ GCVTable vtable = (GCVTable)SGEN_LOAD_VTABLE (obj);
return sgen_vtable_get_descriptor (vtable);
}
if ((forwarded = SGEN_OBJECT_IS_FORWARDED (obj)))
obj = (GCObject*)forwarded;
- return sgen_client_par_object_get_size ((GCVTable*)SGEN_LOAD_VTABLE (obj), obj);
+ return sgen_client_par_object_get_size ((GCVTable)SGEN_LOAD_VTABLE (obj), obj);
}
static inline gboolean
obj = (GCObject*)forwarded;
}
- return sgen_client_slow_object_get_size ((GCVTable*)SGEN_LOAD_VTABLE (obj), obj);
+ return sgen_client_slow_object_get_size ((GCVTable)SGEN_LOAD_VTABLE (obj), obj);
}
#ifdef SGEN_CLIENT_HEADER
extern mword los_memory_usage;
void sgen_los_free_object (LOSObject *obj);
-void* sgen_los_alloc_large_inner (GCVTable *vtable, size_t size);
+void* sgen_los_alloc_large_inner (GCVTable vtable, size_t size);
void sgen_los_sweep (void);
gboolean sgen_ptr_is_in_los (char *ptr, char **start);
void sgen_los_iterate_objects (IterateObjectCallbackFunc cb, void *user_data);
char* sgen_alloc_for_promotion (char *obj, size_t objsize, gboolean has_references);
-void* sgen_alloc_obj_nolock (GCVTable *vtable, size_t size);
-void* sgen_try_alloc_obj_nolock (GCVTable *vtable, size_t size);
+void* sgen_alloc_obj_nolock (GCVTable vtable, size_t size);
+void* sgen_try_alloc_obj_nolock (GCVTable vtable, size_t size);
/* Threads */
void sgen_init_tlab_info (SgenThreadInfo* info);
void sgen_clear_tlabs (void);
-void* sgen_alloc_obj (GCVTable *vtable, size_t size);
-void* sgen_alloc_obj_pinned (GCVTable *vtable, size_t size);
-void* sgen_alloc_obj_mature (GCVTable *vtable, size_t size);
+void* sgen_alloc_obj (GCVTable vtable, size_t size);
+void* sgen_alloc_obj_pinned (GCVTable vtable, size_t size);
+void* sgen_alloc_obj_mature (GCVTable vtable, size_t size);
/* Debug support */
* and we avoid the memcpy overhead.
*/
void*
-sgen_los_alloc_large_inner (GCVTable *vtable, size_t size)
+sgen_los_alloc_large_inner (GCVTable vtable, size_t size)
{
LOSObject *obj = NULL;
void **vtslot;
{
LOSObject *obj;
for (obj = los_object_list; obj; obj = obj->next) {
- GCVTable *vt = (GCVTable*)SGEN_LOAD_VTABLE (obj->data);
+ GCVTable vt = (GCVTable)SGEN_LOAD_VTABLE (obj->data);
if (SGEN_VTABLE_HAS_REFERENCES (vt))
callback ((mword)obj->data, (mword)obj->size);
}
SGEN_ASSERT (9, !SGEN_VTABLE_IS_PINNED (vtable_word), "Pinned object in non-pinned block?");
- desc = sgen_vtable_get_descriptor ((GCVTable*)vtable_word);
+ desc = sgen_vtable_get_descriptor ((GCVTable)vtable_word);
type = desc & DESC_TYPE_MASK;
if (sgen_safe_object_is_small ((GCObject*)obj, type)) {
}
static void*
-alloc_obj (GCVTable *vtable, size_t size, gboolean pinned, gboolean has_references)
+alloc_obj (GCVTable vtable, size_t size, gboolean pinned, gboolean has_references)
{
int size_index = MS_BLOCK_OBJ_SIZE_INDEX (size);
MSBlockInfo * volatile * free_blocks = FREE_BLOCKS (pinned, has_references);
obj = unlink_slot_from_free_list_uncontested (free_blocks, size_index);
- *(GCVTable**)obj = vtable;
+ /* FIXME: assumes object layout */
+ *(GCVTable*)obj = vtable;
return obj;
}
static void*
-major_alloc_object (GCVTable *vtable, size_t size, gboolean has_references)
+major_alloc_object (GCVTable vtable, size_t size, gboolean has_references)
{
return alloc_obj (vtable, size, FALSE, has_references);
}
/* size is a multiple of SGEN_ALLOC_ALIGN */
static void*
-major_alloc_small_pinned_obj (GCVTable *vtable, size_t size, gboolean has_references)
+major_alloc_small_pinned_obj (GCVTable vtable, size_t size, gboolean has_references)
{
void *res;
* size is already rounded up and we hold the GC lock.
*/
static void*
-major_alloc_degraded (GCVTable *vtable, size_t size)
+major_alloc_degraded (GCVTable vtable, size_t size)
{
void *obj = alloc_obj (vtable, size, FALSE, SGEN_VTABLE_HAS_REFERENCES (vtable));
if (G_LIKELY (obj)) {
}
-static GCVTable*
+static GCVTable
major_describe_pointer (char *ptr)
{
MSBlockInfo *block;
int idx;
char *obj;
gboolean live;
- GCVTable *vtable;
+ GCVTable vtable;
int w, b;
gboolean marked;
idx = MS_BLOCK_OBJ_INDEX (ptr, block);
obj = (char*)MS_BLOCK_OBJ (block, idx);
live = MS_OBJ_ALLOCED (obj, block);
- vtable = live ? (GCVTable*)SGEN_LOAD_VTABLE (obj) : NULL;
+ vtable = live ? (GCVTable)SGEN_LOAD_VTABLE (obj) : NULL;
MS_CALC_MARK_BIT (w, b, obj);
marked = MS_MARK_BIT (block, w, b);
static void
count_nonpinned_callback (char *obj, size_t size, void *data)
{
- GCVTable *vtable = (GCVTable*)LOAD_VTABLE (obj);
+ GCVTable vtable = (GCVTable)LOAD_VTABLE (obj);
if (SGEN_VTABLE_HAS_REFERENCES (vtable))
++count_nonpinned_ref;
static void
count_pinned_callback (char *obj, size_t size, void *data)
{
- GCVTable *vtable = (GCVTable*)LOAD_VTABLE (obj);
+ GCVTable vtable = (GCVTable)LOAD_VTABLE (obj);
if (SGEN_VTABLE_HAS_REFERENCES (vtable))
++count_pinned_ref;
return;
}
if (G_UNLIKELY (SGEN_OBJECT_IS_PINNED (obj))) {
- SGEN_ASSERT (9, sgen_vtable_get_descriptor ((GCVTable*)SGEN_LOAD_VTABLE(obj)), "pinned object %p has no gc descriptor", obj);
+ SGEN_ASSERT (9, sgen_vtable_get_descriptor ((GCVTable)SGEN_LOAD_VTABLE(obj)), "pinned object %p has no gc descriptor", obj);
SGEN_LOG (9, " (pinned, no change)");
HEAVY_STAT (++stat_nursery_copy_object_failed_pinned);
return;
#ifndef SGEN_SIMPLE_NURSERY
if (sgen_nursery_is_to_space (obj)) {
- SGEN_ASSERT (9, sgen_vtable_get_descriptor ((GCVTable*)SGEN_LOAD_VTABLE(obj)), "to space object %p has no gc descriptor", obj);
+ SGEN_ASSERT (9, sgen_vtable_get_descriptor ((GCVTable)SGEN_LOAD_VTABLE(obj)), "to space object %p has no gc descriptor", obj);
SGEN_LOG (9, " (tospace, no change)");
HEAVY_STAT (++stat_nursery_copy_object_failed_to_space);
return;
return;
}
if (G_UNLIKELY (SGEN_OBJECT_IS_PINNED (obj))) {
- SGEN_ASSERT (9, sgen_vtable_get_descriptor ((GCVTable*)SGEN_LOAD_VTABLE(obj)), "pinned object %p has no gc descriptor", obj);
+ SGEN_ASSERT (9, sgen_vtable_get_descriptor ((GCVTable)SGEN_LOAD_VTABLE(obj)), "pinned object %p has no gc descriptor", obj);
SGEN_LOG (9, " (pinned, no change)");
HEAVY_STAT (++stat_nursery_copy_object_failed_pinned);
if (!sgen_ptr_in_nursery (obj_slot) && !SGEN_OBJECT_IS_CEMENTED (obj))
#ifndef SGEN_SIMPLE_NURSERY
if (sgen_nursery_is_to_space (obj)) {
/* FIXME: all of these could just use `sgen_obj_get_descriptor_safe()` */
- SGEN_ASSERT (9, sgen_vtable_get_descriptor ((GCVTable*)SGEN_LOAD_VTABLE(obj)), "to space object %p has no gc descriptor", obj);
+ SGEN_ASSERT (9, sgen_vtable_get_descriptor ((GCVTable)SGEN_LOAD_VTABLE(obj)), "to space object %p has no gc descriptor", obj);
SGEN_LOG (9, " (tospace, no change)");
HEAVY_STAT (++stat_nursery_copy_object_failed_to_space);
}
static gpointer
-lookup_vtable_entry (SgenHashTable *hash_table, GCVTable *vtable, gpointer empty_entry)
+lookup_vtable_entry (SgenHashTable *hash_table, GCVTable vtable, gpointer empty_entry)
{
char *name = g_strdup_printf ("%s.%s", sgen_client_vtable_get_namespace (vtable), sgen_client_vtable_get_name (vtable));
gpointer entry = sgen_hash_table_lookup (hash_table, name);
}
static void
-register_vtable (GCVTable *vtable, int pin_types)
+register_vtable (GCVTable vtable, int pin_types)
{
PinnedClassEntry empty_entry;
PinnedClassEntry *entry;
sgen_pointer_queue_add (&pinned_objects, obj);
if (pin_types)
- register_vtable ((GCVTable*)SGEN_LOAD_VTABLE (obj), pin_types);
+ register_vtable ((GCVTable)SGEN_LOAD_VTABLE (obj), pin_types);
}
void
return;
memset (&empty_entry, 0, sizeof (GlobalRemsetClassEntry));
- entry = lookup_vtable_entry (&global_remset_class_hash_table, (GCVTable*)SGEN_LOAD_VTABLE (obj), &empty_entry);
+ entry = lookup_vtable_entry (&global_remset_class_hash_table, (GCVTable)SGEN_LOAD_VTABLE (obj), &empty_entry);
++entry->num_remsets;
}
#include "mono/sgen/sgen-client.h"
static inline char*
-alloc_for_promotion (GCVTable *vtable, char *obj, size_t objsize, gboolean has_references)
+alloc_for_promotion (GCVTable vtable, char *obj, size_t objsize, gboolean has_references)
{
return major_collector.alloc_object (vtable, objsize, has_references);
}
}
static inline char*
-alloc_for_promotion (GCVTable *vtable, char *obj, size_t objsize, gboolean has_references)
+alloc_for_promotion (GCVTable vtable, char *obj, size_t objsize, gboolean has_references)
{
char *p = NULL;
int age;
}
/* FIXME: assumes object layout */
- *(GCVTable**)p = vtable;
+ *(GCVTable*)p = vtable;
return p;
}
static char*
-minor_alloc_for_promotion (GCVTable *vtable, char *obj, size_t objsize, gboolean has_references)
+minor_alloc_for_promotion (GCVTable vtable, char *obj, size_t objsize, gboolean has_references)
{
/*
We only need to check for a non-nursery object if we're doing a major collection.