use of com.oracle.truffle.espresso.nodes.quick.invoke.InvokeDynamicCallSiteNode in project graal by oracle.
the class BytecodeNode method quickenInvokeDynamic.
private int quickenInvokeDynamic(final VirtualFrame frame, int top, int curBCI, int opcode) {
CompilerDirectives.transferToInterpreterAndInvalidate();
assert (Bytecodes.INVOKEDYNAMIC == opcode);
RuntimeConstantPool pool = getConstantPool();
BaseQuickNode quick = null;
int indyIndex = -1;
synchronized (this) {
if (bs.currentVolatileBC(curBCI) == QUICK) {
// Check if someone did the job for us. Defer the call until we are out of the lock.
quick = nodes[readCPI(curBCI)];
} else {
// fetch indy under lock.
indyIndex = readCPI(curBCI);
}
}
if (quick != null) {
// Do invocation outside of the lock.
return quick.execute(frame) - Bytecodes.stackEffectOf(opcode);
}
// Resolution should happen outside of the bytecode patching lock.
InvokeDynamicConstant.CallSiteLink link = pool.linkInvokeDynamic(getMethod().getDeclaringKlass(), indyIndex);
// re-lock to check if someone did the job for us, since this was a heavy operation.
synchronized (this) {
if (bs.currentVolatileBC(curBCI) == QUICK) {
// someone beat us to it, just trust him.
quick = nodes[readCPI(curBCI)];
} else {
quick = injectQuick(curBCI, new InvokeDynamicCallSiteNode(link.getMemberName(), link.getUnboxedAppendix(), link.getParsedSignature(), getMeta(), top, curBCI), QUICK);
}
}
return quick.execute(frame) - Bytecodes.stackEffectOf(opcode);
}
Aggregations