summaryrefslogtreecommitdiff
path: root/src/js/binaryen.js-post.js
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2019-02-05 12:35:09 -0800
committerGitHub <noreply@github.com>2019-02-05 12:35:09 -0800
commitf424f81886405fc26a415fc86900c0f8d0df14eb (patch)
tree5896c316f216fca9654f55e41809839d181ca53b /src/js/binaryen.js-post.js
parent484f62f985cb2180139d1cf991ac04ee41635417 (diff)
downloadbinaryen-f424f81886405fc26a415fc86900c0f8d0df14eb.tar.gz
binaryen-f424f81886405fc26a415fc86900c0f8d0df14eb.tar.bz2
binaryen-f424f81886405fc26a415fc86900c0f8d0df14eb.zip
Bulk memory operations (#1892)
Bulk memory operations The only parts missing are the interpreter implementation and spec tests.
Diffstat (limited to 'src/js/binaryen.js-post.js')
-rw-r--r--src/js/binaryen.js-post.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js
index aa2e613ce..b2dba075b 100644
--- a/src/js/binaryen.js-post.js
+++ b/src/js/binaryen.js-post.js
@@ -73,6 +73,10 @@ Module['SIMDReplaceId'] = Module['_BinaryenSIMDReplaceId']();
Module['SIMDShuffleId'] = Module['_BinaryenSIMDShuffleId']();
Module['SIMDBitselectId'] = Module['_BinaryenSIMDBitselectId']();
Module['SIMDShiftId'] = Module['_BinaryenSIMDShiftId']();
+Module['MemoryInitId'] = Module['_BinaryenMemoryInitId']();
+Module['DataDropId'] = Module['_BinaryenDataDropId']();
+Module['MemoryCopyId'] = Module['_BinaryenMemoryCopyId']();
+Module['MemoryFillId'] = Module['_BinaryenMemoryFillId']();
// External kinds
Module['ExternalFunction'] = Module['_BinaryenExternalFunction']();
@@ -460,6 +464,24 @@ function wrapModule(module, self) {
return Module['_BinaryenHost'](module, Module['GrowMemory'], null, i32sToStack([value]), 1);
}
+ self['memory'] = {
+ 'init': function(segment, dest, offset, size) {
+ return Module['_BinaryenMemoryInit'](module, segment, dest, offset, size);
+ },
+ 'copy': function(dest, source, size) {
+ return Module['_BinaryenMemoryCopy'](module, dest, source, size);
+ },
+ 'fill': function(dest, value, size) {
+ return Module['_BinaryenMemoryFill'](module, dest, value, size);
+ }
+ }
+
+ self['data'] = {
+ 'drop': function(segment) {
+ return Module['_BinaryenDataDrop'](module, segment);
+ }
+ }
+
// The Const creation API is a little different: we don't want users to
// need to make their own Literals, as the C API handles them by value,
// which means we would leak them. Instead, this is the only API that
@@ -2211,6 +2233,34 @@ Module['getExpressionInfo'] = function(expr) {
'vec': Module['_BinaryenSIMDShiftGetVec'](expr),
'shift': Module['_BinaryenSIMDShiftGetShift'](expr)
};
+ case Module['MemoryInitId']:
+ return {
+ 'id': id,
+ 'segment': Module['_BinaryenMemoryInitGetSegment'](expr),
+ 'dest': Module['_BinaryenMemoryInitGetDest'](expr),
+ 'offset': Module['_BinaryenMemoryInitGetOffset'](expr),
+ 'size': Module['_BinaryenMemoryInitGetSize'](expr)
+ };
+ case Module['DataDropId']:
+ return {
+ 'id': id,
+ 'segment': Module['_BinaryenDataDropGetSegment'](expr),
+ };
+ case Module['MemoryCopyId']:
+ return {
+ 'id': id,
+ 'dest': Module['_BinaryenMemoryCopyGetDest'](expr),
+ 'source': Module['_BinaryenMemoryCopyGetSource'](expr),
+ 'size': Module['_BinaryenMemoryCopyGetSize'](expr)
+ };
+ case Module['MemoryFillId']:
+ return {
+ 'id': id,
+ 'dest': Module['_BinaryenMemoryFillGetDest'](expr),
+ 'value': Module['_BinaryenMemoryFillGetValue'](expr),
+ 'size': Module['_BinaryenMemoryFillGetSize'](expr)
+ };
+
default:
throw Error('unexpected id: ' + id);
}