aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/runtime.h
diff options
context:
space:
mode:
authorRick Hudson <rlh@golang.org>2014-09-03 12:06:36 -0400
committerRick Hudson <rlh@golang.org>2014-09-03 12:06:36 -0400
commit56bd176e1d5f0145936128c0dc1f931cc5a84c0b (patch)
tree19819821b463bc0b875143c633cdbdbe80f1f099 /src/pkg/runtime/runtime.h
parentf44073785a99c2b6656156fe42055f81d29f5e1a (diff)
downloadgo-56bd176e1d5f0145936128c0dc1f931cc5a84c0b.tar.xz
runtime: Start and stop individual goroutines at gc safepoints
Code to bring goroutines to a gc safepoint one at a time, do some work such as scanning, and restart the goroutine, and then move on to the next goroutine. Currently this code does not do much useful work but this infrastructure will be critical to future concurrent GC work. Fixed comments reviewers. LGTM=rsc R=golang-codereviews, rsc, dvyukov CC=golang-codereviews https://golang.org/cl/131580043
Diffstat (limited to 'src/pkg/runtime/runtime.h')
-rw-r--r--src/pkg/runtime/runtime.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h
index 0d25ca6c51..84a373cd51 100644
--- a/src/pkg/runtime/runtime.h
+++ b/src/pkg/runtime/runtime.h
@@ -292,7 +292,7 @@ struct G
bool preempt; // preemption signal, duplicates stackguard0 = StackPreempt
bool paniconfault; // panic (instead of crash) on unexpected fault address
bool preemptscan; // preempted g does scan for GC
- bool scancheck; // debug: cleared at begining of scan cycle, set by scan, tested at end of cycle
+ bool gcworkdone; // debug: cleared at begining of gc work phase cycle, set by gcphasework, tested at end of cycle
int8 raceignore; // ignore race detection events
M* m; // for debuggers, but offset not hard-coded
M* lockedm;
@@ -579,6 +579,16 @@ struct DebugVars
int32 scavenge;
};
+// Indicates to write barrier and sychronization task to preform.
+enum
+{ // Synchronization Write barrier
+ GCoff, // stop and start nop
+ GCquiesce, // stop and start nop
+ GCstw, // stop the ps nop
+ GCmark, // scan the stacks and start no white to black
+ GCsweep, // stop and start nop
+};
+
struct ForceGCState
{
Mutex lock;
@@ -586,6 +596,7 @@ struct ForceGCState
uint32 idle;
};
+extern uint32 runtime·gcphase;
extern bool runtime·precisestack;
extern bool runtime·copystack;
@@ -614,8 +625,12 @@ enum {
HashRandomBytes = 32
};
-uint32 runtime·readgstatus(G *gp);
+uint32 runtime·readgstatus(G*);
void runtime·casgstatus(G*, uint32, uint32);
+void runtime·quiesce(G*);
+bool runtime·stopg(G*);
+void runtime·restartg(G*);
+void runtime·gcphasework(G*);
/*
* deferred subroutine calls