Struct code generation
Download
1 / 11

Struct Code generation - PowerPoint PPT Presentation


  • 122 Views
  • Uploaded on

Struct Code generation. code example 1. Struct simple { int one; int two; } simple j; void main ( ) { j.two = 1; }. code example 1. Symbol Table Entry Type size fields fieldsize fieldstart simple struct 8 one 4 0 two 4 4. Struct simple { int one; int two; } simple j;

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Struct Code generation' - dirk


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Code example 1
code example 1

Struct simple

{

int one;

int two;

}

simple j;

void main ( )

{

j.two = 1;

}


Code example 11
code example 1

Symbol Table

Entry Type size fields fieldsize fieldstart

simple struct 8 one 4 0

two 4 4

Struct simple

{

int one;

int two;

}

simple j;

void main ( )

{

j.two = 1;

}


Code example 12
code example 1

Symbol Table

Entry Type size fields fieldsize fieldstart

simple struct 8 one 4 0

two 4 4

Struct simple

{

int one;

int two;

}

simple j;

void main ( )

{

j.two = 1;

}

DataFrame

j db 0x0 dup(8)


Code example 13
code example 1

Symbol Table

Entry Type size fields fieldsize fieldstart

simple struct 8 one 4 0

two 4 4

Struct simple

{

int one;

int two;

}

simple j;

void main ( )

{

j.two = 1;

}

DataFrame

j db 0x0 dup(8)

Calc of address of j.one

mov r1, j

add r1, 4 ; two.fieldstart


Code example 14
code example 1

Symbol Table

Entry Type size fields fieldsize fieldstart

simple struct 8 one 4 0

two 4 4

Struct simple

{

int one;

int two;

}

simple j;

void main ( )

{

j.two = 1;

}

DataFrame

j db 0x0 dup(8)

CodeFrame

mov r1, j

add r1, 4

push r1

push 1

pop r2

pop r1

mov [r1], r2

Calc of address of j.one

mov r1, j

add r1, 4 ; two.fieldstart


Code example 2
code example 2

Struct simple

{

int one;

int two;

}

simple [] j = new simple 3;

void main ( )

{

j[1].two = 1;

}


Code example 21
code example 2

Symbol Table

Entry Type size fields fieldsize fieldstart

simple struct 8 one 4 0

two 4 4

Entry Type Elements ElSize

j array 3 8

Struct simple

{

int one;

int two;

}

simple [] j = new simple 3;

void main ( )

{

j[1].two = 1;

}


Code example 22
code example 2

Symbol Table

Entry Type size fields fieldsize fieldstart

simple struct 8 one 4 0

two 4 4

Entry Type Elements ElSize

j array 3 8

Struct simple

{

int one;

int two;

}

simple [] j = new simple 3;

void main ( )

{

j[1].two = 1;

}

DataFrame

j db 0x0 dup(24)


Code example 23
code example 2

Symbol Table

Entry Type size fields fieldsize fieldstart

simple struct 8 one 4 0

two 4 4

Entry Type Elements ElSize

j array 3 8

Struct simple

{

int one;

int two;

}

simple [] j = new simple 3;

void main ( )

{

j[1].two = 1;

}

DataFrame

j db 0x0 dup(24)

Calc of address of j[1].two

mov r1, j

mov r2, 8 ; ElSize

mul r2, 1 ;

add r1,r2 ; j[1]

add r1, 4 ; two.fieldstart


Code example 24
code example 2

Symbol Table

Entry Type size fields fieldsize fieldstart

simple struct 8 one 4 0

two 4 4

Entry Type Elements ElSize

j array 3 8

Struct simple

{

int one;

int two;

}

simple [] j = new simple 3;

void main ( )

{

j[1].two = 1;

}

DataFrame

j db 0x0 dup(24)

CodeFrame

mov r1, j

mov r2,8

mul r2,1

add r1,r2

add r1, 4

push r1

push 1

pop r2

pop r1

mov [r1], r2

Calc of address of j[1].two

mov r1, j

mov r2, 8 ; ElSize

mul r2, 1 ;

add r1,r2 ; j[1]

add r1, 4 ; two.fieldstart


ad