Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [omr-dev] Starting work on C front-end to OMR JIT

On 15 June 2018 at 16:00, Mark Stoodley <mstoodle@xxxxxxxxxx> wrote:
>
> That's very cool, Dibyendu! Good luck with extending what you have there and I hope you'll keep us aware of your progress. If we can help to ease the integration with the OMR compiler itself, please feel free to continue reaching out.
>

I managed to do initial codegen for strlen implementation (details
below) - but the generated assembly looks wrong - it seems to have a
jump to non-existent label.

strlen code: https://github.com/dibyendumajumdar/dmr_c/blob/master/tests/nano/strlen.c

Compiler trace log:
https://github.com/dibyendumajumdar/dmr_c/blob/master/tests/omr/strlen.log


No doubt I am doing something wrong.

Stuff I am not clear about:

1. Blocks - if I need 5 blocks should I allocate 5 or does the
compiler need additional blocks?
2. I am using OMR::IlInjector::createBlocks(int32_t num) to create
blocks. I notice that it does some linking of blocks - should I worry
about that?
3. I am unclear how to generate conditional branches. First I tried:

 - IfCmp cond goto BlockX
 - Goto BlockY

The compiler complained about the CFG.
So I changed it to:

 - IfCmp cond goto BlockX
 - IfCmp !cond goto BlockY

Compiler seems happy but the generated code appears to be wrong (jumps
to non-existent label).

What is the correct way to do this? I don't want to fall through to
next block on true/false as it may not be the right block to go to.

Perhaps you can tell from the trace log above what I am doing wrong.

Note that I am using two local stack symbols (created as byte array) for n/s.

Thanks and Regards
Dibyendu


Back to the top