* doc/inlining_stacktrace.txt: Added warning about signedness.
[cacao.git] / doc / inlining_stacktrace.txt
1 Stacktraces with Inlined Methods
2 ================================
3
4 Author:  Edwin Steiner
5 Changes: -
6
7
8 The layout of the line number table looks like this:
9
10     +----------+----------------------+
11     | ln 1     | start PC of line 1   |
12     +----------+----------------------+
13     | ln 2     | start PC of line 2   |
14     +----------+----------------------+
15                        ...
16     +----------+----------------------+
17     | ln N     | start PC of line N   |
18     +----------+----------------------+
19
20 Note: "ln 1" means the line number of the first line of the method body,
21       and so on.
22
23
24 For inlined methods special entries are inserted into the table. The special
25 entries have negative line numbers.  If there is an inlined method call at line
26 X, the table looks like this:
27
28     +----------+----------------------+
29     | ln 1     | start PC of line 1   |
30     +----------+----------------------+
31     | ln 2     | start PC of line 2   |
32     +----------+----------------------+
33                       ...
34     +----------+----------------------+
35     | -2       | start PC of line X   |  <-- "-2" marks start of inlined method
36     +----------+----------------------+
37     | ln 1'    | start PC of line 1'  |  \
38     +----------+----------------------+  |
39     | ln 2'    | start PC of line 2'  |  |
40     +----------+----------------------+  |--- these refer to lines within the body of
41                       ...                    |    the inlined callee
42     +----------+----------------------+  |
43     | ln N'    | start PC of line N'  |  /
44     +----------+----------------------+
45     | -3-ln X  | methodinfo* to callee|  <-- methodinfo* instead of PC, -3 minus line number
46     +----------+----------------------+
47     | -1       | start PC of line X   |  <-- NOTE THE PC!
48     +----------+----------------------+
49     | ln X+1   | start PC of line X+1 |
50     +----------+----------------------+
51                       ...
52     +----------+----------------------+
53     | ln N     | start PC of line N   |
54     +----------+----------------------+
55
56 CAUTION: line numbers are stored as unsigned ptrint! You need
57          to cast them (to s4) in order to test <0, etc.
58          (The ptrint values are created by casting a s4 to ptrint.)
59
60
61 # vim: et sw=4 sts=4 ts=4
62