110 likes | 262 Views
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;
E N D
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; 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; void main ( ) { j.two = 1; } DataFrame j db 0x0 dup(8)
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 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 Struct simple { int one; int two; } simple [] j = new simple 3; void main ( ) { j[1].two = 1; }
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 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 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 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