use of com.oracle.truffle.api.instrumentation.LoadSourceSectionListener in project graal by oracle.
the class InstrumentationMultiThreadingTest method createDummyBindings.
private static EventBinding<?>[] createDummyBindings(Instrumenter instrumenter) {
EventBinding<?>[] bindings = new EventBinding<?>[5];
int bi = 0;
ExecutionEventListener dummyListener = new ExecutionEventListener() {
public void onReturnValue(EventContext context, VirtualFrame frame, Object result) {
}
public void onReturnExceptional(EventContext context, VirtualFrame frame, Throwable exception) {
}
public void onEnter(EventContext context, VirtualFrame frame) {
}
};
bindings[bi++] = instrumenter.attachExecutionEventListener(SourceSectionFilter.newBuilder().tagIs(InstrumentationTestLanguage.EXPRESSION).build(), dummyListener);
bindings[bi++] = instrumenter.attachExecutionEventListener(SourceSectionFilter.newBuilder().tagIs(InstrumentationTestLanguage.STATEMENT).build(), dummyListener);
bindings[bi++] = instrumenter.attachLoadSourceListener(SourceFilter.ANY, new LoadSourceListener() {
public void onLoad(LoadSourceEvent event) {
}
}, true);
bindings[bi++] = instrumenter.attachLoadSourceSectionListener(SourceSectionFilter.newBuilder().tagIs(InstrumentationTestLanguage.EXPRESSION).build(), new LoadSourceSectionListener() {
public void onLoad(LoadSourceSectionEvent event) {
}
}, true);
bindings[bi++] = instrumenter.attachLoadSourceSectionListener(SourceSectionFilter.newBuilder().tagIs(InstrumentationTestLanguage.STATEMENT).build(), new LoadSourceSectionListener() {
public void onLoad(LoadSourceSectionEvent event) {
}
}, true);
return bindings;
}
use of com.oracle.truffle.api.instrumentation.LoadSourceSectionListener in project graal by oracle.
the class InstrumentationUpdateTest method setEventFilter.
private void setEventFilter(SourceSectionFilter filter) {
EventBinding<?> old = this.eventBinding;
eventBinding = instrumentEnv.getInstrumenter().attachExecutionEventListener(filter, new ExecutionEventListener() {
public void onReturnValue(EventContext ctx, VirtualFrame frame, Object result) {
}
public void onReturnExceptional(EventContext ctx, VirtualFrame frame, Throwable exception) {
}
public void onEnter(EventContext ctx, VirtualFrame frame) {
executionEvents.add(ctx);
}
});
instrumentEnv.getInstrumenter().attachLoadSourceSectionListener(filter, new LoadSourceSectionListener() {
public void onLoad(LoadSourceSectionEvent event) {
loadEvents.add(event);
}
}, true);
// dispose afterwards to avoid disposal of instrumentation wrappers
if (old != null) {
old.dispose();
}
}
Aggregations