Class MethodContext
java.lang.Object
org.ek9lang.compiler.backend.jvm.support.MethodContext
Shared context for a method that must be coordinated across all generators.
This context tracks:
- Variable to slot mappings
- Temp variable source tracking
- IR labels to JVM labels
- Local variable debug metadata
- Scope boundaries
- Field type descriptors
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintAllocate the next variable slot and increment the counter.Get the field descriptor map (maps "this.fieldName" to JVM descriptor).Get the IR label to JVM label mapping.Get the local variable debug metadata map.The operation-level (method-wide) scope id, or null if none was recorded.Get the scope boundaries map.Get the temp variable source tracking map.The receiver ('this') descriptor for an instance method (e.g.Get the variable to slot mapping.Get the variable type map (maps variable name to primitive type or null for objects).voidmarkOperationScopeIfAbsent(String scopeId) Record the operation-level (method-wide) scope on the FIRST SCOPE_ENTER — the outermost scope, which spans the whole method and is where parameters are live from.voidsetThisTypeDescriptor(String descriptor) Record the receiver descriptor for an instance method — enables the slot-0thisLocalVariableTable entry.
-
Constructor Details
-
MethodContext
public MethodContext()
-
-
Method Details
-
getVariableMap
-
getTempSourceMap
Get the temp variable source tracking map. -
getLabelMap
-
getLocalVariableMetadata
Get the local variable debug metadata map. -
getScopeMap
-
getFieldDescriptorMap
-
getVariableTypeMap
-
allocateNextSlot
public int allocateNextSlot()Allocate the next variable slot and increment the counter. -
markOperationScopeIfAbsent
Record the operation-level (method-wide) scope on the FIRST SCOPE_ENTER — the outermost scope, which spans the whole method and is where parameters are live from. Later (nested control-flow) SCOPE_ENTERs do not overwrite it. B.1: letsDebugInfoGeneratorpick the real method-wide scope for parameters instead of an arbitraryfindFirst()over the scope map. -
getOperationScopeId
The operation-level (method-wide) scope id, or null if none was recorded. -
getThisTypeDescriptor
The receiver ('this') descriptor for an instance method (e.g."Lfoo/Bar;"), or null for a static method. When set,DebugInfoGeneratoremits the slot-0thisLocalVariableTable entry. -
setThisTypeDescriptor
Record the receiver descriptor for an instance method — enables the slot-0thisLocalVariableTable entry. Leave unset (null) for static methods.
-