diff options
-rw-r--r-- | src/cmd/compile/internal/ir/node.go | 1 | ||||
-rw-r--r-- | src/cmd/compile/internal/ir/op_string.go | 51 | ||||
-rw-r--r-- | src/cmd/compile/internal/types/sizeof_test.go | 2 | ||||
-rw-r--r-- | src/cmd/compile/internal/types/type.go | 27 |
4 files changed, 41 insertions, 40 deletions
diff --git a/src/cmd/compile/internal/ir/node.go b/src/cmd/compile/internal/ir/node.go index 7bce0e985c..b6be74296f 100644 --- a/src/cmd/compile/internal/ir/node.go +++ b/src/cmd/compile/internal/ir/node.go @@ -285,7 +285,6 @@ const ( // Left is nil if there is no type-switch variable OTYPESW OFUNCINST // instantiation of a generic function - OTYPEINST // instantiation of a generic type // types OTCHAN // chan int diff --git a/src/cmd/compile/internal/ir/op_string.go b/src/cmd/compile/internal/ir/op_string.go index 65456df356..cfd36c7b3d 100644 --- a/src/cmd/compile/internal/ir/op_string.go +++ b/src/cmd/compile/internal/ir/op_string.go @@ -138,35 +138,34 @@ func _() { _ = x[OSWITCH-127] _ = x[OTYPESW-128] _ = x[OFUNCINST-129] - _ = x[OTYPEINST-130] - _ = x[OTCHAN-131] - _ = x[OTMAP-132] - _ = x[OTSTRUCT-133] - _ = x[OTINTER-134] - _ = x[OTFUNC-135] - _ = x[OTARRAY-136] - _ = x[OTSLICE-137] - _ = x[OINLCALL-138] - _ = x[OEFACE-139] - _ = x[OITAB-140] - _ = x[OIDATA-141] - _ = x[OSPTR-142] - _ = x[OCFUNC-143] - _ = x[OCHECKNIL-144] - _ = x[OVARDEF-145] - _ = x[OVARKILL-146] - _ = x[OVARLIVE-147] - _ = x[ORESULT-148] - _ = x[OINLMARK-149] - _ = x[OLINKSYMOFFSET-150] - _ = x[OTAILCALL-151] - _ = x[OGETG-152] - _ = x[OEND-153] + _ = x[OTCHAN-130] + _ = x[OTMAP-131] + _ = x[OTSTRUCT-132] + _ = x[OTINTER-133] + _ = x[OTFUNC-134] + _ = x[OTARRAY-135] + _ = x[OTSLICE-136] + _ = x[OINLCALL-137] + _ = x[OEFACE-138] + _ = x[OITAB-139] + _ = x[OIDATA-140] + _ = x[OSPTR-141] + _ = x[OCFUNC-142] + _ = x[OCHECKNIL-143] + _ = x[OVARDEF-144] + _ = x[OVARKILL-145] + _ = x[OVARLIVE-146] + _ = x[ORESULT-147] + _ = x[OINLMARK-148] + _ = x[OLINKSYMOFFSET-149] + _ = x[OTAILCALL-150] + _ = x[OGETG-151] + _ = x[OEND-152] } -const _Op_name = "XXXNAMENONAMETYPEPACKLITERALNILADDSUBORXORADDSTRADDRANDANDAPPENDBYTES2STRBYTES2STRTMPRUNES2STRSTR2BYTESSTR2BYTESTMPSTR2RUNESASAS2AS2DOTTYPEAS2FUNCAS2MAPRAS2RECVASOPCALLCALLFUNCCALLMETHCALLINTERCALLPARTCAPCLOSECLOSURECOMPLITMAPLITSTRUCTLITARRAYLITSLICELITPTRLITCONVCONVIFACECONVNOPCOPYDCLDCLFUNCDCLCONSTDCLTYPEDELETEDOTDOTPTRDOTMETHDOTINTERXDOTDOTTYPEDOTTYPE2EQNELTLEGEGTDEREFINDEXINDEXMAPKEYSTRUCTKEYLENMAKEMAKECHANMAKEMAPMAKESLICEMAKESLICECOPYMULDIVMODLSHRSHANDANDNOTNEWNOTBITNOTPLUSNEGORORPANICPRINTPRINTNPARENSENDSLICESLICEARRSLICESTRSLICE3SLICE3ARRSLICEHEADERRECOVERRECVRUNESTRSELRECV2IOTAREALIMAGCOMPLEXALIGNOFOFFSETOFSIZEOFMETHEXPRSTMTEXPRBLOCKBREAKCASECONTINUEDEFERFALLFORFORUNTILGOTOIFLABELGORANGERETURNSELECTSWITCHTYPESWFUNCINSTTYPEINSTTCHANTMAPTSTRUCTTINTERTFUNCTARRAYTSLICEINLCALLEFACEITABIDATASPTRCFUNCCHECKNILVARDEFVARKILLVARLIVERESULTINLMARKLINKSYMOFFSETTAILCALLGETGEND" +const _Op_name = "XXXNAMENONAMETYPEPACKLITERALNILADDSUBORXORADDSTRADDRANDANDAPPENDBYTES2STRBYTES2STRTMPRUNES2STRSTR2BYTESSTR2BYTESTMPSTR2RUNESASAS2AS2DOTTYPEAS2FUNCAS2MAPRAS2RECVASOPCALLCALLFUNCCALLMETHCALLINTERCALLPARTCAPCLOSECLOSURECOMPLITMAPLITSTRUCTLITARRAYLITSLICELITPTRLITCONVCONVIFACECONVNOPCOPYDCLDCLFUNCDCLCONSTDCLTYPEDELETEDOTDOTPTRDOTMETHDOTINTERXDOTDOTTYPEDOTTYPE2EQNELTLEGEGTDEREFINDEXINDEXMAPKEYSTRUCTKEYLENMAKEMAKECHANMAKEMAPMAKESLICEMAKESLICECOPYMULDIVMODLSHRSHANDANDNOTNEWNOTBITNOTPLUSNEGORORPANICPRINTPRINTNPARENSENDSLICESLICEARRSLICESTRSLICE3SLICE3ARRSLICEHEADERRECOVERRECVRUNESTRSELRECV2IOTAREALIMAGCOMPLEXALIGNOFOFFSETOFSIZEOFMETHEXPRSTMTEXPRBLOCKBREAKCASECONTINUEDEFERFALLFORFORUNTILGOTOIFLABELGORANGERETURNSELECTSWITCHTYPESWFUNCINSTTCHANTMAPTSTRUCTTINTERTFUNCTARRAYTSLICEINLCALLEFACEITABIDATASPTRCFUNCCHECKNILVARDEFVARKILLVARLIVERESULTINLMARKLINKSYMOFFSETTAILCALLGETGEND" -var _Op_index = [...]uint16{0, 3, 7, 13, 17, 21, 28, 31, 34, 37, 39, 42, 48, 52, 58, 64, 73, 85, 94, 103, 115, 124, 126, 129, 139, 146, 153, 160, 164, 168, 176, 184, 193, 201, 204, 209, 216, 223, 229, 238, 246, 254, 260, 264, 273, 280, 284, 287, 294, 302, 309, 315, 318, 324, 331, 339, 343, 350, 358, 360, 362, 364, 366, 368, 370, 375, 380, 388, 391, 400, 403, 407, 415, 422, 431, 444, 447, 450, 453, 456, 459, 462, 468, 471, 474, 480, 484, 487, 491, 496, 501, 507, 512, 516, 521, 529, 537, 543, 552, 563, 570, 574, 581, 589, 593, 597, 601, 608, 615, 623, 629, 637, 645, 650, 655, 659, 667, 672, 676, 679, 687, 691, 693, 698, 700, 705, 711, 717, 723, 729, 737, 745, 750, 754, 761, 767, 772, 778, 784, 791, 796, 800, 805, 809, 814, 822, 828, 835, 842, 848, 855, 868, 876, 880, 883} +var _Op_index = [...]uint16{0, 3, 7, 13, 17, 21, 28, 31, 34, 37, 39, 42, 48, 52, 58, 64, 73, 85, 94, 103, 115, 124, 126, 129, 139, 146, 153, 160, 164, 168, 176, 184, 193, 201, 204, 209, 216, 223, 229, 238, 246, 254, 260, 264, 273, 280, 284, 287, 294, 302, 309, 315, 318, 324, 331, 339, 343, 350, 358, 360, 362, 364, 366, 368, 370, 375, 380, 388, 391, 400, 403, 407, 415, 422, 431, 444, 447, 450, 453, 456, 459, 462, 468, 471, 474, 480, 484, 487, 491, 496, 501, 507, 512, 516, 521, 529, 537, 543, 552, 563, 570, 574, 581, 589, 593, 597, 601, 608, 615, 623, 629, 637, 645, 650, 655, 659, 667, 672, 676, 679, 687, 691, 693, 698, 700, 705, 711, 717, 723, 729, 737, 742, 746, 753, 759, 764, 770, 776, 783, 788, 792, 797, 801, 806, 814, 820, 827, 834, 840, 847, 860, 868, 872, 875} func (i Op) String() string { if i >= Op(len(_Op_index)-1) { diff --git a/src/cmd/compile/internal/types/sizeof_test.go b/src/cmd/compile/internal/types/sizeof_test.go index 4c3ef69346..7028938742 100644 --- a/src/cmd/compile/internal/types/sizeof_test.go +++ b/src/cmd/compile/internal/types/sizeof_test.go @@ -21,7 +21,7 @@ func TestSizeof(t *testing.T) { _64bit uintptr // size on 64bit platforms }{ {Sym{}, 44, 72}, - {Type{}, 68, 120}, + {Type{}, 60, 104}, {Map{}, 20, 40}, {Forward{}, 20, 32}, {Func{}, 28, 48}, diff --git a/src/cmd/compile/internal/types/type.go b/src/cmd/compile/internal/types/type.go index 969195b850..88fc409733 100644 --- a/src/cmd/compile/internal/types/type.go +++ b/src/cmd/compile/internal/types/type.go @@ -178,16 +178,13 @@ type Type struct { flags bitset8 - // For defined (named) generic types, the list of type params (in order) - // of this type that need to be instantiated. For fully-instantiated - // generic types, this is the targs used to instantiate them (which are - // used when generating the corresponding instantiated methods). rparams - // is only set for named types that are generic or are fully-instantiated - // from a generic type. - - // TODO(danscales): for space reasons, should probably be a pointer to a - // slice, possibly change the name of this field. - rparams []*Type + // For defined (named) generic types, a pointer to the list of type params + // (in order) of this type that need to be instantiated. For + // fully-instantiated generic types, this is the targs used to instantiate + // them (which are used when generating the corresponding instantiated + // methods). rparams is only set for named types that are generic or are + // fully-instantiated from a generic type, and is otherwise set to nil. + rparams *[]*Type } func (*Type) CanBeAnSSAAux() {} @@ -244,11 +241,17 @@ func (t *Type) Pos() src.XPos { } func (t *Type) RParams() []*Type { - return t.rparams + if t.rparams == nil { + return nil + } + return *t.rparams } func (t *Type) SetRParams(rparams []*Type) { - t.rparams = rparams + if len(rparams) == 0 { + base.Fatalf("Setting nil or zero-length rparams") + } + t.rparams = &rparams if t.HasTParam() { return } |