use of com.oracle.truffle.api.frame.FrameSlotTypeException in project graal by oracle.
the class OptimizedOSRLoopNodeTest method testTransferToInterpreter.
/*
* Test that calling CompilerDirectives.transferToInterpreter does not invalidate the target.
*/
@Test
public void testTransferToInterpreter() {
OSRLoopFactory factory = CONFIGURED;
class TransferToInterpreterTestRepeatingNode extends TestRepeatingNode {
@Override
public boolean executeRepeating(VirtualFrame frame) {
try {
if (CompilerDirectives.inCompiledCode()) {
CompilerDirectives.transferToInterpreter();
}
int counter = frame.getInt(param1);
frame.setInt(param1, counter - 1);
return counter != 0;
} catch (FrameSlotTypeException e) {
return false;
}
}
}
TestRootNode rootNode = new TestRootNode(factory, new TransferToInterpreterTestRepeatingNode());
CallTarget target = runtime.createCallTarget(rootNode);
target.call(OSR_THRESHOLD + 1);
try {
// Invalidation is asynchronous.
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
Assert.assertNotNull(rootNode.getOSRTarget());
}
use of com.oracle.truffle.api.frame.FrameSlotTypeException in project TrufflePascal by Aspect26.
the class FileProgramArgumentAssignmentNode method executeVoid.
@Override
public void executeVoid(VirtualFrame frame) {
try {
FileValue file = (FileValue) frame.getObject(frameSlot);
file.assignFilePath((String) frame.getArguments()[index]);
} catch (FrameSlotTypeException e) {
throw new PascalRuntimeException("Something went wrong");
}
}
use of com.oracle.truffle.api.frame.FrameSlotTypeException in project TrufflePascal by Aspect26.
the class WithNode method executeVoid.
@Override
public void executeVoid(VirtualFrame frame) {
try {
for (FrameSlot recordSlot : this.recordSlots) {
RecordValue record = (RecordValue) frame.getObject(recordSlot);
frame = record.getFrame();
}
innerStatement.executeVoid(frame);
} catch (FrameSlotTypeException e) {
throw new PascalRuntimeException("Unexpected accessing of non record type");
}
}
use of com.oracle.truffle.api.frame.FrameSlotTypeException in project TrufflePascal by Aspect26.
the class ProgramArgumentAssignmentNode method assignFile.
private void assignFile(VirtualFrame frame, String filePath) {
try {
FileValue file = (FileValue) frame.getObject(targetSlot);
file.assignFilePath(filePath);
} catch (FrameSlotTypeException e) {
throw new PascalRuntimeException("Something went wrong");
}
}
use of com.oracle.truffle.api.frame.FrameSlotTypeException in project TrufflePascal by Aspect26.
the class ForNode method executeVoid.
@Override
public void executeVoid(VirtualFrame frame) {
try {
ControlInterface controlInterface = null;
switch(controlSlot.getKind()) {
case Int:
controlInterface = this.createIntControlInterface(frame);
break;
case Long:
controlInterface = this.createLongControlInterface(frame);
break;
case Byte:
controlInterface = this.createCharControlInterface(frame);
break;
case Object:
Object controlValue = frame.getObject(controlSlot);
if (controlValue instanceof EnumValue) {
controlInterface = this.createEnumControlInterface(frame);
break;
} else {
throw new PascalRuntimeException("Unsupported control variable type");
}
}
this.execute(frame, controlInterface, ascending);
} catch (FrameSlotTypeException | UnexpectedResultException e) {
throw new PascalRuntimeException("Something went wrong.");
}
}
Aggregations