Beispiel #1
0
  void Compiler::compile_method(BackgroundCompileRequest* req) {
    CompiledCode* code = req->method();

    if(ctx_->llvm_state()->config().jit_inline_debug) {
      struct timeval tv;
      gettimeofday(&tv, NULL);

      ctx_->llvm_state()->log() << "JIT: compiling "
        << ctx_->llvm_state()->enclosure_name(code)
        << "#"
        << ctx_->llvm_state()->symbol_debug_str(code->name())
        << " (" << tv.tv_sec << "." << tv.tv_usec << ")\n";
    }

    JITMethodInfo info(ctx_, code, code->machine_code());
    info.is_block = false;

    if(Class* cls = req->receiver_class()) {
      info.set_self_class(cls);
    }

    ctx_->set_root(&info);

    jit::MethodBuilder work(ctx_, info);
    work.setup();

    compile_builder(info, work);
    ctx_->set_root(NULL);
  }
Beispiel #2
0
  void Compiler::compile_block(CompiledCode* code, MachineCode* mcode) {
    if(!mcode->parent()) return;
    if(ctx_->llvm_state()->config().jit_inline_debug) {

      struct timeval tv;
      gettimeofday(&tv, NULL);

      ctx_->llvm_state()->log() << "JIT: compiling block in "
        << ctx_->llvm_state()->symbol_debug_str(code->name())
        << " near "
        << ctx_->llvm_state()->symbol_debug_str(code->file()) << ":"
        << code->start_line()
        << " (" << tv.tv_sec << "." << tv.tv_usec << ")\n";
    }

    JITMethodInfo info(ctx_, code, mcode);
    info.is_block = true;

    ctx_->set_root(&info);

    jit::BlockBuilder work(ctx_, info);
    work.setup();

    compile_builder(info, work);
    ctx_->set_root(NULL);
  }
Beispiel #3
0
  void Compiler::compile_method(LLVMState* ls, BackgroundCompileRequest* req) {
    CompiledCode* cm = req->method();

    if(ls->config().jit_inline_debug) {
      struct timeval tv;
      gettimeofday(&tv, NULL);

      ls->log() << "JIT: compiling "
        << ls->enclosure_name(cm)
        << "#"
        << ls->symbol_debug_str(cm->name())
        << " (" << tv.tv_sec << "." << tv.tv_usec << ")\n";
    }

    JITMethodInfo info(ctx_, cm, cm->backend_method());
    info.is_block = false;

    if(Class* cls = req->receiver_class()) {
      info.set_self_class(cls);
    }

    ctx_.set_root(&info);

    jit::MethodBuilder work(ls, info);
    work.setup();

    compile_builder(ctx_, ls, info, work);
    ctx_.set_root(NULL);
  }
Beispiel #4
0
  void Compiler::compile_block(LLVMState* ls, CompiledCode* cm, VMMethod* vmm) {
    if(ls->config().jit_inline_debug) {
      assert(vmm->parent());

      struct timeval tv;
      gettimeofday(&tv, NULL);

      ls->log() << "JIT: compiling block in "
        << ls->symbol_debug_str(cm->name())
        << " near "
        << ls->symbol_debug_str(cm->file()) << ":"
        << cm->start_line()
        << " (" << tv.tv_sec << "." << tv.tv_usec << ")\n";
    }

    JITMethodInfo info(ctx_, cm, vmm);
    info.is_block = true;

    ctx_.set_root(&info);

    jit::BlockBuilder work(ls, info);
    work.setup();

    compile_builder(ctx_, ls, info, work);
  }
Beispiel #5
0
  void Compiler::compile_method(LLVMState* ls, CompiledMethod* cm, VMMethod* vmm) {
    if(ls->config().jit_inline_debug) {
      struct timeval tv;
      gettimeofday(&tv, NULL);

      ls->log() << "JIT: compiling "
        << ls->enclosure_name(cm)
        << "#"
        << ls->symbol_cstr(cm->name())
        << " (" << tv.tv_sec << "." << tv.tv_usec << ")\n";
    }

    jit::Context ctx(ls);
    JITMethodInfo info(ctx, cm, vmm);
    info.is_block = false;

    ctx.set_root(&info);

    jit::MethodBuilder work(ls, info);
    work.setup();

    compile_builder(ctx, ls, info, work);
  }
Beispiel #6
0
  void Compiler::compile_method(BackgroundCompileRequest* req) {
    CompiledCode* code = req->method();

    if(ctx_->llvm_state()->config().jit_inline_debug) {
      struct timeval tv;
      gettimeofday(&tv, NULL);

      ctx_->llvm_state()->log() << "JIT: compiling "
        << ctx_->llvm_state()->enclosure_name(code)
        << "#"
        << ctx_->llvm_state()->symbol_debug_str(code->name())
        << " (" << tv.tv_sec << "." << tv.tv_usec << ")\n";
    }

#ifdef HAVE_DTRACE
    if(RUBINIUS_JIT_FUNCTION_BEGIN_ENABLED()) {
      RBX_DTRACE_CONST char* class_name =
          const_cast<RBX_DTRACE_CONST char*>(
              ctx_->llvm_state()->enclosure_name(code).c_str());
      RBX_DTRACE_CONST char* method_name =
          const_cast<RBX_DTRACE_CONST char*>(
              ctx_->llvm_state()->symbol_debug_str(code->name()).c_str());
      RBX_DTRACE_CONST char* file_name =
          const_cast<RBX_DTRACE_CONST char*>(
              ctx_->llvm_state()->symbol_debug_str(code->file()).c_str());
      int line = code->start_line();
      RUBINIUS_JIT_FUNCTION_BEGIN(class_name, method_name, file_name, line);
    }
#endif

    JITMethodInfo info(ctx_, code, code->machine_code());
    info.is_block = false;
    info.hits = req->hits();

    if(Class* cls = req->receiver_class()) {
      info.set_self_class(cls);
    }

    ctx_->set_root(&info);

    jit::MethodBuilder work(ctx_, info);
    work.setup();

    compile_builder(info, work);
    ctx_->set_root(NULL);

#ifdef HAVE_DTRACE
    if(RUBINIUS_JIT_FUNCTION_END_ENABLED()) {
      RBX_DTRACE_CONST char* class_name =
          const_cast<RBX_DTRACE_CONST char*>(
              ctx_->llvm_state()->enclosure_name(code).c_str());
      RBX_DTRACE_CONST char* method_name =
          const_cast<RBX_DTRACE_CONST char*>(
              ctx_->llvm_state()->symbol_debug_str(code->name()).c_str());
      RBX_DTRACE_CONST char* file_name =
          const_cast<RBX_DTRACE_CONST char*>(
              ctx_->llvm_state()->symbol_debug_str(code->file()).c_str());
      int line = code->start_line();
      RUBINIUS_JIT_FUNCTION_END(class_name, method_name, file_name, line);
    }
#endif
  }