Re: [rvm-research] [External Email] Re: Quick Question about genThreadSwitchTest code Intention

Khaled Z Mahmoud <[email protected]> Wed, 25 Nov 2020 16:13:10 -0500
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <CAER=_eVWUorJJajRMb9Ycz82Df-O+DN6wxp6n-ihVSLS-wdhLg@mail.gmail.com>
Hi,

Thanks for your explanation.
So, anything between Point A and Point B will be jumped over if the
condition is met.
Is my understanding correct ? I had a reverse understanding of it.


Point A - fr1 = asm.forwardJcc(EQ)
          ..........
Point B -  fr1.resolve(asm);

On Wed, Nov 25, 2020 at 3:45 PM David P Grove <[email protected]> wrote:
>
> Khaled Z Mahmoud <[email protected]> wrote on 11/23/2020 01:25:16 AM:
> >
> > In method genThreadSwitchTest, Line Number: 4190
> > Line:4197
> > --> asm.emitCMP_RegDisp_Imm(THREAD_REGISTER,
> > Entrypoints.takeYieldpointField.getOffset(), 0);
> >
> > // Take yieldpoint if yieldpoint flag is non-zero (either 1 or -1)
> > fr1 = asm.forwardJcc(EQ);
> > yieldOffset = Entrypoints.yieldpointFromPrologueMethod.getOffset();
> >
> > My question is :
> > fr1 = asm.forwardJcc(EQ) --> The condition works if "takeYieldpoint==0".
> > So either, the comment is wrong, or the intention of the code is wrong.
>
> Hi,
>
> The comment is correct.  The code is generating a branch around a call to the yieldpointFromPrologueMethod.  Therefore, the test is inverted.  Test succeeds, jump over the call (no yieldpoint). Test fails, don't jump, fall through and execute the call to yieldpoint method.
>
> --dave
>
>
>
> >
> > With no Adaptive Optimization System enabled, the yieldpoint will be
> > invoked every time. However, this is not a big deal, since it
> > virtually does nothing when the Adaptive System is disabled.
> >
> > I am asking this question to understand things just a little bit deeper.
> > So, it should be:
> > asm.emitCMP_RegDisp_Imm(THREAD_REGISTER,
> > Entrypoints.takeYieldpointField.getOffset(), 1);
> >
> >
>
> _______________________________________________
> Jikesrvm-researchers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers



-- 
Regards,
Khaled Mahmoud