Skip to content

Commit 2a456a3

Browse files
committed
combine initMemory & initTable into one method
1 parent 4cb2eed commit 2a456a3

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/compiler.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,7 @@ export class Compiler extends DiagnosticEmitter {
650650
}
651651

652652
// setup memory & table
653-
this.initMemory(memoryOffset);
654-
this.initTable();
653+
this.initDefaultMemoryAndTable(memoryOffset);
655654

656655
// expose the arguments length helper if there are varargs exports
657656
if (this.runtimeFeatures & RuntimeFeatures.setArgumentsLength) {
@@ -712,11 +711,13 @@ export class Compiler extends DiagnosticEmitter {
712711
return module;
713712
}
714713

715-
private initMemory(memoryOffset: i64): void {
716-
this.memoryOffset = memoryOffset;
717-
714+
private initDefaultMemoryAndTable(memoryOffset: i64): void {
718715
var options = this.options;
719716
var module = this.module;
717+
718+
// Init default memory
719+
720+
this.memoryOffset = memoryOffset;
720721
var memorySegments = this.memorySegments;
721722

722723
var initialPages: u32 = 0;
@@ -801,11 +802,8 @@ export class Compiler extends DiagnosticEmitter {
801802
isSharedMemory
802803
);
803804
}
804-
}
805805

806-
private initTable(): void {
807-
var options = this.options;
808-
var module = this.module;
806+
// Init default table
809807

810808
// import and/or export table if requested (default table is named '0' by Binaryen)
811809
if (options.importTable) {
@@ -861,6 +859,12 @@ export class Compiler extends DiagnosticEmitter {
861859
);
862860
}
863861

862+
private initTable(): void {
863+
var options = this.options;
864+
var module = this.module;
865+
866+
}
867+
864868
// === Exports ==================================================================================
865869

866870
/** Compiles the respective module exports for the specified entry file. */

0 commit comments

Comments
 (0)