Does not export memory. No JavaScript access is needed.

This commit is contained in:
Volker Berlin 2020-03-11 19:34:49 +01:00
parent 7774b7c04a
commit 9a157b74a2
2 changed files with 1 additions and 4 deletions

View File

@ -213,9 +213,6 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod
//stream.writeVaruint32( pages ); // maximum length
}
wasm.writeSection( SectionType.Memory, stream );
// export the memory with the name "memory"
exports.add( new ExportEntry( "memory", ExternalKind.Memory, 0 ) );
}
}

View File

@ -162,7 +162,7 @@ public class TextModuleWriter extends ModuleWriter {
int pages = (dataSize + 0xFFFF) / 0x10000;
newline( textOutput );
String pagesStr = Integer.toString( pages );
textOutput.append( "(memory (export \"memory\") " ).append( pagesStr ).append( ' ' ).append( pagesStr ).append( ')' );
textOutput.append( "(memory " ).append( pagesStr ).append( ')' );
newline( textOutput );
textOutput.append( "(data (i32.const 0) \"" );
byte[] data = dataStream.toByteArray();