mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Revert "core/vm: performance tweak of OpCode.String() (#28453)"
This reverts commit 0622724082.
This commit is contained in:
parent
b2b7ffdb0d
commit
5be5a95818
1 changed files with 7 additions and 4 deletions
|
|
@ -224,7 +224,8 @@ const (
|
||||||
SELFDESTRUCT OpCode = 0xff
|
SELFDESTRUCT OpCode = 0xff
|
||||||
)
|
)
|
||||||
|
|
||||||
var opCodeToString = [256]string{
|
// Since the opcodes aren't all in order we can't use a regular slice.
|
||||||
|
var opCodeToString = map[OpCode]string{
|
||||||
// 0x0 range - arithmetic ops.
|
// 0x0 range - arithmetic ops.
|
||||||
STOP: "STOP",
|
STOP: "STOP",
|
||||||
ADD: "ADD",
|
ADD: "ADD",
|
||||||
|
|
@ -398,10 +399,12 @@ var opCodeToString = [256]string{
|
||||||
}
|
}
|
||||||
|
|
||||||
func (op OpCode) String() string {
|
func (op OpCode) String() string {
|
||||||
if s := opCodeToString[op]; s != "" {
|
str := opCodeToString[op]
|
||||||
return s
|
if len(str) == 0 {
|
||||||
|
return fmt.Sprintf("opcode %#x not defined", int(op))
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("opcode %#x not defined", int(op))
|
|
||||||
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
var stringToOp = map[string]OpCode{
|
var stringToOp = map[string]OpCode{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue