org.jruby.truffle.language.methods.CallBoundMethodNodeGen Maven / Gradle / Ivy
// CheckStyle: start generated
package org.jruby.truffle.language.methods;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.dsl.UnsupportedSpecializationException;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.nodes.UnexpectedResultException;
import com.oracle.truffle.api.object.DynamicObject;
import org.jruby.truffle.language.RubyNode;
@GeneratedBy(CallBoundMethodNode.class)
public final class CallBoundMethodNodeGen extends CallBoundMethodNode {
@Child private RubyNode method_;
@Child private RubyNode arguments_;
@Child private RubyNode block_;
@CompilationFinal private boolean seenUnsupported0;
private CallBoundMethodNodeGen(RubyNode method, RubyNode arguments, RubyNode block) {
this.method_ = method;
this.arguments_ = arguments;
this.block_ = block;
}
@Override
public NodeCost getCost() {
return NodeCost.MONOMORPHIC;
}
@Override
public Object executeCallBoundMethod(VirtualFrame frameValue, DynamicObject methodValue, Object[] argumentsValue, Object blockValue) {
return this.call(frameValue, methodValue, argumentsValue, blockValue);
}
@Override
public Object execute(VirtualFrame frameValue) {
DynamicObject methodValue_;
try {
methodValue_ = method_.executeDynamicObject(frameValue);
} catch (UnexpectedResultException ex) {
Object argumentsValue = arguments_.execute(frameValue);
Object blockValue = block_.execute(frameValue);
throw unsupported(ex.getResult(), argumentsValue, blockValue);
}
Object[] argumentsValue_;
try {
argumentsValue_ = arguments_.executeObjectArray(frameValue);
} catch (UnexpectedResultException ex) {
Object blockValue = block_.execute(frameValue);
throw unsupported(methodValue_, ex.getResult(), blockValue);
}
Object blockValue_ = block_.execute(frameValue);
return this.call(frameValue, methodValue_, argumentsValue_, blockValue_);
}
@Override
public void executeVoid(VirtualFrame frameValue) {
execute(frameValue);
return;
}
private UnsupportedSpecializationException unsupported(Object methodValue, Object argumentsValue, Object blockValue) {
if (!seenUnsupported0) {
CompilerDirectives.transferToInterpreterAndInvalidate();
seenUnsupported0 = true;
}
return new UnsupportedSpecializationException(this, new Node[] {method_, arguments_, block_}, methodValue, argumentsValue, blockValue);
}
public static CallBoundMethodNode create(RubyNode method, RubyNode arguments, RubyNode block) {
return new CallBoundMethodNodeGen(method, arguments, block);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy