Skip to content

Emit POP using local stack pointer#6

Merged
Giulio2002 merged 1 commit into
masterfrom
optimize-pop-codegen
May 15, 2026
Merged

Emit POP using local stack pointer#6
Giulio2002 merged 1 commit into
masterfrom
optimize-pop-codegen

Conversation

@Giulio2002
Copy link
Copy Markdown
Owner

Summary

  • generate the POP body directly in the shaped POP case
  • reuse the local s := interp.Stack already needed for the stack check
  • avoid going back through interp.Stack.top-- in the inlined opPop body

Benchmark

Focused opcode benchmark against origin/master baseline:

  • Opcode/PUSH1_POP: 6.392ms -> 6.187ms, -3.20%
  • nearby controls (ADD, DUP1_POP, SWAP1) were statistically unchanged

Verification

  • go generate ./vm
  • git diff --check
  • go test ./vm -count=1
  • go test ./... -count=1
  • GEVM_TEST_RUNNER=opcode go test ./... -count=1
  • go test ./tests/bench -run '^$' -bench '^BenchmarkOpcode/(PUSH1_POP|DUP1_POP|ADD|SWAP1)$' -benchmem -count=10

@Giulio2002 Giulio2002 merged commit 0f734e0 into master May 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant