summaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog17
-rw-r--r--libjava/include/java-insns.h6
-rw-r--r--libjava/include/java-interp.h12
-rw-r--r--libjava/interpret-run.cc7
-rw-r--r--libjava/interpret.cc25
-rw-r--r--libjava/verify.cc4
6 files changed, 65 insertions, 6 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index e45c9c4a214..ababe76515c 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -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".
diff --git a/libjava/include/java-insns.h b/libjava/include/java-insns.h
index a065987fc51..824e44186a0 100644
--- a/libjava/include/java-insns.h
+++ b/libjava/include/java-insns.h
@@ -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,
diff --git a/libjava/include/java-interp.h b/libjava/include/java-interp.h
index 276a887be34..74846c9f6b2 100644
--- a/libjava/include/java-interp.h
+++ b/libjava/include/java-interp.h
@@ -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);
diff --git a/libjava/interpret-run.cc b/libjava/interpret-run.cc
index afabad26994..26cc4a616dd 100644
--- a/libjava/interpret-run.cc
+++ b/libjava/interpret-run.cc
@@ -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)
{
diff --git a/libjava/interpret.cc b/libjava/interpret.cc
index b5c83871b5f..4b3725855f6 100644
--- a/libjava/interpret.cc
+++ b/libjava/interpret.cc
@@ -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 */
@@ -1385,6 +1404,12 @@ _Jv_InterpMethod::get_line_table (jlong& start, jlong& end,
}
pc_t
+_Jv_InterpMethod::install_break (jlong index)
+{
+ return set_insn (index, breakpoint_insn);
+}
+
+pc_t
_Jv_InterpMethod::get_insn (jlong index)
{
pc_t code;
diff --git a/libjava/verify.cc b/libjava/verify.cc
index 90890a6257a..b002c1c0aab 100644
--- a/libjava/verify.cc
+++ b/libjava/verify.cc
@@ -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",