CallSiteHelper

inner class CallSiteHelper

A helper that aggregates parameters for polymorphic dispatch inlining.

Parameters

bundle

The A_Bundle being invoked.

superUnionType

The type whose union with the arguments tuple type is used for lookup. This is ⊥ for ordinary calls, and other types for super calls.

expectedType

The expected result type that has been strengthened by A_SemanticRestrictions at this call site. The VM does not always guarantee this type will be returned, but it inserts runtime checks in the case that it can't prove it.

Functions

Link copied to clipboard
fun generateAllInvocationSites()

For every L2BasicBlock in my invocationSitesToCreate that is reachable, generate an invocation of the corresponding A_Function. A_Bundle.message

Link copied to clipboard
fun generator(): L2Generator

Answer the L2Generator that this CallSiteHelper is within.

Link copied to clipboard
fun translator(): L1Translator

Answer the L1Translator that this CallSiteHelper is within.

Link copied to clipboard
fun useAnswer(answerReg: L2ReadBoxedOperand)

Record the fact that this call has produced a value in a particular register which is to represent the new top-of-stack value.

Properties

Link copied to clipboard
val afterCallNoCheck: L2BasicBlock

Where to jump after a completed call if a return type check isn't needed.

Link copied to clipboard
val afterCallWithCheck: L2BasicBlock

Where to jump after a completed call to perform a return type check.

Link copied to clipboard
val afterEverything: L2BasicBlock

Where it ends up after the entire call, regardless of whether the returned value had to be checked or not.

Link copied to clipboard
var branchLabelCounter: Int = 1

A counter for generating unique branch names for this dispatch.

Link copied to clipboard
val bundle: A_Bundle

The A_Bundle being dispatched

Link copied to clipboard
val expectedType: A_Type

The type expected to be returned by invoking the function. This may be stronger than the type guaranteed by the VM, which requires a runtime check.

Link copied to clipboard
val invocationSitesToCreate: MutableMap<A_Function, Pair<L2BasicBlock, () -> Unit>>

A map from each reachable looked-up A_Function to a Pair containing an L2BasicBlock in which code generation for invocation of this function should/did take place, and a lambda which will cause that code generation to happen.

Link copied to clipboard
val isSuper: Boolean

Whether this call site is a super lookup.

Link copied to clipboard
val onFallBackToSlowLookup: L2BasicBlock

Where to jump to perform the slow lookup.

Link copied to clipboard
val onReificationNoCheck: L2BasicBlock

Where to jump to perform reification without the need for an eventual return type check.

Link copied to clipboard
val onReificationUnreturnable: L2BasicBlock

Where to jump to perform reification during a call that cannot ever return.

Link copied to clipboard
val onReificationWithCheck: L2BasicBlock

Where to jump to perform reification, eventually leading to a return type check after completion.

Link copied to clipboard
val quotedBundleName: String

A Java String naming the A_Bundle.

Link copied to clipboard
val superUnionType: A_Type

Bottom in the normal case, but for a super-call this is a tuple type with the same size as the number of arguments. For the purpose of looking up the appropriate A_Definition, the type union of each argument's dynamic type and the corresponding entry type from this field is computed, and that's used for the lookup.