Class MethodContext

java.lang.Object
org.ek9lang.compiler.backend.jvm.support.MethodContext

public final class MethodContext extends Object
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 Details

    • MethodContext

      public MethodContext()
  • Method Details

    • getVariableMap

      public Map<String,Integer> getVariableMap()
      Get the variable to slot mapping.
    • getTempSourceMap

      public Map<String, TempVariableSource> getTempSourceMap()
      Get the temp variable source tracking map.
    • getLabelMap

      public Map<String, org.objectweb.asm.Label> getLabelMap()
      Get the IR label to JVM label mapping.
    • getLocalVariableMetadata

      public Map<String, LocalVariableInfo> getLocalVariableMetadata()
      Get the local variable debug metadata map.
    • getScopeMap

      public Map<String, ScopeInfo> getScopeMap()
      Get the scope boundaries map.
    • getFieldDescriptorMap

      public Map<String,String> getFieldDescriptorMap()
      Get the field descriptor map (maps "this.fieldName" to JVM descriptor).
    • getVariableTypeMap

      public Map<String,String> getVariableTypeMap()
      Get the variable type map (maps variable name to primitive type or null for objects). Used to track whether a variable contains a primitive value (int, boolean) so the correct load/store opcode can be used.
    • allocateNextSlot

      public int allocateNextSlot()
      Allocate the next variable slot and increment the counter.