Revert "core/vm: performance tweak of OpCode.String() (#28453)"

This reverts commit 0622724082.
This commit is contained in:
devopsbo3 2023-11-10 12:27:53 -06:00 committed by GitHub
parent b2b7ffdb0d
commit 5be5a95818

View file

@ -224,7 +224,8 @@ const (
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.
STOP: "STOP",
ADD: "ADD",
@ -398,10 +399,12 @@ var opCodeToString = [256]string{
}
func (op OpCode) String() string {
if s := opCodeToString[op]; s != "" {
return s
}
str := opCodeToString[op]
if len(str) == 0 {
return fmt.Sprintf("opcode %#x not defined", int(op))
}
return str
}
var stringToOp = map[string]OpCode{