Skip to content

Commit

Permalink
some fixes for bleeding-edge adventurers
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@4141 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information
lrz committed May 24, 2010
1 parent 49a913c commit 3579669
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ rb_gc_disable(VALUE self, SEL sel)
VALUE rb_mGC;

void
rb_gc_assign_weak_ref(const void *value, void *const*location)
rb_gc_assign_weak_ref(const void *value, const void **location)
{
auto_assign_weak_reference(__auto_zone, value, location, NULL);
}
Expand Down
3 changes: 3 additions & 0 deletions include/ruby/ruby.h
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,9 @@ rb_objc_release(void *addr)
}
#define GC_RELEASE(obj) (rb_objc_release((void *)obj))

void *rb_gc_read_weak_ref(void **referrer);
void rb_gc_assign_weak_ref(const void *value, const void **location);

#if RUBY_INCLUDED_AS_FRAMEWORK
#include <MacRuby/ruby/missing.h>
#include <MacRuby/ruby/intern.h>
Expand Down
28 changes: 14 additions & 14 deletions vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,8 @@ class RoxorJITManager : public JITMemoryManager, public JITEventListener {
std::string path;
for (std::vector<EmittedFunctionDetails::LineStart>::const_iterator iter = Details.LineStarts.begin(); iter != Details.LineStarts.end(); ++iter) {
#if LLVM_TOT
//MDNode *scope = iter->Loc.getScope(F.getContext());
//DILocation dil = DILocation(scope);
DILocation dil = Details.MF->getDILocation(iter->Loc);
MDNode *scope = iter->Loc.getAsMDNode(F.getContext());
DILocation dil = DILocation(scope);
if (path.size() == 0) {
DIScope scope = dil.getScope();
path.append(scope.getDirectory());
Expand Down Expand Up @@ -2777,14 +2776,6 @@ rb_vm_get_block(VALUE obj)
return rb_proc_get_block(proc);
}

extern "C"
void*
rb_gc_read_weak_ref(void **referrer);

extern "C"
void
rb_gc_assign_weak_ref(const void *value, void *const*location);

static const int VM_LVAR_USES_SIZE = 8;
enum {
VM_LVAR_USE_TYPE_BLOCK = 1,
Expand Down Expand Up @@ -2816,7 +2807,7 @@ rb_vm_add_lvar_use(rb_vm_var_uses **var_uses, void *use,
}

const int current_index = (*var_uses)->uses_count;
rb_gc_assign_weak_ref(use, &(*var_uses)->uses[current_index]);
rb_gc_assign_weak_ref(use, (const void **)&(*var_uses)->uses[current_index]);
(*var_uses)->use_types[current_index] = use_type;
++(*var_uses)->uses_count;
}
Expand Down Expand Up @@ -2927,7 +2918,7 @@ rb_vm_keep_vars(rb_vm_var_uses *uses, int lvars_size, ...)
}

// indicate to the GC that we do not have a reference here anymore
rb_gc_assign_weak_ref(NULL, &current->uses[use_index]);
rb_gc_assign_weak_ref(NULL, (const void **)&current->uses[use_index]);
}
}
void *old_current = current;
Expand Down Expand Up @@ -4633,10 +4624,19 @@ Init_PreVM(void)
kernel_end = kernel_beg + kernel_i386_bc_len - 1;
#endif

#if LLVM_TOT
MemoryBuffer *mbuf = MemoryBuffer::getMemBuffer(StringRef(kernel_beg,
kernel_end - kernel_beg));
#else
MemoryBuffer *mbuf = MemoryBuffer::getMemBuffer(kernel_beg, kernel_end);
#endif
assert(mbuf != NULL);
RoxorCompiler::module = ParseBitcodeFile(mbuf, getGlobalContext());
std::string err;
RoxorCompiler::module = ParseBitcodeFile(mbuf, getGlobalContext(), &err);
delete mbuf;
if (RoxorCompiler::module == NULL) {
printf("kernel bitcode couldn't be read: %s\n", err.c_str());
}
assert(RoxorCompiler::module != NULL);

RoxorCompiler::module->setTargetTriple(TARGET_TRIPLE);
Expand Down

0 comments on commit 3579669

Please sign in to comment.