[macruby-changes] [661] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Oct 9 14:40:45 PDT 2008


Revision: 661
          http://trac.macosforge.org/projects/ruby/changeset/661
Author:   lsansonetti at apple.com
Date:     2008-10-09 14:40:45 -0700 (Thu, 09 Oct 2008)
Log Message:
-----------
more missing wb

Modified Paths:
--------------
    MacRuby/trunk/compile.c
    MacRuby/trunk/cont.c
    MacRuby/trunk/eval_jump.c
    MacRuby/trunk/file.c
    MacRuby/trunk/struct.c
    MacRuby/trunk/thread.c

Modified: MacRuby/trunk/compile.c
===================================================================
--- MacRuby/trunk/compile.c	2008-10-09 02:30:52 UTC (rev 660)
+++ MacRuby/trunk/compile.c	2008-10-09 21:40:45 UTC (rev 661)
@@ -304,7 +304,7 @@
 #endif
     int i;
 
-    iseq->iseq_encoded = ALLOC_N(VALUE, iseq->iseq_size);
+    GC_WB(&iseq->iseq_encoded, ALLOC_N(VALUE, iseq->iseq_size));
     MEMCPY(iseq->iseq_encoded, iseq->iseq, VALUE, iseq->iseq_size);
 
     for (i = 0; i < iseq->iseq_size; /* */ ) {
@@ -802,7 +802,7 @@
     if (!id_dollar_bang) {
 	id_dollar_bang = rb_intern("#$!");
     }
-    iseq->local_table = (ID *)ALLOC_N(ID *, 1);
+    GC_WB(&iseq->local_table, (ID *)ALLOC_N(ID *, 1));
     iseq->local_table_size = 1;
     iseq->local_size = iseq->local_table_size + 1;
     iseq->local_table[0] = id_dollar_bang;
@@ -1028,7 +1028,7 @@
     }
 
     if (size > 0) {
-	iseq->local_table = (ID *)ALLOC_N(ID *, size);
+	GC_WB(&iseq->local_table, (ID *)ALLOC_N(ID *, size));
 	MEMCPY(iseq->local_table, tbl, ID *, size);
     }
 
@@ -5076,7 +5076,7 @@
 	iseq->arg_post_len = FIX2INT(arg_post_len);
 	iseq->arg_post_start = FIX2INT(arg_post_start);
 	iseq->arg_block = FIX2INT(arg_block);
-	iseq->arg_opt_table = (VALUE *)ALLOC_N(VALUE, RARRAY_LEN(arg_opt_labels));
+	GC_WB(&iseq->arg_opt_table, (VALUE *)ALLOC_N(VALUE, RARRAY_LEN(arg_opt_labels)));
 
 	if (iseq->arg_block != -1) {
 	    iseq->arg_size = iseq->arg_block + 1;

Modified: MacRuby/trunk/cont.c
===================================================================
--- MacRuby/trunk/cont.c	2008-10-09 02:30:52 UTC (rev 660)
+++ MacRuby/trunk/cont.c	2008-10-09 21:40:45 UTC (rev 661)
@@ -130,7 +130,7 @@
 	REALLOC_N(cont->machine_stack, VALUE, size);
     }
     else {
-	cont->machine_stack = ALLOC_N(VALUE, size);
+	GC_WB(&cont->machine_stack, ALLOC_N(VALUE, size));
     }
 
     FLUSH_REGISTER_WINDOWS;
@@ -144,7 +144,7 @@
 	REALLOC_N(cont->machine_register_stack, VALUE, size);
     }
     else {
-	cont->machine_register_stack = ALLOC_N(VALUE, size);
+	GC_WB(&cont->machine_register_stack, ALLOC_N(VALUE, size));
     }
 
     MEMCPY(cont->machine_register_stack, cont->machine_register_stack_src, VALUE, size);
@@ -190,7 +190,7 @@
     contval = cont->self;
     sth = &cont->saved_thread;
 
-    cont->vm_stack = ALLOC_N(VALUE, th->stack_size);
+    GC_WB(&cont->vm_stack, ALLOC_N(VALUE, th->stack_size));
     MEMCPY(cont->vm_stack, th->stack, VALUE, th->stack_size);
     sth->stack = 0;
 
@@ -600,7 +600,7 @@
 	args = cont->value;
 	cont->value = Qnil;
 	th->errinfo = Qnil;
-	th->local_lfp = proc->block.lfp;
+	GC_WB(&th->local_lfp, proc->block.lfp);
 	th->local_svar = Qnil;
 
 	cont->value = vm_invoke_proc(th, proc, proc->block.self, 1, &args, 0);

