Mercurial > projects > dstress
annotate run/m/memory_management_07_B.d @ 1630:d0efa3ae5522 default tip
run/mini/naked_asm5: New x86_64 ABI passes the arguments in reverse order.
author | David Nadlinger <code@klickverbot.at> |
---|---|
date | Sat, 23 Apr 2011 22:57:32 +0200 |
parents | 1802d6b67634 |
children |
rev | line source |
---|---|
1579
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
1 // $HeadURL$ |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
2 // $Date$ |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
3 // $Author$ |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
4 |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
5 // @author@ <david@acz.org> |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
6 // @date@ 2007-11-12 |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
7 // @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=1666 |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
8 // @desc@ [Issue 1666] New: 64-bit gdc programs cannot allocate large arrays |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
9 |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
10 module dstress.run.m.memory_management_07_B; |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
11 |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
12 int main(char[][] args){ |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
13 ubyte x[]; |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
14 size_t len = 1 << 29; |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
15 |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
16 try{ |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
17 x.length = len; |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
18 }catch(Exception e){ |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
19 // "out of memory" Exception |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
20 return 0; |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
21 } |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
22 |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
23 if(len != x.length){ |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
24 assert(0); |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
25 } |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
26 |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
27 // try to defeat "smart" cheaters |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
28 size_t step = 4096 - args.length; |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
29 for(size_t i = 0; i < len; i += step){ |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
30 x[i] = i & 0xFF; |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
31 } |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
32 |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
33 step = 4096 - ((args[0].length / 1000 + 1) % 13); |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
34 for(size_t i = 0; i < len; i += step){ |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
35 if((i & 0xFF) != x[i]){ |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
36 assert(0); |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
37 } |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
38 } |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
39 |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
40 return 0; |
1802d6b67634
[Issue 1666] New: 64-bit gdc programs cannot allocate large arrays
thomask
parents:
diff
changeset
|
41 } |