Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/mono.d3
-rw-r--r--mono/metadata/sgen-internal.c34
-rw-r--r--mono/utils/dtrace.h7
3 files changed, 32 insertions, 12 deletions
diff --git a/data/mono.d b/data/mono.d
index e74ff82054f..0933e3b7645 100644
--- a/data/mono.d
+++ b/data/mono.d
@@ -74,6 +74,9 @@ provider mono {
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
diff --git a/mono/metadata/sgen-internal.c b/mono/metadata/sgen-internal.c
index 2d4c108ea75..ad97e0d0892 100644
--- a/mono/metadata/sgen-internal.c
+++ b/mono/metadata/sgen-internal.c
@@ -126,15 +126,16 @@ sgen_alloc_internal_dynamic (size_t size, int type, gboolean assert_on_failure)
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;
}
@@ -144,22 +145,26 @@ sgen_free_internal_dynamic (void *addr, size_t size, int type)
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;
}
@@ -175,6 +180,11 @@ sgen_free_internal (void *addr, int type)
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
diff --git a/mono/utils/dtrace.h b/mono/utils/dtrace.h
index feb356f870f..2cee8fa483b 100644
--- a/mono/utils/dtrace.h
+++ b/mono/utils/dtrace.h
@@ -185,6 +185,13 @@
#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