use of com.oracle.truffle.api.instrumentation.test.InstrumentationTestLanguage.MaterializedChildExpressionNode in project graal by oracle.
the class InstrumentableNodeTest method testLateMaterializeSyntax.
/*
* First instrument statements and then instrument expressions to test materialization at
* locations where there is already a wrapper.
*/
@Test
public void testLateMaterializeSyntax() {
Source source = createSource("MATERIALIZE_CHILD_EXPRESSION");
SourceSectionFilter filter;
filter = SourceSectionFilter.newBuilder().tagIs(StandardTags.StatementTag.class).build();
instrumenter.attachExecutionEventFactory(filter, null, factory);
execute(source);
assertOn(ENTER, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof MaterializeChildExpressionNode);
});
assertOn(RETURN_VALUE, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof MaterializeChildExpressionNode);
});
assertAllEventsConsumed();
filter = SourceSectionFilter.newBuilder().tagIs(StandardTags.ExpressionTag.class).build();
instrumenter.attachExecutionEventFactory(filter, null, factory);
execute(source);
assertOn(ENTER, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof MaterializedChildExpressionNode);
});
assertOn(ENTER, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof ExpressionNode);
});
assertOn(RETURN_VALUE, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof ExpressionNode);
});
assertOn(RETURN_VALUE, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof MaterializedChildExpressionNode);
});
}
use of com.oracle.truffle.api.instrumentation.test.InstrumentationTestLanguage.MaterializedChildExpressionNode in project graal by oracle.
the class InstrumentableNodeTest method testTagIsNot.
/*
* First instrument statements and then instrument expressions to test materialization at
* locations where there is already a wrapper.
*/
@Test
public void testTagIsNot() {
SourceSectionFilter filter;
filter = SourceSectionFilter.newBuilder().tagIsNot(StandardTags.RootTag.class).build();
instrumenter.attachExecutionEventFactory(filter, null, factory);
execute("MATERIALIZE_CHILD_EXPRESSION");
assertOn(ENTER, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof MaterializedChildExpressionNode);
});
assertOn(ENTER, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof ExpressionNode);
});
assertOn(RETURN_VALUE, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof ExpressionNode);
});
assertOn(RETURN_VALUE, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof MaterializedChildExpressionNode);
});
}
use of com.oracle.truffle.api.instrumentation.test.InstrumentationTestLanguage.MaterializedChildExpressionNode in project graal by oracle.
the class InstrumentableNodeTest method testSimpleMaterializeSyntaxWithInput.
/*
* Directly instrument and materialize all nodes with input values.
*/
@Test
public void testSimpleMaterializeSyntaxWithInput() {
SourceSectionFilter filter = SourceSectionFilter.newBuilder().tagIs(StandardTags.StatementTag.class, StandardTags.ExpressionTag.class).build();
instrumenter.attachExecutionEventFactory(filter, filter, factory);
execute("MATERIALIZE_CHILD_EXPRESSION");
assertOn(ENTER, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof MaterializedChildExpressionNode);
});
assertOn(ENTER, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof ExpressionNode);
});
assertOn(RETURN_VALUE, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof ExpressionNode);
});
assertOn(INPUT_VALUE, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof MaterializedChildExpressionNode);
});
assertOn(RETURN_VALUE, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof MaterializedChildExpressionNode);
});
}
use of com.oracle.truffle.api.instrumentation.test.InstrumentationTestLanguage.MaterializedChildExpressionNode in project graal by oracle.
the class InstrumentableNodeTest method testSimpleMaterializeSyntax.
/*
* Directly instrument and materialize all nodes.
*/
@Test
public void testSimpleMaterializeSyntax() {
SourceSectionFilter filter = SourceSectionFilter.newBuilder().tagIs(StandardTags.StatementTag.class, StandardTags.ExpressionTag.class).build();
instrumenter.attachExecutionEventFactory(filter, null, factory);
execute("MATERIALIZE_CHILD_EXPRESSION");
assertOn(ENTER, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof MaterializedChildExpressionNode);
});
assertOn(ENTER, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof ExpressionNode);
});
assertOn(RETURN_VALUE, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof ExpressionNode);
});
assertOn(RETURN_VALUE, (e) -> {
assertTrue(e.context.getInstrumentedNode() instanceof MaterializedChildExpressionNode);
});
}
Aggregations