/* src/vm/jit/dseg.c - data segment handling stuff
- Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
J. Wenninger, Institut f. Computersprachen - TU Wien
Joseph Wenninger
Edwin Steiner
- $Id: dseg.c 6066 2006-11-27 15:29:40Z edwin $
*/
#include <assert.h>
-#include "vm/options.h"
#include "vm/types.h"
#include "mm/memory.h"
#include "vm/jit/codegen-common.h"
#include "vm/jit/methodheader.h"
+#include "vmcore/options.h"
/* dseg_finish *****************************************************************
linenumbertable_entry *lntinline; /* special entry for inlined method */
for (; lntsize > 0; lntsize--, lntentry--) {
- /* did we reach the current line? */
-
/* Note: In case of inlining this may actually compare the pc
against a methodinfo *, yielding a non-sensical
result. This is no problem, however, as we ignore such
common case (ie. a real pc in lntentry->pc). */
if (pc >= lntentry->pc) {
- /* check for special inline entries (see
- doc/inlining_stacktrace.txt for details */
+ /* did we reach the current line? */
- if ((s4) lntentry->line < 0) {
- switch (lntentry->line) {
- case -1:
- /* begin of inlined method (ie. INLINE_END
- instruction) */
+ if ((s4) lntentry->line >= 0)
+ return (s4) lntentry->line;
- lntinline = --lntentry;/* get entry with methodinfo * */
- lntentry--; /* skip the special entry */
- lntsize -= 2;
+ /* we found a special inline entry (see
+ doc/inlining_stacktrace.txt for details */
- /* search inside the inlined method */
+ switch (lntentry->line) {
+ case -1:
+ /* begin of inlined method (ie. INLINE_END
+ instruction) */
- if (dseg_get_linenumber_from_pc_intern(pm,
- lntentry,
- lntsize,
- pc))
- {
- /* the inlined method contained the pc */
+ lntinline = --lntentry;/* get entry with methodinfo * */
+ lntentry--; /* skip the special entry */
+ lntsize -= 2;
- *pm = (methodinfo *) lntinline->pc;
+ /* search inside the inlined method */
- assert(lntinline->line <= -3);
+ if (dseg_get_linenumber_from_pc_intern(pm, lntentry, lntsize,
+ pc))
+ {
+ /* the inlined method contained the pc */
- return (-3) - lntinline->line;
- }
+ *pm = (methodinfo *) lntinline->pc;
- /* pc was not in inlined method, continue
- search. Entries inside the inlined method
- will be skipped because their lntentry->pc
- is higher than pc. */
- break;
+ assert(lntinline->line <= -3);
- case -2:
- /* end of inlined method */
+ return (-3) - lntinline->line;
+ }
- return 0;
+ /* pc was not in inlined method, continue search.
+ Entries inside the inlined method will be skipped
+ because their lntentry->pc is higher than pc. */
+ break;
- /* default: is only reached for an -3-line entry
- after a skipped -2 entry. We can safely ignore
- it and continue searching. */
- }
- }
- else {
- /* found a normal entry */
+ case -2:
+ /* end of inlined method */
- return (s4) lntentry->line;
+ return 0;
+
+ /* default: is only reached for an -3-line entry after
+ a skipped -2 entry. We can safely ignore it and
+ continue searching. */
}
}
}
linenumbertable_entry *lntentry; /* points to last entry in the table */
s4 linenumber;
+#if defined(__S390__)
+ pc = (u1 *)((intptr_t)pc & 0x7FFFFFFF);
+#endif
+
/* get size of line number table */
lntsize = *((ptrint *) (pv + LineNumberTableSize));
*******************************************************************************/
-#if defined(__I386__) || defined(__X86_64__) || defined(__XDSPCORE__) || defined(ENABLE_INTRP)
+#if defined(__I386__) || defined(__X86_64__) || defined(__S390__) || defined(__XDSPCORE__) || defined(__M68K__) || defined(ENABLE_INTRP)
void dseg_adddata(codegendata *cd)
{
dataref *dr;
*******************************************************************************/
-#if defined(__I386__) || defined(__X86_64__) || defined(__XDSPCORE__) || defined(ENABLE_INTRP)
+#if defined(__I386__) || defined(__X86_64__) || defined(__XDSPCORE__) || defined(__M68K__) || defined(ENABLE_INTRP)
void dseg_resolve_datareferences(jitdata *jd)
{
codeinfo *code;