diff -U 3 -H -d -r -N -- epos--/app/pc_app.cc epos--jvm/app/pc_app.cc --- epos--/app/pc_app.cc 2010-07-21 23:02:24.000000000 -0300 +++ epos--jvm/app/pc_app.cc 2010-12-08 12:13:56.000000000 -0200 @@ -15,29 +15,38 @@ #include #include +#include +#include +#include + +extern "C" { + +int printf(char *, ...) { + // gotcha! +} + +void exit(int statuc) { + epos_prints(" Dica: Aqui a gente destroi a Thread Java.\n"); + for(;;); //ever +} + +} __USING_SYS -int main() -{ - OStream cout; +OStream cout; - cout << "I'm just a dummy test application.\n"; - cout << "Since I have nothing better to do, I'll start an ubound memory test (that is, I'll even test the memory your computer doesn't have :-)!!\n"; - cout << "Testing memory: "; +int function_that_never_ends(){ + while(true); +} - Display disp; - for(char * ptr = (char *)(1024*1024); - ptr < (char *)0xffffffff; - ptr+= 64) { - disp.position(-1, 16); - cout << (void *)ptr; - *ptr = 'G'; - if(*ptr != 'G') { - cout << "\nLast memory position at " << ptr << "!\n"; - break; - } - } - return 0; +int main() { + + Thread vm_exec(&jvm_main); + + Thread thread_that_never_ends(&function_that_never_ends); + thread_that_never_ends.join(); // WTF!?!? + + return 0; } diff -U 3 -H -d -r -N -- epos--/app/philosophae.cc epos--jvm/app/philosophae.cc --- epos--/app/philosophae.cc 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/app/philosophae.cc 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,74 @@ +// EPOS-- Semaphore Test Program + +// This work is licensed under the EPOS Software License for non-commercial use. +// A copy of this license is available in the EPOS source-tree root, +// and can also be found online at: +// http://epos.lisha.ufsc.br/EPOS+Software+License+v1.0 + + +#include +#include +#include +#include +#include + +__USING_SYS + +const int iterations = 10; + +Semaphore sem_display; + +Thread * phil[5]; +Semaphore * chopstick[5]; + +OStream cout; + +int philosopher(int n, int l, int c) +{ + while(true) + cout << "Who's your daddy?\n"; + return 0; +} + +int main() +{ + sem_display.p(); + Display::clear(); + cout << "The Philosopher's Dinner:\n"; + + for(int i = 0; i < 5; i++) + chopstick[i] = new Semaphore; + + phil[0] = new Thread(&philosopher, 0, 5, 32); + phil[1] = new Thread(&philosopher, 1, 10, 44); + phil[2] = new Thread(&philosopher, 2, 16, 39); + phil[3] = new Thread(&philosopher, 3, 16, 24); + phil[4] = new Thread(&philosopher, 4, 10, 20); + + cout << "Philosophers are alive and hungry!\n"; + + cout << "The dinner is served ...\n"; + Display::position(7, 44); + cout << '/'; + Display::position(13, 44); + cout << '\\'; + Display::position(16, 35); + cout << '|'; + Display::position(13, 27); + cout << '/'; + Display::position(7, 27); + cout << '\\'; + sem_display.v(); + + while(true); + + + for(int i = 0; i < 5; i++) + delete chopstick[i]; + for(int i = 0; i < 5; i++) + delete phil[i]; + + cout << "The end!\n"; + + return 0; +} diff -U 3 -H -d -r -N -- epos--/include/javathread.h epos--jvm/include/javathread.h --- epos--/include/javathread.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/include/javathread.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,60 @@ +#ifndef __JAVATHREAD_T_DOWQ +#define __JAVATHREAD_T_DOWQ + +#include +#include +#include "../src/vm/vm.h" +#include "../src/vm/stack.h" + +#define JAVA_THREAD_STACK_SIZE 100 + +__BEGIN_SYS + +class JavaThread: Thread { + + //nvm_stack_t context[100]; + nvm_stack_t *_locals; + nvm_stack_t *_sp; + nvm_stack_t *_stackbase; + nvm_stack_t *_stack; + + void save_context(){ + _locals = locals; + _sp = sp; + _stackbase = stackbase; + _stack = stack; + } + + void load_context(){ + locals = _locals; + sp = _sp; + stackbase = _stackbase; + stack = _stack; + } + +public: + + JavaThread(int (*entry)(u16_t, nvm_stack_t), u16_t mref, nvm_stack_t objref): + Thread(entry, mref, objref, SUSPENDED) + { + _stack = new nvm_stack_t[JAVA_THREAD_STACK_SIZE]; + _stackbase = stack; + _sp = stackbase; + + this->resume(); + } + + virtual ~JavaThread(); + + virtual void prepare_to_save_context(){ + save_context(); + } + + virtual void prepare_to_load_context(){ + load_context(); + } +}; + +__END_SYS + +#endif diff -U 3 -H -d -r -N -- epos--/include/thread.h epos--jvm/include/thread.h --- epos--/include/thread.h 2010-07-21 23:02:22.000000000 -0300 +++ epos--jvm/include/thread.h 2010-12-08 12:21:21.000000000 -0200 @@ -134,6 +134,8 @@ void pass(); void suspend() { suspend(false); } void resume(); + virtual void prepare_to_save_context(); + virtual void prepare_to_load_context(); static Thread * self() { return running(); } static void yield(); @@ -184,9 +186,12 @@ db(TRC) << "Thread::dispatch(prev=" << prev << ",next=" << next << ")\n"; - if(smp) - _lock.release(); - CPU::switch_context(&prev->_context, next->_context); + if(smp) + _lock.release(); + + prev->prepare_to_save_context(); + next->prepare_to_load_context(); + CPU::switch_context(&prev->_context, next->_context); } else if(smp) _lock.release(); diff -U 3 -H -d -r -N -- epos--/include/traits.h epos--jvm/include/traits.h --- epos--/include/traits.h 2010-07-21 23:02:22.000000000 -0300 +++ epos--jvm/include/traits.h 2010-12-08 12:13:56.000000000 -0200 @@ -17,7 +17,7 @@ { static const bool enabled = true; static const bool debugged = false; - static const bool power_management = false; + static const bool power_management = true; }; @@ -26,8 +26,8 @@ { static const bool error = true; static const bool warning = true; - static const bool info = false; - static const bool trace = false; + static const bool info = true; + static const bool trace = true; }; template <> struct Traits: public Traits @@ -76,7 +76,7 @@ // Abstractions template <> struct Traits: public Traits { - typedef Scheduling_Criteria::Priority Criterion; + typedef Scheduling_Criteria::Round_Robin Criterion; static const bool smp = false; static const bool trace_idle = false; static const unsigned int QUANTUM = 10000; // us diff -U 3 -H -d -r -N -- epos--/include/wrapper_jvm.h epos--jvm/include/wrapper_jvm.h --- epos--/include/wrapper_jvm.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/include/wrapper_jvm.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,17 @@ +#include "../src/vm/vm.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void epos_putc(char); +void epos_prints(char *); +void epos_printi(int); + +void epos_new_javathread(u16_t mref, nvm_stack_t objref); + +int jvm_main(); + +#ifdef __cplusplus +} +#endif diff -U 3 -H -d -r -N -- epos--/makedefs epos--jvm/makedefs --- epos--/makedefs 2010-07-21 23:02:24.000000000 -0300 +++ epos--jvm/makedefs 2010-12-08 12:13:56.000000000 -0200 @@ -193,7 +193,7 @@ # Paths, prefixes and suffixes TOP = $(EPOS) -INCLUDE = $(TOP)/include +INCLUDE = $(TOP)/include -I$(TOP)/src/vm/ SRC = $(TOP)/src APP = $(TOP)/app BIN = $(TOP)/bin @@ -218,6 +218,7 @@ LUTIL = $(LUTILNAME)_$(ARCH) ifndef APPLICATION APPLICATION = $(MACH)_app +#APPLICATION = philosophae endif # Tools to adapt linux files diff -U 3 -H -d -r -N -- epos--/nanovmtool/.cvsignore epos--jvm/nanovmtool/.cvsignore --- epos--/nanovmtool/.cvsignore 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/.cvsignore 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,3 @@ +build +*.class +dist diff -U 3 -H -d -r -N -- epos--/nanovmtool/Counter.java epos--jvm/nanovmtool/Counter.java --- epos--/nanovmtool/Counter.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/Counter.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,15 @@ +public class Counter { + private int count; + + public Counter(){ + count = 3; + } + + public void count(){ + count++; + } + + public int value(){ + return count; + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/Main.h epos--jvm/nanovmtool/Main.h --- epos--/nanovmtool/Main.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/Main.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,25 @@ +/* Main.h, autogenerated from Main class */ +{ +0x00, 0x00, 0x00, 0xbe, 0x02, 0x0a, 0x01, 0x00, 0x15, 0x00, 0x15, 0x00, 0x88, 0x00, 0x00, 0x10, +0x00, 0x02, 0x01, 0x10, 0x00, 0x08, 0x00, 0x1e, 0x00, 0x37, 0x00, 0x51, 0x00, 0x43, 0x72, 0x69, +0x61, 0x6e, 0x64, 0x6f, 0x20, 0x75, 0x6d, 0x20, 0x50, 0x72, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x2e, +0x2e, 0x2e, 0x00, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x74, 0x6f, 0x72, 0x20, 0x64, 0x6f, +0x20, 0x50, 0x72, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x2e, 0x2e, 0x00, 0x43, 0x68, 0x61, 0x6d, +0x61, 0x6e, 0x64, 0x6f, 0x20, 0x73, 0x75, 0x70, 0x65, 0x72, 0x2e, 0x73, 0x74, 0x61, 0x72, 0x74, +0x28, 0x29, 0x2e, 0x2e, 0x2e, 0x00, 0x43, 0x68, 0x61, 0x6d, 0x61, 0x6e, 0x64, 0x6f, 0x20, 0x53, +0x74, 0x61, 0x74, 0x69, 0x63, 0x54, 0x68, 0x72, 0x65, 0x61, 0x64, 0x2e, 0x73, 0x74, 0x61, 0x72, +0x74, 0x28, 0x74, 0x68, 0x69, 0x73, 0x29, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, +0x4d, 0x00, 0x01, 0x00, 0x00, 0x01, 0x03, 0x03, 0x68, 0x00, 0x02, 0x01, 0x00, 0x02, 0x02, 0x02, +0x72, 0x00, 0x03, 0x01, 0x00, 0x01, 0x01, 0x02, 0x77, 0x00, 0x04, 0x01, 0x00, 0x01, 0x01, 0x02, +0x7c, 0x00, 0x00, 0x02, 0x00, 0x01, 0x01, 0x01, 0x79, 0x00, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00, +0x75, 0x00, 0x04, 0x02, 0x00, 0x01, 0x01, 0x02, 0x7a, 0x00, 0x06, 0x02, 0x00, 0x01, 0x01, 0x01, +0x77, 0x00, 0x03, 0x02, 0x00, 0x01, 0x01, 0x01, 0x1a, 0xb7, 0x10, 0x00, 0xb1, 0x11, 0x11, 0x00, +0x12, 0x00, 0xb6, 0x12, 0x01, 0xbb, 0x01, 0x00, 0x59, 0x04, 0xb7, 0x00, 0x02, 0x3c, 0xbb, 0x01, +0x00, 0x59, 0x05, 0xb7, 0x00, 0x02, 0x3d, 0x1b, 0xb6, 0x00, 0x04, 0x1c, 0xb6, 0x00, 0x04, 0xb1, +0x1a, 0xb7, 0x00, 0x05, 0x1a, 0x1b, 0xb5, 0x00, 0x00, 0x11, 0x11, 0x00, 0x12, 0x01, 0xb6, 0x12, +0x01, 0xb1, 0x11, 0x11, 0x00, 0x1a, 0xb4, 0x00, 0x00, 0xb6, 0x12, 0x02, 0xa7, 0xff, 0xf6, 0x11, +0x11, 0x00, 0x12, 0x02, 0xb6, 0x12, 0x01, 0x1a, 0xb7, 0x00, 0x07, 0xb1, 0x1a, 0xb7, 0x10, 0x00, +0xb1, 0xb8, 0x2d, 0x03, 0xb1, 0x11, 0x11, 0x00, 0x12, 0x03, 0xb6, 0x12, 0x01, 0x1a, 0xb8, 0x2d, +0x01, 0xb1, 0x1a, 0xb8, 0x2d, 0x04, 0xb1, 0x1a, 0xb8, 0x2d, 0x02, 0xb1, 0x00, 0x00, 0x00, 0xbe, +0x02, 0x0a, 0x01, 0x00, 0x15, 0x00, 0x15, 0x00, 0x88, 0x00, 0x00 +}; diff -U 3 -H -d -r -N -- epos--/nanovmtool/Main.java epos--jvm/nanovmtool/Main.java --- epos--/nanovmtool/Main.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/Main.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,9 @@ +public class Main{ + public static void main(String[] args){ + System.out.println("Criando um Printer..."); + Printer p1 = new Printer(1); + Printer p2 = new Printer(2); + p1.start(); + p2.start(); + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/Printer.java epos--jvm/nanovmtool/Printer.java --- epos--/nanovmtool/Printer.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/Printer.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,20 @@ +public class Printer extends Thread { + + int p; + + Printer(int j){ + p = j; + System.out.println("Construtor do Printer..."); + } + + void run(){ + while(true) + System.out.println(p); + } + + void start(){ + System.out.println("Chamando super.start()..."); + super.start(); + //System.out.println(p); + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/StaticThread.java epos--jvm/nanovmtool/StaticThread.java --- epos--/nanovmtool/StaticThread.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/StaticThread.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,6 @@ +public class StaticThread { + native static void sleep(); + native static void run(Object ref); + native static void start(Object ref); + native static void join(Object ref); +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/SuperFalador.java epos--jvm/nanovmtool/SuperFalador.java --- epos--/nanovmtool/SuperFalador.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/SuperFalador.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,6 @@ +class SuperFalador { + void fala() { + System.out.println("Super falador falando."); + } + +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/Thread.java epos--jvm/nanovmtool/Thread.java --- epos--/nanovmtool/Thread.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/Thread.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,19 @@ +public class Thread { + + static void sleep(){ + StaticThread.sleep(); + } + + void start(){ + System.out.println("Chamando StaticThread.start(this)"); + StaticThread.start(this); + } + + void join(){ + StaticThread.join(this); + } + + void run() { + StaticThread.run(this); + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/asuro_upload.bat epos--jvm/nanovmtool/asuro_upload.bat --- epos--/nanovmtool/asuro_upload.bat 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/asuro_upload.bat 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,11 @@ +@rem +@rem asuro_upload.bat +@rem +@rem batch script to convert and upload class files to the NanoVM on the Asuro +@rem + +@rem Set these to the values matching your system!! +set JAVALIB="c:\Program Files\Java\jre1.5.0_04\lib" +set ASUROCLASS=e:\projekte\nanovm\java + +java -cp %JAVALIB%\comm.jar;./NanoVMTool.jar NanoVMTool -f COM1 config\Asuro.config %ASUROCLASS% %1 \ No newline at end of file diff -U 3 -H -d -r -N -- epos--/nanovmtool/build/classes/org/nanovm/NanoVMTool.mf epos--jvm/nanovmtool/build/classes/org/nanovm/NanoVMTool.mf --- epos--/nanovmtool/build/classes/org/nanovm/NanoVMTool.mf 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/build/classes/org/nanovm/NanoVMTool.mf 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: NanoVMTool + diff -U 3 -H -d -r -N -- epos--/nanovmtool/build/classes/org/nanovm/gui/configurations.xml epos--jvm/nanovmtool/build/classes/org/nanovm/gui/configurations.xml --- epos--/nanovmtool/build/classes/org/nanovm/gui/configurations.xml 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/build/classes/org/nanovm/gui/configurations.xml 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,13 @@ + + + + + + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/build.xml epos--jvm/nanovmtool/build.xml --- epos--/nanovmtool/build.xml 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/build.xml 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,69 @@ + + + + + + Builds, tests, and runs the project NanoVMTool. + + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/AVR.native epos--jvm/nanovmtool/config/AVR.native --- epos--/nanovmtool/config/AVR.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/AVR.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,21 @@ +# +# AVR.native +# + +class nanovm/avr/AVR 21 + +method getClock:()I 1 + +# AVR supports 8 ports +field portA:Lnanovm/avr/Port; 0 +field portB:Lnanovm/avr/Port; 1 +field portC:Lnanovm/avr/Port; 2 +field portD:Lnanovm/avr/Port; 3 +field portE:Lnanovm/avr/Port; 4 +field portF:Lnanovm/avr/Port; 5 +field portG:Lnanovm/avr/Port; 6 +field portH:Lnanovm/avr/Port; 7 + +# AVR supports two PWM units +field pwm0:Lnanovm/avr/Pwm; 0 +field pwm1:Lnanovm/avr/Pwm; 1 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Adc.native epos--jvm/nanovmtool/config/Adc.native --- epos--/nanovmtool/config/Adc.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Adc.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,10 @@ +# +# Adc.native +# + +class nanovm/avr/Adc 26 + +method setPrescaler:(I)V 1 +method setReference:(I)V 2 +method getValue:(I)I 3 +method getByte:(I)I 4 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Asuro.config epos--jvm/nanovmtool/config/Asuro.config --- epos--/nanovmtool/config/Asuro.config 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Asuro.config 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,20 @@ +# +# Asuro.config +# +# direct upload configuration for linux using /dev/ttyS0 +# + +name Asuro +maxsize 512 # Asuro is based on Mega8 + +# info on target +target Asuro +filename /dev/ttyS0 +speed 2400 + +# load lists of native methods +native System +native PrintStream +native StringBuffer +native StringBuilder +native Asuro diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Asuro.native epos--jvm/nanovmtool/config/Asuro.native --- epos--/nanovmtool/config/Asuro.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Asuro.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,15 @@ +# +# Asuro.native +# + +class nanovm/asuro/Asuro 28 + +method :()V 0 +method statusLED:(I)V 1 +method wait:(I)V 2 +method motor:(II)V 3 +method lineLED:(I)V 4 +method backLED:(II)V 5 +method lineSensor:(I)I 6 +method motorSensor:(I)I 7 +method getSwitches:(I)I 8 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Ctbot.config epos--jvm/nanovmtool/config/Ctbot.config --- epos--/nanovmtool/config/Ctbot.config 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Ctbot.config 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,36 @@ +# +# Ctbot.config +# +# direct upload configuration for linux using /dev/ttyS0 +# + +name Ctbot +maxsize 8192 # Ctbot is based on Mega32 using 8k of flash memory + +# info on target +target UART +filename /dev/ttyS0 +speed 2400 + +# load lists of native methods +native System +native PrintStream +native StringBuffer +native StringBuilder +native Math +native Formatter +native ctbot/Bot +native ctbot/Clock +native ctbot/Display +native ctbot/DistanceSensor +native ctbot/EdgeDetector +native ctbot/IrReceiver +native ctbot/LdrSensor +native ctbot/Leds +native ctbot/LightBarrier +native ctbot/LineDetector +native ctbot/Motor +native ctbot/Mouse +native ctbot/Servo +native ctbot/ShutterSensor +native ctbot/WheelEncoder diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/EPOS.config epos--jvm/nanovmtool/config/EPOS.config --- epos--/nanovmtool/config/EPOS.config 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/EPOS.config 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,16 @@ +# +# EPOS.config +# + +name EPOSTest +maxsize 65536 + +target file + +#load lists of native methods, fields, etc.. + +native System +native PrintStream +native StaticThread +#native Semaphore + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Formatter.native epos--jvm/nanovmtool/config/Formatter.native --- epos--/nanovmtool/config/Formatter.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Formatter.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,10 @@ +# +# Formatter.native +# + +class nanovm/util/Formatter 44 + +method :()V 0 +method format:(ILjava/lang/String;)Ljava/lang/String; 1 +method format:(ZLjava/lang/String;)Ljava/lang/String; 2 +method format:(FLjava/lang/String;)Ljava/lang/String; 3 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/InputStream.native epos--jvm/nanovmtool/config/InputStream.native --- epos--/nanovmtool/config/InputStream.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/InputStream.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,8 @@ +# +# InputStream.native +# + +class java/io/InputStream 19 + +method available:()I 1 +method read:()I 2 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Lcd.native epos--jvm/nanovmtool/config/Lcd.native --- epos--/nanovmtool/config/Lcd.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Lcd.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,11 @@ +# +# Lcd.native +# + +class nanovm/io/Lcd 27 + +method clear:()V 1 +method gotoYX:(II)V 2 +method print:(Ljava/lang/String;)V 3 +method print:(I)V 4 +method print:(C)V 5 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Math.native epos--jvm/nanovmtool/config/Math.native --- epos--/nanovmtool/config/Math.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Math.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,30 @@ +# +# Math.native +# + +class nanovm/lang/Math 43 + +method abs:(F)F 1 +method abs:(I)I 2 +method acos:(F)F 3 +method asin:(F)F 4 +method atan:(F)F 5 +method atan2:(FF)F 6 +method ceil:(F)F 7 +method cos:(F)F 8 +method exp:(F)F 9 +method floor:(F)F 10 +method log:(F)F 11 +method max:(FF)F 12 +method max:(II)I 13 +method min:(II)I 14 +method min:(FF)F 15 +method pow:(FF)F 16 +method random:()F 17 +method rint:(F)F 18 +method round:(F)I 19 +method sin:(F)F 20 +method sqrt:(F)F 21 +method tan:(F)F 22 +method toDegrees:(F)F 23 +method toRadians:(F)F 24 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Mega32-LCD.config epos--jvm/nanovmtool/config/Mega32-LCD.config --- epos--/nanovmtool/config/Mega32-LCD.config 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Mega32-LCD.config 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,24 @@ +# +# Mega32.config +# + +name Mega32-with-LCD +maxsize 1024 + +# info on target +target UART +filename /dev/ttyS0 +speed 9600 + +# load lists of native methods +native System +native PrintStream +native InputStream +native StringBuffer +native StringBuilder +native AVR +native Port +native Timer +native Adc +native Pwm +native Lcd diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Mega32.config epos--jvm/nanovmtool/config/Mega32.config --- epos--/nanovmtool/config/Mega32.config 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Mega32.config 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,23 @@ +# +# Mega32.config +# + +name Mega32-Generic +maxsize 1024 + +# info on target +target UART +filename /dev/ttyS0 +speed 9600 + +# load lists of native methods +native System +native PrintStream +native InputStream +native StringBuffer +native StringBuilder +native AVR +native Port +native Timer +native Adc +native Pwm diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Mega8.config epos--jvm/nanovmtool/config/Mega8.config --- epos--/nanovmtool/config/Mega8.config 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Mega8.config 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,23 @@ +# +# Mega8.config +# + +name Mega8-Generic +maxsize 512 + +# info on target +target UART +filename /dev/ttyS0 +speed 9600 + +# load lists of native methods +native System +native PrintStream +native InputStream +native StringBuffer +native StringBuilder +native AVR +native Port +native Timer +native Adc +native Pwm diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/NIBObee.config epos--jvm/nanovmtool/config/NIBObee.config --- epos--/nanovmtool/config/NIBObee.config 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/NIBObee.config 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,28 @@ +# +# NIBObee.config +# +# direct upload configuration for linux using /dev/ttyS0 +# + +name NIBObee +maxsize 16384 # Nibo is based on an ATmega16 using 16k of flash memory + +# info on target +target UART +filename /dev/ttyS0 +speed 2400 + +# load lists of native methods +native System +native PrintStream +native StringBuffer +native StringBuilder +native Math +native Formatter +native nibobee/Bot +native nibobee/Clock +native nibobee/Leds +native nibobee/LineDetector +native nibobee/Motor +native nibobee/Sensor +native nibobee/WheelEncoder diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Nibo.config epos--jvm/nanovmtool/config/Nibo.config --- epos--/nanovmtool/config/Nibo.config 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Nibo.config 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,32 @@ +# +# Nibo.config +# +# direct upload configuration for linux using /dev/ttyS0 +# + +name Nibo +maxsize 131072 # Nibo is based on an ATmega128 using 128k of flash memory + +# info on target +target UART +filename /dev/ttyS0 +speed 2400 + +# load lists of native methods +native System +native PrintStream +native StringBuffer +native StringBuilder +native Math +native Formatter +native nibo/Bot +native nibo/Clock +native nibo/TextDisplay +native nibo/GraphicDisplay +native nibo/DistanceSensor +native nibo/EdgeDetector +native nibo/IrTransceiver +native nibo/Leds +native nibo/LineDetector +native nibo/Motor +native nibo/WheelEncoder diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Nibo2.config epos--jvm/nanovmtool/config/Nibo2.config --- epos--/nanovmtool/config/Nibo2.config 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Nibo2.config 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,32 @@ +# +# Nibo2.config +# +# direct upload configuration for linux using /dev/ttyS0 +# + +name Nibo2 +maxsize 131072 # Nibo is based on an ATmega128 using 128k of flash memory + +# info on target +target UART +filename /dev/ttyS0 +speed 2400 + +# load lists of native methods +native System +native PrintStream +native StringBuffer +native StringBuilder +native Math +native Formatter +native nibo2/Bot +native nibo2/Clock +native nibo2/TextDisplay +native nibo2/GraphicDisplay +native nibo2/DistanceSensor +native nibo2/EdgeDetector +native nibo2/IrTransceiver +native nibo2/Leds +native nibo2/LineDetector +native nibo2/Motor +native nibo2/WheelEncoder diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Object.native epos--jvm/nanovmtool/config/Object.native --- epos--/nanovmtool/config/Object.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Object.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,7 @@ +# +# Object.native +# + +class java/lang/Object 16 + +method :()V 0 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Port.native epos--jvm/nanovmtool/config/Port.native --- epos--/nanovmtool/config/Port.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Port.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,10 @@ +# +# Port.native +# + +class nanovm/avr/Port 22 + +method setInput:(I)V 1 +method setOutput:(I)V 2 +method setBit:(I)V 3 +method clrBit:(I)V 4 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/PrintStream.native epos--jvm/nanovmtool/config/PrintStream.native --- epos--/nanovmtool/config/PrintStream.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/PrintStream.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,13 @@ +# +# PrintStream.native +# + +class java/io/PrintStream 18 + +method println:(Ljava/lang/String;)V 1 +method println:(I)V 2 +method println:(C)V 3 +method print:(Ljava/lang/String;)V 4 +method print:(I)V 5 +method print:(C)V 6 +method format:(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream; 7 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Pwm.native epos--jvm/nanovmtool/config/Pwm.native --- epos--/nanovmtool/config/Pwm.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Pwm.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,8 @@ +# +# Pwm.native +# + +class nanovm/avr/Pwm 25 + +method setPrescaler:(I)V 1 +method setRatio:(I)V 2 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Semaphore.native epos--jvm/nanovmtool/config/Semaphore.native --- epos--/nanovmtool/config/Semaphore.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Semaphore.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,5 @@ +class java/epos/Semaphore 46 + +method : () +method p: ()V 0 +method v: ()V 1 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/StaticThread.native epos--jvm/nanovmtool/config/StaticThread.native --- epos--/nanovmtool/config/StaticThread.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/StaticThread.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,7 @@ +class StaticThread 45 + +method :()V 0 +method start:(Ljava/lang/Object;)V 1 +method run:(Ljava/lang/Object;)V 2 +method sleep:()V 3 +method join:(Ljava/lang/Object;)V 4 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/StringBuffer.native epos--jvm/nanovmtool/config/StringBuffer.native --- epos--/nanovmtool/config/StringBuffer.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/StringBuffer.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,13 @@ +# +# StringBuffer.native +# + +class java/lang/StringBuffer 20 + +method :()V 0 +method :(Ljava/lang/String;)V 1 +method append:(Ljava/lang/String;)Ljava/lang/StringBuffer; 2 +method append:(I)Ljava/lang/StringBuffer; 3 +method append:(C)Ljava/lang/StringBuffer; 4 +method toString:()Ljava/lang/String; 5 +method append:(F)Ljava/lang/StringBuffer; 6 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/StringBuilder.native epos--jvm/nanovmtool/config/StringBuilder.native --- epos--/nanovmtool/config/StringBuilder.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/StringBuilder.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,13 @@ +# +# StringBuilder.native +# + +class java/lang/StringBuilder 20 + +method :()V 0 +method :(Ljava/lang/String;)V 1 +method append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 2 +method append:(I)Ljava/lang/StringBuilder; 3 +method append:(C)Ljava/lang/StringBuilder; 4 +method toString:()Ljava/lang/String; 5 +method append:(F)Ljava/lang/StringBuilder; 6 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/System.native epos--jvm/nanovmtool/config/System.native --- epos--/nanovmtool/config/System.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/System.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,8 @@ +# +# System.native +# + +class java/lang/System 17 + +field out:Ljava/io/PrintStream; 0 +field in:Ljava/io/InputStream; 1 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Thread.native epos--jvm/nanovmtool/config/Thread.native --- epos--/nanovmtool/config/Thread.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Thread.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,7 @@ +class Thread 45 + +method :()V 0 +method start:()V 1 +method run:()V 2 +method sleep:()V 3 +method join:()V 4 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/Timer.native epos--jvm/nanovmtool/config/Timer.native --- epos--/nanovmtool/config/Timer.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/Timer.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,10 @@ +# +# Timer.native +# + +class nanovm/avr/Timer 23 + +method setSpeed:(I)V 1 +method get:()I 2 +method wait:(I)V 3 +method setPrescaler:(I)V 4 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/UnixTest.config epos--jvm/nanovmtool/config/UnixTest.config --- epos--/nanovmtool/config/UnixTest.config 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/UnixTest.config 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,17 @@ +# +# UnixTest.config +# + +name UnixTest +maxsize 65536 # unix supports big files + +target file # write to file named classname.nvm + +# load lists of native methods, fields etc ... +native System +native PrintStream +#native InputStream +#native StringBuffer +#native StringBuilder +#native Math +#native Formatter diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/cc65.config epos--jvm/nanovmtool/config/cc65.config --- epos--/nanovmtool/config/cc65.config 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/cc65.config 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,14 @@ +# +# cc65.config +# + +name cc65 +maxsize 8192 # match CODESIZE define in config.h +target file # write to file named classname.nvm + +# load lists of native methods, fields etc ... +native System +native PrintStream +native InputStream +native StringBuffer +native StringBuilder diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/ctbot/Bot.native epos--jvm/nanovmtool/config/ctbot/Bot.native --- epos--/nanovmtool/config/ctbot/Bot.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/ctbot/Bot.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,12 @@ +# +# Bot.native +# + +class nanovm/ctbot/drivers/Bot 28 + +method :()V 0 +method getError:()I 1 +method setExtension1Enabled:(Z)V 2 +method getExtension1Enabled:()Z 3 +method setExtension2Enabled:(Z)V 4 +method getExtension2Enabled:()Z 5 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/ctbot/Clock.native epos--jvm/nanovmtool/config/ctbot/Clock.native --- epos--/nanovmtool/config/ctbot/Clock.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/ctbot/Clock.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,11 @@ +# +# Clock.native +# + +class nanovm/ctbot/drivers/Clock 29 + +method :()V 0 +method getSeconds:()I 1 +method getMilliSeconds:()I 2 +method delayMilliseconds:(I)V 3 +method delayMicroseconds:(I)V 4 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/ctbot/Display.native epos--jvm/nanovmtool/config/ctbot/Display.native --- epos--/nanovmtool/config/ctbot/Display.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/ctbot/Display.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,12 @@ +# +# Display.native +# + +class nanovm/ctbot/drivers/Display 30 + +method :()V 0 +method clear:()V 1 +method gotoXY:(II)V 2 +method print:(Ljava/lang/String;)V 3 +method setCursorMode:(I) 4 + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/ctbot/DistanceSensor.native epos--jvm/nanovmtool/config/ctbot/DistanceSensor.native --- epos--/nanovmtool/config/ctbot/DistanceSensor.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/ctbot/DistanceSensor.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,13 @@ +# +# DistanceSensor.native +# + +class nanovm/ctbot/drivers/DistanceSensor 31 + +method :()V 0 +method updateLeft:()V 1 +method updateRight:()V 2 +method getLeft:()I 3 +method getRight:()I 4 +method setEnabled:(Z)V 5 +method getEnabled:()Z 6 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/ctbot/EdgeDetector.native epos--jvm/nanovmtool/config/ctbot/EdgeDetector.native --- epos--/nanovmtool/config/ctbot/EdgeDetector.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/ctbot/EdgeDetector.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,13 @@ +# +# EdgeDetector.native +# + +class nanovm/ctbot/drivers/EdgeDetector 32 + +method :()V 0 +method updateLeft:()V 1 +method updateRight:()V 2 +method getLeft:()I 3 +method getRight:()I 4 +method setEnabled:(Z)V 5 +method getEnabled:()Z 6 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/ctbot/IrReceiver.native epos--jvm/nanovmtool/config/ctbot/IrReceiver.native --- epos--/nanovmtool/config/ctbot/IrReceiver.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/ctbot/IrReceiver.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,9 @@ +# +# IrReceiver.native +# + +class nanovm/ctbot/drivers/IrReceiver 33 + +method :()V 0 +method getCommand:()I 1 + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/ctbot/LdrSensor.native epos--jvm/nanovmtool/config/ctbot/LdrSensor.native --- epos--/nanovmtool/config/ctbot/LdrSensor.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/ctbot/LdrSensor.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,11 @@ +# +# LdrSensor.native +# + +class nanovm/ctbot/drivers/LdrSensor 34 + +method :()V 0 +method updateLeft:()V 1 +method updateRight:()V 2 +method getLeft:()I 3 +method getRight:()I 4 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/ctbot/Leds.native epos--jvm/nanovmtool/config/ctbot/Leds.native --- epos--/nanovmtool/config/ctbot/Leds.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/ctbot/Leds.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,10 @@ +# +# Leds.native +# + +class nanovm/ctbot/drivers/Leds 35 + +method :()V 0 +method set:(I)V 1 +method get:()I 2 + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/ctbot/LightBarrier.native epos--jvm/nanovmtool/config/ctbot/LightBarrier.native --- epos--/nanovmtool/config/ctbot/LightBarrier.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/ctbot/LightBarrier.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,10 @@ +# +# LightBarrier.native +# + +class nanovm/ctbot/drivers/LightBarrier 36 + +method :()V 0 +method getState:()Z 1 +method setEnabled:(Z)V 2 +method getEnabled:()Z 3 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/ctbot/LineDetector.native epos--jvm/nanovmtool/config/ctbot/LineDetector.native --- epos--/nanovmtool/config/ctbot/LineDetector.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/ctbot/LineDetector.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,13 @@ +# +# LineDetector.native +# + +class nanovm/ctbot/drivers/LineDetector 37 + +method :()V 0 +method updateLeft:()V 1 +method updateRight:()V 2 +method getLeft:()I 3 +method getRight:()I 4 +method setEnabled:(Z)V 5 +method getEnabled:()Z 6 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/ctbot/Motor.native epos--jvm/nanovmtool/config/ctbot/Motor.native --- epos--/nanovmtool/config/ctbot/Motor.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/ctbot/Motor.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,17 @@ +# +# Motor.native +# + +class nanovm/ctbot/drivers/Motor 38 + +method :()V 0 +method setLeft:(I)V 1 +method setRight:(I)V 2 +method getLeft:()I 3 +method getRight:()I 4 +method setLeftSpeed:(I)V 5 +method setRightSpeed:(I)V 6 +method getLeftSpeed:()I 7 +method getRightSpeed:()I 8 +method stop:()V 9 + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/ctbot/Mouse.native epos--jvm/nanovmtool/config/ctbot/Mouse.native --- epos--/nanovmtool/config/ctbot/Mouse.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/ctbot/Mouse.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,13 @@ +# +# Mouse.native +# + +class nanovm/ctbot/drivers/Mouse 39 + +method :()V 0 +method getX:()I 1 +method getY:()I 2 +method getQuality:()I 3 +method requestPicture:()V 4 +method getPixel:()I 5 +method reset:()V 6 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/ctbot/Servo.native epos--jvm/nanovmtool/config/ctbot/Servo.native --- epos--/nanovmtool/config/ctbot/Servo.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/ctbot/Servo.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,12 @@ +# +# Servo.native +# + +class nanovm/ctbot/drivers/Servo 40 + +method :()V 0 +method set1:(I)V 1 +method set2:(I)V 2 +method get1:()I 3 +method get2:()I 4 + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/ctbot/ShutterSensor.native epos--jvm/nanovmtool/config/ctbot/ShutterSensor.native --- epos--/nanovmtool/config/ctbot/ShutterSensor.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/ctbot/ShutterSensor.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,10 @@ +# +# ShutterSensor.native +# + +class nanovm/ctbot/drivers/ShutterSensor 41 + +method :()V 0 +method getState:()Z 1 +method setEnabled:(Z)V 2 +method getEnabled:()Z 3 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/ctbot/WheelEncoder.native epos--jvm/nanovmtool/config/ctbot/WheelEncoder.native --- epos--/nanovmtool/config/ctbot/WheelEncoder.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/ctbot/WheelEncoder.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,13 @@ +# +# WheelEncoder.native +# + +class nanovm/ctbot/drivers/WheelEncoder 42 + +method :()V 0 +method getLeftInc:()I 1 +method getRightInc:()I 2 +method setEnabled:(Z)V 3 +method getEnabled:()Z 4 +method getLeftSpeed:()I 5 +method getRightSpeed:()I 6 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo/Bot.native epos--jvm/nanovmtool/config/nibo/Bot.native --- epos--/nanovmtool/config/nibo/Bot.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo/Bot.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,9 @@ +# +# Bot.native +# + +class nanovm/nibo/drivers/Bot 28 + +method :()V 0 +method update:()V 1 +method getSupplyVoltage:()I 2 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo/Clock.native epos--jvm/nanovmtool/config/nibo/Clock.native --- epos--/nanovmtool/config/nibo/Clock.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo/Clock.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,11 @@ +# +# Clock.native +# + +class nanovm/nibo/drivers/Clock 29 + +method :()V 0 +method getSeconds:()I 1 +method getMilliSeconds:()I 2 +method delayMilliseconds:(I)V 3 +method delayMicroseconds:(I)V 4 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo/DistanceSensor.native epos--jvm/nanovmtool/config/nibo/DistanceSensor.native --- epos--/nanovmtool/config/nibo/DistanceSensor.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo/DistanceSensor.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,11 @@ +# +# DistanceSensor.native +# + +class nanovm/nibo/drivers/DistanceSensor 31 + +method :()V 0 +method update:()V 1 +method getSensor:(I)I 2 +method setEnabled:(Z)V 3 +method getEnabled:()Z 4 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo/EdgeDetector.native epos--jvm/nanovmtool/config/nibo/EdgeDetector.native --- epos--/nanovmtool/config/nibo/EdgeDetector.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo/EdgeDetector.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,14 @@ +# +# EdgeDetector.native +# + +class nanovm/nibo/drivers/EdgeDetector 32 + +method :()V 0 +method update:()V 1 +method getLeftRel:()I 2 +method getRightRel:()I 3 +method getLeftAbs:()I 4 +method getRightAbs:()I 5 +method setEnabled:(Z)V 6 +method getEnabled:()Z 7 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo/GraphicDisplay.native epos--jvm/nanovmtool/config/nibo/GraphicDisplay.native --- epos--/nanovmtool/config/nibo/GraphicDisplay.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo/GraphicDisplay.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,13 @@ +# +# GraphicDisplay.native +# + +class nanovm/nibo/drivers/GraphicDisplay 30 + +method :()V 0 +method clear:()V 1 +method gotoXY:(II)V 2 +method print:(Ljava/lang/String;)V 3 +method setProportional:(Z)V 4 +method getProportional:()Z 5 + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo/IrTransceiver.native epos--jvm/nanovmtool/config/nibo/IrTransceiver.native --- epos--/nanovmtool/config/nibo/IrTransceiver.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo/IrTransceiver.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,10 @@ +# +# IrTransceiver.native +# + +class nanovm/nibo/drivers/IrTransceiver 33 + +method :()V 0 +method getCommand:()I 1 +method sendCommand:(I)V 2 + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo/Leds.native epos--jvm/nanovmtool/config/nibo/Leds.native --- epos--/nanovmtool/config/nibo/Leds.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo/Leds.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,14 @@ +# +# Leds.native +# + +class nanovm/nibo/drivers/Leds 35 + +method :()V 0 +method setStatus:(II)V 1 +method getStatus:(I)I 2 +method setHeadlights:(I)V 3 +method getHeadlights:()I 4 +method setDisplaylight:(I)V 5 +method getDisplaylight:()I 6 + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo/LineDetector.native epos--jvm/nanovmtool/config/nibo/LineDetector.native --- epos--/nanovmtool/config/nibo/LineDetector.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo/LineDetector.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,14 @@ +# +# LineDetector.native +# + +class nanovm/nibo/drivers/LineDetector 37 + +method :()V 0 +method update:()V 1 +method getLeftRel:()I 2 +method getRightRel:()I 3 +method getLeftAbs:()I 4 +method getRightAbs:()I 5 +method setEnabled:(Z)V 6 +method getEnabled:()Z 7 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo/Motor.native epos--jvm/nanovmtool/config/nibo/Motor.native --- epos--/nanovmtool/config/nibo/Motor.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo/Motor.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,12 @@ +# +# Motor.native +# + +class nanovm/nibo/drivers/Motor 38 + +method :()V 0 +method setParameters:(III)V 1 +method setPWM:(II)V 2 +method setSpeed:(II)V 3 +method stop:()V 4 + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo/TextDisplay.native epos--jvm/nanovmtool/config/nibo/TextDisplay.native --- epos--/nanovmtool/config/nibo/TextDisplay.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo/TextDisplay.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,12 @@ +# +# TextDisplay.native +# + +class nanovm/nibo/drivers/TextDisplay 34 + +method :()V 0 +method clear:()V 1 +method gotoXY:(II)V 2 +method print:(Ljava/lang/String;)V 3 +method setCursorMode:(I) 4 + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo/WheelEncoder.native epos--jvm/nanovmtool/config/nibo/WheelEncoder.native --- epos--/nanovmtool/config/nibo/WheelEncoder.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo/WheelEncoder.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,14 @@ +# +# WheelEncoder.native +# + +class nanovm/nibo/drivers/WheelEncoder 42 + +method :()V 0 +method getLeftInc:()I 1 +method getRightInc:()I 2 +method setEnabled:(Z)V 3 +method getEnabled:()Z 4 +method getLeftSpeed:()I 5 +method getRightSpeed:()I 6 +method update:()V 7 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo2/Bot.native epos--jvm/nanovmtool/config/nibo2/Bot.native --- epos--/nanovmtool/config/nibo2/Bot.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo2/Bot.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,9 @@ +# +# Bot.native +# + +class nanovm/nibo2/drivers/Bot 28 + +method :()V 0 +method update:()V 1 +method getSupplyVoltage:()I 2 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo2/Clock.native epos--jvm/nanovmtool/config/nibo2/Clock.native --- epos--/nanovmtool/config/nibo2/Clock.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo2/Clock.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,11 @@ +# +# Clock.native +# + +class nanovm/nibo2/drivers/Clock 29 + +method :()V 0 +method getSeconds:()I 1 +method getMilliSeconds:()I 2 +method delayMilliseconds:(I)V 3 +method delayMicroseconds:(I)V 4 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo2/DistanceSensor.native epos--jvm/nanovmtool/config/nibo2/DistanceSensor.native --- epos--/nanovmtool/config/nibo2/DistanceSensor.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo2/DistanceSensor.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,11 @@ +# +# DistanceSensor.native +# + +class nanovm/nibo2/drivers/DistanceSensor 31 + +method :()V 0 +method update:()V 1 +method getSensor:(I)I 2 +method setEnabled:(Z)V 3 +method getEnabled:()Z 4 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo2/EdgeDetector.native epos--jvm/nanovmtool/config/nibo2/EdgeDetector.native --- epos--/nanovmtool/config/nibo2/EdgeDetector.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo2/EdgeDetector.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,14 @@ +# +# EdgeDetector.native +# + +class nanovm/nibo2/drivers/EdgeDetector 32 + +method :()V 0 +method update:()V 1 +method getLeftRel:()I 2 +method getRightRel:()I 3 +method getLeftAbs:()I 4 +method getRightAbs:()I 5 +method setEnabled:(Z)V 6 +method getEnabled:()Z 7 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo2/GraphicDisplay.native epos--jvm/nanovmtool/config/nibo2/GraphicDisplay.native --- epos--/nanovmtool/config/nibo2/GraphicDisplay.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo2/GraphicDisplay.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,13 @@ +# +# GraphicDisplay.native +# + +class nanovm/nibo2/drivers/GraphicDisplay 30 + +method :()V 0 +method clear:()V 1 +method gotoXY:(II)V 2 +method print:(Ljava/lang/String;)V 3 +method setProportional:(Z)V 4 +method getProportional:()Z 5 + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo2/IrTransceiver.native epos--jvm/nanovmtool/config/nibo2/IrTransceiver.native --- epos--/nanovmtool/config/nibo2/IrTransceiver.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo2/IrTransceiver.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,10 @@ +# +# IrTransceiver.native +# + +class nanovm/nibo2/drivers/IrTransceiver 33 + +method :()V 0 +method getCommand:()I 1 +method sendCommand:(I)V 2 + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo2/Leds.native epos--jvm/nanovmtool/config/nibo2/Leds.native --- epos--/nanovmtool/config/nibo2/Leds.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo2/Leds.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,14 @@ +# +# Leds.native +# + +class nanovm/nibo2/drivers/Leds 35 + +method :()V 0 +method setStatus:(II)V 1 +method getStatus:(I)I 2 +method setHeadlights:(I)V 3 +method getHeadlights:()I 4 +method setDisplaylight:(I)V 5 +method getDisplaylight:()I 6 + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo2/LineDetector.native epos--jvm/nanovmtool/config/nibo2/LineDetector.native --- epos--/nanovmtool/config/nibo2/LineDetector.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo2/LineDetector.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,14 @@ +# +# LineDetector.native +# + +class nanovm/nibo2/drivers/LineDetector 37 + +method :()V 0 +method update:()V 1 +method getLeftRel:()I 2 +method getRightRel:()I 3 +method getLeftAbs:()I 4 +method getRightAbs:()I 5 +method setEnabled:(Z)V 6 +method getEnabled:()Z 7 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo2/Motor.native epos--jvm/nanovmtool/config/nibo2/Motor.native --- epos--/nanovmtool/config/nibo2/Motor.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo2/Motor.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,12 @@ +# +# Motor.native +# + +class nanovm/nibo2/drivers/Motor 38 + +method :()V 0 +method setParameters:(III)V 1 +method setPWM:(II)V 2 +method setSpeed:(II)V 3 +method stop:()V 4 + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo2/TextDisplay.native epos--jvm/nanovmtool/config/nibo2/TextDisplay.native --- epos--/nanovmtool/config/nibo2/TextDisplay.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo2/TextDisplay.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,12 @@ +# +# TextDisplay.native +# + +class nanovm/nibo2/drivers/TextDisplay 34 + +method :()V 0 +method clear:()V 1 +method gotoXY:(II)V 2 +method print:(Ljava/lang/String;)V 3 +method setCursorMode:(I) 4 + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibo2/WheelEncoder.native epos--jvm/nanovmtool/config/nibo2/WheelEncoder.native --- epos--/nanovmtool/config/nibo2/WheelEncoder.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibo2/WheelEncoder.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,14 @@ +# +# WheelEncoder.native +# + +class nanovm/nibo2/drivers/WheelEncoder 42 + +method :()V 0 +method getLeftInc:()I 1 +method getRightInc:()I 2 +method setEnabled:(Z)V 3 +method getEnabled:()Z 4 +method getLeftSpeed:()I 5 +method getRightSpeed:()I 6 +method update:()V 7 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibobee/Bot.native epos--jvm/nanovmtool/config/nibobee/Bot.native --- epos--/nanovmtool/config/nibobee/Bot.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibobee/Bot.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,8 @@ +# +# Bot.native +# + +class nanovm/nibobee/drivers/Bot 28 + +method :()V 0 +method getSupplyVoltage:()I 1 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibobee/Clock.native epos--jvm/nanovmtool/config/nibobee/Clock.native --- epos--/nanovmtool/config/nibobee/Clock.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibobee/Clock.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,11 @@ +# +# Clock.native +# + +class nanovm/nibobee/drivers/Clock 29 + +method :()V 0 +method getSeconds:()I 1 +method getMilliSeconds:()I 2 +method delayMilliseconds:(I)V 3 +method delayMicroseconds:(I)V 4 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibobee/Leds.native epos--jvm/nanovmtool/config/nibobee/Leds.native --- epos--/nanovmtool/config/nibobee/Leds.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibobee/Leds.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,10 @@ +# +# Leds.native +# + +class nanovm/nibobee/drivers/Leds 35 + +method :()V 0 +method setStatus:(IZ)V 1 +method getStatus:(I)Z 2 + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibobee/LineDetector.native epos--jvm/nanovmtool/config/nibobee/LineDetector.native --- epos--/nanovmtool/config/nibobee/LineDetector.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibobee/LineDetector.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,12 @@ +# +# LineDetector.native +# + +class nanovm/nibobee/drivers/LineDetector 37 + +method :()V 0 +method getValue:(I)I 1 +method calibrateWhite:()V 1 +method calibrateBlack:()V 2 +method setEnableIR:(Z)V 3 +method getEnableIR:()Z 4 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibobee/Motor.native epos--jvm/nanovmtool/config/nibobee/Motor.native --- epos--/nanovmtool/config/nibobee/Motor.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibobee/Motor.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,12 @@ +# +# Motor.native +# + +class nanovm/nibobee/drivers/Motor 38 + +method :()V 0 +method setParameters:(III)V 1 +method setPWM:(II)V 2 +method setSpeed:(II)V 3 +method stop:()V 4 + diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibobee/Sensor.native epos--jvm/nanovmtool/config/nibobee/Sensor.native --- epos--/nanovmtool/config/nibobee/Sensor.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibobee/Sensor.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,9 @@ +# +# Sensor.native +# + +class nanovm/nibobee/drivers/Sensor 31 + +method :()V 0 +method getLeft:()I 1 +method getRight:()I 2 diff -U 3 -H -d -r -N -- epos--/nanovmtool/config/nibobee/WheelEncoder.native epos--jvm/nanovmtool/config/nibobee/WheelEncoder.native --- epos--/nanovmtool/config/nibobee/WheelEncoder.native 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/config/nibobee/WheelEncoder.native 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,11 @@ +# +# WheelEncoder.native +# + +class nanovm/nibobee/drivers/WheelEncoder 42 + +method :()V 0 +method getLeftInc:()I 1 +method getRightInc:()I 2 +method getLeftSpeed:()I 3 +method getRightSpeed:()I 4 diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/allclasses-frame.html epos--jvm/nanovmtool/dist/javadoc/allclasses-frame.html --- epos--/nanovmtool/dist/javadoc/allclasses-frame.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/allclasses-frame.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,94 @@ + + + + + + + +All Classes + + + + + + + + + + + +All Classes +
+ + + + + +
AccessFlags +
+AttributeInfo +
+ClassFileReader +
+ClassInfo +
+ClassLoader +
+CodeInfo +
+CodeTranslator +
+CodeWriter +
+CommonInfo +
+Config +
+ConstPool +
+ConstPoolEntry +
+ConstPoolEntryError +
+Converter +
+ConvertException +
+Debug +
+ExceptionInfo +
+FieldInfo +
+Generator +
+InnerClassInfo +
+LineNumberInfo +
+LocalVariableInfo +
+MainFrame +
+MethodIdTable +
+MethodInfo +
+NanoVMByteCode +
+NanoVMTool +
+NativeMapper +
+Uploader +
+UsedFeatures +
+UVMWriter +
+Version +
+
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/allclasses-noframe.html epos--jvm/nanovmtool/dist/javadoc/allclasses-noframe.html --- epos--/nanovmtool/dist/javadoc/allclasses-noframe.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/allclasses-noframe.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,94 @@ + + + + + + + +All Classes + + + + + + + + + + + +All Classes +
+ + + + + +
AccessFlags +
+AttributeInfo +
+ClassFileReader +
+ClassInfo +
+ClassLoader +
+CodeInfo +
+CodeTranslator +
+CodeWriter +
+CommonInfo +
+Config +
+ConstPool +
+ConstPoolEntry +
+ConstPoolEntryError +
+Converter +
+ConvertException +
+Debug +
+ExceptionInfo +
+FieldInfo +
+Generator +
+InnerClassInfo +
+LineNumberInfo +
+LocalVariableInfo +
+MainFrame +
+MethodIdTable +
+MethodInfo +
+NanoVMByteCode +
+NanoVMTool +
+NativeMapper +
+Uploader +
+UsedFeatures +
+UVMWriter +
+Version +
+
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/constant-values.html epos--jvm/nanovmtool/dist/javadoc/constant-values.html --- epos--/nanovmtool/dist/javadoc/constant-values.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/constant-values.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,373 @@ + + + + + + + +Constant Field Values + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Constant Field Values

+
+
+Contents + + + + + + +
+org.nanovm.*
+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
org.nanovm.converter.AccessFlags
+public static final shortABSTRACT1024
+public static final shortFINAL16
+public static final shortINTERFACE512
+public static final shortNATIVE256
+public static final shortPRIVATE2
+public static final shortPROTECTED4
+public static final shortPUBLIC1
+public static final shortSTATIC8
+public static final shortSYNCHRONIZED32
+public static final shortTRANSIENT128
+public static final shortVOLATILE64
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
org.nanovm.converter.Config
+public static final intTARGET_CTBOT_AUTO5
+public static final intTARGET_FILE0
+public static final intTARGET_NONE-1
+public static final intTARGET_NVC1_ASURO3
+public static final intTARGET_NVC1_AUTO2
+public static final intTARGET_NVC1_UART2
+public static final intTARGET_NVC2_AUTO4
+ +

+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
org.nanovm.converter.ConstPoolEntry
+public static final intCLASS7
+public static final intDOUBLE6
+public static final intFIELDREF9
+public static final intFLOAT4
+public static final intINT3
+public static final intINTERFACEMETHODREF11
+public static final intLONG5
+public static final intMETHODREF10
+public static final intNAMEANDTYPE12
+public static final intSTRING8
+public static final intUNICODE2
+public static final intUTF1
+ +

+ +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/deprecated-list.html epos--jvm/nanovmtool/dist/javadoc/deprecated-list.html --- epos--/nanovmtool/dist/javadoc/deprecated-list.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/deprecated-list.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,147 @@ + + + + + + + +Deprecated List + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Deprecated API

+
+
+Contents
    +
+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/help-doc.html epos--jvm/nanovmtool/dist/javadoc/help-doc.html --- epos--/nanovmtool/dist/javadoc/help-doc.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/help-doc.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,224 @@ + + + + + + + +API Help + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+How This API Document Is Organized

+
+This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.

+Overview

+
+ +

+The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

+

+Package

+
+ +

+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:

    +
  • Interfaces (italic)
  • Classes
  • Enums
  • Exceptions
  • Errors
  • Annotation Types
+
+

+Class/Interface

+
+ +

+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    +
  • Class inheritance diagram
  • Direct Subclasses
  • All Known Subinterfaces
  • All Known Implementing Classes
  • Class/interface declaration
  • Class/interface description +

    +

  • Nested Class Summary
  • Field Summary
  • Constructor Summary
  • Method Summary +

    +

  • Field Detail
  • Constructor Detail
  • Method Detail
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+ +

+Annotation Type

+
+ +

+Each annotation type has its own separate page with the following sections:

    +
  • Annotation Type declaration
  • Annotation Type description
  • Required Element Summary
  • Optional Element Summary
  • Element Detail
+
+ +

+Enum

+
+ +

+Each enum has its own separate page with the following sections:

    +
  • Enum declaration
  • Enum description
  • Enum Constant Summary
  • Enum Constant Detail
+
+

+Use

+
+Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
+

+Tree (Class Hierarchy)

+
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
    +
  • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
  • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
+
+

+Deprecated API

+
+The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+

+Index

+
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+

+Prev/Next

+These links take you to the next or previous class, interface, package, or related page.

+Frames/No Frames

+These links show and hide the HTML frames. All pages are available with or without frames. +

+

+Serialized Form

+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description. +

+

+Constant Field Values

+The Constant Field Values page lists the static final fields and their values. +

+ + +This help file applies to API documentation generated using the standard doclet. + +
+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-1.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-1.html --- epos--/nanovmtool/dist/javadoc/index-files/index-1.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-1.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,173 @@ + + + + + + + +A-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+A

+
+
ABSTRACT - +Static variable in interface org.nanovm.converter.AccessFlags +
  +
AccessFlags - Interface in org.nanovm.converter
Bitfield constants for class/field/method access flags.
add(int) - +Static method in class org.nanovm.converter.UsedFeatures +
  +
addAttribute(AttributeInfo) - +Method in class org.nanovm.converter.CodeInfo +
  +
addAttribute(AttributeInfo) - +Method in class org.nanovm.converter.CommonInfo +
Add a non-standard attribute. +
addEntry(ConstPoolEntry) - +Method in class org.nanovm.converter.ConstPool +
Add a constant pool entry, whether or not it's already in the pool. +
addException(String) - +Method in class org.nanovm.converter.MethodInfo +
  +
addField(FieldInfo) - +Method in class org.nanovm.converter.ClassInfo +
Add a field to this class. +
addInterface(String) - +Method in class org.nanovm.converter.ClassInfo +
Add an interface that the class implements. +
addMethod(MethodInfo) - +Method in class org.nanovm.converter.ClassInfo +
  +
AttributeInfo - Class in org.nanovm.converter
A class for storing information about a class/field/method attribute.
AttributeInfo(String, byte[]) - +Constructor for class org.nanovm.converter.AttributeInfo +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-10.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-10.html --- epos--/nanovmtool/dist/javadoc/index-files/index-10.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-10.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,170 @@ + + + + + + + +L-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+L

+
+
length - +Variable in class org.nanovm.converter.LocalVariableInfo +
  +
lineNumber - +Variable in class org.nanovm.converter.LineNumberInfo +
  +
LineNumberInfo - Class in org.nanovm.converter
A class for storing information about line numbers.
LineNumberInfo(short, short) - +Constructor for class org.nanovm.converter.LineNumberInfo +
  +
load(String) - +Static method in class org.nanovm.converter.ClassLoader +
  +
load(String) - +Static method in class org.nanovm.converter.Config +
  +
load(String) - +Method in class org.nanovm.converter.NativeMapper +
  +
LocalVariableInfo - Class in org.nanovm.converter
A class for storing information about local variables.
LocalVariableInfo(short, short, String, String, short) - +Constructor for class org.nanovm.converter.LocalVariableInfo +
  +
LONG - +Static variable in class org.nanovm.converter.ConstPoolEntry +
  +
lowestNativeId - +Static variable in class org.nanovm.converter.NativeMapper +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-11.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-11.html --- epos--/nanovmtool/dist/javadoc/index-files/index-11.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-11.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,173 @@ + + + + + + + +M-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+M

+
+
main(String[]) - +Static method in class org.nanovm.gui.MainFrame +
  +
main(String[]) - +Static method in class org.nanovm.NanoVMTool +
  +
main(String[]) - +Static method in class org.nanovm.Uploader +
  +
MainFrame - Class in org.nanovm.gui
 
MainFrame() - +Constructor for class org.nanovm.gui.MainFrame +
Creates new form MainFrame +
methodExists(String, String, String) - +Static method in class org.nanovm.converter.ClassLoader +
  +
MethodIdTable - Class in org.nanovm.converter
 
MethodIdTable() - +Constructor for class org.nanovm.converter.MethodIdTable +
  +
MethodInfo - Class in org.nanovm.converter
 
MethodInfo(short, String, String) - +Constructor for class org.nanovm.converter.MethodInfo +
  +
methodIsNative(String, String, String) - +Static method in class org.nanovm.converter.NativeMapper +
  +
METHODREF - +Static variable in class org.nanovm.converter.ConstPoolEntry +
  +
methods() - +Method in class org.nanovm.converter.ClassInfo +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-12.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-12.html --- epos--/nanovmtool/dist/javadoc/index-files/index-12.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-12.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,167 @@ + + + + + + + +N-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+N

+
+
name - +Variable in class org.nanovm.converter.AttributeInfo +
  +
name - +Variable in class org.nanovm.converter.LocalVariableInfo +
  +
NAMEANDTYPE - +Static variable in class org.nanovm.converter.ConstPoolEntry +
  +
NanoVMByteCode - Class in org.nanovm
 
NanoVMByteCode(int) - +Constructor for class org.nanovm.NanoVMByteCode +
  +
NanoVMTool - Class in org.nanovm
 
NanoVMTool() - +Constructor for class org.nanovm.NanoVMTool +
  +
NATIVE - +Static variable in interface org.nanovm.converter.AccessFlags +
  +
NativeMapper - Class in org.nanovm.converter
 
NativeMapper() - +Constructor for class org.nanovm.converter.NativeMapper +
  +
nonStaticFields() - +Method in class org.nanovm.converter.ClassInfo +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-13.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-13.html --- epos--/nanovmtool/dist/javadoc/index-files/index-13.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-13.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,152 @@ + + + + + + + +O-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+O

+
+
org.nanovm - package org.nanovm
 
org.nanovm.converter - package org.nanovm.converter
 
org.nanovm.gui - package org.nanovm.gui
 
outdent() - +Static method in class org.nanovm.converter.Debug +
Outdent subsequent messages. +
outerClass - +Variable in class org.nanovm.converter.InnerClassInfo +
  +
overwriteFileName(String) - +Static method in class org.nanovm.converter.Config +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-14.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-14.html --- epos--/nanovmtool/dist/javadoc/index-files/index-14.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-14.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,161 @@ + + + + + + + +P-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+P

+
+
println(String, String) - +Static method in class org.nanovm.converter.Debug +
Print a debug message. +
PRIVATE - +Static variable in interface org.nanovm.converter.AccessFlags +
  +
PROTECTED - +Static variable in interface org.nanovm.converter.AccessFlags +
  +
providesField(String, String) - +Method in class org.nanovm.converter.ClassInfo +
  +
providesMethod(String, String) - +Method in class org.nanovm.converter.ClassInfo +
  +
PUBLIC - +Static variable in interface org.nanovm.converter.AccessFlags +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-15.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-15.html --- epos--/nanovmtool/dist/javadoc/index-files/index-15.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-15.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,155 @@ + + + + + + + +R-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+R

+
+
read(InputStream, ClassInfo) - +Method in class org.nanovm.converter.ClassFileReader +
  +
read(DataInput) - +Method in class org.nanovm.converter.ConstPool +
Read in the constant pool from a stream. +
read(DataInput, ConstPoolEntry) - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
resolveMethodRefs() - +Method in class org.nanovm.converter.ConstPool +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-16.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-16.html --- epos--/nanovmtool/dist/javadoc/index-files/index-16.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-16.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,315 @@ + + + + + + + +S-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+S

+
+
setAccessFlags(short) - +Method in class org.nanovm.converter.CommonInfo +
Set the access flags of the class. +
setBytecode(byte[]) - +Method in class org.nanovm.converter.CodeInfo +
  +
setClass(int) - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
setClassPath(String) - +Static method in class org.nanovm.converter.ClassLoader +
  +
setCodeInfo(CodeInfo) - +Method in class org.nanovm.converter.MethodInfo +
  +
setConstantValue(Object) - +Method in class org.nanovm.converter.FieldInfo +
Set the constant value of this field. +
setConstPool(ConstPool) - +Method in class org.nanovm.converter.ClassInfo +
Set the constant pool. +
setDeprecated(boolean) - +Method in class org.nanovm.converter.MethodInfo +
  +
setDouble(double) - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
setEnabled(boolean) - +Static method in class org.nanovm.converter.Debug +
Enable or disable printing of any debug message. +
setExceptionTable(ExceptionInfo[]) - +Method in class org.nanovm.converter.CodeInfo +
  +
setFieldRef(int, int) - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
setFloat(float) - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
setInnerClasses(InnerClassInfo[]) - +Method in class org.nanovm.converter.ClassInfo +
Set the inner class information of this class. +
setInt(int) - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
setInterfaceMethodRef(int, int) - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
setLineNumberTable(LineNumberInfo[]) - +Method in class org.nanovm.converter.CodeInfo +
  +
setLocalVariableTable(LocalVariableInfo[]) - +Method in class org.nanovm.converter.CodeInfo +
  +
setLong(long) - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
setMaxLocals(short) - +Method in class org.nanovm.converter.CodeInfo +
  +
setMaxStack(short) - +Method in class org.nanovm.converter.CodeInfo +
  +
setMethodRef(int, int) - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
setName(String) - +Method in class org.nanovm.converter.CommonInfo +
Set the name of this class/method/field. +
setNameAndType(int, int) - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
setOutput(PrintStream) - +Static method in class org.nanovm.converter.Debug +
Redirect where debug messages are sent. +
setSignature(String) - +Method in class org.nanovm.converter.FieldInfo +
Set the signature of the field. +
setSignature(String) - +Method in class org.nanovm.converter.MethodInfo +
  +
setSourceFile(String) - +Method in class org.nanovm.converter.ClassInfo +
Specify the source file for this class, if it is known. +
setString(int) - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
setSuperClassName(String) - +Method in class org.nanovm.converter.ClassInfo +
Set the name of the super class. +
setSynthetic(boolean) - +Method in class org.nanovm.converter.FieldInfo +
  +
setUnicode(String) - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
setUnused() - +Method in class org.nanovm.converter.ConstPoolEntry +
Some const pool entries don't actually exist -- like the ones after a + LONG or DOUBLE, or entry 0. +
setUploader(String) - +Static method in class org.nanovm.Uploader +
  +
setUTF(String) - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
signature - +Variable in class org.nanovm.converter.LocalVariableInfo +
  +
simpleName - +Variable in class org.nanovm.converter.InnerClassInfo +
  +
size() - +Method in class org.nanovm.converter.ConstPool +
Get the size of the pool. +
slot - +Variable in class org.nanovm.converter.LocalVariableInfo +
  +
startPC - +Variable in class org.nanovm.converter.ExceptionInfo +
  +
startPC - +Variable in class org.nanovm.converter.LineNumberInfo +
  +
startPC - +Variable in class org.nanovm.converter.LocalVariableInfo +
  +
STATIC - +Static variable in interface org.nanovm.converter.AccessFlags +
  +
staticFields() - +Method in class org.nanovm.converter.ClassInfo +
  +
strBadData - +Static variable in class org.nanovm.converter.Debug +
  +
strClass - +Static variable in class org.nanovm.converter.Debug +
  +
strCode - +Static variable in class org.nanovm.converter.Debug +
  +
strConstPool - +Static variable in class org.nanovm.converter.Debug +
  +
strField - +Static variable in class org.nanovm.converter.Debug +
  +
STRING - +Static variable in class org.nanovm.converter.ConstPoolEntry +
  +
strInnerClasses - +Static variable in class org.nanovm.converter.Debug +
  +
strInterface - +Static variable in class org.nanovm.converter.Debug +
  +
strLineNumbers - +Static variable in class org.nanovm.converter.Debug +
  +
strLocalVariables - +Static variable in class org.nanovm.converter.Debug +
  +
strMethod - +Static variable in class org.nanovm.converter.Debug +
  +
strUnknownAttribute - +Static variable in class org.nanovm.converter.Debug +
  +
SYNCHRONIZED - +Static variable in interface org.nanovm.converter.AccessFlags +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-17.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-17.html --- epos--/nanovmtool/dist/javadoc/index-files/index-17.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-17.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,203 @@ + + + + + + + +T-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+T

+
+
TARGET_CTBOT_AUTO - +Static variable in class org.nanovm.converter.Config +
  +
TARGET_FILE - +Static variable in class org.nanovm.converter.Config +
  +
TARGET_NONE - +Static variable in class org.nanovm.converter.Config +
  +
TARGET_NVC1_ASURO - +Static variable in class org.nanovm.converter.Config +
  +
TARGET_NVC1_AUTO - +Static variable in class org.nanovm.converter.Config +
  +
TARGET_NVC1_UART - +Static variable in class org.nanovm.converter.Config +
  +
TARGET_NVC2_AUTO - +Static variable in class org.nanovm.converter.Config +
  +
toString() - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
totalClasses() - +Static method in class org.nanovm.converter.ClassLoader +
  +
totalConstantEntries() - +Static method in class org.nanovm.converter.ClassLoader +
  +
totalConstantEntries() - +Method in class org.nanovm.converter.ConstPool +
  +
totalMethods() - +Static method in class org.nanovm.converter.ClassLoader +
  +
totalStaticFields() - +Static method in class org.nanovm.converter.ClassLoader +
  +
totalStrings() - +Static method in class org.nanovm.converter.ClassLoader +
  +
totalStrings() - +Method in class org.nanovm.converter.ConstPool +
  +
totalStringSize() - +Static method in class org.nanovm.converter.ClassLoader +
  +
totalStringSize() - +Method in class org.nanovm.converter.ConstPool +
  +
TRANSIENT - +Static variable in interface org.nanovm.converter.AccessFlags +
  +
translate(ClassInfo, byte[]) - +Static method in class org.nanovm.converter.CodeTranslator +
  +
typecode() - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-18.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-18.html --- epos--/nanovmtool/dist/javadoc/index-files/index-18.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-18.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,164 @@ + + + + + + + +U-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+U

+
+
UNICODE - +Static variable in class org.nanovm.converter.ConstPoolEntry +
  +
upload(String, int, int, byte[], int) - +Static method in class org.nanovm.Uploader +
  +
Uploader - Class in org.nanovm
 
Uploader() - +Constructor for class org.nanovm.Uploader +
  +
usage() - +Static method in class org.nanovm.NanoVMTool +
  +
UsedFeatures - Class in org.nanovm.converter
 
UsedFeatures() - +Constructor for class org.nanovm.converter.UsedFeatures +
  +
UTF - +Static variable in class org.nanovm.converter.ConstPoolEntry +
  +
UVMWriter - Class in org.nanovm
 
UVMWriter(boolean) - +Constructor for class org.nanovm.UVMWriter +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-19.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-19.html --- epos--/nanovmtool/dist/javadoc/index-files/index-19.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-19.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,152 @@ + + + + + + + +V-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+V

+
+
Version - Class in org.nanovm
 
Version() - +Constructor for class org.nanovm.Version +
  +
version - +Static variable in class org.nanovm.Version +
  +
VOLATILE - +Static variable in interface org.nanovm.converter.AccessFlags +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-2.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-2.html --- epos--/nanovmtool/dist/javadoc/index-files/index-2.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-2.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,146 @@ + + + + + + + +B-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+B

+
+
build() - +Static method in class org.nanovm.converter.MethodIdTable +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-20.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-20.html --- epos--/nanovmtool/dist/javadoc/index-files/index-20.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-20.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,155 @@ + + + + + + + +W-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+W

+
+
write(String, NanoVMByteCode) - +Static method in class org.nanovm.CodeWriter +
  +
write16(int) - +Method in class org.nanovm.NanoVMByteCode +
  +
write32(int) - +Method in class org.nanovm.NanoVMByteCode +
  +
write8(int) - +Method in class org.nanovm.NanoVMByteCode +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-3.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-3.html --- epos--/nanovmtool/dist/javadoc/index-files/index-3.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-3.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,202 @@ + + + + + + + +C-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+C

+
+
catchType - +Variable in class org.nanovm.converter.ExceptionInfo +
  +
CLASS - +Static variable in class org.nanovm.converter.ConstPoolEntry +
  +
ClassFileReader - Class in org.nanovm.converter
This class parses java class files and stores the information in a + ClassInfo object.
ClassFileReader() - +Constructor for class org.nanovm.converter.ClassFileReader +
  +
ClassInfo - Class in org.nanovm.converter
A class for storing information about a class.
ClassInfo() - +Constructor for class org.nanovm.converter.ClassInfo +
  +
ClassLoader - Class in org.nanovm.converter
 
ClassLoader() - +Constructor for class org.nanovm.converter.ClassLoader +
  +
clone() - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
CodeInfo - Class in org.nanovm.converter
 
CodeInfo(short, short, byte[], ExceptionInfo[]) - +Constructor for class org.nanovm.converter.CodeInfo +
  +
CodeTranslator - Class in org.nanovm.converter
 
CodeTranslator() - +Constructor for class org.nanovm.converter.CodeTranslator +
  +
CodeWriter - Class in org.nanovm
 
CodeWriter() - +Constructor for class org.nanovm.CodeWriter +
  +
CommonInfo - Class in org.nanovm.converter
A common base class for ClassInfo, MethodInfo, and FieldInfo.
CommonInfo() - +Constructor for class org.nanovm.converter.CommonInfo +
  +
Config - Class in org.nanovm.converter
 
Config() - +Constructor for class org.nanovm.converter.Config +
  +
constantRelocate(int) - +Static method in class org.nanovm.converter.ClassLoader +
  +
constantRelocate(int) - +Method in class org.nanovm.converter.ConstPool +
  +
ConstPool - Class in org.nanovm.converter
This class encapsulates constant pool management.
ConstPool() - +Constructor for class org.nanovm.converter.ConstPool +
  +
ConstPoolEntry - Class in org.nanovm.converter
 
ConstPoolEntry() - +Constructor for class org.nanovm.converter.ConstPoolEntry +
  +
ConstPoolEntryError - Error in org.nanovm.converter
An instance of this class is thrown when a ConstPoolEntry is + used incorrectly.
ConstPoolEntryError(String) - +Constructor for error org.nanovm.converter.ConstPoolEntryError +
  +
convert(String, String, String) - +Static method in class org.nanovm.converter.Converter +
  +
Converter - Class in org.nanovm.converter
 
Converter() - +Constructor for class org.nanovm.converter.Converter +
  +
ConvertException - Exception in org.nanovm
 
ConvertException(String) - +Constructor for exception org.nanovm.ConvertException +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-4.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-4.html --- epos--/nanovmtool/dist/javadoc/index-files/index-4.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-4.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,152 @@ + + + + + + + +D-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+D

+
+
data - +Variable in class org.nanovm.converter.AttributeInfo +
  +
Debug - Class in org.nanovm.converter
All classfile debugging information gets piped through this class.
Debug() - +Constructor for class org.nanovm.converter.Debug +
  +
DOUBLE - +Static variable in class org.nanovm.converter.ConstPoolEntry +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-5.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-5.html --- epos--/nanovmtool/dist/javadoc/index-files/index-5.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-5.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,152 @@ + + + + + + + +E-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+E

+
+
endPC - +Variable in class org.nanovm.converter.ExceptionInfo +
  +
equals(Object) - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
ExceptionInfo - Class in org.nanovm.converter
A class for storing information about the exception table of a method.
ExceptionInfo(short, short, short, String) - +Constructor for class org.nanovm.converter.ExceptionInfo +
Construct an ExceptionInfo +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-6.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-6.html --- epos--/nanovmtool/dist/javadoc/index-files/index-6.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-6.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,164 @@ + + + + + + + +F-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+F

+
+
fieldExists(String, String, String) - +Static method in class org.nanovm.converter.ClassLoader +
  +
fieldExistsExact(String, String, String) - +Static method in class org.nanovm.converter.ClassLoader +
  +
FieldInfo - Class in org.nanovm.converter
A class for storing information about fields.
FieldInfo(short, String, String) - +Constructor for class org.nanovm.converter.FieldInfo +
  +
FIELDREF - +Static variable in class org.nanovm.converter.ConstPoolEntry +
  +
FINAL - +Static variable in interface org.nanovm.converter.AccessFlags +
  +
flags - +Variable in class org.nanovm.converter.InnerClassInfo +
  +
FLOAT - +Static variable in class org.nanovm.converter.ConstPoolEntry +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-7.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-7.html --- epos--/nanovmtool/dist/javadoc/index-files/index-7.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-7.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,371 @@ + + + + + + + +G-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+G

+
+
generate(NanoVMByteCode) - +Method in class org.nanovm.converter.Generator +
  +
Generator - Class in org.nanovm.converter
 
Generator() - +Constructor for class org.nanovm.converter.Generator +
  +
get() - +Static method in class org.nanovm.converter.UsedFeatures +
  +
getAccessFlags() - +Method in class org.nanovm.converter.CommonInfo +
Get the access flags of the class. +
getArgs() - +Method in class org.nanovm.converter.MethodInfo +
  +
getAttributes() - +Method in class org.nanovm.converter.CodeInfo +
  +
getAttributes() - +Method in class org.nanovm.converter.CommonInfo +
Get all non-standard attributes. +
getByte(int) - +Method in class org.nanovm.NanoVMByteCode +
  +
getBytecode() - +Method in class org.nanovm.converter.CodeInfo +
  +
getClassIndex(String) - +Static method in class org.nanovm.converter.ClassLoader +
  +
getClassIndex(int) - +Static method in class org.nanovm.converter.ClassLoader +
  +
getClassIndex() - +Method in class org.nanovm.converter.ConstPoolEntry +
For FIELDREF, METHODREF, or INTERFACEMETHODREF entries. +
getClassInfo(int) - +Static method in class org.nanovm.converter.ClassLoader +
  +
getClassInfo(String) - +Static method in class org.nanovm.converter.ClassLoader +
  +
getClassInfoFromMethodIndex(int) - +Static method in class org.nanovm.converter.ClassLoader +
  +
getClassNameIndex() - +Method in class org.nanovm.converter.ConstPoolEntry +
For CLASS entries. +
getCodeInfo() - +Method in class org.nanovm.converter.MethodInfo +
  +
getConstantEntry(int) - +Static method in class org.nanovm.converter.ClassLoader +
  +
getConstantEntry(int) - +Method in class org.nanovm.converter.ConstPool +
  +
getConstantValue() - +Method in class org.nanovm.converter.FieldInfo +
Get the constant value of this field. +
getConstPool() - +Method in class org.nanovm.converter.ClassInfo +
Get the constant pool. +
getData() - +Method in class org.nanovm.converter.AttributeInfo +
  +
getDouble() - +Method in class org.nanovm.converter.ConstPoolEntry +
For DOUBLE entries. +
getEntry(int) - +Static method in class org.nanovm.converter.MethodIdTable +
  +
getEntryAtIndex(int) - +Method in class org.nanovm.converter.ConstPool +
Get the const pool entry at a given index. +
getExceptionTable() - +Method in class org.nanovm.converter.CodeInfo +
  +
getField(int) - +Method in class org.nanovm.converter.ClassInfo +
  +
getFieldId(String, String, String) - +Static method in class org.nanovm.converter.NativeMapper +
  +
getFieldIndex(int, String, String) - +Method in class org.nanovm.converter.ClassInfo +
  +
getFieldInfo(String, String) - +Method in class org.nanovm.converter.ClassInfo +
  +
getFieldInfo(String, String, String) - +Static method in class org.nanovm.converter.ClassLoader +
  +
getFieldInfoExact(String, String, String) - +Static method in class org.nanovm.converter.ClassLoader +
  +
getFileName() - +Static method in class org.nanovm.converter.Config +
  +
getFloat() - +Method in class org.nanovm.converter.ConstPoolEntry +
For FLOAT entries. +
getIndexOfClassAdd(String) - +Method in class org.nanovm.converter.ConstPool +
Convenience method to return the index of the CLASS const pool entry + whose classname is equal to the given string. +
getIndexOfEntryAdd(ConstPoolEntry) - +Method in class org.nanovm.converter.ConstPool +
Return the index of a constant pool entry equal to the specified one. +
getIndexOfEntryNoAdd(ConstPoolEntry) - +Method in class org.nanovm.converter.ConstPool +
Return the index of a constant pool entry equal to the specified one. +
getIndexOfUTFAdd(String) - +Method in class org.nanovm.converter.ConstPool +
Convenience method to return the index of the UTF const pool entry + equal to the given string. +
getInnerClasses() - +Method in class org.nanovm.converter.ClassInfo +
Get the inner class information of this class. +
getInt() - +Method in class org.nanovm.converter.ConstPoolEntry +
For INT entries. +
getInterfaces() - +Method in class org.nanovm.converter.ClassInfo +
Get the interfaces that this class implements. +
getLineNumberTable() - +Method in class org.nanovm.converter.CodeInfo +
  +
getLong() - +Method in class org.nanovm.converter.ConstPoolEntry +
For LONG entries. +
getMainIndex() - +Static method in class org.nanovm.converter.ClassLoader +
  +
getMaxLocals() - +Method in class org.nanovm.converter.CodeInfo +
  +
getMaxSize() - +Static method in class org.nanovm.converter.Config +
  +
getMaxStack() - +Method in class org.nanovm.converter.CodeInfo +
  +
getMethod(int) - +Method in class org.nanovm.converter.ClassInfo +
  +
getMethod(int) - +Static method in class org.nanovm.converter.ClassLoader +
  +
getMethodId(String, String, String) - +Static method in class org.nanovm.converter.NativeMapper +
  +
getMethodIndex(MethodInfo) - +Method in class org.nanovm.converter.ClassInfo +
  +
getMethodIndex(String, String) - +Method in class org.nanovm.converter.ClassInfo +
  +
getMethodIndex(String, String, String) - +Static method in class org.nanovm.converter.ClassLoader +
  +
getName() - +Method in class org.nanovm.converter.AttributeInfo +
  +
getName() - +Method in class org.nanovm.converter.CommonInfo +
Get the name of this class/method/field. +
getNameAndTypeIndex() - +Method in class org.nanovm.converter.ConstPoolEntry +
For FIELDREF, METHODREF, or INTERFACEMETHODREF entries. +
getNameIndex() - +Method in class org.nanovm.converter.ConstPoolEntry +
For NAMEANDTYPE entries. +
getNativeClassId(String) - +Static method in class org.nanovm.converter.NativeMapper +
  +
getOutput() - +Static method in class org.nanovm.converter.Debug +
Get the destination of debug messages. +
getPrimitiveTypeValue() - +Method in class org.nanovm.converter.ConstPoolEntry +
For INT, LONG, FLOAT, DOUBLE, UTF, or UNICODE entries, + returns an Integer, Long, Float, Double, or String, respectively. +
getSignature() - +Method in class org.nanovm.converter.FieldInfo +
Get the signature of the field. +
getSignature() - +Method in class org.nanovm.converter.MethodInfo +
  +
getSize() - +Method in class org.nanovm.NanoVMByteCode +
  +
getSourceFile() - +Method in class org.nanovm.converter.ClassInfo +
Get the source file for this class. +
getSpeed() - +Static method in class org.nanovm.converter.Config +
  +
getStaticFieldIndex(String, String, String) - +Static method in class org.nanovm.converter.ClassLoader +
  +
getString(int) - +Static method in class org.nanovm.converter.ClassLoader +
  +
getString(int) - +Method in class org.nanovm.converter.ConstPool +
  +
getString() - +Method in class org.nanovm.converter.ConstPoolEntry +
For UTF and UNICODE entries. +
getStringIndex() - +Method in class org.nanovm.converter.ConstPoolEntry +
For STRING entries. +
getSuperClassIndex() - +Method in class org.nanovm.converter.ClassInfo +
  +
getSuperClassName() - +Method in class org.nanovm.converter.ClassInfo +
Get the name of the super class. +
getSuperClassName(String) - +Static method in class org.nanovm.converter.ClassLoader +
  +
getTarget() - +Static method in class org.nanovm.converter.Config +
  +
getTypeIndex() - +Method in class org.nanovm.converter.ConstPoolEntry +
For NAMEANDTYPE entries. +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-8.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-8.html --- epos--/nanovmtool/dist/javadoc/index-files/index-8.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-8.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,149 @@ + + + + + + + +H-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+H

+
+
handlerPC - +Variable in class org.nanovm.converter.ExceptionInfo +
  +
hashCode() - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index-files/index-9.html epos--jvm/nanovmtool/dist/javadoc/index-files/index-9.html --- epos--/nanovmtool/dist/javadoc/index-files/index-9.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index-files/index-9.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,173 @@ + + + + + + + +I-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+

+I

+
+
indent() - +Static method in class org.nanovm.converter.Debug +
Indent subsequent messages. +
innerClass - +Variable in class org.nanovm.converter.InnerClassInfo +
  +
InnerClassInfo - Class in org.nanovm.converter
A class for storing information about inner classes.
InnerClassInfo(String, String, String, short) - +Constructor for class org.nanovm.converter.InnerClassInfo +
Construct an inner class record. +
INT - +Static variable in class org.nanovm.converter.ConstPoolEntry +
  +
INTERFACE - +Static variable in interface org.nanovm.converter.AccessFlags +
  +
INTERFACEMETHODREF - +Static variable in class org.nanovm.converter.ConstPoolEntry +
  +
isDeprecated() - +Method in class org.nanovm.converter.MethodInfo +
  +
isEnabled() - +Static method in class org.nanovm.converter.Debug +
Get whether printing of debug messages is enabled. +
isSynthetic() - +Method in class org.nanovm.converter.FieldInfo +
  +
isUnused() - +Method in class org.nanovm.converter.ConstPoolEntry +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I L M N O P R S T U V W
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/index.html epos--jvm/nanovmtool/dist/javadoc/index.html --- epos--/nanovmtool/dist/javadoc/index.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/index.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,40 @@ + + + + + + + +Generated Documentation (Untitled) + + + + + + + + + + + +<H2> +Frame Alert</H2> + +<P> +This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. +<BR> +Link to<A HREF="overview-summary.html">Non-frame version.</A> + + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/CodeWriter.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/CodeWriter.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/CodeWriter.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/CodeWriter.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,255 @@ + + + + + + + +CodeWriter + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm +
+Class CodeWriter

+
+java.lang.Object
+  extended by org.nanovm.CodeWriter
+
+
+
+
public class CodeWriter
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
CodeWriter() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+static voidwrite(java.lang.String fileName, + NanoVMByteCode code) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+CodeWriter

+
+public CodeWriter()
+
+
+ + + + + + + + +
+Method Detail
+ +

+write

+
+public static void write(java.lang.String fileName,
+                         NanoVMByteCode code)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/ConvertException.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/ConvertException.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/ConvertException.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/ConvertException.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,242 @@ + + + + + + + +ConvertException + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm +
+Class ConvertException

+
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Exception
+          extended by java.io.IOException
+              extended by org.nanovm.ConvertException
+
+
+
All Implemented Interfaces:
java.io.Serializable
+
+
+
+
public class ConvertException
extends java.io.IOException
+ + +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
ConvertException(java.lang.String msg) + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+ConvertException

+
+public ConvertException(java.lang.String msg)
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/NanoVMByteCode.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/NanoVMByteCode.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/NanoVMByteCode.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/NanoVMByteCode.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,338 @@ + + + + + + + +NanoVMByteCode + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm +
+Class NanoVMByteCode

+
+java.lang.Object
+  extended by org.nanovm.NanoVMByteCode
+
+
+
+
public class NanoVMByteCode
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
NanoVMByteCode(int maxsize) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ bytegetByte(int pos) + +
+           
+ intgetSize() + +
+           
+ voidwrite16(int val) + +
+           
+ voidwrite32(int val) + +
+           
+ voidwrite8(int val) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+NanoVMByteCode

+
+public NanoVMByteCode(int maxsize)
+
+
+ + + + + + + + +
+Method Detail
+ +

+getSize

+
+public int getSize()
+
+
+
+
+
+
+ +

+getByte

+
+public byte getByte(int pos)
+
+
+
+
+
+
+ +

+write8

+
+public void write8(int val)
+            throws ConvertException
+
+
+ +
Throws: +
ConvertException
+
+
+
+ +

+write16

+
+public void write16(int val)
+             throws ConvertException
+
+
+ +
Throws: +
ConvertException
+
+
+
+ +

+write32

+
+public void write32(int val)
+             throws ConvertException
+
+
+ +
Throws: +
ConvertException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/NanoVMTool.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/NanoVMTool.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/NanoVMTool.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/NanoVMTool.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,272 @@ + + + + + + + +NanoVMTool + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm +
+Class NanoVMTool

+
+java.lang.Object
+  extended by org.nanovm.NanoVMTool
+
+
+
+
public class NanoVMTool
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
NanoVMTool() + +
+           
+  + + + + + + + + + + + + + + + +
+Method Summary
+static voidmain(java.lang.String[] args) + +
+           
+static voidusage() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+NanoVMTool

+
+public NanoVMTool()
+
+
+ + + + + + + + +
+Method Detail
+ +

+usage

+
+public static void usage()
+
+
+
+
+
+
+ +

+main

+
+public static void main(java.lang.String[] args)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/UVMWriter.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/UVMWriter.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/UVMWriter.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/UVMWriter.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,225 @@ + + + + + + + +UVMWriter + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm +
+Class UVMWriter

+
+java.lang.Object
+  extended by org.nanovm.UVMWriter
+
+
+
+
public class UVMWriter
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
UVMWriter(boolean writeHeader) + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+UVMWriter

+
+public UVMWriter(boolean writeHeader)
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/Uploader.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/Uploader.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/Uploader.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/Uploader.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,299 @@ + + + + + + + +Uploader + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm +
+Class Uploader

+
+java.lang.Object
+  extended by org.nanovm.Uploader
+
+
+
+
public class Uploader
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
Uploader() + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static voidmain(java.lang.String[] args) + +
+           
+static voidsetUploader(java.lang.String type) + +
+           
+static voidupload(java.lang.String device, + int target, + int speed, + byte[] file, + int length) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Uploader

+
+public Uploader()
+
+
+ + + + + + + + +
+Method Detail
+ +

+setUploader

+
+public static void setUploader(java.lang.String type)
+
+
+
+
+
+
+ +

+upload

+
+public static void upload(java.lang.String device,
+                          int target,
+                          int speed,
+                          byte[] file,
+                          int length)
+
+
+
+
+
+
+ +

+main

+
+public static void main(java.lang.String[] args)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/Version.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/Version.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/Version.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/Version.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,261 @@ + + + + + + + +Version + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm +
+Class Version

+
+java.lang.Object
+  extended by org.nanovm.Version
+
+
+
+
public class Version
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Field Summary
+static java.lang.Stringversion + +
+           
+  + + + + + + + + + + +
+Constructor Summary
Version() + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+version

+
+public static java.lang.String version
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+Version

+
+public Version()
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/class-use/CodeWriter.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/class-use/CodeWriter.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/class-use/CodeWriter.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/class-use/CodeWriter.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.nanovm.CodeWriter + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.CodeWriter

+
+No usage of org.nanovm.CodeWriter +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/class-use/ConvertException.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/class-use/ConvertException.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/class-use/ConvertException.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/class-use/ConvertException.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,197 @@ + + + + + + + +Uses of Class org.nanovm.ConvertException + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.ConvertException

+
+ + + + + + + + + +
+Packages that use ConvertException
org.nanovm  
+  +

+ + + + + +
+Uses of ConvertException in org.nanovm
+  +

+ + + + + + + + + + + + + + + + + +
Methods in org.nanovm that throw ConvertException
+ voidNanoVMByteCode.write16(int val) + +
+           
+ voidNanoVMByteCode.write32(int val) + +
+           
+ voidNanoVMByteCode.write8(int val) + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/class-use/NanoVMByteCode.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/class-use/NanoVMByteCode.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/class-use/NanoVMByteCode.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/class-use/NanoVMByteCode.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,229 @@ + + + + + + + +Uses of Class org.nanovm.NanoVMByteCode + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.NanoVMByteCode

+
+ + + + + + + + + + + + + +
+Packages that use NanoVMByteCode
org.nanovm  
org.nanovm.converter  
+  +

+ + + + + +
+Uses of NanoVMByteCode in org.nanovm
+  +

+ + + + + + + + + +
Methods in org.nanovm with parameters of type NanoVMByteCode
+static voidCodeWriter.write(java.lang.String fileName, + NanoVMByteCode code) + +
+           
+  +

+ + + + + +
+Uses of NanoVMByteCode in org.nanovm.converter
+  +

+ + + + + + + + + +
Methods in org.nanovm.converter that return NanoVMByteCode
+static NanoVMByteCodeConverter.convert(java.lang.String config, + java.lang.String classpath, + java.lang.String classname) + +
+           
+  +

+ + + + + + + + + +
Methods in org.nanovm.converter with parameters of type NanoVMByteCode
+ voidGenerator.generate(NanoVMByteCode code) + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/class-use/NanoVMTool.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/class-use/NanoVMTool.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/class-use/NanoVMTool.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/class-use/NanoVMTool.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.nanovm.NanoVMTool + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.NanoVMTool

+
+No usage of org.nanovm.NanoVMTool +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/class-use/UVMWriter.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/class-use/UVMWriter.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/class-use/UVMWriter.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/class-use/UVMWriter.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.nanovm.UVMWriter + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.UVMWriter

+
+No usage of org.nanovm.UVMWriter +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/class-use/Uploader.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/class-use/Uploader.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/class-use/Uploader.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/class-use/Uploader.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.nanovm.Uploader + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.Uploader

+
+No usage of org.nanovm.Uploader +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/class-use/Version.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/class-use/Version.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/class-use/Version.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/class-use/Version.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.nanovm.Version + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.Version

+
+No usage of org.nanovm.Version +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/AccessFlags.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/AccessFlags.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/AccessFlags.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/AccessFlags.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,392 @@ + + + + + + + +AccessFlags + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Interface AccessFlags

+
+
All Known Implementing Classes:
ClassFileReader
+
+
+
+
public interface AccessFlags
+ + +

+Bitfield constants for class/field/method access flags. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static shortABSTRACT + +
+           
+static shortFINAL + +
+           
+static shortINTERFACE + +
+           
+static shortNATIVE + +
+           
+static shortPRIVATE + +
+           
+static shortPROTECTED + +
+           
+static shortPUBLIC + +
+           
+static shortSTATIC + +
+           
+static shortSYNCHRONIZED + +
+           
+static shortTRANSIENT + +
+           
+static shortVOLATILE + +
+           
+  +

+ + + + + + + + +
+Field Detail
+ +

+PUBLIC

+
+static final short PUBLIC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PRIVATE

+
+static final short PRIVATE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+PROTECTED

+
+static final short PROTECTED
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STATIC

+
+static final short STATIC
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FINAL

+
+static final short FINAL
+
+
+
See Also:
Constant Field Values
+
+
+ +

+SYNCHRONIZED

+
+static final short SYNCHRONIZED
+
+
+
See Also:
Constant Field Values
+
+
+ +

+VOLATILE

+
+static final short VOLATILE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TRANSIENT

+
+static final short TRANSIENT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NATIVE

+
+static final short NATIVE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+INTERFACE

+
+static final short INTERFACE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+ABSTRACT

+
+static final short ABSTRACT
+
+
+
See Also:
Constant Field Values
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/AttributeInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/AttributeInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/AttributeInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/AttributeInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,340 @@ + + + + + + + +AttributeInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class AttributeInfo

+
+java.lang.Object
+  extended by org.nanovm.converter.AttributeInfo
+
+
+
+
public class AttributeInfo
extends java.lang.Object
+ + +

+A class for storing information about a class/field/method attribute. + This class is usually only used for non-standard attributes. Standard + attributes such as SourceFile, Code, LineNumberTable, LocalVariableTable, + Exceptions, and ConstantValue are handled with specialized methods in + the appropriate Info class. +

+ +

+

+
See Also:
ClassInfo, +FieldInfo, +MethodInfo
+
+ +

+ + + + + + + + + + + + + + + +
+Field Summary
+ byte[]data + +
+           
+ java.lang.Stringname + +
+           
+  + + + + + + + + + + +
+Constructor Summary
AttributeInfo(java.lang.String name, + byte[] data) + +
+           
+  + + + + + + + + + + + + + + + +
+Method Summary
+ byte[]getData() + +
+           
+ java.lang.StringgetName() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+name

+
+public java.lang.String name
+
+
+
+
+
+ +

+data

+
+public byte[] data
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+AttributeInfo

+
+public AttributeInfo(java.lang.String name,
+                     byte[] data)
+
+
+ + + + + + + + +
+Method Detail
+ +

+getName

+
+public java.lang.String getName()
+
+
+
+
+
+
+ +

+getData

+
+public byte[] getData()
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/ClassFileReader.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/ClassFileReader.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/ClassFileReader.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/ClassFileReader.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,289 @@ + + + + + + + +ClassFileReader + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class ClassFileReader

+
+java.lang.Object
+  extended by org.nanovm.converter.ClassFileReader
+
+
+
All Implemented Interfaces:
AccessFlags
+
+
+
+
public class ClassFileReader
extends java.lang.Object
implements AccessFlags
+ + +

+This class parses java class files and stores the information in a + ClassInfo object. +

+ +

+

+
See Also:
ClassInfo
+
+ +

+ + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from interface org.nanovm.converter.AccessFlags
ABSTRACT, FINAL, INTERFACE, NATIVE, PRIVATE, PROTECTED, PUBLIC, STATIC, SYNCHRONIZED, TRANSIENT, VOLATILE
+  + + + + + + + + + + +
+Constructor Summary
ClassFileReader() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidread(java.io.InputStream in, + ClassInfo classInfo) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+ClassFileReader

+
+public ClassFileReader()
+
+
+ + + + + + + + +
+Method Detail
+ +

+read

+
+public void read(java.io.InputStream in,
+                 ClassInfo classInfo)
+          throws java.io.IOException
+
+
+
+
+
+ +
Throws: +
java.io.IOException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/ClassInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/ClassInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/ClassInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/ClassInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,785 @@ + + + + + + + +ClassInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class ClassInfo

+
+java.lang.Object
+  extended by org.nanovm.converter.CommonInfo
+      extended by org.nanovm.converter.ClassInfo
+
+
+
+
public class ClassInfo
extends CommonInfo
+ + +

+A class for storing information about a class. + This information can be read in by a ClassFileReader, or written out by + a ClassFileWriter. +

+ +

+

+
See Also:
FieldInfo, +MethodInfo, +AttributeInfo, +ClassFileReader, +ClassFileWriter
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
ClassInfo() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddField(FieldInfo fieldInfo) + +
+          Add a field to this class.
+ voidaddInterface(java.lang.String interfaceName) + +
+          Add an interface that the class implements.
+ voidaddMethod(MethodInfo methodInfo) + +
+           
+ ConstPoolgetConstPool() + +
+          Get the constant pool.
+ FieldInfogetField(int index) + +
+           
+ intgetFieldIndex(int staticFlag, + java.lang.String name, + java.lang.String type) + +
+           
+ FieldInfogetFieldInfo(java.lang.String name, + java.lang.String type) + +
+           
+ InnerClassInfo[]getInnerClasses() + +
+          Get the inner class information of this class.
+ java.lang.String[]getInterfaces() + +
+          Get the interfaces that this class implements.
+ MethodInfogetMethod(int index) + +
+           
+ intgetMethodIndex(MethodInfo methodInfo) + +
+           
+ intgetMethodIndex(java.lang.String name, + java.lang.String type) + +
+           
+ java.lang.StringgetSourceFile() + +
+          Get the source file for this class.
+ intgetSuperClassIndex() + +
+           
+ java.lang.StringgetSuperClassName() + +
+          Get the name of the super class.
+ intmethods() + +
+           
+ intnonStaticFields() + +
+           
+ booleanprovidesField(java.lang.String name, + java.lang.String type) + +
+           
+ booleanprovidesMethod(java.lang.String name, + java.lang.String type) + +
+           
+ voidsetConstPool(ConstPool cp) + +
+          Set the constant pool.
+ voidsetInnerClasses(InnerClassInfo[] innerClasses) + +
+          Set the inner class information of this class.
+ voidsetSourceFile(java.lang.String sourceFile) + +
+          Specify the source file for this class, if it is known.
+ voidsetSuperClassName(java.lang.String name) + +
+          Set the name of the super class.
+ intstaticFields() + +
+           
+ + + + + + + +
Methods inherited from class org.nanovm.converter.CommonInfo
addAttribute, getAccessFlags, getAttributes, getName, setAccessFlags, setName
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+ClassInfo

+
+public ClassInfo()
+
+
+ + + + + + + + +
+Method Detail
+ +

+setConstPool

+
+public void setConstPool(ConstPool cp)
+
+
Set the constant pool. The ClassInfo class itself does not actually use + the ConstPool for anything. This method is useful if the ClassInfo is + being read in by a ClassFileReader and there are attributes that the + Reader does not understand, which reference entries in the constant + pool. The best example of such an attribute is method bytecodes. + In a future release, ClassFileReaders will understand bytecodes, + and so this method will become less important. + +

The new ConstPool is not immutable. It may be passed to a + ClassFileWriter, which will add entries as needed. +

+

+
See Also:
ConstPool
+
+
+
+ +

+getConstPool

+
+public ConstPool getConstPool()
+
+
Get the constant pool. The ClassInfo class itself does not use the + constant pool for anthing. The constant pool is useful if the ClassInfo is + being written out by a ClassFileWriter and there are attributes that the + Writer does not understand, which reference entries in the constant + pool. The best example of such an attribute is method bytecodes. + The Writer will use the ConstPool returned by this method in preference + to creating its own ConstPool. Letting the Writer create its own + ConstPool is probably not a good idea, for the reasons describe above. + In a future release, ClassFileWriters will understand bytecodes, and so + this method will become less important. +

+

+
See Also:
ConstPool
+
+
+
+ +

+setSuperClassName

+
+public void setSuperClassName(java.lang.String name)
+
+
Set the name of the super class. The name should be of the form "java.lang.String". +

+

+
+
+
+
+ +

+getSuperClassName

+
+public java.lang.String getSuperClassName()
+
+
Get the name of the super class. The name is of the form "java.lang.String". +

+

+
+
+
+
+ +

+addInterface

+
+public void addInterface(java.lang.String interfaceName)
+
+
Add an interface that the class implements. +

+

+
+
+
+
+ +

+getInterfaces

+
+public java.lang.String[] getInterfaces()
+
+
Get the interfaces that this class implements. +

+

+
+
+
+
+ +

+addField

+
+public void addField(FieldInfo fieldInfo)
+
+
Add a field to this class. The FieldInfo should be need not be + entirely filled out before being added. +

+

+
See Also:
FieldInfo
+
+
+
+ +

+getField

+
+public FieldInfo getField(int index)
+
+
+
+
+
+
+ +

+addMethod

+
+public void addMethod(MethodInfo methodInfo)
+
+
+
+
+
+
+ +

+getMethod

+
+public MethodInfo getMethod(int index)
+
+
+
+
+
+
+ +

+getMethodIndex

+
+public int getMethodIndex(MethodInfo methodInfo)
+
+
+
+
+
+
+ +

+getMethodIndex

+
+public int getMethodIndex(java.lang.String name,
+                          java.lang.String type)
+
+
+
+
+
+
+ +

+methods

+
+public int methods()
+
+
+
+
+
+
+ +

+providesMethod

+
+public boolean providesMethod(java.lang.String name,
+                              java.lang.String type)
+
+
+
+
+
+
+ +

+providesField

+
+public boolean providesField(java.lang.String name,
+                             java.lang.String type)
+
+
+
+
+
+
+ +

+getFieldInfo

+
+public FieldInfo getFieldInfo(java.lang.String name,
+                              java.lang.String type)
+
+
+
+
+
+
+ +

+staticFields

+
+public int staticFields()
+
+
+
+
+
+
+ +

+getFieldIndex

+
+public int getFieldIndex(int staticFlag,
+                         java.lang.String name,
+                         java.lang.String type)
+
+
+
+
+
+
+ +

+nonStaticFields

+
+public int nonStaticFields()
+
+
+
+
+
+
+ +

+getSuperClassIndex

+
+public int getSuperClassIndex()
+
+
+
+
+
+
+ +

+setSourceFile

+
+public void setSourceFile(java.lang.String sourceFile)
+
+
Specify the source file for this class, if it is known. +

+

+
+
+
+
+ +

+getSourceFile

+
+public java.lang.String getSourceFile()
+
+
Get the source file for this class. If the file is not known, this + may return null. +

+

+
+
+
+
+ +

+setInnerClasses

+
+public void setInnerClasses(InnerClassInfo[] innerClasses)
+
+
Set the inner class information of this class. Using inner classes is + a bit tricky. The array should include elements for every inner class + of this class, and every class that contains this class. For example: + +
class Foo {
+    class Bar {
+        class Quux {
+            class Squish {
+            }
+        }
+    }
+    class Baz {
+    }
+}
+ + If this ClassInfo is for Foo.Bar, then the inner classes array should be + {FooInfo, BarInfo, QuuxInfo}. The order is important: outer classes + must come before their inner classes. Note that the + current class must have an entry in the array. Squish and Baz may be + included in the array, but they're not necessary. +

+

+
See Also:
InnerClassInfo
+
+
+
+ +

+getInnerClasses

+
+public InnerClassInfo[] getInnerClasses()
+
+
Get the inner class information of this class. +

+

+
See Also:
#setInnerClasses()
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/ClassLoader.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/ClassLoader.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/ClassLoader.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/ClassLoader.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,756 @@ + + + + + + + +ClassLoader + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class ClassLoader

+
+java.lang.Object
+  extended by org.nanovm.converter.ClassLoader
+
+
+
+
public class ClassLoader
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
ClassLoader() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static voidconstantRelocate(int i) + +
+           
+static booleanfieldExists(java.lang.String className, + java.lang.String name, + java.lang.String type) + +
+           
+static booleanfieldExistsExact(java.lang.String className, + java.lang.String name, + java.lang.String type) + +
+           
+static intgetClassIndex(int index) + +
+           
+static intgetClassIndex(java.lang.String className) + +
+           
+static ClassInfogetClassInfo(int index) + +
+           
+static ClassInfogetClassInfo(java.lang.String className) + +
+           
+static ClassInfogetClassInfoFromMethodIndex(int index) + +
+           
+static intgetConstantEntry(int index) + +
+           
+static FieldInfogetFieldInfo(java.lang.String className, + java.lang.String name, + java.lang.String type) + +
+           
+static FieldInfogetFieldInfoExact(java.lang.String className, + java.lang.String name, + java.lang.String type) + +
+           
+static intgetMainIndex() + +
+           
+static MethodInfogetMethod(int index) + +
+           
+static intgetMethodIndex(java.lang.String className, + java.lang.String name, + java.lang.String type) + +
+           
+static intgetStaticFieldIndex(java.lang.String className, + java.lang.String name, + java.lang.String type) + +
+           
+static java.lang.StringgetString(int index) + +
+           
+static java.lang.StringgetSuperClassName(java.lang.String className) + +
+           
+static voidload(java.lang.String name) + +
+           
+static booleanmethodExists(java.lang.String className, + java.lang.String name, + java.lang.String type) + +
+           
+static voidsetClassPath(java.lang.String path) + +
+           
+static inttotalClasses() + +
+           
+static inttotalConstantEntries() + +
+           
+static inttotalMethods() + +
+           
+static inttotalStaticFields() + +
+           
+static inttotalStrings() + +
+           
+static inttotalStringSize() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+ClassLoader

+
+public ClassLoader()
+
+
+ + + + + + + + +
+Method Detail
+ +

+setClassPath

+
+public static void setClassPath(java.lang.String path)
+
+
+
+
+
+
+ +

+getClassInfo

+
+public static ClassInfo getClassInfo(int index)
+
+
+
+
+
+
+ +

+getClassInfo

+
+public static ClassInfo getClassInfo(java.lang.String className)
+
+
+
+
+
+
+ +

+getClassInfoFromMethodIndex

+
+public static ClassInfo getClassInfoFromMethodIndex(int index)
+
+
+
+
+
+
+ +

+getClassIndex

+
+public static int getClassIndex(java.lang.String className)
+
+
+
+
+
+
+ +

+methodExists

+
+public static boolean methodExists(java.lang.String className,
+                                   java.lang.String name,
+                                   java.lang.String type)
+
+
+
+
+
+
+ +

+getMethodIndex

+
+public static int getMethodIndex(java.lang.String className,
+                                 java.lang.String name,
+                                 java.lang.String type)
+
+
+
+
+
+
+ +

+fieldExistsExact

+
+public static boolean fieldExistsExact(java.lang.String className,
+                                       java.lang.String name,
+                                       java.lang.String type)
+
+
+
+
+
+
+ +

+fieldExists

+
+public static boolean fieldExists(java.lang.String className,
+                                  java.lang.String name,
+                                  java.lang.String type)
+
+
+
+
+
+
+ +

+getFieldInfoExact

+
+public static FieldInfo getFieldInfoExact(java.lang.String className,
+                                          java.lang.String name,
+                                          java.lang.String type)
+
+
+
+
+
+
+ +

+getFieldInfo

+
+public static FieldInfo getFieldInfo(java.lang.String className,
+                                     java.lang.String name,
+                                     java.lang.String type)
+
+
+
+
+
+
+ +

+getSuperClassName

+
+public static java.lang.String getSuperClassName(java.lang.String className)
+
+
+
+
+
+
+ +

+getStaticFieldIndex

+
+public static int getStaticFieldIndex(java.lang.String className,
+                                      java.lang.String name,
+                                      java.lang.String type)
+
+
+
+
+
+
+ +

+totalMethods

+
+public static int totalMethods()
+
+
+
+
+
+
+ +

+totalConstantEntries

+
+public static int totalConstantEntries()
+
+
+
+
+
+
+ +

+getConstantEntry

+
+public static int getConstantEntry(int index)
+
+
+
+
+
+
+ +

+totalStringSize

+
+public static int totalStringSize()
+
+
+
+
+
+
+ +

+totalStrings

+
+public static int totalStrings()
+
+
+
+
+
+
+ +

+getString

+
+public static java.lang.String getString(int index)
+
+
+
+
+
+
+ +

+totalStaticFields

+
+public static int totalStaticFields()
+
+
+
+
+
+
+ +

+getMainIndex

+
+public static int getMainIndex()
+
+
+
+
+
+
+ +

+getMethod

+
+public static MethodInfo getMethod(int index)
+
+
+
+
+
+
+ +

+totalClasses

+
+public static int totalClasses()
+
+
+
+
+
+
+ +

+getClassIndex

+
+public static int getClassIndex(int index)
+
+
+
+
+
+
+ +

+constantRelocate

+
+public static void constantRelocate(int i)
+
+
+
+
+
+
+ +

+load

+
+public static void load(java.lang.String name)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/CodeInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/CodeInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/CodeInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/CodeInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,487 @@ + + + + + + + +CodeInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class CodeInfo

+
+java.lang.Object
+  extended by org.nanovm.converter.CodeInfo
+
+
+
+
public class CodeInfo
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
CodeInfo(short maxStack, + short maxLocals, + byte[] bytecode, + ExceptionInfo[] exceptionTable) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddAttribute(AttributeInfo attributeInfo) + +
+           
+ AttributeInfo[]getAttributes() + +
+           
+ byte[]getBytecode() + +
+           
+ ExceptionInfo[]getExceptionTable() + +
+           
+ LineNumberInfo[]getLineNumberTable() + +
+           
+ shortgetMaxLocals() + +
+           
+ shortgetMaxStack() + +
+           
+ voidsetBytecode(byte[] bytecode) + +
+           
+ voidsetExceptionTable(ExceptionInfo[] exceptionTable) + +
+           
+ voidsetLineNumberTable(LineNumberInfo[] lineNumberTable) + +
+           
+ voidsetLocalVariableTable(LocalVariableInfo[] localVariableTable) + +
+           
+ voidsetMaxLocals(short maxLocals) + +
+           
+ voidsetMaxStack(short maxStack) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+CodeInfo

+
+public CodeInfo(short maxStack,
+                short maxLocals,
+                byte[] bytecode,
+                ExceptionInfo[] exceptionTable)
+
+
+ + + + + + + + +
+Method Detail
+ +

+setMaxStack

+
+public void setMaxStack(short maxStack)
+
+
+
+
+
+
+ +

+getMaxStack

+
+public short getMaxStack()
+
+
+
+
+
+
+ +

+setMaxLocals

+
+public void setMaxLocals(short maxLocals)
+
+
+
+
+
+
+ +

+getMaxLocals

+
+public short getMaxLocals()
+
+
+
+
+
+
+ +

+setBytecode

+
+public void setBytecode(byte[] bytecode)
+
+
+
+
+
+
+ +

+getBytecode

+
+public byte[] getBytecode()
+
+
+
+
+
+
+ +

+setExceptionTable

+
+public void setExceptionTable(ExceptionInfo[] exceptionTable)
+
+
+
+
+
+
+ +

+getExceptionTable

+
+public ExceptionInfo[] getExceptionTable()
+
+
+
+
+
+
+ +

+setLineNumberTable

+
+public void setLineNumberTable(LineNumberInfo[] lineNumberTable)
+
+
+
+
+
+
+ +

+getLineNumberTable

+
+public LineNumberInfo[] getLineNumberTable()
+
+
+
+
+
+
+ +

+setLocalVariableTable

+
+public void setLocalVariableTable(LocalVariableInfo[] localVariableTable)
+
+
+
+
+
+
+ +

+addAttribute

+
+public void addAttribute(AttributeInfo attributeInfo)
+
+
+
+
+
+
+ +

+getAttributes

+
+public AttributeInfo[] getAttributes()
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/CodeTranslator.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/CodeTranslator.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/CodeTranslator.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/CodeTranslator.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,255 @@ + + + + + + + +CodeTranslator + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class CodeTranslator

+
+java.lang.Object
+  extended by org.nanovm.converter.CodeTranslator
+
+
+
+
public class CodeTranslator
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
CodeTranslator() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+static voidtranslate(ClassInfo classInfo, + byte[] code) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+CodeTranslator

+
+public CodeTranslator()
+
+
+ + + + + + + + +
+Method Detail
+ +

+translate

+
+public static void translate(ClassInfo classInfo,
+                             byte[] code)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/CommonInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/CommonInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/CommonInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/CommonInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,375 @@ + + + + + + + +CommonInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class CommonInfo

+
+java.lang.Object
+  extended by org.nanovm.converter.CommonInfo
+
+
+
Direct Known Subclasses:
ClassInfo, FieldInfo, MethodInfo
+
+
+
+
public class CommonInfo
extends java.lang.Object
+ + +

+A common base class for ClassInfo, MethodInfo, and FieldInfo. +

+ +

+

+
See Also:
ClassInfo, +MethodInfo, +FieldInfo
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
CommonInfo() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddAttribute(AttributeInfo attributeInfo) + +
+          Add a non-standard attribute.
+ shortgetAccessFlags() + +
+          Get the access flags of the class.
+ AttributeInfo[]getAttributes() + +
+          Get all non-standard attributes.
+ java.lang.StringgetName() + +
+          Get the name of this class/method/field.
+ voidsetAccessFlags(short accessFlags) + +
+          Set the access flags of the class.
+ voidsetName(java.lang.String name) + +
+          Set the name of this class/method/field.
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+CommonInfo

+
+public CommonInfo()
+
+
+ + + + + + + + +
+Method Detail
+ +

+setName

+
+public void setName(java.lang.String name)
+
+
Set the name of this class/method/field. +

+

+
+
+
+
+ +

+getName

+
+public java.lang.String getName()
+
+
Get the name of this class/method/field. +

+

+
+
+
+
+ +

+setAccessFlags

+
+public void setAccessFlags(short accessFlags)
+
+
Set the access flags of the class. +

+

+
See Also:
AccessFlags
+
+
+
+ +

+getAccessFlags

+
+public short getAccessFlags()
+
+
Get the access flags of the class. +

+

+
See Also:
AccessFlags
+
+
+
+ +

+addAttribute

+
+public void addAttribute(AttributeInfo attributeInfo)
+
+
Add a non-standard attribute. This does not include the Code + attribute for methods, the SourceFile attribute for classes, or the + ConstantValue attribute for fields. +

+

+
+
+
+
+ +

+getAttributes

+
+public AttributeInfo[] getAttributes()
+
+
Get all non-standard attributes. This does not include the Code + attribute for methods, the SourceFile attribute for classes, or the + ConstantValue attribute for fields. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/Config.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/Config.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/Config.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/Config.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,492 @@ + + + + + + + +Config + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class Config

+
+java.lang.Object
+  extended by org.nanovm.converter.Config
+
+
+
+
public class Config
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intTARGET_CTBOT_AUTO + +
+           
+static intTARGET_FILE + +
+           
+static intTARGET_NONE + +
+           
+static intTARGET_NVC1_ASURO + +
+           
+static intTARGET_NVC1_AUTO + +
+           
+static intTARGET_NVC1_UART + +
+           
+static intTARGET_NVC2_AUTO + +
+           
+  + + + + + + + + + + +
+Constructor Summary
Config() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static java.lang.StringgetFileName() + +
+           
+static intgetMaxSize() + +
+           
+static intgetSpeed() + +
+           
+static intgetTarget() + +
+           
+static voidload(java.lang.String fileName) + +
+           
+static voidoverwriteFileName(java.lang.String name) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+TARGET_NONE

+
+public static final int TARGET_NONE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TARGET_FILE

+
+public static final int TARGET_FILE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TARGET_NVC1_AUTO

+
+public static final int TARGET_NVC1_AUTO
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TARGET_NVC1_UART

+
+public static final int TARGET_NVC1_UART
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TARGET_NVC1_ASURO

+
+public static final int TARGET_NVC1_ASURO
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TARGET_NVC2_AUTO

+
+public static final int TARGET_NVC2_AUTO
+
+
+
See Also:
Constant Field Values
+
+
+ +

+TARGET_CTBOT_AUTO

+
+public static final int TARGET_CTBOT_AUTO
+
+
+
See Also:
Constant Field Values
+
+ + + + + + + + +
+Constructor Detail
+ +

+Config

+
+public Config()
+
+
+ + + + + + + + +
+Method Detail
+ +

+getTarget

+
+public static int getTarget()
+
+
+
+
+
+
+ +

+getFileName

+
+public static java.lang.String getFileName()
+
+
+
+
+
+
+ +

+overwriteFileName

+
+public static void overwriteFileName(java.lang.String name)
+
+
+
+
+
+
+ +

+getSpeed

+
+public static int getSpeed()
+
+
+
+
+
+
+ +

+getMaxSize

+
+public static int getMaxSize()
+
+
+
+
+
+
+ +

+load

+
+public static void load(java.lang.String fileName)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/ConstPool.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/ConstPool.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/ConstPool.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/ConstPool.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,589 @@ + + + + + + + +ConstPool + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class ConstPool

+
+java.lang.Object
+  extended by org.nanovm.converter.ConstPool
+
+
+
+
public class ConstPool
extends java.lang.Object
+ + +

+This class encapsulates constant pool management. Classfiles use + constant pools to store information such as class names, method + names, type signatures, and literals like "Hello World" or 123. When + the information is needed (like for a method declaration), an index + into the constant pool is given instead of the actual information. + This can reduce the size of a classfile dramatically if the same + information is used frequently. + +

ClassFileReaders and ClassFileWriters usually try to convert + constant pool indexes into meaningful data (eg ClassInfo.setName() + takes a String instead of a constant pool index). So you probably + won't need to use this class unless you need to work with attributes + that the ClassFileReader/Writer doesn't understand, such as + bytecodes. + +

The constant pool is a 0-based array of entries. The entry at + index 0 is never used. That is, + +

constPool.getEntryAtIndex(0).isUnused() == true;
+ + Another quirk of the constant pool is that LONG and DOUBLE + entries take up "two" indexes. That is, + +
short longIndex = constPool.addEntry(new ConstPoolEntry().setLong(0));
+ constPool.getEntryAtIndex(longIndex+1).isUnused() == true;
+

+ +

+

+
See Also:
ConstPoolEntry, +Signature
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
ConstPool() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ intaddEntry(ConstPoolEntry entry) + +
+          Add a constant pool entry, whether or not it's already in the pool.
+ intconstantRelocate(int index) + +
+           
+ intgetConstantEntry(int n) + +
+           
+ ConstPoolEntrygetEntryAtIndex(int index) + +
+          Get the const pool entry at a given index.
+ intgetIndexOfClassAdd(java.lang.String classname) + +
+          Convenience method to return the index of the CLASS const pool entry + whose classname is equal to the given string.
+ intgetIndexOfEntryAdd(ConstPoolEntry entry) + +
+          Return the index of a constant pool entry equal to the specified one.
+ intgetIndexOfEntryNoAdd(ConstPoolEntry entry) + +
+          Return the index of a constant pool entry equal to the specified one.
+ intgetIndexOfUTFAdd(java.lang.String str) + +
+          Convenience method to return the index of the UTF const pool entry + equal to the given string.
+ java.lang.StringgetString(int n) + +
+           
+ voidread(java.io.DataInput in) + +
+          Read in the constant pool from a stream.
+ voidresolveMethodRefs() + +
+           
+ intsize() + +
+          Get the size of the pool.
+ inttotalConstantEntries() + +
+           
+ inttotalStrings() + +
+           
+ inttotalStringSize() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+ConstPool

+
+public ConstPool()
+
+
+ + + + + + + + +
+Method Detail
+ +

+size

+
+public int size()
+
+
Get the size of the pool. +

+

+
+
+
+
+ +

+addEntry

+
+public int addEntry(ConstPoolEntry entry)
+
+
Add a constant pool entry, whether or not it's already in the pool. + If the entry is a LONG or DOUBLE, a second, unused entry is + also added. +

+

+
+
+
+
+ +

+getEntryAtIndex

+
+public ConstPoolEntry getEntryAtIndex(int index)
+
+
Get the const pool entry at a given index. +

+

+
+
+
+
+ +

+getIndexOfEntryNoAdd

+
+public int getIndexOfEntryNoAdd(ConstPoolEntry entry)
+
+
Return the index of a constant pool entry equal to the specified one. + If there is no matching entry in the pool yet, -1 is returned. Comparisons + are by value, not by reference. +

+

+
+
+
+
+ +

+getIndexOfEntryAdd

+
+public int getIndexOfEntryAdd(ConstPoolEntry entry)
+
+
Return the index of a constant pool entry equal to the specified one. + If there is no matching entry in the pool yet, a clone of the specified + entry is added. Comparisons are made by value, not by reference. +

+

+
+
+
+
+ +

+getIndexOfUTFAdd

+
+public int getIndexOfUTFAdd(java.lang.String str)
+
+
Convenience method to return the index of the UTF const pool entry + equal to the given string. If there is no matching entry in the const pool yet, + a new one is added. Without this method, something like the following code + would be used: +
constPool.getIndexOfEntryAdd(new ConstPoolEntry().setUTF(str));
+ This method avoids the overhead of allocating a ConstPoolEntry every time. +

+

+
+
+
+
+ +

+getIndexOfClassAdd

+
+public int getIndexOfClassAdd(java.lang.String classname)
+
+
Convenience method to return the index of the CLASS const pool entry + whose classname is equal to the given string. If there is no matching entry in + the const pool yet, a new one is added. Without this method, something like + the following code would be used: +
short nameIndex = constPool.getIndexOfUTFAdd(classname);
+ constPool.getIndexEntryAdd(new ConstPoolEntry().setClass(nameIndex));
+ This method avoids the overhead of allocating a ConstPoolEntry every time. +

+

+
+
+
+
+ +

+read

+
+public void read(java.io.DataInput in)
+          throws java.io.IOException
+
+
Read in the constant pool from a stream. +

+

+ +
Throws: +
ClassFileReadException - if the class file is corrupt. +
java.io.IOException - if the DataInput throws an IOException.
+
+
+
+ +

+totalConstantEntries

+
+public int totalConstantEntries()
+
+
+
+
+
+
+ +

+getConstantEntry

+
+public int getConstantEntry(int n)
+
+
+
+
+
+
+ +

+totalStrings

+
+public int totalStrings()
+
+
+
+
+
+
+ +

+totalStringSize

+
+public int totalStringSize()
+
+
+
+
+
+
+ +

+getString

+
+public java.lang.String getString(int n)
+
+
+
+
+
+
+ +

+constantRelocate

+
+public int constantRelocate(int index)
+
+
+
+
+
+
+ +

+resolveMethodRefs

+
+public void resolveMethodRefs()
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/ConstPoolEntry.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/ConstPoolEntry.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/ConstPoolEntry.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/ConstPoolEntry.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,1218 @@ + + + + + + + +ConstPoolEntry + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class ConstPoolEntry

+
+java.lang.Object
+  extended by org.nanovm.converter.ConstPoolEntry
+
+
+
All Implemented Interfaces:
java.lang.Cloneable
+
+
+
+
public final class ConstPoolEntry
extends java.lang.Object
implements java.lang.Cloneable
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static intCLASS + +
+           
+static intDOUBLE + +
+           
+static intFIELDREF + +
+           
+static intFLOAT + +
+           
+static intINT + +
+           
+static intINTERFACEMETHODREF + +
+           
+static intLONG + +
+           
+static intMETHODREF + +
+           
+static intNAMEANDTYPE + +
+           
+static intSTRING + +
+           
+static intUNICODE + +
+           
+static intUTF + +
+           
+  + + + + + + + + + + +
+Constructor Summary
ConstPoolEntry() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.lang.Objectclone() + +
+           
+ booleanequals(java.lang.Object o) + +
+           
+ intgetClassIndex() + +
+          For FIELDREF, METHODREF, or INTERFACEMETHODREF entries.
+ intgetClassNameIndex() + +
+          For CLASS entries.
+ doublegetDouble() + +
+          For DOUBLE entries.
+ floatgetFloat() + +
+          For FLOAT entries.
+ intgetInt() + +
+          For INT entries.
+ longgetLong() + +
+          For LONG entries.
+ intgetNameAndTypeIndex() + +
+          For FIELDREF, METHODREF, or INTERFACEMETHODREF entries.
+ intgetNameIndex() + +
+          For NAMEANDTYPE entries.
+ java.lang.ObjectgetPrimitiveTypeValue() + +
+          For INT, LONG, FLOAT, DOUBLE, UTF, or UNICODE entries, + returns an Integer, Long, Float, Double, or String, respectively.
+ java.lang.StringgetString() + +
+          For UTF and UNICODE entries.
+ intgetStringIndex() + +
+          For STRING entries.
+ intgetTypeIndex() + +
+          For NAMEANDTYPE entries.
+ inthashCode() + +
+           
+ booleanisUnused() + +
+           
+ voidread(java.io.DataInput in, + ConstPoolEntry entry) + +
+           
+ ConstPoolEntrysetClass(int index) + +
+           
+ ConstPoolEntrysetDouble(double value) + +
+           
+ ConstPoolEntrysetFieldRef(int index1, + int index2) + +
+           
+ ConstPoolEntrysetFloat(float value) + +
+           
+ ConstPoolEntrysetInt(int value) + +
+           
+ ConstPoolEntrysetInterfaceMethodRef(int index1, + int index2) + +
+           
+ ConstPoolEntrysetLong(long value) + +
+           
+ ConstPoolEntrysetMethodRef(int index1, + int index2) + +
+           
+ ConstPoolEntrysetNameAndType(int index1, + int index2) + +
+           
+ ConstPoolEntrysetString(int index) + +
+           
+ ConstPoolEntrysetUnicode(java.lang.String value) + +
+           
+ ConstPoolEntrysetUnused() + +
+          Some const pool entries don't actually exist -- like the ones after a + LONG or DOUBLE, or entry 0.
+ ConstPoolEntrysetUTF(java.lang.String value) + +
+           
+ java.lang.StringtoString() + +
+           
+ bytetypecode() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+UTF

+
+public static final int UTF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+UNICODE

+
+public static final int UNICODE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+INT

+
+public static final int INT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FLOAT

+
+public static final int FLOAT
+
+
+
See Also:
Constant Field Values
+
+
+ +

+LONG

+
+public static final int LONG
+
+
+
See Also:
Constant Field Values
+
+
+ +

+DOUBLE

+
+public static final int DOUBLE
+
+
+
See Also:
Constant Field Values
+
+
+ +

+CLASS

+
+public static final int CLASS
+
+
+
See Also:
Constant Field Values
+
+
+ +

+STRING

+
+public static final int STRING
+
+
+
See Also:
Constant Field Values
+
+
+ +

+FIELDREF

+
+public static final int FIELDREF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+METHODREF

+
+public static final int METHODREF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+INTERFACEMETHODREF

+
+public static final int INTERFACEMETHODREF
+
+
+
See Also:
Constant Field Values
+
+
+ +

+NAMEANDTYPE

+
+public static final int NAMEANDTYPE
+
+
+
See Also:
Constant Field Values
+
+ + + + + + + + +
+Constructor Detail
+ +

+ConstPoolEntry

+
+public ConstPoolEntry()
+
+
+ + + + + + + + +
+Method Detail
+ +

+equals

+
+public boolean equals(java.lang.Object o)
+
+
+
Overrides:
equals in class java.lang.Object
+
+
+
+
+
+
+ +

+hashCode

+
+public int hashCode()
+
+
+
Overrides:
hashCode in class java.lang.Object
+
+
+
+
+
+
+ +

+clone

+
+public java.lang.Object clone()
+
+
+
Overrides:
clone in class java.lang.Object
+
+
+
+
+
+
+ +

+toString

+
+public java.lang.String toString()
+
+
+
Overrides:
toString in class java.lang.Object
+
+
+
+
+
+
+ +

+typecode

+
+public byte typecode()
+
+
+
+
+
+
+
+
+
+ +

+setUnused

+
+public ConstPoolEntry setUnused()
+
+
Some const pool entries don't actually exist -- like the ones after a + LONG or DOUBLE, or entry 0. These entries are unused. +

+

+
+
+
+
+
+
+
+ +

+isUnused

+
+public boolean isUnused()
+
+
+
+
+
+
+
+
+
+ +

+setUTF

+
+public ConstPoolEntry setUTF(java.lang.String value)
+
+
+
+
+
+
+
+
+
+ +

+setUnicode

+
+public ConstPoolEntry setUnicode(java.lang.String value)
+
+
+
+
+
+
+
+
+
+ +

+setInt

+
+public ConstPoolEntry setInt(int value)
+
+
+
+
+
+
+
+
+
+ +

+setLong

+
+public ConstPoolEntry setLong(long value)
+
+
+
+
+
+
+
+
+
+ +

+setFloat

+
+public ConstPoolEntry setFloat(float value)
+
+
+
+
+
+
+
+
+
+ +

+setDouble

+
+public ConstPoolEntry setDouble(double value)
+
+
+
+
+
+
+
+
+
+ +

+setString

+
+public ConstPoolEntry setString(int index)
+
+
+
+
+
+
+
+
+
+ +

+setClass

+
+public ConstPoolEntry setClass(int index)
+
+
+
+
+
+
+
+
+
+ +

+setFieldRef

+
+public ConstPoolEntry setFieldRef(int index1,
+                                  int index2)
+
+
+
+
+
+
+
+
+
+ +

+setMethodRef

+
+public ConstPoolEntry setMethodRef(int index1,
+                                   int index2)
+
+
+
+
+
+
+
+
+
+ +

+setInterfaceMethodRef

+
+public ConstPoolEntry setInterfaceMethodRef(int index1,
+                                            int index2)
+
+
+
+
+
+
+
+
+
+ +

+setNameAndType

+
+public ConstPoolEntry setNameAndType(int index1,
+                                     int index2)
+
+
+
+
+
+
+
+
+
+ +

+getString

+
+public java.lang.String getString()
+
+
For UTF and UNICODE entries. +

+

+
+
+
+
+
+
+
+ +

+getStringIndex

+
+public int getStringIndex()
+
+
For STRING entries. +

+

+
+
+
+
+
+
+
+ +

+getInt

+
+public int getInt()
+
+
For INT entries. +

+

+
+
+
+
+
+
+
+ +

+getLong

+
+public long getLong()
+
+
For LONG entries. +

+

+
+
+
+
+
+
+
+ +

+getFloat

+
+public float getFloat()
+
+
For FLOAT entries. +

+

+
+
+
+
+
+
+
+ +

+getDouble

+
+public double getDouble()
+
+
For DOUBLE entries. +

+

+
+
+
+
+
+
+
+ +

+getPrimitiveTypeValue

+
+public java.lang.Object getPrimitiveTypeValue()
+
+
For INT, LONG, FLOAT, DOUBLE, UTF, or UNICODE entries, + returns an Integer, Long, Float, Double, or String, respectively. +

+

+
+
+
+
+
+
+
+ +

+getClassNameIndex

+
+public int getClassNameIndex()
+
+
For CLASS entries. +

+

+
+
+
+
+
+
+
+ +

+getClassIndex

+
+public int getClassIndex()
+
+
For FIELDREF, METHODREF, or INTERFACEMETHODREF entries. +

+

+
+
+
+
+
+
+
+ +

+getNameAndTypeIndex

+
+public int getNameAndTypeIndex()
+
+
For FIELDREF, METHODREF, or INTERFACEMETHODREF entries. +

+

+
+
+
+
+
+
+
+ +

+getNameIndex

+
+public int getNameIndex()
+
+
For NAMEANDTYPE entries. +

+

+
+
+
+
+
+
+
+ +

+getTypeIndex

+
+public int getTypeIndex()
+
+
For NAMEANDTYPE entries. +

+

+
+
+
+
+
+
+
+ +

+read

+
+public void read(java.io.DataInput in,
+                 ConstPoolEntry entry)
+          throws java.io.IOException
+
+
+
+
+
+ +
Throws: +
java.io.IOException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/ConstPoolEntryError.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/ConstPoolEntryError.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/ConstPoolEntryError.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/ConstPoolEntryError.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,249 @@ + + + + + + + +ConstPoolEntryError + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class ConstPoolEntryError

+
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Error
+          extended by org.nanovm.converter.ConstPoolEntryError
+
+
+
All Implemented Interfaces:
java.io.Serializable
+
+
+
+
public class ConstPoolEntryError
extends java.lang.Error
+ + +

+An instance of this class is thrown when a ConstPoolEntry is + used incorrectly. For example, calling setUTF(null), or calling + getClassName() on an entry of type INT. It is a subclass of + Error instead of Exception because checking for it all the time + would make working with ConstPoolEntries very tedious. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
ConstPoolEntryError(java.lang.String msg) + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+ConstPoolEntryError

+
+public ConstPoolEntryError(java.lang.String msg)
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/Converter.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/Converter.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/Converter.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/Converter.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,257 @@ + + + + + + + +Converter + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class Converter

+
+java.lang.Object
+  extended by org.nanovm.converter.Converter
+
+
+
+
public class Converter
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
Converter() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+static NanoVMByteCodeconvert(java.lang.String config, + java.lang.String classpath, + java.lang.String classname) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Converter

+
+public Converter()
+
+
+ + + + + + + + +
+Method Detail
+ +

+convert

+
+public static NanoVMByteCode convert(java.lang.String config,
+                                     java.lang.String classpath,
+                                     java.lang.String classname)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/Debug.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/Debug.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/Debug.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/Debug.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,610 @@ + + + + + + + +Debug + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class Debug

+
+java.lang.Object
+  extended by org.nanovm.converter.Debug
+
+
+
+
public class Debug
extends java.lang.Object
+ + +

+All classfile debugging information gets piped through this class. + You can turn off categories of debug information by setting the + appropriate String to null. +

+ +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+static java.lang.StringstrBadData + +
+           
+static java.lang.StringstrClass + +
+           
+static java.lang.StringstrCode + +
+           
+static java.lang.StringstrConstPool + +
+           
+static java.lang.StringstrField + +
+           
+static java.lang.StringstrInnerClasses + +
+           
+static java.lang.StringstrInterface + +
+           
+static java.lang.StringstrLineNumbers + +
+           
+static java.lang.StringstrLocalVariables + +
+           
+static java.lang.StringstrMethod + +
+           
+static java.lang.StringstrUnknownAttribute + +
+           
+  + + + + + + + + + + +
+Constructor Summary
Debug() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static java.io.PrintStreamgetOutput() + +
+          Get the destination of debug messages.
+static voidindent() + +
+          Indent subsequent messages.
+static booleanisEnabled() + +
+          Get whether printing of debug messages is enabled.
+static voidoutdent() + +
+          Outdent subsequent messages.
+static voidprintln(java.lang.String prefix, + java.lang.String msg) + +
+          Print a debug message.
+static voidsetEnabled(boolean e) + +
+          Enable or disable printing of any debug message.
+static voidsetOutput(java.io.PrintStream out) + +
+          Redirect where debug messages are sent.
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+strClass

+
+public static java.lang.String strClass
+
+
+
+
+
+ +

+strConstPool

+
+public static java.lang.String strConstPool
+
+
+
+
+
+ +

+strField

+
+public static java.lang.String strField
+
+
+
+
+
+ +

+strMethod

+
+public static java.lang.String strMethod
+
+
+
+
+
+ +

+strCode

+
+public static java.lang.String strCode
+
+
+
+
+
+ +

+strInterface

+
+public static java.lang.String strInterface
+
+
+
+
+
+ +

+strLineNumbers

+
+public static java.lang.String strLineNumbers
+
+
+
+
+
+ +

+strLocalVariables

+
+public static java.lang.String strLocalVariables
+
+
+
+
+
+ +

+strInnerClasses

+
+public static java.lang.String strInnerClasses
+
+
+
+
+
+ +

+strUnknownAttribute

+
+public static java.lang.String strUnknownAttribute
+
+
+
+
+
+ +

+strBadData

+
+public static java.lang.String strBadData
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+Debug

+
+public Debug()
+
+
+ + + + + + + + +
+Method Detail
+ +

+indent

+
+public static void indent()
+
+
Indent subsequent messages. Subsequent messages will be indented by + two spaces until outdent() is called. All calls to indent() should eventually + be followed by a call to outdent(). +

+

+
+
+
+
+ +

+outdent

+
+public static void outdent()
+
+
Outdent subsequent messages. This should only be called after a previous + call to indent(). +

+

+
+
+
+
+ +

+setEnabled

+
+public static void setEnabled(boolean e)
+
+
Enable or disable printing of any debug message. +

+

+
+
+
+
+ +

+isEnabled

+
+public static boolean isEnabled()
+
+
Get whether printing of debug messages is enabled. +

+

+
+
+
+
+ +

+setOutput

+
+public static void setOutput(java.io.PrintStream out)
+
+
Redirect where debug messages are sent. +

+

+
+
+
+
+ +

+getOutput

+
+public static java.io.PrintStream getOutput()
+
+
Get the destination of debug messages. +

+

+
+
+
+
+ +

+println

+
+public static void println(java.lang.String prefix,
+                           java.lang.String msg)
+
+
Print a debug message. If the prefix is null, the message is not printed. + The message will be prefixed by blank space, the length of which is + determined by the current level of indentation. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/ExceptionInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/ExceptionInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/ExceptionInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/ExceptionInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,337 @@ + + + + + + + +ExceptionInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class ExceptionInfo

+
+java.lang.Object
+  extended by org.nanovm.converter.ExceptionInfo
+
+
+
+
public class ExceptionInfo
extends java.lang.Object
+ + +

+A class for storing information about the exception table of a method. + This class represents one row in the ExceptionTable. +

+ +

+

+
See Also:
sli.kim.classfile.CodeInfo#setExceptionTable()
+
+ +

+ + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ java.lang.StringcatchType + +
+           
+ shortendPC + +
+           
+ shorthandlerPC + +
+           
+ shortstartPC + +
+           
+  + + + + + + + + + + +
+Constructor Summary
ExceptionInfo(short startPC, + short endPC, + short handlerPC, + java.lang.String catchType) + +
+          Construct an ExceptionInfo
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+startPC

+
+public short startPC
+
+
+
+
+
+ +

+endPC

+
+public short endPC
+
+
+
+
+
+ +

+handlerPC

+
+public short handlerPC
+
+
+
+
+
+ +

+catchType

+
+public java.lang.String catchType
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+ExceptionInfo

+
+public ExceptionInfo(short startPC,
+                     short endPC,
+                     short handlerPC,
+                     java.lang.String catchType)
+
+
Construct an ExceptionInfo +

+

+
Parameters:
startPC - the index of the first instruction in the try block (that is, + startPC is inclusive).
endPC - the index of the first instruction not in the try block (that is, + endPC is exclusive). If the try block extends to the end of the method, + endPC will be equal to the length of the bytecode for the method.
handlerPC - the index of the first instruction of the catch handler.
catchType - the name of the exception class caught by the catch + handler. If this parameter is null, the handler catches all exceptions (this + is used for finally blocks).
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/FieldInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/FieldInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/FieldInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/FieldInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,378 @@ + + + + + + + +FieldInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class FieldInfo

+
+java.lang.Object
+  extended by org.nanovm.converter.CommonInfo
+      extended by org.nanovm.converter.FieldInfo
+
+
+
+
public class FieldInfo
extends CommonInfo
+ + +

+A class for storing information about fields. +

+ +

+

+
See Also:
ClassInfo#addField()
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
FieldInfo(short accessFlags, + java.lang.String name, + java.lang.String signature) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.lang.ObjectgetConstantValue() + +
+          Get the constant value of this field.
+ java.lang.StringgetSignature() + +
+          Get the signature of the field.
+ booleanisSynthetic() + +
+           
+ voidsetConstantValue(java.lang.Object constValue) + +
+          Set the constant value of this field.
+ voidsetSignature(java.lang.String signature) + +
+          Set the signature of the field.
+ voidsetSynthetic(boolean synthetic) + +
+           
+ + + + + + + +
Methods inherited from class org.nanovm.converter.CommonInfo
addAttribute, getAccessFlags, getAttributes, getName, setAccessFlags, setName
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+FieldInfo

+
+public FieldInfo(short accessFlags,
+                 java.lang.String name,
+                 java.lang.String signature)
+
+
+ + + + + + + + +
+Method Detail
+ +

+setSignature

+
+public void setSignature(java.lang.String signature)
+
+
Set the signature of the field. For example "[Ljava/lang/String;" +

+

+
See Also:
Signature
+
+
+
+ +

+getSignature

+
+public java.lang.String getSignature()
+
+
Get the signature of the field. +

+

+
See Also:
Signature
+
+
+
+ +

+setConstantValue

+
+public void setConstantValue(java.lang.Object constValue)
+
+
Set the constant value of this field. This only applies to final fields. + The value must be a String, Integer, Long, Float, or Double. +

+

+
+
+
+
+ +

+getConstantValue

+
+public java.lang.Object getConstantValue()
+
+
Get the constant value of this field. The result must be a String, + Integer, Long, Float, or Double. +

+

+
+
+
+
+ +

+setSynthetic

+
+public void setSynthetic(boolean synthetic)
+
+
+
+
+
+
+ +

+isSynthetic

+
+public boolean isSynthetic()
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/Generator.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/Generator.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/Generator.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/Generator.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,253 @@ + + + + + + + +Generator + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class Generator

+
+java.lang.Object
+  extended by org.nanovm.converter.Generator
+
+
+
+
public class Generator
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
Generator() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ voidgenerate(NanoVMByteCode code) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Generator

+
+public Generator()
+
+
+ + + + + + + + +
+Method Detail
+ +

+generate

+
+public void generate(NanoVMByteCode code)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/InnerClassInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/InnerClassInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/InnerClassInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/InnerClassInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,337 @@ + + + + + + + +InnerClassInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class InnerClassInfo

+
+java.lang.Object
+  extended by org.nanovm.converter.InnerClassInfo
+
+
+
+
public class InnerClassInfo
extends java.lang.Object
+ + +

+A class for storing information about inner classes. + This class represents one row in the InnerClasses table. +

+ +

+

+
See Also:
sli.kim.classfile.ClassInfo#setInnerClasses()
+
+ +

+ + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ shortflags + +
+           
+ java.lang.StringinnerClass + +
+           
+ java.lang.StringouterClass + +
+           
+ java.lang.StringsimpleName + +
+           
+  + + + + + + + + + + +
+Constructor Summary
InnerClassInfo(java.lang.String innerClass, + java.lang.String outerClass, + java.lang.String simpleName, + short flags) + +
+          Construct an inner class record.
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+innerClass

+
+public java.lang.String innerClass
+
+
+
+
+
+ +

+outerClass

+
+public java.lang.String outerClass
+
+
+
+
+
+ +

+simpleName

+
+public java.lang.String simpleName
+
+
+
+
+
+ +

+flags

+
+public short flags
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+InnerClassInfo

+
+public InnerClassInfo(java.lang.String innerClass,
+                      java.lang.String outerClass,
+                      java.lang.String simpleName,
+                      short flags)
+
+
Construct an inner class record. +

+

+
Parameters:
innerClass - the full name of the inner class (eg "mypackage.Foo$Bar")
outerClass - the full name of the outer class. This is null for non-member + classes (that is, classes that are declared static)
simpleName - the simple name of the class (eg "String"). This is null for + anonymous classes.
the - access flags of the class. When an inner class is compiled to a .class + file, the compiler changes its access flags to ensure compatibility with pre-1.1 + virtual machines. Specifically, protected becomes public, and private becomes + package.
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/LineNumberInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/LineNumberInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/LineNumberInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/LineNumberInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,288 @@ + + + + + + + +LineNumberInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class LineNumberInfo

+
+java.lang.Object
+  extended by org.nanovm.converter.LineNumberInfo
+
+
+
+
public class LineNumberInfo
extends java.lang.Object
+ + +

+A class for storing information about line numbers. + This class represents one row in the LineNumberTable. +

+ +

+

+
See Also:
sli.kim.classfile.CodeInfo#setLineNumberTable()
+
+ +

+ + + + + + + + + + + + + + + +
+Field Summary
+ shortlineNumber + +
+           
+ shortstartPC + +
+           
+  + + + + + + + + + + +
+Constructor Summary
LineNumberInfo(short startPC, + short lineNumber) + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+startPC

+
+public short startPC
+
+
+
+
+
+ +

+lineNumber

+
+public short lineNumber
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+LineNumberInfo

+
+public LineNumberInfo(short startPC,
+                      short lineNumber)
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/LocalVariableInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/LocalVariableInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/LocalVariableInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/LocalVariableInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,348 @@ + + + + + + + +LocalVariableInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class LocalVariableInfo

+
+java.lang.Object
+  extended by org.nanovm.converter.LocalVariableInfo
+
+
+
+
public class LocalVariableInfo
extends java.lang.Object
+ + +

+A class for storing information about local variables. + This class represents one row in the LocalVariableTable. +

+ +

+

+
See Also:
sli.kim.classfile.CodeInfo#setLocalVariableTable()
+
+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+ shortlength + +
+           
+ java.lang.Stringname + +
+           
+ java.lang.Stringsignature + +
+           
+ shortslot + +
+           
+ shortstartPC + +
+           
+  + + + + + + + + + + +
+Constructor Summary
LocalVariableInfo(short startPC, + short length, + java.lang.String name, + java.lang.String signature, + short slot) + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+startPC

+
+public short startPC
+
+
+
+
+
+ +

+length

+
+public short length
+
+
+
+
+
+ +

+slot

+
+public short slot
+
+
+
+
+
+ +

+name

+
+public java.lang.String name
+
+
+
+
+
+ +

+signature

+
+public java.lang.String signature
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+LocalVariableInfo

+
+public LocalVariableInfo(short startPC,
+                         short length,
+                         java.lang.String name,
+                         java.lang.String signature,
+                         short slot)
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/MethodIdTable.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/MethodIdTable.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/MethodIdTable.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/MethodIdTable.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,272 @@ + + + + + + + +MethodIdTable + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class MethodIdTable

+
+java.lang.Object
+  extended by org.nanovm.converter.MethodIdTable
+
+
+
+
public class MethodIdTable
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
MethodIdTable() + +
+           
+  + + + + + + + + + + + + + + + +
+Method Summary
+static voidbuild() + +
+           
+static intgetEntry(int i) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+MethodIdTable

+
+public MethodIdTable()
+
+
+ + + + + + + + +
+Method Detail
+ +

+build

+
+public static void build()
+
+
+
+
+
+
+ +

+getEntry

+
+public static int getEntry(int i)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/MethodInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/MethodInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/MethodInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/MethodInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,400 @@ + + + + + + + +MethodInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class MethodInfo

+
+java.lang.Object
+  extended by org.nanovm.converter.CommonInfo
+      extended by org.nanovm.converter.MethodInfo
+
+
+
+
public class MethodInfo
extends CommonInfo
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
MethodInfo(short accessFlags, + java.lang.String name, + java.lang.String signature) + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidaddException(java.lang.String exceptionName) + +
+           
+ intgetArgs() + +
+           
+ CodeInfogetCodeInfo() + +
+           
+ java.lang.StringgetSignature() + +
+           
+ booleanisDeprecated() + +
+           
+ voidsetCodeInfo(CodeInfo codeInfo) + +
+           
+ voidsetDeprecated(boolean d) + +
+           
+ voidsetSignature(java.lang.String signature) + +
+           
+ + + + + + + +
Methods inherited from class org.nanovm.converter.CommonInfo
addAttribute, getAccessFlags, getAttributes, getName, setAccessFlags, setName
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+MethodInfo

+
+public MethodInfo(short accessFlags,
+                  java.lang.String name,
+                  java.lang.String signature)
+
+
+ + + + + + + + +
+Method Detail
+ +

+setSignature

+
+public void setSignature(java.lang.String signature)
+
+
+
+
+
+
+ +

+getArgs

+
+public int getArgs()
+
+
+
+
+
+
+ +

+getSignature

+
+public java.lang.String getSignature()
+
+
+
+
+
+
+ +

+addException

+
+public void addException(java.lang.String exceptionName)
+
+
+
+
+
+
+ +

+setCodeInfo

+
+public void setCodeInfo(CodeInfo codeInfo)
+
+
+
+
+
+
+ +

+getCodeInfo

+
+public CodeInfo getCodeInfo()
+
+
+
+
+
+
+ +

+setDeprecated

+
+public void setDeprecated(boolean d)
+
+
+
+
+
+
+ +

+isDeprecated

+
+public boolean isDeprecated()
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/NativeMapper.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/NativeMapper.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/NativeMapper.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/NativeMapper.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,377 @@ + + + + + + + +NativeMapper + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class NativeMapper

+
+java.lang.Object
+  extended by org.nanovm.converter.NativeMapper
+
+
+
+
public class NativeMapper
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Field Summary
+static intlowestNativeId + +
+           
+  + + + + + + + + + + +
+Constructor Summary
NativeMapper() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+static intgetFieldId(java.lang.String className, + java.lang.String name, + java.lang.String type) + +
+           
+static intgetMethodId(java.lang.String className, + java.lang.String name, + java.lang.String type) + +
+           
+static intgetNativeClassId(java.lang.String className) + +
+           
+ voidload(java.lang.String className) + +
+           
+static booleanmethodIsNative(java.lang.String className, + java.lang.String name, + java.lang.String type) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Field Detail
+ +

+lowestNativeId

+
+public static int lowestNativeId
+
+
+
+
+ + + + + + + + +
+Constructor Detail
+ +

+NativeMapper

+
+public NativeMapper()
+
+
+ + + + + + + + +
+Method Detail
+ +

+load

+
+public void load(java.lang.String className)
+
+
+
+
+
+
+ +

+methodIsNative

+
+public static boolean methodIsNative(java.lang.String className,
+                                     java.lang.String name,
+                                     java.lang.String type)
+
+
+
+
+
+
+ +

+getMethodId

+
+public static int getMethodId(java.lang.String className,
+                              java.lang.String name,
+                              java.lang.String type)
+
+
+
+
+
+
+ +

+getFieldId

+
+public static int getFieldId(java.lang.String className,
+                             java.lang.String name,
+                             java.lang.String type)
+
+
+
+
+
+
+ +

+getNativeClassId

+
+public static int getNativeClassId(java.lang.String className)
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/UsedFeatures.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/UsedFeatures.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/UsedFeatures.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/UsedFeatures.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,272 @@ + + + + + + + +UsedFeatures + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.converter +
+Class UsedFeatures

+
+java.lang.Object
+  extended by org.nanovm.converter.UsedFeatures
+
+
+
+
public class UsedFeatures
extends java.lang.Object
+ + +

+


+ +

+ + + + + + + + + + + +
+Constructor Summary
UsedFeatures() + +
+           
+  + + + + + + + + + + + + + + + +
+Method Summary
+static voidadd(int f) + +
+           
+static intget() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+UsedFeatures

+
+public UsedFeatures()
+
+
+ + + + + + + + +
+Method Detail
+ +

+add

+
+public static void add(int f)
+
+
+
+
+
+
+ +

+get

+
+public static int get()
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/AccessFlags.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/AccessFlags.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/AccessFlags.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/AccessFlags.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,182 @@ + + + + + + + +Uses of Interface org.nanovm.converter.AccessFlags + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Interface
org.nanovm.converter.AccessFlags

+
+ + + + + + + + + +
+Packages that use AccessFlags
org.nanovm.converter  
+  +

+ + + + + +
+Uses of AccessFlags in org.nanovm.converter
+  +

+ + + + + + + + + +
Classes in org.nanovm.converter that implement AccessFlags
+ classClassFileReader + +
+          This class parses java class files and stores the information in a + ClassInfo object.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/AttributeInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/AttributeInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/AttributeInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/AttributeInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,213 @@ + + + + + + + +Uses of Class org.nanovm.converter.AttributeInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.AttributeInfo

+
+ + + + + + + + + +
+Packages that use AttributeInfo
org.nanovm.converter  
+  +

+ + + + + +
+Uses of AttributeInfo in org.nanovm.converter
+  +

+ + + + + + + + + + + + + +
Methods in org.nanovm.converter that return AttributeInfo
+ AttributeInfo[]CodeInfo.getAttributes() + +
+           
+ AttributeInfo[]CommonInfo.getAttributes() + +
+          Get all non-standard attributes.
+  +

+ + + + + + + + + + + + + +
Methods in org.nanovm.converter with parameters of type AttributeInfo
+ voidCodeInfo.addAttribute(AttributeInfo attributeInfo) + +
+           
+ voidCommonInfo.addAttribute(AttributeInfo attributeInfo) + +
+          Add a non-standard attribute.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ClassFileReader.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ClassFileReader.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ClassFileReader.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ClassFileReader.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.nanovm.converter.ClassFileReader + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.ClassFileReader

+
+No usage of org.nanovm.converter.ClassFileReader +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ClassInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ClassInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ClassInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ClassInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,223 @@ + + + + + + + +Uses of Class org.nanovm.converter.ClassInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.ClassInfo

+
+ + + + + + + + + +
+Packages that use ClassInfo
org.nanovm.converter  
+  +

+ + + + + +
+Uses of ClassInfo in org.nanovm.converter
+  +

+ + + + + + + + + + + + + + + + + +
Methods in org.nanovm.converter that return ClassInfo
+static ClassInfoClassLoader.getClassInfo(int index) + +
+           
+static ClassInfoClassLoader.getClassInfo(java.lang.String className) + +
+           
+static ClassInfoClassLoader.getClassInfoFromMethodIndex(int index) + +
+           
+  +

+ + + + + + + + + + + + + +
Methods in org.nanovm.converter with parameters of type ClassInfo
+ voidClassFileReader.read(java.io.InputStream in, + ClassInfo classInfo) + +
+           
+static voidCodeTranslator.translate(ClassInfo classInfo, + byte[] code) + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ClassLoader.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ClassLoader.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ClassLoader.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ClassLoader.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.nanovm.converter.ClassLoader + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.ClassLoader

+
+No usage of org.nanovm.converter.ClassLoader +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/CodeInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/CodeInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/CodeInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/CodeInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,197 @@ + + + + + + + +Uses of Class org.nanovm.converter.CodeInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.CodeInfo

+
+ + + + + + + + + +
+Packages that use CodeInfo
org.nanovm.converter  
+  +

+ + + + + +
+Uses of CodeInfo in org.nanovm.converter
+  +

+ + + + + + + + + +
Methods in org.nanovm.converter that return CodeInfo
+ CodeInfoMethodInfo.getCodeInfo() + +
+           
+  +

+ + + + + + + + + +
Methods in org.nanovm.converter with parameters of type CodeInfo
+ voidMethodInfo.setCodeInfo(CodeInfo codeInfo) + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/CodeTranslator.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/CodeTranslator.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/CodeTranslator.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/CodeTranslator.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.nanovm.converter.CodeTranslator + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.CodeTranslator

+
+No usage of org.nanovm.converter.CodeTranslator +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/CommonInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/CommonInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/CommonInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/CommonInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,197 @@ + + + + + + + +Uses of Class org.nanovm.converter.CommonInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.CommonInfo

+
+ + + + + + + + + +
+Packages that use CommonInfo
org.nanovm.converter  
+  +

+ + + + + +
+Uses of CommonInfo in org.nanovm.converter
+  +

+ + + + + + + + + + + + + + + + + +
Subclasses of CommonInfo in org.nanovm.converter
+ classClassInfo + +
+          A class for storing information about a class.
+ classFieldInfo + +
+          A class for storing information about fields.
+ classMethodInfo + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/Config.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/Config.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/Config.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/Config.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.nanovm.converter.Config + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.Config

+
+No usage of org.nanovm.converter.Config +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ConstPool.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ConstPool.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ConstPool.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ConstPool.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,197 @@ + + + + + + + +Uses of Class org.nanovm.converter.ConstPool + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.ConstPool

+
+ + + + + + + + + +
+Packages that use ConstPool
org.nanovm.converter  
+  +

+ + + + + +
+Uses of ConstPool in org.nanovm.converter
+  +

+ + + + + + + + + +
Methods in org.nanovm.converter that return ConstPool
+ ConstPoolClassInfo.getConstPool() + +
+          Get the constant pool.
+  +

+ + + + + + + + + +
Methods in org.nanovm.converter with parameters of type ConstPool
+ voidClassInfo.setConstPool(ConstPool cp) + +
+          Set the constant pool.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ConstPoolEntry.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ConstPoolEntry.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ConstPoolEntry.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ConstPoolEntry.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,331 @@ + + + + + + + +Uses of Class org.nanovm.converter.ConstPoolEntry + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.ConstPoolEntry

+
+ + + + + + + + + +
+Packages that use ConstPoolEntry
org.nanovm.converter  
+  +

+ + + + + +
+Uses of ConstPoolEntry in org.nanovm.converter
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in org.nanovm.converter that return ConstPoolEntry
+ ConstPoolEntryConstPool.getEntryAtIndex(int index) + +
+          Get the const pool entry at a given index.
+ ConstPoolEntryConstPoolEntry.setClass(int index) + +
+           
+ ConstPoolEntryConstPoolEntry.setDouble(double value) + +
+           
+ ConstPoolEntryConstPoolEntry.setFieldRef(int index1, + int index2) + +
+           
+ ConstPoolEntryConstPoolEntry.setFloat(float value) + +
+           
+ ConstPoolEntryConstPoolEntry.setInt(int value) + +
+           
+ ConstPoolEntryConstPoolEntry.setInterfaceMethodRef(int index1, + int index2) + +
+           
+ ConstPoolEntryConstPoolEntry.setLong(long value) + +
+           
+ ConstPoolEntryConstPoolEntry.setMethodRef(int index1, + int index2) + +
+           
+ ConstPoolEntryConstPoolEntry.setNameAndType(int index1, + int index2) + +
+           
+ ConstPoolEntryConstPoolEntry.setString(int index) + +
+           
+ ConstPoolEntryConstPoolEntry.setUnicode(java.lang.String value) + +
+           
+ ConstPoolEntryConstPoolEntry.setUnused() + +
+          Some const pool entries don't actually exist -- like the ones after a + LONG or DOUBLE, or entry 0.
+ ConstPoolEntryConstPoolEntry.setUTF(java.lang.String value) + +
+           
+  +

+ + + + + + + + + + + + + + + + + + + + + +
Methods in org.nanovm.converter with parameters of type ConstPoolEntry
+ intConstPool.addEntry(ConstPoolEntry entry) + +
+          Add a constant pool entry, whether or not it's already in the pool.
+ intConstPool.getIndexOfEntryAdd(ConstPoolEntry entry) + +
+          Return the index of a constant pool entry equal to the specified one.
+ intConstPool.getIndexOfEntryNoAdd(ConstPoolEntry entry) + +
+          Return the index of a constant pool entry equal to the specified one.
+ voidConstPoolEntry.read(java.io.DataInput in, + ConstPoolEntry entry) + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ConstPoolEntryError.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ConstPoolEntryError.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ConstPoolEntryError.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ConstPoolEntryError.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.nanovm.converter.ConstPoolEntryError + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.ConstPoolEntryError

+
+No usage of org.nanovm.converter.ConstPoolEntryError +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/Converter.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/Converter.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/Converter.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/Converter.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.nanovm.converter.Converter + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.Converter

+
+No usage of org.nanovm.converter.Converter +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/Debug.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/Debug.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/Debug.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/Debug.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.nanovm.converter.Debug + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.Debug

+
+No usage of org.nanovm.converter.Debug +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ExceptionInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ExceptionInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ExceptionInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/ExceptionInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,214 @@ + + + + + + + +Uses of Class org.nanovm.converter.ExceptionInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.ExceptionInfo

+
+ + + + + + + + + +
+Packages that use ExceptionInfo
org.nanovm.converter  
+  +

+ + + + + +
+Uses of ExceptionInfo in org.nanovm.converter
+  +

+ + + + + + + + + +
Methods in org.nanovm.converter that return ExceptionInfo
+ ExceptionInfo[]CodeInfo.getExceptionTable() + +
+           
+  +

+ + + + + + + + + +
Methods in org.nanovm.converter with parameters of type ExceptionInfo
+ voidCodeInfo.setExceptionTable(ExceptionInfo[] exceptionTable) + +
+           
+  +

+ + + + + + + + +
Constructors in org.nanovm.converter with parameters of type ExceptionInfo
CodeInfo(short maxStack, + short maxLocals, + byte[] bytecode, + ExceptionInfo[] exceptionTable) + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/FieldInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/FieldInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/FieldInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/FieldInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,226 @@ + + + + + + + +Uses of Class org.nanovm.converter.FieldInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.FieldInfo

+
+ + + + + + + + + +
+Packages that use FieldInfo
org.nanovm.converter  
+  +

+ + + + + +
+Uses of FieldInfo in org.nanovm.converter
+  +

+ + + + + + + + + + + + + + + + + + + + + +
Methods in org.nanovm.converter that return FieldInfo
+ FieldInfoClassInfo.getField(int index) + +
+           
+ FieldInfoClassInfo.getFieldInfo(java.lang.String name, + java.lang.String type) + +
+           
+static FieldInfoClassLoader.getFieldInfo(java.lang.String className, + java.lang.String name, + java.lang.String type) + +
+           
+static FieldInfoClassLoader.getFieldInfoExact(java.lang.String className, + java.lang.String name, + java.lang.String type) + +
+           
+  +

+ + + + + + + + + +
Methods in org.nanovm.converter with parameters of type FieldInfo
+ voidClassInfo.addField(FieldInfo fieldInfo) + +
+          Add a field to this class.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/Generator.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/Generator.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/Generator.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/Generator.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.nanovm.converter.Generator + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.Generator

+
+No usage of org.nanovm.converter.Generator +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/InnerClassInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/InnerClassInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/InnerClassInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/InnerClassInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,197 @@ + + + + + + + +Uses of Class org.nanovm.converter.InnerClassInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.InnerClassInfo

+
+ + + + + + + + + +
+Packages that use InnerClassInfo
org.nanovm.converter  
+  +

+ + + + + +
+Uses of InnerClassInfo in org.nanovm.converter
+  +

+ + + + + + + + + +
Methods in org.nanovm.converter that return InnerClassInfo
+ InnerClassInfo[]ClassInfo.getInnerClasses() + +
+          Get the inner class information of this class.
+  +

+ + + + + + + + + +
Methods in org.nanovm.converter with parameters of type InnerClassInfo
+ voidClassInfo.setInnerClasses(InnerClassInfo[] innerClasses) + +
+          Set the inner class information of this class.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/LineNumberInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/LineNumberInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/LineNumberInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/LineNumberInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,197 @@ + + + + + + + +Uses of Class org.nanovm.converter.LineNumberInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.LineNumberInfo

+
+ + + + + + + + + +
+Packages that use LineNumberInfo
org.nanovm.converter  
+  +

+ + + + + +
+Uses of LineNumberInfo in org.nanovm.converter
+  +

+ + + + + + + + + +
Methods in org.nanovm.converter that return LineNumberInfo
+ LineNumberInfo[]CodeInfo.getLineNumberTable() + +
+           
+  +

+ + + + + + + + + +
Methods in org.nanovm.converter with parameters of type LineNumberInfo
+ voidCodeInfo.setLineNumberTable(LineNumberInfo[] lineNumberTable) + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/LocalVariableInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/LocalVariableInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/LocalVariableInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/LocalVariableInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,181 @@ + + + + + + + +Uses of Class org.nanovm.converter.LocalVariableInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.LocalVariableInfo

+
+ + + + + + + + + +
+Packages that use LocalVariableInfo
org.nanovm.converter  
+  +

+ + + + + +
+Uses of LocalVariableInfo in org.nanovm.converter
+  +

+ + + + + + + + + +
Methods in org.nanovm.converter with parameters of type LocalVariableInfo
+ voidCodeInfo.setLocalVariableTable(LocalVariableInfo[] localVariableTable) + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/MethodIdTable.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/MethodIdTable.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/MethodIdTable.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/MethodIdTable.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.nanovm.converter.MethodIdTable + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.MethodIdTable

+
+No usage of org.nanovm.converter.MethodIdTable +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/MethodInfo.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/MethodInfo.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/MethodInfo.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/MethodInfo.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,213 @@ + + + + + + + +Uses of Class org.nanovm.converter.MethodInfo + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.MethodInfo

+
+ + + + + + + + + +
+Packages that use MethodInfo
org.nanovm.converter  
+  +

+ + + + + +
+Uses of MethodInfo in org.nanovm.converter
+  +

+ + + + + + + + + + + + + +
Methods in org.nanovm.converter that return MethodInfo
+ MethodInfoClassInfo.getMethod(int index) + +
+           
+static MethodInfoClassLoader.getMethod(int index) + +
+           
+  +

+ + + + + + + + + + + + + +
Methods in org.nanovm.converter with parameters of type MethodInfo
+ voidClassInfo.addMethod(MethodInfo methodInfo) + +
+           
+ intClassInfo.getMethodIndex(MethodInfo methodInfo) + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/NativeMapper.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/NativeMapper.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/NativeMapper.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/NativeMapper.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.nanovm.converter.NativeMapper + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.NativeMapper

+
+No usage of org.nanovm.converter.NativeMapper +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/UsedFeatures.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/UsedFeatures.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/UsedFeatures.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/class-use/UsedFeatures.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.nanovm.converter.UsedFeatures + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.converter.UsedFeatures

+
+No usage of org.nanovm.converter.UsedFeatures +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/package-frame.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/package-frame.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/package-frame.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/package-frame.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,97 @@ + + + + + + + +org.nanovm.converter + + + + + + + + + + + +org.nanovm.converter + + + + +
+Interfaces  + +
+AccessFlags
+ + + + + + +
+Classes  + +
+AttributeInfo +
+ClassFileReader +
+ClassInfo +
+ClassLoader +
+CodeInfo +
+CodeTranslator +
+CommonInfo +
+Config +
+ConstPool +
+ConstPoolEntry +
+Converter +
+Debug +
+ExceptionInfo +
+FieldInfo +
+Generator +
+InnerClassInfo +
+LineNumberInfo +
+LocalVariableInfo +
+MethodIdTable +
+MethodInfo +
+NativeMapper +
+UsedFeatures
+ + + + + + +
+Errors  + +
+ConstPoolEntryError
+ + + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/package-summary.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/package-summary.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/package-summary.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/package-summary.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,272 @@ + + + + + + + +org.nanovm.converter + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package org.nanovm.converter +

+ + + + + + + + + +
+Interface Summary
AccessFlagsBitfield constants for class/field/method access flags.
+  + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Class Summary
AttributeInfoA class for storing information about a class/field/method attribute.
ClassFileReaderThis class parses java class files and stores the information in a + ClassInfo object.
ClassInfoA class for storing information about a class.
ClassLoader 
CodeInfo 
CodeTranslator 
CommonInfoA common base class for ClassInfo, MethodInfo, and FieldInfo.
Config 
ConstPoolThis class encapsulates constant pool management.
ConstPoolEntry 
Converter 
DebugAll classfile debugging information gets piped through this class.
ExceptionInfoA class for storing information about the exception table of a method.
FieldInfoA class for storing information about fields.
Generator 
InnerClassInfoA class for storing information about inner classes.
LineNumberInfoA class for storing information about line numbers.
LocalVariableInfoA class for storing information about local variables.
MethodIdTable 
MethodInfo 
NativeMapper 
UsedFeatures 
+  + +

+ + + + + + + + + +
+Error Summary
ConstPoolEntryErrorAn instance of this class is thrown when a ConstPoolEntry is + used incorrectly.
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/package-tree.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/package-tree.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/package-tree.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/package-tree.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,168 @@ + + + + + + + +org.nanovm.converter Class Hierarchy + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package org.nanovm.converter +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +

+Interface Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/package-use.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/package-use.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/converter/package-use.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/converter/package-use.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,243 @@ + + + + + + + +Uses of Package org.nanovm.converter + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
org.nanovm.converter

+
+ + + + + + + + + +
+Packages that use org.nanovm.converter
org.nanovm.converter  
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Classes in org.nanovm.converter used by org.nanovm.converter
AccessFlags + +
+          Bitfield constants for class/field/method access flags.
AttributeInfo + +
+          A class for storing information about a class/field/method attribute.
ClassInfo + +
+          A class for storing information about a class.
CodeInfo + +
+           
CommonInfo + +
+          A common base class for ClassInfo, MethodInfo, and FieldInfo.
ConstPool + +
+          This class encapsulates constant pool management.
ConstPoolEntry + +
+           
ExceptionInfo + +
+          A class for storing information about the exception table of a method.
FieldInfo + +
+          A class for storing information about fields.
InnerClassInfo + +
+          A class for storing information about inner classes.
LineNumberInfo + +
+          A class for storing information about line numbers.
LocalVariableInfo + +
+          A class for storing information about local variables.
MethodInfo + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/gui/MainFrame.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/gui/MainFrame.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/gui/MainFrame.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/gui/MainFrame.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,432 @@ + + + + + + + +MainFrame + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +org.nanovm.gui +
+Class MainFrame

+
+java.lang.Object
+  extended by java.awt.Component
+      extended by java.awt.Container
+          extended by java.awt.Window
+              extended by java.awt.Frame
+                  extended by javax.swing.JFrame
+                      extended by org.nanovm.gui.MainFrame
+
+
+
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
+
+
+
+
public class MainFrame
extends javax.swing.JFrame
+ + +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + +
+Nested Class Summary
+ + + + + + + +
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
+  + + + + + + + + +
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
+  + + + + + + + + +
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
+  + + + + + + + + +
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
+  + + + + + + + + +
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
+  + + + + + + + +
+Field Summary
+ + + + + + + +
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
+ + + + + + + +
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
+ + + + + + + +
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
+ + + + + + + +
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
+ + + + + + + +
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
+  + + + + + + + + + + +
+Constructor Summary
MainFrame() + +
+          Creates new form MainFrame
+  + + + + + + + + + + + +
+Method Summary
+static voidmain(java.lang.String[] args) + +
+           
+ + + + + + + +
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
+ + + + + + + +
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
+ + + + + + + +
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
+ + + + + + + +
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
+ + + + + + + +
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+ + + + + + + +
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+MainFrame

+
+public MainFrame()
+
+
Creates new form MainFrame +

+

+ + + + + + + + +
+Method Detail
+ +

+main

+
+public static void main(java.lang.String[] args)
+
+
+
Parameters:
args - the command line arguments
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/gui/class-use/MainFrame.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/gui/class-use/MainFrame.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/gui/class-use/MainFrame.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/gui/class-use/MainFrame.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class org.nanovm.gui.MainFrame + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
org.nanovm.gui.MainFrame

+
+No usage of org.nanovm.gui.MainFrame +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/gui/package-frame.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/gui/package-frame.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/gui/package-frame.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/gui/package-frame.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,33 @@ + + + + + + + +org.nanovm.gui + + + + + + + + + + + +org.nanovm.gui + + + + +
+Classes  + +
+MainFrame
+ + + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/gui/package-summary.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/gui/package-summary.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/gui/package-summary.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/gui/package-summary.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,158 @@ + + + + + + + +org.nanovm.gui + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package org.nanovm.gui +

+ + + + + + + + + +
+Class Summary
MainFrame 
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/gui/package-tree.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/gui/package-tree.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/gui/package-tree.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/gui/package-tree.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,168 @@ + + + + + + + +org.nanovm.gui Class Hierarchy + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package org.nanovm.gui +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+
    +
  • java.lang.Object
      +
    • java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable) +
        +
      • java.awt.Container
          +
        • java.awt.Window (implements javax.accessibility.Accessible) +
            +
          • java.awt.Frame (implements java.awt.MenuContainer) +
              +
            • javax.swing.JFrame (implements javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants) + +
            +
          +
        +
      +
    +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/gui/package-use.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/gui/package-use.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/gui/package-use.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/gui/package-use.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,145 @@ + + + + + + + +Uses of Package org.nanovm.gui + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
org.nanovm.gui

+
+No usage of org.nanovm.gui +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/package-frame.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/package-frame.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/package-frame.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/package-frame.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,54 @@ + + + + + + + +org.nanovm + + + + + + + + + + + +org.nanovm + + + + +
+Classes  + +
+CodeWriter +
+NanoVMByteCode +
+NanoVMTool +
+Uploader +
+UVMWriter +
+Version
+ + + + + + +
+Exceptions  + +
+ConvertException
+ + + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/package-summary.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/package-summary.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/package-summary.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/package-summary.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,192 @@ + + + + + + + +org.nanovm + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package org.nanovm +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Class Summary
CodeWriter 
NanoVMByteCode 
NanoVMTool 
Uploader 
UVMWriter 
Version 
+  + +

+ + + + + + + + + +
+Exception Summary
ConvertException 
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/package-tree.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/package-tree.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/package-tree.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/package-tree.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,161 @@ + + + + + + + +org.nanovm Class Hierarchy + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package org.nanovm +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/org/nanovm/package-use.html epos--jvm/nanovmtool/dist/javadoc/org/nanovm/package-use.html --- epos--/nanovmtool/dist/javadoc/org/nanovm/package-use.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/org/nanovm/package-use.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,196 @@ + + + + + + + +Uses of Package org.nanovm + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
org.nanovm

+
+ + + + + + + + + + + + + +
+Packages that use org.nanovm
org.nanovm  
org.nanovm.converter  
+  +

+ + + + + + + + + + + +
+Classes in org.nanovm used by org.nanovm
ConvertException + +
+           
NanoVMByteCode + +
+           
+  +

+ + + + + + + + +
+Classes in org.nanovm used by org.nanovm.converter
NanoVMByteCode + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/overview-frame.html epos--jvm/nanovmtool/dist/javadoc/overview-frame.html --- epos--/nanovmtool/dist/javadoc/overview-frame.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/overview-frame.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,47 @@ + + + + + + + +Overview List + + + + + + + + + + + + + + + +
+
+ + + + + +
All Classes +

+ +Packages +
+org.nanovm +
+org.nanovm.converter +
+org.nanovm.gui +
+

+ +

+  + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/overview-summary.html epos--jvm/nanovmtool/dist/javadoc/overview-summary.html --- epos--/nanovmtool/dist/javadoc/overview-summary.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/overview-summary.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,160 @@ + + + + + + + +Overview + + + + + + + + + + + + +


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + +
+Packages
org.nanovm 
org.nanovm.converter 
org.nanovm.gui 
+ +


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/overview-tree.html epos--jvm/nanovmtool/dist/javadoc/overview-tree.html --- epos--/nanovmtool/dist/javadoc/overview-tree.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/overview-tree.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,185 @@ + + + + + + + +Class Hierarchy + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For All Packages

+
+
+
Package Hierarchies:
org.nanovm, org.nanovm.converter, org.nanovm.gui
+
+

+Class Hierarchy +

+ +

+Interface Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/package-list epos--jvm/nanovmtool/dist/javadoc/package-list --- epos--/nanovmtool/dist/javadoc/package-list 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/package-list 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,3 @@ +org.nanovm +org.nanovm.converter +org.nanovm.gui diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/serialized-form.html epos--jvm/nanovmtool/dist/javadoc/serialized-form.html --- epos--/nanovmtool/dist/javadoc/serialized-form.html 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/serialized-form.html 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,335 @@ + + + + + + + +Serialized Form + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Serialized Form

+
+
+ + + + + +
+Package org.nanovm
+ +

+ + + + + +
+Class org.nanovm.ConvertException extends java.io.IOException implements Serializable
+ +

+


+ + + + + +
+Package org.nanovm.converter
+ +

+ + + + + +
+Class org.nanovm.converter.ConstPoolEntryError extends java.lang.Error implements Serializable
+ +

+


+ + + + + +
+Package org.nanovm.gui
+ +

+ + + + + +
+Class org.nanovm.gui.MainFrame extends javax.swing.JFrame implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+code

+
+NanoVMByteCode code
+
+
+
+
+
+

+jButtonLoadClass

+
+javax.swing.JButton jButtonLoadClass
+
+
+
+
+
+

+jButtonUpload

+
+javax.swing.JButton jButtonUpload
+
+
+
+
+
+

+jButtonWriteFile

+
+javax.swing.JButton jButtonWriteFile
+
+
+
+
+
+

+jLabel1

+
+javax.swing.JLabel jLabel1
+
+
+
+
+
+

+jLabel2

+
+javax.swing.JLabel jLabel2
+
+
+
+
+
+

+jLabel3

+
+javax.swing.JLabel jLabel3
+
+
+
+
+
+

+jProgressBar1

+
+javax.swing.JProgressBar jProgressBar1
+
+
+
+
+
+

+jScrollPane1

+
+javax.swing.JScrollPane jScrollPane1
+
+
+
+
+
+

+jTextArea1

+
+javax.swing.JTextArea jTextArea1
+
+
+
+
+
+

+jTextFieldClass

+
+javax.swing.JTextField jTextFieldClass
+
+
+
+
+
+

+jTextFieldClassPath

+
+javax.swing.JTextField jTextFieldClassPath
+
+
+
+
+
+

+jTextFieldConfig

+
+javax.swing.JTextField jTextFieldConfig
+
+
+
+
+
+

+jToolBar1

+
+javax.swing.JToolBar jToolBar1
+
+
+
+
+ +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/dist/javadoc/stylesheet.css epos--jvm/nanovmtool/dist/javadoc/stylesheet.css --- epos--/nanovmtool/dist/javadoc/stylesheet.css 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/dist/javadoc/stylesheet.css 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,29 @@ +/* Javadoc style sheet */ + +/* Define colors, fonts and other style attributes here to override the defaults */ + +/* Page background color */ +body { background-color: #FFFFFF; color:#000000 } + +/* Headings */ +h1 { font-size: 145% } + +/* Table colors */ +.TableHeadingColor { background: #CCCCFF; color:#000000 } /* Dark mauve */ +.TableSubHeadingColor { background: #EEEEFF; color:#000000 } /* Light mauve */ +.TableRowColor { background: #FFFFFF; color:#000000 } /* White */ + +/* Font used in left-hand frame lists */ +.FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 } +.FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } +.FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } + +/* Navigation bar fonts and colors */ +.NavBarCell1 { background-color:#EEEEFF; color:#000000} /* Light mauve */ +.NavBarCell1Rev { background-color:#00008B; color:#FFFFFF} /* Dark Blue */ +.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;} +.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;} + +.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} +.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} + diff -U 3 -H -d -r -N -- epos--/nanovmtool/manifest.mf epos--jvm/nanovmtool/manifest.mf --- epos--/nanovmtool/manifest.mf 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/manifest.mf 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff -U 3 -H -d -r -N -- epos--/nanovmtool/nbproject/.cvsignore epos--jvm/nanovmtool/nbproject/.cvsignore --- epos--/nanovmtool/nbproject/.cvsignore 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/nbproject/.cvsignore 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1 @@ +private diff -U 3 -H -d -r -N -- epos--/nanovmtool/nbproject/build-impl.xml epos--jvm/nanovmtool/nbproject/build-impl.xml --- epos--/nanovmtool/nbproject/build-impl.xml 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/nbproject/build-impl.xml 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,616 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + + + + + + java -cp "${run.classpath.with.dist.jar}" ${main.class} + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/nbproject/genfiles.properties epos--jvm/nanovmtool/nbproject/genfiles.properties --- epos--/nanovmtool/nbproject/genfiles.properties 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/nbproject/genfiles.properties 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,8 @@ +build.xml.data.CRC32=716194c6 +build.xml.script.CRC32=4a08cd9d +build.xml.stylesheet.CRC32=be360661 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=716194c6 +nbproject/build-impl.xml.script.CRC32=9a612c7a +nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08 diff -U 3 -H -d -r -N -- epos--/nanovmtool/nbproject/project.properties epos--jvm/nanovmtool/nbproject/project.properties --- epos--/nanovmtool/nbproject/project.properties 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/nbproject/project.properties 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,74 @@ +application.title=JavaProject1 +application.vendor=nils +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80 +auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=default +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/NanoVMTool.jar +dist.javadoc.dir=${dist.dir}/javadoc +excludes= +file.reference.RXTXcomm.jar=lib/RXTXcomm.jar +file.reference.tool-src=src +includes=** +jar.compress=false +javac.classpath=\ + ${file.reference.RXTXcomm.jar} +# Space-separated list of extra javac options +javac.compilerargs=-Xlint:unchecked +javac.deprecation=true +javac.source=1.5 +javac.target=1.5 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir}:\ + ${libs.junit.classpath}:\ + ${libs.junit_4.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +jnlp.codebase.type=local +jnlp.codebase.url=file:/D:/Sandbox/sourceforge/nanovm/nanovm/tool/dist/ +jnlp.descriptor=application +jnlp.enabled=false +jnlp.offline-allowed=false +jnlp.signed=false +main.class=org.nanovm.gui.MainFrame +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value +# or test-sys-prop.name=value to set system properties for unit tests): +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=${file.reference.tool-src} diff -U 3 -H -d -r -N -- epos--/nanovmtool/nbproject/project.xml epos--jvm/nanovmtool/nbproject/project.xml --- epos--/nanovmtool/nbproject/project.xml 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/nbproject/project.xml 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,14 @@ + + + org.netbeans.modules.java.j2seproject + + + NanoVMTool + 1.6.5 + + + + + + + diff -U 3 -H -d -r -N -- epos--/nanovmtool/readme.txt epos--jvm/nanovmtool/readme.txt --- epos--/nanovmtool/readme.txt 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/readme.txt 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,106 @@ +NanoVMTool.jar - Classfile converter and Uploader for NanoVM +http://www.harbaum.org/till/nanovm +---------------------------------------------------------------------------- + +The NanoVMTool is a helper tool for the NanoVM. It is required to +convert class files into the internal NanoVM format and to upload them +to the target device. This has several advantages: + +- The total file size is reduced +- All depending class files are combined into one big file +- Code optimizations can take place + +License +------- + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +USA + +Parts of this tool are based on public domain code written by +Kimberley Burchett. See http://www.kimbly.com/code/classfile/ for for +infos. I have heavily hacked around her code, so don't blame her if +you think my code is ugly. + +The NanoVM +---------- + +In order to use the converter the NanoVM has to be installed on the +target system. See http://www.harbaum.org/till/nanovm for a copy of +the NanoVM itself. The NanoVM is correctly installed and working +properly if the built-in demo-application runs correctly. The Asuro +demo application e.g. prints some output via the IR serial interface +and then cycles through a simple LED test application. + +Javax.comm/RXTX/gnu.io +---------------------- + +The NanoVMTool has been written in Java, therefore it runs e.g. under +Linux and Windows. To allow the converter to upload files directly to +the target like e.g. the Asuro, the Java running on the PC needs to +get support to access the PCs serial ports. + +In early versiosn of the nanovm this was done by installing the +javax.comm package. The usage of this package is deprecated, since +there isn't any Windows support anymore, there has never been MacOS +support and usable Linux support has only been added recently. + +Instead the rxtx/gnu.io is being used (see http://www.rxtx.org/ for +details). The NanoVM provides a script in nanovm/doc/install_rxtx.sh +to support the installation of rxtx under Linux. Further instructions +can be found at http://www.jcontrol.org/download/readme_rxtx_en.html. + +Without rxtx/gnu.io NanoVMTool will be unable to upload the file to +the target system. + +Running NanoVMTool +------------------ + +NanoVMTool has been tested under Linux, Windows and MacOS. The basic +syntax to call NanoVMTool is: + +java -jar NanoVMTool.jar CONFIG CLASSPATH CLASS + +CONFIG is a file containing a target description. It includes +information about the supported native classes and the hardware of the +target system incl. the interface used for upload. There are two files +for the Asuro: Asuro.config and AsuroWin.config, both differ in the +name of the serial device used on the PC (COM1 vs. /dev/ttyS0). + +CLASSPATH is the path to the NanoVM classes to be installed. + +CLASS is the name of the class to be installed (e.g. AsuroLED). + +Running NanoVMTool under Linux +------------------------------ + +The LED demo is being converted and uploaded under Linux using +e.g. the command: + +java -jar NanoVMTool.jar Asuro.config ../examples AsuroLED + +Running NanoVMTool under Windows +-------------------------------- + +The archive contains a simple batch file (asuro_upload.bat). You'll +manually have to adjust the both paths in this file and can then +easily convert files just by typing: + +convert AsuroLED + +Example files +------------- + +Example java files for use with the Asuro can be found at +http://www.harbaum.org/till/nanovm diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/.cvsignore epos--jvm/nanovmtool/src/.cvsignore --- epos--/nanovmtool/src/.cvsignore 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/.cvsignore 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1 @@ +*.class *~ diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/CodeWriter.java epos--jvm/nanovmtool/src/org/nanovm/CodeWriter.java --- epos--/nanovmtool/src/org/nanovm/CodeWriter.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/CodeWriter.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,75 @@ +package org.nanovm; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +// +// UVMWriter.java +// +import org.nanovm.converter.ClassLoader; +import java.io.*; + +public class CodeWriter { + + static public void write(String fileName, NanoVMByteCode code) { + System.out.println("Generating unified class file ..."); + + // overwrite target config when -c option was given + System.out.println("Writing C header file"); + + // write header file to disk + try { + System.out.println("Writing to file " + fileName); + File outputFile = new File(fileName); + FileOutputStream out = new FileOutputStream(outputFile); + + out.write(("/* " + fileName + ", autogenerated from " + + ClassLoader.getClassInfo(0).getName() + + " class */\n").getBytes()); + + out.write("{\n".getBytes()); + + int size = code.getSize(); + + for (int i = 0; i < size; i++) { + String str = "0" + Integer.toHexString(0xff & code.getByte(i)); + out.write(("0x" + str.substring(str.length() - 2)).getBytes()); + + if (i < size - 1) { + out.write(",".getBytes()); + } + if (i % 16 == 15) { + out.write("\n".getBytes()); + } else { + out.write(" ".getBytes()); + } + } + + out.write("\n};\n".getBytes()); + out.close(); + } catch (IOException e) { + System.out.println("Error writing header file: " + e.toString()); + System.exit(-1); + } + + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/ConvertException.java epos--jvm/nanovmtool/src/org/nanovm/ConvertException.java --- epos--/nanovmtool/src/org/nanovm/ConvertException.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/ConvertException.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,31 @@ +package org.nanovm; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +import java.io.*; + +public class ConvertException extends IOException { + public ConvertException(String msg) { + super(msg); + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/NVMComm2.java epos--jvm/nanovmtool/src/org/nanovm/NVMComm2.java --- epos--/nanovmtool/src/org/nanovm/NVMComm2.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/NVMComm2.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,432 @@ +package org.nanovm; + +// +// NVMComm2, the NanoVM Communication Protocol +// Copyright (C) 2006 by Till Harbaum , +// Oliver Schulz +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +import java.io.*; +import java.util.*; + + +class NVMComm2 { + // ASCII codes used during transmission + public static final int ASCII_DLE = 0x10; + public static final int ASCII_SYN = 0x16; + + protected static final int NVC2_TIMEOUT_CHARS = 20; //!!8; // Input timout in units of byte transmission time + protected static final int NVC2_MIN_RESPONSE_SIZE = 5; // Minimum size of a message (without start byte) + protected static final int NVC2_MAX_MSG_LEN = 0x7F; // Maximum message length + + protected static final int MAX_DATA_LEN = 16; // Maximum data length to use in message + + protected InputStream m_inputStream; + protected OutputStream m_outputStream; + protected int m_ioSpeed; + protected int m_recvInputTimeout; + protected int m_lastMsgID; + + public static final short CMD_NONE = 0xFF; + public static final short CMD_FOPEN = 0x70; + public static final short CMD_FCLOSE = 0x71; + public static final short CMD_RWFILE = 0x72; + public static final short CMD_RUNLVL = 0x7E; + + public static final byte RUNLVL_HALT = 0x00; + public static final byte RUNLVL_CONF = 0x01; + public static final byte RUNLVL_VM = 0x03; + public static final byte RUNLVL_RESET = 0x06; + public static final byte RUNLVL_BOOT = 0x07; + + + // CCITT CRC-16, msb-first, int version + // 0 <= data <= 0xFF, 0 <= crc <= 0xFFFF + public static int crc16ccittUpdateMsbf(int data, int crc) { + crc = ((crc >> 8) & 0xFF) | ((crc << 8) & 0xFFFF); + crc ^= data; + crc ^= (crc & 0xFF) >> 4; + crc ^= ((crc << 8) << 4) & 0xFFFF; + crc ^= ((crc & 0xFF) << 4) << 1; + return crc; + } + + // CCITT CRC-16, msb-first, byte/short version + public static short crc16ccittUpdateMsbf(byte data, short crc) { + return (short)crc16ccittUpdateMsbf(0xFF & (int)data, 0xFFFF & (int)crc); + } + + // CCITT CRC-16, lsb-first, int version + // 0 <= data <= 0xFF, 0 <= crc <= 0xFFFF + public static int crc16ccittUpdateLsbf(int data, int crc) { + data ^= (crc & 0xFF); + data ^= (data << 4) & 0xFF; + + crc = ((data << 8) & 0xFFFF) | (crc >> 8); + crc ^= (data >> 4); + crc ^= (data << 3) & 0xFFFF; + + return crc; + } + + // CCITT CRC-16, lsb-first, byte/short version + public static short crc16ccittUpdateLsbf(byte data, short crc) { + return (short)crc16ccittUpdateLsbf(0xFF & (int)data, 0xFFFF & (int)crc); + } + + + protected void put(int i) { + byte[] ioArray = new byte[1]; + + i &= 0xff; + ioArray[0] = (byte)i; + + try { + m_outputStream.write(ioArray); + } catch (Exception e) { + System.out.println("Writing Error"); + System.out.println(e.toString()); + System.exit(-1); + } + } + + + public static class QueryMessage { + protected short m_address; + protected boolean m_read; + protected short m_command; + protected byte[] m_data; + + public short getAddress() { return m_address; } // slave address, must be 0x01 for now + public boolean isRead() { return m_read; } // read or write + public short getCommand() { return m_command; } // 0x00 if empty mesage, 0x00 <= command <= 0xFF + public byte[] getData() { return m_data; } // data (only when write query) + + public QueryMessage(short address, boolean read, short command, + byte[] data) + { + m_address = address; m_read = read; + m_command = command; m_data = data; + } + } + + + public static class ResponseMessage { + public boolean m_error; + protected byte[] m_data; + + public boolean isError() { return m_error; } // error Response / normal Resonse + public byte[] getData() { return m_data; } // response data or error info + + public ResponseMessage(boolean isError, byte[] data) { + m_error = isError; m_data = data; + } + } + + + + + protected static class CommBuffer { + protected byte[] m_data; + protected int m_fill; + + int size() { return m_data.length; } + + int fill() { return m_fill; } + + int space() { return size() - fill(); } + + byte getData(int i) { return m_data[i]; } + + void pushBack(byte b) { if (space() > 0) m_data[m_fill++] = b; } + + void popFront(int count) { + if (count >= m_fill) m_fill = 0; + else { + for (int i=0; i < m_fill - count; ++i) m_data[i] = m_data[i+count]; + m_fill -= count; + } + } + + public CommBuffer(int maxSize) { + m_data = new byte[maxSize]; + m_fill = 0; + } + } + + + public ResponseMessage receiveResponse(int messageId, CommBuffer buffer) { + final int NVC2_RECV_DROP = 0; + final int NVC2_RECV_SEARCH = 1; + final int NVC2_RECV_SYNCED = 2; + final int NVC2_RECV_DATA = 3; + + int status = NVC2_RECV_SEARCH; + int neededInput = 0; + boolean commTimeout = false; + + boolean errorMsg = false; + + int msgLen = 0; + int recvId = 0; + + // Minimum buffer size + if ( buffer.space() < NVC2_MIN_RESPONSE_SIZE ) return null; + + // Don't give up while input available or while buffer might contain + // a complete message. + while ( (! commTimeout) || (buffer.fill() >= NVC2_MIN_RESPONSE_SIZE) ) { + // if not enough buffer space, drop currently tracked message + if (buffer.space() < neededInput) status = NVC2_RECV_DROP; + + if (status == NVC2_RECV_DROP) { + // drop currently tracked message + neededInput = buffer.fill() < 1 ? 1 : 0; + status = NVC2_RECV_SEARCH; + } + + // try to read necessary input from input stream + while ( (neededInput > 0) && !commTimeout) { + // wait for input within timeout limits + boolean inputAvailable = false; + try { + for (int i=0; (m_inputStream.available() == 0) && (i < m_recvInputTimeout); ++i) + Thread.currentThread().sleep(2); // sleep 2 ms} + inputAvailable = (m_inputStream.available() > 0); + } catch(Exception e) {} + + if (inputAvailable) { + // input available + byte[] data = new byte[1]; + try { + m_inputStream.read(data); + } catch (Exception e) { + System.out.println("Reading Error"); + System.out.println(e.toString()); + System.exit(-1); + } +// System.out.print(" " + Integer.toHexString(0xFF & (int)data[0]) ); //!! DEBUG + buffer.pushBack(data[0]); + + if (neededInput > 0) --neededInput; + } else { + // timeout + commTimeout = true; + } + } + + // if not enough data after reading, drop currently tracked message + if (neededInput > 0) status = NVC2_RECV_DROP; + + if (status == NVC2_RECV_SEARCH) { + // need at least 1 byte of input + neededInput = (buffer.fill() < 1) ? 1 : 0; + if (neededInput == 0) { + + // search buffer for slave-message start-symbol + for (int i=0; i < buffer.fill(); ++i) { + byte value = buffer.getData(0); + buffer.popFront(1); + + if ((0xFF & (int)value) == ASCII_SYN) + { status = NVC2_RECV_SYNCED; break; } + } + } + } + + if (status==NVC2_RECV_SYNCED) { + // need first 4 bytes of input + neededInput = (buffer.fill() < 4) ? + 4 - buffer.fill() : 0; + if (neededInput == 0) { + int msgLenR; + + // analyse message header + + msgLen = (0xFF) & (int) buffer.getData(0); + int MsgLen2 = 0xFF & (int) buffer.getData(1); + int MsgLen2inv = 0xFF ^ MsgLen2; + + if (msgLen != MsgLen2inv) + msgLenR = MsgLen2; + else { + // LEi instead of LEr, signifies error message + errorMsg = true; + msgLenR = MsgLen2inv; + } + + recvId = 0xFF & (int) buffer.getData(2); + boolean slaveFlag = (recvId & 0x01) > 0; + recvId = (recvId >> 1) & 0x07; + + if ((msgLen != msgLenR) || !slaveFlag) { + status = NVC2_RECV_DROP; + } else { + status = NVC2_RECV_DATA; + } + } + } + + if (status==NVC2_RECV_DATA) { + // need complete message + neededInput = (buffer.fill() < msgLen+2) ? + msgLen+2 - buffer.fill() : 0; + if (neededInput == 0) { + // calculate CRC (FCS-16) + short crc = (short) 0xFFFF; + for (int i=0; i 3) { + data = new byte[msgLen - 3]; + for (int i=0; i= NVC2_MAX_MSG_LEN - 5) return; // Can't fit data in response + + boolean sendContent = query.getCommand() != CMD_NONE; + int msgLen = query.getCommand() == CMD_NONE ? 4 : dsize + 5; + + // send DLE + put(ASCII_DLE); + + // compose message + byte[] msg = new byte[msgLen+2]; + msg[0] = (byte)msgLen; + msg[1] = (byte)msgLen; + msg[2] = (byte)( (0x07 & messageId) << 1 ); + msg[3] = (byte)( ((0xFF & (int)query.getAddress()) << 1) | (query.isRead() ? 1 : 0) ); + + if (sendContent) { + msg[4] = (byte) query.getCommand(); + for (int i=0; i> 0) ); + msg[msgLen+1] = (byte)( 0xFF & (crc >> 8) ); + +// System.out.print("DEBUG: Sending query: "); +// System.out.print(" " + Integer.toHexString(0xFF & (int)ASCII_DLE)); +// for (int i=0; i0)) { +// System.out.println("DEBUG: Received error response with error code."); + return response; + } else { +// System.out.println("DEBUG: Received transmission error."); + } + } + } else { +// System.out.println("DEBUG: Received no valid response."); + // timeout, do nothing + } + } + +// System.out.println("DEBUG: Communication timeout."); + + return null; + } + + + public ResponseMessage executeQuery(short address, boolean read, + short command, byte data, int maxTries) + { + byte[] dataArray = {data}; + return executeQuery(address, read, command, dataArray, maxTries); + } + + + public NVMComm2(InputStream inputStream, OutputStream outputStream, int ioSpeed) { + m_inputStream = inputStream; + m_outputStream = outputStream; + m_ioSpeed = ioSpeed; + m_recvInputTimeout = NVC2_TIMEOUT_CHARS*(10000/ioSpeed) + 1; + m_lastMsgID = 0; + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/NanoVMByteCode.java epos--jvm/nanovmtool/src/org/nanovm/NanoVMByteCode.java --- epos--/nanovmtool/src/org/nanovm/NanoVMByteCode.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/NanoVMByteCode.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,53 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.nanovm; + +/** + * + * @author nils + */ +public class NanoVMByteCode { + + int cur; + int maxsize; + byte[] data; + + public NanoVMByteCode(int maxsize) { + this.maxsize = maxsize; + data = new byte[maxsize]; + } + + public int getSize() { + return cur; + } + + public byte getByte(int pos) { + return data[pos]; + } + + + // write a 8 bit value into buffer and make sure buffer + // end is not overwritten + public void write8(int val) throws ConvertException { + if (cur >= maxsize) { + throw new ConvertException("Converted data too big"); + } + data[cur++] = (byte) val; + } + + // write a 16 bit value little endian into buffer + public void write16(int val) throws ConvertException { + write8(val & 0xff); + write8((val >> 8) & 0xff); + } + + // write a 32 bit value little endian into buffer + public void write32(int val) throws ConvertException { + write8(val & 0xff); + write8((val >> 8) & 0xff); + write8((val >> 16) & 0xff); + write8((val >> 24) & 0xff); + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/NanoVMTool.java epos--jvm/nanovmtool/src/org/nanovm/NanoVMTool.java --- epos--/nanovmtool/src/org/nanovm/NanoVMTool.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/NanoVMTool.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,103 @@ +package org.nanovm; + +import org.nanovm.converter.Config; +import org.nanovm.UVMWriter; +import org.nanovm.converter.ClassLoader; +import org.nanovm.converter.Converter; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// +public class NanoVMTool { + + public static void usage() { + System.out.println("Usage: NanoVMTool [options] config classpath class"); + System.out.println("Options:"); + System.out.println(" -c write c header file"); + System.out.println(" -f name force output file name"); + } + + public static void main(String[] args) { + int curArg = 0; + boolean writeHeader = false; + String outputFileName = null; + + System.out.println("NanoVMTool " + Version.version + + " - (c) 2005-2007 by Till Harbaum"); + + // parse options + while ((args.length > curArg) && (args[curArg].charAt(0) == '-')) { + switch (args[curArg].charAt(1)) { + case 'c': + writeHeader = true; + break; + + case 'f': + outputFileName = args[++curArg]; + break; + + default: + System.out.println("Unknown option " + args[curArg]); + usage(); + return; + } + + // interpret next option + curArg++; + } + + if ((args.length - curArg) != 3) { + usage(); + return; + } + + String configFile = args[curArg]; + String classPath = args[curArg + 1]; + String className = args[curArg + 2]; + + if (writeHeader) { + if (outputFileName==null) { + outputFileName=className+".h"; + } + NanoVMByteCode code = Converter.convert(configFile, classPath, className); + CodeWriter.write(outputFileName, code); + + } else { + + // load config + Config.load(configFile); + + // overwrite filename if given on command line + if (outputFileName != null) { + Config.overwriteFileName(outputFileName); + } + + ClassLoader.setClassPath(classPath); + ClassLoader.load(className); + + System.out.println("Successfully loaded " + + ClassLoader.totalClasses() + " classes"); + + // for first tries: write converted file to disk + UVMWriter writer = new UVMWriter(writeHeader); + } + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/NanoVMTool.mf epos--jvm/nanovmtool/src/org/nanovm/NanoVMTool.mf --- epos--/nanovmtool/src/org/nanovm/NanoVMTool.mf 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/NanoVMTool.mf 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: NanoVMTool + diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/UVMWriter.java epos--jvm/nanovmtool/src/org/nanovm/UVMWriter.java --- epos--/nanovmtool/src/org/nanovm/UVMWriter.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/UVMWriter.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,296 @@ +package org.nanovm; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +// +// UVMWriter.java +// + +import org.nanovm.converter.Config; +import org.nanovm.converter.UsedFeatures; +import org.nanovm.converter.MethodInfo; +import org.nanovm.converter.MethodIdTable; +import org.nanovm.converter.CodeTranslator; +import org.nanovm.converter.ClassLoader; +import org.nanovm.converter.ClassInfo; +import java.io.*; +import java.util.*; + +public class UVMWriter { + static final int MAGIC = 0xBE000000; + static final int VERSION = 2; + + byte[] outputBuffer; + int cur; + + // write a 8 bit value into buffer and make sure buffer + // end is not overwritten + void write8(int val) throws ConvertException { + if(cur >= Config.getMaxSize()) + throw new ConvertException("Converted data too big"); + + outputBuffer[cur++] = (byte)val; + } + + // write a 16 bit value little endian into buffer + void write16(int val) throws ConvertException { + write8(val&0xff); + write8((val>>8)&0xff); + } + + // write a 32 bit value little endian into buffer + void write32(int val) throws ConvertException { + write8(val&0xff); + write8((val>>8)&0xff); + write8((val>>16)&0xff); + write8((val>>24)&0xff); + } + + void updateHeader() throws ConvertException { + int old_cur=cur; + cur = 0; + writeHeader(); + cur = old_cur; + } + + // write uvm file header + void writeHeader() throws ConvertException { + int offset = 15; // header size: 15 bytes + + write32(MAGIC|UsedFeatures.get()); + write8(VERSION); + write8(ClassLoader.totalMethods()); + write16(ClassLoader.getMainIndex()); + + // offset to constant data + offset += 2 * ClassLoader.totalClasses(); // class header size: 2bytes + write16(offset); + + // offset to string data + offset += 4 * ClassLoader.totalConstantEntries(); // constant value size: 4bytes + write16(offset); + + // offset to method data + offset += 2 * ClassLoader.totalStrings(); // string indices + offset += ClassLoader.totalStringSize(); // string data + write16(offset); + write8(ClassLoader.totalStaticFields()); // static fields + } + + // write all class headers + void writeClassHeaders() throws ConvertException { + for(int i=0;i")?1:0); // flags + write8(methodInfo.getArgs()); // args + write8(methodInfo.getCodeInfo().getMaxLocals()); // max_locals + write8(methodInfo.getCodeInfo().getMaxStack()); // max_stack + + codeOffset += methodInfo.getCodeInfo().getBytecode().length; + } + + // write bytecode + for(int i=0;i +// Oliver Schulz +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +import org.nanovm.converter.Config; +import java.io.*; +import java.util.*; +import gnu.io.*; // needs to be added to vm + +public class Uploader { + + // ASCII codes used during transmission + final static int ASCII_SOH = 0x01; + final static int ASCII_STX = 0x02; + final static int ASCII_EOT = 0x04; + final static int ASCII_ACK = 0x06; + final static int ASCII_DLE = 0x10; + final static int ASCII_XON = 0x11; + final static int ASCII_XOFF = 0x13; + final static int ASCII_NAK = 0x15; + final static int ASCII_SYN = 0x16; + final static int ASCII_CAN = 0x18; + final static int ASCII_EOF = 0x1A; + + final static int BLOCK_SIZE = 16; + + // Asure needs specific handling + static boolean asuro_echo_suppression = false; + + static Enumeration portList; + static CommPortIdentifier portId; + static SerialPort serialPort; + static OutputStream outputStream; + static InputStream inputStream; + static boolean outputBufferEmptyFlag = false; + + public static void setUploader(String type){ + // ignore for now... + } + + static int get(boolean timeout) { + final int TIMEOUT = 50; + byte[] inputArray = new byte[1]; + + if(timeout) { + int cnt=0; + try { + while((inputStream.available() == 0) && (cnt BLOCK_SIZE) j = BLOCK_SIZE; + + block++; + if(j > 0) + System.out.print("Sending block " + block + " with " + + j + " bytes ... "); + } else + System.out.print("Resending block " + block + " ... "); + + if(j > 0) { + + // send header + put(ASCII_SOH); + put(block); + put(~block); + + // send data and calculate sum + for(n=0,sum=0;n=0) + System.out.println("received " + i); + } + + // if we received an ack -> good!! + if(i == ASCII_ACK) { + System.out.println("ok"); + if(j == BLOCK_SIZE) done = false; + else done = true; + } else { + System.out.println("error"); + done = false; + } + } else + done = true; // no more bytes to send + } while(!done); + + // transmission ended, send eof and expect ack + put(ASCII_EOF); + while(((i=get(true)) != ASCII_NAK)&&(i != ASCII_ACK)); + + if(i == ASCII_ACK) { + if(asuro_echo_suppression) + System.out.println("Download successful, " + + "please restart your Asuro"); + else + System.out.println("Download successful, " + + "program started!"); + } else + System.out.println("Error: nak after eof"); + + +// ==================================================================== +} // NVMCOMM1 + +else if (target == Config.TARGET_NVC2_AUTO) +{ +// == NVMCOMM2 ======================================================== + + final int maxSearchTries = 10000; + + short slaveAddr = 0x10; // default slave address; + + System.out.println("Using NanoVM Communication Protocol v2.0"); + +// System.out.println("DEBUG: speed = "+speed); + + NVMComm2 nvc = new NVMComm2(inputStream, outputStream, speed); + + boolean slaveFound = false; + + System.out.print("Info: Looking for target system"); + for (int tryctr=0; tryctr +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// +/** +* Bitfield constants for class/field/method access flags. +*/ +public interface AccessFlags { + public static final short PUBLIC = 0x0001; + public static final short PRIVATE = 0x0002; + public static final short PROTECTED = 0x0004; + public static final short STATIC = 0x0008; + public static final short FINAL = 0x0010; + public static final short SYNCHRONIZED = 0x0020; + public static final short VOLATILE = 0x0040; + public static final short TRANSIENT = 0x0080; + public static final short NATIVE = 0x0100; + public static final short INTERFACE = 0x0200; + public static final short ABSTRACT = 0x0400; +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/AttributeInfo.java epos--jvm/nanovmtool/src/org/nanovm/converter/AttributeInfo.java --- epos--/nanovmtool/src/org/nanovm/converter/AttributeInfo.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/AttributeInfo.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,30 @@ +package org.nanovm.converter; + +/** +* A class for storing information about a class/field/method attribute. +* This class is usually only used for non-standard attributes. Standard +* attributes such as SourceFile, Code, LineNumberTable, LocalVariableTable, +* Exceptions, and ConstantValue are handled with specialized methods in +* the appropriate Info class. +* +* @see ClassInfo +* @see FieldInfo +* @see MethodInfo +*/ +public class AttributeInfo { + public String name; + public byte[] data; + + public AttributeInfo(String name, byte[] data) { + this.name = name; + this.data = data; + } + + public String getName() { + return name; + } + + public byte[] getData() { + return data; + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/ClassFileReader.java epos--jvm/nanovmtool/src/org/nanovm/converter/ClassFileReader.java --- epos--/nanovmtool/src/org/nanovm/converter/ClassFileReader.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/ClassFileReader.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,513 @@ +package org.nanovm.converter; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +import org.nanovm.converter.ClassInfo; +import java.io.*; + +/** + * This class parses java class files and stores the information in a + * ClassInfo object. + * + * @see ClassInfo + */ +public class ClassFileReader implements AccessFlags { + + public void read(InputStream in, ClassInfo classInfo) + throws IOException { + strClass(new DataInputStream(new BufferedInputStream(in)), classInfo); + } + + private void strClass(DataInput in, ClassInfo classInfo) + throws IOException { + short count; + + // Magic And Version Numbers + int magic = in.readInt(); + if (magic != 0xCAFEBABE) + throw new IOException("Invalid classfile magic number" + + ": expected 0xCAFEBABE, found 0x" + Integer.toHexString(magic)); + + short major = in.readShort(), minor = in.readShort(); + System.out.println("Classfile version " + major + "." + minor); + + // Constant Pool + ConstPool cp = new ConstPool(); + cp.read(in); + classInfo.setConstPool(cp); + + // General Class Info + short flags = in.readShort(); + short classIndex = in.readShort(); + short superClassIndex = in.readShort(); + int classNameIndex = cp.getEntryAtIndex(classIndex).getClassNameIndex(); + int superClassNameIndex = cp.getEntryAtIndex(superClassIndex).getClassNameIndex(); + String className = cp.getEntryAtIndex(classNameIndex).getString(); + String superClassName = cp.getEntryAtIndex(superClassNameIndex).getString(); + + if (Debug.strClass != null) + Debug.println(Debug.strClass, + "flags=" + flags + + "; class index=" + classIndex + + "; super class index=" + superClassIndex); + + // save necessary class information + classInfo.setAccessFlags(flags); + classInfo.setName(className); + classInfo.setSuperClassName(superClassName); + + // Interfaces + count = in.readShort(); + if(Debug.strClass != null) + Debug.println(Debug.strClass, + "#interfaces=" + count); + Debug.indent(); + for (int i = 0; i < count; i++) + classInfo.addInterface(strInterface(cp, in)); + Debug.outdent(); + + // Fields + count = in.readShort(); + if (Debug.strClass != null) Debug.println(Debug.strClass, + "#fields=" + count); + Debug.indent(); + for (int i = 0; i < count; i++) + classInfo.addField(strField(cp, in)); + Debug.outdent(); + + // Methods + count = in.readShort(); + if (Debug.strClass != null) + Debug.println(Debug.strClass, + "#methods=" + count); + Debug.indent(); + for (int i = 0; i < count; i++) + classInfo.addMethod(strMethod(cp, in)); + Debug.outdent(); + + // Attributes + count = in.readShort(); + if (Debug.strClass != null) + Debug.println(Debug.strClass, + "#attributes=" + count); + Debug.indent(); + for (int i = 0; i < count; i++) + strClassAttribute(classInfo, cp, in); + Debug.outdent(); + } + + private String strInterface(ConstPool cp, DataInput in) + throws IOException { + short classIndex = in.readShort(); + if (Debug.strInterface != null) + Debug.println(Debug.strInterface, + "class index=" + classIndex); + int nameIndex = cp.getEntryAtIndex(classIndex).getClassNameIndex(); + return cp.getEntryAtIndex(nameIndex).getString(); + } + + private FieldInfo strField(ConstPool cp, DataInput in) + throws IOException { + FieldInfo result; + + // General Field Info + { + short flags = in.readShort(); + short nameIndex = in.readShort(); + short signatureIndex = in.readShort(); + + if (Debug.strField != null) Debug.println(Debug.strField, + "flags=" + flags + + "; name index=" + nameIndex + + "; signature index=" + signatureIndex); + + result = new FieldInfo(flags, + cp.getEntryAtIndex(nameIndex).getString(), + cp.getEntryAtIndex(signatureIndex).getString()); + } + + // Field Attributes + short numAttributes = in.readShort(); + if (Debug.strField != null) Debug.println(Debug.strField, + "#attributes=" + numAttributes); + Debug.indent(); + for (int i = 0; i < numAttributes; i++) + strFieldAttribute(result, cp, in); + Debug.outdent(); + + return result; + } + + private MethodInfo strMethod(ConstPool cp, DataInput in) + throws IOException { + MethodInfo result; + + // General Method Info + { + short flags = in.readShort(); + short nameIndex = in.readShort(); + short signatureIndex = in.readShort(); + String methodName = cp.getEntryAtIndex(nameIndex).getString(); + String methodSignature = cp.getEntryAtIndex(signatureIndex).getString(); + + if (Debug.strMethod != null) Debug.println(Debug.strMethod, + "flags=" + flags + + "; name index=" + nameIndex + + "; signature index=" + signatureIndex); + + result = new MethodInfo(flags, methodName, methodSignature); + } + + // Method Attributes + short methodAttrCount = in.readShort(); + if (Debug.strMethod != null) Debug.println(Debug.strMethod, + "#attributes=" + methodAttrCount); + Debug.indent(); + + for (int iMethodAttr = 0; iMethodAttr < methodAttrCount; iMethodAttr++) + strMethodAttribute(result, cp, in); + + Debug.outdent(); + + return result; + } + + private void strClassAttribute(ClassInfo classInfo, ConstPool cp, + DataInput in) throws IOException { + short nameIndex = in.readShort(); + int length = in.readInt(); + + // make sure we read the entire attribute -- if it has bad data, + // an exception might get thrown before we've read it all + byte[] bytes = new byte[length]; + in.readFully(bytes); + in = new DataInputStream(new ByteArrayInputStream(bytes)); + + if (Debug.strClass != null) Debug.println(Debug.strClass, + "attribute name index=" + nameIndex + + "; length=" + length); + Debug.indent(); + + try { + + String name = cp.getEntryAtIndex(nameIndex).getString(); + + // SourceFile Attribute + if (name.equals("SourceFile")) { + short filenameIndex = in.readShort(); + if (Debug.strClass != null) Debug.println(Debug.strClass, + "filename index=" + filenameIndex); + classInfo.setSourceFile(cp.getEntryAtIndex(filenameIndex).getString()); + } + + else if (name.equals("InnerClasses")) + classInfo.setInnerClasses(strInnerClasses(cp, in)); + + else + classInfo.addAttribute(strUnknownAttribute(name, length, in)); + + } catch (ConstPoolEntryError e) { + if (Debug.strBadData != null) Debug.println(Debug.strBadData, + "class attribute name index=" + nameIndex); + } + + Debug.outdent(); + } + + private void strFieldAttribute(FieldInfo fieldInfo, ConstPool cp, + DataInput in) throws IOException { + short nameIndex = in.readShort(); + String name = cp.getEntryAtIndex(nameIndex).getString(); + int length = in.readInt(); + + // make sure we read the entire attribute -- if it has bad data, + // an exception might get thrown before we've read it all + byte[] bytes = new byte[length]; + in.readFully(bytes); + in = new DataInputStream(new ByteArrayInputStream(bytes)); + + if (Debug.strField != null) Debug.println(Debug.strField, + "attribute name index=" + nameIndex + + "; length=" + length); + Debug.indent(); + + try { + + // ConstantValue Attribute + if (name.equals("ConstantValue")) { + short cvIndex = in.readShort(); + if (Debug.strField != null) Debug.println(Debug.strField, + "constant value index=" + cvIndex); + fieldInfo.setConstantValue(cp.getEntryAtIndex(cvIndex).getPrimitiveTypeValue()); + } + + else if (name.equals("Synthetic")) { + if (Debug.strField != null) Debug.println(Debug.strField, + "synthetic"); + fieldInfo.setSynthetic(true); + } + + else + fieldInfo.addAttribute(strUnknownAttribute(name, length, in)); + + } catch (ConstPoolEntryError e) { + if (Debug.strBadData != null) Debug.println(Debug.strBadData, + "field attribute name index=" + nameIndex); + } + + Debug.outdent(); + } + + private void strMethodAttribute(MethodInfo methodInfo, ConstPool cp, + DataInput in) throws IOException { + short nameIndex = in.readShort(); + int length = in.readInt(); + + // make sure we read the entire attribute -- if it has bad data, + // an exception might get thrown before we've read it all + byte[] bytes = new byte[length]; + in.readFully(bytes); + in = new DataInputStream(new ByteArrayInputStream(bytes)); + + if (Debug.strMethod != null) Debug.println(Debug.strMethod, + "attribute name index=" + nameIndex + + "; length=" + length); + Debug.indent(); + + try { + + String name = cp.getEntryAtIndex(nameIndex).getString(); + if (name.equals("Exceptions")) { + int count = in.readShort(); + for (int i = 0; i < count; i++) { + short exceptionClassIndex = in.readShort(); + int exceptionClassNameIndex = cp.getEntryAtIndex(exceptionClassIndex).getClassNameIndex(); + String exceptionName = cp.getEntryAtIndex(exceptionClassNameIndex). getString(); + methodInfo.addException(exceptionName); + } + } + + else if (name.equals("Code")) + methodInfo.setCodeInfo(strCode(cp, in)); + + else if (name.equals("Deprecated")) { + if (Debug.strMethod != null) Debug.println(Debug.strMethod, + "deprecated"); + methodInfo.setDeprecated(true); + } + + else + methodInfo.addAttribute(strUnknownAttribute(name, length, in)); + + } catch (ConstPoolEntryError e) { + if (Debug.strBadData != null) Debug.println(Debug.strBadData, + "method attribute name index=" + nameIndex); + } + + Debug.outdent(); + } + + private CodeInfo strCode(ConstPool cp, DataInput in) + throws IOException { + // General Code Info + short maxStack = in.readShort(); + short maxLocals = in.readShort(); + byte[] bytecode = new byte[in.readInt()]; + + if (Debug.strCode != null) Debug.println(Debug.strCode, + "maxStack=" + maxStack + + "; maxLocals=" + maxLocals + + "; bytecode length=" + bytecode.length); + + in.readFully(bytecode); + + // Exception Table + ExceptionInfo[] exceptionTable = new ExceptionInfo[in.readShort()]; + if (Debug.strCode != null) Debug.println(Debug.strCode, + "exception table length=" + exceptionTable.length); + Debug.indent(); + for (int i = 0; i < exceptionTable.length; i++) { + short startPC = in.readShort(); + short endPC = in.readShort(); + short handlerPC = in.readShort(); + short catchTypeIndex = in.readShort(); + + if (Debug.strCode != null) Debug.println(Debug.strCode, + "startPC=" + startPC + + "; endPC=" + endPC + + "; handlerPC=" + handlerPC + + "; catchTypeIndex=" + catchTypeIndex); + + String catchType = null; + if (catchTypeIndex != 0) { // index is null for finally blocks + int catchTypeNameIndex = + cp.getEntryAtIndex(catchTypeIndex).getClassNameIndex(); + catchType = cp.getEntryAtIndex(catchTypeNameIndex).getString(); + } + exceptionTable[i] = + new ExceptionInfo(startPC, endPC, handlerPC, catchType); + } + Debug.outdent(); + + CodeInfo codeInfo = + new CodeInfo(maxStack, maxLocals, bytecode, exceptionTable); + + // Code Attributes + short codeAttrCount = in.readShort(); + if (Debug.strCode != null) Debug.println(Debug.strCode, + "#attributes=" + codeAttrCount); + Debug.indent(); + for (int iCodeAttr = 0; iCodeAttr < codeAttrCount; iCodeAttr++) + strCodeAttribute(codeInfo, cp, in); + Debug.outdent(); + + return codeInfo; + } + + private void strCodeAttribute(CodeInfo codeInfo, ConstPool cp, + DataInput in) throws IOException { + short nameIndex = in.readShort(); + int length = in.readInt(); + + // make sure we read the entire attribute -- if it has bad data, + // an exception might get thrown before we've read it all + byte[] bytes = new byte[length]; + in.readFully(bytes); + in = new DataInputStream(new ByteArrayInputStream(bytes)); + + if (Debug.strCode != null) + Debug.println(Debug.strCode, "code attribute name index=" + + nameIndex + "; length=" + length); + Debug.indent(); + + try { + + String name = cp.getEntryAtIndex(nameIndex).getString(); + if (name.equals("LineNumberTable")) + codeInfo.setLineNumberTable(readLineNumberTable(in)); + else if (name.equals("LocalVariableTable")) + codeInfo.setLocalVariableTable(strLocalVariablesTable(cp, in)); + else + codeInfo.addAttribute(strUnknownAttribute(name, length, in)); + + } catch (ConstPoolEntryError e) { + if (Debug.strBadData != null) Debug.println(Debug.strBadData, + "code attribute name index=" + nameIndex); + } + + Debug.outdent(); + } + + private InnerClassInfo[] strInnerClasses(ConstPool cp, DataInput in) + throws IOException { + short rows = in.readShort(); + if (Debug.strInnerClasses != null) Debug.println(Debug.strInnerClasses, + "#inner classes=" + rows); + InnerClassInfo[] classes = new InnerClassInfo[rows]; + for (int i = 0; i < rows; i++) { + short innerClassIndex = in.readShort(); + short outerClassIndex = in.readShort(); + short simpleNameIndex = in.readShort(); + short flags = in.readShort(); + + if (Debug.strInnerClasses != null) + Debug.println(Debug.strInnerClasses, + "inner class index=" + innerClassIndex + + "; outer class index=" + outerClassIndex + + "; simple name index=" + simpleNameIndex + + "; flags=" + flags); + + int innerClassNameIndex = cp.getEntryAtIndex(innerClassIndex).getClassNameIndex(); + String innerClassName = cp.getEntryAtIndex(innerClassNameIndex).getString(); + String outerClassName = null; + if (outerClassIndex != 0) { + int outerClassNameIndex = cp.getEntryAtIndex(outerClassIndex).getClassNameIndex(); + outerClassName = cp.getEntryAtIndex(outerClassNameIndex).getString(); + } + String simpleName = null; + if (simpleNameIndex != 0) + simpleName = cp.getEntryAtIndex(simpleNameIndex).getString(); + + classes[i] = new InnerClassInfo(innerClassName, outerClassName, simpleName, flags); + } + return classes; + } + + private LocalVariableInfo[] strLocalVariablesTable(ConstPool cp, DataInput in) + throws IOException + { + LocalVariableInfo[] table = new LocalVariableInfo[in.readShort()]; + if (Debug.strLocalVariables != null) + Debug.println(Debug.strLocalVariables, + "#local variables=" + table.length); + for (int i = 0; i < table.length; i++) { + short startPC = in.readShort(); + short length = in.readShort(); + short nameIndex = in.readShort(); + short signatureIndex = in.readShort(); + short slot= in.readShort(); + if (Debug.strLocalVariables != null) + Debug.println(Debug.strLocalVariables, + "start PC=" + startPC + + "; length=" + length + + "; name index=" + nameIndex + + "; signature index=" + signatureIndex + + "; slot=" + slot); + + String name = cp.getEntryAtIndex(nameIndex).getString(); + String signature = cp.getEntryAtIndex(signatureIndex).getString(); + table[i] = new LocalVariableInfo(startPC, length, name, signature, slot); + } + return table; + } + + private LineNumberInfo[] readLineNumberTable(DataInput in) + throws IOException { + LineNumberInfo[] table = new LineNumberInfo[in.readShort()]; + if (Debug.strLineNumbers != null) + Debug.println(Debug.strLineNumbers, + "#line numbers=" + table.length); + for (int i = 0; i < table.length; i++) { + short startPC = in.readShort(); + short lineNumber = in.readShort(); + + if (Debug.strLineNumbers != null) + Debug.println(Debug.strLineNumbers, + "start PC=" + startPC + + "; line number=" + lineNumber); + + table[i] = new LineNumberInfo(startPC, lineNumber); + } + return table; + } + + private AttributeInfo strUnknownAttribute(String name, int length, DataInput in) + throws IOException { + if (Debug.strUnknownAttribute != null) + Debug.println(Debug.strUnknownAttribute, + "attribute name=\"" + name + "\""); + byte[] data = new byte[length]; + in.readFully(data); + return new AttributeInfo(name, data); + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/ClassInfo.java epos--jvm/nanovmtool/src/org/nanovm/converter/ClassInfo.java --- epos--/nanovmtool/src/org/nanovm/converter/ClassInfo.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/ClassInfo.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,314 @@ +package org.nanovm.converter; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +import java.util.Vector; + +/** +* A class for storing information about a class. +* This information can be read in by a ClassFileReader, or written out by +* a ClassFileWriter. +* +* @see FieldInfo +* @see MethodInfo +* @see AttributeInfo +* @see ClassFileReader +* @see ClassFileWriter +*/ +public class ClassInfo extends CommonInfo { + private String superName = "java.lang.Object", sourceFile; + private ConstPool cp; + // Vector of Strings + private Vector interfaces = new Vector(); + // Vector of FieldInfo + private Vector fields = new Vector(); + // Vector of MethodInfo + private Vector methods = new Vector(); + private InnerClassInfo[] innerClasses; + + /** + * Set the constant pool. The ClassInfo class itself does not actually use + * the ConstPool for anything. This method is useful if the ClassInfo is + * being read in by a ClassFileReader and there are attributes that the + * Reader does not understand, which reference entries in the constant + * pool. The best example of such an attribute is method bytecodes. + * In a future release, ClassFileReaders will understand bytecodes, + * and so this method will become less important. + * + *

The new ConstPool is not immutable. It may be passed to a + * ClassFileWriter, which will add entries as needed. + * + * @see ConstPool + */ + public void setConstPool(ConstPool cp) { + this.cp = cp; + } + + /** + * Get the constant pool. The ClassInfo class itself does not use the + * constant pool for anthing. The constant pool is useful if the ClassInfo is + * being written out by a ClassFileWriter and there are attributes that the + * Writer does not understand, which reference entries in the constant + * pool. The best example of such an attribute is method bytecodes. + * The Writer will use the ConstPool returned by this method in preference + * to creating its own ConstPool. Letting the Writer create its own + * ConstPool is probably not a good idea, for the reasons describe above. + * In a future release, ClassFileWriters will understand bytecodes, and so + * this method will become less important. + * + * @see ConstPool + */ + public ConstPool getConstPool() { + return cp; + } + + /** + * Set the name of the super class. The name should be of the form "java.lang.String". + */ + public void setSuperClassName(String name) { + superName = name; + } + + /** + * Get the name of the super class. The name is of the form "java.lang.String". + */ + public String getSuperClassName() { + return superName; + } + + /** + * Add an interface that the class implements. + */ + public void addInterface(String interfaceName) { + interfaces.addElement(interfaceName); + } + + /** + * Get the interfaces that this class implements. + */ + public String[] getInterfaces() { + String[] list = new String[interfaces.size()]; + interfaces.copyInto(list); + return list; + } + + /** + * Add a field to this class. The FieldInfo should be need not be + * entirely filled out before being added. + * + * @see FieldInfo + */ + public void addField(FieldInfo fieldInfo) { + fields.addElement(fieldInfo); + } + + // get field number n + public FieldInfo getField(int index) { + return (FieldInfo)fields.elementAt(index); + } + + /** + */ + public void addMethod(MethodInfo methodInfo) { + methods.addElement(methodInfo); + } + + public MethodInfo getMethod(int index) { + return (MethodInfo)methods.elementAt(index); + } + + // return index of given method within current class + public int getMethodIndex(MethodInfo methodInfo) { + for(int i=0;iclass Foo { + * class Bar { + * class Quux { + * class Squish { + * } + * } + * } + * class Baz { + * } + *} + * + * If this ClassInfo is for Foo.Bar, then the inner classes array should be + * {FooInfo, BarInfo, QuuxInfo}. The order is important: outer classes + * must come before their inner classes. Note that the + * current class must have an entry in the array. Squish and Baz may be + * included in the array, but they're not necessary. + * + * @see InnerClassInfo + */ + public void setInnerClasses(InnerClassInfo[] innerClasses) { + this.innerClasses = innerClasses; + } + + /** + * Get the inner class information of this class. + * + * @see #setInnerClasses() + */ + public InnerClassInfo[] getInnerClasses() { + return innerClasses; + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/ClassLoader.java epos--jvm/nanovmtool/src/org/nanovm/converter/ClassLoader.java --- epos--/nanovmtool/src/org/nanovm/converter/ClassLoader.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/ClassLoader.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,331 @@ +package org.nanovm.converter; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +import org.nanovm.converter.ClassFileReader; +import org.nanovm.converter.ClassInfo; +import java.io.*; +import java.util.Vector; +import java.util.StringTokenizer; + +public class ClassLoader { + static private Vector classes = new Vector(); + static private String classPath = null; + + static public void setClassPath(String path) { + classPath = path; + } + + public static ClassInfo getClassInfo(int index) { + return (ClassInfo)classes.elementAt(index); + } + + public static ClassInfo getClassInfo(String className) { + // search through all classes + for(int i=0;i= getClassInfo(classIndex).methods()) + index -= getClassInfo(classIndex++).methods(); + + return getClassInfo(classIndex); + } + + // get index of class named className + public static int getClassIndex(String className) { + // search through all classes + for(int i=0;i= getClassInfo(i).getConstPool().totalConstantEntries()) + index -= getClassInfo(i++).getConstPool().totalConstantEntries(); + + return getClassInfo(i).getConstPool().getConstantEntry(index); + } + + + // get memory required to store all strings + public static int totalStringSize() { + int sum = 0; + + for(int i=0;i= getClassInfo(i).getConstPool().totalStrings()) + index -= getClassInfo(i++).getConstPool().totalStrings(); + + return getClassInfo(i).getConstPool().getString(index); + } + + // total number of static fields + public static int totalStaticFields() { + int sum = 0; + + for(int i=0;i= getClassInfo(i).methods()) + index -= getClassInfo(i++).methods(); + + return(getClassInfo(i).getMethod(index)); + } + + public static int totalClasses() { + return classes.size(); + } + + // get class index of method with index + public static int getClassIndex(int index) { + int i=0; + + // search through all classes + while(index >= getClassInfo(i).methods()) + index -= getClassInfo(i++).methods(); + + return i; + } + + public static void constantRelocate(int i) { + System.out.println("request to relocate " + i); + } + + static public void load(String name) { + + try { + InputStream is = null; + + // walk through all paths stored in classpath + StringTokenizer pathTokenizer + = new StringTokenizer(classPath, File.pathSeparator); + + while((pathTokenizer.hasMoreElements()) && (is == null)) { + String filename; + + // build full class file name + filename = pathTokenizer.nextToken(); + filename += "/"; + filename += name; + filename += ".class"; + + try { + // load given class + is = new FileInputStream(filename); + } catch(FileNotFoundException e) { + is = null; + } + } + + if (is == null) { + throw new FileNotFoundException("Unable to find class file " + name + ".class"); + } + + System.out.println("Loading class " + name ); + + ClassInfo classInfo = new ClassInfo(); + new ClassFileReader().read(is, classInfo); + is.close(); + classes.addElement(classInfo); + + System.out.println("Checking dependencies ..."); + + // go through all constants and check for method references + classInfo.getConstPool().resolveMethodRefs(); + + } catch(Exception e) { + System.out.println("Error loading class: " + e.toString()); + System.exit(-1); + } + } +} + diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/CodeInfo.java epos--jvm/nanovmtool/src/org/nanovm/converter/CodeInfo.java --- epos--/nanovmtool/src/org/nanovm/converter/CodeInfo.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/CodeInfo.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,100 @@ +package org.nanovm.converter; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +import org.nanovm.converter.AttributeInfo; +import java.util.Vector; + +/* + * A class for storing information about the code of a method. + */ +public class CodeInfo { + private short maxStack, maxLocals; + private byte[] bytecode; + private ExceptionInfo[] exceptionTable; + private LineNumberInfo[] lineNumberTable; + private LocalVariableInfo[] localVariableTable; + private Vector attributes = new Vector(); + + public CodeInfo(short maxStack, short maxLocals, byte[] bytecode, + ExceptionInfo[] exceptionTable) { + setMaxStack(maxStack); + setMaxLocals(maxLocals); + setBytecode(bytecode); + setExceptionTable(exceptionTable); + } + + public void setMaxStack(short maxStack) { + this.maxStack = maxStack; + } + + public short getMaxStack() { + return maxStack; + } + + public void setMaxLocals(short maxLocals) { + this.maxLocals = maxLocals; + } + + public short getMaxLocals() { + return maxLocals; + } + + public void setBytecode(byte[] bytecode) { + this.bytecode = bytecode; + } + + public byte[] getBytecode() { + return bytecode; + } + + public void setExceptionTable(ExceptionInfo[] exceptionTable) { + this.exceptionTable = exceptionTable; + } + + public ExceptionInfo[] getExceptionTable() { + return exceptionTable; + } + + public void setLineNumberTable(LineNumberInfo[] lineNumberTable) { + this.lineNumberTable = lineNumberTable; + } + + public LineNumberInfo[] getLineNumberTable() { + return lineNumberTable; + } + + public void setLocalVariableTable(LocalVariableInfo[] localVariableTable) { + this.localVariableTable = localVariableTable; + } + + public void addAttribute(AttributeInfo attributeInfo) { + attributes.addElement(attributeInfo); + } + + public AttributeInfo[] getAttributes() { + AttributeInfo[] list = new AttributeInfo[attributes.size()]; + attributes.copyInto(list); + return list; + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/CodeTranslator.java epos--jvm/nanovmtool/src/org/nanovm/converter/CodeTranslator.java --- epos--/nanovmtool/src/org/nanovm/converter/CodeTranslator.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/CodeTranslator.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,365 @@ +package org.nanovm.converter; + + +import org.nanovm.converter.ClassInfo; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +public class CodeTranslator { + + // parameter bytes for each of the 256 instructions (-1 = not implemented) + final static int[] PARAMETER_BYTES = { + // 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f + 0, -1, 0, 0, 0, 0, 0, 0, 0, -1, -1, 0, 0, 0, -1, -1, // 00 + 1, 2, 1, -1, -1, 1, -1, 1, -1, 1, 0, 0, 0, 0, -1, -1, // 10 + -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, -1, // 20 + 0, -1, 0, 0, -1, -1, 1, -1, 1, -1, -1, 0, 0, 0, 0, -1, // 30 + + -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, 0, 0, 0, 0, // 40 + -1, 0, -1, 0, 0, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 50 + 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, // 60 + 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, // 70 + + 0, -1, 0, -1, 2, -1, 0, -1, -1, -1, -1, 0, -1, -1, -1, -1, // 80 + -1, -1, 0, -1, -1, 0, 0, -1, -1, 2, 2, 2, 2, 2, 2, 2, // 90 + 2, 2, 2, 2, 2, -1, -1, 2, -1, -1, 0, 0, 0, -1, 0, -1, // a0 + -1, 0, 2, 2, 2, 2, 2, 2, 2, -1, -1, 2, 1, 2, 0, -1, // b0 + + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // c0 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // d0 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // e0 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // f0 + }; + + // some java bytecode instructions + final static int OP_NOP = 0x00; + final static int OP_ACONST_NULL = 0x01; + final static int OP_ICONST_0 = 0x03; + final static int OP_SIPUSH = 0x11; + final static int OP_LDC = 0x12; + final static int OP_ILOAD = 0x15; + final static int OP_ALOAD = 0x19; + final static int OP_ILOAD_0 = 0x1a; + final static int OP_ILOAD_1 = 0x1b; + final static int OP_ILOAD_2 = 0x1c; + final static int OP_ILOAD_3 = 0x1d; + final static int OP_ALOAD_0 = 0x2a; + final static int OP_ALOAD_1 = 0x2b; + final static int OP_ALOAD_2 = 0x2c; + final static int OP_ALOAD_3 = 0x2d; + final static int OP_ISTORE = 0x36; + final static int OP_ASTORE = 0x3a; + final static int OP_ISTORE_0 = 0x3b; + final static int OP_ISTORE_1 = 0x3c; + final static int OP_ISTORE_2 = 0x3d; + final static int OP_ISTORE_3 = 0x3e; + final static int OP_ASTORE_0 = 0x4b; + final static int OP_ASTORE_1 = 0x4c; + final static int OP_ASTORE_2 = 0x4d; + final static int OP_ASTORE_3 = 0x4e; + final static int OP_I2B = 0x91; + final static int OP_I2C = 0x92; + final static int OP_I2S = 0x93; + final static int OP_TABLESWITCH = 0xaa; + final static int OP_LOOKUPSWITCH = 0xab; + final static int OP_IRETURN = 0xac; + final static int OP_ARETURN = 0xb0; + + final static int OP_GETSTATIC = 0xb2; + final static int OP_PUTSTATIC = 0xb3; + final static int OP_GETFIELD = 0xb4; + final static int OP_PUTFIELD = 0xb5; + final static int OP_INVOKEVIRTUAL = 0xb6; + final static int OP_INVOKESPECIAL = 0xb7; + final static int OP_INVOKESTATIC = 0xb8; + final static int OP_NEW = 0xbb; + + final static int OP_IFEQ = 0x99; + final static int OP_IFNE = 0x9a; + final static int OP_IFNULL = 0xc6; + final static int OP_IFNONNULL = 0xc7; + + final static int OP_FCONST_0 = 0x0b; // only if floating point compiled in + final static int OP_FCONST_1 = 0x0c; // only if floating point compiled in + final static int OP_FCONST_2 = 0x0d; // only if floating point compiled in + final static int OP_FLOAD = 0x17; // only if floating point compiled in + final static int OP_FLOAD_0 = 0x22; // only if floating point compiled in + final static int OP_FLOAD_1 = 0x23; // only if floating point compiled in + final static int OP_FLOAD_2 = 0x24; // only if floating point compiled in + final static int OP_FLOAD_3 = 0x25; // only if floating point compiled in + final static int OP_IALOAD = 0x2e; // only if array compiled in + final static int OP_FALOAD = 0x30; // only if array and floating point compiled in + final static int OP_AALOAD = 0x32; // only if array compiled in + final static int OP_BALOAD = 0x33; // only if array compiled in + final static int OP_FSTORE = 0x38; // only if floating point compiled in + final static int OP_FSTORE_0 = 0x43; // only if floating point compiled in + final static int OP_FSTORE_1 = 0x44; // only if floating point compiled in + final static int OP_FSTORE_2 = 0x45; // only if floating point compiled in + final static int OP_FSTORE_3 = 0x46; // only if floating point compiled in + final static int OP_IASTORE = 0x4f; // only if array compiled in + final static int OP_FASTORE = 0x51; // only if array and floating point compiled in + final static int OP_AASTORE = 0x53; // only if array compiled in + final static int OP_BASTORE = 0x54; // only if array compiled in + final static int OP_DUP_X1 = 0x5a; // only if extended stack ops compiled in + final static int OP_DUP_X2 = 0x5b; // only if extended stack ops compiled in + final static int OP_DUP2_X1 = 0x5d; // only if extended stack ops compiled in + final static int OP_DUP2_X2 = 0x5e; // only if extended stack ops compiled in + final static int OP_SWAP = 0x5f; // only if extended stack ops compiled in + final static int OP_FADD = 0x62; // only if floating point compiled in + final static int OP_FSUB = 0x66; // only if floating point compiled in + final static int OP_FMUL = 0x6a; // only if floating point compiled in + final static int OP_FDIV = 0x6e; // only if floating point compiled in + final static int OP_FREM = 0x72; // only if floating point compiled in + final static int OP_FNEG = 0x76; // only if floating point compiled in + final static int OP_I2F = 0x86; // only if floating point compiled in + final static int OP_F2I = 0x8b; // only if floating point compiled in + final static int OP_FCMPL = 0x95; // only if floating point compiled in + final static int OP_FCMPG = 0x96; // only if floating point compiled in + final static int OP_FRETURN = 0xae; // only if floating point compiled in + final static int OP_NEWARRAY = 0xbc; // only if array compiled in + final static int OP_ANEWARRAY = 0xbd; // only if array compiled in + final static int OP_ARRAYLENGTH = 0xbe; // only if array compiled in + + + + static int unsigned(int i) { + if(i<0) return i + 256; + return i; + } + + static byte signed(int i) { + if(i>127) return (byte)(i - 256); + return (byte)i; + } + + static int get32(byte[] code, int i) { + int val = + 0x00000001 * unsigned(code[i+3]) + + 0x00000100 * unsigned(code[i+2]) + + 0x00010000 * unsigned(code[i+1]) + + 0x01000000 * unsigned(code[i+0]); + return val; + } + + static void set32(byte[] code, int i, int val) { + code[i+3] = signed(val >> 0); + code[i+2] = signed(val >> 8); + code[i+1] = signed(val >> 16); + code[i+0] = signed(val >> 24); + } + + public static void translate(ClassInfo classInfo, byte[] code) { + // process all code bytes + for(int i=0;i>8); + code[i+2] = signed(index&0xff); + } + + if((cmd == OP_GETSTATIC)||(cmd == OP_PUTSTATIC)) { + int index = 256 * unsigned(code[i+1]) + unsigned(code[i+2]); + System.out.print("get/putstatic #" + index); + index = classInfo.getConstPool().constantRelocate(index); + code[i+1] = signed(index>>8); + code[i+2] = signed(index&0xff); + + // getstatic usually uses a reference to the object in question. + // if the object is native, then this is just an id, that is to + // be directly pushed onto the stack, thus we replace the getstatic + // instruction with a push instruction + if((cmd == OP_GETSTATIC)&&((index>>8) >= NativeMapper.lowestNativeId)) + code[i] = signed(OP_SIPUSH); + } + + if((cmd == OP_INVOKEVIRTUAL)||(cmd == OP_INVOKESPECIAL)|| + (cmd == OP_INVOKESTATIC)) { + int index = 256 * unsigned(code[i+1]) + unsigned(code[i+2]); + System.out.print("invoke #" + index); + index = classInfo.getConstPool().constantRelocate(index); + code[i+1] = signed(index>>8); + code[i+2] = signed(index&0xff); + } + + if(cmd == OP_NEW) { + int index = 256 * unsigned(code[i+1]) + unsigned(code[i+2]); + System.out.print("new #" + index); + index = classInfo.getConstPool().constantRelocate(index); + code[i+1] = signed(index>>8); + code[i+2] = signed(index&0xff); + } + + if(cmd == OP_TABLESWITCH) { + UsedFeatures.add(UsedFeatures.TABLESWITCH); + //System.out.println("tableswitch"); + // opcode is followed by up to 3 padding bytes (replaced by nop's) + // 4 byte low value follows + // 4 byte hi value follows + // (hi-lo+1) * 4 bytes build the table + int delta=0; + i++; + while (i%4!=0) { + code[i-1]=signed(OP_NOP); + code[i]=signed(OP_TABLESWITCH); + i++; + delta++; + } + set32(code, i, get32(code, i) - delta); // realloc default label + i+=4; + int lo = get32(code, i+0); + int hi = get32(code, i+4); + i+=8; + System.out.println("tableswitch: number of cases ="+(hi-lo+1)); + for (int j=0; j<(hi-lo+1); j++){ + set32(code, i, get32(code, i) - delta); // realloc label + i+=4; + } + i--; + } + + if(cmd == OP_LOOKUPSWITCH) { + UsedFeatures.add(UsedFeatures.LOOKUPSWITCH); + System.out.println("lookupswitch"); + // opcode is followed by up to 3 padding bytes + // 4 byte default offset follows + // 4 byte count follows + // count * 2 * 4 bytes build the table + int delta=0; + i++; + while (i%4!=0) { + System.out.println("lookupswitch: padding"); + code[i-1]=signed(OP_NOP); + code[i]=signed(OP_LOOKUPSWITCH); + i++; + delta++; + } + set32(code, i, get32(code, i) - delta); // realloc default label + i+=4; + int count = get32(code, i); + i+=4; + System.out.println("lookupswitch: number of cases = "+count); + for (int j=0; j +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +import java.util.Vector; + +/** +* A common base class for ClassInfo, MethodInfo, and FieldInfo. +* +* @see ClassInfo +* @see MethodInfo +* @see FieldInfo +*/ +public class CommonInfo { + short accessFlags = 0; + Vector attributes = new Vector(); + String name; + + /** + * Set the name of this class/method/field. + */ + public void setName(String name) { + this.name = name; + } + + /** + * Get the name of this class/method/field. + */ + public String getName() { + return name; + } + + /** + * Set the access flags of the class. + * + * @see AccessFlags + */ + public void setAccessFlags(short accessFlags) { + this.accessFlags = accessFlags; + } + + /** + * Get the access flags of the class. + * + * @see AccessFlags + */ + public short getAccessFlags() { + return accessFlags; + } + + /** + * Add a non-standard attribute. This does not include the Code + * attribute for methods, the SourceFile attribute for classes, or the + * ConstantValue attribute for fields. + */ + public void addAttribute(AttributeInfo attributeInfo) { + attributes.addElement(attributeInfo); + } + + /** + * Get all non-standard attributes. This does not include the Code + * attribute for methods, the SourceFile attribute for classes, or the + * ConstantValue attribute for fields. + */ + public AttributeInfo[] getAttributes() { + AttributeInfo[] list = new AttributeInfo[attributes.size()]; + attributes.copyInto(list); + return list; + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/Config.java epos--jvm/nanovmtool/src/org/nanovm/converter/Config.java --- epos--/nanovmtool/src/org/nanovm/converter/Config.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/Config.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,153 @@ +package org.nanovm.converter; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +import org.nanovm.converter.NativeMapper; +import java.io.*; +import java.util.*; + +public class Config { + public static final int TARGET_NONE = -1; + public static final int TARGET_FILE = 0; + public static final int TARGET_NVC1_AUTO = 2; // = UART for now + public static final int TARGET_NVC1_UART = 2; + public static final int TARGET_NVC1_ASURO = 3; + public static final int TARGET_NVC2_AUTO = 4; + public static final int TARGET_CTBOT_AUTO = 5; + + static NativeMapper nativeMapper = new NativeMapper(); + + // the config from file + static int maxSize = 0; + static String configName = null; + + static int target = TARGET_NONE; + static String targetFile = null; + static int targetSpeed = -1; + + static public int getTarget() { + return target; + } + + static public String getFileName() { + return targetFile; + } + + static public void overwriteFileName(String name) { + targetFile = name; + } + + static public int getSpeed() { + return targetSpeed; + } + + static public int getMaxSize() { + return maxSize; // asuro + } + + static public void load(String fileName) { + System.out.println("Read config " + fileName); + + File inputFile = new File(fileName); + + // get config path + String configPath = inputFile.getParent(); + if(configPath == null) + configPath = "."; + + // Object is always native + nativeMapper.load(configPath + File.separator + "Object"); + + try { + String line; + FileInputStream in = new FileInputStream(inputFile); + BufferedReader reader = new BufferedReader + (new InputStreamReader(in)); + + // read through all lines in file + while((line = reader.readLine()) != null) { + StringTokenizer st = new StringTokenizer(line); + boolean skipRest = false; + int token_index = 0; + String name=null, value=null; + + while(st.hasMoreTokens() && !skipRest) { + String token = st.nextToken(); + + if(token.charAt(0) == '#') + skipRest = true; + else { + if(token_index == 0) name = token; + else if(token_index == 1) value = token; + } + + token_index++; + } + + if(name != null) { + if(name.equalsIgnoreCase("maxsize") && (value != null)) + maxSize = Integer.parseInt(value); + else if(name.equalsIgnoreCase("name") && (value != null)) + configName = value; + else if(name.equalsIgnoreCase("native") && (value != null)) + nativeMapper.load(configPath + File.separator + value); + else if(name.equalsIgnoreCase("target") && (value != null)) { + if(value.equalsIgnoreCase("file")) + target = TARGET_FILE; + else if(value.equalsIgnoreCase("nvmcomm1/auto")) + target = TARGET_NVC1_AUTO; + else if(value.equalsIgnoreCase("nvmcomm1/uart")) + target = TARGET_NVC1_UART; + else if(value.equalsIgnoreCase("uart")) // legacy support + target = TARGET_NVC1_UART; + else if(value.equalsIgnoreCase("nvmcomm1/asuro")) + target = TARGET_NVC1_ASURO; + else if(value.equalsIgnoreCase("asuro")) // legacy support + target = TARGET_NVC1_ASURO; + else if(value.equalsIgnoreCase("nvmcomm2/auto")) + target = TARGET_NVC2_AUTO; + else if(value.equalsIgnoreCase("ctbot")) + target = TARGET_CTBOT_AUTO; + else { + System.out.println("ERROR: Unknown target \"" + value + "\""); + System.exit(-1); + } + } else if(name.equalsIgnoreCase("filename") && (value != null)) { + targetFile = value; + } else if(name.equalsIgnoreCase("speed") && (value != null)) { + targetSpeed = Integer.parseInt(value); + } else { + System.out.println("ERROR: Unknown config entry \"" + name + "\""); + System.exit(-1); + } + } + } + + in.close(); + } catch(IOException e) { + System.out.println("Error reading map"); + System.out.println(e.toString()); + System.exit(-1); + } + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/ConstPool.java epos--jvm/nanovmtool/src/org/nanovm/converter/ConstPool.java --- epos--/nanovmtool/src/org/nanovm/converter/ConstPool.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/ConstPool.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,520 @@ +package org.nanovm.converter; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +import org.nanovm.converter.ClassLoader; +import org.nanovm.converter.ClassInfo; +import java.util.*; +import java.io.*; + +/** +* This class encapsulates constant pool management. Classfiles use +* constant pools to store information such as class names, method +* names, type signatures, and literals like "Hello World" or 123. When +* the information is needed (like for a method declaration), an index +* into the constant pool is given instead of the actual information. +* This can reduce the size of a classfile dramatically if the same +* information is used frequently. +* +*

ClassFileReaders and ClassFileWriters usually try to convert +* constant pool indexes into meaningful data (eg ClassInfo.setName() +* takes a String instead of a constant pool index). So you probably +* won't need to use this class unless you need to work with attributes +* that the ClassFileReader/Writer doesn't understand, such as +* bytecodes. +* +*

The constant pool is a 0-based array of entries. The entry at +* index 0 is never used. That is, +* +*

constPool.getEntryAtIndex(0).isUnused() == true;
+* +* Another quirk of the constant pool is that LONG and DOUBLE +* entries take up "two" indexes. That is, +* +*
short longIndex = constPool.addEntry(new ConstPoolEntry().setLong(0));
+* constPool.getEntryAtIndex(longIndex+1).isUnused() == true;
+* +* @see ConstPoolEntry +* @see Signature +*/ +public class ConstPool { + private Vector cp = new Vector(); + // for efficiency, addEntry() caches elements in a hashtable, which is + // used by getEntryAtIndex(). Caching reduces the time required to + // read ClassFileWriter.class from ~10s to ~7.5s. + private Hashtable cpHash = new Hashtable(); + + /** + * Get the size of the pool. + */ + public int size() { + return cp.size(); + } + + /** + * Add a constant pool entry, whether or not it's already in the pool. + * If the entry is a LONG or DOUBLE, a second, unused entry is + * also added. + * @returns the index of the added entry. + */ + public int addEntry(ConstPoolEntry entry) { + cp.addElement(entry); + int result = size() - 1; + cpHash.put(entry, new Integer(result)); + // LONG and DOUBLE entries take up two entries + if (entry.typecode() == ConstPoolEntry.LONG + || entry.typecode() == ConstPoolEntry.DOUBLE) + cp.addElement(new ConstPoolEntry().setUnused()); + return result; + } + + /** + * Get the const pool entry at a given index. + */ + public ConstPoolEntry getEntryAtIndex(int index) { + return (ConstPoolEntry)cp.elementAt(index); + } + + /** + * Return the index of a constant pool entry equal to the specified one. + * If there is no matching entry in the pool yet, -1 is returned. Comparisons + * are by value, not by reference. + */ + public int getIndexOfEntryNoAdd(ConstPoolEntry entry) { + Integer i = (Integer)cpHash.get(entry); + if (i != null) + return i.intValue(); + return -1; + } + + /** + * Return the index of a constant pool entry equal to the specified one. + * If there is no matching entry in the pool yet, a clone of the specified + * entry is added. Comparisons are made by value, not by reference. + */ + public int getIndexOfEntryAdd(ConstPoolEntry entry) { + int result = getIndexOfEntryNoAdd(entry); + if (result < 0) + result = addEntry((ConstPoolEntry)entry.clone()); + return result; + } + + // used for doing searches -- reuse so we don't have to allocate a new + // one every time. + private ConstPoolEntry searchEntry = new ConstPoolEntry(); + + /** + * Convenience method to return the index of the UTF const pool entry + * equal to the given string. If there is no matching entry in the const pool yet, + * a new one is added. Without this method, something like the following code + * would be used: + *
constPool.getIndexOfEntryAdd(new ConstPoolEntry().setUTF(str));
+ * This method avoids the overhead of allocating a ConstPoolEntry every time. + */ + public int getIndexOfUTFAdd(String str) { + return getIndexOfEntryAdd(searchEntry.setUTF(str)); + } + + /** + * Convenience method to return the index of the CLASS const pool entry + * whose classname is equal to the given string. If there is no matching entry in + * the const pool yet, a new one is added. Without this method, something like + * the following code would be used: + *
short nameIndex = constPool.getIndexOfUTFAdd(classname);
+   * constPool.getIndexEntryAdd(new ConstPoolEntry().setClass(nameIndex));
+ * This method avoids the overhead of allocating a ConstPoolEntry every time. + */ + public int getIndexOfClassAdd(String classname) { + searchEntry.setClass(getIndexOfUTFAdd(classname)); + return getIndexOfEntryAdd(searchEntry); + } + + /** + * Read in the constant pool from a stream. + * @throws ClassFileReadException if the class file is corrupt. + * @throws IOException if the DataInput throws an IOException. + */ + public void read(DataInput in) throws IOException { + int count = in.readShort(); + + if (Debug.strConstPool != null) + Debug.println(Debug.strConstPool, + "# of entries = " + count); + + // entry 0 is unused + addEntry(new ConstPoolEntry().setUnused()); + // note: start i at 1 because 0 is unused + for (int i = 1; i < count; i++) { + ConstPoolEntry entry = new ConstPoolEntry(); + entry.read(in, entry); + + if (Debug.strConstPool != null) + Debug.println(Debug.strConstPool, + i + " " + entry.toString()); + + addEntry(entry); + // LONG and DOUBLE entries take up two slots + if (ConstPoolEntry.LONG == entry.typecode() + || ConstPoolEntry.DOUBLE == entry.typecode()) + i++; + } + } + + // return total number of constant entries + public int totalConstantEntries() { + int num=0; + + for(int i=0;i>23)&0xff); + ival &= 0x007fffff; + + if (exponent==0xff) + exponent=0x7f; + else if (exponent!=0x00) + exponent-=0x40; + + ival |= (exponent<<23); + if (sign) + ival |= 0x40000000; + + ival &= 0x7fffffff; + return ival; + } + + static int encodeInt(int val) { + val = val & 0x7fffffff; + return val; + } + + + // referenz auf diese klasse mitgeben + public int constantRelocate(int index) { + ConstPoolEntry entry = getEntryAtIndex(index); + int id = 0xffff; + + System.out.print(" -> "); + + if(entry.typecode() == ConstPoolEntry.CLASS) { + String className = getEntryAtIndex( + entry.getClassNameIndex()).getString(); + + System.out.print("class, " + className); + + // check if there's a local class with this name + id = ClassLoader.getClassIndex(className); + if(id >= 0) + System.out.println("local id: #" + Integer.toHexString(id<<8)); + else { + id = NativeMapper.getNativeClassId(className); + if(id >= 0) + System.out.println("native id: #" + Integer.toHexString(id<<8)); + else { + System.out.println("Unable to map class reference"); + System.exit(-1); + } + } + id <<= 8; // class id + } + + else if(entry.typecode() == ConstPoolEntry.FIELDREF) { + System.out.print("field " + getClassName(entry) + ":" + + getFieldName(entry) +"."+ getFieldType(entry) + ", "); + + // check if this is a local field + // try to get the local method index + if(ClassLoader.fieldExists( + getClassName(entry), getMethodName(entry), getMethodType(entry))) { + System.out.print("local, "); + + // check if static or not + FieldInfo fieldInfo = ClassLoader.getFieldInfo( + getClassName(entry), getMethodName(entry), getMethodType(entry)); + + if((fieldInfo.getAccessFlags() & AccessFlags.STATIC) != 0) { + // index is the number of field in this whole set of classes + id = ClassLoader.getStaticFieldIndex(getClassName(entry), + getMethodName(entry), getMethodType(entry)); + + System.out.println("static id: #" + Integer.toHexString(id)); + } else { + // non-static, get access to class it resides in + ClassInfo classInfo = ClassLoader.getClassInfo(getClassName(entry)); + + // index is the number of non static fields in this local class + id = classInfo.getFieldIndex(0, getMethodName(entry), getMethodType(entry)); + + // plus the total number of fields in the super classes + // walk through all super classes + String className = getClassName(entry); + while(NativeMapper.getNativeClassId(ClassLoader. + getSuperClassName(className)) == -1) { + className = ClassLoader.getSuperClassName(className); + id += ClassLoader.getClassInfo(className).nonStaticFields(); + } + System.out.println("non static id: #" + Integer.toHexString(id)); + } + + } else { + // we only support static native fields + id = NativeMapper.getFieldId( + getClassName(entry), getMethodName(entry), getMethodType(entry)); + + if(id == -1) { + System.out.println("Unable to map field reference"); + System.out.println("class="+getClassName(entry)+" method="+getMethodName(entry)+" type="+getMethodType(entry)); + System.exit(-1); + } + + System.out.println("native, id: #" + Integer.toHexString(id)); + } + } + + else if(entry.typecode() == ConstPoolEntry.STRING) { + String str = getEntryAtIndex(entry.getStringIndex()).getString(); + System.out.print("string \"" + str + "\", "); + + // search for this string + for(int i=0;i missing"); + + // try to load appropriate class + ClassLoader.load(getClassName(entry)); + } else + System.out.println(" -> already present"); + } else + System.out.println(" -> native"); + } + } + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/ConstPoolEntry.java epos--jvm/nanovmtool/src/org/nanovm/converter/ConstPoolEntry.java --- epos--/nanovmtool/src/org/nanovm/converter/ConstPoolEntry.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/ConstPoolEntry.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,418 @@ +package org.nanovm.converter; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +import java.io.*; + +public final class ConstPoolEntry implements Cloneable { + public static final int UTF = 1; + public static final int UNICODE = 2; + public static final int INT = 3; + public static final int FLOAT = 4; + public static final int LONG = 5; + public static final int DOUBLE = 6; + public static final int CLASS = 7; + public static final int STRING = 8; + public static final int FIELDREF = 9; + public static final int METHODREF = 10; + public static final int INTERFACEMETHODREF = 11; + public static final int NAMEANDTYPE = 12; + + private byte typecode = -1; + + private String stringValue; + private int intValue; + private long longValue; + private float floatValue; + private double doubleValue; + private int index1, index2; + + public boolean equals(Object o) { + ConstPoolEntry other; + try { + other = (ConstPoolEntry)o; + } catch (ClassCastException e) { + return false; + } + + // For equality purposes, UTF and UNICODE typecodes are equivalent. + // We special case UTF and UNICODE comparison by ignoring typecode and + // just looking at stringValue. + if (stringValue != null && other.stringValue != null) + return stringValue.equals(other.stringValue); + + if (typecode != other.typecode) + return false; + + // This relies on fact that all unused fields are 0. + return (other.intValue == intValue && + other.longValue == longValue && + other.index1 == index1 && + other.index2 == index2 && + other.floatValue == floatValue && + other.doubleValue == doubleValue); + } + + public int hashCode() { + int result = typecode * 97; + if (stringValue != null) + result += stringValue.hashCode()*43; + result += intValue*37 + longValue*31 + index1*29 + index2*23; + return result; + } + + public Object clone() { + ConstPoolEntry result = new ConstPoolEntry(); + result.typecode = typecode; + result.stringValue = stringValue; + result.intValue = intValue; + result.longValue = longValue; + result.index1 = index1; + result.index2 = index2; + result.floatValue = floatValue; + result.doubleValue = doubleValue; + return result; + } + + public String toString() { + if (UTF == typecode) + return "UTF \"" + stringValue + "\""; + else if (UNICODE == typecode) + return "UNICODE \"" + stringValue + "\""; + else if (INT == typecode) + return "INT " + intValue; + else if (FLOAT == typecode) + return "FLOAT " + floatValue; + else if (LONG == typecode) + return "LONG " + longValue; + else if (DOUBLE == typecode) + return "DOUBLE " + doubleValue; + else if (CLASS == typecode) + return "CLASS " + index1; + else if (STRING == typecode) + return "STRING " + index1; + else if (FIELDREF == typecode) + return "FIELDREF " + index1 + " " + index2; + else if (METHODREF == typecode) + return "METHODREF " + index1 + " " + index2; + else if (INTERFACEMETHODREF == typecode) + return "INTERFACEMETHODREF " + index1 + " " + index2; + else if (NAMEANDTYPE == typecode) + return "NAMEANDTYPE " + index1 + " " + index2; + else + return "Unknown typecode " + typecode; + } + + public byte typecode() { + return typecode; + } + + // used by set methods to erase evidence of any previous set method + private void clearType() { + typecode = -1; + stringValue = null; + index1 = 0; + index2 = 0; + intValue = 0; + longValue = 0; + floatValue = 0; + doubleValue = 0; + } + /** + * Some const pool entries don't actually exist -- like the ones after a + * LONG or DOUBLE, or entry 0. These entries are unused. + */ + public ConstPoolEntry setUnused() { + typecode = -1; + return this; + } + + public boolean isUnused() { + return (typecode == -1); + } + + public ConstPoolEntry setUTF(String value) { + clearType(); + typecode = UTF; + stringValue = value; + if (null == stringValue) + throw new ConstPoolEntryError("ConstPoolEntry.setUTF called with null string"); + return this; + } + + public ConstPoolEntry setUnicode(String value) { + clearType(); + typecode = UNICODE; + stringValue = value; + if (null == stringValue) + throw new ConstPoolEntryError("ConstPoolEntry.setUTF called with null string"); + return this; + } + + public ConstPoolEntry setInt(int value) { + clearType(); + typecode = INT; + intValue = value; + return this; + } + + public ConstPoolEntry setLong(long value) { + clearType(); + typecode = LONG; + longValue = value; + return this; + } + + public ConstPoolEntry setFloat(float value) { + clearType(); + typecode = FLOAT; + floatValue = value; + return this; + } + + public ConstPoolEntry setDouble(double value) { + clearType(); + typecode = DOUBLE; + doubleValue = value; + return this; + } + + public ConstPoolEntry setString(int index) { + clearType(); + typecode = STRING; + index1 = index; + return this; + } + + public ConstPoolEntry setClass(int index) { + clearType(); + typecode = CLASS; + index1 = index; + return this; + } + + public ConstPoolEntry setFieldRef(int index1, int index2) { + clearType(); + typecode = FIELDREF; + this.index1 = index1; + this.index2 = index2; + return this; + } + + public ConstPoolEntry setMethodRef(int index1, int index2) { + clearType(); + typecode = METHODREF; + this.index1 = index1; + this.index2 = index2; + return this; + } + + public ConstPoolEntry setInterfaceMethodRef(int index1, int index2) { + clearType(); + typecode = INTERFACEMETHODREF; + this.index1 = index1; + this.index2 = index2; + return this; + } + + public ConstPoolEntry setNameAndType(int index1, int index2) { + clearType(); + typecode = NAMEANDTYPE; + this.index1 = index1; + this.index2 = index2; + return this; + } + + + /** + * For UTF and UNICODE entries. + */ + public String getString() { + if (UTF == typecode || UNICODE == typecode) + return stringValue; + throw getError("getString()"); + } + + /** + * For STRING entries. + */ + public int getStringIndex() { + if (STRING == typecode) + return index1; + throw getError("getStringIndex()"); + } + + /** + * For INT entries. + */ + public int getInt() { + if (INT == typecode) + return intValue; + throw getError("getInt()"); + } + + /** + * For LONG entries. + */ + public long getLong() { + if (LONG == typecode) + return longValue; + throw getError("getLong()"); + } + + /** + * For FLOAT entries. + */ + public float getFloat() { + if (FLOAT == typecode) + return floatValue; + throw getError("getFloat()"); + } + + /** + * For DOUBLE entries. + */ + public double getDouble() { + if (DOUBLE == typecode) + return doubleValue; + throw getError("getDouble()"); + } + + /** + * For INT, LONG, FLOAT, DOUBLE, UTF, or UNICODE entries, + * returns an Integer, Long, Float, Double, or String, respectively. + */ + public Object getPrimitiveTypeValue() { + if (UTF == typecode || UNICODE == typecode) return stringValue; + if (INT == typecode) return new Integer(intValue); + if (LONG == typecode) return new Long(longValue); + if (FLOAT == typecode) return new Float(floatValue); + if (DOUBLE == typecode) return new Double(doubleValue); + throw getError("getPrimitiveTypeValue()"); + } + + /** + * For CLASS entries. + */ + public int getClassNameIndex() { + if (CLASS == typecode) + return index1; + throw getError("getClassNameIndex()"); + } + + /** + * For FIELDREF, METHODREF, or INTERFACEMETHODREF entries. + */ + public int getClassIndex() { + if (FIELDREF == typecode || METHODREF == typecode + || INTERFACEMETHODREF == typecode) + return index1; + throw getError("getClassIndex()"); + } + + /** + * For FIELDREF, METHODREF, or INTERFACEMETHODREF entries. + */ + public int getNameAndTypeIndex() { + if (FIELDREF == typecode || METHODREF == typecode + || INTERFACEMETHODREF == typecode) + return index2; + throw getError("getNameAndTypeIndex()"); + } + + /** + * For NAMEANDTYPE entries. + */ + public int getNameIndex() { + if (NAMEANDTYPE == typecode) + return index1; + throw getError("getNameIndex()"); + } + + /** + * For NAMEANDTYPE entries. + */ + public int getTypeIndex() { + if (NAMEANDTYPE == typecode) + return index2; + throw getError("getTypeIndex()"); + } + + // utility method -- called when getXXXX() is + // called for inappropriate typecode + private ConstPoolEntryError getError(String method) { + return new ConstPoolEntryError(method + + " called on ConstPoolEntry with typecode " + + typecode()); + } + + public void read(DataInput in, ConstPoolEntry entry) + throws IOException { + byte tag = in.readByte(); + switch (tag) { + case UTF: + entry.setUTF(in.readUTF()); + break; + case UNICODE: + int length = in.readShort(); + char[] chars = new char[length]; + for (int i = 0; i < length; i++) + chars[i] = in.readChar(); + String str = new String(chars); + entry.setUnicode(str); + break; + case INT: + entry.setInt(in.readInt()); + break; + case FLOAT: + entry.setFloat(in.readFloat()); + break; + case LONG: + entry.setLong(in.readLong()); + break; + case DOUBLE: + entry.setDouble(in.readDouble()); + break; + case CLASS: + entry.setClass(in.readShort()); + break; + case STRING: + entry.setString(in.readShort()); + break; + case FIELDREF: + entry.setFieldRef(in.readShort(), in.readShort()); + break; + case METHODREF: + entry.setMethodRef(in.readShort(), in.readShort()); + break; + case INTERFACEMETHODREF: + entry.setInterfaceMethodRef(in.readShort(), in.readShort()); + break; + case NAMEANDTYPE: + entry.setNameAndType(in.readShort(), in.readShort()); + break; + default: + throw new IOException("Unknown constant pool tag: " + tag); + } + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/ConstPoolEntryError.java epos--jvm/nanovmtool/src/org/nanovm/converter/ConstPoolEntryError.java --- epos--/nanovmtool/src/org/nanovm/converter/ConstPoolEntryError.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/ConstPoolEntryError.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,36 @@ +package org.nanovm.converter; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +/** +* An instance of this class is thrown when a ConstPoolEntry is +* used incorrectly. For example, calling setUTF(null), or calling +* getClassName() on an entry of type INT. It is a subclass of +* Error instead of Exception because checking for it all the time +* would make working with ConstPoolEntries very tedious. +*/ +public class ConstPoolEntryError extends Error { + public ConstPoolEntryError(String msg) { + super(msg); + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/Converter.java epos--jvm/nanovmtool/src/org/nanovm/converter/Converter.java --- epos--/nanovmtool/src/org/nanovm/converter/Converter.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/Converter.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.nanovm.converter; + +import org.nanovm.NanoVMByteCode; + +/** + * + * @author nils + */ +public class Converter { + + public static NanoVMByteCode convert(String config, String classpath, String classname) { + Config.load(config); + ClassLoader.setClassPath(classpath); + ClassLoader.load(classname); + NanoVMByteCode code = new NanoVMByteCode(Config.getMaxSize()); + Generator gen = new Generator(); + gen.generate(code); + return code; + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/Debug.java epos--jvm/nanovmtool/src/org/nanovm/converter/Debug.java --- epos--/nanovmtool/src/org/nanovm/converter/Debug.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/Debug.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,103 @@ +package org.nanovm.converter; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +import java.io.PrintStream; + +/** +* All classfile debugging information gets piped through this class. +* You can turn off categories of debug information by setting the +* appropriate String to null. +*/ +public class Debug { + public static String strClass = "class: "; + public static String strConstPool = "CP: "; + public static String strField = "field: "; + public static String strMethod = "method: "; + public static String strCode = "code: "; + public static String strInterface = "interface: "; + public static String strLineNumbers = "line numbers: "; + public static String strLocalVariables = "local variables: "; + public static String strInnerClasses = "inner classes: "; + public static String strUnknownAttribute = "unknown attribute: "; + public static String strBadData = "bad data: "; + + /** + * Indent subsequent messages. Subsequent messages will be indented by + * two spaces until outdent() is called. All calls to indent() should eventually + * be followed by a call to outdent(). + */ + public static void indent() { + indentLevel++; + } + /** + * Outdent subsequent messages. This should only be called after a previous + * call to indent(). + */ + public static void outdent() { + indentLevel--; + } + + /** + * Enable or disable printing of any debug message. + */ + public static void setEnabled(boolean e) { + enabled = e; + } + /** + * Get whether printing of debug messages is enabled. + */ + public static boolean isEnabled() { + return enabled; + } + + /** + * Redirect where debug messages are sent. + */ + public static void setOutput(PrintStream out) { + msgs = out; + } + /** + * Get the destination of debug messages. + */ + public static PrintStream getOutput() { + return msgs; + } + + /** + * Print a debug message. If the prefix is null, the message is not printed. + * The message will be prefixed by blank space, the length of which is + * determined by the current level of indentation. + */ + public static void println(String prefix, String msg) { + if (enabled && prefix != null) { + for (int i = 0; i < indentLevel; i++) + msgs.print(" "); + msgs.println(prefix + msg); + } + } + + private static PrintStream msgs = System.out; + private static boolean enabled = true; + private static int indentLevel = 0; +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/ExceptionInfo.java epos--jvm/nanovmtool/src/org/nanovm/converter/ExceptionInfo.java --- epos--/nanovmtool/src/org/nanovm/converter/ExceptionInfo.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/ExceptionInfo.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,57 @@ +package org.nanovm.converter; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +import java.io.*; + +/** +* A class for storing information about the exception table of a method. +* This class represents one row in the ExceptionTable. +* +* @see sli.kim.classfile.CodeInfo#setExceptionTable() +*/ +public class ExceptionInfo { + public short startPC, endPC, handlerPC; + public String catchType; + + /** + * Construct an ExceptionInfo + * + * @param startPC the index of the first instruction in the try block (that is, + * startPC is inclusive). + * @param endPC the index of the first instruction not in the try block (that is, + * endPC is exclusive). If the try block extends to the end of the method, + * endPC will be equal to the length of the bytecode for the method. + * @param handlerPC the index of the first instruction of the catch handler. + * @param catchType the name of the exception class caught by the catch + * handler. If this parameter is null, the handler catches all exceptions (this + * is used for finally blocks). + */ + public ExceptionInfo(short startPC, short endPC, short handlerPC, String catchType) + { + this.startPC = startPC; + this.endPC = endPC; + this.handlerPC = handlerPC; + this.catchType = catchType; + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/FieldInfo.java epos--jvm/nanovmtool/src/org/nanovm/converter/FieldInfo.java --- epos--/nanovmtool/src/org/nanovm/converter/FieldInfo.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/FieldInfo.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,85 @@ +package org.nanovm.converter; + + +import org.nanovm.converter.CommonInfo; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +/** +* A class for storing information about fields. +* +* @see ClassInfo#addField() +*/ +public class FieldInfo extends CommonInfo { + private String signature; + private Object constValue; + private boolean synthetic; + + public FieldInfo(short accessFlags, String name, String signature) { + setAccessFlags(accessFlags); + setName(name); + setSignature(signature); + } + + /** + * Set the signature of the field. For example "[Ljava/lang/String;" + * + * @see Signature + */ + public void setSignature(String signature) { + this.signature = signature; + } + + /** + * Get the signature of the field. + * + * @see Signature + */ + public String getSignature() { + return signature; + } + + /** + * Set the constant value of this field. This only applies to final fields. + * The value must be a String, Integer, Long, Float, or Double. + */ + public void setConstantValue(Object constValue) { + this.constValue = constValue; + } + + /** + * Get the constant value of this field. The result must be a String, + * Integer, Long, Float, or Double. + */ + public Object getConstantValue() { + return constValue; + } + + public void setSynthetic(boolean synthetic) { + this.synthetic = synthetic; + } + + public boolean isSynthetic() { + return synthetic; + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/Generator.java epos--jvm/nanovmtool/src/org/nanovm/converter/Generator.java --- epos--/nanovmtool/src/org/nanovm/converter/Generator.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/Generator.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,181 @@ +package org.nanovm.converter; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +// +// UVMWriter.java +// +import org.nanovm.*; + +public class Generator { + + private NanoVMByteCode code; + static final int MAGIC = 0xBE000000; + static final int VERSION = 2; + int cur; + + void updateHeader() throws ConvertException { + int old_cur = cur; + cur = 0; + writeHeader(); + cur = old_cur; + } + + // write uvm file header + void writeHeader() throws ConvertException { + int offset = 15; // header size: 15 bytes + + code.write32(MAGIC | UsedFeatures.get()); + code.write8(VERSION); + code.write8(ClassLoader.totalMethods()); + code.write16(ClassLoader.getMainIndex()); + + // offset to constant data + offset += 2 * ClassLoader.totalClasses(); // class header size: 2bytes + code.write16(offset); + + // offset to string data + offset += 4 * ClassLoader.totalConstantEntries(); // constant value size: 4bytes + code.write16(offset); + + // offset to method data + offset += 2 * ClassLoader.totalStrings(); // string indices + offset += ClassLoader.totalStringSize(); // string data + code.write16(offset); + code.write8(ClassLoader.totalStaticFields()); // static fields + } + + // write all class headers + void writeClassHeaders() throws ConvertException { + for (int i = 0; i < ClassLoader.totalClasses(); i++) { + ClassInfo classInfo = ClassLoader.getClassInfo(i); + + code.write8(classInfo.getSuperClassIndex()); + code.write8(classInfo.nonStaticFields()); + } + } + + // write all 32bit constant values + void writeConstantEntries() throws ConvertException { + System.out.println("Writing " + ClassLoader.totalConstantEntries() + " constant entries"); + for (int i = 0; i < ClassLoader.totalConstantEntries(); i++) { + System.out.println(" entry[" + i + "] = 0x" + Integer.toHexString(ClassLoader.getConstantEntry(i))); + code.write32(ClassLoader.getConstantEntry(i)); + } + } + + // write all string headers and data + void writeStrings() throws ConvertException { + System.out.println("Writing " + ClassLoader.totalStrings() + " strings"); + + // write array of string offsets + int offset = 2 * ClassLoader.totalStrings(); + for (int i = 0; i < ClassLoader.totalStrings(); i++) { + code.write16(offset); + offset += ClassLoader.getString(i).length() + 1; + } + + // write the strings itself + for (int i = 0; i < ClassLoader.totalStrings(); i++) { + String str = ClassLoader.getString(i); + System.out.println(" entry[" + (i + ClassLoader.totalConstantEntries()) + "] = \"" + str + "\""); + + // write zero terminated c strings + for (int j = 0; j < str.length(); j++) { + code.write8(str.charAt(j)); + } + code.write8(0); + } + } + + // write all methods + void writeMethods() throws ConvertException { + int codeOffset = 0; + + // build the method id table + MethodIdTable.build(); + + // write all Method headers + for (int i = 0; i < ClassLoader.totalMethods(); i++) { + MethodInfo methodInfo = ClassLoader.getMethod(i); + + // offset from this header to bytecode (this header is 8 bytes + // in size) + code.write16((ClassLoader.totalMethods() - i) * 8 + codeOffset); // code_index + code.write16((ClassLoader.getClassIndex(i) << 8) + + MethodIdTable.getEntry(i)); // id + code.write8(methodInfo.getName().equals("") ? 1 : 0); // flags + code.write8(methodInfo.getArgs()); // args + code.write8(methodInfo.getCodeInfo().getMaxLocals()); // max_locals + code.write8(methodInfo.getCodeInfo().getMaxStack()); // max_stack + + codeOffset += methodInfo.getCodeInfo().getBytecode().length; + } + + // write bytecode + for (int i = 0; i < ClassLoader.totalMethods(); i++) { + ClassInfo classInfo = ClassLoader.getClassInfoFromMethodIndex(i); + MethodInfo methodInfo = ClassLoader.getMethod(i); + + System.out.println("Converting " + + classInfo.getName() + "." + + methodInfo.getName() + ":" + + methodInfo.getSignature()); + + byte bcode[] = ClassLoader.getMethod(i).getCodeInfo().getBytecode(); + + // adjust references etc + CodeTranslator.translate(classInfo, bcode); + + // and write bytecode + for (int j = 0; j < bcode.length; j++) { + code.write8(bcode[j]); + } + + System.out.println(""); + } + } + + public Generator() { + } + + public void generate(NanoVMByteCode code) { + this.code = code; + System.out.println("Generating unified class file ..."); + + // create output buffer and reset output pointer + cur = 0; + + try { + writeHeader(); // write file header + writeClassHeaders(); // write class headers + writeConstantEntries(); // write all 32-bit constants + writeStrings(); // write all string data + writeMethods(); // write method headers and byte code + updateHeader(); // update feature values + } catch (ConvertException e) { + System.out.println("Conversion failed: " + e.toString()); + System.exit(-1); + } + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/InnerClassInfo.java epos--jvm/nanovmtool/src/org/nanovm/converter/InnerClassInfo.java --- epos--/nanovmtool/src/org/nanovm/converter/InnerClassInfo.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/InnerClassInfo.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,54 @@ +package org.nanovm.converter; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +/** +* A class for storing information about inner classes. +* This class represents one row in the InnerClasses table. +* +* @see sli.kim.classfile.ClassInfo#setInnerClasses() +*/ +public class InnerClassInfo { + public String innerClass, outerClass, simpleName; + public short flags; + + /** + * Construct an inner class record. + * + * @param innerClass the full name of the inner class (eg "mypackage.Foo$Bar") + * @param outerClass the full name of the outer class. This is null for non-member + * classes (that is, classes that are declared static) + * @param simpleName the simple name of the class (eg "String"). This is null for + * anonymous classes. + * @param the access flags of the class. When an inner class is compiled to a .class + * file, the compiler changes its access flags to ensure compatibility with pre-1.1 + * virtual machines. Specifically, protected becomes public, and private becomes + * package. + */ + public InnerClassInfo(String innerClass, String outerClass, String simpleName, short flags) { + this.innerClass = innerClass; + this.outerClass = outerClass; + this.simpleName = simpleName; + this.flags = flags; + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/LineNumberInfo.java epos--jvm/nanovmtool/src/org/nanovm/converter/LineNumberInfo.java --- epos--/nanovmtool/src/org/nanovm/converter/LineNumberInfo.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/LineNumberInfo.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,40 @@ +package org.nanovm.converter; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +import java.io.*; + +/** +* A class for storing information about line numbers. +* This class represents one row in the LineNumberTable. +* +* @see sli.kim.classfile.CodeInfo#setLineNumberTable() +*/ +public class LineNumberInfo { + public short startPC, lineNumber; + + public LineNumberInfo(short startPC, short lineNumber) { + this.startPC = startPC; + this.lineNumber = lineNumber; + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/LocalVariableInfo.java epos--jvm/nanovmtool/src/org/nanovm/converter/LocalVariableInfo.java --- epos--/nanovmtool/src/org/nanovm/converter/LocalVariableInfo.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/LocalVariableInfo.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,46 @@ +package org.nanovm.converter; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +import java.io.*; + +/** +* A class for storing information about local variables. +* This class represents one row in the LocalVariableTable. +* +* @see sli.kim.classfile.CodeInfo#setLocalVariableTable() +*/ +public class LocalVariableInfo { + public short startPC, length, slot; + public String name, signature; + + public LocalVariableInfo(short startPC, short length, String name, + String signature, short slot) + { + this.startPC = startPC; + this.length = length; + this.name = name; + this.signature = signature; + this.slot = slot; + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/MethodIdTable.java epos--jvm/nanovmtool/src/org/nanovm/converter/MethodIdTable.java --- epos--/nanovmtool/src/org/nanovm/converter/MethodIdTable.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/MethodIdTable.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,66 @@ +package org.nanovm.converter; + + +import org.nanovm.converter.ClassLoader; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +// +// MethodIdTable.java +// + +public class MethodIdTable { + private static int[] mindex; + + // build the complete method id table + public static void build() { + mindex = new int[ClassLoader.totalMethods()]; + + // clear index table + for(int i=0;i +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +import org.nanovm.converter.CommonInfo; +import org.nanovm.converter.AccessFlags; +import java.util.Vector; + +/* +* A class for storing information about methods. +*/ +public class MethodInfo extends CommonInfo { + private String signature; + private Vector exceptions = new Vector(); + private CodeInfo codeInfo; + private boolean deprecated; + + public MethodInfo(short accessFlags, String name, String signature) { + setAccessFlags(accessFlags); + setName(name); + setSignature(signature); + } + + /* + * Set the signature of the method. For example "([I,S)Ljava/lang/String;" + */ + public void setSignature(String signature) { + this.signature = signature; + } + + // parse signature for number of arguments + public int getArgs() { + int args = 0, cur = 0; + + if(signature.charAt(cur++) != '(') { + System.out.println("MethodInfo.getArgs: Invalid type string"); + System.exit(-1); + } + + while(signature.charAt(cur) != ')') { + if((signature.charAt(cur) == 'B')|| // byte + (signature.charAt(cur) == 'C')|| // unicode char + (signature.charAt(cur) == 'I')|| // integer + (signature.charAt(cur) == 'S')|| // short + (signature.charAt(cur) == 'F')|| // float + (signature.charAt(cur) == 'Z')) // boolean + args++; + + else if(signature.charAt(cur) == 'L') { // instance of class + while(signature.charAt(cur) != ';') cur++; + args++; + } + + else if(signature.charAt(cur) == '[') { + // ignore + } else { + System.out.println("MethodInfo.getArgs: Unexpected char in type: '"+signature.charAt(cur)+"'"); + System.exit(-1); + } + + cur++; + } + + // non-static methods have an hidden extra argument: the reference + if((getAccessFlags() & AccessFlags.STATIC) == 0) args++; + + return args; + } + + /* + * Get the signature of the method. + */ + public String getSignature() { + return signature; + } + + /* + * Add a checked exception that the method throws. + */ + public void addException(String exceptionName) { + exceptions.addElement(exceptionName); + } + + /* + * Set information about this method's code. The CodeInfo need + * not be entirely filled in before this method is called. + */ + public void setCodeInfo(CodeInfo codeInfo) { + this.codeInfo = codeInfo; + } + + /* + * Get the information about this method's code. If the method + * has no code, this will return null. + */ + public CodeInfo getCodeInfo() { + return codeInfo; + } + + /* + * Set whether this method is deprecated. Methods are not + * deprecated until setDeprecated(true) is called. + */ + public void setDeprecated(boolean d) { + deprecated = d; + } + + /* + * Get whether this method is deprecated. Methods are not + * deprecated until setDeprecated(true) is called. + */ + public boolean isDeprecated() { + return deprecated; + } +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/converter/NativeMapper.java epos--jvm/nanovmtool/src/org/nanovm/converter/NativeMapper.java --- epos--/nanovmtool/src/org/nanovm/converter/NativeMapper.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/converter/NativeMapper.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,244 @@ +package org.nanovm.converter; + +// +// NanoVMTool, Converter and Upload Tool for the NanoVM +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +// +// NativeMapper.java +// + +import java.io.*; +import java.util.*; + +public class NativeMapper { + static private Vector nativeClasses = new Vector(); + static private Vector nativeMethods = new Vector(); + static private Vector nativeFields = new Vector(); + static public int lowestNativeId = 9999; // lowest native class id + + // java doesn't have native classes, but we do + class NativeClass { + String className; + int id; + } + + class NativeMethod { + String className; + String name; + String type; + int id; + } + + class NativeField { + String className; + String name; + String type; + int id; + } + + public NativeMapper() { + System.out.println("Initializing native mapper"); + } + + public void load(String className) { + System.out.println("read native " + className); + + System.out.println("trying to load "+ className + ".native"); // XXXX + File inputFile = new File(className + ".native"); + + try { + String line; + String fullClassName = null; + int fullClassId = 0; + + FileInputStream in = new FileInputStream(inputFile); + BufferedReader reader = new BufferedReader + (new InputStreamReader(in)); + + // read through all lines in file + while ((line = reader.readLine()) != null) { + StringTokenizer st = new StringTokenizer(line); + boolean skipRest = false; + int token_cnt = 0; + String name = null, value = null, id = null; + + while(st.hasMoreTokens() && !skipRest) { + String token = st.nextToken(); + + if(token.charAt(0) == '#') + skipRest = true; + else { + NativeMethod nativeMethod = new NativeMethod(); + + if(token_cnt == 0) name = token; + else if(token_cnt == 1) value = token; + else if(token_cnt == 2) id = token; + else { + System.out.println("Ignoring superfluous data: " + token); + } + + token_cnt++; + } + } + + if(token_cnt > 0) { + // class entry + if(name.equalsIgnoreCase("class") && (token_cnt == 3)) { + NativeClass nativeClass = new NativeClass(); + nativeClass.className = value; + nativeClass.id = Integer.parseInt(id); + nativeClasses.addElement(nativeClass); + + if(Integer.parseInt(id) < lowestNativeId) + lowestNativeId = Integer.parseInt(id); + + // save locally for further method processing + fullClassName = value; + fullClassId = Integer.parseInt(id); + } + // method entry + else if(name.equalsIgnoreCase("method") && (token_cnt == 3)) { + if(value.indexOf(':') == -1) { + System.out.println("Invalid method reference"); + System.exit(-1); + } + + if(fullClassName == null) { + System.out.println("Method reference before class"); + System.exit(-1); + } + + // seperate class, method and type + NativeMethod nativeMethod = new NativeMethod(); + nativeMethod.className = fullClassName; + nativeMethod.name = value.substring(0, value.indexOf(':')); + nativeMethod.type = value.substring( + value.indexOf(':')+1, value.length()); + nativeMethod.id = Integer.parseInt(id) + (fullClassId << 8); + + nativeMethods.addElement(nativeMethod); + } + + // field entry + else if(name.equalsIgnoreCase("field") && (token_cnt == 3)) { + if(value.indexOf(':') == -1) { + System.out.println("Invalid field reference"); + System.exit(-1); + } + + if(fullClassName == null) { + System.out.println("Method reference before class"); + System.exit(-1); + } + + // seperate class, method and type + NativeField nativeField = new NativeField(); + nativeField.className = fullClassName; + nativeField.name = value.substring(0, value.indexOf(':')); + nativeField.type = value.substring( + value.indexOf(':')+1, value.length()); + nativeField.id = Integer.parseInt(id) + (fullClassId << 8); + + nativeFields.addElement(nativeField); + } + + else { + System.out.println("Unknown entry in native file: " + name + + " + " + token_cnt + " parms"); + System.exit(-1); + } + } + } + + in.close(); + } catch(IOException e) { + System.out.println("Error reading map"); + System.out.println(e.toString()); + System.exit(-1); + } + } + + public static boolean methodIsNative(String className, + String name, String type) { + + // search through all native methods + for(int i=0;i +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// Parts of this tool are based on public domain code written by Kimberley +// Burchett: http://www.kimbly.com/code/classfile/ +// + +import java.util.Vector; + +/* +* A class for storing information about methods. +*/ + +public class UsedFeatures { + static final int LOOKUPSWITCH = (1<<0); + static final int TABLESWITCH = (1<<1); + static final int BIT32 = (1<<2); + static final int FLOAT = (1<<3); + static final int ARRAY = (1<<4); + static final int INHERITANCE = (1<<5); + static final int EXTSTACK = (1<<6); + + private static int features; + + public static void add(int f){ + features |= f; + } + + public static int get(){ + System.out.println("Feature value is 0x"+Integer.toHexString(features)); + return features; + } + +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/gui/MainFrame.form epos--jvm/nanovmtool/src/org/nanovm/gui/MainFrame.form --- epos--/nanovmtool/src/org/nanovm/gui/MainFrame.form 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/gui/MainFrame.form 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,165 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/gui/MainFrame.java epos--jvm/nanovmtool/src/org/nanovm/gui/MainFrame.java --- epos--/nanovmtool/src/org/nanovm/gui/MainFrame.java 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/gui/MainFrame.java 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,179 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * MainFrame.java + * + * Created on 22.05.2009, 17:14:54 + */ + +package org.nanovm.gui; + +import org.nanovm.NanoVMByteCode; +import org.nanovm.converter.Converter; + +/** + * + * @author nils + */ +public class MainFrame extends javax.swing.JFrame { + private NanoVMByteCode code; + + /** Creates new form MainFrame */ + public MainFrame() { + initComponents(); + //java.net.URL url = getClass().getResource("*.xml"); +// java.net.URL url = getClass().getResource("configurations.xml"); + // jTextFieldClass.setText(url.toString()); + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jTextFieldClassPath = new javax.swing.JTextField(); + jTextFieldClass = new javax.swing.JTextField(); + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jLabel3 = new javax.swing.JLabel(); + jTextFieldConfig = new javax.swing.JTextField(); + jToolBar1 = new javax.swing.JToolBar(); + jButtonLoadClass = new javax.swing.JButton(); + jButtonWriteFile = new javax.swing.JButton(); + jButtonUpload = new javax.swing.JButton(); + jScrollPane1 = new javax.swing.JScrollPane(); + jTextArea1 = new javax.swing.JTextArea(); + jProgressBar1 = new javax.swing.JProgressBar(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + + jTextFieldClassPath.setText("D:\\Sandbox\\sourceforge\\nanovm\\nanovm\\java\\examples"); + + jTextFieldClass.setText("nibo2/LedTest"); + + jLabel1.setText("ClassPath:"); + + jLabel2.setText("Class:"); + + jLabel3.setText("Config:"); + + jTextFieldConfig.setText("D:\\Sandbox\\sourceforge\\nanovm\\nanovm\\tool\\config"); + + jToolBar1.setRollover(true); + + jButtonLoadClass.setText("Load Class"); + jButtonLoadClass.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButtonLoadClassActionPerformed(evt); + } + }); + jToolBar1.add(jButtonLoadClass); + + jButtonWriteFile.setText("Write File"); + jToolBar1.add(jButtonWriteFile); + + jButtonUpload.setText("Upload"); + jButtonUpload.setEnabled(false); + jToolBar1.add(jButtonUpload); + + jTextArea1.setColumns(20); + jTextArea1.setRows(5); + jScrollPane1.setViewportView(jTextArea1); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE) + .addGap(12, 12, 12))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTextFieldConfig, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 355, Short.MAX_VALUE) + .addComponent(jTextFieldClass, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 355, Short.MAX_VALUE) + .addComponent(jTextFieldClassPath, javax.swing.GroupLayout.DEFAULT_SIZE, 355, Short.MAX_VALUE)) + .addContainerGap()) + .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 408, Short.MAX_VALUE) + .addContainerGap()) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jProgressBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 408, Short.MAX_VALUE) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextFieldConfig, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel3)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextFieldClassPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jTextFieldClass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2)) + .addGap(18, 18, 18) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(11, 11, 11)) + ); + + pack(); + }// //GEN-END:initComponents + + private void jButtonLoadClassActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonLoadClassActionPerformed + // TODO add your handling code here: + code = Converter.convert(jTextFieldConfig.getText(), jTextFieldClassPath.getText(), jTextFieldClass.getText()); + }//GEN-LAST:event_jButtonLoadClassActionPerformed + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new MainFrame().setVisible(true); + + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButtonLoadClass; + private javax.swing.JButton jButtonUpload; + private javax.swing.JButton jButtonWriteFile; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JProgressBar jProgressBar1; + private javax.swing.JScrollPane jScrollPane1; + private javax.swing.JTextArea jTextArea1; + private javax.swing.JTextField jTextFieldClass; + private javax.swing.JTextField jTextFieldClassPath; + private javax.swing.JTextField jTextFieldConfig; + private javax.swing.JToolBar jToolBar1; + // End of variables declaration//GEN-END:variables + +} diff -U 3 -H -d -r -N -- epos--/nanovmtool/src/org/nanovm/gui/configurations.xml epos--jvm/nanovmtool/src/org/nanovm/gui/configurations.xml --- epos--/nanovmtool/src/org/nanovm/gui/configurations.xml 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/nanovmtool/src/org/nanovm/gui/configurations.xml 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,13 @@ + + + + + + + diff -U 3 -H -d -r -N -- epos--/src/abstraction/javathread.cc epos--jvm/src/abstraction/javathread.cc --- epos--/src/abstraction/javathread.cc 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/abstraction/javathread.cc 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,24 @@ + +#include +#include +#include "../vm/vm.h" + +__USING_SYS + +JavaThread::~JavaThread() { +} + +extern "C" { + +int vm_thread_function(u16_t mref, nvm_stack_t objref){ + stack_push(objref); + vm_run(mref); +} + +void epos_new_javathread(u16_t mref, nvm_stack_t objref){ + JavaThread *t = new JavaThread(&vm_thread_function, mref, objref); +} + +} + + diff -U 3 -H -d -r -N -- epos--/src/abstraction/thread.cc epos--jvm/src/abstraction/thread.cc --- epos--/src/abstraction/thread.cc 2010-07-21 23:02:23.000000000 -0300 +++ epos--jvm/src/abstraction/thread.cc 2010-12-08 12:13:56.000000000 -0200 @@ -313,4 +313,13 @@ Machine::cpu_id() + 1; } + +void Thread::prepare_to_save_context() { + ;; +}; + +void Thread::prepare_to_load_context() { + ;; +}; + __END_SYS diff -U 3 -H -d -r -N -- epos--/src/abstraction/wrapper_jvm.cc epos--jvm/src/abstraction/wrapper_jvm.cc --- epos--/src/abstraction/wrapper_jvm.cc 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/abstraction/wrapper_jvm.cc 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,17 @@ +#include +#include + +__USING_SYS +OStream wrapper_cout; + +void epos_putc(char a) { + wrapper_cout << a; +} + +void epos_prints(char * str) { + wrapper_cout << str; +} + +void epos_printi(int a){ + wrapper_cout << "printi: " << a << "\n"; +} diff -U 3 -H -d -r -N -- epos--/src/makefile epos--jvm/src/makefile --- epos--/src/makefile 2010-07-21 23:02:24.000000000 -0300 +++ epos--jvm/src/makefile 2010-12-08 12:13:56.000000000 -0200 @@ -8,8 +8,7 @@ include ../makedefs -SUBDIRS := utility arch mach abstraction boot setup system init - +SUBDIRS := vm utility arch mach abstraction boot setup system init all: $(SUBDIRS) $(SUBDIRS): FORCE diff -U 3 -H -d -r -N -- epos--/src/vm/.cvsignore epos--jvm/src/vm/.cvsignore --- epos--/src/vm/.cvsignore 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/.cvsignore 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1 @@ +bin2c *.d *.o uvm \ No newline at end of file diff -U 3 -H -d -r -N -- epos--/src/vm/NanoVM.c epos--jvm/src/vm/NanoVM.c --- epos--/src/vm/NanoVM.c 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/NanoVM.c 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,155 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// main() for NanoVM runtime +// +#include + +//#include + +#include "types.h" +#include "config.h" +#include "debug.h" + +#include "loader.h" +//#include "uart.h" +#include "nvmfile.h" +#include "vm.h" + +#ifdef ATMEGA168 +#include +#endif + + +// hooks for init routines + +#include "native_impl.h" + +/* +#ifdef ASURO +#include "native_asuro.h" +#endif + +#ifdef NATIVE_AVR +#include "native_avr.h" +#endif + +*/ + +#ifdef LCD +#include "native_lcd.h" +#endif + +int jvm_main() { +#ifdef ATMEGA168 + // For some reason, after a WDT reset, WDT persists for some CPU's + // like ATmega168 and wdt_disable alone is not sufficient to disable + // the WDT again (avr-libc bug?). Therefore: + MCUSR &= ~(1<\n"); + epos_prints("NanoVM EPOS runtime 2010, by \"Grupo JAVA\"\n\n"); + } + +#ifdef NVM_USE_DISK_FILE + // load translated class file + if((i +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +#include "types.h" +#include "config.h" +#include "debug.h" +#include "error.h" + +#include "vm.h" +#include "array.h" +#include "heap.h" + +#ifdef NVM_USE_ARRAY + +u08_t array_typelen(u08_t type) { + if((type == T_BOOLEAN)||(type == T_CHAR)||(type == T_BYTE)) + return sizeof(nvm_byte_t); + + if(type == T_SHORT) + return sizeof(nvm_short_t); + + if(type == T_INT) + return sizeof(nvm_int_t); + +#ifdef NVM_USE_FLOAT + if(type == T_FLOAT) + return sizeof(nvm_float_t); +#endif + + error(ERROR_ARRAY_ILLEGAL_TYPE); + return 0; // to make compiler happy +} + +heap_id_t array_new(nvm_int_t length, u08_t type) { + heap_id_t id; + + DEBUGF("newarray type %d len = %d: total size = %d bytes\n", + type, length, length * array_typelen(type)); + + id = heap_alloc(FALSE, 1 + length * array_typelen(type)); + + // store type in first byte + *(u08_t*)(heap_get_addr(id)) = type; + + return id; +} + +nvm_int_t array_length(heap_id_t id) { + DEBUGF("arraylength %d = %d/%d\n", id, + heap_get_len(id)-1, + array_typelen(*(u08_t*)heap_get_addr(id))); + + return((heap_get_len(id)-1)/ + array_typelen(*(u08_t*)heap_get_addr(id))); +} + +void array_bastore(heap_id_t id, nvm_int_t index, nvm_byte_t value) { + nvm_byte_t * ptr = (nvm_byte_t *)heap_get_addr(id) + 1; + DEBUGF("bastore id=%x, index=%d, value=%d\n", id, index, value); + ptr[index] = value; +} + +nvm_byte_t array_baload(heap_id_t id, nvm_int_t index) { + nvm_byte_t * ptr = (nvm_byte_t*)heap_get_addr(id) + 1; + DEBUGF("baload id=%x, index=%d\n", id, index); + return ptr[index]; +} + +void array_iastore(heap_id_t id, nvm_int_t index, nvm_int_t value) { + nvm_int_t * ptr = (nvm_int_t *)((u08_t*)heap_get_addr(id) + 1); + DEBUGF("iastore id=%x, index=%d, value=%d\n", id, index, value); + ptr[index] = value; + HEAP_CHECK(); +} + +nvm_int_t array_iaload(heap_id_t id, nvm_int_t index) { + nvm_int_t * ptr = (nvm_int_t *)((u08_t*)heap_get_addr(id) + 1); + DEBUGF("iaload id=%x, index=%d\n", id, index); + return ptr[index]; +} + +#ifdef NVM_USE_FLOAT +void array_fastore(heap_id_t id, nvm_int_t index, nvm_float_t value) { + nvm_float_t * ptr = (nvm_float_t*)((u08_t*)heap_get_addr(id) + 1); + DEBUGF("iastore id=%x, index=%d, value=%f\n", id, index, value); + ptr[index] = value; + HEAP_CHECK(); +} + +nvm_float_t array_faload(heap_id_t id, nvm_int_t index) { + nvm_float_t * ptr = (nvm_float_t*)((u08_t*)heap_get_addr(id) + 1); + DEBUGF("iaload id=%x, index=%d\n", id, index); + return ptr[index]; +} +#endif + +#endif diff -U 3 -H -d -r -N -- epos--/src/vm/array.h epos--jvm/src/vm/array.h --- epos--/src/vm/array.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/array.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,45 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +#ifndef ARRAY_H +#define ARRAY_H + +#include "heap.h" + +#define T_BOOLEAN 4 +#define T_CHAR 5 +#define T_FLOAT 6 // not allowed in mvm +#define T_DOUBLE 7 // not allowed in mvm +#define T_BYTE 8 +#define T_SHORT 9 +#define T_INT 10 +#define T_LONG 11 // not allowed in mvm + +heap_id_t array_new(nvm_int_t length, u08_t type); +nvm_int_t array_length(heap_id_t id); +void array_bastore(heap_id_t id, nvm_int_t index, nvm_byte_t value); +nvm_byte_t array_baload(heap_id_t id, nvm_int_t index); +void array_iastore(heap_id_t id, nvm_int_t index, nvm_int_t value); +nvm_int_t array_iaload(heap_id_t id, nvm_int_t index); +#ifdef NVM_USE_FLOAT +void array_fastore(heap_id_t id, nvm_int_t index, nvm_float_t value); +nvm_float_t array_faload(heap_id_t id, nvm_int_t index); +#endif + +#endif // ARRAY_H diff -U 3 -H -d -r -N -- epos--/src/vm/config.h epos--jvm/src/vm/config.h --- epos--/src/vm/config.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/config.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,39 @@ +// +// config.h +// + +#ifndef CONFIG_H +#define CONFIG_H + +#define CODESIZE 32768 +#define HEAPSIZE 768 + +#define WDT_NO_STATISTICS // all eeprom required for uvmfile + +// define this if you don't want to use stdin/stdout, but +// a named pipe (e.g. to test the loader code): +// #define UART_PORT "/dev/ttyq0" + +#define NVM_USE_STACK_CHECK // enable check if method returns empty stack +#define NVM_USE_ARRAY // enable arrays +#define NVM_USE_SWITCH // support switch instructions +#define NVM_USE_INHERITANCE // support for inheritance +#define NVM_USE_FLOAT // floating point support +#define NVM_USE_32BIT_WORD // 32 bit integer +//#define NVM_USE_COMM // enable firmware upload +#define NVM_USE_UTILS // enable inline utils +#define NVM_USE_EEPROM // nvm file resides in EEPROM (or flash) +#define NVM_USE_MEMCPY_UP // enable custom memcpy for heap compacting +//#define NVM_USE_DISK_FILE // enable disk file loading +#define NVM_USE_DEFAULT_FILE // enable pre-installed default file + +// native setup +//#define NVM_USE_MATH // enable native math functions +#define NVM_USE_STDIO // enable native stdio support +//#define NVM_USE_FORMATTER // enable native formatter class + +// marker used to indicate, that this item is stored in eeprom +#define NVMFILE_FLAG 0x40000000 + +#endif // CONFIG_H + diff -U 3 -H -d -r -N -- epos--/src/vm/debug.c epos--jvm/src/vm/debug.c --- epos--/src/vm/debug.c 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/debug.c 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,90 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// debug.c +// + +#include +#include +#include + +#include "types.h" +#include "config.h" +#include "debug.h" + +#ifdef DEBUG + +#if defined(UNIX) || defined(__CC65__) +bool_t debug_enabled = FALSE; + +void debug_enable(bool_t enable) { + debug_enabled = enable; +} + +void debugf(const char *fmt, ...) { + /*if(debug_enabled) { + va_list ap; + + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + }*/ + epos_prints(fmt); +} +#endif // UNIX || __CC65__ + +bool_t debug_isprint(u08_t chr) { + return(chr >= 32 && chr <= 127); +} + +void debug_hexdump(const void *data, u16_t size) { + u16_t i,n = 0, b2c; + const u08_t *ptr = data; + + if(!size) return; + + DEBUGF("---- dump %d bytes\n", size); + + while(size>0) { + DEBUGF(DBG16": ", n); + + b2c = (size>16)?16:size; + + for(i=0;i +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// debug.h +// + +#ifndef DEBUG_H +#define DEBUG_H + +#include "config.h" +#include "types.h" + +#define DBG8 "%02x" +#define DBG16 "%04x" +#define DBG32 "%08x" + +#ifdef DEBUG +#define DEBUGF(...) debugf(__VA_ARGS__) +#define DEBUG_HEXDUMP(a,b) debug_hexdump(a,b) +void debugf(const char *fmt, ...); +void debug_hexdump(const void *data, u16_t size); +#else +#define DEBUGF(...) +#define DEBUG_HEXDUMP(a,b) +#endif + +void debug_enable(bool_t enable); + +#endif //DEBUG_H diff -U 3 -H -d -r -N -- epos--/src/vm/delay.h epos--jvm/src/vm/delay.h --- epos--/src/vm/delay.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/delay.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,58 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// delay.h +// +// delay and clock rate related routines +// + +#ifndef DELAY_H +#define DELAY_H + +#include "types.h" +#include "config.h" + +#ifdef UNIX +#include + +#define MICROSEC(a) (a) +#define MILLISEC(a) ((a)*1000) +#define SEC(a) ((a)*1000000) + +#define delay(a) usleep(a) +#else + +#ifdef AVR + +#define MICROSEC(a) ((a)*CLOCK/7000000) +#define MILLISEC(a) ((a)*CLOCK/7000) +#define SEC(a) ((a)*CLOCK/7) + +//#define nop() ({__asm__ __volatile__ ("nop\n\t":);}) + +/* nop/1, subi/1, sbc/1, sbc/1, sbc/1, brcc/2 -> 7 clocks */ +static inline void delay(u32_t delay_cnt) { + while(delay_cnt--) {__asm__ __volatile__ ("nop\n\t":);} +} + +#endif // nAVR +#endif // nUNIX + +#endif // DELAY_H diff -U 3 -H -d -r -N -- epos--/src/vm/eeprom.h epos--jvm/src/vm/eeprom.h --- epos--/src/vm/eeprom.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/eeprom.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,58 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +#ifndef EEPROM_H +#define EEPROM_H + +typedef u08_t* eeprom_addr_t; + +#ifdef NVM_USE_EEPROM + +#ifdef UNIX +#include // for memcpy + +#define eeprom_write_byte(a, d) { *a = d; } +#define eeprom_read_block(a, s, l) { memcpy(a, s, l); } +#define eeprom_write_block(a, s, l) { memcpy(s, a, l); } +#define EEPROM + +#else // UNIX +#ifdef AVR + +// TH: Otherwise gcc-3.4.5/avr-lib-1.4.2 complain about unknow +// symbol asm ... is there a more beautiful solution? +#define asm __asm__ + +#include +#define EEPROM __attribute__((section (".eeprom"))) + +#else // AVR + +#error "Unknown EEPROM setup" + +#endif // AVR +#endif // UNIX + +#else // NVM_USE_EEPROM + +#define EEPROM + +#endif // NVM_USE_EEPROM + +#endif // EEPROM_H diff -U 3 -H -d -r -N -- epos--/src/vm/error.c epos--jvm/src/vm/error.c --- epos--/src/vm/error.c 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/error.c 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,109 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +#if defined(UNIX) || defined(__CC65__) +#include +#include +#else +#include +#include "delay.h" +#endif + +#ifdef NIBOBEE +#include +#endif + +#include "types.h" +#include "config.h" +#include "debug.h" +#include "error.h" + +#if defined(UNIX) || defined(__CC65__) +char *error_msg[] = { + // unix message avr error code + "HEAP: illegal chunk size", // A + "HEAP: corrupted", // B + "HEAP: out of memory", // C + "HEAP: chunk does not exist", // D + "HEAP: out of stack memory", // E + "HEAP: stack underrun", // F + "HEAP: out of identifiers", // G + "ARRAY: illegal type", // H + "NATIVE: unknown method", // I + "NATIVE: unknown class", // J + "NATIVE: illegal argument", // K + "NVMFILE: unsupported features or not a valid nvm file", // L + "NVMFILE: wrong nvm file version", // M + "VM: illegal reference", // N + "VM: unsupported opcode", // O + "VM: division by zero", // P + "VM: stack corrupted", // Q +}; +#else +#include "uart.h" +#endif + +void error(err_t code) { +#if defined(UNIX) || defined(__CC65__) + //printf("NanoVM error: %s\n", error_msg[code]); + epos_prints("erro: "); + epos_prints(error_msg[code]); + epos_prints("\n"); + for(;;); +#else + + uart_putc('E'); + uart_putc('R'); + uart_putc('R'); + uart_putc(':'); + uart_putc('A'+code); + uart_putc('\n'); + + for(;;) { + // reset watchdog here if in use + +#ifdef ASURO + // yellow/red blinking status led + PORTD |= _BV(2); + PORTB |= _BV(0); + delay(MILLISEC(250)); + PORTB &= ~_BV(0); + delay(MILLISEC(250)); +#endif + +#ifdef NIBOBEE + uint8_t cnt; + for (cnt=5; cnt; cnt--) { + PORTB &= 0xf0; + PORTB |= _BV(1); + _delay_ms(100); + PORTB &= 0xf0; + PORTB &= _BV(2); + _delay_ms(100); + } + PORTB &= 0xf0; + _delay_ms(1000); + PORTB |= 0x0f&code; + _delay_ms(1000); +#endif + } + + +#endif +} diff -U 3 -H -d -r -N -- epos--/src/vm/error.h epos--jvm/src/vm/error.h --- epos--/src/vm/error.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/error.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,58 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// error.h +// + +#ifndef ERROR_H +#define ERROR_H + +#define ERROR_HEAP_BASE 0 +#define ERROR_HEAP_ILLEGAL_CHUNK_SIZE (ERROR_HEAP_BASE+0) +#define ERROR_HEAP_CORRUPTED (ERROR_HEAP_BASE+1) +#define ERROR_HEAP_OUT_OF_MEMORY (ERROR_HEAP_BASE+2) +#define ERROR_HEAP_CHUNK_DOES_NOT_EXIST (ERROR_HEAP_BASE+3) +#define ERROR_HEAP_OUT_OF_STACK_MEMORY (ERROR_HEAP_BASE+4) +#define ERROR_HEAP_STACK_UNDERRUN (ERROR_HEAP_BASE+5) +#define ERROR_HEAP_OUT_OF_IDS (ERROR_HEAP_BASE+6) + +#define ERROR_ARRAY_BASE (ERROR_HEAP_BASE+7) +#define ERROR_ARRAY_ILLEGAL_TYPE (ERROR_ARRAY_BASE+0) + +#define ERROR_NATIVE_BASE (ERROR_ARRAY_BASE+1) +#define ERROR_NATIVE_UNKNOWN_METHOD (ERROR_NATIVE_BASE+0) +#define ERROR_NATIVE_UNKNOWN_CLASS (ERROR_NATIVE_BASE+1) +#define ERROR_NATIVE_ILLEGAL_ARGUMENT (ERROR_NATIVE_BASE+2) + +#define ERROR_NVMFILE_BASE (ERROR_NATIVE_BASE+3) +#define ERROR_NVMFILE_MAGIC (ERROR_NVMFILE_BASE+0) +#define ERROR_NVMFILE_VERSION (ERROR_NVMFILE_BASE+1) + +#define ERROR_VM_BASE (ERROR_NVMFILE_BASE+2) +#define ERROR_VM_ILLEGAL_REFERENCE (ERROR_VM_BASE+0) +#define ERROR_VM_UNSUPPORTED_OPCODE (ERROR_VM_BASE+1) +#define ERROR_VM_DIVISION_BY_ZERO (ERROR_VM_BASE+2) +#define ERROR_VM_STACK_CORRUPTED (ERROR_VM_BASE+3) + +typedef u08_t err_t; + +void error(err_t code); + +#endif // ERROR_H diff -U 3 -H -d -r -N -- epos--/src/vm/heap.c epos--jvm/src/vm/heap.c --- epos--/src/vm/heap.c 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/heap.c 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,518 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// This file contains the heap. It can be requested to +// create/delete objects on the heap and does some +// simple garbage collection. +// +// The heap is being used top-to-bottom allowing the +// virtual machines stack to grow inside the heap from bottom to +// top +// + +#include + +#include "types.h" +#include "config.h" +#include "debug.h" +#include "error.h" + +#include "utils.h" +#include "heap.h" +#include "stack.h" +#include "vm.h" + +u08_t heap[HEAPSIZE]; +u16_t heap_base = 0; + +typedef struct { + heap_id_t id; + u16_t len; // actually 15 bits for the len and 1 bit for the fieldref flag +} PACKED heap_t; + +#define HEAP_ID_FREE 0 +#define HEAP_LEN_MASK 0x7FFF +#define HEAP_FIELDREF_MASK 0x8000 + +#ifdef NVM_USE_HEAP_IDMAP +// A heap id map must not be larger than 256 elements meaning a limit of 2048 +// heap elements. Each heap element consists of the header (heap_t) and the +// actual data which makes up at least 1 byte. Limiting the heap size to 10kB +// makes sure that are always heap ids available. +#if HEAPSIZE > 10240 +#error The maximum heap size is 10kB when using a heap id map. +#endif +u08_t heap_idmap[(HEAPSIZE/(sizeof(heap_t)+1))/8]; +const u08_t heap_idmap_mask[8] = {0x01, 0x02, 0x04, 0x08, + 0x10, 0x20, 0x40, 0x80}; +#endif + +// return the real heap base (where memory can be "stolen" +// from +u08_t *heap_get_base(void) { + return heap; +} + +#ifdef NVM_USE_MEMCPY_UP +// a version of memcpy that can only copy overlapping chunks +// if the target address is higher +void heap_memcpy_up(u08_t *dst, u08_t *src, u16_t len) { + dst += len; src += len; + while(len--) *--dst = *--src; +} +#endif + +#ifdef DEBUG_JVM +// make some sanity checks on the heap in order to detect +// heap corruption as early as possible +void heap_check(void) { + u16_t current = heap_base; + heap_t *h = (heap_t*)&heap[current]; + u16_t len; + + if(h->id != HEAP_ID_FREE) { + DEBUGF("heap_check(): start element not free element\n"); + error(ERROR_HEAP_CORRUPTED); + } + + // (no HEAP_LEN_MASK required for free chunk) + current += h->len + sizeof(heap_t); + + while(current < sizeof(heap)) { + h = (heap_t*)&heap[current]; + len = h->len & HEAP_LEN_MASK; + if(len > sizeof(heap)) { + DEBUGF("heap_check(): single chunk too big\n"); + heap_show(); + error(ERROR_HEAP_ILLEGAL_CHUNK_SIZE); + } + + if(len + sizeof(heap_t) > sizeof(heap) - current) { + DEBUGF("heap_check(): total size error\n"); + heap_show(); + error(ERROR_HEAP_CORRUPTED); + } + + current += len + sizeof(heap_t); + } + + if(current != sizeof(heap)) { + DEBUGF("heap_check(): heap sum mismatch\n"); + heap_show(); + error(ERROR_HEAP_CORRUPTED); + } +} +#endif + +#ifdef UNIX +void heap_show(void) { + u16_t current = heap_base; + + DEBUGF("Heap:\n"); + while(current < sizeof(heap)) { + heap_t *h = (heap_t*)&heap[current]; + u16_t len = h->len & HEAP_LEN_MASK; + if(h->id == HEAP_ID_FREE) { + DEBUGF("- %d free bytes\n", len); + } else { + DEBUGF("- chunk id %x with %d bytes:\n", h->id, len); + + if(len > sizeof(heap)) + error(ERROR_HEAP_ILLEGAL_CHUNK_SIZE); + + DEBUG_HEXDUMP(h+1, len); + } + + if(len + sizeof(heap_t) > sizeof(heap) - current) { + DEBUGF("heap_show(): total size error\n"); + error(ERROR_HEAP_CORRUPTED); + } + + current += len + sizeof(heap_t); + } + + DEBUGF("- %d bytes stolen\n", heap_base); +} +#endif + +// search for chunk with id in heap and return chunk header +// address +heap_t *heap_search(heap_id_t id) { + u16_t current = heap_base; + + while(current < sizeof(heap)) { + heap_t *h = (heap_t*)&heap[current]; + if(h->id == id) return h; + current += (h->len & HEAP_LEN_MASK) + sizeof(heap_t); + } + return NULL; +} + +#ifdef NVM_USE_HEAP_IDMAP + +void heap_init_ids(void) { + memset(heap_idmap, 0, sizeof(heap_idmap)); + heap_idmap[0] = 0x01; // mark HEAP_ID_FREE +} + +void heap_mark_id(heap_id_t id) { + DEBUGF(" heap_mark_id(id=0x%04x)\n", id); + heap_idmap[id/8] |= heap_idmap_mask[id%8]; +} + +u08_t heap_id_marked(heap_id_t id) { + return heap_idmap[id/8] & heap_idmap_mask[id%8]; +} + +heap_id_t heap_new_id(void) { + u08_t byte,bit; + + for(byte=0;;byte++) { + if(heap_idmap[byte] != 0xFF) + for(bit=0;;bit++) + if(!(heap_idmap[byte] & heap_idmap_mask[bit])) { + heap_idmap[byte] |= heap_idmap_mask[bit]; + return byte*8+bit; + } + + // check failure here before incrementing + // to allow for id maps with 256 elements + if(byte == sizeof(heap_idmap)-1) + return 0; + } +} + +// in some cases, references to heap objects may be inside +// other heap objects. this currently happens only when +// a class is instanciated and this class contains fields. +// the heap element created by the constructor is marked with +// the fieldref bit and it is searched for references during +// garbage collections +void heap_mark_child_ids(void) { + bool_t again; + + do { + u16_t current = heap_base; + again = FALSE; + + DEBUGF("heap_mark_child_ids(): starting heap walk\n"); + while(current < sizeof(heap)) { + heap_t *h = (heap_t*)&heap[current]; + + // check for elements with the fieldref flag + if(h->len & HEAP_FIELDREF_MASK && heap_id_marked(h->id)) { + u08_t fields = (u08_t)((h->len & HEAP_LEN_MASK) / sizeof(nvm_ref_t)); + u08_t i; + + // check all fields in the heap element + DEBUGF("- checking id 0x%04x\n", h->id); + for(i=0;ilen & HEAP_LEN_MASK) + sizeof(heap_t); + } + } while(again); +} + +#else // NVM_USE_HEAP_IDMAP + +heap_id_t heap_new_id(void) { + heap_id_t id; + + for(id=1;id;id++) + if(heap_search(id) == NULL) + return id; + + return 0; +} + +// in some cases, references to heap objects may be inside +// other heap objects. this currently happens only when +// a class is instanciated and this class contains fields. +// the heap element created by the constructor is marked with +// the fieldref bit and it is searched for references during +// garbage collections +bool_t heap_fieldref(heap_id_t id) { + nvm_ref_t id16 = id | NVM_TYPE_HEAP; + u16_t current = heap_base; + + // walk through the entire heap + while(current < sizeof(heap)) { + heap_t *h = (heap_t*)&heap[current]; + + // check for entries with the fieldref flag + if(h->len & HEAP_FIELDREF_MASK) { + u08_t entries = (u08_t)((h->len & HEAP_LEN_MASK) / sizeof(nvm_ref_t)); + u08_t i; + + // check all entries in the heap element for + // the reference we are searching for + for(i=0;ilen & HEAP_LEN_MASK) + sizeof(heap_t); + } + + return FALSE; +} + +#endif // NVM_USE_HEAP_IDMAP + +bool_t heap_alloc_internal(heap_id_t id, bool_t fieldref, u16_t size) { + u16_t req = size + sizeof(heap_t); // total mem required + + // search for free block + heap_t *h = (heap_t*)&heap[heap_base]; + + // (no HEAP_LEN_MASK required for free chunk) + if(h->len >= req) { + // reduce the size of the free chunk + // (no HEAP_LEN_MASK required for free chunk) + h->len -= req; + + // and create the new chunk behind this one + // (no HEAP_LEN_MASK required for free chunk) + h = (heap_t*)&heap[heap_base + sizeof(heap_t) + h->len]; + h->id = id; + h->len = fieldref ? size | HEAP_FIELDREF_MASK : size & HEAP_LEN_MASK; +#ifdef NVM_INITIALIZE_ALLOCATED + // fill memory with zero + u08_t *ptr = (void*)(h+1); + while(size--) + *ptr++ = 0; +#endif + return TRUE; + } + + DEBUGF("heap_alloc_internal(%d): out of memory\n", size); + return FALSE; +} + +heap_id_t heap_alloc(bool_t fieldref, u16_t size) { + heap_id_t id = heap_new_id(); + + DEBUGF("heap_alloc(size=%d) -> id=0x%04x\n", size, id); + if(!id) error(ERROR_HEAP_OUT_OF_IDS); + + if(!heap_alloc_internal(id, fieldref, size)) { + heap_garbage_collect(); + + // we need to reallocate heap id, gc. threw away the old one... + id = heap_new_id(); + if(!id) error(ERROR_HEAP_OUT_OF_IDS); + + if(!heap_alloc_internal(id, fieldref, size)) + error(ERROR_HEAP_OUT_OF_MEMORY); + DEBUGF("heap_alloc(size=%d) -> id=0x%04x successfull after gc\n", + size, id); + } + + return id; +} + +void heap_realloc(heap_id_t id, u16_t size) { + heap_t *h, *h_new; + + DEBUGF("heap_realloc(id=0x%04x, size=%d)\n", id, size); + + // check free mem and call garbage collection if required + h = (heap_t*)&heap[heap_base]; + // (no HEAP_LEN_MASK required for free chunk) + if(h->len < size + sizeof(heap_t)) + heap_garbage_collect(); + + // get info on old chunk + h = heap_search(id); + + // allocate space for bigger one + if(!heap_alloc_internal(id, h->len & HEAP_FIELDREF_MASK ? TRUE : FALSE, size)) + error(ERROR_HEAP_OUT_OF_MEMORY); + + h_new = heap_search(id); + + utils_memcpy(h_new+1, h+1, h->len & HEAP_LEN_MASK); + + // this chunk is not immediately available for new allocation + // but it will be removed by the garbage collection next time + h->id = HEAP_ID_FREE; +} + +u16_t heap_get_len(heap_id_t id) { + heap_t *h = heap_search(id); + if(!h) error(ERROR_HEAP_CHUNK_DOES_NOT_EXIST); + return h->len & HEAP_LEN_MASK; +} + +void *heap_get_addr(heap_id_t id) { + heap_t *h = heap_search(id); + if(!h) error(ERROR_HEAP_CHUNK_DOES_NOT_EXIST); + return h+1; +} + +void heap_init(void) { + heap_t *h; + + DEBUGF("heap_init()\n"); + + // just one big free block + h = (heap_t*)&heap[0]; + h->id = HEAP_ID_FREE; + // (no HEAP_LEN_MASK required for free chunk) + h->len = sizeof(heap) - sizeof(heap_t); + +#ifdef NVM_USE_HEAP_IDMAP + heap_init_ids(); +#endif +} + +// walk through the heap, check for every object +// if it's still being used and remove it if not +void heap_garbage_collect(void) { + u16_t current = heap_base; + heap_t *h; + // (no HEAP_LEN_MASK required for free chunk) + DEBUGF("heap_garbage_collect() free space before: %d\n", ((heap_t*)&heap[heap_base])->len); + +#ifdef NVM_USE_HEAP_IDMAP + heap_init_ids(); + stack_mark_heap_root_ids(); + heap_mark_child_ids(); +#endif + + // set current to stack-top + // walk through the entire heap + while(current < sizeof(heap)) { + u16_t len; + h = (heap_t*)&heap[current]; + len = (h->len & HEAP_LEN_MASK) + sizeof(heap_t); + + // found an entry + if(h->id != HEAP_ID_FREE) { + // check if it's still used +#ifdef NVM_USE_HEAP_IDMAP + if(!heap_id_marked(h->id)) { +#else + if((!stack_heap_id_in_use(h->id))&&(!heap_fieldref(h->id))) { +#endif + // it is not used, remove it + DEBUGF("HEAP: removing unused object with id 0x%04x (len %d)\n", + h->id, len); + + // move everything before to the top +#ifdef NVM_USE_MEMCPY_UP + heap_memcpy_up(heap+heap_base+len, heap+heap_base, current-heap_base); +#else + memmove(heap+heap_base+len, heap+heap_base, current-heap_base); +#endif + + // add freed mem to free chunk + h = (heap_t*)&heap[heap_base]; + // (no HEAP_LEN_MASK required for free chunk) + h->len += len; + } + } + current += len; + } + + if(current != sizeof(heap)) { + DEBUGF("heap_garbage_collect(): total size error\n"); + error(ERROR_HEAP_CORRUPTED); + } + + // (no HEAP_LEN_MASK required for free chunk) + DEBUGF("heap_garbage_collect() free space after: %d\n", ((heap_t*)&heap[heap_base])->len); +} + +// "steal" some bytes from the bottom of the heap (where +// the free chunk is) +void heap_steal(u16_t bytes) { + heap_t *h = (heap_t*)&heap[heap_base]; + u16_t len; + + DEBUGF("HEAP: request to steal %d bytes\n", bytes); + + if(h->id != HEAP_ID_FREE) { + DEBUGF("heap_steal(%d): start element not free element\n", bytes); + error(ERROR_HEAP_CORRUPTED); + } + + // try to make space if necessary + // (no HEAP_LEN_MASK required for free chunk) + len = h->len; + if(len < bytes) + heap_garbage_collect(); + + // (no HEAP_LEN_MASK required for free chunk) + len = h->len; + if(len < bytes) + error(ERROR_HEAP_OUT_OF_STACK_MEMORY); + + // finally steal ... + heap_base += bytes; + h = (heap_t*)&heap[heap_base]; + h->id = HEAP_ID_FREE; + // (no HEAP_LEN_MASK required for free chunk) + h->len = len - bytes; +} + +// someone wants us to give some bytes back :-) +void heap_unsteal(u16_t bytes) { + heap_t *h = (heap_t*)&heap[heap_base]; + u16_t len; + + if(h->id != HEAP_ID_FREE) { + DEBUGF("heap_unsteal(%d): start element not free element\n", bytes); + error(ERROR_HEAP_CORRUPTED); + } + + DEBUGF("HEAP: request to unsteal %d bytes\n", bytes); + + if(heap_base < bytes) { + DEBUGF("stack underrun by %d bytes\n", bytes - heap_base); + error(ERROR_HEAP_STACK_UNDERRUN); + } + + // finally unsteal ... + // (no HEAP_LEN_MASK required for free chunk) + len = h->len; + heap_base -= bytes; + h = (heap_t*)&heap[heap_base]; + h->id = HEAP_ID_FREE; + // (no HEAP_LEN_MASK required for free chunk) + h->len = len + bytes; +} diff -U 3 -H -d -r -N -- epos--/src/vm/heap.h epos--jvm/src/vm/heap.h --- epos--/src/vm/heap.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/heap.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,60 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +#ifndef HEAP_H +#define HEAP_H + +// Each heap element consists of a header and the actual data. This header +// consists of the heap id and a 2 byte combined length/flag value. With a +// 1 byte heap id and and the border case of 1 byte data each heap element +// occupies 4 bytes so with a heap size <= 1024 bytes there are never more +// than 256 heap elements possible meaning a 1 byte heap id is sufficient. +#if HEAPSIZE <= 1024 +typedef u08_t heap_id_t; +#else +typedef u16_t heap_id_t; +#endif + +void heap_init(void); +u08_t *heap_get_base(void); +heap_id_t heap_alloc(bool_t fieldref, u16_t size); +void heap_realloc(heap_id_t id, u16_t size); +u16_t heap_get_len(heap_id_t id); +void *heap_get_addr(heap_id_t id); +//hey, this is java!!! void heap_free(heap_id_t id); +void heap_garbage_collect(void); +void heap_steal(u16_t bytes); +void heap_unsteal(u16_t bytes); + +#ifdef DEBUG_JVM +void heap_check(void); +#define HEAP_CHECK() heap_check() +#else +#define HEAP_CHECK() +#endif + +#ifdef UNIX +void heap_show(void); +#endif + +#ifdef NVM_USE_HEAP_IDMAP +void heap_mark_id(heap_id_t id); +#endif + +#endif // HEAP_H diff -U 3 -H -d -r -N -- epos--/src/vm/loader.c epos--jvm/src/vm/loader.c --- epos--/src/vm/loader.c 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/loader.c 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,155 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005-2006 by Till Harbaum , +// Oliver Schulz +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// The NanoVM boot-loader. +// + + +#include "loader.h" + +#include "types.h" +#include "config.h" +#include "debug.h" +#include "nvmcomm1.h" +#include "nvmcomm2.h" +#include "uart.h" +#include "delay.h" +#include "nvmfile.h" + +#ifdef ASURO +#include +#endif + + +#ifdef NVMCOMM1 +// == NVMCOMM1 ======================================================== + + +void loader_receive(void) { + u08_t i, block = 1, sum = 0, len; + u08_t *addr = nvmfile_get_base(); + loader_t loader; + +#ifdef ASURO + // yellow status led + PORTD |= _BV(2); + PORTB |= _BV(0); +#endif + + // tell sender that we accept data + uart_write_byte(ASCII_NAK); + + // wait for data with timeout + for(sum=0;sum<250 && !uart_available();sum++) + delay(MILLISEC(4)); + + if(uart_available()) { + nvmfile_write_initialize(); + do { + // try to receive a full data block + len = uart_get_block((u08_t*)&loader, sizeof(loader)); + + if(len == sizeof(loader)) { + for(sum=0,i=0;i nak + if(loader.soh != ASCII_EOF) + uart_write_byte(ASCII_NAK); + } + } + } while((len < 1) || (loader.soh != ASCII_EOF)); + nvmfile_write_finalize(); + uart_write_byte(ASCII_ACK); + +#ifdef ASURO + // red status led + PORTB &= ~_BV(0); + + for(;;); // reset watchdog here if enabled +#endif + } +#ifdef ASURO + // green status led + PORTD &= ~_BV(2); +#endif +} + +// ==================================================================== +#endif // NVMCOMM1 + + +#ifdef NVMCOMM2 +// == NVMCOMM2 ======================================================== + + +void loader_receive(void) { + // show status + nvm_showstatus_booting(); + + // enable NVM-Comm2 + nvc2_enable(); + + // wait for 20ms communication pause + while (true) { + for (u08_t i=0; !uart_available() && (i<20); ++i) delay(MILLISEC(1)); + if (uart_available()) uart_read_byte(); else break; + } + + for (u08_t count = 0; g_nvm_runlevel != NVM_RUNLVL_VM; ++count) { + // wait for data with 100ms timeout + for (u08_t i=0; !uart_available() && (i<100); ++i) delay(MILLISEC(1)); + + nvc2_check_input(); + + if ( (g_nvm_runlevel == NVM_RUNLVL_BOOT) && (count >= 10) ) { + // no incoming data, still in boot runlevel after several + // tries, start vm + g_nvm_runlevel = NVM_RUNLVL_VM; + } + } + + // show status + nvm_showstatus_running(); +} + + +// ==================================================================== +#endif // NVMCOMM2 diff -U 3 -H -d -r -N -- epos--/src/vm/loader.h epos--jvm/src/vm/loader.h --- epos--/src/vm/loader.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/loader.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,40 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// +// loader.h +// + +#ifndef LOADER_H +#define LOADER_H + +#define ASCII_SOH 0x01 +#define ASCII_STX 0x02 +#define ASCII_EOT 0x04 +#define ASCII_ACK 0x06 +#define ASCII_DLE 0x10 +#define ASCII_XON 0x11 +#define ASCII_XOFF 0x13 +#define ASCII_NAK 0x15 +#define ASCII_SYN 0x16 +#define ASCII_CAN 0x18 +#define ASCII_EOF 0x1A + +void loader_receive(void); + +#endif // LOADER_H diff -U 3 -H -d -r -N -- epos--/src/vm/makefile epos--jvm/src/vm/makefile --- epos--/src/vm/makefile 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/makefile 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,18 @@ +include $(EPOS)/makedefs + +CCFLAGS = -DUNIX -I. -I$(EPOS)/include -c -std=c99 -O2 -Wall -D_FROM_JVM_FOLDER +CC = $(COMP_PREFIX)gcc + +all: install + +nvmfile.o: nvmfile.c nvmdefault.h + +eposjava.o: array.o debug.o error.o heap.o loader.o native_thread.o native_formatter.o native_impl.o native_lcd.o native_stdio.o nvmcomm1.o nvmcomm2.o nvmfile.o nvmstring.o stack.o vm.o NanoVM.o + ld -i array.o debug.o error.o heap.o loader.o native_thread.o native_formatter.o native_impl.o native_lcd.o native_stdio.o nvmcomm1.o nvmcomm2.o nvmfile.o nvmstring.o stack.o vm.o NanoVM.o -o eposjava.o + +install: eposjava.o + $(INSTALL) eposjava.o $(LIB)/ + +clean: + rm *.o + diff -U 3 -H -d -r -N -- epos--/src/vm/native.h epos--jvm/src/vm/native.h --- epos--/src/vm/native.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/native.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,123 @@ +// +// native.h +// + +#ifndef NATIVE_H +#define NATIVE_H + +#define NATIVE_CLASS_BASE 16 + +// java/lang/Object +#define NATIVE_CLASS_OBJECT (NATIVE_CLASS_BASE+0) +#define NATIVE_METHOD_INIT 0 + +// java/lang/System +#define NATIVE_CLASS_SYSTEM (NATIVE_CLASS_BASE+1) +#define NATIVE_FIELD_OUT 0 +#define NATIVE_FIELD_IN 1 + +// + +// java/io/PrintStream +#define NATIVE_CLASS_PRINTSTREAM (NATIVE_CLASS_BASE+2) +#define NATIVE_METHOD_PRINTLN_STR 1 +#define NATIVE_METHOD_PRINTLN_INT 2 +#define NATIVE_METHOD_PRINTLN_CHAR 3 +#define NATIVE_METHOD_PRINT_STR 4 +#define NATIVE_METHOD_PRINT_INT 5 +#define NATIVE_METHOD_PRINT_CHAR 6 +#define NATIVE_METHOD_FORMAT 7 + +// java/io/InputStream +#define NATIVE_CLASS_INPUTSTREAM (NATIVE_CLASS_BASE+3) +#define NATIVE_METHOD_INPUTSTREAM_AVAILABLE 1 +#define NATIVE_METHOD_INPUTSTREAM_READ 2 + +// java/lang/StringBuffer +#define NATIVE_CLASS_STRINGBUFFER (NATIVE_CLASS_BASE+4) +#define NATIVE_METHOD_INIT_STR 1 +#define NATIVE_METHOD_APPEND_STR 2 +#define NATIVE_METHOD_APPEND_INT 3 +#define NATIVE_METHOD_APPEND_CHR 4 +#define NATIVE_METHOD_TOSTRING 5 +#define NATIVE_METHOD_APPEND_FLOAT 6 + +// nanovm/avr/AVR +#define NATIVE_CLASS_AVR (NATIVE_CLASS_BASE+5) +#define NATIVE_METHOD_GETCLOCK 1 +#define NATIVE_FIELD_PORTA 0 +#define NATIVE_FIELD_PORTB 1 +#define NATIVE_FIELD_PORTC 2 +#define NATIVE_FIELD_PORTD 3 +#define NATIVE_FIELD_PORTE 4 +#define NATIVE_FIELD_PORTF 5 +#define NATIVE_FIELD_PORTG 6 +#define NATIVE_FIELD_PORTH 7 + +// nanovm/avr/Port +#define NATIVE_CLASS_PORT (NATIVE_CLASS_BASE+6) +#define NATIVE_METHOD_SETINPUT 1 +#define NATIVE_METHOD_SETOUTPUT 2 +#define NATIVE_METHOD_SETBIT 3 +#define NATIVE_METHOD_CLRBIT 4 + +// nanovm/avr/Timer +#define NATIVE_CLASS_TIMER (NATIVE_CLASS_BASE+7) +#define NATIVE_METHOD_SETSPEED 1 +#define NATIVE_METHOD_GET 2 +#define NATIVE_METHOD_TWAIT 3 +#define NATIVE_METHOD_SETPRESCALER 4 + +// nanovm/avr/Uart (use PrintStream/InputStream for io) +#define NATIVE_CLASS_UART (NATIVE_CLASS_BASE+8) + +// nanovm/avr/Pwm +#define NATIVE_CLASS_PWM (NATIVE_CLASS_BASE+9) +#define NATIVE_METHOD_PWM_SETPRESCALER 1 +#define NATIVE_METHOD_PWM_SETRATIO 2 +#define NATIVE_FIELD_PWM0 0 +#define NATIVE_FIELD_PWM1 1 + +// nanovm/avr/Adc +#define NATIVE_CLASS_ADC (NATIVE_CLASS_BASE+10) +#define NATIVE_METHOD_ADC_SETPRESCALER 1 +#define NATIVE_METHOD_ADC_SETREFERENCE 2 +#define NATIVE_METHOD_ADC_GETVALUE 3 +#define NATIVE_METHOD_ADC_GETBYTE 4 + +// nanovm/Lcd +#define NATIVE_CLASS_LCD (NATIVE_CLASS_BASE+11) +#define NATIVE_METHOD_LCD_CLEAR 1 +#define NATIVE_METHOD_LCD_GOTOYX 2 +#define NATIVE_METHOD_LCD_PRINT_STR 3 +#define NATIVE_METHOD_LCD_PRINT_INT 4 +#define NATIVE_METHOD_LCD_PRINT_CHAR 5 + +// nanovm/asuro +#define NATIVE_CLASS_ASURO (NATIVE_CLASS_BASE+12) +#define NATIVE_METHOD_STATUSLED 1 +#define NATIVE_METHOD_WAIT 2 +#define NATIVE_METHOD_MOTOR 3 +#define NATIVE_METHOD_LINELED 4 +#define NATIVE_METHOD_BACKLED 5 +#define NATIVE_METHOD_LINESENSOR 6 +#define NATIVE_METHOD_MOTORSENSOR 7 +#define NATIVE_METHOD_GETSWITCHES 8 + +// nanovm/lang/Math +#define NATIVE_CLASS_MATH (NATIVE_CLASS_BASE+27) + +// nanovm/util/Formatter +#define NATIVE_CLASS_FORMATTER (NATIVE_CLASS_BASE+28) + +#define NATIVE_CLASS_THREAD (NATIVE_CLASS_BASE+29) + +#define NATIVE_CLASS_SEMAPHORE (NATIVE_CLASS_BASE+30) + +#define NATIVE_ID(c,m) ((c<<8)|m) + +#define NATIVE_ID2CLASS(m) (m>>8) +#define NATIVE_ID2METHOD(m) (m&0xff) +#define NATIVE_ID2FIELD(m) (m&0xff) + +#endif // NATIVE_H diff -U 3 -H -d -r -N -- epos--/src/vm/native_formatter.c epos--jvm/src/vm/native_formatter.c --- epos--/src/vm/native_formatter.c 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/native_formatter.c 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,398 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// native_lcd.c, native driver for Hitachi HD44780 based text LCDs +// + +#include + +#include "types.h" +#include "debug.h" +#include "config.h" +#include "error.h" + +#ifdef NVM_USE_FORMATTER + +#include "stack.h" +#include "native.h" +#include "native_formatter.h" +#include "nvmstring.h" + +#include +#include + +#define NATIVE_METHOD_formatI 1 +#define NATIVE_METHOD_formatZ 2 +#define NATIVE_METHOD_formatF 3 + +typedef struct +{ + u08_t flags; + u08_t width; + u08_t prec; + u08_t conv; + u08_t pre_len; + u08_t post_len; + char * post; +} formatDescr; + +// extracts all digits and fill remaining digits with '0' +void inttostr(char * begin, char * end, u32_t val, u08_t base, char a) +{ + while (begin!=end--){ + char c = val%base; + c += (c>9)?(a-10):'0'; + *end=c; + val/=base; + } +} + + + +int format_int(char * res, formatDescr * fmtdscr, int val) +{ + int n=0; + if (val<0){ + *res++='-', n++, val=-val; + } else if (fmtdscr->flags&0x04) { + *res++='+', n++; + } else if (fmtdscr->flags&0x08) { + *res++=' ', n++; + } + + char a = 'a'; + char c = fmtdscr->conv; + u08_t base = 10; + if (c=='d'){ + }else if (c=='o'){ + base=8; + }else if (c=='x'){ + base=16; + }else if (c=='X'){ + base=16; + a='A'; + } + + inttostr(res, res+10, val, base, a); + u08_t prec = 10; + u08_t i = 0; + while (prec--){ + if (res[i++]!='0') + break; + } + prec++; + if (fmtdscr->flags&0x10) { + if (fmtdscr->width-n > prec) + prec = fmtdscr->width-n; + } + if (prec==0) + prec=1; + u08_t offset = 10-prec; + while(prec--){ + res[0]=res[offset]; + res++, n++; + } + return n; +} + +int format_bool(char * res, formatDescr * fmtdscr, int val) +{ + if (fmtdscr->conv=='b'){ + if (val){ + native_strcpy(res, "true"); + return 4; + } else { + native_strcpy(res, "false"); + return 5; + } + } else if (fmtdscr->conv=='B'){ + if (val){ + native_strcpy(res, "TRUE"); + return 4; + } else { + native_strcpy(res, "FALSE"); + return 5; + } + } else { + return 0; + } +} + +#define FLOAT_DIGS 10 + +int format_float(char * res, formatDescr * fmtdscr, float val) +{ + int n=0; + if (val<0){ + *res++='-', n++, val=-val; + } else if (fmtdscr->flags&0x04) { + *res++='+', n++; + } else if (fmtdscr->flags&0x08) { + *res++=' ', n++; + } + + char a = 'a'; + char conv = fmtdscr->conv; + u08_t base = 10; + if (conv=='a'){ + base=16; + }else if (conv=='A'){ + base=16; + a='A'; + } + + s08_t max_prec = 8; + s08_t prec = max_prec; + + float factA = 1.0; + for (u08_t i=0; i0.0) { + exp=prec-1; + while(val>=factB) + val/=base, exp+=1; + while(val0){ + if (res[prec-1]!='0') + break; + prec--; + } + //prec contains number of significant digits + + // wenn exp>=0 exp+1 = Ziffern vor dem Komma + // wenn exp<0 |abs| = Nullen vor erster Ziffer + if ((exp<-4) || (exp>prec)) { + if (conv=='g') conv='e'; + if (conv=='G') conv='E'; + } else { + if (conv=='g') conv='f'; + if (conv=='G') conv='f'; + } + + s08_t pre=1; + if (conv=='f'){ + if (exp>=0) { + pre += exp; + } else { + pre=0; + } + } + if (prec>pre) + prec -= pre; + else + prec=0; + + if (fmtdscr->prec != 255) + prec = fmtdscr->prec; + DEBUGF("formatting float prec=%i pre=%i exp=%i\n", (int)prec, (int)pre, (int)exp); + + if (fmtdscr->flags&0x02){ + if (prec==0) + prec=1; + } + + u08_t offs = 1; + if (pre==0){ + offs = -exp + 1; + prec += exp + 1; + if (prec<0) { + prec=0; + } + } + for (s08_t i=pre+prec; i>=pre; i--){ + if (i>=max_prec) + res[i+offs]='0'; + else + res[i+offs]=res[i]; + } + + DEBUGF("formatting float prec=%i pre=%i exp=%i\n", (int)prec, (int)pre, (int)exp); + if (pre==0) { + *res++='0', n++; + if (prec>0){ + *res++='.', n++; + while(++exp<0) + *res++='0', n++; + } else { + u08_t x = fmtdscr->prec; + if ((x != 255)&&(x!=0)) { + *res++='.', n++; + while(x--) + *res++='0', n++; + } + } + } else if (prec>0) { + res[pre]='.'; + res++, n++; + } else { + } + + res+=pre+prec, n+=pre+prec; + + if (conv!='f'){ + *res++=conv, n++; + if (exp<0){ + *res++='-', n++; + exp=-exp; + } else { + *res++='+', n++; + } + inttostr(res, res+2, exp, base, a); + n+=2; + } + + return n; +} + +void make_format_descr(formatDescr * fmtdscr, char * fmt) +{ + u08_t mode=0; + fmtdscr->flags = 0; + fmtdscr->width = 0; + fmtdscr->prec = 255; + fmtdscr->conv = 0; + fmtdscr->pre_len = 0; + fmtdscr->post_len = 0; + fmtdscr->post = 0; + char c; + while((c=native_getchar(fmt++))){ + switch (mode){ + case 0: + if (c=='%') mode=1; + else fmtdscr->pre_len++; + break; + + case 1: + if (c=='-') fmtdscr->flags|=0x01; + else if (c=='#') fmtdscr->flags|=0x02; + else if (c=='+') fmtdscr->flags|=0x04; + else if (c==' ') fmtdscr->flags|=0x08; + else if (c=='0') fmtdscr->flags|=0x10; + else if (c=='.') fmtdscr->prec=0, mode=3; + else goto label2; + break; + + label2: + case 2: + mode=2; + if ((c>='0') && (c<='9')) { + fmtdscr->width*=10; + fmtdscr->width+=c-'0'; + } else if (c=='.'){ + fmtdscr->prec=0, mode=3; + } else { + goto label4; + } + break; + + case 3: + if ((c>='0') && (c<='9')) { + fmtdscr->prec*=10; + fmtdscr->prec+=c-'0'; + } else { + goto label4; + } + break; + + label4: + case 4: + mode=4; + fmtdscr->conv=c; + fmtdscr->post=fmt; + mode=5; + break; + + case 5: + fmtdscr->post_len++; + } + } +} + + +void native_formatter_init(void) { +} + +void native_formatter_invoke(u08_t mref) { + char * fmt = stack_peek_addr(0); + char res[50]; + + formatDescr fmtdscr; + make_format_descr(&fmtdscr, fmt); + + int len = 0; + if(mref == NATIVE_METHOD_formatI) { + nvm_int_t val = stack_peek_int(1); + len = format_int(res, &fmtdscr, val); + } else if(mref == NATIVE_METHOD_formatZ) { + nvm_int_t val = stack_peek_int(1); + len = format_bool(res, &fmtdscr, val); + } else if(mref == NATIVE_METHOD_formatF) { + nvm_float_t val = stack_peek_float(1); + len = format_float(res, &fmtdscr, val); + } else + error(ERROR_NATIVE_UNKNOWN_METHOD); + + + u08_t add = 0; + if (fmtdscr.width>len) + add = (fmtdscr.width-len); + + // allocate heap and realign strings (address may be changed by gc...) + heap_id_t id = heap_alloc(FALSE, len + add + fmtdscr.pre_len + fmtdscr.post_len + 1); + int memoffset = (char*)stack_peek_addr(0)-(char*)fmt; + fmt+=memoffset; + fmtdscr.post+=memoffset; + char * dst = heap_get_addr(id); + + // build result string + native_strncpy(dst, fmt, fmtdscr.pre_len); + dst+=fmtdscr.pre_len; + + if (!(fmtdscr.flags&0x01)){ + while(add--) + *dst++=' '; + } + + native_strncpy(dst, res, len); + dst+=len; + + if (fmtdscr.flags&0x01){ + while(add--) + *dst++=' '; + } + native_strncpy(dst, fmtdscr.post, fmtdscr.post_len); + dst+=fmtdscr.post_len; + *dst=0; + stack_pop(); + stack_pop(); + stack_push(NVM_TYPE_HEAP | id); +} + +#endif //NVM_USE_MATH + diff -U 3 -H -d -r -N -- epos--/src/vm/native_formatter.h epos--jvm/src/vm/native_formatter.h --- epos--/src/vm/native_formatter.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/native_formatter.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,30 @@ +// +// NanoVM, a tiny java VM for the Atmel LCD family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// native_formatter.h +// + +#ifndef NATIVE_FORMATTER_H +#define NATIVE_FORMATTER_H + +void native_formatter_init(void); +void native_formatter_invoke(u08_t mref); + +#endif // NATIVE_FORMATTER_H diff -U 3 -H -d -r -N -- epos--/src/vm/native_impl.c epos--jvm/src/vm/native_impl.c --- epos--/src/vm/native_impl.c 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/native_impl.c 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,146 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// native_impl.c +// + +#include "types.h" +#include "debug.h" +#include "config.h" +#include "error.h" + +#ifndef ASURO + +#include "vm.h" +#include "nvmfile.h" +#include "native.h" +#include "native_impl.h" + +#include "stack.h" + +#ifdef AVR +#include "avr/native_avr.h" +#endif + +#ifdef LCD +#include "native_lcd.h" +#endif + +#ifdef NVM_USE_STDIO +#include "native_stdio.h" +#endif + +#ifdef NVM_USE_MATH +#include "native_math.h" +#endif + +#ifdef NVM_USE_FORMATTER +#include "native_formatter.h" +#endif + +//EPOS Stuff +#include "native_thread.h" + + +void native_java_lang_object_invoke(u08_t mref) { + if(mref == NATIVE_METHOD_INIT) { + /* ignore object constructor ... */ + stack_pop(); // pop object reference + } else + error(ERROR_NATIVE_UNKNOWN_METHOD); +} + +void native_new(u16_t mref) { + if(NATIVE_ID2CLASS(mref) == NATIVE_CLASS_STRINGBUFFER) { + // create empty stringbuf object and push reference onto stack + stack_push(NVM_TYPE_HEAP | heap_alloc(FALSE, 1)); + +// EPOS Stuff + } else if (NATIVE_ID2CLASS(mref) == NATIVE_CLASS_THREAD){ + // o segundo parametro eh o tamanho da allocacao + // o primeiro tem alguma coisa a ver com identificacao + // do que eh colocado na heap + stack_push(NVM_TYPE_HEAP | heap_alloc(TRUE, 1)); + + // adicionar magica aqui: + } + + else + error(ERROR_NATIVE_UNKNOWN_CLASS); +} + +void native_invoke(u16_t mref) { + // check for native classes/methods + if(NATIVE_ID2CLASS(mref) == NATIVE_CLASS_OBJECT) { + native_java_lang_object_invoke(NATIVE_ID2METHOD(mref)); + +#ifdef NVM_USE_STDIO + } else if(NATIVE_ID2CLASS(mref) == NATIVE_CLASS_PRINTSTREAM) { + native_java_io_printstream_invoke(NATIVE_ID2METHOD(mref)); + } else if(NATIVE_ID2CLASS(mref) == NATIVE_CLASS_INPUTSTREAM) { + native_java_io_inputstream_invoke(NATIVE_ID2METHOD(mref)); + } else if(NATIVE_ID2CLASS(mref) == NATIVE_CLASS_STRINGBUFFER) { + native_java_lang_stringbuffer_invoke(NATIVE_ID2METHOD(mref)); +#endif + +#ifdef NVM_USE_MATH + // the math class +// } else if(NATIVE_ID2CLASS(mref) == NATIVE_CLASS_MATH) { +// native_math_invoke(NATIVE_ID2METHOD(mref)); +#endif + +#ifdef NVM_USE_FORMATTER + // the formatter class + } else if(NATIVE_ID2CLASS(mref) == NATIVE_CLASS_FORMATTER) { + native_formatter_invoke(NATIVE_ID2METHOD(mref)); +#endif + +#if defined(AVR) && !defined(ASURO) + // the avr specific classes + // (not used in asuro, although its avr based) + } else if(NATIVE_ID2CLASS(mref) == NATIVE_CLASS_AVR) { + native_avr_avr_invoke(NATIVE_ID2METHOD(mref)); + } else if(NATIVE_ID2CLASS(mref) == NATIVE_CLASS_PORT) { + native_avr_port_invoke(NATIVE_ID2METHOD(mref)); + } else if(NATIVE_ID2CLASS(mref) == NATIVE_CLASS_TIMER) { + native_avr_timer_invoke(NATIVE_ID2METHOD(mref)); + } else if(NATIVE_ID2CLASS(mref) == NATIVE_CLASS_ADC) { + native_avr_adc_invoke(NATIVE_ID2METHOD(mref)); + } else if(NATIVE_ID2CLASS(mref) == NATIVE_CLASS_PWM) { + native_avr_pwm_invoke(NATIVE_ID2METHOD(mref)); +#endif + +#if defined(LCD) + } else if(NATIVE_ID2CLASS(mref) == NATIVE_CLASS_LCD) { + native_lcd_invoke(NATIVE_ID2METHOD(mref)); + +#endif + +// HERE: EPOS Stuff! + } else if(NATIVE_ID2CLASS(mref) == NATIVE_CLASS_THREAD) { + native_thread_invoke(NATIVE_ID2METHOD(mref)); + } else { + error(ERROR_NATIVE_UNKNOWN_CLASS); + epos_prints("Dica: implemente a função \"error\"\n"); + } +} + + +#endif // ASURO diff -U 3 -H -d -r -N -- epos--/src/vm/native_impl.h epos--jvm/src/vm/native_impl.h --- epos--/src/vm/native_impl.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/native_impl.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,32 @@ +// +// NanoVM, a tiny java VM for microcontrollers +// +// Copyright (C) 2007 by Nils Springob +// Based on work by Benjamin Benz(c't-Bot) and Till Harbaum(NanoVM) +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +// +// native_impl.h +// + +#ifndef NATIVE_IMPL_H +#define NATIVE_IMPL_H + +void native_invoke(u16_t mref); +void native_new(u16_t mref); +void native_init(void); + +#endif // NATIVE_IMPL_H diff -U 3 -H -d -r -N -- epos--/src/vm/native_lcd.c epos--jvm/src/vm/native_lcd.c --- epos--/src/vm/native_lcd.c 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/native_lcd.c 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,179 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// native_lcd.c, native driver for Hitachi HD44780 based text LCDs +// + +#include "types.h" +#include "debug.h" +#include "config.h" +#include "error.h" + +#ifdef LCD + +#include "stack.h" +#include "native.h" +#include "native_stdio.h" // contains itoa +#include "native_lcd.h" + +#include "delay.h" + +#include +#include + +// hitachi hd44780 controller commands +#define LCD_CLEAR 0x01 +#define LCD_SET_ENTRY_MODE 0x04 +#define LCD_ENTRY_INCR 0x02 +#define LCD_ON 0x08 +#define LCD_DISPLAY_ON 0x04 +#define LCD_DISPLAY 0x08 + +#define LCD_FUNCTION 0x20 +#define LCD_8_BIT 0x10 +#define LCD_DOUBLE 0x08 +#define LCD_SET_DISP_ADDR 0x80 + +#define LCD_BUSY 0x80 + +// disable LCD by asserting E +static inline void lcd_enable(void) { + // enable LCD + LCD_CTRL_PORT |= _BV(LCD_CTRL_E); + delay(MICROSEC(10)); +} + +// disable LCD by deasserting E +static inline void lcd_disable(void) { + LCD_CTRL_PORT &= ~_BV(LCD_CTRL_E); + delay(MICROSEC(10)); +} + +// switch LCD data port to input +static inline void lcd_data_input(void) { + LCD_DATA_DDR = 0x00; // data lines are input + LCD_DATA_PORT = 0xff; // enable pull-ups +} + +// access LCD by enabling and disabling E +static inline void lcd_write(u08_t data) { + LCD_CTRL_PORT &= ~_BV(LCD_CTRL_RW); // write + + LCD_DATA_DDR = 0xFF; // set data I/O lines to output (8bit) + LCD_DATA_PORT = data; // output data, 8bits + + lcd_enable(); + lcd_disable(); + lcd_data_input(); +} + +static void lcd_wait_while_busy(void) { + // wait until LCD busy bit goes to zero + LCD_CTRL_PORT &= ~_BV(LCD_CTRL_RS); // ctrl access + lcd_data_input(); + LCD_CTRL_PORT |= _BV(LCD_CTRL_RW); // read + + lcd_enable(); + + /* wait for BUSY flag to be gone */ + while(LCD_DATA_PIN & LCD_BUSY) { + lcd_disable(); + lcd_enable(); + } + + lcd_disable(); +} + +// write the control byte to the display controller +static void lcd_write_ctrl(u08_t data) { + lcd_wait_while_busy(); + + LCD_CTRL_PORT &= ~_BV(LCD_CTRL_RS); // ctrl access + + lcd_write(data); +} + +// write a data byte to the display +static void lcd_write_data(u08_t data) { + lcd_wait_while_busy(); + + LCD_CTRL_PORT |= _BV(LCD_CTRL_RS); // data access + + lcd_write(data); +} + +// send a string to the console and append return if ret is true +static void lcd_print(char *str) { + u08_t chr; + +#ifdef NVM_USE_EEPROM + // check if source string is within internal nvm file, otherwise + // it's directly being read from ram + if(NVMFILE_ISSET(str)) { + while((chr = nvmfile_read08(str++))) + lcd_write_data(chr); + } else +#endif + while(*str) + lcd_write_data(*str++); +} + +void native_lcd_init(void) { + + // make the three control lines outputs + LCD_CTRL_PORT &= ~(_BV(LCD_CTRL_RS) | _BV(LCD_CTRL_RW) | _BV(LCD_CTRL_E)); + LCD_CTRL_DDR |= (_BV(LCD_CTRL_RS) | _BV(LCD_CTRL_RW) | _BV(LCD_CTRL_E)); + + // don't drive data lines + lcd_data_input(); + + // writing three times the config byte makes sure, that + // the interface is in 8 bit mode afterwards + lcd_write_ctrl(LCD_FUNCTION | LCD_8_BIT | LCD_DOUBLE); + lcd_write_ctrl(LCD_FUNCTION | LCD_8_BIT | LCD_DOUBLE); + lcd_write_ctrl(LCD_FUNCTION | LCD_8_BIT | LCD_DOUBLE); + + lcd_write_ctrl(LCD_ON | LCD_DISPLAY_ON); + lcd_write_ctrl(LCD_SET_ENTRY_MODE | LCD_ENTRY_INCR); +} + +void native_lcd_invoke(u08_t mref) { + if(mref == NATIVE_METHOD_LCD_CLEAR) { + lcd_write_ctrl(LCD_CLEAR); // clear LCD + // hitachi datasheet says 50 msec to wait before next command + delay(MILLISEC(50)); + } else if(mref == NATIVE_METHOD_LCD_GOTOYX) { + u08_t x = stack_pop(); + u08_t y = stack_pop(); + // set write address + lcd_write_ctrl(LCD_SET_DISP_ADDR | ((y * LCD_VIRTUAL_LINE_LENGTH) + x)); + } else if(mref == NATIVE_METHOD_LCD_PRINT_STR) { + lcd_print(stack_pop_addr()); + } else if(mref == NATIVE_METHOD_LCD_PRINT_INT) { + char tmp[8]; + native_itoa((char*)tmp, stack_pop_int()); + lcd_print(tmp); + } else if(mref == NATIVE_METHOD_LCD_PRINT_CHAR) { + lcd_write_data(stack_pop_int()); + } else + error(ERROR_NATIVE_UNKNOWN_METHOD); +} + +#endif diff -U 3 -H -d -r -N -- epos--/src/vm/native_lcd.h epos--jvm/src/vm/native_lcd.h --- epos--/src/vm/native_lcd.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/native_lcd.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,30 @@ +// +// NanoVM, a tiny java VM for the Atmel LCD family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// native_lcd.h +// + +#ifndef NATIVE_LCD_H +#define NATIVE_LCD_H + +void native_lcd_init(void); +void native_lcd_invoke(u08_t mref); + +#endif // NATIVE_LCD_H diff -U 3 -H -d -r -N -- epos--/src/vm/native_math.c.bkp epos--jvm/src/vm/native_math.c.bkp --- epos--/src/vm/native_math.c.bkp 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/native_math.c.bkp 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,135 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// native_lcd.c, native driver for Hitachi HD44780 based text LCDs +// + +#include "types.h" +#include "debug.h" +#include "config.h" +#include "error.h" + +#ifdef NVM_USE_MATH + +#include "stack.h" +#include "native.h" +#include "native_math.h" + +#include +#include + + +#define NATIVE_METHOD_absF 1 +#define NATIVE_METHOD_absI 2 +#define NATIVE_METHOD_acos 3 +#define NATIVE_METHOD_asin 4 +#define NATIVE_METHOD_atan 5 +#define NATIVE_METHOD_atan2 6 +#define NATIVE_METHOD_ceil 7 +#define NATIVE_METHOD_cos 8 +#define NATIVE_METHOD_exp 9 +#define NATIVE_METHOD_floor 10 +#define NATIVE_METHOD_log 11 +#define NATIVE_METHOD_maxF 12 +#define NATIVE_METHOD_maxI 13 +#define NATIVE_METHOD_minI 14 +#define NATIVE_METHOD_minF 15 +#define NATIVE_METHOD_pow 16 +#define NATIVE_METHOD_random 17 +#define NATIVE_METHOD_rint 18 +#define NATIVE_METHOD_round 19 +#define NATIVE_METHOD_sin 20 +#define NATIVE_METHOD_sqrt 21 +#define NATIVE_METHOD_tan 22 +#define NATIVE_METHOD_toDegrees 23 +#define NATIVE_METHOD_toRadians 24 + + +void native_math_init(void) { +} + +void native_math_invoke(u08_t mref) { + if(mref == NATIVE_METHOD_absF) { + stack_push(nvm_float2stack(fabs(stack_pop_float()))); + } else if(mref == NATIVE_METHOD_absI) { + stack_push(nvm_int2stack(abs(stack_pop_int()))); + + } else if(mref == NATIVE_METHOD_acos) { + stack_push(nvm_float2stack(acos(stack_pop_float()))); + } else if(mref == NATIVE_METHOD_asin) { + stack_push(nvm_float2stack(asin(stack_pop_float()))); + } else if(mref == NATIVE_METHOD_atan) { + stack_push(nvm_float2stack(atan(stack_pop_float()))); + } else if(mref == NATIVE_METHOD_atan2) { + nvm_float_t a = stack_pop_float(); + nvm_float_t b = stack_pop_float(); + stack_push(nvm_float2stack(atan2(a,b))); + } else if(mref == NATIVE_METHOD_ceil) { + stack_push(nvm_float2stack(ceil(stack_pop_float()))); + } else if(mref == NATIVE_METHOD_cos) { + stack_push(nvm_float2stack(cos(stack_pop_float()))); + } else if(mref == NATIVE_METHOD_exp) { + stack_push(nvm_float2stack(exp(stack_pop_float()))); + } else if(mref == NATIVE_METHOD_floor) { + stack_push(nvm_float2stack(floor(stack_pop_float()))); + } else if(mref == NATIVE_METHOD_log) { + stack_push(nvm_float2stack(log(stack_pop_float()))); + } else if(mref == NATIVE_METHOD_maxF) { + nvm_float_t a=stack_pop_float(); + nvm_float_t b=stack_pop_float(); + stack_push(nvm_float2stack(a>b?a:b)); + } else if(mref == NATIVE_METHOD_maxI) { + nvm_int_t a=stack_pop_int(); + nvm_int_t b=stack_pop_int(); + stack_push(nvm_int2stack(a>b?a:b)); + } else if(mref == NATIVE_METHOD_minI) { + nvm_int_t a=stack_pop_int(); + nvm_int_t b=stack_pop_int(); + stack_push(nvm_int2stack(a +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// native_math.h +// + +#ifndef NATIVE_MATH_H +#define NATIVE_MATH_H + +void native_math_init(void); +void native_math_invoke(u08_t mref); + +#endif // NATIVE_MATH_H diff -U 3 -H -d -r -N -- epos--/src/vm/native_semaphore.c epos--jvm/src/vm/native_semaphore.c --- epos--/src/vm/native_semaphore.c 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/native_semaphore.c 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,21 @@ +#include "types.h" +#include "debug.h" +#include "config.h" +#include "error.h" + +#include "stack.h" +#include "native.h" +#include "native_semaphore.h" + +#include + +#define NATIVE_METHOD_p 0 +#define NATIVE_METHOD_v 1 + +void native_semaphore_init(void) { + +} + +void native_semaphore_invoke(u08_t mref){ + +} diff -U 3 -H -d -r -N -- epos--/src/vm/native_semaphore.h epos--jvm/src/vm/native_semaphore.h --- epos--/src/vm/native_semaphore.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/native_semaphore.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,7 @@ +#ifndef NATIVE_SEMAPHORE_H +#define NATIVE_SEMAPHORE_H + +void native_semaphore_init(void); +void native_semaphore_invoke(u08_t mref); + +#endif // NATIVE_SEMAPHORE_H diff -U 3 -H -d -r -N -- epos--/src/vm/native_stdio.c epos--jvm/src/vm/native_stdio.c --- epos--/src/vm/native_stdio.c 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/native_stdio.c 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,259 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// native_stdio.c +// + +#include + +#include "types.h" +#include "debug.h" +#include "config.h" +#include "error.h" + +#ifdef NVM_USE_STDIO + +#include "utils.h" +#include +#include "vm.h" +#include "native.h" +#include "native_stdio.h" +#include "stack.h" +#include "nvmstring.h" + +void native_itoa(char *str, nvm_int_t val) { + nvm_int_t m; +#ifdef NVM_USE_16BIT_WORD + nvm_int_t div = 10000; // max num to be output with 15 bit integer +#else + nvm_int_t div = 1000000000L; // max num to be output +#endif + bool_t printed = FALSE; + + if(val < 0) { + *str++ = '-'; + val = -val; + } + + while(div > 0) { + m = val / div; + if(m) printed = TRUE; + + if((printed)||(div == 1)) + *str++ = '0' + m; + + val = val % div; + div /= 10; + } + + *str++ = 0; +} + +#ifdef NVM_USE_FLOAT +void native_ftoa(char *str, nvm_float_t val) { + if (val<0) + { + *str++='-'; + val=-val; + } + + nvm_int_t i = val; + native_itoa(str, i); + while (*str) str++; // to string end + char * sep = str; + val+=1-i; + i=val*1000000; + native_itoa(str, i); + sep[0] ='.'; + while (*str) str++; // to string end + while (*(--str)=='0') *str=0; + if (*str=='.') *str=0; +} +#endif + +// send a string to the console and append return if ret is true +static void native_print(char *str, bool_t ret) { +#ifdef NVM_USE_EEPROM + u08_t chr; + // check if source string is within internal nvm file, otherwise + // it's directly being read from ram + if(NVMFILE_ISSET(str)) { + while((chr = nvmfile_read08(str++))) { + epos_putc(chr); + } + } else +#endif + while(*str) {;; + epos_putc(*str++); + } + + if(ret) {;; + epos_putc('\n'); + } +} + +// invoke a native method within class java/io/PrintStream +void native_java_io_printstream_invoke(u08_t mref) { + char tmp[8]; + + if(mref == NATIVE_METHOD_PRINTLN_STR) { + native_print(stack_pop_addr(), TRUE); + } else if(mref == NATIVE_METHOD_PRINTLN_INT) { + native_itoa((char*)tmp, stack_pop_int()); + native_print(tmp, TRUE); + } else if(mref == NATIVE_METHOD_PRINT_STR) { + native_print(stack_pop_addr(), FALSE); + } else if(mref == NATIVE_METHOD_PRINT_INT) { + native_itoa((char*)tmp, stack_pop_int()); + native_print(tmp, FALSE); + } else if(mref == NATIVE_METHOD_PRINTLN_CHAR) { + epos_putc(stack_pop_int()); + epos_putc('\n'); + } else if(mref == NATIVE_METHOD_PRINT_CHAR) { + epos_putc(stack_pop_int()); + +#ifdef NVM_USE_EXT_STDIO + } else if(mref == NATIVE_METHOD_FORMAT) { + native_print(stack_pop_addr(), FALSE); + stack_pop_int(); // TODO + stack_push(stack_peek(0)); // duplicate this ref +#endif + } else + error(ERROR_NATIVE_UNKNOWN_METHOD); + + // popping the reference at the end only works as long + // as none of the native methods places anything on the stack + + stack_pop(); // pop output stream reference +} + +// invoke a native method within class java/io/InputStream +void native_java_io_inputstream_invoke(u08_t mref) { + + // popping the reference at the beginning only works as long + // as all of the native methods place something on the stack + + stack_pop(); // pop input stream reference + + if(mref == NATIVE_METHOD_INPUTSTREAM_AVAILABLE) { +// stack_push(uart_available()); + } else if(mref == NATIVE_METHOD_INPUTSTREAM_READ) { +// stack_push(uart_read_byte()); + } else + error(ERROR_NATIVE_UNKNOWN_METHOD); +} + +// invoke a native method within class java/lang/StringBuffer +void native_java_lang_stringbuffer_invoke(u08_t mref) { + if(mref == NATIVE_METHOD_INIT) { + // make this an empty string + *(char*)stack_pop_addr() = 0; + } else if(mref == NATIVE_METHOD_INIT_STR) { + char *src, *dst; + u16_t len; + + src = stack_peek_addr(0); + // check source of string + len = native_strlen(src); + + // resize existing object + heap_realloc(stack_peek(1) & ~NVM_TYPE_MASK, len + 1); + + // and copy string to new object + src = stack_peek_addr(0); + dst = heap_get_addr(stack_peek(1) & ~NVM_TYPE_MASK); + native_strcpy(dst, src); + + // get rid of source references still on the stack + stack_pop(); stack_pop(); + + } else if((mref == NATIVE_METHOD_APPEND_STR)|| + (mref == NATIVE_METHOD_APPEND_INT)|| + (mref == NATIVE_METHOD_APPEND_CHR)|| + (mref == NATIVE_METHOD_APPEND_FLOAT)) { + char *src0, *src1, *dst; +#ifdef NVM_USE_FLOAT + char tmp[15]; +#else +# ifdef NVM_USE_32BIT_WORD + char tmp[10]; +# else + char tmp[5]; +# endif +#endif + u16_t len; + heap_id_t id; + + if(mref == NATIVE_METHOD_APPEND_STR) { + // appending a string is simple + src1 = stack_peek_addr(0); + // check source of string + len = native_strlen(src1); + } else { + if(mref == NATIVE_METHOD_APPEND_INT) { + // integer has to be converted + native_itoa(tmp, stack_peek_int(0)); +#ifdef NVM_USE_FLOAT + } else if(mref == NATIVE_METHOD_APPEND_FLOAT) { + // integer has to be converted + native_ftoa(tmp, stack_peek_float(0)); +#endif + } else { + // character is directly appended + tmp[0] = stack_peek(0); + tmp[1] = 0; + } + + src1 = tmp; + len = utils_strlen((char*)src1); + } + + // this is always a string + src0 = stack_peek_addr(1); + len += native_strlen(src0); + + // create a new object + id = heap_alloc(FALSE, len + 1); + + // alloc may have had an impact on heap, so get address again + src0 = stack_peek_addr(1); + if(mref == NATIVE_METHOD_APPEND_STR) + src1 = stack_peek_addr(0); + + // handle nvmfile memory and ram + dst = heap_get_addr(id); + native_strcpy(dst, src0); + native_strcat(dst, src1); + + // get rid of source references still on the stack + stack_pop(); stack_pop(); // + // place new reference on the stack + stack_push(NVM_TYPE_HEAP | id); + + } else if(mref == NATIVE_METHOD_TOSTRING) { + // toString does nothing, since the object already is + // a valid string + } else { + DEBUGF("unknown method in java/lang/StringBuffer\n"); + error(ERROR_NATIVE_UNKNOWN_METHOD); + } +} + +#endif // NVM_USE_STDIO diff -U 3 -H -d -r -N -- epos--/src/vm/native_stdio.h epos--jvm/src/vm/native_stdio.h --- epos--/src/vm/native_stdio.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/native_stdio.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,32 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// native_stdio.h +// + +#ifndef NATIVE_STDIO_H +#define NATIVE_STDIO_H + +void native_java_io_printstream_invoke(u08_t mref); +void native_java_io_inputstream_invoke(u08_t mref); +void native_java_lang_stringbuffer_invoke(u08_t mref); +void native_itoa(char *str, nvm_int_t val); + +#endif // NATIVE_STDIO_H diff -U 3 -H -d -r -N -- epos--/src/vm/native_thread.c epos--jvm/src/vm/native_thread.c --- epos--/src/vm/native_thread.c 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/native_thread.c 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,57 @@ +#include "types.h" +#include "debug.h" +#include "config.h" +#include "error.h" + +#include "stack.h" +#include "native.h" +#include "native_thread.h" + +#include +#include + +#define NATIVE_METHOD_init 0 +#define NATIVE_METHOD_start 1 +#define NATIVE_METHOD_run 2 +#define NATIVE_METHOD_sleep 3 +#define NATIVE_METHOD_join 4 + +void native_thread_init(void) { + epos_prints("Thread::()\n"); + //stack_pop(); + // magica aqui +} + +void native_thread_sleep(){ + epos_prints("Thread::sleep()\n"); + stack_pop(); + stack_pop(); + // magica aqui +} + +//nvm_stack_t context[1000]; + + +void native_thread_start(){ + + epos_prints("native_thread_start()\n"); + + stack_pop(); + + epos_new_javathread(3, stack_pop()); +} + +void native_thread_invoke(u08_t mref){ + + switch(mref){ + case NATIVE_METHOD_init: + native_thread_init(); + break; + case NATIVE_METHOD_sleep: + native_thread_sleep(); + break; + case NATIVE_METHOD_start: + native_thread_start(); + break; + } +} diff -U 3 -H -d -r -N -- epos--/src/vm/native_thread.h epos--jvm/src/vm/native_thread.h --- epos--/src/vm/native_thread.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/native_thread.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,9 @@ +#ifndef NATIVE_THREAD_H +#define NATIVE_THREAD_H + +void native_thread_init(void); +void native_thread_invoke(u08_t mref); + +#endif // NATIVE_THREAD_H + + diff -U 3 -H -d -r -N -- epos--/src/vm/nvmcomm1.c epos--jvm/src/vm/nvmcomm1.c --- epos--/src/vm/nvmcomm1.c 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/nvmcomm1.c 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,54 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005-2006 by Till Harbaum , +// Oliver Schulz +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + + +#include "nvmcomm1.h" + +#include "uart.h" +#include "delay.h" + +#ifdef ASURO +#include +#endif + + +#ifdef NVMCOMM1 + + +u08_t uart_get_block(u08_t *data, u08_t len) { + u08_t timeout, cnt = 0; + + while(len) { + timeout = 10; // 10 * 20ms + while(!uart_available()) { + // reset watchdog here if enabled + delay(MILLISEC(20)); + if(timeout-- == 0) return cnt; + } + + *data++ = uart_read_byte(); + len--; + cnt++; + } + return cnt; +} + + +#endif // NVMCOMM1 diff -U 3 -H -d -r -N -- epos--/src/vm/nvmcomm1.h epos--jvm/src/vm/nvmcomm1.h --- epos--/src/vm/nvmcomm1.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/nvmcomm1.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,70 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005-2006 by Till Harbaum , +// Oliver Schulz +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// NVM-Comm is the NanoVM upload and communication protocol. +// NVM-Comm v1.0 is a simple protocol usable only for firmware upload. +// It's basically XMODEM with 16 bytes block size. +// + + +#ifndef NVMCOMM1_H +#define NVMCOMM1_H + + +#include "types.h" +#include "config.h" +#include "debug.h" + + +#if defined(NVM_USE_COMM) && !defined(NVMCOMM2) +#define NVMCOMM1 +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef NVMCOMM1 + + + +#define LOADER_BLOCK_SIZE 16 + +typedef struct { + u08_t soh; + u08_t block, nblock; + u08_t data[LOADER_BLOCK_SIZE]; + u08_t sum; +} PACKED loader_t; + + +u08_t uart_get_block(u08_t *data, u08_t len); + + + +#endif // NVMCOMM1 + +#ifdef __cplusplus +} +#endif + +#endif // NVMCOMM1_H diff -U 3 -H -d -r -N -- epos--/src/vm/nvmcomm2.c epos--jvm/src/vm/nvmcomm2.c --- epos--/src/vm/nvmcomm2.c 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/nvmcomm2.c 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,436 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2006 by Till Harbaum , +// Oliver Schulz +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + + +#include "nvmcomm2.h" +#include "uart.h" +#include "delay.h" +#include "loader.h" +#include "nvmfile.h" + + +#ifdef NVMCOMM2 + + +#ifdef AVR +#include +#include +#include +#endif + + +u08_t g_nvm_runlevel = NVM_RUNLVL_BOOT; + + +void nvm_showstatus_booting() { +#ifdef ASURO + // yellow status led + PORTD |= _BV(2); + PORTB |= _BV(0); +#endif +} + + +void nvm_showstatus_nvmcomm() { +#ifdef ASURO + // red status led + PORTD |= _BV(2); + PORTB &= ~_BV(0); +#endif +} + + +void nvm_showstatus_running() { +#ifdef ASURO + // green status led + PORTD &= ~_BV(2); + PORTB |= _BV(0); +#endif +} + + +void nvm_showstatus_halted() { +#ifdef ASURO + // status led off + PORTD &= ~_BV(2); + PORTB &= ~_BV(0); +#endif +} + + +void nvm_halt() { + nvm_showstatus_halted(); +#ifdef AVR + cli(); + wdt_disable(); +while (true) uart_write_byte('H'); //!! DEBUG OUTPUT + for(;;); +#else + exit(0); +#endif +} + + +void nvm_reset() { +#ifdef AVR + cli(); + wdt_enable(WDTO_15MS); + for(;;); +#else + exit(0); +#endif +} + + + +u08_t g_nvc2_address = 0x10; +u08_t g_nvc2_msg_status = 0; +u08_t g_nvc2_query_status = 0; +u08_t g_nvc2_track = 0; +u08_t g_nvc2_le = 0; +u08_t g_nvc2_msgid = 0; +u08_t g_nvc2_lastid = 0xFF; +u16_t g_nvc2_crc = 0; +u08_t g_nvc2_command; + +u08_t g_nvc2_data[NVC2_BUFFER_SIZE]; +size8_t g_nvc2_dsize = 0; + + +s08_t g_nvc2_file_open = -1; +u16_t g_nvc2_file_pos = 0; + +bool g_nvc2_query_success = false; +u08_t g_nvc2_query_rsize = 0; + + + +static inline void nvc2_message_drop() + { g_nvc2_msg_status &= NVC2_STATUS_ENABLED | NVC2_STATUS_AVAIL; } + + +static inline bool nvc2_message_tracking() + { return (g_nvc2_msg_status & NVC2_STATUS_TRACKING) > 0; } + +static inline void nvc2_message_set_tracking() + { g_nvc2_msg_status = NVC2_STATUS_ENABLED | NVC2_STATUS_TRACKING; } + +static inline void nvc2_message_unset_tracking() { + g_nvc2_msg_status &= (0xFF ^ NVC2_STATUS_TRACKING); +} + + +static inline bool nvc2_message_ignore() + { return (g_nvc2_msg_status & NVC2_STATUS_IGNORE) > 0; } + +static inline void nvc2_message_set_ignore() + { g_nvc2_msg_status |= NVC2_STATUS_IGNORE; } + +static inline bool nvc2_message_invalid() + { return (g_nvc2_msg_status & NVC2_QUERY_INVALID) > 0; } + +static inline void nvc2_message_set_invalid() + { g_nvc2_msg_status |= NVC2_QUERY_INVALID; } + +static inline bool nvc2_message_repeated() + { return (g_nvc2_msg_status & NVC2_QUERY_REPEATED) > 0; } + + static inline void nvc2_message_set_repeated() + { g_nvc2_msg_status |= NVC2_QUERY_REPEATED; } + +static inline bool nvc2_message_read() + { return (g_nvc2_msg_status & NVC2_QUERY_READ) > 0; } + +static inline void nvc2_message_set_read() + { g_nvc2_msg_status |= NVC2_QUERY_READ; } + +static inline void nvc2_message_set_command() + { g_nvc2_msg_status |= NVC2_QUERY_COMMAND; } + + +static inline void nvc2_query_set_available() + { g_nvc2_msg_status |= NVC2_STATUS_AVAIL; } + + + +bool nvc2_proc_input(u08_t value) { + if (!nvc2_message_tracking()) { + // not currently tracking a message, check for message start char + switch (value) { + case ASCII_SYN: + nvc2_message_set_ignore(); + case ASCII_DLE: + nvc2_message_set_tracking(); + g_nvc2_track = 0; + g_nvc2_le = 0xFF; // initial LE + g_nvc2_crc = 0xFFFF; // initialize CRC for FCS-16 + break; + default: return false; + } + + // if buffers still blocked by last query, ignore message + if (nvc2_query_available()) nvc2_message_set_ignore(); + } else { + // invert if crc value + if (g_nvc2_track >= g_nvc2_le) value ^= 0xFF; + // update crc + g_nvc2_crc = crc16_ccitt_lsbf_update(value, g_nvc2_crc); + + if (g_nvc2_track == 0) { + // LE + g_nvc2_le = value; + // If message too long, ignore it + if (g_nvc2_le > NVC2_BUFFER_SIZE + 5) nvc2_message_set_ignore(); + } else if (g_nvc2_track == 1) { + // LEr, if != LE, drop message + if (value != g_nvc2_le) { + nvc2_message_drop(); + } + } else if (g_nvc2_track == 2) { + // RRRRNNN1 + if ((value & 0x01) > 0) { + // if not master message, ignore it. + nvc2_message_set_ignore(); + } + else { + // check if repeated message + value = (value >> 1) & 0x07; + g_nvc2_msgid = value; + + if (value == g_nvc2_lastid) nvc2_message_set_repeated(); + } + } else if (g_nvc2_track == 3) { + // AAAAAAA0 + // check if read query. + if ((value & 0x01) > 0) { + nvc2_message_set_read(); + // initialize response length with 0 + g_nvc2_data[0] = 0; + } + // ignore message if not addressed to this system and not + // general call / broadcast + value = value >> 1; + if (value != g_nvc2_address) { + nvc2_message_set_ignore(); + } + } else if (g_nvc2_track == g_nvc2_le) { + // CRC-L + } else if (g_nvc2_track == g_nvc2_le+1) { + // CRC-H, full message received + if (!nvc2_message_ignore()) { + if (g_nvc2_crc == 0) { + // valid message + // compute message data size + g_nvc2_dsize = (g_nvc2_le>5) ? g_nvc2_le-5 : 0; + } else { + // invalid crc + nvc2_message_set_invalid(); + } + nvc2_query_set_available(); + // copy tracked message status bits to query status bits + g_nvc2_query_status = g_nvc2_msg_status; + } + // stop tracking + nvc2_message_unset_tracking(); + // update last-message id + g_nvc2_lastid = g_nvc2_msgid; + } else if (g_nvc2_track == 4) { + // CMD + if (!nvc2_message_ignore()) { + nvc2_message_set_command(); + g_nvc2_command = value; + } + } else if (!nvc2_message_ignore() && !nvc2_message_repeated()) { + // DATA + g_nvc2_data[g_nvc2_track - 5] = value; + } + ++g_nvc2_track; + } + + return true; +} + + +static inline void nvc2_send_response() { + u08_t msgLen = g_nvc2_query_rsize + 3; + u16_t crc = 0xFFFF; + + // send SYN + + uart_write_byte(ASCII_SYN); + + // send LE, LEr/LEi, 0000NNN1 and DATA + + u08_t value = msgLen; + for (size8_t i=0; i=3) value = g_nvc2_data[i-3]; + + crc = crc16_ccitt_lsbf_update(value, crc); + uart_write_byte(value); + + if (!g_nvc2_query_success) value = value ^ 0xFF; // invert repeated length if error + } + crc ^= 0xFFFF; + + // send CRC (FCS-16) + + uart_write_byte((u08_t)(crc & 0xFF)); + uart_write_byte((u08_t)(crc >> 8)); +} + + +// 7976, 7948 +static inline void nvc2_process_query() { + if (nvc2_query_invalid()) { + // invalid query message (transmission error), set empty error response + g_nvc2_query_rsize = 0; + g_nvc2_query_success = false; + } else if (nvc2_query_repeated()) { + // repeated query, do no processing, leave last response + } else { + // normal query + + g_nvc2_query_rsize = 0; + g_nvc2_query_success = false; + + const u08_t command = nvc2_query_command(); + + if (!nvc2_query_hascmd()) { + // process an empty query, set empty response + g_nvc2_query_success = true; + } else if (nvc2_query_read()) { + // process a read query + const u08_t respSize = nvc2_query_rsize(); + u08_t *data = g_nvc2_data; + + if (respSize <= NVC2_BUFFER_SIZE) switch (command) { + case NVC2_CMD_RWFILE: { + if (g_nvc2_file_open == NVC2_FILE_FIRMWARE) { + u08_t *addr = nvmfile_get_base(); + addr += g_nvc2_file_pos; + + for (size8_t i=0; i 0) + if ( (dsize==1) && ( (data0==NVM_RUNLVL_HALT) + || (data0==NVM_RUNLVL_CONF) + || (data0==NVM_RUNLVL_VM) + || (data0==NVM_RUNLVL_RESET) ) ) + { g_nvm_runlevel = data0; + g_nvc2_query_success = true; } + } break; + } + } + + if (!g_nvc2_query_success) { + g_nvc2_query_rsize = 1; + g_nvc2_data[0] = 1; + } + } + + nvc2_send_response(); + nvc2_query_finished(); + + // check for reset or halt runlevel + if (g_nvm_runlevel == NVM_RUNLVL_RESET) nvm_reset(); + if (g_nvm_runlevel == NVM_RUNLVL_HALT) nvm_halt(); +} + + +void nvc2_check_input() { + while (true) { + // wait for input within timeout limits + for (u08_t i=0; !uart_available() && (i < NVC2_RECV_UART_TIMEOUT); ++i) + { delay(MILLISEC(1)); } + + if (uart_available()) { + // input available + u08_t value = uart_read_byte(); + if (!nvc2_enabled() || !nvc2_proc_input(value)) { + // received input doesn't belong to a message, + // possible alternative input processing here + } + } else { + // UART timeout + nvc2_message_drop(); + break; + } + + if (nvc2_query_available()) { + // query received + nvc2_process_query(); + break; + } + } +} + + +#endif // NVMCOMM2 diff -U 3 -H -d -r -N -- epos--/src/vm/nvmcomm2.h epos--jvm/src/vm/nvmcomm2.h --- epos--/src/vm/nvmcomm2.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/nvmcomm2.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,230 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2006 by Till Harbaum , +// Oliver Schulz +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// NVM-Comm is the NanoVM upload and communication protocol. +// NVM-Comm v2.0 is more versatile and robust than v1.0, but also more +// complex. +// Since NVM-Comm v2.0 is still under development, NanoVM is currently +// compiled for NVM-Comm v1.0 by default. +// + + +#ifndef NVMCOMM2_H +#define NVMCOMM2_H + + +#ifdef AVR +#include +#include +#include +#endif + +#ifdef UNIX +#include +#endif + +#include "types.h" +#include "nvmcomm1.h" +#include "loader.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef NVMCOMM2 + + + +#define NVM_RUNLVL_HALT 0x00 +#define NVM_RUNLVL_CONF 0x01 +#define NVM_RUNLVL_VM 0x03 +#define NVM_RUNLVL_RESET 0x06 +#define NVM_RUNLVL_BOOT 0x07 + + +extern u08_t g_nvm_runlevel; // NanoVM system runlevel + + +void nvm_showstatus_booting(); + +void nvm_showstatus_nvmcomm(); + +void nvm_showstatus_running(); + +void nvm_showstatus_halted(); + + +void nvm_halt(); + +void nvm_reset(); + + + +// CRC-16-CCITT, msb-first, Polynomial: x^16 + x^12 + x^5 + 1 +static inline uint16_t crc16_ccitt_msbf_update(uint8_t data, uint16_t crc) { +#ifdef AVR + crc = _crc_xmodem_update(crc, data); +#else + crc = ((crc >> 8) & (0x00ff)) | (crc << 8); + crc ^= data; + crc ^= (crc & 0xff) >> 4; + crc ^= (crc << 8) << 4; + crc ^= ((crc & 0xff) << 4) << 1; +#endif + return crc; +} + + +// CRC-16-CCITT, lsb-first, Polynomial: x^16 + x^12 + x^5 + 1 +static inline uint16_t crc16_ccitt_lsbf_update(uint8_t data, uint16_t crc) { +#ifdef AVR + crc = _crc_ccitt_update(crc, data); +#else + data ^= (crc & 0xFF); + data ^= data << 4; + + crc = ((uint16_t)data << 8) | (crc >> 8); + crc ^= (uint8_t)(data >> 4); + crc ^= (uint16_t)(data << 3); +#endif + return crc; +} + + + +#define NVC2_MAX_MSG_LEN 0x7F // Maximum message length + +#define NVC2_BUFFER_SIZE 16 // NVC2 I/O data buffer size + +#define NVC2_MAX_FID 0 // maximum supported file id +#define NVC2_FILE_FIRMWARE 0x00 // firmware file id + +#define NVC2_CMD_FOPEN 0x70 +#define NVC2_CMD_FCLOSE 0x71 +#define NVC2_CMD_RWFILE 0x72 +#define NVC2_CMD_RUNLVL 0x7E + +#define NVC2_STATUS_ENABLED (1<<7) // 1/0: NVM-Comm2 enabled/disabled +#define NVC2_STATUS_AVAIL (1<<6) // 1: Recieved query is available +#define NVC2_STATUS_TRACKING (1<<5) // 1: Tracking a message +#define NVC2_STATUS_IGNORE (1<<4) // 1: Ignore this message +#define NVC2_QUERY_INVALID (1<<3) // 1: Invalid Message (CRC Error or incomplete) +#define NVC2_QUERY_REPEATED (1<<2) // 1: Received a repeated message +#define NVC2_QUERY_READ (1<<1) // 1/0 : Recieved message is a read/write query +#define NVC2_QUERY_COMMAND (1<<0) // 1: Recieved query contains a command + +#define NVC2_TIMEOUT_CHARS 4 // Input timout in units of byte transmission time + +#ifdef UART_BITRATE +#define NVC2_RECV_UART_TIMEOUT NVC2_TIMEOUT_CHARS*(10000/UART_BITRATE) + 1 // UART timeout during message reception / ms +#else +#define NVC2_RECV_UART_TIMEOUT 1 // UART timeout during message reception / ms +#endif + +extern u08_t g_nvc2_address; // System address +extern u08_t g_nvc2_msg_status; // NVM-Comm2 tracked message status byte +extern u08_t g_nvc2_query_status; // NVM-Comm2 query status byte +extern u08_t g_nvc2_track; // NVM-Comm2 tracking position +extern u08_t g_nvc2_le; // NVM-Comm2 message length +extern u08_t g_nvc2_msgid; // message id +extern u08_t g_nvc2_lastid; // last message id +extern u16_t g_nvc2_crc; // message crc +extern u08_t g_nvc2_command; // Used only if (g_nvc2_msg_status & NVC2_QUERY_COMMAND) > 0. + +// For write queries, g_nvc2_data contains the write data, +// g_nvc2_dsize is set to the data length. +// For read queries, g_nvc2_data[0] is set to RSP, g_nvc2_dsize is not set. +// On reception of invalid or repeated messages, g_nvc2_data is not modified. +extern u08_t g_nvc2_data[NVC2_BUFFER_SIZE]; +extern size8_t g_nvc2_dsize; + +extern s08_t g_nvc2_file_open; // open file id (id 0 = firmware); +extern u16_t g_nvc2_file_pos; // read/write position in open file + +extern bool g_nvc2_query_success; // success of last query +extern u08_t g_nvc2_query_rsize; // last response length + + +// Check if NVM-Comm2 enabled +static inline bool nvc2_enabled() + { return (g_nvc2_msg_status & NVC2_STATUS_ENABLED) > 0; } + +// Enable NVM-Comm2 +static inline void nvc2_enable() + { if (!nvc2_enabled()) g_nvc2_msg_status = NVC2_STATUS_ENABLED; } + +// Disable NVM-Comm2 +static inline void nvc2_disable() + { if (!nvc2_enabled()) g_nvc2_msg_status = 0x00; } + + +// Check if a new query is available +static inline bool nvc2_query_available() + { return (g_nvc2_msg_status & NVC2_STATUS_AVAIL) > 0; } + +// Free things for the next query. +static inline void nvc2_query_finished() { g_nvc2_msg_status &= (0xFF ^ NVC2_STATUS_AVAIL); } + + +// Check if query is invalid +static inline bool nvc2_query_invalid() + { return (g_nvc2_query_status & NVC2_QUERY_INVALID) > 0; } + +// Check if query is repeated +static inline bool nvc2_query_repeated() + { return (g_nvc2_query_status & NVC2_QUERY_REPEATED) > 0; } + +// Check if query is read or write +static inline bool nvc2_query_read() + { return (g_nvc2_query_status & NVC2_QUERY_READ) > 0; } + +// Respone length, use only for read queries. +static inline size8_t nvc2_query_rsize() { return g_nvc2_data[0]; } + +// Data length, use only for write queries. +static inline size8_t nvc2_query_dsize() { return g_nvc2_dsize; } + +// Check if query includes a command (else it's an empty query). +static inline bool nvc2_query_hascmd() + { return (g_nvc2_query_status & NVC2_QUERY_COMMAND) > 0; } + +// Data length, use only if nvc2_query_hascmd()==true. +static inline size8_t nvc2_query_command() { return g_nvc2_command; } + + + +bool nvc2_proc_input(u08_t value); + +//void nvc2_send_response(); + +//void nvc2_process_query(); + +void nvc2_check_input(); + + +#endif // NVMCOMM2 + +#ifdef __cplusplus +} +#endif + +#endif // NVMCOMM2_H diff -U 3 -H -d -r -N -- epos--/src/vm/nvmdefault.h epos--jvm/src/vm/nvmdefault.h --- epos--/src/vm/nvmdefault.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/nvmdefault.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,25 @@ +/* Main.h, autogenerated from Main class */ +{ +0x00, 0x00, 0x00, 0xbe, 0x02, 0x0a, 0x01, 0x00, 0x15, 0x00, 0x15, 0x00, 0x88, 0x00, 0x00, 0x10, +0x00, 0x02, 0x01, 0x10, 0x00, 0x08, 0x00, 0x1e, 0x00, 0x37, 0x00, 0x51, 0x00, 0x43, 0x72, 0x69, +0x61, 0x6e, 0x64, 0x6f, 0x20, 0x75, 0x6d, 0x20, 0x50, 0x72, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x2e, +0x2e, 0x2e, 0x00, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x75, 0x74, 0x6f, 0x72, 0x20, 0x64, 0x6f, +0x20, 0x50, 0x72, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x2e, 0x2e, 0x2e, 0x00, 0x43, 0x68, 0x61, 0x6d, +0x61, 0x6e, 0x64, 0x6f, 0x20, 0x73, 0x75, 0x70, 0x65, 0x72, 0x2e, 0x73, 0x74, 0x61, 0x72, 0x74, +0x28, 0x29, 0x2e, 0x2e, 0x2e, 0x00, 0x43, 0x68, 0x61, 0x6d, 0x61, 0x6e, 0x64, 0x6f, 0x20, 0x53, +0x74, 0x61, 0x74, 0x69, 0x63, 0x54, 0x68, 0x72, 0x65, 0x61, 0x64, 0x2e, 0x73, 0x74, 0x61, 0x72, +0x74, 0x28, 0x74, 0x68, 0x69, 0x73, 0x29, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, +0x4d, 0x00, 0x01, 0x00, 0x00, 0x01, 0x03, 0x03, 0x68, 0x00, 0x02, 0x01, 0x00, 0x02, 0x02, 0x02, +0x72, 0x00, 0x03, 0x01, 0x00, 0x01, 0x01, 0x02, 0x77, 0x00, 0x04, 0x01, 0x00, 0x01, 0x01, 0x02, +0x7c, 0x00, 0x00, 0x02, 0x00, 0x01, 0x01, 0x01, 0x79, 0x00, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00, +0x75, 0x00, 0x04, 0x02, 0x00, 0x01, 0x01, 0x02, 0x7a, 0x00, 0x06, 0x02, 0x00, 0x01, 0x01, 0x01, +0x77, 0x00, 0x03, 0x02, 0x00, 0x01, 0x01, 0x01, 0x1a, 0xb7, 0x10, 0x00, 0xb1, 0x11, 0x11, 0x00, +0x12, 0x00, 0xb6, 0x12, 0x01, 0xbb, 0x01, 0x00, 0x59, 0x04, 0xb7, 0x00, 0x02, 0x3c, 0xbb, 0x01, +0x00, 0x59, 0x05, 0xb7, 0x00, 0x02, 0x3d, 0x1b, 0xb6, 0x00, 0x04, 0x1c, 0xb6, 0x00, 0x04, 0xb1, +0x1a, 0xb7, 0x00, 0x05, 0x1a, 0x1b, 0xb5, 0x00, 0x00, 0x11, 0x11, 0x00, 0x12, 0x01, 0xb6, 0x12, +0x01, 0xb1, 0x11, 0x11, 0x00, 0x1a, 0xb4, 0x00, 0x00, 0xb6, 0x12, 0x02, 0xa7, 0xff, 0xf6, 0x11, +0x11, 0x00, 0x12, 0x02, 0xb6, 0x12, 0x01, 0x1a, 0xb7, 0x00, 0x07, 0xb1, 0x1a, 0xb7, 0x10, 0x00, +0xb1, 0xb8, 0x2d, 0x03, 0xb1, 0x11, 0x11, 0x00, 0x12, 0x03, 0xb6, 0x12, 0x01, 0x1a, 0xb8, 0x2d, +0x01, 0xb1, 0x1a, 0xb8, 0x2d, 0x04, 0xb1, 0x1a, 0xb8, 0x2d, 0x02, 0xb1, 0x00, 0x00, 0x00, 0xbe, +0x02, 0x0a, 0x01, 0x00, 0x15, 0x00, 0x15, 0x00, 0x88, 0x00, 0x00 +}; diff -U 3 -H -d -r -N -- epos--/src/vm/nvmfeatures.h epos--jvm/src/vm/nvmfeatures.h --- epos--/src/vm/nvmfeatures.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/nvmfeatures.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,90 @@ +#ifndef _NVMFEAUTURES_H_ +#define _NVMFEAUTURES_H_ + +// checking flags... +#ifdef NVM_USE_SWITCH +# ifndef NVM_USE_LOOKUPSWITCH +# define NVM_USE_LOOKUPSWITCH +# endif +# ifndef NVM_USE_TABLESWITCH +# define NVM_USE_TABLESWITCH +# endif +#endif + +// checking int size flags +#ifdef NVM_USE_16BIT_WORD +# ifdef NVM_USE_32BIT_WORD +# error "you must define either NVM_USE_16BIT_WORD or NVM_USE_32BIT_WORD, not both!" +# endif +#else +# ifndef NVM_USE_32BIT_WORD +# define NVM_USE_16BIT_WORD +# endif +#endif + +// checking float flags +#ifdef NVM_USE_FLOAT +# ifndef NVM_USE_32BIT_WORD +# error "NVM_USE_FLOAT is only allowed with NVM_USE_32BIT_WORD!" +# endif +#endif + + +#define NVMFILE_VERSION 2 +#define NVMFILE_MAGIC 0xBE000000L + + +#define NVM_FEAUTURE_LOOKUPSWITCH (1L<<0) +#define NVM_FEAUTURE_TABLESWITCH (1L<<1) +#define NVM_FEAUTURE_32BIT (1L<<2) +#define NVM_FEAUTURE_FLOAT (1L<<3) +#define NVM_FEAUTURE_ARRAY (1L<<4) +#define NVM_FEAUTURE_INHERITANCE (1L<<5) +#define NVM_FEAUTURE_EXTSTACK (1L<<6) + +#ifndef NVM_USE_LOOKUPSWITCH +# undef NVM_FEAUTURE_LOOKUPSWITCH +# define NVM_FEAUTURE_LOOKUPSWITCH 0 +#endif + +#ifndef NVM_USE_TABLESWITCH +# undef NVM_FEAUTURE_TABLESWITCH +# define NVM_FEAUTURE_TABLESWITCH 0 +#endif + +#ifndef NVM_USE_32BIT_WORD +# undef NVM_FEAUTURE_32BIT +# define NVM_FEAUTURE_32BIT 0 +#endif + +#ifndef NVM_USE_FLOAT +# undef NVM_FEAUTURE_FLOAT +# define NVM_FEAUTURE_FLOAT 0 +#endif + +#ifndef NVM_USE_ARRAY +# undef NVM_FEAUTURE_ARRAY +# define NVM_FEAUTURE_ARRAY 0 +#endif + +#ifndef NVM_USE_INHERITANCE +# undef NVM_FEAUTURE_INHERITANCE +# define NVM_FEAUTURE_INHERITANCE 0 +#endif + +#ifndef NVM_USE_EXTSTACKOPS +# undef NVM_FEAUTURE_EXTSTACK +# define NVM_FEAUTURE_EXTSTACK 0 +#endif + + +#define NVM_MAGIC_FEAUTURE (NVMFILE_MAGIC\ + |NVM_FEAUTURE_LOOKUPSWITCH\ + |NVM_FEAUTURE_TABLESWITCH\ + |NVM_FEAUTURE_32BIT\ + |NVM_FEAUTURE_FLOAT\ + |NVM_FEAUTURE_ARRAY\ + |NVM_FEAUTURE_INHERITANCE) + + +#endif // _NVMFEAUTURES_H_ diff -U 3 -H -d -r -N -- epos--/src/vm/nvmfile.c epos--jvm/src/vm/nvmfile.c --- epos--/src/vm/nvmfile.c 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/nvmfile.c 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,362 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// nvmfile.c +// +// routines to store and access the NanoVM internal nvm file +// format as generated by NanoVMTool +// + +#include +#include +#include + +#include "types.h" +#include "debug.h" +#include "config.h" +#include "error.h" + +#include "nvmfile.h" +#include "vm.h" +#include "eeprom.h" +#include "nvmfeatures.h" + +#ifdef NVM_USE_FLASH_PROGRAM +# include +# include +#endif + +// buffer for file itself is in eeprom +#ifdef NVM_USE_DEFAULT_FILE + +# ifdef NVM_USE_FLASH_PROGRAM + static u08_t nvmfile[CODESIZE] PROGMEM = +# else +# if defined(NVM_USE_COMM) || defined(NVM_USE_DISK_FILE) + static u08_t EEPROM nvmfile[CODESIZE] = +# else + static u08_t EEPROM nvmfile[] = +# endif +# endif +# include "nvmdefault.h" + +#else + +# ifdef NVM_USE_FLASH_PROGRAM + extern u08_t nvmfile[CODESIZE] PROGMEM; +# else +# if defined(NVM_USE_COMM) || defined(NVM_USE_DISK_FILE) + extern u08_t EEPROM nvmfile[CODESIZE]; +# else + extern u08_t EEPROM nvmfile[]; +# endif +# endif + +#endif + +u08_t nvmfile_constant_count; + +#ifdef NVM_USE_DISK_FILE +void nvmfile_load(const char *filename, bool_t quiet) { + FILE *file; + u16_t size; + + file = fopen(filename, "rb"); + if(!file) { + printf("Unable to open file %s\n", filename); + exit(-1); + } + +#ifdef NVM_USE_EEPROM + + // get file size + fseek(file, 0l, SEEK_END); + size = ftell(file); + fseek(file, 0l, SEEK_SET); + + { + u08_t *buffer = malloc(size); + + if(!quiet) printf("Loading %s, size %d\n", filename, size); + + if(fread(buffer, 1, size, file) != size) { + perror("fread()"); + exit(-1); + } + + DEBUG_HEXDUMP(buffer, size); + + // store in nvm buffer + nvmfile_store(0, buffer, size); + } + +#else // NVM_USE_EEPROM + + if(!quiet) printf("Loading %s", filename); + + size = fread(nvmfile, 1, CODESIZE, file); + if(ferror(file)) { + perror("fread()"); + exit(-1); + } + + if(!quiet) printf(", size %d\n", size); + + DEBUG_HEXDUMP(nvmfile, size); + +#endif // NVM_USE_EEPROM + + fclose(file); +} +#endif // NVM_USE_DISK_FILE + +void *nvmfile_get_base(void) { + return nvmfile; +} + +#ifdef NVM_USE_EEPROM +#ifdef NVM_USE_FLASH_PROGRAM + +void nvmfile_read(void *dst, const void *src, u16_t len) { + src = NVMFILE_ADDR(src); // remove marker (if present) + memcpy_P(dst, (PGM_P)src, len); +} + +u08_t nvmfile_read08(const void *addr) { + u08_t val; + addr = NVMFILE_ADDR(addr); // remove marker (if present) + memcpy_P((u08_t*)&val, (PGM_P)addr, sizeof(val)); + return val; +} + +u16_t nvmfile_read16(const void *addr) { + u16_t val; + addr = NVMFILE_ADDR(addr); // remove marker (if present) + memcpy_P((u08_t*)&val, (PGM_P)addr, sizeof(val)); + return val; +} + +u32_t nvmfile_read32(const void *addr) { + u32_t val; + addr = NVMFILE_ADDR(addr); // remove marker (if present) + memcpy_P((u08_t*)&val, (PGM_P)addr, sizeof(val)); + return val; +} + +void nvmfile_write08(void *addr, u08_t data) { + //no write +} + +void nvmfile_write_initialize(void) { + +} + +void nvmfile_write_finalize(void) { + +} + +#else // NVM_USE_FLASH_PROGRAM + +void nvmfile_read(void *dst, const void *src, u16_t len) { + src = NVMFILE_ADDR(src); // remove marker (if present) + eeprom_read_block(dst, (eeprom_addr_t)src, len); +} + +u08_t nvmfile_read08(const void *addr) { + u08_t val; + addr = NVMFILE_ADDR(addr); // remove marker (if present) + eeprom_read_block((u08_t*)&val, (eeprom_addr_t)addr, sizeof(val)); + return val; +} + +u16_t nvmfile_read16(const void *addr) { + u16_t val; + addr = NVMFILE_ADDR(addr); // remove marker (if present) + eeprom_read_block((u08_t*)&val, (eeprom_addr_t)addr, sizeof(val)); + return val; +} + +u32_t nvmfile_read32(const void *addr) { + u32_t val; + addr = NVMFILE_ADDR(addr); // remove marker (if present) + eeprom_read_block((u08_t*)&val, (eeprom_addr_t)addr, sizeof(val)); + return val; +} + +void nvmfile_write08(void *addr, u08_t data) { + addr = NVMFILE_ADDR(addr); // remove marker (if present) + eeprom_write_byte((eeprom_addr_t)addr, data); +} + +#endif // NVM_USE_FLASH_PROGRAM + +void nvmfile_store(u16_t index, u08_t *buffer, u16_t size) { +#ifdef DEBUG + // this check is not required in real life, since the code + // limit is verified by the upload tool and by the compiler for + // the default code + if(size > CODESIZE) { + DEBUGF("Code size exceeds buffer size (%d > %d)\n", + size, CODESIZE); + for(;;); + } +#endif + + eeprom_write_block(buffer, (eeprom_addr_t)(nvmfile + index), size); +} + +#endif // NVM_USE_EEPROM + +bool_t nvmfile_init(void) { + u16_t t; + nvm_header_t * nvm_header = (nvm_header_t *)nvmfile; + + u32_t features = nvmfile_read32(&nvm_header->magic_feature); + DEBUGF("NVM_MAGIC_FEAUTURE[file] = %x\n", features); + DEBUGF("NVM_MAGIC_FEAUTURE[vm] = %x\n", NVM_MAGIC_FEAUTURE); + + if ((features&NVM_MAGIC_FEAUTURE)!=(features|NVMFILE_MAGIC)) { + error(ERROR_NVMFILE_MAGIC); + return FALSE; + } + + if(nvmfile_read08(&nvm_header->version) != NVMFILE_VERSION) { + error(ERROR_NVMFILE_VERSION); + return FALSE; + } + + t = nvmfile_read16(&nvm_header->string_offset); + t -= nvmfile_read16(&nvm_header->constant_offset); + nvmfile_constant_count = t/4; + + return TRUE; +} + +nvm_method_hdr_t *nvmfile_get_method_hdr(u16_t index) { + // get pointer to method header + nvm_header_t * nvm_header = (nvm_header_t *)nvmfile; + nvm_method_hdr_t *hdrs = + ((nvm_method_hdr_t*)(nvmfile + + nvmfile_read16(&nvm_header->method_offset)))+index; + + return(hdrs); +} + +u32_t nvmfile_get_constant(u08_t index) { + nvm_ref_t res; + + if (indexconstant_offset); + u32_t result = nvmfile_read32(nvmfile+addr+4*index); + DEBUGF(" constant = 0x%08x\n", result); + return result; + } + // it's a string! + + DEBUGF(" constant string index = %i\n", index); + res = NVM_TYPE_CONST | (index-nvmfile_constant_count); + return res; +} + +void nvmfile_call_main(void) { + u08_t i; + + nvm_header_t * nvm_header = (nvm_header_t *)nvmfile; + for(i=0;imethods);i++) { + // is this a clinit method? + if(nvmfile_read08(&nvmfile_get_method_hdr(i)->flags) & FLAG_CLINIT) { + DEBUGF("calling clinit %d\n", i); + vm_run(i); + } + } + + // determine method description address and code + vm_run(nvmfile_read16(&nvm_header->main)); +} + +void *nvmfile_get_addr(u16_t ref) { + // get pointer to string + nvm_header_t * nvm_header = (nvm_header_t *)nvmfile; + u16_t *refs = + (u16_t*)(nvmfile + + nvmfile_read16(&nvm_header->string_offset)); + + return((u08_t*)refs + nvmfile_read16(refs+ref)); +} + +u08_t nvmfile_get_class_fields(u08_t index) { + nvm_header_t * nvm_header = (nvm_header_t *)nvmfile; + return nvmfile_read08(&nvm_header->class_hdr[index].fields); +} + +u08_t nvmfile_get_static_fields(void) { + nvm_header_t * nvm_header = (nvm_header_t *)nvmfile; + return nvmfile_read08(&nvm_header->static_fields); +} + +#ifdef NVM_USE_INHERITANCE +u08_t nvmfile_get_method_by_fixed_class_and_id(u08_t class, u08_t id) { + u08_t i; + nvm_method_hdr_t mhdr, *mhdr_ptr; + + DEBUGF("Searching for class "DBG8", method "DBG8"\n", class, id); + epos_prints("class = "); + epos_printi(class); + epos_prints(", id = "); + epos_printi(id); + epos_prints("\n"); + + nvm_header_t * nvm_header = (nvm_header_t *)nvmfile; + for(i=0;imethods);i++) { + DEBUGF("Method %d ", i); + // load new method header into ram + mhdr_ptr = nvmfile_get_method_hdr(i); + nvmfile_read(&mhdr, mhdr_ptr, sizeof(nvm_method_hdr_t)); + DEBUGF("id = #"DBG16"\n", mhdr.id); + + if(((mhdr.id >> 8) == class) && ((mhdr.id & 0xff) == id)) { + DEBUGF("Match!\n"); + return i; + } + } + + DEBUGF("No matching method in this class\n"); + + return 0xff; +} + +u08_t nvmfile_get_method_by_class_and_id(u08_t class, u08_t id) { + u08_t mref; + + nvm_header_t * nvm_header = (nvm_header_t *)nvmfile; + for(;;) { + if((mref = nvmfile_get_method_by_fixed_class_and_id(class, id)) != 0xff) + return mref; + + DEBUGF("Getting super class of %d ", class); + class = nvmfile_read08(&nvm_header->class_hdr[class].super); + DEBUGF("-> %d\n", class); + } + + return 0; +} +#endif diff -U 3 -H -d -r -N -- epos--/src/vm/nvmfile.h epos--jvm/src/vm/nvmfile.h --- epos--/src/vm/nvmfile.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/nvmfile.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,117 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// nvmfile.h +// + +#ifndef NVMFILE_H +#define NVMFILE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "types.h" +#include "vm.h" + +typedef struct { + u08_t super; + u08_t fields; +} PACKED nvm_class_hdr_t; + +typedef struct { + u16_t code_index; + u16_t id; // class and method id + u08_t flags; + u08_t args; + u08_t max_locals; + u08_t max_stack; +} PACKED nvm_method_hdr_t; + +typedef struct { + u32_t magic_feature; // old 32 bit magic is replaced by 8 bit magic and 24 feauture bits + u08_t version; + u08_t methods; // number of methods in this file + u16_t main; // index of main method + u16_t constant_offset; + u16_t string_offset; + u16_t method_offset; + u08_t static_fields; + nvm_class_hdr_t class_hdr[]; +} PACKED nvm_header_t; + +// marker that indicates, that a method is a classes init method +#define FLAG_CLINIT 1 + +extern u08_t nvmfile_constant_count; + +void nvmfile_store(u16_t index, u08_t *buffer, u16_t size); + +bool_t nvmfile_init(void); +void nvmfile_call_main(void); +void *nvmfile_get_addr(u16_t ref); +u08_t nvmfile_get_class_fields(u08_t index); +u08_t nvmfile_get_static_fields(void); +u32_t nvmfile_get_constant(u08_t index); +void *nvmfile_get_base(void); +u08_t nvmfile_get_method_by_class_and_id(u08_t class_jvm, u08_t id); +nvm_method_hdr_t *nvmfile_get_method_hdr(u16_t index); + +#ifdef NVM_USE_EEPROM + +void nvmfile_read(void *dst, const void *src, u16_t len); +u08_t nvmfile_read08(const void *addr); +u16_t nvmfile_read16(const void *addr); +u32_t nvmfile_read32(const void *addr); +void nvmfile_write08(void *addr, u08_t data); + +#define NVMFILE_SET(a) (void*)(((ptr_t)a) | NVMFILE_FLAG) +#define NVMFILE_ISSET(a) (((ptr_t)a) & NVMFILE_FLAG) +#define NVMFILE_ADDR(a) (void*)(((ptr_t)a) & ~NVMFILE_FLAG) + +#else // NVM_USE_EEPROM + +#define nvmfile_read memcpy +#define nvmfile_read08(addr) (*(u08_t*)(addr)) +#define nvmfile_read16(addr) (*(u16_t*)(addr)) +#define nvmfile_read32(addr) (*(u32_t*)(addr)) +#define nvmfile_write08(addr, data) (*(u08_t*)(addr) = (data)) + +#define NVMFILE_SET(addr) (addr) + +#endif // NVM_USE_EEPROM + +#ifndef NVM_USE_FLASH_PROGRAM +#define nvmfile_write_initialize() do {} while(0) +#define nvmfile_write_finalize() do {} while(0) +#else +void nvmfile_write_initialize(void); +void nvmfile_write_finalize(void); +#endif + +#ifdef NVM_USE_DISK_FILE +void nvmfile_load(const char *filename, bool_t quiet); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // NVMFILE_H diff -U 3 -H -d -r -N -- epos--/src/vm/nvmstring.c epos--jvm/src/vm/nvmstring.c --- epos--/src/vm/nvmstring.c 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/nvmstring.c 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,94 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// string.c +// + +#include "types.h" +#include "debug.h" +#include "config.h" +#include "error.h" + +#ifdef NVM_USE_EEPROM + +#ifdef NVM_USE_STDIO + +#include "vm.h" +#include "stack.h" +#include "nvmstring.h" + +#ifdef NVM_USE_FORMATTER + +char native_getchar(const char* src) { + // check if string resides in nvm file memory (e.g. eeprom) + if(NVMFILE_ISSET(src)) + return nvmfile_read08(src); + else + return *src; +} + +/* string copy to ram */ +void native_strncpy(char *dst, const char* src, int n) { + // check if string resides in nvm file memory (e.g. eeprom) + if(NVMFILE_ISSET(src)) + while(n--&&(*dst++ = nvmfile_read08(src++))); + else + while(n--&&(*dst++ = *src++)); +} + +// append a string to another one +void native_strncat(char *dst, const char *src, int n) { + while(n--&&(*dst)) dst++; // skip string + native_strncpy(dst, src, n); // attach it +} + +#endif // NVM_USE_FORMATTER + +/* string copy to ram */ +void native_strcpy(char *dst, const char* src) { + // check if string resides in nvm file memory (e.g. eeprom) + if(NVMFILE_ISSET(src)) + while((*dst++ = nvmfile_read08(src++))); + else + while((*dst++ = *src++)); +} + +/* determine string length */ +u16_t native_strlen(const char *str) { + u16_t len=0; + + // check if string resides in nvm file memory (e.g. eeprom) + if(NVMFILE_ISSET(str)) + while(nvmfile_read08(str++)) len++; + else + while(*str++) len++; + + return len; +} + +// append a string to another one +void native_strcat(char *dst, const char *src) { + while(*dst) dst++; // skip string + native_strcpy(dst, src); // attach it +} + +#endif // NVM_USE_STDIO + +#endif // NVM_USE_EEPROM diff -U 3 -H -d -r -N -- epos--/src/vm/nvmstring.h epos--jvm/src/vm/nvmstring.h --- epos--/src/vm/nvmstring.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/nvmstring.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,47 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// nvmstring.h +// + +#ifndef NVMSTRING_H +#define NVMSTRING_H + +#ifdef NVM_USE_EEPROM + +void native_strcpy(char *dst, const char* src); +void native_strncpy(char *dst, const char* src, int n); +u16_t native_strlen(const char *str); +void native_strcat(char *dst, const char *src); +void native_strncat(char *dst, const char *src, int n); +char native_getchar(const char* src); + +#else // NVM_USE_EEPROM + +#define native_strcpy strcpy +#define native_strncpy strncpy +#define native_strlen strlen +#define native_strcat strcat +#define native_strncat strncat +#define native_getchar(src) (*(src)) + +#endif // NVM_USE_EEPROM + +#endif // NVMSTRING_H diff -U 3 -H -d -r -N -- epos--/src/vm/nvmtypes.h epos--jvm/src/vm/nvmtypes.h --- epos--/src/vm/nvmtypes.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/nvmtypes.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,83 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// vmtypes.h +// + +#ifndef NVMTYPES_H +#define NVMTYPES_H + +#include "nvmfeatures.h" + +#include "types.h" + +#ifdef NVM_USE_16BIT_WORD +// THE basic types +typedef u16_t nvm_word_t; +typedef u16_t nvm_stack_t; +typedef u16_t nvm_ref_t; +typedef s16_t nvm_int_t; +typedef u16_t nvm_uint_t; // needed for >>> operator +typedef s16_t nvm_short_t; +typedef s08_t nvm_byte_t; +// masks and bits of the basic type +#define NVM_IMMEDIATE_MASK ((nvm_ref_t)0x8000) +#define NVM_TYPE_MASK ((nvm_ref_t)0xc000) +#define NVM_TYPE_HEAP ((nvm_ref_t)0x8000) +#define NVM_TYPE_CONST ((nvm_ref_t)0xc000) +typedef union +{ + nvm_byte_t b[2]; + nvm_short_t s[1]; + nvm_int_t i[1]; +} nvm_union_t; +#endif + + +#ifdef NVM_USE_32BIT_WORD +// THE basic types +typedef u32_t nvm_word_t; +typedef u32_t nvm_stack_t; +typedef u32_t nvm_ref_t; +typedef s32_t nvm_int_t; +typedef u32_t nvm_uint_t; // needed for >>> operator +typedef s16_t nvm_short_t; +typedef s08_t nvm_byte_t; +# ifdef NVM_USE_FLOAT +typedef float nvm_float_t; +# endif +// masks and bits of the basic type +#define NVM_IMMEDIATE_MASK ((nvm_ref_t)0x80000000L) +#define NVM_TYPE_MASK ((nvm_ref_t)0xc0000000L) +#define NVM_TYPE_HEAP ((nvm_ref_t)0x80000000L) +#define NVM_TYPE_CONST ((nvm_ref_t)0xc0000000L) +typedef union +{ + nvm_byte_t b[4]; + nvm_short_t s[2]; + nvm_int_t i[1]; +# ifdef NVM_USE_FLOAT + nvm_float_t f[1]; +# endif +} nvm_union_t; +#endif + + +#endif // NVMTYPES_H diff -U 3 -H -d -r -N -- epos--/src/vm/opcodes.h epos--jvm/src/vm/opcodes.h --- epos--/src/vm/opcodes.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/opcodes.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,162 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// opcodes.h +// + +#ifndef OPCODES_H +#define OPCODES_H + +#define OP_NOP 0x00 +#define OP_ACONST_NULL 0x01 +#define OP_ICONST_M1 0x02 +#define OP_ICONST_0 0x03 +#define OP_ICONST_1 0x04 +#define OP_ICONST_2 0x05 +#define OP_ICONST_3 0x06 +#define OP_ICONST_4 0x07 +#define OP_ICONST_5 0x08 + +#define OP_FCONST_0 0x0b // only if floating point compiled in +#define OP_FCONST_1 0x0c // only if floating point compiled in +#define OP_FCONST_2 0x0d // only if floating point compiled in + +#define OP_BIPUSH 0x10 +#define OP_SIPUSH 0x11 +#define OP_LDC 0x12 + + +#define OP_ILOAD 0x15 +#define OP_FLOAD 0x17 // only if floating point compiled in + +#define OP_ILOAD_0 0x1a +#define OP_ILOAD_1 0x1b +#define OP_ILOAD_2 0x1c +#define OP_ILOAD_3 0x1d + +#define OP_FLOAD_0 0x22 // only if floating point compiled in +#define OP_FLOAD_1 0x23 // only if floating point compiled in +#define OP_FLOAD_2 0x24 // only if floating point compiled in +#define OP_FLOAD_3 0x25 // only if floating point compiled in + +#define OP_ALOAD_0 0x2a +#define OP_ALOAD_1 0x2b +#define OP_ALOAD_2 0x2c +#define OP_ALOAD_3 0x2d + +#define OP_IALOAD 0x2e // only if array compiled in +#define OP_FALOAD 0x30 // only if array and floating point compiled in +#define OP_AALOAD 0x32 // only if array compiled in +#define OP_BALOAD 0x33 // only if array compiled in + +#define OP_ISTORE 0x36 +#define OP_FSTORE 0x38 // only if floating point compiled in +#define OP_ASTORE 0x3a +#define OP_ISTORE_0 0x3b +#define OP_ISTORE_1 0x3c +#define OP_ISTORE_2 0x3d +#define OP_ISTORE_3 0x3e +#define OP_FSTORE_0 0x43 // only if floating point compiled in +#define OP_FSTORE_1 0x44 // only if floating point compiled in +#define OP_FSTORE_2 0x45 // only if floating point compiled in +#define OP_FSTORE_3 0x46 // only if floating point compiled in +#define OP_ASTORE_0 0x4b +#define OP_ASTORE_1 0x4c +#define OP_ASTORE_2 0x4d +#define OP_ASTORE_3 0x4e + +#define OP_IASTORE 0x4f // only if array compiled in +#define OP_FASTORE 0x51 // only if array and floating point compiled in +#define OP_AASTORE 0x53 // only if array compiled in +#define OP_BASTORE 0x54 // only if array compiled in + +#define OP_POP 0x57 +#define OP_POP2 0x58 +#define OP_DUP 0x59 +#define OP_DUP_X1 0x5a // only if extedend stack ops are compiled in +#define OP_DUP_X2 0x5b // only if extedend stack ops are compiled in +#define OP_DUP2 0x5c +#define OP_DUP2_X1 0x5d // only if extedend stack ops are compiled in +#define OP_DUP2_X2 0x5e // only if extedend stack ops are compiled in +#define OP_SWAP 0x5f // only if extedend stack ops are compiled in + +#define OP_IADD 0x60 +#define OP_FADD 0x62 // only if floating point compiled in +#define OP_ISUB 0x64 +#define OP_FSUB 0x66 // only if floating point compiled in +#define OP_IMUL 0x68 +#define OP_FMUL 0x6a // only if floating point compiled in +#define OP_IDIV 0x6c +#define OP_FDIV 0x6e // only if floating point compiled in +#define OP_IREM 0x70 +#define OP_FREM 0x72 // only if floating point compiled in +#define OP_INEG 0x74 +#define OP_FNEG 0x76 // only if floating point compiled in +#define OP_ISHL 0x78 +#define OP_ISHR 0x7a +#define OP_IUSHR 0x7c +#define OP_IAND 0x7e +#define OP_IOR 0x80 +#define OP_IXOR 0x82 +#define OP_IINC 0x84 + +#define OP_I2F 0x86 // only if floating point compiled in +#define OP_F2I 0x8b // only if floating point compiled in + +#define OP_FCMPL 0x95 // only if floating point compiled in +#define OP_FCMPG 0x96 // only if floating point compiled in + +#define OP_IFEQ 0x99 +#define OP_IFNE 0x9a +#define OP_IFLT 0x9b +#define OP_IFGE 0x9c +#define OP_IFGT 0x9d +#define OP_IFLE 0x9e + +#define OP_IF_ICMPEQ 0x9f +#define OP_IF_ICMPNE 0xa0 +#define OP_IF_ICMPLT 0xa1 +#define OP_IF_ICMPGE 0xa2 +#define OP_IF_ICMPGT 0xa3 +#define OP_IF_ICMPLE 0xa4 + +#define OP_GOTO 0xa7 + +#define OP_TABLESWITCH 0xaa +#define OP_LOOKUPSWITCH 0xab + +#define OP_IRETURN 0xac +#define OP_FRETURN 0xae // only if floating point compiled in +#define OP_RETURN 0xb1 + +#define OP_GETSTATIC 0xb2 +#define OP_PUTSTATIC 0xb3 // only if fields are compiled in +#define OP_GETFIELD 0xb4 // only if fields are compiled in +#define OP_PUTFIELD 0xb5 // only if fields are compiled in +#define OP_INVOKEVIRTUAL 0xb6 +#define OP_INVOKESPECIAL 0xb7 +#define OP_INVOKESTATIC 0xb8 + +#define OP_NEW 0xbb +#define OP_NEWARRAY 0xbc // only if array compiled in +#define OP_ANEWARRAY 0xbd // only if array compiled in +#define OP_ARRAYLENGTH 0xbe // only if array compiled in + +#endif // OPCODES_H diff -U 3 -H -d -r -N -- epos--/src/vm/printaodiabo epos--jvm/src/vm/printaodiabo --- epos--/src/vm/printaodiabo 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/printaodiabo 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1 @@ +/usr/local/ia32/gcc/bin/ia32-gcc -O2 -nostdinc -Wall -I/home/meira/Graduação/10.2/ine5424/epos--/include -D __ia32 -D __pc -DUNIX -I. -c diff -U 3 -H -d -r -N -- epos--/src/vm/stack.c epos--jvm/src/vm/stack.c --- epos--/src/vm/stack.c 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/stack.c 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,198 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// stack.c +// + +#include "types.h" +#include "debug.h" +#include "config.h" +#include "error.h" + +#include "vm.h" +#include "heap.h" +#include "stack.h" + +// the stack +nvm_stack_t *stack; // the pysical base of the whole stack (incl. statics) +nvm_stack_t *sp; // the current stack pointer +nvm_stack_t *stackbase; // the base of the runtime stack (excl. statics) + +#ifdef NVM_USE_STACK_CHECK +nvm_stack_t *sp_saved = NULL; + +// save current stack pointer +void stack_save_sp(void) { + if(sp_saved != NULL) { + DEBUGF("sp_saved already in use\n"); + error(ERROR_VM_STACK_CORRUPTED); + } + + sp_saved = sp; // save stack pointer +} + +// check if current stack pointer equals saved one +void stack_verify_sp(void) { + if(sp != sp_saved) { + DEBUGF("%d bytes on stack\n", (u08_t*)sp-(u08_t*)sp_saved); + error(ERROR_VM_STACK_CORRUPTED); + } + + sp_saved = NULL; +} +#endif + +void stack_init(u08_t static_fields) { + + // the stack is generated by stealing from the heap. This + // is possible since the class file tells us how many stack + // elements the call to a method requires + stack = (nvm_stack_t*)heap_get_base(); + sp = stack-1; + + // steal one item for mains args and the space required for + // the static fields + heap_steal((1+static_fields)*sizeof(nvm_stack_t)); + + // increase stack pointer behind static fields + sp += static_fields; +} + +// push an item onto the vms stack +void stack_push(nvm_stack_t val) { + *(++sp) = val; +} + +// pop an item from the vms stack +nvm_stack_t stack_pop(void) { + return *(sp--); +} + +// pop an item from the vm stack +nvm_int_t stack_pop_int(void) { + return nvm_stack2int(*(sp--)); +} + +// peek into the nvm stack +nvm_stack_t stack_peek(u08_t index) { + return sp[-index]; +} + +// peek into the stack and expand 15->16 bits +nvm_int_t stack_peek_int(u08_t index) { + return nvm_stack2int(sp[-index]); +} + +// pop address from stack +void *stack_pop_addr(void) { + return vm_get_addr(*(sp--)); +} + +// peek into the nvm stack for address +void *stack_peek_addr(u08_t index) { + return vm_get_addr(sp[-index]); +} + +# ifdef NVM_USE_FLOAT +nvm_float_t stack_pop_float(void) +{ + return nvm_stack2float(*(sp--)); +} + +nvm_float_t stack_peek_float(u08_t index) +{ + return nvm_stack2float(sp[-index]); +} +#endif + +// the following two routines are used during method invocation and return +// they are used to make space for local variables on the stack +// and to determine the current stack address to be used for the local +// variables +void stack_add_sp(s08_t offset) { + sp += offset; +} + +nvm_stack_t * stack_get_sp(void) { + return sp; +} + +// static variables are allocated at vm startup on the stack. the following +// two routines provide access to these variables +nvm_stack_t stack_get_static(u16_t index) { + return stack[index]; +} + +void stack_set_static(u16_t index, nvm_stack_t value) { + stack[index] = value; +} + +// our way to determine if the java application is being +// finished is to check if the return instruction would cause the +// stack to underflow. this happens, since the main method ends +// with a return statement like any other method. the following +// two methods are used to save the state of the empty stack (there +// may be already the static variables be on the stack) and to check +// whether the stack is filled with the static variables only (it is empty) +void stack_save_base(void) { + stackbase = stack_get_sp(); +} + +bool_t stack_is_empty(void) { + DEBUGF("stack base depth: %d\n", sp-stackbase); + return(sp == stackbase); +} + +#ifdef DEBUG +u16_t stack_get_depth(void) { + return sp-stack; +} +#endif + +#ifdef NVM_USE_HEAP_IDMAP +void stack_mark_heap_root_ids(void) { + u16_t i; + + DEBUGF("stack_mark_heap_root_ids()\n"); + // since the locals are physically part of the stack we only need + // to search the stack + for(i=0;i +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// stack.h +// + +#ifndef STACK_H +#define STACK_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "vm.h" + +extern nvm_stack_t *stack; // the pysical base of the whole stack (incl. statics) +extern nvm_stack_t *sp; // the current stack pointer +extern nvm_stack_t *stackbase; // the base of the runtime stack (excl. statics) + +void stack_init(u08_t static_fields); + +#ifdef NVM_USE_STACK_CHECK +void stack_save_sp(void); +void stack_verify_sp(void); +#endif + +// various stack operations +void stack_push(nvm_stack_t val); +nvm_stack_t stack_pop(void); +nvm_int_t stack_pop_int(void); +nvm_stack_t stack_peek(u08_t index); +nvm_int_t stack_peek_int(u08_t index); +void * stack_pop_addr(void); +void * stack_peek_addr(u08_t index); + +# ifdef NVM_USE_FLOAT +nvm_float_t stack_pop_float(void); +nvm_float_t stack_peek_float(u08_t index); +# endif + + +nvm_stack_t *stack_get_sp(void); +void stack_add_sp(s08_t offset); + +nvm_stack_t stack_get_static(u16_t index); +void stack_set_static(u16_t index, nvm_stack_t value); + +void stack_save_base(void); +bool_t stack_is_empty(void); + +#ifdef DEBUG +u16_t stack_get_depth(void); +#endif + +#ifdef NVM_USE_HEAP_IDMAP +void stack_mark_heap_root_ids(void); +#else +bool_t stack_heap_id_in_use(heap_id_t id); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // STACK_H diff -U 3 -H -d -r -N -- epos--/src/vm/types.h epos--jvm/src/vm/types.h --- epos--/src/vm/types.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/types.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,99 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +#ifndef TYPES_H +#define TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + + +//#include Vai incluir a vó! +typedef unsigned int uint32_t; +typedef int int32_t; +typedef unsigned short uint16_t; +typedef short int16_t; +typedef unsigned char uint8_t; +typedef char int8_t; +#ifndef _FROM_JVM_FOLDER +typedef char _Bool; +#endif +typedef unsigned long int uintptr_t; + + +#ifndef NULL +#define NULL ((void*)0) +#endif + +#ifndef PACKED +#define PACKED __attribute__ ((packed)) +#endif + +typedef uint32_t u32_t; +typedef int32_t s32_t; +typedef uint16_t u16_t; +typedef int16_t s16_t; +typedef uint8_t u08_t; +typedef int8_t s08_t; +typedef _Bool bool_t; +typedef uintptr_t ptr_t; + +typedef uint8_t size8_t; // A byte-sized size_t +typedef int8_t ssize8_t; // A byte-sized ssize_t + + +#if !defined __cplusplus + +#ifndef bool +typedef _Bool bool; +#endif + +#ifndef false +#define false 0 +#endif + +#ifndef FALSE +#define FALSE false +#endif + +#ifndef true +#define true (!false) +#endif + +#ifndef TRUE +#define TRUE true +#endif + +#ifndef min +#define min(X,Y) ((X) < (Y) ? (X) : (Y)) +#endif + +#ifndef max +#define max(X,Y) ((X) > (Y) ? (X) : (Y)) +#endif + +#endif // !defined __cplusplus + + +#ifdef __cplusplus +} +#endif + +#endif // TYPES_H diff -U 3 -H -d -r -N -- epos--/src/vm/uart.c.bkp epos--jvm/src/vm/uart.c.bkp --- epos--/src/vm/uart.c.bkp 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/uart.c.bkp 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,266 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// uart.c +// + +#ifdef __CC65__ +#include +#include +#endif + +#include "types.h" +#include "config.h" +#include "debug.h" + +#include "uart.h" +#include "delay.h" + +// unix uart emulation +#ifdef UNIX +#include +#include +#include +#include +#include +#include + +struct termios old_t; + +FILE *in = NULL, *out = NULL; + +void uart_bye(void) { +#ifdef UART_PORT + fclose(in); // out is identical +#else + // restore terminal settings + tcsetattr( 0, TCSANOW, &old_t); +#endif +} + +void uart_sigproc() { + exit(-1); // exit (and thus call uart_bye) +} + +void uart_init(void) { +#ifdef UART_PORT + out = in = fopen(UART_PORT, "w+b"); + if(!in) { + printf("unable to open %s\n", UART_PORT); + exit(-1); + } + +#else + struct termios new_t; + + in = stdin; + out = stdout; + + if(tcgetattr( 0, &old_t) == -1) + perror("tcgetattr() failed"); + + memcpy( &new_t, &old_t, sizeof(struct termios)); + + tcflush( 0, TCIFLUSH); + + // no cr/lf translation + new_t.c_iflag &= ~(ICRNL); + + // echo and kernel buffers off + new_t.c_lflag &= ~(ECHO|ICANON); + + tcsetattr( 0, TCSANOW, &new_t); + + // libc buffers off + setbuf(stdin, NULL); +#endif + + atexit(uart_bye); + signal(SIGINT, uart_sigproc); +} + +void uart_write_byte(u08_t byte) { + fputc(byte, out); + fflush(out); +} + +u08_t uart_read_byte(void) { + return fgetc(in); +} + +// unix can't tell us how many bytes in the input buffer are, +// so just return one as long as there's data +u08_t uart_available(void) { + fd_set fds; + struct timeval tv = { 0, 100 }; + + FD_ZERO(&fds); + FD_SET(fileno(in), &fds); + + return (select(FD_SETSIZE, &fds, NULL, NULL, &tv) == 1)?1:0; +} + +#endif // UNIX + +#ifdef AVR +#include +#include + +#define UART_BITRATE_CONFIG (u16_t)(((CLOCK/16l)/(UART_BITRATE))-1) +#define UART_BUFFER_SIZE (1<<(UART_BUFFER_BITS)) +#define UART_BUFFER_MASK ((UART_BUFFER_SIZE)-1) + +#if defined(ATMEGA168) +#define UBRRH UBRR0H +#define UBRRL UBRR0L +#define UCSRA UCSR0A +#define UCSRB UCSR0B +#define UCSRC UCSR0C +#define TXEN TXEN0 +#define RXEN RXEN0 +#define RXCIE RXCIE0 +#define UCSZ0 UCSZ00 +#define UDR UDR0 +#define UDRE UDRE0 +#define SIG_UART_RECV SIG_USART_RECV +#endif + +#if defined(NIBO) +#define UBRRH UBRR0H +#define UBRRL UBRR0L +#define UCSRA UCSR0A +#define UCSRB UCSR0B +#define UCSRC UCSR0C +#define UDR UDR0 + +#define URSEL UBRR0H +#define SIG_UART_RECV SIG_UART0_RECV +/* +#define TXEN TXEN0 +#define RXEN RXEN0 +#define RXCIE RXCIE0 +#define UCSZ0 UCSZ00 +#define UDRE UDRE0 +#define SIG_UART_RECV SIG_USART_RECV +*/ +#endif + + +u08_t uart_rd, uart_wr; +u08_t uart_buf[UART_BUFFER_SIZE]; + +void uart_init(void) { + uart_rd = uart_wr = 0; // init buffers + + UBRRH = (u08_t)((UART_BITRATE_CONFIG>>8) & 0xf); + UBRRL = (u08_t)((UART_BITRATE_CONFIG) & 0xff); + + UCSRA = 0; + UCSRB = + _BV(RXEN) | _BV(RXCIE) | // enable receiver and irq + _BV(TXEN); // enable transmitter + +#ifdef URSEL // UCSRC shared with UBRRH + UCSRC = _BV(URSEL) | (3 << UCSZ0); // 8n1 +#else + UCSRC = (3 << UCSZ0); // 8n1 +#endif // URSEL + + sei(); +} + +SIGNAL(SIG_UART_RECV) { + /* irq driven input */ + uart_buf[uart_wr] = UDR; + + /* and increase write pointer */ + uart_wr = ((uart_wr+1) & UART_BUFFER_MASK); +} + +u08_t uart_available(void) { + return(UART_BUFFER_MASK & (uart_wr - uart_rd)); +} + +void uart_write_byte(u08_t byte) { + /* Wait for empty transmit buffer */ + while(!(UCSRA & _BV(UDRE))); + + // asuro needs echo cancellation, since the ir receiver "sees" + // the transmitter +#ifdef ASURO + // disable receiver + UCSRB &= ~(_BV(RXEN) | _BV(RXCIE)); +#endif + + // start transmission + UDR = byte; + +#ifdef ASURO + // Wait for empty transmit buffer + while(!(UCSRA & _BV(UDRE))); + delay(MILLISEC(5)); + + // re-enable receiver + UCSRB |= _BV(RXEN) | _BV(RXCIE); +#endif +} + +u08_t uart_read_byte(void) { + u08_t ret = uart_buf[uart_rd]; + + /* and increase read pointer */ + uart_rd = ((uart_rd+1) & UART_BUFFER_MASK); + + return ret; +} + +#endif // AVR + +#ifdef __CC65__ + +u08_t uart_available(void) { + return kbhit()?1:0; +} + +// Use conio for available() support +u08_t uart_read_byte(void) { + return cgetc(); +} + +// Use stdio for scrolling support +void uart_putc(u08_t byte) { +#ifdef __CBM__ + if((byte & 0x60) == 0x40) byte |= 0x80; + if((byte & 0x60) == 0x60) byte &= 0xDF; +#endif + putchar(byte); +} + +#else // __CC65__ + +// translate nl to cr nl +void uart_putc(u08_t byte) { + if(byte == '\n') + uart_write_byte('\r'); + + uart_write_byte(byte); +} + +#endif // __CC65__ diff -U 3 -H -d -r -N -- epos--/src/vm/uart.h epos--jvm/src/vm/uart.h --- epos--/src/vm/uart.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/uart.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,29 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +#ifndef UART_H +#define UART_H + +extern void uart_init(void); +extern void uart_write_byte(u08_t byte); +extern void uart_putc(u08_t byte); +extern u08_t uart_read_byte(void); +extern u08_t uart_available(void); + +#endif // UART_H diff -U 3 -H -d -r -N -- epos--/src/vm/utils.h epos--jvm/src/vm/utils.h --- epos--/src/vm/utils.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/utils.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,52 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// utils.h +// + +#ifndef UTILS_H +#define UTILS_H + +#ifdef NVM_USE_UTILS + +static inline void utils_memcpy(void *dst, const void *src, u16_t len) { + u08_t *dst8 = (u08_t*)dst; + u08_t *src8 = (u08_t*)src; + + while(len--) + *dst8++ = *src8++; +} + +/* string len ram */ +static inline u16_t utils_strlen(const char *str) { + u16_t len=0; + + while(*str++) len++; + return len; +} + +#else // NVM_USE_UTILS + +#define utils_memcpy memcpy +#define utils_strlen strlen + +#endif // NVM_USE_UTILS + +#endif // UTILS_H diff -U 3 -H -d -r -N -- epos--/src/vm/vm.c epos--jvm/src/vm/vm.c --- epos--/src/vm/vm.c 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/vm.c 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,928 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// vm.c +// + +#include + +#include "types.h" +#include "debug.h" +#include "config.h" +#include "error.h" + +#include "vm.h" +#include "opcodes.h" +#include "native_impl.h" +#include "native.h" +#include "heap.h" +#include "nvmfile.h" +#include "stack.h" +#include "nvmfeatures.h" + +#ifdef NVM_USE_ARRAY +#include "array.h" +#endif + +#ifdef NVM_USE_32BIT_WORD +# define DBG_INT "0x" DBG32 +#else +# define DBG_INT "0x" DBG16 +#endif + + + +void vm_init(void) { + DEBUGF("vm_init() with %d static fields\n", nvmfile_get_static_fields()); + + // init heap + heap_init(); + + // get stack space from heap and setup stack + stack_init(nvmfile_get_static_fields()); + + stack_push(0); // args parameter to main (should be a string array) +} + +void *vm_get_addr(nvm_ref_t ref) { + if(!(ref & NVM_IMMEDIATE_MASK)) + error(ERROR_VM_ILLEGAL_REFERENCE); + + if((ref & NVM_TYPE_MASK) == NVM_TYPE_HEAP) + return heap_get_addr(ref & ~NVM_TYPE_MASK); + + // return nvmfile address and set marker indicating + // that this is inside the nvm file (and may have + // to be accessed in a special manner) + return NVMFILE_SET(nvmfile_get_addr(ref & ~NVM_TYPE_MASK)); +} + +// expand 15 bit immediate to 16 bits (or 31 to 32) +nvm_int_t nvm_stack2int(nvm_stack_t val) { + if(val & (NVM_IMMEDIATE_MASK>>1)) + val |= NVM_IMMEDIATE_MASK; // expand sign bit + return val; +} + +#ifdef NVM_USE_FLOAT +nvm_stack_t nvm_float2stack(nvm_float_t val) +{ + nvm_union_t v; + v.f[0]=val; + //printf("float = %f == 0x%x", v.f[0], v.i[0]); + uint8_t msb = (v.b[3]&0x80)?0x40:0x00; + v.b[3] &= 0x7f; + if (v.b[3]==0x7f && (v.b[2]&0x80)==0x80) + msb |= 0x3f; + else if (v.b[3]!=0x00 || (v.b[2]&0x80)!=0x00) + msb |= v.b[3]-0x20; + v.b[3]=msb; + //printf(" -> encoded = 0x%x\n", v.i[0]); + return v.i[0]; +} + +nvm_float_t nvm_stack2float(nvm_stack_t val) +{ + nvm_union_t v; + v.i[0]=val; + //printf("encoded = 0x%x", v.i[0]); + uint8_t msb = (v.b[3]&0x40)?0x80:0x00; + v.b[3] &= 0x3f; + if (v.b[3]==0x3f && (v.b[2]&0x80)==0x80) + msb |= 0x7f; + else if (v.b[3]!=0x00 || (v.b[2]&0x80)!=0x00) + msb |= v.b[3]+0x20; + v.b[3]=msb; + //printf(" -> float = %f == 0x%x\n", v.f[0], v.i[0]); + return v.f[0]; +} +#endif + + +nvm_stack_t *locals; + +// pc/methodref/localsoffset +#define VM_METHOD_CALL_REQUIREMENTS 3 + +// create an instance of a class. check if it's local (within +// the nvm file) or native (implemented by the runtime environment) +void vm_new(u16_t mref) { + + if(NATIVE_ID2CLASS(mref) < NATIVE_CLASS_BASE) { + heap_id_t h; + + DEBUGF("local new #%d\n", NATIVE_ID2CLASS(mref)); + + DEBUGF("non static fields: %d\n", + nvmfile_get_class_fields(NATIVE_ID2CLASS(mref))); + + // create object with + h = heap_alloc(TRUE, sizeof(nvm_word_t) * + (VM_CLASS_CONST_ALLOC+nvmfile_get_class_fields(NATIVE_ID2CLASS(mref)))); + + stack_push(NVM_TYPE_HEAP | h); + //epos_prints("novo objeto criado, com referencia: \n"); + //epos_printi(h); + + // store reference in object, so we can later determine which kind + // of object this is. this is required for inheritance + ((nvm_ref_t*)heap_get_addr(h))[0] = mref; + + return; + } + + native_new(mref); +} + +// we prefetch arguments from the program storage +// and this is the type it is stored into + +typedef union { + s16_t w; + struct { + s08_t bl, bh; + } z; + nvm_int_t tmp; +} vm_arg_t; + +void vm_run(u16_t mref) { + register u08_t instr, pc_inc, *pc; + register nvm_int_t tmp1=0; + register nvm_int_t tmp2; + register vm_arg_t arg0; + nvm_method_hdr_t mhdr, *mhdr_ptr; + +#ifdef NVM_USE_FLOAT + nvm_float_t f0; + nvm_float_t f1; +#endif + +#ifdef NVM_USE_STACK_CHECK +// stack_save_sp(); +#endif + + DEBUGF("Running method %d\n", mref); + //epos_printi(mref); + + + // load method header into ram + mhdr_ptr = nvmfile_get_method_hdr(mref); + nvmfile_read(&mhdr, mhdr_ptr, sizeof(nvm_method_hdr_t)); + + // determine method description address and code + pc = (u08_t*)mhdr_ptr + mhdr.code_index; + + // make space for locals on the stack + DEBUGF("Allocating space for %d local(s) and %d " + "stack elements - %d args\n", + mhdr.max_locals, mhdr.max_stack, mhdr.args); + + // increase stack space. locals will be put on the stack as + // well. method arguments are part of the locals and are + // already on the stack + heap_steal(sizeof(nvm_stack_t) * (mhdr.max_locals + mhdr.max_stack + mhdr.args)); + + // determine address of current locals (stack pointer + 1) + locals = stack_get_sp() + 1; + stack_add_sp(mhdr.max_locals); + stack_save_base(); + + do { + instr = nvmfile_read08(pc); + pc_inc = 1; + + DEBUGF("%d/(sp:%d) - "DBG8" (%d): ", + (pc-(u08_t*)mhdr_ptr) - mhdr.code_index, + stack_get_depth(), instr, instr); + + //epos_printi(instr); + + // prefetch next args (in big endian order) + arg0.z.bh = nvmfile_read08(pc+1); + arg0.z.bl = nvmfile_read08(pc+2); + + if(instr == OP_NOP) { + DEBUGF("nop\n"); + } + + else if(instr == OP_BIPUSH) { + stack_push(arg0.z.bh); pc_inc = 2; + DEBUGF("bipush #%d\n", stack_peek(0)); + } + + else if(instr == OP_SIPUSH) { + stack_push(~NVM_IMMEDIATE_MASK & (arg0.w)); pc_inc = 3; + DEBUGF("sipush #"DBG16"\n", stack_peek_int(0)); + } + + else if((instr >= OP_ICONST_M1) && (instr <= OP_ICONST_5)) { + stack_push(instr - OP_ICONST_0); + DEBUGF("iconst_%d\n", stack_peek(0)); + } + + // move integer from stack into locals + else if(instr == OP_ISTORE) { + locals[arg0.z.bh] = stack_pop(); pc_inc = 2; + DEBUGF("istore %d (%d)\n", arg0.z.bh, nvm_stack2int(locals[arg0.z.bh])); + } + + // move integer from stack into locals + else if((instr >= OP_ISTORE_0) && (instr <= OP_ISTORE_3)) { + locals[instr - OP_ISTORE_0] = stack_pop(); + DEBUGF("istore_%d (%d)\n", instr - OP_ISTORE_0, + nvm_stack2int(locals[instr - OP_ISTORE_0])); + } + + // load int from local variable (push local var) + else if(instr == OP_ILOAD) { + stack_push(locals[arg0.z.bh]); pc_inc = 2; + DEBUGF("iload %d (%d, "DBG_INT")\n", locals[arg0.z.bh], + stack_peek_int(0), stack_peek_int(0)); + } + + // push local onto stack + else if((instr >= OP_ILOAD_0) && (instr <= OP_ILOAD_3)) { + stack_push(locals[instr - OP_ILOAD_0]); + DEBUGF("iload_%d (%d, "DBG_INT")\n", instr-OP_ILOAD_0, + stack_peek_int(0), stack_peek_int(0)); + } + + // immediate comparison / comparison with zero + else if((instr >= OP_IFEQ) && (instr <= OP_IF_ICMPLE)) { + DEBUGF("if"); + + if((instr >= OP_IFEQ) && (instr <= OP_IFLE)) { + // comparision with zero + tmp2 = 0; + instr -= OP_IFEQ - OP_IF_ICMPEQ; + } else { + // comparison with second argument + DEBUGF("_cmp"); + tmp2 = stack_pop_int(); + } + + tmp1 = stack_pop_int(); + + switch(instr) { + case OP_IF_ICMPEQ: DEBUGF("eq (%d %d)", tmp1, tmp2); + tmp1 = (tmp1 == tmp2); break; + case OP_IF_ICMPNE: DEBUGF("ne (%d %d)", tmp1, tmp2); + tmp1 = (tmp1 != tmp2); break; + case OP_IF_ICMPLT: DEBUGF("lt (%d %d)", tmp1, tmp2); + tmp1 = (tmp1 < tmp2); break; + case OP_IF_ICMPGE: DEBUGF("ge (%d %d)", tmp1, tmp2); + tmp1 = (tmp1 >= tmp2); break; + case OP_IF_ICMPGT: DEBUGF("gt (%d %d)", tmp1, tmp2); + tmp1 = (tmp1 > tmp2); break; + case OP_IF_ICMPLE: DEBUGF("le (%d %d)", tmp1, tmp2); + tmp1 = (tmp1 <= tmp2); break; + } + + // change pc if jump has been taken + if(tmp1) { DEBUGF(" -> taken\n"); pc += arg0.w; pc_inc = 0; } + else { DEBUGF(" -> not taken\n"); pc_inc = 3; } + } + + else if(instr == OP_GOTO) { + pc_inc = 3; + DEBUGF("goto %d\n", arg0.w); + pc += (arg0.w-3); + } + + // two operand arithmetic + else if((instr >= OP_IADD) && (instr <= OP_IINC)) { + // single operand arithmetic + if(instr == OP_INEG) { + tmp1 = -stack_pop_int(); + stack_push(nvm_int2stack(tmp1)); + DEBUGF("ineg(%d)\n", -stack_peek_int(0)); + + } else if(instr == OP_IINC) { + DEBUGF("iinc %d,%d\n", arg0.z.bh, arg0.z.bl); + locals[arg0.z.bh] = (nvm_stack2int(locals[arg0.z.bh]) + arg0.z.bl) + & ~NVM_IMMEDIATE_MASK; + pc_inc = 3; + +#ifdef NVM_USE_FLOAT + } else if(((instr & 0x03) == 0x02) && (instr <= OP_FNEG)) { + if (instr == OP_FNEG) { + f0 = -stack_pop_float(); + stack_push(nvm_float2stack(f0)); + DEBUGF("fneg (%f)\n", stack_peek_float(0)); + } + else { + f0 = stack_pop_float(); // fetch operands from stack + f1 = stack_pop_float(); + switch(instr) { + case OP_FADD: DEBUGF("fadd(%f,%f)", f1, f0); + f1 += f0; break; + case OP_FSUB: DEBUGF("fsub(%f,%f)", f1, f0); + f1 -= f0; break; + case OP_FMUL: DEBUGF("fmul(%f,%f)", f1, f0); + f1 *= f0; break; + case OP_FDIV: DEBUGF("fdiv(%f,%f)", f1, f0); + if(!f0) error(ERROR_VM_DIVISION_BY_ZERO); + f1 /= f0; break; + case OP_IREM: DEBUGF("frem(%f,%f)", f1, f0); + error(ERROR_VM_UNSUPPORTED_OPCODE); + //f1 = f1%f0; break; + } + stack_push(nvm_float2stack(f1)); + DEBUGF(" = %f\n", stack_peek_float(0)); + } +#endif + + } else { + tmp1 = stack_pop_int(); // fetch operands from stack + tmp2 = stack_pop_int(); + + switch(instr) { + case OP_IADD: DEBUGF("iadd(%d,%d)", tmp2, tmp1); + tmp2 += tmp1; break; + case OP_ISUB: DEBUGF("isub(%d,%d)", tmp2, tmp1); + tmp2 -= tmp1; break; + case OP_IMUL: DEBUGF("imul(%d,%d)", tmp2, tmp1); + tmp2 *= tmp1; break; + case OP_IDIV: DEBUGF("idiv(%d,%d)", tmp2, tmp1); + if(!tmp1) error(ERROR_VM_DIVISION_BY_ZERO); + tmp2 /= tmp1; break; + case OP_IREM: DEBUGF("irem(%d,%d)", tmp2, tmp1); + tmp2 %= tmp1; break; + case OP_ISHL: DEBUGF("ishl(%d,%d)", tmp2, tmp1); + tmp2 <<= tmp1; break; + case OP_ISHR: DEBUGF("ishr(%d,%d)", tmp2, tmp1); + tmp2 >>= tmp1; break; + case OP_IAND: DEBUGF("iand(%d,%d)", tmp2, tmp1); + tmp2 &= tmp1; break; + case OP_IOR: DEBUGF("ior(%d,%d)", tmp2, tmp1); + tmp2 |= tmp1; break; + case OP_IXOR: DEBUGF("ixor(%d,%d)", tmp2, tmp1); + tmp2 ^= tmp1; break; + case OP_IUSHR: DEBUGF("iushr(%d,%d)", tmp2, tmp1); + tmp2 = ((nvm_uint_t)tmp2 >> tmp1); break; + } + + // and finally push result + stack_push(nvm_int2stack(tmp2)); + DEBUGF(" = %d\n", stack_peek_int(0)); + } + } + + else if((instr == OP_IRETURN) +#ifdef NVM_USE_FLOAT + ||(instr == OP_FRETURN) +#endif + ||(instr == OP_RETURN)) { + if((instr == OP_IRETURN) +#ifdef NVM_USE_FLOAT + ||(instr == OP_FRETURN) +#endif + ) { + tmp1 = stack_pop(); // save result + DEBUGF("i"); + } + + DEBUGF("return: "); + + // return from locally called method? other case: return + // from main() -> end of program + if(!stack_is_empty()) { + u08_t old_locals = mhdr.max_locals; + u08_t old_unsteal = VM_METHOD_CALL_REQUIREMENTS + + mhdr.max_locals + mhdr.max_stack + mhdr.args; + u16_t old_localsoffset = stack_pop(); + + // make space for locals on the stack + DEBUGF("Return from method with %d local(s) and %d " + "stack elements - %d args\n", + mhdr.max_locals, mhdr.max_stack, mhdr.args); + + mref = stack_pop(); + + // read header of method to return to + mhdr_ptr = nvmfile_get_method_hdr(mref); + // load method header into ram + nvmfile_read(&mhdr, mhdr_ptr, sizeof(nvm_method_hdr_t)); + + // restore pc + pc = (u08_t*)mhdr_ptr + stack_pop(); + pc_inc = 3; // continue _behind_ calling invoke instruction + + // and remove locals from stack and hope that method left + // an uncorrupted stack + stack_add_sp(-old_locals); + locals = stack_get_sp() - old_localsoffset; + + // give memory used by returning method back to heap + heap_unsteal(sizeof(nvm_stack_t) * old_unsteal); + + if(instr == OP_IRETURN){ + stack_push(tmp1); + DEBUGF("ireturn val: %d\n", stack_peek_int(0)); + } +#ifdef NVM_USE_FLOAT + else if(instr == OP_FRETURN){ + stack_push(tmp1); + DEBUGF("freturn val: %f\n", stack_peek_float(0)); + } +#endif + instr = OP_NOP; // make vm continue + } + } + + // discard both top stack items + else if(instr == OP_POP2) { + DEBUGF("ipop\n"); + stack_pop(); stack_pop(); + } + + // discard top stack item + else if(instr == OP_POP) { + DEBUGF("pop\n"); + stack_pop(); + } + + // duplicate top stack item + else if(instr == OP_DUP) { + stack_push(stack_peek(0)); + DEBUGF("dup ("DBG16")\n", stack_peek(0) & 0xffff); + } + + // duplicate top two stack items (a,b -> a,b,a,b) + else if(instr == OP_DUP2) { + stack_push(stack_peek(1)); + stack_push(stack_peek(1)); + DEBUGF("dup2 ("DBG16","DBG16")\n", + stack_peek(0) & 0xffff, stack_peek(1) & 0xffff); + } + +#ifdef NVM_USE_EXTSTACKOPS + + // duplicate top stack item and put it under the second + else if(instr == OP_DUP_X1) { + nvm_stack_t w1 = stack_pop(); + nvm_stack_t w2 = stack_pop(); + stack_push(w1); + stack_push(w2); + stack_push(w1); + DEBUGF("dup_x1 ("DBG16")\n", stack_peek(0) & 0xffff); + } + + // duplicate top stack item + else if(instr == OP_DUP_X2) { + nvm_stack_t w1 = stack_pop(); + nvm_stack_t w2 = stack_pop(); + nvm_stack_t w3 = stack_pop(); + stack_push(w1); + stack_push(w2); + stack_push(w3); + stack_push(w1); + DEBUGF("dup ("DBG16")\n", stack_peek(0) & 0xffff); + } + + // duplicate top two stack items (a,b -> a,b,a,b) + else if(instr == OP_DUP2_X1) { + nvm_stack_t w1 = stack_pop(); + nvm_stack_t w2 = stack_pop(); + nvm_stack_t w3 = stack_pop(); + stack_push(w1); + stack_push(w2); + stack_push(w3); + stack_push(w1); + stack_push(w2); + DEBUGF("dup2 ("DBG16","DBG16")\n", + stack_peek(0) & 0xffff, stack_peek(1) & 0xffff); + } + + // duplicate top two stack items (a,b -> a,b,a,b) + else if(instr == OP_DUP2_X2) { + nvm_stack_t w1 = stack_pop(); + nvm_stack_t w2 = stack_pop(); + nvm_stack_t w3 = stack_pop(); + nvm_stack_t w4 = stack_pop(); + stack_push(w1); + stack_push(w2); + stack_push(w3); + stack_push(w4); + stack_push(w1); + stack_push(w2); + DEBUGF("dup2 ("DBG16","DBG16")\n", + stack_peek(0) & 0xffff, stack_peek(1) & 0xffff); + } + + // swap top two stack items (a,b -> b,a) + else if(instr == OP_SWAP) { + nvm_stack_t w1 = stack_pop(); + nvm_stack_t w2 = stack_pop(); + stack_push(w1); + stack_push(w2); + DEBUGF("swap ("DBG16","DBG16")\n", stack_peek(0), stack_peek(1)); + } + +#endif + + +#ifdef NVM_USE_TABLESWITCH + else if(instr == OP_TABLESWITCH) { + DEBUGF("TABLESWITCH\n"); + // padding was eliminated by generator + tmp1 = ((nvmfile_read08(pc+7)<<8) | + nvmfile_read08(pc+8)); // get low value + tmp2 = ((nvmfile_read08(pc+11)<<8) | + nvmfile_read08(pc+12)); // get high value + arg0.tmp = stack_pop(); // get actual value + DEBUGF("tableswitch %d-%d (%d)\n", tmp1, tmp2, arg0.w); + + // value within range? + if((arg0.tmp < tmp1)||(arg0.tmp > tmp2)) + // no: use default + tmp2 = 3; + else + // yes: get offset from table + tmp2 = 3 + 12 + ((arg0.tmp - tmp1)<<2); + + // and do the jump + pc += ((nvmfile_read08(pc+tmp2+0)<<8) | + nvmfile_read08(pc+tmp2+1)); + pc_inc = 0; + } +#endif + +#ifdef NVM_USE_LOOKUPSWITCH + else if(instr == OP_LOOKUPSWITCH) { + u08_t size; + + DEBUGF("LOOKUPSWITCH\n"); + // padding was eliminated by generator + + arg0.tmp = 1 + 4; + size = nvmfile_read08(pc+arg0.tmp+3); // get table size (max for nvm is 30 cases!) + DEBUGF(" size: %d\n", size); + arg0.tmp += 4; + + tmp1 = stack_pop_int(); // get actual value + DEBUGF(" val=: %d\n", tmp1); + + while(size) + { + if ( +#ifdef NVM_USE_32BIT_WORD + nvmfile_read08(pc+arg0.tmp+0)==(u08_t)(tmp1>>24) && + nvmfile_read08(pc+arg0.tmp+1)==(u08_t)(tmp1>>16) && +#endif + nvmfile_read08(pc+arg0.tmp+2)==(u08_t)(tmp1>>8) && + nvmfile_read08(pc+arg0.tmp+3)==(u08_t)(tmp1>>0) + ) + { + DEBUGF(" value found, index is %d\n", (int)(arg0.tmp-pc_inc-8)/8); + arg0.tmp+=4; + break; + } + arg0.tmp+=8; + size--; + } + + if (size==0) + { + DEBUGF(" not found, using default!\n"); + arg0.tmp = 1; + } + pc += ((nvmfile_read08(pc+arg0.tmp+2)<<8) | + nvmfile_read08(pc+arg0.tmp+3)); + pc_inc = 0; + } +#endif + + // get static field from class + else if(instr == OP_GETSTATIC) { + pc_inc = 3; // prefetched data used + DEBUGF("getstatic #"DBG16"\n", arg0.w); + stack_push(stack_get_static(arg0.w)); + } + + else if(instr == OP_PUTSTATIC) { + pc_inc = 3; + stack_set_static(arg0.w, stack_pop()); + DEBUGF("putstatic #"DBG16" -> "DBG16"\n", + arg0.w, stack_get_static(arg0.w)); + } + + // push item from constant pool + else if(instr == OP_LDC) { + pc_inc = 2; + DEBUGF("ldc #"DBG16"\n", arg0.z.bh); +#ifdef NVM_USE_32BIT_WORD + stack_push(nvmfile_get_constant(arg0.z.bh)); +#else + stack_push(NVM_TYPE_CONST | (arg0.z.bh-nvmfile_constant_count)); +#endif + } + + else if((instr >= OP_INVOKEVIRTUAL)&&(instr <= OP_INVOKESTATIC)) { + DEBUGF("invoke"); + +#ifdef DEBUG + if(instr == OP_INVOKEVIRTUAL) { DEBUGF("virtual"); } + if(instr == OP_INVOKESPECIAL) { DEBUGF("special"); } + if(instr == OP_INVOKESTATIC) { DEBUGF("static"); } +#endif + + DEBUGF(" #"DBG16"\n", 0xffff & arg0.w); + //epos_prints("vai chamar o metodo, e ta printando o mref"); + //epos_printi(mref); + + // invoke a method. check if it's local (within the nvm file) + // or native (implemented by the runtime environment) + if(arg0.z.bh < NATIVE_CLASS_BASE) { + DEBUGF("local method call from method %d to %d\n", mref, arg0.w); + + // save current pc (relative to method start) + tmp1 = (u08_t*)pc-(u08_t*)mhdr_ptr; + + // get pointer to new method + mhdr_ptr = nvmfile_get_method_hdr(arg0.w); + + // load new method header into ram + nvmfile_read(&mhdr, mhdr_ptr, sizeof(nvm_method_hdr_t)); + +#ifdef NVM_USE_INHERITANCE + // check class on stack. it may be not the one we expect. + // this happens due to inheritance + if(instr == OP_INVOKEVIRTUAL) { + nvm_ref_t mref; + + DEBUGF("checking inheritance\n"); + + // fetch class reference from stack and use it to address + // the class instance on the heap. The first entry in this + // object is the class id of it + mref = ((nvm_ref_t*)heap_get_addr(stack_peek(0) & ~NVM_TYPE_MASK))[0]; + DEBUGF("class ref on stack/ref: %d/%d\n", + NATIVE_ID2CLASS(mref), NATIVE_ID2CLASS(mhdr.id)); + + if(NATIVE_ID2CLASS(mref) != NATIVE_ID2CLASS(mhdr.id)) { + DEBUGF("stack/ref class mismatch -> inheritance\n"); + + // get matching method in class on stack or its + // super classes + arg0.z.bl = nvmfile_get_method_by_class_and_id( + NATIVE_ID2CLASS(mref), NATIVE_ID2METHOD(mhdr.id)); + + // get pointer to new method + mhdr_ptr = nvmfile_get_method_hdr(arg0.z.bl); + + // load new method header into ram + nvmfile_read(&mhdr, mhdr_ptr, sizeof(nvm_method_hdr_t)); + } + } +#endif + + // arguments are left on the stack by the calling + // method and expected in the locals by the called + // method. Thus we make this part of the old stack + // be the locals part of the method + DEBUGF("Remove %d args from stack\n", mhdr.args); + stack_add_sp(-mhdr.args); + + tmp2 = stack_get_sp() - locals; + + locals = stack_get_sp() + 1; + +#ifdef DEBUG + if(instr == OP_INVOKEVIRTUAL) { + DEBUGF("virtual call with object reference "DBG16"\n", + locals[0]); + } +#endif + + // make space for locals on the stack + DEBUGF("Allocating space for %d local(s) and %d " + "stack elements - %d args\n", + mhdr.max_locals, mhdr.max_stack, mhdr.args); + + // increase stack space. locals will be put on the stack as + // well. method arguments are part of the locals and are + // already on the stack + heap_steal(sizeof(nvm_stack_t) * + (VM_METHOD_CALL_REQUIREMENTS + + mhdr.max_locals + mhdr.max_stack + mhdr.args)); + + // add space for locals on stack + stack_add_sp(mhdr.max_locals); + + // push everything required to return onto the stack + stack_push(tmp1); // pc offset + stack_push(mref); // method reference + stack_push(tmp2); // locals offset + + // set new pc (this is the actual call) + mref = arg0.w; + pc = (u08_t*)mhdr_ptr + mhdr.code_index; + pc_inc = 0; // don't add further bytes to program counter + } else { + native_invoke(arg0.w); + // trouble nigga + pc_inc = 3; // prefetched data used + } + } + + else if(instr == OP_GETFIELD) { + pc_inc = 3; + DEBUGF("getfield #%d\n", arg0.w); + //epos_printi(stack_peek(0) & ~NVM_TYPE_MASK); + stack_push(((nvm_word_t*)heap_get_addr(stack_pop() & ~NVM_TYPE_MASK)) + [VM_CLASS_CONST_ALLOC+arg0.w]); + } + + else if(instr == OP_PUTFIELD) { + pc_inc = 3; + tmp1 = stack_pop(); + + DEBUGF("putfield #%d\n", arg0.w); + ((nvm_word_t*)heap_get_addr(stack_pop() & ~NVM_TYPE_MASK)) + [VM_CLASS_CONST_ALLOC+arg0.w] = tmp1; + } + + else if(instr == OP_NEW) { + pc_inc = 3; + DEBUGF("new #"DBG16"\n", 0xffff & arg0.w); + vm_new(arg0.w); + } + +#ifdef NVM_USE_ARRAY + else if(instr == OP_NEWARRAY) { + pc_inc = 2; + stack_push(array_new(stack_pop(), arg0.z.bh) | NVM_TYPE_HEAP); + } + + else if(instr == OP_ARRAYLENGTH) { + stack_push(array_length(stack_pop() & ~NVM_TYPE_MASK)); + } + + else if(instr == OP_BASTORE) { + tmp2 = stack_pop_int(); // value + tmp1 = stack_pop_int(); // index + // third parm on stack: array reference + array_bastore(stack_pop() & ~NVM_TYPE_MASK, tmp1, tmp2); + } + + else if(instr == OP_IASTORE) { + tmp2 = stack_pop_int(); // value + tmp1 = stack_pop_int(); // index + // third parm on stack: array reference + array_iastore(stack_pop() & ~NVM_TYPE_MASK, tmp1, tmp2); + } + + else if(instr == OP_BALOAD) { + tmp1 = stack_pop_int(); // index + // second parm on stack: array reference + stack_push(array_baload(stack_pop() & ~NVM_TYPE_MASK, tmp1)); + } + + else if(instr == OP_IALOAD) { + tmp1 = stack_pop_int(); // index + // second parm on stack: array reference + stack_push(array_iaload(stack_pop() & ~NVM_TYPE_MASK, tmp1)); + } +#endif + +#ifdef NVM_USE_OBJ_ARRAY + else if(instr == OP_ANEWARRAY) { + // Object array is the same as int array... + pc_inc = 3; + stack_push(array_new(stack_pop(), T_INT) | NVM_TYPE_HEAP); + } + + else if(instr == OP_AASTORE) { + tmp2 = stack_pop_int(); // value + tmp1 = stack_pop_int(); // index + // third parm on stack: array reference + array_iastore(stack_pop(), tmp1, tmp2); + } + + else if(instr == OP_AALOAD) { + tmp1 = stack_pop_int(); // index + // second parm on stack: array reference + stack_push(array_iaload(stack_pop(), tmp1)); + } +#endif + +#ifdef NVM_USE_FLOAT +# ifdef NVM_USE_ARRAY + else if(instr == OP_FALOAD) { + tmp1 = stack_pop_int(); // index + // second parm on stack: array reference + stack_push(array_faload(stack_pop() & ~NVM_TYPE_MASK, tmp1)); + } + else if(instr == OP_FASTORE) { + f0 = stack_pop_float(); // value + tmp1 = stack_pop_int(); // index + // third parm on stack: array reference + array_fastore(stack_pop() & ~NVM_TYPE_MASK, tmp1, f0); + } +# endif + + else if(instr == OP_FCONST_0) { + stack_push(nvm_float2stack(0.0)); + DEBUGF("fconst_%d\n", stack_peek_float(0)); + } + else if(instr == OP_FCONST_1) { + stack_push(nvm_float2stack(1.0)); + DEBUGF("fconst_%d\n", stack_peek_float(0)); + } + else if(instr == OP_FCONST_2) { + stack_push(nvm_float2stack(2.0)); + DEBUGF("fconst_%d\n", stack_peek_float(0)); + } + else if(instr == OP_I2F) { + tmp1 = stack_pop_int(); + stack_push(nvm_float2stack(tmp1)); + DEBUGF("i2f %f\n", stack_peek_float(0)); + } + else if(instr == OP_F2I) { + tmp1 = stack_pop_float(); + stack_push(nvm_int2stack(tmp1)); + DEBUGF("i2f %f\n", stack_peek_int(0)); + } + + // move float from stack into locals + else if(instr == OP_FSTORE) { + locals[arg0.z.bh] = stack_pop(); pc_inc = 2; + DEBUGF("fstore %d (%f)\n", arg0.z.bh, nvm_stack2float(locals[arg0.z.bh])); + } + + // move integer from stack into locals + else if((instr >= OP_FSTORE_0) && (instr <= OP_FSTORE_3)) { + locals[instr - OP_FSTORE_0] = stack_pop(); + DEBUGF("fstore_%d (%f)\n", instr - OP_FSTORE_0, + nvm_stack2float(locals[instr - OP_FSTORE_0])); + } + + // load float from local variable (push local var) + else if(instr == OP_FLOAD) { + stack_push(locals[arg0.z.bh]); pc_inc = 2; + DEBUGF("fload %d (%f, "DBG16")\n", locals[arg0.z.bh], + stack_peek_float(0), stack_peek_int(0)); + } + + // push local onto stack + else if((instr >= OP_FLOAD_0) && (instr <= OP_FLOAD_3)) { + stack_push(locals[instr - OP_FLOAD_0]); + DEBUGF("fload_%d (%f, "DBG16")\n", instr-OP_FLOAD_0, + stack_peek_float(0), stack_peek_int(0)); + } + + // compare top values on stack + else if((instr == OP_FCMPL) || (instr == OP_FCMPG)) { + f1 = stack_pop_float(); + f0 = stack_pop_float(); + tmp1=0; + if (f0f1) + tmp1=1; + stack_push(nvm_int2stack(tmp1)); + DEBUGF("fcmp%c (%f, %f, %i)\n", (instr==OP_FCMPL)?'l':'g', + f0, f1, stack_peek_int(0)); + } +#endif + + else { + epos_prints("ERRO: UNSUPPORTED OPCODE!\n"); + //error(ERROR_VM_UNSUPPORTED_OPCODE); + } + + // reset watchdog here if present + + pc += pc_inc; + } while((instr != OP_IRETURN)&&(instr != OP_RETURN)); + + // and remove locals from stack and hope that method left + // an uncorrupted stack + stack_add_sp(-mhdr.max_locals); + +#ifdef NVM_USE_STACK_CHECK +// stack_verify_sp(); +#endif + + // give memory back to heap + heap_unsteal(sizeof(nvm_stack_t) * (mhdr.max_locals + mhdr.max_stack + mhdr.args)); +} + diff -U 3 -H -d -r -N -- epos--/src/vm/vm.h epos--jvm/src/vm/vm.h --- epos--/src/vm/vm.h 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/src/vm/vm.h 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,62 @@ +// +// NanoVM, a tiny java VM for the Atmel AVR family +// Copyright (C) 2005 by Till Harbaum +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// + +// +// vm.h +// + +#ifndef VM_H +#define VM_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "nvmtypes.h" +#include "heap.h" +#include "nvmfile.h" + +extern nvm_stack_t *locals; + +// additional items to be allocated on heap during constructor call +#define VM_CLASS_CONST_ALLOC 1 + +void vm_init(void); +void vm_run(u16_t mref); + +// expand types +void * vm_get_addr(nvm_ref_t ref); + +#define nvm_int2stack(x) (~NVM_IMMEDIATE_MASK & (x)) +nvm_int_t nvm_stack2int(nvm_stack_t val); + +#define nvm_ref2stack(x) (x) +#define nvm_stack2ref(x) (x) + +#ifdef NVM_USE_FLOAT +nvm_stack_t nvm_float2stack(nvm_float_t val); +nvm_float_t nvm_stack2float(nvm_stack_t val); +#endif + +#ifdef __cplusplus +} +#endif + + +#endif // VM_H diff -U 3 -H -d -r -N -- epos--/tools/eposcc/eposcc epos--jvm/tools/eposcc/eposcc --- epos--/tools/eposcc/eposcc 2010-07-21 23:02:24.000000000 -0300 +++ epos--jvm/tools/eposcc/eposcc 2010-12-08 12:19:56.000000000 -0200 @@ -73,7 +73,7 @@ LINKER_LIBRARY=$LINKER LINK_FLGS_LIBRARY="-L$LIB -L`$C_COMPILER $C_COMP_FLGS -print-file-name=` -static --nmagic --section-start $MACH_CODE_NAME=$APP_CODE --section-start $MACH_DATA_NAME=$APP_DATA" -LINK_OBJI_LIBRARY="$LIB/$ARCH""_crt1.o $LIB/$ARCH""_crti.o $LIB/$ARCH""_crtbegin.o $LIB/$MACH""_init_first.o $LIB/$MACH""_init_application.o $LIB/$MACH""_application.o" +LINK_OBJI_LIBRARY="$LIB/eposjava.o $LIB/$ARCH""_crt1.o $LIB/$ARCH""_crti.o $LIB/$ARCH""_crtbegin.o $LIB/$MACH""_init_first.o $LIB/$MACH""_init_application.o $LIB/$MACH""_application.o" LINK_OBJN_LIBRARY="$LIB/$MACH""_init_system.o $LIB/$MACH""_system.o $LIB/$ARCH""_crtend.o $LIB/$ARCH""_crtn.o" LINK_LIBS_LIBRARY="util_$ARCH init_$ARCH system_$ARCH mach_$ARCH arch_$ARCH util_$ARCH gcc c gcc" diff -U 3 -H -d -r -N -- epos--/vars epos--jvm/vars --- epos--/vars 1969-12-31 21:00:00.000000000 -0300 +++ epos--jvm/vars 2010-12-08 12:13:56.000000000 -0200 @@ -0,0 +1,2 @@ +export EPOS=$PWD +export PATH=$PATH:$EPOS/bin