readInt

fun readInt(semanticUnboxed: L2SemanticUnboxedInt, onFailure: L2BasicBlock): L2ReadIntOperand

Return an L2ReadIntOperand for the given L2SemanticUnboxedInt. The TypeRestriction must have been proven by the VM. If the semantic value only has a boxed form, generate code to unbox it.

In the case that unboxing may fail, a branch to the supplied onFailure L2BasicBlock will be generated. If the unboxing cannot fail (or if a corresponding L2IntRegister already exists), no branch will lead to onFailure, which can be determined by the client by testing L2BasicBlock.currentlyReachable.

In any case, the generation position after this call is along the success path. This may itself be unreachable in the event that the unboxing will always fail.

Return

The unboxed L2ReadIntOperand.

Parameters

semanticUnboxed

The L2SemanticUnboxedInt to read as an unboxed int.

onFailure

Where to jump in the event that an L2_JUMP_IF_UNBOX_INT fails. The manifest at this location will not contain bindings for the unboxed int (since unboxing was not possible).