]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: shuffle and simplify sync markers
authorMatthew Dempsky <mdempsky@google.com>
Mon, 14 Feb 2022 16:54:37 +0000 (08:54 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 1 Mar 2022 07:35:26 +0000 (07:35 +0000)
Change-Id: I5894ac4697212267380b7a03876927bbf3e1de2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/385999
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/compile/internal/noder/sync.go
src/cmd/compile/internal/noder/syncmarker_string.go

index 7af558f8b207aee4f645b554a9e33981f8aaaad3..6343496beeddbdbcdd8677d93916bff749f0f716 100644 (file)
@@ -43,86 +43,68 @@ type syncMarker int
 
 //go:generate stringer -type=syncMarker -trimprefix=sync
 
-// TODO(mdempsky): Cleanup unneeded sync markers.
-
-// TODO(mdempsky): Split these markers into public/stable markers, and
-// private ones. Also, trim unused ones.
 const (
        _ syncMarker = iota
-       syncNode
+
+       // Public markers (known to go/types importers).
+
+       // Low-level coding markers.
+
+       syncEOF
        syncBool
        syncInt64
        syncUint64
        syncString
+       syncValue
+       syncVal
+       syncRelocs
+       syncReloc
+       syncUseReloc
+
+       // Higher-level object and type markers.
+       syncPublic
        syncPos
+       syncPosBase
+       syncObject
+       syncObject1
        syncPkg
-       syncSym
-       syncSelector
-       syncKind
+       syncPkgDef
+       syncMethod
        syncType
-       syncTypePkg
+       syncTypeIdx
+       syncTypeParamNames
        syncSignature
+       syncParams
        syncParam
-       syncOp
-       syncObject
+       syncCodeObj
+       syncSym
+       syncLocalIdent
+       syncSelector
+
+       // Private markers (only known to cmd/compile).
+       syncPrivate
+
+       syncFuncExt
+       syncVarExt
+       syncTypeExt
+       syncPragma
+
+       syncExprList
+       syncExprs
        syncExpr
-       syncStmt
+       syncOp
+       syncFuncLit
+       syncCompLit
+
        syncDecl
-       syncConstDecl
-       syncFuncDecl
-       syncTypeDecl
-       syncVarDecl
-       syncPragma
-       syncValue
-       syncEOF
-       syncMethod
        syncFuncBody
-       syncUse
-       syncUseObj
-       syncObjectIdx
-       syncTypeIdx
-       syncBOF
-       syncEntry
        syncOpenScope
        syncCloseScope
-       syncGlobal
-       syncLocal
-       syncDefine
-       syncDefLocal
-       syncUseLocal
-       syncDefGlobal
-       syncUseGlobal
-       syncTypeParams
-       syncUseLabel
-       syncDefLabel
-       syncFuncLit
-       syncCommonFunc
-       syncBodyRef
-       syncLinksymExt
-       syncHack
-       syncSetlineno
-       syncName
-       syncImportDecl
+       syncCloseAnotherScope
        syncDeclNames
        syncDeclName
-       syncExprList
-       syncExprs
-       syncWrapname
-       syncTypeExpr
-       syncTypeExprOrNil
-       syncChanDir
-       syncParams
-       syncCloseAnotherScope
-       syncSum
-       syncUnOp
-       syncBinOp
-       syncStructType
-       syncInterfaceType
-       syncPackname
-       syncEmbedded
+
        syncStmts
-       syncStmtsFall
-       syncStmtFall
        syncBlockStmt
        syncIfStmt
        syncForStmt
@@ -133,55 +115,11 @@ const (
        syncSelectStmt
        syncDecls
        syncLabeledStmt
-       syncCompLit
-
-       sync1
-       sync2
-       sync3
-       sync4
-
-       syncN
-       syncDefImplicit
-       syncUseName
        syncUseObjLocal
        syncAddLocal
-       syncBothSignature
-       syncSetUnderlying
        syncLinkname
        syncStmt1
        syncStmtsEnd
-       syncDeclare
-       syncTopDecls
-       syncTopConstDecl
-       syncTopFuncDecl
-       syncTopTypeDecl
-       syncTopVarDecl
-       syncObject1
-       syncAddBody
        syncLabel
-       syncFuncExt
-       syncMethExt
        syncOptLabel
-       syncScalar
-       syncStmtDecls
-       syncDeclLocal
-       syncObjLocal
-       syncObjLocal1
-       syncDeclareLocal
-       syncPublic
-       syncPrivate
-       syncRelocs
-       syncReloc
-       syncUseReloc
-       syncVarExt
-       syncPkgDef
-       syncTypeExt
-       syncVal
-       syncCodeObj
-       syncPosBase
-       syncLocalIdent
-       syncTypeParamNames
-       syncTypeParamBounds
-       syncImplicitTypes
-       syncObjectName
 )
index 655cafc9502d25332bdb9c69b50a77147b701c26..1ee848cda88abccc7a97abd11a7f2f79acf46672 100644 (file)
@@ -8,144 +8,75 @@ func _() {
        // An "invalid array index" compiler error signifies that the constant values have changed.
        // Re-run the stringer command to generate them again.
        var x [1]struct{}
-       _ = x[syncNode-1]
+       _ = x[syncEOF-1]
        _ = x[syncBool-2]
        _ = x[syncInt64-3]
        _ = x[syncUint64-4]
        _ = x[syncString-5]
-       _ = x[syncPos-6]
-       _ = x[syncPkg-7]
-       _ = x[syncSym-8]
-       _ = x[syncSelector-9]
-       _ = x[syncKind-10]
-       _ = x[syncType-11]
-       _ = x[syncTypePkg-12]
-       _ = x[syncSignature-13]
-       _ = x[syncParam-14]
-       _ = x[syncOp-15]
-       _ = x[syncObject-16]
-       _ = x[syncExpr-17]
-       _ = x[syncStmt-18]
-       _ = x[syncDecl-19]
-       _ = x[syncConstDecl-20]
-       _ = x[syncFuncDecl-21]
-       _ = x[syncTypeDecl-22]
-       _ = x[syncVarDecl-23]
-       _ = x[syncPragma-24]
-       _ = x[syncValue-25]
-       _ = x[syncEOF-26]
-       _ = x[syncMethod-27]
-       _ = x[syncFuncBody-28]
-       _ = x[syncUse-29]
-       _ = x[syncUseObj-30]
-       _ = x[syncObjectIdx-31]
-       _ = x[syncTypeIdx-32]
-       _ = x[syncBOF-33]
-       _ = x[syncEntry-34]
-       _ = x[syncOpenScope-35]
-       _ = x[syncCloseScope-36]
-       _ = x[syncGlobal-37]
-       _ = x[syncLocal-38]
-       _ = x[syncDefine-39]
-       _ = x[syncDefLocal-40]
-       _ = x[syncUseLocal-41]
-       _ = x[syncDefGlobal-42]
-       _ = x[syncUseGlobal-43]
-       _ = x[syncTypeParams-44]
-       _ = x[syncUseLabel-45]
-       _ = x[syncDefLabel-46]
-       _ = x[syncFuncLit-47]
-       _ = x[syncCommonFunc-48]
-       _ = x[syncBodyRef-49]
-       _ = x[syncLinksymExt-50]
-       _ = x[syncHack-51]
-       _ = x[syncSetlineno-52]
-       _ = x[syncName-53]
-       _ = x[syncImportDecl-54]
-       _ = x[syncDeclNames-55]
-       _ = x[syncDeclName-56]
-       _ = x[syncExprList-57]
-       _ = x[syncExprs-58]
-       _ = x[syncWrapname-59]
-       _ = x[syncTypeExpr-60]
-       _ = x[syncTypeExprOrNil-61]
-       _ = x[syncChanDir-62]
-       _ = x[syncParams-63]
-       _ = x[syncCloseAnotherScope-64]
-       _ = x[syncSum-65]
-       _ = x[syncUnOp-66]
-       _ = x[syncBinOp-67]
-       _ = x[syncStructType-68]
-       _ = x[syncInterfaceType-69]
-       _ = x[syncPackname-70]
-       _ = x[syncEmbedded-71]
-       _ = x[syncStmts-72]
-       _ = x[syncStmtsFall-73]
-       _ = x[syncStmtFall-74]
-       _ = x[syncBlockStmt-75]
-       _ = x[syncIfStmt-76]
-       _ = x[syncForStmt-77]
-       _ = x[syncSwitchStmt-78]
-       _ = x[syncRangeStmt-79]
-       _ = x[syncCaseClause-80]
-       _ = x[syncCommClause-81]
-       _ = x[syncSelectStmt-82]
-       _ = x[syncDecls-83]
-       _ = x[syncLabeledStmt-84]
-       _ = x[syncCompLit-85]
-       _ = x[sync1-86]
-       _ = x[sync2-87]
-       _ = x[sync3-88]
-       _ = x[sync4-89]
-       _ = x[syncN-90]
-       _ = x[syncDefImplicit-91]
-       _ = x[syncUseName-92]
-       _ = x[syncUseObjLocal-93]
-       _ = x[syncAddLocal-94]
-       _ = x[syncBothSignature-95]
-       _ = x[syncSetUnderlying-96]
-       _ = x[syncLinkname-97]
-       _ = x[syncStmt1-98]
-       _ = x[syncStmtsEnd-99]
-       _ = x[syncDeclare-100]
-       _ = x[syncTopDecls-101]
-       _ = x[syncTopConstDecl-102]
-       _ = x[syncTopFuncDecl-103]
-       _ = x[syncTopTypeDecl-104]
-       _ = x[syncTopVarDecl-105]
-       _ = x[syncObject1-106]
-       _ = x[syncAddBody-107]
-       _ = x[syncLabel-108]
-       _ = x[syncFuncExt-109]
-       _ = x[syncMethExt-110]
-       _ = x[syncOptLabel-111]
-       _ = x[syncScalar-112]
-       _ = x[syncStmtDecls-113]
-       _ = x[syncDeclLocal-114]
-       _ = x[syncObjLocal-115]
-       _ = x[syncObjLocal1-116]
-       _ = x[syncDeclareLocal-117]
-       _ = x[syncPublic-118]
-       _ = x[syncPrivate-119]
-       _ = x[syncRelocs-120]
-       _ = x[syncReloc-121]
-       _ = x[syncUseReloc-122]
-       _ = x[syncVarExt-123]
-       _ = x[syncPkgDef-124]
-       _ = x[syncTypeExt-125]
-       _ = x[syncVal-126]
-       _ = x[syncCodeObj-127]
-       _ = x[syncPosBase-128]
-       _ = x[syncLocalIdent-129]
-       _ = x[syncTypeParamNames-130]
-       _ = x[syncTypeParamBounds-131]
-       _ = x[syncImplicitTypes-132]
-       _ = x[syncObjectName-133]
+       _ = x[syncValue-6]
+       _ = x[syncVal-7]
+       _ = x[syncRelocs-8]
+       _ = x[syncReloc-9]
+       _ = x[syncUseReloc-10]
+       _ = x[syncPublic-11]
+       _ = x[syncPos-12]
+       _ = x[syncPosBase-13]
+       _ = x[syncObject-14]
+       _ = x[syncObject1-15]
+       _ = x[syncPkg-16]
+       _ = x[syncPkgDef-17]
+       _ = x[syncMethod-18]
+       _ = x[syncType-19]
+       _ = x[syncTypeIdx-20]
+       _ = x[syncTypeParamNames-21]
+       _ = x[syncSignature-22]
+       _ = x[syncParams-23]
+       _ = x[syncParam-24]
+       _ = x[syncCodeObj-25]
+       _ = x[syncSym-26]
+       _ = x[syncLocalIdent-27]
+       _ = x[syncSelector-28]
+       _ = x[syncPrivate-29]
+       _ = x[syncFuncExt-30]
+       _ = x[syncVarExt-31]
+       _ = x[syncTypeExt-32]
+       _ = x[syncPragma-33]
+       _ = x[syncExprList-34]
+       _ = x[syncExprs-35]
+       _ = x[syncExpr-36]
+       _ = x[syncOp-37]
+       _ = x[syncFuncLit-38]
+       _ = x[syncCompLit-39]
+       _ = x[syncDecl-40]
+       _ = x[syncFuncBody-41]
+       _ = x[syncOpenScope-42]
+       _ = x[syncCloseScope-43]
+       _ = x[syncCloseAnotherScope-44]
+       _ = x[syncDeclNames-45]
+       _ = x[syncDeclName-46]
+       _ = x[syncStmts-47]
+       _ = x[syncBlockStmt-48]
+       _ = x[syncIfStmt-49]
+       _ = x[syncForStmt-50]
+       _ = x[syncSwitchStmt-51]
+       _ = x[syncRangeStmt-52]
+       _ = x[syncCaseClause-53]
+       _ = x[syncCommClause-54]
+       _ = x[syncSelectStmt-55]
+       _ = x[syncDecls-56]
+       _ = x[syncLabeledStmt-57]
+       _ = x[syncUseObjLocal-58]
+       _ = x[syncAddLocal-59]
+       _ = x[syncLinkname-60]
+       _ = x[syncStmt1-61]
+       _ = x[syncStmtsEnd-62]
+       _ = x[syncLabel-63]
+       _ = x[syncOptLabel-64]
 }
 
-const _syncMarker_name = "NodeBoolInt64Uint64StringPosPkgSymSelectorKindTypeTypePkgSignatureParamOpObjectExprStmtDeclConstDeclFuncDeclTypeDeclVarDeclPragmaValueEOFMethodFuncBodyUseUseObjObjectIdxTypeIdxBOFEntryOpenScopeCloseScopeGlobalLocalDefineDefLocalUseLocalDefGlobalUseGlobalTypeParamsUseLabelDefLabelFuncLitCommonFuncBodyRefLinksymExtHackSetlinenoNameImportDeclDeclNamesDeclNameExprListExprsWrapnameTypeExprTypeExprOrNilChanDirParamsCloseAnotherScopeSumUnOpBinOpStructTypeInterfaceTypePacknameEmbeddedStmtsStmtsFallStmtFallBlockStmtIfStmtForStmtSwitchStmtRangeStmtCaseClauseCommClauseSelectStmtDeclsLabeledStmtCompLit1234NDefImplicitUseNameUseObjLocalAddLocalBothSignatureSetUnderlyingLinknameStmt1StmtsEndDeclareTopDeclsTopConstDeclTopFuncDeclTopTypeDeclTopVarDeclObject1AddBodyLabelFuncExtMethExtOptLabelScalarStmtDeclsDeclLocalObjLocalObjLocal1DeclareLocalPublicPrivateRelocsRelocUseRelocVarExtPkgDefTypeExtValCodeObjPosBaseLocalIdentTypeParamNamesTypeParamBoundsImplicitTypesObjectName"
+const _syncMarker_name = "EOFBoolInt64Uint64StringValueValRelocsRelocUseRelocPublicPosPosBaseObjectObject1PkgPkgDefMethodTypeTypeIdxTypeParamNamesSignatureParamsParamCodeObjSymLocalIdentSelectorPrivateFuncExtVarExtTypeExtPragmaExprListExprsExprOpFuncLitCompLitDeclFuncBodyOpenScopeCloseScopeCloseAnotherScopeDeclNamesDeclNameStmtsBlockStmtIfStmtForStmtSwitchStmtRangeStmtCaseClauseCommClauseSelectStmtDeclsLabeledStmtUseObjLocalAddLocalLinknameStmt1StmtsEndLabelOptLabel"
 
-var _syncMarker_index = [...]uint16{0, 4, 8, 13, 19, 25, 28, 31, 34, 42, 46, 50, 57, 66, 71, 73, 79, 83, 87, 91, 100, 108, 116, 123, 129, 134, 137, 143, 151, 154, 160, 169, 176, 179, 184, 193, 203, 209, 214, 220, 228, 236, 245, 254, 264, 272, 280, 287, 297, 304, 314, 318, 327, 331, 341, 350, 358, 366, 371, 379, 387, 400, 407, 413, 430, 433, 437, 442, 452, 465, 473, 481, 486, 495, 503, 512, 518, 525, 535, 544, 554, 564, 574, 579, 590, 597, 598, 599, 600, 601, 602, 613, 620, 631, 639, 652, 665, 673, 678, 686, 693, 701, 713, 724, 735, 745, 752, 759, 764, 771, 778, 786, 792, 801, 810, 818, 827, 839, 845, 852, 858, 863, 871, 877, 883, 890, 893, 900, 907, 917, 931, 946, 959, 969}
+var _syncMarker_index = [...]uint16{0, 3, 7, 12, 18, 24, 29, 32, 38, 43, 51, 57, 60, 67, 73, 80, 83, 89, 95, 99, 106, 120, 129, 135, 140, 147, 150, 160, 168, 175, 182, 188, 195, 201, 209, 214, 218, 220, 227, 234, 238, 246, 255, 265, 282, 291, 299, 304, 313, 319, 326, 336, 345, 355, 365, 375, 380, 391, 402, 410, 418, 423, 431, 436, 444}
 
 func (i syncMarker) String() string {
        i -= 1