aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-11-21 16:16:46 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-11-21 16:17:19 -0800
commitd4420cfec2d27ba7a55b024d92b513975f561336 (patch)
treebf117825d5bf7f9d0c4d2e10407da7cf8753192a
parent1b755e1334785ab616541daae251160045a866a3 (diff)
add some support for le32=2 mode, where varargs is just 4-byte aligned
-rwxr-xr-xemscripten.py5
-rw-r--r--src/library.js8
-rw-r--r--src/settings.js3
3 files changed, 15 insertions, 1 deletions
diff --git a/emscripten.py b/emscripten.py
index 05c0097d..f2f143c5 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -755,6 +755,7 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
if DEBUG:
shutil.copyfile(temp2, os.path.join(shared.CANONICAL_TEMP_DIR, 'temp2.bc'))
shared.jsrun.timeout_run(subprocess.Popen([os.path.join(shared.PNACL_ROOT, 'llvm-dis'), 'temp2.bc', '-o', 'temp2.ll']))
+ #temp2 = temp1
if DEBUG: logging.debug(' ..3..')
temp3 = temp_files.get('.3.bc').name
@@ -796,6 +797,10 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
# Integrate info from backend
settings['DEFAULT_LIBRARY_FUNCS_TO_INCLUDE'] = settings['DEFAULT_LIBRARY_FUNCS_TO_INCLUDE'] + metadata['declares']
+ # Settings changes
+ assert settings['TARGET_LE32'] == 1
+ settings['TARGET_LE32'] = 2
+
# Save settings to a file to work around v8 issue 1579
settings_file = temp_files.get('.txt').name
def save_settings():
diff --git a/src/library.js b/src/library.js
index a5380c3a..8425a10f 100644
--- a/src/library.js
+++ b/src/library.js
@@ -1855,7 +1855,11 @@ LibraryManager.library = {
// int x = 4; printf("%c\n", (char)x);
var ret;
if (type === 'double') {
+#if TARGET_LE32 == 2
+ ret = {{{ makeGetValue('varargs', 'argIndex', 'double', undefined, undefined, true, 4) }}};
+#else
ret = {{{ makeGetValue('varargs', 'argIndex', 'double', undefined, undefined, true) }}};
+#endif
#if USE_TYPED_ARRAYS == 2
} else if (type == 'i64') {
@@ -1876,7 +1880,11 @@ LibraryManager.library = {
type = 'i32'; // varargs are always i32, i64, or double
ret = {{{ makeGetValue('varargs', 'argIndex', 'i32', undefined, undefined, true) }}};
}
+#if TARGET_LE32 == 2
+ argIndex += Runtime.getNativeFieldSize(type);
+#else
argIndex += Math.max(Runtime.getNativeFieldSize(type), Runtime.getAlignSize(type, null, true));
+#endif
return ret;
}
diff --git a/src/settings.js b/src/settings.js
index bc665973..64884eec 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -23,7 +23,8 @@ var QUANTUM_SIZE = 4; // This is the size of an individual field in a structure.
// Changing this from the default of 4 is deprecated.
var TARGET_X86 = 0; // For i386-pc-linux-gnu
-var TARGET_LE32 = 1; // For le32-unknown-nacl
+var TARGET_LE32 = 1; // For le32-unknown-nacl. 1 is normal, 2 is for the fastcomp llvm
+ // backend using pnacl abi simplification
var CORRECT_SIGNS = 1; // Whether we make sure to convert unsigned values to signed values.
// Decreases performance with additional runtime checks. Might not be