comparison runtime/ldc.diff @ 775:0375841e3175

Updated Tango patch for latest trunk
author tomas@myhost
date Thu, 20 Nov 2008 17:03:18 +0100
parents 61c7a96f28c3
children 6aa2b350c8cc
comparison
equal deleted inserted replaced
774:9688da40cd4d 775:0375841e3175
1 Index: object.di 1 Index: object.di
2 =================================================================== 2 ===================================================================
3 --- object.di (revision 4071) 3 --- object.di (revision 4097)
4 +++ object.di (working copy) 4 +++ object.di (working copy)
5 @@ -150,6 +150,9 @@ 5 @@ -150,6 +150,9 @@
6 void function() dtor; 6 void function() dtor;
7 void function() unitTest; 7 void function() unitTest;
8 8
10 + void function() ictor; 10 + void function() ictor;
11 + 11 +
12 static int opApply( int delegate( inout ModuleInfo ) ); 12 static int opApply( int delegate( inout ModuleInfo ) );
13 } 13 }
14 14
15 Index: lib/unittest.sh
16 ===================================================================
17 --- lib/unittest.sh (revision 4071)
18 +++ lib/unittest.sh (working copy)
19 @@ -18,8 +18,9 @@
20 --help: This message
21 --run-all: Reports result instead of breaking. Do not use this if you want to
22 run unittest runner through a debugger.
23 - dmd: Builds unittests for dmd
24 - gdc: Builds unittests for gdc
25 + dmd: Builds unittests for dmd
26 + gdc: Builds unittests for gdc
27 + ldc: Builds unittests for ldc
28
29 <none>: Builds unittests for all known compilers.'
30 exit 0
31 @@ -86,7 +87,7 @@
32 void main() {}
33 EOF
34
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=1
43 ;;
44 + ldc)
45 + LDC=1
46 + ;;
47 *)
48 usage
49 ;;
50 @@ -132,10 +136,11 @@
51 shift
52 done
53
54 -if [ ! "$DMD" -a ! "$GDC" ]
55 +if [ ! "$DMD" -a ! "$GDC" -a ! "$LDC" ]
56 then
57 DMD=1
58 GDC=1
59 + LDC=1
60 fi
61
62 if [ "$DMD" = "1" ]
63 @@ -146,4 +151,7 @@
64 then
65 compile gdc runUnitTest_gdc
66 fi
67 -
68 +if [ "$LDC" = "1" ]
69 +then
70 + compile ldc runUnitTest_ldc
71 +fi
72 Index: lib/common/tango/core/BitManip.d 15 Index: lib/common/tango/core/BitManip.d
73 =================================================================== 16 ===================================================================
74 --- lib/common/tango/core/BitManip.d (revision 4071) 17 --- lib/common/tango/core/BitManip.d (revision 4097)
75 +++ lib/common/tango/core/BitManip.d (working copy) 18 +++ lib/common/tango/core/BitManip.d (working copy)
76 @@ -171,6 +171,10 @@ 19 @@ -171,6 +171,10 @@
77 */ 20 */
78 uint outpl( uint port_address, uint value ); 21 uint outpl( uint port_address, uint value );
79 } 22 }
84 else 27 else
85 { 28 {
86 public import std.intrinsic; 29 public import std.intrinsic;
87 Index: lib/common/tango/core/Thread.d 30 Index: lib/common/tango/core/Thread.d
88 =================================================================== 31 ===================================================================
89 --- lib/common/tango/core/Thread.d (revision 4071) 32 --- lib/common/tango/core/Thread.d (revision 4097)
90 +++ lib/common/tango/core/Thread.d (working copy) 33 +++ lib/common/tango/core/Thread.d (working copy)
91 @@ -247,6 +247,7 @@ 34 @@ -273,8 +273,50 @@
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 @@
100 } 35 }
101 body 36 body
102 { 37 {
103 - version( D_InlineAsm_X86 ) 38 - version( D_InlineAsm_X86 )
104 + version( LDC) 39 + version( LDC)
146 + else version( D_InlineAsm_X86 ) 81 + else version( D_InlineAsm_X86 )
147 + { 82 + {
148 asm 83 asm
149 { 84 {
150 pushad; 85 pushad;
151 @@ -298,7 +341,7 @@ 86 @@ -330,8 +372,12 @@
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 @@
161 } 87 }
162 } 88 }
163 89
164 - version( D_InlineAsm_X86 ) 90 - version( D_InlineAsm_X86 )
165 + version( LDC) 91 + version( LDC)
169 + else version( D_InlineAsm_X86 ) 95 + else version( D_InlineAsm_X86 )
170 + { 96 + {
171 asm 97 asm
172 { 98 {
173 popad; 99 popad;
174 @@ -1584,8 +1631,14 @@ 100 @@ -2357,6 +2403,10 @@
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 @@
222 version( AsmX86_Win32 ) {} else 101 version( AsmX86_Win32 ) {} else
223 version( AsmX86_Posix ) {} else 102 version( AsmX86_Posix ) {} else
224 version( AsmPPC_Posix ) {} else 103 version( AsmPPC_Posix ) {} else
225 + version( LLVM_AsmX86_Win32 ) {} else 104 + version( LLVM_AsmX86_Win32 ) {} else
226 + version( LLVM_AsmX86_Posix ) {} else 105 + version( LLVM_AsmX86_Posix ) {} else
227 +//TODO: Enable when x86-64 Posix supports fibers 106 +//TODO: Enable when x86-64 Posix supports fibers
228 +// version( LLVM_AsmX86_64_Posix ) {} else 107 +// version( LLVM_AsmX86_64_Posix ) {} else
229 { 108 {
230 // NOTE: The ucontext implementation requires architecture specific 109 // NOTE: The ucontext implementation requires architecture specific
231 // data definitions to operate so testing for it must be done 110 // data definitions to operate so testing for it must be done
232 @@ -2318,10 +2388,10 @@ 111 @@ -2522,7 +2572,7 @@
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 @@
246 } 112 }
247 } 113 }
248 114
249 - 115 -
250 +extern(C) int printf(char*, ...); 116 +extern(C) int printf(char*, ...);
251 //////////////////////////////////////////////////////////////////////////////// 117 ////////////////////////////////////////////////////////////////////////////////
252 // Fiber Entry Point and Context Switch 118 // Fiber
253 //////////////////////////////////////////////////////////////////////////////// 119 ////////////////////////////////////////////////////////////////////////////////
254 @@ -2462,6 +2532,28 @@ 120 @@ -3204,6 +3254,28 @@
255 ret; 121
256 } 122 assert( cast(uint) pstack & 0x0f == 0 );
257 } 123 }
258 + else version( LLVM_AsmX86_Posix ) 124 + else version( LLVM_AsmX86_Posix )
259 + { 125 + {
260 + asm 126 + asm
261 + { 127 + {
277 + //TODO: Fiber implementation here 143 + //TODO: Fiber implementation here
278 + } 144 + }
279 ++/ 145 ++/
280 else static if( is( ucontext_t ) ) 146 else static if( is( ucontext_t ) )
281 { 147 {
282 Fiber cfib = Fiber.getThis(); 148 getcontext( &m_utxt );
283 @@ -2980,16 +3072,25 @@ 149 Index: lib/unittest.sh
284 m_size = sz; 150 ===================================================================
285 } 151 --- lib/unittest.sh (revision 4097)
286 else 152 +++ lib/unittest.sh (working copy)
287 - { static if( is( typeof( mmap ) ) ) 153 @@ -18,8 +18,9 @@
288 + { 154 --help: This message
289 + static if( is( typeof( mmap ) ) ) 155 --run-all: Reports result instead of breaking. Do not use this if you want to
290 { 156 run unittest runner through a debugger.
291 - m_pmem = mmap( null, 157 - dmd: Builds unittests for dmd
292 + //TODO: This seems a bit dubious. 158 - gdc: Builds unittests for gdc
293 + version (X86_64) 159 + dmd: Builds unittests for dmd
294 + { 160 + gdc: Builds unittests for gdc
295 + m_pmem = malloc( sz ); 161 + ldc: Builds unittests for ldc
296 + } 162
297 + else 163 <none>: Builds unittests for all known compilers.'
298 + { 164 exit 0
299 + m_pmem = mmap( null, 165 @@ -86,7 +87,7 @@
300 sz, 166 void main() {}
301 PROT_READ | PROT_WRITE, 167 EOF
302 MAP_PRIVATE | MAP_ANON, 168
303 -1, 169 - rebuild -w -d -g -L-ldl -L-lz -L-lbz2 -debug=UnitTest -debug -full -clean -unittest \
304 0 ); 170 + rebuild -w -d -L-ldl -L-lz -L-lbz2 -debug=UnitTest -debug -full -clean -unittest \
305 - if( m_pmem == MAP_FAILED ) 171 -version=UnitTest $EXE.d tango/core/*.d tango/core/sync/*.d tango/io/digest/*.d \
306 - m_pmem = null; 172 tango/io/model/*.d tango/io/protocol/*.d tango/io/selector/*.d tango/io/*.d \
307 + if( m_pmem == MAP_FAILED ) 173 tango/io/vfs/*.d tango/io/vfs/model/*.d \
308 + m_pmem = null; 174 @@ -125,6 +126,9 @@
309 + } 175 gdc)
310 } 176 GDC=1
311 else static if( is( typeof( valloc ) ) ) 177 ;;
312 { 178 + ldc)
313 @@ -3127,6 +3228,22 @@ 179 + LDC=1
314 push( 0x00000000 ); // ESI 180 + ;;
315 push( 0x00000000 ); // EDI 181 *)
316 } 182 usage
317 + else version( LLVM_AsmX86_Posix ) 183 ;;
318 + { 184 @@ -132,10 +136,11 @@
319 + push( cast(size_t) &fiber_entryPoint ); // EIP 185 shift
320 + push( 0x00000000 ); // newp 186 done
321 + push( 0x00000000 ); // oldp 187
322 + push( 0x00000000 ); // EBP 188 -if [ ! "$DMD" -a ! "$GDC" ]
323 + push( 0x00000000 ); // EBX 189 +if [ ! "$DMD" -a ! "$GDC" -a ! "$LDC" ]
324 + push( 0x00000000 ); // ESI 190 then
325 + push( 0x00000000 ); // EDI 191 DMD=1
326 + } 192 GDC=1
327 +//TODO: Implement x86-64 fibers 193 + LDC=1
328 +/+ 194 fi
329 + else version( LLVM_AsmX86_Posix ) 195
330 + { 196 if [ "$DMD" = "1" ]
331 + } 197 @@ -146,4 +151,7 @@
332 ++/ 198 then
333 else version( AsmPPC_Posix ) 199 compile gdc runUnitTest_gdc
334 { 200 fi
335 version( StackGrowsDown ) 201 -
202 +if [ "$LDC" = "1" ]
203 +then
204 + compile ldc runUnitTest_ldc
205 +fi
336 Index: lib/gc/basic/gcx.d 206 Index: lib/gc/basic/gcx.d
337 =================================================================== 207 ===================================================================
338 --- lib/gc/basic/gcx.d (revision 4071) 208 --- lib/gc/basic/gcx.d (revision 4097)
339 +++ lib/gc/basic/gcx.d (working copy) 209 +++ lib/gc/basic/gcx.d (working copy)
340 @@ -65,6 +65,13 @@ 210 @@ -65,6 +65,13 @@
341 } 211 }
342 212
343 213
426 else 296 else
427 { 297 {
428 asm 298 asm
429 Index: lib/gc/basic/gcbits.d 299 Index: lib/gc/basic/gcbits.d
430 =================================================================== 300 ===================================================================
431 --- lib/gc/basic/gcbits.d (revision 4071) 301 --- lib/gc/basic/gcbits.d (revision 4097)
432 +++ lib/gc/basic/gcbits.d (working copy) 302 +++ lib/gc/basic/gcbits.d (working copy)
433 @@ -39,6 +39,10 @@ 303 @@ -39,6 +39,10 @@
434 { 304 {
435 // use the unoptimized version 305 // use the unoptimized version
436 } 306 }
441 else version (D_InlineAsm_X86) 311 else version (D_InlineAsm_X86)
442 { 312 {
443 version = Asm86; 313 version = Asm86;
444 Index: lib/build-tango.sh 314 Index: lib/build-tango.sh
445 =================================================================== 315 ===================================================================
446 --- lib/build-tango.sh (revision 4071) 316 --- lib/build-tango.sh (revision 4097)
447 +++ lib/build-tango.sh (working copy) 317 +++ lib/build-tango.sh (working copy)
448 @@ -23,7 +23,7 @@ 318 @@ -23,7 +23,7 @@
449 --debug: Will enable debug info 319 --debug: Will enable debug info
450 --warn: Will enable warnings 320 --warn: Will enable warnings
451 --verbose: Increase verbosity 321 --verbose: Increase verbosity
473 mac) 343 mac)
474 # build Universal Binary version of the Tango library 344 # build Universal Binary version of the Tango library
475 build powerpc-apple-darwin8-gdmd libgtango.a.ppc libgphobos.a.ppc 345 build powerpc-apple-darwin8-gdmd libgtango.a.ppc libgphobos.a.ppc
476 Index: tango/text/convert/Layout.d 346 Index: tango/text/convert/Layout.d
477 =================================================================== 347 ===================================================================
478 --- tango/text/convert/Layout.d (revision 4071) 348 --- tango/text/convert/Layout.d (revision 4097)
479 +++ tango/text/convert/Layout.d (working copy) 349 +++ tango/text/convert/Layout.d (working copy)
480 @@ -47,6 +47,12 @@ 350 @@ -47,6 +47,12 @@
481 alias void* Arg; 351 alias void* Arg;
482 alias va_list ArgList; 352 alias va_list ArgList;
483 } 353 }
499 } 369 }
500 } 370 }
501 return parse (formatStr, arguments, arglist, sink); 371 return parse (formatStr, arguments, arglist, sink);
502 Index: tango/net/cluster/CacheInvalidator.d 372 Index: tango/net/cluster/CacheInvalidator.d
503 =================================================================== 373 ===================================================================
504 --- tango/net/cluster/CacheInvalidator.d (revision 4071) 374 --- tango/net/cluster/CacheInvalidator.d (revision 4097)
505 +++ tango/net/cluster/CacheInvalidator.d (working copy) 375 +++ tango/net/cluster/CacheInvalidator.d (working copy)
506 @@ -79,7 +79,7 @@ 376 @@ -79,7 +79,7 @@
507 377
508 *******************************************************************************/ 378 *******************************************************************************/
509 379
512 { 382 {
513 private char[] key_; 383 private char[] key_;
514 384
515 Index: tango/core/Vararg.d 385 Index: tango/core/Vararg.d
516 =================================================================== 386 ===================================================================
517 --- tango/core/Vararg.d (revision 4071) 387 --- tango/core/Vararg.d (revision 4097)
518 +++ tango/core/Vararg.d (working copy) 388 +++ tango/core/Vararg.d (working copy)
519 @@ -15,6 +15,10 @@ 389 @@ -15,6 +15,10 @@
520 { 390 {
521 public import std.stdarg; 391 public import std.stdarg;
522 } 392 }
527 else 397 else
528 { 398 {
529 /** 399 /**
530 Index: tango/core/sync/Semaphore.d 400 Index: tango/core/sync/Semaphore.d
531 =================================================================== 401 ===================================================================
532 --- tango/core/sync/Semaphore.d (revision 4071) 402 --- tango/core/sync/Semaphore.d (revision 4097)
533 +++ tango/core/sync/Semaphore.d (working copy) 403 +++ tango/core/sync/Semaphore.d (working copy)
534 @@ -329,7 +329,8 @@ 404 @@ -376,7 +376,8 @@
535 { 405 {
536 synchronized( synComplete ) 406 synchronized( synComplete )
537 { 407 {
538 - if( numComplete == numConsumers ) 408 - if( numComplete == numConsumers )
539 + // if( numComplete == numConsumers ) 409 + // if( numComplete == numConsumers )
540 + if( numComplete == numToProduce ) 410 + if( numComplete == numToProduce )
541 break; 411 break;
542 } 412 }
543 Thread.yield(); 413 Thread.yield();
544 @@ -337,9 +338,9 @@ 414 @@ -384,9 +385,9 @@
545 415
546 synchronized( synComplete ) 416 synchronized( synComplete )
547 { 417 {
548 - assert( numComplete == numConsumers ); 418 - assert( numComplete == numConsumers );
549 + assert( numComplete == numToProduce ); 419 + assert( numComplete == numToProduce );
551 } 421 }
552 - 422 -
553 synchronized( synConsumed ) 423 synchronized( synConsumed )
554 { 424 {
555 assert( numConsumed == numToProduce ); 425 assert( numConsumed == numToProduce );
556 @@ -400,7 +401,8 @@ 426 @@ -447,7 +448,8 @@
557 427
558 unittest 428 unittest
559 { 429 {
560 + version(darwin){}else{ 430 + version(darwin){}else{
561 testWait(); 431 testWait();
563 + testWaitTimeout();} 433 + testWaitTimeout();}
564 } 434 }
565 } 435 }
566 Index: tango/core/sync/Condition.d 436 Index: tango/core/sync/Condition.d
567 =================================================================== 437 ===================================================================
568 --- tango/core/sync/Condition.d (revision 4071) 438 --- tango/core/sync/Condition.d (revision 4097)
569 +++ tango/core/sync/Condition.d (working copy) 439 +++ tango/core/sync/Condition.d (working copy)
570 @@ -553,8 +553,11 @@ 440 @@ -553,8 +553,11 @@
571 441
572 unittest 442 unittest
573 { 443 {
579 + } 449 + }
580 } 450 }
581 } 451 }
582 Index: tango/core/Atomic.d 452 Index: tango/core/Atomic.d
583 =================================================================== 453 ===================================================================
584 --- tango/core/Atomic.d (revision 4071) 454 --- tango/core/Atomic.d (revision 4097)
585 +++ tango/core/Atomic.d (working copy) 455 +++ tango/core/Atomic.d (working copy)
586 @@ -270,6 +270,167 @@ 456 @@ -270,6 +270,167 @@
587 457
588 458
589 //////////////////////////////////////////////////////////////////////////////// 459 ////////////////////////////////////////////////////////////////////////////////
763 } 633 }
764 version( X86_64 ) 634 version( X86_64 )
765 { 635 {
766 Index: tango/math/IEEE.d 636 Index: tango/math/IEEE.d
767 =================================================================== 637 ===================================================================
768 --- tango/math/IEEE.d (revision 4071) 638 --- tango/math/IEEE.d (revision 4097)
769 +++ tango/math/IEEE.d (working copy) 639 +++ tango/math/IEEE.d (working copy)
770 @@ -1543,7 +1543,12 @@ 640 @@ -1543,7 +1543,12 @@
771 else return 0; 641 else return 0;
772 } 642 }
773 } else { 643 } else {
781 } 651 }
782 } 652 }
783 653
784 Index: tango/math/Math.d 654 Index: tango/math/Math.d
785 =================================================================== 655 ===================================================================
786 --- tango/math/Math.d (revision 4071) 656 --- tango/math/Math.d (revision 4097)
787 +++ tango/math/Math.d (working copy) 657 +++ tango/math/Math.d (working copy)
788 @@ -76,6 +76,14 @@ 658 @@ -76,6 +76,14 @@
789 version = DigitalMars_D_InlineAsm_X86; 659 version = DigitalMars_D_InlineAsm_X86;
790 } 660 }
791 } 661 }
930 } 800 }
931 801
932 debug(UnitTest) { 802 debug(UnitTest) {
933 Index: tango/stdc/posix/sys/types.d 803 Index: tango/stdc/posix/sys/types.d
934 =================================================================== 804 ===================================================================
935 --- tango/stdc/posix/sys/types.d (revision 4071) 805 --- tango/stdc/posix/sys/types.d (revision 4097)
936 +++ tango/stdc/posix/sys/types.d (working copy) 806 +++ tango/stdc/posix/sys/types.d (working copy)
937 @@ -422,7 +422,11 @@ 807 @@ -422,7 +422,11 @@
938 } 808 }
939 else version( darwin ) 809 else version( darwin )
940 { 810 {
947 } 817 }
948 else version( freebsd ) 818 else version( freebsd )
949 { 819 {
950 Index: tango/stdc/stdlib.d 820 Index: tango/stdc/stdlib.d
951 =================================================================== 821 ===================================================================
952 --- tango/stdc/stdlib.d (revision 4071) 822 --- tango/stdc/stdlib.d (revision 4097)
953 +++ tango/stdc/stdlib.d (working copy) 823 +++ tango/stdc/stdlib.d (working copy)
954 @@ -94,6 +94,11 @@ 824 @@ -94,6 +94,11 @@
955 { 825 {
956 void* alloca(size_t size); 826 void* alloca(size_t size);
957 } 827 }
963 else version( GNU ) 833 else version( GNU )
964 { 834 {
965 private import gcc.builtins; 835 private import gcc.builtins;
966 Index: tango/stdc/stdarg.d 836 Index: tango/stdc/stdarg.d
967 =================================================================== 837 ===================================================================
968 --- tango/stdc/stdarg.d (revision 4071) 838 --- tango/stdc/stdarg.d (revision 4097)
969 +++ tango/stdc/stdarg.d (working copy) 839 +++ tango/stdc/stdarg.d (working copy)
970 @@ -13,6 +13,10 @@ 840 @@ -13,6 +13,10 @@
971 { 841 {
972 public import std.c.stdarg; 842 public import std.c.stdarg;
973 } 843 }