arm: work around reg allocator bug in 5g, in two parts.

1) hack regalloc to leave R9 (m) and R10 (g) alone.
the real fix is tricker, but this gets us running
2) fix up the few places in the package sources that
the shortage of registers affects, by simplifying
some expressions.

all of this should be reverted when the right fix is in.

Fixes #1084.

R=rsc
CC=golang-dev
https://golang.org/cl/2132046
This commit is contained in:
Rob Pike 2010-09-10 20:55:29 -07:00
parent b9988edbb6
commit 0aa2317096
7 changed files with 53 additions and 17 deletions

View file

@ -213,6 +213,9 @@ regalloc(Node *n, Type *t, Node *o)
{ {
int i, et, fixfree, floatfree; int i, et, fixfree, floatfree;
// guarantee R9 and R10 (m and g) are left alone. BUG.
reg[9] = 1;
reg[10] = 1;
if(debug['r']) { if(debug['r']) {
fixfree = 0; fixfree = 0;
for(i=REGALLOC_R0; i<=REGALLOC_RMAX; i++) for(i=REGALLOC_R0; i<=REGALLOC_RMAX; i++)

View file

@ -110,8 +110,14 @@ func newHuffmanBitWriter(w io.Writer) *huffmanBitWriter {
} }
func (err WrongValueError) String() string { func (err WrongValueError) String() string {
return "huffmanBitWriter: " + err.name + " should belong to [" + strconv.Itoa64(int64(err.from)) + ";" + // BUG: work around bug in 5g by simplifying expression.
strconv.Itoa64(int64(err.to)) + "] but actual value is " + strconv.Itoa64(int64(err.value)) // return "huffmanBitWriter: " + err.name + " should belong to [" + strconv.Itoa64(int64(err.from)) + ";" +
// strconv.Itoa64(int64(err.to)) + "] but actual value is " + strconv.Itoa64(int64(err.value))
str := "huffmanBitWriter: " + err.name + " should belong to ["
str += strconv.Itoa64(int64(err.from)) + ";"
str += strconv.Itoa64(int64(err.to)) + "] but actual value is "
str += strconv.Itoa64(int64(err.value))
return str
} }
func (w *huffmanBitWriter) flushBits() { func (w *huffmanBitWriter) flushBits() {

View file

@ -867,9 +867,14 @@ func (dec *Decoder) compileDec(remoteId typeId, rt reflect.Type) (engine *decEng
continue continue
} }
if !dec.compatibleType(localField.Type, wireField.id) { if !dec.compatibleType(localField.Type, wireField.id) {
return nil, os.ErrorString("gob: wrong type (" + // BUG: work around bug in 5g by simplifying expression.
localField.Type.String() + ") for received field " + // return nil, os.ErrorString("gob: wrong type (" +
wireStruct.name + "." + wireField.name) // localField.Type.String() + ") for received field " +
// wireStruct.name + "." + wireField.name)
str := "gob: wrong type ("
str += localField.Type.String() + ") for received field "
str += wireStruct.name + "." + wireField.name
return nil, os.ErrorString(str)
} }
op, indir, err := dec.decOpFor(wireField.id, localField.Type, localField.Name) op, indir, err := dec.decOpFor(wireField.id, localField.Type, localField.Name)
if err != nil { if err != nil {

View file

@ -86,7 +86,11 @@ func (l *Logger) formatHeader(ns int64, calldepth int) string {
if l.flag&(Ldate|Ltime|Lmicroseconds) != 0 { if l.flag&(Ldate|Ltime|Lmicroseconds) != 0 {
t := time.SecondsToLocalTime(ns / 1e9) t := time.SecondsToLocalTime(ns / 1e9)
if l.flag&(Ldate) != 0 { if l.flag&(Ldate) != 0 {
h += itoa(int(t.Year), 4) + "/" + itoa(t.Month, 2) + "/" + itoa(t.Day, 2) + " " // BUG: work around bug in 5g by simplifying expression.
// h += itoa(int(t.Year), 4) + "/" + itoa(t.Month, 2) + "/" + itoa(t.Day, 2) + " "
h += itoa(int(t.Year), 4)
h += "/" + itoa(t.Month, 2)
h += "/" + itoa(t.Day, 2) + " "
} }
if l.flag&(Ltime|Lmicroseconds) != 0 { if l.flag&(Ltime|Lmicroseconds) != 0 {
h += itoa(t.Hour, 2) + ":" + itoa(t.Minute, 2) + ":" + itoa(t.Second, 2) h += itoa(t.Hour, 2) + ":" + itoa(t.Minute, 2) + ":" + itoa(t.Second, 2)

View file

@ -200,10 +200,16 @@ func (ip IP) String() string {
// If IPv4, use dotted notation. // If IPv4, use dotted notation.
if p4 := p.To4(); len(p4) == 4 { if p4 := p.To4(); len(p4) == 4 {
return itod(uint(p4[0])) + "." + // BUG: work around bug in 5g by simplifying expression.
itod(uint(p4[1])) + "." + // return itod(uint(p4[0])) + "." +
itod(uint(p4[2])) + "." + // itod(uint(p4[1])) + "." +
itod(uint(p4[3])) // itod(uint(p4[2])) + "." +
// itod(uint(p4[3]))
str := itod(uint(p4[0])) + "."
str += itod(uint(p4[1])) + "."
str += itod(uint(p4[2])) + "."
str += itod(uint(p4[3]))
return str
} }
if len(p) != IPv6len { if len(p) != IPv6len {
return "?" return "?"

View file

@ -356,11 +356,17 @@ type ParseError struct {
// String is the string representation of a ParseError. // String is the string representation of a ParseError.
func (e *ParseError) String() string { func (e *ParseError) String() string {
if e.Message == "" { if e.Message == "" {
return "parsing time " + // BUG: work around bug in 5g by simplifying expression.
strconv.Quote(e.Value) + " as " + // return "parsing time " +
strconv.Quote(e.Layout) + ": cannot parse " + // strconv.Quote(e.Value) + " as " +
strconv.Quote(e.ValueElem) + " as " + // strconv.Quote(e.Layout) + ": cannot parse " +
strconv.Quote(e.LayoutElem) // strconv.Quote(e.ValueElem) + " as " +
// strconv.Quote(e.LayoutElem)
str := "parsing time " + strconv.Quote(e.Value) + " as "
str += strconv.Quote(e.Layout) + ": cannot parse "
str += strconv.Quote(e.ValueElem) + " as "
str += strconv.Quote(e.LayoutElem)
return str
} }
return "parsing time " + return "parsing time " +
strconv.Quote(e.Value) + e.Message strconv.Quote(e.Value) + e.Message

View file

@ -371,8 +371,14 @@ func (p *Parser) popElement(t *EndElement) bool {
p.err = p.syntaxError("element <" + s.name.Local + "> closed by </" + name.Local + ">") p.err = p.syntaxError("element <" + s.name.Local + "> closed by </" + name.Local + ">")
return false return false
case s.name.Space != name.Space: case s.name.Space != name.Space:
p.err = p.syntaxError("element <" + s.name.Local + "> in space " + s.name.Space + // BUG: work around bug in 5g by simplifying expression.
"closed by </" + name.Local + "> in space " + name.Space) // p.err = p.syntaxError("element <" + s.name.Local + "> in space " + s.name.Space +
// "closed by </" + name.Local + "> in space " + name.Space)
str := "element <" + s.name.Local
str += "> in space " + s.name.Space
str += "closed by </" + name.Local
str += "> in space " + name.Space
p.err = p.syntaxError(str)
return false return false
} }