@@ -384,7 +384,7 @@ func opSAR(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory *
384
384
385
385
func opSha3 (pc * uint64 , interpreter * EVMInterpreter , contract * Contract , memory * Memory , stack * Stack ) ([]byte , error ) {
386
386
offset , size := stack .pop (), stack .pop ()
387
- data := memory .Get (offset .Int64 (), size .Int64 ())
387
+ data := memory .GetPtr (offset .Int64 (), size .Int64 ())
388
388
389
389
if interpreter .hasher == nil {
390
390
interpreter .hasher = sha3 .NewLegacyKeccak256 ().(keccakState )
@@ -602,11 +602,9 @@ func opPop(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory *
602
602
}
603
603
604
604
func 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 ))
610
608
return nil , nil
611
609
}
612
610
@@ -691,7 +689,7 @@ func opCreate(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memor
691
689
var (
692
690
value = stack .pop ()
693
691
offset , size = stack .pop (), stack .pop ()
694
- input = memory .Get (offset .Int64 (), size .Int64 ())
692
+ input = memory .GetCopy (offset .Int64 (), size .Int64 ())
695
693
gas = contract .Gas
696
694
)
697
695
if interpreter .evm .chainRules .IsEIP150 {
@@ -725,7 +723,7 @@ func opCreate2(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memo
725
723
endowment = stack .pop ()
726
724
offset , size = stack .pop (), stack .pop ()
727
725
salt = stack .pop ()
728
- input = memory .Get (offset .Int64 (), size .Int64 ())
726
+ input = memory .GetCopy (offset .Int64 (), size .Int64 ())
729
727
gas = contract .Gas
730
728
)
731
729
@@ -757,7 +755,7 @@ func opCall(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory
757
755
toAddr := common .BigToAddress (addr )
758
756
value = math .U256 (value )
759
757
// Get the arguments from the memory.
760
- args := memory .Get (inOffset .Int64 (), inSize .Int64 ())
758
+ args := memory .GetPtr (inOffset .Int64 (), inSize .Int64 ())
761
759
762
760
if value .Sign () != 0 {
763
761
gas += params .CallStipend
@@ -786,7 +784,7 @@ func opCallCode(pc *uint64, interpreter *EVMInterpreter, contract *Contract, mem
786
784
toAddr := common .BigToAddress (addr )
787
785
value = math .U256 (value )
788
786
// Get arguments from the memory.
789
- args := memory .Get (inOffset .Int64 (), inSize .Int64 ())
787
+ args := memory .GetPtr (inOffset .Int64 (), inSize .Int64 ())
790
788
791
789
if value .Sign () != 0 {
792
790
gas += params .CallStipend
@@ -814,7 +812,7 @@ func opDelegateCall(pc *uint64, interpreter *EVMInterpreter, contract *Contract,
814
812
addr , inOffset , inSize , retOffset , retSize := stack .pop (), stack .pop (), stack .pop (), stack .pop (), stack .pop ()
815
813
toAddr := common .BigToAddress (addr )
816
814
// Get arguments from the memory.
817
- args := memory .Get (inOffset .Int64 (), inSize .Int64 ())
815
+ args := memory .GetPtr (inOffset .Int64 (), inSize .Int64 ())
818
816
819
817
ret , returnGas , err := interpreter .evm .DelegateCall (contract , toAddr , args , gas )
820
818
if err != nil {
@@ -839,7 +837,7 @@ func opStaticCall(pc *uint64, interpreter *EVMInterpreter, contract *Contract, m
839
837
addr , inOffset , inSize , retOffset , retSize := stack .pop (), stack .pop (), stack .pop (), stack .pop (), stack .pop ()
840
838
toAddr := common .BigToAddress (addr )
841
839
// Get arguments from the memory.
842
- args := memory .Get (inOffset .Int64 (), inSize .Int64 ())
840
+ args := memory .GetPtr (inOffset .Int64 (), inSize .Int64 ())
843
841
844
842
ret , returnGas , err := interpreter .evm .StaticCall (contract , toAddr , args , gas )
845
843
if err != nil {
@@ -895,7 +893,7 @@ func makeLog(size int) executionFunc {
895
893
topics [i ] = common .BigToHash (stack .pop ())
896
894
}
897
895
898
- d := memory .Get (mStart .Int64 (), mSize .Int64 ())
896
+ d := memory .GetCopy (mStart .Int64 (), mSize .Int64 ())
899
897
interpreter .evm .StateDB .AddLog (& types.Log {
900
898
Address : contract .Address (),
901
899
Topics : topics ,
0 commit comments