Sess
ion #
2026
: J2M
E Plat
form
, Con
nect
ed Li
mite
d Dev
ice C
onfig
urat
ion (C
LDC)
Vir
tual
Mac
hin
e D
esig
nL
ectu
re 1
: O
verv
iew
an
d H
isto
ry
Ant
ero
Tai
vals
aari
Aug
ust 2
003
2
Wel
com
e!
•W
elco
me
to th
e V
irtua
l Mac
hine
Des
ign
Sem
inar
.
•T
UT
sem
inar
810
9035
.
==
==
==
==
==
==
==
==
==
==
==
==
==
==
==
=
•F
irst t
ime
a V
M d
esig
n co
urse
has
bee
n or
gani
zed
in F
inla
nd.
•G
lad
to s
ee th
at th
ere
is s
o m
uch
inte
rest
in th
is to
pic!
3
Go
als
●In
trod
uce
you
to th
e w
orld
of v
irtua
l mac
hine
(V
M)
desi
gn.
●E
xpla
in th
e ke
y te
chno
logi
es th
at a
re
need
ed fo
r bu
ildin
g vi
rtua
l mac
hine
s,
such
as
auto
mat
ic m
emor
y m
anag
emen
t, in
terp
reta
tion,
mul
tithr
eadi
ng, a
nd
dyna
mic
com
pila
tion.
4Str
uct
ure
of
the
Sem
inar
•T
he s
emin
ar c
onsi
sts
of tw
o pa
rts:
–Le
ctur
es (
6 or
7 le
ctur
es in
tota
l)–
Stu
dent
pre
sent
atio
ns
•Le
ctur
es w
ill b
e he
ld in
roo
m T
B22
3 on
W
edne
sday
s, 1
0:15
– 1
1:45
am
.–
Lect
ure
atte
ndan
ce is
not
req
uire
d bu
t rec
omm
ende
d.
•T
o ge
t the
cre
dits
(2
ov),
you
mus
t pre
pare
and
gi
ve a
pre
sent
atio
n on
a s
elec
ted
topi
c re
late
d to
virt
ual m
achi
ne d
esig
n.–
Pre
sent
atio
ns w
ill b
egin
in N
ovem
ber.
–A
list
of s
ugge
sted
topi
cs w
ill b
e av
aila
ble
late
r.
5Lec
ture
Sch
edu
le (
Pre
limin
ary)
•S
ep 1
0: H
isto
ry a
nd o
verv
iew
of V
M d
esig
n
•S
ep 1
7: M
emor
y m
anag
emen
t
•S
ep 2
4: In
terp
reta
tion
and
exec
utio
n
•O
ct 1
: Mul
tithr
eadi
ng, s
ynch
roni
zatio
n an
d I/O
•O
ct 8
: Int
erna
ls o
f the
Jav
a vi
rtua
l mac
hine
(O
ct 1
5: N
o le
ctur
e)
(O
ct 2
2: N
o le
ctur
e)
•O
ct 2
9: H
igh
perf
orm
ance
VM
s (g
uest
lect
ure)
•N
ov 5
: Stu
dent
pre
sent
atio
ns b
egin
6Ab
ou
t th
e L
ectu
rer
•B
uilt
virt
ual m
achi
nes
sinc
e th
e m
id-1
980s
.–
Mai
n in
tere
sts
in th
e 19
80s/
early
199
0s:
For
th, S
mal
ltalk
, Sel
f, ot
her
“dyn
amic
” O
O la
ngua
ges.
•In
199
7, m
oved
to C
alifo
rnia
to w
ork
on J
ava
virt
ual m
achi
nes
at S
un M
icro
syst
ems.
–W
rote
the
K V
irtua
l Mac
hine
(K
VM
) at
Sun
Lab
s in
199
8.–
KV
M b
ecam
e th
e st
artin
g po
int f
or J
ava
2 M
icro
Edi
tion
(J2M
E),
a p
opul
ar v
ersi
on o
f the
Jav
a pl
atfo
rm fo
r m
obile
de
vice
s.
•E
ngin
eerin
g m
anag
er o
f the
J2M
E/K
VM
virt
ual
mac
hine
team
at J
ava
Sof
twar
e, 1
999-
2001
.–
Led
early
J2M
E s
tand
ards
act
iviti
es (
CLD
C 1
.0/1
.1)
–C
o-au
thor
of t
he fi
rst J
ava
Ser
ies
book
on
J2M
E.
8Wh
at is
a V
irtu
al M
ach
ine?
•A
virt
ual m
achi
ne (
VM
) is
an
“abs
trac
t”
com
putin
g ar
chite
ctur
e or
com
puta
tiona
l en
gine
that
is in
depe
nden
t of a
ny p
artic
ular
ha
rdw
are
or o
pera
ting
syst
em.
•“S
oftw
are
mac
hine
” th
at r
uns
on to
p of
a r
eal
hard
war
e pl
atfo
rm a
nd o
pera
ting
syst
em.
•A
llow
s th
e sa
me
prog
ram
s to
run
“vi
rtua
lly”
on a
ny h
ardw
are
for
whi
ch a
VM
is a
vaila
ble.
9Ch
arac
teri
stic
s o
f a
Vir
tual
Mac
hin
e
•A
virt
ual m
achi
ne ty
pica
lly in
trod
uces
its
own
inst
ruct
ion
set t
hat i
s us
ed fo
r ex
ecut
ing
prog
ram
s.–
Thi
s in
stru
ctio
n se
t is
inde
pend
ent o
f the
arc
hite
ctur
eof
the
host
ope
ratin
g sy
stem
.
•A
virt
ual m
achi
ne u
sual
ly a
lso
has
its o
wn
mem
ory
syst
em.
–A
cces
s to
the
mem
ory
syst
em o
f the
hos
t ope
ratin
g sy
stem
is m
inim
ized
.
•In
gen
eral
, acc
ess
to th
e ho
st o
pera
ting
syst
em
is o
ften
limite
d an
d co
ntro
lled
by th
e vi
rtua
l m
achi
ne's
nat
ive
func
tion
inte
rfac
e.
10Typ
ical
Hig
h-L
evel
Arc
hit
ectu
re
Har
dwar
e
Ope
ratin
g S
yste
m
Virt
ual M
achi
ne
App
licat
ion
11Exa
mp
le:
Co
mp
on
ents
of
a Ja
va
Vir
tual
Mac
hin
e (J
VM
)
Mem
ory
Sys
tem
and
Gar
bage
Col
lect
or
Nat
ive
Inte
rfac
eIn
tern
al R
untim
eS
truc
ture
s
Thr
eadi
ng S
yste
m a
nd T
hrea
d S
ched
uler
Inte
rpre
ter
and
Exe
cutio
n S
tack
s
Cla
ss L
oade
r an
d JA
R R
eade
r
Com
pile
r(o
ptio
nal)
Ver
ifier
12So
me
Bac
kgro
un
d
•V
irtua
l mac
hine
s ha
ve b
een
stud
ied
and
built
si
nce
the
late
195
0s.
•M
any
early
pro
gram
min
g la
ngua
ges
wer
e bu
ilt
arou
nd th
e id
ea o
f hav
ing
a po
rtab
le r
untim
e sy
stem
.
•Y
et V
M d
esig
n w
as a
lway
s a
fairl
y sp
ecia
lized
to
pic;
not
man
y bo
oks
or a
rtic
les
wer
e w
ritte
n un
til r
ecen
tly.
•P
opul
arity
of t
he a
rea
expl
oded
in th
e m
id-1
990s
whe
n th
e Ja
va p
rogr
amm
ing
lang
uage
was
intr
oduc
ed.
13Lan
gu
ages
th
at U
seV
irtu
al M
ach
ines
•W
ell-k
now
n la
ngua
ges
usin
g a
virt
ual m
achi
ne:
–Li
sp s
yste
ms,
195
8/19
60-1
980s
–B
asic
, 196
4-19
80s
–F
orth
, ear
ly 1
970s
–P
asca
l (P
-Cod
e ve
rsio
ns),
late
197
0s/e
arly
198
0s–
Sm
allta
lk, 1
970s
-198
0s–
Sel
f, la
te 1
980/
early
199
0s–
Java
, mid
-199
0s
•N
umer
ous
othe
r la
ngua
ges:
–...
Pos
tScr
ipt,
TC
L/T
K, P
erl,
Pyt
hon,
C#,
...
14Wh
y ar
e V
irtu
al M
ach
ines
In
tere
stin
g?
•P
rovi
de p
latfo
rm in
depe
nden
ce.
•Is
olat
e pr
ogra
ms
from
har
dwar
e de
tails
.
•S
impl
ify a
pplic
atio
n co
de m
igra
tion.
•C
an s
uppo
rt d
ynam
ic d
ownl
oadi
ng o
f sof
twar
e.
•C
an p
rovi
de a
dditi
onal
sec
urity
that
mac
hine
-sp
ecifi
c im
plem
enta
tions
can
not p
rovi
de.
•C
an h
ide
com
plex
ity o
f leg
acy
syst
ems.
•M
any
prog
ram
min
g la
ngua
ges
are
built
aro
und
a vi
rtua
l mac
hine
.
15Vir
tual
Mac
hin
es v
s. O
per
atin
g
Sys
tem
s•
The
re is
a lo
t of s
imila
rity
betw
een
VM
and
OS
de
sign
.–
The
key
com
pone
nt a
reas
are
pre
tty m
uch
the
sam
e (m
emor
y m
anag
emen
t, m
ultit
hrea
ding
, I/O
, ...)
•A
few
key
diff
eren
ces:
–V
irtua
l mac
hine
s ar
e us
ually
des
igne
d to
be
as
inde
pend
ent o
f the
hos
t ope
ratin
g sy
stem
as
poss
ible
.–
Ope
ratin
g sy
stem
s ar
e “e
xten
sion
s of
the
unde
rlyin
g ha
rdw
are”
. The
y ar
e bu
ilt to
faci
litat
e ac
cess
to th
e un
derly
ing
com
putin
g ar
chite
ctur
e an
d m
axim
ize
the
utili
zatio
n of
the
hard
war
e re
sour
ces.
–A
lso,
virt
ual m
achi
nes
are
com
mon
ly ti
ed to
a p
artic
ular
pr
ogra
mm
ing
lang
uage
or
lang
uage
fam
ily.
–O
pera
ting
syst
ems
are
usua
lly la
ngua
ge-in
depe
nden
t.
16Exi
stin
g M
ater
ial o
n V
M D
esig
n
•T
here
is a
lot o
f mat
eria
l ava
ilabl
e on
virt
ual
mac
hine
s.
•H
owev
er, t
he m
ater
ial i
s sc
atte
red/
frag
men
ted
and
it is
diff
icul
t to
find
any
com
preh
ensi
ve
pres
enta
tions
.
•A
few
boo
ks o
n th
e to
pic:
–B
ill B
lund
en, V
irtua
l Mac
hine
Des
ign
and
Impl
emen
tatio
n in
C/C
++, W
ordw
are
Pub
lishi
ng, M
arch
200
2.–
Ron
ald
Mak
, Writ
ing
Com
pile
rs a
nd In
terp
rete
rs, J
ohn
Wile
y &
Son
s, J
uly
1996
.
•U
nfor
tuna
tely
, the
se b
ooks
don
't co
ver
the
area
ve
ry w
ell.
18LIS
P
•Jo
hn M
cCar
thy,
195
8–
http
://w
ww
-for
mal
.sta
nfor
d.ed
u/jm
c/hi
stor
y/lis
p/lis
p.ht
ml
–LI
SP
is th
e se
cond
old
est p
rogr
amm
ing
lang
uage
stil
l in
wid
espr
ead
use
(afte
r F
ortr
an)
•LI
SP
is c
hara
cter
ized
by
the
follo
win
g id
eas:
–C
ompu
ting
with
sym
bolic
exp
ress
ions
rat
her
than
nu
mbe
rs,
–re
pres
enta
tion
of s
ymbo
lic e
xpre
ssio
ns a
nd o
ther
in
form
atio
n by
list
str
uctu
re,
–co
mpo
sitio
n of
func
tions
as
a to
ol fo
r fo
rmin
g m
ore
com
plex
func
tions
out
of a
few
prim
itive
ope
ratio
ns,
–th
e re
pres
enta
tion
of L
ISP
pro
gram
s as
LIS
P d
ata,
and
th
e fu
nctio
n ev
al th
at s
erve
s bo
th a
s a
form
al d
efin
ition
of th
e la
ngua
ge a
nd a
s an
inte
rpre
ter.
19Sam
ple
Lis
p C
od
e
(d
efin
e (p
rimes
)
(le
trec
((s
ieve
(la
mbd
a (s
)
(
cons
(ca
r s)
(del
ay (
siev
e (f
ilter
(
lam
bda
(n)
(>
(re
mai
nder
n (
car
s))
0))
(f
orce
(cd
r s)
))))
))))
(s
ieve
(fo
rce
(cdr
nat
))))
)
20Wh
y is
Lis
p In
tere
stin
g f
rom
VM
Des
ign
er's
Vie
wp
oin
t?
•T
he fi
rst l
angu
age
to w
idel
y us
e ga
rbag
e co
llect
ion
as a
m
eans
of a
utom
atin
g m
emor
y m
anag
emen
t.
•T
he fi
rst l
angu
age
to u
se r
ecur
sion
ext
ensi
vely
.
•O
ne o
f the
firs
t tru
ly in
tera
ctiv
e la
ngua
ges
that
did
n't r
equi
re
a “c
ompi
le-li
nk-e
xecu
te-c
rash
-deb
ug”
cycl
e.
•Li
sp w
as o
ne o
f the
firs
t sys
tem
s w
here
pro
gram
s ru
n in
a
“san
dbox
”; a
cces
s to
the
oper
atin
g sy
stem
is li
mite
d an
d pr
ogra
ms
cann
ot r
eally
cra
sh th
e sy
stem
.
•T
he fi
rst t
ruly
“re
flect
ive”
pro
gram
min
g la
ngua
ge a
s w
ell;
LIS
P h
as a
ver
y sm
all l
angu
age
core
; the
res
t of t
he s
yste
m
can
be w
ritte
n in
itse
lf; p
rogr
ams
can
be m
anip
ulat
ed a
s da
ta.
21UC
SD
Pas
cal
•T
he P
asca
l lan
guag
e w
as d
evel
oped
by
Nic
klau
s W
irth
in 1
969.
•A
fairl
y “c
onve
ntio
nal”
prog
ram
min
g la
ngua
ge.
–P
rede
cess
or to
a la
rge
fam
ily o
f oth
er la
ngua
ges
(Mod
ula.
.., O
bero
n...)
•P
asca
l did
not
bec
ome
popu
lar
until
Ken
B
owle
s of
the
Uni
vers
ity o
f Cal
iforn
ia S
an
Die
go (
UC
SD
) im
plem
ente
d th
e P
-Cod
e sy
stem
in th
e la
te 1
970s
.–
A p
orta
ble
pseu
doco
de s
yste
m/la
ngua
ge r
untim
e.–
http
://w
ww
.thre
edee
.com
/jcm
/psy
stem
/–
The
P-C
ode
syst
em m
ade
the
impl
emen
tatio
n ex
trem
ely
port
able
, inc
reas
ing
the
popu
larit
y of
Pas
cal r
apid
ly.
22Sam
ple
Pas
cal C
od
e
PR
OG
RA
M F
ibon
acci
(inpu
t,out
put)
;
V
AR
lo :
INT
EG
ER
; hi :
INT
EG
ER
; n :
INT
EG
ER
;
gold
en_r
atio
: D
OU
BLE
; rat
io :
DO
UB
LE;
B
EG
IN
gold
en_r
atio
:= (
1.0
+ s
qrt(
5.0)
)/2.
0;
lo :=
1; h
i :=
1; n
:= 1
;
WH
ILE
hi >
0 D
O
BE
GIN
n
:= n
+ 1
; rat
io :=
hi /
lo;
W
RIT
ELN
(n :
2, '
', hi
, rat
io :
25, '
', (
ratio
- g
olde
n_ra
tio)
: 21
: 18)
;
hi
:= lo
+ h
i; lo
:= h
i - lo
EN
D
E
ND
23Wh
y is
UC
SD
Pas
cal I
nte
rest
ing
fro
m V
M D
esig
ner
's V
iew
po
int?
•T
he P
-Cod
e sy
stem
pop
ular
ized
the
idea
of
usin
g ps
eudo
code
to im
prov
e po
rtab
ility
of
prog
ram
min
g la
ngua
ge r
untim
e sy
stem
s.
•U
ses
a st
ack-
orie
nted
inst
ruct
ion
set a
nd fi
ve
virt
ual r
egis
ters
.–
Onl
y on
e st
ack
(no
sepa
rate
ope
rand
& c
all s
tack
s)
•T
he fi
rst v
irtua
l mac
hine
impl
emen
tatio
n w
idel
y av
aila
ble
to h
obby
ists
.–
Esp
ecia
lly th
e A
pple
II im
plem
enta
tion
was
ver
y po
pula
r.–
http
://ho
mep
ages
.cw
i.nl/~
stev
en/p
asca
l/boo
k/10
pcod
e.ht
ml
–ht
tp://
ww
w.w
ikip
edia
.org
/wik
i/P-C
ode_
mac
hine
24P-C
od
e S
amp
le In
stru
ctio
ns
In
st.
Sta
ckS
tack
Des
crip
tion
befo
reaf
ter
A
DI
i1 i2
i1+
i2ad
d tw
o in
tege
rs
A
DR
r1 r
2r1
+r2
add
two
real
s
D
VI
i1 i2
i1/i2
inte
ger
divi
sion
IN
Ni1
s1
b1se
t mem
bers
hip;
b1
= w
heth
er i1
is a
mem
ber
of s
1
LD
CI
i1i1
load
inte
ger
cons
tant
M
OV
a1 a
2m
ove
N
OT
b1~
b1bo
olea
n ne
gatio
n
25BA
SIC
•B
egin
ners
All-
purp
ose
Sym
bolic
Inst
ruct
ion
Cod
e.
•D
evel
oped
by
John
Kem
eny
and
Tho
mas
Kur
tz
at D
artm
outh
Col
lege
(U
SA
) in
mid
-196
0s.
–ht
tp://
ww
w.k
basi
c.or
g/1/
hist
ory.
php3
•In
tera
ctiv
e na
ture
mad
e it
suita
ble
for
min
i-an
d m
icro
com
pute
rs (
good
tim
ing!
)
•P
aul A
llen
and
Bill
Gat
es w
rote
the
first
in
terp
rete
d im
plem
enta
tion
in 1
975;
this
im
prov
ed th
e po
rtab
ility
of t
he la
ngua
ge
dram
atic
ally
.
26Sam
ple
BA
SIC
Co
de
10
0 IN
PU
T “
Typ
e a
num
ber”
; N
12
0 IF
N <
= 0
GO
TO
200
13
0 P
RIN
T “
Squ
are
root
=”
SQ
R(N
)
14
0 G
OT
O 1
00
20
0 P
RIN
T “
Num
ber
mus
t be
> 0
”
21
0 G
OT
O 1
00
27Wh
y is
BA
SIC
Inte
rest
ing
fro
m V
M
Des
ign
er's
Vie
wp
oin
t?•
It re
ally
isn'
t ver
y in
tere
stin
g...
–T
he la
ngua
ge h
as n
o sp
ecifi
c co
ntrib
utio
ns e
xcep
t eas
e of
lear
ning
and
eas
e of
use
.–
Exc
essi
ve u
se o
f GO
TO
s le
d to
som
e ho
rrib
le p
rogr
ams.
•H
owev
er, t
he p
opul
arity
of B
AS
IC c
oinc
ided
w
ith th
e m
icro
com
pute
r bo
om.
–M
any
early
mic
roco
mpu
ter
com
pani
es d
ecid
ed to
in
tegr
ate
BA
SIC
in th
eir
prod
ucts
.–
You
cou
ld e
ither
pro
gram
in a
ssem
bly
lang
uage
or
BA
SIC
...
•S
ome
BA
SIC
sys
tem
s us
ed p
retty
inte
rest
ing
inte
rmed
iate
cod
e re
pres
enta
tion
tech
niqu
es.
28Fo
rth
•In
vent
ed b
y C
harle
s M
oore
in th
e ea
rly 1
970s
.–
http
://w
ww
.fort
h.co
m/C
onte
nt/H
isto
ry/H
isto
ry1.
htm
•O
rigin
ally
des
igne
d to
con
trol
rad
iote
lesc
opes
.
•C
hara
cter
istic
s:–
For
th is
a “
wor
d-or
ient
ed”
prog
ram
min
g la
ngua
ge; t
here
is
no
synt
ax o
r gr
amm
ar in
the
trad
ition
al s
ense
.–
All
the
prim
itive
func
tions
/wor
ds a
re a
lso
lang
uage
ke
ywor
ds; o
pen
stac
k us
ed fo
r pa
ram
eter
pas
sing
.–
For
th m
akes
sub
rout
ine
defin
ition
ext
rem
ely
chea
p; th
is
prov
ides
for
exte
nsib
ility
and
hig
h le
vel o
f pro
cedu
ral
abst
ract
ion.
–E
xtre
me
min
imal
ism
: The
ent
ire F
orth
sys
tem
(in
clud
ing
a si
mpl
e m
ultit
aski
ng p
rogr
amm
ing
envi
ronm
ent)
can
fit
in 8
-15
kilo
byte
s.
29Sam
ple
Fo
rth
Co
de
: x
Rev
erse
\ rev
erse
the
horiz
onta
l dire
ctio
n of
the
ball
xS
tep
@ +
/- x
Ste
p ! ;
: y
Rev
erse
\ rev
erse
the
vert
ical
dire
ctio
n of
the
ball
yS
tep
@ +
/- y
Ste
p ! ;
: c
heck
Left
\ che
ck fo
r th
e le
ft ed
ge o
f the
scr
een
x
@ 1
<=
IF x
Rev
erse
TH
EN
;
: che
ckR
ight
\ che
ck fo
r th
e rig
ht e
dge
of th
e sc
reen
x
@ x
Max
>=
IF x
Rev
erse
TH
EN
;
A
SC
II o
CO
NS
TA
NT
"ba
ll"
: s
how
Bal
l\ d
raw
the
ball
on th
e sc
reen
"b
all"
xyP
lot ;
: h
ideB
all
\ hid
e (u
ndra
w)
the
ball
"b
l" x
yPlo
t ;
: try
Bal
l\ t
est t
he b
all d
raw
ing
rout
ines
B
EG
IN
sho
wB
all
c
heck
Left
chec
kRig
ht c
heck
Top
che
ckB
otto
m
hid
eBal
l xyS
tep
A
GA
IN ;
30Wh
y is
Fo
rth
Inte
rest
ing
fro
m t
he
VM
Des
ign
er's
Vie
wp
oin
t?•
One
of t
he e
asie
st v
irtua
l mac
hine
s to
bui
ld.
•T
he V
M c
onsi
sts
of a
sm
all n
umbe
r of
dis
tinct
co
mpo
nent
s (s
tack
s, d
ictio
nary
, int
erpr
eter
, vi
rtua
l reg
iste
rs, p
rimiti
ves)
; no
extr
a “f
at”.
•T
he la
ngua
ge it
self
is s
mal
l, si
mpl
e an
d ef
ficie
nt, a
nd p
rovi
des
an u
nusu
al c
ombi
natio
n of
hig
h-le
vel a
bstr
actio
n an
d ve
ry lo
w le
vel
prog
ram
min
g ca
pabi
litie
s.
•H
igh
leve
l of r
efle
ctio
n (s
igni
fican
t por
tions
of
the
VM
writ
ten
in th
e la
ngua
ge it
self.
)
•Id
eal f
or e
mbe
dded
sys
tem
s (if
the
awkw
ard
synt
ax is
not
exp
osed
to th
e en
d us
er...
)
31Sm
allt
alk
•D
evel
oped
by
Ala
n K
ay's
team
at X
erox
PA
RC
–T
here
are
var
ious
ver
sion
s (S
mal
ltalk
-72,
-76
, -80
).
Sm
allta
lk-8
0 is
the
best
kno
wn.
–ht
tp://
user
s.ip
a.ne
t/~dw
ight
h/sm
allta
lk/b
lueb
ook/
blue
book
_im
p_to
c.ht
ml
•C
hara
cter
istic
s:–
The
firs
t tru
ly in
tera
ctiv
e ob
ject
-orie
nted
pro
gram
min
g la
ngua
ge (
unlik
e S
imul
a w
hich
was
a c
ompi
ler-
base
d sy
stem
.)–
Too
k “e
very
thin
g is
an
obje
ct”
and
“mes
sage
pas
sing
” m
etap
hors
to th
e ex
trem
e.–
Eve
ryth
ing
is a
vaila
ble
for
mod
ifica
tion,
eve
n th
e V
M
itsel
f (ve
ry h
igh
leve
l of r
efle
ctio
n.)
–E
ven
code
is tr
eate
d as
obj
ects
(bl
ocks
).–
The
lang
uage
is v
ery
clos
ely
coup
led
with
a g
raph
ical
in
terf
ace;
sou
rce
code
of a
pro
gram
can
not b
e ea
sily
se
para
ted
from
the
prog
ram
min
g en
viro
nmen
t.
32Sam
ple
Sm
allt
alk
Co
de
| a
Str
ing
vow
els
|
aS
trin
g :=
'Thi
s is
a s
trin
g'.
vo
wel
s :=
aS
trin
g se
lect
: [:a
Cha
ract
er |
aCha
ract
er is
Vow
el].
=
==
==
==
==
==
==
==
==
==
==
==
==
==
==
==
| r
ecta
ngle
s aP
oint
|
re
ctan
gles
:= O
rder
edC
olle
ctio
n
w
ith: (
Rec
tang
le le
ft: 0
rig
ht: 1
0 to
p: 1
00 b
otto
m: 2
00)
w
ith: (
Rec
tang
le le
ft: 1
0 rig
ht: 1
0 to
p: 1
10 b
otto
m: 2
10).
aP
oint
:= P
oint
x: 2
0 y:
20.
co
llisi
ons
:= r
ecta
ngle
s se
lect
: [:a
Rec
t | a
Rec
t con
tain
sPoi
nt: a
Poi
nt].
33Wh
y is
Sm
allt
alk
Inte
rest
ing
Fro
m
the
VM
Des
ign
er's
Vie
wp
oin
t?•
Var
ious
impl
emen
tatio
n ch
alle
nges
:–
Eve
ryth
ing
can
be c
hang
ed o
n th
e fly
.–
No
stat
ic ty
pe s
yste
m.
–E
ven
num
bers
are
obj
ects
that
are
man
ipul
ated
by
mes
sage
pas
sing
(=
arit
hmet
ic o
pera
tions
can
be
slow
.)–
Blo
cks
(hea
p-al
loca
ted
code
obj
ects
/sta
ck fr
ames
) ar
e di
fficu
lt to
impl
emen
t effi
cien
tly.
•E
xtre
mel
y in
tera
ctiv
e/re
flect
ive
=>
fun.
•W
ell-d
esig
ned
and
mat
ure
clas
s lib
rarie
s=
> e
asy
to w
rite
inte
rest
ing
softw
are.
•T
here
are
hig
h-qu
ality
pub
lic d
omai
n S
mal
ltalk
im
plem
enta
tions
ava
ilabl
e.–
http
://w
ww
.squ
eak.
org/
34Sel
f•
Inve
nted
by
Dav
id U
ngar
and
Ran
dall
Sm
ith a
t X
erox
PA
RC
and
Sta
nfor
d U
nive
rsity
in
1986
-198
7.–
The
maj
ority
of t
he a
ctua
l im
plem
enta
tion
wor
k w
as d
one
at S
un L
abs
in th
e 19
90s.
–ht
tp://
ww
w.s
unla
bs.c
om/s
elf
•P
roto
type
-bas
ed fl
avor
/var
iant
of S
mal
ltalk
.–
Too
k th
e “e
very
thin
g is
an
obje
ct”
met
apho
r ev
en fu
rthe
r th
an S
mal
ltalk
.–
No
mor
e cl
asse
s; o
bjec
ts c
an in
herit
(“d
eleg
ate”
) be
havi
or d
irect
ly fr
om e
ach
othe
r.–
Ext
rem
ely
dyna
mic
lang
uage
: eve
n th
e co
ntro
l str
uctu
res
or th
e in
herit
ance
rel
atio
nshi
ps o
f obj
ects
can
be
chan
ged
on th
e fly
.
35Sam
ple
Sel
f C
od
e
ac
c: b
ankA
ccou
nt c
opy.
ac
c ba
lanc
e: 1
00.
b:
[acc
dep
osit:
50]
.
ac
c ba
lanc
e."r
etur
ns 1
00"
b
valu
e.
b
valu
e.
ac
c ba
lanc
e."r
etur
ns 2
00"
36Wh
y is
Sel
f In
tere
stin
g f
rom
VM
D
esig
ner
's V
iew
po
int?
•T
he S
elf l
angu
age
is s
o ex
trem
ely
dyna
mic
that
th
e im
plem
ento
rs h
ad to
pus
h th
e lim
its o
f VM
te
chno
logy
ver
y ag
gres
sive
ly:
–A
dapt
ive
com
pila
tion
to s
peed
up
exec
utio
n.–
Gen
erat
iona
l gar
bage
col
lect
ion
(orig
inal
ly in
vent
ed b
y D
avid
Ung
ar in
his
Ph.
D. w
ork.
)–
Dyn
amic
deo
ptim
izat
ion
to a
llow
deb
uggi
ng o
f hig
hly
optim
ized
pro
gram
s.–
Nov
el c
olla
bora
tive
/ vis
ual p
rogr
amm
ing
and
debu
ggin
g en
viro
nmen
t (tig
htly
inte
grat
ed w
ith th
e V
M.)
•M
any
of th
e ke
y te
chno
logi
es th
at a
re u
sed
toda
y in
mai
nstr
eam
Jav
a vi
rtua
l mac
hine
s w
ere
inve
nted
by
the
Sel
f gro
up.
37Java
•D
evel
oped
by
Jam
es G
oslin
g's
team
at S
un
Mic
rosy
stem
s in
the
early
199
0s.
–ht
tp://
java
.sun
.com
/peo
ple/
jag/
gree
n
•O
rigin
ally
des
igne
d fo
r pr
ogra
mm
ing
cons
umer
de
vice
s (a
s a
repl
acem
ent o
f C+
+).
–U
ses
a sy
ntax
that
is fa
mili
ar to
C/C
++
pro
gram
mer
s.–
Use
s a
port
able
virt
ual m
achi
ne th
at p
rovi
des
auto
mat
ic
mem
ory
man
agem
ent a
nd a
sim
ple
stac
k-or
ient
ed
inst
ruct
ion
set.
–C
lass
file
ver
ifica
tion
was
add
ed to
ena
ble
dow
nloa
ding
an
d ex
ecut
ion
of r
emot
e co
de s
ecur
ely.
•A
gain
, gre
at ti
min
g: th
e de
velo
pmen
t of t
he
Java
tech
nolo
gy c
oinc
ided
with
the
wid
espr
ead
adop
tion
of w
eb b
row
sers
in th
e m
id-1
990s
.
38Sam
ple
Jav
a C
od
e
clas
s P
eg {
int p
egN
um;
int d
isks
[ ] =
new
int[6
4];
int n
Dis
ks;
pub
lic P
eg(in
t n, i
nt n
umD
isks
) {
p
egN
um =
n;
f
or (
int i
= 0
; i <
num
Dis
ks; i
++
) {
di
sks[
i] =
0;
}
n
Dis
ks =
0;
}
p
ublic
voi
d ad
dDis
k(in
t dis
kNum
) {
d
isks
[nD
isks
++
] = d
iskN
um;
}
p
ublic
int r
emov
eDis
k()
{
ret
urn
disk
s[--
nDis
ks];
}
}
39Wh
y is
Jav
a In
tere
stin
g f
rom
VM
D
esig
ner
's V
iew
po
int?
•M
ost p
eopl
e ha
d ne
ver
hear
d of
virt
ual
mac
hine
s un
til J
ava
cam
e al
ong!
•C
ombi
nes
a st
atic
ally
com
pile
d pr
ogra
mm
ing
lang
uage
with
a d
ynam
ic v
irtua
l mac
hine
.
•T
he J
ava
virt
ual m
achi
ne (
JVM
) is
ver
y w
ell
docu
men
ted.
–T
im L
indh
olm
, Fra
nk Y
ellin
, The
Jav
a V
irtua
l Mac
hine
S
peci
ficat
ion ,
Sec
ond
Edi
tion,
Add
ison
Wes
ley,
Jav
a S
erie
s, A
pril
1999
.
•A
JV
M is
see
min
gly
very
eas
y to
bui
ld.
•H
owev
er, t
ight
com
patib
ility
req
uire
men
ts m
ake
the
actu
al im
plem
enta
tion
very
cha
lleng
ing.
–M
ust p
ass
tens
of t
hous
ands
of t
est c
ases
to p
rove
co
mpa
tibili
ty.
41Ho
w a
re V
irtu
al M
ach
ines
Im
ple
men
ted
?
•V
irtua
l mac
hine
s ar
e ty
pica
lly w
ritte
n in
“p
orta
ble”
and
“ef
ficie
nt”
prog
ram
min
g la
ngua
ges
such
as
C o
r C
++
.
•F
or p
erfo
rman
ce-c
ritic
al c
ompo
nent
s,
asse
mbl
y la
ngua
ge is
use
d.–
The
mor
e m
achi
ne c
ode
is u
sed,
the
less
por
tabi
lity.
•S
ome
virt
ual m
achi
nes
(Lis
p, F
orth
, Sm
allta
lk)
are
larg
ely
writ
ten
in th
e la
ngua
ge it
self.
–T
hese
sys
tem
s ha
ve o
nly
a m
inim
al c
ore
impl
emen
ted
in C
or
asse
mbl
y la
ngua
ge.
•M
ost J
ava
VM
impl
emen
tatio
ns c
onsi
st o
f a
mix
ture
of C
/C+
+ a
nd a
ssem
bly
code
.
42Typ
ical
Hig
h-L
evel
Arc
hit
ectu
re
Har
dwar
e
Ope
ratin
g S
yste
m
Virt
ual M
achi
ne
App
licat
ion
43Vir
tual
Mac
hin
e D
esig
n
Co
nsi
der
atio
ns
•S
ize
•P
orta
bilit
y
•P
erfo
rman
ce
•M
emor
y co
nsum
ptio
n
•S
cala
bilit
y
•S
ecur
ity
•... T
here
are
alw
ays
trad
e-of
fs in
VM
des
ign!
44Vir
tual
Mac
hin
e D
esig
n
Co
nsi
der
atio
ns
•U
nfor
tuna
tely
, for
nea
rly a
ll as
pect
s of
the
VM
:•
Sim
ple
impl
ies
slow
•F
ast i
mpl
ies
mor
e co
mpl
icat
ed•
Fas
t im
plie
s le
ss p
orta
ble
•F
ast i
mpl
ies
larg
er m
emor
y co
nsum
ptio
n
–E
xam
ples
:•
Inte
rpre
tatio
n•
Mem
ory
man
agem
ent
•Lo
ckin
g/S
ynch
roni
zatio
n•
Dyn
amic
com
pila
tion
45Co
mp
on
ents
of
a V
irtu
al M
ach
ine
•T
he c
ompo
nent
s of
a v
irtua
l mac
hine
var
y co
nsid
erab
ly d
epen
ding
on
vario
us fa
ctor
s:
–Is
the
lang
uage
inte
ract
ive
(Sm
allta
lk, F
orth
) or
non
-in
tera
ctiv
e (P
asca
l, Ja
va)?
–D
oes
the
lang
uage
hav
e re
flect
ion
capa
bilit
ies
(can
yo
u in
spec
t or
mod
ify th
e V
M o
r th
e pr
ogra
m w
hile
it
is r
unni
ng)?
–D
oes
the
VM
nee
d to
hav
e pe
rfor
man
ce th
at is
co
mpa
rabl
e to
non
-inte
rpre
ted
syst
ems?
–Is
mul
tithr
eadi
ng s
uppo
rt r
equi
red?
–Is
the
VM
req
uire
d to
run
in a
“sa
ndbo
x”?
46Exa
mp
le:
Co
mp
on
ents
of
a Ja
va V
irtu
al M
ach
ine
(JV
M)
Mem
ory
Sys
tem
and
Gar
bage
Col
lect
or
Nat
ive
Inte
rfac
eIn
tern
al R
untim
eS
truc
ture
s
Thr
eadi
ng S
yste
m a
nd T
hrea
d S
ched
uler
Inte
rpre
ter
and
Exe
cutio
n S
tack
s
Cla
ss L
oade
r an
d JA
R R
eade
r
Com
pile
r(o
ptio
nal)
Ver
ifier
48Th
ree
Ver
y D
iffe
ren
t V
irtu
al M
ach
ines
•R
uka:
A m
inim
al, p
orta
ble
For
th v
irtua
l m
achi
ne.
•K
VM
: A J
ava
virt
ual m
achi
ne im
plem
enta
tion
inte
nded
for
smal
l dev
ices
.
•S
quea
k: A
feat
ure-
rich
publ
ic d
omai
n S
mal
ltalk
im
plem
enta
tion.
49Ru
ka:
A P
ort
able
Fo
rth
VM
•W
ritte
n in
AN
SI C
.
•5,
000
lines
of c
ode.
•M
inim
al e
xecu
tabl
e si
ze a
bout
17
KB
.
•Li
ke a
ll F
orth
sys
tem
s, a
llow
s in
tera
ctiv
e de
finiti
on a
nd in
spec
tion
of fu
nctio
ns, a
nd
prov
ides
unr
estr
icte
d ac
cess
to th
e un
derly
ing
oper
atin
g sy
stem
.
•P
orte
d on
to v
ario
us s
mal
l dev
ices
(Pal
m O
S, P
ocke
tPC
, Sym
bian
OS
, ...)
.
50KV
M:
A J
ava
VM
fo
r S
mal
l Dev
ices
•W
ritte
n in
AN
SI C
.
•V
ersi
on 1
.0.4
: abo
ut 3
5,00
0 lin
es o
f qu
ite w
ell-c
omm
ente
d co
de.
–A
bout
50,
000
lines
if d
ebug
ging
sup
port
, nat
ive
func
tions
fo
r th
e J2
ME
CLD
C 1
.0 li
brar
ies,
and
som
e ne
twor
k pr
otoc
ol p
rimiti
ves
are
adde
d.
•F
ully
com
plia
nt w
ith th
e J2
ME
CLD
C te
st s
uite
.
•M
inim
al e
xecu
tabl
e si
ze a
bout
70
KB
.
•P
orte
d on
to n
umer
ous
com
mer
cial
mob
ile
phon
es a
ll ov
er th
e w
orld
.
http
://w
ww
s.su
n.co
m/s
oftw
are/
com
mun
ityso
urce
/j2m
e/cl
dc/d
ownl
oad.
htm
l
51Sq
uea
k: A
Pu
blic
Sm
allt
alk
VM
•A
com
plet
e, c
ompa
ct im
plem
enta
tion
of th
e S
mal
ltalk
-80
Spe
cific
atio
n.
•In
clud
es a
ver
y ric
h gr
aphi
cal p
rogr
amm
ing
envi
ronm
ent a
nd c
lass
libr
ary.
•T
he c
ore
VM
is a
bout
35,
000
lines
of C
cod
e.
•A
com
plet
e ex
ecut
able
with
all
the
grap
hics
lib
rarie
s an
d pl
ug-in
s is
abo
ut 1
MB
.
•V
ario
us p
orts
ava
ilabl
e.
http
://so
urce
forg
e.ne
t/pro
ject
s/sq
ueak
/
52Mo
re In
form
atio
n
•V
irtua
l mac
hine
des
ign:
–B
ill B
lund
en, V
irtua
l Mac
hine
Des
ign
and
Impl
emen
tatio
n in
C/C
++, W
ordw
are
Pub
lishi
ng, M
arch
200
2
•D
esig
ning
“sm
all m
emor
y” s
oftw
are :
–Ja
mes
Nob
le, C
harle
s W
eir,
Sm
all M
emor
y S
oftw
are,
A
ddis
on-W
esle
y, 2
001
•C
onfe
renc
es a
nd w
orks
hops
:–
AC
M S
IGP
LAN
Wor
ksho
p on
Inte
rpre
ters
, Virt
ual
Mac
hine
s an
d E
mul
ator
s (c
o-or
gani
zed
with
PLD
I C
onfe
renc
e), J
une
2003
.–
Use
nix
Java
Virt
ual M
achi
ne R
esea
rch
and
Tec
hnol
ogy
Sym
posi
um (
2001
, 200
2, 2
004)
53Fo
rth
com
ing
Lec
ture
s
Mem
ory
Sys
tem
and
Gar
bage
Col
lect
or
Nat
ive
Inte
rfac
eIn
tern
al R
untim
eS
truc
ture
s
Thr
eadi
ng S
yste
m a
nd T
hrea
d S
ched
uler
Inte
rpre
ter
and
Exe
cutio
n S
tack
s
Cla
ss L
oade
r an
d JA
R R
eade
r
Com
pile
r(o
ptio
nal)
Ver
ifier
24.9
.
17.9
.
1.10
.
8.10
.
8.10
.
29.1
0.
Sess
ion #
2026
: J2M
E Plat
form
, Con
nect
ed Li
mite
d Dev
ice C
onfig
urat
ion (C
LDC)
Qu
esti
on
s?