[svn:parrot] r44227 - in branches/sys_mem_reduce/src: . call gc interp runcore string
bacek at svn.parrot.org
bacek at svn.parrot.org
Sat Feb 20 11:42:55 UTC 2010
Author: bacek
Date: Sat Feb 20 11:42:53 2010
New Revision: 44227
URL: https://trac.parrot.org/parrot/changeset/44227
Log:
Bulk update various parts to use GC allocations
Modified:
branches/sys_mem_reduce/src/call/args.c
branches/sys_mem_reduce/src/call/ops.c
branches/sys_mem_reduce/src/embed.c
branches/sys_mem_reduce/src/events.c
branches/sys_mem_reduce/src/gc/api.c
branches/sys_mem_reduce/src/interp/inter_create.c
branches/sys_mem_reduce/src/packfile.c
branches/sys_mem_reduce/src/runcore/cores.c
branches/sys_mem_reduce/src/runcore/main.c
branches/sys_mem_reduce/src/runcore/profiling.c
branches/sys_mem_reduce/src/string/api.c
branches/sys_mem_reduce/src/string/encoding.c
Modified: branches/sys_mem_reduce/src/call/args.c
==============================================================================
--- branches/sys_mem_reduce/src/call/args.c Sat Feb 20 11:42:15 2010 (r44226)
+++ branches/sys_mem_reduce/src/call/args.c Sat Feb 20 11:42:53 2010 (r44227)
@@ -2874,7 +2874,8 @@
cur &= ~0xfff;
}
- mem_realloc_n_typed(values, cur, void *);
+ values = mem_gc_realloc_n_typed_zeroed(interp, values,
+ cur, resize_threshold, void *);
SETATTR_CallContext_returns_values(interp, self, values);
SETATTR_CallContext_returns_size(interp, self, size);
Modified: branches/sys_mem_reduce/src/call/ops.c
==============================================================================
--- branches/sys_mem_reduce/src/call/ops.c Sat Feb 20 11:42:15 2010 (r44226)
+++ branches/sys_mem_reduce/src/call/ops.c Sat Feb 20 11:42:53 2010 (r44227)
@@ -142,7 +142,7 @@
interp->runloop_jmp_free_list = jump_point->prev;
}
else
- jump_point = mem_allocate_typed(Parrot_runloop);
+ jump_point = mem_gc_allocate_zeroed_typed(interp, Parrot_runloop);
jump_point->prev = interp->current_runloop;
interp->current_runloop = jump_point;
Modified: branches/sys_mem_reduce/src/embed.c
==============================================================================
--- branches/sys_mem_reduce/src/embed.c Sat Feb 20 11:42:15 2010 (r44226)
+++ branches/sys_mem_reduce/src/embed.c Sat Feb 20 11:42:53 2010 (r44227)
@@ -1077,7 +1077,7 @@
PackFile * const pf = PackFile_new(interp, 0);
static opcode_t program_code[2];
- program_code[0] = interp->op_lib->op_code("enternative", 0);
+ program_code[0] = interp->op_lib->op_code(interp, "enternative", 0);
program_code[1] = 0; /* end */
pf->cur_cs = (PackFile_ByteCode *)
Modified: branches/sys_mem_reduce/src/events.c
==============================================================================
--- branches/sys_mem_reduce/src/events.c Sat Feb 20 11:42:15 2010 (r44226)
+++ branches/sys_mem_reduce/src/events.c Sat Feb 20 11:42:53 2010 (r44227)
@@ -831,8 +831,9 @@
ios->events = mem_internal_allocate_n_zeroed_typed(ios->alloced, parrot_event *);
}
else if (ios->n >= ios->alloced) {
+ ios->events = mem_internal_realloc_n_zeroed_typed(ios->events,
+ ios->alloced * 2, ios->alloced, parrot_event *);
ios->alloced *= 2;
- mem_realloc_n_typed(ios->events, ios->alloced, parrot_event *);
}
ios->events[ios->n++] = ev;
}
Modified: branches/sys_mem_reduce/src/gc/api.c
==============================================================================
--- branches/sys_mem_reduce/src/gc/api.c Sat Feb 20 11:42:15 2010 (r44226)
+++ branches/sys_mem_reduce/src/gc/api.c Sat Feb 20 11:42:53 2010 (r44227)
@@ -392,7 +392,7 @@
if (PMC_sync(pmc))
return;
- PMC_sync(pmc) = mem_allocate_typed(Sync);
+ PMC_sync(pmc) = mem_gc_allocate_zeroed_typed(interp, Sync);
if (!PMC_sync(pmc))
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ALLOCATION_ERROR,
Modified: branches/sys_mem_reduce/src/interp/inter_create.c
==============================================================================
--- branches/sys_mem_reduce/src/interp/inter_create.c Sat Feb 20 11:42:15 2010 (r44226)
+++ branches/sys_mem_reduce/src/interp/inter_create.c Sat Feb 20 11:42:53 2010 (r44227)
@@ -147,7 +147,7 @@
Interp *interp;
/* Get an empty interpreter from system memory */
- interp = mem_allocate_zeroed_typed(Interp);
+ interp = mem_internal_allocate_zeroed_typed(Interp);
interp->lo_var_ptr = NULL;
@@ -181,9 +181,9 @@
interp->current_runloop_level = 0;
/* Allocate IMCC info */
- IMCC_INFO(interp) = mem_allocate_zeroed_typed(imc_info_t);
+ IMCC_INFO(interp) = mem_internal_allocate_zeroed_typed(imc_info_t);
- interp->gc_sys = mem_allocate_zeroed_typed(GC_Subsystem);
+ interp->gc_sys = mem_internal_allocate_zeroed_typed(GC_Subsystem);
interp->gc_sys->sys_type = parent
? parent->gc_sys->sys_type
: PARROT_GC_DEFAULT_TYPE;
Modified: branches/sys_mem_reduce/src/packfile.c
==============================================================================
--- branches/sys_mem_reduce/src/packfile.c Sat Feb 20 11:42:15 2010 (r44226)
+++ branches/sys_mem_reduce/src/packfile.c Sat Feb 20 11:42:53 2010 (r44227)
@@ -1199,11 +1199,12 @@
PARROT_EXPORT
void
-PackFile_add_segment(SHIM_INTERP, ARGMOD(PackFile_Directory *dir),
+PackFile_add_segment(PARROT_INTERP, ARGMOD(PackFile_Directory *dir),
ARGIN(PackFile_Segment *seg))
{
ASSERT_ARGS(PackFile_add_segment)
- mem_realloc_n_typed(dir->segments, dir->num_segments+1, PackFile_Segment *);
+ dir->segments = mem_gc_realloc_n_typed_zeroed(interp, dir->segments,
+ dir->num_segments+1, dir->num_segments, PackFile_Segment *);
dir->segments[dir->num_segments] = seg;
dir->num_segments++;
seg->dir = dir;
@@ -2071,7 +2072,8 @@
PARROT_ASSERT(pf);
dir->num_segments = PF_fetch_opcode(pf, &cursor);
TRACE_PRINTF(("directory_unpack: %ld num_segments\n", dir->num_segments));
- mem_realloc_n_typed(dir->segments, dir->num_segments, PackFile_Segment *);
+ dir->segments = mem_gc_allocate_n_zeroed_typed(interp,
+ dir->num_segments, PackFile_Segment *);
for (i = 0; i < dir->num_segments; i++) {
PackFile_Segment *seg;
@@ -2777,8 +2779,8 @@
debug->num_mappings = PF_fetch_opcode(self->pf, &cursor);
/* Allocate space for mappings vector. */
- mem_realloc_n_typed(debug->mappings, debug->num_mappings + 1,
- PackFile_DebugFilenameMapping *);
+ debug->mappings = mem_gc_allocate_n_zeroed_typed(interp,
+ debug->num_mappings + 1, PackFile_DebugFilenameMapping *);
/* Read in each mapping. */
for (i = 0; i < debug->num_mappings; i++) {
@@ -2866,7 +2868,7 @@
/* it exists already, resize it */
if (cs->debugs) {
debug = cs->debugs;
- mem_realloc_n_typed(debug->base.data, size, opcode_t);
+ debug->base.data = mem_gc_realloc_n_typed(interp, debug->base.data, size, opcode_t);
}
/* create one */
else {
@@ -2927,8 +2929,9 @@
}
/* Allocate space for the extra entry. */
- mem_realloc_n_typed(debug->mappings, debug->num_mappings + 1,
- PackFile_DebugFilenameMapping *);
+ debug->mappings = mem_gc_realloc_n_typed(interp,
+ debug->mappings, debug->num_mappings + 1,
+ PackFile_DebugFilenameMapping *);
/* Can it just go on the end? */
if (debug->num_mappings == 0
@@ -2974,7 +2977,8 @@
/* Not found, create a new one */
PackFile_Constant *fnconst;
ct->const_count = ct->const_count + 1;
- mem_realloc_n_typed(ct->constants, ct->const_count, PackFile_Constant *);
+ ct->constants = mem_gc_realloc_n_typed_zeroed(interp, ct->constants,
+ ct->const_count, ct->const_count - 1, PackFile_Constant *);
fnconst = PackFile_Constant_new(interp);
fnconst->type = PFC_STRING;
@@ -3556,7 +3560,8 @@
}
i = self->fixup_count++;
- mem_realloc_n_typed(self->fixups, self->fixup_count, PackFile_FixupEntry *);
+ self->fixups = mem_gc_realloc_n_typed_zeroed(interp,
+ self->fixups, self->fixup_count, i, PackFile_FixupEntry *);
self->fixups[i] = mem_gc_allocate_zeroed_typed(interp, PackFile_FixupEntry);
self->fixups[i]->type = type;
Modified: branches/sys_mem_reduce/src/runcore/cores.c
==============================================================================
--- branches/sys_mem_reduce/src/runcore/cores.c Sat Feb 20 11:42:15 2010 (r44226)
+++ branches/sys_mem_reduce/src/runcore/cores.c Sat Feb 20 11:42:53 2010 (r44227)
@@ -1049,7 +1049,7 @@
ASSERT_ARGS(load_prederef)
const oplib_init_f init_func = get_core_op_lib_init(interp, runcore);
- int (*get_op)(const char * name, int full);
+ int (*get_op)(PARROT_INTERP, const char * name, int full);
get_op = interp->op_lib->op_code;
interp->op_lib = init_func(1);
Modified: branches/sys_mem_reduce/src/runcore/main.c
==============================================================================
--- branches/sys_mem_reduce/src/runcore/main.c Sat Feb 20 11:42:15 2010 (r44226)
+++ branches/sys_mem_reduce/src/runcore/main.c Sat Feb 20 11:42:53 2010 (r44227)
@@ -166,11 +166,12 @@
Parrot_runcore_register(PARROT_INTERP, ARGIN(Parrot_runcore_t *coredata))
{
ASSERT_ARGS(Parrot_runcore_register)
- size_t num_cores = ++interp->num_cores;
+ size_t i = interp->num_cores++;
- mem_realloc_n_typed(interp->cores, num_cores, Parrot_runcore_t *);
+ interp->cores = mem_gc_realloc_n_typed_zeroed(interp, interp->cores,
+ interp->num_cores, i, Parrot_runcore_t *);
- interp->cores[num_cores - 1] = coredata;
+ interp->cores[i] = coredata;
return 1;
}
@@ -388,8 +389,10 @@
pi->n_branches = 0;
}
else if (pi->n_branches >= pi->n_allocated) {
+ size_t old = pi->n_allocated;
pi->n_allocated = (size_t) (pi->n_allocated * 1.5);
- mem_realloc_n_typed(pi->branches, pi->n_allocated, Prederef_branch);
+ pi->branches = mem_gc_realloc_n_typed_zeroed(interp,
+ pi->branches, pi->n_allocated, old, Prederef_branch);
}
pi->branches[pi->n_branches].offs = offset;
Modified: branches/sys_mem_reduce/src/runcore/profiling.c
==============================================================================
--- branches/sys_mem_reduce/src/runcore/profiling.c Sat Feb 20 11:42:15 2010 (r44226)
+++ branches/sys_mem_reduce/src/runcore/profiling.c Sat Feb 20 11:42:53 2010 (r44227)
@@ -103,7 +103,7 @@
ASSERT_ARGS(Parrot_runcore_profiling_init)
Parrot_profiling_runcore_t *coredata =
- mem_allocate_typed(Parrot_profiling_runcore_t);
+ mem_gc_allocate_zeroed_typed(interp, Parrot_profiling_runcore_t);
coredata->name = CONST_STRING(interp, "profiling");
coredata->id = PARROT_PROFILING_CORE;
@@ -148,7 +148,7 @@
runcore->level = 0;
runcore->time_size = 32;
runcore->line_cache = parrot_new_pointer_hash(interp);
- runcore->time = mem_allocate_n_typed(runcore->time_size,
+ runcore->time = mem_gc_allocate_n_typed(interp, runcore->time_size,
UHUGEINTVAL);
/* figure out what format the output should be in */
@@ -262,9 +262,8 @@
if (runcore->level >= runcore->time_size) {
runcore->time_size *= 2;
- runcore->time =
- mem_realloc_n_typed(runcore->time, runcore->time_size + 1,
- UHUGEINTVAL);
+ runcore->time = mem_gc_realloc_n_typed(interp,
+ runcore->time, runcore->time_size + 1, UHUGEINTVAL);
}
/* store the time between DO_OP and the start of this runcore in this
Modified: branches/sys_mem_reduce/src/string/api.c
==============================================================================
--- branches/sys_mem_reduce/src/string/api.c Sat Feb 20 11:42:15 2010 (r44226)
+++ branches/sys_mem_reduce/src/string/api.c Sat Feb 20 11:42:53 2010 (r44227)
@@ -302,7 +302,7 @@
PObj_constant_FLAG);
interp->const_cstring_table =
- mem_allocate_n_zeroed_typed(n_parrot_cstrings, STRING *);
+ mem_gc_allocate_n_zeroed_typed(interp, n_parrot_cstrings, STRING *);
for (i = 0; i < n_parrot_cstrings; ++i) {
DECL_CONST_CAST;
Modified: branches/sys_mem_reduce/src/string/encoding.c
==============================================================================
--- branches/sys_mem_reduce/src/string/encoding.c Sat Feb 20 11:42:15 2010 (r44226)
+++ branches/sys_mem_reduce/src/string/encoding.c Sat Feb 20 11:42:53 2010 (r44227)
@@ -93,10 +93,10 @@
PARROT_MALLOC
PARROT_CANNOT_RETURN_NULL
ENCODING *
-Parrot_new_encoding(SHIM_INTERP)
+Parrot_new_encoding(PARROT_INTERP)
{
ASSERT_ARGS(Parrot_new_encoding)
- return mem_allocate_typed(ENCODING);
+ return mem_gc_allocate_typed(interp, ENCODING);
}
/*
@@ -367,7 +367,7 @@
{
ASSERT_ARGS(Parrot_register_encoding)
if (!all_encodings) {
- all_encodings = mem_allocate_typed(All_encodings);
+ all_encodings = mem_gc_allocate_zeroed_typed(interp, All_encodings);
all_encodings->n_encodings = 0;
all_encodings->enc = NULL;
}
More information about the parrot-commits
mailing list