mirror of
https://github.com/golang/go.git
synced 2025-05-31 04:02:58 +00:00
cmd/compile: more compact representation of DW_AT_high_pc
DWARF version 4 allows DW_AT_high_pc to be represented as a constant offset from DW_AT_low_pc, this can help save up to 7 bytes per function/lexical scope. Change-Id: I93638d83638ecad4d0d1bfe27348eae6139820c9 Reviewed-on: https://go-review.googlesource.com/60530 Run-TryBot: Heschi Kreinick <heschi@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
parent
50f1f639a4
commit
84188296e9
@ -292,7 +292,7 @@ var abbrevs = [DW_NABRV]dwAbbrev{
|
|||||||
[]dwAttrForm{
|
[]dwAttrForm{
|
||||||
{DW_AT_name, DW_FORM_string},
|
{DW_AT_name, DW_FORM_string},
|
||||||
{DW_AT_low_pc, DW_FORM_addr},
|
{DW_AT_low_pc, DW_FORM_addr},
|
||||||
{DW_AT_high_pc, DW_FORM_addr},
|
{DW_AT_high_pc, DW_FORM_udata},
|
||||||
{DW_AT_frame_base, DW_FORM_block1},
|
{DW_AT_frame_base, DW_FORM_block1},
|
||||||
{DW_AT_external, DW_FORM_flag},
|
{DW_AT_external, DW_FORM_flag},
|
||||||
},
|
},
|
||||||
@ -373,7 +373,7 @@ var abbrevs = [DW_NABRV]dwAbbrev{
|
|||||||
DW_CHILDREN_yes,
|
DW_CHILDREN_yes,
|
||||||
[]dwAttrForm{
|
[]dwAttrForm{
|
||||||
{DW_AT_low_pc, DW_FORM_addr},
|
{DW_AT_low_pc, DW_FORM_addr},
|
||||||
{DW_AT_high_pc, DW_FORM_addr},
|
{DW_AT_high_pc, DW_FORM_udata},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -740,7 +740,7 @@ func PutFunc(ctxt Context, info, loc, ranges Sym, name string, external bool, st
|
|||||||
Uleb128put(ctxt, info, DW_ABRV_FUNCTION)
|
Uleb128put(ctxt, info, DW_ABRV_FUNCTION)
|
||||||
putattr(ctxt, info, DW_ABRV_FUNCTION, DW_FORM_string, DW_CLS_STRING, int64(len(name)), name)
|
putattr(ctxt, info, DW_ABRV_FUNCTION, DW_FORM_string, DW_CLS_STRING, int64(len(name)), name)
|
||||||
putattr(ctxt, info, DW_ABRV_FUNCTION, DW_FORM_addr, DW_CLS_ADDRESS, 0, startPC)
|
putattr(ctxt, info, DW_ABRV_FUNCTION, DW_FORM_addr, DW_CLS_ADDRESS, 0, startPC)
|
||||||
putattr(ctxt, info, DW_ABRV_FUNCTION, DW_FORM_addr, DW_CLS_ADDRESS, size, startPC)
|
putattr(ctxt, info, DW_ABRV_FUNCTION, DW_FORM_udata, DW_CLS_CONSTANT, size, nil)
|
||||||
putattr(ctxt, info, DW_ABRV_FUNCTION, DW_FORM_block1, DW_CLS_BLOCK, 1, []byte{DW_OP_call_frame_cfa})
|
putattr(ctxt, info, DW_ABRV_FUNCTION, DW_FORM_block1, DW_CLS_BLOCK, 1, []byte{DW_OP_call_frame_cfa})
|
||||||
var ev int64
|
var ev int64
|
||||||
if external {
|
if external {
|
||||||
@ -772,7 +772,7 @@ func putscope(ctxt Context, info, loc, ranges, startPC Sym, curscope int32, scop
|
|||||||
if len(scope.Ranges) == 1 {
|
if len(scope.Ranges) == 1 {
|
||||||
Uleb128put(ctxt, info, DW_ABRV_LEXICAL_BLOCK_SIMPLE)
|
Uleb128put(ctxt, info, DW_ABRV_LEXICAL_BLOCK_SIMPLE)
|
||||||
putattr(ctxt, info, DW_ABRV_LEXICAL_BLOCK_SIMPLE, DW_FORM_addr, DW_CLS_ADDRESS, scope.Ranges[0].Start, startPC)
|
putattr(ctxt, info, DW_ABRV_LEXICAL_BLOCK_SIMPLE, DW_FORM_addr, DW_CLS_ADDRESS, scope.Ranges[0].Start, startPC)
|
||||||
putattr(ctxt, info, DW_ABRV_LEXICAL_BLOCK_SIMPLE, DW_FORM_addr, DW_CLS_ADDRESS, scope.Ranges[0].End, startPC)
|
putattr(ctxt, info, DW_ABRV_LEXICAL_BLOCK_SIMPLE, DW_FORM_udata, DW_CLS_CONSTANT, scope.Ranges[0].End-scope.Ranges[0].Start, nil)
|
||||||
} else {
|
} else {
|
||||||
Uleb128put(ctxt, info, DW_ABRV_LEXICAL_BLOCK_RANGES)
|
Uleb128put(ctxt, info, DW_ABRV_LEXICAL_BLOCK_RANGES)
|
||||||
putattr(ctxt, info, DW_ABRV_LEXICAL_BLOCK_RANGES, DW_FORM_sec_offset, DW_CLS_PTR, ranges.Len(), ranges)
|
putattr(ctxt, info, DW_ABRV_LEXICAL_BLOCK_RANGES, DW_FORM_sec_offset, DW_CLS_PTR, ranges.Len(), ranges)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user