aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-01-27 17:52:02 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-01-27 17:52:02 -0800
commitc1c1cb75334c109db21694adc6a85777c433b671 (patch)
tree3aca33d9163f06234470a2117e8f3eb7a05ae585
parenteb7c2b26f500609683e412c828a9d9a1c5c61374 (diff)
fix some safeHeap errors with the new exceptions code; fixes #2068
-rwxr-xr-xemcc2
-rw-r--r--src/library.js12
-rw-r--r--tests/test_core.py10
3 files changed, 13 insertions, 11 deletions
diff --git a/emcc b/emcc
index 6191d1f5..ece1e4c5 100755
--- a/emcc
+++ b/emcc
@@ -1222,7 +1222,7 @@ try:
assert not shared.Settings.PGO, 'cannot run PGO in ASM_JS mode'
if shared.Settings.SAFE_HEAP and not js_opts:
- logging.warning('asm.js+SAFE_HEAP requires js opts to be run (-O1 or above by default)')
+ logging.warning('asm.js+SAFE_HEAP requires js opts to be run to be fully effective (-O2 or above by default)')
if shared.Settings.ALLOW_MEMORY_GROWTH:
logging.error('Cannot enable ALLOW_MEMORY_GROWTH with asm.js, build with -s ASM_JS=0 if you need a growable heap');
diff --git a/src/library.js b/src/library.js
index fc2e8a64..bca47944 100644
--- a/src/library.js
+++ b/src/library.js
@@ -162,7 +162,7 @@ LibraryManager.library = {
if (times) {
// NOTE: We don't keep track of access timestamps.
var offset = {{{ C_STRUCTS.utimbuf.modtime }}};
- time = {{{ makeGetValue('times', 'offset', 'i32') }}}
+ time = {{{ makeGetValue('times', 'offset', 'i32') }}};
time *= 1000;
} else {
time = Date.now();
@@ -1182,7 +1182,7 @@ LibraryManager.library = {
for (var i = 0; i < length; i++) {
{{{ makeSetValue('buf', 'i', 'value.charCodeAt(i)', 'i8') }}};
}
- if (len > length) {{{ makeSetValue('buf', 'i++', '0', 'i8') }}}
+ if (len > length) {{{ makeSetValue('buf', 'i++', '0', 'i8') }}};
return i;
}
},
@@ -4365,8 +4365,8 @@ LibraryManager.library = {
Module.printErr('Compiled code throwing an exception, ' + [ptr,type,destructor] + ', at ' + stackTrace());
#endif
var header = ptr - ___cxa_exception_header_size;
- {{{ makeSetValue('header', 0, 'type', 'void*') }}}
- {{{ makeSetValue('header', 4, 'destructor', 'void*') }}}
+ {{{ makeSetValue('header', 0, 'type', 'void*') }}};
+ {{{ makeSetValue('header', 4, 'destructor', 'void*') }}};
___cxa_last_thrown_exception = ptr;
if (!("uncaught_exception" in __ZSt18uncaught_exceptionv)) {
__ZSt18uncaught_exceptionv.uncaught_exception = 1;
@@ -4434,7 +4434,7 @@ LibraryManager.library = {
var destructor = {{{ makeGetValue('header', 4, 'void*') }}};
if (destructor) {
Runtime.dynCall('vi', destructor, [ptr]);
- {{{ makeSetValue('header', 4, '0', 'i32') }}}
+ {{{ makeSetValue('header', 4, '0', 'i32') }}};
}
___cxa_free_exception(ptr);
___cxa_last_thrown_exception = 0;
@@ -7630,7 +7630,7 @@ LibraryManager.library = {
node = DNS.lookup_name(node);
addr = __inet_pton4_raw(node);
if (family === {{{ cDefine('AF_UNSPEC') }}}) {
- family = {{{ cDefine('AF_INET') }}}
+ family = {{{ cDefine('AF_INET') }}};
} else if (family === {{{ cDefine('AF_INET6') }}}) {
addr = [0, 0, _htonl(0xffff), addr];
}
diff --git a/tests/test_core.py b/tests/test_core.py
index aa3fd8c4..d0de0031 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -1278,10 +1278,12 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
if self.emcc_args is None: return self.skip('need emcc to add in libcxx properly')
Settings.DISABLE_EXCEPTION_CATCHING = 0
- test_path = path_from_root('tests', 'core', 'test_exceptions_2')
- src, output = (test_path + s for s in ('.in', '.out'))
-
- self.do_run_from_file(src, output)
+ for safe in [0,1]:
+ print safe
+ Settings.SAFE_HEAP = safe
+ test_path = path_from_root('tests', 'core', 'test_exceptions_2')
+ src, output = (test_path + s for s in ('.in', '.out'))
+ self.do_run_from_file(src, output)
def test_exceptions_white_list(self):
if os.environ.get('EMCC_FAST_COMPILER') == '1': return self.skip('todo in fastcomp')