digitalmars.D.learn - Finding source of typeid use
- Nicholas Wilson (45/45) Jul 07 2017 My library is generating a typeid from somewhere.
- Nicholas Wilson (3/7) Jul 07 2017 It seems to be coming from the need to hash the type, goodness
- rikki cattermole (2/11) Jul 07 2017 https://github.com/dlang/druntime/blob/master/src/object.d#L253 Maybe?
- Nicholas Wilson (5/17) Jul 07 2017 No, the culprit is
- Rainer Schuetze (3/21) Jul 08 2017 I suspect this is generated while building the hash function for your
- Nicholas Wilson (8/32) Jul 08 2017 Hmm, I found needToHash(StructDeclaration sd) which enumerates
My library is generating a typeid from somewhere. e.g. typeid(const(Pointer!(cast(AddrSpace)1u, float))) but I have never declared a const of that type nor have I used typeid explicitly in my program. Where is this coming from? The program is just: enum AddrSpace { Global, Shared } struct Pointer(AddrSpace n,T) { T* ptr; } private import std.traits; struct AutoIndexed(T) if (isInstanceOf(T,Pointer)) { T p = void; enum n = TemplateArgsOf!(T)[0]; alias U = TemplateArgsOf!(T)[1]; static assert(n == AddrSpace.Global || n == AddrSpace.Shared); property U index() { static if (n == AddrSpace.Global) return p[0]; //Some calculation else static if (n == AddrSpace.Shared) return p[0];// ditto } property void index(U t) { static if (n == AddrSpace.Global) p[0] = t; // ditto else static if (n == AddrSpace.Shared) p[0] = t; // ditto } disable this(); alias index this; } alias aagf = AutoIndexed!(GlobalPointer!(float)); kernel void auto_index_test(aagf a, aagf b, aagf c) { a = b + c; }
Jul 07 2017
On Friday, 7 July 2017 at 08:49:58 UTC, Nicholas Wilson wrote:My library is generating a typeid from somewhere. e.g. typeid(const(Pointer!(cast(AddrSpace)1u, float))) [...]It seems to be coming from the need to hash the type, goodness knows why, which explains why I only get the const variety.
Jul 07 2017
On 08/07/2017 2:35 AM, Nicholas Wilson wrote:On Friday, 7 July 2017 at 08:49:58 UTC, Nicholas Wilson wrote:https://github.com/dlang/druntime/blob/master/src/object.d#L253 Maybe?My library is generating a typeid from somewhere. e.g. typeid(const(Pointer!(cast(AddrSpace)1u, float))) [...]It seems to be coming from the need to hash the type, goodness knows why, which explains why I only get the const variety.
Jul 07 2017
On Saturday, 8 July 2017 at 05:36:49 UTC, rikki cattermole wrote:On 08/07/2017 2:35 AM, Nicholas Wilson wrote:No, the culprit is https://github.com/dlang/druntime/blob/master/src/object.d#L1128 but IDK why it is being generated in the first place since nothing I wrote relies on being able to hash it.On Friday, 7 July 2017 at 08:49:58 UTC, Nicholas Wilson wrote:https://github.com/dlang/druntime/blob/master/src/object.d#L253 Maybe?My library is generating a typeid from somewhere. e.g. typeid(const(Pointer!(cast(AddrSpace)1u, float))) [...]It seems to be coming from the need to hash the type, goodness knows why, which explains why I only get the const variety.
Jul 07 2017
On 08.07.2017 07:55, Nicholas Wilson wrote:On Saturday, 8 July 2017 at 05:36:49 UTC, rikki cattermole wrote:I suspect this is generated while building the hash function for your Pointer struct in buildXtoHash in ddmd/clone.d.On 08/07/2017 2:35 AM, Nicholas Wilson wrote:No, the culprit is https://github.com/dlang/druntime/blob/master/src/object.d#L1128 but IDK why it is being generated in the first place since nothing I wrote relies on being able to hash it.On Friday, 7 July 2017 at 08:49:58 UTC, Nicholas Wilson wrote:https://github.com/dlang/druntime/blob/master/src/object.d#L253 Maybe?My library is generating a typeid from somewhere. e.g. typeid(const(Pointer!(cast(AddrSpace)1u, float))) [...]It seems to be coming from the need to hash the type, goodness knows why, which explains why I only get the const variety.
Jul 08 2017
On Saturday, 8 July 2017 at 08:56:17 UTC, Rainer Schuetze wrote:On 08.07.2017 07:55, Nicholas Wilson wrote:Hmm, I found needToHash(StructDeclaration sd) which enumerates the fields If a field is a struct recurse, makes sense if the struct has an alias this, which Pointer does, generate a typeinfo, with a note to see https://issues.dlang.org/show_bug.cgi?id=14948 / dmdPR 5001.On Saturday, 8 July 2017 at 05:36:49 UTC, rikki cattermole wrote:I suspect this is generated while building the hash function for your Pointer struct in buildXtoHash in ddmd/clone.d.On 08/07/2017 2:35 AM, Nicholas Wilson wrote:No, the culprit is https://github.com/dlang/druntime/blob/master/src/object.d#L1128 but IDK why it is being generated in the first place since nothing I wrote relies on being able to hash it.On Friday, 7 July 2017 at 08:49:58 UTC, Nicholas Wilson wrote:https://github.com/dlang/druntime/blob/master/src/object.d#L253 Maybe?My library is generating a typeid from somewhere. e.g. typeid(const(Pointer!(cast(AddrSpace)1u, float))) [...]It seems to be coming from the need to hash the type, goodness knows why, which explains why I only get the const variety.
Jul 08 2017