Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(9)

Side by Side Diff: src/cmd/gc/reflect.c

Issue 5316043: code review 5316043: gc: clean up printing. (Closed)
Patch Set: diff -r b3069ca75051 https://go.googlecode.com/hg/ Created 13 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
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 8
9 /* 9 /*
10 * runtime interface and reflection data structures 10 * runtime interface and reflection data structures
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 ot = duint32(s, ot, typehash(t)); 585 ot = duint32(s, ot, typehash(t));
586 ot = duint8(s, ot, algtype(t)); 586 ot = duint8(s, ot, algtype(t));
587 ot = duint8(s, ot, t->align); // align 587 ot = duint8(s, ot, t->align); // align
588 ot = duint8(s, ot, t->align); // fieldAlign 588 ot = duint8(s, ot, t->align); // fieldAlign
589 i = kinds[t->etype]; 589 i = kinds[t->etype];
590 if(t->etype == TARRAY && t->bound < 0) 590 if(t->etype == TARRAY && t->bound < 0)
591 i = KindSlice; 591 i = KindSlice;
592 if(!haspointers(t)) 592 if(!haspointers(t))
593 i |= KindNoPointers; 593 i |= KindNoPointers;
594 ot = duint8(s, ot, i); // kind 594 ot = duint8(s, ot, i); // kind
595 » longsymnames = 1; 595 » p = smprint("%-uT", t);
596 » p = smprint("%-T", t); 596 » //print("dcommontype: %s\n", p);
597 » longsymnames = 0;
598 ot = dgostringptr(s, ot, p); // string 597 ot = dgostringptr(s, ot, p); // string
599 free(p); 598 free(p);
600 ········ 599 ········
601 // skip pointer to extraType, 600 // skip pointer to extraType,
602 // which follows the rest of this type structure. 601 // which follows the rest of this type structure.
603 // caller will fill in if needed. 602 // caller will fill in if needed.
604 // otherwise linker will assume 0. 603 // otherwise linker will assume 0.
605 ot += widthptr; 604 ot += widthptr;
606 605
607 ot = dsymptr(s, ot, sptr, 0); // ptrto type 606 ot = dsymptr(s, ot, sptr, 0); // ptrto type
608 return ot; 607 return ot;
609 } 608 }
610 609
611 Sym* 610 Sym*
612 typesym(Type *t) 611 typesym(Type *t)
613 { 612 {
614 char *p; 613 char *p;
615 Sym *s; 614 Sym *s;
616 615
617 » p = smprint("%#-T", t); 616 » p = smprint("%-T", t);
618 s = pkglookup(p, typepkg); 617 s = pkglookup(p, typepkg);
618 //print("typesym: %s -> %+S\n", p, s);
619 free(p); 619 free(p);
620 return s; 620 return s;
621 } 621 }
622 622
623 Node* 623 Node*
624 typename(Type *t) 624 typename(Type *t)
625 { 625 {
626 Sym *s; 626 Sym *s;
627 Node *n; 627 Node *n;
628 628
(...skipping 26 matching lines...) Expand all
655 char *p; 655 char *p;
656 Sym *s; 656 Sym *s;
657 static Pkg *weak; 657 static Pkg *weak;
658 ········ 658 ········
659 if(weak == nil) { 659 if(weak == nil) {
660 weak = mkpkg(strlit("weak.type")); 660 weak = mkpkg(strlit("weak.type"));
661 weak->name = "weak.type"; 661 weak->name = "weak.type";
662 weak->prefix = "weak.type"; // not weak%2etype 662 weak->prefix = "weak.type"; // not weak%2etype
663 } 663 }
664 ········ 664 ········
665 » p = smprint("%#-T", t); 665 » if (t == bytetype || t == runetype)
rsc 2011/10/31 15:04:45 This should be unnecessary: the print format shoul
lvd 2011/10/31 15:39:55 yes, leftover from earlier iteration. gone.
666 » » t = types[t->etype];
667
668 » p = smprint("%-T", t);
666 s = pkglookup(p, weak); 669 s = pkglookup(p, weak);
670 //print("weaktypesym: %s -> %+S\n", p, s);
667 free(p); 671 free(p);
668 return s; 672 return s;
669 } 673 }
670 674
671 static Sym* 675 static Sym*
672 dtypesym(Type *t) 676 dtypesym(Type *t)
673 { 677 {
674 int ot, xt, n, isddd, dupok; 678 int ot, xt, n, isddd, dupok;
675 Sym *s, *s1, *s2; 679 Sym *s, *s1, *s2;
676 Sig *a, *m; 680 Sig *a, *m;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 for(i=1; i<=TBOOL; i++) 905 for(i=1; i<=TBOOL; i++)
902 dtypesym(ptrto(types[i])); 906 dtypesym(ptrto(types[i]));
903 dtypesym(ptrto(types[TSTRING])); 907 dtypesym(ptrto(types[TSTRING]));
904 dtypesym(ptrto(types[TUNSAFEPTR])); 908 dtypesym(ptrto(types[TUNSAFEPTR]));
905 ················ 909 ················
906 // add paths for runtime and main, which 6l imports implicitly. 910 // add paths for runtime and main, which 6l imports implicitly.
907 dimportpath(runtimepkg); 911 dimportpath(runtimepkg);
908 dimportpath(mkpkg(strlit("main"))); 912 dimportpath(mkpkg(strlit("main")));
909 } 913 }
910 } 914 }
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b