aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2006-10-10 20:15:51 +0000
committerKeith Seitz <keiths@redhat.com>2006-10-10 20:15:51 +0000
commit861dbd0b0aee3bd3a4b52c230fe600c9f17e5dc2 (patch)
tree128c26f6b83c22bf5dbed4b27189a9b690415438 /libjava
parent2b538735f2de565895772b8f7643e3fb583151b9 (diff)
* include/java-interp.h (_Jv_InterpMethod::get_insn): Declare.
(_Jv_InterpMethod::set_insn): Declare. * interpret.cc (_Jv_InterpMethod::get_insn): New method. (_Jv_InterpMethod::get_insn): New method. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@117614 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog7
-rw-r--r--libjava/include/java-interp.h7
-rw-r--r--libjava/interpret.cc40
3 files changed, 54 insertions, 0 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index b1853f44006..e6933f30829 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,10 @@
+2006-10-10 Keith Seitz <keiths@redhat.com>
+
+ * include/java-interp.h (_Jv_InterpMethod::get_insn): Declare.
+ (_Jv_InterpMethod::set_insn): Declare.
+ * interpret.cc (_Jv_InterpMethod::get_insn): New method.
+ (_Jv_InterpMethod::get_insn): New method.
+
2006-10-10 Tom Tromey <tromey@redhat.com>
* prims.cc (_Jv_PrependVersionedLibdir): Use
diff --git a/libjava/include/java-interp.h b/libjava/include/java-interp.h
index 133fd19f9fe..276a887be34 100644
--- a/libjava/include/java-interp.h
+++ b/libjava/include/java-interp.h
@@ -206,6 +206,13 @@ class _Jv_InterpMethod : public _Jv_MethodBase
void get_line_table (jlong& start, jlong& end, jintArray& line_numbers,
jlongArray& code_indices);
+ // Gets the instruction at the given index
+ pc_t get_insn (jlong index);
+
+ /* Writes the given instruction at the given code index. Returns
+ the insn or NULL if index is invalid. */
+ pc_t set_insn (jlong index, pc_t insn);
+
#ifdef DIRECT_THREADED
friend void _Jv_CompileMethod (_Jv_InterpMethod*);
#endif
diff --git a/libjava/interpret.cc b/libjava/interpret.cc
index 1c4e21e6b76..b5c83871b5f 100644
--- a/libjava/interpret.cc
+++ b/libjava/interpret.cc
@@ -1384,6 +1384,46 @@ _Jv_InterpMethod::get_line_table (jlong& start, jlong& end,
#endif // !DIRECT_THREADED
}
+pc_t
+_Jv_InterpMethod::get_insn (jlong index)
+{
+ pc_t code;
+
+#ifdef DIRECT_THREADED
+ if (index >= number_insn_slots || index < 0)
+ return NULL;
+
+ code = prepared;
+#else // !DIRECT_THREADED
+ if (index >= code_length || index < 0)
+ return NULL;
+
+ code = reinterpret_cast<pc_t> (bytecode ());
+#endif // !DIRECT_THREADED
+
+ return &code[index];
+}
+
+pc_t
+_Jv_InterpMethod::set_insn (jlong index, pc_t insn)
+{
+#ifdef DIRECT_THREADED
+ if (index >= number_insn_slots || index < 0)
+ return NULL;
+
+ pc_t code = prepared;
+ code[index].insn = insn->insn;
+#else // !DIRECT_THREADED
+ if (index >= code_length || index < 0)
+ return NULL;
+
+ pc_t code = reinterpret_cast<pc_t> (bytecode ());
+ code[index] = *insn;
+#endif // !DIRECT_THREADED
+
+ return &code[index];
+}
+
void *
_Jv_JNIMethod::ncode ()
{