mirror of git://gcc.gnu.org/git/gcc.git
java-interp.h (insn_index): New declaration.
* include/java-interp.h (insn_index): New declaration.
(num_insn_slots): New private variable.
(get_line_table): New declaration.
* interpret.cc (insn_index): New function.
(get_line_table): New function.
From-SVN: r110411
This commit is contained in:
parent
f34312c23c
commit
e939885ff5
|
|
@ -1,3 +1,11 @@
|
||||||
|
2006-01-30 Keith Seitz <keiths@redhat.com>
|
||||||
|
|
||||||
|
* include/java-interp.h (insn_index): New declaration.
|
||||||
|
(num_insn_slots): New private variable.
|
||||||
|
(get_line_table): New declaration.
|
||||||
|
* interpret.cc (insn_index): New function.
|
||||||
|
(get_line_table): New function.
|
||||||
|
|
||||||
2006-01-24 Archit Shah <ashah@redhat.com>
|
2006-01-24 Archit Shah <ashah@redhat.com>
|
||||||
Tom Tromey <tromey@redhat.com>
|
Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,7 @@ class _Jv_InterpMethod : public _Jv_MethodBase
|
||||||
_Jv_LineTableEntry *line_table;
|
_Jv_LineTableEntry *line_table;
|
||||||
|
|
||||||
void *prepared;
|
void *prepared;
|
||||||
|
int number_insn_slots;
|
||||||
|
|
||||||
unsigned char* bytecode ()
|
unsigned char* bytecode ()
|
||||||
{
|
{
|
||||||
|
|
@ -182,9 +183,24 @@ class _Jv_InterpMethod : public _Jv_MethodBase
|
||||||
// number info is unavailable.
|
// number info is unavailable.
|
||||||
int get_source_line(pc_t mpc);
|
int get_source_line(pc_t mpc);
|
||||||
|
|
||||||
|
#ifdef DIRECT_THREADED
|
||||||
|
// Convenience function for indexing bytecode PC/insn slots in
|
||||||
|
// line tables for JDWP
|
||||||
|
jlong insn_index (pc_t pc);
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void dump_object(jobject o);
|
static void dump_object(jobject o);
|
||||||
|
|
||||||
|
/* Get the line table for this method.
|
||||||
|
* start is the lowest index in the method
|
||||||
|
* end is the highest index in the method
|
||||||
|
* line_numbers is an array to hold the list of source line numbers
|
||||||
|
* code_indices is an array to hold the corresponding list of code indices
|
||||||
|
*/
|
||||||
|
void get_line_table (jlong& start, jlong& end, jintArray& line_numbers,
|
||||||
|
jlongArray& code_indices);
|
||||||
|
|
||||||
#ifdef DIRECT_THREADED
|
#ifdef DIRECT_THREADED
|
||||||
friend void _Jv_CompileMethod (_Jv_InterpMethod*);
|
friend void _Jv_CompileMethod (_Jv_InterpMethod*);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -330,6 +330,7 @@ _Jv_InterpMethod::compile (const void * const *insn_targets)
|
||||||
if (! first_pass)
|
if (! first_pass)
|
||||||
{
|
{
|
||||||
insns = (insn_slot *) _Jv_AllocBytes (sizeof (insn_slot) * next);
|
insns = (insn_slot *) _Jv_AllocBytes (sizeof (insn_slot) * next);
|
||||||
|
number_insn_slots = next;
|
||||||
next = 0;
|
next = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3672,6 +3673,80 @@ _Jv_InterpMethod::ncode ()
|
||||||
return self->ncode;
|
return self->ncode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DIRECT_THREADED
|
||||||
|
/* Find the index of the given insn in the array of insn slots
|
||||||
|
for this method. Returns -1 if not found. */
|
||||||
|
jlong
|
||||||
|
_Jv_InterpMethod::insn_index (pc_t pc)
|
||||||
|
{
|
||||||
|
jlong left = 0;
|
||||||
|
jlong right = number_insn_slots;
|
||||||
|
insn_slot* slots = reinterpret_cast<insn_slot*> (prepared);
|
||||||
|
|
||||||
|
while (right >= 0)
|
||||||
|
{
|
||||||
|
jlong mid = (left + right) / 2;
|
||||||
|
if (&slots[mid] == pc)
|
||||||
|
return mid;
|
||||||
|
|
||||||
|
if (pc < &slots[mid])
|
||||||
|
right = mid - 1;
|
||||||
|
else
|
||||||
|
left = mid + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif // DIRECT_THREADED
|
||||||
|
|
||||||
|
void
|
||||||
|
_Jv_InterpMethod::get_line_table (jlong& start, jlong& end,
|
||||||
|
jintArray& line_numbers,
|
||||||
|
jlongArray& code_indices)
|
||||||
|
{
|
||||||
|
#ifdef DIRECT_THREADED
|
||||||
|
/* For the DIRECT_THREADED case, if the method has not yet been
|
||||||
|
* compiled, the linetable will change to insn slots instead of
|
||||||
|
* bytecode PCs. It is probably easiest, in this case, to simply
|
||||||
|
* compile the method and guarantee that we are using insn
|
||||||
|
* slots.
|
||||||
|
*/
|
||||||
|
_Jv_CompileMethod (this);
|
||||||
|
|
||||||
|
if (line_table_len > 0)
|
||||||
|
{
|
||||||
|
start = 0;
|
||||||
|
end = number_insn_slots;
|
||||||
|
line_numbers = JvNewIntArray (line_table_len);
|
||||||
|
code_indices = JvNewLongArray (line_table_len);
|
||||||
|
|
||||||
|
jint* lines = elements (line_numbers);
|
||||||
|
jlong* indices = elements (code_indices);
|
||||||
|
for (int i = 0; i < line_table_len; ++i)
|
||||||
|
{
|
||||||
|
lines[i] = line_table[i].line;
|
||||||
|
indices[i] = insn_index (line_table[i].pc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else // !DIRECT_THREADED
|
||||||
|
if (line_table_len > 0)
|
||||||
|
{
|
||||||
|
start = 0;
|
||||||
|
end = code_length;
|
||||||
|
line_numbers = JvNewIntArray (line_table_len);
|
||||||
|
code_indices = JvNewLongArray (line_table_len);
|
||||||
|
|
||||||
|
jint* lines = elements (line_numbers);
|
||||||
|
jlong* indices = elements (code_indices);
|
||||||
|
for (int i = 0; i < line_table_len; ++i)
|
||||||
|
{
|
||||||
|
lines[i] = line_table[i].line;
|
||||||
|
indices[i] = (jlong) line_table[i].bytecode_pc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // !DIRECT_THREADED
|
||||||
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
_Jv_JNIMethod::ncode ()
|
_Jv_JNIMethod::ncode ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue