#include "vmcore/loader.h"
#include "vmcore/options.h"
+#include "vmcore/rt-timing.h"
/* global variables ***********************************************************/
}
-void *heap_alloc_uncollectable(u4 bytelength)
+void *heap_alloc_uncollectable(u4 size)
{
void *p;
- p = GC_MALLOC_UNCOLLECTABLE(bytelength);
+ p = GC_MALLOC_UNCOLLECTABLE(size);
/* clear allocated memory region */
- MSET(p, 0, u1, bytelength);
+ MSET(p, 0, u1, size);
return p;
}
-/* heap_allocate ***************************************************************
+/* heap_alloc ******************************************************************
Allocates memory on the Java heap.
*******************************************************************************/
-void *heap_allocate(u4 bytelength, u4 references, methodinfo *finalizer)
+void *heap_alloc(u4 size, u4 references, methodinfo *finalizer, bool collect)
{
void *p;
+#if defined(ENABLE_RT_TIMING)
+ struct timespec time_start, time_end;
+#endif
+
+ RT_TIMING_GET_TIME(time_start);
/* We can't use a bool here for references, as it's passed as a
bitmask in builtin_new. Thus we check for != 0. */
if (references != 0)
- p = GC_MALLOC(bytelength);
+ p = GC_MALLOC(size);
else
- p = GC_MALLOC_ATOMIC(bytelength);
+ p = GC_MALLOC_ATOMIC(size);
if (p == NULL)
return NULL;
/* clear allocated memory region */
- MSET(p, 0, u1, bytelength);
+ MSET(p, 0, u1, size);
+
+ RT_TIMING_GET_TIME(time_end);
+ RT_TIMING_TIME_DIFF(time_start, time_end, RT_TIMING_GC_ALLOC);
return p;
}