aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-04-21 10:17:52 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-04-29 13:01:58 -0700
commitc2816fad68242e8e85a731d32527115673fb9422 (patch)
tree192cd801103732d90c8e383d0f368f149ed97010 /src
parentec9707170f4e6c8f016c2e2ea27a53abf1326410 (diff)
implement le32 varargs as a struct with two fields: a start and an offset
Diffstat (limited to 'src')
-rw-r--r--src/jsifier.js7
-rw-r--r--src/library.js6
2 files changed, 12 insertions, 1 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index a2ed7f92..acb0332b 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1296,7 +1296,12 @@ function JSify(data, functionsOnly, givenFunctions) {
}
});
makeFuncLineActor('va_arg', function(item) {
- return makeGetValue(item.value.ident, 0, item.type);
+ assert(TARGET_LE32);
+ var ident = item.value.ident;
+ var move = Runtime.getNativeTypeSize(item.type);
+ return '(tempInt=' + makeGetValue(ident, 4, '*') + ',' +
+ makeSetValue(ident, 4, 'tempInt + ' + move, '*') + ',' +
+ makeGetValue(makeGetValue(ident, 0, '*'), 'tempInt', item.type) + ')';
});
makeFuncLineActor('mathop', processMathop);
diff --git a/src/library.js b/src/library.js
index c62b6a05..1686fc70 100644
--- a/src/library.js
+++ b/src/library.js
@@ -4865,7 +4865,13 @@ LibraryManager.library = {
llvm_va_start__inline: function(ptr) {
// varargs - we received a pointer to the varargs as a final 'extra' parameter called 'varrp'
+#if TARGET_X86
return makeSetValue(ptr, 0, 'varrp', 'void*');
+#endif
+#if TARGET_LE32
+ // 4-word structure: start, current offset
+ return makeSetValue(ptr, 0, 'varrp', 'void*') + ';' + makeSetValue(ptr, 4, 0, 'void*');
+#endif
},
llvm_va_end: function() {},