Modified: MacRuby/trunk/eval_jump.c
===================================================================
--- MacRuby/trunk/eval_jump.c	2008-10-09 02:30:52 UTC (rev 660)
+++ MacRuby/trunk/eval_jump.c	2008-10-09 21:40:45 UTC (rev 661)
@@ -59,6 +59,7 @@
 void
 rb_set_end_proc(void (*func)(VALUE), VALUE data)
 {
+    /* FIXME not GC safe! */
     struct end_proc_data *link = ALLOC(struct end_proc_data);
     struct end_proc_data **list;
     rb_thread_t *th = GET_THREAD();

Modified: MacRuby/trunk/file.c
===================================================================
--- MacRuby/trunk/file.c	2008-10-09 02:30:52 UTC (rev 660)
+++ MacRuby/trunk/file.c	2008-10-09 21:40:45 UTC (rev 661)
@@ -3785,7 +3785,7 @@
     }
     nst = ALLOC(struct stat);
     *nst = st;
-    DATA_PTR(obj) = nst;
+    GC_WB(&DATA_PTR(obj), nst);
 
     return Qnil;
 }
@@ -3809,7 +3809,7 @@
     if (DATA_PTR(orig)) {
 	nst = ALLOC(struct stat);
 	*nst = *(struct stat*)DATA_PTR(orig);
-	DATA_PTR(copy) = nst;
+	GC_WB(&DATA_PTR(copy), nst);
     }
 
     return copy;

Modified: MacRuby/trunk/struct.c
===================================================================
--- MacRuby/trunk/struct.c	2008-10-09 02:30:52 UTC (rev 660)
+++ MacRuby/trunk/struct.c	2008-10-09 21:40:45 UTC (rev 661)
@@ -387,7 +387,7 @@
 	rb_mem_clear(st->as.ary, n);
     }
     else {
-	st->as.heap.ptr = ALLOC_N(VALUE, n);
+	GC_WB(&st->as.heap.ptr, ALLOC_N(VALUE, n));
 	rb_mem_clear(st->as.heap.ptr, n);
 	st->as.heap.len = n;
     }

Modified: MacRuby/trunk/thread.c
===================================================================
--- MacRuby/trunk/thread.c	2008-10-09 02:30:52 UTC (rev 660)
+++ MacRuby/trunk/thread.c	2008-10-09 21:40:45 UTC (rev 661)
@@ -1755,7 +1755,7 @@
 rb_fd_init(volatile rb_fdset_t *fds)
 {
     fds->maxfd = 0;
-    fds->fdset = ALLOC(fd_set);
+    GC_WB(&fds->fdset, ALLOC(fd_set));
     FD_ZERO(fds->fdset);
 }
 
@@ -1971,18 +1971,18 @@
     thread_debug("rb_thread_wait_fd_rw(%d, %s)\n", fd, read ? "read" : "write");
 
     while (result <= 0) {
-	rb_fdset_t set;
-	rb_fd_init(&set);
-	FD_SET(fd, &set);
+	rb_fdset_t *set = ALLOC(rb_fdset_t);
+	rb_fd_init(set);
+	FD_SET(fd, set);
 
 	if (read) {
-	    result = do_select(fd + 1, rb_fd_ptr(&set), 0, 0, 0);
+	    result = do_select(fd + 1, rb_fd_ptr(set), 0, 0, 0);
 	}
 	else {
-	    result = do_select(fd + 1, 0, rb_fd_ptr(&set), 0, 0);
+	    result = do_select(fd + 1, 0, rb_fd_ptr(set), 0, 0);
 	}
 
-	rb_fd_term(&set);
+	rb_fd_term(set);
 
 	if (result < 0) {
 	    rb_sys_fail(0);
@@ -2748,7 +2748,8 @@
 	return Qfalse;
     }
     else {
-	*barrier->tail = q = ALLOC(rb_thread_list_t);
+	GC_WB(barrier->tail, ALLOC(rb_thread_list_t));
+	q = *barrier->tail;
 	q->th = GET_THREAD();
 	q->next = 0;
 	barrier->tail = &q->next;
@@ -2872,7 +2873,7 @@
     rb_event_hook_t *hook = ALLOC(rb_event_hook_t);
     hook->func = func;
     hook->flag = events;
-    hook->data = data;
+    GC_WB(&hook->data, data);
     return hook;
 }
 
@@ -2892,6 +2893,7 @@
 rb_thread_add_event_hook(rb_thread_t *th,
 			 rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
 {
+    /* FIXME not GC safe! */
     rb_event_hook_t *hook = alloc_event_fook(func, events, data);
     hook->next = th->event_hooks;
     th->event_hooks = hook;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macruby-changes/attachments/20081009/551ab2dd/attachment.html 


More information about the macruby-changes mailing list