[svn:parrot] r44061 - branches/sys_mem_reduce/src/gc
bacek at svn.parrot.org
bacek at svn.parrot.org
Wed Feb 17 07:15:38 UTC 2010
Author: bacek
Date: Wed Feb 17 07:15:37 2010
New Revision: 44061
URL: https://trac.parrot.org/parrot/changeset/44061
Log:
Expose raw memory allocation functions via GC_Subsystem
Modified:
branches/sys_mem_reduce/src/gc/api.c
branches/sys_mem_reduce/src/gc/gc_ms.c
branches/sys_mem_reduce/src/gc/gc_private.h
Modified: branches/sys_mem_reduce/src/gc/api.c
==============================================================================
--- branches/sys_mem_reduce/src/gc/api.c Wed Feb 17 07:14:42 2010 (r44060)
+++ branches/sys_mem_reduce/src/gc/api.c Wed Feb 17 07:15:37 2010 (r44061)
@@ -650,6 +650,73 @@
interp->gc_sys->free_fixed_size_storage(interp, size, data);
}
+/*
+
+=item C<void * Parrot_gc_allocate_memory_chunk(PARROT_INTERP, size_t size)>
+
+=item C<void * Parrot_gc_reallocate_memory_chunk(PARROT_INTERP, void *data,
+size_t newsize)>
+
+=item C<void Parrot_gc_free_memory_chunk(PARROT_INTERP, void *data)>
+
+=item C<void *
+Parrot_gc_allocate_memory_chunk_with_interior_pointers(PARROT_INTERP, size_t
+size)>
+
+=item C<void *
+Parrot_gc_reallocate_memory_chunk_with_interior_pointers(PARROT_INTERP, void
+*data, size_t newsize)>
+
+TODO Write docu.
+
+*/
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+void *
+Parrot_gc_allocate_memory_chunk(PARROT_INTERP, size_t size)
+{
+ ASSERT_ARGS(Parrot_gc_allocate_memory_chunk)
+ return interp->gc_sys->allocate_memory_chunk(interp, size);
+}
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+void *
+Parrot_gc_reallocate_memory_chunk(PARROT_INTERP, ARGIN(void *data), size_t newsize)
+{
+ ASSERT_ARGS(Parrot_gc_allocate_memory_chunk)
+ return interp->gc_sys->reallocate_memory_chunk(interp, data, newsize);
+}
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+void
+Parrot_gc_free_memory_chunk(PARROT_INTERP, ARGIN(void *data))
+{
+ ASSERT_ARGS(Parrot_gc_allocate_memory_chunk)
+ interp->gc_sys->free_memory_chunk(interp, data);
+}
+
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+void *
+Parrot_gc_allocate_memory_chunk_with_interior_pointers(PARROT_INTERP, size_t size)
+{
+ ASSERT_ARGS(Parrot_gc_allocate_memory_chunk)
+ return interp->gc_sys->allocate_memory_chunk_with_interior_pointers(interp, size);
+}
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+void *
+Parrot_gc_reallocate_memory_chunk_with_interior_pointers(PARROT_INTERP, ARGIN(void *data), size_t newsize)
+{
+ ASSERT_ARGS(Parrot_gc_allocate_memory_chunk)
+ return interp->gc_sys->reallocate_memory_chunk_with_interior_pointers(interp, data, newsize);
+}
+
/*
Modified: branches/sys_mem_reduce/src/gc/gc_ms.c
==============================================================================
--- branches/sys_mem_reduce/src/gc/gc_ms.c Wed Feb 17 07:14:42 2010 (r44060)
+++ branches/sys_mem_reduce/src/gc/gc_ms.c Wed Feb 17 07:15:37 2010 (r44061)
@@ -56,6 +56,9 @@
static Buffer * gc_ms_allocate_bufferlike_header(PARROT_INTERP, size_t size)
__attribute__nonnull__(1);
+static void * gc_ms_allocate_memory_chunk(PARROT_INTERP, size_t size)
+ __attribute__nonnull__(1);
+
PARROT_CAN_RETURN_NULL
static PMC* gc_ms_allocate_pmc_header(PARROT_INTERP, UINTVAL flags)
__attribute__nonnull__(1);
@@ -85,6 +88,15 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
+static void gc_ms_free_attributes_from_pool(PARROT_INTERP,
+ ARGMOD(PMC_Attribute_Pool *pool),
+ ARGMOD(void *data))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ FUNC_MODIFIES(*pool)
+ FUNC_MODIFIES(*data);
+
static void gc_ms_free_bufferlike_header(PARROT_INTERP,
ARGMOD(Buffer *obj),
size_t size)
@@ -92,6 +104,10 @@
__attribute__nonnull__(2)
FUNC_MODIFIES(*obj);
+static void gc_ms_free_memory_chunk(PARROT_INTERP, ARGIN(void *data))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
static void gc_ms_free_pmc_header(PARROT_INTERP, ARGMOD(PMC *pmc))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
@@ -147,6 +163,12 @@
__attribute__nonnull__(2)
FUNC_MODIFIES(*buffer);
+static void * gc_ms_reallocate_memory_chunk(PARROT_INTERP,
+ ARGIN(void *data),
+ size_t newsize)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
static void gc_ms_reallocate_string_storage(PARROT_INTERP,
ARGMOD(STRING *str),
size_t newsize)
@@ -181,15 +203,6 @@
static void gc_ms_unblock_GC_sweep(PARROT_INTERP)
__attribute__nonnull__(1);
-static void gc_ms_free_attributes_from_pool(PARROT_INTERP,
- ARGMOD(PMC_Attribute_Pool *pool),
- ARGMOD(void *data))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3)
- FUNC_MODIFIES(*pool)
- FUNC_MODIFIES(*data);
-
#define ASSERT_ARGS_gc_ms_active_sized_buffers __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(mem_pools))
@@ -207,6 +220,8 @@
#define ASSERT_ARGS_gc_ms_allocate_bufferlike_header \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms_allocate_memory_chunk __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_gc_ms_allocate_pmc_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_gc_ms_allocate_string_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -223,9 +238,17 @@
#define ASSERT_ARGS_gc_ms_finalize_memory_pools __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(mem_pools))
+#define ASSERT_ARGS_gc_ms_free_attributes_from_pool \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(pool) \
+ , PARROT_ASSERT_ARG(data))
#define ASSERT_ARGS_gc_ms_free_bufferlike_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(obj))
+#define ASSERT_ARGS_gc_ms_free_memory_chunk __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(data))
#define ASSERT_ARGS_gc_ms_free_pmc_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pmc))
@@ -257,6 +280,9 @@
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(buffer))
+#define ASSERT_ARGS_gc_ms_reallocate_memory_chunk __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(data))
#define ASSERT_ARGS_gc_ms_reallocate_string_storage \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
@@ -275,11 +301,6 @@
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_gc_ms_unblock_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_gc_ms_free_attributes_from_pool \
- __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(pool) \
- , PARROT_ASSERT_ARG(data))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
@@ -305,7 +326,7 @@
{
ASSERT_ARGS(Parrot_gc_ms_init)
- interp->mem_pools = mem_allocate_zeroed_typed(Memory_Pools);
+ interp->mem_pools = mem_internal_allocate_zeroed(Memory_Pools);
interp->mem_pools->num_sized = 0;
interp->mem_pools->num_attribs = 0;
interp->mem_pools->attrib_pools = NULL;
@@ -1050,6 +1071,40 @@
gc_ms_free_attributes_from_pool(interp, pools[idx], data);
}
+/*
+
+=item C<static void * gc_ms_allocate_memory_chunk(PARROT_INTERP, size_t size)>
+
+=item C<static void * gc_ms_reallocate_memory_chunk(PARROT_INTERP, void *data,
+size_t newsize)>
+
+=item C<static void gc_ms_free_memory_chunk(PARROT_INTERP, void *data)>
+
+TODO Write docu.
+
+*/
+
+static void *
+gc_ms_allocate_memory_chunk(PARROT_INTERP, size_t size)
+{
+ ASSERT_ARGS(gc_ms_allocate_memory_chunk)
+ return mem_internal_allocate(interp, size);
+}
+
+static void *
+gc_ms_reallocate_memory_chunk(PARROT_INTERP, ARGIN(void *data), size_t newsize)
+{
+ ASSERT_ARGS(gc_ms_allocate_memory_chunk)
+ return mem_internal_realloc(interp, data, newsize);
+}
+
+static void
+gc_ms_free_memory_chunk(PARROT_INTERP, ARGIN(void *data))
+{
+ ASSERT_ARGS(gc_ms_allocate_memory_chunk)
+ mem_internal_free(interp, data);
+}
+
/*
Modified: branches/sys_mem_reduce/src/gc/gc_private.h
==============================================================================
--- branches/sys_mem_reduce/src/gc/gc_private.h Wed Feb 17 07:14:42 2010 (r44060)
+++ branches/sys_mem_reduce/src/gc/gc_private.h Wed Feb 17 07:15:37 2010 (r44061)
@@ -132,6 +132,12 @@
void* (*allocate_fixed_size_storage)(PARROT_INTERP, size_t size);
void (*free_fixed_size_storage)(PARROT_INTERP, size_t size, void *);
+ void* (*allocate_memory_chunk)(PARROT_INTERP, size_t size);
+ void* (*reallocate_memory_chunk)(PARROT_INTERP, void *data, size_t newsize);
+ void* (*allocate_memory_chunk_with_interior_pointers)(PARROT_INTERP, size_t size);
+ void* (*reallocate_memory_chunk_with_interior_pointers)(PARROT_INTERP, void *data, size_t newsize);
+ void (*free_memory_chunk)(PARROT_INTERP, void *data);
+
void (*block_mark)(PARROT_INTERP);
void (*unblock_mark)(PARROT_INTERP);
unsigned int (*is_blocked_mark)(PARROT_INTERP);
More information about the parrot-commits
mailing list