[svn:parrot] r44065 - branches/sys_mem_reduce/include/parrot

bacek at svn.parrot.org bacek at svn.parrot.org
Wed Feb 17 07:18:23 UTC 2010


Author: bacek
Date: Wed Feb 17 07:18:22 2010
New Revision: 44065
URL: https://trac.parrot.org/parrot/changeset/44065

Log:
Add bunch of helper macros to allocate typed memory from GC.

Modified:
   branches/sys_mem_reduce/include/parrot/memory.h

Modified: branches/sys_mem_reduce/include/parrot/memory.h
==============================================================================
--- branches/sys_mem_reduce/include/parrot/memory.h	Wed Feb 17 07:18:00 2010	(r44064)
+++ branches/sys_mem_reduce/include/parrot/memory.h	Wed Feb 17 07:18:22 2010	(r44065)
@@ -37,6 +37,22 @@
 #define mem_allocate_zeroed_typed(type)     (type *)mem_sys_allocate_zeroed(sizeof (type))
 #define mem_allocate_n_zeroed_typed(n, type) (type *)mem_sys_allocate_zeroed((n) * sizeof(type))
 #define mem_realloc_n_typed(p, n, type)     (p) = (type *)mem_sys_realloc((p), (n)*sizeof(type))
+
+#define gc_mem_allocate_typed(i, type) \
+        (type *)Parrot_gc_allocate_memory_chunk((i), sizeof (type))
+#define gc_mem_allocate_n_typed(i, n, type) \
+        (type *)Parrot_gc_allocate_memory_chunk((i), (n) * sizeof(type))
+#define gc_mem_realloc_n_typed(i, p, n, type) \
+        (p) = (type *)Parrot_gc_reallocate_memory_chunk((i), (p), (n)*sizeof(type))
+#define gc_mem_allocate_zeroed_typed(i, type) \
+        (type *)Parrot_gc_allocate_memory_chunk_with_interior_pointers((i), sizeof (type))
+#define gc_mem_allocate_n_zeroed_typed(i, n, type) \
+        (type *)Parrot_gc_allocate_memory_chunk_with_interior_pointers((i), (n) * sizeof(type))
+#define gc_mem_realloc_n_typed_zeroed(i, p, n, type) \
+        (p) = (type *)Parrot_gc_reallocate_memory_chunk_with_interior_pointers((i), (p), (n)*sizeof(type))
+#define gc_mem_free(i, p) \
+        Parrot_gc_free_memory_chunk((i), (p))
+
 #define mem_copy_n_typed(dest, src, n, type) memcpy((dest), (src), (n)*sizeof(type))
 
 /* HEADERIZER BEGIN: src/gc/alloc_memory.c */


More information about the parrot-commits mailing list