Implementing Functions at the Machine Level

Total Page:16

File Type:pdf, Size:1020Kb

Implementing Functions at the Machine Level Subroutines/Functions A subroutine is a program fragment that. Resides in user space (i.e, not in OS) Performs a well-defined task Is invoked (called) by a user program Implementing Returns control to the calling program when finished Functions at the Virtues Machine Level Reuse useful code without having to keep typing it in (and debugging it!) Divide task amonggppg multiple programmers Use vendor-supplied library of useful routines Based on slides © McGraw-Hill Additional material © 2004/2005 Lewis/Martin Modified by Diana Palsetia CIT 593 1 CIT 593 2 LC3 Opcode for CALLING a Subroutine JSR JSR/JSRR – saves the return address in R7 and computes 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 the the starting address of the subroutine and loads it JSR 0 1 0 0 1 PCoffset11 Note: This is PC into PC of next instruction JSR 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 1 PC-relative mode (just like PC-relative LD/ST) PC 0100000000011001 d Register File Target address of the subroutine is incremented PC + offset BR 512 R0 IR 0100101000000000 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 R1 9 JSR R2 0 1 0 0 1 PCoffset11 R3 SEXT R4 16 16 R5 16 R6 c 0000001000000000 JSRR R7 0100000000011001 16 Base addressing mode B A ADD Target address of the subroutine is obtained from Base Register ALU 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Just like JMP (but PC is saved in R7) 16 16 JSRR 01000 0 0 BaseR 0 0 0 0 0 0 1 0 CIT 593 3 CIT 593 4 1 Returning From a Subroutine Example: 2’s complement routine Use RET .ORIG x3000 DoSomething1 •. Just a special case of JMP i.e. RET == JMP R7 •. •. •. ;need to compute R4 = R1 - R3 Note x3005 ADD R0, R3, #0 ; copy R3 to R0 x3006 JSR TwosComp ; negate If we use JMP to call subroutine instead of JSR/JSRR, x3007 ADD R4, R1, R0 ; add to R1 we can’t use RET to return from subroutine! x3008 BRz DoSomething2 Why not? TwosComp NOT R0, R0 ; R0 is the input to the routine ADD R0, R0, #1 ; add one RET ; return to caller Do Some thing 2 •. •. •. •. CIT 593 5 CIT 593 6 JSRR Information regarding Subroutines this zero means “register mode” How to Pass Information To/From? 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 In registers (simple, fast, but limited number) JSRR 01000 0 0 BaseR 0 0 0 0 0 0 ¾ E.g. R0 contains input and the return value is also place in R0 In memory (many, but expensive) Register File ¾ This is the stack implementation R0 JSRR R5 R1 Both IR 0100000101000000 R2 R3 R4 What should the User of the Function know? R5 000001000011000 Address: or at least a label that will be bound to its address R6 R7 0100010000011001 ¾In high-level we use the subroutine name 16 Function: what it does NtNote: ThiiPCfThis is PC of 16 ¾NOTE: The programmer does not need to know how the next instruction 16 1 0 subroutine works, but what changes are visible in the d 16 machine’s state after the routine has run 0000010000011000 Arguments: what they are and where they are placed PC 0100010000011001 Virtues of JSRR? c Return values: what they are and where they are placed CIT 593 7 CIT 593 8 2 Saving and Restoring Registers Location for argument(s) and return value Remember that any piece of code uses same set of machine registers Caller/Callee must agree on argument & return value location So we must maintain state of machine after the subroutine call Called routine ⇒ “callee-save” Approach 1 Before start , save register(s) that will be altered Every subroutine does what it likes (unless altered value is desired by calling program!) Program needs to look at documentation for each one Before return, restore those same register(s) Values are saved by storing them in memory Approach 2 Calling routine ⇒ “caller-save” Define a consistent calling convention If register value needed later, save register(s) calling the routine ¾ This is much harder as you may need to know the internal workings of a E.g. LC-3 argument/ret-val location fnctionfunction First 4 arguments passed in R0, R1, R2, R3 Single value returned in register other than R7 By convention, callee-saved Subsequent arguments passed in memory CIT 593 9 CIT 593 10 Example of Callee Save for subroutines Stack TwosComp: ;good to save R7 even if u don’t use it Concept ST R7, SAVER7;save R7 A last-in first-out (LIFO) storage structure ST R1, SAVER1;save R1 The first thing you put in is the last thing you take out NOOTR0, R0 ;R0 is the input to the routine The last thing you put in is the first thing you take out AND R1, R1, #0 Not like an array, where you can access any item based on an index ADD R1, R1, #1 ADD R0, R0,R1 Two main operations LD R7, SAVER7 ;restore R7 PUSH: add an item to the stack LD R1, SAVER1 POP: remove an item from the stack RET SAVER7: .FILL x0000 SAVER1: .FILL x0000 CIT 593 11 CIT 593 12 3 A Physical Stack A Software Stack implemented in Memory Coin holder Assume section x3FFFB to x3FFF in memory used for stack Data items don't move in memory, just our idea about where TOP of the stack is (a register is used to keep track of the location) 1995 1996 1998 1998 1982 x3FFB / / / / / / / / / / / / / / / / / / / / / / / 1982 1995 x3FFC / / / / / / / / / / / / 12 TOP 12 1995 x3FFD / / / / / / / / / / / / 5 5 x3FFE / / / / / / / / / / / / 31 31 TOP x3FFF / / / / / / 18 TOP 18 18 TOP x4000 R6x3FFF R6x3FFC R6x3FFE R6 Initial State After After Three After One Push More Pushes One Pop Initial State After After Three After One Push More Pushes Two Pops Last quarter in is the first quarter out (LIFO) By convention, in LC3 R6 holds the Top of Stack (TOS) pointer CIT 593 13 CIT 593 14 Basic Push and Pop Code What happens when we run out of space? Push Overflow ADD R6, R6, #-1 ; decrement stack ptr When we have no more locations and we try to push some data STR R0, R6, #0 ; store data contained in R0 on the stack Underflow The stack is empty and we try to pop the data Pop LDR R0, R6, #0 ; load data from TOS Some how the programmer needs to learn about the ADD R6, R6, #1 ; increment stack ptr overflow/underflow problem Java: Stack Overflow Note C: Segmentation fault Stacks can grow in either direction (toward higher address or toward lower addresses) CIT 593 15 CIT 593 16 4 POP routine w/ Underflow Detection General Implementation POP: LD R1, EMPTY ;R1 = -x4000 Some processors use three registers to track: ADD R2, R6, R1 ;R6 = Stack Pointer MAX Limit Stack Pointer (SP): contains addr of top of stack BRz Failure ;check whether R6 = x4000 /////// / / / / / LDR R0, R6, #0 ;POP value of the stack 8 SP ADD R6, R6, #1 ;update the stack pointer Stack Base: Contains the addr of the bottom location 12 RET BOTTOM Base Failure: AND R5, R5, #0 Stack Limit: contains the addr of the other end of the ADD R5, R5, #1 ;R5 = 1 indicates that the POP was stack (checks for PUSH error) ;not successful E.g. 3 entry stack RET Empty: .FILL xC000 ; - x4000 (stack limit) CIT 593 17 CIT 593 18 Uses of Stack Use: Passing arguments & return value in a subroutine Passing arguments & routines for subroutine calls Use the stack for arguments & return values instead of Instead passing them through registers registers To perform recursive subroutines Calling routine pushes arguments on the stack and calls the Allocatinggp space for local variables inside a subroutine subroutine Called routine pops the passed arguments from the stack and pushes any return value onto the stack Use as Temporary storage Finally, the calling routine then retrieves the return value(s) from Computers without registers store temporary values during the stack and continues execution computation on a stack Why would this be helpful? Interrupt I/O This is especially helpful if a subroutine has many arguments More when we do I/O Also stack is need for recursion CIT 593 19 CIT 593 20 5 Function Call scenario (Recursion Problem) Solution to Recursion problem Main . First call to Foo For each subroutine call, need a mechanism to distinguish JSR Foo SaveR7 contains address of Next its invocation Next . This is known as activation record HALT Second call to Foo SaveR7 contains address of After Activation Record contains Foo ST R7, SaveR7 Invocation-specific data (e.g., local variables, saved registers, AND R0, R0, #0 First return from Foo arguments and returns) . Returns to After JSR Foo Need to store this information per function call and discard when After . the function call is over LD R7, SaveR7 Second return from Foo RET Returns to After again!!! Stack data structure fits this description well Save7 .FILL #0 ¾When function is called we store (push) record on the stack Counter .FILL #0 ¾When function call is over we discard (pop) record from the stack .END CIT 593 21 CIT 593 22 Big Picture Complete view of an activation record Activation Record of a called function: Memory Memory Memory R5 1.
Recommended publications
  • Chapter 5 Names, Bindings, and Scopes
    Chapter 5 Names, Bindings, and Scopes 5.1 Introduction 198 5.2 Names 199 5.3 Variables 200 5.4 The Concept of Binding 203 5.5 Scope 211 5.6 Scope and Lifetime 222 5.7 Referencing Environments 223 5.8 Named Constants 224 Summary • Review Questions • Problem Set • Programming Exercises 227 CMPS401 Class Notes (Chap05) Page 1 / 20 Dr. Kuo-pao Yang Chapter 5 Names, Bindings, and Scopes 5.1 Introduction 198 Imperative languages are abstractions of von Neumann architecture – Memory: stores both instructions and data – Processor: provides operations for modifying the contents of memory Variables are characterized by a collection of properties or attributes – The most important of which is type, a fundamental concept in programming languages – To design a type, must consider scope, lifetime, type checking, initialization, and type compatibility 5.2 Names 199 5.2.1 Design issues The following are the primary design issues for names: – Maximum length? – Are names case sensitive? – Are special words reserved words or keywords? 5.2.2 Name Forms A name is a string of characters used to identify some entity in a program. Length – If too short, they cannot be connotative – Language examples: . FORTRAN I: maximum 6 . COBOL: maximum 30 . C99: no limit but only the first 63 are significant; also, external names are limited to a maximum of 31 . C# and Java: no limit, and all characters are significant . C++: no limit, but implementers often impose a length limitation because they do not want the symbol table in which identifiers are stored during compilation to be too large and also to simplify the maintenance of that table.
    [Show full text]
  • 7. Functions in PHP – II
    7. Functions in PHP – II Scope of variables in Function Scope of variable is the part of PHP script where the variable can be accessed or used. PHP supports three different scopes for a variable. These scopes are 1. Local 2. Global 3. Static A variable declared within the function has local scope. That means this variable is only used within the function body. This variable is not used outside the function. To demonstrate the concept, let us take an example. // local variable scope function localscope() { $var = 5; //local scope echo '<br> The value of $var inside the function is: '. $var; } localscope(); // call the function // using $var outside the function will generate an error echo '<br> The value of $var inside the function is: '. $var; The output will be: The value of $var inside the function is: 5 ( ! ) Notice: Undefined variable: var in H:\wamp\www\PathshalaWAD\function\function localscope demo.php on line 12 Call Stack # Time Memory Function Location 1 0.0003 240416 {main}( ) ..\function localscope demo.php:0 The value of $var inside the function is: Page 1 of 7 If a variable is defined outside of the function, then the variable scope is global. By default, a global scope variable is only available to code that runs at global level. That means, it is not available inside a function. Following example demonstrate it. <?php //variable scope is global $globalscope = 20; // local variable scope function localscope() { echo '<br> The value of global scope variable is :'.$globalscope; } localscope(); // call the function // using $var outside the function will generate an error echo '<br> The value of $globalscope outside the function is: '.
    [Show full text]
  • Object Lifetimes In
    Object Lifetimes in Tcl - Uses, Misuses, Limitations By Phil Brooks - Mentor – A Siemens Corporation Presented at the 25 nd annual Tcl/Tk conference, Houston Texas, November 2018 Mentor – A Siemens Corporation 8005 Boeckman Road Wilsonville, Oregon 97070 [email protected] Abstract: The management of the lifetime of an object in Tcl presents a number of unique challenges. In the C++ world, the technique of Resource Allocation is Initialization (RAII) is commonly used to control the lifetime of certain objects. With this technique, an object on the call stack is used to insure proper cleanup of a resource. When the object goes out of scope, the resource is released. It presents a low overhead mechanism for a garbage collection like facility without the complication of more complete garbage collection systems. Tcl doesn't have a similar direct capability, and the need for it has resulted in two techniques that are commonly used to substitute for the capability. The techniques are: 1) Use of the trace command to catch unset of a variable. 2) Mis-use of the lifetime of a Tcl_Obj created with Tcl_NewObj. Each of these techniques has drawbacks. The primary issue with the trace technique is that it requires the user of an object to arrange for explicit destruction of the object. This makes the interface more error prone. The mis-use of lifetime of a Tcl_Obj is subject to premature cleanup of the resource if the object is shimmered to a string for any reason. This paper surveys these lifetime management patterns and demonstrates the use of a new user level technique for lifetime management.
    [Show full text]
  • Declare Function Inside a Function Python
    Declare Function Inside A Function Python Transisthmian and praetorian Wye never ensphere helter-skelter when Shawn lord his nightshade. Larboard Hal rumors her dizziesacapnia very so encouragingly actinally. that Colbert aurifies very inferentially. Kenyan Tad reframes her botts so irefully that Etienne Closures prove to it efficient way something we took few functions in our code. Hope you have any mutable object. Calling Functions from Other Files Problem Solving with Python. What embassy your website look like? Then you can declare any result of a million developers have been loaded? The coach who asked this gas has marked it as solved. We focus group functions together can a Python module see modules and it this way lead our. What are Lambda Functions and How to Use Them? It working so art the result variable is only accessible inside the function in. Variables inside python node, learn more detail, regardless of instances of a program demonstrates it. The python function inside another, which start here, and beginners start out. Get code examples like python define a function within a function instantly right anytime your google search results with the Grepper Chrome. The function by replacing it contains one function start here are discussed: how do not provide extremely cost efficient as their name? How to the page helpful for case it requires you can declare python data science. Each item from the python function has arbitrary length arguments must first, but are only the output is simply the function to. We declare their perfomance varies with the gathered arguments using a wrapped the arguments does the computed fahrenheit to declare function inside a function python? List of python can declare a function inside a million other functions we declare function inside a function python.
    [Show full text]
  • Chapter 5. Using Tcl/Tk
    The Almagest 5-1 Chapter 5. Using Tcl/Tk Authors: Edward A. Lee Other Contributors: Brian L. Evans Wei-Jen Huang Alan Kamas Kennard White 5.1 Introduction Tcl is an interpreted “tool command language” designed by John Ousterhout while at UC Berkeley. Tk is an associated X window toolkit. Both have been integrated into Ptolemy. Parts of the graphical user interface and all of the textual interpreter ptcl are designed using them. Several of the stars in the standard star library also use Tcl/Tk. This chapter explains how to use the most basic of these stars, TclScript, as well how to design such stars from scratch. It is possible to define very sophisticated, totally customized user interfaces using this mechanism. In this chapter, we assume the reader is familiar with the Tcl language. Documentation is provided along with the Ptolemy distribution in the $PTOLEMY/tcltk/itcl/man direc- tory in Unix man page format. HTML format documentation is available from the other.src tar file in $PTOLEMY/src/tcltk. Up-to-date documentation and software releases are available by on the SunScript web page at http://www.sunscript.com. There is also a newsgroup called comp.lang.tcl. This news group accumulates a list of frequently asked questions about Tcl which is available http://www.teraform.com/%7Elvirden/tcl-faq/. The principal use of Tcl/Tk in Ptolemy is to customize the user interface. Stars can be created that interact with the user in specialized ways, by creating customized displays or by soliciting graphical inputs. 5.2 Writing Tcl/Tk scripts for the TclScript star Several of the domains in Ptolemy have a star called TclScript.
    [Show full text]
  • Coding 101: Learn Ruby in 15 Minutes Visit
    Coding 101: Learn Ruby in 15 minutes Visit www.makers.tech 1 Contents 2 Contents 10 Challenge 3 3 About us 11 Defining Methods 4 Installing Ruby 12 Challenge 4 4 Checking you’ve got Ruby 12 Challenge 5 5 Method calls 12 Challenge 6 5 Variables 13 Arrays 6 Truth and Falsehood 14 Hashes 7 Strings, objects and Methods 14 Challenge 7 8 Challenge 1 15 Iterations 8 Challenge 2 16 Challenge 8 9 Method Chaining 16 Challenge 9 10 Conditionals 18 Extra Challenges 2 About Us At Makers, we are creating a new generation of tech talent who are skilled and ready for the changing world of work. We are inspired by the idea of discovering and unlocking potential in people for the benefit of 21st century business and society. We believe in alternative ways to learn how to code, how to be ready for work and how to be of value to an organisation. At our core, Makers combines tech education with employment possibilities that transform lives. Our intensive four-month program (which includes a month-long PreCourse) sets you up to become a high quality professional software engineer. Makers is the only coding bootcamp with 5 years experience training software developers remotely. Your virtual experience will be exactly the same as Makers on-site, just delivered differently. If you’d like to learn more, check out www.makers.tech. 3 Installing Checking Ruby you’ve got Ruby You’ll be happy to know that Ruby comes preinstalled on all Apple computers. However we can’t simply use the system defaults - just in case we mess something up! Open the terminal on your computer and then type in If you’ve got your laptop set up already you can skip this section.
    [Show full text]
  • Function Components and Arguments Passing in Cpp
    FUNCTION COMPONENTS AND ARGUMENTS PASSING IN CPP The General Form of a Function The general form of a function is ret-type function-name(parameter list) { body of the function } The ret-type specifies the type of data that the function returns.Afunction may return any type of data except an array. The parameter list is a comma-separated list of variable names and their associated types that receive the values of the arguments when the function is called.Afunction may be without parameters, in which case the parameter list is empty. However, even if there are no parameters, the parentheses are still required. In variable declarations, you can declare many variables to be of a common type by using a comma- separated list of variable names. In contrast, all function parameters must be declared individually, each including both the type and name. That is, the parameter declaration list for a function takes this general form: f(type varname1, type varname2, . , type varnameN) For example, here are correct and incorrect function parameter declarations: f(int i, int k, int j) /* correct */ f(int i, k, float j) /* incorrect */ Scope Rules of Functions The scope rules of a language are the rules that govern whether a piece of code knows about or has access to another piece of code or data. Each function is a discrete block of code. Afunction's code is private to that function and cannot be accessed by any statement in any other function except through a call to that function. (For instance, you cannot use goto to jump into the middle of another function.) The code that constitutes the body of a function is hidden from the rest of the program and, unless it uses global variables or data, it can neither affect nor be affected by other parts of the program.
    [Show full text]
  • Subprograms: Local Variables
    Subprograms: Local Variables ICS312 Machine-Level and Systems Programming Henri Casanova ([email protected]) Local Variables in Subprograms In all the examples we have seen so far, the subprograms were able to do their work using only registers But sometimes, a subprogram’s needs are beyond the set of available registers and some data must be kept in memory Just think of all subprograms you wrote that used more than 6 local variables (EAX, EBX, ECX, EDX, ESI, EDI) One possibility could be to declare a small .bss segment for each subprogram, to reserve memory space for all local variables Drawback #1: memory waste This reserved memory consumes memory space for the entire duration of the execution even if the subprogram is only active for a tiny fraction of the execution time (or never!) Drawback #2: subprograms are not reentrant Re-entrant subprogram A subprogram is active if it has been called but the RET instruction hasn’t been executed yet A subprogram is reentrant if it can be called from anywhere in the program This implies that the program can call itself, directly or indirectly, which enables recursion e.g., f calls g, which calls h, which calls f At a given time, two or more instances of a subprogram can be active Two or more activation records for this subprogram on the stack If we store the local variables of a subprogram in the .bss segment, then there can only be one activation! Otherwise activation #2 could corrupt the local variables of the activation #1 Therefore, with our current scheme for storing local
    [Show full text]
  • Declare a Global Variable Js
    Declare A Global Variable Js Vocable Cy fizzled numbly, he counterplot his Hudibrastics very tragically. Rectified Plato always raffled his towelings if Deane is federal or botanizes thence. Is Morgan epidemiological or stringed when blames some fashioner plunder stodgily? The optimization of undefined at the global variables from a global variable Why Global Variables Should Be Avoided When Unnecessary. Global Variables Confluence Mobile Jitterbit Success Central. Expose Global Variables Methods and Modules in JavaScript. Var foo 'A' Global variable declaration function bar1 documentwritefoo. One and their declaration is a js mixin we are available. Print and current global object whose reading and function is a variable on one variable global. This js that declares a js files loaded into the web things that uses the project, and if we need before they provide an. Why are global variables bad? Why are global variables bad in CC Tutorialspoint. JavaScript global variables vs singletons by Shruti Kapoor. You actually define a variable in a function that embassy the same name are a global or lexical variable without modifying that variable var sandwich. Because military people setup jQuery in no conflict mode where fraud does not strip a variable. Declaring variables with var applies it convenient only 2 traditional scope Global and function scope Accessing a global variable is required a retention of times. Hcl will be accessible inside a subscription, for your files in one part at a js? Why are global and static objects evil? JavaScript global variables and the global object Dustin John. JavaScript has two scopes global and her Any variable declared outside running a function belongs to the global scope and community therefore.
    [Show full text]
  • Introduction to Computer Science and Programming in C
    Introduction to Computer Science and Programming in C Session 7: September 23, 2008 Columbia University Announcements Homework 1 due. Homework 2 out this afternoon. Due 10/7 2 Review Conditionals: if (<condition>) switch (variable) Loops: while (<condition>) for (<init>; <condition>; <count>) 3 Today Functions Variable Scope Recursion 4 Functions We’ve seen functions already int main() printf() But we can write our own functions too! 5 Function Syntax <return type> myFunction(<arguments>) { /* instructions to execute function */ } int multiply(int x, int,y) { return x*y; } Note: functions can return type void, which essentially means they return nothing, like printf() 6 Abstraction Revisited Functions allow us to abstract away algorithms Once a function is written and tested, you can forget about how it works. We can describe the logic at a higher level. 7 Example /* if we have three arrays A[10], B[10], C[10] */ /* Check if they are equal */ int check = 1; for (i=0; i<10; i++) { check = check && (A[i]==B[i]); } for (i=0; i<10; i++) { check = check && (B[i]==C[i]); } 8 Example int arrayEqual(int X[], int Y[], int N) { int i, check=1; for (i=0; i<N; i++) { check = check && (X[i]==Y[i]); } } /* main code */ int check; check = arrayEqual(A,B,10) && arrayEqual(B,C,10); 9 Scope float half(float x) scope - area of program where { variable is valid. return x/2; } global variable - variable is valid everywhere int main() { float x=10.0, y; local variable - only valid within block y = half(x); block – area of code enclosed /*what is x? ...*/ by {} x is 10 We have only been using local variables so far in class Global Variables Declared outside of any functions #include <stdio.h> int count; /* a global variable */ int someFunction() { ..
    [Show full text]
  • C Programming Tutorial
    C Programming Tutorial C PROGRAMMING TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i COPYRIGHT & DISCLAIMER NOTICE All the content and graphics on this tutorial are the property of tutorialspoint.com. Any content from tutorialspoint.com or this tutorial may not be redistributed or reproduced in any way, shape, or form without the written permission of tutorialspoint.com. Failure to do so is a violation of copyright laws. This tutorial may contain inaccuracies or errors and tutorialspoint provides no guarantee regarding the accuracy of the site or its contents including this tutorial. If you discover that the tutorialspoint.com site or this tutorial content contains some errors, please contact us at [email protected] ii Table of Contents C Language Overview .............................................................. 1 Facts about C ............................................................................................... 1 Why to use C ? ............................................................................................. 2 C Programs .................................................................................................. 2 C Environment Setup ............................................................... 3 Text Editor ................................................................................................... 3 The C Compiler ............................................................................................ 3 Installation on Unix/Linux ............................................................................
    [Show full text]
  • Specialising Dynamic Techniques for Implementing the Ruby Programming Language
    SPECIALISING DYNAMIC TECHNIQUES FOR IMPLEMENTING THE RUBY PROGRAMMING LANGUAGE A thesis submitted to the University of Manchester for the degree of Doctor of Philosophy in the Faculty of Engineering and Physical Sciences 2015 By Chris Seaton School of Computer Science This published copy of the thesis contains a couple of minor typographical corrections from the version deposited in the University of Manchester Library. [email protected] chrisseaton.com/phd 2 Contents List of Listings7 List of Tables9 List of Figures 11 Abstract 15 Declaration 17 Copyright 19 Acknowledgements 21 1 Introduction 23 1.1 Dynamic Programming Languages.................. 23 1.2 Idiomatic Ruby............................ 25 1.3 Research Questions.......................... 27 1.4 Implementation Work......................... 27 1.5 Contributions............................. 28 1.6 Publications.............................. 29 1.7 Thesis Structure............................ 31 2 Characteristics of Dynamic Languages 35 2.1 Ruby.................................. 35 2.2 Ruby on Rails............................. 36 2.3 Case Study: Idiomatic Ruby..................... 37 2.4 Summary............................... 49 3 3 Implementation of Dynamic Languages 51 3.1 Foundational Techniques....................... 51 3.2 Applied Techniques.......................... 59 3.3 Implementations of Ruby....................... 65 3.4 Parallelism and Concurrency..................... 72 3.5 Summary............................... 73 4 Evaluation Methodology 75 4.1 Evaluation Philosophy
    [Show full text]