Re: SableVM on ARM Zaurus
Cortez The Killer <[email protected]>
| Newsgroups | gmane.comp.java.vm.sablevm.general |
|---|---|
| Message-ID | <[email protected]> |
> Where did you get this message from? Would you suggest a patch
> to sablevm that would print it out in case of such a problem?
>
See for yourself. I changed the Java_java_lang_VMRuntime_nativeLoad
routine as follows:
Java_java_lang_VMRuntime_nativeLoad (JNIEnv *_env, jclass class SVM_UNUSED,
jstring _filename)
{
_svmt_JNIEnv *env = _svmf_cast_svmt_JNIEnv (_env);
_svmt_JavaVM *vm = env->vm;
const char *errmsg = "unknown error";
_svmf_resuming_java (env);
{
char *filename;
_svmt_class_loader_info *class_loader_info =
_svmf_get_current_class_loader (env);
_svmt_native_library *native_library =
class_loader_info->native_library_list;
lt_dlhandle handle;
jboolean monitor_acquired = JNI_FALSE;
printf("GrepLine1: Java_java_lang_VMRuntime_nativeLoad entered\n");
fflush(NULL);
if (_svmf_enter_class_loader_monitor (env, class_loader_info) != JNI_OK)
{
goto end;
}
monitor_acquired = JNI_TRUE;
printf("GrepLine2: if (_svmm_galloc_utf_chars (env, _filename,
filename) != JNI_OK)\n"); fflush(NULL);
if (_svmm_galloc_utf_chars (env, _filename, filename) != JNI_OK)
{
goto end;
}
handle = lt_dlopenext (filename);
printf("GrepLine3: handle = lt_dlopenext (%s);\n", filename); fflush(NULL);
if (handle == NULL)
{
errmsg = lt_dlerror ();
_svmm_gfree_utf_chars (filename);
goto end;
}
while (native_library != NULL)
{
if (native_library->handle == handle)
{
printf("GrepLine4: _svmm_gfree_utf_chars (%s)\n", filename); fflush(NULL);
errmsg = NULL;
_svmm_gfree_utf_chars (filename);
goto end;
}
native_library = native_library->next;
}
/* Call JNI_OnLoad */
{
JNIEXPORT jint (JNICALL *JNI_OnLoad) (JavaVM *, void *);
JNI_OnLoad = SVM_CAST_EXTENSION
(JNIEXPORT jint (JNICALL *)(JavaVM *, void *)) lt_dlsym (handle,
"JNI_OnLoad");
if (JNI_OnLoad != NULL)
{
jint version = JNI_OnLoad (_svmf_cast_JavaVM (vm), NULL);
printf("GrepLine5: JNI_OnLoad (_svmf_cast_JavaVM (vm), NULL) == %d\n",
version); fflush(NULL);
if (version != JNI_VERSION_1_2)
{
lt_dlclose (handle);
goto end;
}
}
}
printf("GrepLine6: before Check JNI_OK\n"); fflush(NULL);
if (_svmm_cl_zalloc_native_library
(env, class_loader_info,
*(class_loader_info->native_library_list_tail)) != JNI_OK)
{
_svmm_gfree_utf_chars (filename);
goto end;
}
(*(class_loader_info->native_library_list_tail))->name = filename;
(*(class_loader_info->native_library_list_tail))->handle = handle;
class_loader_info->native_library_list_tail =
&(*(class_loader_info->native_library_list_tail))->next;
errmsg = NULL;
end:
printf("GrepLine7: Just after end:\n"); fflush(NULL);
if (monitor_acquired)
{
monitor_acquired = JNI_FALSE;
if (_svmf_exit_class_loader_monitor (env, class_loader_info) !=
JNI_OK)
{
goto end;
}
}
}
printf("GrepLine8: _svmf_stopping_java (env)\n"); fflush(NULL);
_svmf_stopping_java (env);
printf("GrepLine9: Java_java_lang_VMRuntime_nativeLoad exit, errmsg
is: %s\n", errmsg); fflush(NULL);
return errmsg == NULL ? 1 : 0;
}
> Great! This also means we really need to provide information about
> what the real problem was, so that the next person didn't need to
> repeat the whole cycle :-/
What do you suggest, should I make a step-by-step how-to?
> Congratulations on the persistence :-)
Thanks, I wouldn't have made it without your help though, or at least
it had taken me much more time!