[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libunwind] Alloc and saving the return address

From: Johan Walles
Subject: [libunwind] Alloc and saving the return address
Date: Mon, 08 Dec 2003 18:24:54 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624


Here's the top of a dynamically generated Java method:

(gdb) disass 0x2000000062730010 0x2000000062730140
Dump of assembler code from 0x2000000062730010 to 0x2000000062730140:
0x2000000062730010:     [MII]       alloc r32=ar.pfs,5,4,0
0x2000000062730011:                 mov r33=b0
0x2000000062730012:                 adds r12=-16,r12
0x2000000062730020:     [MII]       add r35=r1,r0
0x2000000062730021:                 adds r34=40,r13;;
0x2000000062730022:                 nop.i 0x0
0x2000000062730030:     [MMI]       ld8 r34=[r34];;
0x2000000062730031:                 adds r15=104,r34
0x2000000062730032:                 nop.i 0x0;;
0x2000000062730040:     [MMI]       ld8 r15=[r15];;

The alloc instruction is first and the saving of the return address comes second. AFAIU, I should use _U_dyn_op_save_reg() to tell libunwind about the two instructions.

However, there is no guarantee that either the alloc or the mov r33=b0 is first in the method. Currently we don't move any of them, but because of instruction scheduling the save of the return address will start moving around rsn.

Even the alloc can potentially move around; imagine the following Java-like 

  if (foo) {
    return 42;
  } else {
    return callTheBarFunction();

What do I do in this case? Should I tell libunwind about two regions with one instruction in each? If so, and assuming either of the two instructions can be some place other than the first slot in a bundle, how do I address them?

  Cheers //Johan

reply via email to

[Prev in Thread] Current Thread [Next in Thread]