@@ -368,7 +368,7 @@ function makeSetTempDouble(i, type, value) {
368
368
}
369
369
370
370
// See makeSetValue
371
- function makeGetValue ( ptr , pos , type , noNeedFirst , unsigned , ignore , align , noSafe ) {
371
+ function makeGetValue ( ptr , pos , type , noNeedFirst , unsigned , ignore , align ) {
372
372
if ( typeof unsigned !== 'undefined' ) {
373
373
// TODO(sbc): make this into an error at some point.
374
374
printErr ( 'makeGetValue: Please use u8/u16/u32/u64 unsigned types in favor of additional argument' ) ;
@@ -381,8 +381,8 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSa
381
381
}
382
382
383
383
if ( type == 'double' && ( align < 8 ) ) {
384
- const setdouble1 = makeSetTempDouble ( 0 , 'i32' , makeGetValue ( ptr , pos , 'i32' , noNeedFirst , unsigned , ignore , align , noSafe ) ) ;
385
- const setdouble2 = makeSetTempDouble ( 1 , 'i32' , makeGetValue ( ptr , getFastValue ( pos , '+' , Runtime . getNativeTypeSize ( 'i32' ) ) , 'i32' , noNeedFirst , unsigned , ignore , align , noSafe ) ) ;
384
+ const setdouble1 = makeSetTempDouble ( 0 , 'i32' , makeGetValue ( ptr , pos , 'i32' , noNeedFirst , unsigned , ignore , align ) ) ;
385
+ const setdouble2 = makeSetTempDouble ( 1 , 'i32' , makeGetValue ( ptr , getFastValue ( pos , '+' , Runtime . getNativeTypeSize ( 'i32' ) ) , 'i32' , noNeedFirst , unsigned , ignore , align ) ) ;
386
386
return '(' + setdouble1 + ',' + setdouble2 + ',' + makeGetTempDouble ( 0 , 'double' ) + ')' ;
387
387
}
388
388
@@ -394,12 +394,12 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSa
394
394
if ( isIntImplemented ( type ) ) {
395
395
if ( bytes == 4 && align == 2 ) {
396
396
// Special case that we can optimize
397
- ret += makeGetValue ( ptr , pos , 'i16' , noNeedFirst , 2 , ignore , 2 , noSafe ) + '|' +
398
- '(' + makeGetValue ( ptr , getFastValue ( pos , '+' , 2 ) , 'i16' , noNeedFirst , 2 , ignore , 2 , noSafe ) + '<<16)' ;
397
+ ret += makeGetValue ( ptr , pos , 'i16' , noNeedFirst , 2 , ignore , 2 ) + '|' +
398
+ '(' + makeGetValue ( ptr , getFastValue ( pos , '+' , 2 ) , 'i16' , noNeedFirst , 2 , ignore , 2 ) + '<<16)' ;
399
399
} else { // XXX we cannot truly handle > 4... (in x86)
400
400
ret = '' ;
401
401
for ( let i = 0 ; i < bytes ; i ++ ) {
402
- ret += '(' + makeGetValue ( ptr , getFastValue ( pos , '+' , i ) , 'i8' , noNeedFirst , 1 , ignore , 1 , noSafe ) + ( i > 0 ? '<<' + ( 8 * i ) : '' ) + ')' ;
402
+ ret += '(' + makeGetValue ( ptr , getFastValue ( pos , '+' , i ) , 'i8' , noNeedFirst , 1 , ignore , 1 ) + ( i > 0 ? '<<' + ( 8 * i ) : '' ) + ')' ;
403
403
if ( i < bytes - 1 ) ret += '|' ;
404
404
}
405
405
ret = '(' + makeSignOp ( ret , type , unsigned ? 'un' : 're' , true ) ;
@@ -417,11 +417,6 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSa
417
417
}
418
418
419
419
const offset = calcFastOffset ( ptr , pos , noNeedFirst ) ;
420
- if ( SAFE_HEAP && ! noSafe ) {
421
- if ( ! ignore ) {
422
- return asmCoercion ( 'SAFE_HEAP_LOAD' + ( FLOAT_TYPES . has ( type ) ? '_D' : '' ) + '(' + asmCoercion ( offset , 'i32' ) + ', ' + Runtime . getNativeTypeSize ( type ) + ', ' + ( ! ! unsigned + 0 ) + ')' , type , unsigned ? 'u' : undefined ) ;
423
- }
424
- }
425
420
426
421
const slab = getHeapForType ( type ) ;
427
422
let ret = slab + '[' + getHeapOffset ( offset , type ) + ']' ;
@@ -439,24 +434,22 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSa
439
434
* @param {nunber } pos The position in that slab - the offset. Added to any offset in the pointer itself.
440
435
* @param {number } value The value to set.
441
436
* @param {string } type A string defining the type. Used to find the slab (HEAPU8, HEAP16, HEAPU32, etc.).
442
- * 'null' means, in the context of SAFE_HEAP, that we should accept all types;
443
437
* which means we should write to all slabs, ignore type differences if any on reads, etc.
444
438
* @param {bool } noNeedFirst Whether to ignore the offset in the pointer itself.
445
439
* @param {bool } ignore: legacy, ignored.
446
440
* @param {number } align: TODO
447
- * @param {bool } noSafe: TODO
448
441
* @param {string } sep: TODO
449
442
* @return {TODO }
450
443
*/
451
- function makeSetValue ( ptr , pos , value , type , noNeedFirst , ignore , align , noSafe , sep = ';' ) {
444
+ function makeSetValue ( ptr , pos , value , type , noNeedFirst , ignore , align , sep = ';' ) {
452
445
if ( type == 'double' && ( align < 8 ) ) {
453
446
return '(' + makeSetTempDouble ( 0 , 'double' , value ) + ',' +
454
- makeSetValue ( ptr , pos , makeGetTempDouble ( 0 , 'i32' ) , 'i32' , noNeedFirst , ignore , align , noSafe , ',' ) + ',' +
455
- makeSetValue ( ptr , getFastValue ( pos , '+' , Runtime . getNativeTypeSize ( 'i32' ) ) , makeGetTempDouble ( 1 , 'i32' ) , 'i32' , noNeedFirst , ignore , align , noSafe , ',' ) + ')' ;
447
+ makeSetValue ( ptr , pos , makeGetTempDouble ( 0 , 'i32' ) , 'i32' , noNeedFirst , ignore , align , ',' ) + ',' +
448
+ makeSetValue ( ptr , getFastValue ( pos , '+' , Runtime . getNativeTypeSize ( 'i32' ) ) , makeGetTempDouble ( 1 , 'i32' ) , 'i32' , noNeedFirst , ignore , align , ',' ) + ')' ;
456
449
} else if ( ! WASM_BIGINT && type == 'i64' ) {
457
450
return '(tempI64 = [' + splitI64 ( value ) + '],' +
458
- makeSetValue ( ptr , pos , 'tempI64[0]' , 'i32' , noNeedFirst , ignore , align , noSafe , ',' ) + ',' +
459
- makeSetValue ( ptr , getFastValue ( pos , '+' , Runtime . getNativeTypeSize ( 'i32' ) ) , 'tempI64[1]' , 'i32' , noNeedFirst , ignore , align , noSafe , ',' ) + ')' ;
451
+ makeSetValue ( ptr , pos , 'tempI64[0]' , 'i32' , noNeedFirst , ignore , align , ',' ) + ',' +
452
+ makeSetValue ( ptr , getFastValue ( pos , '+' , Runtime . getNativeTypeSize ( 'i32' ) ) , 'tempI64[1]' , 'i32' , noNeedFirst , ignore , align , ',' ) + ')' ;
460
453
}
461
454
462
455
const bits = getBits ( type ) ;
@@ -470,29 +463,24 @@ function makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe,
470
463
if ( bytes == 4 && align == 2 ) {
471
464
// Special case that we can optimize
472
465
ret += 'tempBigInt=' + value + sep ;
473
- ret += makeSetValue ( ptr , pos , 'tempBigInt&0xffff' , 'i16' , noNeedFirst , ignore , 2 , noSafe ) + sep ;
474
- ret += makeSetValue ( ptr , getFastValue ( pos , '+' , 2 ) , 'tempBigInt>>16' , 'i16' , noNeedFirst , ignore , 2 , noSafe ) ;
466
+ ret += makeSetValue ( ptr , pos , 'tempBigInt&0xffff' , 'i16' , noNeedFirst , ignore , 2 ) + sep ;
467
+ ret += makeSetValue ( ptr , getFastValue ( pos , '+' , 2 ) , 'tempBigInt>>16' , 'i16' , noNeedFirst , ignore , 2 ) ;
475
468
} else {
476
469
ret += 'tempBigInt=' + value + sep ;
477
470
for ( let i = 0 ; i < bytes ; i ++ ) {
478
- ret += makeSetValue ( ptr , getFastValue ( pos , '+' , i ) , 'tempBigInt&0xff' , 'i8' , noNeedFirst , ignore , 1 , noSafe ) ;
471
+ ret += makeSetValue ( ptr , getFastValue ( pos , '+' , i ) , 'tempBigInt&0xff' , 'i8' , noNeedFirst , ignore , 1 ) ;
479
472
if ( i < bytes - 1 ) ret += sep + 'tempBigInt = tempBigInt>>8' + sep ;
480
473
}
481
474
}
482
475
} else {
483
- ret += makeSetValue ( 'tempDoublePtr' , 0 , value , type , noNeedFirst , ignore , 8 , noSafe , null , true ) + sep ;
476
+ ret += makeSetValue ( 'tempDoublePtr' , 0 , value , type , noNeedFirst , ignore , 8 ) + sep ;
484
477
ret += makeCopyValues ( getFastValue ( ptr , '+' , pos ) , 'tempDoublePtr' , Runtime . getNativeTypeSize ( type ) , type , null , align , sep ) ;
485
478
}
486
479
return ret ;
487
480
}
488
481
}
489
482
490
483
const offset = calcFastOffset ( ptr , pos , noNeedFirst ) ;
491
- if ( SAFE_HEAP && ! noSafe ) {
492
- if ( ! ignore ) {
493
- return 'SAFE_HEAP_STORE' + ( FLOAT_TYPES . has ( type ) ? '_D' : '' ) + '(' + asmCoercion ( offset , 'i32' ) + ', ' + asmCoercion ( value , type ) + ', ' + Runtime . getNativeTypeSize ( type ) + ')' ;
494
- }
495
- }
496
484
497
485
const slab = getHeapForType ( type ) ;
498
486
if ( slab == 'HEAPU64' || slab == 'HEAP64' ) {
0 commit comments