@@ -368,7 +368,7 @@ function makeSetTempDouble(i, type, value) {
368368}
369369
370370// See makeSetValue
371- function makeGetValue ( ptr , pos , type , noNeedFirst , unsigned , ignore , align , noSafe ) {
371+ function makeGetValue ( ptr , pos , type , noNeedFirst , unsigned , ignore , align ) {
372372 if ( typeof unsigned !== 'undefined' ) {
373373 // TODO(sbc): make this into an error at some point.
374374 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
381381 }
382382
383383 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 ) ) ;
386386 return '(' + setdouble1 + ',' + setdouble2 + ',' + makeGetTempDouble ( 0 , 'double' ) + ')' ;
387387 }
388388
@@ -394,12 +394,12 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSa
394394 if ( isIntImplemented ( type ) ) {
395395 if ( bytes == 4 && align == 2 ) {
396396 // 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)' ;
399399 } else { // XXX we cannot truly handle > 4... (in x86)
400400 ret = '' ;
401401 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 ) : '' ) + ')' ;
403403 if ( i < bytes - 1 ) ret += '|' ;
404404 }
405405 ret = '(' + makeSignOp ( ret , type , unsigned ? 'un' : 're' , true ) ;
@@ -417,11 +417,6 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSa
417417 }
418418
419419 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- }
425420
426421 const slab = getHeapForType ( type ) ;
427422 let ret = slab + '[' + getHeapOffset ( offset , type ) + ']' ;
@@ -439,24 +434,22 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSa
439434 * @param {nunber } pos The position in that slab - the offset. Added to any offset in the pointer itself.
440435 * @param {number } value The value to set.
441436 * @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;
443437 * which means we should write to all slabs, ignore type differences if any on reads, etc.
444438 * @param {bool } noNeedFirst Whether to ignore the offset in the pointer itself.
445439 * @param {bool } ignore: legacy, ignored.
446440 * @param {number } align: TODO
447- * @param {bool } noSafe: TODO
448441 * @param {string } sep: TODO
449442 * @return {TODO }
450443 */
451- function makeSetValue ( ptr , pos , value , type , noNeedFirst , ignore , align , noSafe , sep = ';' ) {
444+ function makeSetValue ( ptr , pos , value , type , noNeedFirst , ignore , align , sep = ';' ) {
452445 if ( type == 'double' && ( align < 8 ) ) {
453446 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 , ',' ) + ')' ;
456449 } else if ( ! WASM_BIGINT && type == 'i64' ) {
457450 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 , ',' ) + ')' ;
460453 }
461454
462455 const bits = getBits ( type ) ;
@@ -470,29 +463,24 @@ function makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe,
470463 if ( bytes == 4 && align == 2 ) {
471464 // Special case that we can optimize
472465 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 ) ;
475468 } else {
476469 ret += 'tempBigInt=' + value + sep ;
477470 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 ) ;
479472 if ( i < bytes - 1 ) ret += sep + 'tempBigInt = tempBigInt>>8' + sep ;
480473 }
481474 }
482475 } 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 ;
484477 ret += makeCopyValues ( getFastValue ( ptr , '+' , pos ) , 'tempDoublePtr' , Runtime . getNativeTypeSize ( type ) , type , null , align , sep ) ;
485478 }
486479 return ret ;
487480 }
488481 }
489482
490483 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- }
496484
497485 const slab = getHeapForType ( type ) ;
498486 if ( slab == 'HEAPU64' || slab == 'HEAP64' ) {
0 commit comments