Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for typeAssert (0.27 sec)

  1. test/fixedbugs/issue51733.go

    	var v any = p
    	p2 := v.(*S)
    	if p != p2 {
    		log.Fatalf("%p != %p", unsafe.Pointer(p), unsafe.Pointer(p2))
    	}
    	p2 = typeAssert[*S](v)
    	if p != p2 {
    		log.Fatalf("%p != %p from typeAssert", unsafe.Pointer(p), unsafe.Pointer(p2))
    	}
    }
    
    func typeAssert[T any](v any) T {
    	return v.(T)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 02 15:27:18 UTC 2022
    - 619 bytes
    - Viewed (0)
  2. test/codegen/switch.go

    func interfaceCast(x any) int {
    	// amd64:`CALL\truntime.typeAssert`,`MOVL\t16\(AX\)`,`MOVQ\t8\(.*\)(.*\*1)`
    	// arm64:`CALL\truntime.typeAssert`,`LDAR`,`MOVWU\t16\(R0\)`,`MOVD\t\(R.*\)\(R.*\)`
    	if _, ok := x.(I); ok {
    		return 3
    	}
    	return 5
    }
    
    func interfaceCast2(x K) int {
    	// amd64:`CALL\truntime.typeAssert`,`MOVL\t16\(AX\)`,`MOVQ\t8\(.*\)(.*\*1)`
    	// arm64:`CALL\truntime.typeAssert`,`LDAR`,`MOVWU\t16\(R0\)`,`MOVD\t\(R.*\)\(R.*\)`
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 09 18:39:50 UTC 2023
    - 3.6K bytes
    - Viewed (0)
  3. test/codegen/ifaces.go

    	// amd64:-`.*runtime.convI2I`
    	return T(x)
    }
    
    var NopConvertGenericIface = NopConvertGeneric[I]
    
    func ConvToM(x any) I {
    	// amd64:`CALL\truntime.typeAssert`,`MOVL\t16\(.*\)`,`MOVQ\t8\(.*\)(.*\*1)`
    	// arm64:`CALL\truntime.typeAssert`,`LDAR`,`MOVWU`,`MOVD\t\(R.*\)\(R.*\)`
    	return x.(I)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 06 17:02:53 UTC 2023
    - 621 bytes
    - Viewed (0)
  4. src/internal/abi/switch.go

    	switch goarch {
    	case "amd64", "arm64", "loong64", "mips", "mipsle", "mips64", "mips64le", "ppc64", "ppc64le", "riscv64", "s390x":
    		return true
    	default:
    		return false
    	}
    }
    
    type TypeAssert struct {
    	Cache   *TypeAssertCache
    	Inter   *InterfaceType
    	CanFail bool
    }
    type TypeAssertCache struct {
    	Mask    uintptr
    	Entries [1]TypeAssertCacheEntry
    }
    type TypeAssertCacheEntry struct {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 06 17:02:53 UTC 2023
    - 1.6K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/ir/symtab.go

    	Panicoverflow     *obj.LSym
    	Racefuncenter     *obj.LSym
    	Racefuncexit      *obj.LSym
    	Raceread          *obj.LSym
    	Racereadrange     *obj.LSym
    	Racewrite         *obj.LSym
    	Racewriterange    *obj.LSym
    	TypeAssert        *obj.LSym
    	WBZero            *obj.LSym
    	WBMove            *obj.LSym
    	// Wasm
    	SigPanic        *obj.LSym
    	Staticuint64s   *obj.LSym
    	Typedmemmove    *obj.LSym
    	Udiv            *obj.LSym
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 06 17:02:26 UTC 2023
    - 2K bytes
    - Viewed (0)
  6. test/interface/assertinline.go

    // errorcheck -0 -d=typeassert
    
    // Copyright 2015 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package p
    
    func assertptr(x interface{}) *int {
    	return x.(*int) // ERROR "type assertion inlined"
    }
    
    func assertptr2(x interface{}) (*int, bool) {
    	z, ok := x.(*int) // ERROR "type assertion inlined"
    	return z, ok
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 02 21:33:03 UTC 2016
    - 1.8K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/walk/expr.go

    	// When converting from an interface to a non-empty interface. Needs a runtime call.
    	// Allocate an internal/abi.TypeAssert descriptor for that call.
    	lsym := types.LocalPkg.Lookup(fmt.Sprintf(".typeAssert.%d", typeAssertGen)).LinksymABI(obj.ABI0)
    	typeAssertGen++
    	c := rttype.NewCursor(lsym, 0, rttype.TypeAssert)
    	c.Field("Cache").WritePtr(typecheck.LookupRuntimeVar("emptyTypeAssertCache"))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:34:01 UTC 2024
    - 27.6K bytes
    - Viewed (0)
  8. src/cmd/internal/goobj/builtinlist.go

    	{"runtime.convTslice", 1},
    	{"runtime.assertE2I", 1},
    	{"runtime.assertE2I2", 1},
    	{"runtime.panicdottypeE", 1},
    	{"runtime.panicdottypeI", 1},
    	{"runtime.panicnildottype", 1},
    	{"runtime.typeAssert", 1},
    	{"runtime.interfaceSwitch", 1},
    	{"runtime.ifaceeq", 1},
    	{"runtime.efaceeq", 1},
    	{"runtime.panicrangestate", 1},
    	{"runtime.deferrangefunc", 1},
    	{"runtime.rand32", 1},
    	{"runtime.makemap64", 1},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 21 21:08:03 UTC 2024
    - 7.4K bytes
    - Viewed (0)
  9. src/runtime/iface.go

    	if t == nil {
    		return nil
    	}
    	return getitab(inter, t, true)
    }
    
    // typeAssert builds an itab for the concrete type t and the
    // interface type s.Inter. If the conversion is not possible it
    // panics if s.CanFail is false and returns nil if s.CanFail is true.
    func typeAssert(s *abi.TypeAssert, t *_type) *itab {
    	var tab *itab
    	if t == nil {
    		if !s.CanFail {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 17:58:53 UTC 2024
    - 22.5K bytes
    - Viewed (0)
  10. src/cmd/compile/internal/typecheck/_builtin/runtime.go

    func assertE2I(inter *byte, typ *byte) *byte
    func assertE2I2(inter *byte, typ *byte) *byte
    func panicdottypeE(have, want, iface *byte)
    func panicdottypeI(have, want, iface *byte)
    func panicnildottype(want *byte)
    func typeAssert(s *byte, typ *byte) *byte
    
    // interface switches
    func interfaceSwitch(s *byte, t *byte) (int, *byte)
    
    // interface equality. Type/itab pointers are already known to be equal, so
    // we only need to pass one.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 21 21:08:03 UTC 2024
    - 10.6K bytes
    - Viewed (0)
Back to top