Class ListLiteralAsmGenerator

java.lang.Object
org.ek9lang.compiler.backend.jvm.AbstractAsmGenerator
org.ek9lang.compiler.backend.jvm.ListLiteralAsmGenerator
All Implemented Interfaces:
Consumer<ListLiteralInstr>

final class ListLiteralAsmGenerator extends AbstractAsmGenerator implements Consumer<ListLiteralInstr>
Generates JVM bytecode for LIST_LITERAL IR instructions.

Uses pre-sized ArrayList constructor for optimal allocation: new ArrayList(N) avoids all resizing and internal array copies. Then populates via per-element _addAss() calls.

Bytecode sequence:

  1. Execute setup instructions (evaluate elements, RETAIN/SCOPE_REGISTER)
  2. NEW listType + DUP + LDC elementCount + INVOKESPECIAL <init>(I)V
  3. Store to result variable
  4. For each element: load result, load element, INVOKEVIRTUAL _addAss(Any)V