Permalink
Browse files

some fixes for bleeding-edge adventurers

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@4141 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
1 parent 49a913c commit 35796691cb49c53061b3fb2df8acf0804554c5b5 @lrz lrz committed May 24, 2010
Showing with 18 additions and 15 deletions.
  1. +1 −1 gc.c
  2. +3 −0 include/ruby/ruby.h
  3. +14 −14 vm.cpp
View
@@ -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);
}
View
@@ -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>
View
@@ -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());
@@ -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,
@@ -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;
}
@@ -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;
@@ -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);

0 comments on commit 3579669

Please sign in to comment.