[Mesa-dev] main/hash_table.h vs program/hash_table.h

Eric Anholt eric at anholt.net
Sun Dec 22 17:14:31 PST 2013


Connor Abbott <cwabbott0 at gmail.com> writes:

> Hi,
>
> While looking at the GLSL IR code, I noticed that different parts of the
> code use 2 different hash table implementations. ir_loop_analysis,
> ir_variable_refcount, ir_clone, etc. use struct hash_table under
> program/hash_table.h, whereas ir_variable_refcount and link_uniform_blocks
> use struct hash_table under main/hash_table.h. So more code uses
> program/hash_table.h, but it seems based on git blame that
> main/hash_table.h is meant to be a replacement and therefore new code
> should use that - correct? If so, why was the rest of the code never
> converted over? Also, the fact that both versions use the same name (struct
> hash_table) seems to me like a potential source of confusion/chaos with
> accidentally using the wrong functions. It seems like if we include
> main/hash_table.h and program/hash_table.h and then use functions from both
> header files on the same structure (for example, using the wrong functions
> on the results of an analysis pass), then the compiler won't complain,
> leading to all sorts of debugging fun; actually that's something I didn't
> even think about until writing this. So why was the name kept the same for
> the (apparently) new version?

It would be nice to replace program/hash_table, though you have to be
careful in replacing due to the magic deleted and empty values that you
can't collide with.  There's no good reason that work wasn't completed
other than it taking time.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131222/8b60eede/attachment.pgp>


More information about the mesa-dev mailing list