reportWrongReturnType

fun reportWrongReturnType(    returnedValueOrNil: A_BasicObject,     expectedReturnType: A_Type,     pc: Int,     stackp: Int,     vararg slots: A_BasicObject): StackReifier

Handle a return value that doesn't satisfy its expected type out-of-line. This shrinks the control flow graph in L2, which is not just a time saving during creation and memory saving ongoing, but may also increase HotSpot's effectiveness.

This Interpreter's function and returningFunction are expected to contain the calling and returning functions, respectively.

Note that if the handler (HookType.RESULT_DISAGREED_WITH_EXPECTED_TYPE) asks to reify, this method will construct a continuation representing the Avail calling function. The continuation frame can't be resumed, so it will use the unoptimizedChunk's ChunkEntryPoint.UNREACHABLE.

Return

Either null or a StackReifier that the calling code should simply return. This method creates a stack frame on behalf of the Avail calling function if needed.

Parameters

returnedValueOrNil

The value that was actually returned, which may be nil.

expectedReturnType

The A_Type of value that was expected to be returned.

pc

The level one A_Continuation.pc to use in a new continuation, if reification happens inside the error handler.

stackp

The level one parameter stack pointer to use in a new continuation, if reification happens inside the error handler.

slots

Values that will populate a continuation's frame slots if reification happens inside the error handler.