I apologize if i am wrong but i am struck with the following
But now i am trying to change the CALL to JMP
I do the following in Calling convention only if its a tail call
How to get the address of the CALL might be BranchOperand is just a label.
I get an error
********* START OF IR DUMP  Verify: right before Final MIR Expansion: < SystemAppCL, LDev; >.Helper ()V   FOR < SystemAppCL, LDev; >.Helper ()V
-13        LABEL0   Frequency:  1.0
0        ia32_add                ESP(I) AF CF OF PF SF ZF <-- -12
0        require_esp             0
0        require_esp             0
0        ia32_jmp                <unused>
0        advise_esp              0
-1        bbend                   BB0 (ENTRY)
Basic block BB0 (ENTRY)
    in: <none>
    normal out: EXIT1
    exceptional out: <none>
    May throw uncaught exceptions, implicit edge to EXIT
-13:        LABEL0
0:        ia32_add                ESP(I) AF CF OF PF SF ZF <-- -12
0:        require_esp             0
0:        require_esp             0
0:        ia32_jmp                <unused>
0:        advise_esp              0
-1:        bbend                   BB0 (ENTRY)

Basic block EXIT1
    in: BB0 (ENTRY)
    normal out: <none>
    exceptional out: <none>

*********   END OF IR DUMP  Verify: right before Final MIR Expansion: < SystemAppCL, LDev; >.Helper ()V   FOR < SystemAppCL, LDev; >.Helper ()V
VERIFY: right before Final MIR Expansion Unconditional branch     ia32_jmp                <unused> does not end its basic block BB0 (ENTRY)

On Thu, Jan 22, 2009 at 10:05 AM, David P Grove <groved@us.ibm.com> wrote:

Ian Rogers <ian.rogers@manchester.ac.uk> wrote on 01/21/2009 07:50:43 PM:

> Nivedita Puranik wrote:
> > Hello,
> >  I need to jump to a function _foo i.e JMP _foo  instead of Call _foo
> > I see JMP is always to a label within the same block
> > But i need to jump to a different function. Please Help I am struck

> Nivedita -- I told you that I believe you will have to create a new kind
> of instruction at the HIR level: a "jump to method" rather than a
> "call method". But perhaps Dave Grove or someone can offer more detailed
> guidance.
> (She's trying to do a more general form of tail call elimination.)
> Best wishes -- Eliot Moss

> Hi Nivedita & Eliot,
> I'd suggest that you probably need to create a new form of MIR_Call
> operation that during calling convention expansion [1] can be turned
> into a jmp (just as a syscall will get flipped into a call on the
> way to the assembler driver you can flip your pseudo instruction
> into a jmp). I think you want to reconsider using jmp as apposed to
> call, Intel processors have a return stack buffer (RSB) [2] that is
> used to predict the return address of return instructions. By using
> a jmp instruction you will cause the RSB to miss. Such a miss may
> cause around a 10% slowdown - our switch instructions in old Jikes
> RVM's caused the RSB to miss and fixing this caused a 10% speedup on
> some DaCapo benchmarks (those that had switches of >8 elements in
> their critical path).

This seems about right to me.  You'll want to somehow mark the HIR/LIR instruction as a tail call (most likely by adding a tail call boolean to the MethodOperand object).  When you get to calling convention expansion, this is where you'll want to do something different (use jmp instead of a call).  You may need to do some work in the assemblers to teach it about this instruction.

I think JMP is the right thing here (not call) because with a tail call you aren't going to be returning to the instruction after the JMP (that's the point).  So you want to leave the RSB unchanged because when you eventually do a RET, it will be to the last place you did a CALL from not from the place you did the JMP from.


This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
Jikesrvm-researchers mailing list