Changes: Christian Thalinger
- $Id: asmpart.h 664 2003-11-21 18:24:01Z jowenn $
+ $Id: asmpart.h 771 2003-12-13 23:11:08Z stefan $
*/
with up to 4 parameters. This function calls a Java-method (which
possibly needs compilation) with up to 4 parameters.
*/
-java_objectheader *asm_calljavamethod(methodinfo *m, void *arg1, void *arg2,
- void *arg3, void *arg4);
/*
This function calls a Java-method (which possibly needs compilation)
Changes: Mark Probst
Philipp Tomsich
- $Id: headers.c 745 2003-12-13 22:05:02Z twisti $
+ $Id: headers.c 771 2003-12-13 23:11:08Z stefan $
*/
void stringtable_update() { }
void synchronize_caches() { }
void asm_call_jit_compiler() { }
-void asm_calljavamethod() { }
+void asm_calljavafunction() { }
void asm_dumpregistersandcall() { }
s4 asm_builtin_checkcast(java_objectheader *obj, classinfo *class) { return 0; }
Reinhard Grafl
Christian Thalinger
- $Id: asmpart.S 763 2003-12-13 22:47:44Z twisti $
+ $Id: asmpart.S 771 2003-12-13 23:11:08Z stefan $
*/
/********************* exported functions and variables ***********************/
.globl has_no_x_instr_set
- .globl asm_calljavamethod
.globl asm_calljavafunction
.globl asm_calljavafunction2
.globl asm_calljavafunction2long
ret
-/********************* function asm_calljavamethod *****************************
-* *
-* This function calls a Java-method (which possibly needs compilation) *
-* with up to 4 parameters. *
-* *
-* This functions calls the JIT-compiler which eventually translates the *
-* method into machine code. *
-* *
-* An possibly throwed exception will be returned to the caller as function *
-* return value, so the java method cannot return a fucntion value (this *
-* function usually calls 'main' and '<clinit>' which do not return a *
-* function value). *
-* *
-* C-prototype: *
-* javaobject_header *asm_calljavamethod (methodinfo *m, *
-* void *arg1, void *arg2, void *arg3, void *arg4); *
-* *
-*******************************************************************************/
-
-call_name:
- .ascii "calljavamethod\0\0"
-
- .align 8
- .long 0 /* catch type all */
- .long calljava_xhandler /* handler pc */
- .long calljava_xhandler /* end pc */
- .long asm_calljavamethod /* start pc */
- .long 1 /* extable size */
- .long 0 /* fltsave */
- .long 0 /* intsave */
- .long 0 /* isleaf */
- .long 0 /* IsSync */
- .long 32 /* frame size */
- .long 0 /* method pointer (pointer to name) */
-
-asm_calljavamethod:
- push %ebp /* allocate stack space */
- mov %esp, %ebp
-
- push %ebx /* save registers */
- push %esi
- push %edi
-
- sub $32,%esp /* pass the remaining parameters */
- xor %edx,%edx
-
- mov %edx,28(%esp) /* convert parms to 8 byte */
- mov 24(%ebp),%eax
- mov %eax,24(%esp)
-
- mov %edx,20(%esp)
- mov 20(%ebp),%eax
- mov %eax,16(%esp)
-
- mov %edx,12(%esp)
- mov 16(%ebp),%eax
- mov %eax,8(%esp)
-
- mov %edx,4(%esp)
- mov 12(%ebp),%eax
- mov %eax,(%esp)
-
- mov 8(%ebp),%eax /* move function pointer to %eax */
-
- lea asm_call_jit_compiler,%edx
- call *%edx /* call JIT compiler */
-
-calljava_jit:
-calljava_return:
-calljava_ret:
- add $32,%esp
- pop %edi /* restore registers */
- pop %esi
- pop %ebx
-
- xor %eax,%eax
- leave /* free stack space */
- ret
-
-calljava_xhandler:
- push %eax /* pass exception pointer */
- call builtin_throw_exception
- add $4,%esp
-
- add $32,%esp
- pop %edi
- pop %esi
- pop %ebx
- leave
- ret
-
-
/********************* function asm_calljavafunction ***************************
* *
* This function calls a Java-method (which possibly needs compilation) *
Authors: Andreas Krall
Christian Thalinger
- $Id: codegen.c 766 2003-12-13 22:52:32Z twisti $
+ $Id: codegen.c 771 2003-12-13 23:11:08Z stefan $
*/
utf_new_char("<init>"),
utf_new_char("(Ljava/lang/String;)V"));
- asm_calljavamethod(m, p, javastring_new_char("/ by zero"), NULL, NULL);
+ asm_calljavafunction(m, p, javastring_new_char("/ by zero"), NULL, NULL);
sigctx->eax = (long) p; /* REG_ITMP1_XPTR */
sigctx->ecx = sigctx->eip; /* REG_ITMP2_XPC */
Authores: Christian Thalinger
- $Id: methodtable.c 764 2003-12-13 22:48:23Z twisti $
+ $Id: methodtable.c 771 2003-12-13 23:11:08Z stefan $
*/
mtentry *tmp = GCNEW(mtentry, 1);
#else
mtentry *tmp = NEW(mtentry);
-#endif
- tmp->start = (u1 *) asm_calljavamethod;
- tmp->end = (u1 *) asm_calljavafunction; /* little hack, but should work */
- tmp->next = mtroot;
- mtroot = tmp;
-
-#if 0
- tmp = GCNEW(mtentry, 1);
-#else
- tmp = NEW(mtentry);
#endif
tmp->start = (u1 *) asm_calljavafunction;
tmp->end = (u1 *) asm_calljavafunction2; /* little hack, but should work */
Changes: Joseph Wenninger
- $Id: jni.c 746 2003-12-13 22:09:31Z twisti $
+ $Id: jni.c 771 2003-12-13 23:11:08Z stefan $
*/
args[i]=va_arg(vaargs,void*);
}
va_end(vaargs);
- exceptionptr=asm_calljavamethod(methodID,o,args[0],args[1],args[2]);
+ asm_calljavafunction(methodID,o,args[0],args[1],args[2]);
return o;
}
java_objectheader *exceptionToWrap=exceptionptr;
classinfo *ivtec=loader_load_sysclass(NULL,utf_new_char("java/lang/reflect/InvocationTargetException"));
java_objectheader* ivte=builtin_new(ivtec);
- if (asm_calljavamethod(class_resolvemethod(ivtec,utf_new_char("<init>"),utf_new_char("(Ljava/lang/Throwable;)V")),
- ivte,exceptionToWrap,0,0)!=NULL) panic("jni.c: error while creating InvocationTargetException wrapper");
+ asm_calljavafunction(class_resolvemethod(ivtec,utf_new_char("<init>"),utf_new_char("(Ljava/lang/Throwable;)V")),
+ ivte,exceptionToWrap,0,0);
+ if (exceptionptr!=NULL) panic("jni.c: error while creating InvocationTargetException wrapper");
exceptionptr=ivte;
}
return retVal;
Mark Probst
Edwin Steiner
- $Id: loader.c 758 2003-12-13 22:30:00Z twisti $
+ $Id: loader.c 771 2003-12-13 23:11:08Z stefan $
*/
void class_init(classinfo *c)
{
methodinfo *m;
- java_objectheader *exceptionptr;
s4 i;
#ifdef USE_THREADS
int b;
blockInts = 0;
#endif
- exceptionptr = asm_calljavamethod(m, NULL, NULL, NULL, NULL);
+ asm_calljavafunction(m, NULL, NULL, NULL, NULL);
#ifdef USE_THREADS
assert(blockInts == 0);
blockInts = 0;
#endif
- exceptionptr = asm_calljavamethod(m, NULL, NULL, NULL, NULL);
+ asm_calljavafunction(m, NULL, NULL, NULL, NULL);
#ifdef USE_THREADS
assert(blockInts == 0);
- Calling the class loader
- Running the main method
- $Id: main.c 748 2003-12-13 22:13:59Z twisti $
+ $Id: main.c 771 2003-12-13 23:11:08Z stefan $
*/
if (startit) {
methodinfo *mainmethod;
java_objectarray *a;
- java_objectheader *local_exceptionptr = 0;
/* heap_addreference((void**) &a); */
/*class_showmethods(currentThread->group->header.vftbl->class); */
/* here we go... */
- local_exceptionptr = asm_calljavamethod(mainmethod, a, NULL, NULL, NULL);
+ asm_calljavafunction(mainmethod, a, NULL, NULL, NULL);
- if (local_exceptionptr) {
+ if (exceptionptr) {
printf("Exception in thread \"main\" ");
- utf_display(local_exceptionptr->vftbl->class->name);
+ utf_display(exceptionptr->vftbl->class->name);
/* do we have a detail message? */
if (((java_lang_Throwable *) exceptionptr)->detailMessage) {
Authors: Stefan Ring
- $Id: boehm.c 738 2003-12-13 18:41:27Z stefan $
+ $Id: boehm.c 771 2003-12-13 23:11:08Z stefan $
*/
void runboehmfinalizer(void *o, void *p)
{
java_objectheader *ob = (java_objectheader *) o;
- asm_calljavamethod(ob->vftbl->class->finalizer, ob, NULL, NULL, NULL);
+ asm_calljavafunction(ob->vftbl->class->finalizer, ob, NULL, NULL, NULL);
}
if (proplist[i][1] == NULL) proplist[i][1] = "";
- asm_calljavamethod(m,
+ asm_calljavafunction(m,
p,
javastring_new_char(proplist[i][0]),
javastring_new_char(proplist[i][1]),
The .hh files created with the header file generator are all
included here as are the C functions implementing these methods.
- $Id: native.c 755 2003-12-13 22:25:24Z twisti $
+ $Id: native.c 771 2003-12-13 23:11:08Z stefan $
*/
java_objectheader *vmo = builtin_new(class_java_lang_VMClass);
if (!vmo) panic("Error while creating instance of java/lang/VMClass");
- asm_calljavamethod(method_vmclass_init, vmo, c, NULL, NULL);
+ asm_calljavafunction(method_vmclass_init, vmo, c, NULL, NULL);
c->vmClass = (java_lang_VMClass *) vmo;
/*log_text("VMCLASS has been attached");*/
}
use_class_as_object (c);
/* call 'addClass' */
- asm_calljavamethod(m,
+ asm_calljavafunction(m,
(java_objectheader*) SystemClassLoader,
(java_objectheader*) c,
NULL,
id = envTable.GetStaticFieldID(&env,class_java_lang_ClassLoader,"loadedLibraryNames","Ljava/util/Vector;");
if (!id) panic("can not access ClassLoader");
- asm_calljavamethod(m,
+ asm_calljavafunction(m,
GetStaticObjectField(&env,class_java_lang_ClassLoader,id),
o,
NULL,
/* call initializer */
- asm_calljavamethod(m, o, NULL, NULL, NULL);
+ asm_calljavafunction(m, o, NULL, NULL, NULL);
return o;
}
/* call initializer */
- asm_calljavamethod(m, o, s, NULL, NULL);
+ asm_calljavafunction(m, o, s, NULL, NULL);
return o;
}
- Calling the class loader
- Running the main method
- $Id: cacao.c 748 2003-12-13 22:13:59Z twisti $
+ $Id: cacao.c 771 2003-12-13 23:11:08Z stefan $
*/
if (startit) {
methodinfo *mainmethod;
java_objectarray *a;
- java_objectheader *local_exceptionptr = 0;
/* heap_addreference((void**) &a); */
/*class_showmethods(currentThread->group->header.vftbl->class); */
/* here we go... */
- local_exceptionptr = asm_calljavamethod(mainmethod, a, NULL, NULL, NULL);
+ asm_calljavafunction(mainmethod, a, NULL, NULL, NULL);
- if (local_exceptionptr) {
+ if (exceptionptr) {
printf("Exception in thread \"main\" ");
- utf_display(local_exceptionptr->vftbl->class->name);
+ utf_display(exceptionptr->vftbl->class->name);
/* do we have a detail message? */
if (((java_lang_Throwable *) exceptionptr)->detailMessage) {
Changes: Mark Probst
Philipp Tomsich
- $Id: headers.c 745 2003-12-13 22:05:02Z twisti $
+ $Id: headers.c 771 2003-12-13 23:11:08Z stefan $
*/
void stringtable_update() { }
void synchronize_caches() { }
void asm_call_jit_compiler() { }
-void asm_calljavamethod() { }
+void asm_calljavafunction() { }
void asm_dumpregistersandcall() { }
s4 asm_builtin_checkcast(java_objectheader *obj, classinfo *class) { return 0; }
Authors: Stefan Ring
- $Id: boehm.c 738 2003-12-13 18:41:27Z stefan $
+ $Id: boehm.c 771 2003-12-13 23:11:08Z stefan $
*/
void runboehmfinalizer(void *o, void *p)
{
java_objectheader *ob = (java_objectheader *) o;
- asm_calljavamethod(ob->vftbl->class->finalizer, ob, NULL, NULL, NULL);
+ asm_calljavafunction(ob->vftbl->class->finalizer, ob, NULL, NULL, NULL);
}
Changes: Joseph Wenninger
- $Id: jni.c 746 2003-12-13 22:09:31Z twisti $
+ $Id: jni.c 771 2003-12-13 23:11:08Z stefan $
*/
args[i]=va_arg(vaargs,void*);
}
va_end(vaargs);
- exceptionptr=asm_calljavamethod(methodID,o,args[0],args[1],args[2]);
+ asm_calljavafunction(methodID,o,args[0],args[1],args[2]);
return o;
}
java_objectheader *exceptionToWrap=exceptionptr;
classinfo *ivtec=loader_load_sysclass(NULL,utf_new_char("java/lang/reflect/InvocationTargetException"));
java_objectheader* ivte=builtin_new(ivtec);
- if (asm_calljavamethod(class_resolvemethod(ivtec,utf_new_char("<init>"),utf_new_char("(Ljava/lang/Throwable;)V")),
- ivte,exceptionToWrap,0,0)!=NULL) panic("jni.c: error while creating InvocationTargetException wrapper");
+ asm_calljavafunction(class_resolvemethod(ivtec,utf_new_char("<init>"),utf_new_char("(Ljava/lang/Throwable;)V")),
+ ivte,exceptionToWrap,0,0);
+ if (exceptionptr!=NULL) panic("jni.c: error while creating InvocationTargetException wrapper");
exceptionptr=ivte;
}
return retVal;
The .hh files created with the header file generator are all
included here as are the C functions implementing these methods.
- $Id: native.c 755 2003-12-13 22:25:24Z twisti $
+ $Id: native.c 771 2003-12-13 23:11:08Z stefan $
*/
java_objectheader *vmo = builtin_new(class_java_lang_VMClass);
if (!vmo) panic("Error while creating instance of java/lang/VMClass");
- asm_calljavamethod(method_vmclass_init, vmo, c, NULL, NULL);
+ asm_calljavafunction(method_vmclass_init, vmo, c, NULL, NULL);
c->vmClass = (java_lang_VMClass *) vmo;
/*log_text("VMCLASS has been attached");*/
}
use_class_as_object (c);
/* call 'addClass' */
- asm_calljavamethod(m,
+ asm_calljavafunction(m,
(java_objectheader*) SystemClassLoader,
(java_objectheader*) c,
NULL,
id = envTable.GetStaticFieldID(&env,class_java_lang_ClassLoader,"loadedLibraryNames","Ljava/util/Vector;");
if (!id) panic("can not access ClassLoader");
- asm_calljavamethod(m,
+ asm_calljavafunction(m,
GetStaticObjectField(&env,class_java_lang_ClassLoader,id),
o,
NULL,
/* call initializer */
- asm_calljavamethod(m, o, NULL, NULL, NULL);
+ asm_calljavafunction(m, o, NULL, NULL, NULL);
return o;
}
/* call initializer */
- asm_calljavamethod(m, o, s, NULL, NULL);
+ asm_calljavafunction(m, o, s, NULL, NULL);
return o;
}
if (proplist[i][1] == NULL) proplist[i][1] = "";
- asm_calljavamethod(m,
+ asm_calljavafunction(m,
p,
javastring_new_char(proplist[i][0]),
javastring_new_char(proplist[i][1]),
firstStartThread(void)
{
methodinfo *method;
- java_objectheader *local_exceptionptr = NULL;
DBG( printf("firstStartThread %p\n", currentThread); );
if (method == 0)
panic("Cannot find method \'void run ()\'");
- local_exceptionptr = asm_calljavamethod(method, currentThread, NULL, NULL, NULL);
+ asm_calljavafunction(method, currentThread, NULL, NULL, NULL);
- if (local_exceptionptr) {
- utf_display(local_exceptionptr->vftbl->class->name);
+ if (exceptionptr) {
+ utf_display(exceptionptr->vftbl->class->name);
printf("\n");
}
Changes: Christian Thalinger
- $Id: asmpart.h 664 2003-11-21 18:24:01Z jowenn $
+ $Id: asmpart.h 771 2003-12-13 23:11:08Z stefan $
*/
with up to 4 parameters. This function calls a Java-method (which
possibly needs compilation) with up to 4 parameters.
*/
-java_objectheader *asm_calljavamethod(methodinfo *m, void *arg1, void *arg2,
- void *arg3, void *arg4);
/*
This function calls a Java-method (which possibly needs compilation)
Reinhard Grafl
Christian Thalinger
- $Id: asmpart.S 763 2003-12-13 22:47:44Z twisti $
+ $Id: asmpart.S 771 2003-12-13 23:11:08Z stefan $
*/
/********************* exported functions and variables ***********************/
.globl has_no_x_instr_set
- .globl asm_calljavamethod
.globl asm_calljavafunction
.globl asm_calljavafunction2
.globl asm_calljavafunction2long
ret
-/********************* function asm_calljavamethod *****************************
-* *
-* This function calls a Java-method (which possibly needs compilation) *
-* with up to 4 parameters. *
-* *
-* This functions calls the JIT-compiler which eventually translates the *
-* method into machine code. *
-* *
-* An possibly throwed exception will be returned to the caller as function *
-* return value, so the java method cannot return a fucntion value (this *
-* function usually calls 'main' and '<clinit>' which do not return a *
-* function value). *
-* *
-* C-prototype: *
-* javaobject_header *asm_calljavamethod (methodinfo *m, *
-* void *arg1, void *arg2, void *arg3, void *arg4); *
-* *
-*******************************************************************************/
-
-call_name:
- .ascii "calljavamethod\0\0"
-
- .align 8
- .long 0 /* catch type all */
- .long calljava_xhandler /* handler pc */
- .long calljava_xhandler /* end pc */
- .long asm_calljavamethod /* start pc */
- .long 1 /* extable size */
- .long 0 /* fltsave */
- .long 0 /* intsave */
- .long 0 /* isleaf */
- .long 0 /* IsSync */
- .long 32 /* frame size */
- .long 0 /* method pointer (pointer to name) */
-
-asm_calljavamethod:
- push %ebp /* allocate stack space */
- mov %esp, %ebp
-
- push %ebx /* save registers */
- push %esi
- push %edi
-
- sub $32,%esp /* pass the remaining parameters */
- xor %edx,%edx
-
- mov %edx,28(%esp) /* convert parms to 8 byte */
- mov 24(%ebp),%eax
- mov %eax,24(%esp)
-
- mov %edx,20(%esp)
- mov 20(%ebp),%eax
- mov %eax,16(%esp)
-
- mov %edx,12(%esp)
- mov 16(%ebp),%eax
- mov %eax,8(%esp)
-
- mov %edx,4(%esp)
- mov 12(%ebp),%eax
- mov %eax,(%esp)
-
- mov 8(%ebp),%eax /* move function pointer to %eax */
-
- lea asm_call_jit_compiler,%edx
- call *%edx /* call JIT compiler */
-
-calljava_jit:
-calljava_return:
-calljava_ret:
- add $32,%esp
- pop %edi /* restore registers */
- pop %esi
- pop %ebx
-
- xor %eax,%eax
- leave /* free stack space */
- ret
-
-calljava_xhandler:
- push %eax /* pass exception pointer */
- call builtin_throw_exception
- add $4,%esp
-
- add $32,%esp
- pop %edi
- pop %esi
- pop %ebx
- leave
- ret
-
-
/********************* function asm_calljavafunction ***************************
* *
* This function calls a Java-method (which possibly needs compilation) *
Authors: Andreas Krall
Christian Thalinger
- $Id: codegen.c 766 2003-12-13 22:52:32Z twisti $
+ $Id: codegen.c 771 2003-12-13 23:11:08Z stefan $
*/
utf_new_char("<init>"),
utf_new_char("(Ljava/lang/String;)V"));
- asm_calljavamethod(m, p, javastring_new_char("/ by zero"), NULL, NULL);
+ asm_calljavafunction(m, p, javastring_new_char("/ by zero"), NULL, NULL);
sigctx->eax = (long) p; /* REG_ITMP1_XPTR */
sigctx->ecx = sigctx->eip; /* REG_ITMP2_XPC */
Mark Probst
Edwin Steiner
- $Id: loader.c 758 2003-12-13 22:30:00Z twisti $
+ $Id: loader.c 771 2003-12-13 23:11:08Z stefan $
*/
void class_init(classinfo *c)
{
methodinfo *m;
- java_objectheader *exceptionptr;
s4 i;
#ifdef USE_THREADS
int b;
blockInts = 0;
#endif
- exceptionptr = asm_calljavamethod(m, NULL, NULL, NULL, NULL);
+ asm_calljavafunction(m, NULL, NULL, NULL, NULL);
#ifdef USE_THREADS
assert(blockInts == 0);
blockInts = 0;
#endif
- exceptionptr = asm_calljavamethod(m, NULL, NULL, NULL, NULL);
+ asm_calljavafunction(m, NULL, NULL, NULL, NULL);
#ifdef USE_THREADS
assert(blockInts == 0);
firstStartThread(void)
{
methodinfo *method;
- java_objectheader *local_exceptionptr = NULL;
DBG( printf("firstStartThread %p\n", currentThread); );
if (method == 0)
panic("Cannot find method \'void run ()\'");
- local_exceptionptr = asm_calljavamethod(method, currentThread, NULL, NULL, NULL);
+ asm_calljavafunction(method, currentThread, NULL, NULL, NULL);
- if (local_exceptionptr) {
- utf_display(local_exceptionptr->vftbl->class->name);
+ if (exceptionptr) {
+ utf_display(exceptionptr->vftbl->class->name);
printf("\n");
}