Skip to content

Commit

Permalink
Showing 5 changed files with 19 additions and 26 deletions.
1 change: 1 addition & 0 deletions spec/truffle/tags/core/string/modulo_tags.txt
Original file line number Diff line number Diff line change
@@ -80,3 +80,4 @@ fails:String#% behaves as if calling Kernel#Float for %g arguments, when the pas
fails:String#% behaves as if calling Kernel#Float for %G arguments, when the passed argument does not respond to #to_ary
fails:String#% behaves as if calling Kernel#Float for %G arguments, when the passed argument is hexadecimal string
fails:String#% when format string contains %<> formats should raise ArgumentError if no hash given
fails:String#% when format string contains %{} sections should raise ArgumentError if no hash given
Original file line number Diff line number Diff line change
@@ -125,17 +125,11 @@ public Backtrace getBacktrace(Node currentNode,

final ArrayList<Activation> activations = new ArrayList<>();

/*
* TODO(cs): if this materializing the frames proves really expensive
* we might want to make it optional - I think it's only used for some
* features beyond what MRI does like printing locals in backtraces.
*/

if (omit == 0 && currentNode != null && Truffle.getRuntime().getCurrentFrame() != null) {
final MaterializedFrame currentFrame = Truffle.getRuntime().getCurrentFrame()
.getFrame(FrameInstance.FrameAccess.MATERIALIZE, true).materialize();
final InternalMethod method = RubyArguments.getMethod(Truffle.getRuntime().getCurrentFrame()
.getFrame(FrameInstance.FrameAccess.READ_ONLY, true));

activations.add(new Activation(currentNode, currentFrame));
activations.add(new Activation(currentNode, method));
}

Truffle.getRuntime().iterateFrames(new FrameInstanceVisitor<Object>() {
@@ -152,8 +146,10 @@ public Object visitFrame(FrameInstance frameInstance) {
if (!filterNullSourceSection
|| !(frameInstance.getCallNode().getEncapsulatingSourceSection() == null
|| frameInstance.getCallNode().getEncapsulatingSourceSection().getSource() == null)) {
activations.add(new Activation(frameInstance.getCallNode(),
frameInstance.getFrame(FrameInstance.FrameAccess.MATERIALIZE, true).materialize()));
final InternalMethod method = RubyArguments.getMethod(frameInstance
.getFrame(FrameInstance.FrameAccess.READ_ONLY, true));

activations.add(new Activation(frameInstance.getCallNode(), method));
}
}

Original file line number Diff line number Diff line change
@@ -9,28 +9,28 @@
*/
package org.jruby.truffle.language.backtrace;

import com.oracle.truffle.api.frame.MaterializedFrame;
import com.oracle.truffle.api.nodes.Node;
import org.jruby.truffle.language.methods.InternalMethod;

public class Activation {

public static final Activation OMITTED_LIMIT = new Activation(null, null);
public static final Activation OMITTED_UNUSED = new Activation(null, null);

private final Node callNode;
private final MaterializedFrame materializedFrame;
private final InternalMethod method;

public Activation(Node callNode, MaterializedFrame materializedFrame) {
public Activation(Node callNode, InternalMethod method) {
this.callNode = callNode;
this.materializedFrame = materializedFrame;
this.method = method;
}

public Node getCallNode() {
return callNode;
}

public MaterializedFrame getMaterializedFrame() {
return materializedFrame;
public InternalMethod getMethod() {
return method;
}

}
Original file line number Diff line number Diff line change
@@ -149,7 +149,7 @@ private String formatInLine(List<Activation> activations, DynamicObject exceptio

if (isCore(sourceSection) && !flags.contains(FormattingFlags.INCLUDE_CORE_FILES)) {
reportedSourceSection = nextUserSourceSection(activations, 1);
reportedName = RubyArguments.getMethod(activation.getMaterializedFrame().getArguments()).getName();
reportedName = activation.getMethod().getName();
} else {
reportedSourceSection = sourceSection;
reportedName = reportedSourceSection.getIdentifier();
@@ -224,7 +224,7 @@ public String formatLine(List<Activation> activations, int n) {
reportedSourceSection = nextUserSourceSection(activations, n);

try {
reportedName = RubyArguments.getMethod(activation.getMaterializedFrame().getArguments()).getName();
reportedName = activation.getMethod().getName();
} catch (Exception e) {
reportedName = "???";
}
Original file line number Diff line number Diff line change
@@ -96,13 +96,9 @@ public void run(MaterializedFrame frame, Node currentNode) {
} break;

case "frame": {
currentFrameIndex = Integer.parseInt(tokenizer.nextToken());

currentFrame = context.getCallStack()
.getBacktrace(currentNode)
.getActivations()
.get(currentFrameIndex).getMaterializedFrame();
} break;
// TODO CS 4-Mar-2015
throw new UnsupportedOperationException();
}

default: {
try {

0 comments on commit 4892ade

Please sign in to comment.