Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: method.c 8295 2007-08-11 17:57:24Z michi $
-
*/
#include "mm/memory.h"
+#include "native/llni.h"
+
#include "threads/lock-common.h"
#include "vm/builtin.h"
*******************************************************************************/
-java_objectarray *method_get_parametertypearray(methodinfo *m)
+java_handle_objectarray_t *method_get_parametertypearray(methodinfo *m)
{
- methoddesc *md;
- typedesc *paramtypes;
- int32_t paramcount;
- java_objectarray *oa;
- int32_t i;
- classinfo *c;
+ methoddesc *md;
+ typedesc *paramtypes;
+ int32_t paramcount;
+ java_handle_objectarray_t *oa;
+ int32_t i;
+ classinfo *c;
md = m->parseddesc;
if (!resolve_class_from_typedesc(¶mtypes[i], true, false, &c))
return NULL;
- oa->data[i] = c;
+ LLNI_array_direct(oa, i) = (java_object_t *) c;
}
return oa;
*******************************************************************************/
-java_objectarray *method_get_exceptionarray(methodinfo *m)
+java_handle_objectarray_t *method_get_exceptionarray(methodinfo *m)
{
- java_objectarray *oa;
- classinfo *c;
- s4 i;
+ java_handle_objectarray_t *oa;
+ classinfo *c;
+ s4 i;
/* create class-array */
if (c == NULL)
return NULL;
- oa->data[i] = c;
+ LLNI_array_direct(oa, i) = (java_object_t *) c;
}
return oa;
}
-#if defined(ENABLE_ANNOTATIONS)
/* method_get_annotations ******************************************************
Gets a methods' annotations (or NULL if none).
*******************************************************************************/
-annotation_bytearray_t *method_get_annotations(methodinfo *m)
+java_handle_bytearray_t *method_get_annotations(methodinfo *m)
{
- classinfo *c = m->class;
- int slot = m - c->methods;
-
+#if defined(ENABLE_ANNOTATIONS)
+ classinfo *c;
+ int slot;
+ annotation_bytearray_t *ba;
+ java_handle_bytearray_t *annotations;
+
+ c = m->class;
+ slot = m - c->methods;
+ annotations = NULL;
+
if (c->method_annotations != NULL && c->method_annotations->size > slot) {
- return c->method_annotations->data[slot];
+ ba = c->method_annotations->data[slot];
+
+ if (ba != NULL) {
+ annotations = builtin_newarray_byte(ba->size);
+
+ if (annotations != NULL) {
+ MCOPY(annotations->data, ba->data, uint8_t, ba->size);
+ }
+ }
}
-
+
+ return annotations;
+#else
return NULL;
+#endif
}
*******************************************************************************/
-annotation_bytearray_t *method_get_parameterannotations(methodinfo *m)
+java_handle_bytearray_t *method_get_parameterannotations(methodinfo *m)
{
- classinfo *c = m->class;
- int slot = m - c->methods;
+#if defined(ENABLE_ANNOTATIONS)
+ classinfo *c;
+ int slot;
+ annotation_bytearray_t *ba;
+ java_handle_bytearray_t *parameterAnnotations;
+
+ c = m->class;
+ slot = m - c->methods;
+ parameterAnnotations = NULL;
if (c->method_parameterannotations != NULL &&
c->method_parameterannotations->size > slot) {
- return c->method_parameterannotations->data[slot];
+ ba = c->method_parameterannotations->data[slot];
+
+ if (ba != NULL) {
+ parameterAnnotations = builtin_newarray_byte(ba->size);
+
+ if (parameterAnnotations != NULL) {
+ MCOPY(parameterAnnotations->data, ba->data, uint8_t, ba->size);
+ }
+ }
}
-
+
+ return parameterAnnotations;
+#else
return NULL;
+#endif
}
*******************************************************************************/
-annotation_bytearray_t *method_get_annotationdefault(methodinfo *m)
+java_handle_bytearray_t *method_get_annotationdefault(methodinfo *m)
{
- classinfo *c = m->class;
- int slot = m - c->methods;
+#if defined(ENABLE_ANNOTATIONS)
+ classinfo *c;
+ int slot;
+ annotation_bytearray_t *ba;
+ java_handle_bytearray_t *annotationDefault;
+
+ c = m->class;
+ slot = m - c->methods;
+ annotationDefault = NULL;
if (c->method_annotationdefaults != NULL &&
c->method_annotationdefaults->size > slot) {
- return c->method_annotationdefaults->data[slot];
+ ba = c->method_annotationdefaults->data[slot];
+
+ if (ba != NULL) {
+ annotationDefault = builtin_newarray_byte(ba->size);
+
+ if (annotationDefault != NULL) {
+ MCOPY(annotationDefault->data, ba->data, uint8_t, ba->size);
+ }
+ }
}
-
+
+ return annotationDefault;
+#else
return NULL;
-}
#endif
+}
/* method_add_to_worklist ******************************************************