git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 05c4e2d027ee79f709d87c92e48f83e9cb3489ad

Merge branch 'master' into env

wanderer committed on 1/20/2017, 5:40:25 PM
Parent: ccc86c04a14c0346d7695e768be928faf4c41267
Parent: de87b9b68f0638e5deda64385e6c49c506325b8e

Files changed

package.jsonchanged
tests/interface/balance.wasmchanged
tests/interface/balance.wastchanged
tests/interface/call.wasmchanged
tests/interface/call.wastchanged
tests/interface/sstore.wasmchanged
tests/interface/sstore.wastchanged
vm.jschanged
package.jsonView
@@ -37,9 +37,9 @@
3737 ]
3838 },
3939 "dependencies": {
4040 "bn.js": "^4.11.6",
41- "ethereumjs-block": "^1.2.2",
41+ "ethereumjs-block": "^1.4.1",
4242 "ethereumjs-tx": "^1.1.2",
4343 "ethereumjs-util": "^5.0.0",
4444 "merkle-trie": "0.1.2",
4545 "promise-queue": "^2.2.3"
tests/interface/balance.wasmView
@@ -1,5 +1,5 @@
11 asm 
22 ``ethereum
3-getBalancememorymain1
3+getBalancepmemorymaincallback A 
44 '
5-AAA @A)B��������Q@ A ]H���r�h)���oJ-�{
5+AAA @A)B��������Q@ A ]H���r�h)���oJ-�{
tests/interface/balance.wastView
@@ -4,12 +4,19 @@
44 (memory 1 )
55 (data (i32.const 0) "\5d\48\c1\01\89\04\a1\72\88\68\29\bb\bd\9c\6f\4a\2d\06\c4\7b")
66 (export "memory" (memory 0))
77 (export "main" (func $main))
8- (export "1" (func $callback))
98
9+ (table
10+ (export "callback")
11+ anyfunc
12+ (elem
13+ $callback
14+ )
15+ )
16+
1017 (func $main
11- (call $balance (i32.const 0) (i32.const 0) (i32.const 1))
18+ (call $balance (i32.const 0) (i32.const 0) (i32.const 0))
1219 )
1320
1421 (func $callback
1522 (block
tests/interface/call.wasmView
@@ -1,2 +1,2 @@
1-asm `~``ethereumcallmemorymain1
2-:+@AA6A4A����6B�AAA4AA8AA A F@
1+asm `~``ethereumcallpmemorymaincallback A 
2+:+@AA6A4A����6B�AAA4AA8AA A F@
tests/interface/call.wastView
@@ -3,8 +3,17 @@
33 (import "ethereum" "call" (func $call (param i64 i32 i32 i32 i32 i32 i32 i32) (result i32)))
44 (memory 1)
55 (export "memory" (memory 0))
66 (export "main" (func $main))
7+
8+ (table
9+ (export "callback")
10+ anyfunc
11+ (elem
12+ $callback
13+ )
14+ )
15+
716 (func $main
817 (block
918 ;; Memory layout:
1019 ;; 0 - 20 bytes: address (4)
@@ -12,14 +21,13 @@
1221 ;; 52 - 56 bytes: data (0x42004200)
1322 ;; 56 - 60 bytes: result
1423 (i32.store (i32.const 0) (i32.const 0x4))
1524 (i32.store (i32.const 52) (i32.const 0x42004200))
16- (call $call (i64.const 2000) (i32.const 0) (i32.const 20) (i32.const 52) (i32.const 4) (i32.const 56) (i32.const 4) (i32.const 1))
25+ (call $call (i64.const 2000) (i32.const 0) (i32.const 20) (i32.const 52) (i32.const 4) (i32.const 56) (i32.const 4) (i32.const 0))
1726 drop
1827 )
1928 )
2029
21- (export "1" (func $callback))
2230 (func $callback (param $result i32)
2331 (if (i32.eq (i32.const 1) (get_local $result))
2432 (return)
2533 )
tests/interface/sstore.wasmView
@@ -1,3 +1,3 @@
11 asm 
2-``0ethereum storageStoreethereum storageLoadmainmemory12
3-L~@AB���݄ƥ�7A�AA @A�A�A @A�)B���݄ƥ�R@
2+``0ethereum storageStoreethereum storageLoadpmemorycallbackmain A 
3+L~@AB���݄ƥ�7A�AA @A�A�A @A�)B���݄ƥ�R@
tests/interface/sstore.wastView
@@ -3,27 +3,35 @@
33 (import "ethereum" "storageStore" (func $sstore (param i32 i32 i32)))
44 (import "ethereum" "storageLoad" (func $sload (param i32 i32 i32)))
55
66 (memory 1)
7- (export "main" (func $main))
87 (export "memory" (memory 0))
8+
9+ (table
10+ (export "callback")
11+ anyfunc
12+ (elem
13+ $callback
14+ $callback2
15+ )
16+ )
17+
918 (func $main
19+ (export "main")
1020 (local $temp i64)
1121 (block
1222 ;; should roundtrip store and load a value from storage
1323 (i64.store (i32.const 0) (i64.const 173553719826446289))
14- (call $sstore (i32.const 64) (i32.const 0) (i32.const 1))
24+ (call $sstore (i32.const 64) (i32.const 0) (i32.const 0))
1525 )
1626 )
1727
18- (export "1" (func $callback))
1928 (func $callback
2029 (block
21- (call $sload (i32.const 64) (i32.const 64) (i32.const 2))
30+ (call $sload (i32.const 64) (i32.const 64) (i32.const 1))
2231 )
2332 )
2433
25- (export "2" (func $callback2))
2634 (func $callback2
2735 (block
2836 (if (i64.ne (i64.load (i32.const 64)) (i64.const 173553719826446289))
2937 (unreachable))
vm.jsView
@@ -33,9 +33,9 @@
3333 */
3434 pushOpsQueue: (promise, callbackIndex, intefaceCallback) => {
3535 this._opsQueue = Promise.all([this._opsQueue, promise]).then(values => {
3636 const result = intefaceCallback(values.pop())
37- instance.exports[callbackIndex.toString()](result)
37+ instance.exports.callback.get(callbackIndex)(result)
3838 })
3939 },
4040 memory: () => {
4141 return instance.exports.memory.buffer

Built with git-ssb-web