title: Constructor bytecode
body: <p>The <a href="https://asm.ow2.io/asm4-guide.pdf" rel="nofollow noreferrer">ASM guide</a> talks about constructors:</p>
  
  <blockquote>
  <pre><code>package pkg;
  public class Bean {
    private int f;
    public int getF() {
        return this.f;
    }
    public void setF(int f) {
        this.f = f;
    }
  }
  </code></pre>
    
    <p>The Bean class also has a default public constructor which is
    generated by the compiler, since no explicit constructor was defined
    by the programmer. This default public constructor is generated as
    <code>Bean() { super(); }</code>. The bytecode of this constructor is the
    following:</p>
  
  <pre><code>ALOAD 0
  INVOKESPECIAL java/lang/Object &lt;init&gt; ()V
  RETURN
  </code></pre>
    
    <p>The first instruction pushes <code>this</code> on the operand stack. The second
    instruction pops this value from the stack, and calls the <code>&lt;init&gt;</code>
    method defined in the <code>Object</code> class. This corresponds to the <code>super()</code>
    call, i.e. a call to the constructor of the super class, <code>Object</code>. You
    can see here that constructors are named differently in compiled and
    source classes: in compiled classes they are always named <code>&lt;init&gt;</code>,
    while in source classes they have the name of the class in which they
    are defined. Finally the last instruction returns to the caller.</p>
  </blockquote>
  
  <p>How is the value of <code>this</code> already known to the JVM before the first instruction of the constructor?</p>