Dit is de samenvatting van het zevende hoofdstuk van het vak Structuur van Computerprogramma's II. In deze samenvatting werd zowel alle relevante informatie uit de slides als informatie uit eigen notities opgenomen.
Hoofdstuk 5a: Execution model
1 The C Compilation Process (Recap from Chapter 1)
2 Anatomy of a C Program in Memory
(in a UNIX-like 32-bit model)
• When a function call is executed:
o arguments need to be evaluated to values
o control flow jumps to the body of function, and code
begins executing there
▪ Functions push/pop data from the stack as they
call each other & allocate memory on the heap
for data that must survive across functions
o once a return statement has been encountered, go back
to the function call
1
,3 Stack
3.1 Overview
3.2 Stack and Functions
Stack Frame Layout on x86 32-bit Architecture
• from 386 to Pentium 4 (~1985-2005)
3.2.1 Intro: Basics of x86 32-bit processors
• Have 8 general purpose registers:
3.2.2 Stack Frame
• Each language and architecture has their own calling convention = the way the stack frame
looks (which arguments are put on the stack, in what order are they put onto the stack…)
2
, 3.2.3 Instruction Set - GNU assembly syntax (GAS) ~AT&T syntax
• GAS is a subset of the Intel processor instruction set used in GCC assembly
4 Execution of a C Program by Example
3
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller lennyS. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $3.76. You're not tied to anything after your purchase.