java-insns.h (enum java_code): Add op_breakpoint.

* include/java-insns.h (enum java_code): Add op_breakpoint.
        * include/java-interp.h (_Jv_InterpMethod): Declare breakpoint_insn.
        [INTERPRETER]: Declare _Jv_InterpMethod::bp_insn_slot.
        [!INTERPRETER]: Declare _Jv_InterpMethod::bp_insn_opcode.
        (install_break): Declare.
        * interpret.cc (breakpoint_insn): Define breakpoint insn.
        (compile): Add op_breakpoint to "can't happen" cases.
        [INTERPRETER] Initialize breakpoint insn if necessary.
        (install_break): New method.
        * interpret-run.cc: Add op_breakpoint to insn_targets.
        Add insn_breakpoint label.
        * verify.cc (branch_prepass): Add op_breakpoint to unrecognized
        opcodes section of switch statement.
        (verify_instructions_0): Likewise.

From-SVN: r117734
This commit is contained in:
Keith Seitz 2006-10-14 20:11:12 +00:00 committed by Keith Seitz
parent 1526c4b5b6
commit 0f546316f4
6 changed files with 65 additions and 6 deletions

View file

@ -1,3 +1,20 @@
2006-10-14 Keith Seitz <keiths@redhat.com>
* include/java-insns.h (enum java_code): Add op_breakpoint.
* include/java-interp.h (_Jv_InterpMethod): Declare breakpoint_insn.
[INTERPRETER]: Declare _Jv_InterpMethod::bp_insn_slot.
[!INTERPRETER]: Declare _Jv_InterpMethod::bp_insn_opcode.
(install_break): Declare.
* interpret.cc (breakpoint_insn): Define breakpoint insn.
(compile): Add op_breakpoint to "can't happen" cases.
[INTERPRETER] Initialize breakpoint insn if necessary.
(install_break): New method.
* interpret-run.cc: Add op_breakpoint to insn_targets.
Add insn_breakpoint label.
* verify.cc (branch_prepass): Add op_breakpoint to unrecognized
opcodes section of switch statement.
(verify_instructions_0): Likewise.
2006-10-12 Keith Seitz <keiths@redhat.com>
* include/jvmti-int.h (JVMTI): Declare all members "extern".

View file

@ -1,6 +1,6 @@
// java-insns.h - Instruction encodings. This is -*- c++ -*-
/* Copyright (C) 1999, 2001, 2002 Free Software Foundation
/* Copyright (C) 1999, 2001, 2002, 2006 Free Software Foundation
This file is part of libgcj.
@ -199,9 +199,7 @@ enum java_opcode
op_invokespecial = 0xb7,
op_invokestatic = 0xb8,
op_invokeinterface = 0xb9,
// 0xba is unused.
op_breakpoint = 0xba,
op_new = 0xbb,
op_newarray = 0xbc,
op_anewarray = 0xbd,

View file

@ -133,6 +133,14 @@ struct _Jv_LineTableEntry
class _Jv_InterpMethod : public _Jv_MethodBase
{
// Breakpoint instruction
static pc_t breakpoint_insn;
#ifdef DIRECT_THREADED
static insn_slot bp_insn_slot;
#else
static unsigned char bp_insn_opcode;
#endif
_Jv_ushort max_stack;
_Jv_ushort max_locals;
int code_length;
@ -206,6 +214,10 @@ class _Jv_InterpMethod : public _Jv_MethodBase
void get_line_table (jlong& start, jlong& end, jintArray& line_numbers,
jlongArray& code_indices);
/* Installs a break instruction at the given code index. Returns
the pc_t of the breakpoint or NULL if index is invalid. */
pc_t install_break (jlong index);
// Gets the instruction at the given index
pc_t get_insn (jlong index);

View file

@ -217,7 +217,7 @@ details. */
INSN_LABEL(invokespecial),
INSN_LABEL(invokestatic),
INSN_LABEL(invokeinterface),
0, /* Unused. */
INSN_LABEL (breakpoint),
INSN_LABEL(new),
INSN_LABEL(newarray),
INSN_LABEL(anewarray),
@ -2463,6 +2463,11 @@ details. */
}
#endif /* DIRECT_THREADED */
insn_breakpoint:
{
// nothing just yet
}
}
catch (java::lang::Throwable *ex)
{

View file

@ -75,6 +75,18 @@ _Jv_InitInterpreter()
void _Jv_InitInterpreter() {}
#endif
// The breakpoint instruction. For the direct threaded case,
// _Jv_InterpMethod::compile will initialize breakpoint_insn
// the first time it is called.
#ifdef DIRECT_THREADED
insn_slot _Jv_InterpMethod::bp_insn_slot;
pc_t _Jv_InterpMethod::breakpoint_insn = NULL;
#else
unsigned char _Jv_InterpMethod::bp_insn_opcode
= static_cast<unsigned char> (op_breakpoint);
pc_t _Jv_InterpMethod::breakpoint_insn = &_Jv_InterpMethod::bp_insn_opcode;
#endif
extern "C" double __ieee754_fmod (double,double);
static inline void dupx (_Jv_word *sp, int n, int x)
@ -844,6 +856,7 @@ _Jv_InterpMethod::compile (const void * const *insn_targets)
case op_getstatic_4:
case op_getstatic_8:
case op_getstatic_a:
case op_breakpoint:
default:
// Fail somehow.
break;
@ -879,6 +892,12 @@ _Jv_InterpMethod::compile (const void * const *insn_targets)
}
prepared = insns;
if (breakpoint_insn == NULL)
{
bp_insn_slot.insn = const_cast<void *> (insn_targets[op_breakpoint]);
breakpoint_insn = &bp_insn_slot;
}
}
#endif /* DIRECT_THREADED */
@ -1384,6 +1403,12 @@ _Jv_InterpMethod::get_line_table (jlong& start, jlong& end,
#endif // !DIRECT_THREADED
}
pc_t
_Jv_InterpMethod::install_break (jlong index)
{
return set_insn (index, breakpoint_insn);
}
pc_t
_Jv_InterpMethod::get_insn (jlong index)
{

View file

@ -1,6 +1,6 @@
// verify.cc - verify bytecode
/* Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation
/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation
This file is part of libgcj.
@ -1976,6 +1976,7 @@ private:
case op_getstatic_4:
case op_getstatic_8:
case op_getstatic_a:
case op_breakpoint:
default:
verify_fail ("unrecognized instruction in branch_prepass",
start_PC);
@ -3153,6 +3154,7 @@ private:
case op_getstatic_4:
case op_getstatic_8:
case op_getstatic_a:
case op_breakpoint:
default:
// Unrecognized opcode.
verify_fail ("unrecognized instruction in verify_instructions_0",