aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jsifier.js6
-rw-r--r--src/library.js15
-rw-r--r--src/library_browser.js7
3 files changed, 14 insertions, 14 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index faef88d5..88b9d9f6 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1310,8 +1310,10 @@ function JSify(data, functionsOnly, givenFunctions) {
assert(TARGET_LE32);
var ident = item.value.ident;
var move = Runtime.STACK_ALIGN;
- return '(tempInt=' + makeGetValue(ident, 4, '*') + ',' +
- makeSetValue(ident, 4, 'tempInt + ' + move, '*') + ',' +
+
+ // store current list offset in tempInt, advance list offset by STACK_ALIGN, return list entry stored at tempInt
+ return '(tempInt=' + makeGetValue(ident, Runtime.QUANTUM_SIZE, '*') + ',' +
+ makeSetValue(ident, Runtime.QUANTUM_SIZE, 'tempInt + ' + move, '*') + ',' +
makeGetValue(makeGetValue(ident, 0, '*'), 'tempInt', item.type) + ')';
});
diff --git a/src/library.js b/src/library.js
index 151cf3e5..33dcbd5f 100644
--- a/src/library.js
+++ b/src/library.js
@@ -4999,22 +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) }}};
- /* 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) {
diff --git a/src/library_browser.js b/src/library_browser.js
index 9800fedf..925b64e2 100644
--- a/src/library_browser.js
+++ b/src/library_browser.js
@@ -47,8 +47,11 @@ mergeInto(LibraryManager.library, {
workers: [],
init: function() {
- if (Browser.initted) return;
+ if (!Module["preloadPlugins"]) Module["preloadPlugins"] = []; // needs to exist even in workers
+
+ if (Browser.initted || ENVIRONMENT_IS_WORKER) return;
Browser.initted = true;
+
try {
new Blob();
Browser.hasBlobConstructor = true;
@@ -79,8 +82,6 @@ mergeInto(LibraryManager.library, {
}[name.substr(name.lastIndexOf('.')+1)];
}
- if (!Module["preloadPlugins"]) Module["preloadPlugins"] = [];
-
var imagePlugin = {};
imagePlugin['canHandle'] = function(name) {
return !Module.noImageDecoding && /\.(jpg|jpeg|png|bmp)$/.exec(name);