]> Cypherpunks.ru repositories - gostls13.git/blob - src/internal/goexperiment/flags.go
932df10ded175fd5f924951c019f7b2feea68b44
[gostls13.git] / src / internal / goexperiment / flags.go
1 // Copyright 2021 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // Package goexperiment implements support for toolchain experiments.
6 //
7 // Toolchain experiments are controlled by the GOEXPERIMENT
8 // environment variable. GOEXPERIMENT is a comma-separated list of
9 // experiment names. GOEXPERIMENT can be set at make.bash time, which
10 // sets the default experiments for binaries built with the tool
11 // chain; or it can be set at build time. GOEXPERIMENT can also be set
12 // to "none", which disables any experiments that were enabled at
13 // make.bash time.
14 //
15 // Experiments are exposed to the build in the following ways:
16 //
17 // - Build tag goexperiment.x is set if experiment x (lower case) is
18 // enabled.
19 //
20 // - For each experiment x (in camel case), this package contains a
21 // boolean constant x and an integer constant xInt.
22 //
23 // - In runtime assembly, the macro GOEXPERIMENT_x is defined if
24 // experiment x (lower case) is enabled.
25 //
26 // In the toolchain, the set of experiments enabled for the current
27 // build should be accessed via objabi.Experiment.
28 //
29 // The set of experiments is included in the output of runtime.Version()
30 // and "go version <binary>" if it differs from the default experiments.
31 //
32 // For the set of experiments supported by the current toolchain, see
33 // go doc internal/experiment.Flags.
34 package goexperiment
35
36 //go:generate go run mkconsts.go
37
38 // Flags is the set of experiments that can be enabled or disabled in
39 // the current toolchain.
40 //
41 // When specified in the GOEXPERIMENT environment variable or as build
42 // tags, experiments use the strings.ToLower of their field name.
43 //
44 // For the baseline experimental configuration, see
45 // objabi.experimentBaseline.
46 //
47 // If you change this struct definition, run "go generate".
48 type Flags struct {
49         FieldTrack        bool
50         PreemptibleLoops  bool
51         StaticLockRanking bool
52
53         // Regabi is split into several sub-experiments that can be
54         // enabled individually. GOEXPERIMENT=regabi implies the
55         // subset that are currently "working". Not all combinations work.
56         Regabi bool
57         // RegabiWrappers enables ABI wrappers for calling between
58         // ABI0 and ABIInternal functions. Without this, the ABIs are
59         // assumed to be identical so cross-ABI calls are direct.
60         RegabiWrappers bool
61         // RegabiG enables dedicated G and zero registers in
62         // ABIInternal.
63         //
64         // Requires wrappers because it makes the ABIs incompatible.
65         RegabiG bool
66         // RegabiReflect enables the register-passing paths in
67         // reflection calls. This is also gated by intArgRegs in
68         // reflect and runtime (which are disabled by default) so it
69         // can be used in targeted tests.
70         RegabiReflect bool
71         // RegabiDefer enables desugaring defer and go calls
72         // into argument-less closures.
73         RegabiDefer bool
74         // RegabiArgs enables register arguments/results in all
75         // compiled Go functions.
76         //
77         // Requires wrappers (to do ABI translation), g (because
78         // runtime assembly that's been ported to ABIInternal uses the
79         // G register), reflect (so reflection calls use registers),
80         // and defer (because the runtime doesn't support passing
81         // register arguments to defer/go).
82         RegabiArgs bool
83 }