[svn:parrot] r44209 - branches/sys_mem_reduce/src/runcore
bacek at svn.parrot.org
bacek at svn.parrot.org
Fri Feb 19 23:02:06 UTC 2010
Author: bacek
Date: Fri Feb 19 23:02:05 2010
New Revision: 44209
URL: https://trac.parrot.org/parrot/changeset/44209
Log:
Switch runcores to use GC allocations
Modified:
branches/sys_mem_reduce/src/runcore/cores.c
branches/sys_mem_reduce/src/runcore/main.c
Modified: branches/sys_mem_reduce/src/runcore/cores.c
==============================================================================
--- branches/sys_mem_reduce/src/runcore/cores.c Fri Feb 19 22:45:03 2010 (r44208)
+++ branches/sys_mem_reduce/src/runcore/cores.c Fri Feb 19 23:02:05 2010 (r44209)
@@ -405,7 +405,7 @@
{
ASSERT_ARGS(Parrot_runcore_slow_init)
- Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
+ Parrot_runcore_t *coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);
coredata->name = CONST_STRING(interp, "slow");
coredata->id = PARROT_SLOW_CORE;
coredata->opinit = PARROT_CORE_OPLIB_INIT;
@@ -435,7 +435,7 @@
{
ASSERT_ARGS(Parrot_runcore_fast_init)
- Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
+ Parrot_runcore_t *coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);
coredata->name = CONST_STRING(interp, "fast");
coredata->id = PARROT_FAST_CORE;
coredata->opinit = PARROT_CORE_OPLIB_INIT;
@@ -465,7 +465,7 @@
{
ASSERT_ARGS(Parrot_runcore_switch_init)
- Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
+ Parrot_runcore_t *coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);
coredata->name = CONST_STRING(interp, "switch");
coredata->id = PARROT_SWITCH_CORE;
coredata->opinit = PARROT_CORE_SWITCH_OPLIB_INIT;
@@ -495,7 +495,7 @@
{
ASSERT_ARGS(Parrot_runcore_exec_init)
- Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
+ Parrot_runcore_t *coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);
coredata->name = CONST_STRING(interp, "exec");
coredata->id = PARROT_EXEC_CORE;
coredata->opinit = PARROT_CORE_OPLIB_INIT;
@@ -523,7 +523,7 @@
{
ASSERT_ARGS(Parrot_runcore_gc_debug_init)
- Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
+ Parrot_runcore_t *coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);
coredata->name = CONST_STRING(interp, "gc_debug");
coredata->id = PARROT_GC_DEBUG_CORE;
coredata->opinit = PARROT_CORE_OPLIB_INIT;
@@ -553,7 +553,7 @@
{
ASSERT_ARGS(Parrot_runcore_debugger_init)
- Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
+ Parrot_runcore_t *coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);
coredata->name = CONST_STRING(interp, "debugger");
coredata->id = PARROT_DEBUGGER_CORE;
coredata->opinit = PARROT_CORE_OPLIB_INIT;
@@ -585,7 +585,7 @@
{
ASSERT_ARGS(Parrot_runcore_cgp_init)
- Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
+ Parrot_runcore_t *coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);
coredata->name = CONST_STRING(interp, "cgp");
coredata->id = PARROT_CGP_CORE;
coredata->opinit = PARROT_CORE_CGP_OPLIB_INIT;
@@ -618,7 +618,7 @@
{
ASSERT_ARGS(Parrot_runcore_cgoto_init)
- Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
+ Parrot_runcore_t *coredata = mem_gc_allocate_zeroed_typed(interp, Parrot_runcore_t);
coredata->name = CONST_STRING(interp, "cgoto");
coredata->id = PARROT_CGOTO_CORE;
coredata->opinit = PARROT_CORE_CG_OPLIB_INIT;
Modified: branches/sys_mem_reduce/src/runcore/main.c
==============================================================================
--- branches/sys_mem_reduce/src/runcore/main.c Fri Feb 19 22:45:03 2010 (r44208)
+++ branches/sys_mem_reduce/src/runcore/main.c Fri Feb 19 23:02:05 2010 (r44209)
@@ -383,7 +383,7 @@
if (nb < 8)
nb = (size_t)8;
- pi->branches = mem_allocate_n_typed(nb, Prederef_branch);
+ pi->branches = mem_gc_allocate_n_zeroed_typed(interp, nb, Prederef_branch);
pi->n_allocated = nb;
pi->n_branches = 0;
}
@@ -481,7 +481,7 @@
interp->op_func_table = PARROT_CORE_OPLIB_INIT(1)->op_func_table;
if (interp->evc_func_table) {
- mem_sys_free(interp->evc_func_table);
+ mem_gc_free(interp, interp->evc_func_table);
interp->evc_func_table = NULL;
}
@@ -589,7 +589,7 @@
if (!interp->evc_func_table) {
size_t i;
- interp->evc_func_table = mem_allocate_n_typed(n, op_func_t);
+ interp->evc_func_table = mem_gc_allocate_n_zeroed_typed(interp, n, op_func_t);
for (i = 0; i < n; ++i)
interp->evc_func_table[i] = (op_func_t)
@@ -623,11 +623,11 @@
if (destroy)
(*destroy)(interp, core);
- mem_sys_free(core);
+ mem_gc_free(interp, core);
}
if (interp->cores)
- mem_sys_free(interp->cores);
+ mem_gc_free(interp, interp->cores);
interp->cores = NULL;
interp->run_core = NULL;
@@ -640,17 +640,17 @@
cg_lib = PARROT_CORE_CGP_OPLIB_INIT(1);
if (cg_lib->op_func_table)
- mem_sys_free(cg_lib->op_func_table);
+ mem_gc_free(interp, cg_lib->op_func_table);
cg_lib->op_func_table = NULL;
cg_lib = PARROT_CORE_CG_OPLIB_INIT(1);
if (cg_lib->op_func_table)
- mem_sys_free(cg_lib->op_func_table);
+ mem_gc_free(interp, cg_lib->op_func_table);
cg_lib->op_func_table = NULL;
#endif
- mem_sys_free(interp->op_info_table);
- mem_sys_free(interp->op_func_table);
+ mem_gc_free(interp, interp->op_info_table);
+ mem_gc_free(interp, interp->op_func_table);
interp->op_info_table = NULL;
interp->op_func_table = NULL;
}
@@ -697,11 +697,11 @@
}
if (!interp->all_op_libs)
- interp->all_op_libs = (op_lib_t **)mem_sys_allocate(
- sizeof (op_lib_t *) * (interp->n_libs + 1));
+ interp->all_op_libs = mem_gc_allocate_n_zeroed_typed(interp,
+ interp->n_libs + 1, op_lib_t*);
else
- mem_realloc_n_typed(interp->all_op_libs, interp->n_libs + 1,
- op_lib_t *);
+ mem_gc_realloc_n_typed_zeroed(interp, interp->all_op_libs,
+ interp->n_libs + 1, interp->n_libs, op_lib_t *);
init_func = get_dynamic_op_lib_init(interp, lib_pmc);
lib = init_func(1);
@@ -726,18 +726,18 @@
PARROT_ASSERT(interp->op_count == core->op_count);
- new_evc_func_table = (op_func_t *)mem_sys_realloc(interp->evc_func_table,
- sizeof (op_func_t) * n_tot);
+ new_evc_func_table = mem_gc_realloc_n_typed_zeroed(interp,
+ interp->evc_func_table, n_tot, n_old, op_func_t);
if (core->flags & OP_FUNC_IS_ALLOCATED) {
- new_func_table = (op_func_t *)mem_sys_realloc(core->op_func_table,
- sizeof (op_func_t) * n_tot);
- new_info_table = (op_info_t *)mem_sys_realloc(core->op_info_table,
- sizeof (op_info_t) * n_tot);
+ new_func_table = mem_gc_realloc_n_typed_zeroed(interp,
+ core->op_func_table, n_tot, n_old, op_func_t);
+ new_info_table = mem_gc_realloc_n_typed_zeroed(interp,
+ core->op_info_table, n_tot, n_old, op_info_t);
}
else {
/* allocate new op_func and info tables */
- new_func_table = mem_allocate_n_typed(n_tot, op_func_t);
- new_info_table = mem_allocate_n_typed(n_tot, op_info_t);
+ new_func_table = mem_gc_allocate_n_zeroed_typed(interp, n_tot, op_func_t);
+ new_info_table = mem_gc_allocate_n_zeroed_typed(interp, n_tot, op_info_t);
/* copy old */
for (i = 0; i < n_old; ++i) {
@@ -811,13 +811,13 @@
PMC *lib_variant;
if (cg_lib->flags & OP_FUNC_IS_ALLOCATED) {
- ops_addr = (op_func_t *)mem_sys_realloc(cg_lib->op_func_table,
- n_tot * sizeof (op_func_t));
+ ops_addr = mem_gc_realloc_n_typed_zeroed(interp,
+ cg_lib->op_func_table, n_tot, n_old, op_func_t);
}
else {
size_t i;
- ops_addr = mem_allocate_n_typed(n_tot, op_func_t);
+ ops_addr = mem_gc_allocate_n_zeroed_typed(interp, n_tot, op_func_t);
cg_lib->flags = OP_FUNC_IS_ALLOCATED;
for (i = 0; i < n_old; ++i)
More information about the parrot-commits
mailing list