Name: dkC59003 Date: 07/22/99
Following JNI test causes crash of HotSpot VM for
win32 1.3beta build L(H...L)
--------------------------------------------------------
These JCK1.2.2 tests are failed due to this bug:
vm/jni/RegisterNatives/rgnt001/rgnt00101/rgnt00101.html
vm/jni/UnregisterNatives/urnt001/urnt00101/urnt00101.html
--- Sources --------------------------------------------
--- unregtest.java ---
public class unregtest {
native void unregfunc();
static {
try {
System.loadLibrary("unregtest");
}catch (Throwable e) {
System.out.println("Exception caught: " + e);
}
}
public static void main(String argv[]) {
run(argv);
System.out.println("run(): executed");
}
public static int run(String argv[]) {
unregtest tob = new unregtest();
tob.unregfunc();
return 2;
}
}
--- unregtest.c ---
#include "jckjni.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
#ifndef JNI_ENV_ARG
#define JNI_ENV_ARG(x, y) y
#define JNI_ENV_PTR(x) x
#endif
#else
#ifndef JNI_ENV_ARG
#define JNI_ENV_ARG(x,y) x, y
#define JNI_ENV_PTR(x) (*x)
#endif
#endif
JNIEXPORT void JNICALL Java_unregtest_unregfunc(JNIEnv *env, jobject obj) {
jclass jc;
jc = JNI_ENV_PTR(env) -> GetObjectClass(JNI_ENV_ARG(env, obj));
if ( jc == NULL) {
return;
}
JNI_ENV_PTR(env) -> UnregisterNatives(JNI_ENV_ARG(env, jc));
return;
}
#ifdef __cplusplus
}
#endif
-------------------
--- Compilation ----------------------------------------
C:\tmp>cl /D "WIN32" /D "_WINDOWS" /LD unregtest.c
Microsoft (R) 32-bit C/C++ Standard Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
unregtest.c
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
/out:unregtest.dll
/dll
/implib:unregtest.lib
unregtest.obj
Creating library unregtest.lib and object unregtest.exp
C:\tmp>javac unregtest.java
--- Execution ------------------------------------------
C:\tmp>java -version
java version "1.3"
HotSpot Client VM (1.3beta, mixed mode, build l)
C:\tmp>java -classic -Xfuture unregtest
run(): executed
C:\tmp>java -Xfuture unregtest
#
# HotSpot Virtual Machine Error, EXCEPTION_ACCESS_VIOLATION
#
# Error ID: 4F533F57494E13120E43505002B0
#
--------------------------------------------------------
======================================================================