Commit 89988355 authored by Russ Cox's avatar Russ Cox

5g, 6g, 8g: flush modified globals aggressively

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
parent f274551f
...@@ -1029,6 +1029,13 @@ prop(Reg *r, Bits ref, Bits cal) ...@@ -1029,6 +1029,13 @@ prop(Reg *r, Bits ref, Bits cal)
ref.b[z] = 0; ref.b[z] = 0;
} }
break; 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++) { for(z=0; z<BITS; z++) {
ref.b[z] = (ref.b[z] & ~r1->set.b[z]) | ref.b[z] = (ref.b[z] & ~r1->set.b[z]) |
......
...@@ -1085,6 +1085,13 @@ prop(Reg *r, Bits ref, Bits cal) ...@@ -1085,6 +1085,13 @@ prop(Reg *r, Bits ref, Bits cal)
ref.b[z] = 0; ref.b[z] = 0;
} }
break; 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++) { for(z=0; z<BITS; z++) {
ref.b[z] = (ref.b[z] & ~r1->set.b[z]) | ref.b[z] = (ref.b[z] & ~r1->set.b[z]) |
......
...@@ -968,6 +968,13 @@ prop(Reg *r, Bits ref, Bits cal) ...@@ -968,6 +968,13 @@ prop(Reg *r, Bits ref, Bits cal)
ref.b[z] = 0; ref.b[z] = 0;
} }
break; 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++) { for(z=0; z<BITS; z++) {
ref.b[z] = (ref.b[z] & ~r1->set.b[z]) | ref.b[z] = (ref.b[z] & ~r1->set.b[z]) |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment