Code Generation & Parameter Passing
|
|
|
- Pauline Harrell
- 9 years ago
- Views:
Transcription
1 Code Generation & Parameter Passing Lecture Outline 1. Allocating temporaries in the activation record Let s optimie our code generator a bit 2. A deeper look into calling sequences Caller/Callee responsibilities. Parameter passing mechanisms call-b-value, call-b-reference, call-b-value-result, call-b-name and call-b-need Compiler Design I (211) 2 Etra Material in the Appendi (not covered in lecture) 4. Code generation for OO languages Object memor laout Dnamic dispatch 5. Code generation of data structure references Address calculations Arra references 6. Code generation for logical epressions Short-circuiting An Optimiation: Temporaries in the Activation Record Topic 1 Compiler Design I (211)
2 Revie The stack machine has activation records and intermediate results interleaved on the stack The code generator must assign a location in the AR for each temporar Revie (Cont.) Advantage: Simple code generation Disadvantage: Slo code Storing/loading temporaries requires a store/load and $sp adjustment AR Temporaries AR Temporaries These get put here hen e evaluate compound epressions like e 1 + e 2 (need to store e 1 hile evaluating e 2 ) cgen(e 1 + e 2 ) = cgen(e 1 ) ; eval e 1 s $a ($sp) ; save its value addiu $sp $sp-4 ; adjust $sp (!) cgen(e 2 ) ; eval e 2 l $t1 4($sp) ; get e 1 add $a $t1 $a ; $a = e 1 + e 2 addiu $sp $sp-4 ; adjust $sp (!) Compiler Design I (211) 5 Compiler Design I (211) 6 An Optimiation Improved Code Idea: Predict ho $sp ill move at run time Do this prediction at compile time Move $sp to its limit, at the beginning The code generator must staticall assign a location in the AR for each temporar Old method cgen(e 1 + e 2 ) = cgen(e 1 ) s $a ($sp) addiu $sp $sp-4 cgen(e 2 ) l $t1 4($sp) add $a $t1 $a addiu $sp $sp-4 Ne idea cgen(e 1 + e 2 ) = cgen(e 1 ) s $a?($fp) staticall allocate cgen(e 2 ) l $t1?($fp) add $a $t1 $a Compiler Design I (211) 7 Compiler Design I (211) 8
3 Eample add(,,,) begin + ( + ( + ( + 42))) end What intermediate values are placed on the stack? Ho man slots are needed in the AR to hold these values? Ho Man Stack Slots? Let NS(e) = # of slots needed to evaluate e Includes slots for arguments to functions E.g: NS(e 1 + e 2 ) Needs at least as man slots as NS(e 1 ) Needs at least one slot to hold e 1, plus as man slots as NS(e 2 ), i.e. 1 + NS(e 2 ) Space used for temporaries in e 1 can be reused for temporaries in e 2 Compiler Design I (211) 9 Compiler Design I (211) 1 The Equations for Mini Bar NS(e 1 + e 2 ) = ma(ns(e 1 ), 1 + NS(e 2 )) NS(e 1 -e 2 ) = ma(ns(e 1 ), 1 + NS(e 2 )) NS(if e 1 = e 2 then e else e 4 ) = ma(ns(e 1 ), 1 + NS(e 2 ), NS(e ), NS(e 4 )) NS(f(e 1,,e n )) = ma(ns(e 1 ), 1 + NS(e 2 ), 2 + NS(e ),, (n-1) + NS(e n ), n) NS(int) = NS(id) = Rule for f(e 1,, e n ): Each time e evaluate an argument, e put it on the stack. The Revised Activation Record For a function definition f( 1,, n ) begin e end the AR has 2 + NS(e) elements Return address Frame pointer NS(e) locations for intermediate results Note that f s arguments are no considered to be part of its caller s AR Compiler Design I (211) 11 Compiler Design I (211) 12
4 Picture: Activation Record Revised Code Generation popped b callee FP FP 4 increasing values of addresses n... 1 Old FP Return Addr. Temp NS(e)... Temp 1 direction of stack groth pushed b caller saved b callee (this diagram disagrees slightl ith lecture 12: here, the callee saves FP) Code generation must kno ho man slots are in use at each point Add a ne argument to code generation: the position of the net available slot Compiler Design I (211) 1 Compiler Design I (211) 14 Improved Code Notes Old method cgen(e 1 + e 2 ) = cgen(e 1 ) s $a ($sp) addiu $sp $sp -4 cgen(e 2 ) l $t1 4($sp) add $a $t1 $a addiu $sp $sp 4 Ne method cgen(e 1 + e 2, ns) = cgen(e 1, ns) s $a ns($fp) static allocation cgen(e 2, ns+4) l $t1 ns($fp) add $a $t1 $a compile-time prediction The slots for temporar values are still used like a stack, but e predict usage at compile time This saves us from doing that ork at run time Allocate all needed slots at start of a function Eerc. Write some code hich runs sloer after performing the optimiation just presented Hint: Think about memor usage (& caches, etc.) Compiler Design I (211) 15 Compiler Design I (211) 16
5 Handling Procedure Calls and Returns A Deeper Look into Calling Sequences Topic 2 Calling sequence: a code sequence that sets up a procedure call allocates an activation record (model-dependent) loads actual parameters saves machine state (return address, etc.) transfers control to callee Return sequence: a code sequence that handles the return from a procedure call deallocates the activation record sets up return value (if an) restores machine state (stack pointer, PC, etc.) Compiler Design I (211) 18 Calling Sequences: Division of Responsibilities The code in a calling sequence is often divided up beteen the caller and the callee Calling sequence code caller callee If there are m calls to a procedure, the instructions in the caller s part of the calling sequence is repeated m times, hile the callee s part is repeated eactl once This suggests that e should tr to put as much of the calling sequence as possible in the callee Hoever, it ma be possible to carr out more callspecific optimiation b putting more of the code into the caller instead of the callee Calling Sequences: Laout Issues General rule of thumb: Fields that are fied earl, are placed near the middle of the activation record The caller has to evaluate the actual parameters, and retrieve the return value these fields should be located near the caller s activation record The callee has to fill in machine status fields so that the callee can restore state on return the caller should have eas access to this part of the callee s activation record Compiler Design I (211) 19 Compiler Design I (211) 2
6 Calling/Return Sequences: Tpical Actions Eample Activation Record: The SPARC Tpical calling sequence: 1. caller evaluates actuals; pushes them on the stack 2. caller saves machine status on the stack (in the callee s AR) and updates the stack pointer. caller transfers control to the callee 4. callee saves registers, initialies local data, and begins eecution Tpical return sequence: 1. callee stores return value in the appropriate place 2. callee restores registers and old stack pointer. callee branches to the return address Registers g-g7 global registers o-o7 outgoing args l-l7 local registers i-i7 incoming args function return address caller s o7/callee s i7 high addresses current fp caller s sp stack groth current sp callee s fp lo addresses caller s frame locals and temporaries outgoing args not in o-o5 space to save o-5 if necessar addr of return value space to save i-i7 and l-l7 if necessar callee s frame varies varies 6 ords 1 ord 16 ords Compiler Design I (211) 21 Compiler Design I (211) 22 Eample Activation Record: Intel 86 Eample Activation Record: MIPS R high addresses caller s frame incoming arguments high addresses caller s frame incoming arguments frame ptr ebp return address saved registers saved ebp stack groth locals and temporaries callee-save registers stack groth stack ptr locals and temporaries stack ptr outgoing arguments esp callee s frame $sp callee s frame lo addresses lo addresses Compiler Design I (211) 2 Compiler Design I (211) 24
7 Parameter Passing Mechanisms Parameter Passing Mechanisms There are man semantic issues in programming languages centering on hen values are computed, and the scopes of names Evaluation is the heart of computation Names are most primitive abstraction mechanism Topic We ill focus on parameter passing When are arguments of function calls evaluated? What are formal parameters bound to? Compiler Design I (211) 26 Parameter Passing Mechanisms (Cont.) First, an issue not discussed much Order of argument evaluation - Usuall not important for the eecution of a program Hoever, in languages that permit side-effects in call arguments, different evaluation orders ma give different results e.g. a call f(++,) in C A standard evaluation order is then specified C compilers tpicall evaluate their arguments right-to-left. Wh? Compiler Design I (211) 27 Call-b-value C uses call-b-value everhere (ecept macros...) Default mechanism in Pascal and in Ada callbvalue(int ) = + 1; print(); main() int = 42; callbvalue(); output: = 42 = 4 = 42 s value does not change hen s value is changed Compiler Design I (211) 28
8 Call-b-reference Call-b-reference can be faked ith pointers Available in C++ ith the & tpe constructor (and in Pascal ith the var keord) callbref(int &) = + 1; print(); main() int = 42; callbref(); output: = 42 = 4 = 4 s value changes hen s value is changed C++: C: callbref(int &) = + 1; print(); main() int = 42; callbref(); fakecallbref(int *) * = * + 1; print(*); must eplicitl pass the address of a local variable main() int = 42; fakecallbref(&); Compiler Design I (211) 29 Compiler Design I (211) Pointers to fake call-b-reference (cont.) It s not quite the same A pointer can be reassigned to point at something else; a C++ reference cannot The pointer itself as passed b value This is ho ou pass arras (the are implicitl pointers) and structures in C Call-b-value-result Available in Ada for in out parameters (code belo in C snta) callbvalueresult(int, int ) = + 1; = + 1; print(); print(); main() int = 42; callbvalueresult(, ); output: = 42 = 4 = 4 = 4 Note that s value is different from both using call-b-value and call-b-reference Compiler Design I (211) 1 Compiler Design I (211) 2
9 What about Java? Primitive tpes (int, boolean, etc.) are alas passed b value Objects are not quite -b-value nor -b-reference: If ou reassign an object reference, the caller s argument does not get reassigned (like -b-value) But if the object referred-to is modified, that modification is visible to the caller (like -breference) It s reall ordinar call-b-value ith pointers, but the pointers are not sntacticall obvious Compiler Design I (211) Implementing Parameter Passing Call-b b-value value (eas, no special compiler effort) The arguments are evaluated at the time of the call and the value parameters are copied and either behave as constant values during the eecution of the procedure (i.e., cannot be assigned to as in Ada), or are vieed as initialied local variables (in C or in Pascal) Call-b b-reference The arguments must have allocated memor locations The compiler passes the address of the variable, and the parameter becomes an alias for the argument Local accesses to the parameter are turned into indirect accesses Compiler Design I (211) 4 Implementing Parameter Passing (Cont.) Call-b b-value-result The arguments are evaluated at call time and the value parameters are copied (as in call-b-value) and used as a local variables The final values of these variables are copied back to the location of the arguments hen the procedure eits (note that the activation record cannot be freed b the callee!) Issues left unspecified: the order in hich the results are copied back hether the locations of the arguments are calculated onl on entr and stored, or hether the are recalculated on eit Compiler Design I (211) 5 Call-b-name Whole different ballgame: it s like passing the tet of the argument epression, unevaluated The tet of the argument is vieed as a function in its on right Also passes the environment, so free variables are still bound according to rules of static scoping The argument is not evaluated until it is actuall used, inside the callee Might not get evaluated at all! An optimied version of call-b-name is used in some functional languages (e.g. Haskell, Miranda, La-ML) under the names la evaluation (or call-b-need) Compiler Design I (211) 6
10 Call-b-name eample (in C++-Etra ) code + environment (env has just here) callbname(int closure ) eval print(); print(); // => print( = +1) both evals main() have side effects int = 42; callbname( [[ = +1 ]] ); closure output: = 42 = 4 = 44 = 44 s value changes hen is evaluated Code Generation for OO Languages Topic 4 (probabl not covered in lecture) Compiler Design I (211) 7 Object Laout Object-Oriented (OO) code generation and memor laout OO Slogan: If C (child) is a subclass of P (parent), then an instance of class C can be used herever an instance of class P is epected To Issues Ho are objects represented in memor? Ho is dnamic dispatch implemented? This means that P s methods should ork ith an instance of class C Compiler Design I (211) 9 Compiler Design I (211) 4
11 Object Representation Subclass Representation class P : Int <- ; : String <- "Hi"; : Int ; : Bool <- true; : String ; ; Wh method pointers? Wh the tag? self tag: P dnamic dispatch case Hi P.f: return self [1] true P.g: return self [2] self To call f: l $t1 12($s) jalr $t1 class P.. (same).. ; self class C inherits P : Int <- 42; // ne P : Int ; // override h( ) : Bool ; // ne ; C Idea: Append ne fields h( ) Hi overridden C.f: return self [6] true P.g: return self [2] 42 To call f: l $t1 12($s) jalr $t1 C.h: return self [4] inherited Compiler Design I (211) 41 Compiler Design I (211) 42 Subclasses (Cont.) The offset for an attribute is the same in a class and all of its subclasses An method for an A 1 can be used on a subclass A 2 Consider laout for A n < < A < A 2 < A 1 Header A 1 attrs A 2 attrs A attrs... A 1 object A 2 object A object What about multiple inheritance? What s the point? Simple Just append subclass fields Efficient Code can ignore dnamic tpe -- just act as if it is the static tpe Supports overriding of methods Just replace the appropriate dispatch pointers We implement tpe conformance (compile-time concept) ith representation conformance (run-time concept) Compiler Design I (211) 4 Compiler Design I (211) 44
12 An optimiation: Dispatch Tables Observation Consider instances of class C: C.f: return self [6] Ever instance of a given class has the same values for all of its method pointers h( ) h( ) h( ) Space optimiation: Put all method pointers for a given class into a common table, called the dispatch table Each instance has a pointer to the dispatch table C.h: return self [4] P.g: return self [2] Compiler Design I (211) 45 Compiler Design I (211) 46 Picture ith Dispatch Table Subclassing Again Consider again instances of C: dispptr Objects are smaller Dispatch is sloer dispptr dispptr C.f: return self [5] P.g: return self [] h( ) C.h: return self [4] minor point: the offsets have changed since e removed the method ptrs P.f: return self [2] call f: l $t1 4($s) l $t1 ($t1) jalr $t tag: P dispptr dispptr P.g: return self [] C.f: return self [5] h( ) C.h: return self [4] Compiler Design I (211) 47 Compiler Design I (211) 48
13 Real Object Laout Actuall, the first ords of objects contain header information: Needed for garbage collector Class Tag Object Sie Dispatch Ptr Attribute 1 Attribute 2... Offset (in btes) Summar of Dispatch Tables Pulled method pointers out, into separate table Makes objects smaller Makes (dnamic) dispatch sloer Q: Wh don t e do this for attributes? Eerc. Write some code that is sloer ith dispatch tables (instead of embedded method pointers) Eerc. Write some code that is faster ith dispatch tables Compiler Design I (211) 49 Compiler Design I (211) 5
Lecture Outline. Stack machines The MIPS assembly language. Code Generation (I)
Lecture Outline Code Generation (I) Stack machines The MIPS assembl language Adapted from Lectures b Profs. Ale Aiken and George Necula (UCB) A simple source language Stack- machine implementation of the
Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings: 9.1-9.
Code Generation I Stack machines The MIPS assembly language A simple source language Stack-machine implementation of the simple language Readings: 9.1-9.7 Stack Machines A simple evaluation model No variables
CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08
CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 20: Stack Frames 7 March 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Where We Are Source code if (b == 0) a = b; Low-level IR code
Organization of Programming Languages CS320/520N. Lecture 05. Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.
Organization of Programming Languages CS320/520N Razvan C. Bunescu School of Electrical Engineering and Computer Science [email protected] Names, Bindings, and Scopes A name is a symbolic identifier used
More MIPS: Recursion. Computer Science 104 Lecture 9
More MIPS: Recursion Computer Science 104 Lecture 9 Admin Homework Homework 1: graded. 50% As, 27% Bs Homework 2: Due Wed Midterm 1 This Wed 1 page of notes 2 Last time What did we do last time? 3 Last
Stack Allocation. Run-Time Data Structures. Static Structures
Run-Time Data Structures Stack Allocation Static Structures For static structures, a fixed address is used throughout execution. This is the oldest and simplest memory organization. In current compilers,
COMP 356 Programming Language Structures Notes for Chapter 10 of Concepts of Programming Languages Implementing Subprograms.
COMP 356 Programming Language Structures Notes for Chapter 10 of Concepts of Programming Languages Implementing Subprograms 1 Activation Records activation declaration location Recall that an activation
Comp 411 Principles of Programming Languages Lecture 34 Semantics of OO Languages. Corky Cartwright Swarat Chaudhuri November 30, 20111
Comp 411 Principles of Programming Languages Lecture 34 Semantics of OO Languages Corky Cartwright Swarat Chaudhuri November 30, 20111 Overview I In OO languages, data values (except for designated non-oo
Computer Systems Architecture
Computer Systems Architecture http://cs.nott.ac.uk/ txa/g51csa/ Thorsten Altenkirch and Liyang Hu School of Computer Science University of Nottingham Lecture 10: MIPS Procedure Calling Convention and Recursion
Chapter 7D The Java Virtual Machine
This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly
University of Twente. A simulation of the Java Virtual Machine using graph grammars
University of Twente Department of Computer Science A simulation of the Java Virtual Machine using graph grammars Master of Science thesis M. R. Arends, November 2003 A simulation of the Java Virtual Machine
language 1 (source) compiler language 2 (target) Figure 1: Compiling a program
CS 2112 Lecture 27 Interpreters, compilers, and the Java Virtual Machine 1 May 2012 Lecturer: Andrew Myers 1 Interpreters vs. compilers There are two strategies for obtaining runnable code from a program
Translating C code to MIPS
Translating C code to MIPS why do it C is relatively simple, close to the machine C can act as pseudocode for assembler program gives some insight into what compiler needs to do what's under the hood do
INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011
INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011 1 Goals of the Lecture Present an introduction to Objective-C 2.0 Coverage of the language will be INCOMPLETE
Compiling Object Oriented Languages. What is an Object-Oriented Programming Language? Implementation: Dynamic Binding
Compiling Object Oriented Languages What is an Object-Oriented Programming Language? Last time Dynamic compilation Today Introduction to compiling object oriented languages What are the issues? Objects
CS2210: Compiler Construction. Runtime Environment
Compiler s Role in Program Execution When a program is invoked 0x8000000 The OS allocates memory for the program The code is loaded into the main memory Program initializes runtime environment Program
Java Application Developer Certificate Program Competencies
Java Application Developer Certificate Program Competencies After completing the following units, you will be able to: Basic Programming Logic Explain the steps involved in the program development cycle
Machine-Code Generation for Functions
Machine-Code Generation for Functions Cosmin Oancea [email protected] University of Copenhagen December 2012 Structure of a Compiler Programme text Lexical analysis Binary machine code Symbol sequence
Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2
Lecture Handout Computer Architecture Lecture No. 2 Reading Material Vincent P. Heuring&Harry F. Jordan Chapter 2,Chapter3 Computer Systems Design and Architecture 2.1, 2.2, 3.2 Summary 1) A taxonomy of
Assembly Language: Function Calls" Jennifer Rexford!
Assembly Language: Function Calls" Jennifer Rexford! 1 Goals of this Lecture" Function call problems:! Calling and returning! Passing parameters! Storing local variables! Handling registers without interference!
Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA) * Instruction set architecture of a machine fills the semantic gap between the user and the machine. * ISA serves as the starting point for the design of a new machine
Java Programming. Binnur Kurt [email protected]. Istanbul Technical University Computer Engineering Department. Java Programming. Version 0.0.
Java Programming Binnur Kurt [email protected] Istanbul Technical University Computer Engineering Department Java Programming 1 Version 0.0.4 About the Lecturer BSc İTÜ, Computer Engineering Department,
X86-64 Architecture Guide
X86-64 Architecture Guide For the code-generation project, we shall expose you to a simplified version of the x86-64 platform. Example Consider the following Decaf program: class Program { int foo(int
Beam Deflections: 4th Order Method and Additional Topics
11 eam Deflections: 4th Order Method and dditional Topics 11 1 ecture 11: EM DEFECTIONS: 4TH ORDER METHOD ND DDITION TOICS TE OF CONTENTS age 11.1. Fourth Order Method Description 11 3 11.1.1. Example
1 The Java Virtual Machine
1 The Java Virtual Machine About the Spec Format This document describes the Java virtual machine and the instruction set. In this introduction, each component of the machine is briefly described. This
Summit Public Schools Summit, New Jersey Grade Level / Content Area: Mathematics Length of Course: 1 Academic Year Curriculum: AP Computer Science A
Summit Public Schools Summit, New Jersey Grade Level / Content Area: Mathematics Length of Course: 1 Academic Year Curriculum: AP Computer Science A Developed By Brian Weinfeld Course Description: AP Computer
INVESTIGATIONS AND FUNCTIONS 1.1.1 1.1.4. Example 1
Chapter 1 INVESTIGATIONS AND FUNCTIONS 1.1.1 1.1.4 This opening section introduces the students to man of the big ideas of Algebra 2, as well as different was of thinking and various problem solving strategies.
Software Engineering Techniques
Software Engineering Techniques Low level design issues for programming-in-the-large. Software Quality Design by contract Pre- and post conditions Class invariants Ten do Ten do nots Another type of summary
C3: Functions. Learning objectives
CHAPTER C3: Functions Learning objectives After studing this chapter ou should: be familiar with the terms one-one and man-one mappings understand the terms domain and range for a mapping understand the
Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas
CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage
CS-XXX: Graduate Programming Languages. Lecture 25 Multiple Inheritance and Interfaces. Dan Grossman 2012
CS-XXX: Graduate Programming Languages Lecture 25 Multiple Inheritance and Interfaces Dan Grossman 2012 Multiple Inheritance Why not allow class C extends C1,C2,...{...} (and C C1 and C C2)? What everyone
The Cool Reference Manual
The Cool Reference Manual Contents 1 Introduction 3 2 Getting Started 3 3 Classes 4 3.1 Features.............................................. 4 3.2 Inheritance............................................
Chapter 5 Names, Bindings, Type Checking, and Scopes
Chapter 5 Names, Bindings, Type Checking, and Scopes Chapter 5 Topics Introduction Names Variables The Concept of Binding Type Checking Strong Typing Scope Scope and Lifetime Referencing Environments Named
The C Programming Language course syllabus associate level
TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming
Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program
Free Java textbook available online "Thinking in Java" by Bruce Eckel, 4th edition, 2006, ISBN 0131872486, Pearson Education Introduction to the Java programming language CS 4354 Summer II 2014 Jill Seaman
Fundamentals of Java Programming
Fundamentals of Java Programming This document is exclusive property of Cisco Systems, Inc. Permission is granted to print and copy this document for non-commercial distribution and exclusive use by instructors
KITES TECHNOLOGY COURSE MODULE (C, C++, DS)
KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php [email protected] [email protected] Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL
Parameter passing in LISP
Parameter passing in LISP The actual parameters in a function call are always expressions, represented as lists structures. LISP provides two main methods of parameter passing: Pass/Call-by-value. The
Lecture 1 Introduction to Android
These slides are by Dr. Jaerock Kwon at. The original URL is http://kettering.jrkwon.com/sites/default/files/2011-2/ce-491/lecture/alecture-01.pdf so please use that instead of pointing to this local copy
Parameter Passing. Parameter Passing. Parameter Passing Modes in Fortran. Parameter Passing Modes in C
Parameter Passing In this set of notes you will learn about: Parameter passing modes Call by Call by reference Call by sharing Call by result Call by /result Call by name Subroutine closures as parameters
Compiler Construction
Compiler Construction Lecture 1 - An Overview 2003 Robert M. Siegfried All rights reserved A few basic definitions Translate - v, a.to turn into one s own language or another. b. to transform or turn from
The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. [email protected] Oct 2003 Presented to Gordon College CS 311
The Java Virtual Machine and Mobile Devices John Buford, Ph.D. [email protected] Oct 2003 Presented to Gordon College CS 311 Objectives Review virtual machine concept Introduce stack machine architecture
Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek
Instruction Set Architecture or How to talk to computers if you aren t in Star Trek The Instruction Set Architecture Application Compiler Instr. Set Proc. Operating System I/O system Instruction Set Architecture
02 B The Java Virtual Machine
02 B The Java Virtual Machine CS1102S: Data Structures and Algorithms Martin Henz January 22, 2010 Generated on Friday 22 nd January, 2010, 09:46 CS1102S: Data Structures and Algorithms 02 B The Java Virtual
Solving Systems of Linear Equations With Row Reductions to Echelon Form On Augmented Matrices. Paul A. Trogdon Cary High School Cary, North Carolina
Solving Sstems of Linear Equations With Ro Reductions to Echelon Form On Augmented Matrices Paul A. Trogdon Car High School Car, North Carolina There is no more efficient a to solve a sstem of linear equations
Where we are CS 4120 Introduction to Compilers Abstract Assembly Instruction selection mov e1 , e2 jmp e cmp e1 , e2 [jne je jgt ] l push e1 call e
0/5/03 Where we are CS 0 Introduction to Compilers Ross Tate Cornell University Lecture 8: Instruction Selection Intermediate code synta-directed translation reordering with traces Canonical intermediate
Lecture 1: Introduction
Programming Languages Lecture 1: Introduction Benjamin J. Keller Department of Computer Science, Virginia Tech Programming Languages Lecture 1 Introduction 2 Lecture Outline Preview History of Programming
Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program
Free Java textbook available online "Thinking in Java" by Bruce Eckel, 4th edition, 2006, ISBN 0131872486, Pearson Education Introduction to the Java programming language CS 4354 Summer II 2015 The third
Implementation Aspects of OO-Languages
1 Implementation Aspects of OO-Languages Allocation of space for data members: The space for data members is laid out the same way it is done for structures in C or other languages. Specifically: The data
Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters
Interpreters and virtual machines Michel Schinz 2007 03 23 Interpreters Interpreters Why interpreters? An interpreter is a program that executes another program, represented as some kind of data-structure.
Glossary of Object Oriented Terms
Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction
C++ INTERVIEW QUESTIONS
C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get
7.1 Our Current Model
Chapter 7 The Stack In this chapter we examine what is arguably the most important abstract data type in computer science, the stack. We will see that the stack ADT and its implementation are very simple.
An Introduction to Assembly Programming with the ARM 32-bit Processor Family
An Introduction to Assembly Programming with the ARM 32-bit Processor Family G. Agosta Politecnico di Milano December 3, 2011 Contents 1 Introduction 1 1.1 Prerequisites............................. 2
Chapter 5 Instructor's Manual
The Essentials of Computer Organization and Architecture Linda Null and Julia Lobur Jones and Bartlett Publishers, 2003 Chapter 5 Instructor's Manual Chapter Objectives Chapter 5, A Closer Look at Instruction
1 Posix API vs Windows API
1 Posix API vs Windows API 1.1 File I/O Using the Posix API, to open a file, you use open(filename, flags, more optional flags). If the O CREAT flag is passed, the file will be created if it doesnt exist.
Write Barrier Removal by Static Analysis
Write Barrier Removal by Static Analysis Karen Zee and Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology Cambridge, MA 02139 {kkz, [email protected] ABSTRACT We present
Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority)
Boolean Expressions, Conditions, Loops, and Enumerations Relational Operators == // true if two values are equivalent!= // true if two values are not equivalent < // true if left value is less than the
Habanero Extreme Scale Software Research Project
Habanero Extreme Scale Software Research Project Comp215: Java Method Dispatch Zoran Budimlić (Rice University) Always remember that you are absolutely unique. Just like everyone else. - Margaret Mead
C Compiler Targeting the Java Virtual Machine
C Compiler Targeting the Java Virtual Machine Jack Pien Senior Honors Thesis (Advisor: Javed A. Aslam) Dartmouth College Computer Science Technical Report PCS-TR98-334 May 30, 1998 Abstract One of the
Linear Inequality in Two Variables
90 (7-) Chapter 7 Sstems of Linear Equations and Inequalities In this section 7.4 GRAPHING LINEAR INEQUALITIES IN TWO VARIABLES You studied linear equations and inequalities in one variable in Chapter.
Winter 2002 MID-SESSION TEST Friday, March 1 6:30 to 8:00pm
University of Calgary Department of Electrical and Computer Engineering ENCM 369: Computer Organization Instructors: Dr. S. A. Norman (L01) and Dr. S. Yanushkevich (L02) Winter 2002 MID-SESSION TEST Friday,
Functional Programming
FP 2005 1.1 3 Functional Programming WOLFRAM KAHL [email protected] Department of Computing and Software McMaster University FP 2005 1.2 4 What Kinds of Programming Languages are There? Imperative telling
EVALUATION. WA1844 WebSphere Process Server 7.0 Programming Using WebSphere Integration COPY. Developer
WA1844 WebSphere Process Server 7.0 Programming Using WebSphere Integration Developer Web Age Solutions Inc. USA: 1-877-517-6540 Canada: 1-866-206-4644 Web: http://www.webagesolutions.com Chapter 6 - Introduction
- Applet java appaiono di frequente nelle pagine web - Come funziona l'interprete contenuto in ogni browser di un certo livello? - Per approfondire
- Applet java appaiono di frequente nelle pagine web - Come funziona l'interprete contenuto in ogni browser di un certo livello? - Per approfondire il funzionamento della Java Virtual Machine (JVM): -
Affine Transformations
A P P E N D I X C Affine Transformations CONTENTS C The need for geometric transformations 335 C2 Affine transformations 336 C3 Matri representation of the linear transformations 338 C4 Homogeneous coordinates
Computer Organization and Architecture
Computer Organization and Architecture Chapter 11 Instruction Sets: Addressing Modes and Formats Instruction Set Design One goal of instruction set design is to minimize instruction length Another goal
Moving from CS 61A Scheme to CS 61B Java
Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you
Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine
Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine This is a limited version of a hardware implementation to execute the JAVA programming language. 1 of 23 Structured Computer
Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.
Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java
CSCI 3136 Principles of Programming Languages
CSCI 3136 Principles of Programming Languages Faculty of Computer Science Dalhousie University Winter 2013 CSCI 3136 Principles of Programming Languages Faculty of Computer Science Dalhousie University
Inside the Java Virtual Machine
CS1Bh Practical 2 Inside the Java Virtual Machine This is an individual practical exercise which requires you to submit some files electronically. A system which measures software similarity will be used
CSCI 253. Object Oriented Programming (OOP) Overview. George Blankenship 1. Object Oriented Design: Java Review OOP George Blankenship.
CSCI 253 Object Oriented Design: Java Review OOP George Blankenship George Blankenship 1 Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation Abstract Data Type (ADT) Implementation
Semantic Analysis: Types and Type Checking
Semantic Analysis Semantic Analysis: Types and Type Checking CS 471 October 10, 2007 Source code Lexical Analysis tokens Syntactic Analysis AST Semantic Analysis AST Intermediate Code Gen lexical errors
PART IV Performance oriented design, Performance testing, Performance tuning & Performance solutions. Outline. Performance oriented design
PART IV Performance oriented design, Performance testing, Performance tuning & Performance solutions Slide 1 Outline Principles for performance oriented design Performance testing Performance tuning General
Instruction Set Design
Instruction Set Design Instruction Set Architecture: to what purpose? ISA provides the level of abstraction between the software and the hardware One of the most important abstraction in CS It s narrow,
Tutorial on C Language Programming
Tutorial on C Language Programming Teodor Rus [email protected] The University of Iowa, Department of Computer Science Introduction to System Software p.1/64 Tutorial on C programming C program structure:
Lecture 7: Class design for security
Lecture topics Class design for security Visibility of classes, fields, and methods Implications of using inner classes Mutability Design for sending objects across JVMs (serialization) Visibility modifiers
A3 Computer Architecture
A3 Computer Architecture Engineering Science 3rd year A3 Lectures Prof David Murray [email protected] www.robots.ox.ac.uk/ dwm/courses/3co Michaelmas 2000 1 / 1 6. Stacks, Subroutines, and Memory
Overview. CISC Developments. RISC Designs. CISC Designs. VAX: Addressing Modes. Digital VAX
Overview CISC Developments Over Twenty Years Classic CISC design: Digital VAX VAXÕs RISC successor: PRISM/Alpha IntelÕs ubiquitous 80x86 architecture Ð 8086 through the Pentium Pro (P6) RJS 2/3/97 Philosophy
Keil C51 Cross Compiler
Keil C51 Cross Compiler ANSI C Compiler Generates fast compact code for the 8051 and it s derivatives Advantages of C over Assembler Do not need to know the microcontroller instruction set Register allocation
Instruction Set Architecture
Instruction Set Architecture Consider x := y+z. (x, y, z are memory variables) 1-address instructions 2-address instructions LOAD y (r :=y) ADD y,z (y := y+z) ADD z (r:=r+z) MOVE x,y (x := y) STORE x (x:=r)
C++FA 5.1 PRACTICE MID-TERM EXAM
C++FA 5.1 PRACTICE MID-TERM EXAM This practicemid-term exam covers sections C++FA 1.1 through C++FA 1.4 of C++ with Financial Applications by Ben Van Vliet, available at www.benvanvliet.net. 1.) A pointer
Checking Access to Protected Members in the Java Virtual Machine
Checking Access to Protected Members in the Java Virtual Machine Alessandro Coglio Kestrel Institute 3260 Hillview Avenue, Palo Alto, CA 94304, USA Ph. +1-650-493-6871 Fax +1-650-424-1807 http://www.kestrel.edu/
1 Introduction. 2 An Interpreter. 2.1 Handling Source Code
1 Introduction The purpose of this assignment is to write an interpreter for a small subset of the Lisp programming language. The interpreter should be able to perform simple arithmetic and comparisons
Semester Review. CSC 301, Fall 2015
Semester Review CSC 301, Fall 2015 Programming Language Classes There are many different programming language classes, but four classes or paradigms stand out:! Imperative Languages! assignment and iteration!
Instruction Set Architecture (ISA) Design. Classification Categories
Instruction Set Architecture (ISA) Design Overview» Classify Instruction set architectures» Look at how applications use ISAs» Examine a modern RISC ISA (DLX)» Measurement of ISA usage in real computers
picojava TM : A Hardware Implementation of the Java Virtual Machine
picojava TM : A Hardware Implementation of the Java Virtual Machine Marc Tremblay and Michael O Connor Sun Microelectronics Slide 1 The Java picojava Synergy Java s origins lie in improving the consumer
Illustration 1: Diagram of program function and data flow
The contract called for creation of a random access database of plumbing shops within the near perimeter of FIU Engineering school. The database features a rating number from 1-10 to offer a guideline
Crash Course in Java
Crash Course in Java Based on notes from D. Hollinger Based in part on notes from J.J. Johns also: Java in a Nutshell Java Network Programming and Distributed Computing Netprog 2002 Java Intro 1 What is
LESSON EIII.E EXPONENTS AND LOGARITHMS
LESSON EIII.E EXPONENTS AND LOGARITHMS LESSON EIII.E EXPONENTS AND LOGARITHMS OVERVIEW Here s what ou ll learn in this lesson: Eponential Functions a. Graphing eponential functions b. Applications of eponential
Code Refactoring and Defects
Code Refactoring and Defects Reusing this material This work is licensed under a Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License. http://creativecommons.org/licenses/by-nc-sa/4.0/deed.en_us
Course Title: Software Development
Course Title: Software Development Unit: Customer Service Content Standard(s) and Depth of 1. Analyze customer software needs and system requirements to design an information technology-based project plan.
Central Processing Unit (CPU)
Central Processing Unit (CPU) CPU is the heart and brain It interprets and executes machine level instructions Controls data transfer from/to Main Memory (MM) and CPU Detects any errors In the following
Functional Programming. Functional Programming Languages. Chapter 14. Introduction
Functional Programming Languages Chapter 14 Introduction Functional programming paradigm History Features and concepts Examples: Lisp ML 1 2 Functional Programming Functional Programming Languages The
