CPSC 355 Lecture Notes - Lecture 20: Assembly Language

143 views3 pages

Document Summary

Cpsc 355 - lecture 20 oct 28th. Contain fields which may be of different types. Are deallocated in a single block of memory on the stack: fields are accessed using offsets. Eg: int a; char b; short a; struct rec { rec_a = 0 rec_b = 4 [0+4(a)] rec_c = 5 [4+1(b)] If the base addresses are in x19, then the fields are accessed with ldr w20, [x19, rec_a] ldrsb w21, [x19, rec_b] ldrsh w22, [x19, rec_c] C code: struct rec { int main( ) { int a; char b; short c; struct rec sl; Sl. c = 13 rec_a = 0 rec_b = 4 rec_c = 5. Sl_size = 7 alloc = -(16 + sl_size) & -16 dealloc = -alloc. A structure may contain a field whose type is another structure: the field"s su(cid:271)fields are a(cid:272)(cid:272)essed using a 2nd set of offsets.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents