Java VM and Class Loader

JwiK™ programs are written in Java and compiled using javac.exe which is part of the JDK. The latest version of the JDK is a prerequisite and can be downloaded for free here:

Java source code files are typically compiled into separate class files. At run time, the class loader pulls in classes accessed by the application and does a variety of security and validation checks before execution.

This is impractical for resource restricted microcontrollers so a new approach has been created. The VMFILE is JwiK™ replacement for the class file. It supports a subset of the Java language specification and has been optimized for size and performance.

The VMFILE does support inheritance, encapsulation, and polymorphism which are widely accepted, though highly debated, as the requirements for a language to be called "object oriented".

The VMFILE does not support interfaces and exceptions, so Interface, Try, Throw, throws, and Catch are not supported. A JwiK™ application will compile fine that uses these keywords, but will fail when the VMFILE is generated.

Compiler switches allow the JwiK™ Java VM to be compiled with optional features; the combination of optional features affects the overall size of the flash image. Compiler switches are defined in config.h in the appropriate platform directory. The following list shows the compiler switches and their meaning:
  • VM_INCLUDE_ARRAY - support arrays
  • VM_INCLUDE_STRINGS - support string processing
  • VM_INCLUDE_INHERITANCE - support inheritance (overloading and overriding)
  • VM_INCLUDE_FLOAT - support IEEE 32-bit floating point math (adds 3K to footprint)
  • VM_INCLUDE_32BIT_WORD - support 32 bit words (16-bit if not defined)
  • VM_INCLUDE_STDIO - adds STDIO support (adds 2K to footprint)
  • VM_INCLUDE_MATH - adds MATH support (adds 5K to footprint) - sin,cos, etc
  • VM_INCLUDE_FORMATTER - adds string formatting (adds 4K to footprint)

Last edited Jul 20, 2012 at 3:35 AM by stevetherfguy, version 1


No comments yet.