Niveauer af abstrakte maskiner

Slides:



Advertisements
Lignende præsentationer
HUNDE SPEED km h 34,4 HUNDE SPEED km h 34,1 HUNDE SPEED km h 32,8 HUNDE SPEED km h 31,9 HUNDE SPEED km h 31,8 HUNDE SPEED km h 30,9.
Advertisements

Den danske befolknings syn på handicappedes rettigheder
VMS data Geografisk og tidsmæssig udvikling af indsatsen i tobisfiskeriet v/ dataspecialist Josefine Egekvist Sekretariat for myndighedsbetjening.
Atomer Et programmeret forløb. En måde at lære på.
VIND I ØRESUND - Øresund - Kattegat - Skagerrak Et samarbejdsprojekt om vindkraft mellem DTU og LTH Kick-off meeting in Lund d 18 December 2008.
UU-Aalborg Evaluering af brobygning og intro 2013/14 Velkommen UU-Aalborg Ungdommens Uddannelsesvejledning.
Indvandrere og efterkommere i grundskolen Niels Egelund, professor, dr
Funktioner Grundbegreber.
Hjemmesidekonstruktion Tjekspørgsmål 1.Hvad er et markup-sprog – hvad bruges det til? 2.Hvad er forskellen mellem et markup-sprog og et scriptsprog? 3.Hvad.
Prospekt. Ideen •Casa della filosofia er navnet på en forening, der giver almin- delige mennesker mulighed for at have brugsret til et hus i Italien på.
Torbenfeldvej Vallensbæk strand Tlf.: – – dagligt brug af vores hjemmeside •AGEN LYS har en stor og omfattende.
Velkommen til medlemsmødet For børnehaveklasseledere om arbejdstidsaftalen april 2009 Brøndby Strandskole.
Kap. 2 Fiskeri med trawl 2.1 · En smakke med trawlet ude.
v/ Professor Lars Ehlers, Aalborg Universitet
Velkommen hos Juvel A/S
1 DSB og Bibliotekerne Personlige interview foretaget 20. til 25. januar respondenter Holdning til evt. ny portal.
Dataopsamling og GPS-styring
Bolig selskabernes Landsforening– Almene lejeboliger - Maj/Juni Almene lejeboliger - Danmarkspanelet - Maj/Juni 2010.
Sortering af affald Dato: 17. december Agenda Sortering af affald Dato: 17. december 2010 TNS Gallup A/S Kontaktperson Celia Paltved-Kaznelson Danmarks.
ISA-niveauet (1) Machine Language: You try to shoot yourself in the foot only to discover you must first reinvent the gun, gunpowder, the bullet, and your.
Energieffektivisering i byggeriet”. Program Introduktion til Energieffektivisering af byggeriet Delprojekt_01Systematisk energieffektivisering af tekniske.
Symbolsk maskinsprog.
1 Analyse af geografiske valgresultater Søren Risbjerg Thomsen Institut for Statskundskab Aarhus Universitet.
1 Effektiv forrentning Kjeld Tyllesen PEØ, CBS Erhvervsøkonomi / Managerial Economics Kjeld Tyllesen, PEØ, CBS.
Statistik.
Arbejdsmarkedsuddannelser – også for personer med læse-, skrive- og regnevanskeligheder Oplæg fra AMU-Fyn Konference d. 22/5 -07.

Representations for Path Finding in Planar Environments.
DCS/DTS fællesmøde januar 2010 Denne præsentation har været fremlagt ved DCS / DTS Fællesmøde 2010 og Poul Erik Mortensen har alle rettighederne til gengivelse.
©FDLF 1 Hvordan arbejdes med CID.xls? - især Combination1 Plenum 3.
Grundlæggende regnskabsforståelse
Kvalitetstest af Palles Gavebod Spørgeskemaundersøgelse November 2010 – januar 2011 Center for Playware DPU.
Kursus om borger.dk og brugen af digital signatur
HUSKESPIL – den lille tabel
Titel: Arial, fed, skriftstr. 20, mørkegrå. Tekst: Arial, normal, fed eller kursiv, skriftstr. 10, 12 og 14 til print – 16 og 18 til projektor – mørkegrå.
Relativ vigtighed for elektroniske ressourcer,24,22,20,18,16,14,12,10 Indeks FARM nem at bruge Info om anvendelse af elektroniske.
 2 3  3 =  83  43  53  63  73  93  10 4.
