[svn:parrot] r44073 - branches/sys_mem_reduce/src/pmc
bacek at svn.parrot.org
bacek at svn.parrot.org
Wed Feb 17 07:50:21 UTC 2010
Author: bacek
Date: Wed Feb 17 07:50:20 2010
New Revision: 44073
URL: https://trac.parrot.org/parrot/changeset/44073
Log:
Switch RBA to use GC allocations
Modified:
branches/sys_mem_reduce/src/pmc/resizablebooleanarray.pmc
Modified: branches/sys_mem_reduce/src/pmc/resizablebooleanarray.pmc
==============================================================================
--- branches/sys_mem_reduce/src/pmc/resizablebooleanarray.pmc Wed Feb 17 07:49:46 2010 (r44072)
+++ branches/sys_mem_reduce/src/pmc/resizablebooleanarray.pmc Wed Feb 17 07:50:20 2010 (r44073)
@@ -148,8 +148,9 @@
/* Nothing allocated yet */
GET_ATTR_bit_array(INTERP, SELF, bit_array);
if (!bit_array) {
+ // FIXME Clear allocated memory
SET_ATTR_bit_array(INTERP, SELF,
- (unsigned char *)mem_sys_allocate_zeroed(new_size_in_bytes));
+ (unsigned char *)Parrot_gc_allocate_memory_chunk(INTERP, new_size_in_bytes));
/* The size is different, and doesn't fit within the current
* allocation */
@@ -157,7 +158,7 @@
else if (new_size_in_bytes != old_size_in_bytes) {
unsigned char * old_store = bit_array;
unsigned char * new_store =
- (unsigned char *)mem_sys_allocate_zeroed(new_tail_pos);
+ (unsigned char *)Parrot_gc_allocate_memory_chunk(INTERP, new_tail_pos);
size_t copy_size =
new_size_in_bytes < old_size_in_bytes ? new_size_in_bytes : old_size_in_bytes;
@@ -165,7 +166,7 @@
SET_ATTR_bit_array(INTERP, SELF,
(unsigned char *)mem_sys_memmove(
new_store, old_store, copy_size));
- mem_sys_free(old_store);
+ gc_mem_free(INTERP, old_store);
}
}
@@ -249,7 +250,8 @@
/* Allocate an extra allocation unit of space in new array */
new_mem_size = ROUND_BYTES(tail_pos+ MIN_ALLOC);
- new_bit_array = (unsigned char *)mem_sys_allocate_zeroed(new_mem_size);
+ // FIXME Clear allocated memory
+ new_bit_array = (unsigned char *)Parrot_gc_allocate_memory_chunk(INTERP, new_mem_size);
/* Copy contents of old array to new array, moving the head
* position forward by one allocation unit (in bytes). */
@@ -259,7 +261,7 @@
/* Replace old array with new array, and free old array */
SET_ATTR_bit_array(INTERP, SELF, new_bit_array);
- mem_sys_free(old_bit_array);
+ gc_mem_free(INTERP, old_bit_array);
/* Added one allocation unit to the head position offset */
SET_ATTR_size(INTERP, SELF, tail_pos + MIN_ALLOC);
@@ -309,7 +311,7 @@
GET_ATTR_size(INTERP, SELF, tail_pos);
new_mem_size = ROUND_BYTES(tail_pos - MIN_ALLOC);
new_bit_array =
- (unsigned char *)mem_sys_allocate_zeroed(new_mem_size);
+ (unsigned char *)Parrot_gc_allocate_memory_chunk(INTERP, new_mem_size);
/* Copy contents of old array to new array, move the head position
* offset back by one allocation unit (in bytes) */
@@ -319,7 +321,7 @@
/* Replace old array with new array, and free old array */
SET_ATTR_bit_array(INTERP, SELF, new_bit_array);
- mem_sys_free(old_bit_array);
+ gc_mem_free(INTERP, old_bit_array);
/* Removed one allocation unit from the head position offset */
SET_ATTR_size(INTERP, SELF, tail_pos - MIN_ALLOC);
@@ -384,7 +386,7 @@
if (my_bit_array) {
size_t size_in_bits = tail_pos / BITS_PER_CHAR + 1;
- dest_bit_array = (unsigned char *)mem_sys_allocate(size_in_bits);
+ dest_bit_array = (unsigned char *)Parrot_gc_allocate_memory_chunk(INTERP, size_in_bits);
mem_sys_memcopy(dest_bit_array, my_bit_array, size_in_bits);
}
else
More information about the parrot-commits
mailing list