#include "native/llni.h"
-#include "vm/exceptions.h"
+#include "vm/array.h"
#include "vm/global.h"
#include "vm/primitive.h"
#include "vm/resolve.h"
/* argument_vmarray_from_valist ************************************************
- XXX
+ Creates an argument array which can be passed to asm_vm_call_method.
+ The array is created from the passed valist.
ATTENTION: This function has to be used outside the native world.
/* argument_vmarray_from_jvalue ************************************************
- XXX
+ Creates an argument array which can be passed to asm_vm_call_method.
+ The array is created from the passed jvalue array.
ATTENTION: This function has to be used outside the native world.
break;
case TYPE_ADR:
- argument_vmarray_store_adr(array, pd, args[j].l);
+ argument_vmarray_store_adr(array, pd, (java_handle_t *) args[j].l);
break;
}
}
/* argument_vmarray_from_objectarray *******************************************
- XXX
+ Creates an argument array which can be passed to asm_vm_call_method.
+ The array is created from the passed objectarray of boxed values.
ATTENTION: This function has to be used outside the native world.
+ RETURN VALUE:
+ NULL.........indicates an error while creating the array
+ (-1).........no error, but an empty array
+ otherwise....array containing the argument values
+
*******************************************************************************/
uint64_t *argument_vmarray_from_objectarray(methodinfo *m, java_handle_t *o,
array = DMNEW(uint64_t, INT_ARG_CNT + FLT_ARG_CNT + md->memuse);
+ /* The array can be NULL if we don't have any arguments to pass
+ and the architecture does not have any argument registers
+ (e.g. i386). In that case we return (-1) to indicate
+ that no exception should be thrown */
+
+ if (array == NULL)
+ array = (uint64_t *)(-1);
+
/* if method is non-static fill first block and skip `this' pointer */
i = 0;
}
for (j = 0; i < md->paramcount; i++, j++, pd++, td++) {
- LLNI_objectarray_element_get(params, j, param);
+ /* XXX This function can throw an exception, which should not happend
+ here, since we are outside the nativeworld. */
+ param = array_objectarray_element_get(params, j);
switch (td->type) {
case TYPE_INT:
- if (param == NULL) {
- exceptions_throw_illegalargumentexception();
+ if (param == NULL)
return NULL;
- }
/* convert the value according to its declared type */
/* This type is OK. */
break;
default:
- exceptions_throw_illegalargumentexception();
return NULL;
}
break;
/* This type is OK. */
break;
default:
- exceptions_throw_illegalargumentexception();
return NULL;
}
break;
/* This type is OK. */
break;
default:
- exceptions_throw_illegalargumentexception();
return NULL;
}
break;
/* These types are OK. */
break;
default:
- exceptions_throw_illegalargumentexception();
return NULL;
}
break;
/* These types are OK. */
break;
default:
- exceptions_throw_illegalargumentexception();
return NULL;
}
break;
break;
case TYPE_LNG:
- if (param == NULL) {
- exceptions_throw_illegalargumentexception();
+ if (param == NULL)
return NULL;
- }
LLNI_class_get(param, c);
type = primitive_type_get_by_wrapperclass(c);
/* These types are OK. */
break;
default:
- exceptions_throw_illegalargumentexception();
return NULL;
}
break;
case TYPE_FLT:
- if (param == NULL) {
- exceptions_throw_illegalargumentexception();
+ if (param == NULL)
return NULL;
- }
LLNI_class_get(param, c);
type = primitive_type_get_by_wrapperclass(c);
/* This type is OK. */
break;
default:
- exceptions_throw_illegalargumentexception();
return NULL;
}
break;
case TYPE_DBL:
- if (param == NULL) {
- exceptions_throw_illegalargumentexception();
+ if (param == NULL)
return NULL;
- }
LLNI_class_get(param, c);
type = primitive_type_get_by_wrapperclass(c);
/* These types are OK. */
break;
default:
- exceptions_throw_illegalargumentexception();
return NULL;
}
if (param != NULL) {
if (td->arraydim > 0) {
- if (!builtin_arrayinstanceof(param, c)) {
- exceptions_throw_illegalargumentexception();
+ if (!builtin_arrayinstanceof(param, c))
return NULL;
- }
}
else {
- if (!builtin_instanceof(param, c)) {
- exceptions_throw_illegalargumentexception();
+ if (!builtin_instanceof(param, c))
return NULL;
- }
}
}