diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/relooper/emscripten/glue.js | 12 | ||||
-rw-r--r-- | src/settings.js | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/relooper/emscripten/glue.js b/src/relooper/emscripten/glue.js index 40ddabec..92c50500 100644 --- a/src/relooper/emscripten/glue.js +++ b/src/relooper/emscripten/glue.js @@ -1,9 +1,9 @@ - var RBUFFER_SIZE = 20*1024*1024; + var RBUFFER_SIZE = RELOOPER_BUFFER_SIZE; var rbuffer = _malloc(RBUFFER_SIZE); _rl_set_output_buffer(rbuffer, RBUFFER_SIZE); - var TBUFFER_SIZE = 10*1024*1024; + var TBUFFER_SIZE = RELOOPER_BUFFER_SIZE/2; var tbuffer = _malloc(TBUFFER_SIZE); var VBUFFER_SIZE = 256; @@ -15,10 +15,10 @@ }, RelooperGlue['addBlock'] = function(text, branchVar) { assert(this.r); - assert(text.length+1 < TBUFFER_SIZE); + assert(text.length+1 < TBUFFER_SIZE, 'buffer too small, increase RELOOPER_BUFFER_SIZE'); writeStringToMemory(text, tbuffer); if (branchVar) { - assert(branchVar.length+1 < VBUFFER_SIZE); + assert(branchVar.length+1 < VBUFFER_SIZE, 'buffer too small, increase RELOOPER_BUFFER_SIZE'); writeStringToMemory(branchVar, vbuffer); } var b = _rl_new_block(tbuffer, branchVar ? vbuffer : 0); @@ -28,14 +28,14 @@ RelooperGlue['addBranch'] = function(from, to, condition, code) { assert(this.r); if (condition) { - assert(condition.length+1 < TBUFFER_SIZE/2); + assert(condition.length+1 < TBUFFER_SIZE/2, 'buffer too small, increase RELOOPER_BUFFER_SIZE'); writeStringToMemory(condition, tbuffer); condition = tbuffer; } else { condition = 0; // allow undefined, null, etc. as inputs } if (code) { - assert(code.length+1 < TBUFFER_SIZE/2); + assert(code.length+1 < TBUFFER_SIZE/2, 'buffer too small, increase RELOOPER_BUFFER_SIZE'); writeStringToMemory(code, tbuffer + TBUFFER_SIZE/2); code = tbuffer + TBUFFER_SIZE/2; } else { diff --git a/src/settings.js b/src/settings.js index e00f4e59..15bca4db 100644 --- a/src/settings.js +++ b/src/settings.js @@ -70,6 +70,8 @@ var MAX_SETJMPS = 20; // size of setjmp table allocated in each function invocat var MICRO_OPTS = 1; // Various micro-optimizations, like nativizing variables var RELOOP = 0; // Recreate js native loops from llvm data var RELOOPER = 'relooper.js'; // Loads the relooper from this path relative to compiler.js +var RELOOPER_BUFFER_SIZE = 20*1024*1024; // The internal relooper buffer size. Increase if you see assertions + // on OutputBuffer. var USE_TYPED_ARRAYS = 2; // Use typed arrays for the heap. See https://github.com/kripken/emscripten/wiki/Code-Generation-Modes/ // 0 means no typed arrays are used. This mode disallows LLVM optimizations |