File tree Expand file tree Collapse file tree 3 files changed +24
-37
lines changed Expand file tree Collapse file tree 3 files changed +24
-37
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,6 @@ if (VERBOSE) {
9494load ( 'modules.js' ) ;
9595load ( 'parseTools.js' ) ;
9696load ( 'jsifier.js' ) ;
97- load ( 'runtime.js' ) ;
9897if ( ! STRICT ) {
9998 load ( 'parseTools_legacy.js' ) ;
10099}
Original file line number Diff line number Diff line change @@ -170,7 +170,8 @@ function needsQuoting(ident) {
170170 return true ;
171171}
172172
173- const POINTER_SIZE = MEMORY64 ? 8 : 4 ;
173+ global . POINTER_SIZE = MEMORY64 ? 8 : 4 ;
174+ global . STACK_ALIGN = 16 ;
174175const POINTER_BITS = POINTER_SIZE * 8 ;
175176const POINTER_TYPE = 'u' + POINTER_BITS ;
176177const POINTER_JS_TYPE = MEMORY64 ? "'bigint'" : "'number'" ;
@@ -258,6 +259,28 @@ function indentify(text, indent) {
258259
259260// Correction tools
260261
262+ function getNativeTypeSize ( type ) {
263+ switch ( type ) {
264+ case 'i1' : case 'i8' : case 'u8' : return 1 ;
265+ case 'i16' : case 'u16' : return 2 ;
266+ case 'i32' : case 'u32' : return 4 ;
267+ case 'i64' : case 'u64' : return 8 ;
268+ case 'float' : return 4 ;
269+ case 'double' : return 8 ;
270+ default : {
271+ if ( type [ type . length - 1 ] === '*' ) {
272+ return POINTER_SIZE ;
273+ }
274+ if ( type [ 0 ] === 'i' ) {
275+ const bits = Number ( type . substr ( 1 ) ) ;
276+ assert ( bits % 8 === 0 , 'getNativeTypeSize invalid bits ' + bits + ', type ' + type ) ;
277+ return bits / 8 ;
278+ }
279+ return 0 ;
280+ }
281+ }
282+ }
283+
261284function getHeapOffset ( offset , type ) {
262285 if ( type == 'i64' && ! WASM_BIGINT ) {
263286 // We are foreced to use the 32-bit heap for 64-bit values when we don't
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments