aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj/objfile.go
diff options
context:
space:
mode:
authorMarvin Stenger <marvin.stenger94@gmail.com>2016-03-28 11:34:37 +0200
committerDavid Crawshaw <crawshaw@golang.org>2016-03-28 16:32:59 +0000
commit2326c24cc722f5093f40ea0964c93addd155ada0 (patch)
tree82a6101956102488e15b4cd48757ac17a88bfe3f /src/cmd/internal/obj/objfile.go
parent8eec2bbfbc4f209950f677906c6ce67e01d32930 (diff)
downloadgo-2326c24cc722f5093f40ea0964c93addd155ada0.tar.xz
cmd/internal/obj: convert fields of LSym from uint8 to bool
No performance regression measurable: name old time/op new time/op delta Template 432ms ± 3% 422ms ± 2% -2.34% (p=0.010 n=10+9) GoTypes 1.46s ± 1% 1.46s ± 1% ~ (p=0.796 n=10+10) Compiler 7.15s ± 1% 7.14s ± 1% ~ (p=0.447 n=10+9) Change-Id: I21b93cb989017b6fec2215de2423d87f25cf538c Reviewed-on: https://go-review.googlesource.com/21220 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/cmd/internal/obj/objfile.go')
-rw-r--r--src/cmd/internal/obj/objfile.go48
1 files changed, 30 insertions, 18 deletions
diff --git a/src/cmd/internal/obj/objfile.go b/src/cmd/internal/obj/objfile.go
index 42ae86d62d..b9eb8014ec 100644
--- a/src/cmd/internal/obj/objfile.go
+++ b/src/cmd/internal/obj/objfile.go
@@ -170,15 +170,14 @@ func flushplist(ctxt *Link, freeProgs bool) {
case AGLOBL:
s := p.From.Sym
- tmp6 := s.Seenglobl
- s.Seenglobl++
- if tmp6 != 0 {
+ if s.Seenglobl {
fmt.Printf("duplicate %v\n", p)
}
- if s.Onlist != 0 {
+ s.Seenglobl = true
+ if s.Onlist {
log.Fatalf("symbol %s listed multiple times", s.Name)
}
- s.Onlist = 1
+ s.Onlist = true
ctxt.Data = append(ctxt.Data, s)
s.Size = p.To.Offset
if s.Type == 0 || s.Type == SXREF {
@@ -186,7 +185,7 @@ func flushplist(ctxt *Link, freeProgs bool) {
}
flag := int(p.From3.Offset)
if flag&DUPOK != 0 {
- s.Dupok = 1
+ s.Dupok = true
}
if flag&RODATA != 0 {
s.Type = SRODATA
@@ -209,17 +208,17 @@ func flushplist(ctxt *Link, freeProgs bool) {
if s.Text != nil {
log.Fatalf("duplicate TEXT for %s", s.Name)
}
- if s.Onlist != 0 {
+ if s.Onlist {
log.Fatalf("symbol %s listed multiple times", s.Name)
}
- s.Onlist = 1
+ s.Onlist = true
text = append(text, s)
flag := int(p.From3Offset())
if flag&DUPOK != 0 {
- s.Dupok = 1
+ s.Dupok = true
}
if flag&NOSPLIT != 0 {
- s.Nosplit = 1
+ s.Nosplit = true
}
if flag&REFLECTMETHOD != 0 {
s.ReflectMethod = true
@@ -437,19 +436,19 @@ func writesym(ctxt *Link, b *Biobuf, s *LSym) {
if s.Type != 0 {
fmt.Fprintf(ctxt.Bso, "t=%d ", s.Type)
}
- if s.Dupok != 0 {
+ if s.Dupok {
fmt.Fprintf(ctxt.Bso, "dupok ")
}
- if s.Cfunc != 0 {
+ if s.Cfunc {
fmt.Fprintf(ctxt.Bso, "cfunc ")
}
- if s.Nosplit != 0 {
+ if s.Nosplit {
fmt.Fprintf(ctxt.Bso, "nosplit ")
}
fmt.Fprintf(ctxt.Bso, "size=%d", s.Size)
if s.Type == STEXT {
fmt.Fprintf(ctxt.Bso, " args=%#x locals=%#x", uint64(s.Args), uint64(s.Locals))
- if s.Leaf != 0 {
+ if s.Leaf {
fmt.Fprintf(ctxt.Bso, " leaf")
}
}
@@ -499,9 +498,12 @@ func writesym(ctxt *Link, b *Biobuf, s *LSym) {
Bputc(b, 0xfe)
wrint(b, int64(s.Type))
wrsym(b, s)
- flags := int64(s.Dupok)
+ flags := int64(0)
+ if s.Dupok {
+ flags |= 1
+ }
if s.Local {
- flags |= 2
+ flags |= 1 << 1
}
wrint(b, flags)
wrint(b, s.Size)
@@ -522,8 +524,18 @@ func writesym(ctxt *Link, b *Biobuf, s *LSym) {
if s.Type == STEXT {
wrint(b, int64(s.Args))
wrint(b, int64(s.Locals))
- wrint(b, int64(s.Nosplit))
- flags := int64(s.Leaf) | int64(s.Cfunc)<<1
+ if s.Nosplit {
+ wrint(b, 1)
+ } else {
+ wrint(b, 0)
+ }
+ flags := int64(0)
+ if s.Leaf {
+ flags |= 1
+ }
+ if s.Cfunc {
+ flags |= 1 << 1
+ }
if s.ReflectMethod {
flags |= 1 << 2
}