AJVM – Java Virtual Machine Implemented in Actionscript 3.0

AJVM – Java Virtual Machine Implemented in Actionscript 3.0

Journal of Automation, Mobile Robotics & Intelligent Systems VOLUME 10, N° 1 2016 AJVM – Java Virtual Machine Implemented in ActionScript 3.0 Submitted: 5th January 2016; accepted: 2nd February 2016 Arkadiusz Janik, Jakub Krawczyk DOI: 10.14313/JAMRIS_1-2016/8 solution allowing to execute (in an isolated environ- ment) the whole OS and other software designed for Abstract: This paper describes the concept and implementation (VMWare Workstation or Oracle xVM VirtualBox). details of AJVM – state-of-the art Java Virtual Machine Thea specific interpreter platform is software due to capable hardware of executing virtualization bina- (JVM) implemented in ActionScript 3.0. Action Script ry, precompiled code which is an output of a built-in is an objective programming language that supports compilation to Java bytecode. In the presented solu- device [7]. In the further part of this paper the term tion there has been a novel idea utilized – to use the virtualcompiler machine defining will its be own used architecture to denote the as interpreter.of a virtual other Virtual Machine’s execution environment (Action- Script Virtual Machine) to build Java Virtual Machine. 1.2. Flash Platform and ActionScript 3.0 The subset of features specified in JVM Specification Adobe Flash technology (previously known as v.2 supported by AJVM has been chosen in a way which Macromedia Flash) is a multimedia platform en- enables the machine to be used in many practical ap- abling new features in web pages: animations, video plications both in the commercial context as well as in streaming, interactivity commonly used to imple- science. As the architecture of AJVM is modular, the ex- ment games, advertisements as well as more sophis- tension of its features in the future will not cause any ticated and complex applications. difficulties. The implementation of AJVM in ActionScript 3.0 which is executed by ActionScript Virtual Machine (Shockwave Flash Object). Usually there is a single (AVM) makes it possible to use Java code in applications Flash applications are published as SWF files written in ActionScript 3.0. It spawns many new oppor- libraries and multimedia resources. In Flash 5 the tunities considering that AVM is a part of FlashPlayer – conceptfile per application of actions introduced even though in itFlash may 4contain was extend many- commonly used multimedia player available in the form Action Script term was used of plugins for the majority of modern web browsers, in- in the context of a programming language [10, 11]. cluding mobile versions. Flashed and, 7 forwas the released first time, together with the second ver- sion of ActionScript programming language: such Keywords: JVM, Action Script, bytecode features as type-control (during compilation) and inheritance based on classes were introduced. Flash Players 9 was released with ActionScript 3.0 – the 1. Introduction - Traditional, commercial implementations of JVM port downgrade compatibility, there are two virtual Specification aim to increase the performance of machineslanguage wasin the redesigned player: AVM1 significantly (to support and, toAction sup- a Virtual Machine (VM). As a result VMs are usually Script 1.0 and 2.0) and AVM2 (to support Action- implemented in low level programming languages, Script 3.0) [14]. The number of new features have tightly integrated with Operating System (OS) and been introduced to the player including performance hardware (Just In Time compilers that compile by- tecode into native code of the hardware platform). OpenGL), type-control (during code compilation and The goal of AJVM is to execute Java applications in execution),optimization separation (hardware of acceleration class-based forand DirectX prototype- and a variety of computers equipped mainly with a web based inheritance, using packages, namespaces and browser, to increase code reusability by making it regular expressions, new bytecode format, support possible to use Java libraries in Flash applications and to provide convenient platform for end-users to To sum up: ActionScript 3.0 is object-based, im- observe and understand concepts behind JVM. On perativefor E4X format programing and others. language with strong type-con- top of that the solution extends Flash platform with trol, compiled to bytecode being executed on AVM2 new features: multi-threading, blocking operations, virtual machine, single-threaded (driven by events generic classes as well as a new concept of execut- triggered by Flash Player) so not supporting blocking ing bytecode. methods, with automatic memory management (Gar- bage Collector), not supporting generic classes, not 1.1. Basic Terms supporting anonymous classes. There are two major types of virtual machines: In the further part of the paper any references to emulators and interpreters [9]. The emulator is a Action Script will refer to Action Script 3.0. 58 Journal of Automation, Mobile Robotics & Intelligent Systems VOLUME 10, N° 1 2016 2. Related Work AminNes – Flash NES Emulator – Flash NES Emu- There are two major aspects of the contribution lator is an emulator of Nintendo Entertainment System of our work: Implementation of Java Virtual Machine in a non- 2KB video memory. The emulator supports MOS 6502 standard environment and– 8 bitsguarantees gaming theconsole highest equipped quality withof rendered 2kB RAM video. and Emulation of Java platform inside Flash Player. Flip8 – CHIP-8 Flash Emulator - In the opinion of the authors, there are no solu- tions other than AJVM that handle both: Action Script in 70s used to interpret programming– Flip8 language is an called emu and JVM. This makes AJVM a unique system capable of lator of CHIP-8. CHIP-8 is a virtual machine designed- emulating Java platform inside Flash Player. There are number of publications on the subject includingCHIP-8. It 35 used different to be operationsinstalled on [19]. a graphical calcu of non-standard JVMs including the ones mentioned lators. Flip8 is an emulator able to execute bytecode below: 3. Implementation of JVM in ActionScript 3.0 Jamiga – the goal of the project is to execute Java ActionScript Java Virtual Machine (AJVM) was applications on Amiga computers [16]. implemented in Action Script [13]. It implements JC – the property of the JVM is a novel approach to executing bytecode. All Java classes are translated JVM v.2.0. The sections included below present more - informationa subset of features on the architecture described in and the implementationspecification of piled to native code thus enabling performance simi- problems the authors of this article had to solve. laron-the-fly to traditional to source Just code In Time in C languageCompilers and (JITs) then [17]. com Squawk – implementation of JVM for Java ME (Mi- 3.1. Virtual Machine vs Standard Library cro Edition) for embedded systems and small, mobile The crucial part of the implementation of any devices. All elements, except for low-level modules sup- Java Virtual Machine is a standard library – the im- - plementation of core Java classes described by JVM plemented in Java (including Garbage Collector) [15]. Hello portingGNU I/O Classpath operations – Java and Standard OS specific Library code, distributwere im- Word Java application requires hundreds of core Java ed under GNU license providing a great base to build classesspecification to be present[4]. Even and execution loaded into of the VM. simplest The solution own JVMs [20]. described in the paper contains following elements in JOP - terms of a standard library: plementation of JVM with predictable execution time AJVM library – ActionScript 3.0 library contain- – Java Optimized Processor is a hardware im Flash or Flex projects. Flex is a set of components al- afor low embedded cost FPGA real-time (Field-Programmable systems. Due toGate the Array). small ing executable files of AJVM, ready to be used in any- size of the processor used, it can be implemented in be of more importance though slightly more expen- Silverlightlowing a developer [12]. to write RIA applications. It is be siveFor low than volume conventional systems, processors. the flexibility The ofprocessor an FPGA wascan ing ARTcompared standard to technologies library – suchan equivalent as XUL, JavaFX of Java or standard library included in any JVM distributions - sordesigned executes in VHDL bytecode programming directly, without language necessity (Very high to speed Hardware Description Language). The proces- native(such asimplementation JRE System Library of selected for JavaSE). methods A in standard the VM. Forlibrary the ispurpose specific of for AJVM VM implementationwe implemented as a itstandard expects (whichcompile is in-time consistent nor withto parse/interpret JVM –stack-based class VM files. rather Us thaning FPGA register-based) allows JOP to[21]. dynamically declare stack size based on GNU Classpath. Sable VM libraryAs the called authors ART focused (ActionScript on the selectedRuntime) features which ofis virtual machine, using state-of-the-art interpretation techniques. Its– goalsis a highly is to portablebe reasonably and efficient small, fast,Java standard library though it is possible to extend the implementationJVM, the ART is not in future. a complete implementation of the and compliant with the various specifications (JVM 3.2. High Level Overview of AJVM specification,2.1. Emulators JNI, of invocation Other Platforms interface, Implemented etc.) [18]. AJVM is available as an object created by the pro- in the Flash grammer’s code inside his/her Flash application (in Even though ActionScript 3.0 is relatively new lan- the similar way as for Jython interpreter for Python guage there have been several emulators implement- programming language). Consequently, the program- ed so far: mer’s code has a full control over AJVM. Moreover, FC64 – Flash Commodore 64 Emulator – FC64 is several isolated instances of AJVM within the single a low-level, fully functional emulator of Commodore Flash host application can be created. 64 allowing a user to execute applications designed - for Commodore 64 as well as to write code in BASIC ally the code of Flash host-application and the code programming language [22].

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    11 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us