Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 798

Show
Ignore:
Timestamp:
12/12/10 05:49:13 (14 years ago)
Author:
walter
Message:

more 64

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dmd-1.x/src/backend/cg87.c

    r790 r798  
    19641964         */ 
    19651965        if (op1 == 0xDB) 
    19661966        { 
    19671967            cs.Iop = 0xC7;                      // MOV EA+10,0 
    19681968            NEWREG(cs.Irm, 0); 
    19691969            cs.IEV1.sp.Voffset += 10; 
    19701970            cs.IFL2 = FLconst; 
    19711971            cs.IEV2.Vint = 0; 
    19721972            cs.Iflags |= CFopsize; 
    19731973            c2 = gen(c2, &cs); 
    19741974        } 
    19751975        } 
    19761976#endif 
    19771977        if (tysize[TYldouble] == 16) 
    19781978        { 
    19791979        /* This deals with the fact that 10 byte reals really 
    19801980         * occupy 16 bytes by zeroing the extra 6 bytes. 
    19811981         */ 
    19821982        if (op1 == 0xDB) 
    19831983        { 
     1984            cs.Irex &= ~REX_W; 
    19841985            cs.Iop = 0xC7;                      // MOV EA+10,0 
    19851986            NEWREG(cs.Irm, 0); 
    19861987            cs.IEV1.sp.Voffset += 10; 
    19871988            cs.IFL2 = FLconst; 
    19881989            cs.IEV2.Vint = 0; 
    19891990            cs.Iflags |= CFopsize; 
    19901991            c2 = gen(c2, &cs); 
    19911992 
    19921993            cs.IEV1.sp.Voffset += 2; 
    19931994            cs.Iflags &= ~CFopsize; 
    19941995            c2 = gen(c2, &cs); 
    19951996        } 
    19961997        } 
    19971998#endif 
    19981999        c2 = genfwait(c2); 
    19992000        freenode(e->E1); 
    20002001        c1 = cat3(c1,c2,fixresult87(e,mST0 | mPSW,pretregs)); 
    20012002        return c1; 
    20022003} 
    20032004 
  • branches/dmd-1.x/src/backend/cod1.c

    r790 r798  
    824824  //elem_print(e); 
    825825  assert(e); 
    826826  elem_debug(e); 
    827827  if (e->Eoper == OPvar || e->Eoper == OPrelconst) 
    828828  {     s = e->EV.sp.Vsym; 
    829829        fl = s->Sfl; 
    830830        if (tyfloating(s->ty())) 
    831831            obj_fltused(); 
    832832  } 
    833833  else 
    834834        fl = FLoper; 
    835835  pcs->IFL1 = fl; 
    836836  pcs->Iflags = CFoff;                  /* only want offsets            */ 
    837837  pcs->Irex = 0; 
    838838  pcs->IEVoffset1 = 0; 
    839839 
    840840  tym_t ty = e->Ety; 
    841841  unsigned sz = tysize(ty); 
    842842  if (tyfloating(ty)) 
    843843        obj_fltused(); 
    844   else if (I64 && (sz == 8 || sz == 16)) 
     844  if (I64 && (sz == 8 || sz == 16)) 
    845845        pcs->Irex |= REX_W; 
    846846  if (!I16 && sz == SHORTSIZE) 
    847847        pcs->Iflags |= CFopsize; 
    848848  if (ty & mTYvolatile) 
    849849        pcs->Iflags |= CFvolatile; 
    850850  c = CNIL; 
    851851  switch (fl) 
    852852  { 
    853853#if 0 && TARGET_LINUX 
    854854    case FLgot: 
    855855    case FLgotoff: 
    856856        gotref = 1; 
    857857        pcs->IEVsym1 = s; 
    858858        pcs->IEVoffset1 = e->EV.sp.Voffset; 
    859859        if (e->Eoper == OPvar && fl == FLgot) 
    860860        { 
    861861            code *c1; 
    862862            unsigned saveop = pcs->Iop; 
    863863            idxregs = allregs & ~keepmsk;       // get a scratch register 
    864864            c = allocreg(&idxregs,&reg,TYptr); 
     
    34693469            while ((targ_int)(sz -= regsize) > 0) 
    34703470            {   ce = cat(ce,loadea(e,&cs,0xFF,6,sz - regsize,RMload,0)); 
    34713471                code_orflag(ce,flag); 
    34723472                ce = genadjesp(ce,REGSIZE); 
    34733473            } 
    34743474        } 
    34753475    L2: 
    34763476        freenode(e); 
    34773477        c = cat(c,ce); 
    34783478        goto ret; 
    34793479    case OPconst: 
    34803480    { 
    34813481        char pushi = 0; 
    34823482        unsigned flag = 0; 
    34833483        int regsize = REGSIZE; 
    34843484        targ_int value; 
    34853485 
    34863486        if (tycomplex(tym)) 
    34873487            break; 
    34883488 
     3489        if (I64 && tyfloating(tym) && sz > 4 && boolres(e)) 
     3490            // Can't push 64 bit non-zero args directly 
     3491            break; 
     3492 
    34893493        if (I32 && szb == 10)           // special case for long double constants 
    34903494        { 
    34913495            assert(sz == 12); 
    34923496            value = ((unsigned short *)&e->EV.Vldouble)[4]; 
    34933497            stackpush += sz; 
    34943498            ce = genadjesp(NULL,sz); 
    34953499            for (int i = 2; i >= 0; i--) 
    34963500            { 
    34973501                if (reghasvalue(allregs, value, &reg)) 
    34983502                    ce = gen1(ce,0x50 + reg);           // PUSH reg 
    34993503                else 
    35003504                    ce = genc2(ce,0x68,0,value);        // PUSH value 
    35013505                value = ((unsigned *)&e->EV.Vldouble)[i - 1]; 
    35023506            } 
    35033507            goto L2; 
    35043508        } 
    35053509 
    35063510        assert(I64 || sz <= LNGDBLSIZE); 
    35073511        int i = sz; 
    35083512        if (!I16 && i == 2) 
     
    35183522        } 
    35193523        else if (i == REGSIZE) 
    35203524            break; 
    35213525 
    35223526        stackpush += sz; 
    35233527        ce = genadjesp(NULL,sz); 
    35243528        targ_uns *pi = (targ_uns *) &e->EV.Vdouble; 
    35253529        targ_ushort *ps = (targ_ushort *) pi; 
    35263530        targ_ullong *pl = (targ_ullong *)pi; 
    35273531        i /= regsize; 
    35283532        do 
    35293533        {   code *cp; 
    35303534 
    35313535            if (i)                      /* be careful not to go negative */ 
    35323536                i--; 
    35333537            targ_size_t value = (regsize == 4) ? pi[i] : ps[i]; 
    35343538            if (regsize == 8) 
    35353539                value = pl[i]; 
    35363540            if (pushi) 
    35373541            { 
     3542                if (I64 && regsize == 8 && value != (int)value) 
     3543                {   ce = regwithvalue(ce,allregs,value,&reg,64); 
     3544                    goto Preg;          // cannot push imm64 unless it is sign extended 32 bit value 
     3545                } 
    35383546                if (regsize == REGSIZE && reghasvalue(allregs,value,&reg)) 
    35393547                    goto Preg; 
    35403548                ce = genc2(ce,(szb == 1) ? 0x6A : 0x68,0,value); // PUSH value 
    35413549            } 
    35423550            else 
    35433551            { 
    35443552                ce = regwithvalue(ce,allregs,value,&reg,0); 
    35453553            Preg: 
    35463554                ce = genpush(ce,reg);         // PUSH reg 
    35473555            } 
    35483556            code_orflag(ce,flag);                       /* operand size */ 
    35493557        } while (i); 
    35503558        goto L2; 
    35513559    } 
    35523560    default: 
    35533561        break; 
    35543562  } 
    35553563  retregs = tybyte(tym) ? BYTEREGS : allregs; 
    35563564  if (tyfloating(tym)) 
    35573565  {     if (config.inline8087) 
  • branches/dmd-1.x/src/backend/cod4.c

    r772 r798  
    18831883 
    18841884      case OPconst: 
    18851885        // If compare against 0 
    18861886        if (sz <= REGSIZE && *pretregs == mPSW && !boolres(e2) && 
    18871887            isregvar(e1,&retregs,&reg) 
    18881888           ) 
    18891889        {   // Just do a TEST instruction 
    18901890            c = genregs(NULL,0x85 ^ byte,reg,reg);      // TEST reg,reg 
    18911891            c->Iflags |= (cs.Iflags & CFopsize) | CFpsw; 
    18921892            code_orrex(c, rex); 
    18931893            if (I64 && byte && reg >= 4) 
    18941894                c->Irex |= REX;                 // address byte registers 
    18951895            retregs = mPSW; 
    18961896            break; 
    18971897        } 
    18981898 
    18991899        if (!tyuns(tym) && !tyuns(e2->Ety) && 
    19001900            !boolres(e2) && !(*pretregs & mPSW) && 
    19011901            (sz == REGSIZE || (I64 && sz == 4)) && 
    19021902            (!I16 || op == OPlt || op == OPge)) 
    1903         {   unsigned regi; 
    1904  
     1903        { 
    19051904            assert(*pretregs & (allregs)); 
    19061905            cl = codelem(e1,pretregs,FALSE); 
    19071906            reg = findreg(*pretregs); 
    19081907            c = getregs(mask[reg]); 
    19091908            switch (op) 
    19101909            {   case OPle: 
    19111910                    c = genc2(c,0x81,grex | modregrmx(3,0,reg & 7),(unsigned)-1);   // ADD reg,-1 
    19121911                    genc2(c,0x81,grex | modregrmx(3,2,reg & 7),0);          // ADC reg,0 
    19131912                    goto oplt; 
    19141913                case OPgt: 
    19151914                    c = gen2(c,0xF7,grex | modregrmx(3,3,reg & 7));         // NEG reg 
    19161915#if TARGET_WINDOS 
    19171916                    // What does the Windows platform do? 
    19181917                    //  lower INT_MIN by 1?   See test exe9.c 
    19191918                    // BUG: fix later 
    19201919                    genc2(c,0x81,grex | modregrmx(3,3,reg & 7),0);  // SBB reg,0 
    19211920#endif 
    19221921                    goto oplt; 
    19231922                case OPlt: 
    19241923                oplt: 
    19251924                    if (!I16) 
    19261925                        c = genc2(c,0xC1,grex | modregrmx(3,5,reg & 7),sz * 8 - 1); // SHR reg,31 
    19271926                    else 
    19281927                    {   /* 8088-286 do not have a barrel shifter, so use this 
    19291928                           faster sequence 
    19301929                         */ 
    19311930                        c = genregs(c,0xD1,0,reg);              /* ROL reg,1    */ 
     1931                        unsigned regi; 
    19321932                        if (reghasvalue(allregs,1,&regi)) 
    19331933                            c = genregs(c,0x23,reg,regi);       /* AND reg,regi */ 
    19341934                        else 
    19351935                            c = genc2(c,0x81,modregrm(3,4,reg),1); /* AND reg,1 */ 
    19361936                    } 
    19371937                    break; 
    19381938                case OPge: 
    19391939                    c = genregs(c,0xD1,4,reg);          /* SHL reg,1    */ 
    19401940                    code_orrex(c,rex); 
    19411941                    genregs(c,0x19,reg,reg);            /* SBB reg,reg  */ 
    19421942                    code_orrex(c,rex); 
    19431943                    if (I64) 
    19441944                    { 
    19451945                        c = gen2(c,0xFF,modregrmx(3,0,reg));    // INC reg 
    19461946                        code_orrex(c, rex); 
    19471947                    } 
    19481948                    else 
    19491949                        c = gen1(c,0x40 + reg);                 // INC reg 
    19501950                    break; 
    19511951 
    19521952                default: 
    19531953                    assert(0); 
    19541954            } 
    19551955            freenode(e2); 
    19561956            goto ret; 
    19571957        } 
    19581958 
    1959         if (sz > REGSIZE) 
     1959        cs.IFL2 = FLconst; 
     1960        if (sz == 16) 
     1961            cs.IEV2.Vsize_t = e2->EV.Vcent.msw; 
     1962        else if (sz > REGSIZE) 
    19601963            cs.IEV2.Vint = MSREG(e2->EV.Vllong); 
    19611964        else 
    1962             cs.IEV2.Vint = e2->EV.Vint; 
    1963         cs.IFL2 = FLconst; 
     1965            cs.IEV2.Vsize_t = e2->EV.Vllong; 
     1966 
     1967        // The cmp immediate relies on sign extension of the 32 bit immediate value 
     1968        if (I64 && sz >= REGSIZE && cs.IEV2.Vsize_t != (int)cs.IEV2.Vint) 
     1969            goto L2; 
    19641970      L4: 
    19651971        cs.Iop = 0x81 ^ byte; 
    19661972 
    19671973        /* if ((e1 is data or a '*' reference) and it's not a 
    19681974         * common subexpression 
    19691975         */ 
    19701976 
    19711977        if ((e1->Eoper == OPvar && datafl[el_fl(e1)] || 
    19721978             e1->Eoper == OPind) && 
    19731979            !evalinregister(e1)) 
    19741980        {       cl = getlvalue(&cs,e1,RMload); 
    19751981                freenode(e1); 
    19761982                if (evalinregister(e2)) 
    19771983                { 
    19781984                    retregs = idxregm(&cs); 
    19791985                    if ((cs.Iflags & CFSEG) == CFes) 
    19801986                            retregs |= mES;             /* take no chances */ 
    19811987                    rretregs = allregs & ~retregs; 
    19821988                    if (byte) 
    19831989                            rretregs &= BYTEREGS; 
  • branches/dmd-1.x/src/backend/dwarf.c

    r691 r798  
    100100#else 
    101101    assert(0); 
    102102#endif 
    103103} 
    104104 
    105105/************************  DWARF DEBUG OUTPUT ********************************/ 
    106106 
    107107// Dwarf Symbolic Debugging Information 
    108108 
    109109struct CFA_reg 
    110110{ 
    111111    int offset;                 // offset from CFA 
    112112}; 
    113113 
    114114// Current CFA state for .debug_frame 
    115115struct CFA_state 
    116116{ 
    117117    size_t location; 
    118118    int reg;                    // CFA register number 
    119119    int offset;                 // CFA register offset 
    120     CFA_reg regstates[9];       // register states 
     120    CFA_reg regstates[17];      // register states 
    121121}; 
    122122 
    123123static CFA_state CFA_state_init =       // initial CFA state as defined by CIE 
    124124{   0,          // location 
    125125    SP,         // register 
    126126    4,          // offset 
    127127    {   { 0 },  // 0: EAX 
    128128        { 0 },  // 1: ECX 
    129129        { 0 },  // 2: EDX 
    130130        { 0 },  // 3: EBX 
    131131        { 0 },  // 4: ESP 
    132132        { 0 },  // 5: EBP 
    133133        { 0 },  // 6: ESI 
    134134        { 0 },  // 7: EDI 
    135135        { -4 }, // 8: EIP 
    136136    } 
    137137}; 
    138138static CFA_state CFA_state_current;     // current CFA state 
    139139static Outbuffer cfa_buf;               // CFA instructions 
    140140 
  • branches/dmd-1.x/src/backend/ptrntab.c

    r714 r798  
    691691        { 0xc1, op|_ib|_32_bit, _rm32,  _imm8, },       \ 
    692692        { 0xd3, op|_64_bit,     _rm64,  _cl },  \ 
    693693        { 0xc1, op|_ib|_64_bit, _rm64,  _imm8, },       \ 
    694694        { ASM_END, 0, 0, 0 }    \ 
    695695} 
    696696 
    697697OPTABLE(ROL,_0); 
    698698OPTABLE(ROR,_1); 
    699699OPTABLE(RCL,_2); 
    700700OPTABLE(RCR,_3); 
    701701OPTABLE(SHL,_4); 
    702702OPTABLE(SHR,_5); 
    703703OPTABLE(SAR,_7); 
    704704 
    705705#undef OPTABLE 
    706706 
    707707PTRNTAB2  aptb2TEST[] = /* TEST */ { 
    708708        { 0xa8, _ib|_modnot1,           _al,    _imm8 }, 
    709709        { 0xa9, _iw|_16_bit|_modnot1,   _ax,    _imm16 }, 
    710710        { 0xa9, _id|_32_bit|_modnot1,   _eax,   _imm32 }, 
     711        { 0xa9, _id|_64_bit|_modnot1,   _rax,   _imm32 }, 
    711712        { 0xf6, _0|_modnot1,            _rm8,   _imm8 }, 
    712713        { 0xf7, _0|_16_bit|_modnot1,    _rm16,  _imm16 }, 
    713714        { 0xf7, _0|_32_bit|_modnot1,    _rm32,  _imm32 }, 
     715        { 0xf7, _0|_64_bit|_modnot1,    _rm64,  _imm32 }, 
    714716        { 0x84, _r|_modnot1,            _rm8,   _r8 }, 
    715717        { 0x85, _r|_16_bit|_modnot1,    _rm16,  _r16 }, 
    716718        { 0x85, _r|_32_bit|_modnot1,    _rm32,  _r32 }, 
     719        { 0x85, _r|_64_bit|_modnot1,    _rm64,  _r64 }, 
    717720        { ASM_END, 0, 0, 0 } 
    718721}; 
    719722PTRNTAB2  aptb2XADD[] = /* XADD */ {                    // 486 only instruction 
    720723//      { 0x0fc0,       _ib | _I386|_mod2, _rm8, _r8 }, 
    721724//      { 0x0fc1,       _iw | _I386|_16_bit|_mod2, _rm16, _r16 }, 
    722725//      { 0x0fc1,       _id | _I386|_32_bit|_mod2, _rm32, _r32 }, 
    723726        { 0x0fc0,       _r | _I386|_mod2, _rm8, _r8 }, 
    724727        { 0x0fc1,       _r | _I386|_16_bit|_mod2, _rm16, _r16 }, 
    725728        { 0x0fc1,       _r | _I386|_32_bit|_mod2, _rm32, _r32 }, 
    726729        { ASM_END, 0, 0, 0 } 
    727730}; 
    728731PTRNTAB2  aptb2XCHG[] = /* XCHG */ { 
    729732        { 0x90, _r|_16_bit|_mod2,       _ax ,   _r16 | _plus_r }, 
    730733        { 0x90, _r|_16_bit|_mod2,       _r16 | _plus_r, _ax  }, 
    731734        { 0x90, _r|_32_bit|_mod2,       _eax,   _r32 | _plus_r }, 
    732735        { 0x90, _r|_32_bit|_mod2,       _r32 | _plus_r, _eax }, 
    733736        { 0x86, _r|_mod2,               _rm8,   _r8 }, 
    734737        { 0x86, _r|_mod2,               _r8,    _rm8 }, 
    735738        { 0x87, _r|_16_bit|_mod2,               _rm16,  _r16 }, 
    736739        { 0x87, _r|_16_bit|_mod2,               _r16, _rm16 }, 
  • branches/dmd-1.x/src/expression.c

    r779 r798  
    26732673int StringExp::compare(Object *obj) 
    26742674{ 
    26752675    // Used to sort case statement expressions so we can do an efficient lookup 
    26762676    StringExp *se2 = (StringExp *)(obj); 
    26772677 
    26782678    // This is a kludge so isExpression() in template.c will return 5 
    26792679    // for StringExp's. 
    26802680    if (!se2) 
    26812681        return 5; 
    26822682 
    26832683    assert(se2->op == TOKstring); 
    26842684 
    26852685    int len1 = len; 
    26862686    int len2 = se2->len; 
    26872687 
    26882688    if (len1 == len2) 
    26892689    { 
    26902690        switch (sz) 
    26912691        { 
    26922692            case 1: 
    2693                 return strcmp((char *)string, (char *)se2->string); 
     2693                return memcmp((char *)string, (char *)se2->string, len1); 
    26942694 
    26952695            case 2: 
    26962696            {   unsigned u; 
    26972697                d_wchar *s1 = (d_wchar *)string; 
    26982698                d_wchar *s2 = (d_wchar *)se2->string; 
    26992699 
    27002700                for (u = 0; u < len; u++) 
    27012701                { 
    27022702                    if (s1[u] != s2[u]) 
    27032703                        return s1[u] - s2[u]; 
    27042704                } 
    27052705            } 
    27062706 
    27072707            case 4: 
    27082708            {   unsigned u; 
    27092709                d_dchar *s1 = (d_dchar *)string; 
    27102710                d_dchar *s2 = (d_dchar *)se2->string; 
    27112711 
    27122712                for (u = 0; u < len; u++) 
    27132713                { 
  • branches/dmd-1.x/src/toobj.c

    r662 r798  
    8787    // name[] 
    8888    const char *name = toPrettyChars(); 
    8989    size_t namelen = strlen(name); 
    9090    dtsize_t(&dt, namelen); 
    9191    dtabytes(&dt, TYnptr, 0, namelen + 1, name); 
    9292 
    9393    ClassDeclarations aclasses; 
    9494 
    9595    //printf("members->dim = %d\n", members->dim); 
    9696    for (int i = 0; i < members->dim; i++) 
    9797    {   Dsymbol *member = (Dsymbol *)members->data[i]; 
    9898 
    9999        //printf("\tmember '%s'\n", member->toChars()); 
    100100        member->addLocalClass(&aclasses); 
    101101    } 
    102102 
    103103    // importedModules[] 
    104104    int aimports_dim = aimports.dim; 
    105105    for (int i = 0; i < aimports.dim; i++) 
    106106    {   Module *m = (Module *)aimports.data[i]; 
    107         if (!m->needModuleInfo()
     107        if (!m->needmoduleinfo
    108108            aimports_dim--; 
    109109    } 
    110110    dtsize_t(&dt, aimports_dim); 
    111111    if (aimports_dim) 
    112112        dtxoff(&dt, csym, sizeof_ModuleInfo, TYnptr); 
    113113    else 
    114114        dtsize_t(&dt, 0); 
    115115 
    116116    // localClasses[] 
    117117    dtsize_t(&dt, aclasses.dim); 
    118118    if (aclasses.dim) 
    119119        dtxoff(&dt, csym, sizeof_ModuleInfo + aimports_dim * PTRSIZE, TYnptr); 
    120120    else 
    121121        dtsize_t(&dt, 0); 
    122122 
    123123    if (needmoduleinfo) 
    124124        dtsize_t(&dt, 8|0);              // flags (4 means MIstandalone) 
    125125    else 
    126126        dtsize_t(&dt, 8|4);              // flags (4 means MIstandalone) 
    127127 
     
    148148#endif 
    149149        dtsize_t(&dt, 0);                        // xgetMembers 
    150150 
    151151    if (sictor) 
    152152        dtxoff(&dt, sictor, 0, TYnptr); 
    153153    else 
    154154        dtsize_t(&dt, 0); 
    155155 
    156156#if DMDV2 
    157157    // void*[4] reserved; 
    158158    dtsize_t(&dt, 0); 
    159159    dtsize_t(&dt, 0); 
    160160    dtsize_t(&dt, 0); 
    161161    dtsize_t(&dt, 0); 
    162162#endif 
    163163    ////////////////////////////////////////////// 
    164164 
    165165    for (int i = 0; i < aimports.dim; i++) 
    166166    {   Module *m = (Module *)aimports.data[i]; 
    167167 
    168         if (m->needModuleInfo()
     168        if (m->needmoduleinfo
    169169        {   Symbol *s = m->toSymbol(); 
    170170 
    171171            /* Weak references don't pull objects in from the library, 
    172172             * they resolve to 0 if not pulled in by something else. 
    173173             * Don't pull in a module just because it was imported. 
    174174             */ 
    175175#if !OMFOBJ // Optlink crashes with weak symbols at EIP 41AFE7, 402000 
    176176            s->Sflags |= SFLweak; 
    177177#endif 
    178178            dtxoff(&dt, s, 0, TYnptr); 
    179179        } 
    180180    } 
    181181 
    182182    for (int i = 0; i < aclasses.dim; i++) 
    183183    { 
    184184        ClassDeclaration *cd = (ClassDeclaration *)aclasses.data[i]; 
    185185        dtxoff(&dt, cd->toSymbol(), 0, TYnptr); 
    186186    } 
    187187 
    188188    csym->Sdt = dt; 
  • trunk/src/backend/cg87.c

    r790 r798  
    19641964         */ 
    19651965        if (op1 == 0xDB) 
    19661966        { 
    19671967            cs.Iop = 0xC7;                      // MOV EA+10,0 
    19681968            NEWREG(cs.Irm, 0); 
    19691969            cs.IEV1.sp.Voffset += 10; 
    19701970            cs.IFL2 = FLconst; 
    19711971            cs.IEV2.Vint = 0; 
    19721972            cs.Iflags |= CFopsize; 
    19731973            c2 = gen(c2, &cs); 
    19741974        } 
    19751975        } 
    19761976#endif 
    19771977        if (tysize[TYldouble] == 16) 
    19781978        { 
    19791979        /* This deals with the fact that 10 byte reals really 
    19801980         * occupy 16 bytes by zeroing the extra 6 bytes. 
    19811981         */ 
    19821982        if (op1 == 0xDB) 
    19831983        { 
     1984            cs.Irex &= ~REX_W; 
    19841985            cs.Iop = 0xC7;                      // MOV EA+10,0 
    19851986            NEWREG(cs.Irm, 0); 
    19861987            cs.IEV1.sp.Voffset += 10; 
    19871988            cs.IFL2 = FLconst; 
    19881989            cs.IEV2.Vint = 0; 
    19891990            cs.Iflags |= CFopsize; 
    19901991            c2 = gen(c2, &cs); 
    19911992 
    19921993            cs.IEV1.sp.Voffset += 2; 
    19931994            cs.Iflags &= ~CFopsize; 
    19941995            c2 = gen(c2, &cs); 
    19951996        } 
    19961997        } 
    19971998#endif 
    19981999        c2 = genfwait(c2); 
    19992000        freenode(e->E1); 
    20002001        c1 = cat3(c1,c2,fixresult87(e,mST0 | mPSW,pretregs)); 
    20012002        return c1; 
    20022003} 
    20032004 
  • trunk/src/backend/cod1.c

    r790 r798  
    824824  //elem_print(e); 
    825825  assert(e); 
    826826  elem_debug(e); 
    827827  if (e->Eoper == OPvar || e->Eoper == OPrelconst) 
    828828  {     s = e->EV.sp.Vsym; 
    829829        fl = s->Sfl; 
    830830        if (tyfloating(s->ty())) 
    831831            obj_fltused(); 
    832832  } 
    833833  else 
    834834        fl = FLoper; 
    835835  pcs->IFL1 = fl; 
    836836  pcs->Iflags = CFoff;                  /* only want offsets            */ 
    837837  pcs->Irex = 0; 
    838838  pcs->IEVoffset1 = 0; 
    839839 
    840840  tym_t ty = e->Ety; 
    841841  unsigned sz = tysize(ty); 
    842842  if (tyfloating(ty)) 
    843843        obj_fltused(); 
    844   else if (I64 && (sz == 8 || sz == 16)) 
     844  if (I64 && (sz == 8 || sz == 16)) 
    845845        pcs->Irex |= REX_W; 
    846846  if (!I16 && sz == SHORTSIZE) 
    847847        pcs->Iflags |= CFopsize; 
    848848  if (ty & mTYvolatile) 
    849849        pcs->Iflags |= CFvolatile; 
    850850  c = CNIL; 
    851851  switch (fl) 
    852852  { 
    853853#if 0 && TARGET_LINUX 
    854854    case FLgot: 
    855855    case FLgotoff: 
    856856        gotref = 1; 
    857857        pcs->IEVsym1 = s; 
    858858        pcs->IEVoffset1 = e->EV.sp.Voffset; 
    859859        if (e->Eoper == OPvar && fl == FLgot) 
    860860        { 
    861861            code *c1; 
    862862            unsigned saveop = pcs->Iop; 
    863863            idxregs = allregs & ~keepmsk;       // get a scratch register 
    864864            c = allocreg(&idxregs,&reg,TYptr); 
     
    34693469            while ((targ_int)(sz -= regsize) > 0) 
    34703470            {   ce = cat(ce,loadea(e,&cs,0xFF,6,sz - regsize,RMload,0)); 
    34713471                code_orflag(ce,flag); 
    34723472                ce = genadjesp(ce,REGSIZE); 
    34733473            } 
    34743474        } 
    34753475    L2: 
    34763476        freenode(e); 
    34773477        c = cat(c,ce); 
    34783478        goto ret; 
    34793479    case OPconst: 
    34803480    { 
    34813481        char pushi = 0; 
    34823482        unsigned flag = 0; 
    34833483        int regsize = REGSIZE; 
    34843484        targ_int value; 
    34853485 
    34863486        if (tycomplex(tym)) 
    34873487            break; 
    34883488 
     3489        if (I64 && tyfloating(tym) && sz > 4 && boolres(e)) 
     3490            // Can't push 64 bit non-zero args directly 
     3491            break; 
     3492 
    34893493        if (I32 && szb == 10)           // special case for long double constants 
    34903494        { 
    34913495            assert(sz == 12); 
    34923496            value = ((unsigned short *)&e->EV.Vldouble)[4]; 
    34933497            stackpush += sz; 
    34943498            ce = genadjesp(NULL,sz); 
    34953499            for (int i = 2; i >= 0; i--) 
    34963500            { 
    34973501                if (reghasvalue(allregs, value, &reg)) 
    34983502                    ce = gen1(ce,0x50 + reg);           // PUSH reg 
    34993503                else 
    35003504                    ce = genc2(ce,0x68,0,value);        // PUSH value 
    35013505                value = ((unsigned *)&e->EV.Vldouble)[i - 1]; 
    35023506            } 
    35033507            goto L2; 
    35043508        } 
    35053509 
    35063510        assert(I64 || sz <= LNGDBLSIZE); 
    35073511        int i = sz; 
    35083512        if (!I16 && i == 2) 
     
    35183522        } 
    35193523        else if (i == REGSIZE) 
    35203524            break; 
    35213525 
    35223526        stackpush += sz; 
    35233527        ce = genadjesp(NULL,sz); 
    35243528        targ_uns *pi = (targ_uns *) &e->EV.Vdouble; 
    35253529        targ_ushort *ps = (targ_ushort *) pi; 
    35263530        targ_ullong *pl = (targ_ullong *)pi; 
    35273531        i /= regsize; 
    35283532        do 
    35293533        {   code *cp; 
    35303534 
    35313535            if (i)                      /* be careful not to go negative */ 
    35323536                i--; 
    35333537            targ_size_t value = (regsize == 4) ? pi[i] : ps[i]; 
    35343538            if (regsize == 8) 
    35353539                value = pl[i]; 
    35363540            if (pushi) 
    35373541            { 
     3542                if (I64 && regsize == 8 && value != (int)value) 
     3543                {   ce = regwithvalue(ce,allregs,value,&reg,64); 
     3544                    goto Preg;          // cannot push imm64 unless it is sign extended 32 bit value 
     3545                } 
    35383546                if (regsize == REGSIZE && reghasvalue(allregs,value,&reg)) 
    35393547                    goto Preg; 
    35403548                ce = genc2(ce,(szb == 1) ? 0x6A : 0x68,0,value); // PUSH value 
    35413549            } 
    35423550            else 
    35433551            { 
    35443552                ce = regwithvalue(ce,allregs,value,&reg,0); 
    35453553            Preg: 
    35463554                ce = genpush(ce,reg);         // PUSH reg 
    35473555            } 
    35483556            code_orflag(ce,flag);                       /* operand size */ 
    35493557        } while (i); 
    35503558        goto L2; 
    35513559    } 
    35523560    default: 
    35533561        break; 
    35543562  } 
    35553563  retregs = tybyte(tym) ? BYTEREGS : allregs; 
    35563564  if (tyfloating(tym)) 
    35573565  {     if (config.inline8087) 
  • trunk/src/backend/cod4.c

    r772 r798  
    18831883 
    18841884      case OPconst: 
    18851885        // If compare against 0 
    18861886        if (sz <= REGSIZE && *pretregs == mPSW && !boolres(e2) && 
    18871887            isregvar(e1,&retregs,&reg) 
    18881888           ) 
    18891889        {   // Just do a TEST instruction 
    18901890            c = genregs(NULL,0x85 ^ byte,reg,reg);      // TEST reg,reg 
    18911891            c->Iflags |= (cs.Iflags & CFopsize) | CFpsw; 
    18921892            code_orrex(c, rex); 
    18931893            if (I64 && byte && reg >= 4) 
    18941894                c->Irex |= REX;                 // address byte registers 
    18951895            retregs = mPSW; 
    18961896            break; 
    18971897        } 
    18981898 
    18991899        if (!tyuns(tym) && !tyuns(e2->Ety) && 
    19001900            !boolres(e2) && !(*pretregs & mPSW) && 
    19011901            (sz == REGSIZE || (I64 && sz == 4)) && 
    19021902            (!I16 || op == OPlt || op == OPge)) 
    1903         {   unsigned regi; 
    1904  
     1903        { 
    19051904            assert(*pretregs & (allregs)); 
    19061905            cl = codelem(e1,pretregs,FALSE); 
    19071906            reg = findreg(*pretregs); 
    19081907            c = getregs(mask[reg]); 
    19091908            switch (op) 
    19101909            {   case OPle: 
    19111910                    c = genc2(c,0x81,grex | modregrmx(3,0,reg & 7),(unsigned)-1);   // ADD reg,-1 
    19121911                    genc2(c,0x81,grex | modregrmx(3,2,reg & 7),0);          // ADC reg,0 
    19131912                    goto oplt; 
    19141913                case OPgt: 
    19151914                    c = gen2(c,0xF7,grex | modregrmx(3,3,reg & 7));         // NEG reg 
    19161915#if TARGET_WINDOS 
    19171916                    // What does the Windows platform do? 
    19181917                    //  lower INT_MIN by 1?   See test exe9.c 
    19191918                    // BUG: fix later 
    19201919                    genc2(c,0x81,grex | modregrmx(3,3,reg & 7),0);  // SBB reg,0 
    19211920#endif 
    19221921                    goto oplt; 
    19231922                case OPlt: 
    19241923                oplt: 
    19251924                    if (!I16) 
    19261925                        c = genc2(c,0xC1,grex | modregrmx(3,5,reg & 7),sz * 8 - 1); // SHR reg,31 
    19271926                    else 
    19281927                    {   /* 8088-286 do not have a barrel shifter, so use this 
    19291928                           faster sequence 
    19301929                         */ 
    19311930                        c = genregs(c,0xD1,0,reg);              /* ROL reg,1    */ 
     1931                        unsigned regi; 
    19321932                        if (reghasvalue(allregs,1,&regi)) 
    19331933                            c = genregs(c,0x23,reg,regi);       /* AND reg,regi */ 
    19341934                        else 
    19351935                            c = genc2(c,0x81,modregrm(3,4,reg),1); /* AND reg,1 */ 
    19361936                    } 
    19371937                    break; 
    19381938                case OPge: 
    19391939                    c = genregs(c,0xD1,4,reg);          /* SHL reg,1    */ 
    19401940                    code_orrex(c,rex); 
    19411941                    genregs(c,0x19,reg,reg);            /* SBB reg,reg  */ 
    19421942                    code_orrex(c,rex); 
    19431943                    if (I64) 
    19441944                    { 
    19451945                        c = gen2(c,0xFF,modregrmx(3,0,reg));    // INC reg 
    19461946                        code_orrex(c, rex); 
    19471947                    } 
    19481948                    else 
    19491949                        c = gen1(c,0x40 + reg);                 // INC reg 
    19501950                    break; 
    19511951 
    19521952                default: 
    19531953                    assert(0); 
    19541954            } 
    19551955            freenode(e2); 
    19561956            goto ret; 
    19571957        } 
    19581958 
    1959         if (sz > REGSIZE) 
     1959        cs.IFL2 = FLconst; 
     1960        if (sz == 16) 
     1961            cs.IEV2.Vsize_t = e2->EV.Vcent.msw; 
     1962        else if (sz > REGSIZE) 
    19601963            cs.IEV2.Vint = MSREG(e2->EV.Vllong); 
    19611964        else 
    1962             cs.IEV2.Vint = e2->EV.Vint; 
    1963         cs.IFL2 = FLconst; 
     1965            cs.IEV2.Vsize_t = e2->EV.Vllong; 
     1966 
     1967        // The cmp immediate relies on sign extension of the 32 bit immediate value 
     1968        if (I64 && sz >= REGSIZE && cs.IEV2.Vsize_t != (int)cs.IEV2.Vint) 
     1969            goto L2; 
    19641970      L4: 
    19651971        cs.Iop = 0x81 ^ byte; 
    19661972 
    19671973        /* if ((e1 is data or a '*' reference) and it's not a 
    19681974         * common subexpression 
    19691975         */ 
    19701976 
    19711977        if ((e1->Eoper == OPvar && datafl[el_fl(e1)] || 
    19721978             e1->Eoper == OPind) && 
    19731979            !evalinregister(e1)) 
    19741980        {       cl = getlvalue(&cs,e1,RMload); 
    19751981                freenode(e1); 
    19761982                if (evalinregister(e2)) 
    19771983                { 
    19781984                    retregs = idxregm(&cs); 
    19791985                    if ((cs.Iflags & CFSEG) == CFes) 
    19801986                            retregs |= mES;             /* take no chances */ 
    19811987                    rretregs = allregs & ~retregs; 
    19821988                    if (byte) 
    19831989                            rretregs &= BYTEREGS; 
  • trunk/src/backend/dwarf.c

    r691 r798  
    100100#else 
    101101    assert(0); 
    102102#endif 
    103103} 
    104104 
    105105/************************  DWARF DEBUG OUTPUT ********************************/ 
    106106 
    107107// Dwarf Symbolic Debugging Information 
    108108 
    109109struct CFA_reg 
    110110{ 
    111111    int offset;                 // offset from CFA 
    112112}; 
    113113 
    114114// Current CFA state for .debug_frame 
    115115struct CFA_state 
    116116{ 
    117117    size_t location; 
    118118    int reg;                    // CFA register number 
    119119    int offset;                 // CFA register offset 
    120     CFA_reg regstates[9];       // register states 
     120    CFA_reg regstates[17];      // register states 
    121121}; 
    122122 
    123123static CFA_state CFA_state_init =       // initial CFA state as defined by CIE 
    124124{   0,          // location 
    125125    SP,         // register 
    126126    4,          // offset 
    127127    {   { 0 },  // 0: EAX 
    128128        { 0 },  // 1: ECX 
    129129        { 0 },  // 2: EDX 
    130130        { 0 },  // 3: EBX 
    131131        { 0 },  // 4: ESP 
    132132        { 0 },  // 5: EBP 
    133133        { 0 },  // 6: ESI 
    134134        { 0 },  // 7: EDI 
    135135        { -4 }, // 8: EIP 
    136136    } 
    137137}; 
    138138static CFA_state CFA_state_current;     // current CFA state 
    139139static Outbuffer cfa_buf;               // CFA instructions 
    140140 
  • trunk/src/backend/ptrntab.c

    r714 r798  
    691691        { 0xc1, op|_ib|_32_bit, _rm32,  _imm8, },       \ 
    692692        { 0xd3, op|_64_bit,     _rm64,  _cl },  \ 
    693693        { 0xc1, op|_ib|_64_bit, _rm64,  _imm8, },       \ 
    694694        { ASM_END, 0, 0, 0 }    \ 
    695695} 
    696696 
    697697OPTABLE(ROL,_0); 
    698698OPTABLE(ROR,_1); 
    699699OPTABLE(RCL,_2); 
    700700OPTABLE(RCR,_3); 
    701701OPTABLE(SHL,_4); 
    702702OPTABLE(SHR,_5); 
    703703OPTABLE(SAR,_7); 
    704704 
    705705#undef OPTABLE 
    706706 
    707707PTRNTAB2  aptb2TEST[] = /* TEST */ { 
    708708        { 0xa8, _ib|_modnot1,           _al,    _imm8 }, 
    709709        { 0xa9, _iw|_16_bit|_modnot1,   _ax,    _imm16 }, 
    710710        { 0xa9, _id|_32_bit|_modnot1,   _eax,   _imm32 }, 
     711        { 0xa9, _id|_64_bit|_modnot1,   _rax,   _imm32 }, 
    711712        { 0xf6, _0|_modnot1,            _rm8,   _imm8 }, 
    712713        { 0xf7, _0|_16_bit|_modnot1,    _rm16,  _imm16 }, 
    713714        { 0xf7, _0|_32_bit|_modnot1,    _rm32,  _imm32 }, 
     715        { 0xf7, _0|_64_bit|_modnot1,    _rm64,  _imm32 }, 
    714716        { 0x84, _r|_modnot1,            _rm8,   _r8 }, 
    715717        { 0x85, _r|_16_bit|_modnot1,    _rm16,  _r16 }, 
    716718        { 0x85, _r|_32_bit|_modnot1,    _rm32,  _r32 }, 
     719        { 0x85, _r|_64_bit|_modnot1,    _rm64,  _r64 }, 
    717720        { ASM_END, 0, 0, 0 } 
    718721}; 
    719722PTRNTAB2  aptb2XADD[] = /* XADD */ {                    // 486 only instruction 
    720723//      { 0x0fc0,       _ib | _I386|_mod2, _rm8, _r8 }, 
    721724//      { 0x0fc1,       _iw | _I386|_16_bit|_mod2, _rm16, _r16 }, 
    722725//      { 0x0fc1,       _id | _I386|_32_bit|_mod2, _rm32, _r32 }, 
    723726        { 0x0fc0,       _r | _I386|_mod2, _rm8, _r8 }, 
    724727        { 0x0fc1,       _r | _I386|_16_bit|_mod2, _rm16, _r16 }, 
    725728        { 0x0fc1,       _r | _I386|_32_bit|_mod2, _rm32, _r32 }, 
    726729        { ASM_END, 0, 0, 0 } 
    727730}; 
    728731PTRNTAB2  aptb2XCHG[] = /* XCHG */ { 
    729732        { 0x90, _r|_16_bit|_mod2,       _ax ,   _r16 | _plus_r }, 
    730733        { 0x90, _r|_16_bit|_mod2,       _r16 | _plus_r, _ax  }, 
    731734        { 0x90, _r|_32_bit|_mod2,       _eax,   _r32 | _plus_r }, 
    732735        { 0x90, _r|_32_bit|_mod2,       _r32 | _plus_r, _eax }, 
    733736        { 0x86, _r|_mod2,               _rm8,   _r8 }, 
    734737        { 0x86, _r|_mod2,               _r8,    _rm8 }, 
    735738        { 0x87, _r|_16_bit|_mod2,               _rm16,  _r16 }, 
    736739        { 0x87, _r|_16_bit|_mod2,               _r16, _rm16 }, 
  • trunk/src/expression.c

    r789 r798  
    27042704StringExp::StringExp(Loc loc, void *string, size_t len, unsigned char postfix) 
    27052705        : Expression(loc, TOKstring, sizeof(StringExp)) 
    27062706{ 
    27072707    this->string = string; 
    27082708    this->len = len; 
    27092709    this->sz = 1; 
    27102710    this->committed = 0; 
    27112711    this->postfix = postfix; 
    27122712} 
    27132713 
    27142714#if 0 
    27152715Expression *StringExp::syntaxCopy() 
    27162716{ 
    27172717    printf("StringExp::syntaxCopy() %s\n", toChars()); 
    27182718    return copy(); 
    27192719} 
    27202720#endif 
    27212721 
    27222722int StringExp::equals(Object *o) 
    27232723{ 
    2724     //printf("StringExp::equals('%s')\n", o->toChars()); 
     2724    //printf("StringExp::equals('%s') %s\n", o->toChars(), toChars()); 
    27252725    if (o && o->dyncast() == DYNCAST_EXPRESSION) 
    27262726    {   Expression *e = (Expression *)o; 
    27272727 
    27282728        if (e->op == TOKstring) 
    27292729        { 
    27302730            return compare(o) == 0; 
    27312731        } 
    27322732    } 
    27332733    return FALSE; 
    27342734} 
    27352735 
    27362736char *StringExp::toChars() 
    27372737{ 
    27382738    OutBuffer buf; 
    27392739    HdrGenState hgs; 
    27402740    char *p; 
    27412741 
    27422742    memset(&hgs, 0, sizeof(hgs)); 
    27432743    toCBuffer(&buf, &hgs); 
    27442744    buf.writeByte(0); 
     
    28732873 * Convert string to char[]. 
    28742874 */ 
    28752875 
    28762876StringExp *StringExp::toUTF8(Scope *sc) 
    28772877{ 
    28782878    if (sz != 1) 
    28792879    {   // Convert to UTF-8 string 
    28802880        committed = 0; 
    28812881        Expression *e = castTo(sc, Type::tchar->arrayOf()); 
    28822882        e = e->optimize(WANTvalue); 
    28832883        assert(e->op == TOKstring); 
    28842884        StringExp *se = (StringExp *)e; 
    28852885        assert(se->sz == 1); 
    28862886        return se; 
    28872887    } 
    28882888    return this; 
    28892889} 
    28902890 
    28912891int StringExp::compare(Object *obj) 
    28922892{ 
     2893    //printf("StringExp::compare()\n"); 
    28932894    // Used to sort case statement expressions so we can do an efficient lookup 
    28942895    StringExp *se2 = (StringExp *)(obj); 
    28952896 
    28962897    // This is a kludge so isExpression() in template.c will return 5 
    28972898    // for StringExp's. 
    28982899    if (!se2) 
    28992900        return 5; 
    29002901 
    29012902    assert(se2->op == TOKstring); 
    29022903 
    29032904    int len1 = len; 
    29042905    int len2 = se2->len; 
    29052906 
     2907    //printf("sz = %d, len1 = %d, len2 = %d\n", sz, len1, len2); 
    29062908    if (len1 == len2) 
    29072909    { 
    29082910        switch (sz) 
    29092911        { 
    29102912            case 1: 
    2911                 return strcmp((char *)string, (char *)se2->string); 
     2913                return memcmp((char *)string, (char *)se2->string, len1); 
    29122914 
    29132915            case 2: 
    29142916            {   unsigned u; 
    29152917                d_wchar *s1 = (d_wchar *)string; 
    29162918                d_wchar *s2 = (d_wchar *)se2->string; 
    29172919 
    29182920                for (u = 0; u < len; u++) 
    29192921                { 
    29202922                    if (s1[u] != s2[u]) 
    29212923                        return s1[u] - s2[u]; 
    29222924                } 
    29232925            } 
    29242926 
    29252927            case 4: 
    29262928            {   unsigned u; 
    29272929                d_dchar *s1 = (d_dchar *)string; 
    29282930                d_dchar *s2 = (d_dchar *)se2->string; 
    29292931 
    29302932                for (u = 0; u < len; u++) 
    29312933                { 
  • trunk/src/toctype.c

    r762 r798  
    388388 
    389389    //printf("t = %p, Tflags = x%x\n", t, t->Tflags); 
    390390    return t; 
    391391} 
    392392 
    393393type *TypeEnum::toCtype() 
    394394{ 
    395395    if (ctype) 
    396396        return ctype; 
    397397 
    398398    //printf("TypeEnum::toCtype() '%s'\n", sym->toChars()); 
    399399    type *t; 
    400400    Type *tm = mutableOf(); 
    401401    if (tm->ctype && tybasic(tm->ctype->Tty) == TYenum) 
    402402    { 
    403403        Symbol *s = tm->ctype->Ttag; 
    404404        assert(s); 
    405405        t = type_alloc(TYenum); 
    406406        t->Ttag = (Classsym *)s;            // enum tag name 
    407407        t->Tcount++; 
     408        t->Tnext = tm->ctype->Tnext; 
     409        t->Tnext->Tcount++; 
    408410        // Add modifiers 
    409411        switch (mod) 
    410412        { 
    411413            case 0: 
    412414                assert(0); 
    413415                break; 
    414416            case MODconst: 
    415417            case MODwild: 
    416418                t->Tty |= mTYconst; 
    417419                break; 
    418420            case MODimmutable: 
    419421                t->Tty |= mTYimmutable; 
    420422                break; 
    421423            case MODshared: 
    422424                t->Tty |= mTYshared; 
    423425                break; 
    424426            case MODshared | MODwild: 
    425427            case MODshared | MODconst: 
    426428                t->Tty |= mTYshared | mTYconst; 
    427429                break; 
  • trunk/src/toobj.c

    r684 r798  
    6262 
    6363    csym->Sclass = SCglobal; 
    6464    csym->Sfl = FLdata; 
    6565 
    6666#if 1 
    6767    dt_t *dt = NULL; 
    6868    ClassDeclarations aclasses; 
    6969 
    7070    //printf("members->dim = %d\n", members->dim); 
    7171    for (int i = 0; i < members->dim; i++) 
    7272    {   Dsymbol *member = (Dsymbol *)members->data[i]; 
    7373 
    7474        //printf("\tmember '%s'\n", member->toChars()); 
    7575        member->addLocalClass(&aclasses); 
    7676    } 
    7777 
    7878    // importedModules[] 
    7979    int aimports_dim = aimports.dim; 
    8080    for (int i = 0; i < aimports.dim; i++) 
    8181    {   Module *m = (Module *)aimports.data[i]; 
    82         if (!m->needModuleInfo()
     82        if (!m->needmoduleinfo
    8383            aimports_dim--; 
    8484    } 
    8585 
    8686    FuncDeclaration *sgetmembers = findGetMembers(); 
    8787 
    8888    // These must match the values in druntime/src/object_.d 
    8989    #define MIstandalone      4 
    9090    #define MItlsctor         8 
    9191    #define MItlsdtor         0x10 
    9292    #define MIctor            0x20 
    9393    #define MIdtor            0x40 
    9494    #define MIxgetMembers     0x80 
    9595    #define MIictor           0x100 
    9696    #define MIunitTest        0x200 
    9797    #define MIimportedModules 0x400 
    9898    #define MIlocalClasses    0x800 
    9999    #define MInew             0x80000000   // it's the "new" layout 
    100100 
    101101    unsigned flags = MInew; 
    102102    if (sctor) 
     
    127127    if (flags & MItlsctor) 
    128128        dtxoff(&dt, sctor, 0, TYnptr); 
    129129    if (flags & MItlsdtor) 
    130130        dtxoff(&dt, sdtor, 0, TYnptr); 
    131131    if (flags & MIctor) 
    132132        dtxoff(&dt, ssharedctor, 0, TYnptr); 
    133133    if (flags & MIdtor) 
    134134        dtxoff(&dt, sshareddtor, 0, TYnptr); 
    135135    if (flags & MIxgetMembers) 
    136136        dtxoff(&dt, sgetmembers->toSymbol(), 0, TYnptr); 
    137137    if (flags & MIictor) 
    138138        dtxoff(&dt, sictor, 0, TYnptr); 
    139139    if (flags & MIunitTest) 
    140140        dtxoff(&dt, stest, 0, TYnptr); 
    141141    if (flags & MIimportedModules) 
    142142    { 
    143143        dtsize_t(&dt, aimports_dim); 
    144144        for (int i = 0; i < aimports.dim; i++) 
    145145        {   Module *m = (Module *)aimports.data[i]; 
    146146 
    147             if (m->needModuleInfo()
     147            if (m->needmoduleinfo
    148148            {   Symbol *s = m->toSymbol(); 
    149149 
    150150                /* Weak references don't pull objects in from the library, 
    151151                 * they resolve to 0 if not pulled in by something else. 
    152152                 * Don't pull in a module just because it was imported. 
    153153                 */ 
    154154#if !OMFOBJ // Optlink crashes with weak symbols at EIP 41AFE7, 402000 
    155155                s->Sflags |= SFLweak; 
    156156#endif 
    157157                dtxoff(&dt, s, 0, TYnptr); 
    158158            } 
    159159        } 
    160160    } 
    161161    if (flags & MIlocalClasses) 
    162162    { 
    163163        dtsize_t(&dt, aclasses.dim); 
    164164        for (int i = 0; i < aclasses.dim; i++) 
    165165        { 
    166166            ClassDeclaration *cd = (ClassDeclaration *)aclasses.data[i]; 
    167167            dtxoff(&dt, cd->toSymbol(), 0, TYnptr);