diff options
author | Elliott Hughes <enh@google.com> | 2012-03-15 15:22:12 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2012-03-15 15:46:59 -0700 |
commit | 77405796564c6c1353807cda18b28678a719bd68 (patch) | |
tree | 948781c769760d71c7aff4e8db57aa5a9e311372 /test | |
parent | f8bbb8448c733e9e3ad43aad69774c37888329b1 (diff) | |
download | art-77405796564c6c1353807cda18b28678a719bd68.zip art-77405796564c6c1353807cda18b28678a719bd68.tar.gz art-77405796564c6c1353807cda18b28678a719bd68.tar.bz2 |
Rewrite the invoke stubs to use JValue[]s.
The tests were only testing the static stubs, so extend the tests to include
non-static stubs too.
Also add just enough of an ARM disassembler to disassemble the invoke stubs.
Change-Id: If71dfb66b8b8188f9d871914f0eaf1013c9993b9
Diffstat (limited to 'test')
-rw-r--r-- | test/NonStaticLeafMethods/NonStaticLeafMethods.java | 55 | ||||
-rw-r--r-- | test/ReflectionTest/ReflectionTest.java | 8 |
2 files changed, 59 insertions, 4 deletions
diff --git a/test/NonStaticLeafMethods/NonStaticLeafMethods.java b/test/NonStaticLeafMethods/NonStaticLeafMethods.java new file mode 100644 index 0000000..28e03c6 --- /dev/null +++ b/test/NonStaticLeafMethods/NonStaticLeafMethods.java @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +class NonStaticLeafMethods { + NonStaticLeafMethods() { + } + void nop() { + } + byte identity(byte x) { + return x; + } + int identity(int x) { + return x; + } + int sum(int a, int b) { + return a + b; + } + int sum(int a, int b, int c) { + return a + b + c; + } + int sum(int a, int b, int c, int d) { + return a + b + c + d; + } + int sum(int a, int b, int c, int d, int e) { + return a + b + c + d + e; + } + double identity(double x) { + return x; + } + double sum(double a, double b) { + return a + b; + } + double sum(double a, double b, double c) { + return a + b + c; + } + double sum(double a, double b, double c, double d) { + return a + b + c + d; + } + double sum(double a, double b, double c, double d, double e) { + return a + b + c + d + e; + } +} diff --git a/test/ReflectionTest/ReflectionTest.java b/test/ReflectionTest/ReflectionTest.java index 94c02aa..a9dc6e7 100644 --- a/test/ReflectionTest/ReflectionTest.java +++ b/test/ReflectionTest/ReflectionTest.java @@ -119,8 +119,8 @@ class ReflectionTest { try { f = ReflectionTest.class.getDeclaredField("s"); f.set(null, Integer.valueOf(14)); - } catch (Exception ex) { - ex.printStackTrace(); + } catch (IllegalArgumentException expected) { + expected.printStackTrace(); } f = ReflectionTest.class.getDeclaredField("z"); @@ -209,8 +209,8 @@ class ReflectionTest { System.out.println(Arrays.toString(m.getParameterTypes())); show(m.invoke(null)); System.out.println("************* should have thrown!"); - } catch (Exception ex) { - ex.printStackTrace(); + } catch (Exception expected) { + expected.printStackTrace(); } } |