Pleje og Sundhed Gennemførte719 Inviterede895 Svarprocent80% FREDERICIA KOMMUNE MTU og Psykisk APV 2012 Rapportspecifikationer.
1 UNION-FIND. 2 inddata: en følge af heltalspar (p, q); betydning: p er “forbundet med” q uddata: intet, hvis p og q er forbundet, ellers (p, q) Eksempel.
1 Powerpointserie om In-line færdiggørelse ved Heatsettrykning Avisrotation Magasindybtryk Den Grafiske Højskole.
Induktion og rekursion
Region Midtjyllands tilbud 2013
Borgerhenvendelser vedrørende vinter i Aalborg 2010 (SUK)
ETU 2008 | Elevtilfredshedsundersøgelse Erhvervsskolen Nordsjælland HTX (Teknisk Gymnasium) - Hillerød Baseret på 313 besvarelser.
1 Borgerpanelet i Silkeborg Kommune.
Program for fremlæggelse
Globaliseringsredegørelsen 24.mar. 14 Figurer fra Danmark tiltrækker for få udenlandske investeringer i Sådan ligger landet
Kjeld Tyllesen, PEØ, CBS1 Transfer Pricing Kun internt salg Kjeld Tyllesen Erhvervsøkonomi / Managerial Economics Forudsætninger og Opgave.
Affaldsordninger Lemvig Kommune. Dagrenovation Ændringer pr. 1. januar 2011 Frivægt pr. tømning er 5 kg. Herudover er kg. prisen 1 kr. Fra 1. januar 2011.
Matematik B 1.
Claus Brabrand, ITU, Denmark Mar 10, 2009EFFECTIVE JAVA Effective Java Presentation Workshop Claus Brabrand [ ] ( “FÅP”: First-year Project.
1 Vi ser nu på en general graf Men antager at alle afstande er heltallige (Det er ikke så restriktivt) Algoritmen leder efter den mindst mulige dækningsdistance.
MSBuild & Team Build i C#/C++ solutions VSTS ERFA d. 25 November.
1 Tråde 2 Plan Trådbegrebet Synkronisering Koordinering Eksempel: et flertrådet spil.
It i de gymnasiale uddannelser Udstyr og anvendelse, 2010.
1 Bilag 1 Busafgange mellem Silkeborg by og andre byer i kommunen D. 2. oktober 2008.
Grunde til at jeg elsker dig
Januar 2009 MandagTirsdagOnsdagTorsdagFredagLørdagSøndag Uge 2. Anette Ø. Kl Tina H. Lone M. 6 Kl Britt H. 7 Kl Vinnie G. Gerda.
DMU PeopleXS Workflows (alt) (uden forhandlingsdel) Stillingsfaser – Opslag Fremstilling/validering, godkendelse, annoncering – Bedømmelsesudvalg.
DJF PeopleXS Workflows (uden forhandlingsdel) Stillingsfaser – Opslag Fremstilling/validering, godkendelse, annoncering – Bedømmelsesudvalg.
Fundamentale datastrukturer
1 Fundamentale datastrukturer. 2 Definitioner: abstrakt datatype, datastruktur Elementære datastrukturer og abstrakte datatyper : arrays, stakke, køer,
1 Computersimuleringer af Molekylære Systemer Ulf Rørbæk Pedersen Ph.D. studerende ved Center for glas og tid Roskilde Universitetscenter.
DComNet1 ISA-niveauet (1) Machine Language: You try to shoot yourself in the foot only to discover you must first reinvent the gun, gunpowder, the bullet,
1 Kap. 4, Jordens Tyngdefelt = Torge, 2001, Kap. 3. Tyngdekraftens retning og størrelse g (m/s 2 ) Acceleration Tyngdepotentialet (W): evene til at udføre.
Scanning af cervix uteri U-kursus i føtal medicin 2005.
03 – Udtryk og metoder. 2 NOEA2009Java-kursus – Udtryk og metoder Udtryk i Java Java har standard udtrykene… Værditildeling Subrutiner og funktionskald.
VTU 2008 | Virksomhedstilfredshedsundersøgelse Aalborg Tekniske Skole Svarprocent: 27% (414 besvarelser ud af mulige)
DComNet1 ISA-niveauet (2). dComNet2 Niveauer af virtuelle maskiner ISA niveauet / maskinkodeniveauet / maskinniveau.
Præsentationens transcript:

Oversættelse af symbolsk maskinsprog Sammenkædning og indlæsning af maskinsprog

Niveauer af abstrakte maskiner Spørgsmål ... Hvordan bruges asm-niveauet? metode til programmering Hvordan stilles asm-niveauet tilrådighed? oversættelse af symbolsk maskinsprog til absolut maskinsprog

Programmering i symbolsk maskinsprog Tag udgangspunkt i et C program Oversæt systematisk til symbolsk maskinsprog Kommenter med C programmet Afprøv programmet eksternt og internt Konklusion fra sidst Evt. optimeringer foretages altid på et korrekt program ...

Hvilke opgaver har assembleren for at producere absolut maskinkode? .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Hvilke opgaver har assembleren for at producere absolut maskinkode? main index: 0 method area: 40 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 01 15 01 15 02 64 9b 00 0a 15 02 36 03 a7 00 07 15 01 36 03 15 03 ac constant pool: 2 words 00000000 0000000e Skriv opgaverne på tavlen Oversættelse af symbolske navne for instruktioner Oversætte symbolske navne til absolutte - adresser på kode - konstanter - lokale variabler Oprette konstantpool

Oversættelse af symbolsk maskinsprog 1-1 afbildning mellem maskinordre og symbolsk maskinordre Oversættelse er vel ligetil? Hvad med symbolske konstanter, labels og direktiver?

Sekventiel oversættelse .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Sekventiel oversættelse main index: 0 method area: 40 bytes 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac 00 03 00 01 15 01 15 02 64 9b ?? ?? 15 02 36 03 a7 ?? ?? 15 01 36 03 15 03 ac constant pool: 2 words 00000000 0000000e Adresser kan ligge længere fremme i koden – derfor kan de ikke vides når der skal genereres kode

oversættelse af program ordre for ordre ... Two-pass assembler .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } ijvm-asm test.j test.bc 1. gennemløb Opbyg symboltabel Sammenknytning af symbolske navne og værdier ... 2. gennemløb oversættelse af program ordre for ordre ... main index: 0 method area: 40 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 01 15 01 15 02 64 9b 00 0a 15 02 36 03 a7 00 07 15 01 36 03 15 03 ac constant pool: 2 words 00000000 0000000e

Hvad skal asm holde styr på? .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Adressen på næste ledige byte i method area: Instruction Location Counter Adressen på næste ledige word i constant pool: Constant Location Counter Værdier knyttet til symboler, konstanter, metodenavne, labels: Symboltabel main index: 0 method area: 40 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 01 15 01 15 02 64 9b 00 0a 15 02 36 03 a7 00 07 15 01 36 03 15 03 ac constant pool: 2 words 00000000 0000000e

1. gennemløb ILC: 0 CLC: 0 Symbol værdi type .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type main index: method area: constant pool:

1. gennemløb ILC: 0 CLC: 1 Symbol værdi type main metode .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type main metode main index: 0 method area: constant pool: 00000000

1. gennemløb ILC: 4 CLC: 1 Symbol værdi type main metode .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type main metode main index: 0 method area: 00 03 00 00 constant pool: 00000000

1. gennemløb ILC: 4 CLC: 1 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant main index: 0 method area: 00 03 00 00 constant pool: 00000000

1. gennemløb ILC: 4 CLC: 1 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 main index: 0 method area: 00 03 00 00 constant pool: 00000000

1. gennemløb ILC: 6 CLC: 1 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 main index: 0 method area: 00 03 00 00 10 58 constant pool: 00000000

1. gennemløb ILC: 8 CLC: 1 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 main index: 0 method area: 00 03 00 00 10 58 15 01 constant pool: 00000000

1. gennemløb ILC: 10 CLC: 1 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 main index: 0 method area: 00 03 00 00 10 58 15 01 15 02 constant pool: 00000000

1. gennemløb Forward reference (min er ikke i symboltabellen) ILC: 13 CLC: 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 Forward reference (min er ikke i symboltabellen) main index: 0 method area: 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? constant pool: 00000000

1. gennemløb ILC: 14 CLC: 1 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 main index: 0 method area: 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac constant pool: 00000000

1. gennemløb ILC: 14 CLC: 2 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min main index: 0 method area: 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac constant pool: 00000000 0000000e

1. gennemløb ILC: 18 CLC: 2 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min r 3 main index: 0 method area: 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac 00 03 00 01 constant pool: 00000000 0000000e

1. gennemløb ILC: 20 CLC: 2 Vigtigt med scope (to a’er) Symbol værdi .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min r 3 Symbol værdi type scope main metode a 1 konstant b 2 min Vigtigt med scope (to a’er) main index: 0 method area: 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac 00 03 00 01 15 01 constant pool: 00000000 0000000e

1. gennemløb ILC: 22 CLC: 2 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min Symbol værdi type scope main metode a 1 konstant b 2 min r 3 main index: 0 method area: 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac 00 03 00 01 15 01 15 02 constant pool: 00000000 0000000e

1. gennemløb ILC: 23 CLC: 2 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min Symbol værdi type scope main metode a 1 konstant b 2 min r 3 main index: 0 method area: 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac 00 03 00 01 15 01 15 02 64 constant pool: 00000000 0000000e

1. gennemløb Forward reference (else er ikke defineret) ILC: 26 CLC: 2 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min r 3 Symbol værdi type scope main metode a 1 konstant b 2 min Forward reference (else er ikke defineret) main index: 0 method area: 00 03 00 00 10 58 15 02 15 02 b6 ?? ?? ac 00 03 00 01 15 01 15 02 64 9b ?? ?? constant pool: 00000000 0000000e

1. gennemløb ILC: 28 CLC: 2 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min Symbol værdi type scope main metode a 1 konstant b 2 min r 3 main index: 0 method area: 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac 00 03 00 01 15 01 15 02 64 9b ?? ?? 15 02 constant pool: 00000000 0000000e

1. gennemløb ILC: 30 CLC: 2 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min r 3 main index: 0 method area: 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac 00 03 00 01 15 01 15 02 64 9b ?? ?? 15 02 36 03 constant pool: 00000000 0000000e

1. gennemløb Forward reference ILC: 33 CLC: 2 Symbol værdi type scope .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min r 3 Forward reference main index: 0 method area: 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac 00 03 00 01 15 01 15 02 64 9b ?? ?? 15 02 36 03 a7 ?? ?? constant pool: 00000000 0000000e

1. gennemløb ILC: 33 CLC: 2 Hvorfor er else 33? Symbol værdi type .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min r 3 else 33 label Hvorfor er else 33? main index: 0 method area: 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac 00 03 00 01 15 01 15 02 64 9b ?? ?? 15 02 36 03 a7 ?? ?? constant pool: 00000000 0000000e

1. gennemløb ILC: 35 CLC: 2 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min r 3 else 33 label main index: 0 method area: 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac 00 03 00 01 15 01 15 02 64 9b ?? ?? 15 02 36 03 a7 ?? ?? 15 01 constant pool: 00000000 0000000e

1. gennemløb ILC: 37 CLC: 2 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min r 3 else 33 label main index: 0 method area: 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac 00 03 00 01 15 01 15 02 64 9b ?? ?? 15 02 36 03 a7 ?? ?? 15 01 36 03 constant pool: 00000000 0000000e

1. gennemløb ILC: 37 CLC: 2 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min r 3 else 33 label end_if 37 main index: 0 method area: 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac 00 03 00 01 15 01 15 02 64 9b ?? ?? 15 02 36 03 a7 ?? ?? 15 01 36 03 constant pool: 00000000 0000000e

1. gennemløb ILC: 39 CLC: 2 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min r 3 else 33 label end_if 37 main index: 0 method area: 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac 00 03 00 01 15 01 15 02 64 9b ?? ?? 15 02 36 03 a7 ?? ?? 15 01 36 03 15 03 constant pool: 00000000 0000000e

1. gennemløb ILC: 40 CLC: 2 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min r 3 else 33 label end_if 37 main index: 0 method area: 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac 00 03 00 01 15 01 15 02 64 9b ?? ?? 15 02 36 03 a7 ?? ?? 15 01 36 03 15 03 ac constant pool: 00000000 0000000e

1. gennemløb ILC: 40 CLC: 2 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min r 3 else 33 label end_if 37 main index: 0 method area: 40 bytes 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac 00 03 00 01 15 01 15 02 64 9b ?? ?? 15 02 36 03 a7 ?? ?? 15 01 36 03 15 03 ac constant pool: 2 words 00000000 0000000e

2. gennemløb Udfyld “huller” vha. symboltabel Symbol værdi type scope .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min r 3 else 33 label end_if 37 Udfyld “huller” vha. symboltabel main index: 0 method area: 40 bytes 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? ac 00 03 00 01 15 01 15 02 64 9b ?? ?? 15 02 36 03 a7 ?? ?? 15 01 36 03 15 03 ac constant pool: 2 words 00000000 0000000e

2. gennemløb ILC: 13 CLC: 1 Symbol værdi type scope main metode a 1 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min r 3 else 33 label end_if 37 main index: 0 method area: 40 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 01 15 01 15 02 64 9b ?? ?? 15 02 36 03 a7 ?? ?? 15 01 36 03 15 03 ac constant pool: 2 words 00000000 0000000e

2. gennemløb Relativt hop: 33-23 = 10 23 ILC: 26 CLC: 2 .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min r 3 else 33 label end_if 37 Hvordan er det iflt virker? Hvordan udregnes adressen? Relativt hop: 33-23 = 10 main index: 0 method area: 40 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 01 15 01 15 02 64 9b 00 0a 15 02 36 03 a7 ?? ?? 15 01 36 03 15 03 ac constant pool: 2 words 00000000 0000000e 23

