Compressing Java Class Files Java Class Files

Total Page:16

File Type:pdf, Size:1020Kb

Compressing Java Class Files Java Class Files Compressing Java Class files Compressing Java Class files Java Class files • Compiled Java source programs generates 1999 ACM SIGPLAN Conference on (lots of) class files Programming Language Design and • Architecture neutral Implementation • Standard distribution format – Java programs can be compiled to native William Pugh executables, but I won’t talk about that Dept. of Computer Science Univ. of Maryland Class file contents Java ARchive (jar) files • class files contain lots of symbolic • A collection of of class files and other information resources (e.g., images) – For javac, only 21% of uncompressed class file • same format as zip archives is bytecode – individual files can be compressed with zlib • Information for linking • includes manifest • Allows code compiled against an old library – Information such as code signatures – to be linked with a new library – so long as dependent functionality still there Executing Java programs Download individual class over the net files as needed • Download and install program • TCP set-up costs for each class file – compact archive format – unless you use persistent http connection • Execute as downloaded • No compression – class files as needed, or • Get just the class files you need – compact and progressive archive format – some class files are needed only for verification – entire class file is needed if you need only one method • This approach isn’t used in practice – for non-trivial applications William Pugh, Univ. of Maryland 1 Compressing Java Class files A Wire format for Download jar archive class files? • 1 TCP connection • Bandwidth most important • zlib compression of individual class files • Decompression time relatively important – about a factor of 2 savings – Compression time not very important • may download class files that are not used • Progressive • entire jar archive must be downloaded • Not random access before any class files can be accessed • Can translate into jar archive or class files – or load directly into JVM Debugging information Cleanup • Java class files often contain debugging • When comparing my format to jar files information – Clean up first – source file • Remove debugging information – line number • Garbage collect constant pool – local variables • Sort constant pool • Will not include debugging information in – improves compression wire format • Exclude non-class files from archive – could do so; would compress fairly well Effects of Clean up Easy Java class file wire j0r jar sjar no yes yes compressed? format: Collective Zip no yes no debugging info? yes no yes Cleaned up? • In standard Jar archive, Hanoi 86 57 46 – files are compressed individually icebrowserbean 226 125 116 • gzip/zlib finds repeating patterns javafig_dashO 269 136 131 javafig 357 198 170 • lots of patterns repeat between but not as jmark20 309 189 173 much within class files _213_javac 516 274 226 ImageEditor 454 359 257 • Generate jar file without individual tools 1,557 950 737 compression visaj 2,189 1,524 1,157 swingall 3,265 2,193 1,657 • Compress the entire resulting jar file rt 8,937 5,726 4,652 William Pugh, Univ. of Maryland 2 Compressing Java Class files Effectiveness of A closer look at collective zip class file contents Size of Collective Zip swingall javac Original Collective as % of Total size 3,265 516 Benchmark Size Zip Original excluding jar overhead 3,010 485 Hanoi 46 31 67% Field definitions 36 7 Method definitions 97 10 IBM Host on demand 98 85 87% Code 768 114 ICE Browser 105 88 84% Other 72 12 JavaFig 171 144 84% Constant pool 2,037 342 tools 737 513 70% Utf8 entries 1,704 295 visaj 1,157 703 61% if shared 372 56 swingall 1,657 998 60% if shared and factored 235 26 JDK 1.2 runtime 4,652 2,820 61% What did we just learn? Beating collective zip is hard • A substantial part of class files consists of • A lot of the things you could do constant pools – e.g., share constant pool entries – Bytecode is the only other substantial • are already done by a collective zip component • Most of the space in constant pools is taken • You can work very hard up by Utf8 entries – and find that you don’t beat collective zip by • Sharing Utf8 entries across class files is a much huge win Compressing uniform Drawbacks to sharing streams • Increases # of constant pool entries • class files are jumbles of different types – How do we encode a reference? – Utf8 encodings, bytecodes, constant pool • For most class files, less than 255 entries entries – can encode in a single byte • Most compression algorithms work better if given a more uniform stream – separate out class files into streams for each type of information – compress each stream individually William Pugh, Univ. of Maryland 3 Compressing Java Class files Compressing bytestreams Encoding references • Zlib (and most compression algorithms) are • How do you encode a reference to an object designed to work on bytestreams (e.g., a constant pool entry) you may have • How do you compress a stream of shorts? seen before? – Standard serialization mixes types – so that most references are encoded in 1 byte – Could use separate streams for high and low • Overload id’s based on type bytes – In almost all cases, know the type of the object – Use variable length encoding being referenced • Hope that most entries can be encoded in a single byte Encoding references Move to front queue (continued) • Tried several schemes • Maintain a list of all the objects seen • One that worked best was a move-to-front previously queue • To encode an object seen previously – Suggested by Ernst et al. – encode its position (1 for first entry) – Long history in compression literature – move it to the front of the list • To encode an object not seen previously – encode 0 – put it at front of list Implementation of Factoring? Move-to-front queues • Use a modified skip-list • The string “java.awt” occurs in the Utf8 – links record distance they travel encoding of many class names • In decoder, a move-to-front operation on • Method and field signatures contain element k requires O(log k) time separate Utf8 encoding of class names – regardless of total number of elements in list • String f(String s) is recorded as having type • In encoder, requires O(log n) time (Ljava/lang/String;)Ljava/lang/String; – L is to differentiate between references and primitive types William Pugh, Univ. of Maryland 4 Compressing Java Class files Reorganize class file Compressing bytecodes • Factor information to avoid as much • Separating out opcodes from operands helps redundancy as possible • Use separate streams for : – packageNames – opcodes – simpleClassNames – different register types – classNames – branch offsets – method type (array of classnames) – integer constants – ... – constant pool references (already separate) Compression results Compression ratios collective packed/ j0r.gz Jazz Packed Benchmark jar size zip packed Czip/ jar jar Hanoi 46 31 14 67% 30% 100% IBM Host on demand 98 85 44 87% 45% 80% ICE Browser 105 88 36 84% 35% JavaFig 171 144 64 84% 37% 60% Cinderella 625 - 171 27% tools 737 513 204 70% 28% 40% Lotus eSuite Sheet 1,101 - 549 50% 20% visaj 1,157 703 238 61% 21% Size as % of jar file Lotus eSuite Chart 1,387 - 633 46% 0% swingall 1,657 998 338 60% 20% Mockingbird 2,350 - 506 22% 1 10 100 1,000 10,000 Reservation System 3,067 - 736 24% Size of jar file (KBytes) JDK 1.2 runtime 4,652 2,820 1,069 61% 23% Download times Execution Times Jar Pjar Pack • For swingall.jar 1000.0 – Jar format: 1,657 KBytes – compressed size: 338 Kbytes 100.0 – decompression time (Ultra 5 333Mhz) • to memory: 3 secs 10.0 • to jar file: ~ 14 secs – time to load classes : 5.8 secs Download time (secs) • time to define, resolve and verify 1.0 1 10 100 1,000 Download speed (KBytes/sec) William Pugh, Univ. of Maryland 5 Compressing Java Class files Decoder size & security Providing Jar functionality • Decoder is about 35Kbytes • Jar archives contain more than class files – Could be downloaded – images, text files, resources • not useful for small archives – manifest (signatures, …) – Could be installed as extension • Add a stream of non-class files • Decoder either needs permission to write to – a zip archive, without individual compression a temporary file or permission to create a but with overall compression class loader – Can do this under 1.2 security model Complication for signatures Related work - lots! • Compression and decompression changes a • Used few ideas that hadn’t been considered class file previously – by renumbering the constant pool • Compression of executable code • Signatures from source class files won’t – Ernst, Evans, Fraser, Lucco and Proebsting, work on decoded class files PLDI97 • Decompress once, sign decompressed class • Compression of Java Classfiles files, use those signatures – Nigel Horspool et al. – decompression is deterministic Jax from IBM Combining Jax and Pack jar size Jax'd & • Java Application eXtraction Benchmark (Kbytes) Jax'd Packed Packed – available from www.alphaworks.ibm.com Hanoi 46 46% 30% 15% • Extracts just the classes and methods IBM Host on demand 98 84% 45% 37% ICE Browser 105 87% 35% 32% needed by application JavaFig 171 79% 37% 31% • Very useful if your application uses small Cinderella 625 65% 27% 17% part of a large library Lotus eSuite Sheet 1,101 35% 50% 11% Lotus eSuite Chart 1,387 43% 46% 14% – eliminates need to ship entire library Mockingbird 2,350 13% 22% 4% Reservation System 3,067 58% 24% 14% William Pugh, Univ. of Maryland 6 Compressing Java Class files Combining Jax with Packing Software release Jax'd
Recommended publications
  • How Can Java Class Files Be Decompiled?
    HOW CAN JAVA CLASS FILES BE DECOMPILED? David Foster Chamblee High School 11th Grade Many computer science courses feature building a compiler as a final project. I have decided to take a spin on the idea and instead develop a decompiler. Specifically, I decided to write a Java decompiler because: one, I am already familiar with the Java language, two, the language syntax does not suffer from feature-bloat, and three, there do not appear to be many Java decompilers currently on the market. I have approached the task of writing a decompiler as a matter of translating between two different languages. In our case, the source language is Java Virtual Machine (VM) Bytecode, and the target language is the Java Language. As such, our decompiler will attempt to analyze the semantics of the bytecode and convert it into Java source code that has equivalent semantics. A nice sideeffect of this approach is that our decompiler will not be dependent upon the syntax of the bytecodes, the compiler used to generate the bytecodes, or the source language (possibly not Java). It will only care whether a class-file’s semantics can be represented in the Java language. Decompilation is divided up into six phases: 1. Read opcodes 2. Interpret opcode behavior 3. Identify Java-language “idioms” 4. Identify patterns of control-flow 5. Generate Java-language statements 6. Format and output to file The first four phases will be discussed in detail within this paper, as they were the primary focus of my research. Further details pertaining to these phases can be gleaned from the accompanying log book.
    [Show full text]
  • Advanced Programming for the Java(TM) 2 Platform
    Advanced Programming for the Java(TM) 2 Platform Training Index Advanced Programming for the JavaTM 2 Platform By Calvin Austin and Monica Pawlan November 1999 [CONTENTS] [NEXT>>] [DOWNLOAD] Requires login As an experienced developer on the JavaTM platform, you undoubtedly know how fast moving and comprehensive the Early Access platform is. Its many application programming interfaces (APIs) Downloads provide a wealth of functionality for all aspects of application and system-level programming. Real-world developers never use one Bug Database or two APIs to solve a problem, but bring together key Submit a Bug functionality spanning a number of APIs. Knowing which APIs you View Database need, which parts of which APIs you need, and how the APIs work together to create the best solution can be a daunting task. Newsletters Back Issues To help you navigate the Java APIs and fast-track your project Subscribe development time, this book includes the design, development, test, and deployment phases for an enterprise-worthy auction Learning Centers application. While the example application does not cover every Articles possible programming scenario, it explores many common Bookshelf situations and the discussions leave you with a solid methodology Code Samples for designing and building your own solutions. New to Java Question of the Week This book is for developers with more than a beginning level of Quizzes understanding of writing programs in the Java programming Tech Tips language. The example application is written with the Java® 2 Tutorials platform APIs and explained in terms of functional hows and whys, so if you need help installing the Java platform, setting up your Forums environment, or getting your first application to work, you should first read a more introductory book such as Essentials of the Java Programming Language: A Hands-On Guide or The Java Tutorial.
    [Show full text]
  • Information Retrieval from Java Archive Format
    Eötvös Loránd University Faculty of Informatics Department of Programming Languages and Compilers Information retrieval from Java archive format Supervisor: Author: Dr. Zoltán Porkoláb Bálint Kiss Associate Professor Computer Science MSc Budapest, 2017 Abstract During the course of my work, I contributed to CodeCompass, an open source code comprehension tool made for making codebase of software projects written in C, C++ and Java more understandable through navigation and visualization. I was tasked with the development of a module for recovering code information of Java classes in JAR files. This document details background concepts required for reverse- engineering Java bytecode, creating a prototype JAR file reader and how this solu- tion could be integrated to CodeCompass. First, I studied the structure of JAR format and how class files are stored in it. I looked into the Java Class file structure and how bytecode contained in class gets interpreted by the Java Virtual Machine. I also looked at existing decompilers and what bytecode libraries are. I created a proof-of-concept prototype that reads compiled classes from JAR file and extracts code information. I first showcased the use of Java Reflection API, then the use of Apache Commons Byte Code Engineering Library, a third-party bytecode library used for extracting and representing parts of Java class file as Java objects. Finally, I examined how CodeCompass works, how part of the prototype could be integrated into it and demonstrated the integration through parsing of a simple JAR file. i Acknowledgements I would like to thank Dr. Zoltán Porkoláb, Associate Professor of the Department of Programming Languages and Compilers at the Faculty of Informatics for admit- ting me to the CodeCompass project, supplying the thesis topic and helping with the documentation.
    [Show full text]
  • Pack, Encrypt, Authenticate Document Revision: 2021 05 02
    PEA Pack, Encrypt, Authenticate Document revision: 2021 05 02 Author: Giorgio Tani Translation: Giorgio Tani This document refers to: PEA file format specification version 1 revision 3 (1.3); PEA file format specification version 2.0; PEA 1.01 executable implementation; Present documentation is released under GNU GFDL License. PEA executable implementation is released under GNU LGPL License; please note that all units provided by the Author are released under LGPL, while Wolfgang Ehrhardt’s crypto library units used in PEA are released under zlib/libpng License. PEA file format and PCOMPRESS specifications are hereby released under PUBLIC DOMAIN: the Author neither has, nor is aware of, any patents or pending patents relevant to this technology and do not intend to apply for any patents covering it. As far as the Author knows, PEA file format in all of it’s parts is free and unencumbered for all uses. Pea is on PeaZip project official site: https://peazip.github.io , https://peazip.org , and https://peazip.sourceforge.io For more information about the licenses: GNU GFDL License, see http://www.gnu.org/licenses/fdl.txt GNU LGPL License, see http://www.gnu.org/licenses/lgpl.txt 1 Content: Section 1: PEA file format ..3 Description ..3 PEA 1.3 file format details ..5 Differences between 1.3 and older revisions ..5 PEA 2.0 file format details ..7 PEA file format’s and implementation’s limitations ..8 PCOMPRESS compression scheme ..9 Algorithms used in PEA format ..9 PEA security model .10 Cryptanalysis of PEA format .12 Data recovery from
    [Show full text]
  • Steganography and Vulnerabilities in Popular Archives Formats.| Nyxengine Nyx.Reversinglabs.Com
    Hiding in the Familiar: Steganography and Vulnerabilities in Popular Archives Formats.| NyxEngine nyx.reversinglabs.com Contents Introduction to NyxEngine ............................................................................................................................ 3 Introduction to ZIP file format ...................................................................................................................... 4 Introduction to steganography in ZIP archives ............................................................................................. 5 Steganography and file malformation security impacts ............................................................................... 8 References and tools .................................................................................................................................... 9 2 Introduction to NyxEngine Steganography1 is the art and science of writing hidden messages in such a way that no one, apart from the sender and intended recipient, suspects the existence of the message, a form of security through obscurity. When it comes to digital steganography no stone should be left unturned in the search for viable hidden data. Although digital steganography is commonly used to hide data inside multimedia files, a similar approach can be used to hide data in archives as well. Steganography imposes the following data hiding rule: Data must be hidden in such a fashion that the user has no clue about the hidden message or file's existence. This can be achieved by
    [Show full text]
  • User Commands GZIP ( 1 ) Gzip, Gunzip, Gzcat – Compress Or Expand Files Gzip [ –Acdfhllnnrtvv19 ] [–S Suffix] [ Name ... ]
    User Commands GZIP ( 1 ) NAME gzip, gunzip, gzcat – compress or expand files SYNOPSIS gzip [–acdfhlLnNrtvV19 ] [– S suffix] [ name ... ] gunzip [–acfhlLnNrtvV ] [– S suffix] [ name ... ] gzcat [–fhLV ] [ name ... ] DESCRIPTION Gzip reduces the size of the named files using Lempel-Ziv coding (LZ77). Whenever possible, each file is replaced by one with the extension .gz, while keeping the same ownership modes, access and modification times. (The default extension is – gz for VMS, z for MSDOS, OS/2 FAT, Windows NT FAT and Atari.) If no files are specified, or if a file name is "-", the standard input is compressed to the standard output. Gzip will only attempt to compress regular files. In particular, it will ignore symbolic links. If the compressed file name is too long for its file system, gzip truncates it. Gzip attempts to truncate only the parts of the file name longer than 3 characters. (A part is delimited by dots.) If the name con- sists of small parts only, the longest parts are truncated. For example, if file names are limited to 14 characters, gzip.msdos.exe is compressed to gzi.msd.exe.gz. Names are not truncated on systems which do not have a limit on file name length. By default, gzip keeps the original file name and timestamp in the compressed file. These are used when decompressing the file with the – N option. This is useful when the compressed file name was truncated or when the time stamp was not preserved after a file transfer. Compressed files can be restored to their original form using gzip -d or gunzip or gzcat.
    [Show full text]
  • The Ark Handbook
    The Ark Handbook Matt Johnston Henrique Pinto Ragnar Thomsen The Ark Handbook 2 Contents 1 Introduction 5 2 Using Ark 6 2.1 Opening Archives . .6 2.1.1 Archive Operations . .6 2.1.2 Archive Comments . .6 2.2 Working with Files . .7 2.2.1 Editing Files . .7 2.3 Extracting Files . .7 2.3.1 The Extract dialog . .8 2.4 Creating Archives and Adding Files . .8 2.4.1 Compression . .9 2.4.2 Password Protection . .9 2.4.3 Multi-volume Archive . 10 3 Using Ark in the Filemanager 11 4 Advanced Batch Mode 12 5 Credits and License 13 Abstract Ark is an archive manager by KDE. The Ark Handbook Chapter 1 Introduction Ark is a program for viewing, extracting, creating and modifying archives. Ark can handle vari- ous archive formats such as tar, gzip, bzip2, zip, rar, 7zip, xz, rpm, cab, deb, xar and AppImage (support for certain archive formats depends on the appropriate command-line programs being installed). In order to successfully use Ark, you need KDE Frameworks 5. The library libarchive version 3.1 or above is needed to handle most archive types, including tar, compressed tar, rpm, deb and cab archives. To handle other file formats, you need the appropriate command line programs, such as zipinfo, zip, unzip, rar, unrar, 7z, lsar, unar and lrzip. 5 The Ark Handbook Chapter 2 Using Ark 2.1 Opening Archives To open an archive in Ark, choose Open... (Ctrl+O) from the Archive menu. You can also open archive files by dragging and dropping from Dolphin.
    [Show full text]
  • How to 'Zip and Unzip' Files
    How to 'zip and unzip' files The Windows 10 operating system provides a very easy way to zip-up any file (or folder) you want by using a utility program called 7-zip (Seven Zip). The program is integrated in the context menu which you get when you right-click on anything selected. Here are the basic steps you need to take in order to: Zip a file and create an archive 1. Open a folder in your machine and select any file (by clicking on it once). I selected a single file called 'how-to send an email.docx' 2. Now right click the mouse to have the context menu appear 3. In the context menu you should be able to see some commands like the capture below 4. Since we want to zip up the file you need to select one of the bottom two options a. 'Add to archive' will actually open up a dialog of the 7-zip application and will give you the opportunity to customise the archive. b. 'Add to how-to send an email.zip' is actually the quickest way possible to create an archive. The software uses the name of the file and selects a default compression scheme (.zip) so that you can, with two clicks, create a zip archive containing the original file. 5. Now you can use the 'how-to send an email.zip' file and send it as a 'smaller' email attachment. Now consider that you have just received (via email) the 'how-to send an email.zip' file and you need to get (the correct phrase is extract) the file it contains.
    [Show full text]
  • Installing and Customizing Entirex Process Extractor Installing and Customizing Entirex Process Extractor
    Installing and Customizing EntireX Process Extractor Installing and Customizing EntireX Process Extractor Installing and Customizing EntireX Process Extractor This chapter covers the following topics: Delivery Scope Supported Platforms Prerequisites for using EntireX Process Extractor Installation Steps Customizing your EntireX Process Extractor Environment Delivery Scope The installation medium of the EntireX Process Extractor contains the following: 1 Installing and Customizing EntireX Process Extractor Delivery Scope File/Folder Description 3rdparty Source of open source components used for this product. Doc Documentation as PDF documents. UNIX For UNIX platforms. UNIX\EntireXProcessExtractor.tar The runtime part, which is unpacked to a folder for the runtime installation. Windows\ For Windows platforms. Windows\install\ Folder with two installable units: Design-time Part com.softwareag.entirex.processextractor.ide-82.zip This is installed into a Software AG Designer with EntireX Workbench 8.2 SP2. Runtime Part EntireXProcessExtractor.zip This is extracted to the folder for the runtime installation. Windows\lib\ Folder with Ant JARs and related JARs. Windows\scripts\ Folder with Ant script for installation, used by install.bat. Windows\install.bat Installation script for Windows. Windows\install.txt Description of the installation process for Windows. zOS For z/OS (USS) platforms. zOS\EntireXProcessExtractor.tar The runtime part, which is unpacked to a folder for the runtime installation. 3rdpartylicenses.pdf Document containing the license texts for all third party components. install.txt How to install the product on the different platforms. license.txt The Software AG license text. readme.txt Brief description of the product. The runtime part of the EntireX Process Extractor is provided as file EntirexProcessExtractor.zip in folder Windows\install, which contains the following files: 2 Delivery Scope Installing and Customizing EntireX Process Extractor File Description entirex.processextractor.jar The main JAR file for the EntireX Process Extractor.
    [Show full text]
  • Java Class Annotation Example
    Java Class Annotation Example Bud etherealizing her matriarch inimitably, unwavering and decayed. Antimonious and regulation Rog violated almost anywhere, though Saunderson tosses his Creon outdating. Which Roland disinhuming so ordinarily that Westleigh tooth her opposites? It is class to classes are pretty easy to reflection to list to catch, company or property to generate mock for? First method of java example. The java are given list of bibliography. Default annotations example, java code examples of the compiler to be applied to json. The new project for extracting information to create web sites without editions but i go into the annotated bibliography paper, we welcome to isolate the mechanics of using. Parsing the examples can be used from open source and. We will utilize the class analyzes the same type declaration etc at runtime reflection methods or evaluative lists the suite itself which are. Nice explanation about the front controller, we added and then issues a class of the information, management example demonstrates how can be executed and. There are working standalone spring boot application into system proposed here, because of annotations. Its annotations example annotation examples java. Hibernate does not to class or specify java example of fundamental never hurt or not. Read from java class acts as each article has been designed with examples select then we learned about? We made as classes that class or examples of annotation example classes or an earlier article example it tells spring. The table pointing back to interface. From java example is applied only contains a second argument. Junit provides a test cases, we want specific warnings and ideas into our newsletter for an understanding takt time in.
    [Show full text]
  • How to Compress LARGE Files (Greater Than 4GB) on IBM I for IBM I and Non-IBM I Systems
    How to Compress LARGE Files (Greater Than 4GB) on IBM i for IBM i and Non-IBM i Systems By Leo Whitaker Technical Support Supervisor The H.T. Hackney Co. – Grand Rapids SEMIUG May 24, 2016 You will need these commands… ADDENVVAR ENVVAR(JAVA_HOME) REPLACE(*YES) VALUE('/QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit') LEVEL(*JOB) cd '/home/user1' QSH CMD('jar cfM CUSTITEMPR.ZIP CUSTITEMPR.TXT') Scenario: - Customer/item pricing data file - Produced daily after Midnight in Knoxville - Ready to cross the WAN to GR by 3am wrklnk '/home/user1/CUSTITEMPR.TXT' Size of object data in bytes . : 29,582,702,600 - Estimated transmission time: 4.5 hours. - Order receiving system distributes the data to handheld order taking devices that work off-line through the day. - Devices are synced starting at 6am. - The data won’t be there until 7:30am :( Object Compression for i CRTSAVF FILE(QGPL/SAVEFILE) Object Type Attribute Size CSITTESTPR *FILE PF 12,303,405,056 SAVOBJ OBJ(CSITTESTPR) LIB(QGPL) DEV(*SAVF) OBJTYPE(*FILE) SAVF(QGPL/SAVEFILE) DTACPR(???) DTACPR(???) Run Time CPU Savefile Size Comp *NONE 2 Min .011 12,306,644,992 0% *LOW 2 Min .011 9,481,269,248 23% *MEDIUM 6 Min .010 2,601,541,632 79% *HIGH 29 Min .013 2,292,277,248 81% On the target IBM i… Create the *SAVF before attempting the transfer CRTSAVF FILE(QGPL/SAVEFILE) Transfer the file to the target system… FTP 192.168.1.1 user pass bin get SAVEFILE (replace quit Restore the object from the *SAVF RSTOBJ OBJ(CSITTESTPR) LIB(QGPL) DEV(*SAVF) OBJTYPE(*FILE) SAVF(QGPL/SAVEFILE) Not i ..
    [Show full text]
  • Java and C I CSE 351 Autumn 2016
    L26: JVM CSE351, Spring 2018 Java Virtual Machine CSE 351 Spring 2018 Model of a Computer “Showing the Weather” Pencil and Crayon on Paper Matai Feldacker-Grossman, Age 4 May 22, 2018 L26: JVM CSE351, Spring 2018 Roadmap C: Java: Memory & data Integers & floats car *c = malloc(sizeof(car)); Car c = new Car(); x86 assembly c->miles = 100; c.setMiles(100); c->gals = 17; c.setGals(17); Procedures & stacks float mpg = get_mpg(c); float mpg = Executables free(c); c.getMPG(); Arrays & structs Memory & caches Assembly get_mpg: Processes language: pushq %rbp Virtual memory movq %rsp, %rbp ... Memory allocation popq %rbp Java vs. C ret OS: Machine 0111010000011000 code: 100011010000010000000010 1000100111000010 110000011111101000011111 Computer system: 2 L26: JVM CSE351, Spring 2018 Implementing Programming Languages Many choices in how to implement programming models We’ve talked about compilation, can also interpret Interpreting languages has a long history . Lisp, an early programming language, was interpreted Interpreters are still in common use: . Python, Javascript, Ruby, Matlab, PHP, Perl, … Interpreter Your source code implementation Your source code Binary executable Interpreter binary Hardware Hardware 3 L26: JVM CSE351, Spring 2018 An Interpreter is a Program Execute (something close to) the source code directly Simpler/no compiler – less translation More transparent to debug – less translation Easier to run on different architectures – runs in a simulated environment that exists only inside the interpreter process . Just port the interpreter (program), not the program-intepreted Slower and harder to optimize 4 L26: JVM CSE351, Spring 2018 Interpreter vs. Compiler An aspect of a language implementation . A language can have multiple implementations . Some might be compilers and other interpreters “Compiled languages” vs.
    [Show full text]