[PATCH V2] libgccjit: Add new gcc_jit_context_new_blob entry point
David Malcolm
dmalcolm@redhat.com
Fri Sep 11 11:27:03 GMT 2020
On Fri, 2020-09-11 at 12:31 +0200, Andrea Corallo wrote:
> Hi Dave,
>
> thanks for the review!
>
> David Malcolm <dmalcolm@redhat.com> writes:
>
> [...]
>
> > Was there a reason for using reinterpret_cast here, rather than
> > static_cast?
>
> Yes the reason is that apparently we can't use static_cast for that:
>
> "error: invalid ‘static_cast’ from type ‘gcc_jit_lvalue*’ to type
> ‘gcc::jit::recording::global*’"
>
> Why is that is another question I fear I'm not very qualified to
> answer.
> If you feel is necessary and want to suggest some rework to improve
> this
> I'll be happy to put some effort in if you like.
It's because we're effectively downcasting from lvalue to global. This
is safe because of the check for
global->is_global ().
A slightly cleaner way to do it would be to have a dyn_cast_global
vfunc here rather than is_global, and to use the result - but I don't
think it matters.
[...]
> > > After applying the suggestions and having tested it I've
> > > installed
> the
> patch as 4ecc0061c40.
>
> Thanks!
Thanks
Dave
More information about the Jit
mailing list