Commit f8edd54b6f0aad9dea31187b70342bb2abee2659
fix internalize
Signed-off-by: wanderer <mjbecze@gmail.com>wanderer committed on 4/5/2018, 1:16:16 AM
Parent: 20210278852d79f3494721ea3f9eb36c5a93a767
Files changed
index.js | changed |
tests/index.js | changed |
tests/wasm/link.wasm | changed |
tests/wasm/memory.wasm | changed |
tests/wasm/storage.wasm | changed |
tests/wasm/table.wasm | changed |
tests/wast/link.wast | changed |
tests/wast/memory.wast | changed |
tests/wast/storage.wast | changed |
tests/wast/table.wast | changed |
index.js | ||
---|---|---|
@@ -162,9 +162,9 @@ | ||
162 | 162 | externalize: (index, length) => { |
163 | 163 | const data = Buffer.from(this.get8Memory(index, length)) |
164 | 164 | return self.refs.add(data, 'data') |
165 | 165 | }, |
166 | - internalize: (dataRef, srcOffset, sinkOffset, length) => { | |
166 | + internalize: (sinkOffset, length, dataRef, srcOffset) => { | |
167 | 167 | let data = self.refs.get(dataRef, 'data') |
168 | 168 | data = data.subarray(srcOffset, length) |
169 | 169 | const mem = self.get8Memory(sinkOffset, data.length) |
170 | 170 | mem.set(data) |
@@ -184,9 +184,9 @@ | ||
184 | 184 | objects.unshift(obj) |
185 | 185 | } |
186 | 186 | return this.refs.add(objects, 'elem') |
187 | 187 | }, |
188 | - internalize: (elemRef, srcOffset, sinkOffset, length) => { | |
188 | + internalize: (sinkOffset, length, elemRef, srcOffset) => { | |
189 | 189 | let table = self.refs.get(elemRef, 'elem') |
190 | 190 | const buf = table.slice(srcOffset, srcOffset + length).map(obj => self.refs.add(obj, getType(obj))) |
191 | 191 | const mem = self.get32Memory(sinkOffset, length) |
192 | 192 | mem.set(buf) |
tests/index.js | ||
---|---|---|
@@ -392,9 +392,8 @@ | ||
392 | 392 | } |
393 | 393 | }) |
394 | 394 | |
395 | 395 | tape('out of gas', async t => { |
396 | - t.plan(1) | |
397 | 396 | tester = t |
398 | 397 | const tree = new RadixTree({db}) |
399 | 398 | let wasm = fs.readFileSync(WASM_PATH + '/i64.wasm') |
400 | 399 | |
@@ -406,8 +405,8 @@ | ||
406 | 405 | |
407 | 406 | const message = new Message({ |
408 | 407 | funcRef |
409 | 408 | }).on('execution:error', e => { |
410 | - t.pass() | |
409 | + t.end() | |
411 | 410 | }) |
412 | 411 | hypervisor.send(message) |
413 | 412 | }) |
tests/wasm/link.wasm | ||
---|---|---|
@@ -1,3 +1,3 @@ | ||
1 | 1 | asm types`n typeMap #` ` `` ` `` �testcheck testprint memoryexternalize storageget storageset elemexternalize eleminternalize elemlength funcinternalize linkwrap linkunwrap p A memory table main load A |
2 | -E A A A 6 A A $ A A A ( A | |
2 | +E A A A 6 A A $ A A A ( A | |
3 | 3 | A # A A hello world |