All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.oracle.truffle.api.instrumentation.test.InstrumentedNodeWrapper Maven / Gradle / Ivy

The newest version!
// CheckStyle: start generated
package com.oracle.truffle.api.instrumentation.test;

import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.instrumentation.InstrumentableFactory;
import com.oracle.truffle.api.instrumentation.ProbeNode;
import com.oracle.truffle.api.instrumentation.test.InstrumentationTestLanguage.InstrumentedNode;
import com.oracle.truffle.api.nodes.NodeCost;

@GeneratedBy(InstrumentedNode.class)
public final class InstrumentedNodeWrapper implements InstrumentableFactory {

    @Override
    public WrapperNode createWrapper(InstrumentedNode delegateNode, ProbeNode probeNode) {
        return new InstrumentedNodeWrapper0(delegateNode, delegateNode, probeNode);
    }

    @GeneratedBy(InstrumentedNode.class)
    private static final class InstrumentedNodeWrapper0 extends InstrumentedNode implements WrapperNode {

        @Child private InstrumentedNode delegateNode;
        @Child private ProbeNode probeNode;

        private InstrumentedNodeWrapper0(InstrumentedNode delegate, InstrumentedNode delegateNode, ProbeNode probeNode) {
            super(delegate);
            this.delegateNode = delegateNode;
            this.probeNode = probeNode;
        }

        @Override
        public InstrumentedNode getDelegateNode() {
            return delegateNode;
        }

        @Override
        public ProbeNode getProbeNode() {
            return probeNode;
        }

        @Override
        public NodeCost getCost() {
            return NodeCost.NONE;
        }

        @Override
        public Object execute(VirtualFrame frame) {
            try {
                probeNode.onEnter(frame);
                Object returnValue = delegateNode.execute(frame);
                probeNode.onReturnValue(frame, returnValue);
                return returnValue;
            } catch (Throwable t) {
                probeNode.onReturnExceptional(frame, t);
                throw t;
            }
        }

    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy