Get vm compiling as C++.

This commit is contained in:
Bob Nystrom
2015-01-15 16:02:38 -08:00
parent 08263e3676
commit 89a6ed9687
2 changed files with 6 additions and 3 deletions

View File

@ -32,7 +32,7 @@ WrenVM* wrenNewVM(WrenConfiguration* configuration)
reallocate = configuration->reallocateFn;
}
WrenVM* vm = reallocate(NULL, 0, sizeof(WrenVM));
WrenVM* vm = (WrenVM*)reallocate(NULL, 0, sizeof(WrenVM));
vm->reallocate = reallocate;
@ -520,13 +520,13 @@ static bool runInterpreter(WrenVM* vm)
}
#else
#define DISPATCH() goto *dispatchTable[instruction = READ_BYTE()];
#define DISPATCH() goto *dispatchTable[instruction = (Code)READ_BYTE()];
#endif
#else
#define INTERPRET_LOOP for (;;) switch (instruction = READ_BYTE())
#define INTERPRET_LOOP for (;;) switch (instruction = (Code)READ_BYTE())
#define CASE_CODE(name) case CODE_##name
#define DISPATCH() break

View File

@ -51,6 +51,9 @@ typedef enum
CODE_LOAD_LOCAL_7,
CODE_LOAD_LOCAL_8,
// Note: The compiler assumes the following _STORE instructions always
// immediately follow their corresponding _LOAD ones.
// Pushes the value in local slot [arg].
CODE_LOAD_LOCAL,