git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 53fa2cb6dbb5833d412e128716f96fe637b40738

use lang defs from annotation module

wanderer committed on 3/21/2018, 7:45:27 PM
Parent: 891456b4ce75b2fdc83622388dc0ebf2837835cc

Files changed

package-lock.jsonchanged
package.jsonchanged
tests/wasm/caller.wasmchanged
tests/wasm/funcRef_caller.wasmchanged
tests/wasm/funcRef_reciever.wasmchanged
tests/wasm/globals.wasmchanged
tests/wasm/private_caller.wasmchanged
typeCheckWrapper.jschanged
wasmContainer.jschanged
package-lock.jsonView
The diff is too large to show. Use a local git client to view these changes.
Old file size: 369684 bytes
New file size: 369221 bytes
package.jsonView
@@ -32,9 +32,9 @@
3232 "dependencies": {
3333 "binary-search-insert": "^1.0.3",
3434 "borc": "^2.0.2",
3535 "events": "^2.0.0",
36- "primea-annotations": "0.0.0",
36+ "primea-annotations": "0.0.1",
3737 "reference-map": "^1.2.3",
3838 "safe-buffer": "^5.1.1",
3939 "wasm-json-toolkit": "^0.2.3",
4040 "wasm-metering": "^0.1.1"
tests/wasm/caller.wasmView
@@ -1,3 +1,3 @@
1-asm types`` typeMap
1+asm types`n typeMap
22 ``func internalizeptablecall
33 A AA
tests/wasm/funcRef_caller.wasmView
@@ -1,2 +1,2 @@
1-asm types`` typeMap````Tfunc internalizetestcheckmoduleselfmoduleexportmemory externalizep$memorytablecallcallback
1+asm types`n typeMap````Tfunc internalizetestcheckmoduleselfmoduleexportmemory externalizep$memorytablecallcallback
22 "AAA A  A A callback
tests/wasm/funcRef_reciever.wasmView
@@ -1,3 +1,3 @@
1-asm types`` typeMap
1+asm types`n typeMap
22 ``*func internalizefuncset_gas_budgetptablereceive
33  A�� AAA
tests/wasm/globals.wasmView
@@ -1,4 +1,4 @@
1-asm persistn```+memory externalizememory internalize A~ A~ memoryloadstore
1+asm persistm```+memory externalizememory internalize A~ A~ memoryloadstore
22 
33 AA$ #AAA
44 A test
tests/wasm/private_caller.wasmView
@@ -1,2 +1,2 @@
1-asm types`` typeMap```4func internalizefunc externalizetestcheckpmemorytablecall A 
1+asm types`n typeMap```4func internalizefunc externalizetestcheckpmemorytablecall A 
22 AA A  A
typeCheckWrapper.jsView
@@ -1,17 +1,5 @@
1-const LANGUAGE_TYPES = {
2- 'mod': 0x0,
3- 'buf': 0x1,
4- 'elem': 0x2,
5- 'link': 0x3,
6- 'i32': 0x7f,
7- 'i64': 0x7e,
8- 'f32': 0x7d,
9- 'f64': 0x7c,
10- 'anyFunc': 0x70,
11- 'func': 0x60,
12- 'block_type': 0x40
13-}
1+const {LANGUAGE_TYPES_STRG} = require('primea-annotations')
142
153 module.exports = function (params) {
164 const module = [{
175 'name': 'preramble',
@@ -112,9 +100,9 @@
112100 const invokeCode = module[7].entries[1].code
113101
114102 params.forEach((param, index) => {
115103 let baseType = param
116- const typeCode = LANGUAGE_TYPES[param]
104+ const typeCode = LANGUAGE_TYPES_STRG[param]
117105 // import type
118106 if (definedTypes.has(param)) {
119107 baseType = 'i32'
120108 } else {
wasmContainer.jsView
@@ -2,28 +2,13 @@
22 const annotations = require('primea-annotations')
33 const wasmMetering = require('wasm-metering')
44 const ReferanceMap = require('reference-map')
55 const Message = require('./message.js')
6-// const customTypes = require('./customTypes.js')
76 const injectGlobals = require('./injectGlobals.js')
87 const typeCheckWrapper = require('./typeCheckWrapper.js')
98 const {FunctionRef, ModuleRef, DEFAULTS} = require('./systemObjects.js')
109
1110 const nativeTypes = new Set(['i32', 'i64', 'f32', 'f64'])
12-const LANGUAGE_TYPES = {
13- 0x0: 'actor',
14- 0x1: 'data',
15- 0x02: 'elem',
16- 0x03: 'link',
17- 0x04: 'id',
18- 0x7f: 'i32',
19- 0x7e: 'i64',
20- 0x7d: 'f32',
21- 0x7c: 'f64',
22- 0x70: 'anyFunc',
23- 0x60: 'func',
24- 0x40: 'block_type'
25-}
2611 const FUNC_INDEX_OFFSET = 1
2712
2813 function generateWrapper (funcRef, container) {
2914 let wrapper = typeCheckWrapper(funcRef.params)
@@ -35,9 +20,9 @@
3520 'checkTypes': function () {
3621 const args = [...arguments]
3722 const checkedArgs = []
3823 while (args.length) {
39- const type = LANGUAGE_TYPES[args.shift()]
24+ const type = annotations.LANGUAGE_TYPES_BIN[args.shift()]
4025 let arg = args.shift()
4126 if (!nativeTypes.has(type)) {
4227 arg = container.refs.get(arg, type)
4328 }

Built with git-ssb-web