mirror of
https://github.com/golang/go
synced 2024-11-18 00:24:48 -07:00
cmd/internal/obj: eagerly initialize x86 assembler
Prior to this CL, instinit was called as needed. This does not work well in a concurrent backend. Initialization is very cheap; do it on startup instead. Passes toolstash-check -all. No compiler performance impact. Updates #15756 Change-Id: Ifa5e82e8abf4504435e1b28766f5703a0555f42d Reviewed-on: https://go-review.googlesource.com/38662 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
e76d6a456b
commit
3b251e603d
@ -171,6 +171,8 @@ func archX86(linkArch *obj.LinkArch) *Arch {
|
|||||||
instructions["PSRLDQ"] = x86.APSRLO
|
instructions["PSRLDQ"] = x86.APSRLO
|
||||||
instructions["PADDD"] = x86.APADDL
|
instructions["PADDD"] = x86.APADDL
|
||||||
|
|
||||||
|
x86.InstInit()
|
||||||
|
|
||||||
return &Arch{
|
return &Arch{
|
||||||
LinkArch: linkArch,
|
LinkArch: linkArch,
|
||||||
Instructions: instructions,
|
Instructions: instructions,
|
||||||
|
@ -27,4 +27,6 @@ func Init(arch *gc.Arch) {
|
|||||||
arch.SSAMarkMoves = ssaMarkMoves
|
arch.SSAMarkMoves = ssaMarkMoves
|
||||||
arch.SSAGenValue = ssaGenValue
|
arch.SSAGenValue = ssaGenValue
|
||||||
arch.SSAGenBlock = ssaGenBlock
|
arch.SSAGenBlock = ssaGenBlock
|
||||||
|
|
||||||
|
x86.InstInit()
|
||||||
}
|
}
|
||||||
|
@ -33,4 +33,6 @@ func Init(arch *gc.Arch) {
|
|||||||
arch.Ginsnop = ginsnop
|
arch.Ginsnop = ginsnop
|
||||||
|
|
||||||
arch.SSAMarkMoves = ssaMarkMoves
|
arch.SSAMarkMoves = ssaMarkMoves
|
||||||
|
|
||||||
|
x86.InstInit()
|
||||||
}
|
}
|
||||||
|
@ -883,8 +883,8 @@ var ymmxmm0f38 = []ytab{
|
|||||||
* two values match the Ytypes of the p->from and p->to operands. The function
|
* two values match the Ytypes of the p->from and p->to operands. The function
|
||||||
* oclass in span.c computes the specific Ytype of an operand and then the set
|
* oclass in span.c computes the specific Ytype of an operand and then the set
|
||||||
* of more general Ytypes that it satisfies is implied by the ycover table, set
|
* of more general Ytypes that it satisfies is implied by the ycover table, set
|
||||||
* up in instinit. For example, oclass distinguishes the constants 0 and 1
|
* up in InstInit. For example, oclass distinguishes the constants 0 and 1
|
||||||
* from the more general 8-bit constants, but instinit says
|
* from the more general 8-bit constants, but InstInit says
|
||||||
*
|
*
|
||||||
* ycover[Yi0*Ymax + Ys32] = 1;
|
* ycover[Yi0*Ymax + Ys32] = 1;
|
||||||
* ycover[Yi1*Ymax + Ys32] = 1;
|
* ycover[Yi1*Ymax + Ys32] = 1;
|
||||||
@ -1770,7 +1770,7 @@ func span6(ctxt *obj.Link, s *obj.LSym) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ycover[0] == 0 {
|
if ycover[0] == 0 {
|
||||||
instinit()
|
ctxt.Diag("x86 tables not initialized, call x86.InstInit first")
|
||||||
}
|
}
|
||||||
|
|
||||||
for p := ctxt.Cursym.Text; p != nil; p = p.Link {
|
for p := ctxt.Cursym.Text; p != nil; p = p.Link {
|
||||||
@ -1965,7 +1965,14 @@ func span6(ctxt *obj.Link, s *obj.LSym) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func instinit() {
|
func InstInit() {
|
||||||
|
if ycover[0] != 0 {
|
||||||
|
// Already initialized; stop now.
|
||||||
|
// This happens in the cmd/asm tests,
|
||||||
|
// each of which re-initializes the arch.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
for i := 1; optab[i].as != 0; i++ {
|
for i := 1; optab[i].as != 0; i++ {
|
||||||
c := optab[i].as
|
c := optab[i].as
|
||||||
if opindex[c&obj.AMask] != nil {
|
if opindex[c&obj.AMask] != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user