Specialising Dynamic Techniques for Implementing the Ruby Programming Language

Total Page:16

File Type:pdf, Size:1020Kb

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 and Goals.................. 75 4.2 Benchmarking Language Implementations............. 80 4.3 Statistical Techniques......................... 84 4.4 Completeness............................. 90 4.5 Benchmarks Used........................... 94 4.6 Benchmark Harnesses......................... 95 4.7 Repeatability of Results....................... 96 4.8 Summary............................... 99 5 Optimising Metaprogramming in Dynamic Languages 101 5.1 Introduction.............................. 101 5.2 Metaprogramming.......................... 102 5.3 Existing Implementations...................... 102 5.4 Dispatch Chains............................ 103 5.5 Implementation............................ 106 5.6 Application In Ruby......................... 107 5.7 Evaluation............................... 108 5.8 Summary............................... 110 6 Optimising Debugging of Dynamic Languages 115 6.1 Introduction.............................. 115 6.2 Ruby Debuggers............................ 117 6.3 A Prototype Debugger........................ 120 6.4 Debug Nodes............................. 121 6.5 Implementation............................ 128 6.6 Evaluation............................... 134 6.7 Related Work............................. 141 6.8 Summary............................... 142 4 7 Safepoints in Dynamic Language Implementation 145 7.1 Introduction.............................. 145 7.2 Safepoints............................... 148 7.3 Guest-Language Safepoints...................... 150 7.4 Applications of Safepoints in Ruby................. 152 7.5 Implementation............................ 155 7.6 Evaluation............................... 160 7.7 Summary............................... 167 8 Interpretation of Native Extensions for Dynamic Languages 169 8.1 Introduction.............................. 169 8.2 Existing Solutions........................... 171 8.3 TruffleC................................ 173 8.4 Language Interoperability on Top of Truffle............ 173 8.5 Implementation of the Ruby C API................. 180 8.6 Expressing Pointers to Managed Objects.............. 183 8.7 Memory Operations on Managed Objects.............. 184 8.8 Limitations.............................. 185 8.9 Cross-Language Optimisations.................... 185 8.10 Evaluation............................... 186 8.11 Interfacing To Native Libraries................... 191 8.12 Summary............................... 191 9 Conclusions 195 A Dataflow and Transactions for Dynamic Parallelism 197 A.1 Introduction.............................. 197 A.2 Irregular Parallelism......................... 198 A.3 Dataflow................................ 198 A.4 Transactions.............................. 199 A.5 Lee's Algorithm............................ 200 A.6 Implementation............................ 203 A.7 Analysis................................ 207 A.8 Further Work............................. 211 A.9 Summary............................... 212 5 B Benchmarks 213 B.1 Synthetic Benchmarks........................ 213 B.2 Production Benchmarks....................... 214 Bibliography 217 Word Count: 53442 6 List of Listings 2.1 Active Support's adding the sum method to the existing Enumerable class.................................. 38 2.2 Active Support's overwriting the <=> method to the existing DateTime class.................................. 38 2.3 Active Support's IncludeWithRange using a metaprogramming send 39 2.4 include? from Listing 2.3 rewritten to use conventional calls... 40 2.5 Active Support using introspection on an object before attempting a call which may fail......................... 40 2.6 Chunky PNG routine using send to choose a method based on input 41 2.7 PSD.rb forwarding methods using metaprogramming....... 42 2.8 Active Support's Duration forwarding method calls to Time ... 43 2.9 Active Support's delegate method dynamically creating a method to avoid metaprogramming (simplified)............... 44 2.10 Active Record's define_method_attribute method dynamically creating a getter for a database column (simplified)........ 44 2.11 PSD.rb's clamp in pure Ruby.................... 45 2.12 PSD Native's clamp in C using the Ruby extension API..... 45 2.13 A benchmark indicative of patterns found in PSD.rb....... 50 2.14 A sub-view of machine code resulting from Listing 2.13...... 50 5.1 JRuby's implementation of send (simplified)............. 103 5.2 Rubinius's implementation of send.................. 103 5.3 JRuby+Truffle’s implementation of dispatch chain nodes (simpli- fied)................................... 112 5.4 JRuby+Truffle’s implementation of a conventional method call (simplified)............................... 113 5.5 JRuby+Truffle’s implementation of send (simplified)........ 113 6.1 An example use of Ruby's set trace func method........ 118 7 6.2 stdlib-debug using set trace func to create a debugger (simplified)119 6.3 Example Ruby code.......................... 121 6.4 Example command to install a line breakpoint........... 126 6.5 Implementation of CyclicAssumption (simplified)......... 133 7.1 An example use of Ruby's ObjectSpace.each_object method.. 146 7.2 Sketch of an API for safepoints................... 151 7.3 Example locations for a call to poll() ............... 151 7.4 Using guest-language safepoints to implement each_object ... 153 7.5 Using guest-language safepoints to implement Thread.kill ... 153 7.6 Safepoint action to print stack backtraces.............. 154 7.7 Safepoint action to enter a debugger................ 155 7.8 Simple implementation of guest-language safepoints using a volatile flag................................... 156 7.9 Implementation of guest-language safepoints with an Assumption. 157 7.10 Example code for detailed analysis of the generated machine code. 162 7.11 Generated machine code for the api, removed and switchpoint safe- point configurations.......................... 163 7.12 Generated machine code for the volatile safepoint configuration.. 164 8.1 Function to store a value into an array as part of the Ruby API.. 170 8.2 Excerpt of the ruby.h implementation................ 181 8.3 Calling rb ary store from C..................... 182 8.4 IRB session using TruffleC inline to call a library routine...... 191 A.1 Parallel Lee's algorithm using a global SyncVar .......... 204 A.2 Parallel Lee's algorithm using transactional memory........ 205 A.3 Parallel Lee's algorithm using DFScala............... 206 8 List of Tables 6.1 Overhead of set trace func .................... 136 6.2 Overhead of setting a breakpoint on a line never taken (lower is better)................................. 138 6.3 Overhead of setting breakpoint with a constant condition (lower is better)................................. 139 6.4 Overhead of setting breakpoint with a simple condition (lower is better)................................. 140 6.5 Summary of overheads (lower is better)............... 140 A.1 Mean algorithm running time (seconds)............... 208 A.2 Whole program running time on 8 hardware threads (seconds).. 209 A.3 Code metrics............................. 209 9 10 List of Figures 1.1 Recommended minimum chapter reading order........... 33 2.1 A sub-view ofIR resulting from Listing 2.13............ 47 2.2 Performance of the Acid Test benchmark in existing implementa- tions of Ruby............................. 48 2.3 Performance of the Acid Test benchmark in JRuby+Truffle.... 48 3.1 Self-optimising ASTs in Truffle [114]................ 61 3.2 Graal and Truffle deoptimising from optimised machine code back to the AST, and re-optimising [114]................. 63 3.3 Summary performance of different Ruby implementations on all of our benchmarks............................ 69 3.4 Summary performance of different Ruby implementations on all of our benchmarks, excluding JRuby+Truffle............. 69 3.5 Summary performance of historical versions of MRI on all of our benchmarks.............................. 70 3.6 Summary performance of JRuby with invokedynamic ....... 70 4.1 Example
Recommended publications
  • Application-Level Virtual Memory for Object-Oriented Systems Mariano Martinez Peck
    Application-Level Virtual Memory for Object-Oriented Systems Mariano Martinez Peck To cite this version: Mariano Martinez Peck. Application-Level Virtual Memory for Object-Oriented Systems. Program- ming Languages [cs.PL]. Université des Sciences et Technologie de Lille - Lille I, 2012. English. tel-00764991 HAL Id: tel-00764991 https://tel.archives-ouvertes.fr/tel-00764991 Submitted on 26 Dec 2012 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. N° d’ordre : 40886 THESE présentée en vue d’obtenir le grade de DOCTEUR en Spécialité : informatique par Mariano MARTINEZ PECK DOCTORAT DELIVRE CONJOINTEMENT PAR MINES DOUAI ET L’UNIVERSITE DE LILLE 1 Titre de la thèse : Application-Level Virtual Memory for Object-Oriented Systems Soutenue le 29/10/2012 à 10h devant le jury d’examen : Président Jean-Bernard STEFANI (Directeur de recherche – INRIA Grenoble- Rhône-Alpes) Directeur de thèse Stéphane DUCASSE (Directeur de recherche – INRIA Lille) Rapporteur Robert HIRSCHFELD (Professeur – Hasso-Plattner-Institut, Universität Potsdam, Allemagne) Rapporteur Christophe DONY (Professeur – Université Montpellier 2) Examinateur Roel WUYTS (Professeur – IMEC & Katholieke Universiteit Leuven, Belgique) co-Encadrant Noury BOURAQADI (Maître-Assistant – Mines de Douai) co-Encadrant Marcus DENKER (Chargé de recherche – INRIA Lille) co-Encadrant Luc FABRESSE (Maître-Assistant – Mines de Douai) Laboratoire(s) d’accueil : Dépt.
    [Show full text]
  • Visualage for Smalltalk Handbook Volume 2: Features
    SG24-2219-00 VisualAge for Smalltalk Handbook Volume 2: Features September 1997 SG24-2219-00 International Technical Support Organization VisualAge for Smalltalk Handbook Volume 2: Features September 1997 IBM Take Note! Before using this information and the product it supports, be sure to read the general information in Appendix A, “Special Notices.” First Edition (September 1997) This edition applies to VisualAge for Smalltalk, Versions 2, 3, and 4, for use with OS/2, AIX, and Microsoft Windows 95/NT. Comments may be addressed to: IBM Corporation, International Technical Support Organization Dept. QXXE Building 80-E2 650 Harry Road San Jose, California 95120-6099 When you send information to IBM, you grant IBM a non-exclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you. Copyright International Business Machines Corporation 1997. All rights reserved. Note to U.S. Government Users — Documentation related to restricted rights — Use, duplication or disclosure is subject to restrictions set forth in GSA ADP Schedule Contract with IBM Corp. Contents Preface . xiii How This Redbook Is Organized ....................... xiv ITSO on the Internet ................................ xv VisualAge Support on CompuServe ..................... xvii About the Authors ................................ xvii Acknowledgments . xviii Comments Welcome . xix Chapter 1. AS/400 Connection . 1 Multiple Programs with a Single Remote Procedure Call ......... 1 RPC Part Sets Commit Boundary ........................ 1 Connection Problem with V3R1 ......................... 2 AS/400 Communication Error .......................... 2 Strange Characters on Log-on Window .................... 3 Quick Form from AS/400 Record Classes ................... 3 Communication . 4 Read Next/Previous . 4 SQL Statements . 5 Data Queues and Records ............................ 6 ODBC Requirements .
    [Show full text]
  • Ironpython in Action
    IronPytho IN ACTION Michael J. Foord Christian Muirhead FOREWORD BY JIM HUGUNIN MANNING IronPython in Action Download at Boykma.Com Licensed to Deborah Christiansen <[email protected]> Download at Boykma.Com Licensed to Deborah Christiansen <[email protected]> IronPython in Action MICHAEL J. FOORD CHRISTIAN MUIRHEAD MANNING Greenwich (74° w. long.) Download at Boykma.Com Licensed to Deborah Christiansen <[email protected]> For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact Special Sales Department Manning Publications Co. Sound View Court 3B fax: (609) 877-8256 Greenwich, CT 06830 email: [email protected] ©2009 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15% recycled and processed without the use of elemental chlorine.
    [Show full text]
  • Pexpect Documentation Release 4.8
    Pexpect Documentation Release 4.8 Noah Spurrier and contributors Apr 17, 2021 Contents 1 Installation 3 1.1 Requirements...............................................3 2 API Overview 5 2.1 Special EOF and TIMEOUT patterns..................................6 2.2 Find the end of line – CR/LF conventions................................6 2.3 Beware of + and * at the end of patterns.................................7 2.4 Debugging................................................8 2.5 Exceptions................................................8 2.6 Pexpect on Windows...........................................9 3 API documentation 11 3.1 Core pexpect components........................................ 11 3.2 fdpexpect - use pexpect with a file descriptor.............................. 23 3.3 popen_spawn - use pexpect with a piped subprocess.......................... 23 3.4 replwrap - Control read-eval-print-loops................................. 24 3.5 pxssh - control an SSH session...................................... 25 4 Examples 33 5 FAQ 35 6 Common problems 39 6.1 Threads.................................................. 39 6.2 Timing issue with send() and sendline()................................. 39 6.3 Truncated output just before child exits................................. 40 6.4 Controlling SSH on Solaris....................................... 40 6.5 child does not receive full input, emits BEL............................... 40 7 History 41 7.1 Releases................................................. 41 7.2 Moves and forks............................................
    [Show full text]
  • Ajuba Solutions Version 1.4 COPYRIGHT Copyright © 1998-2000 Ajuba Solutions Inc
    • • • • • • Ajuba Solutions Version 1.4 COPYRIGHT Copyright © 1998-2000 Ajuba Solutions Inc. All rights reserved. Information in this document is subject to change without notice. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means electronic or mechanical, including but not limited to photocopying or recording, for any purpose other than the purchaser’s personal use, without the express written permission of Ajuba Solutions Inc. Ajuba Solutions Inc. 2593 Coast Avenue Mountain View, CA 94043 U.S.A http://www.ajubasolutions.com TRADEMARKS TclPro and Ajuba Solutions are trademarks of Ajuba Solutions Inc. Other products and company names not owned by Ajuba Solutions Inc. that appear in this manual may be trademarks of their respective owners. ACKNOWLEDGEMENTS Michael McLennan is the primary developer of [incr Tcl] and [incr Tk]. Jim Ingham and Lee Bernhard handled the Macintosh and Windows ports of [incr Tcl] and [incr Tk]. Mark Ulferts is the primary developer of [incr Widgets], with other contributions from Sue Yockey, John Sigler, Bill Scott, Alfredo Jahn, Bret Schuhmacher, Tako Schotanus, and Kris Raney. Mark Diekhans and Karl Lehenbauer are the primary developers of Extended Tcl (TclX). Don Libes is the primary developer of Expect. TclPro Wrapper incorporates compression code from the Info-ZIP group. There are no extra charges or costs in TclPro due to the use of this code, and the original compression sources are freely available from http://www.cdrom.com/pub/infozip or ftp://ftp.cdrom.com/pub/infozip. NOTE: TclPro is packaged on this CD using Info-ZIP’s compression utility.
    [Show full text]
  • Functional Languages
    Functional Programming Languages (FPL) 1. Definitions................................................................... 2 2. Applications ................................................................ 2 3. Examples..................................................................... 3 4. FPL Characteristics:.................................................... 3 5. Lambda calculus (LC)................................................. 4 6. Functions in FPLs ....................................................... 7 7. Modern functional languages...................................... 9 8. Scheme overview...................................................... 11 8.1. Get your own Scheme from MIT...................... 11 8.2. General overview.............................................. 11 8.3. Data Typing ...................................................... 12 8.4. Comments ......................................................... 12 8.5. Recursion Instead of Iteration........................... 13 8.6. Evaluation ......................................................... 14 8.7. Storing and using Scheme code ........................ 14 8.8. Variables ........................................................... 15 8.9. Data types.......................................................... 16 8.10. Arithmetic functions ......................................... 17 8.11. Selection functions............................................ 18 8.12. Iteration............................................................. 23 8.13. Defining functions ...........................................
    [Show full text]
  • MANNING Greenwich (74° W
    Object Oriented Perl Object Oriented Perl DAMIAN CONWAY MANNING Greenwich (74° w. long.) For electronic browsing and ordering of this and other Manning books, visit http://www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact: Special Sales Department Manning Publications Co. 32 Lafayette Place Fax: (203) 661-9018 Greenwich, CT 06830 email: [email protected] ©2000 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Library of Congress Cataloging-in-Publication Data Conway, Damian, 1964- Object oriented Perl / Damian Conway. p. cm. includes bibliographical references. ISBN 1-884777-79-1 (alk. paper) 1. Object-oriented programming (Computer science) 2. Perl (Computer program language) I. Title. QA76.64.C639 1999 005.13'3--dc21 99-27793 CIP Manning Publications Co. Copyeditor: Adrianne Harun 32 Lafayette
    [Show full text]
  • The Early History of Smalltalk
    The Early History of Smalltalk http://www.accesscom.com/~darius/EarlyHistoryS... The Early History of Smalltalk Alan C. Kay Apple Computer [email protected]# Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise, or to republish, requires a fee and/or specific permission. HOPL-II/4/93/MA, USA © 1993 ACM 0-89791-571-2/93/0004/0069...$1.50 Abstract Most ideas come from previous ideas. The sixties, particularly in the ARPA community, gave rise to a host of notions about "human-computer symbiosis" through interactive time-shared computers, graphics screens and pointing devices. Advanced computer languages were invented to simulate complex systems such as oil refineries and semi-intelligent behavior. The soon-to- follow paradigm shift of modern personal computing, overlapping window interfaces, and object-oriented design came from seeing the work of the sixties as something more than a "better old thing." This is, more than a better way: to do mainframe computing; for end-users to invoke functionality; to make data structures more abstract. Instead the promise of exponential growth in computing/$/volume demanded that the sixties be regarded as "almost a new thing" and to find out what the actual "new things" might be. For example, one would compute with a handheld "Dynabook" in a way that would not be possible on a shared mainframe; millions of potential users meant that the user interface would have to become a learning environment along the lines of Montessori and Bruner; and needs for large scope, reduction in complexity, and end-user literacy would require that data and control structures be done away with in favor of a more biological scheme of protected universal cells interacting only through messages that could mimic any desired behavior.
    [Show full text]
  • Object-Oriented Programming in the Beta Programming Language
    OBJECT-ORIENTED PROGRAMMING IN THE BETA PROGRAMMING LANGUAGE OLE LEHRMANN MADSEN Aarhus University BIRGER MØLLER-PEDERSEN Ericsson Research, Applied Research Center, Oslo KRISTEN NYGAARD University of Oslo Copyright c 1993 by Ole Lehrmann Madsen, Birger Møller-Pedersen, and Kristen Nygaard. All rights reserved. No part of this book may be copied or distributed without the prior written permission of the authors Preface This is a book on object-oriented programming and the BETA programming language. Object-oriented programming originated with the Simula languages developed at the Norwegian Computing Center, Oslo, in the 1960s. The first Simula language, Simula I, was intended for writing simulation programs. Si- mula I was later used as a basis for defining a general purpose programming language, Simula 67. In addition to being a programming language, Simula1 was also designed as a language for describing and communicating about sys- tems in general. Simula has been used by a relatively small community for many years, although it has had a major impact on research in computer sci- ence. The real breakthrough for object-oriented programming came with the development of Smalltalk. Since then, a large number of programming lan- guages based on Simula concepts have appeared. C++ is the language that has had the greatest influence on the use of object-oriented programming in industry. Object-oriented programming has also been the subject of intensive research, resulting in a large number of important contributions. The authors of this book, together with Bent Bruun Kristensen, have been involved in the BETA project since 1975, the aim of which is to develop con- cepts, constructs and tools for programming.
    [Show full text]
  • Compile-Time Safety and Runtime Performance in Programming Frameworks for Distributed Systems
    Compile-time Safety and Runtime Performance in Programming Frameworks for Distributed Systems lars kroll Doctoral Thesis in Information and Communication Technology School of Electrical Engineering and Computer Science KTH Royal Institute of Technology Stockholm, Sweden 2020 School of Electrical Engineering and Computer Science KTH Royal Institute of Technology TRITA-EECS-AVL-2020:13 SE-164 40 Kista ISBN: 978-91-7873-445-0 SWEDEN Akademisk avhandling som med tillstånd av Kungliga Tekniska Högskolan fram- lägges till offentlig granskning för avläggande av teknologie doktorsexamen i informations- och kommunikationsteknik på fredagen den 6 mars 2020 kl. 13:00 i Sal C, Electrum, Kungliga Tekniska Högskolan, Kistagången 16, Kista. © Lars Kroll, February 2020 Printed by Universitetsservice US-AB IV Abstract Distributed Systems, that is systems that must tolerate partial failures while exploiting parallelism, are a fundamental part of the software landscape today. Yet, their development and design still pose many challenges to developers when it comes to reliability and performance, and these challenges often have a negative impact on developer productivity. Distributed programming frameworks and languages attempt to provide solutions to common challenges, so that application developers can focus on business logic. However, the choice of programming model as provided by a such a framework or language will have significant impact both on the runtime performance of applications, as well as their reliability. In this thesis, we argue for programming models that are statically typed, both for reliability and performance reasons, and that provide powerful abstractions, giving developers the tools to implement fast algorithms without being constrained by the choice of the programming model.
    [Show full text]
  • Opencobol Manual for Opencobol 2.0
    OpenCOBOL Manual for OpenCOBOL 2.0 Keisuke Nishida / Roger While Edition 2.0 Updated for OpenCOBOL 2.0 26 January 2012 OpenCOBOL is an open-source COBOL compiler, which translates COBOL programs to C code and compiles it using GCC or other C compiler system. This manual corresponds to OpenCOBOL 2.0. Copyright c 2002,2003,2004,2005,2006 Keisuke Nishida Copyright c 2007-2012 Roger While Permission is granted to make and distribute verbatim copies of this manual provided the copy- right notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the condi- tions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice maybe stated in a translation approved by the Free Software Foundation. i Table of Contents 1 Getting Started :::::::::::::::::::::::::::::::::::::::::::::::: 1 1.1 Hello World!::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 1 2 Compile :::::::::::::::::::::::::::::::::::::::::::::::::::::::: 2 2.1 Compiler Options ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 2 2.1.1 Help Options ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 2 2.1.2 Built Target ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    [Show full text]
  • Comp 411 Principles of Programming Languages Lecture 19 Semantics of OO Languages
    Comp 411 Principles of Programming Languages Lecture 19 Semantics of OO Languages Corky Cartwright Mar 10-19, 2021 Overview I • In OO languages, OO data values (except for designated non-OO types) are special records [structures] (finite mappings from names to values). In OO parlance, the components of record are called members. • Some members of an object may be functions called methods. Methods take this (the object in question) as an implicit parameter. Some OO languages like Java also support static methods that do not depend on this; these methods have no implicit parameters. In efficient OO language implementations, method members are shared since they are the same for all instances of a class, but this sharing is an optimization in statically typed OO languages since the collection of methods in a class is immutable during program evaluation (computation). • A method (instance method in Java) can only be invoked on an object (the receiver, an implicit parameter). Additional parameters are optional, depending on whether the method expects them. This invocation process is called dynamic dispatch because the executed code is literally extracted from the object: the code invoked at a call site depends on the value of the receiver, which can change with each execution of the call. • A language with objects is OO if it supports dynamic dispatch (discussed in more detail in Overview II & III) and inheritance, an explicit taxonomy for classifying objects based on their members and class names where superclass/parent methods are inherited unless overridden. • In single inheritance, this taxonomy forms a tree; • In multiple inheritance, it forms a rooted DAG (directed acyclic graph) where the root class is the universal class (Object in Java).
    [Show full text]