Mercurial > projects > ldc
comparison runtime/llvmdc.diff @ 640:c2a342b5d8e5
Made Fibers work with LLVMDC on x86 Posix.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Fri, 03 Oct 2008 00:42:17 +0200 |
parents | 9fb1f559d9e9 |
children | d9927f20758b |
comparison
equal
deleted
inserted
replaced
639:8aebdf56c455 | 640:c2a342b5d8e5 |
---|---|
1 Index: object.di | 1 Index: object.di |
2 =================================================================== | 2 =================================================================== |
3 --- object.di (revision 3950) | 3 --- object.di (revision 3954) |
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/common/tango/core/BitManip.d | 15 Index: lib/common/tango/core/BitManip.d |
16 =================================================================== | 16 =================================================================== |
17 --- lib/common/tango/core/BitManip.d (revision 3950) | 17 --- lib/common/tango/core/BitManip.d (revision 3954) |
18 +++ lib/common/tango/core/BitManip.d (working copy) | 18 +++ lib/common/tango/core/BitManip.d (working copy) |
19 @@ -171,6 +171,10 @@ | 19 @@ -171,6 +171,10 @@ |
20 */ | 20 */ |
21 uint outpl( uint port_address, uint value ); | 21 uint outpl( uint port_address, uint value ); |
22 } | 22 } |
27 else | 27 else |
28 { | 28 { |
29 public import std.intrinsic; | 29 public import std.intrinsic; |
30 Index: lib/common/tango/core/Thread.d | 30 Index: lib/common/tango/core/Thread.d |
31 =================================================================== | 31 =================================================================== |
32 --- lib/common/tango/core/Thread.d (revision 3950) | 32 --- lib/common/tango/core/Thread.d (revision 3954) |
33 +++ lib/common/tango/core/Thread.d (working copy) | 33 +++ lib/common/tango/core/Thread.d (working copy) |
34 @@ -244,8 +244,29 @@ | 34 @@ -244,8 +244,29 @@ |
35 } | 35 } |
36 body | 36 body |
37 { | 37 { |
74 + else version( D_InlineAsm_X86 ) | 74 + else version( D_InlineAsm_X86 ) |
75 + { | 75 + { |
76 asm | 76 asm |
77 { | 77 { |
78 popad; | 78 popad; |
79 @@ -2306,10 +2331,10 @@ | 79 @@ -2286,6 +2311,13 @@ |
80 version = AsmPPC_Posix; | |
81 } | |
82 | |
83 + version( LLVM_InlineAsm_X86 ) | |
84 + { | |
85 + version( Win32 ) | |
86 + version = LLVM_AsmX86_Win32; | |
87 + else version( Posix ) | |
88 + version = LLVM_AsmX86_Posix; | |
89 + } | |
90 | |
91 version( Posix ) | |
92 { | |
93 @@ -2296,6 +2328,8 @@ | |
94 version( AsmX86_Win32 ) {} else | |
95 version( AsmX86_Posix ) {} else | |
96 version( AsmPPC_Posix ) {} else | |
97 + version( LLVM_AsmX86_Win32 ) {} else | |
98 + version( LLVM_AsmX86_Posix ) {} else | |
99 { | |
100 // NOTE: The ucontext implementation requires architecture specific | |
101 // data definitions to operate so testing for it must be done | |
102 @@ -2306,10 +2340,10 @@ | |
80 import tango.stdc.posix.ucontext; | 103 import tango.stdc.posix.ucontext; |
81 } | 104 } |
82 } | 105 } |
83 - | 106 - |
84 - const size_t PAGESIZE; | 107 - const size_t PAGESIZE; |
87 +// this can't be private since it's used as default argument to a public function | 110 +// this can't be private since it's used as default argument to a public function |
88 +const size_t PAGESIZE; | 111 +const size_t PAGESIZE; |
89 | 112 |
90 static this() | 113 static this() |
91 { | 114 { |
115 @@ -2336,7 +2370,7 @@ | |
116 } | |
117 } | |
118 | |
119 - | |
120 +extern(C) int printf(char*, ...); | |
121 //////////////////////////////////////////////////////////////////////////////// | |
122 // Fiber Entry Point and Context Switch | |
123 //////////////////////////////////////////////////////////////////////////////// | |
124 @@ -2450,6 +2484,17 @@ | |
125 ret; | |
126 } | |
127 } | |
128 + else version( LLVM_AsmX86_Posix ) | |
129 + { | |
130 + asm | |
131 + { | |
132 + // store oldp again with more accurate address | |
133 + mov EAX, oldp; | |
134 + mov [EAX], ESP; | |
135 + // load newp to begin context switch | |
136 + mov ESP, newp; | |
137 + } | |
138 + } | |
139 else static if( is( ucontext_t ) ) | |
140 { | |
141 Fiber cfib = Fiber.getThis(); | |
142 @@ -3115,6 +3160,13 @@ | |
143 push( 0x00000000 ); // ESI | |
144 push( 0x00000000 ); // EDI | |
145 } | |
146 + else version( LLVM_AsmX86_Posix ) | |
147 + { | |
148 + push( cast(size_t) &fiber_entryPoint ); // EIP | |
149 + push( 0x00000000 ); // EBP | |
150 + push( 0x00000000 ); // newp | |
151 + push( 0x00000000 ); // oldp | |
152 + } | |
153 else version( AsmPPC_Posix ) | |
154 { | |
155 version( StackGrowsDown ) | |
92 Index: lib/unittest.sh | 156 Index: lib/unittest.sh |
93 =================================================================== | 157 =================================================================== |
94 --- lib/unittest.sh (revision 3950) | 158 --- lib/unittest.sh (revision 3954) |
95 +++ lib/unittest.sh (working copy) | 159 +++ lib/unittest.sh (working copy) |
96 @@ -18,8 +18,9 @@ | 160 @@ -18,8 +18,9 @@ |
97 --help: This message | 161 --help: This message |
98 --run-all: Reports result instead of breaking. Do not use this if you want to | 162 --run-all: Reports result instead of breaking. Do not use this if you want to |
99 run unittest runner through a debugger. | 163 run unittest runner through a debugger. |
146 +then | 210 +then |
147 + compile llvmdc runUnitTest_llvmdc | 211 + compile llvmdc runUnitTest_llvmdc |
148 +fi | 212 +fi |
149 Index: lib/gc/basic/gcx.d | 213 Index: lib/gc/basic/gcx.d |
150 =================================================================== | 214 =================================================================== |
151 --- lib/gc/basic/gcx.d (revision 3950) | 215 --- lib/gc/basic/gcx.d (revision 3954) |
152 +++ lib/gc/basic/gcx.d (working copy) | 216 +++ lib/gc/basic/gcx.d (working copy) |
153 @@ -65,6 +65,13 @@ | 217 @@ -65,6 +65,13 @@ |
154 } | 218 } |
155 | 219 |
156 | 220 |
218 else | 282 else |
219 { | 283 { |
220 asm | 284 asm |
221 Index: lib/gc/basic/gcbits.d | 285 Index: lib/gc/basic/gcbits.d |
222 =================================================================== | 286 =================================================================== |
223 --- lib/gc/basic/gcbits.d (revision 3950) | 287 --- lib/gc/basic/gcbits.d (revision 3954) |
224 +++ lib/gc/basic/gcbits.d (working copy) | 288 +++ lib/gc/basic/gcbits.d (working copy) |
225 @@ -39,6 +39,10 @@ | 289 @@ -39,6 +39,10 @@ |
226 { | 290 { |
227 // use the unoptimized version | 291 // use the unoptimized version |
228 } | 292 } |
233 else version (D_InlineAsm_X86) | 297 else version (D_InlineAsm_X86) |
234 { | 298 { |
235 version = Asm86; | 299 version = Asm86; |
236 Index: tango/text/convert/Layout.d | 300 Index: tango/text/convert/Layout.d |
237 =================================================================== | 301 =================================================================== |
238 --- tango/text/convert/Layout.d (revision 3950) | 302 --- tango/text/convert/Layout.d (revision 3954) |
239 +++ tango/text/convert/Layout.d (working copy) | 303 +++ tango/text/convert/Layout.d (working copy) |
240 @@ -47,6 +47,12 @@ | 304 @@ -47,6 +47,12 @@ |
241 alias void* Arg; | 305 alias void* Arg; |
242 alias va_list ArgList; | 306 alias va_list ArgList; |
243 } | 307 } |
268 + { | 332 + { |
269 + Arg[64] arglist = void; | 333 + Arg[64] arglist = void; |
270 int[64] intargs = void; | 334 int[64] intargs = void; |
271 byte[64] byteargs = void; | 335 byte[64] byteargs = void; |
272 long[64] longargs = void; | 336 long[64] longargs = void; |
273 Index: tango/text/xml/Document.d | |
274 =================================================================== | |
275 --- tango/text/xml/Document.d (revision 3950) | |
276 +++ tango/text/xml/Document.d (working copy) | |
277 @@ -1243,7 +1243,8 @@ | |
278 freeIndex = 0; | |
279 } | |
280 | |
281 - NodeSet set = {this}; | |
282 + NodeSet set; | |
283 + set.host = this; | |
284 auto mark = freeIndex; | |
285 allocate(root); | |
286 return set.assign (mark); | |
287 @@ -1273,7 +1274,8 @@ | |
288 | |
289 NodeSet dup () | |
290 { | |
291 - NodeSet copy = {host}; | |
292 + NodeSet copy; | |
293 + copy.host = host; | |
294 copy.nodes = nodes.dup; | |
295 return copy; | |
296 } | |
297 @@ -1337,7 +1339,7 @@ | |
298 | |
299 NodeSet nth (uint index) | |
300 { | |
301 - NodeSet set = {host}; | |
302 + NodeSet set; set.host = host; | |
303 auto mark = host.mark; | |
304 if (index < nodes.length) | |
305 host.allocate (nodes [index]); | |
306 @@ -1495,7 +1497,7 @@ | |
307 | |
308 NodeSet filter (bool delegate(Node) filter) | |
309 { | |
310 - NodeSet set = {host}; | |
311 + NodeSet set; set.host = host; | |
312 auto mark = host.mark; | |
313 | |
314 foreach (node; nodes) | |
315 @@ -1514,7 +1516,7 @@ | |
316 NodeSet child (bool delegate(Node) filter, | |
317 XmlNodeType type = XmlNodeType.Element) | |
318 { | |
319 - NodeSet set = {host}; | |
320 + NodeSet set; set.host = host; | |
321 auto mark = host.mark; | |
322 | |
323 foreach (parent; nodes) | |
324 @@ -1534,7 +1536,7 @@ | |
325 | |
326 NodeSet attribute (bool delegate(Node) filter) | |
327 { | |
328 - NodeSet set = {host}; | |
329 + NodeSet set; set.host = host; | |
330 auto mark = host.mark; | |
331 | |
332 foreach (node; nodes) | |
333 @@ -1565,7 +1567,7 @@ | |
334 } | |
335 } | |
336 | |
337 - NodeSet set = {host}; | |
338 + NodeSet set; set.host = host; | |
339 auto mark = host.mark; | |
340 | |
341 foreach (node; nodes) | |
342 @@ -1583,7 +1585,7 @@ | |
343 | |
344 NodeSet parent (bool delegate(Node) filter) | |
345 { | |
346 - NodeSet set = {host}; | |
347 + NodeSet set; set.host = host; | |
348 auto mark = host.mark; | |
349 | |
350 foreach (node; nodes) | |
351 @@ -1613,7 +1615,7 @@ | |
352 | |
353 NodeSet ancestor (bool delegate(Node) filter) | |
354 { | |
355 - NodeSet set = {host}; | |
356 + NodeSet set; set.host = host; | |
357 auto mark = host.mark; | |
358 | |
359 void traverse (Node child) | |
360 @@ -1648,7 +1650,7 @@ | |
361 NodeSet next (bool delegate(Node) filter, | |
362 XmlNodeType type = XmlNodeType.Element) | |
363 { | |
364 - NodeSet set = {host}; | |
365 + NodeSet set; set.host = host; | |
366 auto mark = host.mark; | |
367 | |
368 foreach (node; nodes) | |
369 @@ -1675,7 +1677,7 @@ | |
370 NodeSet prev (bool delegate(Node) filter, | |
371 XmlNodeType type = XmlNodeType.Element) | |
372 { | |
373 - NodeSet set = {host}; | |
374 + NodeSet set; set.host = host; | |
375 auto mark = host.mark; | |
376 | |
377 foreach (node; nodes) | |
378 Index: tango/core/Vararg.d | 337 Index: tango/core/Vararg.d |
379 =================================================================== | 338 =================================================================== |
380 --- tango/core/Vararg.d (revision 3950) | 339 --- tango/core/Vararg.d (revision 3954) |
381 +++ tango/core/Vararg.d (working copy) | 340 +++ tango/core/Vararg.d (working copy) |
382 @@ -15,6 +15,10 @@ | 341 @@ -15,6 +15,10 @@ |
383 { | 342 { |
384 public import std.stdarg; | 343 public import std.stdarg; |
385 } | 344 } |
390 else | 349 else |
391 { | 350 { |
392 /** | 351 /** |
393 Index: tango/core/Atomic.d | 352 Index: tango/core/Atomic.d |
394 =================================================================== | 353 =================================================================== |
395 --- tango/core/Atomic.d (revision 3950) | 354 --- tango/core/Atomic.d (revision 3954) |
396 +++ tango/core/Atomic.d (working copy) | 355 +++ tango/core/Atomic.d (working copy) |
397 @@ -270,6 +270,167 @@ | 356 @@ -270,6 +270,167 @@ |
398 | 357 |
399 | 358 |
400 //////////////////////////////////////////////////////////////////////////////// | 359 //////////////////////////////////////////////////////////////////////////////// |
562 // x86 Atomic Function Implementation | 521 // x86 Atomic Function Implementation |
563 //////////////////////////////////////////////////////////////////////////////// | 522 //////////////////////////////////////////////////////////////////////////////// |
564 | 523 |
565 Index: tango/math/Math.d | 524 Index: tango/math/Math.d |
566 =================================================================== | 525 =================================================================== |
567 --- tango/math/Math.d (revision 3950) | 526 --- tango/math/Math.d (revision 3954) |
568 +++ tango/math/Math.d (working copy) | 527 +++ tango/math/Math.d (working copy) |
569 @@ -76,6 +76,14 @@ | 528 @@ -76,6 +76,14 @@ |
570 version = DigitalMars_D_InlineAsm_X86; | 529 version = DigitalMars_D_InlineAsm_X86; |
571 } | 530 } |
572 } | 531 } |
711 } | 670 } |
712 | 671 |
713 debug(UnitTest) { | 672 debug(UnitTest) { |
714 Index: tango/math/internal/BignumX86.d | 673 Index: tango/math/internal/BignumX86.d |
715 =================================================================== | 674 =================================================================== |
716 --- tango/math/internal/BignumX86.d (revision 3950) | 675 --- tango/math/internal/BignumX86.d (revision 3954) |
717 +++ tango/math/internal/BignumX86.d (working copy) | 676 +++ tango/math/internal/BignumX86.d (working copy) |
718 @@ -53,6 +53,8 @@ | 677 @@ -56,6 +56,8 @@ |
719 private: | 678 private: |
720 version(GNU) { | 679 version(GNU) { |
721 // GDC is a filthy liar. It can't actually do inline asm. | 680 // GDC is a filthy liar. It can't actually do inline asm. |
722 +} else version(LLVMDC) { | 681 +} else version(LLVMDC) { |
723 + // I guess the same goes for llvmdc to some extent :( | 682 + // I guess the same goes for llvmdc to some extent :( |
724 } else version(D_InlineAsm_X86) { | 683 } else version(D_InlineAsm_X86) { |
725 /* Duplicate string s, with n times, substituting index for '@'. | 684 /* Duplicate string s, with n times, substituting index for '@'. |
726 * | 685 * |
727 Index: tango/stdc/stdlib.d | 686 Index: tango/stdc/stdlib.d |
728 =================================================================== | 687 =================================================================== |
729 --- tango/stdc/stdlib.d (revision 3950) | 688 --- tango/stdc/stdlib.d (revision 3954) |
730 +++ tango/stdc/stdlib.d (working copy) | 689 +++ tango/stdc/stdlib.d (working copy) |
731 @@ -94,6 +94,11 @@ | 690 @@ -94,6 +94,11 @@ |
732 { | 691 { |
733 void* alloca(size_t size); | 692 void* alloca(size_t size); |
734 } | 693 } |
740 else version( GNU ) | 699 else version( GNU ) |
741 { | 700 { |
742 private import gcc.builtins; | 701 private import gcc.builtins; |
743 Index: tango/stdc/stdarg.d | 702 Index: tango/stdc/stdarg.d |
744 =================================================================== | 703 =================================================================== |
745 --- tango/stdc/stdarg.d (revision 3950) | 704 --- tango/stdc/stdarg.d (revision 3954) |
746 +++ tango/stdc/stdarg.d (working copy) | 705 +++ tango/stdc/stdarg.d (working copy) |
747 @@ -13,6 +13,10 @@ | 706 @@ -13,6 +13,10 @@ |
748 { | 707 { |
749 public import std.c.stdarg; | 708 public import std.c.stdarg; |
750 } | 709 } |