An invokedynamic instruction is type safe iff all of the following are true:
- Its first operand,
CP, refers to a constant pool entry denoting an dynamic call site with nameCallSiteNamewith descriptorDescriptor. CallSiteNameis not<init>.CallSiteNameis not<clinit>.- One can validly replace types matching the argument types given in
Descriptoron the incoming operand stack with the return type given inDescriptor, yielding the outgoing type state.
instructionIsTypeSafe(invokedynamic(CP,0,0), Environment, _Offset,
StackFrame, NextStackFrame, ExceptionStackFrame) :-
CP = dmethod(CallSiteName, Descriptor),
CallSiteName \= '<init>',
CallSiteName \= '<clinit>',
parseMethodDescriptor(Descriptor, OperandArgList, ReturnType),
reverse(OperandArgList, StackArgList),
validTypeTransition(Environment, StackArgList, ReturnType,
StackFrame, NextStackFrame),
exceptionStackFrame(StackFrame, ExceptionStackFrame).