diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/541-regression-inlined-deopt/expected.txt | 0 | ||||
| -rw-r--r-- | test/541-regression-inlined-deopt/info.txt | 4 | ||||
| -rw-r--r-- | test/541-regression-inlined-deopt/smali/TestCase.smali | 55 | ||||
| -rw-r--r-- | test/541-regression-inlined-deopt/src/Main.java | 36 | ||||
| -rwxr-xr-x | test/960-default-smali/build | 23 | ||||
| -rwxr-xr-x | test/961-default-iface-resolution-generated/build | 27 | ||||
| -rwxr-xr-x | test/962-iface-static/build | 21 | ||||
| -rwxr-xr-x | test/963-default-range-smali/build | 21 | ||||
| -rwxr-xr-x | test/964-default-iface-init-generated/build | 21 | ||||
| -rw-r--r-- | test/Lookup/A.java | 17 | ||||
| -rw-r--r-- | test/Lookup/AB.java | 17 | ||||
| -rw-r--r-- | test/Lookup/C.java | 17 | ||||
| -rwxr-xr-x | test/etc/default-build | 107 | ||||
| -rwxr-xr-x | test/run-test | 4 |
14 files changed, 313 insertions, 57 deletions
diff --git a/test/541-regression-inlined-deopt/expected.txt b/test/541-regression-inlined-deopt/expected.txt new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/541-regression-inlined-deopt/expected.txt diff --git a/test/541-regression-inlined-deopt/info.txt b/test/541-regression-inlined-deopt/info.txt new file mode 100644 index 0000000000..209588fe05 --- /dev/null +++ b/test/541-regression-inlined-deopt/info.txt @@ -0,0 +1,4 @@ +Regression test for deopt from optimized code which would use the top-level +stack map for deopting inlined frames. Test case is written in smali for full +control over vregs because the previous test 449 would pass because the vreg +maps at the various inlining depths were similar. diff --git a/test/541-regression-inlined-deopt/smali/TestCase.smali b/test/541-regression-inlined-deopt/smali/TestCase.smali new file mode 100644 index 0000000000..a109775dfe --- /dev/null +++ b/test/541-regression-inlined-deopt/smali/TestCase.smali @@ -0,0 +1,55 @@ +# Copyright (C) 2015 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 public LTestCase; +.super Ljava/lang/Object; + +.method private static $inline$depth1([I)V + .registers 3 + + # Expects array in v2. + + const v0, 0x0 + + const v1, 0x3 + aput v0, p0, v1 + + const v1, 0x4 + aput v0, p0, v1 + + return-void +.end method + +.method private static $inline$depth0([I)V + .registers 1 + + # Expects array in v0. + + invoke-static {p0}, LTestCase;->$inline$depth1([I)V + return-void +.end method + +.method public static foo()V + .registers 10 + + # Create a new array short enough to throw AIOOB in $inline$depth1. + # Make sure the reference is not stored in the same vreg as used by + # the inlined methods. + + const v5, 0x3 + new-array v6, v5, [I + + invoke-static {v6}, LTestCase;->$inline$depth0([I)V + return-void +.end method diff --git a/test/541-regression-inlined-deopt/src/Main.java b/test/541-regression-inlined-deopt/src/Main.java new file mode 100644 index 0000000000..fa79590e65 --- /dev/null +++ b/test/541-regression-inlined-deopt/src/Main.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2015 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. + */ + +import java.lang.reflect.*; + +public class Main { + + // Workaround for b/18051191. + class InnerClass {} + + public static void main(String[] args) throws Throwable { + try { + Class<?> c = Class.forName("TestCase"); + Method m = c.getMethod("foo"); + m.invoke(null, (Object[]) null); + } catch (InvocationTargetException ex) { + // Code should have thrown AIOOB. + if (!(ex.getCause() instanceof ArrayIndexOutOfBoundsException)) { + throw ex; + } + } + } +} diff --git a/test/960-default-smali/build b/test/960-default-smali/build index 06692f93b8..3946de3787 100755 --- a/test/960-default-smali/build +++ b/test/960-default-smali/build @@ -20,14 +20,23 @@ set -e # Generate the smali Main.smali file or fail ${ANDROID_BUILD_TOP}/art/test/utils/python/generate_smali_main.py ./smali -if [[ $@ == *"--jvm"* ]]; then - # Build the Java files if we are running a --jvm test +USES_JAVA="false" +if [[ $ARGS == *"--jvm"* ]]; then + USES_JAVA="true" +elif [[ "$USE_JACK" == "true" ]]; then + if $JACK -D jack.java.source.version=1.8 >& /dev/null; then + USES_JAVA="true" + else + echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2 + fi +fi + +if [[ "$USES_JAVA" == "true" ]]; then + # We are compiling java code, create it. mkdir -p src - mkdir -p classes ${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src - ${JAVAC} -implicit:none -d classes $(find src -name '*.java') + # Ignore the smali directory. + EXTRA_ARGS="--no-smali" fi -# Build the smali files and make a dex -${SMALI} -JXmx256m ${SMALI_ARGS} --output classes.dex $(find smali -name '*.smali') -zip "$TEST_NAME.jar" classes.dex +./default-build "$@" "$EXTRA_ARGS" --experimental default-methods diff --git a/test/961-default-iface-resolution-generated/build b/test/961-default-iface-resolution-generated/build index 5eb851fa68..03cc62459a 100755 --- a/test/961-default-iface-resolution-generated/build +++ b/test/961-default-iface-resolution-generated/build @@ -17,8 +17,6 @@ # make us exit on a failure set -e -mkdir -p ./smali - # We will be making more files than the ulimit is set to allow. Remove it temporarily. OLD_ULIMIT=`ulimit -S` ulimit -S unlimited @@ -28,20 +26,31 @@ restore_ulimit() { } trap 'restore_ulimit' ERR +mkdir -p ./smali + # Generate the smali files and expected.txt or fail ./util-src/generate_smali.py ./smali ./expected.txt -if [[ $@ == *"--jvm"* ]]; then - # Build the Java files if we are running a --jvm test +USES_JAVA="false" +if [[ $ARGS == *"--jvm"* ]]; then + USES_JAVA="true" +elif [[ $USE_JACK == "true" ]]; then + if "$JACK" -D jack.java.source.version=1.8 >& /dev/null; then + USES_JAVA="true" + else + echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2 + fi +fi + +if [[ "$USES_JAVA" == "true" ]]; then + # We are compiling java code, create it. mkdir -p src - mkdir -p classes ${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src - ${JAVAC} -implicit:none -d classes $(find src -name '*.java') + # Ignore the smali directory. + EXTRA_ARGS="--no-smali" fi -# Build the smali files and make a dex -${SMALI} -JXmx512m ${SMALI_ARGS} --output classes.dex $(find smali -name '*.smali') -zip $TEST_NAME.jar classes.dex +./default-build "$@" "$EXTRA_ARGS" --experimental default-methods # Reset the ulimit back to its initial value restore_ulimit diff --git a/test/962-iface-static/build b/test/962-iface-static/build index 06bb3bdfb8..24e2feb228 100755 --- a/test/962-iface-static/build +++ b/test/962-iface-static/build @@ -17,14 +17,23 @@ # make us exit on a failure set -e +USES_JAVA="false" if [[ $@ == *"--jvm"* ]]; then - # Build the Java files if we are running a --jvm test + USES_JAVA="true" +elif [[ "$USE_JACK" == "true" ]]; then + if $JACK -D jack.java.source.version=1.8 2>/dev/null; then + USES_JAVA="true" + else + echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2 + fi +fi + +if [[ "$USES_JAVA" == "true" ]]; then + # We are compiling java code, create it. mkdir -p src - mkdir -p classes ${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src - ${JAVAC} -implicit:none -d classes $(find src -name '*.java') + # Ignore the smali directory. + EXTRA_ARGS="--no-smali" fi -# Build the smali files and make a dex -${SMALI} -JXmx512m ${SMALI_ARGS} --output classes.dex $(find smali -name '*.smali') -zip $TEST_NAME.jar classes.dex +./default-build "$@" "$EXTRA_ARGS" --experimental default-methods diff --git a/test/963-default-range-smali/build b/test/963-default-range-smali/build index 06bb3bdfb8..24e2feb228 100755 --- a/test/963-default-range-smali/build +++ b/test/963-default-range-smali/build @@ -17,14 +17,23 @@ # make us exit on a failure set -e +USES_JAVA="false" if [[ $@ == *"--jvm"* ]]; then - # Build the Java files if we are running a --jvm test + USES_JAVA="true" +elif [[ "$USE_JACK" == "true" ]]; then + if $JACK -D jack.java.source.version=1.8 2>/dev/null; then + USES_JAVA="true" + else + echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2 + fi +fi + +if [[ "$USES_JAVA" == "true" ]]; then + # We are compiling java code, create it. mkdir -p src - mkdir -p classes ${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src - ${JAVAC} -implicit:none -d classes $(find src -name '*.java') + # Ignore the smali directory. + EXTRA_ARGS="--no-smali" fi -# Build the smali files and make a dex -${SMALI} -JXmx512m ${SMALI_ARGS} --output classes.dex $(find smali -name '*.smali') -zip $TEST_NAME.jar classes.dex +./default-build "$@" "$EXTRA_ARGS" --experimental default-methods diff --git a/test/964-default-iface-init-generated/build b/test/964-default-iface-init-generated/build index b0fbe4bf47..d916f1b8e9 100755 --- a/test/964-default-iface-init-generated/build +++ b/test/964-default-iface-init-generated/build @@ -29,17 +29,26 @@ trap 'restore_ulimit' ERR # Generate the smali files and expected.txt or fail ./util-src/generate_smali.py ./smali ./expected.txt +USES_JAVA="false" if [[ $@ == *"--jvm"* ]]; then - # Build the Java files if we are running a --jvm test + USES_JAVA="true" +elif [[ "$USE_JACK" == "true" ]]; then + if $JACK -D jack.java.source.version=1.8 2>/dev/null; then + USES_JAVA="true" + else + echo "WARNING: Cannot use jack because it does not support JLS 1.8. Falling back to smali" >&2 + fi +fi + +if [[ "$USES_JAVA" == "true" ]]; then + # We are compiling java code, create it. mkdir -p src - mkdir -p classes ${ANDROID_BUILD_TOP}/art/tools/extract-embedded-java ./smali ./src - ${JAVAC} -implicit:none -d classes $(find src -name '*.java') + # Ignore the smali directory. + EXTRA_ARGS="--no-smali" fi -# Build the smali files and make a dex -${SMALI} -JXmx512m ${SMALI_ARGS} --output classes.dex $(find smali -name '*.smali') -zip $TEST_NAME.jar classes.dex +./default-build "$@" "$EXTRA_ARGS" --experimental default-methods # Reset the ulimit back to its initial value restore_ulimit diff --git a/test/Lookup/A.java b/test/Lookup/A.java new file mode 100644 index 0000000000..666ba181d9 --- /dev/null +++ b/test/Lookup/A.java @@ -0,0 +1,17 @@ +/* + * Copyright (C) 2011 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 A {} diff --git a/test/Lookup/AB.java b/test/Lookup/AB.java new file mode 100644 index 0000000000..b231708111 --- /dev/null +++ b/test/Lookup/AB.java @@ -0,0 +1,17 @@ +/* + * Copyright (C) 2011 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 AB {} diff --git a/test/Lookup/C.java b/test/Lookup/C.java new file mode 100644 index 0000000000..5b90069262 --- /dev/null +++ b/test/Lookup/C.java @@ -0,0 +1,17 @@ +/* + * Copyright (C) 2011 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 C {} diff --git a/test/etc/default-build b/test/etc/default-build index 47432168de..7242428f1e 100755 --- a/test/etc/default-build +++ b/test/etc/default-build @@ -17,8 +17,45 @@ # Stop if something fails. set -e +# Set default values for directories. +if [ -d smali ]; then + HAS_SMALI=true +else + HAS_SMALI=false +fi + +if [ -d src ]; then + HAS_SRC=true +else + HAS_SRC=false +fi + +if [ -d src2 ]; then + HAS_SRC2=true +else + HAS_SRC2=false +fi + +if [ -d src-multidex ]; then + HAS_SRC_MULTIDEX=true +else + HAS_SRC_MULTIDEX=false +fi + +if [ -d src-ex ]; then + HAS_SRC_EX=true +else + HAS_SRC_EX=false +fi + DX_FLAGS="" SKIP_DX_MERGER="false" +EXPERIMENTAL="" + +# Setup experimental flag mappings in a bash associative array. +declare -A JACK_EXPERIMENTAL_ARGS +JACK_EXPERIMENTAL_ARGS["default-methods"]="-D jack.java.source.version=1.8" +JACK_EXPERIMENTAL_ARGS["lambdas"]="-D jack.java.source.version=1.8" while true; do if [ "x$1" = "x--dx-option" ]; then @@ -28,6 +65,25 @@ while true; do shift elif [ "x$1" = "x--jvm" ]; then shift + elif [ "x$1" = "x--no-src" ]; then + HAS_SRC=false + shift + elif [ "x$1" = "x--no-src2" ]; then + HAS_SRC2=false + shift + elif [ "x$1" = "x--no-src-multidex" ]; then + HAS_SRC_MULTIDEX=false + shift + elif [ "x$1" = "x--no-src-ex" ]; then + HAS_SRC_EX=false + shift + elif [ "x$1" = "x--no-smali" ]; then + HAS_SMALI=false + shift + elif [ "x$1" = "x--experimental" ]; then + shift + EXPERIMENTAL="${EXPERIMENTAL} $1" + shift elif expr "x$1" : "x--" >/dev/null 2>&1; then echo "unknown $0 option: $1" 1>&2 exit 1 @@ -36,17 +92,22 @@ while true; do fi done +# Add args from the experimental mappings. +for experiment in ${EXPERIMENTAL}; do + JACK_ARGS="${JACK_ARGS} ${JACK_EXPERIMENTAL_ARGS[${experiment}]}" +done + if [ -e classes.dex ]; then zip $TEST_NAME.jar classes.dex exit 0 fi -if ! [ -d src ] && ! [ -d src2 ]; then +if ! [ "${HAS_SRC}" = "true" ] && ! [ "${HAS_SRC2}" = "true" ]; then # No src directory? Then forget about trying to run dx. SKIP_DX_MERGER="true" fi -if [ -d src-multidex ]; then +if [ "${HAS_SRC_MULTIDEX}" = "true" ]; then # Jack does not support this configuration unless we specify how to partition the DEX file # with a .jpp file. USE_JACK="false" @@ -54,27 +115,29 @@ fi if [ ${USE_JACK} = "true" ]; then # Jack toolchain - if [ -d src ]; then - ${JACK} --output-jack src.jack src + if [ "${HAS_SRC}" = "true" ]; then + ${JACK} ${JACK_ARGS} --output-jack src.jack src imported_jack_files="--import src.jack" fi - if [ -d src2 ]; then - ${JACK} --output-jack src2.jack src2 + if [ "${HAS_SRC2}" = "true" ]; then + ${JACK} ${JACK_ARGS} --output-jack src2.jack src2 imported_jack_files="--import src2.jack ${imported_jack_files}" fi # Compile jack files into a DEX file. We set jack.import.type.policy=keep-first to consider # class definitions from src2 first. - ${JACK} ${imported_jack_files} -D jack.import.type.policy=keep-first --output-dex . + if [ "${HAS_SRC}" = "true" ] || [ "${HAS_SRC2}" = "true" ]; then + ${JACK} ${JACK_ARGS} ${imported_jack_files} -D jack.import.type.policy=keep-first --output-dex . + fi else # Legacy toolchain with javac+dx - if [ -d src ]; then + if [ "${HAS_SRC}" = "true" ]; then mkdir classes - ${JAVAC} -implicit:none -classpath src-multidex -d classes `find src -name '*.java'` + ${JAVAC} ${JAVAC_ARGS} -implicit:none -classpath src-multidex -d classes `find src -name '*.java'` fi - if [ -d src-multidex ]; then + if [ "${HAS_SRC_MULTIDEX}" = "true" ]; then mkdir classes2 ${JAVAC} -implicit:none -classpath src -d classes2 `find src-multidex -name '*.java'` if [ ${NEED_DEX} = "true" ]; then @@ -83,20 +146,22 @@ else fi fi - if [ -d src2 ]; then + if [ "${HAS_SRC2}" = "true" ]; then mkdir -p classes - ${JAVAC} -d classes `find src2 -name '*.java'` + ${JAVAC} ${JAVAC_ARGS} -d classes `find src2 -name '*.java'` fi - if [ ${NEED_DEX} = "true" -a ${SKIP_DX_MERGER} = "false" ]; then - ${DX} -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex \ - --dump-width=1000 ${DX_FLAGS} classes + if [ "${HAS_SRC}" = "true" ] || [ "${HAS_SRC2}" = "true" ]; then + if [ ${NEED_DEX} = "true" -a ${SKIP_DX_MERGER} = "false" ]; then + ${DX} -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex \ + --dump-width=1000 ${DX_FLAGS} classes + fi fi fi -if [ -d smali ]; then +if [ "${HAS_SMALI}" = "true" ]; then # Compile Smali classes - ${SMALI} -JXmx256m ${SMALI_ARGS} --output smali_classes.dex `find smali -name '*.smali'` + ${SMALI} -JXmx512m ${SMALI_ARGS} --output smali_classes.dex `find smali -name '*.smali'` # Don't bother with dexmerger if we provide our own main function in a smali file. if [ ${SKIP_DX_MERGER} = "false" ]; then @@ -106,18 +171,18 @@ if [ -d smali ]; then fi fi -if [ -d src-ex ]; then +if [ ${HAS_SRC_EX} = "true" ]; then if [ ${USE_JACK} = "true" ]; then # Rename previous "classes.dex" so it is not overwritten. mv classes.dex classes-1.dex #TODO find another way to append src.jack to the jack classpath - ${JACK}:src.jack --output-dex . src-ex + ${JACK}:src.jack ${JACK_ARGS} --output-dex . src-ex zip $TEST_NAME-ex.jar classes.dex # Restore previous "classes.dex" so it can be zipped. mv classes-1.dex classes.dex else mkdir classes-ex - ${JAVAC} -d classes-ex -cp classes `find src-ex -name '*.java'` + ${JAVAC} ${JAVAC_ARGS} -d classes-ex -cp classes `find src-ex -name '*.java'` if [ ${NEED_DEX} = "true" ]; then ${DX} -JXmx256m --debug --dex --dump-to=classes-ex.lst --output=classes-ex.dex \ --dump-width=1000 ${DX_FLAGS} classes-ex @@ -133,7 +198,7 @@ if [ -d src-ex ]; then fi # Create a single jar with two dex files for multidex. -if [ -d src-multidex ]; then +if [ ${HAS_SRC_MULTIDEX} = "true" ]; then zip $TEST_NAME.jar classes.dex classes2.dex elif [ ${NEED_DEX} = "true" ]; then zip $TEST_NAME.jar classes.dex diff --git a/test/run-test b/test/run-test index 3442fcf67d..f2bbaa7747 100755 --- a/test/run-test +++ b/test/run-test @@ -85,7 +85,7 @@ fi # If JACK_CLASSPATH is not set, assume it only contains core-libart. if [ -z "$JACK_CLASSPATH" ]; then - export JACK_CLASSPATH="$ANDROID_BUILD_TOP/out/host/common/obj/JAVA_LIBRARIES/core-libart-hostdex_intermediates/classes.jack" + export JACK_CLASSPATH="${OUT_DIR:-$ANDROID_BUILD_TOP/out}/host/common/obj/JAVA_LIBRARIES/core-libart-hostdex_intermediates/classes.jack" fi # If JILL_JAR is not set, assume it is located in the prebuilts directory. @@ -440,7 +440,7 @@ elif [ "$runtime" = "art" ]; then if [ "$target_mode" = "no" ]; then # ANDROID_HOST_OUT is not set in a build environment. if [ -z "$ANDROID_HOST_OUT" ]; then - export ANDROID_HOST_OUT=$ANDROID_BUILD_TOP/out/host/linux-x86 + export ANDROID_HOST_OUT=${OUT_DIR:-$ANDROID_BUILD_TOP/out/}host/linux-x86 fi guess_host_arch_name run_args="${run_args} --boot ${ANDROID_HOST_OUT}/framework/core${image_suffix}${pic_image_suffix}.art" |