diff options
| author | Jeff Carr <[email protected]> | 2025-03-19 04:40:49 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-19 04:40:49 -0500 |
| commit | 17119d9298e132aa309f1cc95e439f29f61214b0 (patch) | |
| tree | 578abd95ba2cfe0cdcec3f6e51d609ccb9e2f36b /abi/iface.go | |
day1v0.0.1
Diffstat (limited to 'abi/iface.go')
| -rw-r--r-- | abi/iface.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/abi/iface.go b/abi/iface.go new file mode 100644 index 0000000..676a27d --- /dev/null +++ b/abi/iface.go @@ -0,0 +1,27 @@ +// Copyright 2023 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 abi + +import "unsafe" + +// The first word of every non-empty interface type contains an *ITab. +// It records the underlying concrete type (Type), the interface type it +// is implementing (Inter), and some ancillary information. +// +// allocated in non-garbage-collected memory +type ITab struct { + Inter *InterfaceType + Type *Type + Hash uint32 // copy of Type.Hash. Used for type switches. + Fun [1]uintptr // variable sized. fun[0]==0 means Type does not implement Inter. +} + +// EmptyInterface describes the layout of a "interface{}" or a "any." +// These are represented differently than non-empty interface, as the first +// word always points to an abi.Type. +type EmptyInterface struct { + Type *Type + Data unsafe.Pointer +} |
