Skip to content

Commit e02627f

Browse files
committed
fix
1 parent 6301d2f commit e02627f

1 file changed

Lines changed: 49 additions & 54 deletions

File tree

core/vm/evm.go

Lines changed: 49 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -222,18 +222,16 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
222222
shortcutResult = &shortcut.Result{
223223
Ready: make(chan bool),
224224
}
225-
if evm.Config.EnableInline {
226-
go func() {
227-
defer close(shortcutResult.Ready)
228-
229-
inliner := shortcut.GetShortcut(addr)
230-
if inliner != nil {
231-
shortcutResult.Pc, shortcutResult.GasUsed,
232-
shortcutResult.Stack, shortcutResult.Mem, shortcutResult.LastGasCost,
233-
shortcutResult.Expected, shortcutResult.Err = inliner.Shortcut(input, evm.Origin, caller.Address(), value)
234-
}
235-
}()
236-
}
225+
go func() {
226+
defer close(shortcutResult.Ready)
227+
228+
inliner := shortcut.GetShortcut(addr)
229+
if inliner != nil {
230+
shortcutResult.Pc, shortcutResult.GasUsed,
231+
shortcutResult.Stack, shortcutResult.Mem, shortcutResult.LastGasCost,
232+
shortcutResult.Expected, shortcutResult.Err = inliner.Shortcut(input, evm.Origin, caller.Address(), value)
233+
}
234+
}()
237235
}
238236

239237
// Capture the tracer start/end events in debug mode
@@ -343,22 +341,21 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
343341
// CallCode differs from Call in the sense that it executes the given address'
344342
// code with the caller as context.
345343
func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte, gas uint64, value *uint256.Int) (ret []byte, leftOverGas uint64, err error) {
346-
shortcutResult := &shortcut.Result{
347-
Ready: make(chan bool),
348-
}
344+
var shortcutResult *shortcut.Result
349345
if evm.Config.EnableInline {
350-
if evm.Config.EnableInline {
351-
go func() {
352-
defer close(shortcutResult.Ready)
353-
354-
inliner := shortcut.GetShortcut(addr)
355-
if inliner != nil {
356-
shortcutResult.Pc, shortcutResult.GasUsed,
357-
shortcutResult.Stack, shortcutResult.Mem, shortcutResult.LastGasCost,
358-
shortcutResult.Expected, shortcutResult.Err = inliner.Shortcut(input, evm.Origin, caller.Address(), value)
359-
}
360-
}()
346+
shortcutResult = &shortcut.Result{
347+
Ready: make(chan bool),
361348
}
349+
go func() {
350+
defer close(shortcutResult.Ready)
351+
352+
inliner := shortcut.GetShortcut(addr)
353+
if inliner != nil {
354+
shortcutResult.Pc, shortcutResult.GasUsed,
355+
shortcutResult.Stack, shortcutResult.Mem, shortcutResult.LastGasCost,
356+
shortcutResult.Expected, shortcutResult.Err = inliner.Shortcut(input, evm.Origin, caller.Address(), value)
357+
}
358+
}()
362359
}
363360

364361
// Invoke tracer hooks that signal entering/exiting a call frame
@@ -439,22 +436,21 @@ func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte,
439436
// DelegateCall differs from CallCode in the sense that it executes the given address'
440437
// code with the caller as context and the caller is set to the caller of the caller.
441438
func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error) {
442-
shortcutResult := &shortcut.Result{
443-
Ready: make(chan bool),
444-
}
439+
var shortcutResult *shortcut.Result
445440
if evm.Config.EnableInline {
446-
if evm.Config.EnableInline {
447-
go func() {
448-
defer close(shortcutResult.Ready)
449-
450-
inliner := shortcut.GetShortcut(addr)
451-
if inliner != nil {
452-
shortcutResult.Pc, shortcutResult.GasUsed,
453-
shortcutResult.Stack, shortcutResult.Mem, shortcutResult.LastGasCost,
454-
shortcutResult.Expected, shortcutResult.Err = inliner.Shortcut(input, evm.Origin, caller.Address(), uint256.NewInt(0))
455-
}
456-
}()
441+
shortcutResult = &shortcut.Result{
442+
Ready: make(chan bool),
457443
}
444+
go func() {
445+
defer close(shortcutResult.Ready)
446+
447+
inliner := shortcut.GetShortcut(addr)
448+
if inliner != nil {
449+
shortcutResult.Pc, shortcutResult.GasUsed,
450+
shortcutResult.Stack, shortcutResult.Mem, shortcutResult.LastGasCost,
451+
shortcutResult.Expected, shortcutResult.Err = inliner.Shortcut(input, evm.Origin, caller.Address(), uint256.NewInt(0))
452+
}
453+
}()
458454
}
459455

460456
// Invoke tracer hooks that signal entering/exiting a call frame
@@ -525,22 +521,21 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by
525521
// Opcodes that attempt to perform such modifications will result in exceptions
526522
// instead of performing the modifications.
527523
func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte, gas uint64) (ret []byte, leftOverGas uint64, err error) {
528-
shortcutResult := &shortcut.Result{
529-
Ready: make(chan bool),
530-
}
524+
var shortcutResult *shortcut.Result
531525
if evm.Config.EnableInline {
532-
if evm.Config.EnableInline {
533-
go func() {
534-
defer close(shortcutResult.Ready)
535-
536-
inliner := shortcut.GetShortcut(addr)
537-
if inliner != nil {
538-
shortcutResult.Pc, shortcutResult.GasUsed,
539-
shortcutResult.Stack, shortcutResult.Mem, shortcutResult.LastGasCost,
540-
shortcutResult.Expected, shortcutResult.Err = inliner.Shortcut(input, evm.Origin, caller.Address(), uint256.NewInt(0))
541-
}
542-
}()
526+
shortcutResult = &shortcut.Result{
527+
Ready: make(chan bool),
543528
}
529+
go func() {
530+
defer close(shortcutResult.Ready)
531+
532+
inliner := shortcut.GetShortcut(addr)
533+
if inliner != nil {
534+
shortcutResult.Pc, shortcutResult.GasUsed,
535+
shortcutResult.Stack, shortcutResult.Mem, shortcutResult.LastGasCost,
536+
shortcutResult.Expected, shortcutResult.Err = inliner.Shortcut(input, evm.Origin, caller.Address(), uint256.NewInt(0))
537+
}
538+
}()
544539
}
545540

546541
// Invoke tracer hooks that signal entering/exiting a call frame

0 commit comments

Comments
 (0)