Re: Bug Status of Kaffe
Hi,
On Thu, 2003-12-25 at 03:12, Ben Burton wrote:
> > > #210716 jython causes kaffe to fail with assert error
> > >
> > > ,----
> > > | Version: 1:1.1.1-1
> > > |
> > > | > After removing the JNI lines from jython shell script (see
> > > | > issue #207998) kaffe dies with kaffe-bin: machine.c:620:
> > > | > installMethodCode: Assertion `e->start_pc <= e->end_pc'
> > > | > failed.
> [...]
> But this crash is not a debian-specific bug. The bug here is that jython
> causes kaffe to crash on startup *after* all of the required classes have
> been found - it has nothing to do with the library path.
> [..]
> This is where this crash comes up. Once you have kaffe finding all of the
> JNI libraries that it should (including the ones used with jython and the
> kaffe bootstrap classes), it then crashes with 'e->start_pc <= e->end_pc'
> failed.
>
> So this is definitely a kaffe issue, not a debian-specific issue or a JNI
> path issue.
Seen the same crash when using the CVS view from Eclipse 3.0M4 on kaffe.
<http://kaffe.org/pipermail/kaffe/2003-October/044318.html>
I just removed the assert.
The problem is actually the byte code generated by the compiler since it
should not generate an exception table entry whose start_pc is smaller
(or equal - the assert is actually wrong) to end_pc.
The attached patch turns the assert into a printf WARNING which can help
debug the byte code. In my eclipse case it says:
WARNING start_pc=164661273 end_pc=164661236 in
org/eclipse/team/internal/core/streams/TimeoutInputStream.runThread(()V)
WARNING start_pc=164661775 end_pc=164661236 in
org/eclipse/team/internal/core/streams/TimeoutInputStream.runThread(()V)
WARNING start_pc=161990681 end_pc=161990644 in
org/eclipse/team/internal/core/streams/TimeoutOutputStream.runThread(()V)
WARNING start_pc=161991183 end_pc=161990644 in
org/eclipse/team/internal/core/streams/TimeoutOutputStream.runThread(()V)
(Also included the other things needed to patch/hack around for eclipse)
Cheers,
Mark
Index: kaffe/kaffevm/jni.c
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/jni.c,v
retrieving revision 1.97
diff -u -r1.97 jni.c
--- kaffe/kaffevm/jni.c 3 Nov 2003 05:29:31 -0000 1.97
+++ kaffe/kaffevm/jni.c 27 Dec 2003 20:21:35 -0000
@@ -3024,6 +3024,12 @@
return (ret);
}
+static void*
+Kaffe_GetPrimitiveArrayCritical(JNIEnv* env, jarray arr, jbool* iscopy)
+{
+ return (Kaffe_GetByteArrayElements(env, (jbyteArray)arr, iscopy));
+}
+
static jchar*
Kaffe_GetCharArrayElements(JNIEnv* env, jcharArray arr, jbool* iscopy)
{
@@ -3159,6 +3165,12 @@
}
static void
+Kaffe_ReleasePrimitiveArrayCritical(JNIEnv* env, jbyteArray arr, jbyte* elems, jint mode)
+{
+ Kaffe_ReleaseByteArrayElements(env, (jbyteArray)arr, (jbyte*)elems, mode);
+}
+
+static void
Kaffe_ReleaseCharArrayElements(JNIEnv* env, jcharArray arr, jchar* elems, jint mode)
{
BEGIN_EXCEPTION_HANDLING_VOID();
@@ -4425,8 +4437,8 @@
Kaffe_GetJavaVM,
NULL,
NULL,
- NULL,
- NULL,
+ Kaffe_GetPrimitiveArrayCritical,
+ Kaffe_ReleasePrimitiveArrayCritical,
NULL,
NULL,
NULL,
Index: kaffe/kaffevm/jit3/machine.c
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/jit3/machine.c,v
retrieving revision 1.44
diff -u -r1.44 machine.c
--- kaffe/kaffevm/jit3/machine.c 2 Nov 2003 17:51:59 -0000 1.44
+++ kaffe/kaffevm/jit3/machine.c 27 Dec 2003 20:21:36 -0000
@@ -611,7 +611,12 @@
e->start_pc = getInsnPC(e->start_pc, codeInfo, code) + (uintp)code->code;
e->end_pc = getInsnPC(e->end_pc, codeInfo, code) + (uintp)code->code;
e->handler_pc = getInsnPC(e->handler_pc, codeInfo, code) + (uintp)code->code;
- assert (e->start_pc <= e->end_pc);
+ if (e->start_pc > e->end_pc)
+ printf("WARNING start_pc=%d end_pc=%d in %s.%s(%s)\n",
+ e->start_pc, e->end_pc,
+ CLASS_CNAME(meth->class),
+ meth->name->data,
+ METHOD_SIGD(meth));
}
}
Reply to: