CompilerDirectives.transferToInterpreterAndInvalidate(); if (breakpoint.condition != null) { this.breakCondition = insert(new ConditionalBreakNode(context, breakpoint)); notifyInserted(this.breakCondition); } else {
boolean executeBreakCondition(VirtualFrame frame, DebuggerSession[] sessions) { if ((conditionSnippet == null && conditionCallNode == null) || !conditionUnchanged.isValid()) { CompilerDirectives.transferToInterpreterAndInvalidate(); initializeConditional(frame.materialize()); } Object result; try { suspensionEnabledNode.execute(false, sessions); if (conditionSnippet != null) { result = conditionSnippet.execute(frame); } else { result = conditionCallNode.call(EMPTY_ARRAY); } } finally { suspensionEnabledNode.execute(true, sessions); } if (!(result instanceof Boolean)) { CompilerDirectives.transferToInterpreter(); throw new IllegalArgumentException("Unsupported return type " + result + " in condition."); } return (Boolean) result; }
private void initializeConditional(MaterializedFrame frame) { Node instrumentedNode = context.getInstrumentedNode(); final RootNode rootNode = instrumentedNode.getRootNode(); if (rootNode == null) { throw new IllegalStateException("Probe was disconnected from the AST."); } Source instrumentedSource = context.getInstrumentedSourceSection().getSource(); Source conditionSource; synchronized (breakpoint) { conditionSource = Source.newBuilder(breakpoint.condition).language(instrumentedSource.getLanguage()).mimeType(instrumentedSource.getMimeType()).name( "breakpoint condition").build(); if (conditionSource == null) { throw new IllegalStateException("Condition is not resolved " + rootNode); } conditionUnchanged = breakpoint.getConditionUnchanged(); } ExecutableNode snippet = breakpoint.debugger.getEnv().parseInline(conditionSource, instrumentedNode, frame); if (snippet != null) { conditionSnippet = insert(snippet); notifyInserted(snippet); } else { CallTarget callTarget = Debugger.ACCESSOR.parse(conditionSource, instrumentedNode, new String[0]); conditionCallNode = insert(Truffle.getRuntime().createDirectCallNode(callTarget)); } } }
CompilerDirectives.transferToInterpreterAndInvalidate(); if (breakpoint.condition != null) { this.breakCondition = insert(new ConditionalBreakNode(context, breakpoint)); notifyInserted(this.breakCondition); } else {
boolean executeBreakCondition(VirtualFrame frame, DebuggerSession[] sessions) { if ((conditionSnippet == null && conditionCallNode == null) || !conditionUnchanged.isValid()) { CompilerDirectives.transferToInterpreterAndInvalidate(); initializeConditional(frame.materialize()); } Object result; try { suspensionEnabledNode.execute(false, sessions); if (conditionSnippet != null) { result = conditionSnippet.execute(frame); } else { result = conditionCallNode.call(EMPTY_ARRAY); } } finally { suspensionEnabledNode.execute(true, sessions); } if (!(result instanceof Boolean)) { CompilerDirectives.transferToInterpreter(); throw new IllegalArgumentException("Unsupported return type " + result + " in condition."); } return (Boolean) result; }
private void initializeConditional(MaterializedFrame frame) { Node instrumentedNode = context.getInstrumentedNode(); final RootNode rootNode = instrumentedNode.getRootNode(); if (rootNode == null) { throw new IllegalStateException("Probe was disconnected from the AST."); } Source instrumentedSource = context.getInstrumentedSourceSection().getSource(); Source conditionSource; synchronized (breakpoint) { conditionSource = Source.newBuilder(instrumentedSource.getLanguage(), breakpoint.condition, "breakpoint condition").mimeType(instrumentedSource.getMimeType()).build(); if (conditionSource == null) { throw new IllegalStateException("Condition is not resolved " + rootNode); } conditionUnchanged = breakpoint.getConditionUnchanged(); } ExecutableNode snippet = breakpoint.debugger.getEnv().parseInline(conditionSource, instrumentedNode, frame); if (snippet != null) { conditionSnippet = insert(snippet); notifyInserted(snippet); } else { CallTarget callTarget = Debugger.ACCESSOR.parse(conditionSource, instrumentedNode, new String[0]); conditionCallNode = insert(Truffle.getRuntime().createDirectCallNode(callTarget)); } } }
boolean testCondition(VirtualFrame frame) throws BreakpointConditionFailure { if (!conditionExistsUnchanged.isValid()) { CompilerDirectives.transferToInterpreterAndInvalidate(); if (breakpoint.condition != null) { this.breakCondition = insert(new ConditionalBreakNode(context, breakpoint)); notifyInserted(this.breakCondition); } else { this.breakCondition = null; } conditionExistsUnchanged = breakpoint.getConditionExistsUnchanged(); } if (breakCondition != null) { try { return breakCondition.executeBreakCondition(frame, sessions); } catch (Throwable e) { CompilerDirectives.transferToInterpreter(); throw new BreakpointConditionFailure(breakpoint, e); } } return true; }
AbstractBreakpointNode(Breakpoint breakpoint, EventContext context) { super(context); this.breakpoint = breakpoint; initializeSessions(); this.conditionExistsUnchanged = breakpoint.getConditionExistsUnchanged(); if (breakpoint.condition != null) { this.breakCondition = new ConditionalBreakNode(context, breakpoint); } }
boolean shouldBreak(VirtualFrame frame) throws BreakpointConditionFailure { if (breakCondition != null) { try { return breakCondition.executeBreakCondition(frame, sessions); } catch (Throwable e) { CompilerDirectives.transferToInterpreter(); throw new BreakpointConditionFailure(breakpoint, e); } } return true; }
AbstractBreakpointNode(Breakpoint breakpoint, EventContext context) { super(context); this.breakpoint = breakpoint; initializeSessions(); this.conditionExistsUnchanged = breakpoint.getConditionExistsUnchanged(); if (breakpoint.condition != null) { this.breakCondition = new ConditionalBreakNode(context, breakpoint); } }