Commit 9872ecad by Keith Seitz Committed by Keith Seitz

headers.txt (gnu/gcj/jvmti/Breakpoint.h): Add _Jv_RewriteBreakpointInsn friend declaration.

        * headers.txt (gnu/gcj/jvmti/Breakpoint.h)[DIRECT_THREADED]:
        Add _Jv_RewriteBreakpointInsn friend declaration.
        * gnu/gcj/jvmti/natBreakpoint.cc (_Jv_RewriteBreakpointInsn)
        [DIRECT_THREADED]: New function.
        * gnu/gcj/jvmti/Breakpoint.h: Regenerate.
        * interpret-run.cc: Define new REWRITE_INSN macro.
        Changed all occurrences of insn rewriting to call REWRITE_INSN.

From-SVN: r124111
parent 676b23ba
2007-04-24 Keith Seitz <keiths@redhat.com>
* headers.txt (gnu/gcj/jvmti/Breakpoint.h)[DIRECT_THREADED]:
Add _Jv_RewriteBreakpointInsn friend declaration.
* gnu/gcj/jvmti/natBreakpoint.cc (_Jv_RewriteBreakpointInsn)
[DIRECT_THREADED]: New function.
* gnu/gcj/jvmti/Breakpoint.h: Regenerate.
* interpret-run.cc: Define new REWRITE_INSN macro.
Changed all occurrences of insn rewriting to call REWRITE_INSN.
2007-04-23 Keith Seitz <keiths@redhat.com>
* include/no-gc.h (_Jv_IsThreadSuspended): Declare.
* include/boehm-gc.h (_Jv_IsThreadSuspended): Likewise.
* boehm.cc (_Jv_IsThreadSuspended): New function.
* nogc.cc (_Jv_IsThreadSuspended): Likewise.
* jvmti.cc (_Jv_JVMTI_GetThreadState): New function.
(_Jv_JVMTI_Interface): Define GetThreadState.
2007-04-23 Kyle Galloway <kgallowa@redhat.com> 2007-04-23 Kyle Galloway <kgallowa@redhat.com>
* include/java-interp.h (_Jv_InterpFrame): Add pointer to the * include/java-interp.h (_Jv_InterpFrame): Add pointer to the
......
...@@ -22,9 +22,17 @@ extern "Java" ...@@ -22,9 +22,17 @@ extern "Java"
} }
} }
#ifdef DIRECT_THREADED
void _Jv_RewriteBreakpointInsn (jmethodID, jlocation, pc_t);
#endif
class gnu::gcj::jvmti::Breakpoint : public ::java::lang::Object class gnu::gcj::jvmti::Breakpoint : public ::java::lang::Object
{ {
#ifdef DIRECT_THREADED
friend void (::_Jv_RewriteBreakpointInsn (jmethodID, jlocation, pc_t));
#endif
public: public:
Breakpoint(jlong, jlong); Breakpoint(jlong, jlong);
private: private:
......
...@@ -17,6 +17,7 @@ details. */ ...@@ -17,6 +17,7 @@ details. */
#include <jvmti.h> #include <jvmti.h>
#include <gnu/gcj/jvmti/Breakpoint.h> #include <gnu/gcj/jvmti/Breakpoint.h>
#include <gnu/gcj/jvmti/BreakpointManager.h>
static _Jv_InterpMethod * static _Jv_InterpMethod *
get_interp_method (jlong method) get_interp_method (jlong method)
...@@ -54,3 +55,18 @@ gnu::gcj::jvmti::Breakpoint::remove () ...@@ -54,3 +55,18 @@ gnu::gcj::jvmti::Breakpoint::remove ()
_Jv_InterpMethod *imeth = get_interp_method (method); _Jv_InterpMethod *imeth = get_interp_method (method);
imeth->set_insn (location, reinterpret_cast<pc_t> (data)); imeth->set_insn (location, reinterpret_cast<pc_t> (data));
} }
#ifdef DIRECT_THREADED
void
_Jv_RewriteBreakpointInsn (jmethodID mid, jlocation loc, pc_t new_insn)
{
using namespace ::gnu::gcj::jvmti;
Breakpoint *bp
= BreakpointManager::getBreakpoint (reinterpret_cast<jlong> (mid), loc);
if (bp != NULL)
{
pc_t old_insn = (pc_t) bp->data;
old_insn->insn = new_insn;
}
}
#endif // DIRECT_THREADED
...@@ -63,5 +63,13 @@ friend class java::lang::Class; ...@@ -63,5 +63,13 @@ friend class java::lang::Class;
friend class java::io::ObjectInputStream; friend class java::io::ObjectInputStream;
friend java::lang::reflect::Method* ::_Jv_GetReflectedMethod (jclass, _Jv_Utf8Const*, _Jv_Utf8Const*); friend java::lang::reflect::Method* ::_Jv_GetReflectedMethod (jclass, _Jv_Utf8Const*, _Jv_Utf8Const*);
class gnu/gcj/jvmti/Breakpoint
prepend #ifdef DIRECT_THREADED
prepend void _Jv_RewriteBreakpointInsn (jmethodID, jlocation, pc_t);
prepend #endif
add #ifdef DIRECT_THREADED
add friend void (::_Jv_RewriteBreakpointInsn (jmethodID, jlocation, pc_t));
add #endif
class gnu/gcj/runtime/ExtensionClassLoader class gnu/gcj/runtime/ExtensionClassLoader
friend class ::java::lang::ClassLoader; friend class ::java::lang::ClassLoader;
...@@ -359,9 +359,32 @@ details. */ ...@@ -359,9 +359,32 @@ details. */
goto *((pc++)->insn); \ goto *((pc++)->insn); \
} \ } \
while (0) while (0)
#undef REWRITE_INSN
#define REWRITE_INSN(INSN,SLOT,VALUE) \
do { \
if (pc[-2].insn == breakpoint_insn->insn) \
{ \
using namespace ::gnu::gcj::jvmti; \
jlocation location = meth->insn_index (pc - 2); \
_Jv_RewriteBreakpointInsn (meth->self, location, (pc_t) INSN); \
} \
else \
pc[-2].insn = INSN; \
\
pc[-1].SLOT = VALUE; \
} \
while (0)
#else #else
#undef NEXT_INSN #undef NEXT_INSN
#define NEXT_INSN goto *((pc++)->insn) #define NEXT_INSN goto *((pc++)->insn)
#define REWRITE_INSN(INSN,SLOT,VALUE) \
do { \
pc[-2].insn = INSN; \
pc[-1].SLOT = VALUE; \
} \
while (0)
#endif #endif
#define INTVAL() ((pc++)->int_val) #define INTVAL() ((pc++)->int_val)
...@@ -511,8 +534,7 @@ details. */ ...@@ -511,8 +534,7 @@ details. */
#ifdef DIRECT_THREADED #ifdef DIRECT_THREADED
// Rewrite instruction so that we use a faster pre-resolved // Rewrite instruction so that we use a faster pre-resolved
// method. // method.
pc[-2].insn = &&invokevirtual_resolved; REWRITE_INSN (&&invokevirtual_resolved, datum, rmeth);
pc[-1].datum = rmeth;
#endif /* DIRECT_THREADED */ #endif /* DIRECT_THREADED */
} }
goto perform_invoke; goto perform_invoke;
...@@ -1846,8 +1868,7 @@ details. */ ...@@ -1846,8 +1868,7 @@ details. */
} }
#ifdef DIRECT_THREADED #ifdef DIRECT_THREADED
pc[-2].insn = newinsn; REWRITE_INSN (newinsn, datum, field->u.addr);
pc[-1].datum = field->u.addr;
#endif /* DIRECT_THREADED */ #endif /* DIRECT_THREADED */
} }
NEXT_INSN; NEXT_INSN;
...@@ -1937,8 +1958,7 @@ details. */ ...@@ -1937,8 +1958,7 @@ details. */
} }
#ifdef DIRECT_THREADED #ifdef DIRECT_THREADED
pc[-2].insn = newinsn; REWRITE_INSN (newinsn, int_val, field_offset);
pc[-1].int_val = field_offset;
#endif /* DIRECT_THREADED */ #endif /* DIRECT_THREADED */
} }
NEXT_INSN; NEXT_INSN;
...@@ -2053,8 +2073,7 @@ details. */ ...@@ -2053,8 +2073,7 @@ details. */
} }
#ifdef DIRECT_THREADED #ifdef DIRECT_THREADED
pc[-2].insn = newinsn; REWRITE_INSN (newinsn, datum, field->u.addr);
pc[-1].datum = field->u.addr;
#endif /* DIRECT_THREADED */ #endif /* DIRECT_THREADED */
} }
NEXT_INSN; NEXT_INSN;
...@@ -2152,8 +2171,7 @@ details. */ ...@@ -2152,8 +2171,7 @@ details. */
} }
#ifdef DIRECT_THREADED #ifdef DIRECT_THREADED
pc[-2].insn = newinsn; REWRITE_INSN (newinsn, int_val, field_offset);
pc[-1].int_val = field_offset;
#endif /* DIRECT_THREADED */ #endif /* DIRECT_THREADED */
} }
NEXT_INSN; NEXT_INSN;
...@@ -2228,8 +2246,7 @@ details. */ ...@@ -2228,8 +2246,7 @@ details. */
#ifdef DIRECT_THREADED #ifdef DIRECT_THREADED
// Rewrite instruction so that we use a faster pre-resolved // Rewrite instruction so that we use a faster pre-resolved
// method. // method.
pc[-2].insn = &&invokespecial_resolved; REWRITE_INSN (&&invokespecial_resolved, datum, rmeth);
pc[-1].datum = rmeth;
#endif /* DIRECT_THREADED */ #endif /* DIRECT_THREADED */
} }
goto perform_invoke; goto perform_invoke;
...@@ -2266,8 +2283,7 @@ details. */ ...@@ -2266,8 +2283,7 @@ details. */
#ifdef DIRECT_THREADED #ifdef DIRECT_THREADED
// Rewrite instruction so that we use a faster pre-resolved // Rewrite instruction so that we use a faster pre-resolved
// method. // method.
pc[-2].insn = &&invokestatic_resolved; REWRITE_INSN (&&invokestatic_resolved, datum, rmeth);
pc[-1].datum = rmeth;
#endif /* DIRECT_THREADED */ #endif /* DIRECT_THREADED */
} }
goto perform_invoke; goto perform_invoke;
...@@ -2305,8 +2321,7 @@ details. */ ...@@ -2305,8 +2321,7 @@ details. */
#ifdef DIRECT_THREADED #ifdef DIRECT_THREADED
// Rewrite instruction so that we use a faster pre-resolved // Rewrite instruction so that we use a faster pre-resolved
// method. // method.
pc[-2].insn = &&invokeinterface_resolved; REWRITE_INSN (&&invokeinterface_resolved, datum, rmeth);
pc[-1].datum = rmeth;
#else #else
// Skip dummy bytes. // Skip dummy bytes.
pc += 2; pc += 2;
...@@ -2344,8 +2359,7 @@ details. */ ...@@ -2344,8 +2359,7 @@ details. */
PUSHA (res); PUSHA (res);
#ifdef DIRECT_THREADED #ifdef DIRECT_THREADED
pc[-2].insn = &&new_resolved; REWRITE_INSN (&&new_resolved, datum, klass);
pc[-1].datum = klass;
#endif /* DIRECT_THREADED */ #endif /* DIRECT_THREADED */
} }
NEXT_INSN; NEXT_INSN;
...@@ -2380,8 +2394,7 @@ details. */ ...@@ -2380,8 +2394,7 @@ details. */
PUSHA (result); PUSHA (result);
#ifdef DIRECT_THREADED #ifdef DIRECT_THREADED
pc[-2].insn = &&anewarray_resolved; REWRITE_INSN (&&anewarray_resolved, datum, klass);
pc[-1].datum = klass;
#endif /* DIRECT_THREADED */ #endif /* DIRECT_THREADED */
} }
NEXT_INSN; NEXT_INSN;
...@@ -2425,8 +2438,7 @@ details. */ ...@@ -2425,8 +2438,7 @@ details. */
PUSHA (value); PUSHA (value);
#ifdef DIRECT_THREADED #ifdef DIRECT_THREADED
pc[-2].insn = &&checkcast_resolved; REWRITE_INSN (&&checkcast_resolved, datum, to);
pc[-1].datum = to;
#endif /* DIRECT_THREADED */ #endif /* DIRECT_THREADED */
} }
NEXT_INSN; NEXT_INSN;
...@@ -2453,8 +2465,7 @@ details. */ ...@@ -2453,8 +2465,7 @@ details. */
PUSHI (to->isInstance (value)); PUSHI (to->isInstance (value));
#ifdef DIRECT_THREADED #ifdef DIRECT_THREADED
pc[-2].insn = &&instanceof_resolved; REWRITE_INSN (&&instanceof_resolved, datum, to);
pc[-1].datum = to;
#endif /* DIRECT_THREADED */ #endif /* DIRECT_THREADED */
} }
NEXT_INSN; NEXT_INSN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment