Changeset 775:0375841e3175
- Timestamp:
- 11/20/08 11:03:18 (2 months ago)
- Files:
-
- runtime/ldc.diff (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
runtime/ldc.diff
r755 r775 1 1 Index: object.di 2 2 =================================================================== 3 --- object.di (revision 40 71)3 --- object.di (revision 4097) 4 4 +++ object.di (working copy) 5 5 @@ -150,6 +150,9 @@ … … 13 13 } 14 14 15 Index: lib/unittest.sh16 ===================================================================17 --- lib/unittest.sh (revision 4071)18 +++ lib/unittest.sh (working copy)19 @@ -18,8 +18,9 @@20 --help: This message21 --run-all: Reports result instead of breaking. Do not use this if you want to22 run unittest runner through a debugger.23 - dmd: Builds unittests for dmd24 - gdc: Builds unittests for gdc25 + dmd: Builds unittests for dmd26 + gdc: Builds unittests for gdc27 + ldc: Builds unittests for ldc28 29 <none>: Builds unittests for all known compilers.'30 exit 031 @@ -86,7 +87,7 @@32 void main() {}33 EOF34 35 - rebuild -w -d -g -L-ldl -L-lz -L-lbz2 -debug=UnitTest -debug -full -clean -unittest \36 + rebuild -w -d -L-ldl -L-lz -L-lbz2 -debug=UnitTest -debug -full -clean -unittest \37 -version=UnitTest $EXE.d tango/core/*.d tango/core/sync/*.d tango/io/digest/*.d \38 tango/io/model/*.d tango/io/protocol/*.d tango/io/selector/*.d tango/io/*.d \39 tango/io/vfs/*.d tango/io/vfs/model/*.d \40 @@ -125,6 +126,9 @@41 gdc)42 GDC=143 ;;44 + ldc)45 + LDC=146 + ;;47 *)48 usage49 ;;50 @@ -132,10 +136,11 @@51 shift52 done53 54 -if [ ! "$DMD" -a ! "$GDC" ]55 +if [ ! "$DMD" -a ! "$GDC" -a ! "$LDC" ]56 then57 DMD=158 GDC=159 + LDC=160 fi61 62 if [ "$DMD" = "1" ]63 @@ -146,4 +151,7 @@64 then65 compile gdc runUnitTest_gdc66 fi67 -68 +if [ "$LDC" = "1" ]69 +then70 + compile ldc runUnitTest_ldc71 +fi72 15 Index: lib/common/tango/core/BitManip.d 73 16 =================================================================== 74 --- lib/common/tango/core/BitManip.d (revision 40 71)17 --- lib/common/tango/core/BitManip.d (revision 4097) 75 18 +++ lib/common/tango/core/BitManip.d (working copy) 76 19 @@ -171,6 +171,10 @@ … … 87 30 Index: lib/common/tango/core/Thread.d 88 31 =================================================================== 89 --- lib/common/tango/core/Thread.d (revision 40 71)32 --- lib/common/tango/core/Thread.d (revision 4097) 90 33 +++ lib/common/tango/core/Thread.d (working copy) 91 @@ -247,6 +247,7 @@ 92 // used to track the number of suspended threads 93 // 94 sem_t suspendCount; 95 + sem_t* suspendCountPtr; 96 97 98 extern (C) void thread_suspendHandler( int sig ) 99 @@ -256,8 +257,50 @@ 34 @@ -273,8 +273,50 @@ 100 35 } 101 36 body … … 149 84 { 150 85 pushad; 151 @@ -298,7 +341,7 @@ 152 status = sigdelset( &sigres, SIGUSR2 ); 153 assert( status == 0 ); 154 155 - status = sem_post( &suspendCount ); 156 + status = sem_post( suspendCountPtr ); 157 assert( status == 0 ); 158 159 sigsuspend( &sigres ); 160 @@ -309,8 +352,12 @@ 86 @@ -330,8 +372,12 @@ 161 87 } 162 88 } … … 172 98 { 173 99 popad; 174 @@ -1584,8 +1631,14 @@ 175 status = sigaction( SIGUSR2, &sigusr2, null ); 176 assert( status == 0 ); 177 178 - status = sem_init( &suspendCount, 0, 0 ); 179 - assert( status == 0 ); 180 + version(darwin){ 181 + suspendCountPtr = sem_open( "/thread_init/sem\0".ptr, 0 ); 182 + assert( suspendCountPtr !is null ); 183 + }else { 184 + status=sem_init(&suspendCount,0,0); 185 + suspendCountPtr=&suspendCount; 186 + assert(status==0); 187 + } 188 189 status = pthread_key_create( &Thread.sm_this, null ); 190 assert( status == 0 ); 191 @@ -1793,7 +1846,7 @@ 192 // to simply loop on sem_wait at the end, but I'm not 193 // convinced that this would be much faster than the 194 // current approach. 195 - sem_wait( &suspendCount ); 196 + sem_wait( suspendCountPtr ); 197 } 198 else if( !t.m_lock ) 199 { 200 @@ -2298,7 +2351,20 @@ 201 version = AsmPPC_Posix; 202 } 203 204 + version( LLVM_InlineAsm_X86 ) 205 + { 206 + version( Win32 ) 207 + version = LLVM_AsmX86_Win32; 208 + else version( Posix ) 209 + version = LLVM_AsmX86_Posix; 210 + } 211 + else version( LLVM_InlineAsm_X86_64 ) 212 + { 213 + version( Posix ) 214 + version = LLVM_AsmX86_64_Posix; 215 + } 216 217 + 218 version( Posix ) 219 { 220 import tango.stdc.posix.unistd; // for sysconf 221 @@ -2308,6 +2374,10 @@ 100 @@ -2357,6 +2403,10 @@ 222 101 version( AsmX86_Win32 ) {} else 223 102 version( AsmX86_Posix ) {} else … … 230 109 // NOTE: The ucontext implementation requires architecture specific 231 110 // data definitions to operate so testing for it must be done 232 @@ -2318,10 +2388,10 @@ 233 import tango.stdc.posix.ucontext; 234 } 235 } 236 - 237 - const size_t PAGESIZE; 238 } 239 240 +// this can't be private since it's used as default argument to a public function 241 +const size_t PAGESIZE; 242 243 static this() 244 { 245 @@ -2348,7 +2418,7 @@ 111 @@ -2522,7 +2572,7 @@ 246 112 } 247 113 } … … 250 116 +extern(C) int printf(char*, ...); 251 117 //////////////////////////////////////////////////////////////////////////////// 252 // Fiber Entry Point and Context Switch118 // Fiber 253 119 //////////////////////////////////////////////////////////////////////////////// 254 @@ - 2462,6 +2532,28 @@255 ret;256 }120 @@ -3204,6 +3254,28 @@ 121 122 assert( cast(uint) pstack & 0x0f == 0 ); 257 123 } 258 124 + else version( LLVM_AsmX86_Posix ) … … 280 146 else static if( is( ucontext_t ) ) 281 147 { 282 Fiber cfib = Fiber.getThis(); 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 @@ 314 push( 0x00000000 ); // ESI 315 push( 0x00000000 ); // EDI 316 } 317 + else version( LLVM_AsmX86_Posix ) 318 + { 319 + push( cast(size_t) &fiber_entryPoint ); // EIP 320 + push( 0x00000000 ); // newp 321 + push( 0x00000000 ); // oldp 322 + push( 0x00000000 ); // EBP 323 + push( 0x00000000 ); // EBX 324 + push( 0x00000000 ); // ESI 325 + push( 0x00000000 ); // EDI 326 + } 327 +//TODO: Implement x86-64 fibers 328 +/+ 329 + else version( LLVM_AsmX86_Posix ) 330 + { 331 + } 332 ++/ 333 else version( AsmPPC_Posix ) 334 { 335 version( StackGrowsDown ) 148 getcontext( &m_utxt ); 149 Index: lib/unittest.sh 150 =================================================================== 151 --- lib/unittest.sh (revision 4097) 152 +++ lib/unittest.sh (working copy) 153 @@ -18,8 +18,9 @@ 154 --help: This message 155 --run-all: Reports result instead of breaking. Do not use this if you want to 156 run unittest runner through a debugger. 157 - dmd: Builds unittests for dmd 158 - gdc: Builds unittests for gdc 159 + dmd: Builds unittests for dmd 160 + gdc: Builds unittests for gdc 161 + ldc: Builds unittests for ldc 162 163 <none>: Builds unittests for all known compilers.' 164 exit 0 165 @@ -86,7 +87,7 @@ 166 void main() {} 167 EOF 168 169 - rebuild -w -d -g -L-ldl -L-lz -L-lbz2 -debug=UnitTest -debug -full -clean -unittest \ 170 + rebuild -w -d -L-ldl -L-lz -L-lbz2 -debug=UnitTest -debug -full -clean -unittest \ 171 -version=UnitTest $EXE.d tango/core/*.d tango/core/sync/*.d tango/io/digest/*.d \ 172 tango/io/model/*.d tango/io/protocol/*.d tango/io/selector/*.d tango/io/*.d \ 173 tango/io/vfs/*.d tango/io/vfs/model/*.d \ 174 @@ -125,6 +126,9 @@ 175 gdc) 176 GDC=1 177 ;; 178 + ldc) 179 + LDC=1 180 + ;; 181 *) 182 usage 183 ;; 184 @@ -132,10 +136,11 @@ 185 shift 186 done 187 188 -if [ ! "$DMD" -a ! "$GDC" ] 189 +if [ ! "$DMD" -a ! "$GDC" -a ! "$LDC" ] 190 then 191 DMD=1 192 GDC=1 193 + LDC=1 194 fi 195 196 if [ "$DMD" = "1" ] 197 @@ -146,4 +151,7 @@ 198 then 199 compile gdc runUnitTest_gdc 200 fi 201 - 202 +if [ "$LDC" = "1" ] 203 +then 204 + compile ldc runUnitTest_ldc 205 +fi 336 206 Index: lib/gc/basic/gcx.d 337 207 =================================================================== 338 --- lib/gc/basic/gcx.d (revision 40 71)208 --- lib/gc/basic/gcx.d (revision 4097) 339 209 +++ lib/gc/basic/gcx.d (working copy) 340 210 @@ -65,6 +65,13 @@ … … 429 299 Index: lib/gc/basic/gcbits.d 430 300 =================================================================== 431 --- lib/gc/basic/gcbits.d (revision 40 71)301 --- lib/gc/basic/gcbits.d (revision 4097) 432 302 +++ lib/gc/basic/gcbits.d (working copy) 433 303 @@ -39,6 +39,10 @@ … … 444 314 Index: lib/build-tango.sh 445 315 =================================================================== 446 --- lib/build-tango.sh (revision 40 71)316 --- lib/build-tango.sh (revision 4097) 447 317 +++ lib/build-tango.sh (working copy) 448 318 @@ -23,7 +23,7 @@ … … 476 346 Index: tango/text/convert/Layout.d 477 347 =================================================================== 478 --- tango/text/convert/Layout.d (revision 40 71)348 --- tango/text/convert/Layout.d (revision 4097) 479 349 +++ tango/text/convert/Layout.d (working copy) 480 350 @@ -47,6 +47,12 @@ … … 502 372 Index: tango/net/cluster/CacheInvalidator.d 503 373 =================================================================== 504 --- tango/net/cluster/CacheInvalidator.d (revision 40 71)374 --- tango/net/cluster/CacheInvalidator.d (revision 4097) 505 375 +++ tango/net/cluster/CacheInvalidator.d (working copy) 506 376 @@ -79,7 +79,7 @@ … … 515 385 Index: tango/core/Vararg.d 516 386 =================================================================== 517 --- tango/core/Vararg.d (revision 40 71)387 --- tango/core/Vararg.d (revision 4097) 518 388 +++ tango/core/Vararg.d (working copy) 519 389 @@ -15,6 +15,10 @@ … … 530 400 Index: tango/core/sync/Semaphore.d 531 401 =================================================================== 532 --- tango/core/sync/Semaphore.d (revision 40 71)402 --- tango/core/sync/Semaphore.d (revision 4097) 533 403 +++ tango/core/sync/Semaphore.d (working copy) 534 @@ -3 29,7 +329,8 @@404 @@ -376,7 +376,8 @@ 535 405 { 536 406 synchronized( synComplete ) … … 542 412 } 543 413 Thread.yield(); 544 @@ -3 37,9 +338,9 @@414 @@ -384,9 +385,9 @@ 545 415 546 416 synchronized( synComplete ) … … 554 424 { 555 425 assert( numConsumed == numToProduce ); 556 @@ -4 00,7 +401,8 @@426 @@ -447,7 +448,8 @@ 557 427 558 428 unittest … … 566 436 Index: tango/core/sync/Condition.d 567 437 =================================================================== 568 --- tango/core/sync/Condition.d (revision 40 71)438 --- tango/core/sync/Condition.d (revision 4097) 569 439 +++ tango/core/sync/Condition.d (working copy) 570 440 @@ -553,8 +553,11 @@ … … 582 452 Index: tango/core/Atomic.d 583 453 =================================================================== 584 --- tango/core/Atomic.d (revision 40 71)454 --- tango/core/Atomic.d (revision 4097) 585 455 +++ tango/core/Atomic.d (working copy) 586 456 @@ -270,6 +270,167 @@ … … 766 636 Index: tango/math/IEEE.d 767 637 =================================================================== 768 --- tango/math/IEEE.d (revision 40 71)638 --- tango/math/IEEE.d (revision 4097) 769 639 +++ tango/math/IEEE.d (working copy) 770 640 @@ -1543,7 +1543,12 @@ … … 784 654 Index: tango/math/Math.d 785 655 =================================================================== 786 --- tango/math/Math.d (revision 40 71)656 --- tango/math/Math.d (revision 4097) 787 657 +++ tango/math/Math.d (working copy) 788 658 @@ -76,6 +76,14 @@ … … 933 803 Index: tango/stdc/posix/sys/types.d 934 804 =================================================================== 935 --- tango/stdc/posix/sys/types.d (revision 40 71)805 --- tango/stdc/posix/sys/types.d (revision 4097) 936 806 +++ tango/stdc/posix/sys/types.d (working copy) 937 807 @@ -422,7 +422,11 @@ … … 950 820 Index: tango/stdc/stdlib.d 951 821 =================================================================== 952 --- tango/stdc/stdlib.d (revision 40 71)822 --- tango/stdc/stdlib.d (revision 4097) 953 823 +++ tango/stdc/stdlib.d (working copy) 954 824 @@ -94,6 +94,11 @@ … … 966 836 Index: tango/stdc/stdarg.d 967 837 =================================================================== 968 --- tango/stdc/stdarg.d (revision 40 71)838 --- tango/stdc/stdarg.d (revision 4097) 969 839 +++ tango/stdc/stdarg.d (working copy) 970 840 @@ -13,6 +13,10 @@

