UNIVERSITY of CALIFORNIA, IRVINE Efficient Hosted Interpreter

Total Page:16

File Type:pdf, Size:1020Kb

UNIVERSITY of CALIFORNIA, IRVINE Efficient Hosted Interpreter UNIVERSITY OF CALIFORNIA, IRVINE Efficient Hosted Interpreter for Dynamic Languages DISSERTATION submitted in partial satisfaction of the requirements for the degree of DOCTOR OF PHILOSOPHY in Computer Engineering by Wei Zhang Dissertation Committee: Professor Michael Franz, Chair Professor Kwei-Jay Lin Professor Guoqing Xu 2015 Portion of Chapter 3 c 2013, 2014 ACM, doi 10.1145/2532642 Portion of Chapter 4 c2014 ACM, doi 10.1145/2660193.2660223 Portion of Chapter 5 c 2014 ACM, doi 10.1145/2660193.2660223 All other materials c 2015 Wei Zhang DEDICATION To my supporting parents and lovely wife. ii TABLE OF CONTENTS Page LIST OF FIGURES vi LIST OF TABLES viii ACKNOWLEDGMENTS ix CURRICULUM VITAE x ABSTRACT OF THE DISSERTATION xii 1 Introduction 1 2 Background 3 2.1 VirtualMachines ................................. 3 2.2 Interpreters . 4 2.3 Just-In-TimeCompilers . 5 2.4 Type Specialization for Dynamic Languages . 7 3 Fast Instruction Dispatch for Hosted Bytecode Interpreters 9 3.1 PerformanceAnatomyofBytecodeInterpreters . 10 3.1.1 Switch-based Dispatch . 11 3.2 Efficient Instruction Dispatch Techniques . 12 3.2.1 Direct Threading Dispatch . 12 3.2.2 SubroutineThreadingDispatch . 13 3.3 Just-In-Time Threaded Code for Hosted Bytecode Interpreters . 14 3.3.1 System Overview . 15 3.3.2 Threaded Code Generation . 16 3.4 Evaluation . 19 4 ZipPy: A Fast Python 3 for the JVM 23 4.1 Python on Tru✏e................................. 23 4.2 FastArithmeticsViaTypeSpecialization . 25 4.2.1 NumericTypes .............................. 26 4.2.2 ApplyingTypeSpecializations. 28 4.3 Efficient Data Representation for Composite Data Types . 29 4.3.1 UnboxedSequenceStorage. 30 iii 4.3.2 Profiling-based List Literal Specialization . 30 4.4 ControlFlowSpecializations . 33 4.4.1 For Loop Specializations . 33 4.4.2 List Comprehensions . 34 4.5 Discussion . 35 5 Generator Peeling 36 5.1 Motivation . 36 5.2 Generators in Python . 38 5.3 GeneratorsUsinganASTInterpreter . 40 5.3.1 ASTInterpretersvs. BytecodeInterpreters. 41 5.3.2 GeneratorASTs.............................. 42 5.4 Optimizing Generators with Peeling . 47 5.4.1 Peeling Generator Loops . 47 5.4.2 PeelingASTTransformations . 51 5.4.3 Polymorphism and Deoptimization . 52 5.4.4 FramesandControlFlowHandling . 53 5.4.5 ImplicitGeneratorLoops. 56 5.4.6 Multi-level Generator Peeling . 58 6 Optimizing Object Model and Calls 62 6.1 Object Model . 62 6.1.1 Python Object Data Representations . 62 6.1.2 Attribute Resolutions . 65 6.1.3 Modeling Custom Mutable Types . 67 6.1.4 InlineCachingforAttributeAccesses . 71 6.2 Call Site Modeling . 76 6.2.1 Call Site Structures in Python . 77 6.2.2 CallNodeSpecializations . 79 6.2.3 CallSiteDispatchandInlining . 85 6.3 FlexibleObjectStorages . 87 6.3.1 FlexibleObjectStorageGeneration . 88 6.3.2 Continuous Storage Class Generation . 91 6.3.3 A Generalization to the Object Model . 95 6.3.4 ZombieResurrection . 97 6.3.5 Discussion . 97 7 Evaluation 99 7.1 The Performance of ZipPy . 100 7.1.1 Experiment Setup . 100 7.1.2 Benchmark Selection . 101 7.1.3 Experiment Results . 102 7.1.4 PerformanceAnalysis. 103 7.2 TheE↵ectivenessofGeneratorPeeling . 105 7.2.1 Benchmark Selection . 105 iv 7.2.2 Experiment Results . 106 7.2.3 PerformanceAnalysis. 108 7.2.4 ZipPy vs. PyPy . 111 7.3 TheE↵ectivenessofFlexibleObjectStorages. 114 7.3.1 ObjectModelConfigurations . 114 7.3.2 ThePerformanceofFlexibleObjectStorages. 115 7.3.3 The Space EfficiencyofFlexibleObjectStorages. 118 7.3.4 Discussion . 120 8RelatedWork 122 8.1 HostedInterpretersforDynamicLanguages . 123 8.2 Tru✏e Languages . 125 8.3 Generators and Coroutines . 126 9 Conclusions 129 Bibliography 131 v LIST OF FIGURES Page 3.1 Interpretation costs of bytecode interpreters . 11 3.2 switch-based dispatch . 12 3.3 direct threading dispatch . 13 3.4 subroutine threading dispatch . 14 3.5 JythononModularVM ............................. 15 3.6 Threaded code generation . 16 3.7 Annotatedi-op .................................. 17 3.8 I-opwithnextdispatch.............................. 17 3.9 Direct threading example . 19 3.10 Jython’s direct threaded interpreter vs. switch-based . 21 3.11 Jython’s direct threaded interpreter vs. class file compiler . 22 4.1 Python on Tru✏e................................. 24 4.2 NumerictypesinZipPy ............................. 26 4.3 Implementation of NotNode in ZipPy . 27 4.4 Derivatives of NotNode in ZipPy . 28 4.5 Sequence storage types in ZipPy . 30 4.6 List construction loop . 31 4.7 List literal specialization . 32 4.8 For loop specialization for range iterators . 33 4.9 List comprehensions . 34 5.1 AsimplegeneratorfunctioninPython . 38 5.2 AsimplegeneratorexpressioninPython . 39 5.3 Idiomatic uses of generators . 40 5.4 Two di↵erent WhileNode versions ........................ 41 5.5 TranslationtogeneratorAST . 43 5.6 Translation of a yield expression . 46 5.7 Program execution order of a generator loop . 47 5.8 Peeling transformation . 49 5.9 Transformed generator loop . 49 5.10 PeelingASTtransformation . 50 5.11 Handlingofpolymorphicgeneratorloop . 52 5.12 The caller and generator frame objects of the Fibonacci example . 53 5.13 Complexcontrolflowhandling. 55 vi 5.14 Implicit generator loop transformation . 57 5.15 Multi-level generator peeling . 59 6.1 Three data representations for Python objects . 64 6.2 Attribute resolution for di↵erent data representations . 66 6.3 The implementation of PythonObject ..................... 68 6.4 Mutable object layout . 69 6.5 Attribute access dispatch chain . 72 6.6 Thetransformationofagetattributedispatchnode . 74 6.7 Two types of calls in Python . 77 6.8 The structure of a PythonCallNode ....................... 78 6.9 Call node specializations for a simple call site . 80 6.10 Attribute call sites with di↵erent primary object representations . 82 6.11 Call node specializations for an attribute call site . 83 6.12 Operator overloading by overwriting special method . 84 6.13 AddNode specialization for special method overwriting . 84 6.14 AddNode specialized for special method dispatch . 85 6.15 Call dispatch chain . 86 6.16 Flexibleobjectstorageexample . 88 6.17 Python object layout change example . 90 6.18 Constructor call site transformation . 92 6.19 Continuous storage class generations and object layout changes of an example Python class . 94 6.20 A Python constructor that exposes a reference to self ............ 96 7.1 Detailed speedups of di↵erent Python implementations normalized to CPython 3.4.0 . 109 7.2 Generator optimization in PyPy . 112 7.3 Detailed speedups of di↵erent object model configurations normalized to fixed object storage of size 5 . 116 7.4 The memory overheads of fixed object storage of size 1, 3 and 5 relative to flexible storage allocation with continuous generation . 118 7.5 The slowdowns of fixed object storage of size 1, 3 and 5 relative to flexible storage allocation with continuous generation . 119 vii LIST.
Recommended publications
  • SJC – Small Java Compiler
    SJC – Small Java Compiler User Manual Stefan Frenz Translation: Jonathan Brase original version: 2011/06/08 latest document update: 2011/08/24 Compiler Version: 182 Java is a registered trademark of Oracle/Sun Table of Contents 1 Quick introduction.............................................................................................................................4 1.1 Windows...........................................................................................................................................4 1.2 Linux.................................................................................................................................................5 1.3 JVM Environment.............................................................................................................................5 1.4 QEmu................................................................................................................................................5 2 Hello World.......................................................................................................................................6 2.1 Source Code......................................................................................................................................6 2.2 Compilation and Emulation...............................................................................................................8 2.3 Details...............................................................................................................................................9
    [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]
  • Java (Programming Langua a (Programming Language)
    Java (programming language) From Wikipedia, the free encyclopedialopedia "Java language" redirects here. For the natural language from the Indonesian island of Java, see Javanese language. Not to be confused with JavaScript. Java multi-paradigm: object-oriented, structured, imperative, Paradigm(s) functional, generic, reflective, concurrent James Gosling and Designed by Sun Microsystems Developer Oracle Corporation Appeared in 1995[1] Java Standard Edition 8 Update Stable release 5 (1.8.0_5) / April 15, 2014; 2 months ago Static, strong, safe, nominative, Typing discipline manifest Major OpenJDK, many others implementations Dialects Generic Java, Pizza Ada 83, C++, C#,[2] Eiffel,[3] Generic Java, Mesa,[4] Modula- Influenced by 3,[5] Oberon,[6] Objective-C,[7] UCSD Pascal,[8][9] Smalltalk Ada 2005, BeanShell, C#, Clojure, D, ECMAScript, Influenced Groovy, J#, JavaScript, Kotlin, PHP, Python, Scala, Seed7, Vala Implementation C and C++ language OS Cross-platform (multi-platform) GNU General Public License, License Java CommuniCommunity Process Filename .java , .class, .jar extension(s) Website For Java Developers Java Programming at Wikibooks Java is a computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few impimplementation dependencies as possible.ble. It is intended to let application developers "write once, run ananywhere" (WORA), meaning that code that runs on one platform does not need to be recompiled to rurun on another. Java applications ns are typically compiled to bytecode (class file) that can run on anany Java virtual machine (JVM)) regardless of computer architecture. Java is, as of 2014, one of tthe most popular programming ng languages in use, particularly for client-server web applications, witwith a reported 9 million developers.[10][11] Java was originallyy developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation) and released in 1995 as a core component of Sun Microsystems'Micros Java platform.
    [Show full text]
  • A Status Update of BEAMJIT, the Just-In-Time Compiling Abstract Machine
    A Status Update of BEAMJIT, the Just-in-Time Compiling Abstract Machine Frej Drejhammar and Lars Rasmusson <ffrej,[email protected]> 140609 Who am I? Senior researcher at the Swedish Institute of Computer Science (SICS) working on programming tools and distributed systems. Acknowledgments Project funded by Ericsson AB. Joint work with Lars Rasmusson <[email protected]>. What this talk is About An introduction to how BEAMJIT works and a detailed look at some subtle details of its implementation. Outline Background BEAMJIT from 10000m BEAMJIT-aware Optimization Compiler-supported Profiling Future Work Questions Just-In-Time (JIT) Compilation Decide at runtime to compile \hot" parts to native code. Fairly common implementation technique. McCarthy's Lisp (1969) Python (Psyco, PyPy) Smalltalk (Cog) Java (HotSpot) JavaScript (SquirrelFish Extreme, SpiderMonkey, J¨agerMonkey, IonMonkey, V8) Motivation A JIT compiler increases flexibility. Tracing does not require switching to full emulation. Cross-module optimization. Compiled BEAM modules are platform independent: No need for cross compilation. Binaries not strongly coupled to a particular build of the emulator. Integrates naturally with code upgrade. Project Goals Do as little manual work as possible. Preserve the semantics of plain BEAM. Automatically stay in sync with the plain BEAM, i.e. if bugs are fixed in the interpreter the JIT should not have to be modified manually. Have a native code generator which is state-of-the-art. Eventually be better than HiPE (steady-state). Plan Use automated tools to transform and extend the BEAM. Use an off-the-shelf optimizer and code generator. Implement a tracing JIT compiler. BEAM: Specification & Implementation BEAM is the name of the Erlang VM.
    [Show full text]
  • The Java® Language Specification Java SE 8 Edition
    The Java® Language Specification Java SE 8 Edition James Gosling Bill Joy Guy Steele Gilad Bracha Alex Buckley 2015-02-13 Specification: JSR-337 Java® SE 8 Release Contents ("Specification") Version: 8 Status: Maintenance Release Release: March 2015 Copyright © 1997, 2015, Oracle America, Inc. and/or its affiliates. 500 Oracle Parkway, Redwood City, California 94065, U.S.A. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. The Specification provided herein is provided to you only under the Limited License Grant included herein as Appendix A. Please see Appendix A, Limited License Grant. To Maurizio, with deepest thanks. Table of Contents Preface to the Java SE 8 Edition xix 1 Introduction 1 1.1 Organization of the Specification 2 1.2 Example Programs 6 1.3 Notation 6 1.4 Relationship to Predefined Classes and Interfaces 7 1.5 Feedback 7 1.6 References 7 2 Grammars 9 2.1 Context-Free Grammars 9 2.2 The Lexical Grammar 9 2.3 The Syntactic Grammar 10 2.4 Grammar Notation 10 3 Lexical Structure 15 3.1 Unicode 15 3.2 Lexical Translations 16 3.3 Unicode Escapes 17 3.4 Line Terminators 19 3.5 Input Elements and Tokens 19 3.6 White Space 20 3.7 Comments 21 3.8 Identifiers 22 3.9 Keywords 24 3.10 Literals 24 3.10.1 Integer Literals 25 3.10.2 Floating-Point Literals 31 3.10.3 Boolean Literals 34 3.10.4 Character Literals 34 3.10.5 String Literals 35 3.10.6 Escape Sequences for Character and String Literals 37 3.10.7 The Null Literal 38 3.11 Separators
    [Show full text]
  • 102-401-08 3 Fiches SOFTW.Indd
    PYPY to be adapted to new platforms, to be used in education Scope and to give new answers to security questions. Traditionally, fl exible computer languages allow to write a program in short time but the program then runs slow- Contribution to standardization er at the end-user. Inversely, rather static languages run 0101 faster but are tedious to write programs in. Today, the and interoperability issues most used fl exible and productive computer languages Pypy does not contribute to formal standardization proc- are hard to get to run fast, particularly on small devices. esses. However, Pypy’s Python implementation is practi- During its EU project phase 2004-2007 Pypy challenged cally interoperable and compatible with many environ- this compromise between fl exibility and speed. Using the ments. Each night, around 12 000 automatic tests ensure platform developed in Pypy, language interpreters can that it remains robust and compatible to the mainline now be written at a higher level of abstraction. Pypy au- Python implementation. tomatically produces effi cient versions of such language interpreters for hardware and virtual target environ- Target users / sectors in business ments. Concrete examples include a full Python Inter- 010101 10 preter, whose further development is partially funded by and society the Google Open Source Center – Google itself being a Potential users are developers and companies who have strong user of Python. Pypy also showcases a new way of special needs for using productive dynamic computer combining agile open-source development and contrac- languages. tual research. It has developed methods and tools that support similar projects in the future.
    [Show full text]
  • Scons API Docs Version 4.2
    SCons API Docs version 4.2 SCons Project July 31, 2021 Contents SCons Project API Documentation 1 SCons package 1 Module contents 1 Subpackages 1 SCons.Node package 1 Submodules 1 SCons.Node.Alias module 1 SCons.Node.FS module 9 SCons.Node.Python module 68 Module contents 76 SCons.Platform package 85 Submodules 85 SCons.Platform.aix module 85 SCons.Platform.cygwin module 85 SCons.Platform.darwin module 86 SCons.Platform.hpux module 86 SCons.Platform.irix module 86 SCons.Platform.mingw module 86 SCons.Platform.os2 module 86 SCons.Platform.posix module 86 SCons.Platform.sunos module 86 SCons.Platform.virtualenv module 87 SCons.Platform.win32 module 87 Module contents 87 SCons.Scanner package 89 Submodules 89 SCons.Scanner.C module 89 SCons.Scanner.D module 93 SCons.Scanner.Dir module 93 SCons.Scanner.Fortran module 94 SCons.Scanner.IDL module 94 SCons.Scanner.LaTeX module 94 SCons.Scanner.Prog module 96 SCons.Scanner.RC module 96 SCons.Scanner.SWIG module 96 Module contents 96 SCons.Script package 99 Submodules 99 SCons.Script.Interactive module 99 SCons.Script.Main module 101 SCons.Script.SConsOptions module 108 SCons.Script.SConscript module 115 Module contents 122 SCons.Tool package 123 Module contents 123 SCons.Variables package 125 Submodules 125 SCons.Variables.BoolVariable module 125 SCons.Variables.EnumVariable module 125 SCons.Variables.ListVariable module 126 SCons.Variables.PackageVariable module 126 SCons.Variables.PathVariable module 127 Module contents 127 SCons.compat package 129 Module contents 129 Submodules 129 SCons.Action
    [Show full text]
  • Porting of Micropython to LEON Platforms
    Porting of MicroPython to LEON Platforms Damien P. George George Robotics Limited, Cambridge, UK TEC-ED & TEC-SW Final Presentation Days ESTEC, 10th June 2016 George Robotics Limited (UK) I a limited company in the UK, founded in January 2014 I specialising in embedded systems I hardware: design, manufacturing (via 3rd party), sales I software: development and support of MicroPython code D.P. George (George Robotics Ltd) MicroPython on LEON 2/21 Motivation for MicroPython Electronics circuits now pack an enor- mous amount of functionality in a tiny package. Need a way to control all these sophisti- cated devices. Scripting languages enable rapid development. Is it possible to put Python on a microcontroller? Why is it hard? I Very little memory (RAM, ROM) on a microcontroller. D.P. George (George Robotics Ltd) MicroPython on LEON 3/21 Why Python? I High-level language with powerful features (classes, list comprehension, generators, exceptions, . ). I Large existing community. I Very easy to learn, powerful for advanced users: shallow but long learning curve. I Ideal for microcontrollers: native bitwise operations, procedural code, distinction between int and float, robust exceptions. I Lots of opportunities for optimisation (this may sound surprising, but Python is compiled). D.P. George (George Robotics Ltd) MicroPython on LEON 4/21 Why can't we use existing CPython? (or PyPy?) I Integer operations: Integer object (max 30 bits): 4 words (16 bytes) Preallocates 257+5=262 ints −! 4k RAM! Could ROM them, but that's still 4k ROM. And each integer outside the preallocated ones would be another 16 bytes. I Method calls: led.on(): creates a bound-method object, 5 words (20 bytes) led.intensity(1000) −! 36 bytes RAM! I For loops: require heap to allocate a range iterator.
    [Show full text]
  • Building Useful Program Analysis Tools Using an Extensible Java Compiler
    Building Useful Program Analysis Tools Using an Extensible Java Compiler Edward Aftandilian, Raluca Sauciuc Siddharth Priya, Sundaresan Krishnan Google, Inc. Google, Inc. Mountain View, CA, USA Hyderabad, India feaftan, [email protected] fsiddharth, [email protected] Abstract—Large software companies need customized tools a specific task, but they fail for several reasons. First, ad- to manage their source code. These tools are often built in hoc program analysis tools are often brittle and break on an ad-hoc fashion, using brittle technologies such as regular uncommon-but-valid code patterns. Second, simple ad-hoc expressions and home-grown parsers. Changes in the language cause the tools to break. More importantly, these ad-hoc tools tools don’t provide sufficient information to perform many often do not support uncommon-but-valid code code patterns. non-trivial analyses, including refactorings. Type and symbol We report our experiences building source-code analysis information is especially useful, but amounts to writing a tools at Google on top of a third-party, open-source, extensible type-checker. Finally, more sophisticated program analysis compiler. We describe three tools in use on our Java codebase. tools are expensive to create and maintain, especially as the The first, Strict Java Dependencies, enforces our dependency target language evolves. policy in order to reduce JAR file sizes and testing load. The second, error-prone, adds new error checks to the compilation In this paper, we present our experience building special- process and automates repair of those errors at a whole- purpose tools on top of the the piece of software in our codebase scale.
    [Show full text]
  • Goless Documentation Release 0.6.0
    goless Documentation Release 0.6.0 Rob Galanakis July 11, 2014 Contents 1 Intro 3 2 Goroutines 5 3 Channels 7 4 The select function 9 5 Exception Handling 11 6 Examples 13 7 Benchmarks 15 8 Backends 17 9 Compatibility Details 19 9.1 PyPy................................................... 19 9.2 Python 2 (CPython)........................................... 19 9.3 Python 3 (CPython)........................................... 19 9.4 Stackless Python............................................. 20 10 goless and the GIL 21 11 References 23 12 Contributing 25 13 Miscellany 27 14 Indices and tables 29 i ii goless Documentation, Release 0.6.0 • Intro • Goroutines • Channels • The select function • Exception Handling • Examples • Benchmarks • Backends • Compatibility Details • goless and the GIL • References • Contributing • Miscellany • Indices and tables Contents 1 goless Documentation, Release 0.6.0 2 Contents CHAPTER 1 Intro The goless library provides Go programming language semantics built on top of gevent, PyPy, or Stackless Python. For an example of what goless can do, here is the Go program at https://gobyexample.com/select reimplemented with goless: c1= goless.chan() c2= goless.chan() def func1(): time.sleep(1) c1.send(’one’) goless.go(func1) def func2(): time.sleep(2) c2.send(’two’) goless.go(func2) for i in range(2): case, val= goless.select([goless.rcase(c1), goless.rcase(c2)]) print(val) It is surely a testament to Go’s style that it isn’t much less Python code than Go code, but I quite like this. Don’t you? 3 goless Documentation, Release 0.6.0 4 Chapter 1. Intro CHAPTER 2 Goroutines The goless.go() function mimics Go’s goroutines by, unsurprisingly, running the routine in a tasklet/greenlet.
    [Show full text]
  • Using JIT Compilation and Configurable Runtime Systems for Efficient Deployment of Java Programs on Ubiquitous Devices
    Using JIT Compilation and Configurable Runtime Systems for Efficient Deployment of Java Programs on Ubiquitous Devices Radu Teodorescu and Raju Pandey Parallel and Distributed Computing Laboratory Computer Science Department University of California, Davis {teodores,pandey}@cs.ucdavis.edu Abstract. As the proliferation of ubiquitous devices moves computation away from the conventional desktop computer boundaries, distributed systems design is being exposed to new challenges. A distributed system supporting a ubiquitous computing application must deal with a wider spectrum of hardware architectures featuring structural and functional differences, and resources limitations. Due to its architecture independent infrastructure and object-oriented programming model, the Java programming environment can support flexible solutions for addressing the diversity among these devices. Unfortunately, Java solutions are often associated with high costs in terms of resource consumption, which limits the range of devices that can benefit from this approach. In this paper, we present an architecture that deals with the cost and complexity of running Java programs by partitioning the process of Java program execution between system nodes and remote devices. The system nodes prepare a Java application for execution on a remote device by generating device-specific native code and application-specific runtime system on the fly. The resulting infrastructure provides the flexibility of a high-level programming model and the architecture independence specific to Java. At the same time the amount of resources consumed by an application on the targeted device are comparable to that of a native implementation. 1 Introduction As a result of the proliferation of computation into the physical world, ubiquitous computing [1] has become an important research topic.
    [Show full text]
  • SUBJECT-COMPUTER CLASS-12 CHAPTER 9 – Compiling and Running Java Programs
    SUBJECT-COMPUTER CLASS-12 CHAPTER 9 – Compiling and Running Java Programs Introduction to Java programming JAVA was developed by Sun Microsystems Inc in 1991, later acquired by Oracle Corporation. It was developed by James Gosling and Patrick Naughton. It is a simple programming language. Writing, compiling and debugging a program is easy in java. It helps to create modular programs and reusable code. Bytecode javac compiler of JDK compiles the java source code into bytecode so that it can be executed by JVM. The bytecode is saved in a .class file by compiler. Java Virtual Machine (JVM) This is generally referred as JVM. Before, we discuss about JVM lets see the phases of program execution. Phases are as follows: we write the program, then we compile the program and at last we run the program. 1) Writing of the program is of course done by java programmer. 2) Compilation of program is done by javac compiler, javac is the primary java compiler included in java development kit (JDK). It takes java program as input and generates java bytecode as output. 3) In third phase, JVM executes the bytecode generated by compiler. This is called program run phase. So, now that we understood that the primary function of JVM is to execute the bytecode produced by compiler. Characteristics of Java Simple Java is very easy to learn, and its syntax is simple, clean and easy to understand. Multi-threaded Multithreading capabilities come built right into the Java language. This means it is possible to build highly interactive and responsive apps with a number of concurrent threads of activity.
    [Show full text]