@@ -384,7 +384,7 @@ func opSAR(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory *
384384
385385func opSha3 (pc * uint64 , interpreter * EVMInterpreter , contract * Contract , memory * Memory , stack * Stack ) ([]byte , error ) {
386386 offset , size := stack .pop (), stack .pop ()
387- data := memory .Get (offset .Int64 (), size .Int64 ())
387+ data := memory .GetPtr (offset .Int64 (), size .Int64 ())
388388
389389 if interpreter .hasher == nil {
390390 interpreter .hasher = sha3 .NewLegacyKeccak256 ().(keccakState )
@@ -602,11 +602,9 @@ func opPop(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory *
602602}
603603
604604func opMload (pc * uint64 , interpreter * EVMInterpreter , contract * Contract , memory * Memory , stack * Stack ) ([]byte , error ) {
605- offset := stack .pop ()
606- val := interpreter .intPool .get ().SetBytes (memory .Get (offset .Int64 (), 32 ))
607- stack .push (val )
608-
609- interpreter .intPool .put (offset )
605+ v := stack .peek ()
606+ offset := v .Int64 ()
607+ v .SetBytes (memory .GetPtr (offset , 32 ))
610608 return nil , nil
611609}
612610
@@ -691,7 +689,7 @@ func opCreate(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memor
691689 var (
692690 value = stack .pop ()
693691 offset , size = stack .pop (), stack .pop ()
694- input = memory .Get (offset .Int64 (), size .Int64 ())
692+ input = memory .GetCopy (offset .Int64 (), size .Int64 ())
695693 gas = contract .Gas
696694 )
697695 if interpreter .evm .chainRules .IsEIP150 {
@@ -725,7 +723,7 @@ func opCreate2(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memo
725723 endowment = stack .pop ()
726724 offset , size = stack .pop (), stack .pop ()
727725 salt = stack .pop ()
728- input = memory .Get (offset .Int64 (), size .Int64 ())
726+ input = memory .GetCopy (offset .Int64 (), size .Int64 ())
729727 gas = contract .Gas
730728 )
731729
@@ -757,7 +755,7 @@ func opCall(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory
757755 toAddr := common .BigToAddress (addr )
758756 value = math .U256 (value )
759757 // Get the arguments from the memory.
760- args := memory .Get (inOffset .Int64 (), inSize .Int64 ())
758+ args := memory .GetPtr (inOffset .Int64 (), inSize .Int64 ())
761759
762760 if value .Sign () != 0 {
763761 gas += params .CallStipend
@@ -786,7 +784,7 @@ func opCallCode(pc *uint64, interpreter *EVMInterpreter, contract *Contract, mem
786784 toAddr := common .BigToAddress (addr )
787785 value = math .U256 (value )
788786 // Get arguments from the memory.
789- args := memory .Get (inOffset .Int64 (), inSize .Int64 ())
787+ args := memory .GetPtr (inOffset .Int64 (), inSize .Int64 ())
790788
791789 if value .Sign () != 0 {
792790 gas += params .CallStipend
@@ -814,7 +812,7 @@ func opDelegateCall(pc *uint64, interpreter *EVMInterpreter, contract *Contract,
814812 addr , inOffset , inSize , retOffset , retSize := stack .pop (), stack .pop (), stack .pop (), stack .pop (), stack .pop ()
815813 toAddr := common .BigToAddress (addr )
816814 // Get arguments from the memory.
817- args := memory .Get (inOffset .Int64 (), inSize .Int64 ())
815+ args := memory .GetPtr (inOffset .Int64 (), inSize .Int64 ())
818816
819817 ret , returnGas , err := interpreter .evm .DelegateCall (contract , toAddr , args , gas )
820818 if err != nil {
@@ -839,7 +837,7 @@ func opStaticCall(pc *uint64, interpreter *EVMInterpreter, contract *Contract, m
839837 addr , inOffset , inSize , retOffset , retSize := stack .pop (), stack .pop (), stack .pop (), stack .pop (), stack .pop ()
840838 toAddr := common .BigToAddress (addr )
841839 // Get arguments from the memory.
842- args := memory .Get (inOffset .Int64 (), inSize .Int64 ())
840+ args := memory .GetPtr (inOffset .Int64 (), inSize .Int64 ())
843841
844842 ret , returnGas , err := interpreter .evm .StaticCall (contract , toAddr , args , gas )
845843 if err != nil {
@@ -895,7 +893,7 @@ func makeLog(size int) executionFunc {
895893 topics [i ] = common .BigToHash (stack .pop ())
896894 }
897895
898- d := memory .Get (mStart .Int64 (), mSize .Int64 ())
896+ d := memory .GetCopy (mStart .Int64 (), mSize .Int64 ())
899897 interpreter .evm .StateDB .AddLog (& types.Log {
900898 Address : contract .Address (),
901899 Topics : topics ,
0 commit comments