* src/vm/jit/dseg.c (dseg_addlinenumber_inline_start): Added.
(dseg_addlinenumber_inline_end): Added.
(dseg_addlinenumber): Commented.
(vim boilerplate): Added.
* src/vm/jit/dseg.h (linenumberref): Changed for inlining stacktraces.
Made targetmpc a ptrint, made linenumber s4, reordered fields.
(dseg_addlinenumber_inline_start): Added.
(dseg_addlinenumber_inline_end): Added.
(vim boilerplate): Added.
--- /dev/null
+Stacktraces with Inlined Methods
+================================
+
+Author: Edwin Steiner
+Changes: -
+
+
+The layout of the line number table looks like this:
+
+ +----------+----------------------+
+ | ln 1 | start PC of line 1 |
+ +----------+----------------------+
+ | ln 2 | start PC of line 2 |
+ +----------+----------------------+
+ ...
+ +----------+----------------------+
+ | ln N | start PC of line N |
+ +----------+----------------------+
+
+Note: "ln 1" means the line number of the first line of the method body,
+ and so on.
+
+
+For inlined methods special entries are inserted into the table. The special
+entries have negative line numbers. If there is an inlined method call at line
+X, the table looks like this:
+
+ +----------+----------------------+
+ | ln 1 | start PC of line 1 |
+ +----------+----------------------+
+ | ln 2 | start PC of line 1 |
+ +----------+----------------------+
+ ...
+ +----------+----------------------+
+ | -2 | start PC of line X | <-- "-2" marks start of inlined method
+ +----------+----------------------+
+ | ln 1' | start PC of line 1' | \
+ +----------+----------------------+ |
+ | ln 2' | start PC of line 1' | |
+ +----------+----------------------+ |--- these refer to lines within the body of
+ ... | the inlined callee
+ +----------+----------------------+ |
+ | ln N' | start PC of line N' | /
+ +----------+----------------------+
+ | -3-ln X | methodinfo* to callee| <-- methodinfo* instead of PC, -3 minus line number
+ +----------+----------------------+
+ | -1 | start PC of line X | <-- NOTE THE PC!
+ +----------+----------------------+
+ | ln X+1 | start PC of line X+1 |
+ +----------+----------------------+
+ ...
+ +----------+----------------------+
+ | ln N | start PC of line N |
+ +----------+----------------------+
+
+
+# vim: et sw=4 sts=4 ts=4
+
Changes: Christian Thalinger
Joseph Wenninger
- $Id: dseg.c 4357 2006-01-22 23:33:38Z twisti $
+ $Id: dseg.c 4445 2006-02-05 15:26:34Z edwin $
*/
#include "vm/types.h"
+#include <assert.h>
#include "mm/memory.h"
#include "vm/jit/codegen-common.h"
}
+/* dseg_addlinenumber **********************************************************
+
+ Add a line number reference.
+
+ IN:
+ cd.............current codegen data
+ linenumber.....number of line that starts with the given mcodeptr
+ mcodeptr.......start mcodeptr of line
+
+*******************************************************************************/
+
void dseg_addlinenumber(codegendata *cd, u2 linenumber, u1 *mcodeptr)
{
linenumberref *lr;
}
+/* dseg_addlinenumber_inline_start *********************************************
+
+ Add a marker to the line number table indicating the start of an inlined
+ method body. (see doc/inlining_stacktrace.txt)
+
+ IN:
+ cd.............current codegen data
+ iptr...........the ICMD_INLINE_START instruction
+ mcodeptr.......start mcodeptr of inlined body
+
+*******************************************************************************/
+
+void dseg_addlinenumber_inline_start(codegendata *cd,
+ instruction *iptr,
+ u1 *mcodeptr)
+{
+ linenumberref *lr;
+
+ lr = DNEW(linenumberref);
+
+ lr->linenumber = (-2); /* marks start of inlined method */
+ lr->tablepos = 0;
+ lr->targetmpc = mcodeptr - cd->mcodebase;
+ lr->next = cd->linenumberreferences;
+
+ cd->linenumberreferences = lr;
+
+ iptr->target = mcodeptr; /* store for corresponding INLINE_END */
+}
+
+
+/* dseg_addlinenumber_inline_end ***********************************************
+
+ Add a marker to the line number table indicating the end of an inlined
+ method body. (see doc/inlining_stacktrace.txt)
+
+ IN:
+ cd.............current codegen data
+ iptr...........the ICMD_INLINE_END instruction
+
+ Note:
+ iptr->method must point to the inlined callee.
+
+*******************************************************************************/
+
+void dseg_addlinenumber_inline_end(codegendata *cd, instruction *iptr)
+{
+ linenumberref *lr;
+ linenumberref *prev;
+ instruction *inlinestart;
+
+ /* get the pointer to the corresponding ICMD_INLINE_START */
+ inlinestart = (instruction *)iptr->target;
+
+ assert(inlinestart);
+ assert(iptr->method);
+
+ lr = DNEW(linenumberref);
+
+ /* special entry containing the methodinfo * */
+ lr->linenumber = (-3) - iptr->line;
+ lr->tablepos = 0;
+ lr->targetmpc = (ptrint) iptr->method;
+ lr->next = cd->linenumberreferences;
+
+ prev = lr;
+ lr = DNEW(linenumberref);
+
+ /* end marker with PC of start of body */
+ lr->linenumber = (-1);
+ lr->tablepos = 0;
+ lr->targetmpc = (u1*)inlinestart->target - cd->mcodebase;
+ lr->next = prev;
+
+ cd->linenumberreferences = lr;
+}
+
+
/* dseg_createlinenumbertable **************************************************
Creates a line number table in the data segment from the created
* c-basic-offset: 4
* tab-width: 4
* End:
+ * vim:noexpandtab:sw=4:ts=4:
*/
Changes: Christian Thalinger
Joseph Wenninger
- $Id: dseg.h 4357 2006-01-22 23:33:38Z twisti $
+ $Id: dseg.h 4445 2006-02-05 15:26:34Z edwin $
*/
struct linenumberref {
s4 tablepos; /* patching position in data segment */
- s4 targetmpc; /* machine code program counter of first */
+ s4 linenumber; /* line number, used for inserting into the */
+ /* table and for validity checking */
+ /* -1......start of inlined body */
+ /* -2......end of inlined body */
+ /* <= -3...special entry with methodinfo * */
+ /* (see doc/inlining_stacktrace.txt) */
+ ptrint targetmpc; /* machine code program counter of first */
/* instruction for given line */
- u2 linenumber; /* line number, used for inserting into the */
- /* table and for validty checking */
+ /* NOTE: for linenumber <= -3 this is a the */
+ /* (methodinfo *) of the inlined method */
linenumberref *next; /* next element in linenumberref list */
};
void dseg_addlinenumbertablesize(codegendata *cd);
void dseg_addlinenumber(codegendata *cd, u2 linenumber, u1 *ptr);
+void dseg_addlinenumber_inline_start(codegendata *cd, instruction *iptr, u1 *ptr);
+void dseg_addlinenumber_inline_end(codegendata *cd, instruction *iptr);
void dseg_createlinenumbertable(codegendata *cd);
* c-basic-offset: 4
* tab-width: 4
* End:
+ * vim:noexpandtab:sw=4:ts=4:
*/