diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-01-09 19:37:19 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-01-09 19:37:19 +0000 |
commit | 2193ad7fbf3e917a0ef5a2b48e13f84da1be44f1 (patch) | |
tree | 979f6f9c20889cbbef8a131ed63b6e7f4b7216f6 /libgo/runtime/mgc0.c | |
parent | d1261ac6eb62f0c589ef314c61884ab445e5552b (diff) | |
download | gcc-2193ad7fbf3e917a0ef5a2b48e13f84da1be44f1.zip gcc-2193ad7fbf3e917a0ef5a2b48e13f84da1be44f1.tar.gz gcc-2193ad7fbf3e917a0ef5a2b48e13f84da1be44f1.tar.bz2 |
runtime: copy more of scheduler from Go 1.7 runtime
This started by moving procresize from C to Go so that we can pass the
right type to the memory allocator when allocating a p, which forced
the gomaxprocs variable to move from C to Go, and everything else
followed from that.
Reviewed-on: https://go-review.googlesource.com/34916
From-SVN: r244236
Diffstat (limited to 'libgo/runtime/mgc0.c')
-rw-r--r-- | libgo/runtime/mgc0.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/libgo/runtime/mgc0.c b/libgo/runtime/mgc0.c index 5d6275a..156db0f 100644 --- a/libgo/runtime/mgc0.c +++ b/libgo/runtime/mgc0.c @@ -7,7 +7,7 @@ // GC is: // - mark&sweep // - mostly precise (with the exception of some C-allocated objects, assembly frames/arguments, etc) -// - parallel (up to MaxGcproc threads) +// - parallel (up to _MaxGcproc threads) // - partially concurrent (mark is stop-the-world, while sweep is concurrent) // - non-moving/non-compacting // - full (non-partial) @@ -389,7 +389,7 @@ struct BufferList uint32 busy; byte pad[CacheLineSize]; }; -static BufferList bufferList[MaxGcproc]; +static BufferList bufferList[_MaxGcproc]; static void enqueue(Obj obj, Workbuf **_wbuf, Obj **_wp, uintptr *_nobj); @@ -2228,7 +2228,7 @@ gc(struct gc_args *args) m->locks++; // disable gc during mallocs in parforalloc if(work.markfor == nil) - work.markfor = runtime_parforalloc(MaxGcproc); + work.markfor = runtime_parforalloc(_MaxGcproc); m->locks--; tm1 = 0; @@ -2355,7 +2355,7 @@ gc(struct gc_args *args) sweep.g = __go_go(bgsweep, nil); else if(sweep.parked) { sweep.parked = false; - runtime_ready(sweep.g); + runtime_ready(sweep.g, 0, true); } runtime_unlock(&gclock); } else { @@ -2429,7 +2429,7 @@ gchelperstart(void) M *m; m = runtime_m(); - if(m->helpgc < 0 || m->helpgc >= MaxGcproc) + if(m->helpgc < 0 || m->helpgc >= _MaxGcproc) runtime_throw("gchelperstart: bad m->helpgc"); if(runtime_xchg(&bufferList[m->helpgc].busy, 1)) runtime_throw("gchelperstart: already busy"); @@ -2541,6 +2541,20 @@ runtime_createfing(void) runtime_unlock(&gclock); } +bool getfingwait() __asm__(GOSYM_PREFIX "runtime.getfingwait"); +bool +getfingwait() +{ + return runtime_fingwait; +} + +bool getfingwake() __asm__(GOSYM_PREFIX "runtime.getfingwake"); +bool +getfingwake() +{ + return runtime_fingwake; +} + G* runtime_wakefing(void) { |