Skip to content

Commit

Permalink
Optimized opMLoad to avoid unnecessary allocations.
Browse files Browse the repository at this point in the history
  • Loading branch information
cokicm committed Jun 3, 2024
1 parent 7942848 commit 4f833da
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions state/runtime/evm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,15 +356,14 @@ func opSar(c *state) {
func opMLoad(c *state) {
v := c.top()

var ok bool
c.tmp, ok = c.get2(c.tmp[:0], *v, *wordSize256)

// ### Error handling?
if !ok {
if !c.allocateMemory(*v, *wordSize256) {
return
}

v.SetBytes(c.tmp)
offset := v.Uint64()
size := wordSize256.Uint64()

v.SetBytes(c.memory[offset : offset+size])
}

func opMStore(c *state) {
Expand Down

0 comments on commit 4f833da

Please sign in to comment.