diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-09-13 09:14:08 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-09-13 09:14:08 (GMT) |
| commit | acf652595c7df69adab683a5a9b29e3881cc42be (patch) | |
| tree | 6f33500607edbfbf7503b87c28639a671366be59 /src/virtualmachine/VirtualMachine.h | |
| parent | 771d5df5c9796bb5d6f6c4cae453b138dd17f192 (diff) | |
| download | powder-acf652595c7df69adab683a5a9b29e3881cc42be.zip powder-acf652595c7df69adab683a5a9b29e3881cc42be.tar.gz | |
Some progress on JIT - no syscalls yet
Diffstat (limited to 'src/virtualmachine/VirtualMachine.h')
| -rw-r--r-- | src/virtualmachine/VirtualMachine.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/virtualmachine/VirtualMachine.h b/src/virtualmachine/VirtualMachine.h index ab75e96..287e9aa 100644 --- a/src/virtualmachine/VirtualMachine.h +++ b/src/virtualmachine/VirtualMachine.h @@ -66,6 +66,8 @@ namespace vm class VirtualMachine { + int * instructionPointers; + bool bigEndian; /* host is big-endian (requires byte-swapping). */ /* Memory spaces. */ @@ -76,10 +78,16 @@ namespace vm /* Read-Only Memory (code). */ Instruction * rom; int romSize; + int romMask; + + char * compiledRom; + int compiledRomSize; + int compiledRomMask; /* Random-Access Memory (data). */ ram_t *ram; int ramSize; + int ramMask; int dataStack; int returnStack; @@ -113,7 +121,21 @@ namespace vm int readInt(FILE *qvmfile); int opcodeParameterSize(int opcode); int syscall(int programCounter); + + //Used by the JIT + int constant4(); + int constant1(); + void emit1(int v); + void emit4(int v); + void emitInstruction(const char *string); + void emitCommand(int command); + void emitAddEDI4(); + void emitMovEAXEDI(); + bool emitMovEBXEDI(int andit); + static int hex(int c); public: + static void callFromCompiled(); + static void callSyscall(); Simulation * sim; Renderer * ren; @@ -124,9 +146,11 @@ public: VirtualMachine(int hunkMbytes); virtual ~VirtualMachine(); + bool Compile(); int LoadProgram(char * filename); int Run(); - int Call(int address); + int CallInterpreted(int address); + int CallCompiled(int address); void End(); void Marshal(int address, word element) { |
