comparison runtime/llvmdc.diff @ 613:19cbc612380a

Add bool-special cases in tango.core.Atomic.
author Christian Kamm <kamm incasoftware de>
date Sun, 21 Sep 2008 17:23:17 +0200
parents 2cf4359d344f
children c60e122f4ada
comparison
equal deleted inserted replaced
612:d97b017a8aef 613:19cbc612380a
1 Index: object.di 1 Index: object.di
2 =================================================================== 2 ===================================================================
3 --- object.di (revision 3936) 3 --- object.di (revision 3939)
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
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 15 Index: lib/unittest.sh
16 =================================================================== 16 ===================================================================
17 --- lib/unittest.sh (revision 3936) 17 --- lib/unittest.sh (revision 3939)
18 +++ lib/unittest.sh (working copy) 18 +++ lib/unittest.sh (working copy)
19 @@ -18,8 +18,9 @@ 19 @@ -18,8 +18,9 @@
20 --help: This message 20 --help: This message
21 --run-all: Reports result instead of breaking. Do not use this if you want to 21 --run-all: Reports result instead of breaking. Do not use this if you want to
22 run unittest runner through a debugger. 22 run unittest runner through a debugger.
69 +then 69 +then
70 + compile llvmdc runUnitTest_llvmdc 70 + compile llvmdc runUnitTest_llvmdc
71 +fi 71 +fi
72 Index: lib/common/tango/core/BitManip.d 72 Index: lib/common/tango/core/BitManip.d
73 =================================================================== 73 ===================================================================
74 --- lib/common/tango/core/BitManip.d (revision 3936) 74 --- lib/common/tango/core/BitManip.d (revision 3939)
75 +++ lib/common/tango/core/BitManip.d (working copy) 75 +++ lib/common/tango/core/BitManip.d (working copy)
76 @@ -171,6 +171,10 @@ 76 @@ -171,6 +171,10 @@
77 */ 77 */
78 uint outpl( uint port_address, uint value ); 78 uint outpl( uint port_address, uint value );
79 } 79 }
84 else 84 else
85 { 85 {
86 public import std.intrinsic; 86 public import std.intrinsic;
87 Index: lib/common/tango/core/Thread.d 87 Index: lib/common/tango/core/Thread.d
88 =================================================================== 88 ===================================================================
89 --- lib/common/tango/core/Thread.d (revision 3936) 89 --- lib/common/tango/core/Thread.d (revision 3939)
90 +++ lib/common/tango/core/Thread.d (working copy) 90 +++ lib/common/tango/core/Thread.d (working copy)
91 @@ -244,8 +244,29 @@ 91 @@ -244,8 +244,29 @@
92 } 92 }
93 body 93 body
94 { 94 {
133 asm 133 asm
134 { 134 {
135 popad; 135 popad;
136 Index: lib/gc/basic/gcx.d 136 Index: lib/gc/basic/gcx.d
137 =================================================================== 137 ===================================================================
138 --- lib/gc/basic/gcx.d (revision 3936) 138 --- lib/gc/basic/gcx.d (revision 3939)
139 +++ lib/gc/basic/gcx.d (working copy) 139 +++ lib/gc/basic/gcx.d (working copy)
140 @@ -2178,6 +2178,28 @@ 140 @@ -2178,6 +2178,28 @@
141 __builtin_unwind_init(); 141 __builtin_unwind_init();
142 sp = & sp; 142 sp = & sp;
143 } 143 }
177 else 177 else
178 { 178 {
179 asm 179 asm
180 Index: lib/gc/basic/gcbits.d 180 Index: lib/gc/basic/gcbits.d
181 =================================================================== 181 ===================================================================
182 --- lib/gc/basic/gcbits.d (revision 3936) 182 --- lib/gc/basic/gcbits.d (revision 3939)
183 +++ lib/gc/basic/gcbits.d (working copy) 183 +++ lib/gc/basic/gcbits.d (working copy)
184 @@ -39,6 +39,10 @@ 184 @@ -39,6 +39,10 @@
185 { 185 {
186 // use the unoptimized version 186 // use the unoptimized version
187 } 187 }
192 else version (D_InlineAsm_X86) 192 else version (D_InlineAsm_X86)
193 { 193 {
194 version = Asm86; 194 version = Asm86;
195 Index: tango/text/convert/Layout.d 195 Index: tango/text/convert/Layout.d
196 =================================================================== 196 ===================================================================
197 --- tango/text/convert/Layout.d (revision 3936) 197 --- tango/text/convert/Layout.d (revision 3939)
198 +++ tango/text/convert/Layout.d (working copy) 198 +++ tango/text/convert/Layout.d (working copy)
199 @@ -47,6 +47,12 @@ 199 @@ -47,6 +47,12 @@
200 alias void* Arg; 200 alias void* Arg;
201 alias va_list ArgList; 201 alias va_list ArgList;
202 } 202 }
229 int[64] intargs = void; 229 int[64] intargs = void;
230 byte[64] byteargs = void; 230 byte[64] byteargs = void;
231 long[64] longargs = void; 231 long[64] longargs = void;
232 Index: tango/core/Vararg.d 232 Index: tango/core/Vararg.d
233 =================================================================== 233 ===================================================================
234 --- tango/core/Vararg.d (revision 3936) 234 --- tango/core/Vararg.d (revision 3939)
235 +++ tango/core/Vararg.d (working copy) 235 +++ tango/core/Vararg.d (working copy)
236 @@ -15,6 +15,10 @@ 236 @@ -15,6 +15,10 @@
237 { 237 {
238 public import std.stdarg; 238 public import std.stdarg;
239 } 239 }
244 else 244 else
245 { 245 {
246 /** 246 /**
247 Index: tango/core/Atomic.d 247 Index: tango/core/Atomic.d
248 =================================================================== 248 ===================================================================
249 --- tango/core/Atomic.d (revision 3936) 249 --- tango/core/Atomic.d (revision 3939)
250 +++ tango/core/Atomic.d (working copy) 250 +++ tango/core/Atomic.d (working copy)
251 @@ -270,6 +270,161 @@ 251 @@ -270,6 +270,173 @@
252 252
253 253
254 //////////////////////////////////////////////////////////////////////////////// 254 ////////////////////////////////////////////////////////////////////////////////
255 +// LLVMDC Atomics Implementation 255 +// LLVMDC Atomics Implementation
256 +//////////////////////////////////////////////////////////////////////////////// 256 +////////////////////////////////////////////////////////////////////////////////
277 + ms == msync.ssb || ms == msync.rel || ms == msync.seq, 277 + ms == msync.ssb || ms == msync.rel || ms == msync.seq,
278 + false); 278 + false);
279 + static if (isPointerType!(T)) 279 + static if (isPointerType!(T))
280 + { 280 + {
281 + return cast(T)llvm_atomic_load_add!(size_t)(cast(size_t*)&val, 0); 281 + return cast(T)llvm_atomic_load_add!(size_t)(cast(size_t*)&val, 0);
282 + }
283 + else static if (is(T == bool))
284 + {
285 + return llvm_atomic_load_add!(ubyte)(cast(ubyte*)&val, cast(ubyte)0) ? 1 : 0;
282 + } 286 + }
283 + else 287 + else
284 + { 288 + {
285 + return llvm_atomic_load_add!(T)(&val, cast(T)0); 289 + return llvm_atomic_load_add!(T)(&val, cast(T)0);
286 + } 290 + }
369 + { 373 + {
370 + static if (isPointerType!(T)) 374 + static if (isPointerType!(T))
371 + { 375 + {
372 + return cast(T)llvm_atomic_load_add!(size_t)(cast(size_t*)&val, 1); 376 + return cast(T)llvm_atomic_load_add!(size_t)(cast(size_t*)&val, 1);
373 + } 377 + }
378 + else static if (is(T == bool))
379 + {
380 + return llvm_atomic_load_add!(ubyte)(cast(ubyte*)&val, 1)?1:0;
381 + }
374 + else 382 + else
375 + { 383 + {
376 + return llvm_atomic_load_add!(T)(&val, cast(T)1); 384 + return llvm_atomic_load_add!(T)(&val, cast(T)1);
377 + } 385 + }
378 + } 386 + }
396 + { 404 + {
397 + static if (isPointerType!(T)) 405 + static if (isPointerType!(T))
398 + { 406 + {
399 + return cast(T)llvm_atomic_load_sub!(size_t)(cast(size_t*)&val, 1); 407 + return cast(T)llvm_atomic_load_sub!(size_t)(cast(size_t*)&val, 1);
400 + } 408 + }
409 + else static if (is(T == bool))
410 + {
411 + return llvm_atomic_load_sub!(ubyte)(cast(ubyte*)&val, 1)?1:0;
412 + }
401 + else 413 + else
402 + { 414 + {
403 + return llvm_atomic_load_sub!(T)(&val, cast(T)1); 415 + return llvm_atomic_load_sub!(T)(&val, cast(T)1);
404 + } 416 + }
405 + } 417 + }
410 // x86 Atomic Function Implementation 422 // x86 Atomic Function Implementation
411 //////////////////////////////////////////////////////////////////////////////// 423 ////////////////////////////////////////////////////////////////////////////////
412 424
413 Index: tango/math/Math.d 425 Index: tango/math/Math.d
414 =================================================================== 426 ===================================================================
415 --- tango/math/Math.d (revision 3936) 427 --- tango/math/Math.d (revision 3939)
416 +++ tango/math/Math.d (working copy) 428 +++ tango/math/Math.d (working copy)
417 @@ -76,6 +76,14 @@ 429 @@ -76,6 +76,14 @@
418 version = DigitalMars_D_InlineAsm_X86; 430 version = DigitalMars_D_InlineAsm_X86;
419 } 431 }
420 } 432 }
559 } 571 }
560 572
561 debug(UnitTest) { 573 debug(UnitTest) {
562 Index: tango/math/internal/BignumX86.d 574 Index: tango/math/internal/BignumX86.d
563 =================================================================== 575 ===================================================================
564 --- tango/math/internal/BignumX86.d (revision 3936) 576 --- tango/math/internal/BignumX86.d (revision 3939)
565 +++ tango/math/internal/BignumX86.d (working copy) 577 +++ tango/math/internal/BignumX86.d (working copy)
566 @@ -49,6 +49,8 @@ 578 @@ -49,6 +49,8 @@
567 private: 579 private:
568 version(GNU) { 580 version(GNU) {
569 // GDC is a filthy liar. It can't actually do inline asm. 581 // GDC is a filthy liar. It can't actually do inline asm.
572 } else version(D_InlineAsm_X86) { 584 } else version(D_InlineAsm_X86) {
573 /* Duplicate string s, with n times, substituting index for '@'. 585 /* Duplicate string s, with n times, substituting index for '@'.
574 * 586 *
575 Index: tango/stdc/stdlib.d 587 Index: tango/stdc/stdlib.d
576 =================================================================== 588 ===================================================================
577 --- tango/stdc/stdlib.d (revision 3936) 589 --- tango/stdc/stdlib.d (revision 3939)
578 +++ tango/stdc/stdlib.d (working copy) 590 +++ tango/stdc/stdlib.d (working copy)
579 @@ -94,6 +94,11 @@ 591 @@ -94,6 +94,11 @@
580 { 592 {
581 void* alloca(size_t size); 593 void* alloca(size_t size);
582 } 594 }
588 else version( GNU ) 600 else version( GNU )
589 { 601 {
590 private import gcc.builtins; 602 private import gcc.builtins;
591 Index: tango/stdc/stdarg.d 603 Index: tango/stdc/stdarg.d
592 =================================================================== 604 ===================================================================
593 --- tango/stdc/stdarg.d (revision 3936) 605 --- tango/stdc/stdarg.d (revision 3939)
594 +++ tango/stdc/stdarg.d (working copy) 606 +++ tango/stdc/stdarg.d (working copy)
595 @@ -13,6 +13,10 @@ 607 @@ -13,6 +13,10 @@
596 { 608 {
597 public import std.c.stdarg; 609 public import std.c.stdarg;
598 } 610 }