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 3 Introduction.....................................................................................................................................11 3.1 Origins, Legal Matters, Resources, and Acknowledgements...........................................................11 3.2 Basic Principles and Objectives.......................................................................................................11 3.3 Memory Image Format....................................................................................................................12 3.4 Object Format..................................................................................................................................12 3.5 Stack Frame Format........................................................................................................................13 3.6 Compiler Structure..........................................................................................................................13 3.7 Implemented Modules.....................................................................................................................15 3.8 Differences from Sun Java..............................................................................................................16 4 Frontend Modules for non-Java Files..............................................................................................17 4.1 Importing Binary Files....................................................................................................................17 4.2 Source File Lists..............................................................................................................................17 5 Compiler Functions.........................................................................................................................18 5.1 Compile Options..............................................................................................................................18 5.2 Symbol Information.........................................................................................................................22 6 Runtime Environment.....................................................................................................................25 6.1 Root Object.....................................................................................................................................25 6.2 Strings.............................................................................................................................................25 6.3 Typesystem and Code Related Classes............................................................................................25 6.4 Definition of the Runtime Environment for Allocation and Type Checking...................................26 6.5 Example Implementation of Required 32 Bit Runtime Routines.....................................................27 6.6 Runtime Extensions for the Use of Java Exceptions........................................................................30 6.7 Runtime Extensions for the Use of Synchronized Blocks................................................................31 6.8 Runtime Extensions for Stack Limit Checking................................................................................32 6.9 Runtime Extensions for the Use of Assert Statements.....................................................................32 6.10 Definition of the Optional Arithmetic Library.................................................................................32 7 Special Classes................................................................................................................................34 7.1 MAGIC...........................................................................................................................................34 7.2 SJC Annotations..............................................................................................................................38 7.3 STRUCT.........................................................................................................................................40 7.4 FLASH............................................................................................................................................40 8 Inline Arrays....................................................................................................................................41 8.1 Changes to the Object Structure......................................................................................................41 9 Indirect Scalars................................................................................................................................43 9.1 Changes to the Object Structure......................................................................................................43 9.2 Changes to the Runtime Environment.............................................................................................44 10 In-Image Symbol Information.........................................................................................................46 10.1 raw Symbol Information..................................................................................................................46 10.2 rte Symbol Information...................................................................................................................47 10.3 Mthd Symbol Information...............................................................................................................48 11 Native Linux and Windows Programs.............................................................................................49 11.1 Basic Functionality..........................................................................................................................49 11.2 Native Linux Programs....................................................................................................................49 11.3 Native Microsoft Windows Programs.............................................................................................52 12 Examples.........................................................................................................................................54 12.1 Use of Inlining.................................................................................................................................54 12.2 Access to I/O Ports..........................................................................................................................54 12.3 Writing Interrupt Handlers..............................................................................................................54 12.4 Use of STRUCTs.............................................................................................................................55 12.5 Initialization in Embedded Mode....................................................................................................56 12.6 Handcoded Method Calls................................................................................................................56 12.7 TextualCall......................................................................................................................................57 13 Bootloader.......................................................................................................................................59 14 References.......................................................................................................................................64 1 Quick introduction For a quick introduction, download the executable package (see [sjc] in the References section), which contains all the necessary files for the development of 32 and 64-bit operating systems: File Description b64_dsk.bin Floppy bootloader for 64-bit target systems bootconf.txt Configuration file for the boot image writer bts_dsk.bin
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages64 Page
-
File Size-