Fixes PR52.
authorChristian Thalinger <twisti@complang.tuwien.ac.at>
Fri, 21 Mar 2008 11:48:00 +0000 (12:48 +0100)
committerChristian Thalinger <twisti@complang.tuwien.ac.at>
Fri, 21 Mar 2008 11:48:00 +0000 (12:48 +0100)
* src/vm/array.c (array_objectarray_element_set): Use
builtin_canstore.

* .hgignore (tests/regression/assertion/*.class)
(tests/regression/assertion/packagetest/*.class)
(tests/regression/bugzilla/*.class): Added.
* configure.ac (AC_CONFIG_FILES): Added
tests/regression/bugzilla/Makefile.
* tests/regression/Makefile.am (SUBDIRS): Added bugzilla.
* tests/regression/bugzilla/All.java: New file.
* tests/regression/bugzilla/Makefile.am: Likewise.
* tests/regression/bugzilla/PR52.java: Likewise.

.hgignore
configure.ac
src/vm/array.c
tests/regression/Makefile.am
tests/regression/bugzilla/All.java [new file with mode: 0644]
tests/regression/bugzilla/Makefile.am [new file with mode: 0644]
tests/regression/bugzilla/PR52.java [new file with mode: 0644]

index 9db53cfceb457b80ef726a5a593946352930fe76..751e5c858c8e804c4327135d019a2d30bb09425f 100644 (file)
--- a/.hgignore
+++ b/.hgignore
@@ -41,6 +41,9 @@ src/native/include/*.h
 src/scripts/java
 tests/*.class
 tests/regression/*.class
+tests/regression/assertion/*.class
+tests/regression/assertion/packagetest/*.class
+tests/regression/bugzilla/*.class
 tests/regression/codepatching/*.class
 tests/regression/jasmin/*.class
 tests/regression/native/*.class
index fcbd64940eb3549b1ede4866c17c9b3cc92cbe18..0677557d83f715eac77c9cf689bb086d34ef73f2 100644 (file)
@@ -906,6 +906,7 @@ AC_CONFIG_FILES([Makefile]
                [src/vmcore/Makefile]
                [tests/Makefile]
                [tests/regression/Makefile]
+               [tests/regression/bugzilla/Makefile]
                [tests/regression/codepatching/Makefile]
                [tests/regression/assertion/Makefile]
                [tests/regression/jasmin/Makefile]
index f19177ac14e8aeb506f3aa0d409d10151b4b311b..30f231d3e720a8a60ae388a7dfb5abed406b3114 100644 (file)
@@ -304,30 +304,21 @@ void array_##name##array_element_set(java_handle_##name##array_t *a, int32_t ind
 
 void array_objectarray_element_set(java_handle_objectarray_t *a, int32_t index, java_handle_t *value)
 {
-       arraydescriptor *ad;
-       classinfo *cc;
-       int32_t    size;
+       int32_t size;
 
        if (a == NULL) {
                exceptions_throw_nullpointerexception();
                return;
        }
 
-       /* TODO Write inline functions for that and use LLNI. */
-
-       LLNI_CRITICAL_START;
-
-       ad = a->header.objheader.vftbl->arraydesc;
-       cc = ad->componentvftbl->class;
+       /* Sanity check. */
 
-       LLNI_CRITICAL_END;
+       assert(a->header.objheader.vftbl->arraydesc->arraytype == ARRAYTYPE_OBJECT);
 
-       if (ad->arraytype == ARRAYTYPE_OBJECT) {
-               if (value != NULL) {
-                       if (builtin_instanceof(value, cc) == false) {
-                               exceptions_throw_illegalargumentexception();
-                               return;
-                       }
+       if (value != NULL) {
+               if (builtin_canstore(a, value) == false) {
+                       exceptions_throw_illegalargumentexception();
+                       return;
                }
        }
 
index 6e2d5656b08813a8f7588c879302b94e07c75128..c62ecbd2caf597081401058e2d750ea17237796c 100644 (file)
@@ -23,6 +23,7 @@
 
 SUBDIRS = \
        assertion \
+       bugzilla \
        codepatching \
        jasmin \
        native \
diff --git a/tests/regression/bugzilla/All.java b/tests/regression/bugzilla/All.java
new file mode 100644 (file)
index 0000000..6b1efa0
--- /dev/null
@@ -0,0 +1,51 @@
+/* tests/regression/bugzilla/All.java - runs all CACAO regression unit tests
+
+   Copyright (C) 2008
+   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.
+
+*/
+
+
+import junit.framework.*;
+import junit.textui.*;
+
+public class All extends TestCase {
+    /**
+     * Runs all CACAO regression unit tests using
+     * junit.textui.TestRunner
+     */
+    public static void main(String[] args) {
+        Test s = suite();
+        TestRunner.run(s);
+    }
+
+    /**
+     * Collects all CACAO regression unit tests as one suite
+     */
+    public static Test suite() {
+        TestSuite suite = new TestSuite("CACAO Regression Unit Tests");
+
+        // Add your test here.
+
+        suite.addTest(new TestSuite(PR52.class));
+
+        return suite;
+    }
+}
diff --git a/tests/regression/bugzilla/Makefile.am b/tests/regression/bugzilla/Makefile.am
new file mode 100644 (file)
index 0000000..d9ba79a
--- /dev/null
@@ -0,0 +1,47 @@
+## tests/regression/bugzilla/Makefile.am
+##
+## Copyright (C) 2008
+## 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.
+
+
+JAVA     = $(top_builddir)/src/cacao/cacao
+JAVACMD  = $(JAVA) -Xbootclasspath:$(BOOTCLASSPATH)
+JAVACCMD = $(JAVAC) -bootclasspath $(BOOTCLASSPATH)
+
+EXTRA_DIST = \
+       *.java
+
+CLEANFILES = \
+       *.class
+
+build:
+       $(JAVACCMD) -cp /usr/share/java/junit4.jar -d . *.java
+
+check: build
+       LD_LIBRARY_PATH=$(top_builddir)/src/cacao/.libs $(JAVACMD) -cp /usr/share/java/junit4.jar:. org.junit.runner.JUnitCore All
+
+
+## Local variables:
+## mode: Makefile
+## indent-tabs-mode: t
+## c-basic-offset: 4
+## tab-width: 8
+## compile-command: "automake --add-missing"
+## End:
diff --git a/tests/regression/bugzilla/PR52.java b/tests/regression/bugzilla/PR52.java
new file mode 100644 (file)
index 0000000..fae85f1
--- /dev/null
@@ -0,0 +1,44 @@
+/* tests/regression/bugzilla/PR52.java
+
+   Copyright (C) 2008
+   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.
+
+*/
+
+
+import junit.framework.*;
+import junit.textui.*;
+
+import java.security.*;
+
+public class PR52 extends TestCase {
+    public static void main(String[] args) {
+        TestRunner.run(suite());
+    }
+
+    public static Test suite() {
+        return new TestSuite(PR52.class);
+    }
+
+    public void test() {
+        // This one only triggers with GNU Classpath.
+        AccessController.getContext();
+    }
+}