复旦大学:《计算机原理 Computer System》课程PPT课件_Heterogeneous Data Structures & Alignment; Putting it Together; Floating Point

Heterogeneous Data Structures Alignment heterogeneous:不同种类的
1 Heterogeneous Data Structures & Alignment * heterogeneous: 不同种类的

Outline Struct Uu nion Alignment -chqp3.93.10
2 Outline • Struct • Union • Alignment – Chap 3.9, 3.10

Structures P191 Group objects into a single object Each ob ject is referenced by name Memory layout All the components are stored in a contiguous region of memory a pointer to a structure is the address of its first byte References to structure elements Using offsets as displacements
3 Structures P191 • Group objects into a single object • Each object is referenced by name • Memory layout – All the components are stored in a contiguous region of memory – A pointer to a structure is the address of its first byte • References to structure elements – Using offsets as displacements

Structure P192 struct rect in七11x; /*x coordinate of 1。wer-1 eft corner*/ in七1 /* y coordinate of 1。wer-1 eft corner★ int color /★ Coding ofco1ox*/ int width; /* width (in pixels)*/ int height / Height (in pixels)*/
4 Structure P192 struct rect { int llx; /* X coordinate of lower-left corner */ int lly; /* Y coordinate of lower-left corner */ int color; /* Coding of color */ int width; /* Width (in pixels) */ int height; /* Height (in pixels) */ };

Structure P192 struct rect ri r.11x=x.11y=0; r color oxFFooFF r width = 10; rheight 20;
5 Structure P192 struct rect r; r.llx = r.lly = 0; r.color = 0xFF00FF; r.width = 10; r.height = 20;

Structure P192 int area (struct rect *rp) return (*rp).width (*rp). height ⅴ。 id rotate1eft( struct rect*rp) /* Exchange width and height * int t rp-heighti rp->height rp->width rp->width s ti
6 Structure P192 int area (struct rect *rp) { return (*rp).width * (*rp).height; } void rotate_left (struct rect *rp) { /* Exchange width and height */ int t = rp->height; rp->height = rp->width; rp->width = t; }

Structure struct rec int ii int j; int a[3] int p i }*r; Ofset 0 nnt仁1jaoa]a2
7 Structure struct rec { int i; int j; int a[3]; int *p; } *r;

Structure P193 Copy element r->i to element r->j r is in register edx movl(edx),eax e七x->i 2 mov l eax 4(号edx) store in Ofset 0 ontents i 8a [0]a[1]a[2]
8 Structure P193 • Copy element r->i to element r->j: • r is in register %edx. 1 movl (%edx), %eax Get r->i 2 movl %eax, 4(%edx) Store in r->j

Structure P193 Generate the pointer &(r->a[1]) 工in各eax 立in各eax 11ea18(号eax,edx,4),.ecx岩ecx=正x a[了 Ofset 0 ontents i 8a [0]a[1]a[2]
9 Structure P193 • Generate the pointer &(r->a[1]) – r in %eax, – i in %edx 1 leal 8(%eax,%edx,4),%ecx %ecx = &r- >a[i]

Structure x->P=&r->a[r->i+x->j]; r in register号edx: 1m。v1 4(edx),各eax Get r->j 2 addl (岩edx),号eax Add r->i 31ea1 8(各edx,eax,4),号eax Compute cx->a[x-xi+x->元7 4 movl gear I 20(号edx) store in Ofset 0 ontents i 8a [0]a[1]a[2]
10 Structure • r->p = &r->a[r->i + r->j]; – r in register %edx: 1 movl 4(%edx), %eax Get r->j 2 addl (%edx), %eax Add r->i 3 leal 8(%edx,%eax,4), %eax Compute &r->a[r->i + r->j] 4 movl %eax, 20(%edx) Store in r->p
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Procedure Call and Array.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Machine-Level Representation of Programs Ⅱ.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Machine-Level Representation of Programs I.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Integer Operations; Floating Points.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Integer Representations.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Introduction to Computer Systems; Information is Bits+Context; Information Storage.ppt
- 复旦大学:《计算机原理 Computer System》课程资源_2006年期中考试题目.doc
- 复旦大学:《计算机原理 Computer System》课程资源_2006年期中考试答案.doc
- 复旦大学:《计算机原理 Computer System》课程资源_教学大纲.pdf
- 复旦大学:《计算机图形学》课后习题答案_7.docx
- 复旦大学:《计算机图形学》课后习题答案_6.docx
- 复旦大学:《计算机图形学》课后习题答案_5.docx
- 复旦大学:《计算机图形学》课后习题答案_4.docx
- 复旦大学:《计算机图形学》课后习题答案_3.docx
- 复旦大学:《计算机图形学》课后习题答案_2.docx
- 复旦大学:《计算机图形学》课后习题答案_1.docx
- 复旦大学:《电子商务》课程PPT课件_第十次课 社会化电子商务——Hold住社会化媒体营销.ppt
- 复旦大学:《电子商务》课程PPT课件_第六次课 电子商务运营与管理 Operating Your E-Business.ppt
- 复旦大学:《电子商务》课程PPT课件_第六次课 电子商务运营与管理 Getting Your E-Business Off The Ground.ppt
- 复旦大学:《电子商务》课程PPT课件_第八次课 电子商务模式与应用课程主题案例分析与展示——电子商务团购.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Processor Architecture.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_09、10 Sequential CPU Implementation.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Pipelined Implementation Part I.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Pipelined Implementation Part II.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_12b Code Optimization(• Machine-Independent Optimization – Code motion – Memory optimization • Suggested reading).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_13 Code Optimization(• Optimizing Blockers • Understanding Modern Processor • More Code Optimization techniques • Performance Tuning).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Hardware Organization.ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Memory Hierarchy(• Random-Access Memory(RAM)• Nonvolatile Memory • Disk Storage • Locality • Memory hierarchy).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Cache Memory(• General concepts • 3 ways to organize cache memory • Issues with writes • Write cache friendly codes • Cache mountain).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Cache Memory(• Cache mountain • Matrix multiplication).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Virtual Memory(• Virtual Space• Address translation • Accelerating translation• Different points of view).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Virtual Memory(• Multilevel page tables • Different points of view • Pentium/Linux Memory System • Memory Mapping).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Dynamic Memory Allocation(• Implementation of a simple allocator • Explicit Free List • Segregated Free List).ppt
- 复旦大学:《计算机原理 Computer System》课程PPT课件_Linking II(• Static linking • Symbols & Symbol Table • Relocation • Executable Object Files • Loading).ppt
- 复旦大学:《计算机原理 Computer System》习题PPT课件_chapter2.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_Chapter 3 Machine-Level Representation of Programs.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_Chapter 3 Machine-Level Representation of Programs.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_Chapter 3 Machine-Level(2)Representation of Programs.ppt
- 复旦大学:《计算机原理 Computer System》习题PPT课件_chapter4 Processor Architecture.pptx
- 复旦大学:《计算机原理 Computer System》习题PPT课件_chapter5 Optimizing Program Performance.pptx