diff options
Diffstat (limited to 'src/pkg/runtime/runtime.h')
-rw-r--r-- | src/pkg/runtime/runtime.h | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h index 864b2aa5f..cb72b92d6 100644 --- a/src/pkg/runtime/runtime.h +++ b/src/pkg/runtime/runtime.h @@ -50,11 +50,11 @@ typedef uint8 byte; typedef struct Func Func; typedef struct G G; typedef struct Gobuf Gobuf; -typedef union Lock Lock; +typedef struct Lock Lock; typedef struct M M; typedef struct P P; typedef struct Mem Mem; -typedef union Note Note; +typedef struct Note Note; typedef struct Slice Slice; typedef struct Stktop Stktop; typedef struct String String; @@ -156,15 +156,19 @@ enum /* * structures */ -union Lock +struct Lock { - uint32 key; // futex-based impl - M* waitm; // linked list of waiting M's (sema-based impl) + // Futex-based impl treats it as uint32 key, + // while sema-based impl as M* waitm. + // Used to be a union, but unions break precise GC. + uintptr key; }; -union Note +struct Note { - uint32 key; // futex-based impl - M* waitm; // waiting M (sema-based impl) + // Futex-based impl treats it as uint32 key, + // while sema-based impl as M* waitm. + // Used to be a union, but unions break precise GC. + uintptr key; }; struct String { @@ -317,7 +321,7 @@ struct M bool needextram; void* racepc; void (*waitunlockf)(Lock*); - Lock* waitlock; + void* waitlock; uint32 moreframesize_minalloc; uintptr settype_buf[1024]; @@ -507,7 +511,7 @@ struct ParFor struct CgoMal { CgoMal *next; - byte *alloc; + void *alloc; }; /* |