AccessBridge

Bootstrap methods for invokedynamic call sites emitted by the access-widening bytecode transform in ScriptWeave. Each bootstrap resolves a private/protected/package-private member via privateLookupIn and returns a ConstantCallSite, which the JIT can inline.

This class lives on the game loader (not impl/), so script classes loaded by the masking loader can resolve it via parent delegation — same cross-loader pattern as ReplBridge and PatchEnterCallback.

The call-site MethodType is not the real signature. Widening a member's access is only half the job: a call site whose descriptor names an inaccessible class is rejected while the JVM resolves that descriptor, before any bootstrap here runs (e.g. a descriptor naming package-private kotlin.collections.EmptyMap is rejected). So the transform erases every inaccessible reference type in the call-site descriptor to Object and passes the real names through as string bootstrap arguments instead.

Two consequences for every bootstrap below:

  • type cannot be trusted for the member's real type — the field bootstraps read it reflectively via findField, the method bootstraps take it from the desc argument.
  • Every returned handle is asType'd to type, which inserts the casts between the erased Object view and the real types.

Constructors

Link copied to clipboard
private constructor()

Properties

Link copied to clipboard

Functions

Link copied to clipboard
private open fun backingField(cls: Class<out Any>, method: String, mt: MethodType, hasReceiver: Boolean, caller: MethodHandles.Lookup, cause: NoSuchMethodException): MethodHandle
A Kotlin private val has a backing field and no accessor, yet the metadata flip makes the frontend emit getXxx() against it — resolve such a call to the field instead.
Link copied to clipboard
private open fun capitalize(s: String): String
Kotlin capitalizes ASCII only, so URL and _options keep their head.
Link copied to clipboard
private open fun declaredField(c: Class<out Any>, field: String, wantStatic: Boolean): Field
c's own field of the wanted kind, or null.
Link copied to clipboard
open fun fieldGet(caller: MethodHandles.Lookup, invokedName: String, type: MethodType, owner: String, field: String): CallSite
Bootstrap a GETFIELD call site.
Link copied to clipboard
open fun fieldSet(caller: MethodHandles.Lookup, invokedName: String, type: MethodType, owner: String, field: String): CallSite
Bootstrap a PUTFIELD call site.
Link copied to clipboard
private open fun findField(ref: Class<out Any>, field: String, wantStatic: Boolean): Field
The field ref resolves field to.
Link copied to clipboard
private open fun findMethodOwner(ref: Class<out Any>, method: String, mt: MethodType): Class<out Any>
The class in ref's hierarchy that declares method with mt's parameter types — the method analogue of findField.
Link copied to clipboard
private open fun getterName(prop: String): String
JvmAbi.getterName: an is-prefixed property is already its own getter.
Link copied to clipboard
private open fun interfaceClosure(ref: Class<out Any>): Iterable<Class<out Any>>
Every interface reachable from ref, breadth-first.
Link copied to clipboard
private open fun isPrefixed(name: String): Boolean
JvmAbi.startsWithIsPrefix: is followed by anything that is not a lower-case letter.
Link copied to clipboard
private open fun lookupIn(cls: Class<out Any>, caller: MethodHandles.Lookup): MethodHandles.Lookup
privateLookupIn on cls, or caller where its module refuses to open — java.base being the one that does.
Link copied to clipboard
private open fun resolve(owner: String, caller: MethodHandles.Lookup): Class<out Any>
Link copied to clipboard
private open fun setterName(prop: String): String
JvmAbi.setterName: the is is dropped rather than kept — isEmpty sets via setEmpty.
Link copied to clipboard
open fun staticCall(caller: MethodHandles.Lookup, invokedName: String, type: MethodType, owner: String, method: String, desc: String): CallSite
Bootstrap an INVOKESTATIC call site; the real signature is in desc, the declaring class resolved via findMethodOwner.
Link copied to clipboard
open fun staticFieldGet(caller: MethodHandles.Lookup, invokedName: String, type: MethodType, owner: String, field: String): CallSite
Bootstrap a GETSTATIC call site.
Link copied to clipboard
open fun staticFieldSet(caller: MethodHandles.Lookup, invokedName: String, type: MethodType, owner: String, field: String): CallSite
Bootstrap a PUTSTATIC call site.
Link copied to clipboard
open fun virtualCall(caller: MethodHandles.Lookup, invokedName: String, type: MethodType, owner: String, method: String, desc: String): CallSite
Bootstrap an INVOKEVIRTUAL/INVOKEINTERFACE call site; the real signature is in desc, the declaring class resolved via findMethodOwner.