* src/vm/array.h: Likewise.
* src/vm/array.cpp: New file.
* src/vm/array.hpp: Likewise.
* src/mm/cacao-gc/heap.h,
src/native/jni.cpp,
src/native/vm/gnuclasspath/java_lang_VMThrowable.cpp,
src/native/vm/openjdk/jvm.cpp,
src/vm/Makefile.am,
src/vm/annotation.c,
src/vm/class.c,
src/vm/field.cpp,
src/vm/jit/argument.cpp,
src/vm/jit/builtin.cpp,
src/vm/jit/stacktrace.cpp,
src/vm/jit/verify/typecheck-stackbased.c,
src/vm/jit/verify/typecheck-typeinferer.c,
src/vm/jit/verify/typecheck.c,
src/vm/jit/verify/typeinfo.c,
src/vm/linker.c,
src/vm/method.c,
src/vm/primitive.cpp,
src/vm/primitive.hpp,
src/vm/string.cpp,
src/vm/vm.cpp: Related changes.
--HG--
rename : src/vm/array.c => src/vm/array.cpp
rename : src/vm/array.h => src/vm/array.hpp
#include "gc.h"
#include "region.h"
-#include "vm/array.h" /* needed for ARRAYTYPE_OBJECT */
+#include "vm/array.hpp" /* needed for ARRAYTYPE_OBJECT */
#define GC_SIZE_DUMMY 0xff
#include "toolbox/logging.h"
-#include "vm/array.h"
+#include "vm/array.hpp"
#include "vm/jit/builtin.hpp"
#include "vm/exceptions.hpp"
#include "vm/global.h"
# include "native/vm/include/java_lang_VMThrowable.h"
#endif
-#include "vm/array.h"
+#include "vm/array.hpp"
#include "vm/jit/builtin.hpp"
#include "vm/exceptions.hpp"
#include "vm/globals.hpp"
#include "toolbox/logging.h"
#include "toolbox/list.hpp"
-#include "vm/array.h"
+#include "vm/array.hpp"
#if defined(ENABLE_ASSERTION)
#include "vm/assertion.hpp"
access.c \
access.h \
$(ANNOTATION_SOURCES) \
- array.c \
- array.h \
+ array.cpp \
+ array.hpp \
$(ASSERTION_SOURCES) \
class.c \
class.h \
#include "toolbox/logging.h"
#include "vm/annotation.h"
-#include "vm/array.h"
+#include "vm/array.hpp"
#include "vm/jit/builtin.hpp"
#include "vm/class.h"
#include "vm/loader.hpp"
+++ /dev/null
-/* src/vm/array.c - Java array functions
-
- Copyright (C) 2007
- CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
-
- This file is part of CACAO.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-
-*/
-
-
-#include "config.h"
-
-#include <stdint.h>
-
-#include "native/llni.h"
-
-#include "vm/array.h"
-#include "vm/exceptions.hpp"
-#include "vm/global.h"
-#include "vm/primitive.hpp"
-#include "vm/vm.hpp"
-
-
-/* array_element_get ***********************************************************
-
- Returns a boxed element of the given Java array.
-
-*******************************************************************************/
-
-java_handle_t *array_element_get(java_handle_t *a, int32_t index)
-{
- vftbl_t *v;
- int type;
- imm_union value;
- java_handle_t *o;
-
- if (a == NULL) {
- exceptions_throw_nullpointerexception();
- return NULL;
- }
-
- v = LLNI_vftbl_direct(a);
-
- type = v->arraydesc->arraytype;
-
- value = array_element_primitive_get(a, index);
-
- o = Primitive_box(type, value);
-
- return o;
-}
-
-
-/* array_element_set ***********************************************************
-
- Sets a boxed element in the given Java array.
-
-*******************************************************************************/
-
-void array_element_set(java_handle_t *a, int32_t index, java_handle_t *o)
-{
- imm_union value;
-
- value = Primitive_unbox(o);
-
- array_element_primitive_set(a, index, value);
-}
-
-
-/* array_element_primitive_get *************************************************
-
- Returns a primitive element of the given Java array.
-
-*******************************************************************************/
-
-imm_union array_element_primitive_get(java_handle_t *a, int32_t index)
-{
- vftbl_t *v;
- int type;
- imm_union value;
-
- if (a == NULL) {
- exceptions_throw_nullpointerexception();
- value.a = NULL;
- return value;
- }
-
- v = LLNI_vftbl_direct(a);
-
- type = v->arraydesc->arraytype;
-
- switch (type) {
- case ARRAYTYPE_BOOLEAN:
- value.i = array_booleanarray_element_get((java_handle_booleanarray_t *) a, index);
- break;
- case ARRAYTYPE_BYTE:
- value.i = array_bytearray_element_get((java_handle_bytearray_t *) a,
- index);
- break;
- case ARRAYTYPE_CHAR:
- value.i = array_chararray_element_get((java_handle_chararray_t *) a,
- index);
- break;
- case ARRAYTYPE_SHORT:
- value.i = array_shortarray_element_get((java_handle_shortarray_t *) a,
- index);
- break;
- case ARRAYTYPE_INT:
- value.i = array_intarray_element_get((java_handle_intarray_t *) a,
- index);
- break;
- case ARRAYTYPE_LONG:
- value.l = array_longarray_element_get((java_handle_longarray_t *) a,
- index);
- break;
- case ARRAYTYPE_FLOAT:
- value.f = array_floatarray_element_get((java_handle_floatarray_t *) a,
- index);
- break;
- case ARRAYTYPE_DOUBLE:
- value.d = array_doublearray_element_get((java_handle_doublearray_t *) a,
- index);
- break;
- case ARRAYTYPE_OBJECT:
- value.a = array_objectarray_element_get((java_handle_objectarray_t *) a,
- index);
- break;
- default:
- vm_abort("array_element_primitive_get: invalid array element type %d",
- type);
- }
-
- return value;
-}
-
-
-/* array_element_primitive_set *************************************************
-
- Sets a primitive element in the given Java array.
-
-*******************************************************************************/
-
-void array_element_primitive_set(java_handle_t *a, int32_t index, imm_union value)
-{
- vftbl_t *v;
- int type;
-
- if (a == NULL) {
- exceptions_throw_nullpointerexception();
- return;
- }
-
- v = LLNI_vftbl_direct(a);
-
- type = v->arraydesc->arraytype;
-
- switch (type) {
- case ARRAYTYPE_BOOLEAN:
- array_booleanarray_element_set((java_handle_booleanarray_t *) a,
- index, value.i);
- break;
- case ARRAYTYPE_BYTE:
- array_bytearray_element_set((java_handle_bytearray_t *) a,
- index, value.i);
- break;
- case ARRAYTYPE_CHAR:
- array_chararray_element_set((java_handle_chararray_t *) a,
- index, value.i);
- break;
- case ARRAYTYPE_SHORT:
- array_shortarray_element_set((java_handle_shortarray_t *) a,
- index, value.i);
- break;
- case ARRAYTYPE_INT:
- array_intarray_element_set((java_handle_intarray_t *) a,
- index, value.i);
- break;
- case ARRAYTYPE_LONG:
- array_longarray_element_set((java_handle_longarray_t *) a,
- index, value.l);
- break;
- case ARRAYTYPE_FLOAT:
- array_floatarray_element_set((java_handle_floatarray_t *) a,
- index, value.f);
- break;
- case ARRAYTYPE_DOUBLE:
- array_doublearray_element_set((java_handle_doublearray_t *) a,
- index, value.d);
- break;
- case ARRAYTYPE_OBJECT:
- array_objectarray_element_set((java_handle_objectarray_t *) a,
- index, value.a);
- break;
- default:
- vm_abort("array_element_primitive_set: invalid array element type %d",
- type);
- }
-}
-
-
-/* array_xxxarray_element_get **************************************************
-
- Returns a primitive element of the given Java array.
-
-*******************************************************************************/
-
-#define ARRAY_TYPEARRAY_ELEMENT_GET(name, type) \
-type array_##name##array_element_get(java_handle_##name##array_t *a, int32_t index) \
-{ \
- type value; \
- int32_t size; \
- \
- if (a == NULL) { \
- exceptions_throw_nullpointerexception(); \
- return (type) 0; \
- } \
- \
- size = LLNI_array_size(a); \
- \
- if ((index < 0) || (index >= size)) { \
- exceptions_throw_arrayindexoutofboundsexception(); \
- return (type) 0; \
- } \
- \
- value = LLNI_array_direct(a, index); \
- \
- return value; \
-}
-
-java_handle_t *array_objectarray_element_get(java_handle_objectarray_t *a, int32_t index)
-{
- java_handle_t *value;
- int32_t size;
-
- if (a == NULL) {
- exceptions_throw_nullpointerexception();
- return NULL;
- }
-
- size = LLNI_array_size(a);
-
- if ((index < 0) || (index >= size)) {
- exceptions_throw_arrayindexoutofboundsexception();
- return NULL;
- }
-
- LLNI_CRITICAL_START;
- value = LLNI_WRAP(LLNI_array_direct(a, index));
- LLNI_CRITICAL_END;
-
- return value;
-}
-
-ARRAY_TYPEARRAY_ELEMENT_GET(boolean, uint8_t)
-ARRAY_TYPEARRAY_ELEMENT_GET(byte, int8_t)
-ARRAY_TYPEARRAY_ELEMENT_GET(char, uint16_t)
-ARRAY_TYPEARRAY_ELEMENT_GET(short, int16_t)
-ARRAY_TYPEARRAY_ELEMENT_GET(int, int32_t)
-ARRAY_TYPEARRAY_ELEMENT_GET(long, int64_t)
-ARRAY_TYPEARRAY_ELEMENT_GET(float, float)
-ARRAY_TYPEARRAY_ELEMENT_GET(double, double)
-
-
-/* array_xxxarray_element_set **************************************************
-
- Sets a primitive element in the given Java array.
-
-*******************************************************************************/
-
-#define ARRAY_TYPEARRAY_ELEMENT_SET(name, type) \
-void array_##name##array_element_set(java_handle_##name##array_t *a, int32_t index, type value) \
-{ \
- int32_t size; \
- \
- if (a == NULL) { \
- exceptions_throw_nullpointerexception(); \
- return; \
- } \
- \
- size = LLNI_array_size(a); \
- \
- if ((index < 0) || (index >= size)) { \
- exceptions_throw_arrayindexoutofboundsexception(); \
- return; \
- } \
- \
- LLNI_array_direct(a, index) = value; \
-}
-
-void array_objectarray_element_set(java_handle_objectarray_t *a, int32_t index, java_handle_t *value)
-{
- int32_t size;
-
- if (a == NULL) {
- exceptions_throw_nullpointerexception();
- return;
- }
-
- /* Sanity check. */
-
- assert(a->header.objheader.vftbl->arraydesc->arraytype == ARRAYTYPE_OBJECT);
-
- if (value != NULL) {
- if (builtin_canstore(a, value) == false) {
- exceptions_throw_illegalargumentexception();
- return;
- }
- }
-
- size = LLNI_array_size(a);
-
- if ((index < 0) || (index >= size)) {
- exceptions_throw_arrayindexoutofboundsexception();
- return;
- }
-
- LLNI_CRITICAL_START;
- LLNI_array_direct(a, index) = LLNI_UNWRAP(value);
- LLNI_CRITICAL_END;
-}
-
-ARRAY_TYPEARRAY_ELEMENT_SET(boolean, uint8_t)
-ARRAY_TYPEARRAY_ELEMENT_SET(byte, int8_t)
-ARRAY_TYPEARRAY_ELEMENT_SET(char, uint16_t)
-ARRAY_TYPEARRAY_ELEMENT_SET(short, int16_t)
-ARRAY_TYPEARRAY_ELEMENT_SET(int, int32_t)
-ARRAY_TYPEARRAY_ELEMENT_SET(long, int64_t)
-ARRAY_TYPEARRAY_ELEMENT_SET(float, float)
-ARRAY_TYPEARRAY_ELEMENT_SET(double, double)
-
-
-/* array_length_get ***********************************************************
-
- Returns a the length of the given Java array.
-
- ARGUMENTS:
- a ... Java array
-
- RETURN VALUE:
- -1 ... exception thrown
- >= 0 ... length of the Java array
-
-*******************************************************************************/
-
-int32_t array_length_get(java_handle_t *a)
-{
- classinfo *c;
- int32_t size;
-
- if (a == NULL) {
- exceptions_throw_nullpointerexception();
- return -1;
- }
-
- LLNI_class_get(a, c);
-
- if (!class_is_array(c)) {
-/* exceptions_throw_illegalargumentexception("Argument is not an array"); */
- exceptions_throw_illegalargumentexception();
- return -1;
- }
-
- size = LLNI_array_size(a);
-
- return size;
-}
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim:noexpandtab:sw=4:ts=4:
- */
--- /dev/null
+/* src/vm/array.cpp - Java array functions
+
+ Copyright (C) 2007
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
+
+ This file is part of CACAO.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+*/
+
+
+#include "config.h"
+
+#include <stdint.h>
+
+#include "native/llni.h"
+
+#include "vm/array.hpp"
+#include "vm/exceptions.hpp"
+#include "vm/global.h"
+#include "vm/primitive.hpp"
+#include "vm/vm.hpp"
+
+
+/* array_element_get ***********************************************************
+
+ Returns a boxed element of the given Java array.
+
+*******************************************************************************/
+
+java_handle_t *array_element_get(java_handle_t *a, int32_t index)
+{
+ vftbl_t *v;
+ int type;
+ imm_union value;
+ java_handle_t *o;
+
+ if (a == NULL) {
+ exceptions_throw_nullpointerexception();
+ return NULL;
+ }
+
+ v = LLNI_vftbl_direct(a);
+
+ type = v->arraydesc->arraytype;
+
+ value = array_element_primitive_get(a, index);
+
+ o = Primitive::box(type, value);
+
+ return o;
+}
+
+
+/* array_element_set ***********************************************************
+
+ Sets a boxed element in the given Java array.
+
+*******************************************************************************/
+
+void array_element_set(java_handle_t *a, int32_t index, java_handle_t *o)
+{
+ imm_union value;
+
+ value = Primitive::unbox(o);
+
+ array_element_primitive_set(a, index, value);
+}
+
+
+/* array_element_primitive_get *************************************************
+
+ Returns a primitive element of the given Java array.
+
+*******************************************************************************/
+
+imm_union array_element_primitive_get(java_handle_t *a, int32_t index)
+{
+ vftbl_t *v;
+ int type;
+ imm_union value;
+
+ if (a == NULL) {
+ exceptions_throw_nullpointerexception();
+ value.a = NULL;
+ return value;
+ }
+
+ v = LLNI_vftbl_direct(a);
+
+ type = v->arraydesc->arraytype;
+
+ switch (type) {
+ case ARRAYTYPE_BOOLEAN:
+ value.i = array_booleanarray_element_get((java_handle_booleanarray_t *) a, index);
+ break;
+ case ARRAYTYPE_BYTE:
+ value.i = array_bytearray_element_get((java_handle_bytearray_t *) a,
+ index);
+ break;
+ case ARRAYTYPE_CHAR:
+ value.i = array_chararray_element_get((java_handle_chararray_t *) a,
+ index);
+ break;
+ case ARRAYTYPE_SHORT:
+ value.i = array_shortarray_element_get((java_handle_shortarray_t *) a,
+ index);
+ break;
+ case ARRAYTYPE_INT:
+ value.i = array_intarray_element_get((java_handle_intarray_t *) a,
+ index);
+ break;
+ case ARRAYTYPE_LONG:
+ value.l = array_longarray_element_get((java_handle_longarray_t *) a,
+ index);
+ break;
+ case ARRAYTYPE_FLOAT:
+ value.f = array_floatarray_element_get((java_handle_floatarray_t *) a,
+ index);
+ break;
+ case ARRAYTYPE_DOUBLE:
+ value.d = array_doublearray_element_get((java_handle_doublearray_t *) a,
+ index);
+ break;
+ case ARRAYTYPE_OBJECT:
+ value.a = array_objectarray_element_get((java_handle_objectarray_t *) a,
+ index);
+ break;
+ default:
+ vm_abort("array_element_primitive_get: invalid array element type %d",
+ type);
+ }
+
+ return value;
+}
+
+
+/* array_element_primitive_set *************************************************
+
+ Sets a primitive element in the given Java array.
+
+*******************************************************************************/
+
+void array_element_primitive_set(java_handle_t *a, int32_t index, imm_union value)
+{
+ vftbl_t *v;
+ int type;
+
+ if (a == NULL) {
+ exceptions_throw_nullpointerexception();
+ return;
+ }
+
+ v = LLNI_vftbl_direct(a);
+
+ type = v->arraydesc->arraytype;
+
+ switch (type) {
+ case ARRAYTYPE_BOOLEAN:
+ array_booleanarray_element_set((java_handle_booleanarray_t *) a,
+ index, value.i);
+ break;
+ case ARRAYTYPE_BYTE:
+ array_bytearray_element_set((java_handle_bytearray_t *) a,
+ index, value.i);
+ break;
+ case ARRAYTYPE_CHAR:
+ array_chararray_element_set((java_handle_chararray_t *) a,
+ index, value.i);
+ break;
+ case ARRAYTYPE_SHORT:
+ array_shortarray_element_set((java_handle_shortarray_t *) a,
+ index, value.i);
+ break;
+ case ARRAYTYPE_INT:
+ array_intarray_element_set((java_handle_intarray_t *) a,
+ index, value.i);
+ break;
+ case ARRAYTYPE_LONG:
+ array_longarray_element_set((java_handle_longarray_t *) a,
+ index, value.l);
+ break;
+ case ARRAYTYPE_FLOAT:
+ array_floatarray_element_set((java_handle_floatarray_t *) a,
+ index, value.f);
+ break;
+ case ARRAYTYPE_DOUBLE:
+ array_doublearray_element_set((java_handle_doublearray_t *) a,
+ index, value.d);
+ break;
+ case ARRAYTYPE_OBJECT:
+ array_objectarray_element_set((java_handle_objectarray_t *) a,
+ index, static_cast<java_handle_t*>(value.a));
+ break;
+ default:
+ vm_abort("array_element_primitive_set: invalid array element type %d",
+ type);
+ }
+}
+
+
+/* array_xxxarray_element_get **************************************************
+
+ Returns a primitive element of the given Java array.
+
+*******************************************************************************/
+
+#define ARRAY_TYPEARRAY_ELEMENT_GET(name, type) \
+type array_##name##array_element_get(java_handle_##name##array_t *a, int32_t index) \
+{ \
+ type value; \
+ int32_t size; \
+ \
+ if (a == NULL) { \
+ exceptions_throw_nullpointerexception(); \
+ return (type) 0; \
+ } \
+ \
+ size = LLNI_array_size(a); \
+ \
+ if ((index < 0) || (index >= size)) { \
+ exceptions_throw_arrayindexoutofboundsexception(); \
+ return (type) 0; \
+ } \
+ \
+ value = LLNI_array_direct(a, index); \
+ \
+ return value; \
+}
+
+java_handle_t *array_objectarray_element_get(java_handle_objectarray_t *a, int32_t index)
+{
+ java_handle_t *value;
+ int32_t size;
+
+ if (a == NULL) {
+ exceptions_throw_nullpointerexception();
+ return NULL;
+ }
+
+ size = LLNI_array_size(a);
+
+ if ((index < 0) || (index >= size)) {
+ exceptions_throw_arrayindexoutofboundsexception();
+ return NULL;
+ }
+
+ LLNI_CRITICAL_START;
+ value = LLNI_WRAP(LLNI_array_direct(a, index));
+ LLNI_CRITICAL_END;
+
+ return value;
+}
+
+ARRAY_TYPEARRAY_ELEMENT_GET(boolean, uint8_t)
+ARRAY_TYPEARRAY_ELEMENT_GET(byte, int8_t)
+ARRAY_TYPEARRAY_ELEMENT_GET(char, uint16_t)
+ARRAY_TYPEARRAY_ELEMENT_GET(short, int16_t)
+ARRAY_TYPEARRAY_ELEMENT_GET(int, int32_t)
+ARRAY_TYPEARRAY_ELEMENT_GET(long, int64_t)
+ARRAY_TYPEARRAY_ELEMENT_GET(float, float)
+ARRAY_TYPEARRAY_ELEMENT_GET(double, double)
+
+
+/* array_xxxarray_element_set **************************************************
+
+ Sets a primitive element in the given Java array.
+
+*******************************************************************************/
+
+#define ARRAY_TYPEARRAY_ELEMENT_SET(name, type) \
+void array_##name##array_element_set(java_handle_##name##array_t *a, int32_t index, type value) \
+{ \
+ int32_t size; \
+ \
+ if (a == NULL) { \
+ exceptions_throw_nullpointerexception(); \
+ return; \
+ } \
+ \
+ size = LLNI_array_size(a); \
+ \
+ if ((index < 0) || (index >= size)) { \
+ exceptions_throw_arrayindexoutofboundsexception(); \
+ return; \
+ } \
+ \
+ LLNI_array_direct(a, index) = value; \
+}
+
+void array_objectarray_element_set(java_handle_objectarray_t *a, int32_t index, java_handle_t *value)
+{
+ int32_t size;
+
+ if (a == NULL) {
+ exceptions_throw_nullpointerexception();
+ return;
+ }
+
+ /* Sanity check. */
+
+ assert(a->header.objheader.vftbl->arraydesc->arraytype == ARRAYTYPE_OBJECT);
+
+ if (value != NULL) {
+ if (builtin_canstore(a, value) == false) {
+ exceptions_throw_illegalargumentexception();
+ return;
+ }
+ }
+
+ size = LLNI_array_size(a);
+
+ if ((index < 0) || (index >= size)) {
+ exceptions_throw_arrayindexoutofboundsexception();
+ return;
+ }
+
+ LLNI_CRITICAL_START;
+ LLNI_array_direct(a, index) = LLNI_UNWRAP(value);
+ LLNI_CRITICAL_END;
+}
+
+ARRAY_TYPEARRAY_ELEMENT_SET(boolean, uint8_t)
+ARRAY_TYPEARRAY_ELEMENT_SET(byte, int8_t)
+ARRAY_TYPEARRAY_ELEMENT_SET(char, uint16_t)
+ARRAY_TYPEARRAY_ELEMENT_SET(short, int16_t)
+ARRAY_TYPEARRAY_ELEMENT_SET(int, int32_t)
+ARRAY_TYPEARRAY_ELEMENT_SET(long, int64_t)
+ARRAY_TYPEARRAY_ELEMENT_SET(float, float)
+ARRAY_TYPEARRAY_ELEMENT_SET(double, double)
+
+
+/* array_length_get ***********************************************************
+
+ Returns a the length of the given Java array.
+
+ ARGUMENTS:
+ a ... Java array
+
+ RETURN VALUE:
+ -1 ... exception thrown
+ >= 0 ... length of the Java array
+
+*******************************************************************************/
+
+int32_t array_length_get(java_handle_t *a)
+{
+ classinfo *c;
+ int32_t size;
+
+ if (a == NULL) {
+ exceptions_throw_nullpointerexception();
+ return -1;
+ }
+
+ LLNI_class_get(a, c);
+
+ if (!class_is_array(c)) {
+/* exceptions_throw_illegalargumentexception("Argument is not an array"); */
+ exceptions_throw_illegalargumentexception();
+ return -1;
+ }
+
+ size = LLNI_array_size(a);
+
+ return size;
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
+++ /dev/null
-/* src/vm/array.h - Java array functions
-
- Copyright (C) 2007
- CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
-
- This file is part of CACAO.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA.
-
-*/
-
-
-#ifndef _VM_ARRAY_H
-#define _VM_ARRAY_H
-
-#include "config.h"
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "vm/global.h"
-#include "vm/primitive.hpp"
-
-
-/* array types ****************************************************************/
-
-/* CAUTION: Don't change the numerical values! These constants (with
- the exception of ARRAYTYPE_OBJECT) are used as indices in the
- primitive type table. */
-
-#define ARRAYTYPE_INT PRIMITIVETYPE_INT
-#define ARRAYTYPE_LONG PRIMITIVETYPE_LONG
-#define ARRAYTYPE_FLOAT PRIMITIVETYPE_FLOAT
-#define ARRAYTYPE_DOUBLE PRIMITIVETYPE_DOUBLE
-#define ARRAYTYPE_BYTE PRIMITIVETYPE_BYTE
-#define ARRAYTYPE_CHAR PRIMITIVETYPE_CHAR
-#define ARRAYTYPE_SHORT PRIMITIVETYPE_SHORT
-#define ARRAYTYPE_BOOLEAN PRIMITIVETYPE_BOOLEAN
-#define ARRAYTYPE_OBJECT PRIMITIVETYPE_VOID /* don't use as index! */
-
-
-/* function prototypes ********************************************************/
-
-java_handle_t *array_element_get(java_handle_t *a, int32_t index);
-void array_element_set(java_handle_t *a, int32_t index, java_handle_t *o);
-
-imm_union array_element_primitive_get(java_handle_t *a, int32_t index);
-void array_element_primitive_set(java_handle_t *a, int32_t index, imm_union value);
-
-uint8_t array_booleanarray_element_get(java_handle_booleanarray_t *a, int32_t index);
-int8_t array_bytearray_element_get(java_handle_bytearray_t *a, int32_t index);
-uint16_t array_chararray_element_get(java_handle_chararray_t *a, int32_t index);
-int16_t array_shortarray_element_get(java_handle_shortarray_t *a, int32_t index);
-int32_t array_intarray_element_get(java_handle_intarray_t *a, int32_t index);
-int64_t array_longarray_element_get(java_handle_longarray_t *a, int32_t index);
-float array_floatarray_element_get(java_handle_floatarray_t *a, int32_t index);
-double array_doublearray_element_get(java_handle_doublearray_t *a, int32_t index);
-java_handle_t *array_objectarray_element_get(java_handle_objectarray_t *a, int32_t index);
-
-void array_booleanarray_element_set(java_handle_booleanarray_t *a, int32_t index, uint8_t value);
-void array_bytearray_element_set(java_handle_bytearray_t *a, int32_t index, int8_t value);
-void array_chararray_element_set(java_handle_chararray_t *a, int32_t index, uint16_t value);
-void array_shortarray_element_set(java_handle_shortarray_t *a, int32_t index, int16_t value);
-void array_intarray_element_set(java_handle_intarray_t *a, int32_t index, int32_t value);
-void array_longarray_element_set(java_handle_longarray_t *a, int32_t index, int64_t value);
-void array_floatarray_element_set(java_handle_floatarray_t *a, int32_t index, float value);
-void array_doublearray_element_set(java_handle_doublearray_t *a, int32_t index, double value);
-void array_objectarray_element_set(java_handle_objectarray_t *a, int32_t index, java_handle_t *value);
-
-int32_t array_length_get(java_handle_t *a);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _VM_ARRAY_H */
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim:noexpandtab:sw=4:ts=4:
- */
--- /dev/null
+/* src/vm/array.hpp - Java array functions
+
+ Copyright (C) 2007
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
+
+ This file is part of CACAO.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+*/
+
+
+#ifndef _VM_ARRAY_HPP
+#define _VM_ARRAY_HPP
+
+#include "config.h"
+
+#include <stdint.h>
+
+#include "vm/global.h"
+#include "vm/primitive.hpp"
+
+
+/* array types ****************************************************************/
+
+/* CAUTION: Don't change the numerical values! These constants (with
+ the exception of ARRAYTYPE_OBJECT) are used as indices in the
+ primitive type table. */
+
+#define ARRAYTYPE_INT PRIMITIVETYPE_INT
+#define ARRAYTYPE_LONG PRIMITIVETYPE_LONG
+#define ARRAYTYPE_FLOAT PRIMITIVETYPE_FLOAT
+#define ARRAYTYPE_DOUBLE PRIMITIVETYPE_DOUBLE
+#define ARRAYTYPE_BYTE PRIMITIVETYPE_BYTE
+#define ARRAYTYPE_CHAR PRIMITIVETYPE_CHAR
+#define ARRAYTYPE_SHORT PRIMITIVETYPE_SHORT
+#define ARRAYTYPE_BOOLEAN PRIMITIVETYPE_BOOLEAN
+#define ARRAYTYPE_OBJECT PRIMITIVETYPE_VOID /* don't use as index! */
+
+
+/* function prototypes ********************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+java_handle_t *array_element_get(java_handle_t *a, int32_t index);
+void array_element_set(java_handle_t *a, int32_t index, java_handle_t *o);
+
+imm_union array_element_primitive_get(java_handle_t *a, int32_t index);
+void array_element_primitive_set(java_handle_t *a, int32_t index, imm_union value);
+
+uint8_t array_booleanarray_element_get(java_handle_booleanarray_t *a, int32_t index);
+int8_t array_bytearray_element_get(java_handle_bytearray_t *a, int32_t index);
+uint16_t array_chararray_element_get(java_handle_chararray_t *a, int32_t index);
+int16_t array_shortarray_element_get(java_handle_shortarray_t *a, int32_t index);
+int32_t array_intarray_element_get(java_handle_intarray_t *a, int32_t index);
+int64_t array_longarray_element_get(java_handle_longarray_t *a, int32_t index);
+float array_floatarray_element_get(java_handle_floatarray_t *a, int32_t index);
+double array_doublearray_element_get(java_handle_doublearray_t *a, int32_t index);
+java_handle_t *array_objectarray_element_get(java_handle_objectarray_t *a, int32_t index);
+
+void array_booleanarray_element_set(java_handle_booleanarray_t *a, int32_t index, uint8_t value);
+void array_bytearray_element_set(java_handle_bytearray_t *a, int32_t index, int8_t value);
+void array_chararray_element_set(java_handle_chararray_t *a, int32_t index, uint16_t value);
+void array_shortarray_element_set(java_handle_shortarray_t *a, int32_t index, int16_t value);
+void array_intarray_element_set(java_handle_intarray_t *a, int32_t index, int32_t value);
+void array_longarray_element_set(java_handle_longarray_t *a, int32_t index, int64_t value);
+void array_floatarray_element_set(java_handle_floatarray_t *a, int32_t index, float value);
+void array_doublearray_element_set(java_handle_doublearray_t *a, int32_t index, double value);
+void array_objectarray_element_set(java_handle_objectarray_t *a, int32_t index, java_handle_t *value);
+
+int32_t array_length_get(java_handle_t *a);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _VM_ARRAY_HPP
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
#include "toolbox/logging.h"
-#include "vm/array.h"
+#include "vm/array.hpp"
#include "vm/jit/builtin.hpp"
#include "vm/class.h"
#include "vm/classcache.h"
#include "vm/types.h"
#include "vm/annotation.h"
-#include "vm/array.h"
+#include "vm/array.hpp"
#include "vm/jit/builtin.hpp"
#include "vm/class.h"
#include "vm/descriptor.h"
#include "native/llni.h"
-#include "vm/array.h"
+#include "vm/array.hpp"
#include "vm/descriptor.h"
#include "vm/global.h"
#include "vm/method.h"
#include "toolbox/logging.h"
#include "toolbox/util.h"
-#include "vm/array.h"
+#include "vm/array.hpp"
#include "vm/jit/builtin.hpp"
#include "vm/class.h"
#include "vm/cycles-stats.h"
#include "toolbox/logging.h"
-#include "vm/array.h"
+#include "vm/array.hpp"
#include "vm/jit/builtin.hpp"
#include "vm/class.h"
#include "vm/cycles-stats.h"
#include "vm/jit/builtin.hpp"
#include "mm/memory.h"
-#include "vm/array.h"
+#include "vm/array.hpp"
#include "vm/exceptions.hpp"
#include "vm/global.h"
#include "vm/globals.hpp"
#include "toolbox/logging.h"
#include "vm/access.h"
-#include "vm/array.h"
+#include "vm/array.hpp"
#include "vm/jit/builtin.hpp"
#include "vm/exceptions.hpp"
#include "vm/globals.hpp"
#include "toolbox/logging.h"
#include "vm/access.h"
-#include "vm/array.h"
+#include "vm/array.hpp"
#include "vm/jit/builtin.hpp"
#include "vm/exceptions.hpp"
#include "vm/global.h"
#include "toolbox/logging.h"
-#include "vm/array.h"
+#include "vm/array.hpp"
#include "vm/class.h"
#include "vm/descriptor.h"
#include "vm/exceptions.hpp"
#include "toolbox/logging.h"
#include "vm/access.h"
-#include "vm/array.h"
+#include "vm/array.hpp"
#include "vm/class.h"
#include "vm/classcache.h"
#include "vm/exceptions.hpp"
#include "threads/mutex.hpp"
-#include "vm/array.h"
+#include "vm/array.hpp"
#include "vm/jit/builtin.hpp"
#include "vm/class.h"
#include "vm/exceptions.hpp"
break;
default:
o = NULL;
- os::abort("primitive_box: invalid primitive type %d", type);
+ os::abort("Primitive::box: Invalid primitive type %d", type);
}
return o;
value.a = h;
break;
default:
- os::abort("Primitive::unbox: invalid primitive type %d", type);
+ os::abort("Primitive::unbox: Invalid primitive type %d", type);
}
return value;
extern "C" {
- classinfo* Primitive_get_class_by_name(utf *name) { return Primitive::get_class_by_name(name); }
+classinfo* Primitive_get_class_by_name(utf *name) { return Primitive::get_class_by_name(name); }
classinfo* Primitive_get_class_by_type(int type) { return Primitive::get_class_by_type(type); }
classinfo* Primitive_get_arrayclass_by_type(int type) { return Primitive::get_arrayclass_by_type(type); }
-java_handle_t* Primitive_box(int type, imm_union value) { return Primitive::box(type, value); }
-imm_union Primitive_unbox(java_handle_t *h) { return Primitive::unbox(h); }
}
// Legacy C interface.
classinfo *Primitive_get_class_by_name(utf *name);
classinfo *Primitive_get_class_by_type(int type);
-
classinfo *Primitive_get_arrayclass_by_type(int type);
-
-java_handle_t *Primitive_box(int type, imm_union value);
-imm_union Primitive_unbox(java_handle_t *h);
#endif
#endif // _PRIMITIVE_HPP
#include "threads/lock.hpp"
-#include "vm/array.h"
+#include "vm/array.hpp"
#include "vm/jit/builtin.hpp"
#include "vm/exceptions.hpp"
#include "vm/globals.hpp"
#include "toolbox/logging.h"
-#include "vm/array.h"
+#include "vm/array.hpp"
#if defined(ENABLE_ASSERTION)
#include "vm/assertion.hpp"