Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[omr-dev] Symbol refs, shadow refs and aliasing

Hi,

Now that I have the basic JIT backend working I want to address an
area that is deficient in my implementation. This is to do with how
local stack values are handled. Currently I am defining all local vars
as byte arrays and using array store/load ops but I don't know how
good the optimizer is in figuring out that an array is really a scalar
value. I suspect it is not doing a good job but I am not sure.

Ideally I want to provide as much information to the compiler as
possible but I am not sure of the mechanics of doing so. I have read
the docs and am looking at code in TypeDictionary etc. but it would be
more helpful to have specific answers / examples for the following:


1. If a value is scalar but represented as an aggregate and accessed
using array store/load - is this bad for the optimizer?

2. For scalar local values should I used loadTemporary and storeTemporary ops?

3. What aliasing or shadow information do I need to provide for above?

I am using local byte arrays to represent aggregates. An aggregate may
be any C structure such as structs or unions or arrays etc. I use
array load/store to access values in the aggregate.

I don't even know how to phrase my question here but basically I want
to be able to tell the compiler as much as possible about the
aggregate access. From the little I understand so far:

5. Do I need separate (distinct) shadow symrefs for every load /store
? Can a shadow symref be reused - and if so under what conditions?

6. Does a shadow ref need to have an offset ?

7. What if the shadow ref is accessing a part of the aggregate that is
at a runtime computed offset,
e.g. an array index?

I am currently using following shadow ref code:

auto array_offset = get_array_element_address(injector, type, base, index);
auto loadOp = TR::ILOpCode::indirectLoadOpCode(type);
TR::SymbolReference *symRef =
injector->symRefTab()->findOrCreateArrayShadowSymbolRef(type, base);
TR::Node *load = TR::Node::createWithSymRef(loadOp, 1, array_offset, 0, symRef);

I do not understand what I am doing here - but basically it seems to
me that I may be reusing the same shadow symbol ref for disparate
local aggregate objects as the shadow ref lookup is only based on the
type being accessed. Do all shadow refs for a particular object type /
or local instance of object need to be distinct?

I am reading the docs and looking at the code in OMR to work all this
out ... but sadly it isn't clear to me yet how this is supposed to be
used. If the OMR team can provide me some detailed guidance / examples
of each of the scenarios above that would be very much appreciated.

Many thanks

Regards
Dibyendu


Back to the top