mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-25 07:02:13 +00:00
Add shared memory definitions and initial API (#435)
This commit is contained in:
parent
c7441066dc
commit
b7c7be1fe9
1
NOTICE
1
NOTICE
@ -11,6 +11,7 @@ under the licensing terms detailed in LICENSE:
|
||||
* Palmer <pengliao@live.cn>
|
||||
* Linus Unnebäck <linus@folkdatorn.se>
|
||||
* Joshua Tenner <tenner.joshua@gmail.com>
|
||||
* Nidin Vinayakan <01@01alchemist.com>
|
||||
|
||||
Portions of this software are derived from third-party works licensed under
|
||||
the following terms:
|
||||
|
4
src/glue/binaryen.d.ts
vendored
4
src/glue/binaryen.d.ts
vendored
@ -552,7 +552,7 @@ declare type BinaryenImportRef = usize;
|
||||
|
||||
declare function _BinaryenAddFunctionImport(module: BinaryenModuleRef, internalName: usize, externalModuleName: usize, externalBaseName: usize, functionType: BinaryenFunctionTypeRef): BinaryenImportRef;
|
||||
declare function _BinaryenAddTableImport(module: BinaryenModuleRef, internalName: usize, externalModuleName: usize, externalBaseName: usize): BinaryenImportRef;
|
||||
declare function _BinaryenAddMemoryImport(module: BinaryenModuleRef, internalName: usize, externalModuleName: usize, externalBaseName: usize): BinaryenImportRef;
|
||||
declare function _BinaryenAddMemoryImport(module: BinaryenModuleRef, internalName: usize, externalModuleName: usize, externalBaseName: usize, shared:bool): BinaryenImportRef;
|
||||
declare function _BinaryenAddGlobalImport(module: BinaryenModuleRef, internalName: usize, externalModuleName: usize, externalBaseName: usize, globalType: BinaryenType): BinaryenImportRef;
|
||||
|
||||
declare type BinaryenExportRef = usize;
|
||||
@ -570,7 +570,7 @@ declare function _BinaryenRemoveGlobal(module: BinaryenModuleRef, name: usize):
|
||||
|
||||
declare function _BinaryenSetFunctionTable(module: BinaryenModuleRef, initial: BinaryenIndex, maximum: BinaryenIndex, funcs: usize, numFuncs: BinaryenIndex): void;
|
||||
|
||||
declare function _BinaryenSetMemory(module: BinaryenModuleRef, initial: BinaryenIndex, maximum: BinaryenIndex, exportName: usize, segments: usize, segmentOffsets: usize, segmentSizes: usize, numSegments: BinaryenIndex): void;
|
||||
declare function _BinaryenSetMemory(module: BinaryenModuleRef, initial: BinaryenIndex, maximum: BinaryenIndex, exportName: usize, segments: usize, segmentOffsets: usize, segmentSizes: usize, numSegments: BinaryenIndex, shared: bool): void;
|
||||
|
||||
declare function _BinaryenSetStart(module: BinaryenModuleRef, start: BinaryenFunctionRef): void;
|
||||
|
||||
|
@ -905,13 +905,14 @@ export class Module {
|
||||
addMemoryImport(
|
||||
internalName: string,
|
||||
externalModuleName: string,
|
||||
externalBaseName: string
|
||||
externalBaseName: string,
|
||||
shared: bool = false,
|
||||
): ImportRef {
|
||||
var cStr1 = allocString(internalName);
|
||||
var cStr2 = allocString(externalModuleName);
|
||||
var cStr3 = allocString(externalBaseName);
|
||||
try {
|
||||
return _BinaryenAddMemoryImport(this.ref, cStr1, cStr2, cStr3);
|
||||
return _BinaryenAddMemoryImport(this.ref, cStr1, cStr2, cStr3, shared);
|
||||
} finally {
|
||||
memory.free(cStr3);
|
||||
memory.free(cStr2);
|
||||
@ -945,7 +946,8 @@ export class Module {
|
||||
maximum: Index,
|
||||
segments: MemorySegment[],
|
||||
target: Target,
|
||||
exportName: string | null = null
|
||||
exportName: string | null = null,
|
||||
shared: bool = false
|
||||
): void {
|
||||
var cStr = allocString(exportName);
|
||||
var k = segments.length;
|
||||
@ -965,7 +967,7 @@ export class Module {
|
||||
var cArr2 = allocI32Array(offs);
|
||||
var cArr3 = allocI32Array(sizs);
|
||||
try {
|
||||
_BinaryenSetMemory(this.ref, initial, maximum, cStr, cArr1, cArr2, cArr3, k);
|
||||
_BinaryenSetMemory(this.ref, initial, maximum, cStr, cArr1, cArr2, cArr3, k, shared);
|
||||
} finally {
|
||||
memory.free(cArr3);
|
||||
memory.free(cArr2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user