T.R | Title | User | Personal Name | Date | Lines |
---|
42.1 | comments on issue 37 from David C. P. LaFrance-Linden | SMURF::LOWELL | | Thu Dec 05 1996 16:32 | 3 |
42.2 | assigned | SMURF::LOWELL | | Fri Dec 06 1996 14:53 | 1 |
42.3 | Details of procedure weight | TLE::DMURPHY | | Tue Feb 25 1997 10:14 | 130 |
|
This note covers the review of routine weight indicators in the symbol
table taken as an action item by Bob Monteleone and myself.
The informatin in the symbol table's procedure descriptors indicate
whether a routine is of weight as follows:
o heavy - bit 26 of the register mask is set ON.
o light - reg_frame set ON & regoffset set to ra_save
o null - reg_frame set ON & regoffset = 26
If anyone notes problems/issues with the explanation please
follow up.
Here's an exerpt from /usr/include/sym.h to indicate the location of
reg_frame:
unsigned gp_prologue : 8; /* byte size of GP prologue */
unsigned gp_used : 1; /* true if the procedure uses GP */
unsigned reg_frame : 1; /* true if register frame procedure */
unsigned prof : 1; /* true if compiled with -pg */
Here's the dump of a toy program with heavy & null weight routines:
***PROCEDURE DESCRIPTOR TABLE***
name prof rfrm isym iline iopt regmask regoff fpoff fp
address guse gpro lnOff lnLow lnHigh fregmask frgoff lcloff pc
t.o:
foo1 0 1 1 0 -1 0x00000000 26 0 30
0x0000000000000000 0 0 0 1 5 0x00000000 0 0 26
foo2 0 0 5 4 -1 0x04000000 -16 16 30
0x0000000000000010 1 8 2 7 11 0x00000000 0 0 26
main 0 0 9 20 -1 0x04000000 -16 16 30
0x0000000000000050 1 8 5 13 17 0x00000000 0 0 26
and the toy program
int foo1() {
return 1;
}
static int foo2() {
return foo1();
}
int main() {
return foo2();
}
Here's what a lightweigh procedure looks like:
main 0 1 20 -1 -1 0x00000000 1 0 30
0x0000000000000140 0 0 -1 43 48 0x00000000 0 0 26
We know it's lightweight as r26 in the mawk is off and the regoffset
~= 26.
Here's the GEM code that documents the implementation:
! Having set the pcreg field, for heavywieght routines
! set bit 26 in the imask, for lightweight routines
! set the reg_frame indicator and store the savera
! value in the regoffset field. For nullweight routines,
! set the reg_frame indicator and store R26 in the
! regoffset field.
!
if .RTN_BLOCK[GEM_BLK_HEAVYWEIGHT]
then
begin
PM = PD[REGMASK];
PM[26] = 1;
end
else
begin
PD[REG_FRAME] = true;
if .RTN_BLOCK[GEM_BLK_LIGHTWEIGHT]
then
! Lightweight routine
!
PD[REGOFFSET] = .RTN_BLOCK[GEM_BLK_RA_SAVE]
else
! Nullweight routine
!
PD[REGOFFSET] = GEM_TS_REG_K_R26;
Here's a better odump:
***PROCEDURE DESCRIPTOR TABLE***
name prof rfrm isym iline iopt regmask regoff fpoff fp
address guse gpro lnOff lnLow lnHigh fregmask frgoff lcloff pc
testassert.o:
<stripped> [0 for 3]
deb_assert(char*, char*, int) 0 0 18 -1 -1 0x04000e00 -32
32
30
0x0000000000000000 1 8 -1 4 28 0x00000000 0 0 26
foo(void) 0 1 19 -1 -1 0x00000000 26 0 30
0x0000000000000138 0 0 -1 37 41 0x00000000 0 0 26
main 0 1 20 -1 -1 0x00000000 1 0 30
0x0000000000000140 0 0 -1 43 48 0x00000000 0 0 26
that show's all three weights:
deb_assert is heavy weight: rfrm = 0 regmask[r26] = 1
foo is null weight: rfrm = 1 regoffset = 26
main is light weight: rfrm = 1 regoffset = 1
|
42.4 | approved | SMURF::LOWELL | | Tue Mar 04 1997 10:44 | 7 |
| There haven't been any comments on Dennis' writeup, so it has
been approved.
This description needs to be added to Michelle's spec. The writeup
is based on existing features of the object/symbol table, so no
tool, header or library changes are required.
|
42.5 | Why is this needed? | WIBBIN::NOYCE | Pulling weeds, pickin' stones | Mon Mar 10 1997 15:39 | 3 |
| Could someone explain why the debugger needs to know
whether a routine is light, heavy, or null in order to
call it? Compiled code doesn't need to know...
|
42.6 | So that we can call the routine | VIRRUS::diewald | Here In Soap Opera Central... | Mon Mar 10 1997 16:58 | 18 |
| A debugger that wants to be able to call the routine from the
command line needs to know how to set up the call.
For example:
(ladebug) whatis x
class Foo {
.
.
void dump (void); // dumper routine for class
}
(ladebug) call x->dump()
Since we want to be able to do this with any arbitrary procedure,
we have to know how the compiler set up the routine.
Jeff Diewald
Ladebug team
|
42.7 | | ADA9X::BRETT | | Tue Mar 11 1997 07:44 | 4 |
| But the caller's set-up for the call is, if I understand Bill and the calling
standard properly, independent of the called routines 'weight'.
/Bevin
|
42.8 | | TLE::DMURPHY | | Fri Apr 18 1997 11:51 | 20 |
| > Could someone explain why the debugger needs to know
> whether a routine is light, heavy, or null in order to
> call it? Compiled code doesn't need to know...
Bill, I seem to remember looking at a debugger stack trace related to a C++
exception. I thought at the time that proper understanding of a functions
weight would have helped.
The reason for documenting the function weight is that its being
written to the object files by the compilers, presumably its being
read by somone.
The proper place for any information represented in the object file
is in this document.
Dennis
|
42.9 | | SMURF::LOWELL | | Mon Apr 21 1997 13:25 | 2 |
| Dennis' writeup on determining call frame weight has been
added to the object spec. This issue is now closed.
|