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

Commits on May 9, 2016

  1. [Truffle] Use getInstrumentSourceSection instead of getEncapsulatingS…

    …ourceSection in event action nodes.
    chrisseaton committed May 9, 2016
    Copy the full SHA
    0773eb3 View commit details
  2. Copy the full SHA
    88ad8d9 View commit details
  3. Copy the full SHA
    38da00b View commit details
  4. Copy the full SHA
    3959c1d View commit details
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -74,21 +74,21 @@ public void setTraceFunc(final DynamicObject traceFunc) {
instruments.add(instrumenter.attachFactory(SourceSectionFilter.newBuilder().tagIs(LineTag.class).build(), new ExecutionEventNodeFactory() {
@Override
public ExecutionEventNode create(EventContext eventContext) {
return new BaseEventEventNode(context, traceFunc, context.getCoreStrings().LINE.createInstance());
return new BaseEventEventNode(context, eventContext, traceFunc, context.getCoreStrings().LINE.createInstance());
}
}));

instruments.add(instrumenter.attachFactory(SourceSectionFilter.newBuilder().tagIs(CallTag.class).build(), new ExecutionEventNodeFactory() {
@Override
public ExecutionEventNode create(EventContext eventContext) {
return new CallEventEventNode(context, traceFunc, context.getCoreStrings().CALL.createInstance());
return new CallEventEventNode(context, eventContext, traceFunc, context.getCoreStrings().CALL.createInstance());
}
}));

instruments.add(instrumenter.attachFactory(SourceSectionFilter.newBuilder().tagIs(ClassTag.class).build(), new ExecutionEventNodeFactory() {
@Override
public ExecutionEventNode create(EventContext eventContext) {
return new BaseEventEventNode(context, traceFunc, context.getCoreStrings().CLASS.createInstance());
return new BaseEventEventNode(context, eventContext, traceFunc, context.getCoreStrings().CLASS.createInstance());
}
}));

@@ -99,6 +99,7 @@ private class BaseEventEventNode extends ExecutionEventNode {
protected final ConditionProfile inTraceFuncProfile = ConditionProfile.createBinaryProfile();

protected final RubyContext context;
protected final EventContext eventContext;
protected final DynamicObject traceFunc;
protected final Object event;

@@ -107,8 +108,9 @@ private class BaseEventEventNode extends ExecutionEventNode {
@CompilationFinal private DynamicObject file;
@CompilationFinal private int line;

public BaseEventEventNode(RubyContext context, DynamicObject traceFunc, Object event) {
public BaseEventEventNode(RubyContext context, EventContext eventContext, DynamicObject traceFunc, Object event) {
this.context = context;
this.eventContext = eventContext;
this.traceFunc = traceFunc;
this.event = event;
}
@@ -137,7 +139,7 @@ protected void onEnter(VirtualFrame frame) {
private DynamicObject getFile() {
if (file == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
file = StringOperations.createString(context, context.getRopeTable().getRopeUTF8(getEncapsulatingSourceSection().getSource().getName()));
file = StringOperations.createString(context, context.getRopeTable().getRopeUTF8(eventContext.getInstrumentedSourceSection().getSource().getName()));
}

return file;
@@ -146,7 +148,7 @@ private DynamicObject getFile() {
private int getLine() {
if (line == 0) {
CompilerDirectives.transferToInterpreterAndInvalidate();
line = getEncapsulatingSourceSection().getStartLine();
line = eventContext.getInstrumentedSourceSection().getStartLine();
}

return line;
@@ -167,8 +169,8 @@ private class CallEventEventNode extends BaseEventEventNode {

@Child private LogicalClassNode logicalClassNode;

public CallEventEventNode(RubyContext context, DynamicObject traceFunc, Object event) {
super(context, traceFunc, event);
public CallEventEventNode(RubyContext context, EventContext eventContext, DynamicObject traceFunc, Object event) {
super(context, eventContext, traceFunc, event);
}

@Override
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ public synchronized void enable() {
.build(), new ExecutionEventNodeFactory() {

@Override
public ExecutionEventNode create(EventContext eventContext) {
public ExecutionEventNode create(final EventContext eventContext) {
return new ExecutionEventNode() {

@CompilationFinal private AtomicLongArray counters;
@@ -84,7 +84,7 @@ public ExecutionEventNode create(EventContext eventContext) {
protected void onEnter(VirtualFrame frame) {
if (counters == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
final SourceSection sourceSection = getEncapsulatingSourceSection();
final SourceSection sourceSection = eventContext.getInstrumentedSourceSection();
counters = getCounters(sourceSection.getSource());
lineNumber = sourceSection.getStartLine() - 1;
}