annotate run/delete_01.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 f07f77e65213
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
379
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
1 // $HeadURL$
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
2 // $Date$
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
3 // $Author$
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
4
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
5 // @WARNING@ direct usage of Phobos's GC
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
6
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
7 module dstress.run.delete_01;
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
8 import std.gc;
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
9
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
10 int status;
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
11
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
12 class MyClass{
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
13 ~this(){
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
14 assert(status==0);
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
15 status--;
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
16 }
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
17
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
18 delete(void* p){
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
19 assert(status==-1);
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
20 status--;
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
21 }
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
22 }
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
23
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
24 void test(){
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
25 MyClass c=new MyClass();
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
26 assert(status==0);
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
27 delete c;
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
28 }
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
29
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
30 int main(){
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
31 test();
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
32 assert(status<=-1);
380
f07f77e65213 added std.gc.minimze call to std.gc.fullCollect
thomask
parents: 379
diff changeset
33 std.gc.fullCollect();
f07f77e65213 added std.gc.minimze call to std.gc.fullCollect
thomask
parents: 379
diff changeset
34 std.gc.minimize();
379
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
35 assert(status==-2);
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
36 return 0;
60b4ba82210e added tests for custom deallocators
thomask
parents:
diff changeset
37 }