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: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 37c16a20fbf1
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e789673a5487
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Mar 17, 2016

  1. Copy the full SHA
    5c6a893 View commit details
  2. Copy the full SHA
    1f1bb19 View commit details
  3. Copy the full SHA
    e789673 View commit details
8 changes: 4 additions & 4 deletions test/truffle/integration/tracing/binding.trace
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
["line", "/binding.rb", 23, nil, {:captured_in_scope=>2, :inside_trace=>nil, :modified=>3, :outside_trace=>1, :result=>nil}, nil]
["line", "/binding.rb", 24, nil, {:captured_in_scope=>2, :inside_trace=>4, :modified=>3, :outside_trace=>1, :result=>nil}, nil]
["line", "/binding.rb", 26, nil, {:captured_in_scope=>2, :inside_trace=>4, :modified=>5, :outside_trace=>1, :result=>nil}, nil]
["call", "/binding.rb", 26, :add, {:captured_in_scope=>2, :inside_trace=>4, :modified=>5, :outside_trace=>1, :result=>nil}, Object]
["call", "/binding.rb", 26, :add, {:a=>nil}, Object]
["line", "/binding.rb", 14, nil, {:a=>14}, nil]
["call", "/binding.rb", 14, :"<main>", {:a=>14}, Object]
["call", "/binding.rb", 14, :"<main>", {:captured_in_scope=>2, :inside_trace=>4, :modified=>5, :outside_trace=>1, :result=>16}, Object]
["line", "/binding.rb", 27, nil, {:captured_in_scope=>2, :inside_trace=>4, :modified=>5, :outside_trace=>1, :result=>16}, nil]
["call", "/binding.rb", 14, :+, {:a=>14}, Fixnum]
["call", "/binding.rb", 14, :+, {}, Fixnum]
["line", "/binding.rb", 30, nil, {:captured_in_scope=>2, :inside_trace=>4, :modified=>5, :outside_trace=>1, :result=>16}, nil]
["line", "/binding.rb", 32, nil, {:captured_in_scope=>2, :inside_trace=>4, :modified=>5, :outside_trace=>1, :result=>16}, nil]
["call", "/binding.rb", 32, :set_trace_func, {:captured_in_scope=>2, :inside_trace=>4, :modified=>5, :outside_trace=>1, :result=>16}, Object]
["call", "/binding.rb", 32, :set_trace_func, {}, Object]
4 changes: 2 additions & 2 deletions test/truffle/integration/tracing/simple.trace
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
["line", "/simple.rb", 19, nil, {}, nil]
["call", "/simple.rb", 19, :add, {}, Object]
["call", "/simple.rb", 19, :add, {:a=>nil, :b=>nil}, Object]
["line", "/simple.rb", 14, nil, {:a=>14, :b=>2}, nil]
["call", "/simple.rb", 14, :+, {:a=>14, :b=>2}, Fixnum]
["call", "/simple.rb", 14, :+, {}, Fixnum]
["line", "/simple.rb", 21, nil, {}, nil]
["call", "/simple.rb", 21, :set_trace_func, {}, Object]
Original file line number Diff line number Diff line change
@@ -28,6 +28,8 @@
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.arguments.RubyArguments;
import org.jruby.truffle.language.objects.LogicalClassNode;
import org.jruby.truffle.language.objects.LogicalClassNodeGen;
import org.jruby.truffle.language.yield.YieldNode;

import java.util.ArrayList;
@@ -160,6 +162,8 @@ protected YieldNode getYieldNode() {

private class CallEventEventNode extends BaseEventEventNode {

@Child private LogicalClassNode logicalClassNode;

public CallEventEventNode(RubyContext context, DynamicObject traceFunc, Object event) {
super(context, traceFunc, event);
}
@@ -188,11 +192,11 @@ protected void onEnter(VirtualFrame frame) {
try {
getYieldNode().dispatch(frame, traceFunc,
event,
file,
getFile(file),
line,
context.getSymbolTable().getSymbol(RubyArguments.getMethod(frame).getName()),
Layouts.BINDING.createBinding(context.getCoreLibrary().getBindingFactory(), frame.materialize()),
context.getCoreLibrary().getLogicalClass(RubyArguments.getSelf(frame)));
getLogicalClass(RubyArguments.getSelf(frame)));
} finally {
isInTraceFunc = false;
}
@@ -203,6 +207,20 @@ private SourceSection getCallerSourceSection() {
return Truffle.getRuntime().getCallerFrame().getCallNode().getEncapsulatingSourceSection();
}

@TruffleBoundary
private DynamicObject getFile(String file) {
return StringOperations.createString(context, context.getRopeTable().getRopeUTF8(file));
}

private DynamicObject getLogicalClass(Object object) {
if (logicalClassNode == null) {
CompilerDirectives.transferToInterpreter();
logicalClassNode = insert(LogicalClassNodeGen.create(context, null, null));
}

return logicalClassNode.executeLogicalClass(object);
}

}

}