Commit 2275e7c92d36229646a81cd7ee76f25234fc2a87
move private flag to the identitier
wanderer committed on 3/21/2018, 11:58:02 PMParent: b9423af2cd45a86722df9ab973b4db265a8fcaa3
Files changed
systemObjects.js | changed |
wasmContainer.js | changed |
systemObjects.js | ||
---|---|---|
@@ -38,9 +38,8 @@ | ||
38 | 38 | |
39 | 39 | class FunctionRef extends Serializable { |
40 | 40 | constructor (opts) { |
41 | 41 | super() |
42 | - this.private = opts.private | |
43 | 42 | this.identifier = opts.identifier |
44 | 43 | if (!(opts.id instanceof ID)) { |
45 | 44 | opts.id = new ID(opts.id) |
46 | 45 | } |
@@ -50,9 +49,8 @@ | ||
50 | 49 | } |
51 | 50 | |
52 | 51 | encodeCBOR (gen) { |
53 | 52 | return gen.write(new cbor.Tagged(TAGS.func, [ |
54 | - this.private, | |
55 | 53 | this.identifier, |
56 | 54 | this.params, |
57 | 55 | this.destId |
58 | 56 | ])) |
@@ -71,10 +69,9 @@ | ||
71 | 69 | } |
72 | 70 | |
73 | 71 | getFuncRef (name) { |
74 | 72 | return new FunctionRef({ |
75 | - private: false, | |
76 | - identifier: name, | |
73 | + identifier: [false, name], | |
77 | 74 | params: this.exports[name], |
78 | 75 | id: this.id |
79 | 76 | }) |
80 | 77 | } |
wasmContainer.js | ||
---|---|---|
@@ -89,10 +89,9 @@ | ||
89 | 89 | return self.refs.add(object) |
90 | 90 | } else { |
91 | 91 | const params = self.json.types[self.json.indexes[func.name - FUNC_INDEX_OFFSET]].params |
92 | 92 | const ref = new FunctionRef({ |
93 | - private: true, | |
94 | - identifier: func.tableIndex, | |
93 | + identifier: [true, func.tableIndex], | |
95 | 94 | params, |
96 | 95 | id: self.actor.id |
97 | 96 | }) |
98 | 97 | return self.refs.add(ref, 'func') |
@@ -231,12 +230,12 @@ | ||
231 | 230 | this.instance.exports.setter_globals(...refs) |
232 | 231 | } |
233 | 232 | |
234 | 233 | // call entrypoint function |
235 | - if (funcRef.private) { | |
236 | - this.instance.exports.table.get(funcRef.identifier)(...args) | |
234 | + if (funcRef.identifier[0]) { | |
235 | + this.instance.exports.table.get(funcRef.identifier[1])(...args) | |
237 | 236 | } else { |
238 | - this.instance.exports[funcRef.identifier](...args) | |
237 | + this.instance.exports[funcRef.identifier[1]](...args) | |
239 | 238 | } |
240 | 239 | await this.onDone() |
241 | 240 | |
242 | 241 | // store globals |
Built with git-ssb-web