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