aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-13 17:20:59 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-13 17:20:59 -0700
commiteda32b68ea4d04a7467fe1ece23813b8db5250a9 (patch)
treeb42f21dc512d40261cda3e6353e9ba90be9156f5
parent73579052dae38b12067b350be0a11a74090d0dfe (diff)
RELOOPER_BUFFER_SIZE to change the relooper buffer size easily1.5.8
-rw-r--r--src/relooper/emscripten/glue.js12
-rw-r--r--src/settings.js2
-rw-r--r--tools/shared.py2
3 files changed, 9 insertions, 7 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
diff --git a/tools/shared.py b/tools/shared.py
index 853b064d..45551fec 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -304,7 +304,7 @@ def find_temp_directory():
# we re-check sanity when the settings are changed)
# We also re-check sanity and clear the cache when the version changes
-EMSCRIPTEN_VERSION = '1.5.7'
+EMSCRIPTEN_VERSION = '1.5.8'
def generate_sanity():
return EMSCRIPTEN_VERSION + '|' + get_llvm_target() + '|' + LLVM_ROOT