@@ -42,50 +42,8 @@ function extractLineInfo(lineString: string): LineInfo {
4242 return parseUtils . jsonParse ( lineString ) ;
4343}
4444
45- function extractSectionAddressCorrections ( lines : string [ ] ) : Map < number , number > {
46- const corrections : Map < number , number > = new Map ( ) ;
47- const sections : string [ ] =
48- [ 'Type' , 'Import' , 'Function' , 'Table' , 'Memory' , 'Global' , 'Export' , 'Elem' , 'Code' ]
49- . map ( kind => {
50- return `; section "${ kind } " (` ;
51- } ) ;
52- let candidates : number [ ] = [ ] ;
53- let inSection = false ;
54- let sectionStartIdx = - 1 ;
55- for ( let i = 0 ; i < lines . length ; i ++ ) {
56- const line = lines [ i ] ;
57- const foundSection = sections . find ( s => {
58- return line . startsWith ( s ) ;
59- } ) ;
60-
61- if ( foundSection ) {
62- inSection = true ;
63- sectionStartIdx = i + 1 ;
64- }
65-
66- if ( inSection && i >= sectionStartIdx ) {
67- candidates . push ( i ) ;
68- if ( line . includes ( '; FIXUP section size' ) ) {
69- const hexaAddr = line . match ( / : ( [ a - z A - Z 0 - 9 ] + ) / ) ?. [ 1 ] ;
70- if ( hexaAddr ) {
71- assert ( hexaAddr . length % 2 === 0 , 'hexa address is not even' ) ;
72- const amountBytes = hexaAddr . length / 2 ;
73- candidates . forEach ( lineNr => {
74- corrections . set ( lineNr , amountBytes - 1 ) ;
75- } ) ;
76- }
77- inSection = false ;
78- sectionStartIdx = - 1 ;
79- candidates = [ ] ;
80- }
81- }
82- }
83- return corrections ;
84- }
85-
8645function createLineInfoPairs ( lines : string [ ] ) : LineInfoPairs [ ] { // TODO update
8746
88- const corrections = extractSectionAddressCorrections ( lines ) ;
8947 let result = [ ] ;
9048 let lastLineInfo = undefined ;
9149 for ( let i = 0 ; i < lines . length ; i ++ ) {
@@ -97,13 +55,6 @@ function createLineInfoPairs(lines: string[]): LineInfoPairs[] { // TODO update
9755 }
9856 try {
9957 let addr = parseUtils . extractAddressInformation ( line ) ;
100- if ( corrections . has ( i ) ) {
101- const offset = corrections . get ( i ) ! ;
102- const newAddr = Number ( `0x${ addr } ` ) + offset ;
103- const tmpAddr = newAddr . toString ( 16 ) ;
104- // add padding
105- addr = `${ '0' . repeat ( addr . length - tmpAddr . length ) } ${ tmpAddr } ` ;
106- }
10758 const li = {
10859 line : lastLineInfo ! . line ,
10960 column : lastLineInfo ! . column ,
@@ -270,7 +221,7 @@ export class WASMCompilerBridge implements CompileBridge {
270221 }
271222
272223 private compileToWasmCommand ( ) : string {
273- return `${ this . wabt } /wat2wasm --debug-names -v -o ${ this . tmpdir } /upload.wasm ` + this . wasmFilePath ;
224+ return `${ this . wabt } /wat2wasm --no-canonicalize-leb128s --disable-bulk-memory -- debug-names -v -o ${ this . tmpdir } /upload.wasm ` + this . wasmFilePath ;
274225 }
275226
276227 private getNameDumpCommand ( ) : string {
0 commit comments