[svn:parrot] r44226 - branches/sys_mem_reduce/src/pmc
bacek at svn.parrot.org
bacek at svn.parrot.org
Sat Feb 20 11:42:16 UTC 2010
Author: bacek
Date: Sat Feb 20 11:42:15 2010
New Revision: 44226
URL: https://trac.parrot.org/parrot/changeset/44226
Log:
Bulk update PMCs to use GC allocations
Modified:
branches/sys_mem_reduce/src/pmc/bigint.pmc
branches/sys_mem_reduce/src/pmc/bignum.pmc
branches/sys_mem_reduce/src/pmc/fixedfloatarray.pmc
branches/sys_mem_reduce/src/pmc/fixedpmcarray.pmc
branches/sys_mem_reduce/src/pmc/nci.pmc
branches/sys_mem_reduce/src/pmc/packfileannotations.pmc
branches/sys_mem_reduce/src/pmc/packfileconstanttable.pmc
branches/sys_mem_reduce/src/pmc/packfilefixupentry.pmc
branches/sys_mem_reduce/src/pmc/packfilefixuptable.pmc
branches/sys_mem_reduce/src/pmc/packfilerawsegment.pmc
branches/sys_mem_reduce/src/pmc/resizableintegerarray.pmc
branches/sys_mem_reduce/src/pmc/resizablepmcarray.pmc
branches/sys_mem_reduce/src/pmc/sockaddr.pmc
branches/sys_mem_reduce/src/pmc/sub.pmc
Modified: branches/sys_mem_reduce/src/pmc/bigint.pmc
==============================================================================
--- branches/sys_mem_reduce/src/pmc/bigint.pmc Sat Feb 20 11:41:44 2010 (r44225)
+++ branches/sys_mem_reduce/src/pmc/bigint.pmc Sat Feb 20 11:42:15 2010 (r44226)
@@ -37,7 +37,7 @@
static void
bigint_init(PARROT_INTERP, PMC *self) {
- BIGINT * const bi = mem_allocate_zeroed_typed(BIGINT);
+ BIGINT * const bi = mem_gc_allocate_zeroed_typed(interp, BIGINT);
SETATTR_BigInt_bi(interp, self, bi);
mpz_init(bi->b);
}
Modified: branches/sys_mem_reduce/src/pmc/bignum.pmc
==============================================================================
--- branches/sys_mem_reduce/src/pmc/bignum.pmc Sat Feb 20 11:41:44 2010 (r44225)
+++ branches/sys_mem_reduce/src/pmc/bignum.pmc Sat Feb 20 11:42:15 2010 (r44226)
@@ -154,7 +154,7 @@
static void
bignum_init(PARROT_INTERP, PMC *self) {
#ifdef PARROT_HAS_GMP
- BIGNUM * const bn = mem_allocate_zeroed_typed(BIGNUM);
+ BIGNUM * const bn = mem_gc_allocate_zeroed_typed(interp, BIGNUM);
SETATTR_BigNum_bn(interp, self, bn);
mpf_clear(bn->b);
mpf_init(bn->b);
Modified: branches/sys_mem_reduce/src/pmc/fixedfloatarray.pmc
==============================================================================
--- branches/sys_mem_reduce/src/pmc/fixedfloatarray.pmc Sat Feb 20 11:41:44 2010 (r44225)
+++ branches/sys_mem_reduce/src/pmc/fixedfloatarray.pmc Sat Feb 20 11:42:15 2010 (r44226)
@@ -289,7 +289,7 @@
SET_ATTR_size(INTERP, SELF, new_size);
SET_ATTR_float_array(INTERP, SELF,
- mem_allocate_n_typed(new_size, FLOATVAL));
+ mem_gc_allocate_n_typed(INTERP, new_size, FLOATVAL));
PObj_custom_destroy_SET(SELF);
}
Modified: branches/sys_mem_reduce/src/pmc/fixedpmcarray.pmc
==============================================================================
--- branches/sys_mem_reduce/src/pmc/fixedpmcarray.pmc Sat Feb 20 11:41:44 2010 (r44225)
+++ branches/sys_mem_reduce/src/pmc/fixedpmcarray.pmc Sat Feb 20 11:42:15 2010 (r44226)
@@ -377,7 +377,7 @@
_("FixedPMCArray: Cannot set array size to a negative number"));
PMC_size(SELF) = size;
- data = mem_allocate_n_typed(size, PMC *);
+ data = mem_gc_allocate_n_zeroed_typed(INTERP, size, PMC *);
for (i = 0; i < size; i++)
data[i] = PMCNULL;
Modified: branches/sys_mem_reduce/src/pmc/nci.pmc
==============================================================================
--- branches/sys_mem_reduce/src/pmc/nci.pmc Sat Feb 20 11:41:44 2010 (r44225)
+++ branches/sys_mem_reduce/src/pmc/nci.pmc Sat Feb 20 11:42:15 2010 (r44226)
@@ -28,7 +28,7 @@
char param_buf[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
char *param_sig = sig_length <= 7
? param_buf
- : mem_allocate_n_typed(sig_length, char);
+ : mem_gc_allocate_n_typed(interp, sig_length, char);
size_t j = 0;
size_t i;
Modified: branches/sys_mem_reduce/src/pmc/packfileannotations.pmc
==============================================================================
--- branches/sys_mem_reduce/src/pmc/packfileannotations.pmc Sat Feb 20 11:41:44 2010 (r44225)
+++ branches/sys_mem_reduce/src/pmc/packfileannotations.pmc Sat Feb 20 11:42:15 2010 (r44226)
@@ -260,7 +260,8 @@
VTABLE void *get_pointer() {
Parrot_PackfileAnnotations_attributes *attrs =
PARROT_PACKFILEANNOTATIONS(SELF);
- PackFile_Annotations *res = mem_allocate_zeroed_typed(PackFile_Annotations);
+ PackFile_Annotations *res = mem_gc_allocate_zeroed_typed(INTERP,
+ PackFile_Annotations);
INTVAL i, num;
INTVAL key_type;
PMC *keys; /* Temporary representation of Keys */
@@ -297,7 +298,7 @@
/* Iterate over stored annotations and create Key if required. */
num = VTABLE_elements(interp, attrs->annotations);
res->num_entries = num;
- res->entries = mem_allocate_n_typed(num, PackFile_Annotations_Entry*);
+ res->entries = mem_gc_allocate_n_typed(INTERP, num, PackFile_Annotations_Entry*);
for (i = 0; i < num; ++i) {
PMC *entity = VTABLE_get_pmc_keyed_int(interp, attrs->annotations, i);
Parrot_PackfileAnnotation_attributes *entity_attrs = PARROT_PACKFILEANNOTATION(entity);
@@ -336,7 +337,8 @@
/* At this point we have create (if nesassary) key and name constant. */
/* Start storing real entity */
- res->entries[i] = mem_allocate_zeroed_typed(PackFile_Annotations_Entry);
+ res->entries[i] = mem_gc_allocate_zeroed_typed(INTERP,
+ PackFile_Annotations_Entry);
res->entries[i]->bytecode_offset = entity_attrs->offset;
res->entries[i]->key = key_id;
@@ -365,9 +367,10 @@
/* Time to pack keys */
num = VTABLE_elements(interp, types);
res->num_keys = num;
- res->keys = mem_allocate_n_typed(num, PackFile_Annotations_Key*);
+ res->keys = mem_gc_allocate_n_zeroed_typed(INTERP, num,
+ PackFile_Annotations_Key*);
for (i = 0; i < num; ++i) {
- res->keys[i] = mem_allocate_typed(PackFile_Annotations_Key);
+ res->keys[i] = mem_gc_allocate_typed(INTERP, PackFile_Annotations_Key);
res->keys[i]->name = VTABLE_get_integer_keyed_int(interp, names, i);
res->keys[i]->type = VTABLE_get_integer_keyed_int(interp, types, i);
}
Modified: branches/sys_mem_reduce/src/pmc/packfileconstanttable.pmc
==============================================================================
--- branches/sys_mem_reduce/src/pmc/packfileconstanttable.pmc Sat Feb 20 11:41:44 2010 (r44225)
+++ branches/sys_mem_reduce/src/pmc/packfileconstanttable.pmc Sat Feb 20 11:42:15 2010 (r44226)
@@ -129,7 +129,7 @@
Parrot_PackfileConstantTable_attributes * attrs =
PARROT_PACKFILECONSTANTTABLE(SELF);
PackFile_ConstTable * pftable =
- mem_allocate_zeroed_typed(PackFile_ConstTable);
+ mem_gc_allocate_zeroed_typed(INTERP, PackFile_ConstTable);
PackFile_Constant * value;
opcode_t i;
@@ -137,8 +137,8 @@
/* Copy all constanst with respect of type */
pftable->const_count = VTABLE_get_integer(interp, attrs->constants);
- pftable->constants = mem_allocate_n_typed(pftable->const_count,
- PackFile_Constant*);
+ pftable->constants = mem_gc_allocate_n_typed(INTERP,
+ pftable->const_count, PackFile_Constant*);
for (i = 0; i < pftable->const_count; ++i) {
value = PackFile_Constant_new(interp);
Modified: branches/sys_mem_reduce/src/pmc/packfilefixupentry.pmc
==============================================================================
--- branches/sys_mem_reduce/src/pmc/packfilefixupentry.pmc Sat Feb 20 11:41:44 2010 (r44225)
+++ branches/sys_mem_reduce/src/pmc/packfilefixupentry.pmc Sat Feb 20 11:42:15 2010 (r44226)
@@ -95,7 +95,7 @@
Parrot_PackfileFixupEntry_attributes * attrs =
PARROT_PACKFILEFIXUPENTRY(SELF);
PackFile_FixupEntry * entry =
- mem_allocate_zeroed_typed(PackFile_FixupEntry);
+ mem_gc_allocate_zeroed_typed(INTERP, PackFile_FixupEntry);
entry->type = attrs->type;
entry->name = strdup(Parrot_string_cstring(interp, attrs->name));
Modified: branches/sys_mem_reduce/src/pmc/packfilefixuptable.pmc
==============================================================================
--- branches/sys_mem_reduce/src/pmc/packfilefixuptable.pmc Sat Feb 20 11:41:44 2010 (r44225)
+++ branches/sys_mem_reduce/src/pmc/packfilefixuptable.pmc Sat Feb 20 11:42:15 2010 (r44226)
@@ -108,15 +108,15 @@
Parrot_PackfileFixupTable_attributes * attrs =
PARROT_PACKFILEFIXUPTABLE(SELF);
PackFile_FixupTable * pftable =
- mem_allocate_zeroed_typed(PackFile_FixupTable);
+ mem_gc_allocate_zeroed_typed(INTERP, PackFile_FixupTable);
PMC * entry;
PackFile_FixupEntry * val;
opcode_t i;
pftable->base.type = PF_FIXUP_SEG;
pftable->fixup_count = VTABLE_elements(interp, attrs->entries);
- pftable->fixups = mem_allocate_n_typed(pftable->fixup_count,
- PackFile_FixupEntry*);
+ pftable->fixups = mem_gc_allocate_n_typed(INTERP,
+ pftable->fixup_count, PackFile_FixupEntry*);
/* Copy all entries */
for (i = 0; i < pftable->fixup_count; ++i) {
Modified: branches/sys_mem_reduce/src/pmc/packfilerawsegment.pmc
==============================================================================
--- branches/sys_mem_reduce/src/pmc/packfilerawsegment.pmc Sat Feb 20 11:41:44 2010 (r44225)
+++ branches/sys_mem_reduce/src/pmc/packfilerawsegment.pmc Sat Feb 20 11:42:15 2010 (r44226)
@@ -111,7 +111,7 @@
VTABLE void *get_pointer() {
PackFile_Segment * pfseg =
- (PackFile_Segment*)mem_allocate_zeroed_typed(PackFile_ByteCode);
+ (PackFile_Segment*)mem_gc_allocate_zeroed_typed(INTERP, PackFile_ByteCode);
Parrot_PackfileRawSegment_attributes * attrs =
PARROT_PACKFILERAWSEGMENT(SELF);
PMC * opcodes = attrs->opcodes;
@@ -119,7 +119,7 @@
pfseg->type = attrs->type;
pfseg->size = VTABLE_get_integer(interp, opcodes);
- pfseg->data = mem_allocate_n_typed(pfseg->size, opcode_t);
+ pfseg->data = mem_gc_allocate_n_typed(INTERP, pfseg->size, opcode_t);
/* Not very efficient... */
for (i = 0; i < pfseg->size; ++i) {
Modified: branches/sys_mem_reduce/src/pmc/resizableintegerarray.pmc
==============================================================================
--- branches/sys_mem_reduce/src/pmc/resizableintegerarray.pmc Sat Feb 20 11:41:44 2010 (r44225)
+++ branches/sys_mem_reduce/src/pmc/resizableintegerarray.pmc Sat Feb 20 11:42:15 2010 (r44226)
@@ -124,7 +124,7 @@
}
GET_ATTR_int_array(INTERP, SELF, int_array);
- mem_realloc_n_typed(int_array, cur, INTVAL);
+ int_array = mem_gc_realloc_n_typed(INTERP, int_array, cur, INTVAL);
SET_ATTR_int_array(INTERP, SELF, int_array);
SET_ATTR_size(INTERP, SELF, size);
SET_ATTR_resize_threshold(INTERP, SELF, cur);
Modified: branches/sys_mem_reduce/src/pmc/resizablepmcarray.pmc
==============================================================================
--- branches/sys_mem_reduce/src/pmc/resizablepmcarray.pmc Sat Feb 20 11:41:44 2010 (r44225)
+++ branches/sys_mem_reduce/src/pmc/resizablepmcarray.pmc Sat Feb 20 11:42:15 2010 (r44226)
@@ -92,7 +92,8 @@
if (cur < 8)
cur = 8;
- PMC_array(SELF) = mem_realloc_n_typed(PMC_array(SELF), cur, PMC *);
+ PMC_array(SELF) = mem_gc_realloc_n_typed_zeroed(INTERP,
+ PMC_array(SELF), cur, i, PMC *);
for (; i < cur; i++) {
(PMC_array(SELF))[i] = PMCNULL;
Modified: branches/sys_mem_reduce/src/pmc/sockaddr.pmc
==============================================================================
--- branches/sys_mem_reduce/src/pmc/sockaddr.pmc Sat Feb 20 11:41:44 2010 (r44225)
+++ branches/sys_mem_reduce/src/pmc/sockaddr.pmc Sat Feb 20 11:42:15 2010 (r44226)
@@ -46,7 +46,8 @@
Parrot_Sockaddr_attributes * const pdata_struct =
(Parrot_Sockaddr_attributes *) PMC_data(SELF);
- pdata_struct->pointer = mem_allocate_zeroed_typed(struct sockaddr_in);
+ pdata_struct->pointer = mem_gc_allocate_zeroed_typed(INTERP,
+ struct sockaddr_in);
PObj_custom_destroy_SET(SELF);
}
Modified: branches/sys_mem_reduce/src/pmc/sub.pmc
==============================================================================
--- branches/sys_mem_reduce/src/pmc/sub.pmc Sat Feb 20 11:41:44 2010 (r44225)
+++ branches/sys_mem_reduce/src/pmc/sub.pmc Sat Feb 20 11:42:15 2010 (r44226)
@@ -184,7 +184,8 @@
if (VTABLE_exists_keyed_str(INTERP, init, field)) {
PMC *tmp = VTABLE_get_pmc_keyed_str(INTERP, init, field);
/* Allocate structure to store argument information in. */
- attrs->arg_info = mem_allocate_zeroed_typed(Parrot_sub_arginfo);
+ attrs->arg_info = mem_gc_allocate_zeroed_typed(INTERP,
+ Parrot_sub_arginfo);
/*
Hash.get_integer_keyed_str return 0 if key doesn't exists.
So, don't check existence of key, just use it.
@@ -222,7 +223,7 @@
if (sub) {
if (sub->arg_info)
- mem_sys_free(sub->arg_info);
+ mem_gc_free(INTERP, sub->arg_info);
}
}
@@ -843,7 +844,8 @@
const opcode_t *pc = sub->seg->base.data + sub->start_offs;
/* Allocate structure to store argument information in. */
- sub->arg_info = mem_allocate_zeroed_typed(Parrot_sub_arginfo);
+ sub->arg_info = mem_gc_allocate_zeroed_typed(INTERP,
+ Parrot_sub_arginfo);
/* If the first instruction is a get_params... */
if (*pc == PARROT_OP_get_params_pc) {
More information about the parrot-commits
mailing list