2. gennemløb Relativt hop: 37-30 = 7 30 ILC: 33 CLC: 2 Symbol værdi .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } Symbol værdi type scope main metode a 1 konstant b 2 min r 3 else 33 label end_if 37 Relativt hop: 37-30 = 7 main index: 0 method area: 40 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 01 15 01 15 02 64 9b 00 0a 15 02 36 03 a7 00 07 15 01 36 03 15 03 ac constant pool: 2 words 00000000 0000000e 30

oversættelse af program ordre for ordre ... Two-pass assembler .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 iload a iload b invokevirtual min ireturn // return min ( a, b ); // } .method min // int min .args 3 // ( int a, int b ){ .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) isub iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; end_if: iload r // return r; ireturn // } ijvm-asm test.j test.bc 1. gennemløb Opbyg symboltabel Sammenknytning af symbolske navne og værdier ... 2. gennemløb oversættelse af program ordre for ordre ... main index: 0 method area: 40 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 01 15 01 15 02 64 9b 00 0a 15 02 36 03 a7 00 07 15 01 36 03 15 03 ac constant pool: 2 words 00000000 0000000e

Opgave m. side”mand”: Lav symboltabel for følgende program // Integer multiplication. .method imul .args 3 // ( int x, int y ) .define x = 1 .define y = 2 .locals 1 // int p; .define p = 3 ldc_w 0 istore p // p = 0; while: // while iload x ifeq end_while // ( x > 0 ) // { bipush 1 isub istore x // x = x - 1; iload p iload y iadd istore p // p = p + y; goto while // } end_while: iload p ireturn // return p; // My multiplication program .method main .args 3 .define a = 1 .define b = 2 bipush 88 iload a iload b invokevirtual calc ireturn .method calc .args 3 invokevirtual imul ldc_w 42 ireturn // return a*b+42

Indlæsning af IJVM program 00 03 10 58 15 01 02 b6 ac 64 9b 0a 36 a7 07 0e PC = 0 CPP = 10 SP = 16 LV = 12 04 05 06 08 09 11 12 13 14 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 46 47 ..... main index: 0 method area: 40 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 01 15 01 15 02 64 9b 00 0a 15 02 36 03 a7 00 07 15 01 36 03 15 03 ac constant pool: 2 words 00000000 0000000e Maskinsprog / binært program Indlæs binært program i lager (method area og constant pool) startende fra adresse 0 Initialiser kontrolregistre PC, CPP, LV og SP Start afvikling; invokevirtual ''main index'' Simpelt indlæseprogram Hvorfor er CPP 10, LV=12 og SP = 16? Det er pointere til ORD (á 4 byte) alligned

Hvordan ser indholdet af lageret ud ved programstart? ijvm test.bc 42 87 IJVM Trace of test.bc stack = 0, 1, 87, 42, 15 bipush 88 [10 58] stack = 88, 0, 1, 87, 42, 15 iload 1 [15 01] stack = 42, 88, 0, 1, 87, 42, 15 iload 2 [15 02] stack = 87, 42, 88, 0, 1, 87, 42, 15 invokevirtual 1 [b6 00 01] stack = 12, 13, 0, 87, 42, 21, 0, 1 iload 1 [15 01] stack = 42, 12, 13, 0, 87, 42, 21, 0 iload 2 [15 02] stack = 87, 42, 12, 13, 0, 87, 42, 21 isub [64] stack = -45, 12, 13, 0, 87, 42, 21, 0 iflt 10 [9b 00 0a] stack = 12, 13, 0, 87, 42, 21, 0, 1 istore 3 [36 03] stack = 12, 13, 42, 87, 42, 21, 0, 1 iload 3 [15 03] stack = 42, 12, 13, 42, 87, 42, 21, 0 ireturn [ac] stack = 42, 0, 1, 87, 42, 15 ireturn [ac] stack = 42 return value: 42 Caller's LV: 0 Caller's PC: 1 b: 87 a: 42 Link prt: 15 SP LV +2 +1 15 12 Hvordan ser indholdet af lageret ud ved programstart?

Store programmer Man vil gerne anvende ''biblioteksmetoder'' ... // Integer multiplication. .method imul .args 3 // ( int x, int y ) .define x = 1 .define y = 2 .locals 1 // int p; .define p = 3 ldc_w 0 istore p // p = 0; while: // while iload x ifeq end_while // ( x > 0 ) // { bipush 1 isub istore x // x = x - 1; iload p iload y iadd istore p // p = p + y; goto while // } end_while: iload p ireturn // return p; // My multiplication program .method main .args 3 .define a = 1 .define b = 2 bipush 88 iload a iload b invokevirtual calc ireturn .method calc .args 3 invokevirtual imul ldc_w 42 ireturn // return a*b+42

Mulig løsning Mulig løsning Problemer // Integer multiplication .method imul .args 3 // ( int x, int y ) .define x = 1 .define y = 2 .locals 1 // int p; .define p = 3 ldc_w 0 istore p // p = 0; ... // My multiplication program .method main .args 3 .define a = 1 .define b = 2 bipush 88 iload a iload b invokevirtual calc ireturn .method calc .args 3 invokevirtual imul ldc_w 42 iadd ireturn // return a*b+42 Mulig løsning Lav et samlet program i symbolsk maskinsprog, der kan oversættes ... main index: 1 method area: 66 bytes 00 03 00 01 13 00 00 36 03 15 01 99 00 14 15 01 10 01 64 36 01 15 03 15 02 60 36 03 a7 ff ed 15 03 ac 00 03 00 00 10 58 15 01 15 02 b6 00 02 ac 00 03 00 00 10 58 15 01 15 02 b6 00 00 13 00 03 60 ac constant pool: 4 words 00000000 00000022 00000030 0000002a Mulig løsning Sammenkæd den oversattte kode, maskinkoden, inden indlæsning ... Problemer Kræver adgang til kildeteksten for de anvendte biblioteksmetoder... Biblioteksmetoder skal oversættes hver gang der rettes i egen kode ...

Sammenkæd den oversatte kode, maskinkoden, inden indlæsning ... Sammenkædning Sammenkæd den oversatte kode, maskinkoden, inden indlæsning ... main index: 0 method area: 32 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? 13 00 02 60 ac constant pool: 3 words 00000000 0000000e 0000002a main index: ?? method area: 34 bytes 00 03 00 01 13 00 00 36 03 15 01 99 00 14 15 01 10 01 64 36 01 15 03 15 02 60 36 03 a7 ff ed 15 03 ac constant pool: 1 words 00000000 Mangler ''imul'' Har ingen main-metode

Sammenkæd den oversatte kode, maskinkoden, inden indlæsning ... Sammenkædning Sammenkæd den oversatte kode, maskinkoden, inden indlæsning ... main index: 0 method area: 32 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? 13 00 02 60 ac constant pool: 3 words 00000000 0000000e 0000002a main index: ?? method area: 34 bytes 00 03 00 01 13 00 00 36 03 15 01 99 00 14 15 01 10 01 64 36 01 15 03 15 02 60 36 03 a7 ff ed 15 03 ac constant pool: 1 words 00000000 Mangler ''imul'' Har ingen main-metode main index: 0 calc index: 1 method area: 32 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? 13 00 02 60 ac constant pool: 3 words 00000000 [.method main] 0000000e [.method calc] 0000002a [ldc_w constant] external symbols: .method imul [ 24: invokevirtual imul ] imul index: 1 method area: 34 bytes 00 03 00 01 13 00 00 36 03 15 01 99 00 14 15 01 10 01 64 36 01 15 03 15 02 60 36 03 a7 ff ed 15 03 ac constant pool: 1 words 00000000 [ldc_w constant] 00000000 [.method imul] main.obj imul.obj

Sammenkædning main.obj imul.obj Linker all.bc main index: 1 method area: 66 bytes 00 03 00 01 13 00 00 36 03 15 01 99 00 14 15 01 10 01 64 36 01 15 03 15 02 60 36 03 a7 ff ed 15 03 ac 00 03 00 00 10 58 15 01 15 02 b6 00 02 ac 00 03 00 00 10 58 15 01 15 02 b6 00 00 13 00 03 60 ac constant pool: 4 words 00000000 00000022 00000030 0000002a main index: 0 calc index: 1 method area: 32 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? 13 00 02 60 ac constant pool: 3 words 00000000 [.method main] 0000000e [.method calc] 0000002a [ldc_w constant] external symbols: .method imul [ 24: invokevirtual imul ] imul index: 1 method area: 34 bytes 03 ac constant pool: 1 words 00000000 [ldc_w constant] 00000000 [.method imul]

Sammenkædning main.obj imul.obj Linker all.bc main index: 1 method area: 66 bytes 00 03 00 01 13 00 00 36 03 15 01 99 00 14 15 01 10 01 64 36 01 15 03 15 02 60 36 03 a7 ff ed 15 03 ac 00 03 00 00 10 58 15 01 15 02 b6 00 02 ac 00 03 00 00 10 58 15 01 15 02 b6 00 00 13 00 03 60 ac constant pool: 4 words 00000000 00000022 00000030 0000002a main index: 0 calc index: 1 method area: 32 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? 13 00 02 60 ac constant pool: 3 words 00000000 [.method main] 0000000e [.method calc] 0000002a [ldc_w constant] external symbols: .method imul [ 24: invokevirtual imul ] imul index: 1 method area: 34 bytes 03 ac constant pool: 1 words 00000000 [ldc_w constant] 00000000 [.method imul]

