]> Cypherpunks repositories - gostls13.git/commitdiff
5g, 6g, 8g: flush modified globals aggressively
authorRuss Cox <rsc@golang.org>
Mon, 20 Feb 2012 18:41:44 +0000 (13:41 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 20 Feb 2012 18:41:44 +0000 (13:41 -0500)
The alternative is to record enough information that the
trap handler know which registers contain cached globals
and can flush the registers back to their original locations.
That's significantly more work.

This only affects globals that have been written to.
Code that reads from a global should continue to registerize
as well as before.

Fixes #1304.

R=ken2
CC=golang-dev
https://golang.org/cl/5687046

src/cmd/5g/reg.c
src/cmd/6g/reg.c
src/cmd/8g/reg.c

index b72b9c1657ea6283b5cba496d7e1c2538850656a..93724d03265ac25fc9a10b40819bc4f85df0ee9d 100644 (file)
@@ -1029,6 +1029,13 @@ prop(Reg *r, Bits ref, Bits cal)
                                ref.b[z] = 0;
                        }
                        break;
+
+               default:
+                       // Work around for issue 1304:
+                       // flush modified globals before each instruction.
+                       for(z=0; z<BITS; z++)
+                               cal.b[z] |= externs.b[z];
+                       break;
                }
                for(z=0; z<BITS; z++) {
                        ref.b[z] = (ref.b[z] & ~r1->set.b[z]) |
index 82a2ce31255498e7768556b9330f179255c1935c..bed9f8da68bd9c4ec55af8644cc0340315898e06 100644 (file)
@@ -1085,6 +1085,13 @@ prop(Reg *r, Bits ref, Bits cal)
                                ref.b[z] = 0;
                        }
                        break;
+
+               default:
+                       // Work around for issue 1304:
+                       // flush modified globals before each instruction.
+                       for(z=0; z<BITS; z++)
+                               cal.b[z] |= externs.b[z];
+                       break;
                }
                for(z=0; z<BITS; z++) {
                        ref.b[z] = (ref.b[z] & ~r1->set.b[z]) |
index 4ff68625d211fab05499bf637cab549b91d22e41..29270c8203a3b956bfda50142153194446806df2 100644 (file)
@@ -968,6 +968,13 @@ prop(Reg *r, Bits ref, Bits cal)
                                ref.b[z] = 0;
                        }
                        break;
+
+               default:
+                       // Work around for issue 1304:
+                       // flush modified globals before each instruction.
+                       for(z=0; z<BITS; z++)
+                               cal.b[z] |= externs.b[z];
+                       break;
                }
                for(z=0; z<BITS; z++) {
                        ref.b[z] = (ref.b[z] & ~r1->set.b[z]) |