github.com/digdeepmining/go-atheios@v1.5.13-0.20180902133602-d5687a2e6f43/core/vm/jump_table.go (about)

     1  // Copyright 2015 The go-ethereum Authors
     2  // This file is part of the go-ethereum library.
     3  //
     4  // The go-ethereum library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The go-ethereum library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  package vm
    18  
    19  import (
    20  	"math/big"
    21  
    22  	"github.com/atheioschain/go-atheios/params"
    23  )
    24  
    25  type (
    26  	executionFunc       func(pc *uint64, env *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error)
    27  	gasFunc             func(params.GasTable, *EVM, *Contract, *Stack, *Memory, *big.Int) *big.Int
    28  	stackValidationFunc func(*Stack) error
    29  	memorySizeFunc      func(*Stack) *big.Int
    30  )
    31  
    32  type operation struct {
    33  	// op is the operation function
    34  	execute executionFunc
    35  	// gasCost is the gas function and returns the gas required for execution
    36  	gasCost gasFunc
    37  	// validateStack validates the stack (size) for the operation
    38  	validateStack stackValidationFunc
    39  	// memorySize returns the memory size required for the operation
    40  	memorySize memorySizeFunc
    41  	// halts indicates whether the operation shoult halt further execution
    42  	// and return
    43  	halts bool
    44  	// jumps indicates whether operation made a jump. This prevents the program
    45  	// counter from further incrementing.
    46  	jumps bool
    47  	// valid is used to check whether the retrieved operation is valid and known
    48  	valid bool
    49  }
    50  
    51  var defaultJumpTable = NewJumpTable()
    52  
    53  func NewJumpTable() [256]operation {
    54  	return [256]operation{
    55  		STOP: {
    56  			execute:       opStop,
    57  			gasCost:       constGasFunc(new(big.Int)),
    58  			validateStack: makeStackFunc(0, 0),
    59  			halts:         true,
    60  			valid:         true,
    61  		},
    62  		ADD: {
    63  			execute:       opAdd,
    64  			gasCost:       constGasFunc(GasFastestStep),
    65  			validateStack: makeStackFunc(2, -1),
    66  			valid:         true,
    67  		},
    68  		MUL: {
    69  			execute:       opMul,
    70  			gasCost:       constGasFunc(GasFastStep),
    71  			validateStack: makeStackFunc(2, -1),
    72  			valid:         true,
    73  		},
    74  		SUB: {
    75  			execute:       opSub,
    76  			gasCost:       constGasFunc(GasFastestStep),
    77  			validateStack: makeStackFunc(2, -1),
    78  			valid:         true,
    79  		},
    80  		DIV: {
    81  			execute:       opDiv,
    82  			gasCost:       constGasFunc(GasFastStep),
    83  			validateStack: makeStackFunc(2, -1),
    84  			valid:         true,
    85  		},
    86  		SDIV: {
    87  			execute:       opSdiv,
    88  			gasCost:       constGasFunc(GasFastStep),
    89  			validateStack: makeStackFunc(2, -1),
    90  			valid:         true,
    91  		},
    92  		MOD: {
    93  			execute:       opMod,
    94  			gasCost:       constGasFunc(GasFastStep),
    95  			validateStack: makeStackFunc(2, -1),
    96  			valid:         true,
    97  		},
    98  		SMOD: {
    99  			execute:       opSmod,
   100  			gasCost:       constGasFunc(GasFastStep),
   101  			validateStack: makeStackFunc(2, -1),
   102  			valid:         true,
   103  		},
   104  		ADDMOD: {
   105  			execute:       opAddmod,
   106  			gasCost:       constGasFunc(GasMidStep),
   107  			validateStack: makeStackFunc(3, -2),
   108  			valid:         true,
   109  		},
   110  		MULMOD: {
   111  			execute:       opMulmod,
   112  			gasCost:       constGasFunc(GasMidStep),
   113  			validateStack: makeStackFunc(3, -2),
   114  			valid:         true,
   115  		},
   116  		EXP: {
   117  			execute:       opExp,
   118  			gasCost:       gasExp,
   119  			validateStack: makeStackFunc(2, -1),
   120  			valid:         true,
   121  		},
   122  		SIGNEXTEND: {
   123  			execute:       opSignExtend,
   124  			gasCost:       constGasFunc(GasFastStep),
   125  			validateStack: makeStackFunc(2, -1),
   126  			valid:         true,
   127  		},
   128  		LT: {
   129  			execute:       opLt,
   130  			gasCost:       constGasFunc(GasFastestStep),
   131  			validateStack: makeStackFunc(2, -1),
   132  			valid:         true,
   133  		},
   134  		GT: {
   135  			execute:       opGt,
   136  			gasCost:       constGasFunc(GasFastestStep),
   137  			validateStack: makeStackFunc(2, -1),
   138  			valid:         true,
   139  		},
   140  		SLT: {
   141  			execute:       opSlt,
   142  			gasCost:       constGasFunc(GasFastestStep),
   143  			validateStack: makeStackFunc(2, -1),
   144  			valid:         true,
   145  		},
   146  		SGT: {
   147  			execute:       opSgt,
   148  			gasCost:       constGasFunc(GasFastestStep),
   149  			validateStack: makeStackFunc(2, -1),
   150  			valid:         true,
   151  		},
   152  		EQ: {
   153  			execute:       opEq,
   154  			gasCost:       constGasFunc(GasFastestStep),
   155  			validateStack: makeStackFunc(2, -1),
   156  			valid:         true,
   157  		},
   158  		ISZERO: {
   159  			execute:       opIszero,
   160  			gasCost:       constGasFunc(GasFastestStep),
   161  			validateStack: makeStackFunc(1, 0),
   162  			valid:         true,
   163  		},
   164  		AND: {
   165  			execute:       opAnd,
   166  			gasCost:       constGasFunc(GasFastestStep),
   167  			validateStack: makeStackFunc(2, -1),
   168  			valid:         true,
   169  		},
   170  		XOR: {
   171  			execute:       opXor,
   172  			gasCost:       constGasFunc(GasFastestStep),
   173  			validateStack: makeStackFunc(2, -1),
   174  			valid:         true,
   175  		},
   176  		OR: {
   177  			execute:       opOr,
   178  			gasCost:       constGasFunc(GasFastestStep),
   179  			validateStack: makeStackFunc(2, -1),
   180  			valid:         true,
   181  		},
   182  		NOT: {
   183  			execute:       opNot,
   184  			gasCost:       constGasFunc(GasFastestStep),
   185  			validateStack: makeStackFunc(1, 0),
   186  			valid:         true,
   187  		},
   188  		BYTE: {
   189  			execute:       opByte,
   190  			gasCost:       constGasFunc(GasFastestStep),
   191  			validateStack: makeStackFunc(2, -1),
   192  			valid:         true,
   193  		},
   194  		SHA3: {
   195  			execute:       opSha3,
   196  			gasCost:       gasSha3,
   197  			validateStack: makeStackFunc(2, -1),
   198  			memorySize:    memorySha3,
   199  			valid:         true,
   200  		},
   201  		ADDRESS: {
   202  			execute:       opAddress,
   203  			gasCost:       constGasFunc(GasQuickStep),
   204  			validateStack: makeStackFunc(0, 1),
   205  			valid:         true,
   206  		},
   207  		BALANCE: {
   208  			execute:       opBalance,
   209  			gasCost:       gasBalance,
   210  			validateStack: makeStackFunc(1, 0),
   211  			valid:         true,
   212  		},
   213  		ORIGIN: {
   214  			execute:       opOrigin,
   215  			gasCost:       constGasFunc(GasQuickStep),
   216  			validateStack: makeStackFunc(0, 1),
   217  			valid:         true,
   218  		},
   219  		CALLER: {
   220  			execute:       opCaller,
   221  			gasCost:       constGasFunc(GasQuickStep),
   222  			validateStack: makeStackFunc(0, 1),
   223  			valid:         true,
   224  		},
   225  		CALLVALUE: {
   226  			execute:       opCallValue,
   227  			gasCost:       constGasFunc(GasQuickStep),
   228  			validateStack: makeStackFunc(0, 1),
   229  			valid:         true,
   230  		},
   231  		CALLDATALOAD: {
   232  			execute:       opCalldataLoad,
   233  			gasCost:       constGasFunc(GasFastestStep),
   234  			validateStack: makeStackFunc(1, 0),
   235  			valid:         true,
   236  		},
   237  		CALLDATASIZE: {
   238  			execute:       opCalldataSize,
   239  			gasCost:       constGasFunc(GasQuickStep),
   240  			validateStack: makeStackFunc(0, 1),
   241  			valid:         true,
   242  		},
   243  		CALLDATACOPY: {
   244  			execute:       opCalldataCopy,
   245  			gasCost:       gasCalldataCopy,
   246  			validateStack: makeStackFunc(3, -3),
   247  			memorySize:    memoryCalldataCopy,
   248  			valid:         true,
   249  		},
   250  		CODESIZE: {
   251  			execute:       opCodeSize,
   252  			gasCost:       constGasFunc(GasQuickStep),
   253  			validateStack: makeStackFunc(0, 1),
   254  			valid:         true,
   255  		},
   256  		CODECOPY: {
   257  			execute:       opCodeCopy,
   258  			gasCost:       gasCodeCopy,
   259  			validateStack: makeStackFunc(3, -3),
   260  			memorySize:    memoryCodeCopy,
   261  			valid:         true,
   262  		},
   263  		GASPRICE: {
   264  			execute:       opGasprice,
   265  			gasCost:       constGasFunc(GasQuickStep),
   266  			validateStack: makeStackFunc(0, 1),
   267  			valid:         true,
   268  		},
   269  		EXTCODESIZE: {
   270  			execute:       opExtCodeSize,
   271  			gasCost:       gasExtCodeSize,
   272  			validateStack: makeStackFunc(1, 0),
   273  			valid:         true,
   274  		},
   275  		EXTCODECOPY: {
   276  			execute:       opExtCodeCopy,
   277  			gasCost:       gasExtCodeCopy,
   278  			validateStack: makeStackFunc(4, -4),
   279  			memorySize:    memoryExtCodeCopy,
   280  			valid:         true,
   281  		},
   282  		BLOCKHASH: {
   283  			execute:       opBlockhash,
   284  			gasCost:       constGasFunc(GasExtStep),
   285  			validateStack: makeStackFunc(1, 0),
   286  			valid:         true,
   287  		},
   288  		COINBASE: {
   289  			execute:       opCoinbase,
   290  			gasCost:       constGasFunc(GasQuickStep),
   291  			validateStack: makeStackFunc(0, 1),
   292  			valid:         true,
   293  		},
   294  		TIMESTAMP: {
   295  			execute:       opTimestamp,
   296  			gasCost:       constGasFunc(GasQuickStep),
   297  			validateStack: makeStackFunc(0, 1),
   298  			valid:         true,
   299  		},
   300  		NUMBER: {
   301  			execute:       opNumber,
   302  			gasCost:       constGasFunc(GasQuickStep),
   303  			validateStack: makeStackFunc(0, 1),
   304  			valid:         true,
   305  		},
   306  		DIFFICULTY: {
   307  			execute:       opDifficulty,
   308  			gasCost:       constGasFunc(GasQuickStep),
   309  			validateStack: makeStackFunc(0, 1),
   310  			valid:         true,
   311  		},
   312  		GASLIMIT: {
   313  			execute:       opGasLimit,
   314  			gasCost:       constGasFunc(GasQuickStep),
   315  			validateStack: makeStackFunc(0, 1),
   316  			valid:         true,
   317  		},
   318  		POP: {
   319  			execute:       opPop,
   320  			gasCost:       constGasFunc(GasQuickStep),
   321  			validateStack: makeStackFunc(1, -1),
   322  			valid:         true,
   323  		},
   324  		MLOAD: {
   325  			execute:       opMload,
   326  			gasCost:       gasMLoad,
   327  			validateStack: makeStackFunc(1, 0),
   328  			memorySize:    memoryMLoad,
   329  			valid:         true,
   330  		},
   331  		MSTORE: {
   332  			execute:       opMstore,
   333  			gasCost:       gasMStore,
   334  			validateStack: makeStackFunc(2, -2),
   335  			memorySize:    memoryMStore,
   336  			valid:         true,
   337  		},
   338  		MSTORE8: {
   339  			execute:       opMstore8,
   340  			gasCost:       gasMStore8,
   341  			memorySize:    memoryMStore8,
   342  			validateStack: makeStackFunc(2, -2),
   343  
   344  			valid: true,
   345  		},
   346  		SLOAD: {
   347  			execute:       opSload,
   348  			gasCost:       gasSLoad,
   349  			validateStack: makeStackFunc(1, 0),
   350  			valid:         true,
   351  		},
   352  		SSTORE: {
   353  			execute:       opSstore,
   354  			gasCost:       gasSStore,
   355  			validateStack: makeStackFunc(2, -2),
   356  			valid:         true,
   357  		},
   358  		JUMP: {
   359  			execute:       opJump,
   360  			gasCost:       constGasFunc(GasMidStep),
   361  			validateStack: makeStackFunc(1, -1),
   362  			jumps:         true,
   363  			valid:         true,
   364  		},
   365  		JUMPI: {
   366  			execute:       opJumpi,
   367  			gasCost:       constGasFunc(GasSlowStep),
   368  			validateStack: makeStackFunc(2, -2),
   369  			jumps:         true,
   370  			valid:         true,
   371  		},
   372  		PC: {
   373  			execute:       opPc,
   374  			gasCost:       constGasFunc(GasQuickStep),
   375  			validateStack: makeStackFunc(0, 1),
   376  			valid:         true,
   377  		},
   378  		MSIZE: {
   379  			execute:       opMsize,
   380  			gasCost:       constGasFunc(GasQuickStep),
   381  			validateStack: makeStackFunc(0, 1),
   382  			valid:         true,
   383  		},
   384  		GAS: {
   385  			execute:       opGas,
   386  			gasCost:       constGasFunc(GasQuickStep),
   387  			validateStack: makeStackFunc(0, 1),
   388  			valid:         true,
   389  		},
   390  		JUMPDEST: {
   391  			execute:       opJumpdest,
   392  			gasCost:       constGasFunc(params.JumpdestGas),
   393  			validateStack: makeStackFunc(0, 0),
   394  			valid:         true,
   395  		},
   396  		PUSH1: {
   397  			execute:       makePush(1, big.NewInt(1)),
   398  			gasCost:       gasPush,
   399  			validateStack: makeStackFunc(0, 1),
   400  			valid:         true,
   401  		},
   402  		PUSH2: {
   403  			execute:       makePush(2, big.NewInt(2)),
   404  			gasCost:       gasPush,
   405  			validateStack: makeStackFunc(0, 1),
   406  			valid:         true,
   407  		},
   408  		PUSH3: {
   409  			execute:       makePush(3, big.NewInt(3)),
   410  			gasCost:       gasPush,
   411  			validateStack: makeStackFunc(0, 1),
   412  			valid:         true,
   413  		},
   414  		PUSH4: {
   415  			execute:       makePush(4, big.NewInt(4)),
   416  			gasCost:       gasPush,
   417  			validateStack: makeStackFunc(0, 1),
   418  			valid:         true,
   419  		},
   420  		PUSH5: {
   421  			execute:       makePush(5, big.NewInt(5)),
   422  			gasCost:       gasPush,
   423  			validateStack: makeStackFunc(0, 1),
   424  			valid:         true,
   425  		},
   426  		PUSH6: {
   427  			execute:       makePush(6, big.NewInt(6)),
   428  			gasCost:       gasPush,
   429  			validateStack: makeStackFunc(0, 1),
   430  			valid:         true,
   431  		},
   432  		PUSH7: {
   433  			execute:       makePush(7, big.NewInt(7)),
   434  			gasCost:       gasPush,
   435  			validateStack: makeStackFunc(0, 1),
   436  			valid:         true,
   437  		},
   438  		PUSH8: {
   439  			execute:       makePush(8, big.NewInt(8)),
   440  			gasCost:       gasPush,
   441  			validateStack: makeStackFunc(0, 1),
   442  			valid:         true,
   443  		},
   444  		PUSH9: {
   445  			execute:       makePush(9, big.NewInt(9)),
   446  			gasCost:       gasPush,
   447  			validateStack: makeStackFunc(0, 1),
   448  			valid:         true,
   449  		},
   450  		PUSH10: {
   451  			execute:       makePush(10, big.NewInt(10)),
   452  			gasCost:       gasPush,
   453  			validateStack: makeStackFunc(0, 1),
   454  			valid:         true,
   455  		},
   456  		PUSH11: {
   457  			execute:       makePush(11, big.NewInt(11)),
   458  			gasCost:       gasPush,
   459  			validateStack: makeStackFunc(0, 1),
   460  			valid:         true,
   461  		},
   462  		PUSH12: {
   463  			execute:       makePush(12, big.NewInt(12)),
   464  			gasCost:       gasPush,
   465  			validateStack: makeStackFunc(0, 1),
   466  			valid:         true,
   467  		},
   468  		PUSH13: {
   469  			execute:       makePush(13, big.NewInt(13)),
   470  			gasCost:       gasPush,
   471  			validateStack: makeStackFunc(0, 1),
   472  			valid:         true,
   473  		},
   474  		PUSH14: {
   475  			execute:       makePush(14, big.NewInt(14)),
   476  			gasCost:       gasPush,
   477  			validateStack: makeStackFunc(0, 1),
   478  			valid:         true,
   479  		},
   480  		PUSH15: {
   481  			execute:       makePush(15, big.NewInt(15)),
   482  			gasCost:       gasPush,
   483  			validateStack: makeStackFunc(0, 1),
   484  			valid:         true,
   485  		},
   486  		PUSH16: {
   487  			execute:       makePush(16, big.NewInt(16)),
   488  			gasCost:       gasPush,
   489  			validateStack: makeStackFunc(0, 1),
   490  			valid:         true,
   491  		},
   492  		PUSH17: {
   493  			execute:       makePush(17, big.NewInt(17)),
   494  			gasCost:       gasPush,
   495  			validateStack: makeStackFunc(0, 1),
   496  			valid:         true,
   497  		},
   498  		PUSH18: {
   499  			execute:       makePush(18, big.NewInt(18)),
   500  			gasCost:       gasPush,
   501  			validateStack: makeStackFunc(0, 1),
   502  			valid:         true,
   503  		},
   504  		PUSH19: {
   505  			execute:       makePush(19, big.NewInt(19)),
   506  			gasCost:       gasPush,
   507  			validateStack: makeStackFunc(0, 1),
   508  			valid:         true,
   509  		},
   510  		PUSH20: {
   511  			execute:       makePush(20, big.NewInt(20)),
   512  			gasCost:       gasPush,
   513  			validateStack: makeStackFunc(0, 1),
   514  			valid:         true,
   515  		},
   516  		PUSH21: {
   517  			execute:       makePush(21, big.NewInt(21)),
   518  			gasCost:       gasPush,
   519  			validateStack: makeStackFunc(0, 1),
   520  			valid:         true,
   521  		},
   522  		PUSH22: {
   523  			execute:       makePush(22, big.NewInt(22)),
   524  			gasCost:       gasPush,
   525  			validateStack: makeStackFunc(0, 1),
   526  			valid:         true,
   527  		},
   528  		PUSH23: {
   529  			execute:       makePush(23, big.NewInt(23)),
   530  			gasCost:       gasPush,
   531  			validateStack: makeStackFunc(0, 1),
   532  			valid:         true,
   533  		},
   534  		PUSH24: {
   535  			execute:       makePush(24, big.NewInt(24)),
   536  			gasCost:       gasPush,
   537  			validateStack: makeStackFunc(0, 1),
   538  			valid:         true,
   539  		},
   540  		PUSH25: {
   541  			execute:       makePush(25, big.NewInt(25)),
   542  			gasCost:       gasPush,
   543  			validateStack: makeStackFunc(0, 1),
   544  			valid:         true,
   545  		},
   546  		PUSH26: {
   547  			execute:       makePush(26, big.NewInt(26)),
   548  			gasCost:       gasPush,
   549  			validateStack: makeStackFunc(0, 1),
   550  			valid:         true,
   551  		},
   552  		PUSH27: {
   553  			execute:       makePush(27, big.NewInt(27)),
   554  			gasCost:       gasPush,
   555  			validateStack: makeStackFunc(0, 1),
   556  			valid:         true,
   557  		},
   558  		PUSH28: {
   559  			execute:       makePush(28, big.NewInt(28)),
   560  			gasCost:       gasPush,
   561  			validateStack: makeStackFunc(0, 1),
   562  			valid:         true,
   563  		},
   564  		PUSH29: {
   565  			execute:       makePush(29, big.NewInt(29)),
   566  			gasCost:       gasPush,
   567  			validateStack: makeStackFunc(0, 1),
   568  			valid:         true,
   569  		},
   570  		PUSH30: {
   571  			execute:       makePush(30, big.NewInt(30)),
   572  			gasCost:       gasPush,
   573  			validateStack: makeStackFunc(0, 1),
   574  			valid:         true,
   575  		},
   576  		PUSH31: {
   577  			execute:       makePush(31, big.NewInt(31)),
   578  			gasCost:       gasPush,
   579  			validateStack: makeStackFunc(0, 1),
   580  			valid:         true,
   581  		},
   582  		PUSH32: {
   583  			execute:       makePush(32, big.NewInt(32)),
   584  			gasCost:       gasPush,
   585  			validateStack: makeStackFunc(0, 1),
   586  			valid:         true,
   587  		},
   588  		DUP1: {
   589  			execute:       makeDup(1),
   590  			gasCost:       gasDup,
   591  			validateStack: makeDupStackFunc(1),
   592  			valid:         true,
   593  		},
   594  		DUP2: {
   595  			execute:       makeDup(2),
   596  			gasCost:       gasDup,
   597  			validateStack: makeDupStackFunc(2),
   598  			valid:         true,
   599  		},
   600  		DUP3: {
   601  			execute:       makeDup(3),
   602  			gasCost:       gasDup,
   603  			validateStack: makeDupStackFunc(3),
   604  			valid:         true,
   605  		},
   606  		DUP4: {
   607  			execute:       makeDup(4),
   608  			gasCost:       gasDup,
   609  			validateStack: makeDupStackFunc(4),
   610  			valid:         true,
   611  		},
   612  		DUP5: {
   613  			execute:       makeDup(5),
   614  			gasCost:       gasDup,
   615  			validateStack: makeDupStackFunc(5),
   616  			valid:         true,
   617  		},
   618  		DUP6: {
   619  			execute:       makeDup(6),
   620  			gasCost:       gasDup,
   621  			validateStack: makeDupStackFunc(6),
   622  			valid:         true,
   623  		},
   624  		DUP7: {
   625  			execute:       makeDup(7),
   626  			gasCost:       gasDup,
   627  			validateStack: makeDupStackFunc(7),
   628  			valid:         true,
   629  		},
   630  		DUP8: {
   631  			execute:       makeDup(8),
   632  			gasCost:       gasDup,
   633  			validateStack: makeDupStackFunc(8),
   634  			valid:         true,
   635  		},
   636  		DUP9: {
   637  			execute:       makeDup(9),
   638  			gasCost:       gasDup,
   639  			validateStack: makeDupStackFunc(9),
   640  			valid:         true,
   641  		},
   642  		DUP10: {
   643  			execute:       makeDup(10),
   644  			gasCost:       gasDup,
   645  			validateStack: makeDupStackFunc(10),
   646  			valid:         true,
   647  		},
   648  		DUP11: {
   649  			execute:       makeDup(11),
   650  			gasCost:       gasDup,
   651  			validateStack: makeDupStackFunc(11),
   652  			valid:         true,
   653  		},
   654  		DUP12: {
   655  			execute:       makeDup(12),
   656  			gasCost:       gasDup,
   657  			validateStack: makeDupStackFunc(12),
   658  			valid:         true,
   659  		},
   660  		DUP13: {
   661  			execute:       makeDup(13),
   662  			gasCost:       gasDup,
   663  			validateStack: makeDupStackFunc(13),
   664  			valid:         true,
   665  		},
   666  		DUP14: {
   667  			execute:       makeDup(14),
   668  			gasCost:       gasDup,
   669  			validateStack: makeDupStackFunc(14),
   670  			valid:         true,
   671  		},
   672  		DUP15: {
   673  			execute:       makeDup(15),
   674  			gasCost:       gasDup,
   675  			validateStack: makeDupStackFunc(15),
   676  			valid:         true,
   677  		},
   678  		DUP16: {
   679  			execute:       makeDup(16),
   680  			gasCost:       gasDup,
   681  			validateStack: makeDupStackFunc(16),
   682  			valid:         true,
   683  		},
   684  		SWAP1: {
   685  			execute:       makeSwap(1),
   686  			gasCost:       gasSwap,
   687  			validateStack: makeSwapStackFunc(2),
   688  			valid:         true,
   689  		},
   690  		SWAP2: {
   691  			execute:       makeSwap(2),
   692  			gasCost:       gasSwap,
   693  			validateStack: makeSwapStackFunc(3),
   694  			valid:         true,
   695  		},
   696  		SWAP3: {
   697  			execute:       makeSwap(3),
   698  			gasCost:       gasSwap,
   699  			validateStack: makeSwapStackFunc(4),
   700  			valid:         true,
   701  		},
   702  		SWAP4: {
   703  			execute:       makeSwap(4),
   704  			gasCost:       gasSwap,
   705  			validateStack: makeSwapStackFunc(5),
   706  			valid:         true,
   707  		},
   708  		SWAP5: {
   709  			execute:       makeSwap(5),
   710  			gasCost:       gasSwap,
   711  			validateStack: makeSwapStackFunc(6),
   712  			valid:         true,
   713  		},
   714  		SWAP6: {
   715  			execute:       makeSwap(6),
   716  			gasCost:       gasSwap,
   717  			validateStack: makeSwapStackFunc(7),
   718  			valid:         true,
   719  		},
   720  		SWAP7: {
   721  			execute:       makeSwap(7),
   722  			gasCost:       gasSwap,
   723  			validateStack: makeSwapStackFunc(8),
   724  			valid:         true,
   725  		},
   726  		SWAP8: {
   727  			execute:       makeSwap(8),
   728  			gasCost:       gasSwap,
   729  			validateStack: makeSwapStackFunc(9),
   730  			valid:         true,
   731  		},
   732  		SWAP9: {
   733  			execute:       makeSwap(9),
   734  			gasCost:       gasSwap,
   735  			validateStack: makeSwapStackFunc(10),
   736  			valid:         true,
   737  		},
   738  		SWAP10: {
   739  			execute:       makeSwap(10),
   740  			gasCost:       gasSwap,
   741  			validateStack: makeSwapStackFunc(11),
   742  			valid:         true,
   743  		},
   744  		SWAP11: {
   745  			execute:       makeSwap(11),
   746  			gasCost:       gasSwap,
   747  			validateStack: makeSwapStackFunc(12),
   748  			valid:         true,
   749  		},
   750  		SWAP12: {
   751  			execute:       makeSwap(12),
   752  			gasCost:       gasSwap,
   753  			validateStack: makeSwapStackFunc(13),
   754  			valid:         true,
   755  		},
   756  		SWAP13: {
   757  			execute:       makeSwap(13),
   758  			gasCost:       gasSwap,
   759  			validateStack: makeSwapStackFunc(14),
   760  			valid:         true,
   761  		},
   762  		SWAP14: {
   763  			execute:       makeSwap(14),
   764  			gasCost:       gasSwap,
   765  			validateStack: makeSwapStackFunc(15),
   766  			valid:         true,
   767  		},
   768  		SWAP15: {
   769  			execute:       makeSwap(15),
   770  			gasCost:       gasSwap,
   771  			validateStack: makeSwapStackFunc(16),
   772  			valid:         true,
   773  		},
   774  		SWAP16: {
   775  			execute:       makeSwap(16),
   776  			gasCost:       gasSwap,
   777  			validateStack: makeSwapStackFunc(17),
   778  			valid:         true,
   779  		},
   780  		LOG0: {
   781  			execute:       makeLog(0),
   782  			gasCost:       makeGasLog(0),
   783  			validateStack: makeStackFunc(2, -2),
   784  			memorySize:    memoryLog,
   785  			valid:         true,
   786  		},
   787  		LOG1: {
   788  			execute:       makeLog(1),
   789  			gasCost:       makeGasLog(1),
   790  			validateStack: makeStackFunc(3, -3),
   791  			memorySize:    memoryLog,
   792  			valid:         true,
   793  		},
   794  		LOG2: {
   795  			execute:       makeLog(2),
   796  			gasCost:       makeGasLog(2),
   797  			validateStack: makeStackFunc(4, -4),
   798  			memorySize:    memoryLog,
   799  			valid:         true,
   800  		},
   801  		LOG3: {
   802  			execute:       makeLog(3),
   803  			gasCost:       makeGasLog(3),
   804  			validateStack: makeStackFunc(5, -5),
   805  			memorySize:    memoryLog,
   806  			valid:         true,
   807  		},
   808  		LOG4: {
   809  			execute:       makeLog(4),
   810  			gasCost:       makeGasLog(4),
   811  			validateStack: makeStackFunc(6, -6),
   812  			memorySize:    memoryLog,
   813  			valid:         true,
   814  		},
   815  		CREATE: {
   816  			execute:       opCreate,
   817  			gasCost:       gasCreate,
   818  			validateStack: makeStackFunc(3, -2),
   819  			memorySize:    memoryCreate,
   820  			valid:         true,
   821  		},
   822  		CALL: {
   823  			execute:       opCall,
   824  			gasCost:       gasCall,
   825  			validateStack: makeStackFunc(7, -6),
   826  			memorySize:    memoryCall,
   827  			valid:         true,
   828  		},
   829  		CALLCODE: {
   830  			execute:       opCallCode,
   831  			gasCost:       gasCallCode,
   832  			validateStack: makeStackFunc(7, -6),
   833  			memorySize:    memoryCall,
   834  			valid:         true,
   835  		},
   836  		RETURN: {
   837  			execute:       opReturn,
   838  			gasCost:       gasReturn,
   839  			validateStack: makeStackFunc(2, -2),
   840  			memorySize:    memoryReturn,
   841  			halts:         true,
   842  			valid:         true,
   843  		},
   844  		DELEGATECALL: {
   845  			execute:       opDelegateCall,
   846  			gasCost:       gasDelegateCall,
   847  			validateStack: makeStackFunc(6, -5),
   848  			memorySize:    memoryDelegateCall,
   849  			valid:         true,
   850  		},
   851  		SELFDESTRUCT: {
   852  			execute:       opSuicide,
   853  			gasCost:       gasSuicide,
   854  			validateStack: makeStackFunc(1, -1),
   855  			halts:         true,
   856  			valid:         true,
   857  		},
   858  	}
   859  }