eclipse / omr

Eclipse OMR™ Cross platform components for building reliable, high performance language runtimes
http://www.eclipse.org/omr
Other
941 stars 394 forks source link

Provide an implementation for findOrCreateLiteral in Z CodeGenerator #2180

Closed 0xdaryl closed 3 years ago

0xdaryl commented 6 years ago

The only implementation of findOrCreateLiteral() in the FrontEnd always ends in an unimplemented assertion, despite being on seemingly active code paths in the Z code generator. No known downstream project provides an implementation either.

This issue was discussed with @fjeremic prior to open-sourcing this code, and the following is a summary of our discussion at that time:

The FrontEnd::findOrCreateLiteral API is currently unimplemented and will assert when called. This API is used in several DFP (Decimal Floating Point) paths which are off by default. Historically, this function was only ever implemented by a static language compiler that was not open-sourced that leveraged those DFP features.

The task here is to deprecate the FrontEnd::findOrCreateLiteral API. We need to use OMR::Z::CodeGenerator::findOrCreateConstant instead which will return a constant data snippet. Note that the instructions currently using FrontEnd::findOrCreateLiteral (namely RX instruction format) do not support using constant data snippets, and this would also need to be implemented in such cases.

We do not have any tests in any downstream project to exercise these paths. Hence, part of the work for this task will be to create tests that can exercise them, possibly with Tril.

I will leave this issue marked as a "Discussion" until we decide on how to proceed. If we decide to provide an implementation then this will become an Epic task to track the work items.

0xdaryl commented 6 years ago

In the very short term, the findOrCreateLiteral function can move from the FrontEnd class into the OMR::Z::CodeGenerator class and the references fixed up. It will still be unimplemented.

0xdaryl commented 6 years ago

The sequence of staged PRs to simply move the function from FrontEnd class to the Z CodeGenerator is: