Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 88545672f086
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a91c53b77c0c
Choose a head ref
  • 4 commits
  • 9 files changed
  • 1 contributor

Commits on May 15, 2015

  1. Fixed -Xjit.profile. Closes #3212.

    brixen committed May 15, 2015
    Copy the full SHA
    e8e4cf8 View commit details
  2. Copy the full SHA
    cf7e30d View commit details
  3. Updated rubinius-profiler.

    brixen committed May 15, 2015
    Copy the full SHA
    147fa57 View commit details
  4. Copy the full SHA
    a91c53b View commit details
Showing with 38 additions and 39 deletions.
  1. +1 −1 gems_list.txt
  2. +6 −8 spec/ruby/core/process/detach_spec.rb
  3. +3 −1 vm/instruments/tooling.cpp
  4. +3 −6 vm/llvm/jit_block.cpp
  5. +16 −5 vm/llvm/jit_context.cpp
  6. +2 −5 vm/llvm/jit_context.hpp
  7. +2 −9 vm/llvm/jit_method.cpp
  8. +4 −0 vm/llvm/jit_util.cpp
  9. +1 −4 vm/llvm/jit_visit.hpp
2 changes: 1 addition & 1 deletion gems_list.txt
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ rubinius-debugger-2.2.1.gem
rubinius-developer_tools-2.0.0.gem
rubinius-melbourne-2.3.1.0.gem
rubinius-processor-2.3.0.gem
rubinius-profiler-2.0.1.gem
rubinius-profiler-2.0.2.gem
rubinius-toolset-2.3.1.gem
rubysl-2.1.0.gem
rubysl-abbrev-2.0.4.gem
14 changes: 6 additions & 8 deletions spec/ruby/core/process/detach_spec.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
require File.expand_path('../../../spec_helper', __FILE__)
require 'timeout'

describe "Process.detach" do
platform_is_not :windows do
it "returns a thread" do
pid = Process.fork { Process.exit! }
thr = Process.detach(pid)
thr.should be_kind_of(Thread)
timeout(3) { thr.join }
thr.join
end

it "produces the exit Process::Status as the thread value" do
pid = Process.fork { Process.exit! }
thr = Process.detach(pid)
timeout(3) { thr.join }
thr = Process.detach(pid)
thr.join

status = thr.value
status.should be_kind_of(Process::Status)
@@ -23,24 +22,23 @@
platform_is_not :openbsd do
it "reaps the child process's status automatically" do
pid = Process.fork { Process.exit! }
thr = Process.detach(pid)
timeout(3) { thr.join }
Process.detach(pid).join
lambda { Process.waitpid(pid) }.should raise_error(Errno::ECHILD)
end
end

it "sets the :pid thread-local to the PID" do
pid = Process.fork { Process.exit! }
thr = Process.detach(pid)
timeout(3) { thr.join }
thr.join

thr[:pid].should == pid
end

it "provides a #pid method on the returned thread which returns the PID" do
pid = Process.fork { Process.exit! }
thr = Process.detach(pid)
timeout(3) { thr.join }
thr.join

thr.pid.should == pid
end
4 changes: 3 additions & 1 deletion vm/instruments/tooling.cpp
Original file line number Diff line number Diff line change
@@ -37,7 +37,9 @@ namespace tooling {
void ToolBroker::enable(STATE) {
if(!enable_func_) return;

state->shared().config.jit_disabled.set("true");
if(!state->shared().config.jit_profile.value) {
state->shared().config.jit_disabled.set("true");
}
System::vm_deoptimize_all(state, cTrue);

enable_func_(state->vm()->tooling_env());
9 changes: 3 additions & 6 deletions vm/llvm/jit_block.cpp
Original file line number Diff line number Diff line change
@@ -69,14 +69,11 @@ namespace jit {
import_args_ = b().GetInsertBlock();

if(ctx_->llvm_state()->include_profiling()) {
Value* test = b().CreateLoad(ctx_->profiling(), "profiling");

BasicBlock* setup_profiling = BasicBlock::Create(ctx_->llvm_context(), "setup_profiling", func);
BasicBlock* setup_profiling = BasicBlock::Create(ctx_->llvm_context(),
"setup_profiling", func);
BasicBlock* cont = BasicBlock::Create(ctx_->llvm_context(), "continue", func);

b().CreateCondBr(test, setup_profiling, cont);

b().SetInsertPoint(setup_profiling);
ctx_->profiling(b(), setup_profiling, cont);

Signature sig(ctx_, ctx_->VoidTy);
sig << "State";
21 changes: 16 additions & 5 deletions vm/llvm/jit_context.cpp
Original file line number Diff line number Diff line change
@@ -155,11 +155,6 @@ namespace rubinius {

ObjTy = ptr_type("Object");

profiling_ = new GlobalVariable(
*module_, Int1Ty, false,
GlobalVariable::ExternalLinkage,
0, "profiling_flag");

metadata_id_ = ctx_.getMDKindID("rbx-classid");
}

@@ -183,6 +178,22 @@ namespace rubinius {
return addr;
}

void Context::profiling(IRBuilder& b, BasicBlock* prof, BasicBlock* cont) {
Signature sig(this, Int32Ty);
sig << "State";

Value* call_args[] = {
state_
};

Value* val = sig.call("rbx_check_tooling", call_args, 1, "tooling_p", b);

Value* test = b.CreateICmpEQ(val, cint(1), "profiling_p");

b.CreateCondBr(test, prof, cont);
b.SetInsertPoint(prof);
}

llvm::Type* Context::ptr_type(llvm::Type* type) {
return llvm::PointerType::getUnqual(type);
}
7 changes: 2 additions & 5 deletions vm/llvm/jit_context.hpp
Original file line number Diff line number Diff line change
@@ -57,7 +57,6 @@ namespace rubinius {
llvm::Value* out_args_;
llvm::Value* counter_;

llvm::GlobalVariable* profiling_;
unsigned int metadata_id_;

public:
@@ -138,10 +137,6 @@ namespace rubinius {
return module_;
}

llvm::GlobalVariable* profiling() {
return profiling_;
}

void set_inlined_block(bool val=true) {
inlined_block_ = val;
}
@@ -198,6 +193,8 @@ namespace rubinius {
counter_ = counter;
}

void profiling(IRBuilder& b, llvm::BasicBlock* prof, llvm::BasicBlock* cont);

void init_variables(IRBuilder& b);

void add_runtime_data(jit::RuntimeData* rd);
11 changes: 2 additions & 9 deletions vm/llvm/jit_method.cpp
Original file line number Diff line number Diff line change
@@ -523,15 +523,12 @@ namespace jit {

void MethodBuilder::return_value(Value* ret, BasicBlock* cont) {
if(ctx_->llvm_state()->include_profiling()) {
Value* test = b().CreateLoad(ctx_->profiling(), "profiling");
BasicBlock* end_profiling = info_.new_block("end_profiling");
if(!cont) {
cont = info_.new_block("continue");
}

b().CreateCondBr(test, end_profiling, cont);

b().SetInsertPoint(end_profiling);
ctx_->profiling(b(), end_profiling, cont);

Signature sig(ctx_, ctx_->VoidTy);
sig << llvm::PointerType::getUnqual(ctx_->Int8Ty);
@@ -640,14 +637,10 @@ namespace jit {
get_field(call_frame, offset::CallFrame::jit_data));

if(ctx_->llvm_state()->include_profiling()) {
Value* test = b().CreateLoad(ctx_->profiling(), "profiling");

BasicBlock* setup_profiling = info_.new_block("setup_profiling");
BasicBlock* cont = info_.new_block("continue");

b().CreateCondBr(test, setup_profiling, cont);

b().SetInsertPoint(setup_profiling);
ctx_->profiling(b(), setup_profiling, cont);

Signature sig(ctx_, ctx_->VoidTy);
sig << "State";
4 changes: 4 additions & 0 deletions vm/llvm/jit_util.cpp
Original file line number Diff line number Diff line change
@@ -931,6 +931,10 @@ extern "C" {
return scope->get_local(state, index);
}

int rbx_check_tooling(STATE) {
return state->vm()->tooling();
}

Object* rbx_prologue_check(STATE, CallFrame* call_frame) {
GCTokenImpl gct;

5 changes: 1 addition & 4 deletions vm/llvm/jit_visit.hpp
Original file line number Diff line number Diff line change
@@ -512,13 +512,10 @@ namespace rubinius {

void visit_ret() {
if(llvm_state()->include_profiling() && method_entry_) {
Value* test = b().CreateLoad(ctx_->profiling(), "profiling");
BasicBlock* end_profiling = new_block("end_profiling");
BasicBlock* cont = new_block("continue");

b().CreateCondBr(test, end_profiling, cont);

set_block(end_profiling);
ctx_->profiling(b(), end_profiling, cont);

Signature sig(ctx_, ctx_->VoidTy);
sig << llvm::PointerType::getUnqual(ctx_->Int8Ty);