Skip to content
This repository was archived by the owner on Jan 5, 2019. It is now read-only.

Commit 03af844

Browse files
committed
Support STATICCALL
1 parent 6264c6c commit 03af844

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

opcodes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ const codes = {
147147
0xf2: ['CALLCODE', 0, 7, 1],
148148
0xf3: ['RETURN', 0, 2, 0],
149149
0xf4: ['DELEGATECALL', 0, 6, 1],
150+
0xfa: ['STATICCALL', 0, 6, 1],
150151

151152
// '0x70', range - other
152153
0xff: ['SELFDESTRUCT', 0, 1, 0]

wasm/generateInterface.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ const interfaceManifest = {
137137
input: ['i64', 'address', 'readOffset', 'length'],
138138
output: ['i32']
139139
},
140+
STATICCALL: {
141+
name: 'callStatic',
142+
async: true,
143+
input: ['i64', 'address', 'i128', 'readOffset', 'length'],
144+
output: ['i32']
145+
},
140146
SSTORE: {
141147
name: 'storageStore',
142148
async: true,
@@ -265,7 +271,7 @@ function generateManifest (interfaceManifest, opts) {
265271
(i64.load (i32.add (get_global $sp) (i32.const ${spOffset * 32 + 8 * 2})))
266272
(i64.load (i32.add (get_global $sp) (i32.const ${spOffset * 32 + 8 * 3})))))`
267273
call += `(get_local $offset${numOfLocals})`
268-
} else if (input === 'length' && (opcode === 'CALL' || opcode === 'CALLCODE' || opcode === 'DELEGATECALL')) {
274+
} else if (input === 'length' && (opcode === 'CALL' || opcode === 'CALLCODE' || opcode === 'DELEGATECALL' || opcode === 'STATICCALL')) {
269275
// CALLs in EVM have 7 arguments
270276
// but in ewasm CALLs only have 5 arguments
271277
// so delete the bottom two stack elements, after processing the 5th argument
@@ -365,7 +371,7 @@ function generateManifest (interfaceManifest, opts) {
365371
call += '(get_local $callback)'
366372
}
367373

368-
if (opcode === 'CALL' || opcode === 'CALLCODE' || opcode === 'DELEGATECALL') {
374+
if (opcode === 'CALL' || opcode === 'CALLCODE' || opcode === 'DELEGATECALL' || opcode === 'STATICCALL') {
369375
call =
370376
`(i64.store
371377
(i32.add (get_global $sp) (i32.const ${spOffset * 32}))

0 commit comments

Comments
 (0)