use of com.oracle.truffle.api.instrumentation.SourceSectionFilter in project graal by oracle.
the class InputFilterTest method testNoInputFilter.
@Test
public void testNoInputFilter() {
SourceSectionFilter expressionFilter = SourceSectionFilter.newBuilder().tagIs(StandardTags.ExpressionTag.class).build();
instrumenter.attachExecutionEventFactory(expressionFilter, null, factory);
execute("ROOT(EXPRESSION(EXPRESSION,EXPRESSION))");
assertOn(ENTER);
assertOn(ENTER);
assertOn(RETURN_VALUE, (e) -> {
assertEquals("()", e.result);
assertArrayEquals(new Object[0], e.inputs);
});
assertOn(ENTER);
assertOn(RETURN_VALUE, (e) -> {
assertEquals("()", e.result);
assertArrayEquals(new Object[0], e.inputs);
});
assertOn(RETURN_VALUE, (e) -> {
assertEquals("(()+())", e.result);
assertArrayEquals(new Object[0], e.inputs);
});
}
use of com.oracle.truffle.api.instrumentation.SourceSectionFilter 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.SourceSectionFilter in project graal by oracle.
the class InstrumentableNodeTest method testNoSourceSectionWithFilter.
@Test
public void testNoSourceSectionWithFilter() {
SourceSectionFilter filter = SourceSectionFilter.newBuilder().tagIs(BlockTag.class).lineIn(1, 1).build();
instrumenter.attachExecutionEventFactory(filter, null, factory);
execute("BLOCK_NO_SOURCE_SECTION(BLOCK())");
assertOn(ENTER, (e) -> {
assertProperties(e.context.getNodeObject(), "simpleName", "BlockNode");
});
assertOn(RETURN_VALUE, (e) -> {
assertProperties(e.context.getNodeObject(), "simpleName", "BlockNode");
});
}
use of com.oracle.truffle.api.instrumentation.SourceSectionFilter in project graal by oracle.
the class InstrumentableNodeTest method testNoSourceSectionNoFilter.
@Test
public void testNoSourceSectionNoFilter() {
SourceSectionFilter filter = SourceSectionFilter.newBuilder().tagIs(BlockTag.class).build();
instrumenter.attachExecutionEventFactory(filter, null, factory);
execute("BLOCK_NO_SOURCE_SECTION(BLOCK())");
assertOn(ENTER, (e) -> {
assertProperties(e.context.getNodeObject(), "simpleName", "BlockNoSourceSectionNode");
});
assertOn(ENTER, (e) -> {
assertProperties(e.context.getNodeObject(), "simpleName", "BlockNode");
});
assertOn(RETURN_VALUE, (e) -> {
assertProperties(e.context.getNodeObject(), "simpleName", "BlockNode");
});
assertOn(RETURN_VALUE, (e) -> {
assertProperties(e.context.getNodeObject(), "simpleName", "BlockNoSourceSectionNode");
});
}
use of com.oracle.truffle.api.instrumentation.SourceSectionFilter 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);
});
}
Aggregations