182
170
alg->copy(size, dst, *src);
185
// func convT2I(typ *byte, typ2 *byte, elem any) (ret any)
188
runtime·convT2I(Type *t, InterfaceType *inter, ...)
175
runtime·typ2Itab(Type *t, InterfaceType *inter, Itab **cache, Itab *ret)
179
tab = itab(inter, t, 0);
180
runtime·atomicstorep(cache, tab);
185
// func convT2I(typ *byte, typ2 *byte, cache **byte, elem any) (ret any)
188
runtime·convT2I(Type *t, InterfaceType *inter, Itab **cache, ...)
194
elem = (byte*)(&inter+1);
195
elem = (byte*)(&cache+1);
196
ret = (Iface*)(elem + runtime·rnd(wid, Structrnd));
197
ret->tab = itab(inter, t, 0);
197
ret = (Iface*)(elem + ROUND(wid, Structrnd));
198
tab = runtime·atomicloadp(cache);
200
tab = itab(inter, t, 0);
201
runtime·atomicstorep(cache, tab);
198
204
copyin(t, elem, &ret->data);
210
216
elem = (byte*)(&t+1);
212
ret = (Eface*)(elem + runtime·rnd(wid, Structrnd));
218
ret = (Eface*)(elem + ROUND(wid, Structrnd));
214
220
copyin(t, elem, &ret->data);
272
278
copyout(t, &i.data, ret);
282
runtime·assertI2TOK(Type *t, Iface i, bool ok)
284
ok = i.tab!=nil && i.tab->type==t;
275
288
static void assertE2Tret(Type *t, Eface e, byte *ret);
277
290
// func ifaceE2T(typ *byte, iface any) (ret any)
328
341
copyout(t, &e.data, ret);
345
runtime·assertE2TOK(Type *t, Eface e, bool ok)
331
351
// func convI2E(elem any) (ret any)
333
353
runtime·convI2E(Iface i, Eface ret)
555
runtime·ifacehash(Iface a)
574
runtime·ifacehash(Iface a, uintptr h)
559
return ifacehash1(a.data, a.tab->type);
578
return ifacehash1(a.data, a.tab->type, h);
563
runtime·efacehash(Eface a)
582
runtime·efacehash(Eface a, uintptr h)
565
return ifacehash1(a.data, a.type);
584
return ifacehash1(a.data, a.type, h);
669
reflect·unsafe_New(Eface typ, void *ret)
673
// Reflect library has reinterpreted typ
674
// as its own kind of type structure.
675
// We know that the pointer to the original
676
// type structure sits before the data pointer.
677
t = (Type*)((Eface*)typ.data-1);
679
if(t->kind&KindNoPointers)
680
ret = runtime·mallocgc(t->size, FlagNoPointers, 1, 1);
682
ret = runtime·mal(t->size);
687
reflect·unsafe_NewArray(Eface typ, uint32 n, void *ret)
692
// Reflect library has reinterpreted typ
693
// as its own kind of type structure.
694
// We know that the pointer to the original
695
// type structure sits before the data pointer.
696
t = (Type*)((Eface*)typ.data-1);
699
if(t->kind&KindNoPointers)
700
ret = runtime·mallocgc(size, FlagNoPointers, 1, 1);
702
ret = runtime·mal(size);
688
reflect·unsafe_New(Type *t, void *ret)
690
ret = runtime·cnew(t);
695
reflect·unsafe_NewArray(Type *t, intgo n, void *ret)
697
ret = runtime·cnewarray(t, n);
702
reflect·typelinks(Slice ret)
704
extern Type *typelink[], *etypelink[];
705
static int32 first = 1;
706
ret.array = (byte*)typelink;
707
ret.len = etypelink - typelink;