Target Environment - Cross-compilation

Andrew Haley aph at
Fri Jan 20 09:31:19 UTC 2017

On 19/01/17 23:55, David Clarke wrote:

> So on x86 we want to optimise away a full fence that immediately
> follows a weakCompareAndSet and on ARM, we don’t.  This could be
> delayed until the code generation phase, but I would like to keep
> the optimisations at the IR or LIR level so that we retain the
> greatest generality for as long as possible and avoid repeating
> similar code in several distinct code generation phases.

There's a related problem on ARMv8.  At the present time we emit
fences very early, which means that we don't generate the STLR/LDAR
instructions we really want for Java volailes.  At the very least this
is inefficient.

> So my questions are “How can the code within a Node find out the
> target environment?" and “Can we fiddle this so that the target
> environment is different from the actual host environment?”

I think that the real answer is to handle all of this properly in the
Graal IR by lowering the nodes in a way that is controlled by the back
end.  This will mean that the compiler will have to be taught about
how to handle the nodes appropriately.


More information about the graal-dev mailing list