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

Ticket #1212: tango-common.patch

File tango-common.patch, 8.0 kB (added by ChristianK, 3 years ago)
  • lib/common/tango/core/Thread.d

    old new  
    273273        } 
    274274        body 
    275275        { 
    276             version( D_InlineAsm_X86
     276            version( LDC
    277277            { 
     278                version(X86) 
     279                { 
     280                    uint eax,ecx,edx,ebx,ebp,esi,edi; 
     281                    asm 
     282                    { 
     283                        mov eax[EBP], EAX      ; 
     284                        mov ecx[EBP], ECX      ; 
     285                        mov edx[EBP], EDX      ; 
     286                        mov ebx[EBP], EBX      ; 
     287                        mov ebp[EBP], EBP      ; 
     288                        mov esi[EBP], ESI      ; 
     289                        mov edi[EBP], EDI      ; 
     290                    } 
     291                } 
     292                else version (X86_64) 
     293                { 
     294                    ulong rax,rbx,rcx,rdx,rbp,rsi,rdi,rsp,r10,r11,r12,r13,r14,r15; 
     295                    asm 
     296                    { 
     297                        movq rax[RBP], RAX        ; 
     298                        movq rbx[RBP], RBX        ; 
     299                        movq rcx[RBP], RCX        ; 
     300                        movq rdx[RBP], RDX        ; 
     301                        movq rbp[RBP], RBP        ; 
     302                        movq rsi[RBP], RSI        ; 
     303                        movq rdi[RBP], RDI        ; 
     304                        movq rsp[RBP], RSP        ; 
     305                        movq r10[RBP], R10        ; 
     306                        movq r11[RBP], R11        ; 
     307                        movq r12[RBP], R12        ; 
     308                        movq r13[RBP], R13        ; 
     309                        movq r14[RBP], R14        ; 
     310                        movq r15[RBP], R15        ; 
     311                    } 
     312                } 
     313                else 
     314                { 
     315                    static assert( false, "Architecture not supported." ); 
     316                } 
     317            } 
     318            else version( D_InlineAsm_X86 ) 
     319            { 
    278320                asm 
    279321                { 
    280322                    pushad; 
     
    330372                } 
    331373            } 
    332374 
    333             version( D_InlineAsm_X86
     375            version( LDC
    334376            { 
     377                // nothing to pop 
     378            } 
     379            else version( D_InlineAsm_X86 ) 
     380            { 
    335381                asm 
    336382                { 
    337383                    popad; 
     
    23472393        version( Posix ) 
    23482394            version = AsmPPC_Posix; 
    23492395    } 
     2396    version( LLVM_InlineAsm_X86 )  
     2397    { 
     2398        version( Win32 ) 
     2399            version = LLVM_AsmX86_Win32; 
     2400        else version( Posix ) 
     2401            version = LLVM_AsmX86_Posix; 
     2402    } 
     2403    else version( LLVM_InlineAsm_X86_64 ) 
     2404    { 
     2405        version( Posix ) 
     2406            version = LLVM_AsmX86_64_Posix; 
     2407    } 
    23502408 
    23512409    version( Posix ) 
    23522410    { 
     
    23572415        version( AsmX86_Win32 ) {} else 
    23582416        version( AsmX86_Posix ) {} else 
    23592417        version( AsmPPC_Posix ) {} else 
     2418        version( LLVM_AsmX86_Win32 ) {} else 
     2419        version( LLVM_AsmX86_Posix ) {} else 
     2420//TODO: Enable when x86-64 Posix supports fibers 
     2421//        version( LLVM_AsmX86_64_Posix ) {} else 
    23602422        { 
    23612423            // NOTE: The ucontext implementation requires architecture specific 
    23622424            //       data definitions to operate so testing for it must be done 
     
    25102572                ret; 
    25112573            } 
    25122574        } 
     2575        else version( LLVM_AsmX86_Posix ) 
     2576        { 
     2577            asm 
     2578            { 
     2579                // clobber registers to save 
     2580                inc EBX; 
     2581                inc ESI; 
     2582                inc EDI; 
     2583 
     2584                // store oldp again with more accurate address 
     2585                mov EAX, oldp; 
     2586                mov [EAX], ESP; 
     2587                // load newp to begin context switch 
     2588                mov ESP, newp; 
     2589            } 
     2590        } 
     2591/+ 
     2592        version( LLVM_AsmX86_64_Posix ) 
     2593        { 
     2594            //TODO: Fiber implementation here 
     2595        } 
     2596+/ 
    25132597        else static if( is( ucontext_t ) ) 
    25142598        { 
    25152599            Fiber   cfib = Fiber.getThis(); 
     
    25222606    } 
    25232607} 
    25242608 
    2525  
     2609extern(C) int printf(char*, ...); 
    25262610//////////////////////////////////////////////////////////////////////////////// 
    25272611// Fiber 
    25282612//////////////////////////////////////////////////////////////////////////////// 
     
    32553339            push( 0x00000000 );                                     // ESI 
    32563340            push( 0x00000000 );                                     // EDI 
    32573341        } 
     3342        else version( LLVM_AsmX86_Posix ) 
     3343        { 
     3344            push( cast(size_t) &fiber_entryPoint );                 // EIP 
     3345            push( 0x00000000 );                                     // newp 
     3346            push( 0x00000000 );                                     // oldp 
     3347            push( 0x00000000 );                                     // EBP 
     3348            push( 0x00000000 );                                     // EBX 
     3349            push( 0x00000000 );                                     // ESI 
     3350            push( 0x00000000 );                                     // EDI 
     3351        } 
     3352//TODO: Implement x86-64 fibers 
     3353/+ 
     3354        else version( LLVM_AsmX86_Posix ) 
     3355        { 
     3356        } 
     3357+/ 
    32583358        else version( AsmPPC_Posix ) 
    32593359        { 
    32603360            version( StackGrowsDown ) 
  • lib/gc/basic/gcx.d

    old new  
    6565} 
    6666 
    6767 
     68struct BlkInfo 
     69{ 
     70    void*  base; 
     71    size_t size; 
     72    uint   attr; 
     73} 
     74 
    6875private 
    6976{ 
    7077    enum BlkAttr : uint 
     
    7582        ALL_BITS = 0b1111_1111 
    7683    } 
    7784 
    78     struct BlkInfo 
    79     { 
    80         void*  base; 
    81         size_t size; 
    82         uint   attr; 
    83     } 
    84  
    8585    extern (C) void* rt_stackBottom(); 
    8686    extern (C) void* rt_stackTop(); 
    8787 
     
    21782178            __builtin_unwind_init(); 
    21792179            sp = & sp; 
    21802180        } 
     2181        else version(LDC) 
     2182        { 
     2183            version(X86) 
     2184            { 
     2185                uint eax,ecx,edx,ebx,ebp,esi,edi; 
     2186                asm 
     2187                { 
     2188                    mov eax[EBP], EAX      ; 
     2189                    mov ecx[EBP], ECX      ; 
     2190                    mov edx[EBP], EDX      ; 
     2191                    mov ebx[EBP], EBX      ; 
     2192                    mov ebp[EBP], EBP      ; 
     2193                    mov esi[EBP], ESI      ; 
     2194                    mov edi[EBP], EDI      ; 
     2195                    mov sp[EBP],ESP     ; 
     2196                } 
     2197            } 
     2198            else version (X86_64) 
     2199            { 
     2200                ulong rax,rbx,rcx,rdx,rbp,rsi,rdi,rsp,r10,r11,r12,r13,r14,r15; 
     2201                asm 
     2202                { 
     2203                    movq rax[RBP], RAX      ; 
     2204                    movq rbx[RBP], RBX      ; 
     2205                    movq rcx[RBP], RCX      ; 
     2206                    movq rdx[RBP], RDX      ; 
     2207                    movq rbp[RBP], RBP      ; 
     2208                    movq rsi[RBP], RSI      ; 
     2209                    movq rdi[RBP], RDI      ; 
     2210                    movq rsp[RBP], RSP      ; 
     2211                    movq r10[RBP], R10      ; 
     2212                    movq r11[RBP], R11      ; 
     2213                    movq r12[RBP], R12      ; 
     2214                    movq r13[RBP], R13      ; 
     2215                    movq r14[RBP], R14      ; 
     2216                    movq r15[RBP], R15      ; 
     2217                } 
     2218            } 
     2219            else 
     2220            { 
     2221                static assert( false, "Architecture not supported." ); 
     2222            } 
     2223        } 
    21812224        else 
    21822225        { 
    21832226        asm 
     
    21912234        { 
    21922235            // nothing to do 
    21932236        } 
     2237        else version(LDC) 
     2238        { 
     2239            // nothing to do 
     2240        } 
    21942241        else 
    21952242        { 
    21962243        asm 
  • lib/common/tango/core/BitManip.d

    old new  
    171171     */ 
    172172    uint outpl( uint port_address, uint value ); 
    173173} 
     174else version( LDC ) 
     175{ 
     176    public import ldc.bitmanip; 
     177} 
    174178else 
    175179{ 
    176180    public import std.intrinsic;