1 / 14

ISA-niveauet (2)

ISA-niveauet (2). Niveauer af virtuelle maskiner. ISA niveauet / maskin kodeniveauet / maskinniveau. ISA - Fra sidst. ISA-niveauet og von-Neumann maskine: Maskininstruktioner og instruktionsformat. Absolut maskinkode. Registre og lagermodellen. IJVM maskinen: Registre: PC, SP, LV, CPP.

irish
Download Presentation

ISA-niveauet (2)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ISA-niveauet (2) dComNet

  2. Niveauer af virtuelle maskiner ISA niveauet / maskinkodeniveauet / maskinniveau dComNet

  3. ISA - Fra sidst ISA-niveauet og von-Neumann maskine: Maskininstruktioner og instruktionsformat. Absolut maskinkode. Registre og lagermodellen. IJVM maskinen: Registre: PC, SP, LV, CPP. Lagermodel: method area, constant pool, stakken. Metodekald og stakafsnit, parametre og lokale variable. IJVM simulatoren dComNet

  4. 32 bit 32 bit 8 bit IJVM Lagermodel Opdelt i tre områder (konstant pool, stakken, method area): .. indlejret i et lineært lager: 4.294.967.296 celler (1 byte/celle). dComNet

  5. IJVM registre Program Counter (PC): 32-bit register Udpeger aktuel instruktion (byte) i method area. Constant Pool Pointer:32-bit register Udpeger bunden (word) af konstant pool i lageret Stack Pointer (SP) :32-bit register Udpeger øverste element (word) på stakken. Local Variable Frame Pointer (LV):32-bit register Udpeger bunden (word) af det aktuelle stakafsnit. dComNet

  6. invokevirtual dComNet

  7. ireturn dComNet

  8. test.c int min(int a, int b) { int r; if (a>=b) r=b; else r=a; return r; } int main(int a, int b) { return min(a,b); } dComNet

  9. test.j .method main // int main .args 3 // ( int a, int b ) .define a = 1 .define b = 2 // { bipush 88 // Push object reference. iload a iload b invokevirtual min ireturn // return min ( a, b ); // } dComNet

  10. .method min // int min .args 3 // ( int a, int b ){ .define a = 1 .define b = 2 .locals 1 // int r; .define r = 3 iload a // if ( a >= b ) iload b isub // stack = a - b, ... ; a - b < 0 => a < b iflt else iload b // r = b; istore r goto end_if else: // else iload a // r = a; istore r end_if: iload r // return r; ireturn // } dComNet

  11. Test.c oversættes til ”by hand” (næste time) test.j oversættes til ijvm-asm test.j test.bc 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 fortolkes af ijvm test.bc 77 43 IJVM simulator dComNet

  12. Antal argumenter for main Antal lokale variable for main Start adresse for main Start adresse for min main index: 0 method area: 40 bytes 0 00 03 2 00 00 4 10 58 bipush 88 6 15 01 iload 1 8 15 02 iload 2 10 b6 00 01 invokevirtual 1 13 ac ireturn 14 00 03 16 00 01 18 15 01 iload 1 20 15 02 iload 2 22 64 isub 23 9b 00 0a iflt 10 26 15 02 iload 2 28 36 03 istore 3 30 a7 00 07 goto 7 33 15 01 iload 1 35 36 03 istore 3 37 15 03 iload 3 39 ac ireturn constant pool: 2 words 00000000 0000000e dComNet

  13. ijvm test.bc 77 43 IJVM Trace of foo stack = 0, 1, 43, 77, 15 bipush 88 [10 58] stack = 88, 0, 1, 43, 77, 15 iload 1 [15 01] stack = 77, 88, 0, 1, 43, 77, 15 iload 2 [15 02] stack = 43, 77, 88, 0, 1, 43, 77, 15 invokevirtual 1 [b6 00 01] stack = 12, 13, 0, 43, 77, 21, 0, 1 iload 1 [15 01] stack = 77, 12, 13, 0, 43, 77, 21, 0 iload 2 [15 02] stack = 43, 77, 12, 13, 0, 43, 77, 21 isub [64] stack = 34, 12, 13, 0, 43, 77, 21, 0 iflt 10 [9b 00 0a] stack = 12, 13, 0, 43, 77, 21, 0, 1 iload 2 [15 02] stack = 43, 12, 13, 0, 43, 77, 21, 0 istore 3 [36 03] stack = 12, 13, 43, 43, 77, 21, 0, 1 goto 7 [a7 00 07] stack = 12, 13, 43, 43, 77, 21, 0, 1 iload 3 [15 03] stack = 43, 12, 13, 43, 43, 77, 21, 0 ireturn [ac] stack = 43, 0, 1, 43, 77, 15 ireturn [ac] stack = 43 return value: 43 dComNet

  14. IJVM Maskinarkitekturen Instruktionssæt: 20 instruktioner. Instruktionsformat: 1-5 bytes længde og 1 byte opkode. Datatyper:heltal (med og uden fortegn) Lagermodel: 3-delt 4Gb lineært lager. Stakmaskine: operander udpeges ved stak addressering. dComNet

More Related