Skip to content
This repository has been archived by the owner on Jan 6, 2020. It is now read-only.

nanojit question #4

Open
dibyendumajumdar opened this issue Apr 5, 2017 · 0 comments
Open

nanojit question #4

dibyendumajumdar opened this issue Apr 5, 2017 · 0 comments

Comments

@dibyendumajumdar
Copy link

Hi @wmaddox3rd

I have noticed that in lirasm immediately after the LIR_start instruction, there are additional instructions to save registers.

    mLir->ins0(LIR_start);
    for (int i = 0; i < nanojit::NumSavedRegs; ++i)
        mLir->insParam(i, 1);

Similarly in LirHelper - this is done done in emitStart():

    // create params for saved regs -- processor specific
    for (int i=0; i < NumSavedRegs; i++) {
        LIns *p = lirout->insParam(i, 1); (void) p;
    }

In lirasm when a fragment is ended a guard is inserted:

    mFragment->lastIns =
        mLir->insGuard(LIR_x, NULL, createGuardRecord(createSideExit()))

I noticed that the registers saved initially are popped in the guard section.
Looking at the generated code it seems to me though that when the code fragment has 'ret' instructions then the guard will never be executed - so in that case the saved registers will not be restored?

Is it mandatory to include the guard?

Thanks and Regards

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant