]> Cypherpunks.ru repositories - gostls13.git/commit
runtime: access modules via a slice
authorDavid Crawshaw <crawshaw@golang.org>
Mon, 31 Oct 2016 00:30:38 +0000 (20:30 -0400)
committerDavid Crawshaw <crawshaw@golang.org>
Tue, 1 Nov 2016 16:04:12 +0000 (16:04 +0000)
commit54ec7b072e017f7351f889f9f5b31bbf53a44119
tree8e1520eca08765335b77ef904f4ad0f9a2d865b8
parent807a7ebd5107b44ca93849f2b12b61bc4cacca10
runtime: access modules via a slice

The introduction of -buildmode=plugin means modules can be added to a
Go program while it is running. This means there exists some time
while the program is running with the module is on the moduledata
linked list, but it has not been initialized to the satisfaction of
other parts of the runtime. Notably, the GC.

This CL adds a new way of access modules, an activeModules function.
It returns a slice of modules that is built in the background and
atomically swapped in. The parts of the runtime that need to wait on
module initialization can use this slice instead of the linked list.

Fixes #17455

Change-Id: I04790fd07e40c7295beb47cea202eb439206d33d
Reviewed-on: https://go-review.googlesource.com/32357
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/cgocall.go
src/runtime/cgocheck.go
src/runtime/iface.go
src/runtime/mbitmap.go
src/runtime/mgc.go
src/runtime/mgcmark.go
src/runtime/plugin.go
src/runtime/proc.go
src/runtime/runtime1.go
src/runtime/symtab.go
src/runtime/type.go