Comment made by: hiredman
with hoistedmethod-pass-1.diff the example code generates bytecode like this
`
user=> (println (no.disassemble/disassemble (fn [] (loop [b 0] (recur (loop [a 1] a))))))
// Compiled from form-init1272682692522767658.clj (version 1.5 : 49.0, super bit)
public final class user$eval1675$fn__1676 extends clojure.lang.AFunction {
// Field descriptor #7 Ljava/lang/Object;
public static final java.lang.Object const__0;
// Field descriptor #7 Ljava/lang/Object;
public static final java.lang.Object const__1;
// Method descriptor #10 ()V
// Stack: 2, Locals: 0
public static {};
0 lconst_0
1 invokestatic java.lang.Long.valueOf(long) : java.lang.Long [16]
4 putstatic user$eval1675$fn__1676.const__0 : java.lang.Object [18]
7 lconst_1
8 invokestatic java.lang.Long.valueOf(long) : java.lang.Long [16]
11 putstatic user$eval1675$fn__1676.const__1 : java.lang.Object [20]
14 return
Line numbers:
[pc: 0, line: 1]
// Method descriptor #10 ()V
// Stack: 1, Locals: 1
public user$eval1675$fn__1676();
0 aload_0 [this]
1 invokespecial clojure.lang.AFunction() [23]
4 return
Line numbers:
[pc: 0, line: 1]
// Method descriptor #25 ()Ljava/lang/Object;
// Stack: 3, Locals: 3
public java.lang.Object invoke();
0 lconst_0
1 lstore_1 [b]
2 aload_0 [this]
3 lload_1 [b]
4 invokevirtual user$eval1675$fn__1676.__hoisted1677(long) : long [29]
7 lstore_1 [b]
8 goto 2
11 areturn
Line numbers:
[pc: 0, line: 1]
Local variable table:
[pc: 2, pc: 11] local: b index: 1 type: long
[pc: 0, pc: 11] local: this index: 0 type: java.lang.Object
// Method descriptor #27 (J)J
// Stack: 2, Locals: 5
public long __hoisted1677(long b);
0 lconst_1
1 lstore_3 [a]
2 lload_3
3 lreturn
Line numbers:
[pc: 0, line: 1]
Local variable table:
[pc: 2, pc: 3] local: a index: 3 type: long
[pc: 0, pc: 3] local: this index: 0 type: java.lang.Object
[pc: 0, pc: 3] local: b index: 1 type: java.lang.Object
}
nil
user=>
`
the body of the method __hoisted1677 is the inner loop
for reference the part of the bytecode from the same function compiled with 1.6.0 is pasted here https://gist.github.com/hiredman/f178a690718bde773ba0 the inner loop body is missing because it is implemented as its own IFn class that is instantiated and immediately executed. it closes over a boxed version of the numbers and returns an boxed version