Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Changeset 755:61c7a96f28c3

Show
Ignore:
Timestamp:
11/08/08 05:34:35 (2 months ago)
Author:
Christian Kamm <kamm incasoftware de>
branch:
default
Message:

Merge in most of x86-64 tango patch.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • runtime/ldc.diff

    r754 r755  
    9797  
    9898         extern (C) void thread_suspendHandler( int sig ) 
    99 @@ -256,8 +257,29 @@ 
     99@@ -256,8 +257,50 @@ 
    100100         } 
    101101         body 
     
    118118+                    } 
    119119+                } 
     120+                else version (X86_64) 
     121+                { 
     122+                    ulong rax,rbx,rcx,rdx,rbp,rsi,rdi,rsp,r10,r11,r12,r13,r14,r15; 
     123+                    asm 
     124+                    { 
     125+                        movq rax[RBP], RAX        ; 
     126+                        movq rbx[RBP], RBX        ; 
     127+                        movq rcx[RBP], RCX        ; 
     128+                        movq rdx[RBP], RDX        ; 
     129+                        movq rbp[RBP], RBP        ; 
     130+                        movq rsi[RBP], RSI        ; 
     131+                        movq rdi[RBP], RDI        ; 
     132+                        movq rsp[RBP], RSP        ; 
     133+                        movq r10[RBP], R10        ; 
     134+                        movq r11[RBP], R11        ; 
     135+                        movq r12[RBP], R12        ; 
     136+                        movq r13[RBP], R13        ; 
     137+                        movq r14[RBP], R14        ; 
     138+                        movq r15[RBP], R15        ; 
     139+                    } 
     140+                } 
    120141+                else 
    121142+                { 
     
    128149                 { 
    129150                     pushad; 
    130 @@ -298,7 +320,7 @@ 
     151@@ -298,7 +341,7 @@ 
    131152                 status = sigdelset( &sigres, SIGUSR2 ); 
    132153                 assert( status == 0 ); 
     
    137158  
    138159                 sigsuspend( &sigres ); 
    139 @@ -309,8 +331,12 @@ 
     160@@ -309,8 +352,12 @@ 
    140161                 } 
    141162             } 
     
    151172                 { 
    152173                     popad; 
    153 @@ -1584,8 +1610,14 @@ 
     174@@ -1584,8 +1631,14 @@ 
    154175         status = sigaction( SIGUSR2, &sigusr2, null ); 
    155176         assert( status == 0 ); 
     
    168189         status = pthread_key_create( &Thread.sm_this, null ); 
    169190         assert( status == 0 ); 
    170 @@ -1793,7 +1825,7 @@ 
     191@@ -1793,7 +1846,7 @@ 
    171192                 //       to simply loop on sem_wait at the end, but I'm not 
    172193                 //       convinced that this would be much faster than the 
     
    177198             else if( !t.m_lock ) 
    178199             { 
    179 @@ -2298,6 +2330,13 @@ 
     200@@ -2298,7 +2351,20 @@ 
    180201             version = AsmPPC_Posix; 
    181202     } 
     
    188209+            version = LLVM_AsmX86_Posix; 
    189210+    } 
    190   
     211+    else version( LLVM_InlineAsm_X86_64 ) 
     212+    { 
     213+        version( Posix ) 
     214+            version = LLVM_AsmX86_64_Posix; 
     215+    } 
     216  
     217
    191218     version( Posix ) 
    192219     { 
    193 @@ -2308,6 +2347,8 @@ 
     220         import tango.stdc.posix.unistd;   // for sysconf 
     221@@ -2308,6 +2374,10 @@ 
    194222         version( AsmX86_Win32 ) {} else 
    195223         version( AsmX86_Posix ) {} else 
     
    197225+        version( LLVM_AsmX86_Win32 ) {} else 
    198226+        version( LLVM_AsmX86_Posix ) {} else 
     227+//TODO: Enable when x86-64 Posix supports fibers 
     228+//        version( LLVM_AsmX86_64_Posix ) {} else 
    199229         { 
    200230             // NOTE: The ucontext implementation requires architecture specific 
    201231             //       data definitions to operate so testing for it must be done 
    202 @@ -2318,10 +2359,10 @@ 
     232@@ -2318,10 +2388,10 @@ 
    203233             import tango.stdc.posix.ucontext; 
    204234         } 
     
    213243 static this() 
    214244 { 
    215 @@ -2348,7 +2389,7 @@ 
     245@@ -2348,7 +2418,7 @@ 
    216246     } 
    217247 } 
     
    222252 // Fiber Entry Point and Context Switch 
    223253 //////////////////////////////////////////////////////////////////////////////// 
    224 @@ -2462,6 +2503,22 @@ 
     254@@ -2462,6 +2532,28 @@ 
    225255                 ret; 
    226256             } 
     
    242272+            } 
    243273+        } 
     274+/+ 
     275+        version( LLVM_AsmX86_64_Posix ) 
     276+        { 
     277+            //TODO: Fiber implementation here 
     278+        } 
     279++/ 
    244280         else static if( is( ucontext_t ) ) 
    245281         { 
    246282             Fiber   cfib = Fiber.getThis(); 
    247 @@ -3127,6 +3184,16 @@ 
     283@@ -2980,16 +3072,25 @@ 
     284             m_size = sz; 
     285         } 
     286         else 
     287-        {   static if( is( typeof( mmap ) ) ) 
     288+        { 
     289+            static if( is( typeof( mmap ) ) ) 
     290             { 
     291-                m_pmem = mmap( null, 
     292+                //TODO: This seems a bit dubious. 
     293+                version (X86_64) 
     294+                { 
     295+                    m_pmem = malloc( sz ); 
     296+                } 
     297+                else 
     298+                { 
     299+                    m_pmem = mmap( null, 
     300                                sz, 
     301                                PROT_READ | PROT_WRITE, 
     302                                MAP_PRIVATE | MAP_ANON, 
     303                                -1, 
     304                                0 ); 
     305-                if( m_pmem == MAP_FAILED ) 
     306-                    m_pmem = null; 
     307+                    if( m_pmem == MAP_FAILED ) 
     308+                        m_pmem = null; 
     309+                } 
     310             } 
     311             else static if( is( typeof( valloc ) ) ) 
     312             { 
     313@@ -3127,6 +3228,22 @@ 
    248314             push( 0x00000000 );                                     // ESI 
    249315             push( 0x00000000 );                                     // EDI 
     
    259325+            push( 0x00000000 );                                     // EDI 
    260326+        } 
     327+//TODO: Implement x86-64 fibers 
     328+/+ 
     329+        else version( LLVM_AsmX86_Posix ) 
     330+        { 
     331+        } 
     332++/ 
    261333         else version( AsmPPC_Posix ) 
    262334         { 
     
    294366     extern (C) void* rt_stackTop(); 
    295367  
    296 @@ -2178,6 +2178,28 @@ 
     368@@ -2178,6 +2178,49 @@ 
    297369             __builtin_unwind_init(); 
    298370             sp = & sp; 
     
    315387+                } 
    316388+            } 
     389+            else version (X86_64) 
     390+            { 
     391+                ulong rax,rbx,rcx,rdx,rbp,rsi,rdi,rsp,r10,r11,r12,r13,r14,r15; 
     392+                asm 
     393+                { 
     394+                    movq rax[RBP], RAX      ; 
     395+                    movq rbx[RBP], RBX      ; 
     396+                    movq rcx[RBP], RCX      ; 
     397+                    movq rdx[RBP], RDX      ; 
     398+                    movq rbp[RBP], RBP      ; 
     399+                    movq rsi[RBP], RSI      ; 
     400+                    movq rdi[RBP], RDI      ; 
     401+                    movq rsp[RBP], RSP      ; 
     402+                    movq r10[RBP], R10      ; 
     403+                    movq r11[RBP], R11      ; 
     404+                    movq r12[RBP], R12      ; 
     405+                    movq r13[RBP], R13      ; 
     406+                    movq r14[RBP], R14      ; 
     407+                    movq r15[RBP], R15      ; 
     408+                } 
     409+            } 
    317410+            else 
    318411+            { 
     
    323416         { 
    324417         asm 
    325 @@ -2191,6 +2213,10 @@ 
     418@@ -2191,6 +2234,10 @@ 
    326419         { 
    327420             // nothing to do 
Copyright © 2008, LDC Development Team.