Sammenkædning main.obj imul.obj Linker all.bc Hvordan? main index: 1 method area: 66 bytes 00 03 00 01 13 00 00 36 03 15 01 99 00 14 15 01 10 01 64 36 01 15 03 15 02 60 36 03 a7 ff ed 15 03 ac 00 03 00 00 10 58 15 01 15 02 b6 00 02 ac 00 03 00 00 10 58 15 01 15 02 b6 00 00 13 00 03 60 ac constant pool: 4 words 00000000 00000022 00000030 0000002a main index: 0 calc index: 1 method area: 32 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? 13 00 02 60 ac constant pool: 3 words 00000000 [.method main] 0000000e [.method calc] 0000002a [ldc_w constant] external symbols: .method imul [ 24: invokevirtual imul ] imul index: 1 method area: 34 bytes 03 ac constant pool: 1 words 00000000 [ldc_w constant] 00000000 [.method imul] Hvordan?

Generelt eksempel Fire objekt-moduler skal sammenkædes Hver oversat under antagelse af indlæsning fra adresse 0 ...

Reallokeringsproblem Absolutte referencer til lageradresse skal justeres jvf. indlæsningsadresser ... Eksterne referencer Skal sættes jvf. indlæsnings-adresser ...

IJVM eksempel Linker all.bc main index: 1 method area: 66 bytes 00 03 00 01 13 00 00 36 03 15 01 99 00 14 15 01 10 01 64 36 01 15 03 15 02 60 36 03 a7 ff ed 15 03 ac 00 03 00 00 10 58 15 01 15 02 b6 00 02 ac 00 03 00 00 10 58 15 01 15 02 b6 00 00 13 00 03 60 ac constant pool: 4 words 00000000 00000022 00000030 0000002a main index: 0 calc index: 1 method area: 32 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? 13 00 02 60 ac constant pool: 3 words 00000000 [.method main] 0000000e [.method calc] 0000002a [ldc_w constant] external symbols: .method imul [ 24: invokevirtual imul ] imul index: 1 method area: 34 bytes 03 ac constant pool: 1 words 00000000 [ldc_w constant] 00000000 [.method imul]

IJVM eksempel Linker all.bc main index: 1 method area: 66 bytes 00 03 00 01 13 00 00 36 03 15 01 99 00 14 15 01 10 01 64 36 01 15 03 15 02 60 36 03 a7 ff ed 15 03 ac 00 03 00 00 10 58 15 01 15 02 b6 00 02 ac 00 03 00 00 10 58 15 01 15 02 b6 00 00 13 00 03 60 ac constant pool: 4 words 00000000 00000022 00000030 0000002a main index: 0 calc index: 1 method area: 32 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? 13 00 02 60 ac constant pool: 3 words 00000000 [.method main] 0000000e [.method calc] 0000002a [ldc_w constant] external symbols: .method imul [ 24: invokevirtual imul ] imul index: 1 method area: 34 bytes 03 ac constant pool: 1 words 00000000 [ldc_w constant] 00000000 [.method imul] Eksterne referencer sættes jvf. placering i fælles ''method area'' og ''constant pool'' ...

IJVM eksempel Linker all.bc main index: 1 method area: 66 bytes 00 03 00 01 13 00 00 36 03 15 01 99 00 14 15 01 10 01 64 36 01 15 03 15 02 60 36 03 a7 ff ed 15 03 ac 00 03 00 00 10 58 15 01 15 02 b6 00 02 ac 00 03 00 00 10 58 15 01 15 02 b6 00 00 13 00 03 60 ac constant pool: 4 words 00000000 00000022 00000030 0000002a main index: 0 calc index: 1 method area: 32 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? 13 00 02 60 ac constant pool: 3 words 00000000 [.method main] 0000000e [.method calc] 0000002a [ldc_w constant] external symbols: .method imul [ 24: invokevirtual imul ] imul index: 1 method area: 34 bytes 03 ac constant pool: 1 words 00000000 [ldc_w constant] 00000000 [.method imul] Startadresser for metoder i eget ''method area'' skal justeres i fælles ''constant pool'' jvf. placering i fælles ''method area'' ...

IJVM eksempel Linker all.bc main index: 1 method area: 66 bytes 00 03 00 01 13 00 00 36 03 15 01 99 00 14 15 01 10 01 64 36 01 15 03 15 02 60 36 03 a7 ff ed 15 03 ac 00 03 00 00 10 58 15 01 15 02 b6 00 02 ac 00 03 00 00 10 58 15 01 15 02 b6 00 00 13 00 03 60 ac constant pool: 4 words 00000000 00000022 00000030 0000002a main index: 0 calc index: 1 method area: 32 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? 13 00 02 60 ac constant pool: 3 words 00000000 [.method main] 0000000e [.method calc] 0000002a [ldc_w constant] external symbols: .method imul [ 24: invokevirtual imul ] imul index: 1 method area: 34 bytes 03 ac constant pool: 1 words 00000000 [ldc_w constant] 00000000 [.method imul] Startadresser for metoder i eget ''method area'' skal justeres i fælles ''constant pool'' jvf. placering i fælles ''method area'' ... adresse 34

IJVM eksempel Linker all.bc main index: 1 method area: 66 bytes 00 03 00 01 13 00 00 36 03 15 01 99 00 14 15 01 10 01 64 36 01 15 03 15 02 60 36 03 a7 ff ed 15 03 ac 00 03 00 00 10 58 15 01 15 02 b6 00 02 ac 00 03 00 00 10 58 15 01 15 02 b6 00 00 13 00 03 60 ac constant pool: 4 words 00000000 00000022 00000030 0000002a main index: 0 calc index: 1 method area: 32 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? 13 00 02 60 ac constant pool: 3 words 00000000 [.method main] 0000000e [.method calc] 0000002a [ldc_w constant] external symbols: .method imul [ 24: invokevirtual imul ] imul index: 1 method area: 34 bytes 03 ac constant pool: 1 words 00000000 [ldc_w constant] 00000000 [.method imul] Referencer til egen ''constant pool'' (via invokevirtual eller ldc_w) skal justeres jvf. placering i fælles ''constant pool'' ...

IJVM eksempel Linker all.bc main index: 1 method area: 66 bytes 00 03 00 01 13 00 00 36 03 15 01 99 00 14 15 01 10 01 64 36 01 15 03 15 02 60 36 03 a7 ff ed 15 03 ac 00 03 00 00 10 58 15 01 15 02 b6 00 02 ac 00 03 00 00 10 58 15 01 15 02 b6 00 00 13 00 03 60 ac constant pool: 4 words 00000000 00000022 00000030 0000002a main index: 0 calc index: 1 method area: 32 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? 13 00 02 60 ac constant pool: 3 words 00000000 [.method main] 0000000e [.method calc] 0000002a [ldc_w constant] external symbols: .method imul [ 24: invokevirtual imul ] imul index: 1 method area: 34 bytes 03 ac constant pool: 1 words 00000000 [ldc_w constant] 00000000 [.method imul] Referencer til egen ''constant pool'' (via invokevirtual eller ldc_w) skal justeres jvf. placering i fælles ''constant pool'' ... adresse 1

IJVM eksempel Linker all.bc main index: 1 method area: 66 bytes 00 03 00 01 13 00 00 36 03 15 01 99 00 14 15 01 10 01 64 36 01 15 03 15 02 60 36 03 a7 ff ed 15 03 ac 00 03 00 00 10 58 15 01 15 02 b6 00 02 ac 00 03 00 00 10 58 15 01 15 02 b6 00 00 13 00 03 60 ac constant pool: 4 words 00000000 00000022 00000030 0000002a main index: 0 calc index: 1 method area: 32 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? 13 00 02 60 ac constant pool: 3 words 00000000 [.method main] 0000000e [.method calc] 0000002a [ldc_w constant] external symbols: .method imul [ 24: invokevirtual imul ] imul index: 1 method area: 34 bytes 03 ac constant pool: 1 words 00000000 [ldc_w constant] 00000000 [.method imul] relocation dictionary: [10: invokevirtual] [27: ldc_w] Referencer til egen ''constant pool'' (via invokevirtual eller ldc_w) skal justeres jvf. placering i fælles ''constant pool'' ... adresse 1

Opsummering main index: 0 calc index: 1 method area: 32 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? 13 00 02 60 ac constant pool: 3 words 00000000 [.method main] 0000000e [.method calc] 0000002a [ldc_w constant] external symbols: .method imul [ 24: invokevirtual imul ] relocation dictionary: [10: invokevirtual] [27: ldc_w]

Opsummering main index: 0 calc index: 1 method area: 32 bytes 00 03 00 00 10 58 15 01 15 02 b6 00 01 ac 00 03 00 00 10 58 15 01 15 02 b6 ?? ?? 13 00 02 60 ac constant pool: 3 words 00000000 [.method main] 0000000e [.method calc] 0000002a [ldc_w constant] external symbols: .method imul [ 24: invokevirtual imul ] relocation dictionary: [10: invokevirtual] [27: ldc_w]

Opsummering Egentlig en diskussion af bindingstidspunkt, dvs. hvornår bindes referencer til lageret til fysiske adresse ... Når programmet skrives Når programmet oversættes Når programmet sammenkædes Når programmet indlæses ... ijvm-asm eksempel ... et samspil med operativ-systemets ''memory manager'' ...