comparison truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/debug/TagBreakpointFactory.java @ 22011:95d5d6a93968

add more truffle boundaries
author Andreas Woess <andreas.woess@oracle.com>
date Thu, 23 Jul 2015 17:23:05 +0200
parents 5bc7f7b867ab
children 78c3d3d8d86e
comparison
equal deleted inserted replaced
22010:f410818cdec8 22011:95d5d6a93968
30 import java.util.*; 30 import java.util.*;
31 import java.util.Map.Entry; 31 import java.util.Map.Entry;
32 32
33 import com.oracle.truffle.api.*; 33 import com.oracle.truffle.api.*;
34 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; 34 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
35 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
35 import com.oracle.truffle.api.debug.Debugger.BreakpointCallback; 36 import com.oracle.truffle.api.debug.Debugger.BreakpointCallback;
36 import com.oracle.truffle.api.debug.Debugger.WarningLog; 37 import com.oracle.truffle.api.debug.Debugger.WarningLog;
37 import com.oracle.truffle.api.frame.*; 38 import com.oracle.truffle.api.frame.*;
38 import com.oracle.truffle.api.instrument.*; 39 import com.oracle.truffle.api.instrument.*;
39 import com.oracle.truffle.api.instrument.impl.*; 40 import com.oracle.truffle.api.instrument.impl.*;
70 private static final boolean TRACE = false; 71 private static final boolean TRACE = false;
71 private static final PrintStream OUT = System.out; 72 private static final PrintStream OUT = System.out;
72 73
73 private static final String BREAKPOINT_NAME = "TAG BREAKPOINT"; 74 private static final String BREAKPOINT_NAME = "TAG BREAKPOINT";
74 75
76 @TruffleBoundary
75 private static void trace(String format, Object... args) { 77 private static void trace(String format, Object... args) {
76 if (TRACE) { 78 if (TRACE) {
77 OUT.println(String.format("%s: %s", BREAKPOINT_NAME, String.format(format, args))); 79 OUT.println(String.format("%s: %s", BREAKPOINT_NAME, String.format(format, args)));
78 } 80 }
79 } 81 }
305 @Override 307 @Override
306 public String getCondition() { 308 public String getCondition() {
307 return conditionExpr; 309 return conditionExpr;
308 } 310 }
309 311
312 @TruffleBoundary
310 @Override 313 @Override
311 public void dispose() { 314 public void dispose() {
312 if (getState() != DISPOSED) { 315 if (getState() != DISPOSED) {
313 for (Instrument instrument : instruments) { 316 for (Instrument instrument : instruments) {
314 instrument.dispose(); 317 instrument.dispose();
338 enabledUnchangedAssumption.invalidate(); 341 enabledUnchangedAssumption.invalidate();
339 this.isEnabled = enabled; 342 this.isEnabled = enabled;
340 } 343 }
341 } 344 }
342 345
346 @TruffleBoundary
343 private String getShortDescription() { 347 private String getShortDescription() {
344 return BREAKPOINT_NAME + "@" + tag.name(); 348 return BREAKPOINT_NAME + "@" + tag.name();
345 } 349 }
346 350
347 private void changeState(State after) { 351 private void changeState(State after) {
396 nodeEnter(node, vFrame); 400 nodeEnter(node, vFrame);
397 } 401 }
398 } 402 }
399 403
400 public void notifyFailure(Node node, VirtualFrame vFrame, RuntimeException ex) { 404 public void notifyFailure(Node node, VirtualFrame vFrame, RuntimeException ex) {
401 warningLog.addWarning(String.format("Exception in %s: %s", getShortDescription(), ex.getMessage())); 405 addExceptionWarning(ex);
402 if (TRACE) { 406 if (TRACE) {
403 trace("breakpoint failure = %s %s", ex.toString(), getShortDescription()); 407 trace("breakpoint failure = %s %s", ex, getShortDescription());
404 } 408 }
405 // Take the breakpoint if evaluation fails. 409 // Take the breakpoint if evaluation fails.
406 nodeEnter(node, vFrame); 410 nodeEnter(node, vFrame);
411 }
412
413 @TruffleBoundary
414 private void addExceptionWarning(RuntimeException ex) {
415 warningLog.addWarning(String.format("Exception in %s: %s", getShortDescription(), ex.getMessage()));
407 } 416 }
408 417
409 @Override 418 @Override
410 public String getLocationDescription() { 419 public String getLocationDescription() {
411 return "Tag " + tag.name(); 420 return "Tag " + tag.name();