[Mesa-dev] [PATCH 12/24] i965: Initialize registers' file to BAD_FILE.

Emil Velikov emil.l.velikov at gmail.com
Thu Nov 5 08:16:55 PST 2015


On 3 November 2015 at 18:02, Matt Turner <mattst88 at gmail.com> wrote:
> On Tue, Nov 3, 2015 at 8:05 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> On 3 November 2015 at 00:29, Matt Turner <mattst88 at gmail.com> wrote:
>>> The test (file == BAD_FILE) works on registers for which the constructor
>>> has not run because BAD_FILE is zero.  The next commit will move
>>> BAD_FILE in the enum so that it's no longer zero.
>>
>> Doesn't the DECLARE_RALLOC_CXX_OPERATORS macro and fs_reg::fs_reg()
>> kick in ? If not things look quite fragile and perhaps we should wire
>> them up.
>
> I don't know.
>
> I'm certainly in favor of actually constructing fs_regs...
>
> Ken was pretty horrified when I told him that we were just
> ralloc_arrary()ing fs_regs without calling the constructor, but he's
> partly to blame (commit commit 6928bea :)
>
> What's worse, ralloc_array() isn't even supposed to zero-initialize
> things. That's just an accident that's kind of hard to fix now.
>
> I could try to clean that stuff up, but again, this series is already
> cleaning plenty of stuff. If I stopped to fix every bug I saw...
For anyone interested (to answer my questions):

With the proper ctors in place one of these hunks is no longer needed.
For the remaining we need an extra (or to extend the) macro, because
as is, it doesn't override the new[] operator (and to actually use it
of course).

-Emil


More information about the mesa-dev mailing list