git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 35dfa5477c5c02ad53d5eef194860e48f9677897

fixed memory exports

wanderer committed on 12/28/2016, 7:37:18 PM
Parent: 276e1f2ef76f665728f308c95464327233c1ba98

Files changed

tests/interface/basic_gas_ops.wasmchanged
tests/interface/basic_gas_ops.wastchanged
tests/interface/call.wasmchanged
tests/interface/call.wastchanged
tests/interface/callDataSize.wasmchanged
tests/interface/callDataSize.wastchanged
tests/interface/callValue.wasmchanged
tests/interface/callValue.wastchanged
tests/interface/caller.wasmchanged
tests/interface/caller.wastchanged
tests/interface/coinbase.wasmchanged
tests/interface/coinbase.wastchanged
tests/interface/origin.wasmchanged
tests/interface/origin.wastchanged
tests/interface/sstore.wasmchanged
tests/interface/sstore.wastchanged
tests/interfaceRunner.jschanged
vm.jschanged
tests/interface/basic_gas_ops.wasmView
@@ -1,3 +1,3 @@
1-asm  ```)ethereumuseGasethereum
1+asm  `~`~`)ethereumuseGasethereum
22 getGasLefttest
3-(&@AA�F@ @AA�F@
3+(&@BB�Q@ @BB�Q@
tests/interface/basic_gas_ops.wastView
@@ -1,22 +1,22 @@
11 ;; starts with 1000 gas
22 (module
3- (import "ethereum" "useGas" (func $useGas (param i32)))
4- (import "ethereum" "getGasLeft" (func $gas(result i32)))
3+ (import "ethereum" "useGas" (func $useGas (param i64)))
4+ (import "ethereum" "getGasLeft" (func $gas (result i64)))
55
66 (export "test" (func $main))
77 (func $main
88 ;; test adding gas
99 (block
10- (call $useGas (i32.const 1))
11- (if (i32.eq (call $gas) (i32.const 997))
10+ (call $useGas (i64.const 1))
11+ (if (i64.eq (call $gas) (i64.const 997))
1212 (return)
1313 )
1414 (unreachable)
1515 )
1616 (block
17- (call $useGas (i32.const 1))
18- (if (i32.eq (call $gas) (i32.const 996))
17+ (call $useGas (i64.const 1))
18+ (if (i64.eq (call $gas) (i64.const 996))
1919 (return)
2020 )
2121 (unreachable)
2222 )
tests/interface/call.wasmView
@@ -1,2 +1,2 @@
1-asm ```ethereumcallamain1
2-:+@AA6A4A����6A�AAA4AA8AA A F@
1+asm `~``ethereumcallmemorymain1
2+:+@AA6A4A����6B�AAA4AA8AA A F@
tests/interface/call.wastView
@@ -1,9 +1,9 @@
11 ;; starts with an address of 5d48c1018904a172886829bbbd9c6f4a2d06c47b
22 (module
3- (import "ethereum" "call" (func $call (param i32 i32 i32 i32 i32 i32 i32 i32) (result i32)))
3+ (import "ethereum" "call" (func $call (param i64 i32 i32 i32 i32 i32 i32 i32) (result i32)))
44 (memory 1)
5- (export "a" (memory 0))
5+ (export "memory" (memory 0))
66 (export "main" (func $main))
77 (func $main
88 (block
99 ;; Memory layout:
@@ -12,9 +12,9 @@
1212 ;; 52 - 56 bytes: data (0x42004200)
1313 ;; 56 - 60 bytes: result
1414 (i32.store (i32.const 0) (i32.const 0x4))
1515 (i32.store (i32.const 52) (i32.const 0x42004200))
16- (call $call (i32.const 2000) (i32.const 0) (i32.const 20) (i32.const 52) (i32.const 4) (i32.const 56) (i32.const 4) (i32.const 1))
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))
1717 drop
1818 )
1919 )
2020
tests/interface/callDataSize.wasmView
@@ -1,2 +1,2 @@
1-asm `~`ethereumgetCallDataSizemain
2-@B�Q@
1+asm ``ethereumgetCallDataSizemain
2+@A�F@
tests/interface/callDataSize.wastView
@@ -1,11 +1,11 @@
11 (module
2- (import"ethereum" "getCallDataSize" (func $callDataSize (result i64)))
2+ (import"ethereum" "getCallDataSize" (func $callDataSize (result i32)))
33 (memory 1)
44 (export "main" (func $main))
55 (func $main
66 (block
7- (if (i64.eq (call $callDataSize) (i64.const 277))
7+ (if (i32.eq (call $callDataSize) (i32.const 277))
88 (return)
99 )
1010 (unreachable)
1111 )
tests/interface/callValue.wasmView
@@ -1,2 +1,2 @@
1-asm ``ethereum getCallValue amain
1+asm ``ethereum getCallValuememorymain
22 @AA)B��������Q@
tests/interface/callValue.wastView
@@ -1,9 +1,9 @@
11 ;; call value of 0x056bc75e2d63100000 (100 ETH)
22 (module
33 (import "ethereum" "getCallValue" (func $callValue (param i32)))
44 (memory 1)
5- (export "a" (memory 0))
5+ (export "memory" (memory 0))
66 (export "main" (func $main))
77 (func $main
88 (block
99 (call $callValue (i32.const 0))
tests/interface/caller.wasmView
@@ -1,2 +1,2 @@
1-asm ``ethereum getCaller maina
1+asm ``ethereum getCallermainmemory
22 !@AA)Bݐ�������Q@
tests/interface/caller.wastView
@@ -2,9 +2,9 @@
22 (module
33 (import "ethereum" "getCaller" (func $caller (param i32)))
44 (memory 1)
55 (export "main" (func $main))
6- (export "a" (memory 0))
6+ (export "memory" (memory 0))
77 (func $main
88 (block
99 ;; loads the caller into memory
1010 (call $caller (i32.const 0))
tests/interface/coinbase.wasmView
@@ -1,2 +1,2 @@
1-asm ``ethereumgetBlockCoinbase maina
1+asm ``ethereumgetBlockCoinbasemainmemory
22 !@AA)Bݐ�������Q@
tests/interface/coinbase.wastView
@@ -2,9 +2,9 @@
22 (module
33 (import "ethereum" "getBlockCoinbase" (func $coinbase (param i32)))
44 (memory 1)
55 (export "main" (func $main))
6- (export "a" (memory 0))
6+ (export "memory" (memory 0))
77 (func $main
88 (block
99 ;; loads the coinbase into memory
1010 (call $coinbase (i32.const 0))
tests/interface/origin.wasmView
@@ -1,2 +1,2 @@
1-asm ``ethereum getTxOrigin maina
1+asm ``ethereum getTxOriginmainmemory
22 !@AA)Bݐ�������Q@
tests/interface/origin.wastView
@@ -3,9 +3,9 @@
33 (import "ethereum" "getTxOrigin" (func $origin (param i32)))
44 (memory 1)
55
66 (export "main" (func $main))
7- (export "a" (memory 0))
7+ (export "memory" (memory 0))
88 (func $main
99 (block
1010 ;; loads the address into memory
1111 (call $origin (i32.const 0))
tests/interface/sstore.wasmView
@@ -1,3 +1,3 @@
11 asm 
2-``0ethereum storageStoreethereum storageLoadmaina12
2+``0ethereum storageStoreethereum storageLoadmainmemory12
33 L~@AB���݄ƥ�7A�AA @A�A�A @A�)B���݄ƥ�R@
tests/interface/sstore.wastView
@@ -4,9 +4,9 @@
44 (import "ethereum" "storageLoad" (func $sload (param i32 i32 i32)))
55
66 (memory 1)
77 (export "main" (func $main))
8- (export "a" (memory 0))
8+ (export "memory" (memory 0))
99 (func $main
1010 (local $temp i64)
1111 (block
1212 ;; should roundtrip store and load a value from storage
tests/interfaceRunner.jsView
@@ -10,18 +10,17 @@
1010
1111 const dir = path.join(__dirname, '/interface')
1212 // get the test names
1313 let tests = fs.readdirSync(dir).filter((file) => file.endsWith('.wast'))
14-// tests = ['callDataCopy.wast']
14+// tests = ['callDataSize.wast']
1515
1616 runTests(tests)
1717
1818 function runTests (tests) {
1919 for (let testName of tests) {
2020 testName = testName.split('.')[0]
2121 tape(testName, async (t) => {
2222 // Compile Command
23-
2423 const rootVertex = new Vertex()
2524 const code = fs.readFileSync(`${dir}/${testName}.wasm`)
2625 const envData = JSON.parse(fs.readFileSync(`${dir}/${testName}.json`).toString())
2726
vm.jsView
@@ -49,7 +49,7 @@
4949 return this._environment
5050 }
5151
5252 get memory () {
53- return this._instance.exports.memory
53+ return this._instance.exports.memory.buffer
5454 }
5555 }

Built with git-ssb-web