summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/iface.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/iface.c')
-rw-r--r--src/pkg/runtime/iface.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/pkg/runtime/iface.c b/src/pkg/runtime/iface.c
index 5973d6d03..ecbdcc707 100644
--- a/src/pkg/runtime/iface.c
+++ b/src/pkg/runtime/iface.c
@@ -7,6 +7,7 @@
#include "type.h"
#include "typekind.h"
#include "malloc.h"
+#include "../../cmd/ld/textflag.h"
void
runtime·printiface(Iface i)
@@ -85,7 +86,7 @@ itab(InterfaceType *inter, Type *type, int32 canfail)
}
ni = inter->mhdr.len;
- m = runtime·malloc(sizeof(*m) + ni*sizeof m->fun[0]);
+ m = runtime·persistentalloc(sizeof(*m) + ni*sizeof m->fun[0], 0, &mstats.other_sys);
m->inter = inter;
m->type = type;
@@ -170,7 +171,7 @@ copyout(Type *t, void **src, void *dst)
alg->copy(size, dst, *src);
}
-#pragma textflag 7
+#pragma textflag NOSPLIT
void
runtime·typ2Itab(Type *t, InterfaceType *inter, Itab **cache, Itab *ret)
{
@@ -183,7 +184,7 @@ runtime·typ2Itab(Type *t, InterfaceType *inter, Itab **cache, Itab *ret)
}
// func convT2I(typ *byte, typ2 *byte, cache **byte, elem any) (ret any)
-#pragma textflag 7
+#pragma textflag NOSPLIT
void
runtime·convT2I(Type *t, InterfaceType *inter, Itab **cache, ...)
{
@@ -205,7 +206,7 @@ runtime·convT2I(Type *t, InterfaceType *inter, Itab **cache, ...)
}
// func convT2E(typ *byte, elem any) (ret any)
-#pragma textflag 7
+#pragma textflag NOSPLIT
void
runtime·convT2E(Type *t, ...)
{
@@ -223,7 +224,7 @@ runtime·convT2E(Type *t, ...)
static void assertI2Tret(Type *t, Iface i, byte *ret);
// func ifaceI2T(typ *byte, iface any) (ret any)
-#pragma textflag 7
+#pragma textflag NOSPLIT
void
runtime·assertI2T(Type *t, Iface i, ...)
{
@@ -256,7 +257,7 @@ assertI2Tret(Type *t, Iface i, byte *ret)
}
// func ifaceI2T2(typ *byte, iface any) (ret any, ok bool)
-#pragma textflag 7
+#pragma textflag NOSPLIT
void
runtime·assertI2T2(Type *t, Iface i, ...)
{
@@ -288,7 +289,7 @@ runtime·assertI2TOK(Type *t, Iface i, bool ok)
static void assertE2Tret(Type *t, Eface e, byte *ret);
// func ifaceE2T(typ *byte, iface any) (ret any)
-#pragma textflag 7
+#pragma textflag NOSPLIT
void
runtime·assertE2T(Type *t, Eface e, ...)
{
@@ -319,7 +320,7 @@ assertE2Tret(Type *t, Eface e, byte *ret)
}
// func ifaceE2T2(sigt *byte, iface any) (ret any, ok bool);
-#pragma textflag 7
+#pragma textflag NOSPLIT
void
runtime·assertE2T2(Type *t, Eface e, ...)
{
@@ -481,6 +482,16 @@ runtime·ifaceE2I(InterfaceType *inter, Eface e, Iface *ret)
ret->tab = itab(inter, t, 0);
}
+bool
+runtime·ifaceE2I2(InterfaceType *inter, Eface e, Iface *ret)
+{
+ ret->tab = itab(inter, e.type, 1);
+ if(ret->tab == nil)
+ return false;
+ ret->data = e.data;
+ return true;
+}
+
// For reflect
// func ifaceE2I(t *InterfaceType, e interface{}, dst *Iface)
void