GC.BlkAttr.FINALIZE
Steven Schveighoffer
schveiguy at yahoo.com
Mon Mar 3 14:37:58 PST 2014
On Mon, 03 Mar 2014 15:34:18 -0500, Namespace <rswhite4 at googlemail.com>
wrote:
> On Monday, 3 March 2014 at 18:36:56 UTC, Steven Schveighoffer wrote:
>> On Mon, 03 Mar 2014 12:03:12 -0500, Namespace <rswhite4 at googlemail.com>
>> wrote:
>>
>>> On Monday, 3 March 2014 at 02:44:09 UTC, Namespace wrote:
>>>> It's working now, I get all my debug infos I need.
>>>> But: I have absolutly no idea how to get the correct TypeInfo in
>>>> rt_finalize2. The ClassInfo is identified by casting the void*
>>>> pointer to a void** and then cast this void** to ClassInfo*. But for
>>>> other TypeInfos this weird trick doesn't work. How can I extract the
>>>> correct TypeInfo from this void**? :P
>>>
>>> I get the real TypeInfo (not sure if this was intended this way) and
>>> in my test base it works! But in druntime I get the weird error:
>>> src\rt\lifetime.d(1256): Error: variable a1 used before set
>>>
>>> ----
>>> if (gc_getAttr(p) & BlkAttr.APPENDABLE)
>>> {
>>> void[] a1 = *cast(void[]*) ppv;
>>> //printf("len = %d\n", a1.length);
>>>
>>> void* p_a1 = &a1;
>>> void* tp = p_a1 + 12;
>>>
>>> TypeInfo* ti = cast(TypeInfo*) tp;
>>>
>>> import std.string : toStringz;
>>> string s = ti.toString(); // line 1256
>>> printf("Type = %s\n", toStringz(s));
>>>
>>> return;
>>> }
>>> ----
>>>
>>> Any call to ti will invoke the error. Any idea why?
>>
>> Not really any clue.
>>
>> But if this is in druntime, it should not be importing anything from
>> std.
>
> Even without I get this weird error. Is this a bug?
It sounds suspicious. Clearly, you are not accessing a1 there, and clearly
a1 is set before being used.
Any chance to reduce it?
-Steve
More information about the Digitalmars-d-learn
mailing list