Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #2038: 64Bit.4.patch

File 64Bit.4.patch, 144.8 kB (added by Marenz, 13 years ago)

Fixed compilation errors in deh.d

  • build/script/unittest.sh

    old new  
    3333    OPTIONS="-oq -d-debug -d-debug=UnitTest" 
    3434fi 
    3535 
    36 build/bin/$PLATFORM$ARCH/bob -v -r=$DC -c=$DC -p=$PLATFORM -l=libtango-$DC-tst -o="-g -unittest $OPTIONS" .  
     36build/bin/${PLATFORM}32/bob -v -r=$DC -c=$DC -p=$PLATFORM -l=libtango-$DC-tst -o="-m64 -g -unittest $OPTIONS" .  
    3737 
    3838if ! which $DC >& /dev/null 
    3939then 
     
    100100fi 
    101101 
    102102echo "$DC $EXE.d $DFILES -g $OPTIONS -unittest -L-L. -L-ltango-$DC-tst  $DL -L-lz -L-lbz2" 
    103 $DC $EXE.d $DFILES -g $OPTIONS -unittest -L-L. -L-ltango-$DC-tst  $DL -L-lz -L-lbz2  && rm $EXE.d && rm libtango-$DC-tst.a 
     103$DC $EXE.d $DFILES -g $OPTIONS -m$ARCH -unittest -L-L. -L-ltango-$DC-tst  $DL -L-lz -L-lbz2  && rm $EXE.d && rm libtango-$DC-tst.a 
    104104 
    105105./runUnittests_$DC 
    106106 
  • build/src/bob.d

    old new  
    3838           new FreeBSD (args); 
    3939           new Solaris (args); 
    4040           new Windows (args); 
    41            stdout.formatln ("{} files", FileFilter.builder(args.os, args.compiler)()); 
     41           Stdout.formatln ("{} files", FileFilter.builder(args.os, args.compiler)()); 
    4242           } 
    4343} 
    4444 
     
    170170 
    171171                if (args.core) { 
    172172                    foreach (file; scan(".c")) { 
    173                              auto obj = compile (file, gcc32); 
     173                             auto obj = compile (file, gcc); 
    174174                             addToLib(obj); 
    175175                    } 
    176176 
    177177                    foreach (file; scan(".S")) { 
    178                             auto obj = compile (file, gcc32); 
     178                            auto obj = compile (file, gcc); 
    179179                            addToLib(obj); 
    180180                    } 
    181181                } 
     
    780780                if (args.verbose) 
    781781                   { 
    782782                   foreach (str; cmd) 
    783                             stdout (str)(' '); 
    784                    stdout.newline; 
     783                            Stdout (str)(' '); 
     784                   Stdout.newline; 
    785785                   }   
    786786                          
    787787                if (! args.inhibit) 
     
    794794                       proc.copyEnv (true); 
    795795 
    796796                   proc.execute(); 
    797                    stdout.stream.copy (proc.stderr); 
    798                    stdout.stream.copy (proc.stdout); 
     797                   Stdout.stream.copy (proc.stderr); 
     798                   Stdout.stream.copy (proc.stdout); 
    799799                   auto result = proc.wait; 
    800800                   if (result.reason != Process.Result.Exit) 
    801801                       throw new Exception (result.toString); 
  • object.di

    old new  
    119119    equals_t      equals(void *p1, void *p2); 
    120120    /// compares the types of this TypeInfo stored at p1 and p2 
    121121    int      compare(void *p1, void *p2); 
     122     /// Return alignment of type 
     123    size_t   talign() { return tsize(); } 
    122124    /// returns the size of a type with the current TypeInfo 
    123125    size_t   tsize(); 
    124126    /// swaps the two types stored at p1 and p2 
     
    131133    PointerMap pointermap(); 
    132134    /// offsets of the various elements 
    133135    OffsetTypeInfo[] offTi(); 
     136 
     137    /** Return internal info on arguments fitting into 8byte. 
     138       * See X86-64 ABI 3.2.3 
     139     */ 
     140    version (X86_64) int argTypes(out TypeInfo arg1, out TypeInfo arg2); 
    134141} 
    135142 
    136143class TypeInfo_Typedef : TypeInfo 
  • tango/text/convert/Layout.d

    old new  
    4545        { 
    4646        private import tango.time.Time; 
    4747        private import tango.text.convert.DateTime; 
    48         }     
     48        } 
    4949 
    5050 
    5151/******************************************************************************* 
     
    6666        alias void* Arg; 
    6767        alias va_list ArgList; 
    6868        } 
     69else version(DigitalMars) 
     70        { 
     71        private import tango.core.Vararg; 
     72        alias void* Arg; 
     73        alias va_list ArgList; 
     74        } 
    6975     else 
    7076        { 
    7177        alias void* Arg; 
     
    8389{ 
    8490        public alias convert opCall; 
    8591        public alias uint delegate (T[]) Sink; 
    86         
     92 
    8793        static if (is (DateTimeLocale)) 
    8894                   private DateTimeLocale* dateTime = &DateTimeDefault; 
    8995 
    9096        /********************************************************************** 
    9197 
    9298                Return shared instance 
    93                  
     99 
    94100                Note that this is not threadsafe, and that static-ctor 
    95101                usage doesn't get invoked appropriately (compiler bug) 
    96102 
     
    252258 
    253259                        Arg[64] arglist = void; 
    254260                        ArgU[64] storedArgs = void; 
    255          
     261 
    256262                        foreach (i, arg; arguments) 
    257263                                { 
    258264                                static if (is(typeof(args.ptr))) 
     
    271277                                            arglist[i] = &(storedArgs[i].f); 
    272278                                            converted = true; 
    273279                                            break; 
    274                                          
     280 
    275281                                       case TypeCode.CFLOAT: 
    276282                                            storedArgs[i].cf = va_arg!(cfloat)(args); 
    277283                                            arglist[i] = &(storedArgs[i].cf); 
    278284                                            converted = true; 
    279285                                            break; 
    280          
     286 
    281287                                       case TypeCode.DOUBLE, TypeCode.IDOUBLE: 
    282288                                            storedArgs[i].d = va_arg!(double)(args); 
    283289                                            arglist[i] = &(storedArgs[i].d); 
    284290                                            converted = true; 
    285291                                            break; 
    286                                          
     292 
    287293                                       case TypeCode.CDOUBLE: 
    288294                                            storedArgs[i].cd = va_arg!(cdouble)(args); 
    289295                                            arglist[i] = &(storedArgs[i].cd); 
    290296                                            converted = true; 
    291297                                            break; 
    292          
     298 
    293299                                       case TypeCode.REAL, TypeCode.IREAL: 
    294300                                            storedArgs[i].r = va_arg!(real)(args); 
    295301                                            arglist[i] = &(storedArgs[i].r); 
     
    301307                                            arglist[i] = &(storedArgs[i].cr); 
    302308                                            converted = true; 
    303309                                            break; 
    304          
     310 
    305311                                       default: 
    306312                                            break; 
    307313                                        } 
     
    524530                                       } 
    525531                                   length += sink ("]"); 
    526532                                   } 
    527                                 else  
     533                                else 
    528534                                if (_ti.classinfo.name.length is 25 && _ti.classinfo.name[9..$] == "AssociativeArray") 
    529535                                   { 
    530536                                   auto tiAsso = cast(TypeInfo_AssociativeArray)_ti; 
     
    538544 
    539545                                   length += sink ("{"); 
    540546                                   bool first = true; 
    541                                    
     547 
    542548                                   size_t roundUp (size_t sz) 
    543549                                   { 
    544550                                        return (sz + (void*).sizeof -1) & ~((void*).sizeof - 1); 
     
    560566                                           } 
    561567                                   length += sink ("}"); 
    562568                                   } 
    563                                 else  
     569                                else 
    564570                                if (_ti.classinfo.name[9] is TypeCode.ARRAY) 
    565571                                   { 
    566572                                   if (_ti is typeid(char[])) 
    567573                                       emit (Utf.fromString8 (*cast(char[]*) _arg, result)); 
    568574                                   else 
    569                                    if (_ti is typeid(wchar[]))         
     575                                   if (_ti is typeid(wchar[])) 
    570576                                       emit (Utf.fromString16 (*cast(wchar[]*) _arg, result)); 
    571577                                   else 
    572578                                   if (_ti is typeid(dchar[])) 
     
    596602                                   emit (dispatch (result, format, _ti, _arg)); 
    597603                      } 
    598604 
    599                        
     605 
    600606                      // process this argument 
    601607                      if (index >= ti.length) 
    602608                          emit ("{invalid index}"); 
     
    691697 
    692698                       case TypeCode.STRUCT: 
    693699                            auto s = cast(TypeInfo_Struct) type; 
    694                             if (s.xtoString)  
     700                            if (s.xtoString) 
    695701                               { 
    696702                               char[] delegate() toString; 
    697703                               toString.ptr = p; 
     
    734740        version (WithExtensions) 
    735741                { 
    736742                result = Extensions!(T).run (type, result, p, format); 
    737                 return (result) ? result :  
     743                return (result) ? result : 
    738744                       "{unhandled argument type: " ~ Utf.fromString8 (type.toString, result) ~ "}"; 
    739745                } 
    740746             else 
     
    808814                                    } 
    809815                                 break; 
    810816                            } 
    811                  
     817 
    812818                return Float.format (output, v, dec, exp, pad); 
    813819        } 
    814820 
     
    848854        { 
    849855                return floatingTail (result, val.im, format, "*1i"); 
    850856        } 
    851          
     857 
    852858        /********************************************************************** 
    853859 
    854860                format a complex value 
     
    859865        { 
    860866                static bool signed (real x) 
    861867                { 
    862                         static if (real.sizeof is 4)  
     868                        static if (real.sizeof is 4) 
    863869                                   return ((*cast(uint *)&x) & 0x8000_0000) != 0; 
    864870                        else 
    865                         static if (real.sizeof is 8)  
     871                        static if (real.sizeof is 8) 
    866872                                   return ((*cast(ulong *)&x) & 0x8000_0000_0000_0000) != 0; 
    867873                               else 
    868874                                  { 
     
    935941        CREAL = 'c', 
    936942        IFLOAT = 'o', 
    937943        IDOUBLE = 'p', 
    938         IREAL = 'j'   
     944        IREAL = 'j' 
    939945} 
    940946 
    941947 
     
    10861092        assert( Formatter( "{:f.}", 1.237 ) == "1.24" ); 
    10871093        assert( Formatter( "{:f.}", 1.000 ) == "1" ); 
    10881094        assert( Formatter( "{:f2.}", 200.001 ) == "200"); 
    1089          
     1095 
    10901096        // array output 
    10911097        int[] a = [ 51, 52, 53, 54, 55 ]; 
    10921098        assert( Formatter( "{}", a ) == "[51, 52, 53, 54, 55]" ); 
     
    10991105        ushort[3] c = [ cast(ushort)51, 52, 53 ]; 
    11001106        assert( Formatter( "{}", c ) == "[51, 52, 53]" ); 
    11011107 
    1102         // integer AA  
     1108        // integer AA 
    11031109        ushort[long] d; 
    11041110        d[234] = 2; 
    11051111        d[345] = 3; 
    11061112        assert( Formatter( "{}", d ) == "{234 => 2, 345 => 3}" || 
    11071113                Formatter( "{}", d ) == "{345 => 3, 234 => 2}"); 
    1108          
    1109         // bool/string AA  
     1114 
     1115        // bool/string AA 
    11101116        bool[char[]] e; 
    11111117        e[ "key".dup ] = true; 
    11121118        e[ "value".dup ] = false; 
    11131119        assert( Formatter( "{}", e ) == "{key => true, value => false}" || 
    11141120                Formatter( "{}", e ) == "{value => false, key => true}"); 
    11151121 
    1116         // string/double AA  
     1122        // string/double AA 
    11171123        char[][ double ] f; 
    11181124        f[ 1.0 ] = "one".dup; 
    11191125        f[ 3.14 ] = "PI".dup; 
     
    11581164 
    11591165                struct S 
    11601166                { 
    1161                    char[] toString () {return "foo";}       
     1167                   char[] toString () {return "foo";} 
    11621168                } 
    11631169 
    11641170                S s; 
  • tango/text/Text.d

    old new  
    125125 
    126126                // reserve some space for inserts/additions 
    127127                Text reserve (int extra); 
    128          
     128 
    129129                // write content to stream 
    130130                Text write (OutputStream sink); 
    131131        } 
     
    213213 
    214214private import tango.stdc.string : memmove; 
    215215 
     216version(DigitalMars) 
     217{ 
     218    private import tango.core.Vararg; 
     219} 
    216220 
    217221/******************************************************************************* 
    218222 
     
    285289 
    286290                bool next () 
    287291                { 
    288                         return locate (&engine.forward, text.slice,  
     292                        return locate (&engine.forward, text.slice, 
    289293                                        text.selectPoint + text.selectLength); 
    290294                } 
    291295 
    292296                /*************************************************************** 
    293297 
    294                         Returns true if there is a match within the  
     298                        Returns true if there is a match within the 
    295299                        associated text 
    296300 
    297301                ***************************************************************/ 
    298302 
    299303                bool within () 
    300                 {        
     304                { 
    301305                        return engine.within (text.slice); 
    302306                } 
    303307 
    304308                /*************************************************************** 
    305                  
     309 
    306310                        Returns number of matches within the associated 
    307311                        text 
    308312 
    309313                ***************************************************************/ 
    310314 
    311315                size_t count () 
    312                 {        
     316                { 
    313317                        return engine.count (text.slice); 
    314318                } 
    315319 
     
    320324                ***************************************************************/ 
    321325 
    322326                void replace (T chr) 
    323                 {      
    324                         replace ((&chr)[0..1]);   
     327                { 
     328                        replace ((&chr)[0..1]); 
    325329                } 
    326330 
    327331                /*************************************************************** 
     
    331335                ***************************************************************/ 
    332336 
    333337                void replace (T[] sub = null) 
    334                 {   
     338                { 
    335339                        auto dst = new T[text.length]; 
    336340                        dst.length = 0; 
    337341 
     
    339343                                 dst ~= token; 
    340344                        text.set (dst, false); 
    341345                } 
    342   
     346 
    343347                /*************************************************************** 
    344348 
    345349                        locate pattern index and select as appropriate 
     
    379383 
    380384                Note: A character like 'a' will be implicitly converted to 
    381385                uint and thus will be accepted for this constructor, making 
    382                 it appear like you can initialize a Text instance with a  
     386                it appear like you can initialize a Text instance with a 
    383387                single character, something which is not supported. 
    384388 
    385389        ***********************************************************************/ 
     
    431435                this class. This can be useful when wrapping an array 
    432436                "temporarily" with a stack-based Text. 
    433437 
    434                 Also resets the curent selection to null            
     438                Also resets the curent selection to null 
    435439 
    436440        ***********************************************************************/ 
    437441 
     
    456460                these methods. This can be useful when wrapping an array 
    457461                "temporarily" with a stack-based Text. 
    458462 
    459                 Also resets the curent selection to null            
     463                Also resets the curent selection to null 
    460464 
    461465        ***********************************************************************/ 
    462466 
     
    530534        } 
    531535 
    532536        /*********************************************************************** 
    533          
     537 
    534538                Return a search iterator for a given pattern. The iterator 
    535539                sets the current text selection as appropriate. For example: 
    536540                --- 
     
    735739                deprecated: use format() instead 
    736740 
    737741        ***********************************************************************/ 
    738          
     742 
    739743        deprecated final Text append (int v, T[] fmt = null) 
    740744        { 
    741745                return append (cast(long) v, fmt); 
     
    780784        final Text append (InputStream source) 
    781785        { 
    782786                T[8192/T.sizeof] tmp = void; 
    783                 while (true)  
     787                while (true) 
    784788                      { 
    785                       auto len = source.read (tmp);  
    786                       if (len is source.Eof)  
    787                           break;  
     789                      auto len = source.read (tmp); 
     790                      if (len is source.Eof) 
     791                          break; 
    788792 
    789793                      // check to ensure UTF conversion is ok 
    790794                      assert ((len & (T.sizeof-1)) is 0); 
     
    16351639*******************************************************************************/ 
    16361640 
    16371641debug (UnitTest) 
    1638 {        
     1642{ 
    16391643        import tango.io.device.Array; 
    16401644 
    16411645        //void main() {} 
  • tango/io/stream/Snoop.d

    old new  
    1717 
    1818private import  tango.text.convert.Format; 
    1919 
     20version(DigitalMars) 
     21{ 
     22    private import tango.core.Vararg; 
     23} 
     24 
    2025private alias void delegate(char[]) Snoop; 
    2126 
    2227/******************************************************************************* 
  • tango/io/stream/Format.d

    old new  
    1616 
    1717private import tango.text.convert.Layout; 
    1818 
     19version(DigitalMars) 
     20{ 
     21    private import tango.core.Vararg; 
     22} 
     23 
    1924/******************************************************************************* 
    2025 
    2126        A bridge between a Layout instance and a stream. This is used for 
  • tango/core/rt/gc/basic/gcx.d

    old new  
    23442344        } 
    23452345        else 
    23462346        { 
    2347         asm 
     2347        version (D_InlineAsm_X86) 
    23482348        { 
    2349             pushad              ; 
    2350             mov sp[EBP],ESP     ; 
     2349            asm 
     2350            { 
     2351                pushad              ; 
     2352                mov sp[EBP],ESP     ; 
     2353            } 
    23512354        } 
     2355        else version (D_InlineAsm_X86_64) 
     2356        { 
     2357            asm 
     2358            { 
     2359                push RAX ; 
     2360                push RBX ; 
     2361                push RCX ; 
     2362                push RDX ; 
     2363                push RSI ; 
     2364                push RDI ; 
     2365                push RBP ; 
     2366                push R8  ; 
     2367                push R9  ; 
     2368                push R10  ; 
     2369                push R11  ; 
     2370                push R12  ; 
     2371                push R13  ; 
     2372                push R14  ; 
     2373                push R15  ; 
     2374                push EAX ;   // 16 byte align the stack 
     2375            } 
    23522376        } 
     2377        else 
     2378        { 
     2379            static assert( false, "Architecture not supported." ); 
     2380        } 
     2381        } 
    23532382        result = fullcollect(sp); 
    23542383        version (GNU) 
    23552384        { 
     
    25192548        for (n = 0; n < npools; n++) 
    25202549        {   size_t pn; 
    25212550            size_t ncommitted; 
    2522             uint*  bbase; 
    25232551 
    25242552            pool = pooltable[n]; 
    2525             bbase = pool.mark.base(); 
     2553            auto bbase = pool.mark.base(); 
    25262554            ncommitted = pool.ncommitted; 
    25272555            for (pn = 0; pn < ncommitted; pn++, bbase += PAGESIZE / (32 * 16)) 
    25282556            { 
  • tango/core/rt/gc/basic/gcbits.d

    old new  
    5050 
    5151struct GCBits 
    5252{ 
    53     const int BITS_PER_WORD = 32; 
    54     const int BITS_SHIFT = 5; 
    55     const int BITS_MASK = 31; 
     53    alias size_t wordtype; 
    5654 
    57     uint*  data = null; 
     55    const BITS_PER_WORD = (wordtype.sizeof * 8); 
     56    const BITS_SHIFT = (wordtype.sizeof == 8 ? 6 : 5); 
     57    const BITS_MASK = (BITS_PER_WORD - 1); 
     58    const BITS_1 = cast(wordtype)1; 
     59 
     60    wordtype*  data = null; 
    5861    size_t nwords = 0;    // allocated words in data[] excluding sentinals 
    5962    size_t nbits = 0;     // number of bits in data[] excluding sentinals 
    6063 
     
    7982    { 
    8083        this.nbits = nbits; 
    8184        nwords = (nbits + (BITS_PER_WORD - 1)) >> BITS_SHIFT; 
    82         data = cast(uint*)calloc(nwords + 2, uint.sizeof); 
     85        data = cast(wordtype*)calloc(nwords + 2, wordtype.sizeof); 
    8386        if (!data) 
    8487            onOutOfMemoryError(); 
    8588    } 
    8689 
    87     uint test(size_t i) 
     90    wordtype test(size_t i) 
    8891    in 
    8992    { 
    9093        assert(i < nbits); 
     
    9295    body 
    9396    { 
    9497        //return (cast(bit *)(data + 1))[i]; 
    95         return data[1 + (i >> BITS_SHIFT)] & (1 << (i & BITS_MASK)); 
     98        return data[1 + (i >> BITS_SHIFT)] & (BITS_1 << (i & BITS_MASK)); 
    9699    } 
    97100 
    98101    void set(size_t i) 
     
    103106    body 
    104107    { 
    105108        //(cast(bit *)(data + 1))[i] = 1; 
    106         data[1 + (i >> BITS_SHIFT)] |= (1 << (i & BITS_MASK)); 
     109        data[1 + (i >> BITS_SHIFT)] |= (BITS_1 << (i & BITS_MASK)); 
    107110    } 
    108111 
    109112    void clear(size_t i) 
     
    114117    body 
    115118    { 
    116119        //(cast(bit *)(data + 1))[i] = 0; 
    117         data[1 + (i >> BITS_SHIFT)] &= ~(1 << (i & BITS_MASK)); 
     120        data[1 + (i >> BITS_SHIFT)] &= ~(BITS_1 << (i & BITS_MASK)); 
    118121    } 
    119122 
    120     uint testClear(size_t i) 
     123    wordtype testClear(size_t i) 
    121124    { 
    122125        version (bitops) 
    123126        { 
     
    136139            } 
    137140        } 
    138141        else 
    139         {   uint result; 
     142        {   wordtype result; 
    140143 
    141144            //result = (cast(bit *)(data + 1))[i]; 
    142145            //(cast(bit *)(data + 1))[i] = 0; 
    143146 
    144             uint* p = &data[1 + (i >> BITS_SHIFT)]; 
    145             uint  mask = (1 << (i & BITS_MASK)); 
     147            wordtype* p = &data[1 + (i >> BITS_SHIFT)]; 
     148            wordtype  mask = (BITS_1 << (i & BITS_MASK)); 
    146149            result = *p & mask; 
    147150            *p &= ~mask; 
    148151            return result; 
     
    188191            for (;d1!=dEnd;++d1) 
    189192                *d1=0u; 
    190193        } else { 
    191             memset(data + 1, 0, nwords * uint.sizeof); 
     194            memset(data + 1, 0, nwords * wordtype.sizeof); 
    192195        } 
    193196    } 
    194197 
     
    200203    body 
    201204    { 
    202205        version(MEMCPY_NON_SIG_SAFE) { 
    203             uint * d1=data+1,d2=f.data+1,dEnd=d1+nwords; 
     206            wordtype * d1=data+1,d2=f.data+1,dEnd=d1+nwords; 
    204207            for (;d1!=dEnd;++d1,++d2) 
    205208                *d1=*d2; 
    206209        } else { 
    207             memcpy(data + 1, f.data + 1, nwords * uint.sizeof); 
     210            memcpy(data + 1, f.data + 1, nwords * wordtype.sizeof); 
    208211        } 
    209212    } 
    210213 
    211     uint* base() 
     214    wordtype* base() 
    212215    in 
    213216    { 
    214217        assert(data); 
  • tango/core/rt/compiler/ldc/object_.d

    old new  
    412412    /// Compares two instances for &lt;, ==, or &gt;. 
    413413    int compare(in void* p1, in void* p2) { return 0; } //throw new Exception("non comparable",__FILE__,__LINE__);  
    414414 
     415     /// Return alignment of type 
     416    size_t   talign() { return tsize(); } 
     417 
    415418    /// Returns size of the type. 
    416419    size_t tsize() { return 0; } 
    417420 
  • tango/core/rt/compiler/ldc/typeinfo/ti_void.d

    old new  
    2222        return *cast(byte *)p1 - *cast(byte *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return void.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return void.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_wchar.d

    old new  
    2121        return *cast(wchar *)p1 - *cast(wchar *)p2; 
    2222    } 
    2323 
     24    override size_t talign() 
     25    { 
     26        return wchar.alignof; 
     27    } 
     28 
    2429    override size_t tsize() 
    2530    { 
    2631        return wchar.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_ptr.d

    old new  
    2525        return 0; 
    2626    } 
    2727 
     28    override size_t talign() 
     29    { 
     30        return (void*).alignof; 
     31    } 
     32 
    2833    override size_t tsize() 
    2934    { 
    3035        return (void*).sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_Afloat.d

    old new  
    7676        return 0; 
    7777    } 
    7878 
     79    override size_t talign() 
     80    { 
     81        return (float[]).alignof; 
     82    } 
     83 
    7984    override size_t tsize() 
    8085    { 
    8186        return (float[]).sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_double.d

    old new  
    4343        return _compare(*cast(double *)p1, *cast(double *)p2); 
    4444    } 
    4545 
     46    override size_t talign() 
     47    { 
     48        return double.alignof; 
     49    } 
     50 
    4651    override size_t tsize() 
    4752    { 
    4853        return double.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_delegate.d

    old new  
    1818        return *cast(dg *)p1 == *cast(dg *)p2; 
    1919    } 
    2020 
     21    override size_t talign() 
     22    { 
     23        return dg.alignof; 
     24    } 
     25 
    2126    override size_t tsize() 
    2227    { 
    2328        return dg.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_Adouble.d

    old new  
    7676        return 0; 
    7777    } 
    7878 
     79    override size_t talign() 
     80    { 
     81        return (double[]).alignof; 
     82    } 
     83 
    7984    override size_t tsize() 
    8085    { 
    8186        return (double[]).sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_char.d

    old new  
    2020        return *cast(char *)p1 - *cast(char *)p2; 
    2121    } 
    2222 
     23    override size_t talign() 
     24    { 
     25        return char.alignof; 
     26    } 
     27 
    2328    override size_t tsize() 
    2429    { 
    2530        return char.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_Acdouble.d

    old new  
    7575        return 0; 
    7676    } 
    7777 
     78    override size_t talign() 
     79    { 
     80        return (cdouble[]).alignof; 
     81    } 
     82 
    7883    override size_t tsize() 
    7984    { 
    8085        return (cdouble[]).sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_uint.d

    old new  
    2626        return 0; 
    2727    } 
    2828 
     29    override size_t talign() 
     30    { 
     31        return uint.alignof; 
     32    } 
     33 
    2934    override size_t tsize() 
    3035    { 
    3136        return uint.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_AC.d

    old new  
    8282        return 0; 
    8383    } 
    8484 
     85    override size_t talign() 
     86    { 
     87        return (Object[]).alignof; 
     88    } 
     89 
    8590    override size_t tsize() 
    8691    { 
    8792        return (Object[]).sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_ulong.d

    old new  
    3131        return 0; 
    3232    } 
    3333 
     34    override size_t talign() 
     35    { 
     36        return ulong.alignof; 
     37    } 
     38 
    3439    override size_t tsize() 
    3540    { 
    3641        return ulong.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_creal.d

    old new  
    4444        return _compare(*cast(creal *)p1, *cast(creal *)p2); 
    4545    } 
    4646 
     47    override size_t talign() 
     48    { 
     49        return creal.alignof; 
     50    } 
     51 
    4752    override size_t tsize() 
    4853    { 
    4954        return creal.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_ubyte.d

    old new  
    2222        return *cast(ubyte *)p1 - *cast(ubyte *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return ubyte.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return ubyte.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_Aint.d

    old new  
    4747        return 0; 
    4848    } 
    4949 
     50    override size_t talign() 
     51    { 
     52        return (int[]).alignof; 
     53    } 
     54 
    5055    override size_t tsize() 
    5156    { 
    5257        return (int[]).sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_long.d

    old new  
    3131        return 0; 
    3232    } 
    3333 
     34    override size_t talign() 
     35    { 
     36        return long.alignof; 
     37    } 
     38 
    3439    override size_t tsize() 
    3540    { 
    3641        return long.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_short.d

    old new  
    2222        return *cast(short *)p1 - *cast(short *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return short.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return short.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_Along.d

    old new  
    4848        return 0; 
    4949    } 
    5050 
     51    override size_t talign() 
     52    { 
     53        return (long[]).alignof; 
     54    } 
     55 
    5156    override size_t tsize() 
    5257    { 
    5358        return (long[]).sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_byte.d

    old new  
    2222        return *cast(byte *)p1 - *cast(byte *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return byte.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return byte.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_float.d

    old new  
    4242        return _compare(*cast(float *)p1, *cast(float *)p2); 
    4343    } 
    4444 
     45    override size_t talign() 
     46    { 
     47        return float.alignof; 
     48    } 
     49 
    4550    override size_t tsize() 
    4651    { 
    4752        return float.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_cfloat.d

    old new  
    4444        return _compare(*cast(cfloat *)p1, *cast(cfloat *)p2); 
    4545    } 
    4646 
     47    override size_t talign() 
     48    { 
     49        return cfloat.alignof; 
     50    } 
     51 
    4752    override size_t tsize() 
    4853    { 
    4954        return cfloat.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_Acfloat.d

    old new  
    7676        return 0; 
    7777    } 
    7878 
     79    override size_t talign() 
     80    { 
     81        return (cfloat[]).alignof; 
     82    } 
     83 
    7984    override size_t tsize() 
    8085    { 
    8186        return (cfloat[]).sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_cdouble.d

    old new  
    4444        return _compare(*cast(cdouble *)p1, *cast(cdouble *)p2); 
    4545    } 
    4646 
     47    override size_t talign() 
     48    { 
     49        return cdouble.alignof; 
     50    } 
     51 
    4752    override size_t tsize() 
    4853    { 
    4954        return cdouble.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_dchar.d

    old new  
    2222        return *cast(dchar *)p1 - *cast(dchar *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return dchar.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return dchar.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_C.d

    old new  
    6262        return c; 
    6363    } 
    6464 
     65    override size_t talign() 
     66    { 
     67        return Object.alignof; 
     68    } 
     69 
    6570    override size_t tsize() 
    6671    { 
    6772        return Object.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_real.d

    old new  
    4343        return _compare(*cast(real *)p1, *cast(real *)p2); 
    4444    } 
    4545 
     46    override size_t talign() 
     47    { 
     48        return real.alignof; 
     49    } 
     50 
    4651    override size_t tsize() 
    4752    { 
    4853        return real.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_ushort.d

    old new  
    2222        return *cast(ushort *)p1 - *cast(ushort *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return ushort.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return ushort.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_Areal.d

    old new  
    7676        return 0; 
    7777    } 
    7878 
     79    override size_t talign() 
     80    { 
     81        return (real[]).alignof; 
     82    } 
     83 
    7984    override size_t tsize() 
    8085    { 
    8186        return (real[]).sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_Acreal.d

    old new  
    7676        return 0; 
    7777    } 
    7878 
     79    override size_t talign() 
     80    { 
     81        return (creal[]).alignof; 
     82    } 
     83 
    7984    override size_t tsize() 
    8085    { 
    8186        return (creal[]).sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_Ag.d

    old new  
    4848        return 0; 
    4949    } 
    5050 
     51    override size_t talign() 
     52    { 
     53        return (byte[]).alignof; 
     54    } 
     55 
    5156    override size_t tsize() 
    5257    { 
    5358        return (byte[]).sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_int.d

    old new  
    2626        return 0; 
    2727    } 
    2828 
     29    override size_t talign() 
     30    { 
     31        return int.alignof; 
     32    } 
     33 
    2934    override size_t tsize() 
    3035    { 
    3136        return int.sizeof; 
  • tango/core/rt/compiler/ldc/typeinfo/ti_Ashort.d

    old new  
    4747        return 0; 
    4848    } 
    4949 
     50    override size_t talign() 
     51    { 
     52        return (short[]).alignof; 
     53    } 
     54 
    5055    override size_t tsize() 
    5156    { 
    5257        return (short[]).sizeof; 
  • tango/core/rt/compiler/dmd/rt/trace.d

    old new  
    1717{ 
    1818    import rt.compiler.util.string; 
    1919    import tango.stdc.string : memset, memcpy, strlen; 
    20     import tango.stdc.stdlib : malloc, free, exit, strtoul, strtoull, qsort,  
     20    import tango.stdc.stdlib : malloc, free, exit, strtoul, strtoull, qsort, 
    2121                                EXIT_FAILURE; 
    2222    import tango.stdc.ctype : isspace, isalpha, isgraph; 
    2323    import tango.stdc.stdio : fopen, fclose, fprintf, fgetc, FILE, EOF; 
     
    906906        } 
    907907    } 
    908908} 
     909else version (D_InlineAsm_X86_64) 
     910{ 
     911    extern (D) 
     912    { 
     913        void QueryPerformanceCounter(timer_t* ctr) 
     914        { 
     915            asm 
     916            { 
     917                naked                   ; 
     918                rdtsc                   ; 
     919                mov   [RDI],EAX         ; 
     920                mov   4[RDI],EDX        ; 
     921                ret                     ; 
     922            } 
     923        } 
     924 
     925        void QueryPerformanceFrequency(timer_t* freq) 
     926        { 
     927            *freq = 3579545; 
     928        } 
     929    } 
     930} 
    909931else 
    910932{ 
    911933    static assert(0); 
  • tango/core/rt/compiler/dmd/rt/lifetime.d

    old new  
    303303    if (ndims == 0) 
    304304        result = 0; 
    305305    else 
    306     {   va_list q; 
    307         va_start!(int)(q, ndims)
     306    { 
     307        va_list q
    308308 
     309        version(X86) 
     310            va_start(q, ndims); 
     311        else version(X86_64) 
     312            va_start(q, __va_argsave); 
     313        else 
     314            static assert(false, "platform not supported"); 
     315 
    309316        void[] foo(TypeInfo ti, size_t* pdim, int ndims) 
    310317        { 
    311318            size_t dim = *pdim; 
     
    329336        } 
    330337 
    331338        size_t* pdim = cast(size_t *)q; 
    332         result = cast(ulong)foo(ti, pdim, ndims)
     339        result = cast(ulong)foo(ti, pdim, ndims).ptr
    333340        debug(PRINTF) printf("result = %llx\n", result); 
    334341 
    335342        version (none) 
     
    358365    else 
    359366    { 
    360367        va_list q; 
    361         va_start!(int)(q, ndims); 
    362368 
     369        version(X86) 
     370            va_start(q, ndims); 
     371        else version(X86_64) 
     372            va_start(q, __va_argsave); 
     373        else 
     374            static assert(false, "platform not supported"); 
     375 
    363376        void[] foo(TypeInfo ti, size_t* pdim, int ndims) 
    364377        { 
    365378            size_t dim = *pdim; 
     
    382395        } 
    383396 
    384397        size_t* pdim = cast(size_t *)q; 
    385         result = cast(ulong)foo(ti, pdim, ndims)
     398        result = cast(ulong)foo(ti, pdim, ndims).ptr
    386399        debug(PRINTF) printf("result = %llx\n", result); 
    387400 
    388401        version (none) 
     
    830843            const size_t b=0; // flatness factor, how fast the extra space decreases with array size 
    831844            const size_t a=100; // allocate at most a% of the requested size as extra space (rounding will change this) 
    832845            const size_t minBits=1; // minimum bit size 
    833              
    834846 
     847 
    835848            static size_t log2plusB(size_t c) 
    836849            { 
    837850                // could use the bsr bit op 
     
    11671180        } 
    11681181        result = gc_malloc(length * sizeelem, !(ti.next.flags() & 1) ? BlkAttr.NO_SCAN : 0, pm); 
    11691182 
    1170         va_list q; 
    1171         va_start!(size_t)(q, length); 
     1183        version(X86) 
     1184        { 
     1185            va_list q; 
     1186            va_start!(size_t)(q, length); 
    11721187 
    1173         size_t stacksize = (sizeelem + int.sizeof - 1) & ~(int.sizeof - 1); 
     1188            size_t stacksize = (sizeelem + int.sizeof - 1) & ~(int.sizeof - 1); 
    11741189 
    1175         if (stacksize == sizeelem) 
    1176         { 
    1177             memcpy(result, q, length * sizeelem); 
     1190            if (stacksize == sizeelem) 
     1191            { 
     1192                memcpy(result, q, length * sizeelem); 
     1193            } 
     1194            else 
     1195            { 
     1196                for (size_t i = 0; i < length; i++) 
     1197                { 
     1198                    memcpy(result + i * sizeelem, q, sizeelem); 
     1199                    q += stacksize; 
     1200                } 
     1201            } 
     1202 
     1203            va_end(q); 
    11781204        } 
    1179         else 
     1205        else version(X86_64) 
    11801206        { 
     1207            va_list q; 
     1208            va_start(q, __va_argsave); 
    11811209            for (size_t i = 0; i < length; i++) 
    11821210            { 
    1183                 memcpy(result + i * sizeelem, q, sizeelem); 
    1184                 q += stacksize; 
     1211                va_arg(q, ti.next, result + i * sizeelem); 
    11851212            } 
     1213            va_end(q); 
    11861214        } 
    1187  
    1188         va_end(q); 
    11891215    } 
    11901216    return result; 
    11911217} 
  • tango/core/rt/compiler/dmd/rt/memory.d

    old new  
    109109            ret; 
    110110        } 
    111111    } 
     112    else version( D_InlineAsm_X86_64 ) 
     113    { 
     114        asm 
     115        { 
     116            naked; 
     117            mov RAX, RSP; 
     118            ret; 
     119        } 
     120    } 
    112121    else 
    113122    { 
    114123            static assert( false, "Architecture not supported." ); 
     
    155164        extern int _end; 
    156165        } 
    157166    } 
    158      
     167 
    159168    version (Solaris) 
    160169    { 
    161170        extern (C) 
  • tango/core/rt/compiler/dmd/rt/cover.d

    old new  
    3434    struct BitArray 
    3535    { 
    3636        size_t  len; 
    37         uint*  ptr; 
     37        size_t* ptr; 
    3838 
    3939        bool opIndex( size_t i ) 
    4040        in 
  • tango/core/rt/compiler/dmd/rt/aaA.d

    old new  
    110110 
    111111size_t aligntsize(size_t tsize) 
    112112{ 
    113     // Is pointer alignment on the x64 4 bytes or 8? 
    114     return (tsize + size_t.sizeof - 1) & ~(size_t.sizeof - 1); 
     113    version (X86_64) 
     114        // Size of key needed to align value on 16 bytes 
     115        return (tsize + 15) & ~(15); 
     116    else 
     117        return (tsize + size_t.sizeof - 1) & ~(size_t.sizeof - 1); 
    115118} 
    116119 
    117120extern (C): 
     
    824827    else 
    825828    { 
    826829        va_list q; 
    827         va_start!(size_t)(q, length); 
     830        version(X86_64) va_start(q, __va_argsave); else va_start!(size_t)(q, length); 
    828831 
    829832        result = new BB(); 
    830833        result.keyti = keyti; 
  • tango/core/rt/compiler/dmd/object_.d

    old new  
    416416 
    417417    /// Compares two instances for &lt;, ==, or &gt;. 
    418418    int compare(in void* p1, in void* p2) { return 0; } // throw new Exception("non comparable",__FILE__,__LINE__); 
    419  
     419    /// Return alignment of type 
     420    size_t talign() { return tsize(); } 
    420421    /// Returns size of the type. 
    421422    size_t tsize() { return 0; } 
    422423 
     
    473474 
    474475    /// Get type information on the contents of the type; null if not available 
    475476    OffsetTypeInfo[] offTi() { return null; } 
     477 
     478 
     479     /** Return internal info on arguments fitting into 8byte. 
     480       * See X86-64 ABI 3.2.3 
     481     */ 
     482    version (X86_64) int argTypes(out TypeInfo arg1, out TypeInfo arg2) 
     483    {   arg1 = this; 
     484        return 0; 
     485    } 
    476486} 
    477487 
    478488class TypeInfo_Typedef : TypeInfo 
  • tango/core/rt/compiler/dmd/typeinfo/ti_void.d

    old new  
    2222        return *cast(byte *)p1 - *cast(byte *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return void.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return void.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_wchar.d

    old new  
    2121        return *cast(wchar *)p1 - *cast(wchar *)p2; 
    2222    } 
    2323 
     24    override size_t talign() 
     25    { 
     26        return wchar.alignof; 
     27    } 
     28 
    2429    override size_t tsize() 
    2530    { 
    2631        return wchar.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_ptr.d

    old new  
    2525        return 0; 
    2626    } 
    2727 
     28    override size_t talign() 
     29    { 
     30        return (void*).alignof; 
     31    } 
     32 
    2833    override size_t tsize() 
    2934    { 
    3035        return (void*).sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_Afloat.d

    old new  
    7676        return 0; 
    7777    } 
    7878 
     79    override size_t talign() 
     80    { 
     81        return (float[]).alignof; 
     82    } 
     83 
    7984    override size_t tsize() 
    8085    { 
    8186        return (float[]).sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_double.d

    old new  
    4343        return _compare(*cast(double *)p1, *cast(double *)p2); 
    4444    } 
    4545 
     46    override size_t talign() 
     47    { 
     48        return double.alignof; 
     49    } 
     50 
    4651    override size_t tsize() 
    4752    { 
    4853        return double.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_delegate.d

    old new  
    1818        return *cast(dg *)p1 == *cast(dg *)p2; 
    1919    } 
    2020 
     21    override size_t talign() 
     22    { 
     23        return dg.alignof; 
     24    } 
     25 
    2126    override size_t tsize() 
    2227    { 
    2328        return dg.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_Adouble.d

    old new  
    7676        return 0; 
    7777    } 
    7878 
     79    override size_t talign() 
     80    { 
     81        return (double[]).alignof; 
     82    } 
     83 
    7984    override size_t tsize() 
    8085    { 
    8186        return (double[]).sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_char.d

    old new  
    2020        return *cast(char *)p1 - *cast(char *)p2; 
    2121    } 
    2222 
     23    override size_t talign() 
     24    { 
     25        return char.alignof; 
     26    } 
     27 
    2328    override size_t tsize() 
    2429    { 
    2530        return char.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_Acdouble.d

    old new  
    7575        return 0; 
    7676    } 
    7777 
     78    override size_t talign() 
     79    { 
     80        return (cdouble[]).alignof; 
     81    } 
     82 
    7883    override size_t tsize() 
    7984    { 
    8085        return (cdouble[]).sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_uint.d

    old new  
    2626        return 0; 
    2727    } 
    2828 
     29    override size_t talign() 
     30    { 
     31        return uint.alignof; 
     32    } 
     33 
    2934    override size_t tsize() 
    3035    { 
    3136        return uint.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_AC.d

    old new  
    8282        return 0; 
    8383    } 
    8484 
     85    override size_t talign() 
     86    { 
     87        return (Object[]).alignof; 
     88    } 
     89 
    8590    override size_t tsize() 
    8691    { 
    8792        return (Object[]).sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_ulong.d

    old new  
    3131        return 0; 
    3232    } 
    3333 
     34    override size_t talign() 
     35    { 
     36        return ulong.alignof; 
     37    } 
     38 
    3439    override size_t tsize() 
    3540    { 
    3641        return ulong.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_creal.d

    old new  
    4444        return _compare(*cast(creal *)p1, *cast(creal *)p2); 
    4545    } 
    4646 
     47    override size_t talign() 
     48    { 
     49        return creal.alignof; 
     50    } 
     51 
    4752    override size_t tsize() 
    4853    { 
    4954        return creal.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_ubyte.d

    old new  
    2222        return *cast(ubyte *)p1 - *cast(ubyte *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return ubyte.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return ubyte.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_Aint.d

    old new  
    4747        return 0; 
    4848    } 
    4949 
     50    override size_t talign() 
     51    { 
     52        return (int[]).alignof; 
     53    } 
     54 
    5055    override size_t tsize() 
    5156    { 
    5257        return (int[]).sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_long.d

    old new  
    3131        return 0; 
    3232    } 
    3333 
     34    override size_t talign() 
     35    { 
     36        return long.alignof; 
     37    } 
     38 
    3439    override size_t tsize() 
    3540    { 
    3641        return long.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_short.d

    old new  
    2222        return *cast(short *)p1 - *cast(short *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return short.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return short.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_Along.d

    old new  
    4848        return 0; 
    4949    } 
    5050 
     51    override size_t talign() 
     52    { 
     53        return (long[]).alignof; 
     54    } 
     55 
    5156    override size_t tsize() 
    5257    { 
    5358        return (long[]).sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_byte.d

    old new  
    2222        return *cast(byte *)p1 - *cast(byte *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return byte.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return byte.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_float.d

    old new  
    4242        return _compare(*cast(float *)p1, *cast(float *)p2); 
    4343    } 
    4444 
     45    override size_t talign() 
     46    { 
     47        return float.alignof; 
     48    } 
     49 
    4550    override size_t tsize() 
    4651    { 
    4752        return float.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_cfloat.d

    old new  
    4444        return _compare(*cast(cfloat *)p1, *cast(cfloat *)p2); 
    4545    } 
    4646 
     47    override size_t talign() 
     48    { 
     49        return cfloat.alignof; 
     50    } 
     51 
    4752    override size_t tsize() 
    4853    { 
    4954        return cfloat.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_Acfloat.d

    old new  
    7676        return 0; 
    7777    } 
    7878 
     79    override size_t talign() 
     80    { 
     81        return (cfloat[]).alignof; 
     82    } 
     83 
    7984    override size_t tsize() 
    8085    { 
    8186        return (cfloat[]).sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_cdouble.d

    old new  
    4444        return _compare(*cast(cdouble *)p1, *cast(cdouble *)p2); 
    4545    } 
    4646 
     47    override size_t talign() 
     48    { 
     49        return cdouble.alignof; 
     50    } 
     51 
    4752    override size_t tsize() 
    4853    { 
    4954        return cdouble.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_dchar.d

    old new  
    2222        return *cast(dchar *)p1 - *cast(dchar *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return dchar.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return dchar.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_C.d

    old new  
    6262        return c; 
    6363    } 
    6464 
     65    override size_t talign() 
     66    { 
     67        return Object.alignof; 
     68    } 
     69 
    6570    override size_t tsize() 
    6671    { 
    6772        return Object.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_real.d

    old new  
    4343        return _compare(*cast(real *)p1, *cast(real *)p2); 
    4444    } 
    4545 
     46    override size_t talign() 
     47    { 
     48        return real.alignof; 
     49    } 
     50 
    4651    override size_t tsize() 
    4752    { 
    4853        return real.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_ushort.d

    old new  
    2222        return *cast(ushort *)p1 - *cast(ushort *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return ushort.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return ushort.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_Areal.d

    old new  
    7676        return 0; 
    7777    } 
    7878 
     79    override size_t talign() 
     80    { 
     81        return (real[]).alignof; 
     82    } 
     83 
    7984    override size_t tsize() 
    8085    { 
    8186        return (real[]).sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_Acreal.d

    old new  
    7676        return 0; 
    7777    } 
    7878 
     79    override size_t talign() 
     80    { 
     81        return (creal[]).alignof; 
     82    } 
     83 
    7984    override size_t tsize() 
    8085    { 
    8186        return (creal[]).sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_Ag.d

    old new  
    4848        return 0; 
    4949    } 
    5050 
     51    override size_t talign() 
     52    { 
     53        return (byte[]).alignof; 
     54    } 
     55 
    5156    override size_t tsize() 
    5257    { 
    5358        return (byte[]).sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_int.d

    old new  
    2626        return 0; 
    2727    } 
    2828 
     29    override size_t talign() 
     30    { 
     31        return int.alignof; 
     32    } 
     33 
    2934    override size_t tsize() 
    3035    { 
    3136        return int.sizeof; 
  • tango/core/rt/compiler/dmd/typeinfo/ti_Ashort.d

    old new  
    4747        return 0; 
    4848    } 
    4949 
     50    override size_t talign() 
     51    { 
     52        return (short[]).alignof; 
     53    } 
     54 
    5055    override size_t tsize() 
    5156    { 
    5257        return (short[]).sizeof; 
  • tango/core/rt/compiler/dmd/posix/deh.d

    old new  
    3535extern (C) 
    3636{ 
    3737    version (darwin) {} 
    38      
     38 
    3939    else 
    4040    { 
    4141        extern void* _deh_beg; 
     
    111111    { 
    112112        static FuncTable[] functionTables; 
    113113        static bool hasFunctionTables; 
    114          
     114 
    115115        if (!hasFunctionTables) 
    116116        { 
    117117            functionTables = getSectionData!(FuncTable, "__DATA", "__deh_eh"); 
    118118            hasFunctionTables = true; 
    119119        } 
    120          
     120 
    121121        foreach (ft ; functionTables) 
    122122        { 
    123123            if (ft.fptr <= address && address < cast(void *)(cast(char *)ft.fptr + ft.fsize)) 
    124124                return ft.handlertable; 
    125125        } 
    126                  
     126 
    127127        return null; 
    128128    } 
    129      
     129 
    130130    else 
    131131    { 
    132132        FuncTable *ft; 
     
    164164 *   caller's EBP 
    165165 */ 
    166166 
    167 uint __eh_find_caller(uint regbp, uint *pretaddr) 
     167size_t __eh_find_caller(size_t regbp, size_t *pretaddr) 
    168168{ 
    169     uint bp = *cast(uint *)regbp; 
     169    size_t bp = *cast(size_t *)regbp; 
    170170 
    171171    if (bp)         // if not end of call chain 
    172172    { 
     
    176176            // stack should grow to smaller values 
    177177            terminate(); 
    178178 
    179         *pretaddr = *cast(uint *)(regbp + int.sizeof); 
     179        *pretaddr = *cast(size_t *)(regbp + size_t.sizeof); 
    180180    } 
    181181    return bp; 
    182182} 
     
    195195* Throw a D object. 
    196196*/ 
    197197 
    198 extern(C) void _d_throwc(Object *h){ 
    199     uint regebp; 
     198extern(C) void _d_throwc(Object *h) 
     199
     200    size_t regebp; 
    200201 
    201202    debug(deh) 
    202203    { 
     
    204205        printf("\tvptr = %p\n", *cast(void **)h); 
    205206    } 
    206207 
    207     asm 
    208     { 
    209         mov regebp,EBP  ; 
    210     } 
     208    version (D_InlineAsm_X86) 
     209        asm 
     210        { 
     211            mov regebp,EBP  ; 
     212        } 
     213    else version (D_InlineAsm_X86_64) 
     214        asm 
     215        { 
     216            mov regebp,RBP  ; 
     217        } 
     218    else 
     219        static assert(0); 
    211220 
    212221//static uint abc; 
    213222//if (++abc == 2) *(char *)0=0; 
     
    218227        DHandlerTable *handler_table; 
    219228        FuncTable *pfunc; 
    220229        DHandlerInfo *phi; 
    221         uint retaddr; 
    222         uint funcoffset; 
     230        size_t retaddr; 
     231        size_t funcoffset; 
    223232        uint spoff; 
    224233        uint retoffset; 
    225234        int index; 
    226         int dim; 
     235        size_t dim; 
    227236        int ndx; 
    228237        int prev_ndx; 
    229238 
     
    275284            phi = handler_table.handler_info.ptr + i; 
    276285 
    277286            debug(deh) printf("i = %d, phi.offset = %04x\n", i, funcoffset + phi.offset); 
    278             if (cast(uint)retaddr > funcoffset + phi.offset && 
    279                 cast(uint)retaddr <= funcoffset + phi.endoffset) 
     287            if (retaddr > funcoffset + phi.offset && 
     288                retaddr <= funcoffset + phi.endoffset) 
    280289                index = i; 
    281290        } 
    282291        debug(deh) printf("index = %d\n", index); 
     
    287296        { 
    288297            phi = handler_table.handler_info.ptr + ndx; 
    289298            prev_ndx = phi.prev_index; 
     299 
    290300            if (phi.cioffset) 
    291301            { 
    292302                // this is a catch handler (no finally) 
    293303                DCatchInfo *pci; 
    294                 int ncatches; 
    295                 int i; 
     304                size_t ncatches; 
     305                size_t i; 
    296306 
    297307                pci = cast(DCatchInfo *)(cast(char *)handler_table + phi.cioffset); 
    298308                ncatches = pci.ncatches; 
     309 
    299310                for (i = 0; i < ncatches; i++) 
    300311                { 
    301312                    DCatchBlock *pcb; 
     
    311322 
    312323                        // Jump to catch block. Does not return. 
    313324                        { 
    314                             uint catch_esp; 
     325                            size_t catch_esp; 
    315326                            fp_t catch_addr; 
    316327 
    317328                            catch_addr = cast(fp_t)(pcb.code); 
    318329                            catch_esp = regebp - handler_table.espoffset - fp_t.sizeof; 
    319                             asm 
    320                             { 
    321                                 mov     EAX,catch_esp   ; 
    322                                 mov     ECX,catch_addr  ; 
    323                                 mov     [EAX],ECX       ; 
    324                                 mov     EBP,regebp      ; 
    325                                 mov     ESP,EAX         ; // reset stack 
    326                                 ret                     ; // jump to catch block 
    327                             } 
     330 
     331                            version (D_InlineAsm_X86) 
     332                                asm 
     333                                { 
     334                                    mov     EAX,catch_esp   ; 
     335                                    mov     ECX,catch_addr  ; 
     336                                    mov     [EAX],ECX       ; 
     337                                    mov     EBP,regebp      ; 
     338                                    mov     ESP,EAX         ; // reset stack 
     339                                    ret                     ; // jump to catch block 
     340                                } 
     341                            else version (D_InlineAsm_X86_64) 
     342                                asm 
     343                                { 
     344                                    mov     RAX,catch_esp   ; 
     345                                    mov     RCX,catch_esp   ; 
     346                                    mov     RCX,catch_addr  ; 
     347                                    mov     [RAX],RCX       ; 
     348                                    mov     RBP,regebp      ; 
     349                                    mov     RSP,RAX         ; // reset stack 
     350                                    ret                     ; // jump to catch block 
     351                                } 
     352                            else 
     353                                static assert(0); 
     354 
    328355                        } 
    329356                    } 
    330357                } 
     
    338365 
    339366                version (OSX) 
    340367                { 
    341                     asm { 
    342                         sub ESP,4       ; 
    343                         push    EBX     ; 
    344                         mov EBX,blockaddr   ; 
    345                         push    EBP     ; 
    346                         mov EBP,regebp  ; 
    347                         call    EBX     ; 
    348                         pop EBP     ; 
    349                         pop EBX     ; 
    350                         add ESP,4       ; 
    351                     } 
    352                 } else { 
    353                     asm { 
    354                         push        EBX             ; 
    355                         mov         EBX,blockaddr   ; 
    356                         push        EBP             ; 
    357                         mov         EBP,regebp      ; 
    358                         call        EBX             ; 
    359                         pop         EBP             ; 
    360                         pop         EBX             ; 
    361                     } 
     368                    version (D_InlineAsm_X86) 
     369                        asm 
     370                        { 
     371                            sub     ESP,4           ; 
     372                            push    EBX             ; 
     373                            mov     EBX,blockaddr   ; 
     374                            push    EBP             ; 
     375                            mov     EBP,regebp      ; 
     376                            call    EBX             ; 
     377                            pop     EBP             ; 
     378                            pop     EBX             ; 
     379                            add     ESP,4           ; 
     380                        } 
     381                    else version (D_InlineAsm_X86_64) 
     382                        asm 
     383                        { 
     384                            sub     RSP,8           ; 
     385                            push    RBX             ; 
     386                            mov     RBX,blockaddr   ; 
     387                            push    RBP             ; 
     388                            mov     RBP,regebp      ; 
     389                            call    RBX             ; 
     390                            pop     RBP             ; 
     391                            pop     RBX             ; 
     392                            add     RSP,8           ; 
     393                        } 
     394                    else 
     395                        static assert(0); 
    362396                } 
     397                else 
     398                { 
     399                    version (D_InlineAsm_X86) 
     400                        asm 
     401                        { 
     402                            push    EBX             ; 
     403                            mov     EBX,blockaddr   ; 
     404                            push    EBP             ; 
     405                            mov     EBP,regebp      ; 
     406                            call    EBX             ; 
     407                            pop     EBP             ; 
     408                            pop     EBX             ; 
     409                        } 
     410                    else version (D_InlineAsm_X86_64) 
     411                        asm 
     412                        { 
     413                            sub     RSP,8           ; 
     414                            push    RBX             ; 
     415                            mov     RBX,blockaddr   ; 
     416                            push    RBP             ; 
     417                            mov     RBP,regebp      ; 
     418                            call    RBX             ; 
     419                            pop     RBP             ; 
     420                            pop     RBX             ; 
     421                            add     RSP,8           ; 
     422                        } 
     423                    else 
     424                        static assert(0); 
     425                } 
    363426            } 
    364427        } 
    365428    } 
  • tango/core/rt/compiler/gdc/object_.d

    old new  
    413413    /// Compares two instances for &lt;, ==, or &gt;. 
    414414    int compare(in void* p1, in void* p2) { return 0; } // throw new Exception("non comparable",__FILE__,__LINE__); 
    415415 
     416     /// Return alignment of type 
     417    size_t   talign() { return tsize(); } 
     418 
    416419    /// Returns size of the type. 
    417420    size_t tsize() { return 0; } 
    418421 
  • tango/core/rt/compiler/gdc/typeinfo/ti_void.d

    old new  
    2222        return *cast(byte *)p1 - *cast(byte *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return void.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return void.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_wchar.d

    old new  
    2121        return *cast(wchar *)p1 - *cast(wchar *)p2; 
    2222    } 
    2323 
     24    override size_t talign() 
     25    { 
     26        return wchar.alignof; 
     27    } 
     28 
    2429    override size_t tsize() 
    2530    { 
    2631        return wchar.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_ptr.d

    old new  
    2525        return 0; 
    2626    } 
    2727 
     28    override size_t talign() 
     29    { 
     30        return (void*).alignof; 
     31    } 
     32 
    2833    override size_t tsize() 
    2934    { 
    3035        return (void*).sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_Afloat.d

    old new  
    7676        return 0; 
    7777    } 
    7878 
     79    override size_t talign() 
     80    { 
     81        return (float[]).alignof; 
     82    } 
     83 
    7984    override size_t tsize() 
    8085    { 
    8186        return (float[]).sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_double.d

    old new  
    4343        return _compare(*cast(double *)p1, *cast(double *)p2); 
    4444    } 
    4545 
     46    override size_t talign() 
     47    { 
     48        return double.alignof; 
     49    } 
     50 
    4651    override size_t tsize() 
    4752    { 
    4853        return double.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_delegate.d

    old new  
    1818        return *cast(dg *)p1 == *cast(dg *)p2; 
    1919    } 
    2020 
     21    override size_t talign() 
     22    { 
     23        return dg.alignof; 
     24    } 
     25 
    2126    override size_t tsize() 
    2227    { 
    2328        return dg.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_Adouble.d

    old new  
    7676        return 0; 
    7777    } 
    7878 
     79    override size_t talign() 
     80    { 
     81        return (double[]).alignof; 
     82    } 
     83 
    7984    override size_t tsize() 
    8085    { 
    8186        return (double[]).sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_char.d

    old new  
    2020        return *cast(char *)p1 - *cast(char *)p2; 
    2121    } 
    2222 
     23    override size_t talign() 
     24    { 
     25        return char.alignof; 
     26    } 
     27 
    2328    override size_t tsize() 
    2429    { 
    2530        return char.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_Acdouble.d

    old new  
    7575        return 0; 
    7676    } 
    7777 
     78    override size_t talign() 
     79    { 
     80        return (cdouble[]).alignof; 
     81    } 
     82 
    7883    override size_t tsize() 
    7984    { 
    8085        return (cdouble[]).sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_uint.d

    old new  
    2626        return 0; 
    2727    } 
    2828 
     29    override size_t talign() 
     30    { 
     31        return uint.alignof; 
     32    } 
     33 
    2934    override size_t tsize() 
    3035    { 
    3136        return uint.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_AC.d

    old new  
    8282        return 0; 
    8383    } 
    8484 
     85    override size_t talign() 
     86    { 
     87        return (Object[]).alignof; 
     88    } 
     89 
    8590    override size_t tsize() 
    8691    { 
    8792        return (Object[]).sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_ulong.d

    old new  
    3131        return 0; 
    3232    } 
    3333 
     34    override size_t talign() 
     35    { 
     36        return ulong.alignof; 
     37    } 
     38 
    3439    override size_t tsize() 
    3540    { 
    3641        return ulong.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_creal.d

    old new  
    4444        return _compare(*cast(creal *)p1, *cast(creal *)p2); 
    4545    } 
    4646 
     47    override size_t talign() 
     48    { 
     49        return creal.alignof; 
     50    } 
     51 
    4752    override size_t tsize() 
    4853    { 
    4954        return creal.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_ubyte.d

    old new  
    2222        return *cast(ubyte *)p1 - *cast(ubyte *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return ubyte.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return ubyte.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_Aint.d

    old new  
    4747        return 0; 
    4848    } 
    4949 
     50    override size_t talign() 
     51    { 
     52        return (int[]).alignof; 
     53    } 
     54 
    5055    override size_t tsize() 
    5156    { 
    5257        return (int[]).sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_long.d

    old new  
    3131        return 0; 
    3232    } 
    3333 
     34    override size_t talign() 
     35    { 
     36        return long.alignof; 
     37    } 
     38 
    3439    override size_t tsize() 
    3540    { 
    3641        return long.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_short.d

    old new  
    2222        return *cast(short *)p1 - *cast(short *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return short.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return short.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_Along.d

    old new  
    4848        return 0; 
    4949    } 
    5050 
     51    override size_t talign() 
     52    { 
     53        return (long[]).alignof; 
     54    } 
     55 
    5156    override size_t tsize() 
    5257    { 
    5358        return (long[]).sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_byte.d

    old new  
    2222        return *cast(byte *)p1 - *cast(byte *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return byte.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return byte.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_float.d

    old new  
    4242        return _compare(*cast(float *)p1, *cast(float *)p2); 
    4343    } 
    4444 
     45    override size_t talign() 
     46    { 
     47        return float.alignof; 
     48    } 
     49 
    4550    override size_t tsize() 
    4651    { 
    4752        return float.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_cfloat.d

    old new  
    4444        return _compare(*cast(cfloat *)p1, *cast(cfloat *)p2); 
    4545    } 
    4646 
     47    override size_t talign() 
     48    { 
     49        return cfloat.alignof; 
     50    } 
     51 
    4752    override size_t tsize() 
    4853    { 
    4954        return cfloat.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_Acfloat.d

    old new  
    7676        return 0; 
    7777    } 
    7878 
     79    override size_t talign() 
     80    { 
     81        return (cfloat[]).alignof; 
     82    } 
     83 
    7984    override size_t tsize() 
    8085    { 
    8186        return (cfloat[]).sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_cdouble.d

    old new  
    4444        return _compare(*cast(cdouble *)p1, *cast(cdouble *)p2); 
    4545    } 
    4646 
     47    override size_t talign() 
     48    { 
     49        return cdouble.alignof; 
     50    } 
     51 
    4752    override size_t tsize() 
    4853    { 
    4954        return cdouble.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_dchar.d

    old new  
    2222        return *cast(dchar *)p1 - *cast(dchar *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return dchar.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return dchar.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_C.d

    old new  
    6262        return c; 
    6363    } 
    6464 
     65    override size_t talign() 
     66    { 
     67        return Object.alignof; 
     68    } 
     69 
    6570    override size_t tsize() 
    6671    { 
    6772        return Object.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_real.d

    old new  
    4343        return _compare(*cast(real *)p1, *cast(real *)p2); 
    4444    } 
    4545 
     46    override size_t talign() 
     47    { 
     48        return real.alignof; 
     49    } 
     50 
    4651    override size_t tsize() 
    4752    { 
    4853        return real.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_ushort.d

    old new  
    2222        return *cast(ushort *)p1 - *cast(ushort *)p2; 
    2323    } 
    2424 
     25    override size_t talign() 
     26    { 
     27        return ushort.alignof; 
     28    } 
     29 
    2530    override size_t tsize() 
    2631    { 
    2732        return ushort.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_Areal.d

    old new  
    7676        return 0; 
    7777    } 
    7878 
     79    override size_t talign() 
     80    { 
     81        return (real[]).alignof; 
     82    } 
     83 
    7984    override size_t tsize() 
    8085    { 
    8186        return (real[]).sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_Acreal.d

    old new  
    7676        return 0; 
    7777    } 
    7878 
     79    override size_t talign() 
     80    { 
     81        return (creal[]).alignof; 
     82    } 
     83 
    7984    override size_t tsize() 
    8085    { 
    8186        return (creal[]).sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_Ag.d

    old new  
    4848        return 0; 
    4949    } 
    5050 
     51    override size_t talign() 
     52    { 
     53        return (byte[]).alignof; 
     54    } 
     55 
    5156    override size_t tsize() 
    5257    { 
    5358        return (byte[]).sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_int.d

    old new  
    2626        return 0; 
    2727    } 
    2828 
     29    override size_t talign() 
     30    { 
     31        return int.alignof; 
     32    } 
     33 
    2934    override size_t tsize() 
    3035    { 
    3136        return int.sizeof; 
  • tango/core/rt/compiler/gdc/typeinfo/ti_Ashort.d

    old new  
    4747        return 0; 
    4848    } 
    4949 
     50    override size_t talign() 
     51    { 
     52        return (short[]).alignof; 
     53    } 
     54 
    5055    override size_t tsize() 
    5156    { 
    5257        return (short[]).sizeof; 
  • tango/core/Variant.d

    old new  
    88module tango.core.Variant; 
    99 
    1010private import tango.core.Memory : GC; 
    11 private import tango.core.Vararg : va_list
     11private import tango.core.Vararg
    1212private import tango.core.Traits; 
    1313private import tango.core.Tuple; 
    1414 
     
    3737            version=EnableVararg; 
    3838        } 
    3939    } 
     40    version( X86_64 ) 
     41    { 
     42        version( Windows ) 
     43        { 
     44            version=EnableVararg; 
     45        } 
     46        else version( Posix ) 
     47        { 
     48            version=EnableVararg; 
     49        } 
     50    } 
    4051} 
    4152else version( LDC ) 
    4253{ 
     
    337348     * 
    338349     * Returns: 
    339350     *  The new Variant. 
    340      *  
     351     * 
    341352     * Example: 
    342353     * ----- 
    343354     *  auto v = Variant(42); 
     
    366377     * 
    367378     * Returns: 
    368379     *  The new Variant. 
    369      *  
     380     * 
    370381     * Example: 
    371382     * ----- 
    372383     *  int life = 42; 
     
    389400     * 
    390401     * Returns: 
    391402     *  The new value of the assigned-to variant. 
    392      *  
     403     * 
    393404     * Example: 
    394405     * ----- 
    395406     *  Variant v; 
     
    446457     * 
    447458     * Returns: 
    448459     *  true if the Variant contains a value of type T, false otherwise. 
    449      *  
     460     * 
    450461     * Example: 
    451462     * ----- 
    452463     *  auto v = Variant(cast(int) 42); 
     
    468479     *  true if the Variant contains a value of type T, or if the Variant 
    469480     *  contains a value that can be implicitly cast to type T; false 
    470481     *  otherwise. 
    471      *  
     482     * 
    472483     * Example: 
    473484     * ----- 
    474485     *  auto v = Variant(cast(int) 42); 
     
    739750        else 
    740751            return value.heap.ptr; 
    741752    } 
    742      
     753 
    743754    version( EnableVararg ) 
    744755    { 
    745756        /** 
     
    751762 
    752763            foreach( i, ref v ; vs ) 
    753764                args = Variant.fromPtr(types[i], args, v); 
    754              
     765 
    755766            return vs; 
    756767        } 
    757          
     768 
    758769        /// ditto 
    759770        static Variant[] fromVararg(...) 
    760771        { 
    761772            return Variant.fromVararg(_arguments, _argptr); 
    762773        } 
    763          
     774 
    764775        /** 
    765776         * Converts an array of Variants into a vararg function argument list. 
    766777         * 
     
    780791                size += (ti.tsize + size_t.sizeof-1) & ~(size_t.sizeof-1); 
    781792                noptr = noptr && (ti.flags & 2); 
    782793            } 
    783              
     794 
    784795            // Create the storage, and tell the GC whether it needs to be scanned 
    785796            // or not. 
    786797            auto storage = new ubyte[size]; 
     
    810821    { 
    811822        return (_type = v); 
    812823    } 
    813      
     824 
    814825    /* 
    815826     * Creates a Variant using a given TypeInfo and a void*.  Returns the 
    816827     * given pointer adjusted for the next vararg. 
     
    861872                if( type.tsize <= this.value.data.length ) 
    862873                { 
    863874                    // Copy into storage 
    864                     r.value.data[0 .. type.tsize] =  
     875                    r.value.data[0 .. type.tsize] = 
    865876                        (cast(ubyte*)ptr)[0 .. type.tsize]; 
    866877                } 
    867878                else 
     
    12551266            B    va_a = new B; 
    12561267            C    va_b = new D; 
    12571268            D    va_c = new D; 
    1258              
     1269 
    12591270            auto vs = scoop(va_0, va_1, va_2, va_3, 
    12601271                            va_4, va_5, va_6, va_7, 
    12611272                            va_8, va_9, va_a, va_b, va_c); 
     
    12771288            assert( vs[0x9].get!(typeof(va_9)).msg == "A" ); 
    12781289            assert( vs[0xa].get!(typeof(va_a)).msg == "B" ); 
    12791290            assert( vs[0xc].get!(typeof(va_c)).msg == "D" ); 
    1280              
     1291 
    12811292            assert( vs[0xb].get!(typeof(va_b)).name == "phil" ); 
    12821293            assert( vs[0xc].get!(typeof(va_c)).name == "phil" ); 
    12831294 
  • tango/core/Thread.d

    old new  
    348348            { 
    349349                __builtin_unwind_init(); 
    350350            } 
     351            else version ( D_InlineAsm_X86_64 ) 
     352            { 
     353                asm 
     354                { 
     355                    // Not sure what goes here, pushad is invalid in 64 bit code 
     356                    push RAX ; 
     357                    push RBX ; 
     358                    push RCX ; 
     359                    push RDX ; 
     360                    push RSI ; 
     361                    push RDI ; 
     362                    push RBP ; 
     363                    push R8  ; 
     364                    push R9  ; 
     365                    push R10 ; 
     366                    push R11 ; 
     367                    push R12 ; 
     368                    push R13 ; 
     369                    push R14 ; 
     370                    push R15 ; 
     371                    push EAX ;   // 16 byte align the stack 
     372                } 
     373            } 
    351374            else 
    352375            { 
    353376                static assert( false, "Architecture not supported." ); 
     
    411434            { 
    412435                // registers will be popped automatically 
    413436            } 
     437            else version ( D_InlineAsm_X86_64 ) 
     438            { 
     439                asm 
     440                { 
     441                    // Not sure what goes here, popad is invalid in 64 bit code 
     442                    pop EAX ;   // 16 byte align the stack 
     443                    pop R15 ; 
     444                    pop R14 ; 
     445                    pop R13 ; 
     446                    pop R12 ; 
     447                    pop R11 ; 
     448                    pop R10 ; 
     449                    pop R9  ; 
     450                    pop R8  ; 
     451                    pop RBP ; 
     452                    pop RDI ; 
     453                    pop RSI ; 
     454                    pop RDX ; 
     455                    pop RCX ; 
     456                    pop RBX ; 
     457                    pop RAX ; 
     458                } 
     459            } 
    414460            else 
    415461            { 
    416462                static assert( false, "Architecture not supported." ); 
     
    26702716        } 
    26712717        else version( AsmX86_64_Posix ) 
    26722718        { 
    2673             asm 
     2719            version( DigitalMars ) asm 
    26742720            { 
    26752721                naked; 
    26762722 
    26772723                // save current stack state 
     2724                push RBP; 
     2725                mov RBP, RSP; 
     2726                push RBX; 
     2727                push R12; 
     2728                push R13; 
     2729                push R14; 
     2730                push R15; 
     2731                sub RSP, 4; 
     2732                stmxcsr [RSP]; 
     2733                sub RSP, 4; 
     2734                //version(SynchroFloatExcept){ 
     2735                    fstcw [RSP]; 
     2736                    fwait; 
     2737                //} else { 
     2738                //    fnstcw [RSP]; 
     2739                //    fnclex; 
     2740                //} 
     2741 
     2742                // store oldp again with more accurate address 
     2743                mov [RDI], RSP; 
     2744                // load newp to begin context switch 
     2745                mov RSP, RSI; 
     2746 
     2747                // load saved state from new stack 
     2748                fldcw [RSP]; 
     2749                add RSP, 4; 
     2750                ldmxcsr [RSP]; 
     2751                add RSP, 4; 
     2752                pop R15; 
     2753                pop R14; 
     2754                pop R13; 
     2755                pop R12; 
     2756 
     2757                pop RBX; 
     2758                pop RBP; 
     2759 
     2760                // 'return' to complete switch 
     2761                ret; 
     2762 
     2763            } 
     2764            else asm 
     2765            { 
     2766                naked; 
     2767 
     2768                // save current stack state 
    26782769                pushq RBP; 
    26792770                mov RBP, RSP; 
    26802771                pushq RBX; 
  • tango/core/Vararg.d

    old new  
    2121} 
    2222else 
    2323{ 
    24     /** 
    25      * The base vararg list type. 
    26      */ 
    27     alias void* va_list; 
    28  
    29  
    30     /** 
    31      * This function initializes the supplied argument pointer for subsequent 
    32      * use by va_arg and va_end. 
    33      * 
    34      * Params: 
    35      *  ap      = The argument pointer to initialize. 
    36      *  paramn  = The identifier of the rightmost parameter in the function 
    37      *            parameter list. 
    38      */ 
    39     void va_start(T) ( out va_list ap, ref T parmn ) 
     24    version (X86) 
    4025    { 
    41         ap = cast(va_list) ( cast(void*) &parmn + ( ( T.sizeof + int.sizeof - 1 ) & ~( int.sizeof - 1 ) ) ); 
    42     } 
     26        alias void* va_list; 
    4327 
    44     /** 
    45      * This function returns the next argument in the sequence referenced by 
    46      * the supplied argument pointer.  The argument pointer will be adjusted 
    47      * to point to the next arggument in the sequence. 
    48      * 
    49      * Params: 
    50      *  ap  = The argument pointer. 
    51      * 
    52      * Returns: 
    53      *  The next argument in the sequence.  The result is undefined if ap 
    54      *  does not point to a valid argument. 
    55      */ 
    56     T va_arg(T) ( ref va_list ap ) 
    57     { 
    58         T arg = *cast(T*) ap; 
    59         ap = cast(va_list) ( cast(void*) ap + ( ( T.sizeof + int.sizeof - 1 ) & ~( int.sizeof - 1 ) ) ); 
    60         return arg; 
     28        template va_arg(T) 
     29        { 
     30            T va_arg(ref va_list _argptr) 
     31            { 
     32                T arg = *cast(T*)_argptr; 
     33                _argptr = _argptr + ((T.sizeof + int.sizeof - 1) & ~(int.sizeof - 1)); 
     34                return arg; 
     35            } 
     36        } 
    6137    } 
    62  
    63     /** 
    64      * This function cleans up any resources allocated by va_start.  It is 
    65      * currently a no-op and exists mostly for syntax compatibility with 
    66      * the variadric argument functions for C. 
    67      * 
    68      * Params: 
    69      *  ap  = The argument pointer. 
    70      */ 
    71     void va_end( va_list ap ) 
     38    else 
    7239    { 
    73  
     40        public import tango.stdc.stdarg; 
    7441    } 
    75  
    76  
    77     /** 
    78      * This function copied the argument pointer src to dst. 
    79      * 
    80      * Params: 
    81      *  src = The source pointer. 
    82      *  dst = The destination pointer. 
    83      */ 
    84     void va_copy( out va_list dst, va_list src ) 
    85     { 
    86         dst = src; 
    87     } 
    8842} 
  • tango/core/sync/Atomic.d

    old new  
    245245        return oldval; 
    246246    } 
    247247} else version(D_InlineAsm_X86) { 
    248     T atomicSwap( T )( inout T val, T newval ) 
     248    T atomicSwap( T )( ref T val, T newval ) 
    249249    in { 
    250250        // NOTE: 32 bit x86 systems support 8 byte CAS, which only requires 
    251251        //       4 byte alignment, so use size_t as the align type here. 
     
    289289        } 
    290290    } 
    291291} else version (D_InlineAsm_X86_64){ 
    292     T atomicSwap( T )( inout T val, T newval ) 
     292    T atomicSwap( T )( ref T val, T newval ) 
    293293    in { 
    294294        assert( atomicValueIsProperlyAligned!(T)( cast(size_t) &val ) ); 
    295295    } body { 
     
    332332        } 
    333333    } 
    334334} else { 
    335     T atomicSwap( T )( inout T val, T newval ) 
     335    T atomicSwap( T )( ref T val, T newval ) 
    336336    in { 
    337337        assert( atomicValueIsProperlyAligned!(T)( cast(size_t) &val ) ); 
    338338    } body { 
  • tango/stdc/stdarg.d

    old new  
    88 */ 
    99module tango.stdc.stdarg; 
    1010 
    11  
    1211version( GNU ) 
    1312{ 
    1413    public import std.c.stdarg; 
     
    1918} 
    2019else 
    2120{ 
     21version (X86) 
     22{ 
     23    /********************* 
     24     * The argument pointer type. 
     25     */ 
    2226    alias void* va_list; 
    2327 
    24     template va_start( T ) 
     28    /********** 
     29     * Initialize ap. 
     30     * For 32 bit code, parmn should be the last named parameter. 
     31     * For 64 bit code, parmn should be __va_argsave. 
     32     */ 
     33    void va_start(T)(out va_list ap, ref T parmn) 
    2534    { 
    26         void va_start( out va_list ap, ref T parmn ) 
     35        ap = cast(va_list)(cast(void*)&parmn + ((T.sizeof + int.sizeof - 1) & ~(int.sizeof - 1))); 
     36    } 
     37 
     38    /************ 
     39     * Retrieve and return the next value that is type T. 
     40     * Should use the other va_arg instead, as this won't work for 64 bit code. 
     41     */ 
     42    T va_arg(T)(ref va_list ap) 
     43    { 
     44        T arg = *cast(T*)ap; 
     45        ap = cast(va_list)(cast(void*)ap + ((T.sizeof + int.sizeof - 1) & ~(int.sizeof - 1))); 
     46        return arg; 
     47    } 
     48 
     49    /************ 
     50     * Retrieve and return the next value that is type T. 
     51     * This is the preferred version. 
     52     */ 
     53    void va_arg(T)(ref va_list ap, ref T parmn) 
     54    { 
     55        parmn = *cast(T*)ap; 
     56        ap = cast(va_list)(cast(void*)ap + ((T.sizeof + int.sizeof - 1) & ~(int.sizeof - 1))); 
     57    } 
     58 
     59    /************* 
     60     * Retrieve and store through parmn the next value that is of TypeInfo ti. 
     61     * Used when the static type is not known. 
     62     */ 
     63    void va_arg()(ref va_list ap, TypeInfo ti, void* parmn) 
     64    { 
     65        // Wait until everyone updates to get TypeInfo.talign() 
     66        //auto talign = ti.talign(); 
     67        //auto p = cast(void*)(cast(size_t)ap + talign - 1) & ~(talign - 1); 
     68        auto p = ap; 
     69        auto tsize = ti.tsize(); 
     70        ap = cast(void*)(cast(size_t)p + ((tsize + size_t.sizeof - 1) & ~(size_t.sizeof - 1))); 
     71        parmn[0..tsize] = p[0..tsize]; 
     72    } 
     73 
     74    /*********************** 
     75     * End use of ap. 
     76     */ 
     77    void va_end(va_list ap) 
     78    { 
     79    } 
     80 
     81    void va_copy(out va_list dest, va_list src) 
     82    { 
     83        dest = src; 
     84    } 
     85
     86else version (X86_64) 
     87
     88    // Layout of this struct must match __gnuc_va_list for C ABI compatibility 
     89    struct __va_list 
     90    { 
     91        uint offset_regs = 6 * 8;            // no regs 
     92        uint offset_fpregs = 6 * 8 + 8 * 16; // no fp regs 
     93        void* stack_args; 
     94        void* reg_args; 
     95    } 
     96 
     97    struct __va_argsave_t 
     98    { 
     99        size_t[6] regs;   // RDI,RSI,RDX,RCX,R8,R9 
     100        real[8] fpregs;   // XMM0..XMM7 
     101        __va_list va; 
     102    } 
     103 
     104    /* 
     105     * Making it an array of 1 causes va_list to be passed as a pointer in 
     106     * function argument lists 
     107     */ 
     108    alias void* va_list; 
     109 
     110    void va_start(T)(out va_list ap, ref T parmn) 
     111    { 
     112        ap = &parmn.va; 
     113    } 
     114 
     115    T va_arg(T)(va_list ap) 
     116    {   T a; 
     117        va_arg(ap, a); 
     118        return a; 
     119    } 
     120 
     121    void va_arg(T)(va_list apx, ref T parmn) 
     122    { 
     123        __va_list* ap = cast(__va_list*)apx; 
     124        static if (is(T U == __argTypes)) 
    27125        { 
    28             ap = cast(va_list) ( cast(void*) &parmn + ( ( T.sizeof + int.sizeof - 1 ) & ~( int.sizeof - 1 ) ) ); 
     126            static if (U.length == 0 || T.sizeof > 16 || U[0].sizeof > 8) 
     127            {   // Always passed in memory 
     128                // The arg may have more strict alignment than the stack 
     129                auto p = (cast(size_t)ap.stack_args + T.alignof - 1) & ~(T.alignof - 1); 
     130                ap.stack_args = cast(void*)(p + ((T.sizeof + size_t.sizeof - 1) & ~(size_t.sizeof - 1))); 
     131                parmn = *cast(T*)p; 
     132            } 
     133            else static if (U.length == 1) 
     134            {   // Arg is passed in one register 
     135                alias U[0] T1; 
     136                static if (is(T1 == double) || is(T1 == float)) 
     137                {   // Passed in XMM register 
     138                    if (ap.offset_fpregs < (6 * 8 + 16 * 8)) 
     139                    { 
     140                        parmn = *cast(T*)(ap.reg_args + ap.offset_fpregs); 
     141                        ap.offset_fpregs += 16; 
     142                    } 
     143                    else 
     144                    { 
     145                        parmn = *cast(T*)ap.stack_args; 
     146                        ap.stack_args += (T1.sizeof + size_t.sizeof - 1) & ~(size_t.sizeof - 1); 
     147                    } 
     148                } 
     149                else 
     150                {   // Passed in regular register 
     151                    if (ap.offset_regs < 6 * 8 && T.sizeof <= 8) 
     152                    { 
     153                        parmn = *cast(T*)(ap.reg_args + ap.offset_regs); 
     154                        ap.offset_regs += 8; 
     155                    } 
     156                    else 
     157                    { 
     158                        auto p = (cast(size_t)ap.stack_args + T.alignof - 1) & ~(T.alignof - 1); 
     159                        ap.stack_args = cast(void*)(p + ((T.sizeof + size_t.sizeof - 1) & ~(size_t.sizeof - 1))); 
     160                        parmn = *cast(T*)p; 
     161                    } 
     162                } 
     163            } 
     164            else static if (U.length == 2) 
     165            {   // Arg is passed in two registers 
     166                alias U[0] T1; 
     167                alias U[1] T2; 
     168 
     169                static if (is(T1 == double) || is(T1 == float)) 
     170                { 
     171                    if (ap.offset_fpregs < (6 * 8 + 16 * 8)) 
     172                    { 
     173                        *cast(T1*)&parmn = *cast(T1*)(ap.reg_args + ap.offset_fpregs); 
     174                        ap.offset_fpregs += 16; 
     175                    } 
     176                    else 
     177                    { 
     178                        *cast(T1*)&parmn = *cast(T1*)ap.stack_args; 
     179                        ap.stack_args += (T1.sizeof + size_t.sizeof - 1) & ~(size_t.sizeof - 1); 
     180                    } 
     181                } 
     182                else 
     183                { 
     184                    if (ap.offset_regs < 6 * 8 && T1.sizeof <= 8) 
     185                    { 
     186                        *cast(T1*)&parmn = *cast(T1*)(ap.reg_args + ap.offset_regs); 
     187                        ap.offset_regs += 8; 
     188                    } 
     189                    else 
     190                    { 
     191                        *cast(T1*)&parmn = *cast(T1*)ap.stack_args; 
     192                        ap.stack_args += 8; 
     193                    } 
     194                } 
     195 
     196                auto p = cast(void*)&parmn + 8; 
     197                static if (is(T2 == double) || is(T2 == float)) 
     198                { 
     199                    if (ap.offset_fpregs < (6 * 8 + 16 * 8)) 
     200                    { 
     201                        *cast(T2*)p = *cast(T2*)(ap.reg_args + ap.offset_fpregs); 
     202                        ap.offset_fpregs += 16; 
     203                    } 
     204                    else 
     205                    { 
     206                        *cast(T2*)p = *cast(T2*)ap.stack_args; 
     207                        ap.stack_args += (T2.sizeof + size_t.sizeof - 1) & ~(size_t.sizeof - 1); 
     208                    } 
     209                } 
     210                else 
     211                { 
     212                    void* a = void; 
     213                    if (ap.offset_regs < 6 * 8 && T2.sizeof <= 8) 
     214                    { 
     215                        a = ap.reg_args + ap.offset_regs; 
     216                        ap.offset_regs += 8; 
     217                    } 
     218                    else 
     219                    { 
     220                        a = ap.stack_args; 
     221                        ap.stack_args += 8; 
     222                    } 
     223                    // Be careful not to go past the size of the actual argument 
     224                    const sz2 = T.sizeof - 8; 
     225                    p[0..sz2] = a[0..sz2]; 
     226                } 
     227            } 
     228            else 
     229            { 
     230                static assert(0); 
     231            } 
    29232        } 
     233        else 
     234        { 
     235            static assert(0, "not a valid argument type for va_arg"); 
     236        } 
    30237    } 
    31238 
    32     template va_arg( T
     239    void va_arg()(va_list apx, TypeInfo ti, void* parmn
    33240    { 
    34         T va_arg( ref va_list ap ) 
     241        __va_list* ap = cast(__va_list*)apx; 
     242        TypeInfo arg1, arg2; 
     243        if (!ti.argTypes(arg1, arg2)) 
    35244        { 
    36             T arg = *cast(T*) ap; 
    37             ap = cast(va_list) ( cast(void*) ap + ( ( T.sizeof + int.sizeof - 1 ) & ~( int.sizeof - 1 ) ) ); 
    38             return arg; 
     245            if (arg1 && arg1.tsize() <= 8) 
     246            {   // Arg is passed in one register 
     247                auto tsize = arg1.tsize(); 
     248                void* p; 
     249                auto s = arg1.toString(); 
     250                if (s == "double" || s == "float") 
     251                {   // Passed in XMM register 
     252                    if (ap.offset_fpregs < (6 * 8 + 16 * 8)) 
     253                    { 
     254                        p = ap.reg_args + ap.offset_fpregs; 
     255                        ap.offset_fpregs += 16; 
     256                    } 
     257                    else 
     258                    { 
     259                        p = ap.stack_args; 
     260                        ap.stack_args += (tsize + size_t.sizeof - 1) & ~(size_t.sizeof - 1); 
     261                    } 
     262                } 
     263                else 
     264                {   // Passed in regular register 
     265                    if (ap.offset_regs < 6 * 8) 
     266                    { 
     267                        p = ap.reg_args + ap.offset_regs; 
     268                        ap.offset_regs += 8; 
     269                    } 
     270                    else 
     271                    { 
     272                        p = ap.stack_args; 
     273                        ap.stack_args += 8; 
     274                    } 
     275                } 
     276                parmn[0..tsize] = p[0..tsize]; 
     277 
     278                if (arg2) 
     279                { 
     280                    parmn += 8; 
     281                    tsize = arg2.tsize(); 
     282                    s = arg2.toString(); 
     283                    if (s == "double" || s == "float") 
     284                    {   // Passed in XMM register 
     285                        if (ap.offset_fpregs < (6 * 8 + 16 * 8)) 
     286                        { 
     287                            p = ap.reg_args + ap.offset_fpregs; 
     288                            ap.offset_fpregs += 16; 
     289                        } 
     290                        else 
     291                        { 
     292                            p = ap.stack_args; 
     293                            ap.stack_args += (tsize + size_t.sizeof - 1) & ~(size_t.sizeof - 1); 
     294                        } 
     295                    } 
     296                    else 
     297                    {   // Passed in regular register 
     298                        if (ap.offset_regs < 6 * 8) 
     299                        { 
     300                            p = ap.reg_args + ap.offset_regs; 
     301                            ap.offset_regs += 8; 
     302                        } 
     303                        else 
     304                        { 
     305                            p = ap.stack_args; 
     306                            ap.stack_args += 8; 
     307                        } 
     308                    } 
     309                    tsize = ti.tsize() - 8; 
     310                    parmn[0..tsize] = p[0..tsize]; 
     311                } 
     312            } 
     313            else 
     314            {   // Always passed in memory 
     315                // The arg may have more strict alignment than the stack 
     316                auto talign = ti.talign(); 
     317                auto tsize = ti.tsize(); 
     318                auto p = cast(void*)((cast(size_t)ap.stack_args + talign - 1) & ~(talign - 1)); 
     319                ap.stack_args = cast(void*)(cast(size_t)p + ((tsize + size_t.sizeof - 1) & ~(size_t.sizeof - 1))); 
     320                parmn[0..tsize] = p[0..tsize]; 
     321            } 
    39322        } 
     323        else 
     324        { 
     325            assert(0, "not a valid argument type for va_arg"); 
     326        } 
    40327    } 
    41328 
    42     void va_end( va_list ap
     329    void va_end(va_list ap
    43330    { 
    44  
    45331    } 
    46332 
    47     void va_copy( out va_list dest, va_list src
     333    void va_copy(out va_list dest, va_list src
    48334    { 
    49335        dest = src; 
    50336    } 
    51337} 
     338else 
     339{ 
     340    static assert(0); 
     341} 
     342} 
  • tango/util/log/Log.d

    old new  
    33        copyright:      Copyright (c) 2004 Kris Bell. All rights reserved 
    44 
    55        license:        BSD style: $(LICENSE) 
    6        
     6 
    77        version:        May 2004 : Initial release 
    88        version:        Oct 2004: Hierarchy moved due to circular dependencies 
    99        version:        Apr 2008: Lazy delegates removed due to awkward usage 
     
    2020 
    2121        Generic usage: 
    2222 
    23         Loggers are named entities, sometimes shared, sometimes specific to  
    24         a particular portion of code. The names are generally hierarchical in  
    25         nature, using dot notation (with '.') to separate each named section.  
     23        Loggers are named entities, sometimes shared, sometimes specific to 
     24        a particular portion of code. The names are generally hierarchical in 
     25        nature, using dot notation (with '.') to separate each named section. 
    2626        For example, a typical name might be something like "mail.send.writer" 
    2727        --- 
    2828        import tango.util.log.Log; 
    29          
     29 
    3030        auto log = Log.lookup ("mail.send.writer"); 
    3131 
    3232        log.info  ("an informational message"); 
     
    3434 
    3535        etc ... 
    3636        --- 
    37          
    38         It is considered good form to pass a logger instance as a function or  
    39         class-ctor argument, or to assign a new logger instance during static  
    40         class construction. For example: if it were considered appropriate to  
     37 
     38        It is considered good form to pass a logger instance as a function or 
     39        class-ctor argument, or to assign a new logger instance during static 
     40        class construction. For example: if it were considered appropriate to 
    4141        have one logger instance per class, each might be constructed like so: 
    4242        --- 
    4343        private Logger log; 
    44          
     44 
    4545        static this() 
    4646        { 
    4747            log = Log.lookup (nameOfThisClassOrStructOrModule); 
     
    6363        log.warn (log.format (buf, "a very long message: {}", someLongMessage)); 
    6464        --- 
    6565 
    66         To avoid overhead when constructing arguments passed to formatted  
     66        To avoid overhead when constructing arguments passed to formatted 
    6767        messages, you should check to see whether a logger is active or not: 
    6868        --- 
    6969        if (log.warn) 
    7070            log.warn ("temperature is {} degrees!", complexFunction()); 
    7171        --- 
    72          
    73         tango.log closely follows both the API and the behaviour as documented  
    74         at the official Log4J site, where you'll find a good tutorial. Those  
    75         pages are hosted over  
     72 
     73        tango.log closely follows both the API and the behaviour as documented 
     74        at the official Log4J site, where you'll find a good tutorial. Those 
     75        pages are hosted over 
    7676        <A HREF="http://logging.apache.org/log4j/docs/documentation.html">here</A>. 
    7777 
    7878*******************************************************************************/ 
     
    103103        alias void* Arg; 
    104104        alias va_list ArgList; 
    105105        } 
     106version (DigitalMars) 
     107        { 
     108        private import tango.core.Vararg; 
     109        alias void* Arg; 
     110        alias va_list ArgList; 
     111        } 
    106112     else 
    107113        { 
    108114        alias void* Arg; 
     
    127133} 
    128134 
    129135/******************************************************************************* 
    130                          
     136 
    131137        These represent the standard LOG4J event levels. Note that 
    132138        Debug is called Trace here, because debug is a reserved word 
    133         in D  
     139        in D 
    134140 
    135141*******************************************************************************/ 
    136142 
    137 alias ILogger.Level Level;  
     143alias ILogger.Level Level; 
    138144 
    139145 
    140146/******************************************************************************* 
    141147 
    142         Manager for routing Logger calls to the default hierarchy. Note  
     148        Manager for routing Logger calls to the default hierarchy. Note 
    143149        that you may have multiple hierarchies per application, but must 
    144         access the hierarchy directly for root() and lookup() methods within  
     150        access the hierarchy directly for root() and lookup() methods within 
    145151        each additional instance. 
    146152 
    147153*******************************************************************************/ 
     
    167173        private struct  Pair {char[] name; Level value;} 
    168174 
    169175        private static  Level [char[]] map; 
    170          
    171         private static  Pair[] Pairs =  
     176 
     177        private static  Pair[] Pairs = 
    172178                        [ 
    173179                        {"TRACE",  Level.Trace}, 
    174180                        {"Trace",  Level.Trace}, 
     
    191197                        ]; 
    192198 
    193199        // logging-level names 
    194         private static char[][] LevelNames =  
     200        private static char[][] LevelNames = 
    195201        [ 
    196202                "Trace", "Info", "Warn", "Error", "Fatal", "None" 
    197203        ]; 
    198204 
    199205        /*********************************************************************** 
    200          
    201                 Initialize the base hierarchy            
    202                
     206 
     207                Initialize the base hierarchy 
     208 
    203209        ***********************************************************************/ 
    204210 
    205211        static this () 
     
    209215                foreach (p; Pairs) 
    210216                         map[p.name] = p.value; 
    211217 
    212                 version (Posix)        
     218                version (Posix) 
    213219                { 
    214220                        beginTime = Clock.now; 
    215221                } 
     
    220226 
    221227                        if (! QueryPerformanceFrequency (&freq)) 
    222228                              throw new PlatformException ("high-resolution timer is not available"); 
    223                          
     229 
    224230                        QueryPerformanceCounter (&timerStart); 
    225                         multiplier = cast(double) TimeSpan.TicksPerSecond / freq;        
     231                        multiplier = cast(double) TimeSpan.TicksPerSecond / freq; 
    226232                        beginTime = Clock.now; 
    227233                } 
    228234        } 
    229235 
    230236        /*********************************************************************** 
    231          
     237 
    232238                Return the level of a given name 
    233239 
    234240        ***********************************************************************/ 
     
    242248        } 
    243249 
    244250        /*********************************************************************** 
    245                  
     251 
    246252                Return the current time 
    247253 
    248254        ***********************************************************************/ 
    249255 
    250256        static Time time () 
    251257        { 
    252                 version (Posix)        
     258                version (Posix) 
    253259                { 
    254260                        return Clock.now; 
    255261                } 
     
    266272        /*********************************************************************** 
    267273 
    268274                Return the root Logger instance. This is the ancestor of 
    269                 all loggers and, as such, can be used to manipulate the  
    270                 entire hierarchy. For instance, setting the root 'level'  
     275                all loggers and, as such, can be used to manipulate the 
     276                entire hierarchy. For instance, setting the root 'level' 
    271277                attribute will affect all other loggers in the tree. 
    272278 
    273279        ***********************************************************************/ 
     
    278284        } 
    279285 
    280286        /*********************************************************************** 
    281          
     287 
    282288                Return an instance of the named logger. Names should be 
    283                 hierarchical in nature, using dot notation (with '.') to  
    284                 separate each name section. For example, a typical name  
     289                hierarchical in nature, using dot notation (with '.') to 
     290                separate each name section. For example, a typical name 
    285291                might be something like "tango.io.Stdout". 
    286292 
    287293                If the logger does not currently exist, it is created and 
     
    297303        } 
    298304 
    299305        /*********************************************************************** 
    300          
     306 
    301307                Return text name for a log level 
    302308 
    303309        ***********************************************************************/ 
     
    309315        } 
    310316 
    311317        /*********************************************************************** 
    312          
     318 
    313319                Return the singleton hierarchy. 
    314320 
    315321        ***********************************************************************/ 
     
    320326        } 
    321327 
    322328        /*********************************************************************** 
    323                  
     329 
    324330                Pedestrian usage support, as an alias for Log.root.info() 
    325331 
    326332        ***********************************************************************/ 
     
    336342 
    337343                Adds a StreamAppender to the root node, and sets 
    338344                the activity level to be everything enabled. 
    339                  
     345 
    340346        ***********************************************************************/ 
    341347 
    342348        static void config (OutputStream stream, bool flush = true) 
     
    348354 
    349355/******************************************************************************* 
    350356 
    351         Loggers are named entities, sometimes shared, sometimes specific to  
    352         a particular portion of code. The names are generally hierarchical in  
    353         nature, using dot notation (with '.') to separate each named section.  
     357        Loggers are named entities, sometimes shared, sometimes specific to 
     358        a particular portion of code. The names are generally hierarchical in 
     359        nature, using dot notation (with '.') to separate each named section. 
    354360        For example, a typical name might be something like "mail.send.writer" 
    355361        --- 
    356362        import tango.util.log.Log;format 
    357          
     363 
    358364        auto log = Log.lookup ("mail.send.writer"); 
    359365 
    360366        log.info  ("an informational message"); 
     
    362368 
    363369        etc ... 
    364370        --- 
    365          
    366         It is considered good form to pass a logger instance as a function or  
    367         class-ctor argument, or to assign a new logger instance during static  
    368         class construction. For example: if it were considered appropriate to  
     371 
     372        It is considered good form to pass a logger instance as a function or 
     373        class-ctor argument, or to assign a new logger instance during static 
     374        class construction. For example: if it were considered appropriate to 
    369375        have one logger instance per class, each might be constructed like so: 
    370376        --- 
    371377        private Logger log; 
    372          
     378 
    373379        static this() 
    374380        { 
    375381            log = Log.lookup (nameOfThisClassOrStructOrModule); 
     
    391397        log.warn (log.format (buf, "a very long warning: {}", someLongWarning)); 
    392398        --- 
    393399 
    394         To avoid overhead when constructing argument passed to formatted  
     400        To avoid overhead when constructing argument passed to formatted 
    395401        messages, you should check to see whether a logger is active or not: 
    396402        --- 
    397403        if (log.enabled (log.Warn)) 
    398404            log.warn ("temperature is {} degrees!", complexFunction()); 
    399405        --- 
    400          
    401         The above will be handled implicitly by the logging system when  
    402         macros are added to the language (used to be handled implicitly  
     406 
     407        The above will be handled implicitly by the logging system when 
     408        macros are added to the language (used to be handled implicitly 
    403409        via lazy delegates, but usage of those turned out to be awkward). 
    404410 
    405         tango.log closely follows both the API and the behaviour as documented  
    406         at the official Log4J site, where you'll find a good tutorial. Those  
    407         pages are hosted over  
     411        tango.log closely follows both the API and the behaviour as documented 
     412        at the official Log4J site, where you'll find a good tutorial. Those 
     413        pages are hosted over 
    408414        <A HREF="http://logging.apache.org/log4j/docs/documentation.html">here</A>. 
    409415 
    410416*******************************************************************************/ 
    411417 
    412418public class Logger : ILogger 
    413 {      
    414          
    415         alias Level.Trace Trace;        // shortcut to Level values  
     419{ 
     420 
     421        alias Level.Trace Trace;        // shortcut to Level values 
    416422        alias Level.Info  Info;         // ... 
    417423        alias Level.Warn  Warn;         // ... 
    418424        alias Level.Error Error;        // ... 
     
    421427        alias append      opCall;       // shortcut to append 
    422428 
    423429        /*********************************************************************** 
    424                  
     430 
    425431                Context for a hierarchy, used for customizing behaviour 
    426432                of log hierarchies. You can use this to implement dynamic 
    427433                log-levels, based upon filtering or some other mechanism 
     
    432438        { 
    433439                /// return a label for this context 
    434440                char[] label (); 
    435                  
     441 
    436442                /// first arg is the setting of the logger itself, and 
    437443                /// the second arg is what kind of message we're being 
    438444                /// asked to produce 
     
    440446        } 
    441447 
    442448        /*********************************************************************** 
    443                  
     449 
    444450        ***********************************************************************/ 
    445451 
    446452        private Logger          next, 
     
    453459        private Appender        appender_; 
    454460 
    455461        /*********************************************************************** 
    456          
    457                 Construct a LoggerInstance with the specified name for the  
     462 
     463                Construct a LoggerInstance with the specified name for the 
    458464                given hierarchy. By default, logger instances are additive 
    459465                and are set to emit all events. 
    460466 
     
    469475        } 
    470476 
    471477        /*********************************************************************** 
    472          
     478 
    473479                Is this logger enabed for the specified Level? 
    474480 
    475481        ***********************************************************************/ 
     
    592598        /*********************************************************************** 
    593599 
    594600                Return the name of this Logger (sans the appended dot). 
    595         
     601 
    596602        ***********************************************************************/ 
    597603 
    598604        final char[] name () 
     
    600606                int i = name_.length; 
    601607                if (i > 0) 
    602608                    --i; 
    603                 return name_[0 .. i];      
     609                return name_[0 .. i]; 
    604610        } 
    605611 
    606612        /*********************************************************************** 
    607          
     613 
    608614                Return the Level this logger is set to 
    609615 
    610616        ***********************************************************************/ 
    611617 
    612618        final Level level () 
    613619        { 
    614                 return level_;      
     620                return level_; 
    615621        } 
    616622 
    617623        /*********************************************************************** 
    618          
     624 
    619625                Set the current level for this logger (and only this logger). 
    620626 
    621627        ***********************************************************************/ 
     
    626632        } 
    627633 
    628634        /*********************************************************************** 
    629          
     635 
    630636                Set the current level for this logger, and (optionally) all 
    631637                of its descendents. 
    632638 
     
    634640 
    635641        final Logger level (Level level, bool propagate) 
    636642        { 
    637                 level_ = level;  
    638                 if (propagate)     
     643                level_ = level; 
     644                if (propagate) 
    639645                    foreach (log; host_) 
    640646                             if (log.isChildOf (name_)) 
    641647                                 log.level_ = level; 
     
    643649        } 
    644650 
    645651        /*********************************************************************** 
    646          
     652 
    647653                Is this logger additive? That is, should we walk ancestors 
    648654                looking for more appenders? 
    649655 
     
    655661        } 
    656662 
    657663        /*********************************************************************** 
    658          
     664 
    659665                Set the additive status of this logger. See bool additive(). 
    660666 
    661667        ***********************************************************************/ 
    662668 
    663669        final Logger additive (bool enabled) 
    664670        { 
    665                 additive_ = enabled;      
     671                additive_ = enabled; 
    666672                return this; 
    667673        } 
    668674 
    669675        /*********************************************************************** 
    670          
     676 
    671677                Add (another) appender to this logger. Appenders are each 
    672678                invoked for log events as they are produced. At most, one 
    673679                instance of each appender will be invoked. 
     
    683689        } 
    684690 
    685691        /*********************************************************************** 
    686          
     692 
    687693                Remove all appenders from this Logger 
    688694 
    689695        ***********************************************************************/ 
    690696 
    691697        final Logger clear () 
    692698        { 
    693                 appender_ = null;      
     699                appender_ = null; 
    694700                return this; 
    695701        } 
    696702 
    697703        /*********************************************************************** 
    698          
     704 
    699705                Get time since this application started 
    700706 
    701707        ***********************************************************************/ 
     
    706712        } 
    707713 
    708714        /*********************************************************************** 
    709          
     715 
    710716                Send a message to this logger via its appender list. 
    711717 
    712718        ***********************************************************************/ 
     
    725731        } 
    726732 
    727733        /*********************************************************************** 
    728          
     734 
    729735                Send a message to this logger via its appender list. 
    730736 
    731737        ***********************************************************************/ 
     
    734740        { 
    735741                // combine appenders from all ancestors 
    736742                auto links = this; 
    737                 Appender.Mask masks = 0;                  
     743                Appender.Mask masks = 0; 
    738744                do { 
    739745                   auto appender = links.appender_; 
    740746 
    741747                   // this level have an appender? 
    742748                   while (appender) 
    743                          {  
     749                         { 
    744750                         auto mask = appender.mask; 
    745751 
    746752                         // have we visited this appender already? 
     
    777783        ***********************************************************************/ 
    778784 
    779785        final Logger format (Level level, char[] fmt, TypeInfo[] types, ArgList args) 
    780         {     
     786        { 
    781787                char[2048] tmp = void; 
    782   
     788 
    783789                if (types.length) 
    784790                    append (level, Format.vprint (tmp, fmt, types, args)); 
    785791                else 
    786                    append (level, fmt);                 
     792                   append (level, fmt); 
    787793                return this; 
    788794        } 
    789795 
    790796        /*********************************************************************** 
    791          
    792                 See if the provided Logger name is a parent of this one. Note  
    793                 that each Logger name has a '.' appended to the end, such that  
     797 
     798                See if the provided Logger name is a parent of this one. Note 
     799                that each Logger name has a '.' appended to the end, such that 
    794800                name segments will not partially match. 
    795801 
    796802        ***********************************************************************/ 
     
    801807 
    802808                // possible parent if length is shorter 
    803809                if (len < name_.length) 
    804                     // does the prefix match? Note we append a "." to each  
     810                    // does the prefix match? Note we append a "." to each 
    805811                    // (the root is a parent of everything) 
    806                     return (len is 0 ||  
     812                    return (len is 0 || 
    807813                            memcmp (&candidate[0], &name_[0], len) is 0); 
    808814                return false; 
    809815        } 
    810816 
    811817        /*********************************************************************** 
    812          
     818 
    813819                See if the provided Logger is a better match as a parent of 
    814820                this one. This is used to restructure the hierarchy when a 
    815821                new logger instance is introduced 
     
    828834} 
    829835 
    830836/******************************************************************************* 
    831   
     837 
    832838        The Logger hierarchy implementation. We keep a reference to each 
    833839        logger in a hash-table for convenient lookup purposes, plus keep 
    834840        each logger linked to the others in an ordered group. Ordering 
    835         places shortest names at the head and longest ones at the tail,  
     841        places shortest names at the head and longest ones at the tail, 
    836842        making the job of identifying ancestors easier in an orderly 
    837843        fashion. For example, when propagating levels across descendents 
    838844        it would be a mistake to propagate to a child before all of its 
     
    844850{ 
    845851        private Logger                  root_; 
    846852        private char[]                  name_, 
    847                                         address_;       
     853                                        address_; 
    848854        private Logger.Context          context_; 
    849855        private Logger[char[]]          loggers; 
    850856 
    851857 
    852858        /*********************************************************************** 
    853          
     859 
    854860                Construct a hierarchy with the given name. 
    855861 
    856862        ***********************************************************************/ 
     
    873879        { 
    874880                return ""; 
    875881        } 
    876                  
     882 
    877883        /********************************************************************** 
    878884 
    879885 
     
    932938 
    933939        /********************************************************************** 
    934940 
    935                 Return the diagnostic context.  Useful for setting an  
     941                Return the diagnostic context.  Useful for setting an 
    936942                override logging level. 
    937943 
    938944        **********************************************************************/ 
    939          
     945 
    940946        final Logger.Context context () 
    941947        { 
    942948            return context_; 
    943949        } 
    944          
     950 
    945951        /********************************************************************** 
    946952 
    947                 Set the diagnostic context.  Not usually necessary, as a  
    948                 default was created.  Useful when you need to provide a  
     953                Set the diagnostic context.  Not usually necessary, as a 
     954                default was created.  Useful when you need to provide a 
    949955                different implementation, such as a ThreadLocal variant. 
    950956 
    951957        **********************************************************************/ 
    952          
     958 
    953959        final void context (Logger.Context context) 
    954960        { 
    955961            context_ = context; 
    956962        } 
    957          
     963 
    958964        /*********************************************************************** 
    959          
     965 
    960966                Return the root node. 
    961967 
    962968        ***********************************************************************/ 
     
    967973        } 
    968974 
    969975        /*********************************************************************** 
    970          
     976 
    971977                Return the instance of a Logger with the provided label. If 
    972978                the instance does not exist, it is created at this time. 
    973979 
     
    10011007        } 
    10021008 
    10031009        /*********************************************************************** 
    1004          
     1010 
    10051011                Return the instance of a Logger with the provided label. If 
    10061012                the instance does not exist, it is created at this time. 
    10071013 
     
    10211027                   // insert into linked list 
    10221028                   insert (li); 
    10231029 
    1024                    // look for and adjust children. Don't force  
     1030                   // look for and adjust children. Don't force 
    10251031                   // property inheritance on existing loggers 
    10261032                   update (li); 
    10271033 
    10281034                   // insert into map 
    10291035                   loggers [name] = li; 
    10301036                   } 
    1031                 
     1037 
    10321038                return *l; 
    10331039        } 
    10341040 
    10351041        /*********************************************************************** 
    1036          
    1037                 Loggers are maintained in a sorted linked-list. The order  
    1038                 is maintained such that the shortest name is at the root,  
     1042 
     1043                Loggers are maintained in a sorted linked-list. The order 
     1044                is maintained such that the shortest name is at the root, 
    10391045                and the longest at the tail. 
    10401046 
    10411047                This is done so that updateLoggers() will always have a 
     
    10541060                      if (l.name.length < curr.name.length) 
    10551061                          if (prev is null) 
    10561062                              throw new IllegalElementException ("invalid hierarchy"); 
    1057                           else                                  
     1063                          else 
    10581064                             { 
    10591065                             l.next = prev.next; 
    10601066                             prev.next = l; 
     
    10661072                         propagate (l, curr, true); 
    10671073 
    10681074                      // remember where insertion point should be 
    1069                       prev = curr;   
    1070                       curr = curr.next;   
     1075                      prev = curr; 
     1076                      curr = curr.next; 
    10711077                      } 
    10721078 
    10731079                // add to tail 
     
    10751081        } 
    10761082 
    10771083        /*********************************************************************** 
    1078          
    1079                 Propagate hierarchical changes across known loggers.  
     1084 
     1085                Propagate hierarchical changes across known loggers. 
    10801086                This includes changes in the hierarchy itself, and to 
    1081                 the various settings of child loggers with respect to  
    1082                 their parent(s).               
     1087                the various settings of child loggers with respect to 
     1088                their parent(s). 
    10831089 
    10841090        ***********************************************************************/ 
    10851091 
     
    10901096        } 
    10911097 
    10921098        /*********************************************************************** 
    1093          
     1099 
    10941100                Propagate changes in the hierarchy downward to child Loggers. 
    1095                 Note that while 'parent' is always changed, the adjustment of  
     1101                Note that while 'parent' is always changed, the adjustment of 
    10961102                'level' is selectable. 
    10971103 
    10981104        ***********************************************************************/ 
     
    11361142        private Hierarchy       host_; 
    11371143 
    11381144        /*********************************************************************** 
    1139                  
     1145 
    11401146                Set the various attributes of this event. 
    11411147 
    11421148        ***********************************************************************/ 
     
    11511157        } 
    11521158 
    11531159        /*********************************************************************** 
    1154                  
     1160 
    11551161                Return the message attached to this event. 
    11561162 
    11571163        ***********************************************************************/ 
     
    11621168        } 
    11631169 
    11641170        /*********************************************************************** 
    1165                  
     1171 
    11661172                Return the name of the logger which produced this event 
    11671173 
    11681174        ***********************************************************************/ 
     
    11731179        } 
    11741180 
    11751181        /*********************************************************************** 
    1176                  
     1182 
    11771183                Return the logger level of this event. 
    11781184 
    11791185        ***********************************************************************/ 
     
    11841190        } 
    11851191 
    11861192        /*********************************************************************** 
    1187                  
     1193 
    11881194                Return the hierarchy where the event was produced from 
    11891195 
    11901196        ***********************************************************************/ 
     
    11951201        } 
    11961202 
    11971203        /*********************************************************************** 
    1198                  
    1199                 Return the time this event was produced, relative to the  
     1204 
     1205                Return the time this event was produced, relative to the 
    12001206                start of this executable 
    12011207 
    12021208        ***********************************************************************/ 
     
    12071213        } 
    12081214 
    12091215        /*********************************************************************** 
    1210                 
     1216 
    12111217                Return the time this event was produced relative to Epoch 
    12121218 
    12131219        ***********************************************************************/ 
     
    12181224        } 
    12191225 
    12201226        /*********************************************************************** 
    1221                  
     1227 
    12221228                Return time when the executable started 
    12231229 
    12241230        ***********************************************************************/ 
     
    12291235        } 
    12301236 
    12311237        /*********************************************************************** 
    1232                  
     1238 
    12331239                Return the logger level name of this event. 
    12341240 
    12351241        ***********************************************************************/ 
     
    12401246        } 
    12411247 
    12421248        /*********************************************************************** 
    1243                  
     1249 
    12441250                Convert a time value (in milliseconds) to ascii 
    12451251 
    12461252        ***********************************************************************/ 
     
    12551261                   s[--len] = cast(char)(ms % 10 + '0'); 
    12561262                   ms /= 10; 
    12571263                   } while (ms && len); 
    1258                 return s[len..s.length];                 
     1264                return s[len..s.length]; 
    12591265        } 
    12601266} 
    12611267 
     
    12661272        emitting messages sent to a particular logger. There may be more 
    12671273        than one appender attached to any logger. The actual message is 
    12681274        constructed by another class known as an EventLayout. 
    1269          
     1275 
    12701276*******************************************************************************/ 
    12711277 
    12721278public class Appender 
     
    12821288 
    12831289                Interface for all logging layout instances 
    12841290 
    1285                 Implement this method to perform the formatting of   
     1291                Implement this method to perform the formatting of 
    12861292                message content. 
    12871293 
    12881294        ***********************************************************************/ 
     
    12931299        } 
    12941300 
    12951301        /*********************************************************************** 
    1296                  
     1302 
    12971303                Return the mask used to identify this Appender. The mask 
    1298                 is used to figure out whether an appender has already been  
     1304                is used to figure out whether an appender has already been 
    12991305                invoked for a particular logger. 
    13001306 
    13011307        ***********************************************************************/ 
     
    13031309        abstract Mask mask (); 
    13041310 
    13051311        /*********************************************************************** 
    1306                  
     1312 
    13071313                Return the name of this Appender. 
    13081314 
    13091315        ***********************************************************************/ 
    13101316 
    13111317        abstract char[] name (); 
    1312                  
     1318 
    13131319        /*********************************************************************** 
    1314                  
     1320 
    13151321                Append a message to the output. 
    13161322 
    13171323        ***********************************************************************/ 
     
    13191325        abstract void append (LogEvent event); 
    13201326 
    13211327        /*********************************************************************** 
    1322                
    1323               Create an Appender and default its layout to LayoutSimple.   
    13241328 
     1329              Create an Appender and default its layout to LayoutSimple. 
     1330 
    13251331        ***********************************************************************/ 
    13261332 
    13271333        this () 
     
    13301336        } 
    13311337 
    13321338        /*********************************************************************** 
    1333                
    1334               Create an Appender and default its layout to LayoutSimple.   
    13351339 
     1340              Create an Appender and default its layout to LayoutSimple. 
     1341 
    13361342        ***********************************************************************/ 
    13371343 
    13381344        static this () 
     
    13411347        } 
    13421348 
    13431349        /*********************************************************************** 
    1344                
     1350 
    13451351                Return the current Level setting 
    13461352 
    13471353        ***********************************************************************/ 
     
    13521358        } 
    13531359 
    13541360        /*********************************************************************** 
    1355                
     1361 
    13561362                Return the current Level setting 
    13571363 
    13581364        ***********************************************************************/ 
     
    13641370        } 
    13651371 
    13661372        /*********************************************************************** 
    1367                  
     1373 
    13681374                Static method to return a mask for identifying the Appender. 
    13691375                Each Appender class should have a unique fingerprint so that 
    13701376                we can figure out which ones have been invoked for a given 
     
    13941400        } 
    13951401 
    13961402        /*********************************************************************** 
    1397                  
     1403 
    13981404                Set the current layout to be that of the argument, or the 
    13991405                generic layout where the argument is null 
    14001406 
     
    14061412        } 
    14071413 
    14081414        /*********************************************************************** 
    1409                  
     1415 
    14101416                Return the current Layout 
    14111417 
    14121418        ***********************************************************************/ 
     
    14171423        } 
    14181424 
    14191425        /*********************************************************************** 
    1420                  
     1426 
    14211427                Attach another appender to this one 
    14221428 
    14231429        ***********************************************************************/ 
     
    14281434        } 
    14291435 
    14301436        /*********************************************************************** 
    1431                  
     1437 
    14321438                Return the next appender in the list 
    14331439 
    14341440        ***********************************************************************/ 
     
    14391445        } 
    14401446 
    14411447        /*********************************************************************** 
    1442                  
    1443                 Close this appender. This would be used for file, sockets,  
     1448 
     1449                Close this appender. This would be used for file, sockets, 
    14441450                and such like. 
    14451451 
    14461452        ***********************************************************************/ 
     
    14631469        private Mask mask_; 
    14641470 
    14651471        /*********************************************************************** 
    1466                  
     1472 
    14671473                Create with the given Layout 
    14681474 
    14691475        ***********************************************************************/ 
     
    14751481        } 
    14761482 
    14771483        /*********************************************************************** 
    1478                  
     1484 
    14791485                Return the fingerprint for this class 
    14801486 
    14811487        ***********************************************************************/ 
     
    14861492        } 
    14871493 
    14881494        /*********************************************************************** 
    1489                  
     1495 
    14901496                Return the name of this class 
    14911497 
    14921498        ***********************************************************************/ 
     
    14951501        { 
    14961502                return this.classinfo.name; 
    14971503        } 
    1498                  
     1504 
    14991505        /*********************************************************************** 
    1500                  
     1506 
    15011507                Append an event to the output. 
    1502                   
     1508 
    15031509        ***********************************************************************/ 
    15041510 
    15051511        final void append (LogEvent event) 
     
    15221528        private OutputStream    stream_; 
    15231529 
    15241530        /*********************************************************************** 
    1525                  
     1531 
    15261532                Create with the given stream and layout 
    15271533 
    15281534        ***********************************************************************/ 
     
    15381544        } 
    15391545 
    15401546        /*********************************************************************** 
    1541                  
     1547 
    15421548                Return the fingerprint for this class 
    15431549 
    15441550        ***********************************************************************/ 
     
    15491555        } 
    15501556 
    15511557        /*********************************************************************** 
    1552                  
     1558 
    15531559                Return the name of this class 
    15541560 
    15551561        ***********************************************************************/ 
     
    15581564        { 
    15591565                return this.classinfo.name; 
    15601566        } 
    1561                  
     1567 
    15621568        /*********************************************************************** 
    1563                 
     1569 
    15641570                Append an event to the output. 
    1565                   
     1571 
    15661572        ***********************************************************************/ 
    15671573 
    15681574        final void append (LogEvent event) 
     
    15911597public class LayoutTimer : Appender.Layout 
    15921598{ 
    15931599        /*********************************************************************** 
    1594                  
     1600 
    15951601                Subclasses should implement this method to perform the 
    15961602                formatting of the actual message content. 
    15971603 
     
    16211627debug (Log) 
    16221628{ 
    16231629        import tango.io.Console; 
    1624   
     1630 
    16251631        void main() 
    16261632        { 
    16271633                Log.config (Cerr.stream);