]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove PDISCARD class
authorMatthew Dempsky <mdempsky@google.com>
Sat, 12 Oct 2019 23:58:01 +0000 (16:58 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Sun, 13 Oct 2019 01:47:43 +0000 (01:47 +0000)
This pseudo-Class was previously used by the importer code to optimize
processing duplicate inline bodies, since we didn't actually care
about the declarations in those contexts.

This functionality is no longer needed with indexed exports, since we
now only process function bodies as needed (and never more than once).

Passes toolstash-check.

Change-Id: I7eab0cb16925ab777079c2a20731dbcfd63cf195
Reviewed-on: https://go-review.googlesource.com/c/go/+/200899
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/class_string.go
src/cmd/compile/internal/gc/dcl.go
src/cmd/compile/internal/gc/go.go

index 7dc6a15a181720147c32929f32284df706b4cbf1..a4084a7535209505093583c7b2745520c68772fd 100644 (file)
@@ -15,12 +15,11 @@ func _() {
        _ = x[PPARAM-4]
        _ = x[PPARAMOUT-5]
        _ = x[PFUNC-6]
-       _ = x[PDISCARD-7]
 }
 
-const _Class_name = "PxxxPEXTERNPAUTOPAUTOHEAPPPARAMPPARAMOUTPFUNCPDISCARD"
+const _Class_name = "PxxxPEXTERNPAUTOPAUTOHEAPPPARAMPPARAMOUTPFUNC"
 
-var _Class_index = [...]uint8{0, 4, 11, 16, 25, 31, 40, 45, 53}
+var _Class_index = [...]uint8{0, 4, 11, 16, 25, 31, 40, 45}
 
 func (i Class) String() string {
        if i >= Class(len(_Class_index)-1) {
index 32b72a44d8d779083f9958ce738a6fcf4147b4cf..44ef64f32957a3517e4e3ce67f83ccc2b8cfd7ae 100644 (file)
@@ -60,10 +60,6 @@ var declare_typegen int
 // declare records that Node n declares symbol n.Sym in the specified
 // declaration context.
 func declare(n *Node, ctxt Class) {
-       if ctxt == PDISCARD {
-               return
-       }
-
        if n.isBlank() {
                return
        }
index 37b86523cc09d1af7900c59c0ab35eaa04349259..f6ad3752a0ad1da5c52a1ba0bb2222c1f2da3613 100644 (file)
@@ -60,17 +60,10 @@ const (
        PPARAMOUT              // output results
        PFUNC                  // global function
 
-       PDISCARD // discard during parse of duplicate import
        // Careful: Class is stored in three bits in Node.flags.
-       // Adding a new Class will overflow that.
+       _ = uint((1 << 3) - iota) // static assert for iota <= (1 << 3)
 )
 
-func init() {
-       if PDISCARD != 7 {
-               panic("PDISCARD changed; does all Class values still fit in three bits?")
-       }
-}
-
 // note this is the runtime representation
 // of the compilers arrays.
 //