[macruby-changes] [433] MacRuby/branches/lrz_unstable
source_changes at macosforge.org
source_changes at macosforge.org
Wed Aug 13 15:31:28 PDT 2008
Revision: 433
http://trac.macosforge.org/projects/ruby/changeset/433
Author: lsansonetti at apple.com
Date: 2008-08-13 15:31:28 -0700 (Wed, 13 Aug 2008)
Log Message:
-----------
more write barriers for the new GC
Modified Paths:
--------------
MacRuby/branches/lrz_unstable/bignum.c
MacRuby/branches/lrz_unstable/re.c
MacRuby/branches/lrz_unstable/st.c
MacRuby/branches/lrz_unstable/string.c
MacRuby/branches/lrz_unstable/vm.c
Modified: MacRuby/branches/lrz_unstable/bignum.c
===================================================================
--- MacRuby/branches/lrz_unstable/bignum.c 2008-08-13 08:30:59 UTC (rev 432)
+++ MacRuby/branches/lrz_unstable/bignum.c 2008-08-13 22:31:28 UTC (rev 433)
@@ -82,7 +82,7 @@
ds = ALLOC_N(BDIGIT, len);
MEMCPY(ds, RBIGNUM(big)->as.ary, BDIGIT, RBIGNUM_EMBED_LEN_MAX);
RBIGNUM(big)->as.heap.len = RBIGNUM_LEN(big);
- RBIGNUM(big)->as.heap.digits = ds;
+ GC_WB(&RBIGNUM(big)->as.heap.digits, ds);
RBASIC(big)->flags &= ~RBIGNUM_EMBED_FLAG;
}
}
@@ -98,10 +98,11 @@
}
else {
if (RBIGNUM_LEN(big) == 0) {
- RBIGNUM(big)->as.heap.digits = ALLOC_N(BDIGIT, len);
+ GC_WB(&RBIGNUM(big)->as.heap.digits, ALLOC_N(BDIGIT, len));
}
else {
REALLOC_N(RBIGNUM(big)->as.heap.digits, BDIGIT, len);
+ GC_WB(&RBIGNUM(big)->as.heap.digits, RBIGNUM(big)->as.heap.digits);
}
}
}
Modified: MacRuby/branches/lrz_unstable/re.c
===================================================================
--- MacRuby/branches/lrz_unstable/re.c 2008-08-13 08:30:59 UTC (rev 432)
+++ MacRuby/branches/lrz_unstable/re.c 2008-08-13 22:31:28 UTC (rev 433)
@@ -1383,7 +1383,7 @@
if (!reverse) {
range += RSTRING_LEN(str);
}
- MEMZERO(®s, struct re_registers, 1);
+ MEMZERO(pregs, struct re_registers, 1);
result = onig_search(RREGEXP(re)->ptr,
(UChar*)cstr,
((UChar*)cstr + clen),
Modified: MacRuby/branches/lrz_unstable/st.c
===================================================================
--- MacRuby/branches/lrz_unstable/st.c 2008-08-13 08:30:59 UTC (rev 432)
+++ MacRuby/branches/lrz_unstable/st.c 2008-08-13 22:31:28 UTC (rev 433)
@@ -174,7 +174,7 @@
tbl->num_entries = 0;
tbl->entries_packed = type == &type_numhash && size/2 <= MAX_PACKED_NUMHASH;
tbl->num_bins = size;
- tbl->bins = (st_table_entry **)Calloc(size, sizeof(st_table_entry*));
+ GC_WB(&tbl->bins, (st_table_entry **)Calloc(size, sizeof(st_table_entry*)));
tbl->head = 0;
return tbl;
@@ -473,8 +473,8 @@
}
*new_table = *old_table;
- new_table->bins = (st_table_entry**)
- Calloc((unsigned)num_bins, sizeof(st_table_entry*));
+ GC_WB(&new_table->bins, (st_table_entry**)
+ Calloc((unsigned)num_bins, sizeof(st_table_entry*)));
if (new_table->bins == 0) {
free(new_table);
@@ -498,7 +498,7 @@
*entry = *ptr;
hash_val = entry->hash % num_bins;
entry->next = new_table->bins[hash_val];
- new_table->bins[hash_val] = entry;
+ GC_WB(&new_table->bins[hash_val], entry);
entry->back = prev;
*tail = prev = entry;
tail = &entry->fore;
Modified: MacRuby/branches/lrz_unstable/string.c
===================================================================
--- MacRuby/branches/lrz_unstable/string.c 2008-08-13 08:30:59 UTC (rev 432)
+++ MacRuby/branches/lrz_unstable/string.c 2008-08-13 22:31:28 UTC (rev 433)
@@ -1359,6 +1359,7 @@
const char *cptr;
data = (CFDataRef)rb_str_cfdata2(ptr);
+ cptr = NULL;
if (data == NULL) {
cptr = CFStringGetCStringPtr((CFStringRef)ptr, 0);
if (cptr == NULL) {
Modified: MacRuby/branches/lrz_unstable/vm.c
===================================================================
--- MacRuby/branches/lrz_unstable/vm.c 2008-08-13 08:30:59 UTC (rev 432)
+++ MacRuby/branches/lrz_unstable/vm.c 2008-08-13 22:31:28 UTC (rev 433)
@@ -91,7 +91,7 @@
th->cfp->sp, block->lfp, iseq->local_size);
if (cref) {
- th->cfp->dfp[-1] = (VALUE)cref;
+ GC_WB(&th->cfp->dfp[-1], (VALUE)cref);
}
}
@@ -246,8 +246,8 @@
env->env_size = local_size + 1 + 2;
env->local_size = local_size;
- env->env = ALLOC_N(VALUE, env->env_size);
- env->prev_envval = penvval;
+ GC_WB(&env->env, ALLOC_N(VALUE, env->env_size));
+ GC_WB(&env->prev_envval, penvval);
for (i = 0; i <= local_size; i++) {
env->env[i] = envptr[-local_size + i];
@@ -1725,11 +1725,12 @@
rb_iseq_t *iseq;
/* create vm object */
- vm->self = Data_Wrap_Struct(rb_cVM, rb_vm_mark, vm_free, vm);
+ GC_WB(&vm->self, Data_Wrap_Struct(rb_cVM, rb_vm_mark, vm_free, vm));
/* create main thread */
- th_self = th->self = Data_Wrap_Struct(rb_cThread, rb_thread_mark,
+ th_self = Data_Wrap_Struct(rb_cThread, rb_thread_mark,
thread_free, th);
+ GC_WB(&th->self, th_self);
vm->main_thread = th;
vm->running_thread = th;
th->vm = vm;
@@ -1737,10 +1738,11 @@
th->top_self = rb_vm_top_self();
rb_thread_set_current(th);
- vm->living_threads = st_init_numtable();
+ GC_WB(&vm->living_threads, st_init_numtable());
st_insert(vm->living_threads, th_self, (st_data_t) th->thread_id);
rb_register_mark_object(iseqval);
+ rb_objc_retain((void *)iseqval);
GetISeqPtr(iseqval, iseq);
th->cfp->iseq = iseq;
th->cfp->pc = iseq->iseq_encoded;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20080813/65094c2e/attachment.html
More information about the macruby-changes
mailing list