@@ -399,39 +399,6 @@ function makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, sep = '
399
399
return slab + '[' + getHeapOffset ( offset , type ) + '] = ' + value ;
400
400
}
401
401
402
- const UNROLL_LOOP_MAX = 8 ;
403
-
404
- function makeCopyValues ( dest , src , num , type , modifier , align , sep = ';' ) {
405
- assert ( typeof align === 'undefined' ) ;
406
- function unroll ( type , num , jump = 1 ) {
407
- const setValues = range ( num ) . map ( ( i ) => makeSetValue ( dest , i * jump , makeGetValue ( src , i * jump , type ) , type ) ) ;
408
- return setValues . join ( sep ) ;
409
- }
410
- // If we don't know how to handle this at compile-time, or handling it is best
411
- // done in a large amount of code, call memcpy
412
- if ( ! isNumber ( num ) ) num = stripCorrections ( num ) ;
413
- if ( ! isNumber ( align ) ) align = stripCorrections ( align ) ;
414
- if ( ! isNumber ( num ) || ( parseInt ( num ) / align >= UNROLL_LOOP_MAX ) ) {
415
- return '(_memcpy(' + dest + ', ' + src + ', ' + num + ')|0)' ;
416
- }
417
- num = parseInt ( num ) ;
418
- // remove corrections, since we will be correcting after we add anyhow,
419
- dest = stripCorrections ( dest ) ;
420
- src = stripCorrections ( src ) ;
421
- // and in the heap assignment expression
422
- const ret = [ ] ;
423
- [ 4 , 2 , 1 ] . forEach ( ( possibleAlign ) => {
424
- if ( num == 0 ) return ;
425
- if ( align >= possibleAlign ) {
426
- ret . push ( unroll ( 'i' + ( possibleAlign * 8 ) , Math . floor ( num / possibleAlign ) , possibleAlign ) ) ;
427
- src = getFastValue ( src , '+' , Math . floor ( num / possibleAlign ) * possibleAlign ) ;
428
- dest = getFastValue ( dest , '+' , Math . floor ( num / possibleAlign ) * possibleAlign ) ;
429
- num %= possibleAlign ;
430
- }
431
- } ) ;
432
- return ret . join ( sep ) ;
433
- }
434
-
435
402
function makeHEAPView ( which , start , end ) {
436
403
const size = parseInt ( which . replace ( 'U' , '' ) . replace ( 'F' , '' ) ) / 8 ;
437
404
const mod = size == 1 ? '' : ( '>>' + Math . log2 ( size ) ) ;
@@ -590,34 +557,6 @@ function makeThrow(what) {
590
557
return `throw ${ what } ;` ;
591
558
}
592
559
593
- function stripCorrections ( param ) {
594
- let m ;
595
- while ( true ) {
596
- if ( m = / ^ \( ( .* ) \) $ / . exec ( param ) ) {
597
- param = m [ 1 ] ;
598
- continue ;
599
- }
600
- if ( m = / ^ \( ( [ $ _ \w ] + ) \) & \d + $ / . exec ( param ) ) {
601
- param = m [ 1 ] ;
602
- continue ;
603
- }
604
- if ( m = / ^ \( ( [ $ _ \w ( ) ] + ) \) \| 0 $ / . exec ( param ) ) {
605
- param = m [ 1 ] ;
606
- continue ;
607
- }
608
- if ( m = / ^ \( ( [ $ _ \w ( ) ] + ) \) \> > > 0 $ / . exec ( param ) ) {
609
- param = m [ 1 ] ;
610
- continue ;
611
- }
612
- if ( m = / C H E C K _ O V E R F L O W \( ( [ ^ , ) ] * ) , .* / . exec ( param ) ) {
613
- param = m [ 1 ] ;
614
- continue ;
615
- }
616
- break ;
617
- }
618
- return param ;
619
- }
620
-
621
560
function charCode ( char ) {
622
561
return char . charCodeAt ( 0 ) ;
623
562
}
0 commit comments