core/vm: reduced big int allocations
Reduced big int allocation by making stack items modifiable. Instead of adding items such as `common.Big0` to the stack, `new(big.Int)` is added instead. One must expect that any item that is added to the stack might change.
This commit is contained in:
@ -21,14 +21,17 @@ import (
|
||||
"math/big"
|
||||
)
|
||||
|
||||
func newstack() *stack {
|
||||
return &stack{}
|
||||
}
|
||||
|
||||
// stack is an object for basic stack operations. Items popped to the stack are
|
||||
// expected to be changed and modified. stack does not take care of adding newly
|
||||
// initialised objects.
|
||||
type stack struct {
|
||||
data []*big.Int
|
||||
}
|
||||
|
||||
func newstack() *stack {
|
||||
return &stack{}
|
||||
}
|
||||
|
||||
func (st *stack) Data() []*big.Int {
|
||||
return st.data
|
||||
}
|
||||
|
Reference in New Issue
Block a user