Skip to content

Instantly share code, notes, and snippets.

@lrytz
Created October 27, 2014 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lrytz/81805c460eef3864cc1a to your computer and use it in GitHub Desktop.
Save lrytz/81805c460eef3864cc1a to your computer and use it in GitHub Desktop.
class C {
def f() = {
val x = 0
val f = (a: Int) => a + x
f(1)
}
}
// class version 50.0 (50)
// access flags 0x31
public final class C$lambda$$f$1 extends scala/runtime/AbstractFunction1 implements scala/Serializable {
// compiled from: Test.scala
ATTRIBUTE Scala : unknown
// access flags 0x1
public I x$2
// access flags 0x1
public <init>(I)V
L0
LINENUMBER 4 L0
ALOAD 0
INVOKESPECIAL scala/runtime/AbstractFunction1.<init> ()V
ALOAD 0
ILOAD 1
PUTFIELD C$lambda$$f$1.x$2 : I
RETURN
L1
LOCALVARIABLE this LC$lambda$$f$1; L0 L1 0
LOCALVARIABLE x$2 I L0 L1 1
MAXSTACK = 2
MAXLOCALS = 2
// access flags 0x11
public final apply(I)I
L0
LINENUMBER 4 L0
ILOAD 1
ALOAD 0
GETFIELD C$lambda$$f$1.x$2 : I
INVOKESTATIC C.accessor$1 (II)I
IRETURN
L1
LOCALVARIABLE this LC$lambda$$f$1; L0 L1 0
LOCALVARIABLE a I L0 L1 1
MAXSTACK = 2
MAXLOCALS = 2
// access flags 0x1051
public final synthetic bridge apply(Ljava/lang/Object;)Ljava/lang/Object;
L0
LINENUMBER 4 L0
ALOAD 0
ALOAD 1
INVOKESTATIC scala/runtime/BoxesRunTime.unboxToInt (Ljava/lang/Object;)I
INVOKEVIRTUAL C$lambda$$f$1.apply (I)I
INVOKESTATIC scala/runtime/BoxesRunTime.boxToInteger (I)Ljava/lang/Integer;
ARETURN
L1
LOCALVARIABLE this LC$lambda$$f$1; L0 L1 0
LOCALVARIABLE a Ljava/lang/Object; L0 L1 1
MAXSTACK = 2
MAXLOCALS = 2
}
// class version 50.0 (50)
// access flags 0x21
public class C {
// compiled from: Test.scala
@Lscala/reflect/ScalaSignature;(bytes="\u0006\u0001]1A!\u0001\u0002\u0001\u000b\u0009\u00091IC\u0001\u0004\u0003\u001daT-\u001c9usz\u001a\u0001a\u0005\u0002\u0001\rA\u0011qAC\u0007\u0002\u0011)\u0009\u0011\"A\u0003tG\u0006d\u0017-\u0003\u0002\u000c\u0011\u00091\u0011I\\=SK\u001aDQ!\u0004\u0001\u0005\u00029\u0009a\u0001P5oSRtD#A\u0008\u0011\u0005A\u0001Q\"\u0001\u0002\u0009\u000bI\u0001A\u0011A\n\u0002\u0003\u0019$\u0012\u0001\u0006\u0009\u0003\u000fUI!A\u0006\u0005\u0003\u0007%sG\u000f")
ATTRIBUTE ScalaSig : unknown
// access flags 0x1
public f()I
L0
LINENUMBER 3 L0
ICONST_0
ISTORE 1
L1
LINENUMBER 4 L1
NEW C$lambda$$f$1
DUP
ILOAD 1
INVOKESPECIAL C$lambda$$f$1.<init> (I)V
CHECKCAST scala/Function1
ASTORE 2
L2
LINENUMBER 5 L2
ALOAD 2
ICONST_1
INVOKEINTERFACE scala/Function1.apply$mcII$sp (I)I
L3
IRETURN
L4
LOCALVARIABLE this LC; L0 L4 0
LOCALVARIABLE x I L1 L3 1
LOCALVARIABLE f Lscala/Function1; L2 L3 2
MAXSTACK = 3
MAXLOCALS = 3
// access flags 0x101A
private final static synthetic $anonfun$1(II)I
L0
LINENUMBER 4 L0
ILOAD 0
ILOAD 1
IADD
IRETURN
L1
LOCALVARIABLE a I L0 L1 0
LOCALVARIABLE x$1 I L0 L1 1
MAXSTACK = 2
MAXLOCALS = 2
// access flags 0x1
public <init>()V
L0
LINENUMBER 7 L0
ALOAD 0
INVOKESPECIAL java/lang/Object.<init> ()V
RETURN
L1
LOCALVARIABLE this LC; L0 L1 0
MAXSTACK = 1
MAXLOCALS = 1
// access flags 0x1059
public final static synthetic bridge accessor$1(II)I
L0
ILOAD 0
ILOAD 1
L1
LINENUMBER 4 L1
INVOKESTATIC C.$anonfun$1 (II)I
IRETURN
L2
LOCALVARIABLE a I L0 L2 0
LOCALVARIABLE x$1 I L0 L2 1
MAXSTACK = 2
MAXLOCALS = 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment