SlideShare a Scribd company logo
SCALA UNDER THE HOOD
TZOFIA SHIFTAN / OVEROPS
AGENDA
1. JVM 101
2. THE COOL STUFF
JVM 101
bytecode
Noun
Java bytecode is the instruction set of the
Java virtual machine
Wikipedia
JVM
Example.classExample.scala
scalac scala
javap
class file
javap
$ javap Example.class
Compiled from "Example.scala"
public class Example {
public int b();
public int bar(int);
public Example();
}
javap
$ javap -p Example.class
Compiled from "Example.scala"
public class Example {
private int a;
private final int b;
private int a();
private void a_$eq(int);
public int b();
private void foo();
public int bar(int);
public Example();
}
javap
$ javap -c Example.class
Compiled from "Example.scala"
public class Example {
public int b();
Code:
0: aload_0
1: getfield #21 // Field b:I
4: ireturn
public int bar(int);
Code:
0: iconst_3
1: iload_1
2: imul
3: ireturn
...
javap
JVM
THREADTHREAD THREAD
STACK STACK STACK
FRAME
FRAME
FRAME
FRAME
FRAME
FRAME
FRAME
FRAME
FRAME
FRAME
OPERAND STACKLOCAL VARIABLES
this
0 1 2
def add(a : Int, b : Int) = a+b
iload_0
iload_1
iadd
ireturn
add(2,5)
FRAME
LOCAL VARIABLES OPERAND STACK
a b
2 5
def add(a : Int, b : Int) = a+b
iload_0
iload_1
iadd
ireturn
add(2,5)
FRAME
LOCAL VARIABLES OPERAND STACK
a b
2 5
2
def add(a : Int, b : Int) = a+b
iload_0
iload_1
iadd
ireturn
add(2,5)
FRAME
LOCAL VARIABLES OPERAND STACK
a b
2 5
2
5
def add(a : Int, b : Int) = a+b
iload_0
iload_1
iadd
ireturn
add(2,5)
FRAME
LOCAL VARIABLES OPERAND STACK
a b
2 5
7
2
5
7
+
=
2
5
FRAME
LOCAL VARIABLES OPERAND STACK
a b
2 5
7
def add(a : Int, b : Int) = a+b
iload_0
iload_1
iadd
ireturn
add(2,5)
THE COOL STUFF
val vs var vs def
val
var
def
class Var {
var a = 1
}
class Val {
val a = 1
}
class Def {
def a = 1
}
javap -p Var
javap -p Val
javap -p Def
val
var
def
private final int a;
public int a();
public Val();
private int a;
public int a();
public void a_$eq(int);
public Var();
public int a();
public Def();
val
var
def
private final int a;
public int a();
public Val();
private int a;
public int a();
public void a_$eq(int);
public Var();
public int a();
public Def();
val
var
def
private final int a;
public int a();
public Val();
private int a;
public int a();
public void a_$eq(int);
public Var();
public int a();
public Def();
val
var
def
private final int a;
public int a();
public Val();
private int a;
public int a();
public void a_$eq(int);
public Var();
public int a();
public Def();
val
var
def
public int a();
aload_0
getfield #13 // Field a:I
ireturn
public int a();
iconst_1
ireturn
return this.a
return 1
val
var
def
private final int a;
public int a();
public Val();
private int a;
public int a();
public void a_$eq(int);
public Var();
public int a();
public Def();
val
var
def
public void a_$eq(int);
aload_0
iload_1
putfield #13 // Field a:I
return
this.a = a
val
var
def
private final int a;
public int a();
public Val();
private int a;
public int a();
public void a_$eq(int);
public Var();
public int a();
public Def();
val
var
def
public Va[r|l]();
aload_0
invokespecial #19 // Method java/lang/Object."<init>":()V
aload_0
iconst_1
putfield #13 // Field a:I
return
public Def();
aload_0
invokespecial #16 // Method java/lang/Object."<init>":()V
return
val
var
def
this.a = 1
return
getter setter evaluation
val 1
var 1
def multiple
lazy val
val
lazy val
class Val {
val a = 1
}
class LazyVal {
lazy val a = 1
}
javap -p Val
javap -p LazyVal
val
lazy val
private final int a;
public Val();
public int a();
private int a;
public LazyVal();
private volatile boolean bitmap$0;
private int a$lzycompute();
public int a();
val
lazy val
private final int a;
public Val();
public int a();
private int a;
public LazyVal();
private volatile boolean bitmap$0;
private int a$lzycompute();
public int a();
val
lazy val
private final int a;
public Val();
public int a();
private int a;
public LazyVal();
private volatile boolean bitmap$0;
private int a$lzycompute();
public int a();
val
lazy val
public Val();
aload_0
invokespecial #19 // Method java/lang/Object."<init>":()V
aload_0
iconst_1
putfield #13 // Field a:I
return
public LazyVal();
aload_0
Invokespecial #28 // Method java/lang/Object."<init>":()V
return
super()
val
lazy val
private final int a;
public Val();
public int a();
private int a;
public LazyVal();
private volatile boolean bitmap$0;
private int a$lzycompute();
public int a();
val
lazy val
private int a$lzycompute();
0: aload_0
1: dup
2: astore_1
3: monitorenter
4: aload_0
5: getfield #16 // Field bitmap$0:Z
8: ifne 21
11: aload_0
12: iconst_1
13: putfield #18 // Field a:I
16: aload_0
17: iconst_1
18: putfield #16 // Field bitmap$0:Z
21: aload_1
22: monitorexit
23: goto 29
26: aload_1
27: monitorexit
28: athrow
29: aload_0
30: getfield #18 // Field a:I
33: ireturn
private int a$lzycompute();
0: aload_0
1: dup
2: astore_1
3: monitorenter
4: aload_0
5: getfield #16 // Field bitmap$0:Z
8: ifne 21
11: aload_0
12: iconst_1
13: putfield #18 // Field a:I
16: aload_0
17: iconst_1
18: putfield #16 // Field bitmap$0:Z
21: aload_1
22: monitorexit
23: goto 29
26: aload_1
27: monitorexit
28: athrow
29: aload_0
30: getfield #18 // Field a:I
33: ireturn
synchronize start
private int a$lzycompute();
0: aload_0
1: dup
2: astore_1
3: monitorenter
4: aload_0
5: getfield #16 // Field bitmap$0:Z
8: ifne 21
11: aload_0
12: iconst_1
13: putfield #18 // Field a:I
16: aload_0
17: iconst_1
18: putfield #16 // Field bitmap$0:Z
21: aload_1
22: monitorexit
23: goto 29
26: aload_1
27: monitorexit
28: athrow
29: aload_0
30: getfield #18 // Field a:I
33: ireturn
bitmap$0 ? 0
private int a$lzycompute();
0: aload_0
1: dup
2: astore_1
3: monitorenter
4: aload_0
5: getfield #16 // Field bitmap$0:Z
8: ifne 21
11: aload_0
12: iconst_1
13: putfield #18 // Field a:I
16: aload_0
17: iconst_1
18: putfield #16 // Field bitmap$0:Z
21: aload_1
22: monitorexit
23: goto 29
26: aload_1
27: monitorexit
28: athrow
29: aload_0
30: getfield #18 // Field a:I
33: ireturn
this.a = 1
this.bitmap$0 = 1
synchronize end
return this.a
bitmap$0 == 0
private int a$lzycompute();
0: aload_0
1: dup
2: astore_1
3: monitorenter
4: aload_0
5: getfield #16 // Field bitmap$0:Z
8: ifne 21
11: aload_0
12: iconst_1
13: putfield #18 // Field a:I
16: aload_0
17: iconst_1
18: putfield #16 // Field bitmap$0:Z
21: aload_1
22: monitorexit
23: goto 29
26: aload_1
27: monitorexit
28: athrow
29: aload_0
30: getfield #18 // Field a:I
33: ireturn
synchronize end
return this.a
bitmap$0 == 1
private int a$lzycompute() {
LazyVal lazyVal = this;
synchronized (lazyVal) {
if (!this.bitmap$0) {
this.a = 1;
this.bitmap$0 = true;
}
}
return this.a;
}
private int a$lzycompute() {
LazyVal lazyVal = this;
synchronized (lazyVal) {
if (!this.bitmap$0) {
this.a = 1;
this.bitmap$0 = true;
}
}
return this.a;
}
private int a$lzycompute() {
LazyVal lazyVal = this;
synchronized (lazyVal) {
if (!this.bitmap$0) {
this.a = 1;
this.bitmap$0 = true;
}
}
return this.a;
}
private final int a;
public Val();
public int a();
private int a;
public LazyVal();
private volatile boolean bitmap$0;
private int a$lzycompute();
public int a();
val
lazy val
public int a();
0: aload_0
1: getfield #16 // Field bitmap$0:Z
4: ifne 14
7: aload_0
8: invokespecial #24 // Method a$lzycompute:()I
11: goto 18
14: aload_0
15: getfield #18 // Field a:I
18: ireturn
public int a();
0: aload_0
1: getfield #16 // Field bitmap$0:Z
4: ifne 14
7: aload_0
8: invokespecial #24 // Method a$lzycompute:()I
11: goto 18
14: aload_0
15: getfield #18 // Field a:I
18: ireturn
bitmap$0 ? 0
public int a();
0: aload_0
1: getfield #16 // Field bitmap$0:Z
4: ifne 14
7: aload_0
8: invokespecial #24 // Method a$lzycompute:()I
11: goto 18
14: aload_0
15: getfield #18 // Field a:I
18: ireturn
this.a$lzycompute()
return ^
bitmap$0 == 0
public int a();
0: aload_0
1: getfield #16 // Field bitmap$0:Z
4: ifne 14
7: aload_0
8: invokespecial #24 // Method a$lzycompute:()I
11: goto 18
14: aload_0
15: getfield #18 // Field a:I
18: ireturn
bitmap$0 == 1 return this.a
evaluation
val c’tor
lazy val lzycompute
object
object Hello {
def main(args: Array[String]) {
println("Hello, Scala Swarm!")
}
}
Hello.scala
Hello.class
Hello$.class
scalac
Compiled from "Hello.scala"
public final class Hello {
public static void main(java.lang.String[]);
}
Compiled from "Hello.scala"
public final class Hello$ {
public static Hello$ MODULE$;
public static {};
private Hello$();
public void main(java.lang.String[]);
}
Compiled from "Hello.scala"
public final class Hello {
public static void main(java.lang.String[]);
}
Compiled from "Hello.scala"
public final class Hello$ {
public static Hello$ MODULE$;
public static {};
private Hello$();
public void main(java.lang.String[]);
}
Compiled from "Hello.scala"
public final class Hello {
public static void main(java.lang.String[]);
}
Compiled from "Hello.scala"
public final class Hello$ {
public static Hello$ MODULE$;
public static {};
private Hello$();
public void main(java.lang.String[]);
}
public static void main(java.lang.String[]);
getstatic #16 // Field Hello$.MODULE$:LHello$;
aload_0
invokevirtual #18 // Method Hello$.main:([Ljava/lang/String;)V
return
Hello$.MODULE$.main(args)
Compiled from "Hello.scala"
public final class Hello {
public static void main(java.lang.String[]);
}
Compiled from "Hello.scala"
public final class Hello$ {
public static Hello$ MODULE$;
public static {};
private Hello$();
public void main(java.lang.String[]);
}
Compiled from "Hello.scala"
public final class Hello {
public static void main(java.lang.String[]);
}
Compiled from "Hello.scala"
public final class Hello$ {
public static Hello$ MODULE$;
public static {};
private Hello$();
public void main(java.lang.String[]);
}
public static {};
new #2 // class Hello$
invokespecial #12 // Method "<init>":()V
return
new Hello$()
Compiled from "Hello.scala"
public final class Hello {
public static void main(java.lang.String[]);
}
Compiled from "Hello.scala"
public final class Hello$ {
public static Hello$ MODULE$;
public static {};
private Hello$();
public void main(java.lang.String[]);
}
private Hello$();
aload_0
invokespecial #29 // Method java/lang/Object."<init>":()V
aload_0
putstatic #31 // Field MODULE$:LHello$;
return
MODULE$ = this
Compiled from "Hello.scala"
public final class Hello {
public static void main(java.lang.String[]);
}
Compiled from "Hello.scala"
public final class Hello$ {
public static Hello$ MODULE$;
public static {};
private Hello$();
public void main(java.lang.String[]);
}
public void main(java.lang.String[]);
getstatic #20 // Field scala/Predef$.MODULE$:Lscala/Predef$;
ldc #22 // String Hello, Scala Swarm!
invokevirtual #26 // Method scala/Predef$.println:(Ljava/lang/Object;)V
return
println(“Hello, Scala Swarm!”)
public final class Hello$ {
public static Hello$ MODULE$;
public static {
new Hello$();
}
private Hello$() {
MODULE$ = this;
}
public void main(String[] args) {
println("Hello, Scala Swarm!");
}
}
public final class Hello {
public static void main(final String[] args) {
Hello$.MODULE$.main(args);
}
}
public final class Hello$ {
public static Hello$ MODULE$;
public static {
new Hello$();
}
private Hello$() {
MODULE$ = this;
}
public void main(String[] args) {
println("Hello, Scala Swarm!");
}
}
public final class Hello {
public static void main(final String[] args) {
Hello$.MODULE$.main(args);
}
}
public final class Hello$ {
public static Hello$ MODULE$;
public static {
new Hello$();
}
private Hello$() {
MODULE$ = this;
}
public void main(String[] args) {
println("Hello, Scala Swarm!");
}
}
public final class Hello {
public static void main(final String[] args) {
Hello$.MODULE$.main(args);
}
}
public final class Hello$ {
public static Hello$ MODULE$;
public static {
new Hello$();
}
private Hello$() {
MODULE$ = this;
}
public void main(String[] args) {
println("Hello, Scala Swarm!");
}
}
public final class Hello {
public static void main(final String[] args) {
Hello$.MODULE$.main(args);
}
}
public final class Hello$ {
public static Hello$ MODULE$;
public static {
new Hello$();
}
private Hello$() {
MODULE$ = this;
}
public void main(String[] args) {
println(“Hello, Scala Swarm!");
}
}
public final class Hello {
public static void main(final String[] args) {
Hello$.MODULE$.main(args);
}
}
public final class Hello$ {
public static Hello$ MODULE$;
public static {
new Hello$();
}
private Hello$() {
MODULE$ = this;
}
public void main(String[] args) {
println("Hello, Scala Swarm!");
}
}
public final class Hello {
public static void main(final String[] args) {
Hello$.MODULE$.main(args);
}
}
Hello, Scala Swarm!
SUMMARY
Given a problem, consider the following steps:
1. javap
2. repeat
tzofia@overopshq.com
@tzofias

More Related Content

What's hot

Why you-dont-need-design-patterns-in-python
Why you-dont-need-design-patterns-in-pythonWhy you-dont-need-design-patterns-in-python
Why you-dont-need-design-patterns-in-python
Sivanagaraju Pachipulusu
 
C lab programs
C lab programsC lab programs
C lab programs
Dr. Prashant Vats
 
Intro to c programming
Intro to c programmingIntro to c programming
Intro to c programming
Prabhu Govind
 
Zend VMにおける例外の実装
Zend VMにおける例外の実装Zend VMにおける例外の実装
Zend VMにおける例外の実装
Yoshio Hanawa
 
HotSpot template interpreter memos
HotSpot template interpreter memosHotSpot template interpreter memos
HotSpot template interpreter memos
ytoshima
 
Common Intermediate Language (.NET) by Example
Common Intermediate Language (.NET) by ExampleCommon Intermediate Language (.NET) by Example
Common Intermediate Language (.NET) by Example
Ganesh Samarthyam
 
Getting started with LLVM using Swift / Алексей Денисов (Blacklane)
Getting started with LLVM using Swift / Алексей Денисов (Blacklane)Getting started with LLVM using Swift / Алексей Денисов (Blacklane)
Getting started with LLVM using Swift / Алексей Денисов (Blacklane)
Ontico
 
Python 炒股指南
Python 炒股指南 Python 炒股指南
Python 炒股指南
Leo Zhou
 
節子、それViewControllerやない...、FatViewControllerや...。
節子、それViewControllerやない...、FatViewControllerや...。節子、それViewControllerやない...、FatViewControllerや...。
節子、それViewControllerやない...、FatViewControllerや...。
Kenji Tanaka
 
COMUNICACION SERIAL DSPIC30F3014 Y MATLAB
COMUNICACION SERIAL DSPIC30F3014 Y MATLABCOMUNICACION SERIAL DSPIC30F3014 Y MATLAB
COMUNICACION SERIAL DSPIC30F3014 Y MATLAB
Carlos Buitron Quispe
 
Nobody knows-except-g4mm4
Nobody knows-except-g4mm4Nobody knows-except-g4mm4
Nobody knows-except-g4mm4
Xchym Hiệp
 
VC「もしかして...」Model「私たち...」「「入れ替わってるー!?」」を前前前世から防ぐ方法
VC「もしかして...」Model「私たち...」「「入れ替わってるー!?」」を前前前世から防ぐ方法VC「もしかして...」Model「私たち...」「「入れ替わってるー!?」」を前前前世から防ぐ方法
VC「もしかして...」Model「私たち...」「「入れ替わってるー!?」」を前前前世から防ぐ方法
Kenji Tanaka
 
Ruby closures, how are they possible?
Ruby closures, how are they possible?Ruby closures, how are they possible?
Ruby closures, how are they possible?
Carlos Alonso Pérez
 
Blending Culture in Twitter Client
Blending Culture in Twitter ClientBlending Culture in Twitter Client
Blending Culture in Twitter Client
Kenji Tanaka
 
Catastrophic Cancellation
Catastrophic CancellationCatastrophic Cancellation
Catastrophic Cancellation
C4Media
 
NSClient++ Workshop: 05 Monitoring
NSClient++ Workshop: 05 MonitoringNSClient++ Workshop: 05 Monitoring
NSClient++ Workshop: 05 Monitoring
Michael Medin
 

What's hot (18)

Why you-dont-need-design-patterns-in-python
Why you-dont-need-design-patterns-in-pythonWhy you-dont-need-design-patterns-in-python
Why you-dont-need-design-patterns-in-python
 
C lab programs
C lab programsC lab programs
C lab programs
 
Intro to c programming
Intro to c programmingIntro to c programming
Intro to c programming
 
Zend VMにおける例外の実装
Zend VMにおける例外の実装Zend VMにおける例外の実装
Zend VMにおける例外の実装
 
HotSpot template interpreter memos
HotSpot template interpreter memosHotSpot template interpreter memos
HotSpot template interpreter memos
 
Common Intermediate Language (.NET) by Example
Common Intermediate Language (.NET) by ExampleCommon Intermediate Language (.NET) by Example
Common Intermediate Language (.NET) by Example
 
Getting started with LLVM using Swift / Алексей Денисов (Blacklane)
Getting started with LLVM using Swift / Алексей Денисов (Blacklane)Getting started with LLVM using Swift / Алексей Денисов (Blacklane)
Getting started with LLVM using Swift / Алексей Денисов (Blacklane)
 
Python 炒股指南
Python 炒股指南 Python 炒股指南
Python 炒股指南
 
節子、それViewControllerやない...、FatViewControllerや...。
節子、それViewControllerやない...、FatViewControllerや...。節子、それViewControllerやない...、FatViewControllerや...。
節子、それViewControllerやない...、FatViewControllerや...。
 
COMUNICACION SERIAL DSPIC30F3014 Y MATLAB
COMUNICACION SERIAL DSPIC30F3014 Y MATLABCOMUNICACION SERIAL DSPIC30F3014 Y MATLAB
COMUNICACION SERIAL DSPIC30F3014 Y MATLAB
 
Nobody knows-except-g4mm4
Nobody knows-except-g4mm4Nobody knows-except-g4mm4
Nobody knows-except-g4mm4
 
VC「もしかして...」Model「私たち...」「「入れ替わってるー!?」」を前前前世から防ぐ方法
VC「もしかして...」Model「私たち...」「「入れ替わってるー!?」」を前前前世から防ぐ方法VC「もしかして...」Model「私たち...」「「入れ替わってるー!?」」を前前前世から防ぐ方法
VC「もしかして...」Model「私たち...」「「入れ替わってるー!?」」を前前前世から防ぐ方法
 
Ruby closures, how are they possible?
Ruby closures, how are they possible?Ruby closures, how are they possible?
Ruby closures, how are they possible?
 
Blending Culture in Twitter Client
Blending Culture in Twitter ClientBlending Culture in Twitter Client
Blending Culture in Twitter Client
 
Of class3
Of class3Of class3
Of class3
 
Catastrophic Cancellation
Catastrophic CancellationCatastrophic Cancellation
Catastrophic Cancellation
 
Vcs15
Vcs15Vcs15
Vcs15
 
NSClient++ Workshop: 05 Monitoring
NSClient++ Workshop: 05 MonitoringNSClient++ Workshop: 05 Monitoring
NSClient++ Workshop: 05 Monitoring
 

Similar to Scala Under the Hood / ScalaSwarm

ANSimport java.util.Scanner; class Bina_node { Bina_node .pdf
ANSimport java.util.Scanner; class Bina_node { Bina_node .pdfANSimport java.util.Scanner; class Bina_node { Bina_node .pdf
ANSimport java.util.Scanner; class Bina_node { Bina_node .pdf
anukoolelectronics
 
Best Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesBest Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' Mistakes
Andrey Karpov
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
Ganesh Samarthyam
 
Interfacepackage PJ1; public interface SimpleFractionInterface.pdf
Interfacepackage PJ1; public interface SimpleFractionInterface.pdfInterfacepackage PJ1; public interface SimpleFractionInterface.pdf
Interfacepackage PJ1; public interface SimpleFractionInterface.pdf
sutharbharat59
 
SOLID principles in practice: the Clean Architecture
SOLID principles in practice: the Clean ArchitectureSOLID principles in practice: the Clean Architecture
SOLID principles in practice: the Clean Architecture
Fabio Collini
 
operating system linux,ubuntu,Mac Geometri.pdf
operating system linux,ubuntu,Mac Geometri.pdfoperating system linux,ubuntu,Mac Geometri.pdf
operating system linux,ubuntu,Mac Geometri.pdf
aquadreammail
 
Virtual Functions
Virtual FunctionsVirtual Functions
Virtual Functions
Roman Okolovich
 
Java Bytecode Crash Course [Code One 2019]
Java Bytecode Crash Course [Code One 2019]Java Bytecode Crash Course [Code One 2019]
Java Bytecode Crash Course [Code One 2019]
David Buck
 
Scottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADScottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RAD
lostcaggy
 
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
curwenmichaela
 
循環参照のはなし
循環参照のはなし循環参照のはなし
循環参照のはなし
Masahiro Honma
 
The Truth About Lambdas in PHP
The Truth About Lambdas in PHPThe Truth About Lambdas in PHP
The Truth About Lambdas in PHP
Sharon Levy
 
Please read the comment ins codeExpressionTree.java-------------.pdf
Please read the comment ins codeExpressionTree.java-------------.pdfPlease read the comment ins codeExpressionTree.java-------------.pdf
Please read the comment ins codeExpressionTree.java-------------.pdf
shanki7
 
in this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdfin this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdf
michardsonkhaicarr37
 
import java.util.Scanner;public class Fraction {   instan.pdf
import java.util.Scanner;public class Fraction {    instan.pdfimport java.util.Scanner;public class Fraction {    instan.pdf
import java.util.Scanner;public class Fraction {   instan.pdf
apleathers
 
Improving Java performance at JBCNConf 2015
Improving Java performance at JBCNConf 2015Improving Java performance at JBCNConf 2015
Improving Java performance at JBCNConf 2015
Raimon Ràfols
 
Stack queue
Stack queueStack queue
Stack queue
James Wong
 

Similar to Scala Under the Hood / ScalaSwarm (20)

ANSimport java.util.Scanner; class Bina_node { Bina_node .pdf
ANSimport java.util.Scanner; class Bina_node { Bina_node .pdfANSimport java.util.Scanner; class Bina_node { Bina_node .pdf
ANSimport java.util.Scanner; class Bina_node { Bina_node .pdf
 
Best Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesBest Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' Mistakes
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
 
Interfacepackage PJ1; public interface SimpleFractionInterface.pdf
Interfacepackage PJ1; public interface SimpleFractionInterface.pdfInterfacepackage PJ1; public interface SimpleFractionInterface.pdf
Interfacepackage PJ1; public interface SimpleFractionInterface.pdf
 
SOLID principles in practice: the Clean Architecture
SOLID principles in practice: the Clean ArchitectureSOLID principles in practice: the Clean Architecture
SOLID principles in practice: the Clean Architecture
 
operating system linux,ubuntu,Mac Geometri.pdf
operating system linux,ubuntu,Mac Geometri.pdfoperating system linux,ubuntu,Mac Geometri.pdf
operating system linux,ubuntu,Mac Geometri.pdf
 
Virtual Functions
Virtual FunctionsVirtual Functions
Virtual Functions
 
Java Bytecode Crash Course [Code One 2019]
Java Bytecode Crash Course [Code One 2019]Java Bytecode Crash Course [Code One 2019]
Java Bytecode Crash Course [Code One 2019]
 
Scottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADScottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RAD
 
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
 
循環参照のはなし
循環参照のはなし循環参照のはなし
循環参照のはなし
 
The Truth About Lambdas in PHP
The Truth About Lambdas in PHPThe Truth About Lambdas in PHP
The Truth About Lambdas in PHP
 
Please read the comment ins codeExpressionTree.java-------------.pdf
Please read the comment ins codeExpressionTree.java-------------.pdfPlease read the comment ins codeExpressionTree.java-------------.pdf
Please read the comment ins codeExpressionTree.java-------------.pdf
 
in this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdfin this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdf
 
import java.util.Scanner;public class Fraction {   instan.pdf
import java.util.Scanner;public class Fraction {    instan.pdfimport java.util.Scanner;public class Fraction {    instan.pdf
import java.util.Scanner;public class Fraction {   instan.pdf
 
Improving Java performance at JBCNConf 2015
Improving Java performance at JBCNConf 2015Improving Java performance at JBCNConf 2015
Improving Java performance at JBCNConf 2015
 
Stack queue
Stack queueStack queue
Stack queue
 
Stack queue
Stack queueStack queue
Stack queue
 
Stack queue
Stack queueStack queue
Stack queue
 
Stack queue
Stack queueStack queue
Stack queue
 

Recently uploaded

Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 

Recently uploaded (20)

Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 

Scala Under the Hood / ScalaSwarm

  • 1. SCALA UNDER THE HOOD TZOFIA SHIFTAN / OVEROPS
  • 2.
  • 3. AGENDA 1. JVM 101 2. THE COOL STUFF
  • 5. bytecode Noun Java bytecode is the instruction set of the Java virtual machine Wikipedia
  • 8. $ javap Example.class Compiled from "Example.scala" public class Example { public int b(); public int bar(int); public Example(); } javap
  • 9. $ javap -p Example.class Compiled from "Example.scala" public class Example { private int a; private final int b; private int a(); private void a_$eq(int); public int b(); private void foo(); public int bar(int); public Example(); } javap
  • 10. $ javap -c Example.class Compiled from "Example.scala" public class Example { public int b(); Code: 0: aload_0 1: getfield #21 // Field b:I 4: ireturn public int bar(int); Code: 0: iconst_3 1: iload_1 2: imul 3: ireturn ... javap
  • 11. JVM THREADTHREAD THREAD STACK STACK STACK FRAME FRAME FRAME FRAME FRAME FRAME FRAME FRAME FRAME
  • 13. def add(a : Int, b : Int) = a+b iload_0 iload_1 iadd ireturn add(2,5) FRAME LOCAL VARIABLES OPERAND STACK a b 2 5
  • 14. def add(a : Int, b : Int) = a+b iload_0 iload_1 iadd ireturn add(2,5) FRAME LOCAL VARIABLES OPERAND STACK a b 2 5 2
  • 15. def add(a : Int, b : Int) = a+b iload_0 iload_1 iadd ireturn add(2,5) FRAME LOCAL VARIABLES OPERAND STACK a b 2 5 2 5
  • 16. def add(a : Int, b : Int) = a+b iload_0 iload_1 iadd ireturn add(2,5) FRAME LOCAL VARIABLES OPERAND STACK a b 2 5 7 2 5 7 + = 2 5
  • 17. FRAME LOCAL VARIABLES OPERAND STACK a b 2 5 7 def add(a : Int, b : Int) = a+b iload_0 iload_1 iadd ireturn add(2,5)
  • 19. val vs var vs def
  • 20. val var def class Var { var a = 1 } class Val { val a = 1 } class Def { def a = 1 }
  • 21. javap -p Var javap -p Val javap -p Def val var def
  • 22. private final int a; public int a(); public Val(); private int a; public int a(); public void a_$eq(int); public Var(); public int a(); public Def(); val var def
  • 23. private final int a; public int a(); public Val(); private int a; public int a(); public void a_$eq(int); public Var(); public int a(); public Def(); val var def
  • 24. private final int a; public int a(); public Val(); private int a; public int a(); public void a_$eq(int); public Var(); public int a(); public Def(); val var def
  • 25. private final int a; public int a(); public Val(); private int a; public int a(); public void a_$eq(int); public Var(); public int a(); public Def(); val var def
  • 26. public int a(); aload_0 getfield #13 // Field a:I ireturn public int a(); iconst_1 ireturn return this.a return 1 val var def
  • 27. private final int a; public int a(); public Val(); private int a; public int a(); public void a_$eq(int); public Var(); public int a(); public Def(); val var def
  • 28. public void a_$eq(int); aload_0 iload_1 putfield #13 // Field a:I return this.a = a val var def
  • 29. private final int a; public int a(); public Val(); private int a; public int a(); public void a_$eq(int); public Var(); public int a(); public Def(); val var def
  • 30. public Va[r|l](); aload_0 invokespecial #19 // Method java/lang/Object."<init>":()V aload_0 iconst_1 putfield #13 // Field a:I return public Def(); aload_0 invokespecial #16 // Method java/lang/Object."<init>":()V return val var def this.a = 1 return
  • 31. getter setter evaluation val 1 var 1 def multiple
  • 33. val lazy val class Val { val a = 1 } class LazyVal { lazy val a = 1 }
  • 34. javap -p Val javap -p LazyVal val lazy val
  • 35. private final int a; public Val(); public int a(); private int a; public LazyVal(); private volatile boolean bitmap$0; private int a$lzycompute(); public int a(); val lazy val
  • 36. private final int a; public Val(); public int a(); private int a; public LazyVal(); private volatile boolean bitmap$0; private int a$lzycompute(); public int a(); val lazy val
  • 37. private final int a; public Val(); public int a(); private int a; public LazyVal(); private volatile boolean bitmap$0; private int a$lzycompute(); public int a(); val lazy val
  • 38. public Val(); aload_0 invokespecial #19 // Method java/lang/Object."<init>":()V aload_0 iconst_1 putfield #13 // Field a:I return public LazyVal(); aload_0 Invokespecial #28 // Method java/lang/Object."<init>":()V return super() val lazy val
  • 39. private final int a; public Val(); public int a(); private int a; public LazyVal(); private volatile boolean bitmap$0; private int a$lzycompute(); public int a(); val lazy val
  • 40. private int a$lzycompute(); 0: aload_0 1: dup 2: astore_1 3: monitorenter 4: aload_0 5: getfield #16 // Field bitmap$0:Z 8: ifne 21 11: aload_0 12: iconst_1 13: putfield #18 // Field a:I 16: aload_0 17: iconst_1 18: putfield #16 // Field bitmap$0:Z 21: aload_1 22: monitorexit 23: goto 29 26: aload_1 27: monitorexit 28: athrow 29: aload_0 30: getfield #18 // Field a:I 33: ireturn
  • 41. private int a$lzycompute(); 0: aload_0 1: dup 2: astore_1 3: monitorenter 4: aload_0 5: getfield #16 // Field bitmap$0:Z 8: ifne 21 11: aload_0 12: iconst_1 13: putfield #18 // Field a:I 16: aload_0 17: iconst_1 18: putfield #16 // Field bitmap$0:Z 21: aload_1 22: monitorexit 23: goto 29 26: aload_1 27: monitorexit 28: athrow 29: aload_0 30: getfield #18 // Field a:I 33: ireturn synchronize start
  • 42. private int a$lzycompute(); 0: aload_0 1: dup 2: astore_1 3: monitorenter 4: aload_0 5: getfield #16 // Field bitmap$0:Z 8: ifne 21 11: aload_0 12: iconst_1 13: putfield #18 // Field a:I 16: aload_0 17: iconst_1 18: putfield #16 // Field bitmap$0:Z 21: aload_1 22: monitorexit 23: goto 29 26: aload_1 27: monitorexit 28: athrow 29: aload_0 30: getfield #18 // Field a:I 33: ireturn bitmap$0 ? 0
  • 43. private int a$lzycompute(); 0: aload_0 1: dup 2: astore_1 3: monitorenter 4: aload_0 5: getfield #16 // Field bitmap$0:Z 8: ifne 21 11: aload_0 12: iconst_1 13: putfield #18 // Field a:I 16: aload_0 17: iconst_1 18: putfield #16 // Field bitmap$0:Z 21: aload_1 22: monitorexit 23: goto 29 26: aload_1 27: monitorexit 28: athrow 29: aload_0 30: getfield #18 // Field a:I 33: ireturn this.a = 1 this.bitmap$0 = 1 synchronize end return this.a bitmap$0 == 0
  • 44. private int a$lzycompute(); 0: aload_0 1: dup 2: astore_1 3: monitorenter 4: aload_0 5: getfield #16 // Field bitmap$0:Z 8: ifne 21 11: aload_0 12: iconst_1 13: putfield #18 // Field a:I 16: aload_0 17: iconst_1 18: putfield #16 // Field bitmap$0:Z 21: aload_1 22: monitorexit 23: goto 29 26: aload_1 27: monitorexit 28: athrow 29: aload_0 30: getfield #18 // Field a:I 33: ireturn synchronize end return this.a bitmap$0 == 1
  • 45. private int a$lzycompute() { LazyVal lazyVal = this; synchronized (lazyVal) { if (!this.bitmap$0) { this.a = 1; this.bitmap$0 = true; } } return this.a; }
  • 46. private int a$lzycompute() { LazyVal lazyVal = this; synchronized (lazyVal) { if (!this.bitmap$0) { this.a = 1; this.bitmap$0 = true; } } return this.a; }
  • 47. private int a$lzycompute() { LazyVal lazyVal = this; synchronized (lazyVal) { if (!this.bitmap$0) { this.a = 1; this.bitmap$0 = true; } } return this.a; }
  • 48. private final int a; public Val(); public int a(); private int a; public LazyVal(); private volatile boolean bitmap$0; private int a$lzycompute(); public int a(); val lazy val
  • 49. public int a(); 0: aload_0 1: getfield #16 // Field bitmap$0:Z 4: ifne 14 7: aload_0 8: invokespecial #24 // Method a$lzycompute:()I 11: goto 18 14: aload_0 15: getfield #18 // Field a:I 18: ireturn
  • 50. public int a(); 0: aload_0 1: getfield #16 // Field bitmap$0:Z 4: ifne 14 7: aload_0 8: invokespecial #24 // Method a$lzycompute:()I 11: goto 18 14: aload_0 15: getfield #18 // Field a:I 18: ireturn bitmap$0 ? 0
  • 51. public int a(); 0: aload_0 1: getfield #16 // Field bitmap$0:Z 4: ifne 14 7: aload_0 8: invokespecial #24 // Method a$lzycompute:()I 11: goto 18 14: aload_0 15: getfield #18 // Field a:I 18: ireturn this.a$lzycompute() return ^ bitmap$0 == 0
  • 52. public int a(); 0: aload_0 1: getfield #16 // Field bitmap$0:Z 4: ifne 14 7: aload_0 8: invokespecial #24 // Method a$lzycompute:()I 11: goto 18 14: aload_0 15: getfield #18 // Field a:I 18: ireturn bitmap$0 == 1 return this.a
  • 55. object Hello { def main(args: Array[String]) { println("Hello, Scala Swarm!") } }
  • 57. Compiled from "Hello.scala" public final class Hello { public static void main(java.lang.String[]); } Compiled from "Hello.scala" public final class Hello$ { public static Hello$ MODULE$; public static {}; private Hello$(); public void main(java.lang.String[]); }
  • 58. Compiled from "Hello.scala" public final class Hello { public static void main(java.lang.String[]); } Compiled from "Hello.scala" public final class Hello$ { public static Hello$ MODULE$; public static {}; private Hello$(); public void main(java.lang.String[]); }
  • 59. Compiled from "Hello.scala" public final class Hello { public static void main(java.lang.String[]); } Compiled from "Hello.scala" public final class Hello$ { public static Hello$ MODULE$; public static {}; private Hello$(); public void main(java.lang.String[]); }
  • 60. public static void main(java.lang.String[]); getstatic #16 // Field Hello$.MODULE$:LHello$; aload_0 invokevirtual #18 // Method Hello$.main:([Ljava/lang/String;)V return Hello$.MODULE$.main(args)
  • 61. Compiled from "Hello.scala" public final class Hello { public static void main(java.lang.String[]); } Compiled from "Hello.scala" public final class Hello$ { public static Hello$ MODULE$; public static {}; private Hello$(); public void main(java.lang.String[]); }
  • 62. Compiled from "Hello.scala" public final class Hello { public static void main(java.lang.String[]); } Compiled from "Hello.scala" public final class Hello$ { public static Hello$ MODULE$; public static {}; private Hello$(); public void main(java.lang.String[]); }
  • 63. public static {}; new #2 // class Hello$ invokespecial #12 // Method "<init>":()V return new Hello$()
  • 64. Compiled from "Hello.scala" public final class Hello { public static void main(java.lang.String[]); } Compiled from "Hello.scala" public final class Hello$ { public static Hello$ MODULE$; public static {}; private Hello$(); public void main(java.lang.String[]); }
  • 65. private Hello$(); aload_0 invokespecial #29 // Method java/lang/Object."<init>":()V aload_0 putstatic #31 // Field MODULE$:LHello$; return MODULE$ = this
  • 66. Compiled from "Hello.scala" public final class Hello { public static void main(java.lang.String[]); } Compiled from "Hello.scala" public final class Hello$ { public static Hello$ MODULE$; public static {}; private Hello$(); public void main(java.lang.String[]); }
  • 67. public void main(java.lang.String[]); getstatic #20 // Field scala/Predef$.MODULE$:Lscala/Predef$; ldc #22 // String Hello, Scala Swarm! invokevirtual #26 // Method scala/Predef$.println:(Ljava/lang/Object;)V return println(“Hello, Scala Swarm!”)
  • 68. public final class Hello$ { public static Hello$ MODULE$; public static { new Hello$(); } private Hello$() { MODULE$ = this; } public void main(String[] args) { println("Hello, Scala Swarm!"); } } public final class Hello { public static void main(final String[] args) { Hello$.MODULE$.main(args); } }
  • 69. public final class Hello$ { public static Hello$ MODULE$; public static { new Hello$(); } private Hello$() { MODULE$ = this; } public void main(String[] args) { println("Hello, Scala Swarm!"); } } public final class Hello { public static void main(final String[] args) { Hello$.MODULE$.main(args); } }
  • 70. public final class Hello$ { public static Hello$ MODULE$; public static { new Hello$(); } private Hello$() { MODULE$ = this; } public void main(String[] args) { println("Hello, Scala Swarm!"); } } public final class Hello { public static void main(final String[] args) { Hello$.MODULE$.main(args); } }
  • 71. public final class Hello$ { public static Hello$ MODULE$; public static { new Hello$(); } private Hello$() { MODULE$ = this; } public void main(String[] args) { println("Hello, Scala Swarm!"); } } public final class Hello { public static void main(final String[] args) { Hello$.MODULE$.main(args); } }
  • 72. public final class Hello$ { public static Hello$ MODULE$; public static { new Hello$(); } private Hello$() { MODULE$ = this; } public void main(String[] args) { println(“Hello, Scala Swarm!"); } } public final class Hello { public static void main(final String[] args) { Hello$.MODULE$.main(args); } }
  • 73. public final class Hello$ { public static Hello$ MODULE$; public static { new Hello$(); } private Hello$() { MODULE$ = this; } public void main(String[] args) { println("Hello, Scala Swarm!"); } } public final class Hello { public static void main(final String[] args) { Hello$.MODULE$.main(args); } }
  • 75. SUMMARY Given a problem, consider the following steps: 1. javap 2. repeat