* config/msp430/msp430.md (zero_extendhipsi2): Use MOVX.A to store
[official-gcc.git] / libgo / runtime / interface.h
blobf3068a656fab84674e02c352ba2fa1f6320c1274
1 /* interface.h -- the interface type for Go.
3 Copyright 2009 The Go Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style
5 license that can be found in the LICENSE file. */
7 #ifndef LIBGO_INTERFACE_H
8 #define LIBGO_INTERFACE_H
10 struct __go_type_descriptor;
12 /* A variable of interface type is an instance of this struct, if the
13 interface has any methods. */
15 struct __go_interface
17 /* A pointer to the interface method table. The first pointer is
18 the type descriptor of the object. Subsequent pointers are
19 pointers to functions. This is effectively the vtable for this
20 interface. The function pointers are in the same order as the
21 list in the internal representation of the interface, which sorts
22 them by name. */
23 const void **__methods;
25 /* The object. If the object is a pointer--if the type descriptor
26 code is GO_PTR or GO_UNSAFE_POINTER--then this field is the value
27 of the object itself. Otherwise this is a pointer to memory
28 which holds the value. */
29 void *__object;
32 /* A variable of an empty interface type is an instance of this
33 struct. */
35 struct __go_empty_interface
37 /* The type descriptor of the object. */
38 const struct __go_type_descriptor *__type_descriptor;
40 /* The object. This is the same as __go_interface above. */
41 void *__object;
44 extern void *
45 __go_convert_interface (const struct __go_type_descriptor *,
46 const struct __go_type_descriptor *);
48 extern void *
49 __go_convert_interface_2 (const struct __go_type_descriptor *,
50 const struct __go_type_descriptor *,
51 _Bool may_fail);
53 extern _Bool
54 __go_can_convert_to_interface(const struct __go_type_descriptor *,
55 const struct __go_type_descriptor *);
57 #endif /* !defined(LIBGO_INTERFACE_H) */