java-interp.h (_Jv_LocalVarTableEntry): Add union for bytecode_pc and direct-threaded pc.
* include/java-interp.h (_Jv_LocalVarTableEntry): Add union for bytecode_pc and direct-threaded pc. Add field descriptions inline. * defineclass.cc (read_one_code_attribute): Change from bytecode_start_pc to bytecode_pc. Remove unused variable "len". * interpret.cc (compile): Remap the variable table, too. (get_local_var_table) [DIRECT_THREADED]: Use insn_index on the start location to map from pc_t to code index. From-SVN: r125734
This commit is contained in:
parent
e89993b3f2
commit
7dace0ca51
4 changed files with 56 additions and 13 deletions
|
@ -1,3 +1,15 @@
|
|||
2007-06-14 Keith Seitz <keiths@redhat.com>
|
||||
|
||||
* include/java-interp.h (_Jv_LocalVarTableEntry): Add union
|
||||
for bytecode_pc and direct-threaded pc.
|
||||
Add field descriptions inline.
|
||||
* defineclass.cc (read_one_code_attribute): Change from
|
||||
bytecode_start_pc to bytecode_pc.
|
||||
Remove unused variable "len".
|
||||
* interpret.cc (compile): Remap the variable table, too.
|
||||
(get_local_var_table) [DIRECT_THREADED]: Use insn_index on the
|
||||
start location to map from pc_t to code index.
|
||||
|
||||
2007-06-09 Keith Seitz <keiths@redhat.com>
|
||||
|
||||
* testsuite/libjava.jvmti/dummyagent.c (Agent_OnLoad):
|
||||
|
|
|
@ -1009,11 +1009,10 @@ void _Jv_ClassReader::read_one_code_attribute (int method_index)
|
|||
|
||||
for (int i = 0; i < table_len; i++)
|
||||
{
|
||||
table[i].bytecode_start_pc = read2u ();
|
||||
table[i].bytecode_pc = read2u ();
|
||||
table[i].length = read2u ();
|
||||
int len;
|
||||
len = pool_Utf8_to_char_arr (read2u (), &table[i].name);
|
||||
len = pool_Utf8_to_char_arr (read2u (), &table[i].descriptor);
|
||||
pool_Utf8_to_char_arr (read2u (), &table[i].name);
|
||||
pool_Utf8_to_char_arr (read2u (), &table[i].descriptor);
|
||||
table[i].slot = read2u ();
|
||||
|
||||
if (table[i].slot > method->max_locals || table[i].slot < 0)
|
||||
|
|
|
@ -138,17 +138,27 @@ struct _Jv_LineTableEntry
|
|||
};
|
||||
|
||||
// This structure holds local variable information.
|
||||
// The pc value is the first pc where the variable must have a value and it
|
||||
// must continue to have a value until (start_pc + length).
|
||||
// The name is the variable name, and the descriptor contains type information.
|
||||
// The slot is the index in the local variable array of this method, long and
|
||||
// double occupy slot and slot+1.
|
||||
// Like _Jv_LineTableEntry above, it is remapped when the method is
|
||||
// compiled for direct threading.
|
||||
struct _Jv_LocalVarTableEntry
|
||||
{
|
||||
int bytecode_start_pc;
|
||||
// First PC value at which variable is live
|
||||
union
|
||||
{
|
||||
pc_t pc;
|
||||
int bytecode_pc;
|
||||
};
|
||||
|
||||
// length of visibility of variable
|
||||
int length;
|
||||
|
||||
// variable name
|
||||
char *name;
|
||||
|
||||
// type description
|
||||
char *descriptor;
|
||||
|
||||
// stack slot number (long and double occupy slot and slot + 1)
|
||||
int slot;
|
||||
};
|
||||
|
||||
|
|
|
@ -947,6 +947,25 @@ _Jv_InterpMethod::compile (const void * const *insn_targets)
|
|||
|
||||
prepared = insns;
|
||||
|
||||
// Now remap the variable table for this method.
|
||||
for (int i = 0; i < local_var_table_len; ++i)
|
||||
{
|
||||
int start_byte = local_var_table[i].bytecode_pc;
|
||||
if (start_byte < 0 || start_byte >= code_length)
|
||||
start_byte = 0;
|
||||
jlocation start = pc_mapping[start_byte];
|
||||
|
||||
int end_byte = start_byte + local_var_table[i].length;
|
||||
if (end_byte < 0)
|
||||
end_byte = 0;
|
||||
jlocation end = ((end_byte >= code_length)
|
||||
? number_insn_slots
|
||||
: pc_mapping[end_byte]);
|
||||
|
||||
local_var_table[i].pc = &insns[start];
|
||||
local_var_table[i].length = end - start + 1;
|
||||
}
|
||||
|
||||
if (breakpoint_insn == NULL)
|
||||
{
|
||||
bp_insn_slot.insn = const_cast<void *> (insn_targets[op_breakpoint]);
|
||||
|
@ -1526,12 +1545,15 @@ _Jv_InterpMethod::get_local_var_table (char **name, char **sig,
|
|||
*sig = local_var_table[table_slot].descriptor;
|
||||
*generic_sig = local_var_table[table_slot].descriptor;
|
||||
|
||||
*startloc = static_cast<jlong>
|
||||
(local_var_table[table_slot].bytecode_start_pc);
|
||||
#ifdef DIRECT_THREADED
|
||||
*startloc = insn_index (local_var_table[table_slot].pc);
|
||||
#else
|
||||
*startloc = static_cast<jlong> (local_var_table[table_slot].bytecode_pc);
|
||||
#endif
|
||||
*length = static_cast<jint> (local_var_table[table_slot].length);
|
||||
*slot = static_cast<jint> (local_var_table[table_slot].slot);
|
||||
}
|
||||
return local_var_table_len - table_slot -1;
|
||||
return local_var_table_len - table_slot - 1;
|
||||
}
|
||||
|
||||
pc_t
|
||||
|
|
Loading…
Add table
Reference in a new issue