aboutsummaryrefslogtreecommitdiff
path: root/src/library.js
diff options
context:
space:
mode:
authormanny/MADE <nerurkar@made-apps.biz>2013-06-17 14:03:11 +0200
committermanny/MADE <nerurkar@made-apps.biz>2013-06-18 14:00:05 +0200
commitf015eb3da85cae5fd3cad36a17c6633b6cb5ca7b (patch)
tree96ba708a195be439daa6b1778cd7c82cd4f1bb8b /src/library.js
parenta04b53740e3de7cc8b4c4b9d6fd9fd903c0f97aa (diff)
IMPROVED: va_list offset is not hardcoded, added comments
Diffstat (limited to 'src/library.js')
-rw-r--r--src/library.js16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/library.js b/src/library.js
index d6e6879b..33dcbd5f 100644
--- a/src/library.js
+++ b/src/library.js
@@ -4999,23 +4999,19 @@ LibraryManager.library = {
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*');
+ // 2-word structure: struct { void* start; void* currentOffset; }
+ return makeSetValue(ptr, 0, 'varrp', 'void*') + ';' + makeSetValue(ptr, Runtime.QUANTUM_SIZE, 0, 'void*');
#endif
},
llvm_va_end: function() {},
llvm_va_copy: function(ppdest, ppsrc) {
+ // copy the list start
{{{ makeCopyValues('ppdest', 'ppsrc', Runtime.QUANTUM_SIZE, 'null', null, 1) }}};
- {{{ makeCopyValues('(ppdest+4)', '(ppsrc+4)', Runtime.QUANTUM_SIZE, 'null', null, 1) }}};
- /* Alternate implementation that copies the actual DATA; it assumes the va_list is prefixed by its size
- var psrc = IHEAP[ppsrc]-1;
- var num = IHEAP[psrc]; // right before the data, is the number of (flattened) values
- var pdest = _malloc(num+1);
- _memcpy(pdest, psrc, num+1);
- IHEAP[ppdest] = pdest+1;
- */
+
+ // copy the list's current offset (will be advanced with each call to va_arg)
+ {{{ makeCopyValues('(ppdest+'+Runtime.QUANTUM_SIZE+')', '(ppsrc+'+Runtime.QUANTUM_SIZE+')', Runtime.QUANTUM_SIZE, 'null', null, 1) }}};
},
llvm_bswap_i16: function(x) {