use of com.oracle.truffle.api.instrumentation.test.InstrumentationTestLanguage.MaterializeChildExpressionNode 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);
});
}
Aggregations