Allow more than 256 methods and constants.

Class symbol tables now grow on demand, and the relevant
instructions take 16-bit arguments. There's a small perf hit
for this, but only a few percent, which is good.
This commit is contained in:
Bob Nystrom
2014-01-04 11:08:31 -08:00
parent f82a034b57
commit 870f3b8b93
18 changed files with 10589 additions and 420 deletions
+4 -1
View File
@@ -6,6 +6,9 @@
#include "wren_value.h"
#include "wren_utils.h"
// TODO: Get rid of this.
#define MAX_GLOBALS 256
typedef enum
{
// Load the constant at index [arg].
@@ -203,7 +206,7 @@ struct WrenVM
SymbolTable globalSymbols;
// TODO: Using a fixed array is gross here.
Value globals[MAX_SYMBOLS];
Value globals[MAX_GLOBALS];
// The compiler that is currently compiling code. This is used so that heap
// allocated objects used by the compiler can be found if a GC is kicked off