Skip to content

Commit

Permalink
Fixed --disable-llvm.
Browse files Browse the repository at this point in the history
  • Loading branch information
brixen committed Nov 1, 2014
1 parent f129cf1 commit f846083
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
12 changes: 10 additions & 2 deletions vm/builtin/jit.cpp
Expand Up @@ -22,8 +22,10 @@ namespace rubinius {
Object* JIT::enable(STATE) {
if(!CBOOL(enabled())) return cFalse;

#ifdef ENABLE_LLVM
state->shared().llvm_state->enable(state);
enabled(state, cTrue);
#endif

return cTrue;
}
Expand All @@ -33,10 +35,12 @@ namespace rubinius {
{
if(!CBOOL(enabled())) return cFalse;

#ifdef ENABLE_LLVM
GCTokenImpl gct;

LLVMState* ls = state->shared().llvm_state;
ls->compile_soon(state, gct, code, call_frame, receiver_class, block_env, is_block);
#endif

return cTrue;
}
Expand All @@ -46,28 +50,34 @@ namespace rubinius {
{
if(!CBOOL(enabled())) return cFalse;

#ifdef ENABLE_LLVM
GCTokenImpl gct;

LLVMState* ls = state->shared().llvm_state;
ls->compile_callframe(state, gct, code, call_frame, primitive);
#endif

return cTrue;
}

Object* JIT::start_method_update(STATE) {
if(!CBOOL(enabled())) return cFalse;

#ifdef ENABLE_LLVM
LLVMState* ls = state->shared().llvm_state;
ls->start_method_update();
#endif

return cTrue;
}

Object* JIT::end_method_update(STATE) {
if(!CBOOL(enabled())) return cFalse;

#ifdef ENABLE_LLVM
LLVMState* ls = state->shared().llvm_state;
ls->end_method_update();
#endif

return cTrue;
}
Expand All @@ -86,6 +96,4 @@ namespace rubinius {

return request;
}


}
8 changes: 7 additions & 1 deletion vm/environment.cpp
Expand Up @@ -80,10 +80,12 @@ namespace rubinius {
, signal_handler_(NULL)
, finalizer_handler_(NULL)
{
#if defined ENABLE_LLVM && RBX_LLVM_API_VER < 305
#ifdef ENABLE_LLVM
#if RBX_LLVM_API_VER < 305
if(!llvm::llvm_start_multithreaded()) {
assert(0 && "llvm doesn't support threading!");
}
#endif
#endif

String::init_hash();
Expand Down Expand Up @@ -140,9 +142,11 @@ namespace rubinius {

if(state->shared().config.jit_disabled) return;

#ifdef ENABLE_LLVM
if(!state->shared().llvm_state) {
state->shared().llvm_state = new LLVMState(state);
}
#endif
}

void Environment::stop_logging(STATE) {
Expand All @@ -154,9 +158,11 @@ namespace rubinius {

if(state->shared().config.jit_disabled) return;

#ifdef ENABLE_LLVM
if(state->shared().llvm_state) {
state->shared().llvm_state->stop(state);
}
#endif
}

void Environment::start_signals(STATE) {
Expand Down
4 changes: 4 additions & 0 deletions vm/metrics.cpp
Expand Up @@ -13,7 +13,9 @@
#include "builtin/thread.hpp"
#include "builtin/tuple.hpp"

#ifdef ENABLE_LLVM
#include "llvm/state.hpp"
#endif

#include "gc/managed.hpp"

Expand Down Expand Up @@ -521,11 +523,13 @@ namespace rubinius {
}
}

#ifdef ENABLE_LLVM
if(state->shared().llvm_state) {
if(VM* vm = state->shared().llvm_state->vm()) {
metrics_collection_.add(vm->metrics());
}
}
#endif

metrics_collection_.add(&metrics_history_);

Expand Down
2 changes: 2 additions & 0 deletions vm/ontology.cpp
Expand Up @@ -489,7 +489,9 @@ namespace rubinius {

G(rubinius)->set_const(state, "PROGRAM_NAME", String::create(state, RBX_PROGRAM_NAME));
G(rubinius)->set_const(state, "RUBY_VERSION", String::create(state, RBX_RUBY_VERSION));
#ifdef ENABLE_LLVM
G(rubinius)->set_const(state, "LLVM_VERSION", String::create(state, RBX_LLVM_VERSION));
#endif
G(rubinius)->set_const(state, "VERSION", String::create(state, RBX_VERSION));
G(rubinius)->set_const(state, "LIB_VERSION", String::create(state, RBX_LIB_VERSION));
G(rubinius)->set_const(state, "BUILD_REV", String::create(state, RBX_BUILD_REV));
Expand Down
2 changes: 1 addition & 1 deletion vm/vm.cpp
Expand Up @@ -168,7 +168,7 @@ namespace rubinius {
}
#else
G(jit)->available(&state, cFalse);
G(jit)->properties(&state, cNil);
G(jit)->properties(&state, nil<Array>());
G(jit)->enabled(&state, cFalse);
#endif
}
Expand Down

0 comments on commit f846083

Please sign in to comment.