comparison tango/lib/compiler/llvmdc/lifetime.d @ 137:ce7b81fb957f trunk

[svn r141] fixed more problems with classinfo moved more IR state out of the AST classes
author lindquist
date Fri, 18 Jan 2008 16:42:16 +0100
parents 44a95ac7368a
children e881c9b1c738
comparison
equal deleted inserted replaced
136:0e28624814e8 137:ce7b81fb957f
25 * Authors: Walter Bright, Sean Kelly, Tomas Lindquist Olsen 25 * Authors: Walter Bright, Sean Kelly, Tomas Lindquist Olsen
26 */ 26 */
27 module lifetime; 27 module lifetime;
28 28
29 //debug=PRINTF; 29 //debug=PRINTF;
30 debug=PRINTF2; 30 //debug=PRINTF2;
31 31
32 private 32 private
33 { 33 {
34 import tango.stdc.stdlib; 34 import tango.stdc.stdlib;
35 import tango.stdc.string; 35 import tango.stdc.string;
87 */ 87 */
88 extern (C) Object _d_newclass(ClassInfo ci) 88 extern (C) Object _d_newclass(ClassInfo ci)
89 { 89 {
90 void* p; 90 void* p;
91 91
92 debug(PRINTF) printf("_d_newclass(ci = %p, %s)\n", ci, cast(char *)ci.name.ptr); 92 debug(PRINTF2) printf("_d_newclass(ci = %p, %s)\n", ci, cast(char *)ci.name.ptr);
93 /+ 93 /+
94 if (ci.flags & 1) // if COM object 94 if (ci.flags & 1) // if COM object
95 { /* COM objects are not garbage collected, they are reference counted 95 { /* COM objects are not garbage collected, they are reference counted
96 * using AddRef() and Release(). They get free'd by C's free() 96 * using AddRef() and Release(). They get free'd by C's free()
97 * function called by Release() when Release()'s reference count goes 97 * function called by Release() when Release()'s reference count goes
107 p = gc_malloc(ci.init.length, 107 p = gc_malloc(ci.init.length,
108 BlkAttr.FINALIZE | (ci.flags & 2 ? BlkAttr.NO_SCAN : 0)); 108 BlkAttr.FINALIZE | (ci.flags & 2 ? BlkAttr.NO_SCAN : 0));
109 debug(PRINTF2) printf(" p = %p\n", p); 109 debug(PRINTF2) printf(" p = %p\n", p);
110 } 110 }
111 111
112 debug(PRINTF) 112 debug(PRINTF2)
113 { 113 {
114 printf("p = %p\n", p); 114 printf("p = %p\n", p);
115 printf("ci = %p, ci.init = %p, len = %d\n", ci, ci.init, ci.init.length); 115 printf("ci = %p, ci.init = %p, len = %d\n", ci, ci.init.ptr, ci.init.length);
116 printf("vptr = %p\n", *cast(void**) ci.init); 116 printf("vptr = %p\n", *cast(void**) ci.init.ptr);
117 printf("vtbl[0] = %p\n", (*cast(void***) ci.init)[0]); 117 printf("vtbl[0] = %p\n", (*cast(void***) ci.init.ptr)[0]);
118 printf("vtbl[1] = %p\n", (*cast(void***) ci.init)[1]); 118 printf("vtbl[1] = %p\n", (*cast(void***) ci.init.ptr)[1]);
119 printf("init[0] = %x\n", (cast(uint*) ci.init)[0]); 119 printf("init[0] = %p\n", (cast(uint**) ci.init.ptr)[0]);
120 printf("init[1] = %x\n", (cast(uint*) ci.init)[1]); 120 printf("init[1] = %p\n", (cast(uint**) ci.init.ptr)[1]);
121 printf("init[2] = %x\n", (cast(uint*) ci.init)[2]); 121 printf("init[2] = %p\n", (cast(uint**) ci.init.ptr)[2]);
122 printf("init[3] = %x\n", (cast(uint*) ci.init)[3]); 122 printf("init[3] = %p\n", (cast(uint**) ci.init.ptr)[3]);
123 printf("init[4] = %x\n", (cast(uint*) ci.init)[4]); 123 printf("init[4] = %p\n", (cast(uint**) ci.init.ptr)[4]);
124 } 124 }
125 125
126 // initialize it 126 // initialize it
127 // llvmdc does this inline 127 // llvmdc does this inline
128 //(cast(byte*) p)[0 .. ci.init.length] = ci.init[]; 128 //(cast(byte*) p)[0 .. ci.init.length] = ci.init[];