=) the Size of the
SS.
SB)
F AIAHALL AG,
csé& DS
A\SS ? ment oneal
1) Define Storoge Organizatfon.
1
fy From -the Perspective ofthe compiler coriter, the execuéi
ro layge t program yuns $n tS aon Lefcal Address space |
Ne 4 Was. a
fo woh%th, each Prograro value Was @ location. “The “en
J-ement aud eygarizatfon Of thin logical acldvess space ‘
Shaved bette! the compiler, operatirg Syptem ud org}
-tt machine |
=the os Maps the logtcal addvess Sinko ea |
yess) which ave usually Spread throughout memory |
=> The von-time ye presentation of an object program |
in the logical add vesspate consist Of cate aud Pa
| sam aveas ap Sheon below |
| code | |
\
reap) “peal Subdisshin Moe
uv -fime memory Snto Code
qud data aveas.
anevated target code fA fined ak
Compile ime, So gf. compiler Can piace the exctutale\,
lage coe ina aes delerrrined) aves, COAe,
Usually $n the tow end of Niemory:
=> Semilayly , the Size of Some Progen data Objects,
Such as global dongianté, aud dato enevated. by the
| Compiler, Suth as ta-frzwation
Re
to Sapport ae taBa
Cplledtion, May be Kamen at Compfle Hime and these .,
Object can be possible placed fin augthey staticalis mm
=ned avea called Slatfe-
=) One yeason —fov Stastfeallg
as possible % that the addves SH
be Compiled Gnto ~the target lata
=) "Tb Manknize The vtfization of Sp
ty two auens', Slacks and tleap area OF
the yemainder Of the address space:
€ % ‘the
=>) These ArYeob ave iene the sige GU
4ousvds each other
oqvam executes, these ArcaS geo
as inceded. the ciack 12 osed 40) data shuctures
€alled act?vation vecords that ge fa during
yours Fouards bower acllvesses)
ak dala oy
allocatt
$e these’ Objects @
ak yea Hime, the
ace.
tice Opposite
En practice, te staek
-the heap doucand? faa |
2D! hak % activation yecord 7 write the various 4elds |
of gett vation Record. {|
Aid Aet®vatlon Lecord
wn we ans
= Activation Record tov) Frame %% a Contiguous block of
alovage that Con4ains all «the Snformatfes xcquired -tor)
ar
a Single énecttfon of o Be
1 vecord consist of sevenfeldS Shown thy
= An activate
1
d
Figure.
% “Tem porary voluck e—
MI ann Ne oe i
=> this field holds LT (eed valle’ §: Ahad are
Used in the evaluation of expressions:
}Relorned value
factual parameters)
[control tinie
TAecess tate |
Machine. tos |
Local Chia
[Temporary val y ve ues |
* Local: Datai- aa] |
a tid holds att the data that if locol to 2 proceed
“ve. i )
# Machire Slatus\— |
AAAS AAR
this fietd saves the .S
Procedure occ uyE. r |
x Access link (— |
we
Jatos Of the mathire when a call to}
ina) tield. |
link 4p data Cnon—tocal) hold ty |
ae
a this ig an opti
a this -field holde &
cihey activation recerde.
x Control - link {-
We
Tt basically work OP aM
ot Cele eho an shorter G4 fost
2 ty outpue “the.| peephole B
optimntation:
‘which o part of
Code. without @ cho
machine — de pendent
°
bject?ves cephole optimization i—
Objectives: of Peeps Ccmncanes
“the objective Of peephole Optfmigation |® ag Follows: |
te 716) improve per dtoymance.
a- TO edule memor “footprint
3. To vetie de Size
ec phdle timiaati ini {=
phat Ope aan a. | |:
leash ond. Sis. Aaa
Is eliminated in thip technique.
Tnftab 2
Bean Ose Opthniged | let
at oL)
We geo I] Stee YB no tro. |
H wel |
Welve yemoved +Wo vedundaut i
Variables Say
whope |
Redundant lead and Store elimination ved on dency
eS j i i
were just beirg Copied -fom one cendther.vo,
_ ae a
2 de Conskank fea c
_ EBERT aa nay a
me Cos pe piredmame crapecaton, fo ve
oy done at yuntme ave yeplaced with simplified Code > |
Avoid com putation-
| anSttal cade
ra
| TMs, |
imized code?
uae 2s
Cc. Stren ibe |
a Reduction The | Operators -thod tensome higher exe}
=cution time are replaced y the operators Con soning i
optimiacd Cale
execution time.
Tastlal code: A gufitel code i
Bert >) 7) Sea |
Ogun are te
fh rien ek elect) 4 ame |
ves sion’
tha Alge bral
|b. Null Sequenes ( simplify Agee ous
Usetess Operator axe deleted
Ot 2ak0%
at =arxly
Ga hie \
6 ar +a-04 !
‘a ‘ al operat ons one veploced bya
€- combine Operating: Seve
Single equivalent operation:
(0 Qeadeode Elimination velers 4a. portion’ ob 4
cam hee \ ane! never affect The
Pe vamls ObSewable behavioow- €liminatt dead a ee
fm prove Whe efficiency and pemiorts oF mg Compt «
program Bi reducing pnnecesary Computer Gus
When le_—
—
yee roe 8
ai ae suse arnt
oa ei
eos * pat). 5
Ne aan Pilea
“ ie 4 pl
| | ao Mo cat
S| shotte, Mano Hilocatia) J) aS or
ma 1 oie ab Compile and ip allocate ie
memory wa Hine:
Jae
ime. d wl
i ou can not be chougel weuie| =p reevsnry Cos HC Cte
|p Memon Co” cle exec, ial
enceutig a fate He
= Used in an array
b> ar ip fast ard saves venning
time
Hes rt alloctes memory -hom
F -+the gyacke
E> Allocated Nicwor, ones
EHorn giart +0 crcl abe ProTo™
Te is less efticient than the
One allocation Strategy.
=> used inthe liaed fst
gt tp a bik: $ low.
wor to
|
>
> allocateé
-m -the heap |
Sy ewnny (Ge lee allocate
He aud cou .
at a
eluted oF any stime.
> Tein more efficient: tod
she siatie allocation Shaty
|
Teo pi that Vs Sate Membr
Con not he Chavged. d
=> D0 Oyramic Mew
AULocatton Guy
re Si
bad ealloe(), malloc ¢), ave the Imevaony 1 allocaicad
mem) t SRC Can be che ae
Tmplementation of this +ype “tt
afallocation 's simple. HYP) > amplementation of is |
bs an
s Be FC ec ‘yPe OF allocation \
|? Be wets Complicated. | \
| loat 5 ps --
L. float j 5 pe malloc Cage oF Cnt) \
the I differen@ beludecn Stale ANd Oynamic Mewor ion)
Allocet i
lon ered SRe s fad
ip allocated at vn!Y ' eer
*, 3 ization mento in the pects eats,
of of compiler wrtier i Ore diogam? ‘lt F
Hay INheo “the a yoqram e-xecete —then
legend adthess Uspace sin aihich the valle ef cotaiire
location.
=the cal addiess gpace ip shored aworg ihe Compiler , Qpesating
AoWget machire -foy marapemine aud Oy
3 The. Operotig Sptem I iysed) “fo trop “the loaical adkhess toto
physio address which 36 ay spieadl -lhnoughouk the memo
Sobdivisten of Rin--time J
OOS OSIM OT apace eS HS
Memory Wcabiong for, code ave Odlermrinel
I — ok coinpi ler, Here
4. |<— Jocation of state Date cur also be
determined ot Compiler me:
Je— Dota objects alloetcated a Rin time
CAcBuation Recorela)
bE rund in Tk p Oton
ron hoy a
er ond
other ac Aillcoltdl Dal Objects at]
ST Ron tirte (for cxauple, Malloc Ara inc)
=> Ron-Hme e comes ‘nfo blocks’, whee qi byte 1S
aed , 1S psed'
Show -the Smallest unit of Addlessable memory. “ysing the foor
tf @ machine 0rd can -form, Sd
> object OF ae @ Stored 40 consecutive bores gud a the
first bye acklyes }
2 oe Con be Soddivide “to hold ‘the clifferent
-pnemip ef an erecuting Program?
h Genevated CxeCulable Code
d. Static data objects
& Dynamic closa— Dbject - heap
YY. Automatfe Weta +p rane Tt Used by both the aualipin aud Spotty,
ve 1 for fe Ulsieg povpos=s:
the vore ofall enittes id a Strtsctemed fom] |
ff a variable has been cleclaved
Used “fo determine, the Scop: of @ heme.
§5 sed ty implement Jype checking BY Phy te
49 implement type checking By verthying albGorney I
npressioa in the Sourte cede ave Emeatate covect. 5 1 RS \
Sambo] table Can efthey be Jineay oY @ hash’ table,
format, 41. maintains He cin fox
1a Mord i? © 2 variable Store the ‘cformabion aout the
"i declanation -
| ek
then 7 stove 4 ‘
| cM rE Stow acta airy format:
Ze OR ae
[F satay Re | State 5] we
> “the clause ath Me \
nn OMeute Contains the, ents
nine TS velated 49 the 4
| Procedure ;
ie Insert (2
—> insert ©) Operation %§ m
f ie frequen ty ey By
phase when “the tokens aie 5) ited Secl In the Aualysis |
in the _Jable cn iFied and rarres are Corey: > The bast format Of look upc i-function se o4 Follows.
ythe insert (5 6, ration
4 i
Syrecl Jatble Nee ine te Used to insert tpg
Siete Teformation jn ihe \
ao ; "re Oceurita in he Source Cale
Be Te SOUT Cte, the autitade oul Symol 18 the informakt
alsectated why, had Len a ae
v
f, ae AYPe ancl cpniae Scope ahout Enitialization Of the S.rnbol.
~ Cheeving whether the vame i declared multiol -Hme.
ol. The information Containe the slate
lookup Symbol,
cod > The format 6 varloos a tp the ern Longe
Mae