OLD | NEW |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include <u.h> | 5 #include <u.h> |
6 #include <libc.h> | 6 #include <libc.h> |
7 #include "go.h" | 7 #include "go.h" |
8 #include "../ld/textflag.h" | 8 #include "../ld/textflag.h" |
9 #include "../../pkg/runtime/mgc0.h" | 9 #include "../../pkg/runtime/mgc0.h" |
10 #include "../../pkg/runtime/typekind.h" | 10 #include "../../pkg/runtime/typekind.h" |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 Sym *method; | 371 Sym *method; |
372 | 372 |
373 // method type | 373 // method type |
374 mt = methtype(t, 0); | 374 mt = methtype(t, 0); |
375 if(mt == T) | 375 if(mt == T) |
376 return nil; | 376 return nil; |
377 expandmeth(mt); | 377 expandmeth(mt); |
378 | 378 |
379 // type stored in interface word | 379 // type stored in interface word |
380 it = t; | 380 it = t; |
381 » if(it->width > widthptr) | 381 » if(!isdirectiface(it)) |
382 it = ptrto(t); | 382 it = ptrto(t); |
383 | 383 |
384 // make list of methods for t, | 384 // make list of methods for t, |
385 // generating code if necessary. | 385 // generating code if necessary. |
386 a = nil; | 386 a = nil; |
387 for(f=mt->xmethod; f; f=f->down) { | 387 for(f=mt->xmethod; f; f=f->down) { |
388 if(f->etype != TFIELD) | 388 if(f->etype != TFIELD) |
389 fatal("methods: not field %T", f); | 389 fatal("methods: not field %T", f); |
390 if (f->type->etype != TFUNC || f->type->thistuple == 0) | 390 if (f->type->etype != TFUNC || f->type->thistuple == 0) |
391 fatal("non-method on %T method %S %T\n", mt, f->sym, f); | 391 fatal("non-method on %T method %S %T\n", mt, f->sym, f); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 fatal("invalid alignment %d for %T", t->align, t); | 778 fatal("invalid alignment %d for %T", t->align, t); |
779 ot = duint8(s, ot, t->align); // align | 779 ot = duint8(s, ot, t->align); // align |
780 ot = duint8(s, ot, t->align); // fieldAlign | 780 ot = duint8(s, ot, t->align); // fieldAlign |
781 | 781 |
782 gcprog = usegcprog(t); | 782 gcprog = usegcprog(t); |
783 i = kinds[t->etype]; | 783 i = kinds[t->etype]; |
784 if(t->etype == TARRAY && t->bound < 0) | 784 if(t->etype == TARRAY && t->bound < 0) |
785 i = KindSlice; | 785 i = KindSlice; |
786 if(!haspointers(t)) | 786 if(!haspointers(t)) |
787 i |= KindNoPointers; | 787 i |= KindNoPointers; |
| 788 if(isdirectiface(t)) |
| 789 i |= KindDirectIface; |
788 if(gcprog) | 790 if(gcprog) |
789 i |= KindGCProg; | 791 i |= KindGCProg; |
790 ot = duint8(s, ot, i); // kind | 792 ot = duint8(s, ot, i); // kind |
791 if(alg >= 0) | 793 if(alg >= 0) |
792 ot = dsymptr(s, ot, algarray, alg*sizeofAlg); | 794 ot = dsymptr(s, ot, algarray, alg*sizeofAlg); |
793 else | 795 else |
794 ot = dsymptr(s, ot, algsym, 0); | 796 ot = dsymptr(s, ot, algsym, 0); |
795 // gc | 797 // gc |
796 if(gcprog) { | 798 if(gcprog) { |
797 gengcprog(t, &gcprog0, &gcprog1); | 799 gengcprog(t, &gcprog0, &gcprog1); |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 gengcprog1(g, t1->type, xoffset); | 1564 gengcprog1(g, t1->type, xoffset); |
1563 o = fieldoffset + t1->type->width; | 1565 o = fieldoffset + t1->type->width; |
1564 } | 1566 } |
1565 proggenskip(g, *xoffset, t->width - o); | 1567 proggenskip(g, *xoffset, t->width - o); |
1566 *xoffset += t->width - o; | 1568 *xoffset += t->width - o; |
1567 break; | 1569 break; |
1568 default: | 1570 default: |
1569 fatal("gengcprog1: unexpected type, %T", t); | 1571 fatal("gengcprog1: unexpected type, %T", t); |
1570 } | 1572 } |
1571 } | 1573 } |
OLD | NEW |