Example #1
0
 Object* CompiledMethod::compile(STATE) {
   if(backend_method_ == NULL || backend_method_->run != VMMethod::debugger_interpreter) {
     backend_method_ = NULL;
     formalize(state);
   }
   return this;
 }
Example #2
0
 Object* CompiledMethod::set_breakpoint(STATE, Fixnum* ip) {
   int i = ip->to_native();
   if(backend_method_ == NULL) formalize(state);
   if(!backend_method_->validate_ip(state, i)) return Primitives::failure();
   backend_method_->run = VMMethod::debugger_interpreter;
   backend_method_->set_breakpoint_flags(state, i, cBreakpoint);
   return ip;
 }
Example #3
0
  MachineMethod* CompiledMethod::make_machine_method(STATE) {
    if(backend_method_ == 0) {
      formalize(state, false);
    }

    JITCompiler jit;
    jit.compile(state, backend_method_);
    return MachineMethod::create(state, backend_method_, jit);
  }
Example #4
0
 void CompiledMethod::post_marshal(STATE) {
   formalize(state); // side-effect, populates backend_method_
   // Set the sender attribute of all SendSites in this method to this CM
   Tuple *lit = literals();
   for(std::size_t i = 0; i < lit->num_fields(); i++) {
     SendSite *ss = try_as<SendSite>(lit->at(state, i));
     if(ss != NULL) ss->sender(state, this);
   }
 }
Example #5
0
void grammarToAutomata(){
	printf("\nTesting Grammar to Automata Conversion ");
	printGrammar(g1);
	formalize(g1);
	printf("\nFormalized");
	printGrammar(g1);
	AutomataADT a = toAutomata(g1);
	printAutomata(a);
	printf("productions quant: %d\n", getQuant(getProductions(g1)));
}
Example #6
0
  Object* CompiledMethod::set_breakpoint(STATE, Fixnum* ip, Object* bp) {
    int i = ip->to_native();
    if(backend_method_ == NULL) formalize(state);
    if(!backend_method_->validate_ip(state, i)) return Primitives::failure();

    if(breakpoints_->nil_p()) {
      breakpoints_ = LookupTable::create(state);
    }

    breakpoints_->store(state, ip, bp);
    backend_method_->run = VMMethod::debugger_interpreter;
    return ip;
  }
Example #7
0
  Object* CompiledMethod::jit_soon(STATE) {
#ifdef ENABLE_LLVM
    if(backend_method_ == NULL) {
      formalize(state, false);
    }

    if(state->shared.config.jit_show_compiling) {
      std::cout << "[[[ JIT queueing " << full_name(state)->c_str() << " ]]]\n";
    }

    LLVMState::get(state)->compile_soon(state, this);
    return Qtrue;
#else
    return Qfalse;
#endif
  }
Example #8
0
  Object* CompiledMethod::jit_now(STATE) {
#ifdef ENABLE_LLVM
    if(backend_method_ == NULL) {
      formalize(state, false);
    }

    if(state->shared.config.jit_show_compiling) {
      std::cout << "[[[ JIT compiling " << full_name(state)->c_str() << " ]]]\n";
    }

    LLVMState* ls = LLVMState::get(state);

    jit::Compiler jit;
    jit.compile_method(ls, this, backend_method_);

    if(jit.generate_function(ls)) {
      backend_method_->set_jitted(jit.llvm_function(),
                                  jit.code_bytes(), jit.function_pointer());
      return Qtrue;
    }
#endif

    return Qfalse;
  }
Example #9
0
 void CompiledMethod::post_marshal(STATE) {
   formalize(state); // side-effect, populates backend_method_
 }
Example #10
0
 Object* CompiledMethod::compile(STATE) {
   backend_method_ = NULL;
   formalize(state);
   return this;
 }