]> Cypherpunks repositories - gostls13.git/commitdiff
arm: work around reg allocator bug in 5g, in two parts.
authorRob Pike <r@golang.org>
Sat, 11 Sep 2010 03:55:29 +0000 (20:55 -0700)
committerRob Pike <r@golang.org>
Sat, 11 Sep 2010 03:55:29 +0000 (20:55 -0700)
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

src/cmd/5g/gsubr.c
src/pkg/compress/flate/huffman_bit_writer.go
src/pkg/gob/decode.go
src/pkg/log/log.go
src/pkg/net/ip.go
src/pkg/time/format.go
src/pkg/xml/xml.go

index 70ebad6edd075f88b2d1e9dcd5432776da862f6d..584a0f62b84f1e7ef26b4ff9390e0f40b0ea10b2 100644 (file)
@@ -213,6 +213,9 @@ regalloc(Node *n, Type *t, Node *o)
 {
        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']) {
                fixfree = 0;
                for(i=REGALLOC_R0; i<=REGALLOC_RMAX; i++)
index abff82dd694bd21fff203132b3524c652aca428e..294cdf65329d841d5202a331e195e2b454f4cf08 100644 (file)
@@ -110,8 +110,14 @@ func newHuffmanBitWriter(w io.Writer) *huffmanBitWriter {
 }
 
 func (err WrongValueError) String() string {
-       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))
+       // BUG: work around bug in 5g by simplifying expression.
+       // 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() {
index a70799e9a729997d4770fc670629df3756f98180..a91a98bf15781bf4ce3fb65ed390c328e397810d 100644 (file)
@@ -867,9 +867,14 @@ func (dec *Decoder) compileDec(remoteId typeId, rt reflect.Type) (engine *decEng
                        continue
                }
                if !dec.compatibleType(localField.Type, wireField.id) {
-                       return nil, os.ErrorString("gob: wrong type (" +
-                               localField.Type.String() + ") for received field " +
-                               wireStruct.name + "." + wireField.name)
+                       // BUG: work around bug in 5g by simplifying expression.
+                       // return nil, os.ErrorString("gob: wrong type (" +
+                       //      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)
                if err != nil {
index 28d6204eb68ecee3e5525f18eb2c584426253bf4..cfc1bd7767fd27203ee56292e1f35436f4f591f1 100644 (file)
@@ -86,7 +86,11 @@ func (l *Logger) formatHeader(ns int64, calldepth int) string {
        if l.flag&(Ldate|Ltime|Lmicroseconds) != 0 {
                t := time.SecondsToLocalTime(ns / 1e9)
                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 {
                        h += itoa(t.Hour, 2) + ":" + itoa(t.Minute, 2) + ":" + itoa(t.Second, 2)
index e82224a28364274e55fb51b410481b430053ac18..29a72971f5ac530e311991fb54de511de52a85ea 100644 (file)
@@ -200,10 +200,16 @@ func (ip IP) String() string {
 
        // If IPv4, use dotted notation.
        if p4 := p.To4(); len(p4) == 4 {
-               return itod(uint(p4[0])) + "." +
-                       itod(uint(p4[1])) + "." +
-                       itod(uint(p4[2])) + "." +
-                       itod(uint(p4[3]))
+               // BUG: work around bug in 5g by simplifying expression.
+               // return itod(uint(p4[0])) + "." +
+               //      itod(uint(p4[1])) + "." +
+               //      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 {
                return "?"
index 355721e1839d2725e5a8d59ee91306f7eb4115f2..bc94cb78e2447bfb9ce2f479edcad320536319af 100644 (file)
@@ -356,11 +356,17 @@ type ParseError struct {
 // String is the string representation of a ParseError.
 func (e *ParseError) String() string {
        if e.Message == "" {
-               return "parsing time " +
-                       strconv.Quote(e.Value) + " as " +
-                       strconv.Quote(e.Layout) + ": cannot parse " +
-                       strconv.Quote(e.ValueElem) + " as " +
-                       strconv.Quote(e.LayoutElem)
+               // BUG: work around bug in 5g by simplifying expression.
+               // return "parsing time " +
+               //      strconv.Quote(e.Value) + " as " +
+               //      strconv.Quote(e.Layout) + ": cannot parse " +
+               //      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 " +
                strconv.Quote(e.Value) + e.Message
index cd67f6e2657fc9faf5c2960c12f91e0bcded5b10..c72d726c76e7908a637623c14849539b27dcc73c 100644 (file)
@@ -371,8 +371,14 @@ func (p *Parser) popElement(t *EndElement) bool {
                p.err = p.syntaxError("element <" + s.name.Local + "> closed by </" + name.Local + ">")
                return false
        case s.name.Space != name.Space:
-               p.err = p.syntaxError("element <" + s.name.Local + "> in space " + s.name.Space +
-                       "closed by </" + name.Local + "> in space " + name.Space)
+               // BUG: work around bug in 5g by simplifying expression.
+               // 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
        }