proc/*: only load floating point registers when needed (#1981)

Changes implementations of proc.Registers interface and the
op.DwarfRegisters struct so that floating point registers can be loaded
only when they are needed.
Removes the floatingPoint parameter from proc.Thread.Registers.
This accomplishes three things:

1. it simplifies the proc.Thread.Registers interface
2. it makes it impossible to accidentally create a broken set of saved
   registers or of op.DwarfRegisters by accidentally calling
   Registers(false)
3. it improves general performance of Delve by avoiding to load
   floating point registers as much as possible

Floating point registers are loaded under two circumstances:

1. When the Slice method is called with floatingPoint == true
2. When the Copy method is called

Benchmark before:

BenchmarkConditionalBreakpoints-4   	       1	4327350142 ns/op

Benchmark after:

BenchmarkConditionalBreakpoints-4   	       1	3852642917 ns/op

Updates #1549
This commit is contained in:
Alessandro Arzilli
2020-05-13 20:56:50 +02:00
committed by GitHub
parent f96663a243
commit 200994bc8f
37 changed files with 364 additions and 250 deletions

View File

@ -422,7 +422,7 @@ func FindGoroutine(dbp *Target, gid int) (*G, error) {
}
func getGVariable(thread Thread) (*Variable, error) {
regs, err := thread.Registers(false)
regs, err := thread.Registers()
if err != nil {
return nil, err
}