comparison dmd/TypeFunction.d @ 95:ae5b11064a9a

beginning of 2.036 branch
author Trass3r
date Mon, 30 Aug 2010 23:08:44 +0200
parents 43073c7c7769
children acd69f84627e
comparison
equal deleted inserted replaced
93:df6d0f967680 95:ae5b11064a9a
651 * through a hidden pointer to the caller's stack. 651 * through a hidden pointer to the caller's stack.
652 */ 652 */
653 RET retStyle() 653 RET retStyle()
654 { 654 {
655 //printf("TypeFunction.retStyle() %s\n", toChars()); 655 //printf("TypeFunction.retStyle() %s\n", toChars());
656 version (DMDV2) { 656 version (DMDV2)
657 {
657 if (isref) 658 if (isref)
658 return RET.RETregs; // returns a pointer 659 return RET.RETregs; // returns a pointer
659 } 660 }
660 661
661 Type tn = next.toBasetype(); 662 Type tn = next.toBasetype();
662 663 Type tns = tn;
663 if (tn.ty == TY.Tstruct) 664 ulong sz = tn.size();
665
666 version(SARRAYVALUE)
667 {
668 if (tn.ty == Tsarray)
669 {
670 do
671 {
672 tns = tns.nextOf().toBasetype();
673 } while (tns.ty == Tsarray);
674 if (tns.ty != Tstruct)
675 {
676 if (global.params.isLinux && linkage != LINKd)
677 {}
678 else
679 {
680 switch (sz)
681 { case 1:
682 case 2:
683 case 4:
684 case 8:
685 return RETregs; // return small structs in regs
686 // (not 3 byte structs!)
687 default:
688 break;
689 }
690 }
691 return RETstack;
692 }
693 }
694 }
695 if (tns.ty == TY.Tstruct)
664 { 696 {
665 StructDeclaration sd = (cast(TypeStruct)tn).sym; 697 StructDeclaration sd = (cast(TypeStruct)tn).sym;
666 if (global.params.isLinux && linkage != LINK.LINKd) { 698 if (global.params.isLinux && linkage != LINK.LINKd) {
667 ; 699 ;
668 } 700 }
669 ///version (DMDV2) { 701 ///version (DMDV2) { // TODO:
670 else if (sd.dtor || sd.cpctor) { 702 else if (sd.dtor || sd.cpctor)
671 ; 703 {
672 } 704 }
673 ///} 705 ///}
674 else 706 else
675 { 707 {
676 switch (cast(int)tn.size()) 708 switch (sz)
677 { 709 {
678 case 1: 710 case 1:
679 case 2: 711 case 2:
680 case 4: 712 case 4:
681 case 8: 713 case 8: