case TINT8, TUINT8, TINT16, TUINT16,
TINT32, TUINT32, TINT64, TUINT64,
TINT, TUINT, TUINTPTR,
- TBOOL, TPTR32, TPTR64,
+ TBOOL, TPTR,
TCHAN, TUNSAFEPTR:
return AMEM, nil
w = 16
t.Align = uint8(Widthreg)
- case TPTR32:
- w = 4
- checkwidth(t.Elem())
-
- case TPTR64:
- w = 8
+ case TPTR:
+ w = int64(Widthptr)
checkwidth(t.Elem())
case TUNSAFEPTR:
// the user already needs some way to construct values of
// those types.
switch t.Etype {
- case TPTR32, TPTR64, TARRAY, TSLICE, TCHAN:
+ case TPTR, TARRAY, TSLICE, TCHAN:
// TODO(mdempsky): Skip marking element type for
// send-only channels?
p.markType(t.Elem())
case TARRAY:
goto bad
- case TPTR32, TPTR64, TUNSAFEPTR:
+ case TPTR, TUNSAFEPTR:
n.SetVal(Val{new(Mpint)})
case TCHAN, TFUNC, TINTER, TMAP, TSLICE:
TBOOL:
return true
- case TIDEAL, TINT64, TUINT64, TPTR32, TPTR64:
+ case TIDEAL, TINT64, TUINT64, TPTR:
v, ok := n.Val().U.(*Mpint)
if ok && v.Cmp(minintval[TINT32]) > 0 && v.Cmp(maxintval[TINT32]) < 0 {
return true
e.nodeEscState(ind).Loopdepth = e.nodeEscState(n).Loopdepth
ind.Pos = n.Pos
t := n.Type
- if t.IsKind(types.Tptr) || t.IsSlice() {
+ if t.IsPtr() || t.IsSlice() {
// This should model our own sloppy use of OIND to encode
// decreasing levels of indirection; i.e., "indirecting" a slice
// yields the type of an element.
}
switch t.Etype {
- case TPTR32, TPTR64:
+ case TPTR:
switch mode {
case FTypeId, FTypeIdName:
if flag&FmtShort != 0 {
}
switch t.Etype {
- case TPTR32, TPTR64:
+ case TPTR:
w.startType(pointerType)
w.typ(t.Elem())
return CTSTR
case TINT, TINT8, TINT16, TINT32, TINT64,
TUINT, TUINT8, TUINT16, TUINT32, TUINT64, TUINTPTR,
- TPTR32, TPTR64, TUNSAFEPTR:
+ TPTR, TUNSAFEPTR:
return CTINT
case TFLOAT32, TFLOAT64:
return CTFLT
func typeWithPointers() *types.Type {
t := types.New(TSTRUCT)
- f := &types.Field{Type: types.New(TPTR64)}
+ f := &types.Field{Type: types.New(TPTR)}
t.SetFields([]*types.Field{f})
return t
}
TINT, TUINT, TUINTPTR, TBOOL,
TFLOAT32, TFLOAT64, TCOMPLEX64, TCOMPLEX128:
- case TPTR32, TPTR64, TUNSAFEPTR, TFUNC, TCHAN, TMAP:
+ case TPTR, TUNSAFEPTR, TFUNC, TCHAN, TMAP:
if off&int64(Widthptr-1) != 0 {
Fatalf("onebitwalktype1: invalid alignment, %v", t)
}
return
}
switch t.Etype {
- case TPTR32,
- TPTR64,
+ case TPTR,
TUNSAFEPTR,
TFUNC,
TCHAN,
tsym := t.Sym
if tsym == nil {
switch t.Etype {
- case TARRAY, TSLICE, TPTR32, TPTR64, TCHAN:
+ case TARRAY, TSLICE, TPTR, TCHAN:
if t.Elem() != nil {
tsym = t.Elem().Sym
}
TFLOAT64: objabi.KindFloat64,
TBOOL: objabi.KindBool,
TSTRING: objabi.KindString,
- TPTR32: objabi.KindPtr,
- TPTR64: objabi.KindPtr,
+ TPTR: objabi.KindPtr,
TSTRUCT: objabi.KindStruct,
TINTER: objabi.KindInterface,
TCHAN: objabi.KindChan,
}
switch t.Etype {
- case TPTR32,
- TPTR64,
+ case TPTR,
TUNSAFEPTR,
TFUNC,
TCHAN,
TINT64,
TUINT64,
TUINTPTR,
- TPTR32,
- TPTR64,
+ TPTR,
TUNSAFEPTR,
TSTRING,
TCHAN:
func needkeyupdate(t *types.Type) bool {
switch t.Etype {
case TBOOL, TINT, TUINT, TINT8, TUINT8, TINT16, TUINT16, TINT32, TUINT32,
- TINT64, TUINT64, TUINTPTR, TPTR32, TPTR64, TUNSAFEPTR, TCHAN:
+ TINT64, TUINT64, TUINTPTR, TPTR, TUNSAFEPTR, TCHAN:
return false
case TFLOAT32, TFLOAT64, TCOMPLEX64, TCOMPLEX128, // floats and complex can be +0/-0
ot = duint8(lsym, ot, uint8(obj.Bool2int(needkeyupdate(t.Key()))))
ot = dextratype(lsym, ot, t, 0)
- case TPTR32, TPTR64:
+ case TPTR:
if t.Elem().Etype == TANY {
// ../../../../runtime/type.go:/UnsafePointerType
ot = dcommontype(lsym, t)
// functions must return the existing type structure rather
// than creating a new one.
switch t.Etype {
- case TPTR32, TPTR64, TARRAY, TCHAN, TFUNC, TMAP, TSLICE, TSTRUCT:
+ case TPTR, TARRAY, TCHAN, TFUNC, TMAP, TSLICE, TSTRUCT:
keep = true
}
}
opAndType{OEQ, TFUNC}: ssa.OpEqPtr,
opAndType{OEQ, TMAP}: ssa.OpEqPtr,
opAndType{OEQ, TCHAN}: ssa.OpEqPtr,
- opAndType{OEQ, TPTR32}: ssa.OpEqPtr,
- opAndType{OEQ, TPTR64}: ssa.OpEqPtr,
+ opAndType{OEQ, TPTR}: ssa.OpEqPtr,
opAndType{OEQ, TUINTPTR}: ssa.OpEqPtr,
opAndType{OEQ, TUNSAFEPTR}: ssa.OpEqPtr,
opAndType{OEQ, TFLOAT64}: ssa.OpEq64F,
opAndType{ONE, TFUNC}: ssa.OpNeqPtr,
opAndType{ONE, TMAP}: ssa.OpNeqPtr,
opAndType{ONE, TCHAN}: ssa.OpNeqPtr,
- opAndType{ONE, TPTR32}: ssa.OpNeqPtr,
- opAndType{ONE, TPTR64}: ssa.OpNeqPtr,
+ opAndType{ONE, TPTR}: ssa.OpNeqPtr,
opAndType{ONE, TUINTPTR}: ssa.OpNeqPtr,
opAndType{ONE, TUNSAFEPTR}: ssa.OpNeqPtr,
opAndType{ONE, TFLOAT64}: ssa.OpNeq64F,
// 5. src is the predeclared identifier nil and dst is a nillable type.
if src.Etype == TNIL {
switch dst.Etype {
- case TPTR32,
- TPTR64,
+ case TPTR,
TFUNC,
TMAP,
TCHAN,
}
switch t.Etype {
- case TPTR32,
- TPTR64,
+ case TPTR,
TCHAN,
TMAP,
TFUNC,
TFLOAT64: "float64",
TBOOL: "bool",
TSTRING: "string",
- TPTR32: "pointer",
- TPTR64: "pointer",
+ TPTR: "pointer",
TUNSAFEPTR: "unsafe.Pointer",
TSTRUCT: "struct",
TINTER: "interface",
TBOOL = types.TBOOL
- TPTR32 = types.TPTR32
- TPTR64 = types.TPTR64
-
+ TPTR = types.TPTR
TFUNC = types.TFUNC
TSLICE = types.TSLICE
TARRAY = types.TARRAY
simtype[et] = et
}
- types.Types[TPTR32] = types.New(TPTR32)
- dowidth(types.Types[TPTR32])
-
- types.Types[TPTR64] = types.New(TPTR64)
- dowidth(types.Types[TPTR64])
+ types.Types[TPTR] = types.New(TPTR)
+ dowidth(types.Types[TPTR])
t := types.New(TUNSAFEPTR)
types.Types[TUNSAFEPTR] = t
asNode(t.Sym.Def).Name = new(Name)
dowidth(types.Types[TUNSAFEPTR])
- types.Tptr = TPTR32
- if Widthptr == 8 {
- types.Tptr = TPTR64
- }
-
for et := TINT8; et <= TUINT64; et++ {
isInt[et] = true
}
okforlen[TSLICE] = true
okforlen[TSTRING] = true
- okforeq[TPTR32] = true
- okforeq[TPTR64] = true
+ okforeq[TPTR] = true
okforeq[TUNSAFEPTR] = true
okforeq[TINTER] = true
okforeq[TCHAN] = true
types.Types[TINTER] = types.New(TINTER)
// simple aliases
- simtype[TMAP] = types.Tptr
- simtype[TCHAN] = types.Tptr
- simtype[TFUNC] = types.Tptr
- simtype[TUNSAFEPTR] = types.Tptr
+ simtype[TMAP] = TPTR
+ simtype[TCHAN] = TPTR
+ simtype[TFUNC] = TPTR
+ simtype[TUNSAFEPTR] = TPTR
array_array = int(Rnd(0, int64(Widthptr)))
array_nel = int(Rnd(int64(array_array)+int64(Widthptr), int64(Widthptr)))
on = syslook("printiface")
}
on = substArgTypes(on, n.Type) // any-1
- case TPTR32, TPTR64, TCHAN, TMAP, TFUNC, TUNSAFEPTR:
+ case TPTR, TCHAN, TMAP, TFUNC, TUNSAFEPTR:
on = syslook("printpointer")
on = substArgTypes(on, n.Type) // any-1
case TSLICE:
}
types.Dowidth = func(t *types.Type) {}
- types.Tptr = types.TPTR64
for _, typ := range [...]struct {
width int64
et types.EType
TBOOL
- TPTR32
- TPTR64
-
+ TPTR
TFUNC
TSLICE
TARRAY
// TFUNCARGS: FuncArgs
// TCHANARGS: ChanArgs
// TCHAN: *Chan
- // TPTR32, TPTR64: Ptr
+ // TPTR: Ptr
// TARRAY: *Array
// TSLICE: Slice
Extra interface{}
t.Extra = new(Struct)
case TINTER:
t.Extra = new(Interface)
- case TPTR32, TPTR64:
+ case TPTR:
t.Extra = Ptr{}
case TCHANARGS:
t.Extra = ChanArgs{}
return t
}
- if Tptr == 0 {
- Fatalf("NewPtr: Tptr not initialized")
- }
-
- t := New(Tptr)
+ t := New(TPTR)
t.Extra = Ptr{Elem: elem}
t.Width = int64(Widthptr)
t.Align = uint8(Widthptr)
t = (*types)[0]
*types = (*types)[1:]
- case TPTR32, TPTR64:
+ case TPTR:
elem := SubstAny(t.Elem(), types)
if elem != t.Elem() {
t = t.copy()
// Usable with pointers, channels, arrays, slices, and maps.
func (t *Type) Elem() *Type {
switch t.Etype {
- case TPTR32, TPTR64:
+ case TPTR:
return t.Extra.(Ptr).Elem
case TARRAY:
return t.Extra.(*Array).Elem
}
return t.Elem().cmp(x.Elem())
- case TPTR32, TPTR64, TSLICE:
+ case TPTR, TSLICE:
// No special cases for these, they are handled
// by the general code after the switch.
panic(e)
}
- // Common element type comparison for TARRAY, TCHAN, TPTR32, TPTR64, and TSLICE.
+ // Common element type comparison for TARRAY, TCHAN, TPTR, and TSLICE.
return t.Elem().cmp(x.Elem())
}
// IsPtr reports whether t is a regular Go pointer type.
// This does not include unsafe.Pointer.
func (t *Type) IsPtr() bool {
- return t.Etype == TPTR32 || t.Etype == TPTR64
+ return t.Etype == TPTR
}
// IsUnsafePtr reports whether t is an unsafe pointer.
// that consist of a single pointer shaped type.
// TODO(mdempsky): Should it? See golang.org/issue/15028.
func (t *Type) IsPtrShaped() bool {
- return t.Etype == TPTR32 || t.Etype == TPTR64 || t.Etype == TUNSAFEPTR ||
+ return t.Etype == TPTR || t.Etype == TUNSAFEPTR ||
t.Etype == TMAP || t.Etype == TCHAN || t.Etype == TFUNC
}
}
return false
- case TPTR32, TPTR64, TSLICE:
+ case TPTR, TSLICE:
return !(ignoreNotInHeap && t.Elem().NotInHeap())
case TTUPLE:
const BADWIDTH = -1000000000
-// Initialized by frontend. Exists only here.
-var Tptr EType // either TPTR32 or TPTR64
-
// The following variables must be initialized early by the frontend.
// They are here to break import cycles.
// TODO(gri) eliminate these dependencies.