Permalink
Browse files

needs the exclusive control for JIT compiling.

  • Loading branch information...
Watson1978 committed Jul 6, 2011
1 parent d08f39d commit d1d50ef583a1c7ab151f0e26dfa233bcf668a023
Showing with 6 additions and 0 deletions.
  1. +6 −0 vm.cpp
View
6 vm.cpp
@@ -2630,14 +2630,18 @@ rb_vm_define_attr(Class klass, const char *name, bool read, bool write)
ID iname = rb_intern(buf);
if (read) {
+ GET_CORE()->lock();
Function *f = RoxorCompiler::shared->compile_read_attr(iname);
+ GET_CORE()->unlock();
SEL sel = sel_registerName(name);
rb_vm_prepare_method(klass, false, sel, f, rb_vm_arity(0),
VM_METHOD_FBODY);
}
if (write) {
+ GET_CORE()->lock();
Function *f = RoxorCompiler::shared->compile_write_attr(iname);
+ GET_CORE()->unlock();
snprintf(buf, sizeof buf, "%s=:", name);
SEL sel = sel_registerName(buf);
rb_vm_prepare_method(klass, false, sel, f, rb_vm_arity(1),
@@ -2734,8 +2738,10 @@ rb_vm_define_method3(Class klass, ID mid, rb_vm_block_t *block)
const int arity = rb_vm_arity_n(block->arity);
SEL sel = rb_vm_id_to_sel(mid, arity);
+ GET_CORE()->lock();
Function *func = RoxorCompiler::shared->compile_block_caller(block);
IMP imp = GET_CORE()->compile(func);
+ GET_CORE()->unlock();
NODE *body = rb_vm_cfunc_node_from_imp(klass, arity < -1 ? -2 : arity, imp, 0);
GC_RETAIN(body);
GC_RETAIN(block);

0 comments on commit d1d50ef

Please sign in to comment.