Skip to content

Commit 2aa5c43

Browse files
committed
Properly set up memory if memoryBase is specified even if there are no static segments, fixes AssemblyScript#414
1 parent 201bd5f commit 2aa5c43

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/compiler.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,12 +392,11 @@ export class Compiler extends DiagnosticEmitter {
392392
);
393393
}
394394

395-
// determine initial page size
396-
var numPages = this.memorySegments.length
397-
? i64_low(i64_shr_u(i64_align(memoryOffset, 0x10000), i64_new(16, 0)))
398-
: 0;
395+
// set up memory
399396
module.setMemory(
400-
numPages,
397+
this.options.memoryBase /* is specified */ || this.memorySegments.length
398+
? i64_low(i64_shr_u(i64_align(memoryOffset, 0x10000), i64_new(16, 0)))
399+
: 0,
401400
Module.UNLIMITED_MEMORY,
402401
this.memorySegments,
403402
options.target,

0 commit comments

Comments
 (0)