aboutsummaryrefslogtreecommitdiff
path: root/src/jsifier.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/jsifier.js')
-rw-r--r--src/jsifier.js28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index cb753e57..b5502741 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1373,8 +1373,9 @@ function JSify(data, functionsOnly, givenFunctions) {
function insertelementHandler(item) {
var base = getVectorBaseType(item.type);
var ident = ensureVector(item.ident, base);
+ var laneOp = ((base == 'float') ? 'SIMD.float32x4.with' : 'SIMD.int32x4.with');
//return ident + '.with' + SIMDLane[finalizeLLVMParameter(item.index)] + '(' + finalizeLLVMParameter(item.value) + ')';
- return 'SIMD.with' + SIMDLane[finalizeLLVMParameter(item.index)] + '(' + ident + ',' + finalizeLLVMParameter(item.value) + ')';
+ return laneOp + SIMDLane[finalizeLLVMParameter(item.index)] + '(' + ident + ',' + finalizeLLVMParameter(item.value) + ')';
}
function extractelementHandler(item) {
var base = getVectorBaseType(item.type);
@@ -1603,6 +1604,15 @@ function JSify(data, functionsOnly, givenFunctions) {
}
}
+ // we alias llvm memset and such to normal memset. The target has a return value, while the original
+ // does not, so we need to fix that for the actual call target
+ if (ASM_JS) {
+ var sig = LibraryManager.library[simpleIdent + '__sig'];
+ if (sig && sig[0] !== 'v') {
+ returnType = Functions.getSignatureType(sig[0]);
+ }
+ }
+
if (byPointer) {
var sig = Functions.getSignature(returnType, argsTypes, hasVarArgs);
if (ASM_JS) {
@@ -1746,11 +1756,13 @@ function JSify(data, functionsOnly, givenFunctions) {
print('/* no memory initializer */'); // test purposes
}
- // Define postsets. These will be run in ATINIT, right before global initializers (which might need the postsets). We cannot
- // run them now because the memory initializer might not have been applied yet.
- print('function runPostSets() {\n');
- print(itemsDict.GlobalVariablePostSet.map(function(item) { return item.JS }).join('\n'));
- print('}\n');
+ if (phase !== 'glue') {
+ // Define postsets. These will be run in ATINIT, right before global initializers (which might need the postsets). We cannot
+ // run them now because the memory initializer might not have been applied yet.
+ print('function runPostSets() {\n');
+ print(itemsDict.GlobalVariablePostSet.map(function(item) { return item.JS }).join('\n'));
+ print('}\n');
+ }
if (USE_TYPED_ARRAYS == 2) {
if (!BUILD_AS_SHARED_LIB && !SIDE_MODULE) {
@@ -1847,10 +1859,10 @@ function JSify(data, functionsOnly, givenFunctions) {
// first row are utilities called from generated code, second are needed from fastLong
['i64Add', 'i64Subtract', 'bitshift64Shl', 'bitshift64Lshr', 'bitshift64Ashr',
'llvm_ctlz_i32', 'llvm_cttz_i32'].forEach(function(func) {
- if (!Functions.libraryFunctions[func]) {
+ if (!Functions.libraryFunctions[func] || (phase == 'glue' && func[0] === 'l')) { // TODO: one-by-one in fastcomp glue mode
print(processLibraryFunction(LibraryManager.library[func], func)); // must be first to be close to generated code
Functions.implementedFunctions['_' + func] = LibraryManager.library[func + '__sig'];
- Functions.libraryFunctions[func] = 1;
+ Functions.libraryFunctions[func] = phase == 'glue' ? 2 : 1; // XXX
// limited dependency handling
var deps = LibraryManager.library[func + '__deps'];
if (deps) {