probe gc__global__remset__add (uintptr_t ref_addr, uintptr_t obj_addr, uintptr_t size, char *ns_name, char *class_name);
probe gc__obj__cemented (uintptr_t addr, uintptr_t size, char *ns_name, char *class_name);
+
+ probe gc__internal__alloc (uintptr_t addr, int type, uintptr_t size);
+ probe gc__internal__dealloc (uintptr_t add, uintptr_t size, int type);
};
#pragma D attributes Evolving/Evolving/Common provider mono provider
p = sgen_alloc_os_memory (size, SGEN_ALLOC_INTERNAL | SGEN_ALLOC_ACTIVATE, NULL);
if (!p)
sgen_assert_memory_alloc (NULL, size, description_for_type (type));
- return p;
- }
+ } else {
+ index = index_for_size (size);
- index = index_for_size (size);
+ p = mono_lock_free_alloc (&allocators [index]);
+ if (!p)
+ sgen_assert_memory_alloc (NULL, size, description_for_type (type));
+ memset (p, 0, size);
+ }
- p = mono_lock_free_alloc (&allocators [index]);
- if (!p)
- sgen_assert_memory_alloc (NULL, size, description_for_type (type));
- memset (p, 0, size);
+ MONO_GC_INTERNAL_ALLOC (p, size, type);
return p;
}
if (!addr)
return;
- if (size > allocator_sizes [NUM_ALLOCATORS - 1]) {
+ if (size > allocator_sizes [NUM_ALLOCATORS - 1])
sgen_free_os_memory (addr, size, SGEN_ALLOC_INTERNAL);
- return;
- }
+ else
+ mono_lock_free_free (addr);
- mono_lock_free_free (addr);
+ MONO_GC_INTERNAL_DEALLOC (addr, size, type);
}
void*
sgen_alloc_internal (int type)
{
int index = fixed_type_allocator_indexes [type];
+ int size = allocator_sizes [index];
void *p;
g_assert (index >= 0 && index < NUM_ALLOCATORS);
p = mono_lock_free_alloc (&allocators [index]);
- memset (p, 0, allocator_sizes [index]);
+ memset (p, 0, size);
+
+ MONO_GC_INTERNAL_ALLOC (p, size, type);
+
return p;
}
g_assert (index >= 0 && index < NUM_ALLOCATORS);
mono_lock_free_free (addr);
+
+ if (MONO_GC_INTERNAL_DEALLOC_ENABLED ()) {
+ int size = allocator_sizes [index];
+ MONO_GC_INTERNAL_DEALLOC (addr, size, type);
+ }
}
void
#define MONO_GC_OBJ_CEMENTED(addr,size,ns_name,class_name)
#define MONO_GC_OBJ_CEMENTED_ENABLED() (0)
+
+#define MONO_GC_INTERNAL_ALLOC(addr,size)
+#define MONO_GC_INTERNAL_ALLOC_ENABLED() (0)
+
+#define MONO_GC_INTERNAL_DEALLOC(addr,size)
+#define MONO_GC_INTERNAL_DEALLOC_ENABLED() (0)
+
#endif
#endif