mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/obj: make Prog.From3 a pointer
It is almost never set and Addr is large, so having the full struct in the Prog wastes memory most of the time. Before (on a 64-bit system): $ sizeof -p cmd/internal/obj Addr Prog Addr 80 Prog 376 $ After: $ sizeof -p cmd/internal/obj Addr Prog Addr 80 Prog 304 $ Change-Id: I491f201241f87543964a7d0f48b85830759be9d0 Reviewed-on: https://go-review.googlesource.com/10457 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
parent
80864cf1f7
commit
c413c45e6d
25 changed files with 863 additions and 548 deletions
|
|
@ -204,7 +204,7 @@ type Prog struct {
|
|||
Ctxt *Link
|
||||
Link *Prog
|
||||
From Addr
|
||||
From3 Addr
|
||||
From3 *Addr // optional
|
||||
To Addr
|
||||
Opt interface{}
|
||||
Forwd *Prog
|
||||
|
|
@ -231,6 +231,14 @@ type Prog struct {
|
|||
Info ProgInfo
|
||||
}
|
||||
|
||||
// From3Type returns From3.Type, or TYPE_NONE when From3 is nil.
|
||||
func (p *Prog) From3Type() int16 {
|
||||
if p.From3 == nil {
|
||||
return TYPE_NONE
|
||||
}
|
||||
return p.From3.Type
|
||||
}
|
||||
|
||||
// ProgInfo holds information about the instruction for use
|
||||
// by clients such as the compiler. The exact meaning of this
|
||||
// data is up to the client and is not interpreted by the cmd/internal/obj/... packages.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue