diff options
author | Meng-Ying Yang <garfield@dexon.org> | 2019-03-05 16:34:05 +0800 |
---|---|---|
committer | Meng-Ying Yang <garfield@dexon.org> | 2019-04-03 17:05:28 +0800 |
commit | 92a883cbd3b6e93ee8602a50ecf139d9face1fe4 (patch) | |
tree | 66eee398a90ac7b3001a2b28ed6ec047077b93a9 /core | |
parent | adf0afa9c4a81086f927614d219c722417fcc23c (diff) | |
download | dexon-92a883cbd3b6e93ee8602a50ecf139d9face1fe4.tar dexon-92a883cbd3b6e93ee8602a50ecf139d9face1fe4.tar.gz dexon-92a883cbd3b6e93ee8602a50ecf139d9face1fe4.tar.bz2 dexon-92a883cbd3b6e93ee8602a50ecf139d9face1fe4.tar.lz dexon-92a883cbd3b6e93ee8602a50ecf139d9face1fe4.tar.xz dexon-92a883cbd3b6e93ee8602a50ecf139d9face1fe4.tar.zst dexon-92a883cbd3b6e93ee8602a50ecf139d9face1fe4.zip |
core: vm: sqlvm: add jump table
Diffstat (limited to 'core')
-rw-r--r-- | core/vm/sqlvm/runtime/jumptable.go | 26 | ||||
-rw-r--r-- | core/vm/sqlvm/runtime/runtime.go | 4 |
2 files changed, 27 insertions, 3 deletions
diff --git a/core/vm/sqlvm/runtime/jumptable.go b/core/vm/sqlvm/runtime/jumptable.go index 5ce6d9a8a..415a4e62b 100644 --- a/core/vm/sqlvm/runtime/jumptable.go +++ b/core/vm/sqlvm/runtime/jumptable.go @@ -1,6 +1,32 @@ package runtime var jumpTable = [256]OpFunction{ + // 0x10 + ADD: opAdd, + MUL: opMul, + SUB: opSub, + DIV: opDiv, + MOD: opMod, + + // 0x20 + LT: opLt, + GT: opGt, + EQ: opEq, + AND: opAnd, + OR: opOr, + NOT: opNot, + UNION: opUnion, + INTXN: opIntxn, + LIKE: opLike, + + // 0x40 + ZIP: opZip, + FIELD: opField, + PRUNE: opPrune, + SORT: opSort, + FILTER: opFilter, + CAST: opCast, + // 0x60 LOAD: opLoad, } diff --git a/core/vm/sqlvm/runtime/runtime.go b/core/vm/sqlvm/runtime/runtime.go index 5cae111c9..3b6d49a72 100644 --- a/core/vm/sqlvm/runtime/runtime.go +++ b/core/vm/sqlvm/runtime/runtime.go @@ -14,9 +14,7 @@ func Run(stateDB vm.StateDB, ins []Instruction, registers []*Operand) (ret []byt in.Input[i] = registers[in.Input[i].RegisterIndex] } } - opFunc := jumpTable[in.Op] - loadRegister(in.Input, registers) - errCode := opFunc(&common.Context{}, in.Input, registers, in.Output) + errCode := jumpTable[in.Op](&common.Context{}, in.Input, registers, in.Output) if errCode != nil { err = se.Error{ Position: in.Position, |