diff options
597 files changed, 2142 insertions, 23003 deletions
diff --git a/dexdump/Android.mk b/dexdump/Android.mk index b825146d6..a6c954539 100644 --- a/dexdump/Android.mk +++ b/dexdump/Android.mk @@ -23,8 +23,6 @@ dexdump_src_files := \ dexdump_c_includes := \ dalvik -dexdump_shared_libraries := - dexdump_static_libraries := \ libdex @@ -39,7 +37,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := dexdump LOCAL_SRC_FILES := $(dexdump_src_files) LOCAL_C_INCLUDES := $(dexdump_c_includes) -LOCAL_SHARED_LIBRARIES := $(dexdump_shared_libraries) libz liblog +LOCAL_SHARED_LIBRARIES := libz liblog libutils LOCAL_STATIC_LIBRARIES := $(dexdump_static_libraries) LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE_TAGS := optional @@ -51,6 +49,7 @@ LOCAL_MODULE := libdexdump_static LOCAL_SRC_FILES := $(dexdump_src_files) LOCAL_C_INCLUDES := $(dexdump_c_includes) LOCAL_STATIC_LIBRARIES := $(dexdump_static_libraries) +LOCAL_SHARED_LIBRARIES := libutils LOCAL_MODULE_TAGS := optional include $(BUILD_STATIC_LIBRARY) @@ -67,8 +66,7 @@ LOCAL_MODULE := dexdump LOCAL_MODULE_TAGS := optional LOCAL_SRC_FILES := $(dexdump_src_files) LOCAL_C_INCLUDES := $(dexdump_c_includes) -LOCAL_SHARED_LIBRARIES := $(dexdump_shared_libraries) -LOCAL_STATIC_LIBRARIES := $(dexdump_static_libraries) liblog +LOCAL_STATIC_LIBRARIES := $(dexdump_static_libraries) liblog libutils ifneq ($(strip $(USE_MINGW)),) LOCAL_STATIC_LIBRARIES += libz diff --git a/dexlist/Android.mk b/dexlist/Android.mk index 62b00874a..5c3be63bd 100644 --- a/dexlist/Android.mk +++ b/dexlist/Android.mk @@ -23,8 +23,6 @@ dexdump_src_files := \ dexdump_c_includes := \ dalvik -dexdump_shared_libraries := - dexdump_static_libraries := \ libdex @@ -33,7 +31,7 @@ LOCAL_MODULE := dexlist LOCAL_MODULE_TAGS := optional LOCAL_SRC_FILES := $(dexdump_src_files) LOCAL_C_INCLUDES := $(dexdump_c_includes) -LOCAL_SHARED_LIBRARIES := $(dexdump_shared_libraries) libcutils libz +LOCAL_SHARED_LIBRARIES := libcutils libz libutils LOCAL_STATIC_LIBRARIES := $(dexdump_static_libraries) LOCAL_LDLIBS += #include $(BUILD_EXECUTABLE) @@ -43,7 +41,6 @@ LOCAL_MODULE := dexlist LOCAL_MODULE_TAGS := optional LOCAL_SRC_FILES := $(dexdump_src_files) LOCAL_C_INCLUDES := $(dexdump_c_includes) -LOCAL_SHARED_LIBRARIES := $(dexdump_shared_libraries) -LOCAL_STATIC_LIBRARIES := $(dexdump_static_libraries) libcutils liblog +LOCAL_STATIC_LIBRARIES := $(dexdump_static_libraries) libcutils liblog libutils LOCAL_LDLIBS += -lpthread -lz include $(BUILD_HOST_EXECUTABLE) diff --git a/dexopt/OptMain.cpp b/dexopt/OptMain.cpp index 3cdf5bea2..f948ff4c9 100644 --- a/dexopt/OptMain.cpp +++ b/dexopt/OptMain.cpp @@ -58,10 +58,8 @@ static int extractAndProcessZip(int zipFd, int cacheFd, const char* debugFileName, bool isBootstrap, const char* bootClassPath, const char* dexoptFlagStr) { - ZipArchive zippy; + ZipArchiveHandle zippy; ZipEntry zipEntry; - size_t uncompLen; - long modWhen, crc32; off_t dexOffset; int err; int result = -1; @@ -69,8 +67,6 @@ static int extractAndProcessZip(int zipFd, int cacheFd, DexClassVerifyMode verifyMode = VERIFY_MODE_ALL; DexOptimizerMode dexOptMode = OPTIMIZE_MODE_VERIFIED; - memset(&zippy, 0, sizeof(zippy)); - /* make sure we're still at the start of an empty file */ if (lseek(cacheFd, 0, SEEK_END) != 0) { ALOGE("DexOptZ: new cache file '%s' is not empty", debugFileName); @@ -93,36 +89,21 @@ static int extractAndProcessZip(int zipFd, int cacheFd, /* * Open the zip archive, find the DEX entry. */ - if (dexZipPrepArchive(zipFd, debugFileName, &zippy) != 0) { + if (dexZipOpenArchiveFd(zipFd, debugFileName, &zippy) != 0) { ALOGW("DexOptZ: unable to open zip archive '%s'", debugFileName); goto bail; } - zipEntry = dexZipFindEntry(&zippy, kClassesDex); - if (zipEntry == NULL) { + if (dexZipFindEntry(zippy, kClassesDex, &zipEntry) != 0) { ALOGW("DexOptZ: zip archive '%s' does not include %s", debugFileName, kClassesDex); goto bail; } /* - * Extract some info about the zip entry. - */ - if (dexZipGetEntryInfo(&zippy, zipEntry, NULL, &uncompLen, NULL, NULL, - &modWhen, &crc32) != 0) - { - ALOGW("DexOptZ: zip archive GetEntryInfo failed on %s", debugFileName); - goto bail; - } - - uncompLen = uncompLen; - modWhen = modWhen; - crc32 = crc32; - - /* * Extract the DEX data into the cache file at the current offset. */ - if (dexZipExtractEntryToFile(&zippy, zipEntry, cacheFd) != 0) { + if (dexZipExtractEntryToFile(zippy, &zipEntry, cacheFd) != 0) { ALOGW("DexOptZ: extraction of %s from %s failed", kClassesDex, debugFileName); goto bail; @@ -183,8 +164,9 @@ static int extractAndProcessZip(int zipFd, int cacheFd, //vmStarted = 1; /* do the optimization */ - if (!dvmContinueOptimization(cacheFd, dexOffset, uncompLen, debugFileName, - modWhen, crc32, isBootstrap)) + if (!dvmContinueOptimization(cacheFd, dexOffset, + zipEntry.uncompressed_length, debugFileName, + zipEntry.mod_time, zipEntry.crc32, isBootstrap)) { ALOGE("Optimization failed"); goto bail; @@ -195,7 +177,7 @@ static int extractAndProcessZip(int zipFd, int cacheFd, result = 0; bail: - dexZipCloseArchive(&zippy); + dexZipCloseArchive(zippy); return result; } diff --git a/dx/Android.mk b/dx/Android.mk index edf8ca3b4..3723c4441 100644 --- a/dx/Android.mk +++ b/dx/Android.mk @@ -7,7 +7,7 @@ LOCAL_PATH := $(call my-dir) # .jar files they wrap. # This tool is prebuilt if we're doing an app-only build. -ifeq ($(TARGET_BUILD_APPS),) +ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),) # the dx script # ============================================================ @@ -27,7 +27,67 @@ $(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/dx | $(ACP) INTERNAL_DALVIK_MODULES += $(LOCAL_INSTALLED_MODULE) -endif # TARGET_BUILD_APPS +# the mainDexClasses rules +# ============================================================ +include $(CLEAR_VARS) +LOCAL_IS_HOST_MODULE := true +LOCAL_MODULE_CLASS := EXECUTABLES +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE := mainDexClasses.rules + +include $(BUILD_SYSTEM)/base_rules.mk + +$(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/dx$(COMMON_JAVA_PACKAGE_SUFFIX) +$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/mainDexClasses.rules | $(ACP) + @echo "Copy: $(PRIVATE_MODULE) ($@)" + $(copy-file-to-new-target) + +INTERNAL_DALVIK_MODULES += $(LOCAL_INSTALLED_MODULE) + +installed_mainDexClasses.rules := $(LOCAL_INSTALLED_MODULE) + +# the shrinkedAndroid jar is a library used by the mainDexClasses script +# ============================================================ +include $(CLEAR_VARS) +LOCAL_IS_HOST_MODULE := true +LOCAL_MODULE_CLASS := JAVA_LIBRARIES +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE := shrinkedAndroid +LOCAL_BUILT_MODULE_STEM := shrinkedAndroid.jar +LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX) + +include $(BUILD_SYSTEM)/base_rules.mk + +$(LOCAL_BUILT_MODULE): PRIVATE_PROGUARD_FLAGS:= \ + -include $(addprefix $(LOCAL_PATH)/, shrinkedAndroid.proguard.flags) +$(LOCAL_BUILT_MODULE): $(call java-lib-files,android_stubs_current) | $(PROGUARD) + @echo Proguard: $@ + $(hide) $(PROGUARD) -injars "$<(**/*.class)" -outjars $@ $(PRIVATE_PROGUARD_FLAGS) + +INTERNAL_DALVIK_MODULES += $(LOCAL_INSTALLED_MODULE) + +installed_shrinkedAndroid := $(LOCAL_INSTALLED_MODULE) + +# the mainDexClasses script +# ============================================================ +include $(CLEAR_VARS) +LOCAL_IS_HOST_MODULE := true +LOCAL_MODULE_CLASS := EXECUTABLES +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE := mainDexClasses + +include $(BUILD_SYSTEM)/base_rules.mk + +$(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/dx$(COMMON_JAVA_PACKAGE_SUFFIX) +$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/mainDexClasses | $(ACP) + @echo "Copy: $(PRIVATE_MODULE) ($@)" + $(copy-file-to-new-target) + $(hide) chmod 755 $@ + +$(LOCAL_INSTALLED_MODULE): | $(installed_shrinkedAndroid) $(installed_mainDexClasses.rules) +INTERNAL_DALVIK_MODULES += $(LOCAL_INSTALLED_MODULE) + +endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK # the dexmerger script # ============================================================ diff --git a/dx/etc/mainDexClasses b/dx/etc/mainDexClasses new file mode 100644 index 000000000..034d47eaa --- /dev/null +++ b/dx/etc/mainDexClasses @@ -0,0 +1,158 @@ +#!/bin/bash +# +# Copyright (C) 2013 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. + +function makeTempJar () +{ + local tempDir=/tmp + if [ ! -e "${tempDir}" ]; then + tempDir=. + fi + local tempfile="${tempDir}/mainDexClasses-$$.tmp.jar" + if [ -e "${tempfile}" ]; then + echo "Failed to create temporary file" >2 + exit 6 + fi + echo "${tempfile}" +} + +function cleanTmp () +{ + if [ -e "${tmpOut}" ] ; then + rm "${tmpOut}" + fi +} + + +# Set up prog to be the path of this script, including following symlinks, +# and set up progdir to be the fully-qualified pathname of its directory. +prog="$0" + +while [ -h "${prog}" ]; do + newProg=`/bin/ls -ld "${prog}"` + newProg=`expr "${newProg}" : ".* -> \(.*\)$"` + if expr "x${newProg}" : 'x/' >/dev/null; then + prog="${newProg}" + else + progdir=`dirname "${prog}"` + prog="${progdir}/${newProg}" + fi +done +oldwd=`pwd` +progdir=`dirname "${prog}"` +cd "${progdir}" +progdir=`pwd` +prog="${progdir}"/`basename "${prog}"` +cd "${oldwd}" + +baserules="${progdir}"/mainDexClasses.rules +if [ ! -r ${baserules} ]; then + echo `basename "$prog"`": can't find mainDexClasses.rules" 1>&2 + exit 1 +fi + +jarfile=dx.jar +libdir="$progdir" + +if [ ! -r "$libdir/$jarfile" ]; then + # set dx.jar location for the SDK case + libdir="$libdir/lib" +fi + + +if [ ! -r "$libdir/$jarfile" ]; then + # set dx.jar location for the Android tree case + libdir=`dirname "$progdir"`/framework +fi + +if [ ! -r "$libdir/$jarfile" ]; then + echo `basename "$prog"`": can't find $jarfile" 1>&2 + exit 1 +fi + +proguardExec="proguard.sh" +proguard=${PROGUARD_HOME}/bin/${proguardExec} + +if [ ! -r "${proguard}" ]; then + # set proguard location for the SDK case + proguardBaseDir=`dirname "$progdir"` + # "${progdir}"/../.. + proguardBaseDir=`dirname "$proguardBaseDir"` + proguard="${proguardBaseDir}"/tools/proguard/bin/${proguardExec} +fi + +if [ ! -r "${proguard}" ]; then + # set proguard location for the Android tree case + proguardBaseDir=`dirname "$proguardBaseDir"` + # "${progdir}"/../../../.. + proguardBaseDir=`dirname "$proguardBaseDir"` + proguard="${proguardBaseDir}"/external/proguard/bin/${proguardExec} +fi + +if [ ! -r "${proguard}" ]; then + proguard="`which proguard`" +fi + +if [ -z "${proguard}" -o ! -r "${proguard}" ]; then + proguard="`which ${proguardExec}`" +fi + +if [ -z "${proguard}" -o ! -r "${proguard}" ]; then + echo `basename "$prog"`": can't find ${proguardExec}" 1>&2 + exit 1 +fi + +shrinkedAndroidJar="${SHRINKED_ANDROID_JAR}" +if [ -z "${shrinkedAndroidJar}" ]; then + shrinkedAndroidJar=shrinkedAndroid.jar +fi + +if [ ! -r "${shrinkedAndroidJar}" ]; then + shrinkedAndroidJar=${libdir}/${shrinkedAndroidJar} +fi + +if [ ! -r "${shrinkedAndroidJar}" ]; then + echo `basename "$prog"`": can't find shrinkedAndroid.jar" 1>&2 + exit 1 +fi + +if [ "$OSTYPE" = "cygwin" ]; then + # For Cygwin, convert the jarfile path into native Windows style. + jarpath=`cygpath -w "$libdir/$jarfile"` + proguard=`cygpath -w "${proguard}"` + shrinkedAndroidJar=`cygpath -w "${shrinkedAndroidJar}"` +else + jarpath="$libdir/$jarfile" +fi + +if expr "x$1" : 'x--output' >/dev/null; then + exec 1>$2 + shift 2 +fi + +if [ $# -ne 1 ]; then + echo "Usage : $0 [--output <output file>] <application path>" 1>&2 + exit 2 +fi + +tmpOut=`makeTempJar` + +trap cleanTmp 0 + +${proguard} -injars ${@} -dontwarn -forceprocessing -outjars ${tmpOut} \ + -libraryjars "${shrinkedAndroidJar}" -dontoptimize -dontobfuscate -dontpreverify \ + -include "${baserules}" 1>/dev/null || exit 10 + +java -cp "$jarpath" com.android.multidex.ClassReferenceListBuilder "${tmpOut}" ${@} || exit 11 diff --git a/dx/etc/mainDexClasses.bat b/dx/etc/mainDexClasses.bat new file mode 100755 index 000000000..00b60e8de --- /dev/null +++ b/dx/etc/mainDexClasses.bat @@ -0,0 +1,110 @@ +@echo off
+REM Copyright (C) 2013 The Android Open Source Project
+REM
+REM Licensed under the Apache License, Version 2.0 (the "License");
+REM you may not use this file except in compliance with the License.
+REM You may obtain a copy of the License at
+REM
+REM http://www.apache.org/licenses/LICENSE-2.0
+REM
+REM Unless required by applicable law or agreed to in writing, software
+REM distributed under the License is distributed on an "AS IS" BASIS,
+REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+REM See the License for the specific language governing permissions and
+REM limitations under the License.
+
+REM don't modify the caller's environment
+setlocal
+
+rem Check we have a valid Java.exe in the path.
+set java_exe=
+if exist "%~dp0..\tools\lib\find_java.bat" call "%~dp0..\tools\lib\find_java.bat"
+if exist "%~dp0..\..\tools\lib\find_java.bat" call "%~dp0..\..\tools\lib\find_java.bat"
+if not defined java_exe goto :EOF
+
+set baserules="%~dp0\mainDexClasses.rules"
+
+REM Locate dx.jar in the directory where dx.bat was found.
+set jarfile=dx.jar
+set "frameworkdir=%~dp0"
+rem frameworkdir must not end with a dir sep.
+set "frameworkdir=%frameworkdir:~0,-1%"
+if exist "%frameworkdir%\%jarfile%" goto JarFileOk
+ set "frameworkdir=%~dp0lib"
+
+if exist "%frameworkdir%\%jarfile%" goto JarFileOk
+ set "frameworkdir=%~dp0..\framework"
+:JarFileOk
+
+set "jarpath=%frameworkdir%\%jarfile%"
+
+set "shrinkedAndroidJar=%SHRINKED_ANDROID_JAR%
+if exist "%shrinkedAndroidJar%" goto shrinkedAndroidOk
+ set "shrinkedAndroidJar=shrinkedAndroid.jar"
+
+if exist "%shrinkedAndroidJar%" goto shrinkedAndroidOk
+ set "shrinkedAndroidJar=%frameworkdir%\%shrinkedAndroidJar%"
+
+:shrinkedAndroidOk
+set "proguardExec=proguard.bat"
+set "proguard=%PROGUARD_HOME%\bin\%proguardExec%"
+
+if exist "%proguard%" goto proguardOk
+REM set proguard location for the SDK case
+ set "PROGUARD_HOME=%~dp0\..\..\tools\proguard"
+ set "proguard=%PROGUARD_HOME%\bin\%proguardExec%"
+
+if exist "%proguard%" goto proguardOk
+REM set proguard location for the Android tree case
+ set "PROGUARD_HOME=%~dp0\..\..\..\..\external\proguard"
+ set "proguard=%PROGUARD_HOME%\bin\%proguardExec%"
+
+:proguardOk
+REM Capture all arguments.
+REM Note that when reading the input arguments with %1, the cmd.exe
+REM automagically converts --name=value arguments into 2 arguments "--name"
+REM followed by "value". Dx has been changed to know how to deal with that.
+set params=
+
+set output=
+
+:firstArg
+if [%1]==[] goto endArgs
+
+ if %1 NEQ --output goto notOut
+ set "output=%2"
+ shift
+ shift
+ goto firstArg
+
+:notOut
+ if defined params goto usage
+ set params=%1
+ shift
+ goto firstArg
+
+:endArgs
+if defined params ( goto makeTmpJar ) else ( goto usage )
+
+:makeTmpJar
+set "tmpJar=%TMP%\mainDexClasses-%RANDOM%.tmp.jar"
+if exist "%tmpJar%" goto makeTmpJar
+echo "" > "%tmpJar%"
+set "exitStatus=0"
+
+
+call "%proguard%" -injars %params% -dontwarn -forceprocessing -outjars "%tmpJar%" -libraryjars "%shrinkedAndroidJar%" -dontoptimize -dontobfuscate -dontpreverify -include "%baserules%" 1>nul
+
+if DEFINED output goto redirect
+call "%java_exe%" -Djava.ext.dirs="%frameworkdir%" com.android.multidex.ClassReferenceListBuilder "%tmpJar%" "%params%"
+goto afterClassReferenceListBuilder
+:redirect
+call "%java_exe%" -Djava.ext.dirs="%frameworkdir%" com.android.multidex.ClassReferenceListBuilder "%tmpJar%" "%params%" 1>"%output%"
+:afterClassReferenceListBuilder
+
+del %tmpJar%
+exit /b
+
+:usage
+echo "Usage : %0 [--output <output file>] <application path>"
+exit /b 1
diff --git a/dx/etc/mainDexClasses.rules b/dx/etc/mainDexClasses.rules new file mode 100644 index 000000000..517541886 --- /dev/null +++ b/dx/etc/mainDexClasses.rules @@ -0,0 +1,24 @@ + -keep public class * extends android.app.Instrumentation {
+ <init>();
+ }
+ -keep public class * extends android.app.Application {
+ <init>();
+ }
+ -keep public class * extends android.app.Activity {
+ <init>();
+ }
+ -keep public class * extends android.app.Service {
+ <init>();
+ }
+ -keep public class * extends android.content.ContentProvider {
+ <init>();
+ }
+ -keep public class * extends android.content.BroadcastReceiver {
+ <init>();
+ }
+ -keep public class * extends android.app.backup.BackupAgent {
+ <init>();
+ }
+ -keep class android.support.multidex.** {
+ *;
+ }
\ No newline at end of file diff --git a/dx/shrinkedAndroid.proguard.flags b/dx/shrinkedAndroid.proguard.flags new file mode 100644 index 000000000..65c8689f1 --- /dev/null +++ b/dx/shrinkedAndroid.proguard.flags @@ -0,0 +1,21 @@ +-dontwarn +-forceprocessing +-dontoptimize +-dontobfuscate +-dontpreverify +-keep public class * extends android.app.Instrumentation { +} +-keep public class * extends android.app.Application { +} +-keep public class * extends android.app.Activity { +} +-keep public class * extends android.app.Service { +} +-keep public class * extends android.content.ContentProvider { +} +-keep public class * extends android.content.BroadcastReceiver { +} +-keep public class * extends android.app.backup.BackupAgent { +} +-keep class android.support.multidex.installer.** { +} diff --git a/dx/src/Android.mk b/dx/src/Android.mk index 678397f78..4d86ac3dc 100644 --- a/dx/src/Android.mk +++ b/dx/src/Android.mk @@ -3,7 +3,7 @@ LOCAL_PATH := $(call my-dir) # This tool is prebuilt if we're doing an app-only build. -ifeq ($(TARGET_BUILD_APPS),) +ifeq ($(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)),) # dx java library # ============================================================ @@ -19,7 +19,7 @@ include $(BUILD_HOST_JAVA_LIBRARY) INTERNAL_DALVIK_MODULES += $(LOCAL_INSTALLED_MODULE) -endif # TARGET_BUILD_APPS +endif # No TARGET_BUILD_APPS or TARGET_BUILD_PDK # the documentation # ============================================================ diff --git a/dx/src/com/android/dx/cf/code/Ropper.java b/dx/src/com/android/dx/cf/code/Ropper.java index c318b4c72..329bf4ffe 100644 --- a/dx/src/com/android/dx/cf/code/Ropper.java +++ b/dx/src/com/android/dx/cf/code/Ropper.java @@ -41,9 +41,12 @@ import com.android.dx.rop.type.TypeList; import com.android.dx.util.Bits; import com.android.dx.util.Hex; import com.android.dx.util.IntList; + import java.util.ArrayList; import java.util.BitSet; +import java.util.Collection; import java.util.HashMap; +import java.util.Map; /** * Utility that converts a basic block list into a list of register-oriented @@ -116,9 +119,9 @@ public final class Ropper { /** * {@code non-null;} for each block (by label) that is used as an exception - * handler, the type of exception it catches + * handler in the input, the exception handling info in Rop. */ - private final Type[] catchTypes; + private final CatchInfo[] catchInfos; /** * whether an exception-handler block for a synchronized method was @@ -134,6 +137,83 @@ public final class Ropper { /** true if {@code subroutines} is non-empty */ private boolean hasSubroutines; + /** Allocates labels of exception handler setup blocks. */ + private final ExceptionSetupLabelAllocator exceptionSetupLabelAllocator; + + /** + * Keeps mapping of an input exception handler target code and how it is generated/targeted in + * Rop. + */ + private class CatchInfo { + /** + * {@code non-null;} map of ExceptionHandlerSetup by the type they handle */ + private final Map<Type, ExceptionHandlerSetup> setups = + new HashMap<Type, ExceptionHandlerSetup>(); + + /** + * Get the {@link ExceptionHandlerSetup} corresponding to the given type. The + * ExceptionHandlerSetup is created if this the first request for the given type. + * + * @param caughtType {@code non-null;} the type catch by the requested setup + * @return {@code non-null;} the handler setup block info for the given type + */ + ExceptionHandlerSetup getSetup(Type caughtType) { + ExceptionHandlerSetup handler = setups.get(caughtType); + if (handler == null) { + int handlerSetupLabel = exceptionSetupLabelAllocator.getNextLabel(); + handler = new ExceptionHandlerSetup(caughtType, handlerSetupLabel); + setups.put(caughtType, handler); + } + return handler; + } + + /** + * Get all {@link ExceptionHandlerSetup} of this handler. + * + * @return {@code non-null;} + */ + Collection<ExceptionHandlerSetup> getSetups() { + return setups.values(); + } + } + + /** + * Keeps track of an exception handler setup. + */ + private static class ExceptionHandlerSetup { + /** + * {@code non-null;} The caught type. */ + private Type caughtType; + /** + * {@code >= 0;} The label of the exception setup block. */ + private int label; + + /** + * Constructs instance. + * + * @param caughtType {@code non-null;} the caught type + * @param label {@code >= 0;} the label + */ + ExceptionHandlerSetup(Type caughtType, int label) { + this.caughtType = caughtType; + this.label = label; + } + + /** + * @return {@code non-null;} the caught type + */ + Type getCaughtType() { + return caughtType; + } + + /** + * @return {@code >= 0;} the label + */ + public int getLabel() { + return label; + } + } + /** * Keeps track of subroutines that exist in java form and are inlined in * Rop form. @@ -307,7 +387,7 @@ public final class Ropper { this.resultSubroutines = new ArrayList<IntList>(blocks.size() * 2 + 10); - this.catchTypes = new Type[maxLabel]; + this.catchInfos = new CatchInfo[maxLabel]; this.synchNeedsExceptionHandler = false; /* @@ -315,6 +395,7 @@ public final class Ropper { * empty here (to be filled in outside of the constructor). */ startFrames[0] = new Frame(maxLocals, method.getMaxStack()); + exceptionSetupLabelAllocator = new ExceptionSetupLabelAllocator(); } /** @@ -337,17 +418,6 @@ public final class Ropper { } /** - * Gets the label for the exception handler setup block corresponding - * to the given label. - * - * @param label {@code >= 0;} the original label - * @return {@code >= 0;} the corresponding exception handler setup label - */ - private int getExceptionSetupLabel(int label) { - return maxLabel + label; - } - - /** * Gets the label for the given special-purpose block. The given label * should be one of the static constants defined by this class. * @@ -359,12 +429,11 @@ public final class Ropper { * The label is bitwise-complemented so that mistakes where * LABEL is used instead of getSpecialLabel(LABEL) cause a * failure at block construction time, since negative labels - * are illegal. We multiply maxLabel by 2 since 0..maxLabel - * (exclusive) are the original blocks and - * maxLabel..(maxLabel*2) are reserved for exception handler - * setup blocks (see getExceptionSetupLabel(), above). + * are illegal. 0..maxLabel (exclusive) are the original blocks and + * maxLabel..(maxLabel + method.getCatches().size()) are reserved for exception handler + * setup blocks (see getAvailableLabel(), exceptionSetupLabelAllocator). */ - return (maxLabel * 2) + ~label; + return maxLabel + method.getCatches().size() + ~label; } /** @@ -374,17 +443,32 @@ public final class Ropper { */ private int getMinimumUnreservedLabel() { /* - * The labels below ((maxLabel * 2) + SPECIAL_LABEL_COUNT) are + * The labels below (maxLabel + method.getCatches().size() + SPECIAL_LABEL_COUNT) are * reserved for particular uses. */ - return (maxLabel * 2) + SPECIAL_LABEL_COUNT; + return maxLabel + method.getCatches().size() + SPECIAL_LABEL_COUNT; } /** - * Gets an arbitrary unreserved and available label. + * Gets an unreserved and available label. + * Labels are distributed this way: + * <ul> + * <li>[0, maxLabel[ are the labels of the blocks directly + * corresponding to the input bytecode.</li> + * <li>[maxLabel, maxLabel + method.getCatches().size()[ are reserved for exception setup + * blocks.</li> + * <li>[maxLabel + method.getCatches().size(), + * maxLabel + method.getCatches().size() + SPECIAL_LABEL_COUNT[ are reserved for special blocks, + * ie param assignement, return and synch blocks.</li> + * <li>[maxLabel method.getCatches().size() + SPECIAL_LABEL_COUNT, getAvailableLabel()[ assigned + * labels. Note that some + * of the assigned labels may not be used any more if they were assigned to a block that was + * deleted since.</li> + * </ul> * - * @return {@code >= 0;} the label + * @return {@code >= 0;} an available label with the guaranty that all greater labels are + * also available. */ private int getAvailableLabel() { int candidate = getMinimumUnreservedLabel(); @@ -836,22 +920,19 @@ public final class Ropper { } /* - * Set up the exception handler type, by setting it if - * the given handler has yet to be encountered, or by - * conservatively unioning if it has. + * Set up the exception handler type. */ - Type already = catchTypes[targ]; - if (already == null) { - catchTypes[targ] = exceptionClass.getClassType(); - } else if (already != exceptionClass.getClassType()) { - catchTypes[targ] = Type.OBJECT; + CatchInfo handlers = catchInfos[targ]; + if (handlers == null) { + handlers = new CatchInfo(); + catchInfos[targ] = handlers; } + ExceptionHandlerSetup handler = handlers.getSetup(exceptionClass.getClassType()); /* - * The synthesized exception setup block will have the - * label getExceptionSetupLabel(targ). + * The synthesized exception setup block will have the label given by handler. */ - newSucc.add(getExceptionSetupLabel(targ)); + newSucc.add(handler.getLabel()); } if (synch && !catchesAny) { @@ -1205,30 +1286,32 @@ public final class Ropper { */ private void addExceptionSetupBlocks() { - int len = catchTypes.length; + int len = catchInfos.length; for (int i = 0; i < len; i++) { - Type one = catchTypes[i]; - if (one != null) { - Insn proto = labelToBlock(i).getFirstInsn(); - SourcePosition pos = proto.getPosition(); - InsnList il = new InsnList(2); - - Insn insn = new PlainInsn(Rops.opMoveException(one), - pos, - RegisterSpec.make(maxLocals, one), - RegisterSpecList.EMPTY); - il.set(0, insn); - - insn = new PlainInsn(Rops.GOTO, pos, null, - RegisterSpecList.EMPTY); - il.set(1, insn); - il.setImmutable(); - - BasicBlock bb = new BasicBlock(getExceptionSetupLabel(i), - il, - IntList.makeImmutable(i), - i); - addBlock(bb, startFrames[i].getSubroutines()); + CatchInfo catches = catchInfos[i]; + if (catches != null) { + for (ExceptionHandlerSetup one : catches.getSetups()) { + Insn proto = labelToBlock(i).getFirstInsn(); + SourcePosition pos = proto.getPosition(); + InsnList il = new InsnList(2); + + Insn insn = new PlainInsn(Rops.opMoveException(one.getCaughtType()), + pos, + RegisterSpec.make(maxLocals, one.getCaughtType()), + RegisterSpecList.EMPTY); + il.set(0, insn); + + insn = new PlainInsn(Rops.GOTO, pos, null, + RegisterSpecList.EMPTY); + il.set(1, insn); + il.setImmutable(); + + BasicBlock bb = new BasicBlock(one.getLabel(), + il, + IntList.makeImmutable(i), + i); + addBlock(bb, startFrames[i].getSubroutines()); + } } } } @@ -1359,6 +1442,26 @@ public final class Ropper { } /** + * Allocates labels for exception setup blocks. + */ + private class ExceptionSetupLabelAllocator extends LabelAllocator { + int maxSetupLabel; + + ExceptionSetupLabelAllocator() { + super(maxLabel); + maxSetupLabel = maxLabel + method.getCatches().size(); + } + + @Override + int getNextLabel() { + if (nextAvailableLabel >= maxSetupLabel) { + throw new IndexOutOfBoundsException(); + } + return nextAvailableLabel ++; + } + } + + /** * Inlines a subroutine. Start by calling * {@link #inlineSubroutineCalledFrom}. */ diff --git a/dx/src/com/android/dx/command/dexer/Main.java b/dx/src/com/android/dx/command/dexer/Main.java index 8c77d894c..9f4a177d7 100644 --- a/dx/src/com/android/dx/command/dexer/Main.java +++ b/dx/src/com/android/dx/command/dexer/Main.java @@ -272,7 +272,7 @@ public class Main { // this array is null if no classes were defined byte[] outArray = null; - if (!outputDex.isEmpty()) { + if (!outputDex.isEmpty() || (args.humanOutName != null)) { outArray = writeDex(); if (outArray == null) { @@ -1192,9 +1192,6 @@ public class Main { */ public boolean keepClassesInJar = false; - /** what API level to target */ - public int targetApiLevel = DexFormat.API_NO_EXTENDED_OPCODES; - /** how much source position info to preserve */ public int positionInfo = PositionList.LINES; @@ -1517,7 +1514,6 @@ public class Main { cfOptions.warn = DxConsole.err; dexOptions = new DexOptions(); - dexOptions.targetApiLevel = targetApiLevel; dexOptions.forceJumbo = forceJumbo; } } diff --git a/dx/src/com/android/dx/dex/DexOptions.java b/dx/src/com/android/dx/dex/DexOptions.java index db0c7a2c5..60d83a84e 100644 --- a/dx/src/com/android/dx/dex/DexOptions.java +++ b/dx/src/com/android/dx/dex/DexOptions.java @@ -34,12 +34,4 @@ public class DexOptions { public String getMagic() { return DexFormat.apiToMagic(targetApiLevel); } - - /** - * Returns whether extended opcodes are allowed. This became - * allowed as of Ice Cream Sandwich. - */ - public boolean canUseExtendedOpcodes() { - return targetApiLevel >= DexFormat.API_CURRENT; - } } diff --git a/dx/src/com/android/dx/dex/code/Dops.java b/dx/src/com/android/dx/dex/code/Dops.java index cc5c173ed..a84ddc098 100644 --- a/dx/src/com/android/dx/dex/code/Dops.java +++ b/dx/src/com/android/dx/dex/code/Dops.java @@ -1206,29 +1206,15 @@ public final class Dops { * the last in its chain */ public static Dop getNextOrNull(Dop opcode, DexOptions options) { - boolean suppressExtendedOpcodes = !options.canUseExtendedOpcodes(); + int nextOpcode = opcode.getNextOpcode(); - for (;;) { - int nextOpcode = opcode.getNextOpcode(); + if (nextOpcode == Opcodes.NO_NEXT) { + return null; + } - if (nextOpcode == Opcodes.NO_NEXT) { - return null; - } - - opcode = get(nextOpcode); + opcode = get(nextOpcode); - if (suppressExtendedOpcodes && Opcodes.isExtended(nextOpcode)) { - /* - * Continuing rather than just returning null here - * protects against the possibility that an - * instruction fitting chain might list non-extended - * opcodes after extended ones. - */ - continue; - } - - return opcode; - } + return opcode; } /** diff --git a/dx/src/com/android/dx/io/Opcodes.java b/dx/src/com/android/dx/io/Opcodes.java index 6dba49d9e..611dbda43 100644 --- a/dx/src/com/android/dx/io/Opcodes.java +++ b/dx/src/com/android/dx/io/Opcodes.java @@ -327,23 +327,6 @@ public final class Opcodes { } /** - * Gets whether ({@code true}) or not ({@code false}) the given - * opcode value is an "extended" opcode (not counting the nop-like - * payload opcodes). Extended opcodes require a full 16-bit code - * unit to represent, without leaving space for an argument byte. - * - * @param opcode the opcode value - * @return {@code true} iff the opcode is an "extended" opcode - */ - public static boolean isExtended(int opcode) { - /* - * Note: Extended opcodes all have the form ((byteValue << 8) - * | 0xff). - */ - return (opcode >= 0x00ff); - } - - /** * Gets the opcode out of an opcode unit, the latter of which may also * include one or more argument values. * diff --git a/dx/src/com/android/dx/rop/code/AccessFlags.java b/dx/src/com/android/dx/rop/code/AccessFlags.java index 2d84fe8c2..f516950a3 100644 --- a/dx/src/com/android/dx/rop/code/AccessFlags.java +++ b/dx/src/com/android/dx/rop/code/AccessFlags.java @@ -231,6 +231,28 @@ public final class AccessFlags { } /** + * Returns whether the flag {@code ACC_CONSTRUCTOR} is on in + * the given flags. + * + * @param flags the flags to check + * @return the value of the {@code ACC_CONSTRUCTOR} flag + */ + public static boolean isConstructor(int flags) { + return (flags & ACC_CONSTRUCTOR) != 0; + } + + /** + * Returns whether the flag {@code ACC_INTERFACE} is on in + * the given flags. + * + * @param flags the flags to check + * @return the value of the {@code ACC_INTERFACE} flag + */ + public static boolean isInterface(int flags) { + return (flags & ACC_INTERFACE) != 0; + } + + /** * Returns whether the flag {@code ACC_SYNCHRONIZED} is on in * the given flags. * @@ -286,6 +308,16 @@ public final class AccessFlags { } /** + * Returns whether the flag {@code ACC_ENUM} is on in the given flags. + * + * @param flags the flags to check + * @return the value of the {@code ACC_ENUM} flag + */ + public static boolean isEnum(int flags) { + return (flags & ACC_ENUM) != 0; + } + + /** * Helper to return a human-oriented string representing the given * access flags. * diff --git a/dx/src/com/android/dx/rop/cst/ConstantPool.java b/dx/src/com/android/dx/rop/cst/ConstantPool.java index efc394daa..f4b808654 100644 --- a/dx/src/com/android/dx/rop/cst/ConstantPool.java +++ b/dx/src/com/android/dx/rop/cst/ConstantPool.java @@ -67,4 +67,11 @@ public interface ConstantPool { * the index is in-range but invalid */ public Constant getOrNull(int n); + + /** + * Get all entries in this constant pool. + * + * @return the returned array may contain null entries. + */ + public Constant[] getEntries(); } diff --git a/dx/src/com/android/dx/rop/cst/StdConstantPool.java b/dx/src/com/android/dx/rop/cst/StdConstantPool.java index bb975e498..f941f7daa 100644 --- a/dx/src/com/android/dx/rop/cst/StdConstantPool.java +++ b/dx/src/com/android/dx/rop/cst/StdConstantPool.java @@ -88,6 +88,15 @@ public final class StdConstantPool } /** + * Get all entries in this constant pool. + * + * @return the returned array may contain null entries. + */ + public Constant[] getEntries() { + return entries; + } + + /** * Sets the entry at the given index. * * @param n {@code >= 1, < size();} which entry diff --git a/dx/src/com/android/multidex/ArchivePathElement.java b/dx/src/com/android/multidex/ArchivePathElement.java new file mode 100644 index 000000000..e76993bd9 --- /dev/null +++ b/dx/src/com/android/multidex/ArchivePathElement.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2013 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. + */ + +package com.android.multidex; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +/** + * A zip element. + */ +class ArchivePathElement implements ClassPathElement { + + private ZipFile archive; + + public ArchivePathElement(ZipFile archive) { + this.archive = archive; + } + + @Override + public InputStream open(String path) throws IOException { + ZipEntry entry = archive.getEntry(path); + if (entry == null) { + throw new FileNotFoundException(path); + } else { + return archive.getInputStream(entry); + } + } + + @Override + public void close() throws IOException { + archive.close(); + } + +} diff --git a/dx/src/com/android/multidex/ClassPathElement.java b/dx/src/com/android/multidex/ClassPathElement.java new file mode 100644 index 000000000..6c60721a4 --- /dev/null +++ b/dx/src/com/android/multidex/ClassPathElement.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2013 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. + */ + +package com.android.multidex; + +import java.io.IOException; +import java.io.InputStream; + +/** + * An element of the class path in which class files can be found. + */ +interface ClassPathElement { + + char SEPARATOR_CHAR = '/'; + + /** + * Open a "file" from this {@code ClassPathElement}. + * @param path a '/' separated relative path to the wanted file. + * @return an {@code InputStream} ready to read the requested file. + * @throws IOException if the path can not be found or if an error occurred while opening it. + */ + InputStream open(String path) throws IOException; + + void close() throws IOException; + +} diff --git a/dx/src/com/android/multidex/ClassReferenceListBuilder.java b/dx/src/com/android/multidex/ClassReferenceListBuilder.java new file mode 100644 index 000000000..104262f48 --- /dev/null +++ b/dx/src/com/android/multidex/ClassReferenceListBuilder.java @@ -0,0 +1,294 @@ +/* + * Copyright (C) 2013 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. + */ + +package com.android.multidex; + +import com.android.dx.cf.direct.DirectClassFile; +import com.android.dx.cf.direct.StdAttributeFactory; +import com.android.dx.rop.cst.Constant; +import com.android.dx.rop.cst.ConstantPool; +import com.android.dx.rop.cst.CstType; +import com.android.dx.rop.type.Type; +import com.android.dx.rop.type.TypeList; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.regex.Pattern; +import java.util.zip.ZipEntry; +import java.util.zip.ZipException; +import java.util.zip.ZipFile; + +/** + * This is a command line tool used by mainDexClasses script to find direct class references to + * other classes. First argument of the command line is an archive, each class file contained in + * this archive is used to identify a class whose references are to be searched, those class files + * are not opened by this tool only their names matter. Other arguments must be zip files or + * directories, they constitute in a classpath in with the classes named by the first argument + * will be searched. Each searched class must be found. On each of this classes are searched for + * their dependencies to other classes. Finally the tools prints on standard output a list of class + * files names suitable as content of the file argument --main-dex-list of dx. + */ +public class ClassReferenceListBuilder { + + private static final String CLASS_EXTENSION = ".class"; + + private static final int STATUS_ERROR = 1; + + private static final String EOL = System.getProperty("line.separator"); + + private static String USAGE_MESSAGE = + "Usage:" + EOL + EOL + + "Short version: Don't use this." + EOL + EOL + + "Slightly longer version: This tool is used by mainDexClasses script to find direct" + + EOL + + "references of some classes." + EOL; + + private Path path; + private Set<String> toKeep = new HashSet<String>(); + + private ClassReferenceListBuilder(Path path) { + this.path = path; + } + + public static void main(String[] args) { + + if (args.length != 2) { + printUsage(); + System.exit(STATUS_ERROR); + } + + ZipFile jarOfRoots; + try { + jarOfRoots = new ZipFile(args[0]); + } catch (IOException e) { + System.err.println("\"" + args[0] + "\" can not be read as a zip archive. (" + + e.getMessage() + ")"); + System.exit(STATUS_ERROR); + return; + } + + Path path = null; + try { + path = new Path(args[1]); + + ClassReferenceListBuilder builder = new ClassReferenceListBuilder(path); + builder.addRoots(jarOfRoots); + + printList(builder.toKeep); + } catch (IOException e) { + System.err.println("A fatal error occured: " + e.getMessage()); + System.exit(STATUS_ERROR); + return; + } finally { + try { + jarOfRoots.close(); + } catch (IOException e) { + // ignore + } + if (path != null) { + for (ClassPathElement element : path.elements) { + try { + element.close(); + } catch (IOException e) { + // keep going, lets do our best. + } + } + } + } + } + + private static void printUsage() { + System.err.print(USAGE_MESSAGE); + } + + private static ClassPathElement getClassPathElement(File file) + throws ZipException, IOException { + if (file.isDirectory()) { + return new FolderPathElement(file); + } else if (file.isFile()) { + return new ArchivePathElement(new ZipFile(file)); + } else if (file.exists()) { + throw new IOException(file.getAbsolutePath() + + " is not a directory neither a zip file"); + } else { + throw new FileNotFoundException(file.getAbsolutePath()); + } + } + + private static void printList(Set<String> toKeep) { + for (String classDescriptor : toKeep) { + System.out.print(classDescriptor); + System.out.println(CLASS_EXTENSION); + } + } + + private void addRoots(ZipFile jarOfRoots) throws IOException { + + // keep roots + for (Enumeration<? extends ZipEntry> entries = jarOfRoots.entries(); + entries.hasMoreElements();) { + ZipEntry entry = entries.nextElement(); + String name = entry.getName(); + if (name.endsWith(CLASS_EXTENSION)) { + toKeep.add(name.substring(0, name.length() - CLASS_EXTENSION.length())); + } + } + + // keep direct references of roots (+ direct references hierarchy) + for (Enumeration<? extends ZipEntry> entries = jarOfRoots.entries(); + entries.hasMoreElements();) { + ZipEntry entry = entries.nextElement(); + String name = entry.getName(); + if (name.endsWith(CLASS_EXTENSION)) { + DirectClassFile classFile; + try { + classFile = path.getClass(name); + } catch (FileNotFoundException e) { + throw new IOException("Class " + name + + " is missing form original class path " + path, e); + } + + addDependencies(classFile.getConstantPool()); + } + } + } + + private void addDependencies(ConstantPool pool) { + int entryCount = pool.size(); + for (Constant constant : pool.getEntries()) { + if (constant instanceof CstType) { + Type type = ((CstType) constant).getClassType(); + String descriptor = type.getDescriptor(); + if (descriptor.endsWith(";")) { + int lastBrace = descriptor.lastIndexOf('['); + if (lastBrace < 0) { + addClassWithHierachy(descriptor.substring(1, descriptor.length()-1)); + } else { + assert descriptor.length() > lastBrace + 3 + && descriptor.charAt(lastBrace + 1) == 'L'; + addClassWithHierachy(descriptor.substring(lastBrace + 2, + descriptor.length() - 1)); + } + } + } + } + } + + private void addClassWithHierachy(String classBinaryName) { + if (toKeep.contains(classBinaryName)) { + return; + } + + String fileName = classBinaryName + CLASS_EXTENSION; + try { + DirectClassFile classFile = path.getClass(fileName); + toKeep.add(classBinaryName); + CstType superClass = classFile.getSuperclass(); + if (superClass != null) { + addClassWithHierachy(superClass.getClassType().getClassName()); + } + + TypeList interfaceList = classFile.getInterfaces(); + int interfaceNumber = interfaceList.size(); + for (int i = 0; i < interfaceNumber; i++) { + addClassWithHierachy(interfaceList.getType(i).getClassName()); + } + } catch (FileNotFoundException e) { + // Ignore: The referenced type is not in the path it must be part of the libraries. + } + } + + private static class Path { + private List<ClassPathElement> elements = new ArrayList<ClassPathElement>(); + private String definition; + private ByteArrayOutputStream baos = new ByteArrayOutputStream(40 * 1024); + private byte[] readBuffer = new byte[20 * 1024]; + + public Path(String definition) throws IOException { + this.definition = definition; + for (String filePath : definition.split(Pattern.quote(File.pathSeparator))) { + try { + addElement(getClassPathElement(new File(filePath))); + } catch (IOException e) { + throw new IOException("\"" + filePath + "\" can not be used as a classpath" + + " element. (" + + e.getMessage() + ")", e); + } + } + } + + private static byte[] readStream(InputStream in, ByteArrayOutputStream baos, byte[] readBuffer) + throws IOException { + try { + for (;;) { + int amt = in.read(readBuffer); + if (amt < 0) { + break; + } + + baos.write(readBuffer, 0, amt); + } + } finally { + in.close(); + } + return baos.toByteArray(); + } + + @Override + public String toString() { + return definition; + } + + private void addElement(ClassPathElement element) { + assert element != null; + elements.add(element); + } + + private DirectClassFile getClass(String path) throws FileNotFoundException { + DirectClassFile classFile = null; + for (ClassPathElement element : elements) { + try { + InputStream in = element.open(path); + try { + byte[] bytes = readStream(in, baos, readBuffer); + baos.reset(); + classFile = new DirectClassFile(bytes, path, false); + classFile.setAttributeFactory(StdAttributeFactory.THE_ONE); + break; + } finally { + in.close(); + } + } catch (IOException e) { + // search next element + } + } + if (classFile == null) { + throw new FileNotFoundException(path); + } + return classFile; + } + } + + +} diff --git a/tests/301-abstract-protected/src/Main.java b/dx/src/com/android/multidex/FolderPathElement.java index 9b19a9d56..224254730 100644 --- a/tests/301-abstract-protected/src/Main.java +++ b/dx/src/com/android/multidex/FolderPathElement.java @@ -14,20 +14,32 @@ * limitations under the License. */ -public class Main { - public static void main(String args[]) throws Exception { - System.err.println(new C().m()); - } -} +package com.android.multidex; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; + +/** + * A folder element. + */ +class FolderPathElement implements ClassPathElement { + + private File baseFolder; -// An arbitrary interface. -interface I { public String m(); } + public FolderPathElement(File baseFolder) { + this.baseFolder = baseFolder; + } -// This is I-like, but doesn't actually claim to implement I. -abstract class Abstract { protected abstract String m(); } + @Override + public InputStream open(String path) throws FileNotFoundException { + return new FileInputStream(new File(baseFolder, + path.replace(SEPARATOR_CHAR, File.separatorChar))); + } -// This claims to implement I, but the inherited m isn't sufficiently visible. -abstract class AbstractI extends Abstract implements I { } + @Override + public void close() { + } -// This has a concrete m that's sufficiently visible, so all should be good. -class C extends AbstractI { public String m() { return "passed"; }; } +} diff --git a/libdex/Android.mk b/libdex/Android.mk index 7ab00139f..0a4639627 100644 --- a/libdex/Android.mk +++ b/libdex/Android.mk @@ -32,7 +32,6 @@ dex_src_files := \ OptInvocation.cpp \ sha1.cpp \ SysUtil.cpp \ - ZipArchive.cpp dex_include_files := \ dalvik \ @@ -51,6 +50,8 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := $(dex_src_files) LOCAL_C_INCLUDES += $(dex_include_files) LOCAL_STATIC_LIBRARIES := liblog +LOCAL_WHOLE_STATIC_LIBRARIES := libziparchive +LOCAL_SHARED_LIBRARIES := libutils LOCAL_MODULE_TAGS := optional LOCAL_MODULE := libdex include $(BUILD_STATIC_LIBRARY) @@ -66,7 +67,8 @@ endif # !SDK_ONLY include $(CLEAR_VARS) LOCAL_SRC_FILES := $(dex_src_files) LOCAL_C_INCLUDES += $(dex_include_files) -LOCAL_STATIC_LIBRARIES := liblog +LOCAL_STATIC_LIBRARIES := liblog libutils +LOCAL_WHOLE_STATIC_LIBRARIES := libziparchive-host LOCAL_MODULE_TAGS := optional LOCAL_MODULE := libdex include $(BUILD_HOST_STATIC_LIBRARY) diff --git a/libdex/CmdUtils.cpp b/libdex/CmdUtils.cpp index ff737a362..cdb7bb982 100644 --- a/libdex/CmdUtils.cpp +++ b/libdex/CmdUtils.cpp @@ -40,7 +40,7 @@ UnzipToFileResult dexUnzipToFile(const char* zipFileName, { UnzipToFileResult result = kUTFRSuccess; static const char* kFileToExtract = "classes.dex"; - ZipArchive archive; + ZipArchiveHandle archive; ZipEntry entry; bool unlinkOnFailure = false; int fd = -1; @@ -54,7 +54,7 @@ UnzipToFileResult dexUnzipToFile(const char* zipFileName, goto bail; } - fd = open(outFileName, O_WRONLY | O_CREAT | O_EXCL, 0600); + fd = open(outFileName, O_RDWR | O_CREAT | O_EXCL, 0600); if (fd < 0) { fprintf(stderr, "Unable to create output file '%s': %s\n", outFileName, strerror(errno)); @@ -64,8 +64,7 @@ UnzipToFileResult dexUnzipToFile(const char* zipFileName, unlinkOnFailure = true; - entry = dexZipFindEntry(&archive, kFileToExtract); - if (entry == NULL) { + if (dexZipFindEntry(archive, kFileToExtract, &entry) != 0) { if (!quiet) { fprintf(stderr, "Unable to find '%s' in '%s'\n", kFileToExtract, zipFileName); @@ -74,7 +73,7 @@ UnzipToFileResult dexUnzipToFile(const char* zipFileName, goto bail; } - if (dexZipExtractEntryToFile(&archive, entry, fd) != 0) { + if (dexZipExtractEntryToFile(archive, &entry, fd) != 0) { fprintf(stderr, "Extract of '%s' from '%s' failed\n", kFileToExtract, zipFileName); result = kUTFRBadZip; @@ -86,7 +85,7 @@ bail: close(fd); if (unlinkOnFailure && result != kUTFRSuccess) unlink(outFileName); - dexZipCloseArchive(&archive); + dexZipCloseArchive(archive); return result; } diff --git a/libdex/ZipArchive.cpp b/libdex/ZipArchive.cpp deleted file mode 100644 index f70a5dfbd..000000000 --- a/libdex/ZipArchive.cpp +++ /dev/null @@ -1,813 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -/* - * Read-only access to Zip archives, with minimal heap allocation. - */ -#include "ZipArchive.h" - -#include <zlib.h> - -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <fcntl.h> -#include <errno.h> - -#include <JNIHelp.h> // TEMP_FAILURE_RETRY may or may not be in unistd -#include <utils/Compat.h> // For off64_t and lseek64 on Mac - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -/* - * Zip file constants. - */ -#define kEOCDSignature 0x06054b50 -#define kEOCDLen 22 -#define kEOCDDiskNumber 4 // number of the current disk -#define kEOCDDiskNumberForCD 6 // disk number with the Central Directory -#define kEOCDNumEntries 8 // offset to #of entries in file -#define kEOCDTotalNumEntries 10 // offset to total #of entries in spanned archives -#define kEOCDSize 12 // size of the central directory -#define kEOCDFileOffset 16 // offset to central directory -#define kEOCDCommentSize 20 // offset to the length of the file comment - -#define kMaxCommentLen 65535 // longest possible in ushort -#define kMaxEOCDSearch (kMaxCommentLen + kEOCDLen) - -#define kLFHSignature 0x04034b50 -#define kLFHLen 30 // excluding variable-len fields -#define kLFHGPBFlags 6 // offset to GPB flags -#define kLFHNameLen 26 // offset to filename length -#define kLFHExtraLen 28 // offset to extra length - -#define kCDESignature 0x02014b50 -#define kCDELen 46 // excluding variable-len fields -#define kCDEGPBFlags 8 // offset to GPB flags -#define kCDEMethod 10 // offset to compression method -#define kCDEModWhen 12 // offset to modification timestamp -#define kCDECRC 16 // offset to entry CRC -#define kCDECompLen 20 // offset to compressed length -#define kCDEUncompLen 24 // offset to uncompressed length -#define kCDENameLen 28 // offset to filename length -#define kCDEExtraLen 30 // offset to extra length -#define kCDECommentLen 32 // offset to comment length -#define kCDELocalOffset 42 // offset to local hdr - -/* General Purpose Bit Flag */ -#define kGPFEncryptedFlag (1 << 0) -#define kGPFUnsupportedMask (kGPFEncryptedFlag) - -/* - * The values we return for ZipEntryRO use 0 as an invalid value, so we - * want to adjust the hash table index by a fixed amount. Using a large - * value helps insure that people don't mix & match arguments, e.g. to - * findEntryByIndex(). - */ -#define kZipEntryAdj 10000 - -/* - * Convert a ZipEntry to a hash table index, verifying that it's in a - * valid range. - */ -static int entryToIndex(const ZipArchive* pArchive, const ZipEntry entry) -{ - long ent = ((long) entry) - kZipEntryAdj; - if (ent < 0 || ent >= pArchive->mHashTableSize || - pArchive->mHashTable[ent].name == NULL) - { - ALOGW("Zip: invalid ZipEntry %p (%ld)", entry, ent); - return -1; - } - return ent; -} - -/* - * Simple string hash function for non-null-terminated strings. - */ -static unsigned int computeHash(const char* str, int len) -{ - unsigned int hash = 0; - - while (len--) - hash = hash * 31 + *str++; - - return hash; -} - -/* - * Add a new entry to the hash table. - */ -static void addToHash(ZipArchive* pArchive, const char* str, int strLen, - unsigned int hash) -{ - const int hashTableSize = pArchive->mHashTableSize; - int ent = hash & (hashTableSize - 1); - - /* - * We over-allocated the table, so we're guaranteed to find an empty slot. - */ - while (pArchive->mHashTable[ent].name != NULL) - ent = (ent + 1) & (hashTableSize-1); - - pArchive->mHashTable[ent].name = str; - pArchive->mHashTable[ent].nameLen = strLen; -} - -/* - * Get 2 little-endian bytes. - */ -static u2 get2LE(unsigned char const* pSrc) -{ - return pSrc[0] | (pSrc[1] << 8); -} - -/* - * Get 4 little-endian bytes. - */ -static u4 get4LE(unsigned char const* pSrc) -{ - u4 result; - - result = pSrc[0]; - result |= pSrc[1] << 8; - result |= pSrc[2] << 16; - result |= pSrc[3] << 24; - - return result; -} - -static int mapCentralDirectory0(int fd, const char* debugFileName, - ZipArchive* pArchive, off64_t fileLength, size_t readAmount, u1* scanBuf) -{ - /* - * Make sure this is a Zip archive. - */ - if (lseek64(pArchive->mFd, 0, SEEK_SET) != 0) { - ALOGW("seek to start failed: %s", strerror(errno)); - return false; - } - - ssize_t actual = TEMP_FAILURE_RETRY(read(pArchive->mFd, scanBuf, sizeof(int32_t))); - if (actual != (ssize_t) sizeof(int32_t)) { - ALOGI("couldn't read first signature from zip archive: %s", strerror(errno)); - return false; - } - - unsigned int header = get4LE(scanBuf); - if (header != kLFHSignature) { - ALOGV("Not a Zip archive (found 0x%08x)\n", header); - return false; - } - - /* - * Perform the traditional EOCD snipe hunt. - * - * We're searching for the End of Central Directory magic number, - * which appears at the start of the EOCD block. It's followed by - * 18 bytes of EOCD stuff and up to 64KB of archive comment. We - * need to read the last part of the file into a buffer, dig through - * it to find the magic number, parse some values out, and use those - * to determine the extent of the CD. - * - * We start by pulling in the last part of the file. - */ - off64_t searchStart = fileLength - readAmount; - - if (lseek64(pArchive->mFd, searchStart, SEEK_SET) != searchStart) { - ALOGW("seek %ld failed: %s\n", (long) searchStart, strerror(errno)); - return false; - } - actual = TEMP_FAILURE_RETRY(read(pArchive->mFd, scanBuf, readAmount)); - if (actual != (ssize_t) readAmount) { - ALOGW("Zip: read %zd, expected %zd. Failed: %s\n", - actual, readAmount, strerror(errno)); - return false; - } - - - /* - * Scan backward for the EOCD magic. In an archive without a trailing - * comment, we'll find it on the first try. (We may want to consider - * doing an initial minimal read; if we don't find it, retry with a - * second read as above.) - */ - int i; - for (i = readAmount - kEOCDLen; i >= 0; i--) { - if (scanBuf[i] == 0x50 && get4LE(&scanBuf[i]) == kEOCDSignature) { - ALOGV("+++ Found EOCD at buf+%d", i); - break; - } - } - if (i < 0) { - ALOGD("Zip: EOCD not found, %s is not zip", debugFileName); - return -1; - } - - off64_t eocdOffset = searchStart + i; - const u1* eocdPtr = scanBuf + i; - - assert(eocdOffset < fileLength); - - /* - * Grab the CD offset and size, and the number of entries in the - * archive. Verify that they look reasonable. - */ - u4 diskNumber = get2LE(eocdPtr + kEOCDDiskNumber); - u4 diskWithCentralDir = get2LE(eocdPtr + kEOCDDiskNumberForCD); - u4 numEntries = get2LE(eocdPtr + kEOCDNumEntries); - u4 totalNumEntries = get2LE(eocdPtr + kEOCDTotalNumEntries); - u4 centralDirSize = get4LE(eocdPtr + kEOCDSize); - u4 centralDirOffset = get4LE(eocdPtr + kEOCDFileOffset); - u4 commentSize = get2LE(eocdPtr + kEOCDCommentSize); - - // Verify that they look reasonable. - if ((long long) centralDirOffset + (long long) centralDirSize > (long long) eocdOffset) { - ALOGW("bad offsets (dir %ld, size %u, eocd %ld)\n", - (long) centralDirOffset, centralDirSize, (long) eocdOffset); - return false; - } - if (numEntries == 0) { - ALOGW("empty archive?\n"); - return false; - } else if (numEntries != totalNumEntries || diskNumber != 0 || diskWithCentralDir != 0) { - ALOGW("spanned archives not supported"); - return false; - } - - // Check to see if comment is a sane size - if (((size_t) commentSize > (fileLength - kEOCDLen)) - || (eocdOffset > (fileLength - kEOCDLen) - commentSize)) { - ALOGW("comment size runs off end of file"); - return false; - } - - ALOGV("+++ numEntries=%d dirSize=%d dirOffset=%d\n", - numEntries, centralDirSize, centralDirOffset); - - /* - * It all looks good. Create a mapping for the CD, and set the fields - * in pArchive. - */ - if (sysMapFileSegmentInShmem(fd, centralDirOffset, centralDirSize, - &pArchive->mDirectoryMap) != 0) - { - ALOGW("Zip: cd map failed"); - return -1; - } - - pArchive->mNumEntries = numEntries; - pArchive->mDirectoryOffset = centralDirOffset; - - return 0; -} - -/* - * Find the zip Central Directory and memory-map it. - * - * On success, returns 0 after populating fields from the EOCD area: - * mDirectoryOffset - * mDirectoryMap - * mNumEntries - */ -static int mapCentralDirectory(int fd, const char* debugFileName, - ZipArchive* pArchive) -{ - /* - * Get and test file length. - */ - off64_t fileLength = lseek64(fd, 0, SEEK_END); - if (fileLength < kEOCDLen) { - ALOGV("Zip: length %ld is too small to be zip", (long) fileLength); - return -1; - } - - /* - * Perform the traditional EOCD snipe hunt. - * - * We're searching for the End of Central Directory magic number, - * which appears at the start of the EOCD block. It's followed by - * 18 bytes of EOCD stuff and up to 64KB of archive comment. We - * need to read the last part of the file into a buffer, dig through - * it to find the magic number, parse some values out, and use those - * to determine the extent of the CD. - * - * We start by pulling in the last part of the file. - */ - size_t readAmount = kMaxEOCDSearch; - if (fileLength < off_t(readAmount)) - readAmount = fileLength; - - u1* scanBuf = (u1*) malloc(readAmount); - if (scanBuf == NULL) { - return -1; - } - - int result = mapCentralDirectory0(fd, debugFileName, pArchive, - fileLength, readAmount, scanBuf); - - free(scanBuf); - return result; -} - -/* - * Parses the Zip archive's Central Directory. Allocates and populates the - * hash table. - * - * Returns 0 on success. - */ -static int parseZipArchive(ZipArchive* pArchive) -{ - int result = -1; - const u1* cdPtr = (const u1*)pArchive->mDirectoryMap.addr; - size_t cdLength = pArchive->mDirectoryMap.length; - int numEntries = pArchive->mNumEntries; - - /* - * Create hash table. We have a minimum 75% load factor, possibly as - * low as 50% after we round off to a power of 2. There must be at - * least one unused entry to avoid an infinite loop during creation. - */ - pArchive->mHashTableSize = dexRoundUpPower2(1 + (numEntries * 4) / 3); - pArchive->mHashTable = (ZipHashEntry*) - calloc(pArchive->mHashTableSize, sizeof(ZipHashEntry)); - - /* - * Walk through the central directory, adding entries to the hash - * table and verifying values. - */ - const u1* ptr = cdPtr; - int i; - for (i = 0; i < numEntries; i++) { - if (get4LE(ptr) != kCDESignature) { - ALOGW("Zip: missed a central dir sig (at %d)", i); - goto bail; - } - if (ptr + kCDELen > cdPtr + cdLength) { - ALOGW("Zip: ran off the end (at %d)", i); - goto bail; - } - - long localHdrOffset = (long) get4LE(ptr + kCDELocalOffset); - if (localHdrOffset >= pArchive->mDirectoryOffset) { - ALOGW("Zip: bad LFH offset %ld at entry %d", localHdrOffset, i); - goto bail; - } - - unsigned int gpbf = get2LE(ptr + kCDEGPBFlags); - if ((gpbf & kGPFUnsupportedMask) != 0) { - ALOGW("Invalid General Purpose Bit Flag: %d", gpbf); - goto bail; - } - - unsigned int nameLen, extraLen, commentLen, hash; - nameLen = get2LE(ptr + kCDENameLen); - extraLen = get2LE(ptr + kCDEExtraLen); - commentLen = get2LE(ptr + kCDECommentLen); - - const char *name = (const char *) ptr + kCDELen; - - /* Check name for NULL characters */ - if (memchr(name, 0, nameLen) != NULL) { - ALOGW("Filename contains NUL byte"); - goto bail; - } - - /* add the CDE filename to the hash table */ - hash = computeHash(name, nameLen); - addToHash(pArchive, name, nameLen, hash); - - /* We don't care about the comment or extra data. */ - ptr += kCDELen + nameLen + extraLen + commentLen; - if ((size_t)(ptr - cdPtr) > cdLength) { - ALOGW("Zip: bad CD advance (%d vs %zd) at entry %d", - (int) (ptr - cdPtr), cdLength, i); - goto bail; - } - } - ALOGV("+++ zip good scan %d entries", numEntries); - - result = 0; - -bail: - return result; -} - -/* - * Open the specified file read-only. We examine the contents and verify - * that it appears to be a valid zip file. - * - * This will be called on non-Zip files, especially during VM startup, so - * we don't want to be too noisy about certain types of failure. (Do - * we want a "quiet" flag?) - * - * On success, we fill out the contents of "pArchive" and return 0. On - * failure we return the errno value. - */ -int dexZipOpenArchive(const char* fileName, ZipArchive* pArchive) -{ - int fd, err; - - ALOGV("Opening as zip '%s' %p", fileName, pArchive); - - memset(pArchive, 0, sizeof(ZipArchive)); - - fd = open(fileName, O_RDONLY | O_BINARY, 0); - if (fd < 0) { - err = errno ? errno : -1; - ALOGV("Unable to open '%s': %s", fileName, strerror(err)); - return err; - } - - return dexZipPrepArchive(fd, fileName, pArchive); -} - -/* - * Prepare to access a ZipArchive through an open file descriptor. - * - * On success, we fill out the contents of "pArchive" and return 0. - */ -int dexZipPrepArchive(int fd, const char* debugFileName, ZipArchive* pArchive) -{ - int result = -1; - - memset(pArchive, 0, sizeof(*pArchive)); - pArchive->mFd = fd; - - if (mapCentralDirectory(fd, debugFileName, pArchive) != 0) - goto bail; - - if (parseZipArchive(pArchive) != 0) { - ALOGV("Zip: parsing '%s' failed", debugFileName); - goto bail; - } - - /* success */ - result = 0; - -bail: - if (result != 0) - dexZipCloseArchive(pArchive); - return result; -} - - -/* - * Close a ZipArchive, closing the file and freeing the contents. - * - * NOTE: the ZipArchive may not have been fully created. - */ -void dexZipCloseArchive(ZipArchive* pArchive) -{ - ALOGV("Closing archive %p", pArchive); - - if (pArchive->mFd >= 0) - close(pArchive->mFd); - - sysReleaseShmem(&pArchive->mDirectoryMap); - - free(pArchive->mHashTable); - - /* ensure nobody tries to use the ZipArchive after it's closed */ - pArchive->mDirectoryOffset = -1; - pArchive->mFd = -1; - pArchive->mNumEntries = -1; - pArchive->mHashTableSize = -1; - pArchive->mHashTable = NULL; -} - - -/* - * Find a matching entry. - * - * Returns 0 if not found. - */ -ZipEntry dexZipFindEntry(const ZipArchive* pArchive, const char* entryName) -{ - int nameLen = strlen(entryName); - unsigned int hash = computeHash(entryName, nameLen); - const int hashTableSize = pArchive->mHashTableSize; - int ent = hash & (hashTableSize-1); - - while (pArchive->mHashTable[ent].name != NULL) { - if (pArchive->mHashTable[ent].nameLen == nameLen && - memcmp(pArchive->mHashTable[ent].name, entryName, nameLen) == 0) - { - /* match */ - return (ZipEntry)(long)(ent + kZipEntryAdj); - } - - ent = (ent + 1) & (hashTableSize-1); - } - - return NULL; -} - -#if 0 -/* - * Find the Nth entry. - * - * This currently involves walking through the sparse hash table, counting - * non-empty entries. If we need to speed this up we can either allocate - * a parallel lookup table or (perhaps better) provide an iterator interface. - */ -ZipEntry findEntryByIndex(ZipArchive* pArchive, int idx) -{ - if (idx < 0 || idx >= pArchive->mNumEntries) { - ALOGW("Invalid index %d", idx); - return NULL; - } - - int ent; - for (ent = 0; ent < pArchive->mHashTableSize; ent++) { - if (pArchive->mHashTable[ent].name != NULL) { - if (idx-- == 0) - return (ZipEntry) (ent + kZipEntryAdj); - } - } - - return NULL; -} -#endif - -/* - * Get the useful fields from the zip entry. - * - * Returns non-zero if the contents of the fields (particularly the data - * offset) appear to be bogus. - */ -int dexZipGetEntryInfo(const ZipArchive* pArchive, ZipEntry entry, - int* pMethod, size_t* pUncompLen, size_t* pCompLen, off_t* pOffset, - long* pModWhen, long* pCrc32) -{ - int ent = entryToIndex(pArchive, entry); - if (ent < 0) - return -1; - - /* - * Recover the start of the central directory entry from the filename - * pointer. The filename is the first entry past the fixed-size data, - * so we can just subtract back from that. - */ - const unsigned char* basePtr = (const unsigned char*) - pArchive->mDirectoryMap.addr; - const unsigned char* ptr = (const unsigned char*) - pArchive->mHashTable[ent].name; - off_t cdOffset = pArchive->mDirectoryOffset; - - ptr -= kCDELen; - - int method = get2LE(ptr + kCDEMethod); - if (pMethod != NULL) - *pMethod = method; - - if (pModWhen != NULL) - *pModWhen = get4LE(ptr + kCDEModWhen); - if (pCrc32 != NULL) - *pCrc32 = get4LE(ptr + kCDECRC); - - size_t compLen = get4LE(ptr + kCDECompLen); - if (pCompLen != NULL) - *pCompLen = compLen; - size_t uncompLen = get4LE(ptr + kCDEUncompLen); - if (pUncompLen != NULL) - *pUncompLen = uncompLen; - - /* - * If requested, determine the offset of the start of the data. All we - * have is the offset to the Local File Header, which is variable size, - * so we have to read the contents of the struct to figure out where - * the actual data starts. - * - * We also need to make sure that the lengths are not so large that - * somebody trying to map the compressed or uncompressed data runs - * off the end of the mapped region. - * - * Note we don't verify compLen/uncompLen if they don't request the - * dataOffset, because dataOffset is expensive to determine. However, - * if they don't have the file offset, they're not likely to be doing - * anything with the contents. - */ - if (pOffset != NULL) { - long localHdrOffset = (long) get4LE(ptr + kCDELocalOffset); - if (localHdrOffset + kLFHLen >= cdOffset) { - ALOGW("Zip: bad local hdr offset in zip"); - return -1; - } - - u1 lfhBuf[kLFHLen]; - if (lseek(pArchive->mFd, localHdrOffset, SEEK_SET) != localHdrOffset) { - ALOGW("Zip: failed seeking to lfh at offset %ld", localHdrOffset); - return -1; - } - ssize_t actual = - TEMP_FAILURE_RETRY(read(pArchive->mFd, lfhBuf, sizeof(lfhBuf))); - if (actual != sizeof(lfhBuf)) { - ALOGW("Zip: failed reading lfh from offset %ld", localHdrOffset); - return -1; - } - - if (get4LE(lfhBuf) != kLFHSignature) { - ALOGW("Zip: didn't find signature at start of lfh, offset=%ld", - localHdrOffset); - return -1; - } - - u4 gpbf = get2LE(lfhBuf + kLFHGPBFlags); - if ((gpbf & kGPFUnsupportedMask) != 0) { - ALOGW("Invalid General Purpose Bit Flag: %d", gpbf); - return -1; - } - - off64_t dataOffset = localHdrOffset + kLFHLen - + get2LE(lfhBuf + kLFHNameLen) + get2LE(lfhBuf + kLFHExtraLen); - if (dataOffset >= cdOffset) { - ALOGW("Zip: bad data offset %ld in zip", (long) dataOffset); - return -1; - } - - /* check lengths */ - if ((off_t)(dataOffset + compLen) > cdOffset) { - ALOGW("Zip: bad compressed length in zip (%ld + %zd > %ld)", - (long) dataOffset, compLen, (long) cdOffset); - return -1; - } - - if (method == kCompressStored && - (off_t)(dataOffset + uncompLen) > cdOffset) - { - ALOGW("Zip: bad uncompressed length in zip (%ld + %zd > %ld)", - (long) dataOffset, uncompLen, (long) cdOffset); - return -1; - } - - *pOffset = dataOffset; - } - return 0; -} - -/* - * Uncompress "deflate" data from the archive's file to an open file - * descriptor. - */ -static int inflateToFile(int outFd, int inFd, size_t uncompLen, size_t compLen) -{ - int result = -1; - const size_t kBufSize = 32768; - unsigned char* readBuf = (unsigned char*) malloc(kBufSize); - unsigned char* writeBuf = (unsigned char*) malloc(kBufSize); - z_stream zstream; - int zerr; - - if (readBuf == NULL || writeBuf == NULL) - goto bail; - - /* - * Initialize the zlib stream struct. - */ - memset(&zstream, 0, sizeof(zstream)); - zstream.zalloc = Z_NULL; - zstream.zfree = Z_NULL; - zstream.opaque = Z_NULL; - zstream.next_in = NULL; - zstream.avail_in = 0; - zstream.next_out = (Bytef*) writeBuf; - zstream.avail_out = kBufSize; - zstream.data_type = Z_UNKNOWN; - - /* - * Use the undocumented "negative window bits" feature to tell zlib - * that there's no zlib header waiting for it. - */ - zerr = inflateInit2(&zstream, -MAX_WBITS); - if (zerr != Z_OK) { - if (zerr == Z_VERSION_ERROR) { - ALOGE("Installed zlib is not compatible with linked version (%s)", - ZLIB_VERSION); - } else { - ALOGW("Call to inflateInit2 failed (zerr=%d)", zerr); - } - goto bail; - } - - /* - * Loop while we have more to do. - */ - do { - /* read as much as we can */ - if (zstream.avail_in == 0) { - size_t getSize = (compLen > kBufSize) ? kBufSize : compLen; - - ssize_t actual = TEMP_FAILURE_RETRY(read(inFd, readBuf, getSize)); - if (actual != (ssize_t) getSize) { - ALOGW("Zip: inflate read failed (%d vs %zd)", - (int)actual, getSize); - goto z_bail; - } - - compLen -= getSize; - - zstream.next_in = readBuf; - zstream.avail_in = getSize; - } - - /* uncompress the data */ - zerr = inflate(&zstream, Z_NO_FLUSH); - if (zerr != Z_OK && zerr != Z_STREAM_END) { - ALOGW("Zip: inflate zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)", - zerr, zstream.next_in, zstream.avail_in, - zstream.next_out, zstream.avail_out); - goto z_bail; - } - - /* write when we're full or when we're done */ - if (zstream.avail_out == 0 || - (zerr == Z_STREAM_END && zstream.avail_out != kBufSize)) - { - size_t writeSize = zstream.next_out - writeBuf; - if (sysWriteFully(outFd, writeBuf, writeSize, "Zip inflate") != 0) - goto z_bail; - - zstream.next_out = writeBuf; - zstream.avail_out = kBufSize; - } - } while (zerr == Z_OK); - - assert(zerr == Z_STREAM_END); /* other errors should've been caught */ - - /* paranoia */ - if (zstream.total_out != uncompLen) { - ALOGW("Zip: size mismatch on inflated file (%ld vs %zd)", - zstream.total_out, uncompLen); - goto z_bail; - } - - result = 0; - -z_bail: - inflateEnd(&zstream); /* free up any allocated structures */ - -bail: - free(readBuf); - free(writeBuf); - return result; -} - -/* - * Uncompress an entry, in its entirety, to an open file descriptor. - * - * TODO: this doesn't verify the data's CRC, but probably should (especially - * for uncompressed data). - */ -int dexZipExtractEntryToFile(const ZipArchive* pArchive, - const ZipEntry entry, int fd) -{ - int result = -1; - int ent = entryToIndex(pArchive, entry); - if (ent < 0) { - ALOGW("Zip: extract can't find entry %p", entry); - goto bail; - } - - int method; - size_t uncompLen, compLen; - off_t dataOffset; - - if (dexZipGetEntryInfo(pArchive, entry, &method, &uncompLen, &compLen, - &dataOffset, NULL, NULL) != 0) - { - goto bail; - } - if (lseek(pArchive->mFd, dataOffset, SEEK_SET) != dataOffset) { - ALOGW("Zip: lseek to data at %ld failed", (long) dataOffset); - goto bail; - } - - if (method == kCompressStored) { - if (sysCopyFileToFile(fd, pArchive->mFd, uncompLen) != 0) - goto bail; - } else { - if (inflateToFile(fd, pArchive->mFd, uncompLen, compLen) != 0) - goto bail; - } - - result = 0; - -bail: - return result; -} diff --git a/libdex/ZipArchive.h b/libdex/ZipArchive.h index df5c49a6b..c4794ce0d 100644 --- a/libdex/ZipArchive.h +++ b/libdex/ZipArchive.h @@ -20,75 +20,20 @@ #ifndef LIBDEX_ZIPARCHIVE_H_ #define LIBDEX_ZIPARCHIVE_H_ +#include <ziparchive/zip_archive.h> + #include "SysUtil.h" #include "DexFile.h" // need DEX_INLINE /* - * Trivial typedef to ensure that ZipEntry is not treated as a simple - * integer. We use NULL to indicate an invalid value. - */ -typedef void* ZipEntry; - -/* - * One entry in the hash table. - */ -struct ZipHashEntry { - const char* name; - unsigned short nameLen; -}; - -/* - * Read-only Zip archive. - * - * We want "open" and "find entry by name" to be fast operations, and - * we want to use as little memory as possible. We memory-map the zip - * central directory, and load a hash table with pointers to the filenames - * (which aren't null-terminated). The other fields are at a fixed offset - * from the filename, so we don't need to extract those (but we do need - * to byte-read and endian-swap them every time we want them). - * - * It's possible that somebody has handed us a massive (~1GB) zip archive, - * so we can't expect to mmap the entire file. - * - * To speed comparisons when doing a lookup by name, we could make the mapping - * "private" (copy-on-write) and null-terminate the filenames after verifying - * the record structure. However, this requires a private mapping of - * every page that the Central Directory touches. Easier to tuck a copy - * of the string length into the hash table entry. - */ -struct ZipArchive { - /* open Zip archive */ - int mFd; - - /* mapped central directory area */ - off_t mDirectoryOffset; - MemMapping mDirectoryMap; - - /* number of entries in the Zip archive */ - int mNumEntries; - - /* - * We know how many entries are in the Zip archive, so we can have a - * fixed-size hash table. We probe on collisions. - */ - int mHashTableSize; - ZipHashEntry* mHashTable; -}; - -/* Zip compression methods we support */ -enum { - kCompressStored = 0, // no compression - kCompressDeflated = 8, // standard deflate -}; - - -/* * Open a Zip archive. * * On success, returns 0 and populates "pArchive". Returns nonzero errno * value on failure. */ -int dexZipOpenArchive(const char* fileName, ZipArchive* pArchive); +DEX_INLINE int dexZipOpenArchive(const char* fileName, ZipArchiveHandle* pArchive) { + return OpenArchive(fileName, pArchive); +} /* * Like dexZipOpenArchive, but takes a file descriptor open for reading @@ -97,7 +42,10 @@ int dexZipOpenArchive(const char* fileName, ZipArchive* pArchive); * * "debugFileName" will appear in error messages, but is not otherwise used. */ -int dexZipPrepArchive(int fd, const char* debugFileName, ZipArchive* pArchive); +DEX_INLINE int dexZipOpenArchiveFd(int fd, const char* debugFileName, + ZipArchiveHandle* pArchive) { + return OpenArchiveFd(fd, debugFileName, pArchive); +} /* * Close archive, releasing resources associated with it. @@ -105,62 +53,24 @@ int dexZipPrepArchive(int fd, const char* debugFileName, ZipArchive* pArchive); * Depending on the implementation this could unmap pages used by classes * stored in a Jar. This should only be done after unloading classes. */ -void dexZipCloseArchive(ZipArchive* pArchive); +DEX_INLINE void dexZipCloseArchive(ZipArchiveHandle archive) { + CloseArchive(archive); +} /* * Return the archive's file descriptor. */ -DEX_INLINE int dexZipGetArchiveFd(const ZipArchive* pArchive) { - return pArchive->mFd; +DEX_INLINE int dexZipGetArchiveFd(const ZipArchiveHandle pArchive) { + return GetFileDescriptor(pArchive); } /* * Find an entry in the Zip archive, by name. Returns NULL if the entry * was not found. */ -ZipEntry dexZipFindEntry(const ZipArchive* pArchive, - const char* entryName); - -/* - * Retrieve one or more of the "interesting" fields. Non-NULL pointers - * are filled in. - * - * Returns 0 on success. - */ -int dexZipGetEntryInfo(const ZipArchive* pArchive, ZipEntry entry, - int* pMethod, size_t* pUncompLen, size_t* pCompLen, off_t* pOffset, - long* pModWhen, long* pCrc32); - -/* - * Simple accessors. - */ -DEX_INLINE long dexGetZipEntryOffset(const ZipArchive* pArchive, - const ZipEntry entry) -{ - off_t val = 0; - dexZipGetEntryInfo(pArchive, entry, NULL, NULL, NULL, &val, NULL, NULL); - return (long) val; -} -DEX_INLINE size_t dexGetZipEntryUncompLen(const ZipArchive* pArchive, - const ZipEntry entry) -{ - size_t val = 0; - dexZipGetEntryInfo(pArchive, entry, NULL, &val, NULL, NULL, NULL, NULL); - return val; -} -DEX_INLINE long dexGetZipEntryModTime(const ZipArchive* pArchive, - const ZipEntry entry) -{ - long val = 0; - dexZipGetEntryInfo(pArchive, entry, NULL, NULL, NULL, NULL, &val, NULL); - return val; -} -DEX_INLINE long dexGetZipEntryCrc32(const ZipArchive* pArchive, - const ZipEntry entry) -{ - long val = 0; - dexZipGetEntryInfo(pArchive, entry, NULL, NULL, NULL, NULL, NULL, &val); - return val; +DEX_INLINE int dexZipFindEntry(const ZipArchiveHandle pArchive, + const char* entryName, ZipEntry* data) { + return FindEntry(pArchive, entryName, data); } /* @@ -168,13 +78,9 @@ DEX_INLINE long dexGetZipEntryCrc32(const ZipArchive* pArchive, * * Returns 0 on success. */ -int dexZipExtractEntryToFile(const ZipArchive* pArchive, - const ZipEntry entry, int fd); - -/* - * Utility function to compute a CRC-32. - */ -u4 dexInitCrc32(void); -u4 dexComputeCrc32(u4 crc, const void* buf, size_t len); +DEX_INLINE int dexZipExtractEntryToFile(ZipArchiveHandle handle, + ZipEntry* entry, int fd) { + return ExtractEntryToFile(handle, entry, fd); +} #endif // LIBDEX_ZIPARCHIVE_H_ diff --git a/tests/001-nop/build b/tests/001-nop/build deleted file mode 100644 index 5233a2d71..000000000 --- a/tests/001-nop/build +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -# Nothing to do here. diff --git a/tests/001-nop/expected.txt b/tests/001-nop/expected.txt deleted file mode 100644 index 80a233e74..000000000 --- a/tests/001-nop/expected.txt +++ /dev/null @@ -1 +0,0 @@ -Blort. diff --git a/tests/001-nop/info.txt b/tests/001-nop/info.txt deleted file mode 100644 index 9942f10da..000000000 --- a/tests/001-nop/info.txt +++ /dev/null @@ -1,2 +0,0 @@ -This is a sample no-op test, which does at least serve to verify that the -test harness is working. diff --git a/tests/001-nop/run b/tests/001-nop/run deleted file mode 100644 index 210296b57..000000000 --- a/tests/001-nop/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -echo "Blort." diff --git a/tests/002-sleep/expected.txt b/tests/002-sleep/expected.txt deleted file mode 100644 index f994ce5de..000000000 --- a/tests/002-sleep/expected.txt +++ /dev/null @@ -1,2 +0,0 @@ -Sleeping 1000 msec... -Done sleeping diff --git a/tests/002-sleep/info.txt b/tests/002-sleep/info.txt deleted file mode 100644 index 9a0afe9dd..000000000 --- a/tests/002-sleep/info.txt +++ /dev/null @@ -1,3 +0,0 @@ -Test that Thread.sleep() operates reasonably. This test is actually -mostly meant as an easy thing to modify in order to test other things -in an ad-hoc way. diff --git a/tests/002-sleep/src/Main.java b/tests/002-sleep/src/Main.java deleted file mode 100644 index c1a2d83c5..000000000 --- a/tests/002-sleep/src/Main.java +++ /dev/null @@ -1,22 +0,0 @@ -public class Main { - static public void main(String[] args) throws Exception { - int millis = 1000; - - if (args.length != 0) { - millis = Integer.parseInt(args[0]); - } - - System.out.println("Sleeping " + millis + " msec..."); - - long start = System.currentTimeMillis(); - Thread.sleep(millis); - long elapsed = System.currentTimeMillis() - start; - long offBy = Math.abs(elapsed - millis); - - System.out.println("Done sleeping"); - - if (offBy > 250) { - System.out.println("Actually slept about " + elapsed + " msec..."); - } - } -} diff --git a/tests/003-omnibus-opcodes/build b/tests/003-omnibus-opcodes/build deleted file mode 100644 index 9eb5ed3f4..000000000 --- a/tests/003-omnibus-opcodes/build +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2008 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. - -# Stop if something fails. -set -e - -mkdir classes -${JAVAC} -d classes `find src -name '*.java'` -rm classes/UnresClass.class -${JAVAC} -d classes `find src2 -name '*.java'` - -dx -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex classes -zip test.jar classes.dex diff --git a/tests/003-omnibus-opcodes/expected.txt b/tests/003-omnibus-opcodes/expected.txt deleted file mode 100644 index 4895dc3e0..000000000 --- a/tests/003-omnibus-opcodes/expected.txt +++ /dev/null @@ -1,74 +0,0 @@ -(assertions are enabled) -InstField assign... -InstField check... -InstField.nullCheck -StaticField assign... -StaticField check... -IntMath.shiftTest1 -IntMath.shiftTest2 -IntMath.unsignedShiftTest -IntMath.convTest -IntMath.charSubTest -IntMath.intOperTest -IntMath.intOperCheck -IntMath.longOperTest -IntMath.longOperCheck -IntMath.lit16Test -IntMath.lit8Test -IntMath.intShiftTest -IntMath.intShiftCheck -IntMath.longShiftTest -IntMath.longShiftCheck -IntMath.truncateTest -IntMath.divideByZero -IntMath.bigDivideOverflow -IntMath.checkConsts -IntMath.jlmTests -FloatMath.convTest -FloatMath.floatOperTest -FloatMath.doubleOperTest -FloatMath.checkConvI -FloatMath.checkConvL -FloatMath.checkConvF - 0: -2.0054409E9 - 1: -8.613303E18 - 2: -3.1415927 --2.0054409E9, -8.6133031E18, -3.1415927 -FloatMath.checkConvD - 0: -2.005440939E9 - 1: -8.613303245920329E18 - 2: 123.45600128173828 --2.005440939E9, -8.6133032459203287E18, 123.4560012817382 -FloatMath.checkConsts -FloatMath.jlmTests -IntMath.testIntCompare -IntMath.testLongCompare -IntMath.testFloatCompare -IntMath.testDoubleCompare -Monitor.run -Switch.testSwitch -Array check... -Array.checkRange32 -Array.checkRange64 -Array.checkNegAlloc -Classes.checkCast -Classes.arrayInstance -Goto.smallGoto -Goto.smallGoto -Goto.mediumGoto -Goto.mediumGoto -Goto.bigGoto -Goto.bigGoto - MethodCallBase ctor - MethodCall ctor -MethodCalls.manyArgs -Throw.one -Throw.twoA -Throw.twoN -Throw.rethrow -UnresTest1... -UnresTest1... -UnresTest2... -UnresTest2 done -InternedString.run -Done! diff --git a/tests/003-omnibus-opcodes/info.txt b/tests/003-omnibus-opcodes/info.txt deleted file mode 100644 index 6c0fbda2c..000000000 --- a/tests/003-omnibus-opcodes/info.txt +++ /dev/null @@ -1 +0,0 @@ -This is a smoke test of many Dalvik opcodes. diff --git a/tests/003-omnibus-opcodes/src/Array.java b/tests/003-omnibus-opcodes/src/Array.java deleted file mode 100644 index f385dd817..000000000 --- a/tests/003-omnibus-opcodes/src/Array.java +++ /dev/null @@ -1,224 +0,0 @@ -// Copyright 2008 The Android Open Source Project - - -/** - * Exercise arrays. - */ -public class Array { - - /* - * Verify array contents. - */ - static void checkBytes(byte[] bytes) { - assert(bytes[0] == 0); - assert(bytes[1] == -1); - assert(bytes[2] == -2); - assert(bytes[3] == -3); - assert(bytes[4] == -4); - } - static void checkShorts(short[] shorts) { - assert(shorts[0] == 20); - assert(shorts[1] == 10); - assert(shorts[2] == 0); - assert(shorts[3] == -10); - assert(shorts[4] == -20); - } - static void checkChars(char[] chars) { - assert(chars[0] == 40000); - assert(chars[1] == 40001); - assert(chars[2] == 40002); - assert(chars[3] == 40003); - assert(chars[4] == 40004); - } - static void checkInts(int[] ints) { - assert(ints[0] == 70000); - assert(ints[1] == 70001); - assert(ints[2] == 70002); - assert(ints[3] == 70003); - assert(ints[4] == 70004); - } - static void checkBooleans(boolean[] booleans) { - assert(booleans[0]); - assert(booleans[1]); - assert(!booleans[2]); - assert(booleans[3]); - assert(!booleans[4]); - } - static void checkFloats(float[] floats) { - assert(floats[0] == -1.5); - assert(floats[1] == -0.5); - assert(floats[2] == 0.0); - assert(floats[3] == 0.5); - assert(floats[4] == 1.5); - } - static void checkLongs(long[] longs) { - assert(longs[0] == 0x1122334455667788L); - assert(longs[1] == 0x8877665544332211L); - assert(longs[2] == 0L); - assert(longs[3] == 1L); - assert(longs[4] == -1L); - } - static void checkStrings(String[] strings) { - assert(strings[0].equals("zero")); - assert(strings[1].equals("one")); - assert(strings[2].equals("two")); - assert(strings[3].equals("three")); - assert(strings[4].equals("four")); - } - - /* - * Try bad range values, 32 bit get/put. - */ - static void checkRange32(int[] ints, int[] empty, int negVal1, int negVal2){ - System.out.println("Array.checkRange32"); - int i = 0; - - assert(ints.length == 5); - - try { - i = ints[5]; // exact bound - assert(false); - } catch (ArrayIndexOutOfBoundsException aioobe) { - // good - } - try { - ints[5] = i; // exact bound - assert(false); - } catch (ArrayIndexOutOfBoundsException aioobe) { - // good - } - try { - i = ints[6]; // one past - assert(false); - } catch (ArrayIndexOutOfBoundsException aioobe) { - // good - } - try { - i = ints[negVal1]; // -1 - assert(false); - } catch (ArrayIndexOutOfBoundsException aioobe) { - // good - } - try { - ints[negVal1] = i; // -1 - assert(false); - } catch (ArrayIndexOutOfBoundsException aioobe) { - // good - } - try { - i = ints[negVal2]; // min int - assert(false); - } catch (ArrayIndexOutOfBoundsException aioobe) { - // good - } - - - try { - i = empty[1]; - assert(false); - } catch (ArrayIndexOutOfBoundsException aioobe) { - // good - } - } - - /* - * Try bad range values, 64 bit get/put. - */ - static void checkRange64(long[] longs, int negVal1, int negVal2) { - System.out.println("Array.checkRange64"); - long l = 0L; - - assert(longs.length == 5); - - try { - l = longs[5]; // exact bound - assert(false); - } catch (ArrayIndexOutOfBoundsException aioobe) { - // good - } - try { - longs[5] = l; // exact bound - assert(false); - } catch (ArrayIndexOutOfBoundsException aioobe) { - // good - } - try { - l = longs[6]; // one past - assert(false); - } catch (ArrayIndexOutOfBoundsException aioobe) { - // good - } - try { - l = longs[negVal1]; // -1 - assert(false); - } catch (ArrayIndexOutOfBoundsException aioobe) { - // good - } - try { - longs[negVal1] = l; // -1 - assert(false); - } catch (ArrayIndexOutOfBoundsException aioobe) { - // good - } - try { - l = longs[negVal2]; // min int - assert(false); - } catch (ArrayIndexOutOfBoundsException aioobe) { - // good - } - } - - /* - * Test negative allocations of object and primitive arrays. - */ - static void checkNegAlloc(int count) { - System.out.println("Array.checkNegAlloc"); - String[] strings; - int[] ints; - - try { - ints = new int[count]; - assert(false); - } catch (NegativeArraySizeException nase) { - // good - } - - try { - strings = new String[count]; - assert(false); - } catch (NegativeArraySizeException nase) { - // good - } - } - - public static void run() { - System.out.println("Array check..."); - - byte[] xBytes = new byte[] { 0, -1, -2, -3, -4 }; - short[] xShorts = new short[] { 20, 10, 0, -10, -20 }; - char[] xChars = new char[] { 40000, 40001, 40002, 40003, 40004 }; - int[] xInts = new int[] { 70000, 70001, 70002, 70003, 70004 }; - boolean[] xBooleans = new boolean[] { true, true, false, true, false }; - float[] xFloats = new float[] { -1.5f, -0.5f, 0.0f, 0.5f, 1.5f }; - long[] xLongs = new long[] { - 0x1122334455667788L, 0x8877665544332211L, 0L, 1L, -1l }; - String[] xStrings = new String[] { - "zero", "one", "two", "three", "four" }; - - int[] xEmpty = new int[0]; - - checkBytes(xBytes); - checkShorts(xShorts); - checkChars(xChars); - checkInts(xInts); - checkBooleans(xBooleans); - checkFloats(xFloats); - checkLongs(xLongs); - checkStrings(xStrings); - - checkRange32(xInts, xEmpty, -1, (int) 0x80000000); - checkRange64(xLongs, -1, (int) 0x80000000); - - checkNegAlloc(-1); - } -} diff --git a/tests/003-omnibus-opcodes/src/Classes.java b/tests/003-omnibus-opcodes/src/Classes.java deleted file mode 100644 index c89ff3ef8..000000000 --- a/tests/003-omnibus-opcodes/src/Classes.java +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -import java.io.Serializable; -import java.util.Arrays; - -/** - * Exercise some class-related instructions. - */ -public class Classes { - int mSome; - - public void subFunc(boolean wantSub) { - assert(!wantSub); - } - - void checkCast(Object thisRef, Object moreRef, Object nullRef) { - System.out.println("Classes.checkCast"); - - Classes classes; - MoreClasses more; - - classes = (Classes) thisRef; - assert(thisRef instanceof Classes); - classes = (Classes) moreRef; - assert(moreRef instanceof Classes); - - more = (MoreClasses) moreRef; - assert(moreRef instanceof MoreClasses); - assert(!(thisRef instanceof MoreClasses)); - - try { - more = (MoreClasses) thisRef; - assert(false); - } catch (ClassCastException cce) { - //System.out.println(" class cast msg: " + cce.getMessage()); - //Dalvik throws terser message than Hotspot VM - assert(cce.getMessage().regionMatches(false, 0, "Classes", 0, 7)); - } - assert(!(thisRef instanceof MoreClasses)); - - /* hopefully these classes cause a resolve */ - try { - java.math.RoundingMode mode = (java.math.RoundingMode) thisRef; - assert(false); - } catch (ClassCastException cce) { - //System.out.println(" class cast msg: " + cce.getMessage()); - //Dalvik throws terser message than Hotspot VM - assert(cce.getMessage().regionMatches(false, 0, "Classes", 0, 7)); - } - assert(!(thisRef instanceof java.math.BigDecimal)); - - /* try some stuff with a null reference */ - classes = (Classes) nullRef; - classes = (MoreClasses) nullRef; - more = (MoreClasses) nullRef; - assert(!(nullRef instanceof Classes)); - - } - - - static void xTests(Object x) { - assert( x instanceof Classes); - assert(!(x instanceof MoreClasses)); - } - static void yTests(Object y) { - assert( y instanceof Classes); - assert( y instanceof MoreClasses); - } - static void xarTests(Object xar) { - assert( xar instanceof Object); - assert(!(xar instanceof Classes)); - assert( xar instanceof Classes[]); - assert(!(xar instanceof MoreClasses[])); - assert( xar instanceof Object[]); - assert(!(xar instanceof Object[][])); - } - static void yarTests(Object yar) { - assert( yar instanceof Classes[]); - assert( yar instanceof MoreClasses[]); - } - static void xarararTests(Object xararar) { - assert( xararar instanceof Object); - assert( xararar instanceof Object[]); - assert(!(xararar instanceof Classes)); - assert(!(xararar instanceof Classes[])); - assert(!(xararar instanceof Classes[][])); - assert( xararar instanceof Classes[][][]); - assert(!(xararar instanceof MoreClasses[][][])); - assert( xararar instanceof Object[][][]); - assert( xararar instanceof Serializable); - assert( xararar instanceof Serializable[]); - assert( xararar instanceof Serializable[][]); - assert(!(xararar instanceof Serializable[][][])); - } - static void yarararTests(Object yararar) { - assert( yararar instanceof Classes[][][]); - assert( yararar instanceof MoreClasses[][][]); - } - static void iarTests(Object iar) { - assert( iar instanceof Object); - assert(!(iar instanceof Object[])); - } - static void iararTests(Object iarar) { - assert( iarar instanceof Object); - assert( iarar instanceof Object[]); - assert(!(iarar instanceof Object[][])); - } - - /* - * Exercise filled-new-array and test instanceof on arrays. - * - * We call out instead of using "instanceof" directly to avoid - * compiler optimizations. - */ - static void arrayInstance() { - System.out.println("Classes.arrayInstance"); - - Classes x = new Classes(); - Classes[] xar = new Classes[1]; - Classes[][] xarar = new Classes[1][1]; - Classes[][][] xararar = new Classes[1][2][3]; - MoreClasses y = new MoreClasses(); - MoreClasses[] yar = new MoreClasses[3]; - MoreClasses[][] yarar = new MoreClasses[2][3]; - MoreClasses[][][] yararar = new MoreClasses[1][2][3]; - int[] iar = new int[1]; - int[][] iarar = new int[1][1]; - Object test; - - xTests(x); - yTests(y); - xarTests(xar); - yarTests(yar); - xarararTests(xararar); - yarararTests(yararar); - iarTests(iar); - iararTests(iarar); - - yararar[0] = yarar; - yararar[0][0] = yar; - yararar[0][1] = yar; - yararar[0][0][0] = y; - yararar[0][0][1] = y; - yararar[0][0][2] = y; - yararar[0][1][0] = y; - yararar[0][1][1] = y; - yararar[0][1][2] = y; - - String strForm; - - String[][][][] multi1 = new String[2][3][2][1]; - multi1[0] = new String[2][3][2]; - multi1[0][1] = new String[3][2]; - multi1[0][1][2] = new String[2]; - multi1[0][1][2][1] = "HELLO-1"; - strForm = Arrays.deepToString(multi1); - - String[][][][][] multi2 = new String[5][2][3][2][1]; - multi2[0] = new String[5][2][3][2]; - multi2[0][1] = new String[5][2][3]; - multi2[0][1][2] = new String[5][2]; - multi2[0][1][2][1] = new String[5]; - multi2[0][1][2][1][4] = "HELLO-2"; - strForm = Arrays.deepToString(multi2); - - - String[][][][][][] multi3 = new String[2][5][2][3][2][1]; - multi3[0] = new String[2][][][][]; - multi3[0][1] = new String[3][][][]; - multi3[0][1][2] = new String[2][][]; - multi3[0][1][2][1] = new String[5][]; - multi3[0][1][2][1][4] = new String[2]; - multi3[0][1][2][1][4][1] = "HELLO-3"; - strForm = Arrays.deepToString(multi3); - - // build up pieces - String[][][][][][] multi4 = new String[1][][][][][]; - multi4[0] = new String[2][][][][]; - multi4[0][1] = new String[3][][][]; - multi4[0][1][2] = new String[2][][]; - multi4[0][1][2][1] = new String[5][]; - multi4[0][1][2][1][4] = new String[2]; - multi4[0][1][2][1][4][1] = "HELLO-4"; - strForm = Arrays.deepToString(multi4); - - /* this is expected to fail; 1073921584 * 4 overflows 32 bits */ - try { - String[][][][][] multiX = new String[5][2][3][2][1073921584]; - assert(false); - } catch (Error e) { - //System.out.println(" Got expected failure: " + e); - } - - } - - public static void run() { - Classes classes = new Classes(); - MoreClasses more = new MoreClasses(); - classes.checkCast(classes, more, null); - - more.subFunc(true); - more.superFunc(false); - arrayInstance(); - } -} - -class MoreClasses extends Classes { - int mMore; - - public MoreClasses() {} - - public void subFunc(boolean wantSub) { - assert(wantSub); - } - - public void superFunc(boolean wantSub) { - super.subFunc(wantSub); - } -} diff --git a/tests/003-omnibus-opcodes/src/Compare.java b/tests/003-omnibus-opcodes/src/Compare.java deleted file mode 100644 index 43a708a5e..000000000 --- a/tests/003-omnibus-opcodes/src/Compare.java +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright 2008 The Android Open Source Project - - - -/** - * Test comparison operators. - */ -public class Compare { - - /* - * Test the integer comparisons in various ways. - */ - static void testIntCompare(int minus, int plus, int plus2, int zero) { - System.out.println("IntMath.testIntCompare"); - - if (minus > plus) - assert(false); - if (minus >= plus) - assert(false); - if (plus < minus) - assert(false); - if (plus <= minus) - assert(false); - if (plus == minus) - assert(false); - if (plus != plus2) - assert(false); - - /* try a branch-taken */ - if (plus != minus) { - assert(true); - } else { - assert(false); - } - - if (minus > 0) - assert(false); - if (minus >= 0) - assert(false); - if (plus < 0) - assert(false); - if (plus <= 0) - assert(false); - if (plus == 0) - assert(false); - if (zero != 0) - assert(false); - - if (zero == 0) { - assert(true); - } else { - assert(false); - } - } - - /* - * Test cmp-long. - * - * minus=-5, alsoMinus=0xFFFFFFFF00000009, plus=4, alsoPlus=8 - */ - static void testLongCompare(long minus, long alsoMinus, long plus, - long alsoPlus) { - - System.out.println("IntMath.testLongCompare"); - if (minus > plus) - assert(false); - if (plus < minus) - assert(false); - if (plus == minus) - assert(false); - - if (plus >= plus+1) - assert(false); - if (minus >= minus+1) - assert(false); - - /* try a branch-taken */ - if (plus != minus) { - assert(true); - } else { - assert(false); - } - - /* compare when high words are equal but low words differ */ - if (plus > alsoPlus) - assert(false); - if (alsoPlus < plus) - assert(false); - if (alsoPlus == plus) - assert(false); - - /* high words are equal, low words have apparently different signs */ - if (minus < alsoMinus) // bug! - assert(false); - if (alsoMinus > minus) - assert(false); - if (alsoMinus == minus) - assert(false); - } - - /* - * Test cmpl-float and cmpg-float. - */ - static void testFloatCompare(float minus, float plus, float plus2, - float nan) { - - System.out.println("IntMath.testFloatCompare"); - if (minus > plus) - assert(false); - if (plus < minus) - assert(false); - if (plus == minus) - assert(false); - if (plus != plus2) - assert(false); - - if (plus <= nan) - assert(false); - if (plus >= nan) - assert(false); - if (minus <= nan) - assert(false); - if (minus >= nan) - assert(false); - if (nan >= plus) - assert(false); - if (nan <= plus) - assert(false); - - if (nan == nan) - assert(false); - } - - static void testDoubleCompare(double minus, double plus, double plus2, - double nan) { - - System.out.println("IntMath.testDoubleCompare"); - if (minus > plus) - assert(false); - if (plus < minus) - assert(false); - if (plus == minus) - assert(false); - if (plus != plus2) - assert(false); - - if (plus <= nan) - assert(false); - if (plus >= nan) - assert(false); - if (minus <= nan) - assert(false); - if (minus >= nan) - assert(false); - if (nan >= plus) - assert(false); - if (nan <= plus) - assert(false); - - if (nan == nan) - assert(false); - } - - public static void run() { - testIntCompare(-5, 4, 4, 0); - testLongCompare(-5L, -4294967287L, 4L, 8L); - - testFloatCompare(-5.0f, 4.0f, 4.0f, (1.0f/0.0f) / (1.0f/0.0f)); - testDoubleCompare(-5.0, 4.0, 4.0, (1.0/0.0) / (1.0/0.0)); - } -} diff --git a/tests/003-omnibus-opcodes/src/FloatMath.java b/tests/003-omnibus-opcodes/src/FloatMath.java deleted file mode 100644 index 3c4940209..000000000 --- a/tests/003-omnibus-opcodes/src/FloatMath.java +++ /dev/null @@ -1,337 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Test arithmetic operations. - */ -public class FloatMath { - - static void convTest() { - System.out.println("FloatMath.convTest"); - - float f; - double d; - int i; - long l; - - /* float --> int */ - f = 1234.5678f; - i = (int) f; - assert(i == 1234); - - f = -1234.5678f; - i = (int) f; - assert(i == -1234); - - /* float --> long */ - f = 1238.5678f; - l = (long) f; - assert(l == 1238); - - f = -1238.5678f; - l = (long) f; - assert(l == -1238); - - /* float --> double */ - f = 1238.5678f; - d = (double) f; - assert(d > 1238.567 && d < 1238.568); - - /* double --> int */ - d = 1234.5678; - i = (int) d; - assert(i == 1234); - - d = -1234.5678; - i = (int) d; - assert(i == -1234); - - /* double --> long */ - d = 5678956789.0123; - l = (long) d; - assert(l == 5678956789L); - - d = -5678956789.0123; - l = (long) d; - assert(l == -5678956789L); - - /* double --> float */ - d = 1238.5678; - f = (float) d; - assert(f > 1238.567 && f < 1238.568); - - /* int --> long */ - i = 7654; - l = (long) i; - assert(l == 7654L); - - i = -7654; - l = (long) i; - assert(l == -7654L); - - /* int --> float */ - i = 1234; - f = (float) i; - assert(f > 1233.9f && f < 1234.1f); - - i = -1234; - f = (float) i; - assert(f < -1233.9f && f > -1234.1f); - - /* int --> double */ - i = 1238; - d = (double) i; - assert(d > 1237.9f && d < 1238.1f); - - i = -1238; - d = (double) i; - assert(d < -1237.9f && d > -1238.1f); - - /* long --> int (with truncation) */ - l = 5678956789L; - i = (int) l; - assert(i == 1383989493); - - l = -5678956789L; - i = (int) l; - assert(i == -1383989493); - - /* long --> float */ - l = 5678956789L; - f = (float) l; - assert(f > 5.6789564E9 && f < 5.6789566E9); - - l = -5678956789L; - f = (float) l; - assert(f < -5.6789564E9 && f > -5.6789566E9); - - /* long --> double */ - l = 6678956789L; - d = (double) l; - assert(d > 6.6789567E9 && d < 6.6789568E9); - - l = -6678956789L; - d = (double) l; - assert(d < -6.6789567E9 && d > -6.6789568E9); - } - - /* - * We pass in the arguments and return the results so the compiler - * doesn't do the math for us. - */ - static float[] floatOperTest(float x, float y) { - System.out.println("FloatMath.floatOperTest"); - - float[] results = new float[9]; - - /* this seems to generate "op-float" instructions */ - results[0] = x + y; - results[1] = x - y; - results[2] = x * y; - results[3] = x / y; - results[4] = x % -y; - - /* this seems to generate "op-float/2addr" instructions */ - results[8] = x + (((((x + y) - y) * y) / y) % y); - - return results; - } - static void floatOperCheck(float[] results) { - assert(results[0] > 69996.99f && results[0] < 69997.01f); - assert(results[1] > 70002.99f && results[1] < 70003.01f); - assert(results[2] > -210000.01f && results[2] < -209999.99f); - assert(results[3] > -23333.34f && results[3] < -23333.32f); - assert(results[4] > 0.999f && results[4] < 1.001f); - assert(results[8] > 70000.99f && results[8] < 70001.01f); - } - - /* - * We pass in the arguments and return the results so the compiler - * doesn't do the math for us. - */ - static double[] doubleOperTest(double x, double y) { - System.out.println("FloatMath.doubleOperTest"); - - double[] results = new double[9]; - - /* this seems to generate "op-double" instructions */ - results[0] = x + y; - results[1] = x - y; - results[2] = x * y; - results[3] = x / y; - results[4] = x % -y; - - /* this seems to generate "op-double/2addr" instructions */ - results[8] = x + (((((x + y) - y) * y) / y) % y); - - return results; - } - static void doubleOperCheck(double[] results) { - assert(results[0] > 69996.99 && results[0] < 69997.01); - assert(results[1] > 70002.99 && results[1] < 70003.01); - assert(results[2] > -210000.01 && results[2] < -209999.99); - assert(results[3] > -23333.34 && results[3] < -23333.32); - assert(results[4] > 0.999 && results[4] < 1.001); - assert(results[8] > 70000.99 && results[8] < 70001.01); - } - - /* - * Try to cause some unary operations. - */ - static float unopTest(float f) { - f = -f; - return f; - } - - static int[] convI(long l, float f, double d, float zero) { - int[] results = new int[6]; - results[0] = (int) l; - results[1] = (int) f; - results[2] = (int) d; - results[3] = (int) (1.0f / zero); // +inf - results[4] = (int) (-1.0f / zero); // -inf - results[5] = (int) ((1.0f / zero) / (1.0f / zero)); // NaN - return results; - } - static void checkConvI(int[] results) { - System.out.println("FloatMath.checkConvI"); - assert(results[0] == 0x44332211); - assert(results[1] == 123); - assert(results[2] == -3); - assert(results[3] == 0x7fffffff); - assert(results[4] == 0x80000000); - assert(results[5] == 0); - } - - static long[] convL(int i, float f, double d, double zero) { - long[] results = new long[6]; - results[0] = (long) i; - results[1] = (long) f; - results[2] = (long) d; - results[3] = (long) (1.0 / zero); // +inf - results[4] = (long) (-1.0 / zero); // -inf - results[5] = (long) ((1.0 / zero) / (1.0 / zero)); // NaN - return results; - } - static void checkConvL(long[] results) { - System.out.println("FloatMath.checkConvL"); - assert(results[0] == 0xFFFFFFFF88776655L); - assert(results[1] == 123); - assert(results[2] == -3); - assert(results[3] == 0x7fffffffffffffffL); - assert(results[4] == 0x8000000000000000L); - assert(results[5] == 0); - } - - static float[] convF(int i, long l, double d) { - float[] results = new float[3]; - results[0] = (float) i; - results[1] = (float) l; - results[2] = (float) d; - return results; - } - static void checkConvF(float[] results) { - System.out.println("FloatMath.checkConvF"); - // TODO: assert values - for (int i = 0; i < results.length; i++) - System.out.println(" " + i + ": " + results[i]); - System.out.println("-2.0054409E9, -8.6133031E18, -3.1415927"); - } - - static double[] convD(int i, long l, float f) { - double[] results = new double[3]; - results[0] = (double) i; - results[1] = (double) l; - results[2] = (double) f; - return results; - } - static void checkConvD(double[] results) { - System.out.println("FloatMath.checkConvD"); - // TODO: assert values - for (int i = 0; i < results.length; i++) - System.out.println(" " + i + ": " + results[i]); - System.out.println("-2.005440939E9, -8.6133032459203287E18, 123.4560012817382"); - } - - static void checkConsts() { - System.out.println("FloatMath.checkConsts"); - - float f = 10.0f; // const/special - assert(f > 9.9 && f < 10.1); - - double d = 10.0; // const-wide/special - assert(d > 9.9 && d < 10.1); - } - - /* - * Determine if two floating point numbers are approximately equal. - * - * (Assumes that floating point is generally working, so we can't use - * this for the first set of tests.) - */ - static boolean approxEqual(float a, float b, float maxDelta) { - if (a > b) - return (a - b) < maxDelta; - else - return (b - a) < maxDelta; - } - static boolean approxEqual(double a, double b, double maxDelta) { - if (a > b) - return (a - b) < maxDelta; - else - return (b - a) < maxDelta; - } - - /* - * Test some java.lang.Math functions. - * - * The method arguments are positive values. - */ - static void jlmTests(float ff, double dd) { - System.out.println("FloatMath.jlmTests"); - - assert(approxEqual(Math.abs(ff), ff, 0.001f)); - assert(approxEqual(Math.abs(-ff), ff, 0.001f)); - assert(approxEqual(Math.min(ff, -5.0f), -5.0f, 0.001f)); - assert(approxEqual(Math.max(ff, -5.0f), ff, 0.001f)); - - assert(approxEqual(Math.abs(dd), dd, 0.001)); - assert(approxEqual(Math.abs(-dd), dd, 0.001)); - assert(approxEqual(Math.min(dd, -5.0), -5.0, 0.001)); - assert(approxEqual(Math.max(dd, -5.0), dd, 0.001)); - - double sq = Math.sqrt(dd); - assert(approxEqual(sq*sq, dd, 0.001)); - - assert(approxEqual(0.5403023058681398, Math.cos(1.0), 0.00000001)); - assert(approxEqual(0.8414709848078965, Math.sin(1.0), 0.00000001)); - } - - public static void run() { - convTest(); - - float[] floatResults; - double[] doubleResults; - int[] intResults; - long[] longResults; - - floatResults = floatOperTest(70000.0f, -3.0f); - floatOperCheck(floatResults); - doubleResults = doubleOperTest(70000.0, -3.0); - doubleOperCheck(doubleResults); - - intResults = convI(0x8877665544332211L, 123.456f, -3.1415926535, 0.0f); - checkConvI(intResults); - longResults = convL(0x88776655, 123.456f, -3.1415926535, 0.0); - checkConvL(longResults); - floatResults = convF(0x88776655, 0x8877665544332211L, -3.1415926535); - checkConvF(floatResults); - doubleResults = convD(0x88776655, 0x8877665544332211L, 123.456f); - checkConvD(doubleResults); - - unopTest(123.456f); - - checkConsts(); - - jlmTests(3.14159f, 123456.78987654321); - } -} diff --git a/tests/003-omnibus-opcodes/src/Goto.java b/tests/003-omnibus-opcodes/src/Goto.java deleted file mode 100644 index d56ceae9d..000000000 --- a/tests/003-omnibus-opcodes/src/Goto.java +++ /dev/null @@ -1,2408 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -/** - * Try to cause some gotos. - */ -class Goto { - static int filler(int i) { - return i+1; - } - - static int smallGoto(boolean which) { - System.out.println("Goto.smallGoto"); - - int i = 0; - - if (which) { - i += filler(i); - } else { - i -= filler(i); - } - - return i; - } - - static int mediumGoto(boolean which) { - System.out.println("Goto.mediumGoto"); - - int i = 0; - - if (which) { - i += filler(i); - } else { - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - } - - return i; - } - - static int bigGoto(boolean which) { - System.out.println("Goto.bigGoto"); - - int i = 0; - - if (which) { - i += filler(i); - } else { - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - i -= filler(i); i -= filler(i); i -= filler(i); i -= filler(i); - } - - return i; - } - - public static void run() { - smallGoto(false); - smallGoto(true); - mediumGoto(false); - mediumGoto(true); - bigGoto(false); - bigGoto(true); - } -}; diff --git a/tests/003-omnibus-opcodes/src/InstField.java b/tests/003-omnibus-opcodes/src/InstField.java deleted file mode 100644 index 80b95abb9..000000000 --- a/tests/003-omnibus-opcodes/src/InstField.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -public class InstField { - public boolean mBoolean1, mBoolean2; - public byte mByte1, mByte2; - public char mChar1, mChar2; - public short mShort1, mShort2; - public int mInt1, mInt2; - public float mFloat1, mFloat2; - public long mLong1, mLong2; - public double mDouble1, mDouble2; - public volatile long mVolatileLong1, mVolatileLong2; - - public void run() { - assignFields(); - checkFields(); - InstField.nullCheck(null); - } - - /* - * Check access to instance fields through a null pointer. - */ - static public void nullCheck(InstField nully) { - System.out.println("InstField.nullCheck"); - try { - int x = nully.mInt1; - assert(false); - } catch (NullPointerException npe) { - // good - } - try { - long l = nully.mLong1; - assert(false); - } catch (NullPointerException npe) { - // good - } - try { - nully.mInt1 = 5; - assert(false); - } catch (NullPointerException npe) { - // good - } - try { - nully.mLong1 = 17L; - assert(false); - } catch (NullPointerException npe) { - // good - } - } - - public void assignFields() { - System.out.println("InstField assign..."); - mBoolean1 = true; - mBoolean2 = false; - mByte1 = 127; - mByte2 = -128; - mChar1 = 32767; - mChar2 = 65535; - mShort1 = 32767; - mShort2 = -32768; - mInt1 = 65537; - mInt2 = -65537; - mFloat1 = 3.1415f; - mFloat2 = -1.0f / 0.0f; // -inf - mLong1 = 1234605616436508552L; // 0x1122334455667788 - mLong2 = -1234605616436508552L; - mDouble1 = 3.1415926535; - mDouble2 = 1.0 / 0.0; // +inf - mVolatileLong1 = mLong1 - 1; - mVolatileLong2 = mLong2 + 1; - } - - public void checkFields() { - System.out.println("InstField check..."); - assert(mBoolean1); - assert(!mBoolean2); - assert(mByte1 == 127); - assert(mByte2 == -128); - assert(mChar1 == 32767); - assert(mChar2 == 65535); - assert(mShort1 == 32767); - assert(mShort2 == -32768); - assert(mInt1 == 65537); - assert(mInt2 == -65537); - assert(mFloat1 > 3.141f && mFloat1 < 3.142f); - assert(mFloat2 < mFloat1); - assert(mLong1 == 1234605616436508552L); - assert(mLong2 == -1234605616436508552L); - assert(mDouble1 > 3.141592653 && mDouble1 < 3.141592654); - assert(mDouble2 > mDouble1); - assert(mVolatileLong1 == 1234605616436508551L); - assert(mVolatileLong2 == -1234605616436508551L); - } -} diff --git a/tests/003-omnibus-opcodes/src/IntMath.java b/tests/003-omnibus-opcodes/src/IntMath.java deleted file mode 100644 index 89194de90..000000000 --- a/tests/003-omnibus-opcodes/src/IntMath.java +++ /dev/null @@ -1,492 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Test arithmetic operations. - */ -public class IntMath { - - static void shiftTest1() { - System.out.println("IntMath.shiftTest1"); - - final int[] mBytes = { - 0x11, 0x22, 0x33, 0x44, 0x88, 0x99, 0xaa, 0xbb - }; - long l; - int i1, i2; - - i1 = mBytes[0] | mBytes[1] << 8 | mBytes[2] << 16 | mBytes[3] << 24; - i2 = mBytes[4] | mBytes[5] << 8 | mBytes[6] << 16 | mBytes[7] << 24; - l = i1 | ((long)i2 << 32); - - assert(i1 == 0x44332211); - assert(i2 == 0xbbaa9988); - assert(l == 0xbbaa998844332211L); - - l = (long)mBytes[0] - | (long)mBytes[1] << 8 - | (long)mBytes[2] << 16 - | (long)mBytes[3] << 24 - | (long)mBytes[4] << 32 - | (long)mBytes[5] << 40 - | (long)mBytes[6] << 48 - | (long)mBytes[7] << 56; - - assert(l == 0xbbaa998844332211L); - } - - static void shiftTest2() { - System.out.println("IntMath.shiftTest2"); - - long a = 0x11; - long b = 0x22; - long c = 0x33; - long d = 0x44; - long e = 0x55; - long f = 0x66; - long g = 0x77; - long h = 0x88; - - long result = ((a << 56) | (b << 48) | (c << 40) | (d << 32) | - (e << 24) | (f << 16) | (g << 8) | h); - - assert(result == 0x1122334455667788L); - } - - static void unsignedShiftTest() { - System.out.println("IntMath.unsignedShiftTest"); - - byte b = -4; - short s = -4; - char c = 0xfffc; - int i = -4; - - b >>>= 4; - s >>>= 4; - c >>>= 4; - i >>>= 4; - - assert((int) b == -1); - assert((int) s == -1); - assert((int) c == 0x0fff); - assert(i == 268435455); - } - - static void convTest() { - System.out.println("IntMath.convTest"); - - float f; - double d; - int i; - long l; - - /* int --> long */ - i = 7654; - l = (long) i; - assert(l == 7654L); - - i = -7654; - l = (long) i; - assert(l == -7654L); - - /* long --> int (with truncation) */ - l = 5678956789L; - i = (int) l; - assert(i == 1383989493); - - l = -5678956789L; - i = (int) l; - assert(i == -1383989493); - } - - static void charSubTest() { - System.out.println("IntMath.charSubTest"); - - char char1 = 0x00e9; - char char2 = 0xffff; - int i; - - /* chars are unsigned-expanded to ints before subtraction */ - i = char1 - char2; - assert(i == 0xffff00ea); - } - - /* - * We pass in the arguments and return the results so the compiler - * doesn't do the math for us. (x=70000, y=-3) - */ - static int[] intOperTest(int x, int y) { - System.out.println("IntMath.intOperTest"); - - int[] results = new int[10]; - - /* this seems to generate "op-int" instructions */ - results[0] = x + y; - results[1] = x - y; - results[2] = x * y; - results[3] = x * x; - results[4] = x / y; - results[5] = x % -y; - results[6] = x & y; - results[7] = x | y; - results[8] = x ^ y; - - /* this seems to generate "op-int/2addr" instructions */ - results[9] = x + ((((((((x + y) - y) * y) / y) % y) & y) | y) ^ y); - - return results; - } - static void intOperCheck(int[] results) { - System.out.println("IntMath.intOperCheck"); - - /* check this edge case while we're here (div-int/2addr) */ - int minInt = -2147483648; - int negOne = -results[5]; - int plusOne = 1; - int result = (((minInt + plusOne) - plusOne) / negOne) / negOne; - assert(result == minInt); - - assert(results[0] == 69997); - assert(results[1] == 70003); - assert(results[2] == -210000); - assert(results[3] == 605032704); // overflow / truncate - assert(results[4] == -23333); - assert(results[5] == 1); - assert(results[6] == 70000); - assert(results[7] == -3); - assert(results[8] == -70003); - assert(results[9] == 70000); - } - - /* - * More operations, this time with 16-bit constants. (x=77777) - */ - static int[] lit16Test(int x) { - System.out.println("IntMath.lit16Test"); - - int[] results = new int[8]; - - /* try to generate op-int/lit16" instructions */ - results[0] = x + 1000; - results[1] = 1000 - x; - results[2] = x * 1000; - results[3] = x / 1000; - results[4] = x % 1000; - results[5] = x & 1000; - results[6] = x | -1000; - results[7] = x ^ -1000; - return results; - } - static void lit16Check(int[] results) { - assert(results[0] == 78777); - assert(results[1] == -76777); - assert(results[2] == 77777000); - assert(results[3] == 77); - assert(results[4] == 777); - assert(results[5] == 960); - assert(results[6] == -39); - assert(results[7] == -76855); - } - - /* - * More operations, this time with 8-bit constants. (x=-55555) - */ - static int[] lit8Test(int x) { - System.out.println("IntMath.lit8Test"); - - int[] results = new int[8]; - - /* try to generate op-int/lit8" instructions */ - results[0] = x + 10; - results[1] = 10 - x; - results[2] = x * 10; - results[3] = x / 10; - results[4] = x % 10; - results[5] = x & 10; - results[6] = x | -10; - results[7] = x ^ -10; - return results; - } - static void lit8Check(int[] results) { - //for (int i = 0; i < results.length; i++) - // System.out.println(" " + i + ": " + results[i]); - - /* check this edge case while we're here (div-int/lit8) */ - int minInt = -2147483648; - int result = minInt / -1; - assert(result == minInt); - - assert(results[0] == -55545); - assert(results[1] == 55565); - assert(results[2] == -555550); - assert(results[3] == -5555); - assert(results[4] == -5); - assert(results[5] == 8); - assert(results[6] == -1); - assert(results[7] == 55563); - } - - - /* - * Shift some data. (value=0xff00aa01, dist=8) - */ - static int[] intShiftTest(int value, int dist) { - System.out.println("IntMath.intShiftTest"); - - int results[] = new int[4]; - - results[0] = value << dist; - results[1] = value >> dist; - results[2] = value >>> dist; - - results[3] = (((value << dist) >> dist) >>> dist) << dist; - return results; - } - static void intShiftCheck(int[] results) { - System.out.println("IntMath.intShiftCheck"); - - assert(results[0] == 0x00aa0100); - assert(results[1] == 0xffff00aa); - assert(results[2] == 0x00ff00aa); - assert(results[3] == 0xaa00); - } - - /* - * We pass in the arguments and return the results so the compiler - * doesn't do the math for us. (x=70000000000, y=-3) - */ - static long[] longOperTest(long x, long y) { - System.out.println("IntMath.longOperTest"); - - long[] results = new long[10]; - - /* this seems to generate "op-long" instructions */ - results[0] = x + y; - results[1] = x - y; - results[2] = x * y; - results[3] = x * x; - results[4] = x / y; - results[5] = x % -y; - results[6] = x & y; - results[7] = x | y; - results[8] = x ^ y; - - /* this seems to generate "op-long/2addr" instructions */ - results[9] = x + ((((((((x + y) - y) * y) / y) % y) & y) | y) ^ y); - - return results; - } - static void longOperCheck(long[] results) { - System.out.println("IntMath.longOperCheck"); - - /* check this edge case while we're here (div-long/2addr) */ - long minLong = -9223372036854775808L; - long negOne = -results[5]; - long plusOne = 1; - long result = (((minLong + plusOne) - plusOne) / negOne) / negOne; - assert(result == minLong); - - assert(results[0] == 69999999997L); - assert(results[1] == 70000000003L); - assert(results[2] == -210000000000L); - assert(results[3] == -6833923606740729856L); // overflow - assert(results[4] == -23333333333L); - assert(results[5] == 1); - assert(results[6] == 70000000000L); - assert(results[7] == -3); - assert(results[8] == -70000000003L); - assert(results[9] == 70000000000L); - - assert(results.length == 10); - } - - /* - * Shift some data. (value=0xd5aa96deff00aa01, dist=8) - */ - static long[] longShiftTest(long value, int dist) { - System.out.println("IntMath.longShiftTest"); - - long results[] = new long[4]; - - results[0] = value << dist; - results[1] = value >> dist; - results[2] = value >>> dist; - - results[3] = (((value << dist) >> dist) >>> dist) << dist; - return results; - } - static long longShiftCheck(long[] results) { - System.out.println("IntMath.longShiftCheck"); - - assert(results[0] == 0x96deff00aa010000L); - assert(results[1] == 0xffffd5aa96deff00L); - assert(results[2] == 0x0000d5aa96deff00L); - assert(results[3] == 0xffff96deff000000L); - - assert(results.length == 4); - - return results[0]; // test return-long - } - - - /* - * Try to cause some unary operations. - */ - static int unopTest(int x) { - x = -x; - x ^= 0xffffffff; - return x; - } - static void unopCheck(int result) { - assert(result == 37); - } - - static class Shorty { - public short mShort; - public char mChar; - public byte mByte; - }; - - /* - * Truncate an int. - */ - static Shorty truncateTest(int x) { - System.out.println("IntMath.truncateTest"); - Shorty shorts = new Shorty(); - - shorts.mShort = (short) x; - shorts.mChar = (char) x; - shorts.mByte = (byte) x; - return shorts; - } - static void truncateCheck(Shorty shorts) { - assert(shorts.mShort == -5597); // 0xea23 - assert(shorts.mChar == 59939); // 0xea23 - assert(shorts.mByte == 35); // 0x23 - } - - /* - * Verify that we get a divide-by-zero exception. - */ - static void divideByZero(int z) { - System.out.println("IntMath.divideByZero"); - - try { - int x = 100 / z; - assert(false); - } catch (ArithmeticException ae) { - } - - try { - int x = 100 % z; - assert(false); - } catch (ArithmeticException ae) { - } - - try { - long x = 100L / z; - assert(false); - } catch (ArithmeticException ae) { - } - - try { - long x = 100L % z; - assert(false); - } catch (ArithmeticException ae) { - } - } - - /* - * Check an edge condition: dividing the most-negative integer by -1 - * returns the most-negative integer, and doesn't cause an exception. - * - * Pass in -1, -1L. - */ - static void bigDivideOverflow(int idiv, long ldiv) { - System.out.println("IntMath.bigDivideOverflow"); - int mostNegInt = (int) 0x80000000; - long mostNegLong = (long) 0x8000000000000000L; - - int intDivResult = mostNegInt / idiv; - int intModResult = mostNegInt % idiv; - long longDivResult = mostNegLong / ldiv; - long longModResult = mostNegLong % ldiv; - - assert(intDivResult == mostNegInt); - assert(intModResult == 0); - assert(longDivResult == mostNegLong); - assert(longModResult == 0); - } - - /* - * Check "const" instructions. We use negative values to ensure that - * sign-extension is happening. - */ - static void checkConsts(byte small, short medium, int large, long huge) { - System.out.println("IntMath.checkConsts"); - - assert(small == 1); // const/4 - assert(medium == -256); // const/16 - assert(medium == -256L); // const-wide/16 - assert(large == -88888); // const - assert(large == -88888L); // const-wide/32 - assert(huge == 0x9922334455667788L); // const-wide - } - - /* - * Test some java.lang.Math functions. - * - * The method arguments are positive values. - */ - static void jlmTests(int ii, long ll) { - System.out.println("IntMath.jlmTests"); - - assert(Math.abs(ii) == ii); - assert(Math.abs(-ii) == ii); - assert(Math.min(ii, -5) == -5); - assert(Math.max(ii, -5) == ii); - - assert(Math.abs(ll) == ll); - assert(Math.abs(-ll) == ll); - assert(Math.min(ll, -5L) == -5L); - assert(Math.max(ll, -5L) == ll); - } - - public static void run() { - shiftTest1(); - shiftTest2(); - unsignedShiftTest(); - convTest(); - charSubTest(); - - int[] intResults; - long[] longResults; - - intResults = intOperTest(70000, -3); - intOperCheck(intResults); - longResults = longOperTest(70000000000L, -3L); - longOperCheck(longResults); - - intResults = lit16Test(77777); - lit16Check(intResults); - intResults = lit8Test(-55555); - lit8Check(intResults); - - intResults = intShiftTest(0xff00aa01, 8); - intShiftCheck(intResults); - longResults = longShiftTest(0xd5aa96deff00aa01L, 16); - long longRet = longShiftCheck(longResults); - assert(longRet == 0x96deff00aa010000L); - - Shorty shorts = truncateTest(-16717277); // 0xff00ea23 - truncateCheck(shorts); - - divideByZero(0); - bigDivideOverflow(-1, -1L); - - checkConsts((byte) 1, (short) -256, -88888, 0x9922334455667788L); - - unopCheck(unopTest(38)); - - jlmTests(12345, 0x1122334455667788L); - } -} diff --git a/tests/003-omnibus-opcodes/src/InternedString.java b/tests/003-omnibus-opcodes/src/InternedString.java deleted file mode 100644 index 4baab0c38..000000000 --- a/tests/003-omnibus-opcodes/src/InternedString.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2008 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.ref.*; - -public class InternedString { - public static final String CONST = "Class InternedString"; - - public static void run() { - System.out.println("InternedString.run"); - testImmortalInternedString(); - testDeadInternedString(); - } - - private static void testDeadInternedString() { - String s = "blah"; - s = s + s; - WeakReference strRef = new WeakReference<String>(s.intern()); - // Kill s, otherwise the string object is still accessible from root set - s = CONST; - System.gc(); - // "blahblah" should disappear from the intern list - assert(strRef.get() == null); - } - - private static void testImmortalInternedString() { - WeakReference strRef = new WeakReference<String>(CONST.intern()); - System.gc(); - // Class constant string should be entered to the interned table when - // loaded - assert(CONST == CONST.intern()); - // and it should survive the gc - assert(strRef.get() != null); - - String s = CONST; - // "Class InternedString" should remain on the intern list - strRef = new WeakReference<String>(s.intern()); - // Kill s, otherwise the string object is still accessible from root set - s = ""; - System.gc(); - assert(strRef.get() == CONST); - } -} diff --git a/tests/003-omnibus-opcodes/src/Main.java b/tests/003-omnibus-opcodes/src/Main.java deleted file mode 100644 index fb39d76d7..000000000 --- a/tests/003-omnibus-opcodes/src/Main.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -/** - * Dalvik instruction exerciser. - */ -public class Main { - /* - * Start up. - */ - public static void main(String[] args) { - boolean assertEnabled = false; - assert assertEnabled = true; - if (!assertEnabled) { - System.out.println("FAIL: assert doesn't work (specify '-ea')\n"); - throw new RuntimeException(); - } else { - System.out.println("(assertions are enabled)"); - } - - Main main = new Main(); - main.run(); - - /* run through the heap to see if we trashed something */ - System.gc(); - - System.out.println("Done!"); - } - - public void run() { - InstField instField = new InstField(); - instField.run(); - - StaticField.run(); - - IntMath.run(); - FloatMath.run(); - Compare.run(); - - Monitor.run(); - Switch.run(); - Array.run(); - Classes.run(); - Goto.run(); - MethodCall.run(); - Throw.run(); - - try { - UnresTest1.run(); - } catch (VerifyError ve) { - System.out.println("Caught: " + ve); - } - try { - UnresTest1.run(); - } catch (VerifyError ve) { - System.out.println("Caught (retry): " + ve); - } - - try { - UnresTest2.run(); - } catch (VerifyError ve) { - System.out.println("Caught: " + ve); - } catch (NoClassDefFoundError ncdfe) { - /* UnresClass can cause desktop Java to freak out */ - System.out.println("NOTE: UnresTest2 not available"); - } - InternedString.run(); - } -} diff --git a/tests/003-omnibus-opcodes/src/MethodCall.java b/tests/003-omnibus-opcodes/src/MethodCall.java deleted file mode 100644 index f89194b05..000000000 --- a/tests/003-omnibus-opcodes/src/MethodCall.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -/** - * Try different kinds of method calls. - */ -public class MethodCall extends MethodCallBase { - MethodCall() { - super(); - System.out.println(" MethodCall ctor"); - } - - /* overridden method */ - int tryThing() { - int val = super.tryThing(); - assert(val == 7); - return val; - } - - /* do-nothing private instance method */ - private void directly() {} - - /* - * Function with many arguments. - */ - static void manyArgs(int a0, long a1, int a2, long a3, int a4, long a5, - int a6, int a7, double a8, float a9, double a10, short a11, int a12, - char a13, int a14, int a15, byte a16, boolean a17, int a18, int a19, - long a20, long a21, int a22, int a23, int a24, int a25, int a26, - String[][] a27, String[] a28, String a29) - { - System.out.println("MethodCalls.manyArgs"); - assert(a0 == 0); - assert(a9 > 8.99 && a9 < 9.01); - assert(a16 == -16); - assert(a25 == 25); - assert(a29.equals("twenty nine")); - } - - public static void run() { - MethodCall inst = new MethodCall(); - - MethodCallBase base = inst; - base.tryThing(); - inst.tryThing(); - - inst = null; - try { - inst.directly(); - assert(false); - } catch (NullPointerException npe) { - // good - } - - manyArgs(0, 1L, 2, 3L, 4, 5L, 6, 7, 8.0, 9.0f, 10.0, (short)11, 12, - (char)13, 14, 15, (byte)-16, true, 18, 19, 20L, 21L, 22, 23, 24, - 25, 26, null, null, "twenty nine"); - } -} - -class MethodCallBase { - MethodCallBase() { - System.out.println(" MethodCallBase ctor"); - } - - int tryThing() { - return 7; - } -} diff --git a/tests/003-omnibus-opcodes/src/Monitor.java b/tests/003-omnibus-opcodes/src/Monitor.java deleted file mode 100644 index 66d7c6595..000000000 --- a/tests/003-omnibus-opcodes/src/Monitor.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2008 The Android Open Source Project - - - -/** - * Exercise monitors. - */ -public class Monitor { - public static int mVal = 0; - - public synchronized void subTest() { - Object obj = new Object(); - synchronized (obj) { - mVal++; - obj = null; // does NOT cause a failure on exit - assert(obj == null); - } - } - - - public static void run() { - System.out.println("Monitor.run"); - - Object obj = null; - - try { - synchronized (obj) { - mVal++; - } - assert(false); - } catch (NullPointerException npe) { - /* expected */ - } - - obj = new Object(); - synchronized (obj) { - mVal++; - } - - new Monitor().subTest(); - - assert(mVal == 2); - } -} diff --git a/tests/003-omnibus-opcodes/src/StaticField.java b/tests/003-omnibus-opcodes/src/StaticField.java deleted file mode 100644 index 7ccdd7eb4..000000000 --- a/tests/003-omnibus-opcodes/src/StaticField.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -public class StaticField { - public static boolean mBoolean1, mBoolean2; - public static byte mByte1, mByte2; - public static char mChar1, mChar2; - public static short mShort1, mShort2; - public static int mInt1, mInt2; - public static float mFloat1, mFloat2; - public static long mLong1, mLong2; - public static double mDouble1, mDouble2; - public static volatile long mVolatileLong1, mVolatileLong2; - - public static void run() { - assignFields(); - checkFields(); - } - - public static void assignFields() { - System.out.println("StaticField assign..."); - mBoolean1 = true; - mBoolean2 = false; - mByte1 = 127; - mByte2 = -128; - mChar1 = 32767; - mChar2 = 65535; - mShort1 = 32767; - mShort2 = -32768; - mInt1 = 65537; - mInt2 = -65537; - mFloat1 = 3.1415f; - mFloat2 = -1.0f / 0.0f; // -inf - mLong1 = 1234605616436508552L; // 0x1122334455667788 - mLong2 = -1234605616436508552L; - mDouble1 = 3.1415926535; - mDouble2 = 1.0 / 0.0; // +inf - mVolatileLong1 = mLong1 - 1; - mVolatileLong2 = mLong2 + 1; - } - - public static void checkFields() { - System.out.println("StaticField check..."); - assert(mBoolean1); - assert(!mBoolean2); - assert(mByte1 == 127); - assert(mByte2 == -128); - assert(mChar1 == 32767); - assert(mChar2 == 65535); - assert(mShort1 == 32767); - assert(mShort2 == -32768); - assert(mInt1 == 65537); - assert(mInt2 == -65537); - assert(mFloat1 > 3.141f && mFloat2 < 3.142f); - assert(mFloat2 < mFloat1); - assert(mLong1 == 1234605616436508552L); - assert(mLong2 == -1234605616436508552L); - assert(mDouble1 > 3.141592653 && mDouble1 < 3.141592654); - assert(mDouble2 > mDouble1); - assert(mVolatileLong1 == 1234605616436508551L); - assert(mVolatileLong2 == -1234605616436508551L); - } -} diff --git a/tests/003-omnibus-opcodes/src/Switch.java b/tests/003-omnibus-opcodes/src/Switch.java deleted file mode 100644 index 67c82b0df..000000000 --- a/tests/003-omnibus-opcodes/src/Switch.java +++ /dev/null @@ -1,62 +0,0 @@ -public class Switch { - /** - * Test switch() blocks - */ - private static void testSwitch() { - System.out.println("Switch.testSwitch"); - - int a = 1; - - switch (a) { - case -1: assert(false); break; - case 0: assert(false); break; - case 1: /*correct*/ break; - case 2: assert(false); break; - case 3: assert(false); break; - case 4: assert(false); break; - default: assert(false); break; - } - switch (a) { - case 3: assert(false); break; - case 4: assert(false); break; - default: /*correct*/ break; - } - - a = 0x12345678; - - switch (a) { - case 0x12345678: /*correct*/ break; - case 0x12345679: assert(false); break; - default: assert(false); break; - } - switch (a) { - case 57: assert(false); break; - case -6: assert(false); break; - case 0x12345678: /*correct*/ break; - case 22: assert(false); break; - case 3: assert(false); break; - default: assert(false); break; - } - switch (a) { - case -6: assert(false); break; - case 3: assert(false); break; - default: /*correct*/ break; - } - - a = -5; - switch (a) { - case 12: assert(false); break; - case -5: /*correct*/ break; - case 0: assert(false); break; - default: assert(false); break; - } - - switch (a) { - default: /*correct*/ break; - } - } - - public static void run() { - testSwitch(); - } -} diff --git a/tests/003-omnibus-opcodes/src/Throw.java b/tests/003-omnibus-opcodes/src/Throw.java deleted file mode 100644 index 91ee6ddcd..000000000 --- a/tests/003-omnibus-opcodes/src/Throw.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -/** - * Test exception throwing. - */ -public class Throw { - public void throwNullPointerException() { - throw new NullPointerException("npe!"); - } - - public void throwArithmeticException() { - throw new ArithmeticException(); - } - - public void one() { - System.out.println("Throw.one"); - try { - throwNullPointerException(); - assert(false); - } catch (Exception ex) { - // good - return; - } - - assert(false); - } - - public void twoA() { - System.out.println("Throw.twoA"); - boolean gotN = false; - boolean gotA = false; - boolean gotWeird = false; - - try { - try { - throwArithmeticException(); - gotWeird = true; - } catch (ArithmeticException ae) { - gotA = true; - } - } catch (NullPointerException npe) { - gotN = true; - } - - assert(gotA); - assert(!gotN); - assert(!gotWeird); - } - - public void twoN() { - System.out.println("Throw.twoN"); - boolean gotN = false; - boolean gotA = false; - boolean gotWeird = false; - - try { - try { - throwNullPointerException(); - gotWeird = true; - } catch (ArithmeticException ae) { - gotA = true; - } - } catch (NullPointerException npe) { - gotN = true; - } - - assert(!gotA); - assert(gotN); - assert(!gotWeird); - } - - public void rethrow() { - System.out.println("Throw.rethrow"); - boolean caught = false; - boolean lly = false; - boolean second = false; - - try { - try { - throwNullPointerException(); - assert(false); - } catch (Exception ex) { - if (ex instanceof ArithmeticException) { - assert(false); - } - if (ex instanceof NullPointerException) { - caught = true; - throw (NullPointerException) ex; - } - } finally { - lly = true; - } - } catch (Exception ex) { - second = true; - } - - assert(caught); - assert(lly); - assert(second); - } - - public static void run() { - Throw th = new Throw(); - - th.one(); - th.twoA(); - th.twoN(); - th.rethrow(); - } -} diff --git a/tests/003-omnibus-opcodes/src/UnresClass.java b/tests/003-omnibus-opcodes/src/UnresClass.java deleted file mode 100644 index 52b3d4fa4..000000000 --- a/tests/003-omnibus-opcodes/src/UnresClass.java +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Unresolved class. - * - * "happy" version. - */ - -public class UnresClass { - int foo; -} diff --git a/tests/003-omnibus-opcodes/src/UnresStuff.java b/tests/003-omnibus-opcodes/src/UnresStuff.java deleted file mode 100644 index 1d2a55638..000000000 --- a/tests/003-omnibus-opcodes/src/UnresStuff.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Unresolved classes / fields / methods in a resolved class. - * - * "happy" version. - */ - -public class UnresStuff { - public int instField; - - public static int staticField; - - public double wideInstField; - public static double wideStaticField; - - public void virtualMethod() { - System.out.println("unres!"); - } - - public static void staticMethod() { - System.out.println("unres!"); - } -} diff --git a/tests/003-omnibus-opcodes/src/UnresTest1.java b/tests/003-omnibus-opcodes/src/UnresTest1.java deleted file mode 100644 index 5a80a7a83..000000000 --- a/tests/003-omnibus-opcodes/src/UnresTest1.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Test failure to resolve class members. - */ -class UnresTest1 { - public static void run() { - System.out.println("UnresTest1..."); - - UnresStuff stuff = new UnresStuff(); - try { - int x = stuff.instField; - assert(false); - } catch (NoSuchFieldError nsfe) { - // good - } - try { // hit the same one a second time - int x = stuff.instField; - assert(false); - } catch (NoSuchFieldError nsfe) { - // good - } - try { - stuff.instField = 5; - assert(false); - } catch (NoSuchFieldError nsfe) { - // good - } - - try { - double d = stuff.wideInstField; - assert(false); - } catch (NoSuchFieldError nsfe) { - // good - } - try { - stuff.wideInstField = 0.0; - assert(false); - } catch (NoSuchFieldError nsfe) { - // good - } - - try { - int y = UnresStuff.staticField; - assert(false); - } catch (NoSuchFieldError nsfe) { - // good - } - try { - UnresStuff.staticField = 17; - assert(false); - } catch (NoSuchFieldError nsfe) { - // good - } - - try { - double d = UnresStuff.wideStaticField; - assert(false); - } catch (NoSuchFieldError nsfe) { - // good - } - try { - UnresStuff.wideStaticField = 1.0; - assert(false); - } catch (NoSuchFieldError nsfe) { - // good - } - - try { - stuff.virtualMethod(); - assert(false); - } catch (NoSuchMethodError nsfe) { - // good - } - try { - UnresStuff.staticMethod(); - assert(false); - } catch (NoSuchMethodError nsfe) { - // good - } - } -} diff --git a/tests/003-omnibus-opcodes/src/UnresTest2.java b/tests/003-omnibus-opcodes/src/UnresTest2.java deleted file mode 100644 index 768be8f56..000000000 --- a/tests/003-omnibus-opcodes/src/UnresTest2.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Test failure to resolve classes. - */ -class UnresTest2 { - /* - * Try check-cast and instance-of. - */ - static boolean checkCasts(Object obj) { - boolean foo = false; - - try { - UnresClass un = (UnresClass) obj; - assert(false); - } catch (NoClassDefFoundError ncdfe) { - // good - } - try { - foo = obj instanceof UnresClass; - assert(false); - } catch (NoClassDefFoundError ncdfe) { - // good - } - - return foo; - } - - public static void run() { - System.out.println("UnresTest2..."); - UnresClass un; - UnresStuff stuff = new UnresStuff(); - - try { - un = new UnresClass(); - assert(false); - } catch (NoClassDefFoundError ncdfe) { - // good - } - - try { - UnresClass[] uar = new UnresClass[3]; - assert(false); - } catch (NoClassDefFoundError ncdfe) { - // good - } - - checkCasts(stuff); - System.out.println("UnresTest2 done"); - } -} diff --git a/tests/003-omnibus-opcodes/src2/UnresStuff.java b/tests/003-omnibus-opcodes/src2/UnresStuff.java deleted file mode 100644 index 56f43af53..000000000 --- a/tests/003-omnibus-opcodes/src2/UnresStuff.java +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Unresolved classes / fields / methods in a resolved class. - * - * "happy" version. - */ - -public class UnresStuff { - public int x; -} diff --git a/tests/004-annotations/build b/tests/004-annotations/build deleted file mode 100644 index c147cb26c..000000000 --- a/tests/004-annotations/build +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# -# 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. - -# Stop if something fails. -set -e - -mkdir classes - -# android.test.anno.MissingAnnotation is available at compile time... -${JAVAC} -d classes `find src -name '*.java'` - -# ...but not at run time. -rm classes/android/test/anno/MissingAnnotation.class -dx -JXmx256m --debug --dex --output=test.jar classes diff --git a/tests/004-annotations/expected.txt b/tests/004-annotations/expected.txt deleted file mode 100644 index dc13a9868..000000000 --- a/tests/004-annotations/expected.txt +++ /dev/null @@ -1,103 +0,0 @@ -TestAnnotations... -java.lang.String android.test.anno.TestAnnotations.thing1: @android.test.anno.AnnoArrayField(bb=[], cc=[a, b], dd=[0.987654321], ff=[3.1415927], ii=[], jj=[], ss=[], str=[], zz=[]) -java.lang.String android.test.anno.TestAnnotations.thing2: @android.test.anno.AnnoArrayField(bb=[-1, 0, 1], cc=[Q], dd=[0.3, 0.6, 0.9], ff=[1.1, 1.2, 1.3], ii=[1, 2, 3, 4], jj=[-5, 0, 5], ss=[12, 13, 14, 15, 16, 17], str=[hickory, dickory, dock], zz=[true, false, true]) -mapping is class [Landroid.test.anno.IntToString; - 0='@android.test.anno.IntToString(from=0, to=NORMAL_FOCUS)' - 1='@android.test.anno.IntToString(from=2, to=WEAK_FOCUS)' -present(getFocusType, ExportedProperty): true -present(getFocusType, AnnoSimpleType): false - -AnnoSimpleField true, SimplyNoted false -annotations on TYPE class android.test.anno.SimplyNoted(2): - @android.test.anno.AnnoSimpleType() - interface android.test.anno.AnnoSimpleType - @android.test.anno.AnnoSimpleType2() - interface android.test.anno.AnnoSimpleType2 - - annotations on CTOR android.test.anno.SimplyNoted(): - @android.test.anno.AnnoSimpleConstructor() - interface android.test.anno.AnnoSimpleConstructor - constructor parameter annotations: - annotations on CTOR android.test.anno.SimplyNoted(int): - @android.test.anno.AnnoSimpleConstructor() - interface android.test.anno.AnnoSimpleConstructor - constructor parameter annotations: - @android.test.anno.AnnoSimpleParameter() - interface android.test.anno.AnnoSimpleParameter - annotations on METH public int android.test.anno.SimplyNoted.foo(): - @android.test.anno.AnnoSimpleMethod() - interface android.test.anno.AnnoSimpleMethod - method parameter annotations: - annotations on FIELD public static int android.test.anno.SimplyNoted.mOneFoo: - @android.test.anno.AnnoSimpleField() - interface android.test.anno.AnnoSimpleField - annotations on FIELD public int android.test.anno.SimplyNoted.mFoo: - @android.test.anno.AnnoSimpleField() - interface android.test.anno.AnnoSimpleField - -annotations on TYPE interface android.test.anno.INoted(1): - @android.test.anno.AnnoSimpleType2() - interface android.test.anno.AnnoSimpleType2 - - annotations on METH public abstract int android.test.anno.INoted.bar(): - @android.test.anno.AnnoSimpleMethod() - interface android.test.anno.AnnoSimpleMethod - method parameter annotations: - -annotations on TYPE class android.test.anno.SubNoted(3): - @android.test.anno.AnnoFancyType(name=unknown, num=5) - interface android.test.anno.AnnoFancyType - @android.test.anno.AnnoSimpleType() - interface android.test.anno.AnnoSimpleType - @android.test.anno.AnnoSimpleType2() - interface android.test.anno.AnnoSimpleType2 - - annotations on CTOR public android.test.anno.SubNoted(): - constructor parameter annotations: - annotations on METH public int android.test.anno.SubNoted.bar(): - method parameter annotations: - annotations on FIELD int android.test.anno.SubNoted.mBar: - -annotations on TYPE class android.test.anno.FullyNoted(1): - @android.test.anno.AnnoFancyType(name=full, num=5) - interface android.test.anno.AnnoFancyType - - annotations on CTOR android.test.anno.FullyNoted(int): - @android.test.anno.AnnoFancyConstructor(numArgs=1) - interface android.test.anno.AnnoFancyConstructor - constructor parameter annotations: - @android.test.anno.AnnoFancyParameter(factor=0.5) - interface android.test.anno.AnnoFancyParameter - annotations on METH public int android.test.anno.FullyNoted.bar(int,long) throws java.io.IOException,java.io.EOFException: - @android.test.anno.AnnoFancyMethod(biteMe=false, callMe=true, enumerated=FOO, someClass=class android.test.anno.SomeClass) - interface android.test.anno.AnnoFancyMethod - method parameter annotations: - @android.test.anno.AnnoSimpleParameter() - interface android.test.anno.AnnoSimpleParameter - @android.test.anno.AnnoFancyParameter(factor=3.7879912899761) - interface android.test.anno.AnnoFancyParameter - annotations on METH public int android.test.anno.FullyNoted.bar1(int,long) throws java.io.IOException: - @android.test.anno.AnnoFancyMethod(biteMe=true, callMe=false, enumerated=BAR, someClass=class android.test.anno.SomeClass) - interface android.test.anno.AnnoFancyMethod - method parameter annotations: - @android.test.anno.AnnoSimpleParameter() - interface android.test.anno.AnnoSimpleParameter - @android.test.anno.AnnoFancyParameter(factor=3.7879912899761) - interface android.test.anno.AnnoFancyParameter - annotations on METH public int android.test.anno.FullyNoted.notAnnotated(): - method parameter annotations: - annotations on FIELD int android.test.anno.FullyNoted.mBar: - @android.test.anno.AnnoFancyField(nombre=fubar) - interface android.test.anno.AnnoFancyField - aff: @android.test.anno.AnnoFancyField(nombre=fubar) / class $Proxy13 - --> nombre is 'fubar' - -SimplyNoted.get(AnnoSimpleType) = @android.test.anno.AnnoSimpleType() -SubNoted.get(AnnoSimpleType) = @android.test.anno.AnnoSimpleType() - -Package annotations: - @android.test.anno.AnnoSimplePackage() - interface android.test.anno.AnnoSimplePackage -Package declared annotations: - @android.test.anno.AnnoSimplePackage() - interface android.test.anno.AnnoSimplePackage diff --git a/tests/004-annotations/info.txt b/tests/004-annotations/info.txt deleted file mode 100644 index c8c9280c3..000000000 --- a/tests/004-annotations/info.txt +++ /dev/null @@ -1 +0,0 @@ -Test a bunch of uses of annotations. diff --git a/tests/004-annotations/src/Main.java b/tests/004-annotations/src/Main.java deleted file mode 100644 index e44722fc4..000000000 --- a/tests/004-annotations/src/Main.java +++ /dev/null @@ -1,7 +0,0 @@ -import android.test.anno.TestAnnotations; - -public class Main { - static public void main(String[] args) { - TestAnnotations.main(args); - } -} diff --git a/tests/004-annotations/src/android/test/AnnoSimplePackage1.java b/tests/004-annotations/src/android/test/AnnoSimplePackage1.java deleted file mode 100644 index 629cb7dc0..000000000 --- a/tests/004-annotations/src/android/test/AnnoSimplePackage1.java +++ /dev/null @@ -1,8 +0,0 @@ -package android.test; - -import java.lang.annotation.*; - -@Target(ElementType.PACKAGE) -@Retention(RetentionPolicy.RUNTIME) - -public @interface AnnoSimplePackage1 {} diff --git a/tests/004-annotations/src/android/test/anno/AnnoArrayField.java b/tests/004-annotations/src/android/test/anno/AnnoArrayField.java deleted file mode 100644 index 681045c36..000000000 --- a/tests/004-annotations/src/android/test/anno/AnnoArrayField.java +++ /dev/null @@ -1,19 +0,0 @@ -package android.test.anno; - -import java.lang.annotation.*; - -@Documented -@Inherited -@Target({ElementType.FIELD}) -@Retention(RetentionPolicy.RUNTIME) -public @interface AnnoArrayField { - boolean[] zz() default {}; - byte[] bb() default {}; - char[] cc() default {'a', 'b'}; - short[] ss() default {}; - int[] ii() default {}; - float[] ff() default {3.141592654f}; - long[] jj() default {}; - double[] dd() default {0.987654321}; - String[] str() default {}; -} diff --git a/tests/004-annotations/src/android/test/anno/AnnoFancyConstructor.java b/tests/004-annotations/src/android/test/anno/AnnoFancyConstructor.java deleted file mode 100644 index 19dadecc9..000000000 --- a/tests/004-annotations/src/android/test/anno/AnnoFancyConstructor.java +++ /dev/null @@ -1,10 +0,0 @@ -package android.test.anno; - -import java.lang.annotation.*; - -@Target(ElementType.CONSTRUCTOR) -@Retention(RetentionPolicy.RUNTIME) - -public @interface AnnoFancyConstructor { - public int numArgs() default 0; -} diff --git a/tests/004-annotations/src/android/test/anno/AnnoFancyField.java b/tests/004-annotations/src/android/test/anno/AnnoFancyField.java deleted file mode 100644 index 855ba5614..000000000 --- a/tests/004-annotations/src/android/test/anno/AnnoFancyField.java +++ /dev/null @@ -1,12 +0,0 @@ -package android.test.anno; - -import java.lang.annotation.*; - -@Target(ElementType.FIELD) -@Retention(RetentionPolicy.RUNTIME) -@Inherited // should have no effect -@Documented - -public @interface AnnoFancyField { - public String nombre() default "no se"; -} diff --git a/tests/004-annotations/src/android/test/anno/AnnoFancyMethod.java b/tests/004-annotations/src/android/test/anno/AnnoFancyMethod.java deleted file mode 100644 index 308886664..000000000 --- a/tests/004-annotations/src/android/test/anno/AnnoFancyMethod.java +++ /dev/null @@ -1,14 +0,0 @@ -package android.test.anno; - -import java.lang.annotation.*; - -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) - -public @interface AnnoFancyMethod { - enum AnnoFancyMethodEnum { FOO, BAR }; - boolean callMe() default false; - boolean biteMe(); - AnnoFancyMethodEnum enumerated() default AnnoFancyMethodEnum.FOO; - Class someClass() default SomeClass.class; -} diff --git a/tests/004-annotations/src/android/test/anno/AnnoFancyParameter.java b/tests/004-annotations/src/android/test/anno/AnnoFancyParameter.java deleted file mode 100644 index bc2ba7c29..000000000 --- a/tests/004-annotations/src/android/test/anno/AnnoFancyParameter.java +++ /dev/null @@ -1,10 +0,0 @@ -package android.test.anno; - -import java.lang.annotation.*; - -@Target(ElementType.PARAMETER) -@Retention(RetentionPolicy.RUNTIME) - -public @interface AnnoFancyParameter { - double factor(); -} diff --git a/tests/004-annotations/src/android/test/anno/AnnoFancyType.java b/tests/004-annotations/src/android/test/anno/AnnoFancyType.java deleted file mode 100644 index 745f8386a..000000000 --- a/tests/004-annotations/src/android/test/anno/AnnoFancyType.java +++ /dev/null @@ -1,11 +0,0 @@ -package android.test.anno; - -import java.lang.annotation.*; - -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) - -public @interface AnnoFancyType { - public int num(); - public String name() default "unknown"; -} diff --git a/tests/004-annotations/src/android/test/anno/AnnoSimpleConstructor.java b/tests/004-annotations/src/android/test/anno/AnnoSimpleConstructor.java deleted file mode 100644 index d66b9aef2..000000000 --- a/tests/004-annotations/src/android/test/anno/AnnoSimpleConstructor.java +++ /dev/null @@ -1,8 +0,0 @@ -package android.test.anno; - -import java.lang.annotation.*; - -@Target(ElementType.CONSTRUCTOR) -@Retention(RetentionPolicy.RUNTIME) - -public @interface AnnoSimpleConstructor {} diff --git a/tests/004-annotations/src/android/test/anno/AnnoSimpleField.java b/tests/004-annotations/src/android/test/anno/AnnoSimpleField.java deleted file mode 100644 index 04193d227..000000000 --- a/tests/004-annotations/src/android/test/anno/AnnoSimpleField.java +++ /dev/null @@ -1,8 +0,0 @@ -package android.test.anno; - -import java.lang.annotation.*; - -@Target(ElementType.FIELD) -@Retention(RetentionPolicy.RUNTIME) - -public @interface AnnoSimpleField {} diff --git a/tests/004-annotations/src/android/test/anno/AnnoSimpleLocalVariable.java b/tests/004-annotations/src/android/test/anno/AnnoSimpleLocalVariable.java deleted file mode 100644 index a839fa22d..000000000 --- a/tests/004-annotations/src/android/test/anno/AnnoSimpleLocalVariable.java +++ /dev/null @@ -1,8 +0,0 @@ -package android.test.anno; - -import java.lang.annotation.*; - -@Target(ElementType.LOCAL_VARIABLE) -@Retention(RetentionPolicy.RUNTIME) - -public @interface AnnoSimpleLocalVariable {} diff --git a/tests/004-annotations/src/android/test/anno/AnnoSimpleMethod.java b/tests/004-annotations/src/android/test/anno/AnnoSimpleMethod.java deleted file mode 100644 index fcd9c0f5f..000000000 --- a/tests/004-annotations/src/android/test/anno/AnnoSimpleMethod.java +++ /dev/null @@ -1,8 +0,0 @@ -package android.test.anno; - -import java.lang.annotation.*; - -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) - -public @interface AnnoSimpleMethod {} diff --git a/tests/004-annotations/src/android/test/anno/AnnoSimplePackage.java b/tests/004-annotations/src/android/test/anno/AnnoSimplePackage.java deleted file mode 100644 index 4aadfe7bf..000000000 --- a/tests/004-annotations/src/android/test/anno/AnnoSimplePackage.java +++ /dev/null @@ -1,8 +0,0 @@ -package android.test.anno; - -import java.lang.annotation.*; - -@Target(ElementType.PACKAGE) -@Retention(RetentionPolicy.RUNTIME) - -public @interface AnnoSimplePackage {} diff --git a/tests/004-annotations/src/android/test/anno/AnnoSimpleParameter.java b/tests/004-annotations/src/android/test/anno/AnnoSimpleParameter.java deleted file mode 100644 index 6e26ca3a4..000000000 --- a/tests/004-annotations/src/android/test/anno/AnnoSimpleParameter.java +++ /dev/null @@ -1,8 +0,0 @@ -package android.test.anno; - -import java.lang.annotation.*; - -@Target(ElementType.PARAMETER) -@Retention(RetentionPolicy.RUNTIME) - -public @interface AnnoSimpleParameter {} diff --git a/tests/004-annotations/src/android/test/anno/AnnoSimpleType.java b/tests/004-annotations/src/android/test/anno/AnnoSimpleType.java deleted file mode 100644 index 3bba3dbfb..000000000 --- a/tests/004-annotations/src/android/test/anno/AnnoSimpleType.java +++ /dev/null @@ -1,9 +0,0 @@ -package android.test.anno; - -import java.lang.annotation.*; - -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -@Inherited -@Documented -public @interface AnnoSimpleType {} diff --git a/tests/004-annotations/src/android/test/anno/AnnoSimpleType2.java b/tests/004-annotations/src/android/test/anno/AnnoSimpleType2.java deleted file mode 100644 index f74b29119..000000000 --- a/tests/004-annotations/src/android/test/anno/AnnoSimpleType2.java +++ /dev/null @@ -1,8 +0,0 @@ -package android.test.anno; - -import java.lang.annotation.*; - -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -@Inherited -public @interface AnnoSimpleType2 {} diff --git a/tests/004-annotations/src/android/test/anno/AnnoSimpleTypeInvis.java b/tests/004-annotations/src/android/test/anno/AnnoSimpleTypeInvis.java deleted file mode 100644 index 541d82eed..000000000 --- a/tests/004-annotations/src/android/test/anno/AnnoSimpleTypeInvis.java +++ /dev/null @@ -1,8 +0,0 @@ -package android.test.anno; - -import java.lang.annotation.*; - -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.CLASS) - -public @interface AnnoSimpleTypeInvis {} diff --git a/tests/004-annotations/src/android/test/anno/ExportedProperty.java b/tests/004-annotations/src/android/test/anno/ExportedProperty.java deleted file mode 100644 index 810d28f8f..000000000 --- a/tests/004-annotations/src/android/test/anno/ExportedProperty.java +++ /dev/null @@ -1,12 +0,0 @@ -/* part of test for array problem */ -package android.test.anno; - -import java.lang.annotation.*; - -@Target({ ElementType.FIELD, ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) - -public @interface ExportedProperty { - boolean resolveId() default false; - IntToString[] mapping() default { @IntToString(from = -1, to = "-1") }; -} diff --git a/tests/004-annotations/src/android/test/anno/FullyNoted.java b/tests/004-annotations/src/android/test/anno/FullyNoted.java deleted file mode 100644 index 76a7b0411..000000000 --- a/tests/004-annotations/src/android/test/anno/FullyNoted.java +++ /dev/null @@ -1,39 +0,0 @@ - -package android.test.anno; - -import java.io.IOException; -import java.io.EOFException; - -@AnnoFancyType(num=5, name="full") -public class FullyNoted { - @AnnoFancyField(nombre="fubar") - int mBar; - - @AnnoFancyConstructor(numArgs=1) - FullyNoted(@AnnoFancyParameter(factor=0.5) int bar) - { - mBar = bar; - } - - @AnnoFancyMethod(callMe=true, biteMe=false) - public int bar( - @AnnoSimpleParameter int one, - @AnnoFancyParameter(factor=3.7879912899761) long two) - throws IOException, EOFException { - - return 0; - } - - @AnnoFancyMethod(biteMe=true, enumerated=AnnoFancyMethod.AnnoFancyMethodEnum.BAR) - public int bar1( - @AnnoSimpleParameter int one, - @AnnoFancyParameter(factor=3.7879912899761) long two) - throws IOException { - - return 0; - } - - public int notAnnotated() { - return 0; - } -} diff --git a/tests/004-annotations/src/android/test/anno/INoted.java b/tests/004-annotations/src/android/test/anno/INoted.java deleted file mode 100644 index b2cd007d9..000000000 --- a/tests/004-annotations/src/android/test/anno/INoted.java +++ /dev/null @@ -1,7 +0,0 @@ -package android.test.anno; - -@AnnoSimpleType2 -public interface INoted { - @AnnoSimpleMethod - public int bar(); -} diff --git a/tests/004-annotations/src/android/test/anno/IntToString.java b/tests/004-annotations/src/android/test/anno/IntToString.java deleted file mode 100644 index e84fcfa3a..000000000 --- a/tests/004-annotations/src/android/test/anno/IntToString.java +++ /dev/null @@ -1,12 +0,0 @@ -/* part of test for array problem */ -package android.test.anno; - -import java.lang.annotation.*; - -@Target({ ElementType.TYPE }) -@Retention(RetentionPolicy.RUNTIME) - -public @interface IntToString { - int from(); - String to(); -} diff --git a/tests/004-annotations/src/android/test/anno/MissingAnnotation.java b/tests/004-annotations/src/android/test/anno/MissingAnnotation.java deleted file mode 100644 index 56da15a25..000000000 --- a/tests/004-annotations/src/android/test/anno/MissingAnnotation.java +++ /dev/null @@ -1,8 +0,0 @@ -package android.test.anno; - -import java.lang.annotation.Retention; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -@Retention(RUNTIME) public @interface MissingAnnotation { -} - diff --git a/tests/004-annotations/src/android/test/anno/SimplyNoted.java b/tests/004-annotations/src/android/test/anno/SimplyNoted.java deleted file mode 100644 index b75746589..000000000 --- a/tests/004-annotations/src/android/test/anno/SimplyNoted.java +++ /dev/null @@ -1,36 +0,0 @@ -package android.test.anno; - -@AnnoSimpleType -@AnnoSimpleType2 -@AnnoSimpleTypeInvis -@MissingAnnotation -public class SimplyNoted { - @AnnoSimpleField - @MissingAnnotation - public int mFoo; - - @AnnoSimpleField - @MissingAnnotation - public static int mOneFoo; - - @AnnoSimpleConstructor - @MissingAnnotation - SimplyNoted() { - mFoo = 0; - } - - @AnnoSimpleConstructor - @MissingAnnotation - SimplyNoted(@AnnoSimpleParameter int xyzzy) { - mFoo = xyzzy; - } - - @AnnoSimpleMethod - @MissingAnnotation - public int foo() { - @AnnoSimpleLocalVariable - int bar = 5; - - return bar; - } -} diff --git a/tests/004-annotations/src/android/test/anno/SomeClass.java b/tests/004-annotations/src/android/test/anno/SomeClass.java deleted file mode 100644 index c21d68dc5..000000000 --- a/tests/004-annotations/src/android/test/anno/SomeClass.java +++ /dev/null @@ -1,4 +0,0 @@ -package android.test.anno; - -public class SomeClass { -} diff --git a/tests/004-annotations/src/android/test/anno/SubNoted.java b/tests/004-annotations/src/android/test/anno/SubNoted.java deleted file mode 100644 index 2530346dc..000000000 --- a/tests/004-annotations/src/android/test/anno/SubNoted.java +++ /dev/null @@ -1,12 +0,0 @@ -package android.test.anno; - -@AnnoFancyType(num=5) // first occurrence of AnnoFancyType - // we inherit @AnnoSimpleType -@AnnoSimpleType2 // AnnoSimpleType2 here *and* inherited from parent -public class SubNoted extends SimplyNoted implements INoted { - int mBar; - - public int bar() { - return 0; - } -} diff --git a/tests/004-annotations/src/android/test/anno/TestAnnotations.java b/tests/004-annotations/src/android/test/anno/TestAnnotations.java deleted file mode 100644 index 4eabb12b3..000000000 --- a/tests/004-annotations/src/android/test/anno/TestAnnotations.java +++ /dev/null @@ -1,186 +0,0 @@ -package android.test.anno; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.TreeMap; - -public class TestAnnotations { - /** - * Print the annotations in sorted order, so as to avoid - * any (legitimate) non-determinism with regard to the iteration order. - */ - static private void printAnnotationArray(String prefix, Annotation[] arr) { - TreeMap<String, Annotation> sorted = - new TreeMap<String, Annotation>(); - - for (Annotation a : arr) { - sorted.put(a.annotationType().getName(), a); - } - - for (Annotation a : sorted.values()) { - System.out.println(prefix + " " + a); - System.out.println(prefix + " " + a.annotationType()); - } - } - - static void printAnnotations(Class clazz) { - Annotation[] annos; - Annotation[][] parAnnos; - - annos = clazz.getAnnotations(); - System.out.println("annotations on TYPE " + clazz + - "(" + annos.length + "):"); - printAnnotationArray("", annos); - System.out.println(); - - for (Constructor c: clazz.getDeclaredConstructors()) { - annos = c.getDeclaredAnnotations(); - System.out.println(" annotations on CTOR " + c + ":"); - printAnnotationArray(" ", annos); - - System.out.println(" constructor parameter annotations:"); - for (Annotation[] pannos: c.getParameterAnnotations()) { - printAnnotationArray(" ", pannos); - } - } - - for (Method m: clazz.getDeclaredMethods()) { - annos = m.getDeclaredAnnotations(); - System.out.println(" annotations on METH " + m + ":"); - printAnnotationArray(" ", annos); - - System.out.println(" method parameter annotations:"); - for (Annotation[] pannos: m.getParameterAnnotations()) { - printAnnotationArray(" ", pannos); - } - } - - for (Field f: clazz.getDeclaredFields()) { - annos = f.getDeclaredAnnotations(); - System.out.println(" annotations on FIELD " + f + ":"); - printAnnotationArray(" ", annos); - - AnnoFancyField aff; - aff = (AnnoFancyField) f.getAnnotation(AnnoFancyField.class); - if (aff != null) { - System.out.println(" aff: " + aff + " / " + aff.getClass()); - System.out.println(" --> nombre is '" + aff.nombre() + "'"); - } - } - System.out.println(); - } - - - @ExportedProperty(mapping = { - @IntToString(from = 0, to = "NORMAL_FOCUS"), - @IntToString(from = 2, to = "WEAK_FOCUS") - }) - public int getFocusType() { - return 2; - } - - - @AnnoArrayField - String thing1; - - @AnnoArrayField( - zz = {true,false,true}, - bb = {-1,0,1}, - cc = {'Q'}, - ss = {12,13,14,15,16,17}, - ii = {1,2,3,4}, - ff = {1.1f,1.2f,1.3f}, - jj = {-5,0,5}, - dd = {0.3,0.6,0.9}, - str = {"hickory","dickory","dock"} - ) - String thing2; - - public static void testArrays() { - TestAnnotations ta = new TestAnnotations(); - Field field; - Annotation[] annotations; - - try { - field = TestAnnotations.class.getDeclaredField("thing1"); - annotations = field.getAnnotations(); - System.out.println(field + ": " + annotations[0].toString()); - - field = TestAnnotations.class.getDeclaredField("thing2"); - annotations = field.getAnnotations(); - System.out.println(field + ": " + annotations[0].toString()); - } catch (NoSuchFieldException nsfe) { - throw new RuntimeException(nsfe); - } - } - - public static void testArrayProblem() { - Method meth; - ExportedProperty property; - final IntToString[] mapping; - - try { - meth = TestAnnotations.class.getMethod("getFocusType", - (Class[])null); - } catch (NoSuchMethodException nsme) { - throw new RuntimeException(nsme); - } - property = meth.getAnnotation(ExportedProperty.class); - mapping = property.mapping(); - - System.out.println("mapping is " + mapping.getClass() + - "\n 0='" + mapping[0] + "'\n 1='" + mapping[1] + "'"); - - /* while we're here, check isAnnotationPresent on Method */ - System.out.println("present(getFocusType, ExportedProperty): " + - meth.isAnnotationPresent(ExportedProperty.class)); - System.out.println("present(getFocusType, AnnoSimpleType): " + - meth.isAnnotationPresent(AnnoSimpleType.class)); - - System.out.println(""); - } - - - - public static void main(String[] args) { - System.out.println("TestAnnotations..."); - - testArrays(); - testArrayProblem(); - //System.exit(0); - - System.out.println( - "AnnoSimpleField " + AnnoSimpleField.class.isAnnotation() + - ", SimplyNoted " + SimplyNoted.class.isAnnotation()); - - Class clazz; - clazz = SimplyNoted.class; - printAnnotations(clazz); - clazz = INoted.class; - printAnnotations(clazz); - clazz = SubNoted.class; - printAnnotations(clazz); - clazz = FullyNoted.class; - printAnnotations(clazz); - - Annotation anno; - - // this is expected to be non-null - anno = SimplyNoted.class.getAnnotation(AnnoSimpleType.class); - System.out.println("SimplyNoted.get(AnnoSimpleType) = " + anno); - // this is non-null if the @Inherited tag is present - anno = SubNoted.class.getAnnotation(AnnoSimpleType.class); - System.out.println("SubNoted.get(AnnoSimpleType) = " + anno); - - System.out.println(); - - // Package annotations aren't inherited, so getAnnotations and getDeclaredAnnotations are - // the same. - System.out.println("Package annotations:"); - printAnnotationArray(" ", TestAnnotations.class.getPackage().getAnnotations()); - System.out.println("Package declared annotations:"); - printAnnotationArray(" ", TestAnnotations.class.getPackage().getDeclaredAnnotations()); - } -} diff --git a/tests/004-annotations/src/android/test/anno/package-info.java b/tests/004-annotations/src/android/test/anno/package-info.java deleted file mode 100644 index 74b11f99a..000000000 --- a/tests/004-annotations/src/android/test/anno/package-info.java +++ /dev/null @@ -1,2 +0,0 @@ -@AnnoSimplePackage -package android.test.anno; diff --git a/tests/004-annotations/src/android/test/package-info.java b/tests/004-annotations/src/android/test/package-info.java deleted file mode 100644 index e188cdaef..000000000 --- a/tests/004-annotations/src/android/test/package-info.java +++ /dev/null @@ -1,2 +0,0 @@ -@AnnoSimplePackage1 -package android.test; diff --git a/tests/005-args/expected.txt b/tests/005-args/expected.txt deleted file mode 100644 index 094fbbbcf..000000000 --- a/tests/005-args/expected.txt +++ /dev/null @@ -1,5 +0,0 @@ -VALUES: 1122334455667788 9887766554433221 1122334455667788 -VALUES: 1234605616436508552 -7455860480511102431 1234605616436508552 -1234605616436508552 -j = 1234605616436508552 -a=123 c=q d=3.343434 j=1234605616436508552 f=0.12345 diff --git a/tests/005-args/info.txt b/tests/005-args/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/005-args/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/005-args/src/ArgsTest.java b/tests/005-args/src/ArgsTest.java deleted file mode 100644 index 2b874cd29..000000000 --- a/tests/005-args/src/ArgsTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2007 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 ArgsTest{ - public ArgsTest() { - - } - - private long mLongArray[] = new long[] { - 0x1122334455667788L, 0x9887766554433221L }; - - /** - * - * @param a - * @param c - * @param d - * @param j - * @param f - */ - void argTest(int a, char c, double d, long j, float f) { - System.out.println("VALUES: " + Long.toHexString(mLongArray[0]) + " " - + Long.toHexString(mLongArray[1]) + " " + Long.toHexString(j)); - System.out.println("VALUES: " + mLongArray[0] + " " - + mLongArray[1] + " " + j); - - System.out.println(j); - System.out.println("j = " + j); - System.out.println("a=" + a + " c=" + c + " d=" + d - + " j=" + j + " f=" + f); - } -} diff --git a/tests/005-args/src/Main.java b/tests/005-args/src/Main.java deleted file mode 100644 index 1240ec5e8..000000000 --- a/tests/005-args/src/Main.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * Test passing arguments of various sizes - */ -public class Main { - public static void main (String args[]) { - new ArgsTest() - .argTest(123, 'q', 3.343434, 0x1122334455667788L, 0.12345f); - } -} diff --git a/tests/006-count10/expected.txt b/tests/006-count10/expected.txt deleted file mode 100644 index 8b1acc12b..000000000 --- a/tests/006-count10/expected.txt +++ /dev/null @@ -1,10 +0,0 @@ -0 -1 -2 -3 -4 -5 -6 -7 -8 -9 diff --git a/tests/006-count10/info.txt b/tests/006-count10/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/006-count10/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/006-count10/src/Main.java b/tests/006-count10/src/Main.java deleted file mode 100644 index 650d053d8..000000000 --- a/tests/006-count10/src/Main.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * Simple loop-and-print - */ -public class Main { - public static void main(String args[]) { - for (int i = 0; i < 10; i++) { - System.out.println(i); - } - } -} diff --git a/tests/007-exceptions/expected.txt b/tests/007-exceptions/expected.txt deleted file mode 100644 index 2a3163662..000000000 --- a/tests/007-exceptions/expected.txt +++ /dev/null @@ -1,9 +0,0 @@ -Got an NPE: second throw -java.lang.NullPointerException: second throw - at Main.catchAndRethrow(Main.java:36) - at Main.main(Main.java:23) - at dalvik.system.NativeStart.main(Native Method) -Caused by: java.lang.NullPointerException: first throw - at Main.throwNullPointerException(Main.java:43) - at Main.catchAndRethrow(Main.java:33) - ... 2 more diff --git a/tests/007-exceptions/info.txt b/tests/007-exceptions/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/007-exceptions/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/007-exceptions/src/Main.java b/tests/007-exceptions/src/Main.java deleted file mode 100644 index c7da2153d..000000000 --- a/tests/007-exceptions/src/Main.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * Exceptions across method calls - */ -public class Main { - public static void main (String args[]) { - try { - catchAndRethrow(); - } catch (NullPointerException npe) { - System.out.print("Got an NPE: "); - System.out.println(npe.getMessage()); - npe.printStackTrace(); - } - } - - private static void catchAndRethrow() { - try { - throwNullPointerException(); - } catch (NullPointerException npe) { - NullPointerException npe2; - npe2 = new NullPointerException("second throw"); - npe2.initCause(npe); - throw npe2; - } - } - - private static void throwNullPointerException() { - throw new NullPointerException("first throw"); - } -} diff --git a/tests/008-instanceof/expected.txt b/tests/008-instanceof/expected.txt deleted file mode 100644 index 77fd0cbc7..000000000 --- a/tests/008-instanceof/expected.txt +++ /dev/null @@ -1,6 +0,0 @@ -iface1.mFloaty = 5.0 wahoo -aa.mFloaty = 5.0 wahoo -bb.mWhoami = ImplB! -aaOkay (false) = false -bbOkay (true) = true -Caught a ClassCastException (expected) diff --git a/tests/008-instanceof/info.txt b/tests/008-instanceof/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/008-instanceof/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/008-instanceof/src/Iface1.java b/tests/008-instanceof/src/Iface1.java deleted file mode 100644 index ba17d45f2..000000000 --- a/tests/008-instanceof/src/Iface1.java +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2005 The Android Open Source Project - -/** - * Test stuff. - */ -public interface Iface1 { - - public int iFunc1(int ii); - - public float mFloaty = 5.0f; - - public String mWahoo = new String("wahoo"); -} diff --git a/tests/008-instanceof/src/Iface2.java b/tests/008-instanceof/src/Iface2.java deleted file mode 100644 index 83fe6508d..000000000 --- a/tests/008-instanceof/src/Iface2.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Another interface. - */ -public interface Iface2 { - - public int iFunc2(int ii); -} diff --git a/tests/008-instanceof/src/Iface2Sub1.java b/tests/008-instanceof/src/Iface2Sub1.java deleted file mode 100644 index db3e905bd..000000000 --- a/tests/008-instanceof/src/Iface2Sub1.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Another interface. - */ -public interface Iface2Sub1 extends Iface2, Cloneable { - - //public int iFunc2(int ii); -} diff --git a/tests/008-instanceof/src/ImplA.java b/tests/008-instanceof/src/ImplA.java deleted file mode 100644 index 9007001b9..000000000 --- a/tests/008-instanceof/src/ImplA.java +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Blah. - */ -public class ImplA implements Iface1, Iface2 { - - public int iFunc1(int ii) { - return ii+1; - } - public int iFunc2(int ii) { - return ii+2; - } -} diff --git a/tests/008-instanceof/src/ImplB.java b/tests/008-instanceof/src/ImplB.java deleted file mode 100644 index 619fa005b..000000000 --- a/tests/008-instanceof/src/ImplB.java +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Blah. - */ -public class ImplB implements Iface1, Iface2 { - - public int iFunc1(int ii) { - return ii+10; - } - public int iFunc2(int ii) { - return ii+20; - } - - public static String mWhoami = new String("ImplB!"); -} diff --git a/tests/008-instanceof/src/ImplBSub.java b/tests/008-instanceof/src/ImplBSub.java deleted file mode 100644 index f3a771442..000000000 --- a/tests/008-instanceof/src/ImplBSub.java +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Interface test. - */ -public class ImplBSub extends ImplB implements /*Iface2,*/ Iface2Sub1 { - - public int iFunc1(int ii) { - return ii+100; - } - public int iFunc2(int ii) { - return ii+200; - } -} diff --git a/tests/008-instanceof/src/Main.java b/tests/008-instanceof/src/Main.java deleted file mode 100644 index 77f3f515c..000000000 --- a/tests/008-instanceof/src/Main.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * Test instanceof - */ -public class Main { - public static void main(String args[]) { - Iface1 face1; - ImplA aa = new ImplA(); - ImplBSub bb = new ImplBSub(); - boolean aaOkay, bbOkay; - - face1 = aa; - face1 = bb; - - System.out.println("iface1.mFloaty = " + face1.mFloaty + " " + face1.mWahoo); - System.out.println("aa.mFloaty = " + aa.mFloaty + " " + aa.mWahoo); - System.out.println("bb.mWhoami = " + bb.mWhoami); - - aaOkay = face1 instanceof ImplA; - System.out.print("aaOkay (false) = "); - System.out.println(aaOkay); - bbOkay = face1 instanceof ImplB; - System.out.print("bbOkay (true) = "); - System.out.println(bbOkay); - - bb = (ImplBSub) face1; - try { - aa = (ImplA) face1; - } - catch (ClassCastException cce) { - System.out.println("Caught a ClassCastException (expected)"); - } - } -} diff --git a/tests/009-instanceof2/expected.txt b/tests/009-instanceof2/expected.txt deleted file mode 100644 index 74ad20293..000000000 --- a/tests/009-instanceof2/expected.txt +++ /dev/null @@ -1,5 +0,0 @@ -instanceof Serializable = true -instanceof Cloneable = true -instanceof Runnable = false -aaOkay (false) = false -bbOkay (true) = true diff --git a/tests/009-instanceof2/info.txt b/tests/009-instanceof2/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/009-instanceof2/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/009-instanceof2/src/Iface1.java b/tests/009-instanceof2/src/Iface1.java deleted file mode 100644 index ba17d45f2..000000000 --- a/tests/009-instanceof2/src/Iface1.java +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2005 The Android Open Source Project - -/** - * Test stuff. - */ -public interface Iface1 { - - public int iFunc1(int ii); - - public float mFloaty = 5.0f; - - public String mWahoo = new String("wahoo"); -} diff --git a/tests/009-instanceof2/src/Iface2.java b/tests/009-instanceof2/src/Iface2.java deleted file mode 100644 index 83fe6508d..000000000 --- a/tests/009-instanceof2/src/Iface2.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Another interface. - */ -public interface Iface2 { - - public int iFunc2(int ii); -} diff --git a/tests/009-instanceof2/src/Iface2Sub1.java b/tests/009-instanceof2/src/Iface2Sub1.java deleted file mode 100644 index db3e905bd..000000000 --- a/tests/009-instanceof2/src/Iface2Sub1.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Another interface. - */ -public interface Iface2Sub1 extends Iface2, Cloneable { - - //public int iFunc2(int ii); -} diff --git a/tests/009-instanceof2/src/ImplA.java b/tests/009-instanceof2/src/ImplA.java deleted file mode 100644 index 9007001b9..000000000 --- a/tests/009-instanceof2/src/ImplA.java +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Blah. - */ -public class ImplA implements Iface1, Iface2 { - - public int iFunc1(int ii) { - return ii+1; - } - public int iFunc2(int ii) { - return ii+2; - } -} diff --git a/tests/009-instanceof2/src/ImplB.java b/tests/009-instanceof2/src/ImplB.java deleted file mode 100644 index 619fa005b..000000000 --- a/tests/009-instanceof2/src/ImplB.java +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Blah. - */ -public class ImplB implements Iface1, Iface2 { - - public int iFunc1(int ii) { - return ii+10; - } - public int iFunc2(int ii) { - return ii+20; - } - - public static String mWhoami = new String("ImplB!"); -} diff --git a/tests/009-instanceof2/src/ImplBSub.java b/tests/009-instanceof2/src/ImplBSub.java deleted file mode 100644 index f3a771442..000000000 --- a/tests/009-instanceof2/src/ImplBSub.java +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Interface test. - */ -public class ImplBSub extends ImplB implements /*Iface2,*/ Iface2Sub1 { - - public int iFunc1(int ii) { - return ii+100; - } - public int iFunc2(int ii) { - return ii+200; - } -} diff --git a/tests/009-instanceof2/src/Main.java b/tests/009-instanceof2/src/Main.java deleted file mode 100644 index 15a1e507f..000000000 --- a/tests/009-instanceof2/src/Main.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * more instanceof cases - */ -public class Main { - public static void main(String args[]) { - Iface1[] faceArray; - ImplA[] aaArray = new ImplA[5]; - ImplBSub[] bbArray = new ImplBSub[5]; - boolean aaOkay, bbOkay; - - faceArray = aaArray; - faceArray = bbArray; - - System.out.print("instanceof Serializable = "); - System.out.println((Object)aaArray instanceof java.io.Serializable); - System.out.print("instanceof Cloneable = "); - System.out.println((Object)aaArray instanceof java.lang.Cloneable); - System.out.print("instanceof Runnable = "); - System.out.println((Object)aaArray instanceof java.lang.Runnable); - - aaOkay = faceArray instanceof ImplA[]; - System.out.print("aaOkay (false) = "); - System.out.println(aaOkay); - bbOkay = faceArray instanceof ImplB[]; - System.out.print("bbOkay (true) = "); - System.out.println(bbOkay); - } -} diff --git a/tests/010-instance/expected.txt b/tests/010-instance/expected.txt deleted file mode 100644 index 219dd06f8..000000000 --- a/tests/010-instance/expected.txt +++ /dev/null @@ -1,30 +0,0 @@ -instance begin -x instanceof X (true): true -x instanceof Y (false): false -y instanceof X (true): true -y instanceof Y (true): true -xar instanceof Object (true): true -xar instanceof X (false): false -xar instanceof X[] (true): true -xar instanceof Y[] (false): false -xar instanceof Object[] (true): true -xar instanceof X[][] (false): false -yar instanceof X[] (true): true -xararar instanceof Object (true): true -xararar instanceof Object[] (true): true -xararar instanceof X (false): false -xararar instanceof X[] (false): false -xararar instanceof X[][] (false): false -xararar instanceof X[][][] (true): true -xararar instanceof Object[][][] (true): true -xararar instanceof Serializable (true): true -xararar instanceof Serializable[] (true): true -xararar instanceof Serializable[][] (true): true -xararar instanceof Serializable[][][] (false): false -yararar instanceof X[][][] (true): true -iar instanceof Object (true): true -iar instanceof Object[] (false): false -iarar instanceof Object (true): true -iarar instanceof Object[] (true): true -iarar instanceof Object[][] (false): false -instanceof end diff --git a/tests/010-instance/info.txt b/tests/010-instance/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/010-instance/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/010-instance/src/InstanceTest.java b/tests/010-instance/src/InstanceTest.java deleted file mode 100644 index 78384ff76..000000000 --- a/tests/010-instance/src/InstanceTest.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -import java.io.Serializable; - -/** - * Test some instanceof stuff. - */ -public class InstanceTest { - public static void main(String[] args) { - System.out.println("instance begin"); - - X x = new X(); - X[] xar = new X[1]; - X[][] xarar = new X[1][1]; - X[][][] xararar = new X[1][1][1]; - Y y = new Y(); - Y[] yar = new Y[1]; - Y[][] yarar = new Y[1][1]; - Y[][][] yararar = new Y[1][1][1]; - int[] iar = new int[1]; - int[][] iarar = new int[1][1]; - Object test; - - test = x; - System.out.println("x instanceof X (true): " + (test instanceof X)); - System.out.println("x instanceof Y (false): " + (test instanceof Y)); - test = y; - System.out.println("y instanceof X (true): " + (test instanceof X)); - System.out.println("y instanceof Y (true): " + (test instanceof Y)); - - test = xar; - System.out.println("xar instanceof Object (true): " - + (test instanceof Object)); - System.out.println("xar instanceof X (false): " - + (test instanceof X)); - System.out.println("xar instanceof X[] (true): " - + (test instanceof X[])); - System.out.println("xar instanceof Y[] (false): " - + (test instanceof Y[])); - System.out.println("xar instanceof Object[] (true): " - + (test instanceof Object[])); - System.out.println("xar instanceof X[][] (false): " - + (test instanceof X[][])); - test = yar; - System.out.println("yar instanceof X[] (true): " - + (test instanceof X[])); - - test = xararar; - System.out.println("xararar instanceof Object (true): " - + (test instanceof Object)); - System.out.println("xararar instanceof Object[] (true): " - + (test instanceof Object[])); - System.out.println("xararar instanceof X (false): " - + (test instanceof X)); - System.out.println("xararar instanceof X[] (false): " - + (test instanceof X[])); - System.out.println("xararar instanceof X[][] (false): " - + (test instanceof X[][])); - System.out.println("xararar instanceof X[][][] (true): " - + (test instanceof X[][][])); - System.out.println("xararar instanceof Object[][][] (true): " - + (test instanceof Object[][][])); - - System.out.println("xararar instanceof Serializable (true): " - + (test instanceof Serializable)); - System.out.println("xararar instanceof Serializable[] (true): " - + (test instanceof Serializable[])); - System.out.println("xararar instanceof Serializable[][] (true): " - + (test instanceof Serializable[][])); - System.out.println("xararar instanceof Serializable[][][] (false): " - + (test instanceof Serializable[][][])); - - test = yararar; - System.out.println("yararar instanceof X[][][] (true): " - + (test instanceof X[][][])); - - test = iar; - System.out.println("iar instanceof Object (true): " - + (test instanceof Object)); - System.out.println("iar instanceof Object[] (false): " - + (test instanceof Object[])); - - test = iarar; - System.out.println("iarar instanceof Object (true): " - + (test instanceof Object)); - System.out.println("iarar instanceof Object[] (true): " - + (test instanceof Object[])); - System.out.println("iarar instanceof Object[][] (false): " - + (test instanceof Object[][])); - - System.out.println("instanceof end"); - } -} diff --git a/tests/010-instance/src/Main.java b/tests/010-instance/src/Main.java deleted file mode 100644 index ab0ab5e56..000000000 --- a/tests/010-instance/src/Main.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * even more instanceof cases - */ -public class Main { - public static void main(String args[]) { - InstanceTest.main(null); - } -} diff --git a/tests/010-instance/src/X.java b/tests/010-instance/src/X.java deleted file mode 100644 index d664d481b..000000000 --- a/tests/010-instance/src/X.java +++ /dev/null @@ -1,8 +0,0 @@ -class X { - public X() { - } - - int foo() { - return 0; - } -} diff --git a/tests/010-instance/src/Y.java b/tests/010-instance/src/Y.java deleted file mode 100644 index 2b2c3711a..000000000 --- a/tests/010-instance/src/Y.java +++ /dev/null @@ -1,8 +0,0 @@ -class Y extends X { - public Y() { - } - - int bar() { - return 1; - } -} diff --git a/tests/011-array-copy/expected.txt b/tests/011-array-copy/expected.txt deleted file mode 100644 index 724786ee3..000000000 --- a/tests/011-array-copy/expected.txt +++ /dev/null @@ -1,15 +0,0 @@ -string -> object -object -> string -object -> string (modified) -caught ArrayStoreException (expected) -copy: 0,0,0: [0, 1, 2, 3, 4, 5, 6, 7] -copy: 0,0,8: [0, 1, 2, 3, 4, 5, 6, 7] -copy: 0,2,4: [0, 1, 0, 1, 2, 3, 6, 7] -copy: 2,0,4: [2, 3, 4, 5, 4, 5, 6, 7] -copy: 1,3,4: [0, 1, 2, 1, 2, 3, 4, 7] -copy: 3,1,4: [0, 3, 4, 5, 6, 5, 6, 7] -copy: 3,1,5: [0, 3, 4, 5, 6, 7, 6, 7] -copy: 1,3,5: [0, 1, 2, 1, 2, 3, 4, 5] -copy: 0,3,5: [0, 1, 2, 0, 1, 2, 3, 4] -copy: 3,0,5: [3, 4, 5, 6, 7, 5, 6, 7] -copy: 0,5,1: [0, 1, 2, 3, 4, 0, 6, 7] diff --git a/tests/011-array-copy/info.txt b/tests/011-array-copy/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/011-array-copy/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/011-array-copy/src/Iface1.java b/tests/011-array-copy/src/Iface1.java deleted file mode 100644 index ba17d45f2..000000000 --- a/tests/011-array-copy/src/Iface1.java +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2005 The Android Open Source Project - -/** - * Test stuff. - */ -public interface Iface1 { - - public int iFunc1(int ii); - - public float mFloaty = 5.0f; - - public String mWahoo = new String("wahoo"); -} diff --git a/tests/011-array-copy/src/Iface2.java b/tests/011-array-copy/src/Iface2.java deleted file mode 100644 index 83fe6508d..000000000 --- a/tests/011-array-copy/src/Iface2.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Another interface. - */ -public interface Iface2 { - - public int iFunc2(int ii); -} diff --git a/tests/011-array-copy/src/ImplA.java b/tests/011-array-copy/src/ImplA.java deleted file mode 100644 index 9007001b9..000000000 --- a/tests/011-array-copy/src/ImplA.java +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Blah. - */ -public class ImplA implements Iface1, Iface2 { - - public int iFunc1(int ii) { - return ii+1; - } - public int iFunc2(int ii) { - return ii+2; - } -} diff --git a/tests/011-array-copy/src/Main.java b/tests/011-array-copy/src/Main.java deleted file mode 100644 index 505d8b09c..000000000 --- a/tests/011-array-copy/src/Main.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (C) 2007 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.util.Arrays; - -/** - * System.arraycopy cases - */ -public class Main { - public static void main(String args[]) { - testObjectCopy(); - testOverlappingMoves(); - } - - public static void testObjectCopy() { - String[] stringArray = new String[8]; - Object[] objectArray = new Object[8]; - - for (int i = 0; i < stringArray.length; i++) - stringArray[i] = new String(Integer.toString(i)); - - System.out.println("string -> object"); - System.arraycopy(stringArray, 0, objectArray, 0, stringArray.length); - System.out.println("object -> string"); - System.arraycopy(objectArray, 0, stringArray, 0, stringArray.length); - System.out.println("object -> string (modified)"); - objectArray[4] = new ImplA(); - try { - System.arraycopy(objectArray, 0, stringArray, 0,stringArray.length); - } - catch (ArrayStoreException ase) { - System.out.println("caught ArrayStoreException (expected)"); - } - } - - static final int ARRAY_SIZE = 8; - - static void initByteArray(byte[] array) { - for (int i = 0; i < ARRAY_SIZE; i++) { - array[i] = (byte) i; - } - } - static void initShortArray(short[] array) { - for (int i = 0; i < ARRAY_SIZE; i++) { - array[i] = (short) i; - } - } - static void initIntArray(int[] array) { - for (int i = 0; i < ARRAY_SIZE; i++) { - array[i] = (int) i; - } - } - static void initLongArray(long[] array) { - for (int i = 0; i < ARRAY_SIZE; i++) { - array[i] = (long) i; - } - } - - /* - * Perform an array copy operation on primitive arrays with different - * element widths. - */ - static void makeCopies(int srcPos, int dstPos, int length) { - byte[] byteArray = new byte[ARRAY_SIZE]; - short[] shortArray = new short[ARRAY_SIZE]; - int[] intArray = new int[ARRAY_SIZE]; - long[] longArray = new long[ARRAY_SIZE]; - - initByteArray(byteArray); - initShortArray(shortArray); - initIntArray(intArray); - initLongArray(longArray); - - System.arraycopy(byteArray, srcPos, byteArray, dstPos, length); - System.arraycopy(shortArray, srcPos, shortArray, dstPos, length); - System.arraycopy(intArray, srcPos, intArray, dstPos, length); - System.arraycopy(longArray, srcPos, longArray, dstPos, length); - - for (int i = 0; i < ARRAY_SIZE; i++) { - if (intArray[i] != byteArray[i]) { - System.out.println("mismatch int vs byte at " + i + " : " + - Arrays.toString(byteArray)); - break; - } else if (intArray[i] != shortArray[i]) { - System.out.println("mismatch int vs short at " + i + " : " + - Arrays.toString(shortArray)); - break; - } else if (intArray[i] != longArray[i]) { - System.out.println("mismatch int vs long at " + i + " : " + - Arrays.toString(longArray)); - break; - } - } - - System.out.println("copy: " + srcPos + "," + dstPos + "," + length + - ": " + Arrays.toString(intArray)); - } - - public static void testOverlappingMoves() { - /* do nothing */ - makeCopies(0, 0, 0); - - /* do more nothing */ - makeCopies(0, 0, ARRAY_SIZE); - - /* copy forward, even alignment */ - makeCopies(0, 2, 4); - - /* copy backward, even alignment */ - makeCopies(2, 0, 4); - - /* copy forward, odd alignment */ - makeCopies(1, 3, 4); - - /* copy backward, odd alignment */ - makeCopies(3, 1, 4); - - /* copy backward, odd length */ - makeCopies(3, 1, 5); - - /* copy forward, odd length */ - makeCopies(1, 3, 5); - - /* copy forward, mixed alignment */ - makeCopies(0, 3, 5); - - /* copy backward, mixed alignment */ - makeCopies(3, 0, 5); - - /* copy forward, mixed alignment, trivial length */ - makeCopies(0, 5, 1); - } -} diff --git a/tests/012-math/expected.txt b/tests/012-math/expected.txt deleted file mode 100644 index af9708e44..000000000 --- a/tests/012-math/expected.txt +++ /dev/null @@ -1,32 +0,0 @@ -res:10 -res:-4 -res:2 -res:-2 -res:21 -res:0 -res:3 -res:4 -res:384 -res:0 -res:0 -a:10 -a:3 -a:2 -a:-3 -a:-21 -a:-3 -a:-3 -a:-6 -a:-768 -a:-6 -a:33554431 -fres:10.0 -fres:-4.0 -fres:21.0 -fres:0.42857142857142855 -fres:3.0 -f:10.0 -f:3.0 -f:21.0 -f:3.0 -f:3.0 diff --git a/tests/012-math/info.txt b/tests/012-math/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/012-math/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/012-math/src/Main.java b/tests/012-math/src/Main.java deleted file mode 100644 index 87ea40ba6..000000000 --- a/tests/012-math/src/Main.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * test simple math opers - */ -public class Main { - public static void main(String args[]) { - int pad0, pad1, pad2, pad3, pad4, pad5, pad6, pad7; - int pad8, pad9, pad10, pad11, pad12, pad13, pad14, pad15; - int a, b, res; - //long a, b, res; - - a = 3; - b = 7; - - res = a + b; - System.out.println("res:" +res); - res = a - b; - System.out.println("res:" +res); - res = 5 - a; - System.out.println("res:" +res); - res = a - 5; - System.out.println("res:" +res); - res = a * b; - System.out.println("res:" +res); - res = a / b; - System.out.println("res:" +res); - res = a % b; - System.out.println("res:" +res); - res = a ^ b; - System.out.println("res:" +res); - res = a << b; - System.out.println("res:" +res); - res = a >> b; - System.out.println("res:" +res); - res = a >>> b; - System.out.println("res:" +res); - - a += b; - System.out.println("a:" +a); - a -= b; - System.out.println("a:" +a); - a = 5 - a; - System.out.println("a:" +a); - a -= 5; - System.out.println("a:" +a); - a *= b; - System.out.println("a:" +a); - a /= b; - System.out.println("a:" +a); - a %= b; - System.out.println("a:" +a); - a ^= b; - System.out.println("a:" +a); - a <<= b; - System.out.println("a:" +a); - a >>= b; - System.out.println("a:" +a); - a >>>= b; - System.out.println("a:" +a); - - double f, g, fres; - - f = 3.0f; - g = 7.0f; - - fres = f + g; - System.out.println("fres:" +fres); - fres = f - g; - System.out.println("fres:" +fres); - fres = f * g; - System.out.println("fres:" +fres); - fres = f / g; - System.out.println("fres:" +fres); - fres = f % g; - System.out.println("fres:" +fres); - f += g; - System.out.println("f:" +f); - f -= g; - System.out.println("f:" +f); - f *= g; - System.out.println("f:" +f); - f /= g; - System.out.println("f:" +f); - f %= g; - System.out.println("f:" +f); - } -} diff --git a/tests/013-math2/expected.txt b/tests/013-math2/expected.txt deleted file mode 100644 index d36c468e8..000000000 --- a/tests/013-math2/expected.txt +++ /dev/null @@ -1 +0,0 @@ -a:32003 diff --git a/tests/013-math2/info.txt b/tests/013-math2/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/013-math2/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/013-math2/src/Main.java b/tests/013-math2/src/Main.java deleted file mode 100644 index 819571dcc..000000000 --- a/tests/013-math2/src/Main.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * test add by a 16-bit constant - */ -public class Main { - public static void main(String args[]) { - int a, b, res; - - a = 3; - b = 7; - - // a 16-bit constant - a += 32000; - System.out.println("a:" +a); - } -} diff --git a/tests/014-math3/expected.txt b/tests/014-math3/expected.txt deleted file mode 100644 index bda3dc7d2..000000000 --- a/tests/014-math3/expected.txt +++ /dev/null @@ -1 +0,0 @@ -testMath3 success diff --git a/tests/014-math3/info.txt b/tests/014-math3/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/014-math3/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/014-math3/src/Main.java b/tests/014-math3/src/Main.java deleted file mode 100644 index f55b17a94..000000000 --- a/tests/014-math3/src/Main.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * Test math exceptions - */ -public class Main { - public static void main(String args[]) { - int expectedThrows = 2; - int i; - long j; - float f = 0.0f; - double d = 0.0; - - try { i = 10 / 0; } - catch (ArithmeticException ae) { - expectedThrows--; - } - - try { j = 10L / 0L; } - catch (ArithmeticException ae) { - expectedThrows--; - } - - /* - * Floating point divide by zero doesn't throw an exception -- the - * result is just NaN. - */ - try { f = 10.0f / f; } - catch (ArithmeticException ae) { - expectedThrows--; - } - - try { d = 10.0 / d; } - catch (ArithmeticException ae) { - expectedThrows--; - } - - if (expectedThrows != 0) - System.out.println("HEY: expected throws is " + expectedThrows); - else - System.out.println("testMath3 success"); - } -} diff --git a/tests/015-switch/expected.txt b/tests/015-switch/expected.txt deleted file mode 100644 index ca3b518f0..000000000 --- a/tests/015-switch/expected.txt +++ /dev/null @@ -1,10 +0,0 @@ -CORRECT (one) -CORRECT (not found) -CORRECT (large) -CORRECT (large2) -CORRECT (large3) -CORRECT (not found) -CORRECT (not found) -CORRECT (default only) -CORRECT big sparse / first -CORRECT big sparse / last diff --git a/tests/015-switch/info.txt b/tests/015-switch/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/015-switch/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/015-switch/src/Main.java b/tests/015-switch/src/Main.java deleted file mode 100644 index 7198e2b7b..000000000 --- a/tests/015-switch/src/Main.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * Test switch() blocks - */ -public class Main { - public static void main(String args[]) { - int a = 1; - - switch (a) { - case -1: System.out.print("neg one\n"); break; - case 0: System.out.print("zero\n"); break; - case 1: System.out.print("CORRECT (one)\n"); break; - case 2: System.out.print("two\n"); break; - case 3: System.out.print("three\n"); break; - case 4: System.out.print("four\n"); break; - default: System.out.print("???\n"); break; - } - switch (a) { - case 3: System.out.print("three\n"); break; - case 4: System.out.print("four\n"); break; - default: System.out.print("CORRECT (not found)\n"); break; - } - - a = 0x12345678; - - switch (a) { - case 0x12345678: System.out.print("CORRECT (large)\n"); break; - case 0x12345679: System.out.print("large+1\n"); break; - default: System.out.print("nuts\n"); break; - } - switch (a) { - case 0x12345678: System.out.print("CORRECT (large2)\n"); break; - case 0x12345700: System.out.print("large+many\n"); break; - default: System.out.print("nuts\n"); break; - } - switch (a) { - case 57: System.out.print("fifty-seven!\n"); break; - case -6: System.out.print("neg six!\n"); break; - case 0x12345678: System.out.print("CORRECT (large3)\n"); break; - case 22: System.out.print("twenty-two!\n"); break; - case 3: System.out.print("three!\n"); break; - default: System.out.print("huh?\n"); break; - } - switch (a) { - case -6: System.out.print("neg six!\n"); break; - case 3: System.out.print("three!\n"); break; - default: System.out.print("CORRECT (not found)\n"); break; - } - - a = -5; - switch (a) { - case 12: System.out.print("twelve\n"); break; - case -5: System.out.print("CORRECT (not found)\n"); break; - case 0: System.out.print("zero\n"); break; - default: System.out.print("wah?\n"); break; - } - - switch (a) { - default: System.out.print("CORRECT (default only)\n"); break; - } - - a = -10; - switch (a) { - case -10: System.out.print("CORRECT big sparse / first\n"); break; - case -5: System.out.print("neg five\n"); break; - case 0: System.out.print("zero\n"); break; - case 5: System.out.print("five\n"); break; - case 10: System.out.print("ten\n"); break; - case 15: System.out.print("fifteen\n"); break; - case 20: System.out.print("twenty\n"); break; - case 50: System.out.print("fifty\n"); break; - case 100: System.out.print("hundred\n"); break; - default: System.out.print("blah!\n"); break; - } - - a = 100; - switch (a) { - case -10: System.out.print("neg ten\n"); break; - case -5: System.out.print("neg five\n"); break; - case 0: System.out.print("zero\n"); break; - case 5: System.out.print("five\n"); break; - case 10: System.out.print("ten\n"); break; - case 15: System.out.print("fifteen\n"); break; - case 20: System.out.print("twenty\n"); break; - case 50: System.out.print("fifty\n"); break; - case 100: System.out.print("CORRECT big sparse / last\n"); break; - default: System.out.print("blah!\n"); break; - } - } -} diff --git a/tests/016-intern/expected.txt b/tests/016-intern/expected.txt deleted file mode 100644 index 7d919635f..000000000 --- a/tests/016-intern/expected.txt +++ /dev/null @@ -1 +0,0 @@ -good! foobar diff --git a/tests/016-intern/info.txt b/tests/016-intern/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/016-intern/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/016-intern/src/Main.java b/tests/016-intern/src/Main.java deleted file mode 100644 index 430686302..000000000 --- a/tests/016-intern/src/Main.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * Interned strings - */ -public class Main { - public static void main(String args[]) { - String a, b; - String foo = "foo"; - String bar = "bar"; - - a = foo.concat(bar).intern(); - b = foo.concat(bar).intern(); - if (a == b && foo != bar) { - System.out.println("good! " + a); - } else { - System.out.println("bad!"); - } - } -} diff --git a/tests/017-float/expected.txt b/tests/017-float/expected.txt deleted file mode 100644 index 2062f9e7b..000000000 --- a/tests/017-float/expected.txt +++ /dev/null @@ -1,3 +0,0 @@ -base values: d=3.1415926535 f=3.1415927 -base values: d=3.1415926535 f=3.1415927 -base values: f=3.1415927 d=3.1415926535 diff --git a/tests/017-float/info.txt b/tests/017-float/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/017-float/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/017-float/src/Main.java b/tests/017-float/src/Main.java deleted file mode 100644 index a5dbe1e23..000000000 --- a/tests/017-float/src/Main.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * I dont know what this test does. - */ -public class Main { - public static void main(String args[]) { - float f = 3.1415926535f; - double d = 3.1415926535; - //float fd = (float) d; - //Float off = new Float(f); - //Float ofd = new Float(d); - System.out.println("base values: d=" + d + " f=" + f); - System.out.println("base values: d=" + d + " f=" + f); - System.out.println("base values: f=" + f + " d=" + d); - //System.out.println("object values: off=" - // + off.floatValue() + " ofd=" + ofd.floatValue()); - } -} diff --git a/tests/018-stack-overflow/expected.txt b/tests/018-stack-overflow/expected.txt deleted file mode 100644 index 779781678..000000000 --- a/tests/018-stack-overflow/expected.txt +++ /dev/null @@ -1,2 +0,0 @@ -caught SOE -SOE test done diff --git a/tests/018-stack-overflow/info.txt b/tests/018-stack-overflow/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/018-stack-overflow/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/018-stack-overflow/src/Main.java b/tests/018-stack-overflow/src/Main.java deleted file mode 100644 index f79c269c8..000000000 --- a/tests/018-stack-overflow/src/Main.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * generate a stack overflow condition and catch it - */ -public class Main { - public static void main(String args[]) { - try { - stackOverflowTestSub(0.0, 0.0, 0.0); - } - catch (StackOverflowError soe) { - System.out.println("caught SOE"); - } - System.out.println("SOE test done"); - } - - private static void stackOverflowTestSub(double pad1, double pad2, - double pad3) { - stackOverflowTestSub(pad1, pad2, pad3); - } -} diff --git a/tests/019-wrong-array-type/expected.txt b/tests/019-wrong-array-type/expected.txt deleted file mode 100644 index c0ed71652..000000000 --- a/tests/019-wrong-array-type/expected.txt +++ /dev/null @@ -1 +0,0 @@ -Got correct array store exception diff --git a/tests/019-wrong-array-type/info.txt b/tests/019-wrong-array-type/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/019-wrong-array-type/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/019-wrong-array-type/src/Main.java b/tests/019-wrong-array-type/src/Main.java deleted file mode 100644 index c424ae9ef..000000000 --- a/tests/019-wrong-array-type/src/Main.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * Stuff the wrong type object into an array. - */ -public class Main { - public static void main(String args[]) { - String[] strArray = new String[1]; - - Object[] objArray = strArray; - - try { - objArray[0] = new Integer(1); - System.out.println("Array store succeeded?!"); - } catch (ArrayStoreException ase) { - System.out.println("Got correct array store exception"); - } - } -} diff --git a/tests/020-string/expected.txt b/tests/020-string/expected.txt deleted file mode 100644 index 081fea3a4..000000000 --- a/tests/020-string/expected.txt +++ /dev/null @@ -1,7 +0,0 @@ -testStr is 'This is a very nice string' -This is a very nice string -Compare result is 32 -Compare unicode: -65302 -Got expected exception -subStr is 'uick brown fox jumps over the lazy ' -Indexes are: 0:-1:0:43:33:-1:18:13:13:-1:18:18:-1:13:-1:-1:-1 diff --git a/tests/020-string/info.txt b/tests/020-string/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/020-string/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/020-string/src/Main.java b/tests/020-string/src/Main.java deleted file mode 100644 index bb8ce1fa5..000000000 --- a/tests/020-string/src/Main.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * Simple string test. - */ -public class Main { - public static void main(String args[]) { - basicTest(); - indexTest(); - } - - public static void basicTest() { - String baseStr = "*** This is a very nice string!!!"; - String testStr; - int i; - - testStr = baseStr.substring(4, baseStr.length() - 3); - System.out.println("testStr is '" + testStr + "'"); - - /* sloppy for loop */ - for (i = 0; i < testStr.length(); i++) - System.out.print(testStr.charAt(i)); - System.out.print("\n"); - - String testStr2 = "This is a very nice strinG"; - if (testStr.length() != testStr2.length()) - System.out.println("WARNING: stringTest length mismatch"); - - System.out.println("Compare result is " + testStr.compareTo(testStr2)); - - // expected: -65302 - String s1 = "\u0c6d\u0cb6\u0d00\u0000\u0080\u0080\u0080\u0000\u0002\u0002\u0002\u0000\u00e9\u00e9\u00e9"; - String s2 = "\u0c6d\u0cb6\u0d00\u0000\u0080\u0080\u0080\u0000\u0002\u0002\u0002\u0000\uffff\uffff\uffff\u00e9\u00e9\u00e9"; - System.out.println("Compare unicode: " + s1.compareTo(s2)); - - try { - testStr.charAt(500); - System.out.println("GLITCH: expected exception"); - } catch (StringIndexOutOfBoundsException sioobe) { - System.out.println("Got expected exception"); - } - } - - public static void indexTest() { - String baseStr = "The quick brown fox jumps over the lazy dog!"; - String subStr; - - subStr = baseStr.substring(5, baseStr.length() - 4); - System.out.println("subStr is '" + subStr + "'"); - - System.out.println("Indexes are: " + - baseStr.indexOf('T') + ":" + - subStr.indexOf('T') + ":" + - subStr.indexOf('u') + ":" + - baseStr.indexOf('!') + ":" + - subStr.indexOf('y') + ":" + - subStr.indexOf('d') + ":" + - baseStr.indexOf('x') + ":" + - subStr.indexOf('x', 0) + ":" + - subStr.indexOf('x', -1) + ":" + - subStr.indexOf('x', 200) + ":" + - baseStr.indexOf('x', 17) + ":" + - baseStr.indexOf('x', 18) + ":" + - baseStr.indexOf('x', 19) + ":" + - subStr.indexOf('x', 13) + ":" + - subStr.indexOf('x', 14) + ":" + - subStr.indexOf('&') + ":" + - baseStr.indexOf(0x12341234)); - } -} diff --git a/tests/021-string2/expected.txt b/tests/021-string2/expected.txt deleted file mode 100644 index bd7f0492b..000000000 --- a/tests/021-string2/expected.txt +++ /dev/null @@ -1 +0,0 @@ -Got expected npe diff --git a/tests/021-string2/info.txt b/tests/021-string2/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/021-string2/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/021-string2/src/Main.java b/tests/021-string2/src/Main.java deleted file mode 100644 index 87e4baf65..000000000 --- a/tests/021-string2/src/Main.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2007 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 junit.framework.Assert; - -/** - * more string tests - */ -public class Main { - public static void main(String args[]) { - String test = "0123456789"; - String test1 = new String("0123456789"); // different object - String test2 = new String("0123456780"); // different value - String offset = new String("xxx0123456789yyy"); - String sub = offset.substring(3, 13); - Object blah = new Object(); - - Assert.assertTrue(test.equals(test)); - Assert.assertTrue(test.equals(test1)); - Assert.assertFalse(test.equals(test2)); - - Assert.assertEquals(test.compareTo(test1), 0); - Assert.assertTrue(test1.compareTo(test2) > 0); - Assert.assertTrue(test2.compareTo(test1) < 0); - - /* compare string with a nonzero offset, in left/right side */ - Assert.assertEquals(test.compareTo(sub), 0); - Assert.assertEquals(sub.compareTo(test), 0); - Assert.assertTrue(test.equals(sub)); - Assert.assertTrue(sub.equals(test)); - /* same base, one is a substring */ - Assert.assertFalse(offset.equals(sub)); - Assert.assertFalse(sub.equals(offset)); - /* wrong class */ - Assert.assertFalse(test.equals(blah)); - - /* null ptr - throw */ - try { - test.compareTo(null); - Assert.fail("didn't get expected npe"); - } catch (NullPointerException npe) { - System.out.println("Got expected npe"); - } - /* null ptr - ok */ - Assert.assertFalse(test.equals(null)); - - test = test.substring(1); - Assert.assertTrue(test.equals("123456789")); - Assert.assertFalse(test.equals(test1)); - - test = test.substring(1); - Assert.assertTrue(test.equals("23456789")); - - test = test.substring(1); - Assert.assertTrue(test.equals("3456789")); - - test = test.substring(1); - Assert.assertTrue(test.equals("456789")); - - test = test.substring(3,5); - Assert.assertTrue(test.equals("78")); - - test = "this/is/a/path"; - String[] strings = test.split("/"); - Assert.assertEquals(4, strings.length); - - Assert.assertEquals("this is a path", test.replaceAll("/", " ")); - Assert.assertEquals("this is a path", test.replace("/", " ")); - } -} diff --git a/tests/021-string2/src/junit/framework/Assert.java b/tests/021-string2/src/junit/framework/Assert.java deleted file mode 100644 index 364e646ff..000000000 --- a/tests/021-string2/src/junit/framework/Assert.java +++ /dev/null @@ -1,291 +0,0 @@ -package junit.framework; - -/** - * A set of assert methods. Messages are only displayed when an assert fails. - */ - -public class Assert { - /** - * Protect constructor since it is a static only class - */ - protected Assert() { - } - - /** - * Asserts that a condition is true. If it isn't it throws - * an AssertionFailedError with the given message. - */ - static public void assertTrue(String message, boolean condition) { - if (!condition) - fail(message); - } - /** - * Asserts that a condition is true. If it isn't it throws - * an AssertionFailedError. - */ - static public void assertTrue(boolean condition) { - assertTrue(null, condition); - } - /** - * Asserts that a condition is false. If it isn't it throws - * an AssertionFailedError with the given message. - */ - static public void assertFalse(String message, boolean condition) { - assertTrue(message, !condition); - } - /** - * Asserts that a condition is false. If it isn't it throws - * an AssertionFailedError. - */ - static public void assertFalse(boolean condition) { - assertFalse(null, condition); - } - /** - * Fails a test with the given message. - */ - static public void fail(String message) { - throw new AssertionFailedError(message); - } - /** - * Fails a test with no message. - */ - static public void fail() { - fail(null); - } - /** - * Asserts that two objects are equal. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertEquals(String message, Object expected, Object actual) { - if (expected == null && actual == null) - return; - if (expected != null && expected.equals(actual)) - return; - failNotEquals(message, expected, actual); - } - /** - * Asserts that two objects are equal. If they are not - * an AssertionFailedError is thrown. - */ - static public void assertEquals(Object expected, Object actual) { - assertEquals(null, expected, actual); - } - /** - * Asserts that two Strings are equal. - */ - static public void assertEquals(String message, String expected, String actual) { - if (expected == null && actual == null) - return; - if (expected != null && expected.equals(actual)) - return; - throw new ComparisonFailure(message, expected, actual); - } - /** - * Asserts that two Strings are equal. - */ - static public void assertEquals(String expected, String actual) { - assertEquals(null, expected, actual); - } - /** - * Asserts that two doubles are equal concerning a delta. If they are not - * an AssertionFailedError is thrown with the given message. If the expected - * value is infinity then the delta value is ignored. - */ - static public void assertEquals(String message, double expected, double actual, double delta) { - // handle infinity specially since subtracting to infinite values gives NaN and the - // the following test fails - if (Double.isInfinite(expected)) { - if (!(expected == actual)) - failNotEquals(message, new Double(expected), new Double(actual)); - } else if (!(Math.abs(expected-actual) <= delta)) // Because comparison with NaN always returns false - failNotEquals(message, new Double(expected), new Double(actual)); - } - /** - * Asserts that two doubles are equal concerning a delta. If the expected - * value is infinity then the delta value is ignored. - */ - static public void assertEquals(double expected, double actual, double delta) { - assertEquals(null, expected, actual, delta); - } - /** - * Asserts that two floats are equal concerning a delta. If they are not - * an AssertionFailedError is thrown with the given message. If the expected - * value is infinity then the delta value is ignored. - */ - static public void assertEquals(String message, float expected, float actual, float delta) { - // handle infinity specially since subtracting to infinite values gives NaN and the - // the following test fails - if (Float.isInfinite(expected)) { - if (!(expected == actual)) - failNotEquals(message, new Float(expected), new Float(actual)); - } else if (!(Math.abs(expected-actual) <= delta)) - failNotEquals(message, new Float(expected), new Float(actual)); - } - /** - * Asserts that two floats are equal concerning a delta. If the expected - * value is infinity then the delta value is ignored. - */ - static public void assertEquals(float expected, float actual, float delta) { - assertEquals(null, expected, actual, delta); - } - /** - * Asserts that two longs are equal. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertEquals(String message, long expected, long actual) { - assertEquals(message, new Long(expected), new Long(actual)); - } - /** - * Asserts that two longs are equal. - */ - static public void assertEquals(long expected, long actual) { - assertEquals(null, expected, actual); - } - /** - * Asserts that two booleans are equal. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertEquals(String message, boolean expected, boolean actual) { - assertEquals(message, new Boolean(expected), new Boolean(actual)); - } - /** - * Asserts that two booleans are equal. - */ - static public void assertEquals(boolean expected, boolean actual) { - assertEquals(null, expected, actual); - } - /** - * Asserts that two bytes are equal. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertEquals(String message, byte expected, byte actual) { - assertEquals(message, new Byte(expected), new Byte(actual)); - } - /** - * Asserts that two bytes are equal. - */ - static public void assertEquals(byte expected, byte actual) { - assertEquals(null, expected, actual); - } - /** - * Asserts that two chars are equal. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertEquals(String message, char expected, char actual) { - assertEquals(message, new Character(expected), new Character(actual)); - } - /** - * Asserts that two chars are equal. - */ - static public void assertEquals(char expected, char actual) { - assertEquals(null, expected, actual); - } - /** - * Asserts that two shorts are equal. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertEquals(String message, short expected, short actual) { - assertEquals(message, new Short(expected), new Short(actual)); - } - /** - * Asserts that two shorts are equal. - */ - static public void assertEquals(short expected, short actual) { - assertEquals(null, expected, actual); - } - /** - * Asserts that two ints are equal. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertEquals(String message, int expected, int actual) { - assertEquals(message, new Integer(expected), new Integer(actual)); - } - /** - * Asserts that two ints are equal. - */ - static public void assertEquals(int expected, int actual) { - assertEquals(null, expected, actual); - } - /** - * Asserts that an object isn't null. - */ - static public void assertNotNull(Object object) { - assertNotNull(null, object); - } - /** - * Asserts that an object isn't null. If it is - * an AssertionFailedError is thrown with the given message. - */ - static public void assertNotNull(String message, Object object) { - assertTrue(message, object != null); - } - /** - * Asserts that an object is null. - */ - static public void assertNull(Object object) { - assertNull(null, object); - } - /** - * Asserts that an object is null. If it is not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertNull(String message, Object object) { - assertTrue(message, object == null); - } - /** - * Asserts that two objects refer to the same object. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertSame(String message, Object expected, Object actual) { - if (expected == actual) - return; - failNotSame(message, expected, actual); - } - /** - * Asserts that two objects refer to the same object. If they are not - * the same an AssertionFailedError is thrown. - */ - static public void assertSame(Object expected, Object actual) { - assertSame(null, expected, actual); - } - /** - * Asserts that two objects refer to the same object. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertNotSame(String message, Object expected, Object actual) { - if (expected == actual) - failSame(message); - } - /** - * Asserts that two objects refer to the same object. If they are not - * the same an AssertionFailedError is thrown. - */ - static public void assertNotSame(Object expected, Object actual) { - assertNotSame(null, expected, actual); - } - - static private void failSame(String message) { - String formatted= ""; - if (message != null) - formatted= message+" "; - fail(formatted+"expected not same"); - } - - static private void failNotSame(String message, Object expected, Object actual) { - String formatted= ""; - if (message != null) - formatted= message+" "; - fail(formatted+"expected same:<"+expected+"> was not:<"+actual+">"); - } - - static private void failNotEquals(String message, Object expected, Object actual) { - fail(format(message, expected, actual)); - } - - static String format(String message, Object expected, Object actual) { - String formatted= ""; - if (message != null) - formatted= message+" "; - return formatted+"expected:<"+expected+"> but was:<"+actual+">"; - } -} diff --git a/tests/021-string2/src/junit/framework/AssertionFailedError.java b/tests/021-string2/src/junit/framework/AssertionFailedError.java deleted file mode 100644 index e9cb3a385..000000000 --- a/tests/021-string2/src/junit/framework/AssertionFailedError.java +++ /dev/null @@ -1,13 +0,0 @@ -package junit.framework; - -/** - * Thrown when an assertion failed. - */ -public class AssertionFailedError extends Error { - - public AssertionFailedError () { - } - public AssertionFailedError (String message) { - super (message); - } -} diff --git a/tests/021-string2/src/junit/framework/ComparisonFailure.java b/tests/021-string2/src/junit/framework/ComparisonFailure.java deleted file mode 100644 index 0cb2cee91..000000000 --- a/tests/021-string2/src/junit/framework/ComparisonFailure.java +++ /dev/null @@ -1,68 +0,0 @@ -package junit.framework; - -/** - * Thrown when an assert equals for Strings failed. - * - * Inspired by a patch from Alex Chaffee mailto:alex@purpletech.com - */ -public class ComparisonFailure extends AssertionFailedError { - private String fExpected; - private String fActual; - - /** - * Constructs a comparison failure. - * @param message the identifying message or null - * @param expected the expected string value - * @param actual the actual string value - */ - public ComparisonFailure (String message, String expected, String actual) { - super (message); - fExpected= expected; - fActual= actual; - } - - /** - * Returns "..." in place of common prefix and "..." in - * place of common suffix between expected and actual. - * - * @see java.lang.Throwable#getMessage() - */ - public String getMessage() { - if (fExpected == null || fActual == null) - return Assert.format(super.getMessage(), fExpected, fActual); - - int end= Math.min(fExpected.length(), fActual.length()); - - int i= 0; - for(; i < end; i++) { - if (fExpected.charAt(i) != fActual.charAt(i)) - break; - } - int j= fExpected.length()-1; - int k= fActual.length()-1; - for (; k >= i && j >= i; k--,j--) { - if (fExpected.charAt(j) != fActual.charAt(k)) - break; - } - String actual, expected; - - // equal strings - if (j < i && k < i) { - expected= fExpected; - actual= fActual; - } else { - expected= fExpected.substring(i, j+1); - actual= fActual.substring(i, k+1); - if (i <= end && i > 0) { - expected= "..."+expected; - actual= "..."+actual; - } - - if (j < fExpected.length()-1) - expected= expected+"..."; - if (k < fActual.length()-1) - actual= actual+"..."; - } - return Assert.format(super.getMessage(), expected, actual); - } -} diff --git a/tests/022-interface/expected.txt b/tests/022-interface/expected.txt deleted file mode 100644 index 121266345..000000000 --- a/tests/022-interface/expected.txt +++ /dev/null @@ -1,2 +0,0 @@ -ImplBSub intf: 205 -ImplA: 7 diff --git a/tests/022-interface/info.txt b/tests/022-interface/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/022-interface/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/022-interface/src/Iface1.java b/tests/022-interface/src/Iface1.java deleted file mode 100644 index ba17d45f2..000000000 --- a/tests/022-interface/src/Iface1.java +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2005 The Android Open Source Project - -/** - * Test stuff. - */ -public interface Iface1 { - - public int iFunc1(int ii); - - public float mFloaty = 5.0f; - - public String mWahoo = new String("wahoo"); -} diff --git a/tests/022-interface/src/Iface2.java b/tests/022-interface/src/Iface2.java deleted file mode 100644 index 83fe6508d..000000000 --- a/tests/022-interface/src/Iface2.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Another interface. - */ -public interface Iface2 { - - public int iFunc2(int ii); -} diff --git a/tests/022-interface/src/Iface2Sub1.java b/tests/022-interface/src/Iface2Sub1.java deleted file mode 100644 index db3e905bd..000000000 --- a/tests/022-interface/src/Iface2Sub1.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Another interface. - */ -public interface Iface2Sub1 extends Iface2, Cloneable { - - //public int iFunc2(int ii); -} diff --git a/tests/022-interface/src/ImplA.java b/tests/022-interface/src/ImplA.java deleted file mode 100644 index 9007001b9..000000000 --- a/tests/022-interface/src/ImplA.java +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Blah. - */ -public class ImplA implements Iface1, Iface2 { - - public int iFunc1(int ii) { - return ii+1; - } - public int iFunc2(int ii) { - return ii+2; - } -} diff --git a/tests/022-interface/src/ImplB.java b/tests/022-interface/src/ImplB.java deleted file mode 100644 index 619fa005b..000000000 --- a/tests/022-interface/src/ImplB.java +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Blah. - */ -public class ImplB implements Iface1, Iface2 { - - public int iFunc1(int ii) { - return ii+10; - } - public int iFunc2(int ii) { - return ii+20; - } - - public static String mWhoami = new String("ImplB!"); -} diff --git a/tests/022-interface/src/ImplBSub.java b/tests/022-interface/src/ImplBSub.java deleted file mode 100644 index f3a771442..000000000 --- a/tests/022-interface/src/ImplBSub.java +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Interface test. - */ -public class ImplBSub extends ImplB implements /*Iface2,*/ Iface2Sub1 { - - public int iFunc1(int ii) { - return ii+100; - } - public int iFunc2(int ii) { - return ii+200; - } -} diff --git a/tests/022-interface/src/Main.java b/tests/022-interface/src/Main.java deleted file mode 100644 index 9151e89d1..000000000 --- a/tests/022-interface/src/Main.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * test calling through an interface - */ -public class Main { - public static void main(String args[]) { - int result = 0; - Iface2Sub1 faceObj; - ImplA faceObj2; - - faceObj = new ImplBSub(); - - result = faceObj.iFunc2(5); - System.out.print("ImplBSub intf: "); - System.out.println(result); - - faceObj2 = new ImplA(); - result = faceObj2.iFunc2(5); - System.out.print("ImplA: "); - System.out.println(result); - } -} diff --git a/tests/023-many-interfaces/build b/tests/023-many-interfaces/build deleted file mode 100644 index fc81d62d8..000000000 --- a/tests/023-many-interfaces/build +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2008 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. - -# Stop if something fails. -set -e - -# Write out a bunch of interface source files. -gcc -o iface-gen iface-gen.c -./iface-gen - -mkdir classes -${JAVAC} -d classes src/*.java - -dx --debug --dex --dump-to=classes.lst --output=classes.dex classes -zip test.jar classes.dex diff --git a/tests/023-many-interfaces/expected.txt b/tests/023-many-interfaces/expected.txt deleted file mode 100644 index c6a0c6179..000000000 --- a/tests/023-many-interfaces/expected.txt +++ /dev/null @@ -1,9 +0,0 @@ -testIface001: done -testIface049: done -testIface099: done -testVirt001: done -testVirt049: done -testVirt099: done -testInst001: done -testInst049: done -testInst099: done diff --git a/tests/023-many-interfaces/iface-gen.c b/tests/023-many-interfaces/iface-gen.c deleted file mode 100644 index 1e3284a9e..000000000 --- a/tests/023-many-interfaces/iface-gen.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Generate a big pile of interface classes. - */ -#include <stdio.h> - -/* - * Create N interface files. - */ -static int createFiles(int count) -{ - FILE* fp; - int i; - - for (i = 0; i < count; i++) { - char nameBuf[32]; - - sprintf(nameBuf, "src/Interface%03d.java", i); - fp = fopen(nameBuf, "w"); - if (fp == NULL) { - fprintf(stderr, "ERROR: unable to open %s\n", nameBuf); - return -1; - } - - fprintf(fp, "interface Interface%03d {\n", i); - if ((i & 0x01) != 0) - fprintf(fp, " int func%03d();\n", i); - fprintf(fp, "}\n"); - fclose(fp); - } - - fp = fopen("func-decl", "w"); - fprintf(fp, " implements\n"); - for (i = 0; i < count; i++) { - fprintf(fp, " Interface%03d%s\n", i, (i == count-1) ? "" : ","); - } - fprintf(fp, "\n"); - for (i = 1; i < count; i += 2) { - fprintf(fp, " public int func%03d() { return %d; }\n", i, i); - } - fclose(fp); - - return 0; -} - -int main() -{ - int result; - - result = createFiles(100); - - return (result != 0); -} diff --git a/tests/023-many-interfaces/info.txt b/tests/023-many-interfaces/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/023-many-interfaces/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/023-many-interfaces/src/Main.java b/tests/023-many-interfaces/src/Main.java deleted file mode 100644 index 666a41c9f..000000000 --- a/tests/023-many-interfaces/src/Main.java +++ /dev/null @@ -1,6 +0,0 @@ -public class Main { - static public void main(String[] args) throws Exception { - boolean timing = (args.length >= 1) && args[0].equals("--timing"); - ManyInterfaces.run(timing); - } -} diff --git a/tests/023-many-interfaces/src/ManyInterfaces.java b/tests/023-many-interfaces/src/ManyInterfaces.java deleted file mode 100644 index 375938afd..000000000 --- a/tests/023-many-interfaces/src/ManyInterfaces.java +++ /dev/null @@ -1,413 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -/* -Initial: -test001: 2039901us (4079ns per call) -test049: 3346619us (6693ns per call) -test099: 4687402us (9374ns per call) -testInst001: 1327216us (2654ns per use) -testInst049: 1326995us (2653ns per use) -testInst099: 1327735us (2655ns per use) - -After refactoring cache code: 2871ns per use -After re-refactoring cache code: 2797ns per use - -After de-inlining invoke-interface: -test001: 2164873us (4329ns per call) -test049: 3303884us (6607ns per call) -test099: 4656718us (9313ns per call) -testInst001: 1401731us (2803ns per use) -testInst049: 1401120us (2802ns per use) -testInst099: 1401298us (2802ns per use) - -After adding caching for invoke-interface: -testIface001: 1909330us (3818ns per call) -testIface049: 1905204us (3810ns per call) -testIface099: 1899012us (3798ns per call) -testVirt001: 1825001us (3650ns per call) -testVirt049: 1826161us (3652ns per call) -testVirt099: 1823915us (3647ns per call) -testInst001: 1393963us (2787ns per use) -testInst049: 1393163us (2786ns per use) -testInst099: 1390496us (2780ns per use) - -After repeating each operation 16 times inside the inner loop: -testIface001: 1429472us (2726ns per call) * 2382ns -testIface049: 1427847us (2723ns per call) * 2396ns -testIface099: 1423707us (2715ns per call) * 2387ns -testVirt001: 1277790us (2437ns per call) * 2118ns -testVirt049: 1280276us (2441ns per call) * 2119ns -testVirt099: 1272640us (2427ns per call) * 2118ns -testInst001: 844694us (1611ns per use) * 1396ns -testInst049: 845619us (1612ns per use) * 1395ns -testInst099: 845526us (1612ns per use) * 1394ns -('*' is with dx optimizations enabled) -*/ - -/** - * Semi-generated class with many interfaces. - */ -public class ManyInterfaces - implements - Interface000, - Interface001, - Interface002, - Interface003, - Interface004, - Interface005, - Interface006, - Interface007, - Interface008, - Interface009, - Interface010, - Interface011, - Interface012, - Interface013, - Interface014, - Interface015, - Interface016, - Interface017, - Interface018, - Interface019, - Interface020, - Interface021, - Interface022, - Interface023, - Interface024, - Interface025, - Interface026, - Interface027, - Interface028, - Interface029, - Interface030, - Interface031, - Interface032, - Interface033, - Interface034, - Interface035, - Interface036, - Interface037, - Interface038, - Interface039, - Interface040, - Interface041, - Interface042, - Interface043, - Interface044, - Interface045, - Interface046, - Interface047, - Interface048, - Interface049, - Interface050, - Interface051, - Interface052, - Interface053, - Interface054, - Interface055, - Interface056, - Interface057, - Interface058, - Interface059, - Interface060, - Interface061, - Interface062, - Interface063, - Interface064, - Interface065, - Interface066, - Interface067, - Interface068, - Interface069, - Interface070, - Interface071, - Interface072, - Interface073, - Interface074, - Interface075, - Interface076, - Interface077, - Interface078, - Interface079, - Interface080, - Interface081, - Interface082, - Interface083, - Interface084, - Interface085, - Interface086, - Interface087, - Interface088, - Interface089, - Interface090, - Interface091, - Interface092, - Interface093, - Interface094, - Interface095, - Interface096, - Interface097, - Interface098, - Interface099 -{ - /** whether to report timing information */ - private static boolean timing = false; - - /** - * Report on a section. - */ - private static void report(String label, long start, long end, int iter, - int rept) { - if (timing) { - System.out.println(label + ": " + (end - start) / 1000 + "us" - + " (" + (end - start) / (iter*rept) + "ns per call)"); - } else { - System.out.println(label + ": done"); - } - } - - /** - * Run tests. - * - * @param timing whether to print out timing info - */ - public static void run(boolean timing) { - ManyInterfaces.timing = timing; - ManyInterfaces obj = new ManyInterfaces(); - Interface001 one; - Interface049 forty; - Interface099 ninety; - long start, end; - int iter = 32768; - int rept = 16; - int i; - - /* - * Clear the heap. The various classes involved should already - * be loaded and ready as a result of instantiating ManyInterfaces. - */ - System.gc(); - - start = System.nanoTime(); - testIface001(obj, iter); - end = System.nanoTime(); - report("testIface001", start, end, iter, rept); - - start = System.nanoTime(); - testIface049(obj, iter); - end = System.nanoTime(); - report("testIface049", start, end, iter, rept); - - start = System.nanoTime(); - testIface099(obj, iter); - end = System.nanoTime(); - report("testIface099", start, end, iter, rept); - - start = System.nanoTime(); - testVirt001(obj, iter); - end = System.nanoTime(); - report("testVirt001", start, end, iter, rept); - - start = System.nanoTime(); - testVirt049(obj, iter); - end = System.nanoTime(); - report("testVirt049", start, end, iter, rept); - - start = System.nanoTime(); - testVirt099(obj, iter); - end = System.nanoTime(); - report("testVirt099", start, end, iter, rept); - - start = System.nanoTime(); - testInstance001(obj, iter); - end = System.nanoTime(); - report("testInst001", start, end, iter, rept); - - start = System.nanoTime(); - testInstance049(obj, iter); - end = System.nanoTime(); - report("testInst049", start, end, iter, rept); - - start = System.nanoTime(); - testInstance099(obj, iter); - end = System.nanoTime(); - report("testInst099", start, end, iter, rept); - } - - public int func001() { return 1; } - public int func003() { return 3; } - public int func005() { return 5; } - public int func007() { return 7; } - public int func009() { return 9; } - public int func011() { return 11; } - public int func013() { return 13; } - public int func015() { return 15; } - public int func017() { return 17; } - public int func019() { return 19; } - public int func021() { return 21; } - public int func023() { return 23; } - public int func025() { return 25; } - public int func027() { return 27; } - public int func029() { return 29; } - public int func031() { return 31; } - public int func033() { return 33; } - public int func035() { return 35; } - public int func037() { return 37; } - public int func039() { return 39; } - public int func041() { return 41; } - public int func043() { return 43; } - public int func045() { return 45; } - public int func047() { return 47; } - public int func049() { return 49; } - public int func051() { return 51; } - public int func053() { return 53; } - public int func055() { return 55; } - public int func057() { return 57; } - public int func059() { return 59; } - public int func061() { return 61; } - public int func063() { return 63; } - public int func065() { return 65; } - public int func067() { return 67; } - public int func069() { return 69; } - public int func071() { return 71; } - public int func073() { return 73; } - public int func075() { return 75; } - public int func077() { return 77; } - public int func079() { return 79; } - public int func081() { return 81; } - public int func083() { return 83; } - public int func085() { return 85; } - public int func087() { return 87; } - public int func089() { return 89; } - public int func091() { return 91; } - public int func093() { return 93; } - public int func095() { return 95; } - public int func097() { return 97; } - public int func099() { return 99; } - - static void testIface001(Interface001 iface, int count) { - while (count-- != 0) { - iface.func001(); iface.func001(); iface.func001(); iface.func001(); - iface.func001(); iface.func001(); iface.func001(); iface.func001(); - iface.func001(); iface.func001(); iface.func001(); iface.func001(); - iface.func001(); iface.func001(); iface.func001(); iface.func001(); - } - } - - static void testIface049(Interface049 iface, int count) { - while (count-- != 0) { - iface.func049(); iface.func049(); iface.func049(); iface.func049(); - iface.func049(); iface.func049(); iface.func049(); iface.func049(); - iface.func049(); iface.func049(); iface.func049(); iface.func049(); - iface.func049(); iface.func049(); iface.func049(); iface.func049(); - } - } - - static void testIface099(Interface099 iface, int count) { - while (count-- != 0) { - iface.func099(); iface.func099(); iface.func099(); iface.func099(); - iface.func099(); iface.func099(); iface.func099(); iface.func099(); - iface.func099(); iface.func099(); iface.func099(); iface.func099(); - iface.func099(); iface.func099(); iface.func099(); iface.func099(); - } - } - - static void testVirt001(ManyInterfaces obj, int count) { - while (count-- != 0) { - obj.func001(); obj.func001(); obj.func001(); obj.func001(); - obj.func001(); obj.func001(); obj.func001(); obj.func001(); - obj.func001(); obj.func001(); obj.func001(); obj.func001(); - obj.func001(); obj.func001(); obj.func001(); obj.func001(); - } - } - - static void testVirt049(ManyInterfaces obj, int count) { - while (count-- != 0) { - obj.func049(); obj.func049(); obj.func049(); obj.func049(); - obj.func049(); obj.func049(); obj.func049(); obj.func049(); - obj.func049(); obj.func049(); obj.func049(); obj.func049(); - obj.func049(); obj.func049(); obj.func049(); obj.func049(); - } - } - - static void testVirt099(ManyInterfaces obj, int count) { - while (count-- != 0) { - obj.func099(); obj.func099(); obj.func099(); obj.func099(); - obj.func099(); obj.func099(); obj.func099(); obj.func099(); - obj.func099(); obj.func099(); obj.func099(); obj.func099(); - obj.func099(); obj.func099(); obj.func099(); obj.func099(); - } - } - - static void testInstance001(Object obj, int count) { - if (!(obj instanceof Interface001)) - System.err.println("BAD"); - while (count-- != 0) { - boolean is; - is = obj instanceof Interface001; - is = obj instanceof Interface001; - is = obj instanceof Interface001; - is = obj instanceof Interface001; - is = obj instanceof Interface001; - is = obj instanceof Interface001; - is = obj instanceof Interface001; - is = obj instanceof Interface001; - is = obj instanceof Interface001; - is = obj instanceof Interface001; - is = obj instanceof Interface001; - is = obj instanceof Interface001; - is = obj instanceof Interface001; - is = obj instanceof Interface001; - is = obj instanceof Interface001; - is = obj instanceof Interface001; - } - } - - static void testInstance049(Object obj, int count) { - if (!(obj instanceof Interface049)) - System.err.println("BAD"); - while (count-- != 0) { - boolean is; - is = obj instanceof Interface049; - is = obj instanceof Interface049; - is = obj instanceof Interface049; - is = obj instanceof Interface049; - is = obj instanceof Interface049; - is = obj instanceof Interface049; - is = obj instanceof Interface049; - is = obj instanceof Interface049; - is = obj instanceof Interface049; - is = obj instanceof Interface049; - is = obj instanceof Interface049; - is = obj instanceof Interface049; - is = obj instanceof Interface049; - is = obj instanceof Interface049; - is = obj instanceof Interface049; - is = obj instanceof Interface049; - } - } - - static void testInstance099(Object obj, int count) { - if (!(obj instanceof Interface099)) - System.err.println("BAD"); - while (count-- != 0) { - boolean is; - is = obj instanceof Interface099; - is = obj instanceof Interface099; - is = obj instanceof Interface099; - is = obj instanceof Interface099; - is = obj instanceof Interface099; - is = obj instanceof Interface099; - is = obj instanceof Interface099; - is = obj instanceof Interface099; - is = obj instanceof Interface099; - is = obj instanceof Interface099; - is = obj instanceof Interface099; - is = obj instanceof Interface099; - is = obj instanceof Interface099; - is = obj instanceof Interface099; - is = obj instanceof Interface099; - is = obj instanceof Interface099; - } - } -} diff --git a/tests/024-illegal-access/expected.txt b/tests/024-illegal-access/expected.txt deleted file mode 100644 index 5f951f493..000000000 --- a/tests/024-illegal-access/expected.txt +++ /dev/null @@ -1,2 +0,0 @@ -Got expected failure 1 -Got expected failure 2 diff --git a/tests/024-illegal-access/info.txt b/tests/024-illegal-access/info.txt deleted file mode 100644 index 16a284dac..000000000 --- a/tests/024-illegal-access/info.txt +++ /dev/null @@ -1,3 +0,0 @@ -Test that an attempt to access a private field results in a verification -error. Also try to access a non-public class in a different package with -"instanceof". diff --git a/tests/024-illegal-access/src/CheckInstanceof.java b/tests/024-illegal-access/src/CheckInstanceof.java deleted file mode 100644 index de48cd2d2..000000000 --- a/tests/024-illegal-access/src/CheckInstanceof.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -/** - * Make sure we're performing access checks on classes used in "instanceof". - */ -public class CheckInstanceof { - public static void main(Object obj) { - if (obj instanceof otherpkg.Package) - System.out.println("yes!"); - else - System.out.println("no!"); - } -} diff --git a/tests/024-illegal-access/src/Main.java b/tests/024-illegal-access/src/Main.java deleted file mode 100644 index bde73e945..000000000 --- a/tests/024-illegal-access/src/Main.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class Main { - static public void main(String[] args) { - try { - PublicAccess.main(); - System.err.println("ERROR: call 1 not expected to succeed"); - } catch (VerifyError ve) { - // dalvik - System.out.println("Got expected failure 1"); - } catch (IllegalAccessError iae) { - // reference - System.out.println("Got expected failure 1"); - } - - try { - CheckInstanceof.main(new Object()); - System.err.println("ERROR: call 2 not expected to succeed"); - } catch (VerifyError ve) { - // dalvik - System.out.println("Got expected failure 2"); - } catch (IllegalAccessError iae) { - // reference - System.out.println("Got expected failure 2"); - } - } -} diff --git a/tests/024-illegal-access/src/PublicAccess.java b/tests/024-illegal-access/src/PublicAccess.java deleted file mode 100644 index fdc0e9e70..000000000 --- a/tests/024-illegal-access/src/PublicAccess.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Some stuff for access checks. - */ -public class PublicAccess { - public static void main() { - String shouldFail = SemiPrivate.mPrivvy; - System.out.println("Got " + shouldFail); - } -} diff --git a/tests/024-illegal-access/src/SemiPrivate.java b/tests/024-illegal-access/src/SemiPrivate.java deleted file mode 100644 index 17b2ac02f..000000000 --- a/tests/024-illegal-access/src/SemiPrivate.java +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Version with package scope access. - */ -public class SemiPrivate { - /* not private */ static String mPrivvy = "stuff"; -} diff --git a/tests/024-illegal-access/src/otherpkg/Package.java b/tests/024-illegal-access/src/otherpkg/Package.java deleted file mode 100644 index bc295b5a2..000000000 --- a/tests/024-illegal-access/src/otherpkg/Package.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -package otherpkg; - -/* - * Package-scope class (public here). - */ -public class Package { -} diff --git a/tests/024-illegal-access/src2/SemiPrivate.java b/tests/024-illegal-access/src2/SemiPrivate.java deleted file mode 100644 index cf6f8e6e1..000000000 --- a/tests/024-illegal-access/src2/SemiPrivate.java +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Version with private access. - */ -public class SemiPrivate { - private static String mPrivvy = "stuff"; -} diff --git a/tests/024-illegal-access/src2/otherpkg/Package.java b/tests/024-illegal-access/src2/otherpkg/Package.java deleted file mode 100644 index 54d834187..000000000 --- a/tests/024-illegal-access/src2/otherpkg/Package.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -package otherpkg; - -/* - * Package-scope class. - */ -class Package { -} diff --git a/tests/025-access-controller/expected.txt b/tests/025-access-controller/expected.txt deleted file mode 100644 index 75cfc9971..000000000 --- a/tests/025-access-controller/expected.txt +++ /dev/null @@ -1 +0,0 @@ -AccessControllerTest: got 39 diff --git a/tests/025-access-controller/info.txt b/tests/025-access-controller/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/025-access-controller/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/025-access-controller/src/Main.java b/tests/025-access-controller/src/Main.java deleted file mode 100644 index 84dc05771..000000000 --- a/tests/025-access-controller/src/Main.java +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -import java.security.AccessController; - -/** - * Test java.security.AccessController. - */ -public class Main { - public static void main(String[] args) { - Privvy priv = new Privvy(38); - Integer result = AccessController.doPrivileged(priv); - System.out.println("AccessControllerTest: got " + result); - } -} diff --git a/tests/025-access-controller/src/Privvy.java b/tests/025-access-controller/src/Privvy.java deleted file mode 100644 index 07a067815..000000000 --- a/tests/025-access-controller/src/Privvy.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.security.ProtectionDomain; - -class Privvy implements PrivilegedAction<Integer> { - - private Integer mValue; - - public Privvy(int val) { - mValue = new Integer(val + 1); - } - - public Integer run() { - return mValue; - } -} diff --git a/tests/026-access/expected.txt b/tests/026-access/expected.txt deleted file mode 100644 index dabfb37aa..000000000 --- a/tests/026-access/expected.txt +++ /dev/null @@ -1,2 +0,0 @@ -access test -Blort. diff --git a/tests/026-access/info.txt b/tests/026-access/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/026-access/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/026-access/src/Main.java b/tests/026-access/src/Main.java deleted file mode 100644 index 96282598f..000000000 --- a/tests/026-access/src/Main.java +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -import otherpackage.PublicAccess; - -public class Main { - public static void main(String[] args) { - System.out.println("access test"); - - PublicAccess pa = new PublicAccess(); - pa.main(); - } -} diff --git a/tests/026-access/src/otherpackage/PublicAccess.java b/tests/026-access/src/otherpackage/PublicAccess.java deleted file mode 100644 index 996fa769e..000000000 --- a/tests/026-access/src/otherpackage/PublicAccess.java +++ /dev/null @@ -1,7 +0,0 @@ -package otherpackage; - -public class PublicAccess { - static public void main() { - System.out.println("Blort."); - } -} diff --git a/tests/027-arithmetic/expected.txt b/tests/027-arithmetic/expected.txt deleted file mode 100644 index 2dadf10d9..000000000 --- a/tests/027-arithmetic/expected.txt +++ /dev/null @@ -1,18 +0,0 @@ -f=1234.5677 --> i=1234 -f=-1234.5677 --> i=-1234 -d=1234.5678 --> i=1234 -d=-1234.5678 --> i=-1234 -d=5.6789567890123E9 --> l=5678956789 -d=-5.6789567890123E9 --> l=-5678956789 -i=7654 --> l=7654 -i=-7654 --> l=-7654 -l=5678956789 --> i=1383989493 -l=-5678956789 --> i=-1383989493 -i=1234 --> f=1234.0 -i=-1234 --> f=-1234.0 -values are 44332211 and bbaa9988 -First l is bbaa998844332211 -Second l is bbaa998844332211 -shiftTest2 l is 1122334455667788 -b=-1, s=-1, c=4095, i=268435455 -b=0xffffffff, s=0xffffffff, c=0xfff, i=0xfffffff diff --git a/tests/027-arithmetic/info.txt b/tests/027-arithmetic/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/027-arithmetic/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/027-arithmetic/src/Main.java b/tests/027-arithmetic/src/Main.java deleted file mode 100644 index 4d0f74e7d..000000000 --- a/tests/027-arithmetic/src/Main.java +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Test arithmetic operations. - */ -public class Main { - - static void shiftTest1() - { - final int[] mBytes = { - 0x11, 0x22, 0x33, 0x44, 0x88, 0x99, 0xaa, 0xbb - }; - long l; - int i1, i2; - - i1 = mBytes[0] | mBytes[1] << 8 | mBytes[2] << 16 | mBytes[3] << 24; - i2 = mBytes[4] | mBytes[5] << 8 | mBytes[6] << 16 | mBytes[7] << 24; - l = i1 | ((long)i2 << 32); - - System.out.println("values are " + Integer.toHexString(i1) - + " and " + Integer.toHexString(i2)); - - System.out.println("First l is " + Long.toHexString(l)); - - l = (long)mBytes[0] - | (long)mBytes[1] << 8 - | (long)mBytes[2] << 16 - | (long)mBytes[3] << 24 - | (long)mBytes[4] << 32 - | (long)mBytes[5] << 40 - | (long)mBytes[6] << 48 - | (long)mBytes[7] << 56; - - System.out.println("Second l is " + Long.toHexString(l)); - } - - static void shiftTest2() - { - long a = 0x11; - long b = 0x22; - long c = 0x33; - long d = 0x44; - long e = 0x55; - long f = 0x66; - long g = 0x77; - long h = 0x88; - - long result = ((a << 56) | (b << 48) | (c << 40) | (d << 32) | - (e << 24) | (f << 16) | (g << 8) | h); - - System.out.println("shiftTest2 l is " + Long.toHexString(result)); - } - - static void convTest() - { - float f; - double d; - int i; - long l; - - /* float --> int */ - f = 1234.5678f; - i = (int) f; - System.out.println("f=" + f + " --> i=" + i); - - f = -1234.5678f; - i = (int) f; - System.out.println("f=" + f + " --> i=" + i); - - /* double --> int */ - d = 1234.5678; - i = (int) d; - System.out.println("d=" + d + " --> i=" + i); - - d = -1234.5678; - i = (int) d; - System.out.println("d=" + d + " --> i=" + i); - - /* double --> long */ - d = 5678956789.0123; - l = (long) d; - System.out.println("d=" + d + " --> l=" + l); - - d = -5678956789.0123; - l = (long) d; - System.out.println("d=" + d + " --> l=" + l); - - /* int --> long */ - i = 7654; - l = (long) i; - System.out.println("i=" + i + " --> l=" + l); - - i = -7654; - l = (long) i; - System.out.println("i=" + i + " --> l=" + l); - - /* long --> int (with truncation) */ - l = 5678956789L; - i = (int) l; - System.out.println("l=" + l + " --> i=" + i); - - l = -5678956789L; - i = (int) l; - System.out.println("l=" + l + " --> i=" + i); - - /* int --> float */ - i = 1234; - f = (float) i; - System.out.println("i=" + i + " --> f=" + f); - - i = -1234; - f = (float) i; - System.out.println("i=" + i + " --> f=" + f); - } - - static void unsignedShiftTest() - { - byte b = -4; - short s = -4; - char c = 0xfffc; - int i = -4; - - b >>>= 4; - s >>>= 4; - c >>>= 4; - i >>>= 4; - - System.out.println("b=" + b + ", s=" + s + ", c=" + (int)c + ", i=" +i); - System.out.println("b=0x" + Integer.toHexString((int)b) - + ", s=0x" + Integer.toHexString((int)s) - + ", c=0x" + Integer.toHexString((int)c) - + ", i=0x" + Integer.toHexString(i)); - } - - public static void main(String[] args) { - convTest(); - shiftTest1(); - shiftTest2(); - unsignedShiftTest(); - } -} diff --git a/tests/028-array-write/expected.txt b/tests/028-array-write/expected.txt deleted file mode 100644 index 85986b5eb..000000000 --- a/tests/028-array-write/expected.txt +++ /dev/null @@ -1,3 +0,0 @@ -Running writeTest... -Running copyTest... -Done! diff --git a/tests/028-array-write/info.txt b/tests/028-array-write/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/028-array-write/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/028-array-write/src/Main.java b/tests/028-array-write/src/Main.java deleted file mode 100644 index 6f36f849d..000000000 --- a/tests/028-array-write/src/Main.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -/** - * Array write speed test. - */ -public class Main { - /** whether to report times */ - static boolean timing = false; - - static final int STORAGE_SIZE = 128*1024; - static int[] mStorage = new int[STORAGE_SIZE]; - - static public void report(long start, long end) { - if (! timing) { - return; - } - - System.out.println("Finished in " + ((end - start) / 1000000.0) - + " msec"); - } - - static void writeArray(int val) { - for (int i = STORAGE_SIZE-1; i >= 0; i--) - mStorage[i] = val; - } - - static void writeTest() { - long start, end; - - writeArray(0); // touch all the memory - - System.out.println("Running writeTest..."); - start = System.nanoTime(); - for (int i = 1; i < 20; i++) - writeArray(i); - end = System.nanoTime(); - - report(start, end); - } - - static void copyTest() { - long start, end; - - // touch once - System.arraycopy(mStorage, 0, mStorage, - STORAGE_SIZE/2, STORAGE_SIZE/2); - - System.out.println("Running copyTest..."); - start = System.nanoTime(); - for (int i = 1; i < 35; i++) { - System.arraycopy(mStorage, 0, mStorage, - STORAGE_SIZE/2, STORAGE_SIZE/2); - } - end = System.nanoTime(); - - report(start, end); - } - - public static void main(String[] args) { - if ((args.length >= 1) && args[0].equals("--timing")) { - timing = true; - } - - writeTest(); - copyTest(); - System.out.println("Done!"); - } -} diff --git a/tests/029-assert/expected.txt b/tests/029-assert/expected.txt deleted file mode 100644 index bf0efeccf..000000000 --- a/tests/029-assert/expected.txt +++ /dev/null @@ -1 +0,0 @@ -caught expected assert exception diff --git a/tests/029-assert/info.txt b/tests/029-assert/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/029-assert/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/029-assert/src/Main.java b/tests/029-assert/src/Main.java deleted file mode 100644 index 3b1f8da4c..000000000 --- a/tests/029-assert/src/Main.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -/** - * Test Java language asserts. - */ -public class Main { - public static void main(String[] args) { - assert true; - try { - assert false; - System.out.println("GLITCH: didn't assert (is '-ea' set?)"); - } catch (AssertionError ae) { - System.out.println("caught expected assert exception"); - } - - // exercise this code path - ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true); - } -} diff --git a/tests/030-bad-finalizer/expected.txt b/tests/030-bad-finalizer/expected.txt deleted file mode 100644 index 88b18967d..000000000 --- a/tests/030-bad-finalizer/expected.txt +++ /dev/null @@ -1,7 +0,0 @@ -Constructed object. -Nulled. Requestion gc. -Finalizer started and spinning... -Finalizer done spinning. -Finalizer sleeping forever now. -Requesting another GC. -Requesting another GC. diff --git a/tests/030-bad-finalizer/info.txt b/tests/030-bad-finalizer/info.txt deleted file mode 100644 index 26f499376..000000000 --- a/tests/030-bad-finalizer/info.txt +++ /dev/null @@ -1,15 +0,0 @@ -The finalizer for this class never finishes. Dalvik is expected to detect -this situation and abort the VM (so you will likely see a stacktrace like -the following in the log output). - -java.util.concurrent.TimeoutException - at java.lang.VMThread.sleep(Native Method) - at java.lang.Thread.sleep(Thread.java:1031) - at java.lang.Thread.sleep(Thread.java:1013) - at BadFinalizer.snooze(BadFinalizer.java:9) - at BadFinalizer.finalize(BadFinalizer.java:29) - at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:182) - at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:168) - at java.lang.Thread.run(Thread.java:856) -Calling exit(2) - diff --git a/tests/030-bad-finalizer/src/BadFinalizer.java b/tests/030-bad-finalizer/src/BadFinalizer.java deleted file mode 100644 index 3ff422b3d..000000000 --- a/tests/030-bad-finalizer/src/BadFinalizer.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -/** - * Class with a bad finalizer. - */ -public class BadFinalizer { - public static void snooze(int ms) { - try { - Thread.sleep(ms); - } catch (InterruptedException ie) { - System.out.println("Snooze: " + ie.getMessage()); - } - } - - protected void finalize() { - System.out.println("Finalizer started and spinning..."); - int j = 0; - - /* spin for a bit */ - long start, end; - start = System.nanoTime(); - for (int i = 0; i < 1000000; i++) - j++; - end = System.nanoTime(); - System.out.println("Finalizer done spinning."); - - System.out.println("Finalizer sleeping forever now."); - while (true) { - snooze(10000); - } - } -} diff --git a/tests/030-bad-finalizer/src/Main.java b/tests/030-bad-finalizer/src/Main.java deleted file mode 100644 index db80a8711..000000000 --- a/tests/030-bad-finalizer/src/Main.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -/** - * Test a class with a bad finalizer. - */ -public class Main { - public static void main(String[] args) { - BadFinalizer bf = new BadFinalizer(); - - System.out.println("Constructed object."); - bf = null; - - System.out.println("Nulled. Requestion gc."); - System.gc(); - - for (int i = 0; i < 8; i++) { - BadFinalizer.snooze(4000); - System.out.println("Requesting another GC."); - System.gc(); - } - - System.out.println("Done waiting."); - System.exit(0); - } -} diff --git a/tests/031-class-attributes/expected.txt b/tests/031-class-attributes/expected.txt deleted file mode 100644 index 849487d4b..000000000 --- a/tests/031-class-attributes/expected.txt +++ /dev/null @@ -1,223 +0,0 @@ -public abstract final int -public abstract final [I -public java.lang.Object -public abstract final [Ljava.lang.Object; -public ClassAttrs$PublicInnerClass -public abstract final [LClassAttrs$PublicInnerClass; -protected ClassAttrs$ProtectedInnerClass -protected abstract final [LClassAttrs$ProtectedInnerClass; -private ClassAttrs$PrivateInnerClass -private abstract final [LClassAttrs$PrivateInnerClass; - ClassAttrs$PackagePrivateInnerClass -abstract final [LClassAttrs$PackagePrivateInnerClass; -***** class ClassAttrs: - name: ClassAttrs - canonical: ClassAttrs - simple: ClassAttrs - genericSignature: null - super: class java.lang.Object - genericSuperclass: class java.lang.Object - declaring: null - enclosing: null - enclosingCon: null - enclosingMeth: null - modifiers: 1 - package: null - declaredClasses: [6] class ClassAttrs$PublicMemberClass, class ClassAttrs$MemberClass, class ClassAttrs$PackagePrivateInnerClass, class ClassAttrs$PrivateInnerClass, class ClassAttrs$ProtectedInnerClass, class ClassAttrs$PublicInnerClass - member classes: [3] class ClassAttrs$PublicMemberClass, class ClassAttrs$ProtectedInnerClass, class ClassAttrs$PublicInnerClass - isAnnotation: false - isAnonymous: false - isArray: false - isEnum: false - isInterface: false - isLocalClass: false - isMemberClass: false - isPrimitive: false - isSynthetic: false - genericInterfaces: [0] - typeParameters: [0] -***** class OtherClass: - name: OtherClass - canonical: OtherClass - simple: OtherClass - genericSignature: null - super: class java.lang.Object - genericSuperclass: class java.lang.Object - declaring: null - enclosing: null - enclosingCon: null - enclosingMeth: null - modifiers: 0 - package: null - declaredClasses: [0] - member classes: [0] - isAnnotation: false - isAnonymous: false - isArray: false - isEnum: false - isInterface: false - isLocalClass: false - isMemberClass: false - isPrimitive: false - isSynthetic: false - genericInterfaces: [0] - typeParameters: [0] -***** class otherpackage.OtherPackageClass: - name: otherpackage.OtherPackageClass - canonical: otherpackage.OtherPackageClass - simple: OtherPackageClass - genericSignature: null - super: class java.lang.Object - genericSuperclass: class java.lang.Object - declaring: null - enclosing: null - enclosingCon: null - enclosingMeth: null - modifiers: 1 - package: package otherpackage - declaredClasses: [0] - member classes: [0] - isAnnotation: false - isAnonymous: false - isArray: false - isEnum: false - isInterface: false - isLocalClass: false - isMemberClass: false - isPrimitive: false - isSynthetic: false - genericInterfaces: [0] - typeParameters: [0] -***** class ClassAttrs$1InnerNamed: - name: ClassAttrs$1InnerNamed - canonical: null - simple: InnerNamed - genericSignature: null - super: class java.lang.Object - genericSuperclass: class java.lang.Object - declaring: null - enclosing: class ClassAttrs - enclosingCon: null - enclosingMeth: public static void ClassAttrs.main() - modifiers: 0 - package: null - declaredClasses: [0] - member classes: [0] - isAnnotation: false - isAnonymous: false - isArray: false - isEnum: false - isInterface: false - isLocalClass: true - isMemberClass: false - isPrimitive: false - isSynthetic: false - genericInterfaces: [0] - typeParameters: [0] -***** class ClassAttrs$1ConsInnerNamed: - name: ClassAttrs$1ConsInnerNamed - canonical: null - simple: ConsInnerNamed - genericSignature: null - super: class java.lang.Object - genericSuperclass: class java.lang.Object - declaring: null - enclosing: class ClassAttrs - enclosingCon: ClassAttrs() - enclosingMeth: null - modifiers: 0 - package: null - declaredClasses: [0] - member classes: [0] - isAnnotation: false - isAnonymous: false - isArray: false - isEnum: false - isInterface: false - isLocalClass: true - isMemberClass: false - isPrimitive: false - isSynthetic: false - genericInterfaces: [0] - typeParameters: [0] -***** class ClassAttrs$1: - name: ClassAttrs$1 - canonical: null - simple: - genericSignature: null - super: class OtherClass - genericSuperclass: class OtherClass - declaring: null - enclosing: class ClassAttrs - enclosingCon: null - enclosingMeth: public static void ClassAttrs.main() - modifiers: 8 - package: null - declaredClasses: [0] - member classes: [0] - isAnnotation: false - isAnonymous: true - isArray: false - isEnum: false - isInterface: false - isLocalClass: false - isMemberClass: false - isPrimitive: false - isSynthetic: false - genericInterfaces: [0] - typeParameters: [0] -***** class ClassAttrs$MemberClass: - name: ClassAttrs$MemberClass - canonical: ClassAttrs.MemberClass - simple: MemberClass - genericSignature: <XYZ:Ljava/lang/Object;>Ljava/lang/Object; - super: class java.lang.Object - genericSuperclass: class java.lang.Object - declaring: class ClassAttrs - enclosing: class ClassAttrs - enclosingCon: null - enclosingMeth: null - modifiers: 8 - package: null - declaredClasses: [0] - member classes: [0] - isAnnotation: false - isAnonymous: false - isArray: false - isEnum: false - isInterface: false - isLocalClass: false - isMemberClass: true - isPrimitive: false - isSynthetic: false - genericInterfaces: [0] - typeParameters: [1] XYZ -***** class FancyClass: - name: FancyClass - canonical: FancyClass - simple: FancyClass - genericSignature: <K:Ljava/lang/Object;V:Ljava/lang/Object;>Ljava/util/HashMap<TK;TV;>;Ljava/util/Map<TK;TV;>; - super: class java.util.HashMap - genericSuperclass: java.util.HashMap<K, V> - declaring: null - enclosing: null - enclosingCon: null - enclosingMeth: null - modifiers: 1 - package: null - declaredClasses: [0] - member classes: [2] class java.util.AbstractMap$SimpleEntry, class java.util.AbstractMap$SimpleImmutableEntry - isAnnotation: false - isAnonymous: false - isArray: false - isEnum: false - isInterface: false - isLocalClass: false - isMemberClass: false - isPrimitive: false - isSynthetic: false - genericInterfaces: [1] java.util.Map<K, V> - typeParameters: [2] K, V -constructor signature: (LClassAttrs$MemberClass<TXYZ;>;)V -method signature: ()Ljava/lang/Class<TXYZ;>; -field signature: LClassAttrs$MemberClass<TXYZ;>; diff --git a/tests/031-class-attributes/info.txt b/tests/031-class-attributes/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/031-class-attributes/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/031-class-attributes/src/ClassAttrs.java b/tests/031-class-attributes/src/ClassAttrs.java deleted file mode 100644 index e731c2c42..000000000 --- a/tests/031-class-attributes/src/ClassAttrs.java +++ /dev/null @@ -1,248 +0,0 @@ -import otherpackage.OtherPackageClass; - -import java.lang.reflect.AccessibleObject; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.lang.reflect.Type; -import java.lang.reflect.TypeVariable; - -public class ClassAttrs { - ClassAttrs() { - /* local, not anonymous, not member */ - class ConsInnerNamed { - public void showMe() { - printClassAttrs(this.getClass()); - } - } - - ConsInnerNamed cinner = new ConsInnerNamed(); - cinner.showMe(); - } - - public class PublicInnerClass { - } - - protected class ProtectedInnerClass { - } - - private class PrivateInnerClass { - } - - class PackagePrivateInnerClass { - } - - private static void showModifiers(Class<?> c) { - System.out.println(Modifier.toString(c.getModifiers()) + " " + c.getName()); - } - - // https://code.google.com/p/android/issues/detail?id=56267 - private static void test56267() { - // Primitive classes. - showModifiers(int.class); - showModifiers(int[].class); - - // Regular classes. - showModifiers(Object.class); - showModifiers(Object[].class); - - // Inner classes. - showModifiers(PublicInnerClass.class); - showModifiers(PublicInnerClass[].class); - showModifiers(ProtectedInnerClass.class); - showModifiers(ProtectedInnerClass[].class); - showModifiers(PrivateInnerClass.class); - showModifiers(PrivateInnerClass[].class); - showModifiers(PackagePrivateInnerClass.class); - showModifiers(PackagePrivateInnerClass[].class); - } - - public static void main() { - test56267(); - - printClassAttrs(ClassAttrs.class); - printClassAttrs(OtherClass.class); - printClassAttrs(OtherPackageClass.class); - - /* local, not anonymous, not member */ - class InnerNamed { - public void showMe() { - printClassAttrs(this.getClass()); - } - } - InnerNamed inner = new InnerNamed(); - inner.showMe(); - - ClassAttrs attrs = new ClassAttrs(); - - /* anonymous, not local, not member */ - printClassAttrs((new OtherClass() { int i = 5; }).getClass()); - - /* member, not anonymous, not local */ - printClassAttrs(MemberClass.class); - - /* fancy */ - printClassAttrs(FancyClass.class); - - try { - Constructor cons; - cons = MemberClass.class.getConstructor( - new Class[] { MemberClass.class }); - System.out.println("constructor signature: " - + getSignatureAttribute(cons)); - - Method meth; - meth = MemberClass.class.getMethod("foo", (Class[]) null); - System.out.println("method signature: " - + getSignatureAttribute(meth)); - - Field field; - field = MemberClass.class.getField("mWha"); - System.out.println("field signature: " - + getSignatureAttribute(field)); - } catch (NoSuchMethodException nsme) { - System.err.println("FAILED: " + nsme); - } catch (NoSuchFieldException nsfe) { - System.err.println("FAILED: " + nsfe); - } catch (RuntimeException re) { - System.err.println("FAILED: " + re); - re.printStackTrace(); - } - } - - /* to call the (out-of-scope) <code>getSignatureAttribute</code> methods */ - public static String getSignatureAttribute(Object obj) { - Method method; - try { - if (obj instanceof AccessibleObject) { - method = AccessibleObject.class.getDeclaredMethod( - "getSignatureAttribute"); - } else { - // Should be a Class. - method = Class.class.getDeclaredMethod( - "getSignatureAttribute"); - } - method.setAccessible(true); - } catch (NoSuchMethodException ex) { - //System.err.println("getSignatureAttribute() not defined."); - //ex.printStackTrace(); - return "<unknown>"; - } - - try { - return (String) method.invoke(obj); - } catch (IllegalAccessException ex) { - throw new RuntimeException(ex); - } catch (InvocationTargetException ex) { - throw new RuntimeException(ex); - } - } - - /* for reflection testing */ - static class MemberClass<XYZ> { - public MemberClass<XYZ> mWha; - - public MemberClass(MemberClass<XYZ> memb) { - mWha = memb; - } - - public Class<XYZ> foo() throws NoSuchMethodException { - return null; - } - } - - /* for reflection testing (getClasses vs getDeclaredClasses) */ - static public class PublicMemberClass { - float mBlah; - } - - /* - * Dump a variety of class attributes. - */ - public static void printClassAttrs(Class clazz) { - Class clazz2; - - System.out.println("***** " + clazz + ":"); - - System.out.println(" name: " - + clazz.getName()); - System.out.println(" canonical: " - + clazz.getCanonicalName()); - System.out.println(" simple: " - + clazz.getSimpleName()); - System.out.println(" genericSignature: " - + getSignatureAttribute(clazz)); - - System.out.println(" super: " - + clazz.getSuperclass()); - System.out.println(" genericSuperclass: " - + clazz.getGenericSuperclass()); - System.out.println(" declaring: " - + clazz.getDeclaringClass()); - System.out.println(" enclosing: " - + clazz.getEnclosingClass()); - System.out.println(" enclosingCon: " - + clazz.getEnclosingConstructor()); - System.out.println(" enclosingMeth: " - + clazz.getEnclosingMethod()); - System.out.println(" modifiers: " - + clazz.getModifiers()); - System.out.println(" package: " - + clazz.getPackage()); - - System.out.println(" declaredClasses: " - + stringifyTypeArray(clazz.getDeclaredClasses())); - System.out.println(" member classes: " - + stringifyTypeArray(clazz.getClasses())); - - System.out.println(" isAnnotation: " - + clazz.isAnnotation()); - System.out.println(" isAnonymous: " - + clazz.isAnonymousClass()); - System.out.println(" isArray: " - + clazz.isArray()); - System.out.println(" isEnum: " - + clazz.isEnum()); - System.out.println(" isInterface: " - + clazz.isInterface()); - System.out.println(" isLocalClass: " - + clazz.isLocalClass()); - System.out.println(" isMemberClass: " - + clazz.isMemberClass()); - System.out.println(" isPrimitive: " - + clazz.isPrimitive()); - System.out.println(" isSynthetic: " - + clazz.isSynthetic()); - - System.out.println(" genericInterfaces: " - + stringifyTypeArray(clazz.getGenericInterfaces())); - - TypeVariable<Class<?>>[] typeParameters = clazz.getTypeParameters(); - System.out.println(" typeParameters: " - + stringifyTypeArray(typeParameters)); - } - - /* - * Convert an array of Type into a string. Start with an array count. - */ - private static String stringifyTypeArray(Type[] types) { - StringBuilder stb = new StringBuilder(); - boolean first = true; - - stb.append("[" + types.length + "]"); - - for (Type t: types) { - if (first) { - stb.append(" "); - first = false; - } else { - stb.append(", "); - } - stb.append(t.toString()); - } - - return stb.toString(); - } -} diff --git a/tests/031-class-attributes/src/FancyClass.java b/tests/031-class-attributes/src/FancyClass.java deleted file mode 100644 index a58b6a623..000000000 --- a/tests/031-class-attributes/src/FancyClass.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ - -import java.util.HashMap; -import java.util.Map; - -public class FancyClass<K,V> extends HashMap<K,V> implements Map<K,V> { -} - diff --git a/tests/031-class-attributes/src/Main.java b/tests/031-class-attributes/src/Main.java deleted file mode 100644 index bc6b74987..000000000 --- a/tests/031-class-attributes/src/Main.java +++ /dev/null @@ -1,5 +0,0 @@ -public class Main { - public static void main(String[] args) { - ClassAttrs.main(); - } -} diff --git a/tests/031-class-attributes/src/OtherClass.java b/tests/031-class-attributes/src/OtherClass.java deleted file mode 100644 index 0b4526e56..000000000 --- a/tests/031-class-attributes/src/OtherClass.java +++ /dev/null @@ -1,2 +0,0 @@ -class OtherClass { -} diff --git a/tests/031-class-attributes/src/otherpackage/OtherPackageClass.java b/tests/031-class-attributes/src/otherpackage/OtherPackageClass.java deleted file mode 100644 index 9652b776a..000000000 --- a/tests/031-class-attributes/src/otherpackage/OtherPackageClass.java +++ /dev/null @@ -1,4 +0,0 @@ -package otherpackage; - -public class OtherPackageClass { -} diff --git a/tests/032-concrete-sub/expected.txt b/tests/032-concrete-sub/expected.txt deleted file mode 100644 index 56f25bb09..000000000 --- a/tests/032-concrete-sub/expected.txt +++ /dev/null @@ -1,6 +0,0 @@ -calling abs.doStuff() -In AbstractBase.doStuff (src2) -Got expected exception from abs.doStuff(). -class modifiers=1025 -meth modifiers=1025 -Got expected failure diff --git a/tests/032-concrete-sub/info.txt b/tests/032-concrete-sub/info.txt deleted file mode 100644 index 195699412..000000000 --- a/tests/032-concrete-sub/info.txt +++ /dev/null @@ -1,3 +0,0 @@ -This tests some facets of abstract method handling, notably situations -where a concrete class and its abstract superclass were compiled with -different notions about which methods are abstract. diff --git a/tests/032-concrete-sub/src/AbstractBase.java b/tests/032-concrete-sub/src/AbstractBase.java deleted file mode 100644 index 628118906..000000000 --- a/tests/032-concrete-sub/src/AbstractBase.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * Abstract base class. - */ -public abstract class AbstractBase { - public void doStuff() { - System.out.println("In AbstractBase.doStuff"); - } - - public void abstractOrNot() {} -} diff --git a/tests/032-concrete-sub/src/ConcreteSub.java b/tests/032-concrete-sub/src/ConcreteSub.java deleted file mode 100644 index 083f25dc7..000000000 --- a/tests/032-concrete-sub/src/ConcreteSub.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2007 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.Method; - -/** - * Test insertion of an abstract method in a superclass. - */ -public class ConcreteSub extends AbstractBase { - private static void callBase(AbstractBase abs) { - System.out.println("calling abs.doStuff()"); - abs.doStuff(); - } - - public static void main() { - ConcreteSub sub = new ConcreteSub(); - - try { - callBase(sub); - } catch (AbstractMethodError ame) { - System.out.println("Got expected exception from abs.doStuff()."); - } - - /* - * Check reflection stuff. - */ - Class absClass = AbstractBase.class; - Method meth; - - System.out.println("class modifiers=" + absClass.getModifiers()); - - try { - meth = absClass.getMethod("redefineMe", (Class[]) null); - } catch (NoSuchMethodException nsme) { - nsme.printStackTrace(); - return; - } - System.out.println("meth modifiers=" + meth.getModifiers()); - } -} diff --git a/tests/032-concrete-sub/src/ConcreteSub2.java b/tests/032-concrete-sub/src/ConcreteSub2.java deleted file mode 100644 index 0a9e67e18..000000000 --- a/tests/032-concrete-sub/src/ConcreteSub2.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -/** - * Test conversion of a concrete method to an abstract method. This class - * will fail verification because there is no implementation of the - * abstractOrNot() method. - */ -public class ConcreteSub2 extends AbstractBase { - public void doStuff() { - abstractOrNot(); - } -} diff --git a/tests/032-concrete-sub/src/Main.java b/tests/032-concrete-sub/src/Main.java deleted file mode 100644 index 4a5193d63..000000000 --- a/tests/032-concrete-sub/src/Main.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * Test insertion of an abstract method in a superclass. - */ -public class Main { - public static void main(String[] args) { - ConcreteSub.main(); - - try { - // Dalvik verifier stops here (VerifyError) - ConcreteSub2 blah = new ConcreteSub2(); - // other VMs fail here (AbstractMethodError) - blah.doStuff(); - System.err.println("Succeeded unexpectedly"); - } catch (VerifyError ve) { - System.out.println("Got expected failure"); - } catch (AbstractMethodError ame) { - System.out.println("Got expected failure"); - } - } -} diff --git a/tests/032-concrete-sub/src2/AbstractBase.java b/tests/032-concrete-sub/src2/AbstractBase.java deleted file mode 100644 index 534f7384b..000000000 --- a/tests/032-concrete-sub/src2/AbstractBase.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * Abstract base class. - */ -public abstract class AbstractBase { - public void doStuff() { - System.out.println("In AbstractBase.doStuff (src2)"); - redefineMe(); - } - - public abstract void redefineMe(); - - public abstract void abstractOrNot(); -} diff --git a/tests/033-class-init-deadlock/expected.txt b/tests/033-class-init-deadlock/expected.txt deleted file mode 100644 index 182d0da00..000000000 --- a/tests/033-class-init-deadlock/expected.txt +++ /dev/null @@ -1,7 +0,0 @@ -Deadlock test starting. -A initializing... -B initializing... -Deadlock test interrupting threads. -Deadlock test main thread bailing. -A initialized: false -B initialized: false diff --git a/tests/033-class-init-deadlock/info.txt b/tests/033-class-init-deadlock/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/033-class-init-deadlock/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/033-class-init-deadlock/src/Main.java b/tests/033-class-init-deadlock/src/Main.java deleted file mode 100644 index 1e3f89788..000000000 --- a/tests/033-class-init-deadlock/src/Main.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * This causes most VMs to lock up. - * - * Interrupting threads in class initialization should NOT work. - */ -public class Main { - public static boolean aInitialized = false; - public static boolean bInitialized = false; - - static public void main(String[] args) { - Thread thread1, thread2; - - System.out.println("Deadlock test starting."); - thread1 = new Thread() { public void run() { new A(); } }; - thread2 = new Thread() { public void run() { new B(); } }; - thread1.start(); - // Give thread1 a chance to start before starting thread2. - try { Thread.sleep(1000); } catch (InterruptedException ie) { } - thread2.start(); - - try { Thread.sleep(6000); } catch (InterruptedException ie) { } - - System.out.println("Deadlock test interrupting threads."); - thread1.interrupt(); - thread2.interrupt(); - System.out.println("Deadlock test main thread bailing."); - System.out.println("A initialized: " + aInitialized); - System.out.println("B initialized: " + bInitialized); - System.exit(0); - } -} - -class A { - static { - System.out.println("A initializing..."); - try { Thread.sleep(3000); } catch (InterruptedException ie) { } - new B(); - System.out.println("A initialized"); - Main.aInitialized = true; - } -} - -class B { - static { - System.out.println("B initializing..."); - try { Thread.sleep(3000); } catch (InterruptedException ie) { } - new A(); - System.out.println("B initialized"); - Main.bInitialized = true; - } -} diff --git a/tests/034-call-null/expected.txt b/tests/034-call-null/expected.txt deleted file mode 100644 index 19f86f493..000000000 --- a/tests/034-call-null/expected.txt +++ /dev/null @@ -1 +0,0 @@ -done diff --git a/tests/034-call-null/info.txt b/tests/034-call-null/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/034-call-null/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/034-call-null/src/Main.java b/tests/034-call-null/src/Main.java deleted file mode 100644 index 8fe88bdd9..000000000 --- a/tests/034-call-null/src/Main.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -public class Main { - int mFoo = 27; - - private void doStuff() { - System.out.println("mFoo is " + mFoo); - } - - public static void main(String[] args) { - Main instance = null; - try { - instance.doStuff(); - throw new RuntimeException("fail"); - } catch (NullPointerException npe) { } - - System.out.println("done"); - } -} diff --git a/tests/035-enum/expected.txt b/tests/035-enum/expected.txt deleted file mode 100644 index 50f2791b0..000000000 --- a/tests/035-enum/expected.txt +++ /dev/null @@ -1,3 +0,0 @@ -found field CRAWLING - synthetic? false - enum? true diff --git a/tests/035-enum/info.txt b/tests/035-enum/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/035-enum/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/035-enum/src/Main.java b/tests/035-enum/src/Main.java deleted file mode 100644 index 09fcc98e6..000000000 --- a/tests/035-enum/src/Main.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -import java.lang.reflect.Field; - -/** - * Try some stuff with enumerations. - */ -public class Main { - public enum Shubbery { GROUND, CRAWLING, HANGING } - - public static void main(String[] args) { - Field field; - try { - field = Shubbery.class.getDeclaredField("CRAWLING"); - } catch (NoSuchFieldException nsfe) { - throw new RuntimeException(nsfe); - } - - System.out.println("found field " + field.getName()); - System.out.println(" synthetic? " + field.isSynthetic()); - System.out.println(" enum? " + field.isEnumConstant()); - } -} diff --git a/tests/036-finalizer/expected.txt b/tests/036-finalizer/expected.txt deleted file mode 100644 index f9b29b0d5..000000000 --- a/tests/036-finalizer/expected.txt +++ /dev/null @@ -1,14 +0,0 @@ -wimp: wahoo -gc -finalizer executed: wahoo -wimp: null -finalize -wimp: null -sleep -reborn: wahoo -wimp: null -reset reborn -gc + finalize -sleep -reborn: nothing -wimp: null diff --git a/tests/036-finalizer/info.txt b/tests/036-finalizer/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/036-finalizer/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/036-finalizer/src/FinalizerTest.java b/tests/036-finalizer/src/FinalizerTest.java deleted file mode 100644 index 420ec34b8..000000000 --- a/tests/036-finalizer/src/FinalizerTest.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -import java.lang.ref.WeakReference; - -public class FinalizerTest { - public static FinalizerTest mNothing = new FinalizerTest("nothing"); - public static FinalizerTest mReborn = mNothing; - - public String mMsg = "default"; - - public FinalizerTest(String msg) { - mMsg = msg; - } - - public String toString() { - return mMsg; - } - - protected void finalize() { - System.out.println("finalizer executed: " + mMsg); - mReborn = this; - } -} diff --git a/tests/036-finalizer/src/Main.java b/tests/036-finalizer/src/Main.java deleted file mode 100644 index c29cc1148..000000000 --- a/tests/036-finalizer/src/Main.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -import java.lang.ref.WeakReference; - -/** - * Some finalizer tests. - * - * This only works if System.runFinalization() causes finalizers to run - * immediately or very soon. - */ -public class Main { - private static void snooze(int ms) { - try { - Thread.sleep(ms); - } catch (InterruptedException ie) { - System.out.println("Snooze: " + ie.getMessage()); - } - } - - public static WeakReference makeRef() { - /* - * Make ft in another thread, so there is no danger of - * a conservative reference leaking onto the main thread's - * stack. - */ - - final WeakReference[] wimp = new WeakReference[1]; - Thread t = new Thread() { - public void run() { - FinalizerTest ft = new FinalizerTest("wahoo"); - wimp[0] = new WeakReference(ft); - ft = null; - } - }; - - t.start(); - - try { - t.join(); - } catch (InterruptedException ie) { - throw new RuntimeException(ie); - } - - return wimp[0]; - } - - public static String wimpString(final WeakReference wimp) { - /* - * Do the work in another thread, so there is no danger of a - * conservative reference to ft leaking onto the main thread's - * stack. - */ - - final String[] s = new String[1]; - Thread t = new Thread() { - public void run() { - Object ref = wimp.get(); - if (ref != null) { - s[0] = ref.toString(); - } - } - }; - - t.start(); - - try { - t.join(); - } catch (InterruptedException ie) { - throw new RuntimeException(ie); - } - - return s[0]; - } - - public static void main(String[] args) { - WeakReference wimp = makeRef(); - - System.out.println("wimp: " + wimpString(wimp)); - - /* this will try to collect and finalize ft */ - System.out.println("gc"); - System.gc(); - - System.out.println("wimp: " + wimpString(wimp)); - System.out.println("finalize"); - System.runFinalization(); - System.out.println("wimp: " + wimpString(wimp)); - - System.out.println("sleep"); - snooze(1000); - - System.out.println("reborn: " + FinalizerTest.mReborn); - System.out.println("wimp: " + wimpString(wimp)); - System.out.println("reset reborn"); - System.gc(); - FinalizerTest.mReborn = FinalizerTest.mNothing; - System.out.println("gc + finalize"); - System.gc(); - System.runFinalization(); - - System.out.println("sleep"); - snooze(1000); - - System.out.println("reborn: " + FinalizerTest.mReborn); - System.out.println("wimp: " + wimpString(wimp)); - } -} diff --git a/tests/037-inherit/expected.txt b/tests/037-inherit/expected.txt deleted file mode 100644 index 1fb9912e3..000000000 --- a/tests/037-inherit/expected.txt +++ /dev/null @@ -1,3 +0,0 @@ -magic is 64.0 - 0: 64.0 - 1: 64.0 diff --git a/tests/037-inherit/info.txt b/tests/037-inherit/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/037-inherit/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/037-inherit/src/Main.java b/tests/037-inherit/src/Main.java deleted file mode 100644 index 55b782ee2..000000000 --- a/tests/037-inherit/src/Main.java +++ /dev/null @@ -1,37 +0,0 @@ -public class Main { - static void arrayCluster(IMagic[] magicArray) { - int i; - - for (i = 0; i < magicArray.length; i++) - System.out.println(" " + i + ": " + magicArray[i].getSomeData()); - } - - public static void main(String args[]) { - MagicClass magic = new MagicClass(); - - System.out.print("magic is "); - System.out.println(magic.getSomeData()); - - MagicClass magicArray[] = new MagicClass[2]; - magicArray[0] = new MagicClass(); - magicArray[1] = new MagicClass(); - arrayCluster(magicArray); - } -} - -class IntSource { - public int getMagicInt() { return 64; } -} - -interface IMagic { - public double getSomeData(); - - IntSource mIntSource = new IntSource(); - public int MAGIC_INT = mIntSource.getMagicInt(); -} - -class MagicClass implements IMagic { - public double getSomeData() { - return this.MAGIC_INT; - } -} diff --git a/tests/038-inner-null/expected.txt b/tests/038-inner-null/expected.txt deleted file mode 100644 index 29c1e420e..000000000 --- a/tests/038-inner-null/expected.txt +++ /dev/null @@ -1,2 +0,0 @@ -new Special() -done diff --git a/tests/038-inner-null/info.txt b/tests/038-inner-null/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/038-inner-null/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/038-inner-null/src/Main.java b/tests/038-inner-null/src/Main.java deleted file mode 100644 index 1239248c0..000000000 --- a/tests/038-inner-null/src/Main.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -public class Main { - public static void main(String[] args) { - Special special = new Special(); - special.callInner(); - System.out.println("done"); - } - - public static class Special { - Blort mBlort = null; - - Special() { - System.out.println("new Special()"); - } - - public void callInner() { - try { - mBlort.repaint(); - throw new RuntimeException("fail"); - } catch (NullPointerException npe) {} - } - } - - private class Blort { - public void repaint() { - System.out.println("shouldn't see this"); - } - } - -} diff --git a/tests/039-join-main/expected.txt b/tests/039-join-main/expected.txt deleted file mode 100644 index 37e6d777b..000000000 --- a/tests/039-join-main/expected.txt +++ /dev/null @@ -1,5 +0,0 @@ -Starting thread 'Joiner' -@ JoinMainSub running -JoinMain starter returning -@ JoinMainSub successfully joined main -@ JoinMainSub bailing diff --git a/tests/039-join-main/info.txt b/tests/039-join-main/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/039-join-main/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/039-join-main/src/Main.java b/tests/039-join-main/src/Main.java deleted file mode 100644 index 0644f1c43..000000000 --- a/tests/039-join-main/src/Main.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -/** - * Make sure that a sub-thread can join the main thread. - */ -public class Main { - public static void main(String[] args) { - Thread t; - - t = new Thread(new JoinMainSub(Thread.currentThread()), "Joiner"); - System.out.print("Starting thread '" + t.getName() + "'\n"); - t.start(); - - try { Thread.sleep(1000); } - catch (InterruptedException ie) {} - - System.out.print("JoinMain starter returning\n"); - } -} - -class JoinMainSub implements Runnable { - private Thread mJoinMe; - - public JoinMainSub(Thread joinMe) { - mJoinMe = joinMe; - } - - public void run() { - System.out.print("@ JoinMainSub running\n"); - - try { - mJoinMe.join(); - System.out.print("@ JoinMainSub successfully joined main\n"); - } catch (InterruptedException ie) { - System.out.print("@ JoinMainSub interrupted!\n"); - } - finally { - System.out.print("@ JoinMainSub bailing\n"); - } - } -} diff --git a/tests/040-miranda/expected.txt b/tests/040-miranda/expected.txt deleted file mode 100644 index e22bbd974..000000000 --- a/tests/040-miranda/expected.txt +++ /dev/null @@ -1,12 +0,0 @@ -MirandaClass: - inInterface: true - inInterface2: 27 - inAbstract: false -MirandaAbstract / MirandaClass: - inInterface: true - inInterface2: 27 - inAbstract: false -MirandaAbstract / MirandaClass2: - inInterface: true - inInterface2: 28 - inAbstract: true diff --git a/tests/040-miranda/info.txt b/tests/040-miranda/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/040-miranda/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/040-miranda/src/Main.java b/tests/040-miranda/src/Main.java deleted file mode 100644 index 558806ac7..000000000 --- a/tests/040-miranda/src/Main.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Miranda testing. - */ -public class Main { - public static void main(String[] args) { - MirandaClass mir = new MirandaClass(); - System.out.println("MirandaClass:"); - System.out.println(" inInterface: " + mir.inInterface()); - System.out.println(" inInterface2: " + mir.inInterface2()); - System.out.println(" inAbstract: " + mir.inAbstract()); - - /* try again through abstract class; results should be identical */ - MirandaAbstract mira = mir; - System.out.println("MirandaAbstract / MirandaClass:"); - System.out.println(" inInterface: " + mira.inInterface()); - System.out.println(" inInterface2: " + mira.inInterface2()); - System.out.println(" inAbstract: " + mira.inAbstract()); - - MirandaAbstract mira2 = new MirandaClass2(); - System.out.println("MirandaAbstract / MirandaClass2:"); - System.out.println(" inInterface: " + mira2.inInterface()); - System.out.println(" inInterface2: " + mira2.inInterface2()); - System.out.println(" inAbstract: " + mira2.inAbstract()); - } -} diff --git a/tests/040-miranda/src/MirandaAbstract.java b/tests/040-miranda/src/MirandaAbstract.java deleted file mode 100644 index b603ce67a..000000000 --- a/tests/040-miranda/src/MirandaAbstract.java +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Miranda testing. - */ -public abstract class MirandaAbstract implements MirandaInterface, MirandaInterface2 -{ - protected MirandaAbstract() { } - - //public abstract boolean inInterface(); - //public abstract int inInterface2(); - - public boolean inAbstract() { - return true; - } -} diff --git a/tests/040-miranda/src/MirandaClass.java b/tests/040-miranda/src/MirandaClass.java deleted file mode 100644 index 3bf670464..000000000 --- a/tests/040-miranda/src/MirandaClass.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Miranda testing. - */ -public class MirandaClass extends MirandaAbstract { - - public MirandaClass() {} - - public boolean inInterface() { - //System.out.println(" MirandaClass inInterface"); - return true; - } - - public int inInterface2() { - //System.out.println(" MirandaClass inInterface2"); - return 27; - } - - public boolean inAbstract() { - //System.out.println(" MirandaClass inAbstract"); - return false; - } -} diff --git a/tests/040-miranda/src/MirandaClass2.java b/tests/040-miranda/src/MirandaClass2.java deleted file mode 100644 index e9bdf2b9a..000000000 --- a/tests/040-miranda/src/MirandaClass2.java +++ /dev/null @@ -1,9 +0,0 @@ -class MirandaClass2 extends MirandaAbstract { - public boolean inInterface() { - return true; - } - - public int inInterface2() { - return 28; - } -} diff --git a/tests/040-miranda/src/MirandaInterface.java b/tests/040-miranda/src/MirandaInterface.java deleted file mode 100644 index 2c0a59a77..000000000 --- a/tests/040-miranda/src/MirandaInterface.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Miranda testing. - */ -public interface MirandaInterface { - - public boolean inInterface(); - -} diff --git a/tests/040-miranda/src/MirandaInterface2.java b/tests/040-miranda/src/MirandaInterface2.java deleted file mode 100644 index 83b6af80f..000000000 --- a/tests/040-miranda/src/MirandaInterface2.java +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Miranda testing. - */ -public interface MirandaInterface2 { - - public boolean inInterface(); - - public int inInterface2(); - -} diff --git a/tests/041-narrowing/expected.txt b/tests/041-narrowing/expected.txt deleted file mode 100644 index 93b85901c..000000000 --- a/tests/041-narrowing/expected.txt +++ /dev/null @@ -1,38 +0,0 @@ - -Double.POSITIVE_INFINITY = 7ff0000000000000 -Double.NEGATIVE_INFINITY = fff0000000000000 -Float.POSITIVE_INFINITY = 7ff0000000000000 -Float.NEGATIVE_INFINITY = fff0000000000000 -Double.NaN = 7ff8000000000000 -Float.NaN = 7ff8000000000000 - -(byte) Double.NaN = 00 expected: 00 -(short) Double.NaN = 0000 expected: 0000 -(int) Double.NaN = 00000000 expected: 00000000 -(long) Double.NaN = 0000000000000000 expected: 0000000000000000 - -(byte) Float.NaN = 00 expected: 00 -(short) Float.NaN = 0000 expected: 0000 -(int) Float.NaN = 00000000 expected: 00000000 -(long) Float.NaN = 0000000000000000 expected: 0000000000000000 - -(byte) Double.POSITIVE_INFINITY = ff expected: ff -(short) Double.POSITIVE_INFINITY = ffff expected: ffff -(int) Double.POSITIVE_INFINITY = 7fffffff expected: 7fffffff -(long) Double.POSITIVE_INFINITY = 7fffffffffffffff expected: 7fffffffffffffff - -(byte) Double.NEGATIVE_INFINITY = 00 expected: 00 -(short) Double.NEGATIVE_INFINITY = 0000 expected: 0000 -(int) Double.NEGATIVE_INFINITY = 80000000 expected: 80000000 -(long) Double.NEGATIVE_INFINITY = 8000000000000000 expected: 8000000000000000 - -(byte) Float.POSITIVE_INFINITY = ff expected: ff -(short) Float.POSITIVE_INFINITY = ffff expected: ffff -(int) Float.POSITIVE_INFINITY = 7fffffff expected: 7fffffff -(long) Float.POSITIVE_INFINITY = 7fffffffffffffff expected: 7fffffffffffffff - -(byte) Float.NEGATIVE_INFINITY = 00 expected: 00 -(short) Float.NEGATIVE_INFINITY = 0000 expected: 0000 -(int) Float.NEGATIVE_INFINITY = 80000000 expected: 80000000 -(long) Float.NEGATIVE_INFINITY = 8000000000000000 expected: 8000000000000000 - diff --git a/tests/041-narrowing/info.txt b/tests/041-narrowing/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/041-narrowing/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/041-narrowing/src/Main.java b/tests/041-narrowing/src/Main.java deleted file mode 100644 index eb9d64a33..000000000 --- a/tests/041-narrowing/src/Main.java +++ /dev/null @@ -1,99 +0,0 @@ -public class Main { - public static void main(String[] args) { - test_printNarrowing(); - } - - public static void test_printNarrowing() { - - System.out.println(); - System.out.println("Double.POSITIVE_INFINITY = " - + Long.toHexString(Double.doubleToRawLongBits(Double.POSITIVE_INFINITY))); - System.out.println("Double.NEGATIVE_INFINITY = " - + Long.toHexString(Double.doubleToRawLongBits(Double.NEGATIVE_INFINITY))); - System.out.println("Float.POSITIVE_INFINITY = " - + Long.toHexString(Double.doubleToRawLongBits(Float.POSITIVE_INFINITY))); - System.out.println("Float.NEGATIVE_INFINITY = " - + Long.toHexString(Double.doubleToRawLongBits(Float.NEGATIVE_INFINITY))); - System.out.println("Double.NaN = " - + Long.toHexString(Double.doubleToRawLongBits(Double.NaN))); - System.out.println("Float.NaN = " - + Long.toHexString(Double.doubleToRawLongBits(Float.NaN))); - double dbl2 = Double.NaN; - System.out.println(); - System.out.println("(byte) Double.NaN = " - + (Long.toHexString((byte)dbl2).equals("0") ? "00" : Long.toHexString((byte)dbl2) - .substring(6)) + " expected: 00"); - System.out.println("(short) Double.NaN = " - + (Integer.toHexString((short)dbl2).equals("0") ? "0000" : Integer.toHexString( - (short)dbl2).substring(4)) + " expected: 0000"); - System.out.println("(int) Double.NaN = " - + (Integer.toHexString((int)dbl2).equals("0") ? "00000000" : Integer - .toHexString((int)dbl2)) + " expected: 00000000"); - System.out.println("(long) Double.NaN = " - + (Long.toHexString((long)dbl2).equals("0") ? "0000000000000000" : Long - .toHexString((long)dbl2)) + " expected: 0000000000000000"); - float fl2 = Float.NaN; - System.out.println(); - System.out.println("(byte) Float.NaN = " - + (Long.toHexString((byte)fl2).equals("0") ? "00" : Long.toHexString((byte)fl2) - .substring(6)) + " expected: 00"); - System.out.println("(short) Float.NaN = " - + (Integer.toHexString((short)fl2).equals("0") ? "0000" : Integer.toHexString( - (short)fl2).substring(4)) + " expected: 0000"); - System.out.println("(int) Float.NaN = " - + (Integer.toHexString((int)fl2).equals("0") ? "00000000" : Integer - .toHexString((int)fl2)) + " expected: 00000000"); - System.out.println("(long) Float.NaN = " - + (Long.toHexString((long)fl2).equals("0") ? "0000000000000000" : Long - .toHexString((long)fl2)) + " expected: 0000000000000000"); - double dbl3 = Double.POSITIVE_INFINITY; - System.out.println(); - System.out.println("(byte) Double.POSITIVE_INFINITY = " - + (Integer.toHexString((byte)dbl3).equals("0") ? "00" : Integer.toHexString( - (byte)dbl3).substring(6)) + " expected: ff"); - System.out.println("(short) Double.POSITIVE_INFINITY = " - + (Integer.toHexString((short)dbl3).equals("0") ? "0000" : Integer.toHexString( - (short)dbl3).substring(4)) + " expected: ffff"); - System.out.println("(int) Double.POSITIVE_INFINITY = " - + Integer.toHexString((int)dbl3) + " expected: 7fffffff"); - System.out.println("(long) Double.POSITIVE_INFINITY = " + Long.toHexString((long)dbl3) - + " expected: 7fffffffffffffff"); - double dbl4 = Double.NEGATIVE_INFINITY; - System.out.println(); - System.out.println("(byte) Double.NEGATIVE_INFINITY = " - + (Long.toHexString((byte)dbl4).equals("0") ? " 00" : Long - .toHexString((byte)dbl4)) + " expected: 00"); - System.out.println("(short) Double.NEGATIVE_INFINITY = " - + (Integer.toHexString((short)dbl4).equals("0") ? " 0000" : Long - .toHexString((short)dbl4)) + " expected: 0000"); - System.out.println("(int) Double.NEGATIVE_INFINITY = " - + Integer.toHexString((int)dbl4) + " expected: 80000000"); - System.out.println("(long) Double.NEGATIVE_INFINITY = " + Long.toHexString((long)dbl4) - + " expected: 8000000000000000"); - float fl3 = Float.POSITIVE_INFINITY; - System.out.println(); - System.out.println("(byte) Float.POSITIVE_INFINITY = " - + (Integer.toHexString((byte)fl3).equals("0") ? "00" : Integer.toHexString( - (byte)fl3).substring(6)) + " expected: ff"); - System.out.println("(short) Float.POSITIVE_INFINITY = " - + (Integer.toHexString((short)fl3).equals("0") ? "0000" : Integer.toHexString( - (short)fl3).substring(4)) + " expected: ffff"); - System.out.println("(int) Float.POSITIVE_INFINITY = " - + Integer.toHexString((int)fl3) + " expected: 7fffffff"); - System.out.println("(long) Float.POSITIVE_INFINITY = " + Long.toHexString((long)fl3) - + " expected: 7fffffffffffffff"); - float fl4 = Float.NEGATIVE_INFINITY; - System.out.println(); - System.out.println("(byte) Float.NEGATIVE_INFINITY = " - + (Long.toHexString((byte)fl4).equals("0") ? " 00" : Long - .toHexString((byte)fl4)) + " expected: 00"); - System.out.println("(short) Float.NEGATIVE_INFINITY = " - + (Integer.toHexString((short)fl4).equals("0") ? " 0000" : Long - .toHexString((short)fl4)) + " expected: 0000"); - System.out.println("(int) Float.NEGATIVE_INFINITY = " - + Integer.toHexString((int)fl4) + " expected: 80000000"); - System.out.println("(long) Float.NEGATIVE_INFINITY = " + Long.toHexString((long)fl4) - + " expected: 8000000000000000"); - System.out.println(); - } -} diff --git a/tests/042-new-instance/expected.txt b/tests/042-new-instance/expected.txt deleted file mode 100644 index bb1b80c12..000000000 --- a/tests/042-new-instance/expected.txt +++ /dev/null @@ -1,9 +0,0 @@ -LocalClass succeeded -Got expected PackageAccess complaint -LocalClass3 succeeded -Got expected InstantationError -Cons LocalClass failed as expected -Cons LocalClass2 succeeded -Cons got expected PackageAccess complaint -Cons got expected InstantationException -Cons got expected PackageAccess2 complaint diff --git a/tests/042-new-instance/info.txt b/tests/042-new-instance/info.txt deleted file mode 100644 index 49c9e0285..000000000 --- a/tests/042-new-instance/info.txt +++ /dev/null @@ -1,2 +0,0 @@ -Test various permutations of Class.newInstance and Constructor.newInstance, -looking for correct handling of access rights and abstract classes. diff --git a/tests/042-new-instance/src/Main.java b/tests/042-new-instance/src/Main.java deleted file mode 100644 index e43c5a568..000000000 --- a/tests/042-new-instance/src/Main.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (C) 2007 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.Constructor; - -/** - * Test instance creation. - */ -public class Main { - private static boolean FULL_ACCESS_CHECKS = false; // b/5861201 - - public static void main(String[] args) { - testClassNewInstance(); - testConstructorNewInstance(); - } - - /** - * Tests Class.newInstance(). - */ - static void testClassNewInstance() { - // should succeed - try { - Class c = Class.forName("LocalClass"); - Object obj = c.newInstance(); - System.out.println("LocalClass succeeded"); - } catch (Exception ex) { - System.err.println("LocalClass failed"); - ex.printStackTrace(); - } - - // should fail - try { - Class c = Class.forName("otherpackage.PackageAccess"); - Object obj = c.newInstance(); - System.err.println("ERROR: PackageAccess succeeded unexpectedly"); - } catch (IllegalAccessException iae) { - System.out.println("Got expected PackageAccess complaint"); - } catch (Exception ex) { - System.err.println("Got unexpected PackageAccess failure"); - ex.printStackTrace(); - } - - LocalClass3.main(); - - try { - MaybeAbstract ma = new MaybeAbstract(); - System.err.println("ERROR: MaybeAbstract succeeded unexpectedly"); - } catch (InstantiationError ie) { - System.out.println("Got expected InstantationError"); - } catch (Exception ex) { - System.err.println("Got unexpected MaybeAbstract failure"); - } - } - - /** - * Tests Constructor.newInstance(). - */ - static void testConstructorNewInstance() { - // should fail -- getConstructor only returns public constructors - try { - Class c = Class.forName("LocalClass"); - Constructor cons = c.getConstructor(new Class[0] /*(Class[])null*/); - System.err.println("Cons LocalClass succeeded unexpectedly"); - } catch (NoSuchMethodException nsme) { - System.out.println("Cons LocalClass failed as expected"); - } catch (Exception ex) { - System.err.println("Cons LocalClass failed strangely"); - ex.printStackTrace(); - } - - // should succeed - try { - Class c = Class.forName("LocalClass2"); - Constructor cons = c.getConstructor((Class[]) null); - Object obj = cons.newInstance(); - System.out.println("Cons LocalClass2 succeeded"); - } catch (Exception ex) { - System.err.println("Cons LocalClass2 failed"); - ex.printStackTrace(); - } - - // should fail - try { - Class c = Class.forName("otherpackage.PackageAccess"); - Constructor cons = c.getConstructor(new Class[0] /*(Class[])null*/); - System.err.println("ERROR: Cons PackageAccess succeeded unexpectedly"); - } catch (NoSuchMethodException nsme) { - // constructor isn't public - System.out.println("Cons got expected PackageAccess complaint"); - } catch (Exception ex) { - System.err.println("Cons got unexpected PackageAccess failure"); - ex.printStackTrace(); - } - - // should fail - try { - Class c = Class.forName("MaybeAbstract"); - Constructor cons = c.getConstructor(new Class[0] /*(Class[])null*/); - Object obj = cons.newInstance(); - System.err.println("ERROR: Cons MaybeAbstract succeeded unexpectedly"); - } catch (InstantiationException ie) { - // note InstantiationException vs. InstantiationError - System.out.println("Cons got expected InstantationException"); - } catch (Exception ex) { - System.err.println("Cons got unexpected MaybeAbstract failure"); - ex.printStackTrace(); - } - - // should fail - try { - Class c = Class.forName("otherpackage.PackageAccess2"); - Constructor cons = c.getConstructor((Class[]) null); - if (!FULL_ACCESS_CHECKS) { throw new IllegalAccessException(); } - Object obj = cons.newInstance(); - System.err.println("ERROR: Cons PackageAccess2 succeeded unexpectedly"); - } catch (IllegalAccessException iae) { - // constructor is public, but class has package scope - System.out.println("Cons got expected PackageAccess2 complaint"); - } catch (Exception ex) { - System.err.println("Cons got unexpected PackageAccess2 failure"); - ex.printStackTrace(); - } - - } -} - -class LocalClass { - // this class has a default constructor with package visibility -} - -class LocalClass2 { - public LocalClass2() {} -} - - -class LocalClass3 { - public static void main() { - try { - CC.newInstance(); - System.out.println("LocalClass3 succeeded"); - } catch (Exception ex) { - System.err.println("Got unexpected LocalClass3 failure"); - ex.printStackTrace(); - } - } - - static class CC { - private CC() {} - - static Object newInstance() { - try { - Class c = CC.class; - return c.newInstance(); - } catch (Exception ex) { - ex.printStackTrace(); - return null; - } - } - } -} diff --git a/tests/042-new-instance/src/MaybeAbstract.java b/tests/042-new-instance/src/MaybeAbstract.java deleted file mode 100644 index 6d3b05bb3..000000000 --- a/tests/042-new-instance/src/MaybeAbstract.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public /*abstract*/ class MaybeAbstract { - public MaybeAbstract() {} - int foo() { return 0; } -} diff --git a/tests/042-new-instance/src/otherpackage/PackageAccess.java b/tests/042-new-instance/src/otherpackage/PackageAccess.java deleted file mode 100644 index f4541f20c..000000000 --- a/tests/042-new-instance/src/otherpackage/PackageAccess.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -package otherpackage; - -class PackageAccess { - /*package*/ PackageAccess() { - System.out.println("created PackageAccess"); - } -} - -class PackageAccess2 { - public PackageAccess2() { - System.out.println("created PackageAccess2"); - } -} diff --git a/tests/042-new-instance/src2/MaybeAbstract.java b/tests/042-new-instance/src2/MaybeAbstract.java deleted file mode 100644 index 8b70a0712..000000000 --- a/tests/042-new-instance/src2/MaybeAbstract.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public abstract class MaybeAbstract { - public MaybeAbstract() {} - int foo() { return 0; } -} diff --git a/tests/043-privates/expected.txt b/tests/043-privates/expected.txt deleted file mode 100644 index 2779ec746..000000000 --- a/tests/043-privates/expected.txt +++ /dev/null @@ -1,6 +0,0 @@ -PrivatePackage --> PrivatePackage! -PrivatePackage --> PrivatePackage! -PrivatePackage --> PrivatePackage! -PrivatePackageSub --> PrivatePackageSub! -PrivatePackage --> PrivatePackage! -PrivatePackage --> PrivatePackage! diff --git a/tests/043-privates/info.txt b/tests/043-privates/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/043-privates/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/043-privates/src/Main.java b/tests/043-privates/src/Main.java deleted file mode 100644 index 73b4d79cb..000000000 --- a/tests/043-privates/src/Main.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -/** - * Make sure private methods don't inherit. - */ -public class Main { - public static void main(String args[]) { - PrivatePackage inst1 = new PrivatePackage(); - PrivatePackage inst2 = new PrivatePackageSub(); - PrivatePackageSub inst3 = new PrivatePackageSub(); - - System.out.println("PrivatePackage --> " + inst1.getStr()); - System.out.println("PrivatePackage --> " + inst2.getStr()); - System.out.println("PrivatePackage --> " + inst3.getStr()); - System.out.println("PrivatePackageSub --> " + inst3.getStrSub()); - - inst1.stretchTest(); - } -} - -class PrivatePackage { - public String getStr() { - return privGetStr(); - } - - private String privGetStr() { - return "PrivatePackage!"; - } - - public void stretchTest() { - PrivatePackage inst = new PrivatePackageSub(); - System.out.println("PrivatePackage --> " + inst.getStr()); - System.out.println("PrivatePackage --> " + inst.privGetStr()); - } -} - -class PrivatePackageSub extends PrivatePackage { - public String getStrSub() { - return privGetStr(); - } - - private String privGetStr() { - return "PrivatePackageSub!"; - } -} diff --git a/tests/044-proxy/expected.txt b/tests/044-proxy/expected.txt deleted file mode 100644 index 4be26cf71..000000000 --- a/tests/044-proxy/expected.txt +++ /dev/null @@ -1,80 +0,0 @@ -Invoke public abstract void Shapes.circle(int) - 0: 3 ---- circle 3 -Success: method circle res=null -Invoke public abstract int Quads.rectangle(int,int) - 0: 10 - 1: 20 ---- rectangle 10,20 -Success: method rectangle res=4 -Invoke public abstract java.lang.String Shapes.blob() - (no args) ---- blob -Success: method blob res=mix -Invoke public abstract int Quads.rectangle(int,int) - 0: 15 - 1: 25 ---- rectangle 15,25 -Success: method rectangle res=4 -Invoke public abstract int Quads.trapezoid(int,double,int) - 0: 6 - 1: 81.18 - 2: 4 ---- trap 6,4,81.18 -Success: method trapezoid res=8 -Invoke public abstract int Colors.red(float) - 0: 1.0 ---- red 1.0 -Success: method red res=0 -Invoke public abstract double Colors.blue(int) - 0: 777 ---- blue 777 -Success: method blue res=2.54 -Invoke public abstract int Colors.mauve(java.lang.String) - 0: sorry ---- mauve sorry -Success: method mauve res=3 -Invoke public abstract java.lang.String Shapes.blob() - (no args) ---- blob -Success: method blob res=mix -Invoke public abstract void Shapes.upChuck() - (no args) -Got expected ioobe -Invoke public abstract void Shapes.upCheck() throws java.lang.InterruptedException - (no args) -Got expected ie - -Proxy methods: [public native boolean $Proxy0.equals(java.lang.Object), public native int $Proxy0.hashCode(), public native java.lang.String $Proxy0.toString(), public native int $Proxy0.rectangle(int,int), public native int $Proxy0.square(int,int), public native int $Proxy0.trapezoid(int,double,int), public native java.lang.String $Proxy0.blob(), public native void $Proxy0.circle(int), public native void $Proxy0.upCheck(), public native void $Proxy0.upChuck(), public native double $Proxy0.blue(int), public native R0aa $Proxy0.checkMe(), public native int $Proxy0.green(double), public native int $Proxy0.mauve(java.lang.String), public native int $Proxy0.red(float)] -Decl annos: [] -Param annos (1) : [[]] -Proxy fields: [private static java.lang.Throwable[][] $Proxy0.throws] -Dupe threw expected exception -Clash threw expected exception -Clash2 threw expected exception -Clash3 threw expected exception -Clash4 threw expected exception -Invoke public abstract void InterfaceW1.throwFunky() - (no args) -Got expected UTE -Invoke public abstract void InterfaceW1.throwFunky2() throws BaseException,java.lang.NoSuchMethodException,java.io.IOException - (no args) -Got expected IOE -Invoke public abstract void InterfaceW1.throwFunky2() throws BaseException,java.lang.NoSuchMethodException,java.io.IOException - (no args) -Got expected IOE -Invoke public abstract void InterfaceW1.throwException() throws BaseException - (no args) -Got expected UTE -Invoke public abstract void InterfaceW1.throwBase() throws BaseException - (no args) -Got expected UTE -Invoke public abstract void InterfaceW1.throwSub() throws BaseException - (no args) -Got expected exception -Invoke public abstract void InterfaceW1.throwSubSub() throws BaseException - (no args) -Got expected exception -Invoke public abstract void InterfaceW1.bothThrowBase() throws BaseException,SubException,SubSubException - (no args) -Got expected exception diff --git a/tests/044-proxy/info.txt b/tests/044-proxy/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/044-proxy/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/044-proxy/src/BasicTest.java b/tests/044-proxy/src/BasicTest.java deleted file mode 100644 index 2a453c47f..000000000 --- a/tests/044-proxy/src/BasicTest.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (C) 2008 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.annotation.Annotation; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.Arrays; - -/** - * Do some basic tests. - */ -public class BasicTest { - - public static void main(String[] args) { - Mix proxyMe = new Mix(); - Object proxy = createProxy(proxyMe); - - if (!Proxy.isProxyClass(proxy.getClass())) - System.err.println("not a proxy class?"); - if (Proxy.getInvocationHandler(proxy) == null) - System.err.println("ERROR: Proxy.getInvocationHandler is null"); - - /* take it for a spin; verifies instanceof constraint */ - Shapes shapes = (Shapes) proxy; - shapes.circle(3); - shapes.rectangle(10, 20); - shapes.blob(); - Quads quads = (Quads) proxy; - quads.rectangle(15, 25); - quads.trapezoid(6, 81.18, 4); - Colors colors = (Colors) proxy; - colors.red(1.0f); - colors.blue(777); - colors.mauve("sorry"); - colors.blob(); - - try { - shapes.upChuck(); - System.out.println("Didn't get expected exception"); - } catch (IndexOutOfBoundsException ioobe) { - System.out.println("Got expected ioobe"); - } - try { - shapes.upCheck(); - System.out.println("Didn't get expected exception"); - } catch (InterruptedException ie) { - System.out.println("Got expected ie"); - } - - /* - * Exercise annotations on Proxy classes. This is mostly to ensure - * that annotation calls work correctly on generated classes. - */ - System.out.println(""); - Method[] methods = proxy.getClass().getDeclaredMethods(); - System.out.println("Proxy methods: " + Arrays.deepToString(methods)); - Method meth = methods[methods.length -1]; - System.out.println("Decl annos: " + Arrays.deepToString(meth.getDeclaredAnnotations())); - Annotation[][] paramAnnos = meth.getParameterAnnotations(); - System.out.println("Param annos (" + paramAnnos.length + ") : " - + Arrays.deepToString(paramAnnos)); - Field[] fields = proxy.getClass().getDeclaredFields(); - System.out.println("Proxy fields: " + Arrays.deepToString(fields)); - } - - static Object createProxy(Object proxyMe) { - /* declare an object that will handle the method calls */ - InvocationHandler handler = new MyInvocationHandler(proxyMe); - - /* create the proxy class */ - Class proxyClass = Proxy.getProxyClass(Shapes.class.getClassLoader(), - new Class[] { Quads.class, Colors.class }); - - /* create a proxy object, passing the handler object in */ - Object proxy = null; - try { - Constructor<Class> cons; - cons = proxyClass.getConstructor( - new Class[] { InvocationHandler.class }); - //System.out.println("Constructor is " + cons); - proxy = cons.newInstance(new Object[] { handler }); - } catch (NoSuchMethodException nsme) { - System.err.println("failed: " + nsme); - } catch (InstantiationException ie) { - System.err.println("failed: " + ie); - } catch (IllegalAccessException ie) { - System.err.println("failed: " + ie); - } catch (InvocationTargetException ite) { - System.err.println("failed: " + ite); - } - - return proxy; - } -} - -/* - * Some interfaces. - */ -interface Shapes { - public void circle(int r); - public int rectangle(int x, int y); - - public String blob(); - - public R0base checkMe(); - public void upChuck(); - public void upCheck() throws InterruptedException; -} - -interface Quads extends Shapes { - public int rectangle(int x, int y); - public int square(int x, int y); - public int trapezoid(int x, double off, int y); - - public R0a checkMe(); -} - -/* - * More interfaces. - */ -interface Colors { - public int red(float howRed); - public int green(double howGreen); - public double blue(int howBlue); - public int mauve(String apology); - - public String blob(); - - public R0aa checkMe(); -} - -/* - * Some return types. - */ -class R0base { int mBlah; } -class R0a extends R0base { int mBlah_a; } -class R0aa extends R0a { int mBlah_aa; } - - -/* - * A class that implements them all. - */ -class Mix implements Quads, Colors { - public void circle(int r) { - System.out.println("--- circle " + r); - } - public int rectangle(int x, int y) { - System.out.println("--- rectangle " + x + "," + y); - return 4; - } - public int square(int x, int y) { - System.out.println("--- square " + x + "," + y); - return 4; - } - public int trapezoid(int x, double off, int y) { - System.out.println("--- trap " + x + "," + y + "," + off); - return 8; - } - public String blob() { - System.out.println("--- blob"); - return "mix"; - } - - public int red(float howRed) { - System.out.println("--- red " + howRed); - return 0; - } - public int green(double howGreen) { - System.out.println("--- green " + howGreen); - return 1; - } - public double blue(int howBlue) { - System.out.println("--- blue " + howBlue); - return 2.54; - } - public int mauve(String apology) { - System.out.println("--- mauve " + apology); - return 3; - } - - public R0aa checkMe() { - return null; - } - public void upChuck() { - throw new IndexOutOfBoundsException("upchuck"); - } - public void upCheck() throws InterruptedException { - throw new InterruptedException("upcheck"); - } -} - -/* - * Invocation handler, defining the implementation of the proxy functions. - */ -class MyInvocationHandler implements InvocationHandler { - Object mObj; - - public MyInvocationHandler(Object obj) { - mObj = obj; - } - - /* - * This is called when anything gets invoked in the proxy object. - */ - public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable { - - Object result = null; - - // Trap Object calls. This is important here to avoid a recursive - // invocation of toString() in the print statements below. - if (method.getDeclaringClass() == java.lang.Object.class) { - //System.out.println("!!! object " + method.getName()); - if (method.getName().equals("toString")) - return super.toString(); - else if (method.getName().equals("hashCode")) - return Integer.valueOf(super.hashCode()); - else if (method.getName().equals("equals")) - return Boolean.valueOf(super.equals(args[0])); - else - throw new RuntimeException("huh?"); - } - - System.out.println("Invoke " + method); - if (args == null || args.length == 0) { - System.out.println(" (no args)"); - } else { - for (int i = 0; i < args.length; i++) - System.out.println(" " + i + ": " + args[i]); - } - - try { - if (true) - result = method.invoke(mObj, args); - else - result = -1; - System.out.println("Success: method " + method.getName() - + " res=" + result); - } catch (InvocationTargetException ite) { - throw ite.getTargetException(); - } catch (IllegalAccessException iae) { - throw new RuntimeException(iae); - } - return result; - } -} diff --git a/tests/044-proxy/src/Clash.java b/tests/044-proxy/src/Clash.java deleted file mode 100644 index adeffdcf1..000000000 --- a/tests/044-proxy/src/Clash.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2008 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.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; - -/* - * Try to instantiate a proxy class with interfaces that have conflicting - * duplicate methods (primitive vs. object). - */ -public class Clash { - public static void main(String[] args) { - InvocationHandler handler = new ClashInvocationHandler(); - - /* try passing in the same interface twice */ - try { - Proxy.newProxyInstance(Clash.class.getClassLoader(), - new Class[] { Interface1A.class, Interface1A.class }, - handler); - System.err.println("Dupe did not throw expected exception"); - } catch (IllegalArgumentException iae) { - System.out.println("Dupe threw expected exception"); - } - - try { - Proxy.newProxyInstance(Clash.class.getClassLoader(), - new Class[] { Interface1A.class, Interface1B.class }, - handler); - System.err.println("Clash did not throw expected exception"); - } catch (IllegalArgumentException iae) { - System.out.println("Clash threw expected exception"); - } - } -} - -interface Interface1A { - public int thisIsOkay(); - - public float thisIsTrouble(); -} - -interface Interface1B { - public int thisIsOkay(); - - public Object thisIsTrouble(); -} - -class ClashInvocationHandler implements InvocationHandler { - /* don't really need to do anything -- should never get this far */ - public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable { - - return null; - } -} diff --git a/tests/044-proxy/src/Clash2.java b/tests/044-proxy/src/Clash2.java deleted file mode 100644 index 2a384f417..000000000 --- a/tests/044-proxy/src/Clash2.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2008 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.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; - -/* - * Try to instantiate a proxy class with interfaces that have conflicting - * duplicate methods (primitive types). - */ -public class Clash2 { - public static void main(String[] args) { - InvocationHandler handler = new Clash2InvocationHandler(); - - try { - Proxy.newProxyInstance(Clash.class.getClassLoader(), - new Class[] { Interface2A.class, Interface2B.class }, - handler); - System.err.println("Clash2 did not throw expected exception"); - } catch (IllegalArgumentException iae) { - System.out.println("Clash2 threw expected exception"); - } - } -} - -interface Interface2A { - public int thisIsOkay(); - - public int thisIsTrouble(); -} - -interface Interface2B { - public int thisIsOkay(); - - public short thisIsTrouble(); -} - -class Clash2InvocationHandler implements InvocationHandler { - /* don't really need to do anything -- should never get this far */ - public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable { - - return null; - } -} diff --git a/tests/044-proxy/src/Clash3.java b/tests/044-proxy/src/Clash3.java deleted file mode 100644 index 6d6f2f296..000000000 --- a/tests/044-proxy/src/Clash3.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2008 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.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; - -/* - * Try to instantiate a proxy class with interfaces that have conflicting - * duplicate methods (type tree with interface). - */ -public class Clash3 { - public static void main(String[] args) { - InvocationHandler handler = new Clash3InvocationHandler(); - - try { - Proxy.newProxyInstance(Clash.class.getClassLoader(), - new Class[] { - Interface3a.class, - Interface3base.class, - Interface3aa.class, - Interface3b.class }, - handler); - System.err.println("Clash3 did not throw expected exception"); - } catch (IllegalArgumentException iae) { - System.out.println("Clash3 threw expected exception"); - } - } -} - -class R3base implements I3 { int mBlah; public void x() {} } -class R3a extends R3base { int mBlah_a; } -class R3aa extends R3a { int mBlah_aa; } -class R3b implements I3 { int mBlah_b; public void x() {} } - -interface I3 { - void x(); -} - -interface Interface3base { - public R3base thisIsTrouble(); -} - -interface Interface3a { - public R3a thisIsTrouble(); -} -interface Interface3aa { - public R3aa thisIsTrouble(); -} -interface Interface3b { - public R3b thisIsTrouble(); -} - -class Clash3InvocationHandler implements InvocationHandler { - /* don't really need to do anything -- should never get this far */ - public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable { - - return null; - } -} diff --git a/tests/044-proxy/src/Clash4.java b/tests/044-proxy/src/Clash4.java deleted file mode 100644 index 1bfb37f58..000000000 --- a/tests/044-proxy/src/Clash4.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2008 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.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; - -/* - * Try to instantiate a proxy class with interfaces that have conflicting - * duplicate methods (tree of types). - */ -public class Clash4 { - public static void main(String[] args) { - InvocationHandler handler = new Clash4InvocationHandler(); - - try { - Proxy.newProxyInstance(Clash.class.getClassLoader(), - new Class[] { - Interface4a.class, - Interface4aa.class, - Interface4base.class, - Interface4b.class, - Interface4bb.class }, - handler); - System.err.println("Clash4 did not throw expected exception"); - } catch (IllegalArgumentException iae) { - System.out.println("Clash4 threw expected exception"); - //System.out.println(iae); - } - } -} - -class R4base { int mBlah; } -class R4a extends R4base { int mBlah_a; } -class R4aa extends R4a { int mBlah_aa; } -class R4b extends R4base { int mBlah_b; } -class R4bb extends R4b { int mBlah_bb; } - -interface Interface4base { - public R4base thisIsTrouble(); -} - -interface Interface4a { - public R4a thisIsTrouble(); -} -interface Interface4aa { - public R4aa thisIsTrouble(); -} -interface Interface4b { - public R4b thisIsTrouble(); -} -interface Interface4bb { - public R4bb thisIsTrouble(); -} - -class Clash4InvocationHandler implements InvocationHandler { - /* don't really need to do anything -- should never get this far */ - public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable { - - return null; - } -} diff --git a/tests/044-proxy/src/Main.java b/tests/044-proxy/src/Main.java deleted file mode 100644 index 01926af2c..000000000 --- a/tests/044-proxy/src/Main.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -/** - * Test java.lang.reflect.Proxy - */ -public class Main { - public static void main(String[] args) { - BasicTest.main(null); - Clash.main(null); - Clash2.main(null); - Clash3.main(null); - Clash4.main(null); - WrappedThrow.main(null); - } -} diff --git a/tests/044-proxy/src/WrappedThrow.java b/tests/044-proxy/src/WrappedThrow.java deleted file mode 100644 index 27ae84e24..000000000 --- a/tests/044-proxy/src/WrappedThrow.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (C) 2008 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.io.IOException; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.lang.reflect.UndeclaredThrowableException; - -/* - * Create a Proxy class that blah. - */ -public class WrappedThrow { - public static void main(String[] args) { - WTMix mix = new WTMix(); - InvocationHandler handler = new WTInvocationHandler(mix); - Object proxy; - - try { - proxy = Proxy.newProxyInstance(WrappedThrow.class.getClassLoader(), - new Class[] { InterfaceW1.class, InterfaceW2.class }, - handler); - } catch (IllegalArgumentException iae) { - System.out.println("WT init failed"); - return; - } - - InterfaceW1 if1 = (InterfaceW1) proxy; - InterfaceW2 if2 = (InterfaceW2) proxy; - try { - if1.throwFunky(); - System.err.println("No exception thrown"); - } catch (UndeclaredThrowableException ute) { - System.out.println("Got expected UTE"); - } catch (Throwable t) { - System.err.println("Got unexpected exception: " + t); - } - - try { - if1.throwFunky2(); - System.err.println("No exception thrown"); - } catch (IOException ioe) { - System.out.println("Got expected IOE"); - } catch (Throwable t) { - System.err.println("Got unexpected exception: " + t); - } - - try { - if2.throwFunky2(); - System.err.println("No exception thrown"); - } catch (IOException ioe) { - System.out.println("Got expected IOE"); - } catch (Throwable t) { - System.err.println("Got unexpected exception: " + t); - } - - /* - * Throw exceptions, walking down the hierarchy. - */ - try { - if1.throwException(); - System.err.println("No exception thrown"); - } catch (UndeclaredThrowableException ute) { - System.out.println("Got expected UTE"); - } catch (Throwable t) { - System.err.println("Got unexpected exception: " + t); - } - - try { - if1.throwBase(); - System.err.println("No exception thrown"); - } catch (UndeclaredThrowableException ute) { - System.out.println("Got expected UTE"); - } catch (Throwable t) { - System.err.println("Got unexpected exception: " + t); - } - - try { - if2.throwSub(); - System.err.println("No exception thrown"); - } catch (SubException se) { - System.out.println("Got expected exception"); - } catch (Throwable t) { - System.err.println("Got unexpected exception: " + t); - } - - try { - if2.throwSubSub(); - System.err.println("No exception thrown"); - } catch (SubException se) { - System.out.println("Got expected exception"); - } catch (Throwable t) { - System.err.println("Got unexpected exception: " + t); - } - - /* - * Make sure that, if the class explicitly allows the base - * class of an exception, that we still allow it. - */ - try { - if1.bothThrowBase(); - System.err.println("No exception thrown"); - } catch (BaseException se) { - System.out.println("Got expected exception"); - } catch (Throwable t) { - System.err.println("Got unexpected exception: " + t); - } - } -} - -class BaseException extends Exception {} -class SubException extends BaseException {} -class SubSubException extends SubException {} - -interface InterfaceW1 { - public void throwFunky(); - - public void throwFunky2() throws BaseException, - NoSuchMethodException, IOException; - - public void throwException() throws BaseException; - public void throwBase() throws BaseException; - public void throwSub() throws BaseException; - public void throwSubSub() throws BaseException; - - public void bothThrowBase() throws BaseException, SubException, SubSubException; -} - -interface InterfaceW2 { - public void throwFunky2() throws InterruptedException, - NoSuchMethodException, IOException; - - public void throwException() throws SubException; - public void throwBase() throws SubException; - public void throwSub() throws SubException; - public void throwSubSub() throws SubException; - - public void bothThrowBase() throws SubException, BaseException, SubSubException; -} - -/** - * Implement all of the proxied interfaces. - */ -class WTMix implements InterfaceW1, InterfaceW2 { - public int dastardlyDeed() throws SubException { - System.out.println("Throwing SubException"); - throw new SubException(); - } - - /* these don't actually get called; they just cause exceptions */ - public void throwFunky() {} - public void throwFunky2() {} - public void throwException() throws SubException {} - public void throwBase() throws SubException {} - public void throwSub() throws SubException {} - public void throwSubSub() throws SubException {} - - public void bothThrowBase() throws BaseException, SubException {} -} - -/** - * Invocation handler for our proxy class. - */ -class WTInvocationHandler implements InvocationHandler { - private Object mObj; - - public WTInvocationHandler(Object obj) { - mObj = obj; - } - - /* - * This is called when anything gets invoked in the proxy object. - */ - public Object invoke(Object proxy, Method method, Object[] args) - throws Throwable { - - Object result = null; - - // Trap Object calls. This is important here to avoid a recursive - // invocation of toString() in the print statements below. - if (method.getDeclaringClass() == java.lang.Object.class) { - //System.out.println("!!! object " + method.getName()); - if (method.getName().equals("toString")) - return super.toString(); - else if (method.getName().equals("hashCode")) - return Integer.valueOf(super.hashCode()); - else if (method.getName().equals("equals")) - return Boolean.valueOf(super.equals(args[0])); - else - throw new RuntimeException("huh?"); - } - - System.out.println("Invoke " + method); - if (args == null || args.length == 0) { - System.out.println(" (no args)"); - } else { - for (int i = 0; i < args.length; i++) - System.out.println(" " + i + ": " + args[i]); - } - - try { - if (method.getName().equals("throwFunky")) - throw new InterruptedException("fake"); - if (method.getName().equals("throwFunky2")) - throw new IOException("fake2"); - if (method.getName().equals("throwException")) - throw new Exception(); - if (method.getName().equals("throwBase")) - throw new BaseException(); - if (method.getName().equals("throwSub")) - throw new SubException(); - if (method.getName().equals("throwSubSub")) - throw new SubSubException(); - if (method.getName().equals("bothThrowBase")) - throw new BaseException(); - - if (true) - result = method.invoke(mObj, args); - else - result = -1; - System.out.println("Success: method " + method.getName() - + " res=" + result); - } catch (InvocationTargetException ite) { - throw ite.getTargetException(); - } catch (IllegalAccessException iae) { - throw new RuntimeException(iae); - } - return result; - } -} diff --git a/tests/045-reflect-array/expected.txt b/tests/045-reflect-array/expected.txt deleted file mode 100644 index 5990b34a4..000000000 --- a/tests/045-reflect-array/expected.txt +++ /dev/null @@ -1,9 +0,0 @@ -ReflectArrayTest.testSingleInt passed -ReflectArrayTest.testSingleChar passed -ReflectArrayTest.testSingleShort passed -ReflectArrayTest.testSingleLong passed -ReflectArrayTest.testSingle passed -ReflectArrayTest.testMultiInt passed -zero one two ++ -ReflectArrayTest.testMulti passed -ReflectArrayTest passed diff --git a/tests/045-reflect-array/info.txt b/tests/045-reflect-array/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/045-reflect-array/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/045-reflect-array/src/Main.java b/tests/045-reflect-array/src/Main.java deleted file mode 100644 index 36f8ac388..000000000 --- a/tests/045-reflect-array/src/Main.java +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - */ - -import java.lang.reflect.Array; - -/** - * Test java.lang.reflect.Array. - */ -public class Main { - public static void main(String[] args) { - testSingleInt(); - testSingleChar(); - testSingleShort(); - testSingleLong(); - testSingle(); - testMultiInt(); - testMulti(); - - System.out.println("ReflectArrayTest passed"); - } - - static void testSingleInt() { - Object intArray; - - intArray = Array.newInstance(Integer.TYPE, 2); - - int[] array = (int[]) intArray; - array[0] = 5; - Array.setInt(intArray, 1, 6); - - if (Array.getInt(intArray, 0) != 5) - throw new RuntimeException(); - if (array[1] != 6) - throw new RuntimeException(); - try { - array[2] = 27; - throw new RuntimeException("store should have failed"); - } catch (ArrayIndexOutOfBoundsException abe) { } - try { - Array.setInt(intArray, 2, 27); - throw new RuntimeException("store should have failed"); - } catch (ArrayIndexOutOfBoundsException abe) { } - if (array.length != Array.getLength(intArray) || - array.length != 2) - { - throw new RuntimeException("bad len"); - } - - Integer x123 = Integer.valueOf(123); - Integer x456 = Integer.valueOf(456); - - Array.set(intArray, 0, x123); - Array.set(intArray, 1, x456); - if (!Array.get(intArray, 0).equals(x123) || !Array.get(intArray, 1).equals(x456)) { - throw new RuntimeException("bad 123 or 456"); - } - - int[][] wrongArray; - try { - wrongArray = (int[][]) intArray; - throw new RuntimeException("cast should have failed"); - } catch (ClassCastException cce) { } - - intArray = Array.newInstance(Integer.TYPE, 0); - if (Array.getLength(intArray) != 0) - throw new RuntimeException(); - System.out.println("ReflectArrayTest.testSingleInt passed"); - } - - static void testSingleChar() { - Object charArray = Array.newInstance(Character.TYPE, 7); - - char[] array = (char[]) charArray; - array[0] = '0'; - array[1] = 'W'; - array[2] = '2'; - array[3] = '3'; - array[4] = 'X'; - array[5] = '5'; - array[6] = '6'; - Array.setChar(charArray, 1, '1'); - Array.setChar(charArray, 4, '4'); - try { - Array.setShort(charArray, 3, (short) 'Y'); - throw new RuntimeException("shouldn't allow short in char array"); - } catch (IllegalArgumentException iae) {} - try { - Array.setInt(charArray, 5, 'Z'); - throw new RuntimeException("shouldn't allow int in char array"); - } catch (IllegalArgumentException iae) {} - - try { - for (int i = 0; i < array.length; i++) { - if (Array.getInt(charArray, i) - '0' != i) { - throw new RuntimeException("mismatch: " + i + " is " + array[i]); - } - } - - if (Array.getInt(charArray, 4) != '4') { - throw new RuntimeException("load should have worked"); - } - } catch (IllegalArgumentException iae) { - System.err.println("Couldn't Array.getInt(charArray)"); - } - try { - Array.getByte(charArray, 2); - throw new RuntimeException("shouldn't allow read of char as byte"); - } catch (IllegalArgumentException iae) {} - - Array.setChar(charArray, 3, (char) 0xffff); - try { - if (Array.getInt(charArray, 3) != 0xffff) { - throw new RuntimeException("char got sign-extended? " - + Array.getInt(charArray, 3)); - } - } catch (IllegalArgumentException iae) { - System.err.println("Couldn't Array.getInt(charArray)"); - } - - System.out.println("ReflectArrayTest.testSingleChar passed"); - } - - static void testSingleShort() { - Object shortArray = Array.newInstance(Short.TYPE, 1); - Array.setShort(shortArray, 0, (short) -1); - if (Array.getInt(shortArray, 0) != -1) { - throw new RuntimeException("short didn't get sign-extended"); - } - - Short box = (Short) Array.get(shortArray, 0); - - System.out.println("ReflectArrayTest.testSingleShort passed"); - } - - static void testSingleLong() { - Object longArray = Array.newInstance(Long.TYPE, 2); - Array.setInt(longArray, 0, 123); - Array.setLong(longArray, 1, 0x1122334455667788L); - try { - Array.getInt(longArray, 0); - throw new RuntimeException("shouldn't allow read of long as int"); - } catch (IllegalArgumentException iae) {} - - long[] array = (long[]) longArray; - if (array[0] != 123 || array[1] != 0x1122334455667788L) { - throw new RuntimeException(); - } - - float f = Array.getFloat(longArray, 0); - if (f < 122.9 || f > 123.1) { - throw new RuntimeException("long-as-float failed - " + f); - } - if (Array.getLong(longArray, 1) != 0x1122334455667788L) { - throw new RuntimeException("long1 failed"); - } - - System.out.println("ReflectArrayTest.testSingleLong passed"); - } - - static void testSingle() { - Object strArray; - - strArray = Array.newInstance(String.class, 2); - - String[] array = (String[]) strArray; - array[0] = "entry zero"; - Array.set(strArray, 1, "entry one"); - try { - Array.set(strArray, 2, "entry two"); - throw new RuntimeException("store should have failed"); - } catch (ArrayIndexOutOfBoundsException abe) { } - - //System.out.println("array: " + array); - - if (!"entry zero".equals(Array.get(strArray, 0))) - throw new RuntimeException(); - if (!"entry one".equals(array[1])) - throw new RuntimeException(); - - if (array.length != Array.getLength(strArray) || - array.length != 2) - { - throw new RuntimeException("bad len"); - } - - try { - Array.set(strArray, 0, new Integer(5)); - throw new RuntimeException("store of Integer should have failed"); - } catch (IllegalArgumentException iae) {} - System.out.println("ReflectArrayTest.testSingle passed"); - } - - static void testMultiInt() { - Object intIntIntArray; - int[] dimensions = { 3, 2, 1 }; - - intIntIntArray = Array.newInstance(Integer.TYPE, dimensions); - int[][][] array3 = (int[][][]) intIntIntArray; - - array3[0][0][0] = 123; // trouble - array3[2][1][0] = 456; - - try { - array3[2][1][1] = 768; - throw new RuntimeException("store should have failed"); - } - catch (ArrayIndexOutOfBoundsException abe) { - } - System.out.println("ReflectArrayTest.testMultiInt passed"); - } - - static void testMulti() { - Object strStrStrArray; - int[] dimensions = { 1, 2, 3 }; - - strStrStrArray = Array.newInstance(String.class, dimensions); - String[][][] array3 = (String[][][]) strStrStrArray; - - array3[0][0][0] = "zero zero zero"; - array3[0][1][2] = "zero one two"; - - try { - array3[1][0][0] = "bad store"; - throw new RuntimeException("store should have failed"); - } - catch (ArrayIndexOutOfBoundsException abe) { - } - - try { - String[][] array2 = (String[][]) strStrStrArray; - throw new RuntimeException("expecting bad cast"); - } - catch (ClassCastException cce) { - } - - String[] strar = new String[4]; - strar[2] = "zero one two ++"; - array3[0][1] = strar; - System.out.println(array3[0][1][2]); - //System.out.println("array3: " + array3); - - - int[] dimensions2 = { 1, 2 }; - strStrStrArray = Array.newInstance(String[].class, dimensions2); - array3 = (String[][][]) strStrStrArray; - - array3[0][1] = new String[3]; - array3[0][1][2] = "zero one two"; - try { - array3[1][0][0] = "bad store"; - throw new RuntimeException("store should have failed"); - } - catch (ArrayIndexOutOfBoundsException abe) { - } - System.out.println("ReflectArrayTest.testMulti passed"); - } -} diff --git a/tests/046-reflect/expected.txt b/tests/046-reflect/expected.txt deleted file mode 100644 index 309b07689..000000000 --- a/tests/046-reflect/expected.txt +++ /dev/null @@ -1,102 +0,0 @@ -Method name is myMethod - Declaring class is Target - Arg 0: int - Exc 0: java.lang.NullPointerException - Exc 1: java.io.IOException - Return type is int - Access flags are 0x1 -Method name is myMethod - Declaring class is SuperTarget - Arg 0: float - Return type is int - Access flags are 0x1 -Method name is myNoargMethod - Declaring class is Target - Return type is void - Access flags are 0x9 -Method name is myMethod - Declaring class is Target - Arg 0: [Ljava.lang.String; - Arg 1: float - Arg 2: char - Return type is int - Access flags are 0x1 -SuperTarget constructor ()V -Target constructor ()V -Before, float is 3.1415925 -myMethod: hi there 3.1415925 Q ! -Result of invoke: 7 -Calling no-arg void-return method -myNoargMethod ()V -throwingMethod -Invoke got expected exception: -java.lang.reflect.InvocationTargetException -java.lang.NullPointerException: gratuitous throw! - -Field name is string1 - Declaring class is Target - Field type is java.lang.String - Access flags are 0x1 - string1 value is 'hey' - ::: hey:yo:there - string1 value is now 'a new string' - ::: a new string:yo:there - got expected illegal obj store exc - got the other expected access exc - got expected arg exc -pubLong initial value is 1122334455667788 -pubLong new value is 9988776655443322 -Field name is superInt - Declaring class is SuperTarget - Field type is int - Access flags are 0x1 - superInt value is 1010101 - superInt boxed is 1010101 - superInt value is now 20202 - superInt value (from short) is now 30303 - superInt value is now 40404 - got expected long->int failure - got expected long->int failure - got expected string->int failure - got expected int->short failure -Field name is superClassInt - Declaring class is SuperTarget - Field type is int - Access flags are 0x9 - superClassInt value is 1010102 -Field name is staticDouble - Declaring class is Target - Field type is double - Access flags are 0x9 - staticDoubleVal value is 3.3 - got expected double->long failure -as expected: aPrivateInt not found -Field name is constantString - Declaring class is Target - Field type is java.lang.String - Access flags are 0x19 - Constant test value is a constant string -Field name is cantTouchThis - Declaring class is Target - Field type is int - Access flags are 0x11 - cantTouchThis is 77 - got expected set-final failure - cantTouchThis is now 77 - cantTouchThis is now 88 -cons modifiers=1 -SuperTarget constructor ()V -Target constructor (IF)V : ii=7 ff=3.3333 -myMethod (I)I - arg=17 anInt=7 -ReflectTest done! -public method -checkType invoking null -checkType got expected exception -got methods -NoisyInitUser is initializing -NoisyInit is initializing - -generic field: java.util.List<java.lang.String> -generic method fancyMethod params='[1] java.util.ArrayList<java.lang.String>' ret='java.util.Map<java.lang.Integer, java.lang.String>' -generic ctor Main params='[1] java.util.ArrayList<java.lang.Integer>' diff --git a/tests/046-reflect/info.txt b/tests/046-reflect/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/046-reflect/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/046-reflect/src/Main.java b/tests/046-reflect/src/Main.java deleted file mode 100644 index e2a3929dd..000000000 --- a/tests/046-reflect/src/Main.java +++ /dev/null @@ -1,555 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -import java.lang.reflect.*; -import java.io.IOException; -import java.util.Collections; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * Reflection test. - */ -public class Main { - private static boolean FULL_ACCESS_CHECKS = false; // b/5861201 - public Main() {} - public Main(ArrayList<Integer> stuff) {} - - void printMethodInfo(Method meth) { - Class[] params, exceptions; - int i; - - System.out.println("Method name is " + meth.getName()); - System.out.println(" Declaring class is " - + meth.getDeclaringClass().getName()); - params = meth.getParameterTypes(); - for (i = 0; i < params.length; i++) - System.out.println(" Arg " + i + ": " + params[i].getName()); - exceptions = meth.getExceptionTypes(); - for (i = 0; i < exceptions.length; i++) - System.out.println(" Exc " + i + ": " + exceptions[i].getName()); - System.out.println(" Return type is " + meth.getReturnType().getName()); - System.out.println(" Access flags are 0x" - + Integer.toHexString(meth.getModifiers())); - //System.out.println(" GenericStr is " + meth.toGenericString()); - } - - void printFieldInfo(Field field) { - System.out.println("Field name is " + field.getName()); - System.out.println(" Declaring class is " - + field.getDeclaringClass().getName()); - System.out.println(" Field type is " + field.getType().getName()); - System.out.println(" Access flags are 0x" - + Integer.toHexString(field.getModifiers())); - } - - private void showStrings(Target instance) - throws NoSuchFieldException, IllegalAccessException { - - Class target = Target.class; - String one, two, three, four; - Field field = null; - - field = target.getField("string1"); - one = (String) field.get(instance); - - field = target.getField("string2"); - two = (String) field.get(instance); - - field = target.getField("string3"); - three = (String) field.get(instance); - - System.out.println(" ::: " + one + ":" + two + ":" + three); - } - - public static void checkAccess() { - try { - Class target = otherpackage.Other.class; - Object instance = new otherpackage.Other(); - Method meth; - - meth = target.getMethod("publicMethod", (Class[]) null); - meth.invoke(instance); - - try { - meth = target.getMethod("packageMethod", (Class[]) null); - System.err.println("succeeded on package-scope method"); - } catch (NoSuchMethodException nsme) { - // good - } - - - instance = otherpackage.Other.getInnerClassInstance(); - target = instance.getClass(); - meth = target.getMethod("innerMethod", (Class[]) null); - try { - if (!FULL_ACCESS_CHECKS) { throw new IllegalAccessException(); } - meth.invoke(instance); - System.err.println("inner-method invoke unexpectedly worked"); - } catch (IllegalAccessException iae) { - // good - } - - Field field = target.getField("innerField"); - try { - int x = field.getInt(instance); - if (!FULL_ACCESS_CHECKS) { throw new IllegalAccessException(); } - System.err.println("field get unexpectedly worked: " + x); - } catch (IllegalAccessException iae) { - // good - } - } catch (Exception ex) { - System.out.println("----- unexpected exception -----"); - ex.printStackTrace(); - } - } - - public void run() { - Class target = Target.class; - Method meth = null; - Field field = null; - boolean excep; - - try { - meth = target.getMethod("myMethod", new Class[] { int.class }); - - if (meth.getDeclaringClass() != target) - throw new RuntimeException(); - printMethodInfo(meth); - - meth = target.getMethod("myMethod", new Class[] { float.class }); - printMethodInfo(meth); - - meth = target.getMethod("myNoargMethod", (Class[]) null); - printMethodInfo(meth); - - meth = target.getMethod("myMethod", - new Class[] { String[].class, float.class, char.class }); - printMethodInfo(meth); - - Target instance = new Target(); - Object[] argList = new Object[] { - new String[] { "hi there" }, - new Float(3.1415926f), - new Character('Q') - }; - System.out.println("Before, float is " - + ((Float)argList[1]).floatValue()); - - Integer boxval; - boxval = (Integer) meth.invoke(instance, argList); - System.out.println("Result of invoke: " + boxval.intValue()); - - System.out.println("Calling no-arg void-return method"); - meth = target.getMethod("myNoargMethod", (Class[]) null); - meth.invoke(instance, (Object[]) null); - - /* try invoking a method that throws an exception */ - meth = target.getMethod("throwingMethod", (Class[]) null); - try { - meth.invoke(instance, (Object[]) null); - System.out.println("GLITCH: didn't throw"); - } catch (InvocationTargetException ite) { - System.out.println("Invoke got expected exception:"); - System.out.println(ite.getClass().getName()); - System.out.println(ite.getCause()); - } - catch (Exception ex) { - System.out.println("GLITCH: invoke got wrong exception:"); - ex.printStackTrace(); - } - System.out.println(""); - - - field = target.getField("string1"); - if (field.getDeclaringClass() != target) - throw new RuntimeException(); - printFieldInfo(field); - String strVal = (String) field.get(instance); - System.out.println(" string1 value is '" + strVal + "'"); - - showStrings(instance); - - field.set(instance, new String("a new string")); - strVal = (String) field.get(instance); - System.out.println(" string1 value is now '" + strVal + "'"); - - showStrings(instance); - - try { - field.set(instance, new Object()); - System.out.println("WARNING: able to store Object into String"); - } - catch (IllegalArgumentException iae) { - System.out.println(" got expected illegal obj store exc"); - } - - - try { - String four; - field = target.getField("string4"); - four = (String) field.get(instance); - System.out.println("WARNING: able to access string4: " - + four); - } - catch (IllegalAccessException iae) { - System.out.println(" got expected access exc"); - } - catch (NoSuchFieldException nsfe) { - System.out.println(" got the other expected access exc"); - } - try { - String three; - field = target.getField("string3"); - three = (String) field.get(this); - System.out.println("WARNING: able to get string3 in wrong obj: " - + three); - } - catch (IllegalArgumentException iae) { - System.out.println(" got expected arg exc"); - } - - /* - * Try setting a field to null. - */ - String four; - field = target.getDeclaredField("string3"); - field.set(instance, null); - - /* - * Do some stuff with long. - */ - long longVal; - field = target.getField("pubLong"); - longVal = field.getLong(instance); - System.out.println("pubLong initial value is " + - Long.toHexString(longVal)); - field.setLong(instance, 0x9988776655443322L); - longVal = field.getLong(instance); - System.out.println("pubLong new value is " + - Long.toHexString(longVal)); - - - field = target.getField("superInt"); - if (field.getDeclaringClass() == target) - throw new RuntimeException(); - printFieldInfo(field); - int intVal = field.getInt(instance); - System.out.println(" superInt value is " + intVal); - Integer boxedIntVal = (Integer) field.get(instance); - System.out.println(" superInt boxed is " + boxedIntVal); - - field.set(instance, new Integer(20202)); - intVal = field.getInt(instance); - System.out.println(" superInt value is now " + intVal); - field.setShort(instance, (short)30303); - intVal = field.getInt(instance); - System.out.println(" superInt value (from short) is now " +intVal); - field.setInt(instance, 40404); - intVal = field.getInt(instance); - System.out.println(" superInt value is now " + intVal); - try { - field.set(instance, new Long(123)); - System.out.println("FAIL: expected exception not thrown"); - } - catch (IllegalArgumentException iae) { - System.out.println(" got expected long->int failure"); - } - try { - field.setLong(instance, 123); - System.out.println("FAIL: expected exception not thrown"); - } - catch (IllegalArgumentException iae) { - System.out.println(" got expected long->int failure"); - } - try { - field.set(instance, new String("abc")); - System.out.println("FAIL: expected exception not thrown"); - } - catch (IllegalArgumentException iae) { - System.out.println(" got expected string->int failure"); - } - - try { - field.getShort(instance); - System.out.println("FAIL: expected exception not thrown"); - } - catch (IllegalArgumentException iae) { - System.out.println(" got expected int->short failure"); - } - - field = target.getField("superClassInt"); - printFieldInfo(field); - int superClassIntVal = field.getInt(instance); - System.out.println(" superClassInt value is " + superClassIntVal); - - field = target.getField("staticDouble"); - printFieldInfo(field); - double staticDoubleVal = field.getDouble(null); - System.out.println(" staticDoubleVal value is " + staticDoubleVal); - - try { - field.getLong(instance); - System.out.println("FAIL: expected exception not thrown"); - } - catch (IllegalArgumentException iae) { - System.out.println(" got expected double->long failure"); - } - - excep = false; - try { - field = target.getField("aPrivateInt"); - printFieldInfo(field); - } - catch (NoSuchFieldException nsfe) { - System.out.println("as expected: aPrivateInt not found"); - excep = true; - } - if (!excep) - System.out.println("BUG: got aPrivateInt"); - - - field = target.getField("constantString"); - printFieldInfo(field); - String val = (String) field.get(instance); - System.out.println(" Constant test value is " + val); - - - field = target.getField("cantTouchThis"); - printFieldInfo(field); - intVal = field.getInt(instance); - System.out.println(" cantTouchThis is " + intVal); - try { - field.setInt(instance, 99); - System.out.println("ERROR: set-final succeeded"); - } catch (IllegalAccessException iae) { - System.out.println(" got expected set-final failure"); - } - intVal = field.getInt(instance); - System.out.println(" cantTouchThis is now " + intVal); - - field.setAccessible(true); - field.setInt(instance, 87); // exercise int version - field.set(instance, 88); // exercise Object version - intVal = field.getInt(instance); - System.out.println(" cantTouchThis is now " + intVal); - - Constructor<Target> cons; - Target targ; - Object[] args; - - cons = target.getConstructor(new Class[] { int.class,float.class }); - args = new Object[] { new Integer(7), new Float(3.3333) }; - System.out.println("cons modifiers=" + cons.getModifiers()); - targ = cons.newInstance(args); - targ.myMethod(17); - - } catch (Exception ex) { - System.out.println("----- unexpected exception -----"); - ex.printStackTrace(); - } - - System.out.println("ReflectTest done!"); - } - - public static void checkType() { - Method m; - - try { - m = Collections.class.getDeclaredMethod("checkType", - Object.class, Class.class); - } catch (NoSuchMethodException nsme) { - nsme.printStackTrace(); - return; - } - - m.setAccessible(true); - try { - m.invoke(null, new Object(), Object.class); - } catch (IllegalAccessException iae) { - iae.printStackTrace(); - return; - } catch (InvocationTargetException ite) { - ite.printStackTrace(); - return; - } - - try { - System.out.println("checkType invoking null"); - m.invoke(null, new Object(), int.class); - System.out.println("ERROR: should throw InvocationTargetException"); - } catch (InvocationTargetException ite) { - System.out.println("checkType got expected exception"); - } catch (IllegalAccessException iae) { - iae.printStackTrace(); - return; - } - } - - public static void checkInit() { - Class niuClass = NoisyInitUser.class; - Method[] methods; - - methods = niuClass.getDeclaredMethods(); - System.out.println("got methods"); - /* neither NoisyInit nor NoisyInitUser should be initialized yet */ - NoisyInitUser niu = new NoisyInitUser(); - NoisyInit ni = new NoisyInit(); - - System.out.println(""); - } - - - /* - * Test some generic type stuff. - */ - public List<String> dummy; - public Map<Integer,String> fancyMethod(ArrayList<String> blah) { return null; } - public static void checkGeneric() { - Field field; - try { - field = Main.class.getField("dummy"); - } catch (NoSuchFieldException nsfe) { - throw new RuntimeException(nsfe); - } - Type listType = field.getGenericType(); - System.out.println("generic field: " + listType); - - Method method; - try { - method = Main.class.getMethod("fancyMethod", - new Class[] { ArrayList.class }); - } catch (NoSuchMethodException nsme) { - throw new RuntimeException(nsme); - } - Type[] parmTypes = method.getGenericParameterTypes(); - Type ret = method.getGenericReturnType(); - System.out.println("generic method " + method.getName() + " params='" - + stringifyTypeArray(parmTypes) + "' ret='" + ret + "'"); - - Constructor ctor; - try { - ctor = Main.class.getConstructor(new Class[] { ArrayList.class }); - } catch (NoSuchMethodException nsme) { - throw new RuntimeException(nsme); - } - parmTypes = ctor.getGenericParameterTypes(); - System.out.println("generic ctor " + ctor.getName() + " params='" - + stringifyTypeArray(parmTypes) + "'"); - } - - /* - * Convert an array of Type into a string. Start with an array count. - */ - private static String stringifyTypeArray(Type[] types) { - StringBuilder stb = new StringBuilder(); - boolean first = true; - - stb.append("[" + types.length + "]"); - - for (Type t: types) { - if (first) { - stb.append(" "); - first = false; - } else { - stb.append(", "); - } - stb.append(t.toString()); - } - - return stb.toString(); - } - - - public static void main(String[] args) { - Main test = new Main(); - test.run(); - - checkAccess(); - checkType(); - checkInit(); - checkGeneric(); - } -} - - -class SuperTarget { - public SuperTarget() { - System.out.println("SuperTarget constructor ()V"); - superInt = 1010101; - superClassInt = 1010102; - } - - public int myMethod(float floatArg) { - System.out.println("myMethod (F)I " + floatArg); - return 6; - } - - public int superInt; - public static int superClassInt; -} - -class Target extends SuperTarget { - public Target() { - System.out.println("Target constructor ()V"); - } - - public Target(int ii, float ff) { - System.out.println("Target constructor (IF)V : ii=" - + ii + " ff=" + ff); - anInt = ii; - } - - public int myMethod(int intarg) throws NullPointerException, IOException { - System.out.println("myMethod (I)I"); - System.out.println(" arg=" + intarg + " anInt=" + anInt); - return 5; - } - - public int myMethod(String[] strarg, float f, char c) { - System.out.println("myMethod: " + strarg[0] + " " + f + " " + c + " !"); - return 7; - } - - public static void myNoargMethod() { - System.out.println("myNoargMethod ()V"); - } - - public void throwingMethod() { - System.out.println("throwingMethod"); - throw new NullPointerException("gratuitous throw!"); - } - - public void misc() { - System.out.println("misc"); - } - - public int anInt; - public String string1 = "hey"; - public String string2 = "yo"; - public String string3 = "there"; - private String string4 = "naughty"; - public static final String constantString = "a constant string"; - private int aPrivateInt; - - public final int cantTouchThis = 77; - - public long pubLong = 0x1122334455667788L; - - public static double staticDouble = 3.3; -} - -class NoisyInit { - static { - System.out.println("NoisyInit is initializing"); - //Throwable th = new Throwable(); - //th.printStackTrace(); - } -} - -class NoisyInitUser { - static { - System.out.println("NoisyInitUser is initializing"); - } - public void createNoisyInit(NoisyInit ni) {} -} diff --git a/tests/046-reflect/src/otherpackage/Other.java b/tests/046-reflect/src/otherpackage/Other.java deleted file mode 100644 index 702ab6d68..000000000 --- a/tests/046-reflect/src/otherpackage/Other.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -package otherpackage; - -public class Other { - public void publicMethod() { - System.out.println("public method"); - } - void packageMethod() { - System.out.println("package method"); - } - - public static InnerOther getInnerClassInstance() { - return new InnerOther(); - } - - private static class InnerOther { - public void innerMethod() { - System.out.println("inner method"); - } - - public int innerField = 7; - } -} diff --git a/tests/047-returns/expected.txt b/tests/047-returns/expected.txt deleted file mode 100644 index 160f69c23..000000000 --- a/tests/047-returns/expected.txt +++ /dev/null @@ -1,10 +0,0 @@ -pick 1 -one running -one -1 -pick 2 -two running -two -2 -pick 3 -three running diff --git a/tests/047-returns/info.txt b/tests/047-returns/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/047-returns/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/047-returns/src/Main.java b/tests/047-returns/src/Main.java deleted file mode 100644 index d53c4a7f3..000000000 --- a/tests/047-returns/src/Main.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -/** - * Return stuff. - */ -public class Main { - public static void main(String[] args) { - - System.out.println("pick 1"); - pickOne(1).run(); - System.out.println(((CommonInterface)pickOne(1)).doStuff()); - - System.out.println("pick 2"); - pickOne(2).run(); - System.out.println(((CommonInterface)pickOne(2)).doStuff()); - - System.out.println("pick 3"); - pickOne(3).run(); - } - - public static Runnable pickOne(int which) { - Runnable runme; - - if (which == 1) - runme = new ClassOne(); - else if (which == 2) - runme = new ClassTwo(); - else if (which == 3) - runme = new ClassThree(); - else - runme = null; - - return runme; - } -} - -class ClassOne implements CommonInterface, Runnable { - public void run() { - System.out.println("one running"); - } - public int doStuff() { - System.out.println("one"); - return 1; - } -} - -class ClassTwo implements CommonInterface, Runnable { - public void run() { - System.out.println("two running"); - } - public int doStuff() { - System.out.println("two"); - return 2; - } -} - -class ClassThree implements Runnable { - public void run() { - System.out.println("three running"); - } -} - -interface CommonInterface { - int doStuff(); -} diff --git a/tests/048-server-socket/expected.txt b/tests/048-server-socket/expected.txt deleted file mode 100644 index 23c3e8494..000000000 --- a/tests/048-server-socket/expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -opened! -closed! -reopened! -done diff --git a/tests/048-server-socket/info.txt b/tests/048-server-socket/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/048-server-socket/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/048-server-socket/src/Main.java b/tests/048-server-socket/src/Main.java deleted file mode 100644 index 55dbf9a22..000000000 --- a/tests/048-server-socket/src/Main.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -import java.net.ServerSocket; -import java.io.IOException; - - -/** - * Quick server socket test. - */ -public class Main { - private static void snooze(int sec) { - try { - Thread.sleep(sec * 1000); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - public static void main(String[] args) { - ServerSocket socket; - - try { - socket = new ServerSocket(7890); - } catch (IOException ioe) { - System.out.println("couldn't open socket " + ioe.getMessage()); - return; - } - - System.out.println("opened!"); - snooze(1); - - try { - socket.close(); - } catch (IOException ioe) { - System.out.println("couldn't close socket " + ioe.getMessage()); - return; - } - - System.out.println("closed!"); - snooze(1); - - try { - socket = new ServerSocket(7890); - } catch (IOException ioe) { - System.out.println("couldn't reopen socket " + ioe.getMessage()); - return; - } - - System.out.println("reopened!"); - System.out.println("done"); - } -} diff --git a/tests/049-show-object/expected.txt b/tests/049-show-object/expected.txt deleted file mode 100644 index 4613c39e7..000000000 --- a/tests/049-show-object/expected.txt +++ /dev/null @@ -1,11 +0,0 @@ -d is 3.1415 -class: class [Ljava.lang.Object; -0: null -1: null -2: null -3: null -4: null -class: class [Ljava.lang.String; -0: hey -1: you -2: there diff --git a/tests/049-show-object/info.txt b/tests/049-show-object/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/049-show-object/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/049-show-object/src/Main.java b/tests/049-show-object/src/Main.java deleted file mode 100644 index d31eeda5a..000000000 --- a/tests/049-show-object/src/Main.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -/* - * Some basic operations for testing the debugger. - */ -public class Main { - long mLong = 0x1122334455667788L; - - public Main() { - double d = 3.1415; - System.out.println("d is " + d); - } - - public static void showObject(Object[] foo) { - int xyz = 27; - System.out.println("class: " + foo.getClass()); - - for (int i = 0; i < foo.length; i++) { - System.out.println(i + ": " + foo[i]); - } - } - - public static void main(String[] args) { - int x = 5; - Main testObj = new Main(); - - Object[] array = new Object[5]; - showObject(array); - - String[] niftyStrings = new String[] { "hey", "you", "there" }; - array = niftyStrings; - showObject(array); - } -} diff --git a/tests/050-sync-test/expected.txt b/tests/050-sync-test/expected.txt deleted file mode 100644 index c2a70318b..000000000 --- a/tests/050-sync-test/expected.txt +++ /dev/null @@ -1,34 +0,0 @@ -Sleep Test -GOING -GONE - -Count Test -going: 1 -going: 1 -going: 1 -going: 1 -going: 1 -going: 1 -going: 1 -going: 1 -going: 1 -going: 1 -Final result: 10 -going: 2 -going: 2 -going: 2 -going: 2 -going: 2 -going: 2 -going: 2 -going: 2 -going: 2 -going: 2 -Final result: 20 -main: all done - -Interrupt Test -SleepyThread.run starting -SleepyThread.run starting -interrupting other (isAlive=true) -thread#0 interrupted, flag=false diff --git a/tests/050-sync-test/info.txt b/tests/050-sync-test/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/050-sync-test/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/050-sync-test/src/Main.java b/tests/050-sync-test/src/Main.java deleted file mode 100644 index 418f5f4e5..000000000 --- a/tests/050-sync-test/src/Main.java +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Test synchronization primitives. - * - * TODO: this should be re-written to be a little more rigorous and/or - * useful. Also, the ThreadDeathHandler stuff should be exposed or - * split out. - */ -public class Main { - public static void main(String[] args) { - System.out.println("Sleep Test"); - sleepTest(); - - System.out.println("\nCount Test"); - countTest(); - - System.out.println("\nInterrupt Test"); - interruptTest(); - } - - static void sleepTest() { - System.out.println("GOING"); - try { - Thread.sleep(1000); - } catch (InterruptedException ie) { - System.out.println("INTERRUPT!"); - ie.printStackTrace(); - } - System.out.println("GONE"); - } - - static void countTest() { - CpuThread one, two; - - one = new CpuThread(1); - two = new CpuThread(2); - - one.start(); - - try { - Thread.sleep(100); - } catch (InterruptedException ie) { - System.out.println("INTERRUPT!"); - ie.printStackTrace(); - } - - two.start(); - - //System.out.println("main: off and running"); - - try { - one.join(); - two.join(); - } catch (InterruptedException ie) { - System.out.println("INTERRUPT!"); - ie.printStackTrace(); - } - System.out.println("main: all done"); - } - - static void interruptTest() { - SleepyThread sleepy, pesky; - - sleepy = new SleepyThread(null); - pesky = new SleepyThread(sleepy); - - sleepy.setPriority(4); - sleepy.start(); - pesky.start(); - pesky.setPriority(3); - } -} - -class CpuThread extends Thread { - static Object mSyncable = new Object(); - static int mCount = 0; - int mNumber; - - CpuThread(int num) { - super("CpuThread " + num); - mNumber = num; - } - - public void run() { - //System.out.print("thread running -- "); - //System.out.println(Thread.currentThread().getName()); - - synchronized (mSyncable) { - for (int i = 0; i < 10; i++) { - output(mNumber); - } - - System.out.print("Final result: "); - System.out.println(mCount); - } - } - - void output(int num) { - int count = mCount; - - System.out.print("going: "); - System.out.println(num); - - /* burn CPU; adjust end value so we exceed scheduler quantum */ - for (int j = 0; j < 5000; j++) { - ; - } - - count++; - mCount = count; - } -} - -class SleepyThread extends Thread { - private SleepyThread mOther; - private Integer[] mWaitOnMe; // any type of object will do - - private static int count = 0; - - SleepyThread(SleepyThread other) { - mOther = other; - mWaitOnMe = new Integer[] { 1, 2 }; - - setName("thread#" + count); - count++; - } - - public void run() { - System.out.println("SleepyThread.run starting"); - - if (false) { - ThreadDeathHandler threadHandler = - new ThreadDeathHandler("SYNC THREAD"); - Thread.currentThread().setUncaughtExceptionHandler(threadHandler); - throw new NullPointerException("die"); - } - - if (mOther == null) { - boolean intr = false; - - try { - synchronized (mWaitOnMe) { - mWaitOnMe.wait(9000); - } - } catch (InterruptedException ie) { - // Expecting this; interrupted should be false. - System.out.println(Thread.currentThread().getName() + - " interrupted, flag=" + Thread.interrupted()); - intr = true; - } catch (Exception ex) { - ex.printStackTrace(); - } - - if (!intr) - System.out.println("NOT INTERRUPTED"); - } else { - try { - Thread.sleep(2000); - } catch (InterruptedException ie) { - System.out.println("PESKY INTERRUPTED?"); - } - - System.out.println("interrupting other (isAlive=" - + mOther.isAlive() + ")"); - mOther.interrupt(); - } - } -} diff --git a/tests/050-sync-test/src/ThreadDeathHandler.java b/tests/050-sync-test/src/ThreadDeathHandler.java deleted file mode 100644 index 5ea61a52d..000000000 --- a/tests/050-sync-test/src/ThreadDeathHandler.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -import java.lang.Thread.UncaughtExceptionHandler; - -/** - * Report death-by-uncaught-exception. - */ -public class ThreadDeathHandler implements Thread.UncaughtExceptionHandler { - private String mMyMessage; - - public ThreadDeathHandler(String msg) { - mMyMessage = msg; - } - - public void uncaughtException(Thread t, Throwable e) { - System.err.println("Uncaught exception " + mMyMessage + "!"); - e.printStackTrace(); - } -} diff --git a/tests/051-thread/expected.txt b/tests/051-thread/expected.txt deleted file mode 100644 index 8e6b153a0..000000000 --- a/tests/051-thread/expected.txt +++ /dev/null @@ -1,8 +0,0 @@ -Initializing System.out... -Thread count: 512 -Starting thread 'Thready' -@ Thread running -@ Got expected setDaemon exception -@ Thread bailing -Thread starter returning -thread test done diff --git a/tests/051-thread/info.txt b/tests/051-thread/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/051-thread/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/051-thread/src/Main.java b/tests/051-thread/src/Main.java deleted file mode 100644 index ea587af90..000000000 --- a/tests/051-thread/src/Main.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2006 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.util.ArrayList; - -/** - * Test some basic thread stuff. - */ -public class Main { - public static void main(String[] args) throws Exception { - System.out.println("Initializing System.out..."); - - MyThread[] threads = new MyThread[512]; - for (int i = 0; i < 512; i++) { - threads[i] = new MyThread(); - } - - for (MyThread thread : threads) { - thread.start(); - } - for (MyThread thread : threads) { - thread.join(); - } - - System.out.println("Thread count: " + MyThread.mCount); - - go(); - System.out.println("thread test done"); - } - - public static void go() { - Thread t = new Thread(null, new ThreadTestSub(), "Thready", 7168); - - t.setDaemon(false); - - System.out.print("Starting thread '" + t.getName() + "'\n"); - t.start(); - - try { - t.join(); - } catch (InterruptedException ex) { - ex.printStackTrace(); - } - - System.out.print("Thread starter returning\n"); - } - - /* - * Simple thread capacity test. - */ - static class MyThread extends Thread { - static int mCount = 0; - public void run() { - synchronized (MyThread.class) { - ++mCount; - } - } - } -} - -class ThreadTestSub implements Runnable { - public void run() { - System.out.print("@ Thread running\n"); - - try { - Thread.currentThread().setDaemon(true); - System.out.print("@ FAILED: setDaemon() succeeded\n"); - } catch (IllegalThreadStateException itse) { - System.out.print("@ Got expected setDaemon exception\n"); - } - - //if (true) - // throw new NullPointerException(); - try { - Thread.sleep(2000); - } - catch (InterruptedException ie) { - System.out.print("@ Interrupted!\n"); - } - finally { - System.out.print("@ Thread bailing\n"); - } - } -} diff --git a/tests/052-verifier-fun/expected.txt b/tests/052-verifier-fun/expected.txt deleted file mode 100644 index 566267534..000000000 --- a/tests/052-verifier-fun/expected.txt +++ /dev/null @@ -1,2 +0,0 @@ -BlahOne -Zorch. diff --git a/tests/052-verifier-fun/info.txt b/tests/052-verifier-fun/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/052-verifier-fun/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/052-verifier-fun/src/Blah.java b/tests/052-verifier-fun/src/Blah.java deleted file mode 100644 index edd6c9d3e..000000000 --- a/tests/052-verifier-fun/src/Blah.java +++ /dev/null @@ -1,4 +0,0 @@ -public abstract class Blah { - public void unrelatedStuff() { - } -} diff --git a/tests/052-verifier-fun/src/BlahFeature.java b/tests/052-verifier-fun/src/BlahFeature.java deleted file mode 100644 index ea0e18aa3..000000000 --- a/tests/052-verifier-fun/src/BlahFeature.java +++ /dev/null @@ -1,3 +0,0 @@ -public interface BlahFeature { - public void doStuff(); -} diff --git a/tests/052-verifier-fun/src/BlahOne.java b/tests/052-verifier-fun/src/BlahOne.java deleted file mode 100644 index ed423cdf3..000000000 --- a/tests/052-verifier-fun/src/BlahOne.java +++ /dev/null @@ -1,5 +0,0 @@ -public class BlahOne extends Blah implements BlahFeature { - public void doStuff() { - System.out.println("BlahOne"); - } -} diff --git a/tests/052-verifier-fun/src/BlahTwo.java b/tests/052-verifier-fun/src/BlahTwo.java deleted file mode 100644 index cff367091..000000000 --- a/tests/052-verifier-fun/src/BlahTwo.java +++ /dev/null @@ -1,5 +0,0 @@ -public class BlahTwo extends Blah implements BlahFeature { - public void doStuff() { - System.out.println("BlahTwo"); - } -} diff --git a/tests/052-verifier-fun/src/Main.java b/tests/052-verifier-fun/src/Main.java deleted file mode 100644 index ca960cf4d..000000000 --- a/tests/052-verifier-fun/src/Main.java +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -import java.lang.reflect.Type; - -/** - * Throw a few things at the verifier, all of which are expected to pass. - */ -public class Main { - static public void main(String[] args) { - tryBlah(1); - - System.out.println("Zorch."); - } - - /* - * Make sure the verifier is handling type merge of arrays of - * references correctly. - */ - static Object[] arrayCheck1(int wanted) { - String[] arrayOne; - Integer[] arrayTwo; - - arrayOne = new String[1]; - arrayTwo = new Integer[1]; - - switch (wanted) { - case 0: return arrayOne; - case 1: return arrayTwo; - default: return null; - } - } - - static Object arrayCheck1b(int wanted) { - String[] arrayOne; - Integer[] arrayTwo; - int[] arrayThree; - - arrayOne = new String[1]; - arrayTwo = new Integer[1]; - arrayThree = new int[1]; - - switch (wanted) { - case 0: return arrayOne; - case 1: return arrayTwo; - case 2: return arrayThree; - default: return null; - } - } - - static Object[] arrayCheck2(int wanted) { - String[][] arrayOne; - String[][] arrayTwo; - Integer[][] arrayThree; - - arrayOne = new String[1][]; - arrayTwo = new String[1][]; - arrayThree = new Integer[1][]; - - switch (wanted) { - case 0: return arrayOne; - case 1: return arrayTwo; - case 2: return arrayThree; - default: return null; - } - } - - static Object[] arrayCheck3(int wanted) { - String[][] arrayTwo; - String[][][][] arrayFour; - - arrayTwo = new String[1][]; - arrayFour = new String[1][][][]; - - switch (wanted) { - case 0: return arrayTwo; - case 1: return arrayFour; - default: return null; - } - } - - /* - * Check return type merge. - */ - private Type[] typeTest() { - if(this == null) { - return (Class<?>[])null; - } - return (Type[])null; - } - - - /* - * Exercise the blahs. - */ - static void tryBlah(int num) { - BlahFeature feature = null; // interface ref - - switch (num) { - case 1: - feature = new BlahOne(); - break; - default: - feature = new BlahTwo(); - break; - } - - feature.doStuff(); - } -} diff --git a/tests/053-wait-some/expected.txt b/tests/053-wait-some/expected.txt deleted file mode 100644 index 182892cc6..000000000 --- a/tests/053-wait-some/expected.txt +++ /dev/null @@ -1,7 +0,0 @@ -Caught expected exception on neg arg -Waiting for 200ms... -Waiting for 500ms... -Waiting for 1000ms... -Waiting for 2000ms... -Waiting for 3500ms... -Waiting for 8000ms... diff --git a/tests/053-wait-some/info.txt b/tests/053-wait-some/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/053-wait-some/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/053-wait-some/src/Main.java b/tests/053-wait-some/src/Main.java deleted file mode 100644 index 51e6c5214..000000000 --- a/tests/053-wait-some/src/Main.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -/** - * Exercise Object.wait(), comparing results against wall clock time. - */ -public class Main { - /* delays, in milliseconds */ - private final static long[] DELAYS = { - 200, 500, 1000, 2000, 3500, 8000 - }; - - public static void main(String[] args) { - boolean timing = (args.length >= 1) && args[0].equals("--timing"); - doit(timing); - } - - public static void doit(boolean timing) { - Object sleepy = new Object(); - long start, end; - - synchronized (sleepy) { - try { - sleepy.wait(-500); - System.out.println("HEY: didn't throw on negative arg"); - } catch (IllegalArgumentException iae) { - System.out.println("Caught expected exception on neg arg"); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - - for(long delay : DELAYS) { - System.out.println("Waiting for " + delay + "ms..."); - - start = System.currentTimeMillis(); - try { - sleepy.wait(delay); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - end = System.currentTimeMillis(); - - long elapsed = end - start; - boolean showTime = timing; - - if (! timing) { - long epsilon = delay / 10; - if (epsilon > 50) { - epsilon = 50; - } - - long min = delay - epsilon; - long max = delay + epsilon; - - if (elapsed < min) { - System.out.println(" Elapsed time was too short"); - showTime = true; - } else if (elapsed > max) { - System.out.println(" Elapsed time was too long: " - + "elapsed=" + elapsed + " max=" + max); - showTime = true; - } - } - - if (showTime) { - System.out.println(" Wall clock elapsed " - + elapsed + "ms"); - } - } - } - } -} diff --git a/tests/054-uncaught/expected.txt b/tests/054-uncaught/expected.txt deleted file mode 100644 index e7473be8a..000000000 --- a/tests/054-uncaught/expected.txt +++ /dev/null @@ -1,21 +0,0 @@ -Test 1 -Uncaught exception DEFAULT! -java.lang.NullPointerException: Hi diddly-ho, neighborino. - at Main.catchTheUncaught(Main.java:49) - at Main$Helper.run(Main.java:60) -Test 2 -Uncaught exception THREAD! -java.lang.NullPointerException: Hi diddly-ho, neighborino. - at Main.catchTheUncaught(Main.java:49) - at Main$Helper.run(Main.java:60) -Test 3 -Uncaught exception THREAD! -java.lang.NullPointerException: Hi diddly-ho, neighborino. - at Main.catchTheUncaught(Main.java:49) - at Main$Helper.run(Main.java:60) -Test 1 -Uncaught exception DEFAULT! -java.lang.NullPointerException: Hi diddly-ho, neighborino. - at Main.catchTheUncaught(Main.java:49) - at Main.main(Main.java:12) - at dalvik.system.NativeStart.main(Native Method) diff --git a/tests/054-uncaught/info.txt b/tests/054-uncaught/info.txt deleted file mode 100644 index 08127da23..000000000 --- a/tests/054-uncaught/info.txt +++ /dev/null @@ -1,6 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -TODO: Real description goes here. diff --git a/tests/054-uncaught/src/Main.java b/tests/054-uncaught/src/Main.java deleted file mode 100644 index 4ee6b050a..000000000 --- a/tests/054-uncaught/src/Main.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2006 The Android Open Source Project - -/** - * Test the uncaught exception handler. - */ -public class Main { - public static void main(String[] args) { - testThread(1); - testThread(2); - testThread(3); - - catchTheUncaught(1); - } - - private static void testThread(int which) { - Thread t = new Helper(which); - t.start(); - - try { - t.join(); - } catch (InterruptedException ex) { - ex.printStackTrace(); - } - } - - static void catchTheUncaught(int which) { - ThreadDeathHandler defHandler = new ThreadDeathHandler("DEFAULT"); - ThreadDeathHandler threadHandler = new ThreadDeathHandler("THREAD"); - - System.out.println("Test " + which); - switch (which) { - case 1: { - Thread.setDefaultUncaughtExceptionHandler(defHandler); - break; - } - case 2: { - Thread.currentThread().setUncaughtExceptionHandler( - threadHandler); - break; - } - case 3: { - Thread.setDefaultUncaughtExceptionHandler(defHandler); - Thread.currentThread().setUncaughtExceptionHandler( - threadHandler); - break; - } - } - - throw new NullPointerException("Hi diddly-ho, neighborino."); - } - - private static class Helper extends Thread { - private int which; - - public Helper(int which) { - this.which = which; - } - - public void run() { - catchTheUncaught(which); - } - } -} diff --git a/tests/054-uncaught/src/ThreadDeathHandler.java b/tests/054-uncaught/src/ThreadDeathHandler.java deleted file mode 100644 index 5ea61a52d..000000000 --- a/tests/054-uncaught/src/ThreadDeathHandler.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -import java.lang.Thread.UncaughtExceptionHandler; - -/** - * Report death-by-uncaught-exception. - */ -public class ThreadDeathHandler implements Thread.UncaughtExceptionHandler { - private String mMyMessage; - - public ThreadDeathHandler(String msg) { - mMyMessage = msg; - } - - public void uncaughtException(Thread t, Throwable e) { - System.err.println("Uncaught exception " + mMyMessage + "!"); - e.printStackTrace(); - } -} diff --git a/tests/055-enum-performance/expected.txt b/tests/055-enum-performance/expected.txt deleted file mode 100644 index ceb6bc4ac..000000000 --- a/tests/055-enum-performance/expected.txt +++ /dev/null @@ -1,12 +0,0 @@ -FOUR -ONE -FOURTEEN -NINE -FIVE -TWELVE -SamePackagePublicEnum -basis: performed 10000 iterations -test1: performed 10000 iterations -test2: performed 10000 iterations -test3: performed 10000 iterations -Timing is acceptable. diff --git a/tests/055-enum-performance/info.txt b/tests/055-enum-performance/info.txt deleted file mode 100644 index 2ea1b9d95..000000000 --- a/tests/055-enum-performance/info.txt +++ /dev/null @@ -1,2 +0,0 @@ -This is a performance test of Enum.valueOf(). To see the numbers, invoke -this test with the "--timing" option. diff --git a/tests/055-enum-performance/src/Main.java b/tests/055-enum-performance/src/Main.java deleted file mode 100644 index 43f45f1a8..000000000 --- a/tests/055-enum-performance/src/Main.java +++ /dev/null @@ -1,195 +0,0 @@ -import otherpackage.OtherPackagePublicEnum; - -public class Main { - /** used by {@link #basisCall} */ - static private int basisTestValue = 12; - - static public void main(String[] args) throws Exception { - boolean timing = (args.length >= 1) && args[0].equals("--timing"); - run(timing); - } - - static public void run(boolean timing) { - preTest(); - - long time0 = System.nanoTime(); - int count1 = test1(500); - long time1 = System.nanoTime(); - int count2 = test2(500); - long time2 = System.nanoTime(); - int count3 = test3(500); - long time3 = System.nanoTime(); - int count4 = basis(500); - long time4 = System.nanoTime(); - - System.out.println("basis: performed " + count4 + " iterations"); - System.out.println("test1: performed " + count1 + " iterations"); - System.out.println("test2: performed " + count2 + " iterations"); - System.out.println("test3: performed " + count3 + " iterations"); - - double msec1 = (time1 - time0) / (double) count1 / 1000000; - double msec2 = (time2 - time1) / (double) count2 / 1000000; - double msec3 = (time3 - time2) / (double) count3 / 1000000; - double basisMsec = (time4 - time3) / (double) count4 / 1000000; - - double avg = (msec1 + msec2 + msec3) / 3; - if (avg < (basisMsec * 10)) { - System.out.println("Timing is acceptable."); - } else { - System.out.println("Iterations are taking too long!"); - timing = true; - } - - if (timing) { - System.out.printf("basis time: %.3g msec\n", basisMsec); - System.out.printf("test1: %.3g msec per iteration\n", msec1); - System.out.printf("test2: %.3g msec per iteration\n", msec2); - System.out.printf("test3: %.3g msec per iteration\n", msec3); - } - - } - - static public void preTest() { - /* - * This is meant to ensure that the basic enum functionality - * really is working. - */ - - Class<SamePackagePublicEnum> c = SamePackagePublicEnum.class; - - System.out.println(Enum.valueOf(c, "FOUR")); - System.out.println(Enum.valueOf(c, "ONE")); - System.out.println(Enum.valueOf(c, "FOURTEEN")); - System.out.println(Enum.valueOf(c, "NINE")); - System.out.println(Enum.valueOf(c, "FIVE")); - System.out.println(Enum.valueOf(c, "TWELVE")); - - System.out.println(Enum.valueOf(c, "ZERO").getClass().getName()); - } - - static final String[] BASIS_COMPARE_ARRAY = { - "ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", - "NINE", "TEN", "ELEVEN", "TWELVE", "THIRTEEN", "FOURTEEN", "FIFTEEN", - "SIXTEEN", "SEVENTEEN", "EIGHTEEN", "NINETEEN" - }; - - static public int basis(int iters) { - for (int i = iters; i > 0; i--) { - basisValueOf("ZERO"); - basisValueOf("ONE"); - basisValueOf("TWO"); - basisValueOf("THREE"); - basisValueOf("FOUR"); - basisValueOf("FIVE"); - basisValueOf("SIX"); - basisValueOf("SEVEN"); - basisValueOf("EIGHT"); - basisValueOf("NINE"); - basisValueOf("TEN"); - basisValueOf("ELEVEN"); - basisValueOf("TWELVE"); - basisValueOf("THIRTEEN"); - basisValueOf("FOURTEEN"); - basisValueOf("FIFTEEN"); - basisValueOf("SIXTEEN"); - basisValueOf("SEVENTEEN"); - basisValueOf("EIGHTEEN"); - basisValueOf("NINETEEN"); - } - - return iters * 20; - } - - static String basisValueOf(String key) { - for (String s : BASIS_COMPARE_ARRAY) { - if (s.equals(key)) { - return s; - } - } - throw new IllegalArgumentException(); - } - - static public int test1(int iters) { - Class<SamePackagePublicEnum> c = SamePackagePublicEnum.class; - for (int i = iters; i > 0; i--) { - Enum.valueOf(c, "ZERO"); - Enum.valueOf(c, "ONE"); - Enum.valueOf(c, "TWO"); - Enum.valueOf(c, "THREE"); - Enum.valueOf(c, "FOUR"); - Enum.valueOf(c, "FIVE"); - Enum.valueOf(c, "SIX"); - Enum.valueOf(c, "SEVEN"); - Enum.valueOf(c, "EIGHT"); - Enum.valueOf(c, "NINE"); - Enum.valueOf(c, "TEN"); - Enum.valueOf(c, "ELEVEN"); - Enum.valueOf(c, "TWELVE"); - Enum.valueOf(c, "THIRTEEN"); - Enum.valueOf(c, "FOURTEEN"); - Enum.valueOf(c, "FIFTEEN"); - Enum.valueOf(c, "SIXTEEN"); - Enum.valueOf(c, "SEVENTEEN"); - Enum.valueOf(c, "EIGHTEEN"); - Enum.valueOf(c, "NINETEEN"); - } - - return iters * 20; - } - - static public int test2(int iters) { - Class<SamePackagePrivateEnum> c = SamePackagePrivateEnum.class; - for (int i = iters; i > 0; i--) { - Enum.valueOf(c, "ZERO"); - Enum.valueOf(c, "ONE"); - Enum.valueOf(c, "TWO"); - Enum.valueOf(c, "THREE"); - Enum.valueOf(c, "FOUR"); - Enum.valueOf(c, "FIVE"); - Enum.valueOf(c, "SIX"); - Enum.valueOf(c, "SEVEN"); - Enum.valueOf(c, "EIGHT"); - Enum.valueOf(c, "NINE"); - Enum.valueOf(c, "TEN"); - Enum.valueOf(c, "ELEVEN"); - Enum.valueOf(c, "TWELVE"); - Enum.valueOf(c, "THIRTEEN"); - Enum.valueOf(c, "FOURTEEN"); - Enum.valueOf(c, "FIFTEEN"); - Enum.valueOf(c, "SIXTEEN"); - Enum.valueOf(c, "SEVENTEEN"); - Enum.valueOf(c, "EIGHTEEN"); - Enum.valueOf(c, "NINETEEN"); - } - - return iters * 20; - } - - static public int test3(int iters) { - Class<OtherPackagePublicEnum> c = OtherPackagePublicEnum.class; - for (int i = iters; i > 0; i--) { - Enum.valueOf(c, "ZERO"); - Enum.valueOf(c, "ONE"); - Enum.valueOf(c, "TWO"); - Enum.valueOf(c, "THREE"); - Enum.valueOf(c, "FOUR"); - Enum.valueOf(c, "FIVE"); - Enum.valueOf(c, "SIX"); - Enum.valueOf(c, "SEVEN"); - Enum.valueOf(c, "EIGHT"); - Enum.valueOf(c, "NINE"); - Enum.valueOf(c, "TEN"); - Enum.valueOf(c, "ELEVEN"); - Enum.valueOf(c, "TWELVE"); - Enum.valueOf(c, "THIRTEEN"); - Enum.valueOf(c, "FOURTEEN"); - Enum.valueOf(c, "FIFTEEN"); - Enum.valueOf(c, "SIXTEEN"); - Enum.valueOf(c, "SEVENTEEN"); - Enum.valueOf(c, "EIGHTEEN"); - Enum.valueOf(c, "NINETEEN"); - } - - return iters * 20; - } -} diff --git a/tests/055-enum-performance/src/SamePackagePrivateEnum.java b/tests/055-enum-performance/src/SamePackagePrivateEnum.java deleted file mode 100644 index b6759f69f..000000000 --- a/tests/055-enum-performance/src/SamePackagePrivateEnum.java +++ /dev/null @@ -1,5 +0,0 @@ -/*package*/ enum SamePackagePrivateEnum { - ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, - TEN, ELEVEN, TWELVE, THIRTEEN, FOURTEEN, FIFTEEN, SIXTEEN, - SEVENTEEN, EIGHTEEN, NINETEEN; -} diff --git a/tests/055-enum-performance/src/SamePackagePublicEnum.java b/tests/055-enum-performance/src/SamePackagePublicEnum.java deleted file mode 100644 index 3a1c23046..000000000 --- a/tests/055-enum-performance/src/SamePackagePublicEnum.java +++ /dev/null @@ -1,5 +0,0 @@ -public enum SamePackagePublicEnum { - ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, - TEN, ELEVEN, TWELVE, THIRTEEN, FOURTEEN, FIFTEEN, SIXTEEN, - SEVENTEEN, EIGHTEEN, NINETEEN; -} diff --git a/tests/055-enum-performance/src/otherpackage/OtherPackagePublicEnum.java b/tests/055-enum-performance/src/otherpackage/OtherPackagePublicEnum.java deleted file mode 100644 index 4ef4d7878..000000000 --- a/tests/055-enum-performance/src/otherpackage/OtherPackagePublicEnum.java +++ /dev/null @@ -1,7 +0,0 @@ -package otherpackage; - -public enum OtherPackagePublicEnum { - ZERO, ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, - TEN, ELEVEN, TWELVE, THIRTEEN, FOURTEEN, FIFTEEN, SIXTEEN, - SEVENTEEN, EIGHTEEN, NINETEEN; -} diff --git a/tests/056-const-string-jumbo/build b/tests/056-const-string-jumbo/build deleted file mode 100644 index c5e35dbbc..000000000 --- a/tests/056-const-string-jumbo/build +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2008 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. - -# Stop if something fails. -set -e - -# Write out files with 32768 total static string declarations, so that -# the reference to "zorch" in the real test file will be guaranteed to -# need a jumbo string reference (it sorts last after all the others). -# Note: Each string reference is stored in a separate static variable, -# and that variable's name is also represented in the strings, which -# is why we can just have 32768 and not 65536 declarations. - -awk ' -BEGIN { - writeFile("Zorch1", 0, 16383); - writeFile("Zorch2", 16384, 32767); -} -function writeFile(name, start, end) { - fileName = "src/" name ".java"; - printf("public class %s {\n", name) > fileName; - for (i = start; i <= end; i++) { - printf(" static public final String s%d = \"%d\";\n", - i, i) > fileName; - } - printf("}\n") > fileName; -}' - -mkdir classes -${JAVAC} -d classes src/*.java - -dx -JXmx500m --debug --dex --no-optimize --positions=none --no-locals \ - --dump-to=classes.lst --output=classes.dex classes -zip test.jar classes.dex diff --git a/tests/056-const-string-jumbo/expected.txt b/tests/056-const-string-jumbo/expected.txt deleted file mode 100644 index bebbf9e7e..000000000 --- a/tests/056-const-string-jumbo/expected.txt +++ /dev/null @@ -1 +0,0 @@ -zorch diff --git a/tests/056-const-string-jumbo/info.txt b/tests/056-const-string-jumbo/info.txt deleted file mode 100644 index c4ba85600..000000000 --- a/tests/056-const-string-jumbo/info.txt +++ /dev/null @@ -1 +0,0 @@ -Test that the opcode const-string/jumbo works. diff --git a/tests/056-const-string-jumbo/src/Main.java b/tests/056-const-string-jumbo/src/Main.java deleted file mode 100644 index 68d6e539e..000000000 --- a/tests/056-const-string-jumbo/src/Main.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -public class Main { - static public void main(String[] args) { - System.out.println("zorch"); - } -} diff --git a/tests/058-enum-order/expected.txt b/tests/058-enum-order/expected.txt deleted file mode 100644 index b8124046c..000000000 --- a/tests/058-enum-order/expected.txt +++ /dev/null @@ -1,5 +0,0 @@ -0: CORN -1: BLUEBERRY -2: CRANBERRY -3: BRAN -4: BLACKBERRY diff --git a/tests/058-enum-order/info.txt b/tests/058-enum-order/info.txt deleted file mode 100644 index b9809fd59..000000000 --- a/tests/058-enum-order/info.txt +++ /dev/null @@ -1 +0,0 @@ -Test that the ordering of enums is as expected. diff --git a/tests/058-enum-order/src/Main.java b/tests/058-enum-order/src/Main.java deleted file mode 100644 index 2cd60525c..000000000 --- a/tests/058-enum-order/src/Main.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -/** - * Test enum ordering. - */ -public class Main { - public static enum Muffin { - CORN, BLUEBERRY, CRANBERRY, BRAN, BLACKBERRY; - } - - public static void main(String args[]) { - Muffin[] array = Muffin.class.getEnumConstants(); - for (Muffin m : array) { - System.out.println(m.ordinal() + ": " + m); - } - } -} diff --git a/tests/059-finalizer-throw/expected.txt b/tests/059-finalizer-throw/expected.txt deleted file mode 100644 index cbc9ece76..000000000 --- a/tests/059-finalizer-throw/expected.txt +++ /dev/null @@ -1,2 +0,0 @@ -In finalizer -done diff --git a/tests/059-finalizer-throw/info.txt b/tests/059-finalizer-throw/info.txt deleted file mode 100644 index 626137208..000000000 --- a/tests/059-finalizer-throw/info.txt +++ /dev/null @@ -1 +0,0 @@ -Verify that exceptions thrown from finalizers are ignored. diff --git a/tests/059-finalizer-throw/src/Main.java b/tests/059-finalizer-throw/src/Main.java deleted file mode 100644 index 42260e434..000000000 --- a/tests/059-finalizer-throw/src/Main.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -import java.util.Timer; -import java.util.TimerTask; - -/* - * Throw an exception from a finalizer and make sure it's harmless. Under - * Dalvik this may also generate a warning in the log file. - */ -public class Main { - static Object waiter = new Object(); - static volatile boolean didFinal = false; - - static void createAndForget() { - Main main = new Main(); - } - - public static void main(String[] args) { - createAndForget(); - - System.gc(); - System.runFinalization(); - - new Timer(true).schedule(new TimerTask() { - public void run() { - System.out.println("Timed out, exiting"); - System.exit(1); - } - }, 30000); - - while (!didFinal) { - try { - Thread.sleep(500); - } catch (InterruptedException ie) { - System.err.println(ie); - } - } - - /* give it a chance to cause mayhem */ - try { - Thread.sleep(750); - } catch (InterruptedException ie) { - System.err.println(ie); - } - - System.out.println("done"); - } - - protected void finalize() throws Throwable { - System.out.println("In finalizer"); - - didFinal = true; - - throw new InterruptedException("whee"); - } -} diff --git a/tests/061-out-of-memory/expected.txt b/tests/061-out-of-memory/expected.txt deleted file mode 100644 index ca876299f..000000000 --- a/tests/061-out-of-memory/expected.txt +++ /dev/null @@ -1,7 +0,0 @@ -tests beginning -Got expected huge-array OOM -testOomeLarge beginning -testOomeLarge succeeded -testOomeSmall beginning -testOomeSmall succeeded -tests succeeded diff --git a/tests/061-out-of-memory/info.txt b/tests/061-out-of-memory/info.txt deleted file mode 100644 index 523f3a22a..000000000 --- a/tests/061-out-of-memory/info.txt +++ /dev/null @@ -1 +0,0 @@ -Tests the various ways that an OutOfMemoryError can be constructed and thrown. diff --git a/tests/061-out-of-memory/src/Main.java b/tests/061-out-of-memory/src/Main.java deleted file mode 100644 index c812c8111..000000000 --- a/tests/061-out-of-memory/src/Main.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2008 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.util.Arrays; -import java.util.LinkedList; - -/** - * Exercise the construction and throwing of OutOfMemoryError. - */ -public class Main { - public static void main(String args[]) { - System.out.println("tests beginning"); - testHugeArray(); - testOomeLarge(); - testOomeSmall(); - System.out.println("tests succeeded"); - } - - private static void testHugeArray() { - try { - final int COUNT = 32768*32768 + 4; - int[] tooBig = new int[COUNT]; - - Arrays.fill(tooBig, 0xdd); - } catch (OutOfMemoryError oom) { - System.out.println("Got expected huge-array OOM"); - } - } - - private static void testOomeLarge() { - System.out.println("testOomeLarge beginning"); - - Boolean sawEx = false; - byte[] a; - - try { - // Just shy of the typical max heap size so that it will actually - // try to allocate it instead of short-circuiting. - a = new byte[(int) Runtime.getRuntime().maxMemory() - 32]; - } catch (OutOfMemoryError oom) { - //Log.i(TAG, "HeapTest/OomeLarge caught " + oom); - sawEx = true; - } - - if (!sawEx) { - throw new RuntimeException("Test failed: " + - "OutOfMemoryError not thrown"); - } - - System.out.println("testOomeLarge succeeded"); - } - - /* Do this in another method so that the GC has a chance of freeing the - * list afterwards. Even if we null out list when we're done, the conservative - * GC may see a stale pointer to it in a register. - */ - private static boolean testOomeSmallInternal() { - final int LINK_SIZE = 6 * 4; // estimated size of a LinkedList's node - - LinkedList<Object> list = new LinkedList<Object>(); - - /* Allocate progressively smaller objects to fill up the entire heap. - */ - int objSize = 1 * 1024 * 1024; - while (objSize >= LINK_SIZE) { - boolean sawEx = false; - try { - for (int i = 0; i < Runtime.getRuntime().maxMemory() / objSize; i++) { - list.add((Object)new byte[objSize]); - } - } catch (OutOfMemoryError oom) { - sawEx = true; - } - - if (!sawEx) { - return false; - } - - objSize = (objSize * 4) / 5; - } - - return true; - } - - private static void testOomeSmall() { - System.out.println("testOomeSmall beginning"); - if (!testOomeSmallInternal()) { - /* Can't reliably throw this from inside the internal function, because - * we may not be able to allocate the RuntimeException. - */ - throw new RuntimeException("Test failed: " + - "OutOfMemoryError not thrown while filling heap"); - } - System.out.println("testOomeSmall succeeded"); - } -} diff --git a/tests/062-character-encodings/expected.txt b/tests/062-character-encodings/expected.txt deleted file mode 100644 index b395a2a7a..000000000 --- a/tests/062-character-encodings/expected.txt +++ /dev/null @@ -1 +0,0 @@ -Missing: [] diff --git a/tests/062-character-encodings/info.txt b/tests/062-character-encodings/info.txt deleted file mode 100644 index bdf60bfae..000000000 --- a/tests/062-character-encodings/info.txt +++ /dev/null @@ -1 +0,0 @@ -Test that the list of character encodings is what we expect. diff --git a/tests/062-character-encodings/src/Main.java b/tests/062-character-encodings/src/Main.java deleted file mode 100644 index 6e9f0cd5b..000000000 --- a/tests/062-character-encodings/src/Main.java +++ /dev/null @@ -1,25 +0,0 @@ -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.SortedMap; -import java.util.Set; - -public class Main { - static public void main(String[] args) throws Exception { - // These charsets must be provided; anything else is optional. - List<String> standardCharsets = Arrays.asList("US-ASCII", "ISO-8859-1", - "UTF-8", "UTF-16BE", "UTF-16LE", "UTF-16"); - - SortedMap<String, Charset> all = Charset.availableCharsets(); - Set<String> needed = new HashSet<String>(standardCharsets); - for (Map.Entry<String, Charset> e : all.entrySet()) { - String canonicalName = e.getKey(); - needed.remove(canonicalName); - } - System.out.println("Missing: " + needed); - } -} diff --git a/tests/063-process-manager/expected.txt b/tests/063-process-manager/expected.txt deleted file mode 100644 index 836023977..000000000 --- a/tests/063-process-manager/expected.txt +++ /dev/null @@ -1,15 +0,0 @@ -process manager: nonexistent - -spawning child #1 -spawning child -process manager: RUNNABLE -child died -process manager: WAITING - -spawning child #2 -spawning child -process manager: RUNNABLE -child died -process manager: WAITING - -done! diff --git a/tests/063-process-manager/info.txt b/tests/063-process-manager/info.txt deleted file mode 100644 index e5907c41b..000000000 --- a/tests/063-process-manager/info.txt +++ /dev/null @@ -1,2 +0,0 @@ -Test that spawning a child process and then reaping it (a) works and (b) -doesn't cause the system to busy-wait. diff --git a/tests/063-process-manager/src/Main.java b/tests/063-process-manager/src/Main.java deleted file mode 100644 index 68bf87850..000000000 --- a/tests/063-process-manager/src/Main.java +++ /dev/null @@ -1,43 +0,0 @@ -import java.util.Map; - -public class Main { - static public void main(String[] args) throws Exception { - checkManager(); - for (int i = 1; i <= 2; i++) { - System.out.println("\nspawning child #" + i); - child(); - Thread.sleep(2000); - checkManager(); - } - System.out.println("\ndone!"); - } - - static private void child() throws Exception { - System.out.println("spawning child"); - ProcessBuilder pb = new ProcessBuilder("sleep", "5"); - Process proc = pb.start(); - Thread.sleep(1000); - checkManager(); - proc.waitFor(); - System.out.println("child died"); - } - - static private void checkManager() { - Map<Thread, StackTraceElement[]> traces = Thread.getAllStackTraces(); - boolean found = false; - - for (Map.Entry<Thread, StackTraceElement[]> entry : - traces.entrySet()) { - Thread t = entry.getKey(); - String name = t.getName(); - if (name.equals("java.lang.ProcessManager")) { - System.out.println("process manager: " + t.getState()); - found = true; - } - } - - if (! found) { - System.out.println("process manager: nonexistent"); - } - } -} diff --git a/tests/064-field-access/expected.txt b/tests/064-field-access/expected.txt deleted file mode 100644 index 0af56ba52..000000000 --- a/tests/064-field-access/expected.txt +++ /dev/null @@ -1,2 +0,0 @@ -good -Got expected failure diff --git a/tests/064-field-access/info.txt b/tests/064-field-access/info.txt deleted file mode 100644 index 442baf2f8..000000000 --- a/tests/064-field-access/info.txt +++ /dev/null @@ -1,10 +0,0 @@ -The documentation lists exceptional conditions and the exceptions that -should be thrown, but doesn't say which exception previals when two or -more exceptional conditions exist at the same time. For example, -attempting to set a protected field from an unrelated class causes an -IllegalAccessException, while passing in a data type that doesn't match -the field causes an IllegalArgumentException. If code does both at the -same time, we can only throw one or the other. - -This exercises the various failure modes to ensure that behavior is -equivalent, and not merely spec-compliant. diff --git a/tests/064-field-access/src/GetNonexistent.java b/tests/064-field-access/src/GetNonexistent.java deleted file mode 100644 index faad68680..000000000 --- a/tests/064-field-access/src/GetNonexistent.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class GetNonexistent { - public static void main(String[] args) { - Object obj = Holder.mObject; - } -} diff --git a/tests/064-field-access/src/Holder.java b/tests/064-field-access/src/Holder.java deleted file mode 100644 index 5e3402487..000000000 --- a/tests/064-field-access/src/Holder.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class Holder { - public static Object mObject = new Object(); -} diff --git a/tests/064-field-access/src/Main.java b/tests/064-field-access/src/Main.java deleted file mode 100644 index c068d2369..000000000 --- a/tests/064-field-access/src/Main.java +++ /dev/null @@ -1,345 +0,0 @@ -/* - * Copyright (C) 2008 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 other.OtherPackage; - -import java.lang.reflect.Field; - -/* - * Test field access through reflection. - */ -public class Main { - public static void main(String[] args) { - SubOther.main(null); - - try { - GetNonexistent.main(null); - System.err.println("Not expected to succeed"); - } catch (VerifyError fe) { - // dalvik - System.out.println("Got expected failure"); - } catch (NoSuchFieldError nsfe) { - // reference - System.out.println("Got expected failure"); - } - } - - /* - * Get the field specified by "field" from "obj". - * - * "type" determines which "get" call is made, e.g. 'B' turns into - * field.getByte(). - * - * The "expectedException" must match the class of the exception thrown, - * or be null if no exception was expected. - * - * On success, the boxed value retrieved is returned. - */ - public Object getValue(Field field, Object obj, char type, - Class expectedException) { - - Object result = null; - try { - switch (type) { - case 'Z': - result = new Boolean(field.getBoolean(obj)); - break; - case 'B': - result = new Byte(field.getByte(obj)); - break; - case 'S': - result = new Short(field.getShort(obj)); - break; - case 'C': - result = new Character(field.getChar(obj)); - break; - case 'I': - result = new Integer(field.getInt(obj)); - break; - case 'J': - result = new Long(field.getLong(obj)); - break; - case 'F': - result = new Float(field.getFloat(obj)); - break; - case 'D': - result = new Double(field.getDouble(obj)); - break; - case 'L': - result = field.get(obj); - break; - default: - throw new RuntimeException("bad type '" + type + "'"); - } - - /* success; expected? */ - if (expectedException != null) { - Throwable th = new Throwable(); - System.err.println("ERROR: call succeeded, was expecting " - + expectedException); - th.printStackTrace(); - } - } catch (Exception ex) { - if (expectedException == null) { - System.err.println("ERROR: call failed unexpectedly: " - + ex.getClass()); - ex.printStackTrace(); - } else { - if (!expectedException.equals(ex.getClass())) { - System.err.println("ERROR: incorrect exception: wanted " - + expectedException.getName() + ", got " - + ex.getClass()); - ex.printStackTrace(); - } - } - } - - return result; - } -} - -/* - * Local class with some fields. - */ -class SamePackage { - public byte pubByteField; - - protected byte protByteField; - protected Object protObjectField; - - private float privFloatField; -} - -/* - * This is a sub-class of OtherPackage, which should be allowed to access - * the various protected fields. - */ -class SubOther extends OtherPackage { - - protected long protLongField = 0x1122334455667788L; - - /* - * Perform the various tests. - * - * localInst.getValue() is performed using an instance of Main as the - * source of the reflection call. otherInst.getValue() uses a subclass - * of OtherPackage as the source. - */ - public static void main(String[] args) { - SubOther subOther = new SubOther(); - subOther.doTests(); - } - - public void doTests() { - Class localClass = SamePackage.class; - Class otherClass = OtherPackage.class; - Field localPubByteField, localProtByteField, localProtObjectField, - localPrivFloatField; - Field otherPubCharField, otherProtShortField, otherProtObjectField, - otherPkgDoubleField; - Field subProtLongField; - Main localInst = new Main(); - SamePackage samePkgInst = new SamePackage(); - OtherPackage otherPkgInst = new OtherPackage(); - Object plainObj = new Object(); - - /* - * Locate the various fields. - */ - try { - localPubByteField = localClass.getDeclaredField("pubByteField"); - localProtByteField = localClass.getDeclaredField("protByteField"); - localProtObjectField = localClass.getDeclaredField("protObjectField"); - localPrivFloatField = localClass.getDeclaredField("privFloatField"); - - otherPubCharField = otherClass.getDeclaredField("pubCharField"); - otherProtShortField = otherClass.getDeclaredField("protShortField"); - otherProtObjectField = otherClass.getDeclaredField("protObjectField"); - otherPkgDoubleField = otherClass.getDeclaredField("pkgDoubleField"); - - subProtLongField = getClass().getDeclaredField("protLongField"); - } catch (NoSuchFieldException nsfe) { - throw new RuntimeException(nsfe); - } - - /* - * Get a public field from a class in the same package. - */ - localInst.getValue(localPubByteField, samePkgInst, 'B', null); - - /* - * Get a protected field from a class in the same package. - */ - this.getValue(localProtByteField, samePkgInst, 'B', null); - - /* - * Get a private field from a class in the same package. - */ - this.getValue(localPrivFloatField, samePkgInst, 'F', - IllegalAccessException.class); - - /* - * Get a protected field from otherInst's superclass. - * - * We can get at "this.protShortField" but not - * "otherPkgInst.protShortField" because we can only access - * protected fields in instances of our class -- being a subclass - * of OtherPackage does not allow us to modify protected fields in - * all other subclasses of OtherPackage. - */ - this.getValue(otherProtShortField, this, 'S', - null); - this.getValue(otherProtShortField, otherPkgInst, 'S', - IllegalAccessException.class); - this.getValue(otherPkgDoubleField, otherPkgInst, 'D', - IllegalAccessException.class); - - /* - * Null object. Different exceptions based on which package - * we would be trying to access and whether or not our object - * has the correct type. - */ - localInst.getValue(localPubByteField, null, 'B', - NullPointerException.class); - - this.getValue(subProtLongField, null, 'J', - NullPointerException.class); - - this.getValue(localPrivFloatField, null, 'F', - IllegalAccessException.class); - - localInst.getValue(otherProtShortField, null, 'S', - IllegalAccessException.class); - this.getValue(otherProtShortField, null, 'S', - IllegalAccessException.class); - this.getValue(otherPkgDoubleField, null, 'D', - IllegalAccessException.class); - - localInst.getValue(otherProtShortField, null, 'Z', - IllegalAccessException.class); - /* -- Dalvik VM currently throws NPE - this.getValue(subProtLongField, null, 'Z', - IllegalArgumentException.class); - */ - - /* - * Valid object, wrong field type. - */ - this.getValue(subProtLongField, this, 'J', - null); - this.getValue(localProtByteField, samePkgInst, 'Z', - IllegalArgumentException.class); - this.getValue(subProtLongField, this, 'Z', - IllegalArgumentException.class); - this.getValue(localPrivFloatField, this, 'Z', - IllegalAccessException.class); - this.getValue(localPrivFloatField, this, 'Z', - IllegalAccessException.class); - localInst.getValue(otherProtShortField, otherPkgInst, 'Z', - IllegalAccessException.class); - this.getValue(otherProtShortField, otherPkgInst, 'Z', - IllegalAccessException.class); - - /* - * Wrong object. - */ - this.getValue(subProtLongField, plainObj, 'J', - IllegalArgumentException.class); - - /* wrong object + private field */ - this.getValue(localPrivFloatField, plainObj, 'F', - IllegalAccessException.class); - - /* wrong object + wrong field type */ - this.getValue(subProtLongField, plainObj, 'Z', - IllegalArgumentException.class); - - /* wrong object + invalid access */ - localInst.getValue(otherProtShortField, plainObj, 'S', - IllegalAccessException.class); - this.getValue(otherProtShortField, plainObj, 'S', - IllegalAccessException.class); - - System.out.println("good"); - } - - /* - * [this is a clone of Main.getValue() -- the class issuing the - * reflection call is significant] - */ - public Object getValue(Field field, Object obj, char type, - Class expectedException) { - - Object result = null; - try { - switch (type) { - case 'Z': - result = new Boolean(field.getBoolean(obj)); - break; - case 'B': - result = new Byte(field.getByte(obj)); - break; - case 'S': - result = new Short(field.getShort(obj)); - break; - case 'C': - result = new Character(field.getChar(obj)); - break; - case 'I': - result = new Integer(field.getInt(obj)); - break; - case 'J': - result = new Long(field.getLong(obj)); - break; - case 'F': - result = new Float(field.getFloat(obj)); - break; - case 'D': - result = new Double(field.getDouble(obj)); - break; - case 'L': - result = field.get(obj); - break; - default: - throw new RuntimeException("bad type '" + type + "'"); - } - - /* success; expected? */ - if (expectedException != null) { - Throwable th = new Throwable(); - System.err.println("ERROR: call succeeded, was expecting " - + expectedException); - th.printStackTrace(); - } - } catch (Exception ex) { - if (expectedException == null) { - System.err.println("ERROR: call failed unexpectedly: " - + ex.getClass()); - ex.printStackTrace(); - } else { - if (!expectedException.equals(ex.getClass())) { - System.err.println("ERROR: incorrect exception: wanted " - + expectedException.getName() + ", got " - + ex.getClass()); - ex.printStackTrace(); - } - } - } - - return result; - } - -} diff --git a/tests/064-field-access/src/other/OtherPackage.java b/tests/064-field-access/src/other/OtherPackage.java deleted file mode 100644 index a595db54c..000000000 --- a/tests/064-field-access/src/other/OtherPackage.java +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -package other; - -/* - * Declare a few fields to reflect upon. - */ -public class OtherPackage { - public char pubCharField = 0x8765; - - protected short protShortField = 0x1234; - protected Object protObjectField = "blah"; - - double pkgDoubleField = 3.141592654; -} diff --git a/tests/064-field-access/src2/Holder.java b/tests/064-field-access/src2/Holder.java deleted file mode 100644 index 28224d7b4..000000000 --- a/tests/064-field-access/src2/Holder.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class Holder { - //public static Object mObject = new Object(); -} diff --git a/tests/065-mismatched-implements/expected.txt b/tests/065-mismatched-implements/expected.txt deleted file mode 100644 index 09c05967d..000000000 --- a/tests/065-mismatched-implements/expected.txt +++ /dev/null @@ -1 +0,0 @@ -Got expected ICCE diff --git a/tests/065-mismatched-implements/info.txt b/tests/065-mismatched-implements/info.txt deleted file mode 100644 index 74c3ff377..000000000 --- a/tests/065-mismatched-implements/info.txt +++ /dev/null @@ -1,2 +0,0 @@ -This tests what happens when class A implements interface B, but somebody -turns B into an abstract class without rebuilding A. diff --git a/tests/065-mismatched-implements/src/Base.java b/tests/065-mismatched-implements/src/Base.java deleted file mode 100644 index 8623ad7bb..000000000 --- a/tests/065-mismatched-implements/src/Base.java +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -public class Base implements Defs { - public void func() { - System.out.println("whee"); - } -}; diff --git a/tests/065-mismatched-implements/src/Defs.java b/tests/065-mismatched-implements/src/Defs.java deleted file mode 100644 index bab92d842..000000000 --- a/tests/065-mismatched-implements/src/Defs.java +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -public interface Defs { - public void func(); - - // func2 not defined -} diff --git a/tests/065-mismatched-implements/src/Indirect.java b/tests/065-mismatched-implements/src/Indirect.java deleted file mode 100644 index 023e409f7..000000000 --- a/tests/065-mismatched-implements/src/Indirect.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -/** - * Error indirection class. - * - * Some VMs will load this class and fail on the "new" call, others will - * refuse to load this class at all. - */ -public class Indirect { - public static void main() { - Base base = new Base(); - } -} diff --git a/tests/065-mismatched-implements/src/Main.java b/tests/065-mismatched-implements/src/Main.java deleted file mode 100644 index 5975b99e9..000000000 --- a/tests/065-mismatched-implements/src/Main.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -/* - * Test field access through reflection. - */ -public class Main { - public static void main(String[] args) { - try { - Indirect.main(); - System.err.println("Succeeded unexpectedly"); - } catch (IncompatibleClassChangeError icce) { - System.out.println("Got expected ICCE"); - } - } -} diff --git a/tests/065-mismatched-implements/src2/Defs.java b/tests/065-mismatched-implements/src2/Defs.java deleted file mode 100644 index e7eb8a14a..000000000 --- a/tests/065-mismatched-implements/src2/Defs.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -public abstract class Defs { - public void func() { - System.out.println("yo"); - } - - public void func2() { - System.out.println("yo yo"); - } -} diff --git a/tests/066-mismatched-super/expected.txt b/tests/066-mismatched-super/expected.txt deleted file mode 100644 index 09c05967d..000000000 --- a/tests/066-mismatched-super/expected.txt +++ /dev/null @@ -1 +0,0 @@ -Got expected ICCE diff --git a/tests/066-mismatched-super/info.txt b/tests/066-mismatched-super/info.txt deleted file mode 100644 index 7865ffc4a..000000000 --- a/tests/066-mismatched-super/info.txt +++ /dev/null @@ -1,2 +0,0 @@ -This tests what happens when class A extends abstract class B, but somebody -turns B into an interface without rebuilding A. diff --git a/tests/066-mismatched-super/src/Base.java b/tests/066-mismatched-super/src/Base.java deleted file mode 100644 index 6180c8bbf..000000000 --- a/tests/066-mismatched-super/src/Base.java +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -public class Base extends Defs { - // no need to implement func(), provided by abstract class -}; diff --git a/tests/066-mismatched-super/src/Defs.java b/tests/066-mismatched-super/src/Defs.java deleted file mode 100644 index e7eb8a14a..000000000 --- a/tests/066-mismatched-super/src/Defs.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -public abstract class Defs { - public void func() { - System.out.println("yo"); - } - - public void func2() { - System.out.println("yo yo"); - } -} diff --git a/tests/066-mismatched-super/src/Indirect.java b/tests/066-mismatched-super/src/Indirect.java deleted file mode 100644 index 023e409f7..000000000 --- a/tests/066-mismatched-super/src/Indirect.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -/** - * Error indirection class. - * - * Some VMs will load this class and fail on the "new" call, others will - * refuse to load this class at all. - */ -public class Indirect { - public static void main() { - Base base = new Base(); - } -} diff --git a/tests/066-mismatched-super/src/Main.java b/tests/066-mismatched-super/src/Main.java deleted file mode 100644 index 5975b99e9..000000000 --- a/tests/066-mismatched-super/src/Main.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -/* - * Test field access through reflection. - */ -public class Main { - public static void main(String[] args) { - try { - Indirect.main(); - System.err.println("Succeeded unexpectedly"); - } catch (IncompatibleClassChangeError icce) { - System.out.println("Got expected ICCE"); - } - } -} diff --git a/tests/066-mismatched-super/src2/Defs.java b/tests/066-mismatched-super/src2/Defs.java deleted file mode 100644 index bab92d842..000000000 --- a/tests/066-mismatched-super/src2/Defs.java +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -public interface Defs { - public void func(); - - // func2 not defined -} diff --git a/tests/067-preemptive-unpark/expected.txt b/tests/067-preemptive-unpark/expected.txt deleted file mode 100644 index 12bfee059..000000000 --- a/tests/067-preemptive-unpark/expected.txt +++ /dev/null @@ -1,5 +0,0 @@ -Test starting -GC'ing -Asking thread to park -park() returned quickly -Test succeeded! diff --git a/tests/067-preemptive-unpark/info.txt b/tests/067-preemptive-unpark/info.txt deleted file mode 100644 index 0bc0c61c1..000000000 --- a/tests/067-preemptive-unpark/info.txt +++ /dev/null @@ -1 +0,0 @@ -Test that Unsafe.unpark() operates as expected, in particular across a gc. diff --git a/tests/067-preemptive-unpark/src/Main.java b/tests/067-preemptive-unpark/src/Main.java deleted file mode 100644 index a16219e60..000000000 --- a/tests/067-preemptive-unpark/src/Main.java +++ /dev/null @@ -1,107 +0,0 @@ -import sun.misc.Unsafe; - -import java.lang.reflect.Field; - -public class Main { - private static Unsafe UNSAFE; - - public static void main(String[] args) throws Exception { - setUp(); - - ParkTester test = new ParkTester(); - - System.out.println("Test starting"); - - test.start(); - UNSAFE.unpark(test); - clearStack(10); - - System.out.println("GC'ing"); - System.gc(); - System.gc(); - - System.out.println("Asking thread to park"); - test.parkNow = true; - - try { - Thread.sleep(1500); - } catch (InterruptedException ex) { - // Ignore it. - } - - if (test.success) { - System.out.println("Test succeeded!"); - } else { - System.out.println("Test failed."); - } - } - - /** - * Set up {@link #UNSAFE}. - */ - public static void setUp() { - /* - * Subvert the access check to get the unique Unsafe instance. - * We can do this because there's no security manager - * installed when running the test. - */ - try { - Field field = Unsafe.class.getDeclaredField("THE_ONE"); - field.setAccessible(true); - - UNSAFE = (Unsafe) field.get(null); - } catch (NoSuchFieldException ex) { - throw new RuntimeException(ex); - } catch (IllegalAccessException ex) { - throw new RuntimeException(ex); - } - } - - /** - * Scribbles on the stack to help ensure we don't have a fake - * pointer that would keep would-be garbage alive. - */ - private static void clearStack(int depth) { - int a = 0; - int b = 0; - int c = 0; - int d = 0; - int e = 0; - int f = 0; - int g = 0; - int h = 0; - int i = 0; - int j = 0; - - if (depth > 0) { - clearStack(depth - 1); - } - } - - private static class ParkTester extends Thread { - public volatile boolean parkNow = false; - public volatile boolean success = false; - - public void run() { - while (!parkNow) { - try { - Thread.sleep(500); - } catch (InterruptedException ex) { - // Ignore it. - } - } - - long start = System.currentTimeMillis(); - UNSAFE.park(false, 500 * 1000000); // 500 msec - long elapsed = System.currentTimeMillis() - start; - - if (elapsed > 200) { - System.out.println("park()ed for " + elapsed + " msec"); - success = false; - } else { - System.out.println("park() returned quickly"); - success = true; - } - } - } -} diff --git a/tests/068-classloader/expected.txt b/tests/068-classloader/expected.txt deleted file mode 100644 index bf131eee6..000000000 --- a/tests/068-classloader/expected.txt +++ /dev/null @@ -1,13 +0,0 @@ -base: class DoubledImplement -base2: class DoubledImplement2 -Got expected access exception #1 -Got expected CNFE/IAE #2 -Got expected CNFE/IAE #3 -Got expected LinkageError on DE -Got DEO result DoubledExtendOkay 1 -Got LinkageError on GD -Got LinkageError on TA -Ctor: doubled implement, type 1 -DoubledImplement one -Got LinkageError on DI (early) -Got LinkageError on IDI (early) diff --git a/tests/068-classloader/info.txt b/tests/068-classloader/info.txt deleted file mode 100644 index 421e52a3b..000000000 --- a/tests/068-classloader/info.txt +++ /dev/null @@ -1,8 +0,0 @@ -Class loaders allow code to "redefine" a given class, e.g. it's possible to -have multiple classes called "com.android.Blah" loaded simultaneously. The -classes are distinct and must be treated as such. This test exercises -some situations in which a VM that only checks the UTF-8 signatures could -mix things up. - -This also tests a couple of situations in which an IllegalAccessException -is expected. diff --git a/tests/068-classloader/src-ex/AbstractGet.java b/tests/068-classloader/src-ex/AbstractGet.java deleted file mode 100644 index db13b3279..000000000 --- a/tests/068-classloader/src-ex/AbstractGet.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -/** - * Verify that we don't reject this with a LinkageError. - */ -public class AbstractGet extends AbstractBase { - public DoubledExtendOkay getExtended() { - return new DoubledExtendOkay(); - } -} - -/** - * Abstract class, does not declare getAbstract. This cause the VM to - * generate a "miranda" method. - */ -abstract class AbstractBase extends BaseOkay { - public abstract DoubledExtendOkay getExtended(); -} diff --git a/tests/068-classloader/src-ex/DoubledExtend.java b/tests/068-classloader/src-ex/DoubledExtend.java deleted file mode 100644 index 6ad2708b1..000000000 --- a/tests/068-classloader/src-ex/DoubledExtend.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -/** - * Doubled sub-class, form #2. - */ -public class DoubledExtend extends Base { - public DoubledExtend() { - //System.out.println("Ctor: doubled extend, type 2"); - } - - @Override - public DoubledExtend getExtended() { - //System.out.println("getExtended 2"); - return new DoubledExtend(); - } - - public String getStr() { - return "DoubledExtend 2"; - } -} diff --git a/tests/068-classloader/src-ex/DoubledExtendOkay.java b/tests/068-classloader/src-ex/DoubledExtendOkay.java deleted file mode 100644 index 9674875b7..000000000 --- a/tests/068-classloader/src-ex/DoubledExtendOkay.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -/** - * "Okay" doubled sub-class, form #2. - */ -public class DoubledExtendOkay extends BaseOkay { - public DoubledExtendOkay() { - //System.out.println("Ctor: doubled extend okay, type 2"); - } - - /* - @Override - public DoubledExtendOkay getExtended() { - //System.out.println("getExtended 2"); - return new DoubledExtendOkay(); - } - */ - - public String getStr() { - return "DoubledExtendOkay 2"; - } -} diff --git a/tests/068-classloader/src-ex/DoubledImplement.java b/tests/068-classloader/src-ex/DoubledImplement.java deleted file mode 100644 index 5c44fc319..000000000 --- a/tests/068-classloader/src-ex/DoubledImplement.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -/** - * Doubled sub-class, form #2. - */ -public class DoubledImplement implements ICommon { - public DoubledImplement() { - System.out.println("Ctor: doubled implement, type 2"); - } - - public DoubledImplement getDoubledInstance() { - return new DoubledImplement(); - } - - public void two() { - System.out.println("DoubledImplement two"); - } -} diff --git a/tests/068-classloader/src-ex/DoubledImplement2.java b/tests/068-classloader/src-ex/DoubledImplement2.java deleted file mode 100644 index 24ecb6524..000000000 --- a/tests/068-classloader/src-ex/DoubledImplement2.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -/** - * Another doubled sub-class, form #2. - */ -public class DoubledImplement2 implements ICommon2 { - public DoubledImplement2() { - System.out.println("Ctor: doubled implement, type 2"); - } - - public DoubledImplement2 getDoubledInstance2() { - return new DoubledImplement2(); - } - - public void two() { - System.out.println("DoubledImplement2 two"); - } -} diff --git a/tests/068-classloader/src-ex/GetDoubled.java b/tests/068-classloader/src-ex/GetDoubled.java deleted file mode 100644 index 28ada1e56..000000000 --- a/tests/068-classloader/src-ex/GetDoubled.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -/* - * The interface we implement was declared in a different class loader, - * which means the DoubledExtend we return is not the one it was declared - * to return. - */ -public class GetDoubled implements IGetDoubled { - public DoubledExtendOkay getDoubled() { - return new DoubledExtendOkay(); - } -} diff --git a/tests/068-classloader/src-ex/IfaceImpl.java b/tests/068-classloader/src-ex/IfaceImpl.java deleted file mode 100644 index 7e9c27d71..000000000 --- a/tests/068-classloader/src-ex/IfaceImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -public class IfaceImpl implements IfaceSub { - public DoubledImplement2 getDoubledInstance2() { - return new DoubledImplement2(); - } -} diff --git a/tests/068-classloader/src-ex/IfaceSub.java b/tests/068-classloader/src-ex/IfaceSub.java deleted file mode 100644 index 7e512e76f..000000000 --- a/tests/068-classloader/src-ex/IfaceSub.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -public interface IfaceSub extends IfaceSuper { - public DoubledImplement2 getDoubledInstance2(); -} diff --git a/tests/068-classloader/src-ex/Inaccessible1.java b/tests/068-classloader/src-ex/Inaccessible1.java deleted file mode 100644 index 415a8a1b6..000000000 --- a/tests/068-classloader/src-ex/Inaccessible1.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -/** - * Non-public class, inaccessible from Main. Note the constructor is - * public. - */ -class Inaccessible1 extends SimpleBase { - public Inaccessible1() { - System.out.println("--- inaccessible1"); - } -} diff --git a/tests/068-classloader/src-ex/Inaccessible2.java b/tests/068-classloader/src-ex/Inaccessible2.java deleted file mode 100644 index dc20c21b9..000000000 --- a/tests/068-classloader/src-ex/Inaccessible2.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -/** - * Public class that can't access its base. - */ -public class Inaccessible2 extends InaccessibleBase { - public Inaccessible2() { - System.out.println("--- inaccessible2"); - } -} diff --git a/tests/068-classloader/src-ex/Inaccessible3.java b/tests/068-classloader/src-ex/Inaccessible3.java deleted file mode 100644 index 771d0f7ac..000000000 --- a/tests/068-classloader/src-ex/Inaccessible3.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -/** - * Public class that can't access its interface. - */ -public class Inaccessible3 implements InaccessibleInterface { - public Inaccessible3() { - System.out.println("--- inaccessible3"); - } -} diff --git a/tests/068-classloader/src/Base.java b/tests/068-classloader/src/Base.java deleted file mode 100644 index b297a8aa2..000000000 --- a/tests/068-classloader/src/Base.java +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -/** - * Common base class. - */ -public class Base { - public Base() {} - - public DoubledExtend getExtended() { - return new DoubledExtend(); - } - - public static String doStuff(DoubledExtend dt) { - return dt.getStr(); - } -} diff --git a/tests/068-classloader/src/BaseOkay.java b/tests/068-classloader/src/BaseOkay.java deleted file mode 100644 index 48b7796b3..000000000 --- a/tests/068-classloader/src/BaseOkay.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -/** - * Common base class. - */ -public class BaseOkay implements IDoubledExtendOkay { - public BaseOkay() {} - - public DoubledExtendOkay getExtended() { - return new DoubledExtendOkay(); - } - - public static String doStuff(DoubledExtendOkay dt) { - return dt.getStr(); - } -} - -/** - * Interface that declares the not-overridden method. This exists to ensure - * that the existence of an interface doesn't trip the check. - */ -interface IDoubledExtendOkay { - public DoubledExtendOkay getExtended(); -} diff --git a/tests/068-classloader/src/DoubledExtend.java b/tests/068-classloader/src/DoubledExtend.java deleted file mode 100644 index 5f8ebc20f..000000000 --- a/tests/068-classloader/src/DoubledExtend.java +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -/** - * Doubled sub-class, form #1. - */ -public class DoubledExtend extends Base { - public DoubledExtend() { - //System.out.println("Ctor: doubled extend, type 1"); - } - - @Override - public DoubledExtend getExtended() { - System.out.println("getExtended 1"); - return new DoubledExtend(); - } - - public String getStr() { - return "DoubledExtend 1"; - } -} diff --git a/tests/068-classloader/src/DoubledExtendOkay.java b/tests/068-classloader/src/DoubledExtendOkay.java deleted file mode 100644 index e226e5fc5..000000000 --- a/tests/068-classloader/src/DoubledExtendOkay.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -/** - * "Okay" doubled sub-class, form #1. - */ -public class DoubledExtendOkay extends BaseOkay { - public DoubledExtendOkay() { - //System.out.println("Ctor: doubled extend okay, type 1"); - } - - /* - @Override - public DoubledExtendOkay getExtended() { - System.out.println("getExtended 1"); - return new DoubledExtendOkay(); - } - */ - - public String getStr() { - return "DoubledExtendOkay 1"; - } -} diff --git a/tests/068-classloader/src/DoubledImplement.java b/tests/068-classloader/src/DoubledImplement.java deleted file mode 100644 index 64ec5e268..000000000 --- a/tests/068-classloader/src/DoubledImplement.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -/** - * Doubled sub-class, form #1. - */ -class DoubledImplement implements ICommon { - public DoubledImplement() { - System.out.println("Ctor: doubled implement, type 1"); - } - - public DoubledImplement getDoubledInstance() { - return new DoubledImplement(); - } - - public void one() { - System.out.println("DoubledImplement one"); - } -} diff --git a/tests/068-classloader/src/DoubledImplement2.java b/tests/068-classloader/src/DoubledImplement2.java deleted file mode 100644 index 12c036c93..000000000 --- a/tests/068-classloader/src/DoubledImplement2.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -/** - * Another doubled sub-class, form #1. - */ -public class DoubledImplement2 implements ICommon2 { - public DoubledImplement2() { - System.out.println("Ctor: doubled implement, type 1"); - } - - public DoubledImplement2 getDoubledInstance2() { - return new DoubledImplement2(); - } - - public void one() { - System.out.println("DoubledImplement2 one"); - } -} diff --git a/tests/068-classloader/src/FancyLoader.java b/tests/068-classloader/src/FancyLoader.java deleted file mode 100644 index d04083afc..000000000 --- a/tests/068-classloader/src/FancyLoader.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright (C) 2008 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.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; -import java.lang.reflect.InvocationTargetException; - -/** - * A class loader with atypical behavior: we try to load a private - * class implementation before asking the system or boot loader. This - * is used to create multiple classes with identical names in a single VM. - * - * If DexFile is available, we use that; if not, we assume we're not in - * Dalvik and instantiate the class with defineClass(). - * - * The location of the DEX files and class data is dependent upon the - * test framework. - */ -public class FancyLoader extends ClassLoader { - /* this is where the "alternate" .class files live */ - static final String CLASS_PATH = "classes-ex/"; - - /* this is the "alternate" DEX/Jar file */ - static final String DEX_FILE = "test-ex.jar"; - - /* on Dalvik, this is a DexFile; otherwise, it's null */ - private Class mDexClass; - - private Object mDexFile; - - /** - * Construct FancyLoader, grabbing a reference to the DexFile class - * if we're running under Dalvik. - */ - public FancyLoader(ClassLoader parent) { - super(parent); - - try { - mDexClass = parent.loadClass("dalvik.system.DexFile"); - } catch (ClassNotFoundException cnfe) { - // ignore -- not running Dalvik - } - } - - /** - * Finds the class with the specified binary name. - * - * We search for a file in CLASS_PATH or pull an entry from DEX_FILE. - * If we don't find a match, we throw an exception. - */ - protected Class<?> findClass(String name) throws ClassNotFoundException - { - if (mDexClass != null) { - return findClassDalvik(name); - } else { - return findClassNonDalvik(name); - } - } - - /** - * Finds the class with the specified binary name, from a DEX file. - */ - private Class<?> findClassDalvik(String name) - throws ClassNotFoundException { - - if (mDexFile == null) { - synchronized (FancyLoader.class) { - Constructor ctor; - /* - * Construct a DexFile object through reflection. - */ - try { - ctor = mDexClass.getConstructor(new Class[] {String.class}); - } catch (NoSuchMethodException nsme) { - throw new ClassNotFoundException("getConstructor failed", - nsme); - } - - try { - mDexFile = ctor.newInstance(DEX_FILE); - } catch (InstantiationException ie) { - throw new ClassNotFoundException("newInstance failed", ie); - } catch (IllegalAccessException iae) { - throw new ClassNotFoundException("newInstance failed", iae); - } catch (InvocationTargetException ite) { - throw new ClassNotFoundException("newInstance failed", ite); - } - } - } - - /* - * Call DexFile.loadClass(String, ClassLoader). - */ - Method meth; - - try { - meth = mDexClass.getMethod("loadClass", - new Class[] { String.class, ClassLoader.class }); - } catch (NoSuchMethodException nsme) { - throw new ClassNotFoundException("getMethod failed", nsme); - } - - try { - meth.invoke(mDexFile, name, this); - } catch (IllegalAccessException iae) { - throw new ClassNotFoundException("loadClass failed", iae); - } catch (InvocationTargetException ite) { - throw new ClassNotFoundException("loadClass failed", - ite.getCause()); - } - - return null; - } - - /** - * Finds the class with the specified binary name, from .class files. - */ - private Class<?> findClassNonDalvik(String name) - throws ClassNotFoundException { - - String pathName = CLASS_PATH + name + ".class"; - //System.out.println("--- Fancy: looking for " + pathName); - - File path = new File(pathName); - RandomAccessFile raf; - - try { - raf = new RandomAccessFile(path, "r"); - } catch (FileNotFoundException fnfe) { - throw new ClassNotFoundException("Not found: " + pathName); - } - - /* read the entire file in */ - byte[] fileData; - try { - fileData = new byte[(int) raf.length()]; - raf.readFully(fileData); - } catch (IOException ioe) { - throw new ClassNotFoundException("Read error: " + pathName); - } finally { - try { - raf.close(); - } catch (IOException ioe) { - // drop - } - } - - /* create the class */ - //System.out.println("--- Fancy: defining " + name); - try { - return defineClass(name, fileData, 0, fileData.length); - } catch (Throwable th) { - throw new ClassNotFoundException("defineClass failed", th); - } - } - - /** - * Load a class. - * - * Normally a class loader wouldn't override this, but we want our - * version of the class to take precedence over an already-loaded - * version. - * - * We still want the system classes (e.g. java.lang.Object) from the - * bootstrap class loader. - */ - protected Class<?> loadClass(String name, boolean resolve) - throws ClassNotFoundException - { - Class res; - - /* - * 1. Invoke findLoadedClass(String) to check if the class has - * already been loaded. - * - * This doesn't change. - */ - res = findLoadedClass(name); - if (res != null) { - System.out.println("FancyLoader.loadClass: " - + name + " already loaded"); - if (resolve) - resolveClass(res); - return res; - } - - /* - * 3. Invoke the findClass(String) method to find the class. - */ - try { - res = findClass(name); - if (resolve) - resolveClass(res); - } - catch (ClassNotFoundException e) { - // we couldn't find it, so eat the exception and keep going - } - - /* - * 2. Invoke the loadClass method on the parent class loader. If - * the parent loader is null the class loader built-in to the - * virtual machine is used, instead. - * - * (Since we're not in java.lang, we can't actually invoke the - * parent's loadClass() method, but we passed our parent to the - * super-class which can take care of it for us.) - */ - res = super.loadClass(name, resolve); // returns class or throws - return res; - } -} diff --git a/tests/068-classloader/src/ICommon.java b/tests/068-classloader/src/ICommon.java deleted file mode 100644 index 35a98cc5c..000000000 --- a/tests/068-classloader/src/ICommon.java +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -/** - * Common interface. - */ -public interface ICommon { - public DoubledImplement getDoubledInstance(); -} diff --git a/tests/068-classloader/src/ICommon2.java b/tests/068-classloader/src/ICommon2.java deleted file mode 100644 index 6d81afcb9..000000000 --- a/tests/068-classloader/src/ICommon2.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -/** - * Common interface. - */ -public interface ICommon2 { - public DoubledImplement2 getDoubledInstance2(); -} diff --git a/tests/068-classloader/src/IGetDoubled.java b/tests/068-classloader/src/IGetDoubled.java deleted file mode 100644 index 08cd1ce54..000000000 --- a/tests/068-classloader/src/IGetDoubled.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -/** - * Interface, loaded from one loader, used from another. - */ -public interface IGetDoubled { - public DoubledExtendOkay getDoubled(); -} diff --git a/tests/068-classloader/src/IfaceSuper.java b/tests/068-classloader/src/IfaceSuper.java deleted file mode 100644 index 36d278c5e..000000000 --- a/tests/068-classloader/src/IfaceSuper.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -public interface IfaceSuper { - public DoubledImplement2 getDoubledInstance2(); -} diff --git a/tests/068-classloader/src/InaccessibleBase.java b/tests/068-classloader/src/InaccessibleBase.java deleted file mode 100644 index 83af6659d..000000000 --- a/tests/068-classloader/src/InaccessibleBase.java +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -/** - * Non-public base class, inaccessible from alternate class loader. - */ -class InaccessibleBase { -} diff --git a/tests/068-classloader/src/InaccessibleInterface.java b/tests/068-classloader/src/InaccessibleInterface.java deleted file mode 100644 index 7f52b80f0..000000000 --- a/tests/068-classloader/src/InaccessibleInterface.java +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -/** - * Non-public interface class, inaccessible from alternate class loader. - */ -interface InaccessibleInterface { -} diff --git a/tests/068-classloader/src/Main.java b/tests/068-classloader/src/Main.java deleted file mode 100644 index 1bc7b04c5..000000000 --- a/tests/068-classloader/src/Main.java +++ /dev/null @@ -1,425 +0,0 @@ -/* - * Copyright (C) 2008 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 loader test. - */ -public class Main { - /** - * Main entry point. - */ - public static void main(String[] args) { - FancyLoader loader; - - loader = new FancyLoader(ClassLoader.getSystemClassLoader()); - //System.out.println("SYSTEM: " + ClassLoader.getSystemClassLoader()); - //System.out.println("ALTERN: " + loader); - - /* - * This statement has no effect on this program, but it can - * change the point where a LinkageException is thrown in - * testImplement(). When this is present the "reference - * implementation" throws an exception from Class.newInstance(), - * when it's absent the exception is deferred until the first time - * we call a method that isn't actually implemented. - * - * This isn't the class that fails -- it's a class with the same - * name in the "fancy" class loader -- but the VM thinks it has a - * reference to one of these; presumably the difference is that - * without this the VM finds itself holding a reference to an - * instance of an uninitialized class. - */ - System.out.println("base: " + DoubledImplement.class); - System.out.println("base2: " + DoubledImplement2.class); - - /* - * Run tests. - */ - testAccess1(loader); - testAccess2(loader); - testAccess3(loader); - - testExtend(loader); - testExtendOkay(loader); - testInterface(loader); - testAbstract(loader); - testImplement(loader); - testIfaceImplement(loader); - } - - /** - * See if we can load a class that isn't public to us. We should be - * able to load it but not instantiate it. - */ - static void testAccess1(ClassLoader loader) { - Class altClass; - - try { - altClass = loader.loadClass("Inaccessible1"); - } catch (ClassNotFoundException cnfe) { - System.err.println("loadClass failed"); - cnfe.printStackTrace(); - return; - } - - /* instantiate */ - Object obj; - try { - obj = altClass.newInstance(); - System.err.println("ERROR: Inaccessible1 was accessible"); - } catch (InstantiationException ie) { - System.err.println("newInstance failed: " + ie); - return; - } catch (IllegalAccessException iae) { - System.out.println("Got expected access exception #1"); - //System.out.println("+++ " + iae); - return; - } - } - - /** - * See if we can load a class whose base class is not accessible to it - * (though the base *is* accessible to us). - */ - static void testAccess2(ClassLoader loader) { - Class altClass; - - try { - altClass = loader.loadClass("Inaccessible2"); - System.err.println("ERROR: Inaccessible2 was accessible"); - } catch (ClassNotFoundException cnfe) { - Throwable cause = cnfe.getCause(); - if (cause instanceof IllegalAccessError) { - System.out.println("Got expected CNFE/IAE #2"); - } else { - System.err.println("Got unexpected CNFE/IAE #2"); - cnfe.printStackTrace(); - } - } - } - - /** - * See if we can load a class with an inaccessible interface. - */ - static void testAccess3(ClassLoader loader) { - Class altClass; - - try { - altClass = loader.loadClass("Inaccessible3"); - System.err.println("ERROR: Inaccessible3 was accessible"); - } catch (ClassNotFoundException cnfe) { - Throwable cause = cnfe.getCause(); - if (cause instanceof IllegalAccessError) { - System.out.println("Got expected CNFE/IAE #3"); - } else { - System.err.println("Got unexpected CNFE/IAE #3"); - cnfe.printStackTrace(); - } - } - } - - /** - * Test a doubled class that extends the base class. - */ - static void testExtend(ClassLoader loader) { - Class doubledExtendClass; - Object obj; - - /* get the "alternate" version of DoubledExtend */ - try { - doubledExtendClass = loader.loadClass("DoubledExtend"); - //System.out.println("+++ DoubledExtend is " + doubledExtendClass - // + " in " + doubledExtendClass.getClassLoader()); - } catch (ClassNotFoundException cnfe) { - System.err.println("loadClass failed: " + cnfe); - return; - } - - /* instantiate */ - try { - obj = doubledExtendClass.newInstance(); - } catch (InstantiationException ie) { - System.err.println("newInstance failed: " + ie); - return; - } catch (IllegalAccessException iae) { - System.err.println("newInstance failed: " + iae); - return; - } catch (LinkageError le) { - System.out.println("Got expected LinkageError on DE"); - return; - } - - /* use the base class reference to get a CL-specific instance */ - Base baseRef = (Base) obj; - DoubledExtend de = baseRef.getExtended(); - - /* try to call through it */ - try { - String result; - - result = Base.doStuff(de); - System.err.println("ERROR: did not get LinkageError on DE"); - System.err.println("(result=" + result + ")"); - } catch (LinkageError le) { - System.out.println("Got expected LinkageError on DE"); - return; - } - } - - /** - * Test a doubled class that extends the base class, but is okay since - * it doesn't override the base class method. - */ - static void testExtendOkay(ClassLoader loader) { - Class doubledExtendOkayClass; - Object obj; - - /* get the "alternate" version of DoubledExtendOkay */ - try { - doubledExtendOkayClass = loader.loadClass("DoubledExtendOkay"); - } catch (ClassNotFoundException cnfe) { - System.err.println("loadClass failed: " + cnfe); - return; - } - - /* instantiate */ - try { - obj = doubledExtendOkayClass.newInstance(); - } catch (InstantiationException ie) { - System.err.println("newInstance failed: " + ie); - return; - } catch (IllegalAccessException iae) { - System.err.println("newInstance failed: " + iae); - return; - } catch (LinkageError le) { - System.err.println("Got unexpected LinkageError on DEO"); - le.printStackTrace(); - return; - } - - /* use the base class reference to get a CL-specific instance */ - BaseOkay baseRef = (BaseOkay) obj; - DoubledExtendOkay de = baseRef.getExtended(); - - /* try to call through it */ - try { - String result; - - result = BaseOkay.doStuff(de); - System.out.println("Got DEO result " + result); - } catch (LinkageError le) { - System.err.println("Got unexpected LinkageError on DEO"); - le.printStackTrace(); - return; - } - } - - /** - * Try to access a doubled class through a class that implements - * an interface declared in a different class. - */ - static void testInterface(ClassLoader loader) { - Class getDoubledClass; - Object obj; - - /* get GetDoubled from the "alternate" class loader */ - try { - getDoubledClass = loader.loadClass("GetDoubled"); - } catch (ClassNotFoundException cnfe) { - System.err.println("loadClass failed: " + cnfe); - return; - } - - /* instantiate */ - try { - obj = getDoubledClass.newInstance(); - } catch (InstantiationException ie) { - System.err.println("newInstance failed: " + ie); - return; - } catch (IllegalAccessException iae) { - System.err.println("newInstance failed: " + iae); - return; - } catch (LinkageError le) { - // Dalvik bails here - System.out.println("Got LinkageError on GD"); - return; - } - - /* - * Cast the object to the interface, and try to use it. - */ - IGetDoubled iface = (IGetDoubled) obj; - try { - /* "de" will be the wrong variety of DoubledExtendOkay */ - DoubledExtendOkay de = iface.getDoubled(); - // reference impl bails here - String str = de.getStr(); - } catch (LinkageError le) { - System.out.println("Got LinkageError on GD"); - return; - } - System.err.println("Should have failed by now on GetDoubled"); - } - - /** - * Throw an abstract class into the middle and see what happens. - */ - static void testAbstract(ClassLoader loader) { - Class abstractGetClass; - Object obj; - - /* get AbstractGet from the "alternate" loader */ - try { - abstractGetClass = loader.loadClass("AbstractGet"); - } catch (ClassNotFoundException cnfe) { - System.err.println("loadClass ta failed: " + cnfe); - return; - } - - /* instantiate */ - try { - obj = abstractGetClass.newInstance(); - } catch (InstantiationException ie) { - System.err.println("newInstance failed: " + ie); - return; - } catch (IllegalAccessException iae) { - System.err.println("newInstance failed: " + iae); - return; - } catch (LinkageError le) { - System.out.println("Got LinkageError on TA"); - return; - } - - /* use the base class reference to get a CL-specific instance */ - BaseOkay baseRef = (BaseOkay) obj; - DoubledExtendOkay de = baseRef.getExtended(); - - /* try to call through it */ - try { - String result; - - result = BaseOkay.doStuff(de); - } catch (LinkageError le) { - System.out.println("Got LinkageError on TA"); - return; - } - System.err.println("Should have failed by now in testAbstract"); - } - - /** - * Test a doubled class that implements a common interface. - */ - static void testImplement(ClassLoader loader) { - Class doubledImplementClass; - Object obj; - - useImplement(new DoubledImplement(), true); - - /* get the "alternate" version of DoubledImplement */ - try { - doubledImplementClass = loader.loadClass("DoubledImplement"); - } catch (ClassNotFoundException cnfe) { - System.err.println("loadClass failed: " + cnfe); - return; - } - - /* instantiate */ - try { - obj = doubledImplementClass.newInstance(); - } catch (InstantiationException ie) { - System.err.println("newInstance failed: " + ie); - return; - } catch (IllegalAccessException iae) { - System.err.println("newInstance failed: " + iae); - return; - } catch (LinkageError le) { - System.out.println("Got LinkageError on DI (early)"); - return; - } - - /* if we lived this long, try to do something with it */ - ICommon icommon = (ICommon) obj; - useImplement(icommon.getDoubledInstance(), false); - } - - /** - * Do something with a DoubledImplement instance. - */ - static void useImplement(DoubledImplement di, boolean isOne) { - //System.out.println("useObject: " + di.toString() + " -- " - // + di.getClass().getClassLoader()); - try { - di.one(); - if (!isOne) { - System.err.println("ERROR: did not get LinkageError on DI"); - } - } catch (LinkageError le) { - if (!isOne) { - System.out.println("Got LinkageError on DI (late)"); - } else { - throw le; - } - } - } - - - /** - * Test a class that implements an interface with a super-interface - * that refers to a doubled class. - */ - static void testIfaceImplement(ClassLoader loader) { - Class ifaceImplClass; - Object obj; - - /* - * Create an instance of IfaceImpl. We also pull in - * DoubledImplement2 from the other class loader; without this - * we don't fail in some implementations. - */ - try { - ifaceImplClass = loader.loadClass("IfaceImpl"); - ifaceImplClass = loader.loadClass("DoubledImplement2"); - } catch (ClassNotFoundException cnfe) { - System.err.println("loadClass failed: " + cnfe); - return; - } - - /* instantiate */ - try { - obj = ifaceImplClass.newInstance(); - } catch (InstantiationException ie) { - System.err.println("newInstance failed: " + ie); - return; - } catch (IllegalAccessException iae) { - System.err.println("newInstance failed: " + iae); - return; - } catch (LinkageError le) { - System.out.println("Got LinkageError on IDI (early)"); - //System.out.println(le); - return; - } - - /* - * Without the pre-load of FancyLoader->DoubledImplement2, some - * implementations will happily execute through this part. "obj" - * comes from FancyLoader, but the di2 returned from ifaceSuper - * comes from the application class loader. - */ - IfaceSuper ifaceSuper = (IfaceSuper) obj; - DoubledImplement2 di2 = ifaceSuper.getDoubledInstance2(); - di2.one(); - } -} diff --git a/tests/068-classloader/src/SimpleBase.java b/tests/068-classloader/src/SimpleBase.java deleted file mode 100644 index fd56db9ed..000000000 --- a/tests/068-classloader/src/SimpleBase.java +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2008 The Android Open Source Project - -/** - * Simple, public base class. - */ -public class SimpleBase { - public SimpleBase() {} -} diff --git a/tests/068-classloader/src/Useless.java b/tests/068-classloader/src/Useless.java deleted file mode 100644 index f51d9a8f0..000000000 --- a/tests/068-classloader/src/Useless.java +++ /dev/null @@ -1,4 +0,0 @@ - -public class Useless implements ICommon { - public DoubledImplement getDoubledInstance() { return null; } -} diff --git a/tests/069-field-type/expected.txt b/tests/069-field-type/expected.txt deleted file mode 100644 index 88281780f..000000000 --- a/tests/069-field-type/expected.txt +++ /dev/null @@ -1,4 +0,0 @@ -Assignment was allowed -Got expected IncompatibleClassChangeError -In compareTo -Done diff --git a/tests/069-field-type/info.txt b/tests/069-field-type/info.txt deleted file mode 100644 index 6e3a22fd4..000000000 --- a/tests/069-field-type/info.txt +++ /dev/null @@ -1,4 +0,0 @@ -This tests to see if the VM allows you to store a reference to an -inappropriate object type in an instance field. By compiling two -versions of the field-holder class we can bypass the compiler's type -safety. diff --git a/tests/069-field-type/src/Blah.java b/tests/069-field-type/src/Blah.java deleted file mode 100644 index fd9833646..000000000 --- a/tests/069-field-type/src/Blah.java +++ /dev/null @@ -1,9 +0,0 @@ - -/** - * Trivial class; must implement an interesting interface. - */ -public class Blah implements Runnable { - public void run() { - System.out.println("run"); - } -} diff --git a/tests/069-field-type/src/Holder.java b/tests/069-field-type/src/Holder.java deleted file mode 100644 index e3c9f8936..000000000 --- a/tests/069-field-type/src/Holder.java +++ /dev/null @@ -1,7 +0,0 @@ - -/** - * Simple class with one field. - */ -public class Holder { - public Runnable mValue; -} diff --git a/tests/069-field-type/src/Main.java b/tests/069-field-type/src/Main.java deleted file mode 100644 index f9885e64b..000000000 --- a/tests/069-field-type/src/Main.java +++ /dev/null @@ -1,34 +0,0 @@ - -/** - * Create some objects and store them into an instance field. - */ -public class Main { - /** - * Entry point. - */ - public static void main(String[] args) { - Holder holder = new Holder(); - - Blah blah = new Blah(); - - /* strictly speaking, this should fail */ - holder.mValue = blah; - - System.out.println("Assignment was allowed"); - - /* try to use the reference; should fail */ - try { - holder.mValue.run(); - System.err.println("ERROR: did not get expected ICCE"); - } catch (IncompatibleClassChangeError icce) { - System.out.println("Got expected IncompatibleClassChangeError"); - } - - /* for fun, verify that it's the "alternate" type */ - //Comparable cmpx = holder.mValue; /* compiler rejects */ - Comparable cmp = (Comparable) holder.mValue; - cmp.compareTo(cmp); - - System.out.println("Done"); - } -} diff --git a/tests/069-field-type/src2/Blah.java b/tests/069-field-type/src2/Blah.java deleted file mode 100644 index 1bffff6c4..000000000 --- a/tests/069-field-type/src2/Blah.java +++ /dev/null @@ -1,10 +0,0 @@ - -/** - * Trivial class; must implement an interesting interface. - */ -public class Blah implements Comparable { - public int compareTo(Object another) { - System.out.println("In compareTo"); - return 0; - } -} diff --git a/tests/070-nio-buffer/expected.txt b/tests/070-nio-buffer/expected.txt deleted file mode 100644 index ddb45af6b..000000000 --- a/tests/070-nio-buffer/expected.txt +++ /dev/null @@ -1,6 +0,0 @@ -Direct byte buffer has array: true -Got expected buffer overflow exception -Got expected out-of-bounds exception -Got expected buffer overflow exception -00fbfb2ec03000001234567840490fd01122334455667788000000000000000100000000 -ccfb2efb30c0cccc78563412d00f494088776655443322110100000000000000cccccccc diff --git a/tests/070-nio-buffer/info.txt b/tests/070-nio-buffer/info.txt deleted file mode 100644 index 761714eed..000000000 --- a/tests/070-nio-buffer/info.txt +++ /dev/null @@ -1 +0,0 @@ -Exercise NIO buffers (e.g. java.nio.ByteBuffer). diff --git a/tests/070-nio-buffer/src/Main.java b/tests/070-nio-buffer/src/Main.java deleted file mode 100644 index a7433b851..000000000 --- a/tests/070-nio-buffer/src/Main.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (C) 2008 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.nio.BufferOverflowException; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.CharBuffer; -import java.nio.DoubleBuffer; -import java.nio.FloatBuffer; -import java.nio.IntBuffer; -import java.nio.LongBuffer; -import java.nio.ShortBuffer; - -public class Main { - public static void main(String[] args) { - ByteBuffer buf = ByteBuffer.allocateDirect(16); - System.out.println("Direct byte buffer has array: " + buf.hasArray()); - - intFloatTest(); - basicShortTest(); - primTest(); - } - - /* - * Create a buffer and fiddle with it. - */ - public static void basicShortTest() { - ByteBuffer directBuf = ByteBuffer.allocateDirect(64); - //ByteBuffer directBuf = ByteBuffer.allocateDirect(65); - - ShortBuffer shortBuf = directBuf.asShortBuffer(); - - short[] myShorts = { - 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, - 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, - 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, - 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031 - }; - - shortBuf.position(0); - shortBuf.put(myShorts, 0, 32); // should work - shortBuf.position(0); - shortBuf.put(myShorts, 16, 16); // should work - shortBuf.put(myShorts, 16, 16); // advance to end - - try { - shortBuf.put(myShorts, 0, 1); // should fail - System.err.println("ERROR: out-of-bounds put succeeded\n"); - } catch (BufferOverflowException boe) { - System.out.println("Got expected buffer overflow exception"); - } - - try { - shortBuf.position(0); - shortBuf.put(myShorts, 0, 33); // should fail - System.err.println("ERROR: out-of-bounds put succeeded\n"); - } catch (IndexOutOfBoundsException ioobe) { - System.out.println("Got expected out-of-bounds exception"); - } - - try { - shortBuf.position(16); - shortBuf.put(myShorts, 0, 17); // should fail - System.err.println("ERROR: out-of-bounds put succeeded\n"); - } catch (BufferOverflowException boe) { - System.out.println("Got expected buffer overflow exception"); - } - } - - /* - * Try this with either floats or ints; ints fail with - * BufferOverflowException, floats work. - * - * From http://code.google.com/p/android/issues/detail?id=1585 . - */ - public static void intFloatTest() { - ByteBuffer direct = ByteBuffer.allocateDirect(100); - direct.order(ByteOrder.nativeOrder()); - IntBuffer int1 = direct.asIntBuffer(); - int data[] = new int[25]; - //FloatBuffer int1 = direct.asFloatBuffer(); - //float data[] = new float[25]; - int1.clear (); - int1.put (data); - int1.position (0); - - int1.clear (); - int1.put (data); - int1.position (0); - } - - /* - * Exercise all "view buffer" classes, in both byte orders. - */ - public static void primTest() { - ByteBuffer directBuf = ByteBuffer.allocateDirect(36); - directBuf.order(ByteOrder.BIG_ENDIAN); - storeValues(directBuf); - - for (int i = 0; i < 36; i++) { - directBuf.put(i, (byte) 0xcc); - } - - directBuf.order(ByteOrder.LITTLE_ENDIAN); - storeValues(directBuf); - } - - static void storeValues(ByteBuffer directBuf) { - directBuf.position(0); - ShortBuffer shortBuf = directBuf.asShortBuffer(); - CharBuffer charBuf = directBuf.asCharBuffer(); - IntBuffer intBuf = directBuf.asIntBuffer(); - FloatBuffer floatBuf = directBuf.asFloatBuffer(); - LongBuffer longBuf = directBuf.asLongBuffer(); - DoubleBuffer doubleBuf = directBuf.asDoubleBuffer(); - - final byte byteValue = -5; - final short shortValue = -1234; - final char charValue = 49200; - final int intValue = 0x12345678; - final float floatValue = 3.14159f; - final long longValue = 0x1122334455667788L; - final double doubleValue = Double.MIN_VALUE; - - if (directBuf.put(1, byteValue).get(1) != byteValue) { - throw new RuntimeException("byte get/store failed"); - } - if (shortBuf.put(1, shortValue).get(1) != shortValue) { - throw new RuntimeException("short get/store failed"); - } - if (charBuf.put(2, charValue).get(2) != charValue) { - throw new RuntimeException("char get/store failed"); - } - if (intBuf.put(2, intValue).get(2) != intValue) { - throw new RuntimeException("int get/store failed"); - } - if (floatBuf.put(3, floatValue).get(3) != floatValue) { - throw new RuntimeException("float get/store failed"); - } - if (longBuf.put(2, longValue).get(2) != longValue) { - throw new RuntimeException("long get/store failed"); - } - if (doubleBuf.put(3, doubleValue).get(3) != doubleValue) { - throw new RuntimeException("double get/store failed"); - } - - directBuf.position(0); - char[] outBuf = new char[directBuf.limit() * 2]; - for (int i = 0; i < directBuf.limit(); i++) { - byte b = directBuf.get(); - outBuf[i*2] = hexChar((byte) ((b >> 4) & 0x0f)); - outBuf[i*2+1] = hexChar((byte) (b & 0x0f)); - } - System.out.println(new String(outBuf)); - } - - static char hexChar(byte b) { - if (b < 10) { - return (char) ('0' + b); - } else { - return (char) ('a' + b - 10); - } - } -} diff --git a/tests/071-dexfile/expected.txt b/tests/071-dexfile/expected.txt deleted file mode 100644 index b7af75ed2..000000000 --- a/tests/071-dexfile/expected.txt +++ /dev/null @@ -1,3 +0,0 @@ -Constructing another -Got expected ULE -done diff --git a/tests/071-dexfile/info.txt b/tests/071-dexfile/info.txt deleted file mode 100644 index 54d9ed0e8..000000000 --- a/tests/071-dexfile/info.txt +++ /dev/null @@ -1,4 +0,0 @@ -Exercise some Dalvik-specific DEX file features. This is not expected to -work on other VMs. - -NOTE: the test requires that /sdcard exists and is writable. diff --git a/tests/071-dexfile/src-ex/Another.java b/tests/071-dexfile/src-ex/Another.java deleted file mode 100644 index c978c596a..000000000 --- a/tests/071-dexfile/src-ex/Another.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -public class Another { - public Another() { - System.out.println("Constructing another"); - - /* not expected to work; just exercises the call */ - try { - System.loadLibrary("nonexistent"); - } catch (UnsatisfiedLinkError ule) { - System.out.println("Got expected ULE"); - } - } -} diff --git a/tests/071-dexfile/src/Main.java b/tests/071-dexfile/src/Main.java deleted file mode 100644 index d71aec028..000000000 --- a/tests/071-dexfile/src/Main.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2008 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.io.File; -import java.io.IOException; -import java.lang.reflect.Constructor; - -/** - * DexFile tests (Dalvik-specific). - */ -public class Main { - private static final String CLASS_PATH = "test-ex.jar"; - private static final String ODEX_DIR = "/sdcard"; - //private static final String ODEX_DIR = "."; - private static final String ODEX_ALT = "/tmp"; - private static final String LIB_DIR = "/nowhere/nothing/"; - - /** - * Prep the environment then run the test. - */ - public static void main(String[] args) { - Process p; - try { - /* - * Create a sub-process to see if the ProcessManager wait - * interferes with the dexopt invocation wait. - * - * /dev/random never hits EOF, so we're sure that we'll still - * be waiting for the process to complete. On the device it - * stops pretty quickly (which means the child won't be - * spinning). - */ - ProcessBuilder pb = new ProcessBuilder("cat", "/dev/random"); - p = pb.start(); - } catch (IOException ioe) { - System.err.println("cmd failed: " + ioe.getMessage()); - p = null; - } - - try { - testDexClassLoader(); - } finally { - // shouldn't be necessary, but it's good to be tidy - if (p != null) - p.destroy(); - - // let the ProcessManager's daemon thread finish before we shut down - // (avoids the occasional segmentation fault) - try { - Thread.sleep(500); - } catch (Exception ex) {} - } - - System.out.println("done"); - } - - /** - * Create a class loader, explicitly specifying the source DEX and - * the location for the optimized DEX. - */ - private static void testDexClassLoader() { - ClassLoader dexClassLoader = getDexClassLoader(); - - Class anotherClass; - try { - anotherClass = dexClassLoader.loadClass("Another"); - } catch (ClassNotFoundException cnfe) { - throw new RuntimeException("Another?"); - } - - Object another; - try { - another = anotherClass.newInstance(); - } catch (IllegalAccessException ie) { - throw new RuntimeException("new another", ie); - } catch (InstantiationException ie) { - throw new RuntimeException("new another", ie); - } - - // not expected to work; just exercises the call - dexClassLoader.getResource("nonexistent"); - } - - /* - * Create an instance of DexClassLoader. The test harness doesn't - * have visibility into dalvik.system.*, so we do this through - * reflection. - */ - private static ClassLoader getDexClassLoader() { - String odexDir; - - /* - String androidData = System.getenv("ANDROID_DATA"); - if (androidData == null) - androidData = ""; - odexDir = androidData + "/" + ODEX_DIR; - */ - - File test = new File(ODEX_DIR); - if (test.isDirectory()) - odexDir = ODEX_DIR; - else - odexDir = ODEX_ALT; - //System.out.println("Output dir is " + odexDir); - - ClassLoader myLoader = Main.class.getClassLoader(); - Class dclClass; - try { - dclClass = myLoader.loadClass("dalvik.system.DexClassLoader"); - } catch (ClassNotFoundException cnfe) { - throw new RuntimeException("dalvik.system.DexClassLoader not found"); - } - - Constructor ctor; - try { - ctor = dclClass.getConstructor(String.class, String.class, - String.class, ClassLoader.class); - } catch (NoSuchMethodException nsme) { - throw new RuntimeException("DCL ctor", nsme); - } - - // create an instance, using the path we found - Object dclObj; - try { - dclObj = ctor.newInstance(CLASS_PATH, odexDir, LIB_DIR, myLoader); - } catch (Exception ex) { - throw new RuntimeException("DCL newInstance", ex); - } - - return (ClassLoader) dclObj; - } -} diff --git a/tests/072-precise-gc/expected.txt b/tests/072-precise-gc/expected.txt deleted file mode 100644 index 18ec087af..000000000 --- a/tests/072-precise-gc/expected.txt +++ /dev/null @@ -1,2 +0,0 @@ -Valid refs: 0 -String0String1String2String3String4String5String6String7String8String9 diff --git a/tests/072-precise-gc/info.txt b/tests/072-precise-gc/info.txt deleted file mode 100644 index b0b2cea9f..000000000 --- a/tests/072-precise-gc/info.txt +++ /dev/null @@ -1 +0,0 @@ -Try to detect whether precise GC is working. diff --git a/tests/072-precise-gc/src/Main.java b/tests/072-precise-gc/src/Main.java deleted file mode 100644 index e0492218d..000000000 --- a/tests/072-precise-gc/src/Main.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (C) 2009 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.ref.WeakReference; - -public class Main { - public static void main(String[] args) { - staleStackTest(); - } - - public static void staleStackTest() { - WeakReference wrefs[] = new WeakReference[10]; - - populate(wrefs); - - check(wrefs); - } - - static void populate(WeakReference[] wrefs) { - /* - * Get a bunch of non-constant String objects into registers. These - * should be the first locals declared. - */ - String str0 = generateString("String", 0); - String str1 = generateString("String", 1); - String str2 = generateString("String", 2); - String str3 = generateString("String", 3); - String str4 = generateString("String", 4); - String str5 = generateString("String", 5); - String str6 = generateString("String", 6); - String str7 = generateString("String", 7); - String str8 = generateString("String", 8); - String str9 = generateString("String", 9); - - /* stuff them into the weak references array */ - wrefs[0] = new WeakReference(str0); - wrefs[1] = new WeakReference(str1); - wrefs[2] = new WeakReference(str2); - wrefs[3] = new WeakReference(str3); - wrefs[4] = new WeakReference(str4); - wrefs[5] = new WeakReference(str5); - wrefs[6] = new WeakReference(str6); - wrefs[7] = new WeakReference(str7); - wrefs[8] = new WeakReference(str8); - wrefs[9] = new WeakReference(str9); - } - - static String generateString(String base, int num) { - return base + num; - } - - static void check(WeakReference[] wrefs) { - /* - * Declare locals so that our stack overlaps the same region - * that populate() did. - */ - String str0; - String str1; - String str2; - String str3; - String str4; - String str5; - String str6; - String str7; - String str8; - String str9; - int numValid = 0; - - /* - * This *should* blow out all the weakly-reference objects. If - * we still have stale copies of references on the stack, a - * conservative GC will try to hold on to those objects and the - * count will be nonzero. - * - * Getting a zero result here isn't conclusive, but it's a strong - * indicator that precise GC is having an impact. - */ - System.gc(); - - for (int i = 0; i < wrefs.length; i++) { - if (wrefs[i].get() != null) - numValid++; - } - - System.out.println("Valid refs: " + numValid); - - /* use the locals in case the compiler gets smart */ - str0 = generateString("String", 0); - str1 = generateString("String", 1); - str2 = generateString("String", 2); - str3 = generateString("String", 3); - str4 = generateString("String", 4); - str5 = generateString("String", 5); - str6 = generateString("String", 6); - str7 = generateString("String", 7); - str8 = generateString("String", 8); - str9 = generateString("String", 9); - System.out.println(str0+str1+str2+str3+str4+str5+str6+str7+str8+str9); - } -} diff --git a/tests/073-mismatched-field/expected.txt b/tests/073-mismatched-field/expected.txt deleted file mode 100644 index 90fbab87a..000000000 --- a/tests/073-mismatched-field/expected.txt +++ /dev/null @@ -1 +0,0 @@ -Got expected failure diff --git a/tests/073-mismatched-field/info.txt b/tests/073-mismatched-field/info.txt deleted file mode 100644 index 4a15263e4..000000000 --- a/tests/073-mismatched-field/info.txt +++ /dev/null @@ -1,3 +0,0 @@ -Test behavior when an instance field is overlapped (through separate -compilation) by a static field. The VM is expected to detect the conflict -and throw an IncompatibleClassChangeError when the field is accessed. diff --git a/tests/073-mismatched-field/src/IMain.java b/tests/073-mismatched-field/src/IMain.java deleted file mode 100644 index 3ad5ecb72..000000000 --- a/tests/073-mismatched-field/src/IMain.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public interface IMain { - //static int f = 123; -} diff --git a/tests/073-mismatched-field/src/Main.java b/tests/073-mismatched-field/src/Main.java deleted file mode 100644 index 70709c0c8..000000000 --- a/tests/073-mismatched-field/src/Main.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class Main extends SuperMain implements IMain { - public static void main(String[] args) { - Main main = new Main(); - main.doit(); - } - - void doit() { - try { - System.out.println("value=" + this.f); - System.err.println("Succeeded unexpectedly"); - } catch (IncompatibleClassChangeError icce) { - System.out.println("Got expected failure"); - } - } -} diff --git a/tests/073-mismatched-field/src/SuperMain.java b/tests/073-mismatched-field/src/SuperMain.java deleted file mode 100644 index 48a9bab69..000000000 --- a/tests/073-mismatched-field/src/SuperMain.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class SuperMain { - public int f = 456; -} diff --git a/tests/073-mismatched-field/src2/IMain.java b/tests/073-mismatched-field/src2/IMain.java deleted file mode 100644 index 136f2a15e..000000000 --- a/tests/073-mismatched-field/src2/IMain.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public interface IMain { - static int f = 123; -} diff --git a/tests/074-gc-thrash/expected.txt b/tests/074-gc-thrash/expected.txt deleted file mode 100644 index 26691659b..000000000 --- a/tests/074-gc-thrash/expected.txt +++ /dev/null @@ -1,2 +0,0 @@ -Running (10 seconds) ... -Done. diff --git a/tests/074-gc-thrash/info.txt b/tests/074-gc-thrash/info.txt deleted file mode 100644 index ded1582ca..000000000 --- a/tests/074-gc-thrash/info.txt +++ /dev/null @@ -1 +0,0 @@ -This thrashes the memory allocator and garbage collector for a brief period. diff --git a/tests/074-gc-thrash/src/Main.java b/tests/074-gc-thrash/src/Main.java deleted file mode 100644 index f85aa4bde..000000000 --- a/tests/074-gc-thrash/src/Main.java +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Copyright (C) 2009 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.io.File; -import java.lang.ref.WeakReference; -import java.lang.reflect.Method; -import java.lang.reflect.InvocationTargetException; - -public class Main { - public static volatile boolean quit = false; - public static final boolean DEBUG = false; - - private static final boolean WRITE_HPROF_DATA = false; - private static final int TEST_TIME = 10; - private static final String OUTPUT_FILE = "gc-thrash.hprof"; - - public static void main(String[] args) { - // dump heap before - - System.out.println("Running (" + TEST_TIME + " seconds) ..."); - runTests(); - - Method dumpHprofDataMethod = null; - String dumpFile = null; - - if (WRITE_HPROF_DATA) { - dumpHprofDataMethod = getDumpHprofDataMethod(); - if (dumpHprofDataMethod != null) { - dumpFile = getDumpFileName(); - System.out.println("Sending output to " + dumpFile); - } - } - - System.gc(); - System.runFinalization(); - System.gc(); - - if (WRITE_HPROF_DATA && dumpHprofDataMethod != null) { - try { - dumpHprofDataMethod.invoke(null, dumpFile); - } catch (IllegalAccessException iae) { - System.err.println(iae); - } catch (InvocationTargetException ite) { - System.err.println(ite); - } - } - - System.out.println("Done."); - } - - /** - * Finds VMDebug.dumpHprofData() through reflection. In the reference - * implementation this will not be available. - * - * @return the reflection object, or null if the method can't be found - */ - private static Method getDumpHprofDataMethod() { - ClassLoader myLoader = Main.class.getClassLoader(); - Class vmdClass; - try { - vmdClass = myLoader.loadClass("dalvik.system.VMDebug"); - } catch (ClassNotFoundException cnfe) { - return null; - } - - Method meth; - try { - meth = vmdClass.getMethod("dumpHprofData", - new Class[] { String.class }); - } catch (NoSuchMethodException nsme) { - System.err.println("Found VMDebug but not dumpHprofData method"); - return null; - } - - return meth; - } - - private static String getDumpFileName() { - File tmpDir = new File("/tmp"); - if (tmpDir.exists() && tmpDir.isDirectory()) { - return "/tmp/" + OUTPUT_FILE; - } - - File sdcard = new File("/sdcard"); - if (sdcard.exists() && sdcard.isDirectory()) { - return "/sdcard/" + OUTPUT_FILE; - } - - return null; - } - - - /** - * Run the various tests for a set period. - */ - public static void runTests() { - Robin robin = new Robin(); - Deep deep = new Deep(); - Large large = new Large(); - - /* start all threads */ - robin.start(); - deep.start(); - large.start(); - - /* let everybody run for 10 seconds */ - sleep(TEST_TIME * 1000); - - quit = true; - - try { - /* wait for all threads to stop */ - robin.join(); - deep.join(); - large.join(); - } catch (InterruptedException ie) { - System.err.println("join was interrupted"); - } - } - - /** - * Sleeps for the "ms" milliseconds. - */ - public static void sleep(int ms) { - try { - Thread.sleep(ms); - } catch (InterruptedException ie) { - System.err.println("sleep was interrupted"); - } - } - - /** - * Sleeps briefly, allowing other threads some CPU time to get started. - */ - public static void startupDelay() { - sleep(500); - } -} - - -/** - * Allocates useless objects and holds on to several of them. - * - * Uses a single large array of references, replaced repeatedly in round-robin - * order. - */ -class Robin extends Thread { - private static final int ARRAY_SIZE = 40960; - int sleepCount = 0; - - public void run() { - Main.startupDelay(); - - String strings[] = new String[ARRAY_SIZE]; - int idx = 0; - - while (!Main.quit) { - strings[idx] = makeString(idx); - - if (idx % (ARRAY_SIZE / 4) == 0) { - Main.sleep(400); - sleepCount++; - } - - idx = (idx + 1) % ARRAY_SIZE; - } - - if (Main.DEBUG) - System.out.println("Robin: sleepCount=" + sleepCount); - } - - private String makeString(int val) { - return new String("Robin" + val); - } -} - - -/** - * Allocates useless objects in recursive calls. - */ -class Deep extends Thread { - private static final int MAX_DEPTH = 61; - - private static String strong[] = new String[MAX_DEPTH]; - private static WeakReference weak[] = new WeakReference[MAX_DEPTH]; - - public void run() { - int iter = 0; - boolean once = false; - - Main.startupDelay(); - - while (!Main.quit) { - dive(0, iter); - once = true; - iter += MAX_DEPTH; - } - - if (!once) { - System.err.println("not even once?"); - return; - } - - /* - * Check the results of the last trip through. Everything in - * "weak" should be matched in "strong", and the two should be - * equivalent (object-wise, not just string-equality-wise). - */ - for (int i = 0; i < MAX_DEPTH; i++) { - if (strong[i] != weak[i].get()) { - System.err.println("Deep: " + i + " strong=" + strong[i] + - ", weak=" + weak[i].get()); - } - } - - /* - * Wipe "strong", do a GC, see if "weak" got collected. - */ - for (int i = 0; i < MAX_DEPTH; i++) - strong[i] = null; - - System.gc(); - - for (int i = 0; i < MAX_DEPTH; i++) { - if (weak[i].get() != null) { - System.err.println("Deep: weak still has " + i); - } - } - - if (Main.DEBUG) - System.out.println("Deep: iters=" + iter / MAX_DEPTH); - } - - /** - * Recursively dive down, setting one or more local variables. - * - * We pad the stack out with locals, attempting to create a mix of - * valid and invalid references on the stack. - */ - private String dive(int depth, int iteration) { - String str0; - String str1; - String str2; - String str3; - String str4; - String str5; - String str6; - String str7; - String funStr; - - funStr = ""; - - switch (iteration % 8) { - case 0: - funStr = str0 = makeString(iteration); - break; - case 1: - funStr = str1 = makeString(iteration); - break; - case 2: - funStr = str2 = makeString(iteration); - break; - case 3: - funStr = str3 = makeString(iteration); - break; - case 4: - funStr = str4 = makeString(iteration); - break; - case 5: - funStr = str5 = makeString(iteration); - break; - case 6: - funStr = str6 = makeString(iteration); - break; - case 7: - funStr = str7 = makeString(iteration); - break; - } - - strong[depth] = funStr; - weak[depth] = new WeakReference(funStr); - - if (depth+1 < MAX_DEPTH) - dive(depth+1, iteration+1); - else - Main.sleep(100); - - return funStr; - } - - private String makeString(int val) { - return new String("Deep" + val); - } -} - - -/** - * Allocates large useless objects. - */ -class Large extends Thread { - public void run() { - byte[] chunk; - int count = 0; - int sleepCount = 0; - - Main.startupDelay(); - - while (!Main.quit) { - chunk = new byte[100000]; - pretendToUse(chunk); - - count++; - if ((count % 500) == 0) { - Main.sleep(400); - sleepCount++; - } - } - - if (Main.DEBUG) - System.out.println("Large: sleepCount=" + sleepCount); - } - - public void pretendToUse(byte[] chunk) {} -} diff --git a/tests/075-verification-error/expected.txt b/tests/075-verification-error/expected.txt deleted file mode 100644 index 6e4f584d3..000000000 --- a/tests/075-verification-error/expected.txt +++ /dev/null @@ -1,12 +0,0 @@ -Got expected InstantationError -Got expected NoSuchFieldError -Got expected NoSuchFieldError -Got expected NoSuchMethodError -Got expected NoSuchMethodError -Got expected IllegalAccessError (ifield) -Got expected IllegalAccessError (sfield) -Got expected IllegalAccessError (method) -Got expected IllegalAccessError (smethod) -Got expected IllegalAccessError (meth-class) -Got expected IllegalAccessError (field-class) -Got expected IllegalAccessError (meth-meth) diff --git a/tests/075-verification-error/info.txt b/tests/075-verification-error/info.txt deleted file mode 100644 index be688ff2b..000000000 --- a/tests/075-verification-error/info.txt +++ /dev/null @@ -1 +0,0 @@ -Exercise deferred verification error reporting. diff --git a/tests/075-verification-error/src/Main.java b/tests/075-verification-error/src/Main.java deleted file mode 100644 index 51d648cd0..000000000 --- a/tests/075-verification-error/src/Main.java +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (C) 2009 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 other.Mutant; -import other.InaccessibleClass; -import other.InaccessibleMethod; - -/** - * Test some problematic situations that the verifier detects. - */ -public class Main { - public static final boolean VERBOSE = false; - - public static void main(String[] args) { - testClassNewInstance(); - testMissingStuff(); - testBadAccess(); - } - - /** - * Try to create a new instance of an abstract class. - */ - static void testClassNewInstance() { - try { - MaybeAbstract ma = new MaybeAbstract(); - System.err.println("ERROR: MaybeAbstract succeeded unexpectedly"); - } catch (InstantiationError ie) { - System.out.println("Got expected InstantationError"); - if (VERBOSE) System.out.println("--- " + ie); - } catch (Exception ex) { - System.err.println("Got unexpected MaybeAbstract failure"); - } - } - - /** - * Test stuff that disappears. - */ - static void testMissingStuff() { - Mutant mutant = new Mutant(); - - try { - int x = mutant.disappearingField; - } catch (NoSuchFieldError nsfe) { - System.out.println("Got expected NoSuchFieldError"); - if (VERBOSE) System.out.println("--- " + nsfe); - } - - try { - int y = Mutant.disappearingStaticField; - } catch (NoSuchFieldError nsfe) { - System.out.println("Got expected NoSuchFieldError"); - if (VERBOSE) System.out.println("--- " + nsfe); - } - - try { - mutant.disappearingMethod(); - } catch (NoSuchMethodError nsme) { - System.out.println("Got expected NoSuchMethodError"); - if (VERBOSE) System.out.println("--- " + nsme); - } - - try { - Mutant.disappearingStaticMethod(); - } catch (NoSuchMethodError nsme) { - System.out.println("Got expected NoSuchMethodError"); - if (VERBOSE) System.out.println("--- " + nsme); - } - } - - /** - * Test stuff that becomes inaccessible. - */ - static void testBadAccess() { - Mutant mutant = new Mutant(); - - try { - int x = mutant.inaccessibleField; - System.err.println("ERROR: bad access succeeded\n"); - } catch (IllegalAccessError iae) { - System.out.println("Got expected IllegalAccessError (ifield)"); - if (VERBOSE) System.out.println("--- " + iae); - } - - try { - int y = Mutant.inaccessibleStaticField; - System.err.println("ERROR: bad access succeeded\n"); - } catch (IllegalAccessError iae) { - System.out.println("Got expected IllegalAccessError (sfield)"); - if (VERBOSE) System.out.println("--- " + iae); - } - - try { - mutant.inaccessibleMethod(); - System.err.println("ERROR: bad access succeeded\n"); - } catch (IllegalAccessError iae) { - System.out.println("Got expected IllegalAccessError (method)"); - if (VERBOSE) System.out.println("--- " + iae); - } - - try { - Mutant.inaccessibleStaticMethod(); - System.err.println("ERROR: bad access succeeded\n"); - } catch (IllegalAccessError iae) { - System.out.println("Got expected IllegalAccessError (smethod)"); - if (VERBOSE) System.out.println("--- " + iae); - } - - try { - /* accessible static method in an inaccessible class */ - InaccessibleClass.test(); - System.err.println("ERROR: bad meth-class access succeeded\n"); - } catch (IllegalAccessError iae) { - System.out.println("Got expected IllegalAccessError (meth-class)"); - if (VERBOSE) System.out.println("--- " + iae); - } - - try { - /* accessible static field in an inaccessible class */ - int blah = InaccessibleClass.blah; - System.err.println("ERROR: bad field-class access succeeded\n"); - } catch (IllegalAccessError iae) { - System.out.println("Got expected IllegalAccessError (field-class)"); - if (VERBOSE) System.out.println("--- " + iae); - } - - try { - /* inaccessible static method in an accessible class */ - InaccessibleMethod.test(); - System.err.println("ERROR: bad access succeeded\n"); - } catch (IllegalAccessError iae) { - System.out.println("Got expected IllegalAccessError (meth-meth)"); - if (VERBOSE) System.out.println("--- " + iae); - } - } -} diff --git a/tests/075-verification-error/src/MaybeAbstract.java b/tests/075-verification-error/src/MaybeAbstract.java deleted file mode 100644 index 6d3b05bb3..000000000 --- a/tests/075-verification-error/src/MaybeAbstract.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public /*abstract*/ class MaybeAbstract { - public MaybeAbstract() {} - int foo() { return 0; } -} diff --git a/tests/075-verification-error/src/other/InaccessibleClass.java b/tests/075-verification-error/src/other/InaccessibleClass.java deleted file mode 100644 index b9bdfc482..000000000 --- a/tests/075-verification-error/src/other/InaccessibleClass.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -package other; - -public class InaccessibleClass { - public static void test() {} - - public static int blah = 5; -} diff --git a/tests/075-verification-error/src/other/InaccessibleMethod.java b/tests/075-verification-error/src/other/InaccessibleMethod.java deleted file mode 100644 index 04603733f..000000000 --- a/tests/075-verification-error/src/other/InaccessibleMethod.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -package other; - -public class InaccessibleMethod { - public static void test() {} -} diff --git a/tests/075-verification-error/src/other/Mutant.java b/tests/075-verification-error/src/other/Mutant.java deleted file mode 100644 index ec4754b8a..000000000 --- a/tests/075-verification-error/src/other/Mutant.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -package other; - -/** - * Parts of this class will disappear or change form. - */ -public class Mutant { - public int disappearingField = 3; - public static int disappearingStaticField = 4; - - public void disappearingMethod() { - System.out.println("bye"); - } - public static void disappearingStaticMethod() { - System.out.println("kthxbai"); - } - - public int inaccessibleField = 5; - public static int inaccessibleStaticField = 6; - - public void inaccessibleMethod() { - System.out.println("no"); - } - - public static void inaccessibleStaticMethod() { - System.out.println("nay"); - } -} diff --git a/tests/075-verification-error/src2/MaybeAbstract.java b/tests/075-verification-error/src2/MaybeAbstract.java deleted file mode 100644 index 8b70a0712..000000000 --- a/tests/075-verification-error/src2/MaybeAbstract.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public abstract class MaybeAbstract { - public MaybeAbstract() {} - int foo() { return 0; } -} diff --git a/tests/075-verification-error/src2/other/InaccessibleClass.java b/tests/075-verification-error/src2/other/InaccessibleClass.java deleted file mode 100644 index 812fac98c..000000000 --- a/tests/075-verification-error/src2/other/InaccessibleClass.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -package other; - -/*package*/ class InaccessibleClass { - public static void test() {} - - public static int blah = 5; -} diff --git a/tests/075-verification-error/src2/other/InaccessibleMethod.java b/tests/075-verification-error/src2/other/InaccessibleMethod.java deleted file mode 100644 index 9fb844ef7..000000000 --- a/tests/075-verification-error/src2/other/InaccessibleMethod.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -package other; - -public class InaccessibleMethod { - /*package*/ static void test() {} -} diff --git a/tests/075-verification-error/src2/other/Mutant.java b/tests/075-verification-error/src2/other/Mutant.java deleted file mode 100644 index 67cd36dfa..000000000 --- a/tests/075-verification-error/src2/other/Mutant.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -package other; - -/** - * Parts of this class will disappear or change form. - */ -public class Mutant { - //public int disappearingField = 3; - //public static int disappearingStaticField = 4; - - //public static void disappearingMethod() { - // System.out.println("bye"); - //} - //public static void disappearingStaticMethod() { - // System.out.println("kthxbai"); - //} - - protected int inaccessibleField = 5; - protected static int inaccessibleStaticField = 6; - - protected void inaccessibleMethod() { - System.out.println("no"); - } - - protected static void inaccessibleStaticMethod() { - System.out.println("nay"); - } -} diff --git a/tests/076-boolean-put/expected.txt b/tests/076-boolean-put/expected.txt deleted file mode 100644 index a965a70ed..000000000 --- a/tests/076-boolean-put/expected.txt +++ /dev/null @@ -1 +0,0 @@ -Done diff --git a/tests/076-boolean-put/info.txt b/tests/076-boolean-put/info.txt deleted file mode 100644 index 5b3ef4dba..000000000 --- a/tests/076-boolean-put/info.txt +++ /dev/null @@ -1,3 +0,0 @@ -This checks a case where javac generates code that stores a byte into a -boolean field. The code as generated should not pass the verifier, so the -verifier had to be "loosened" to allow this case. diff --git a/tests/076-boolean-put/src/Main.java b/tests/076-boolean-put/src/Main.java deleted file mode 100644 index b32542250..000000000 --- a/tests/076-boolean-put/src/Main.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -/** - * Test access to private boolean fields. - * - * Accessing private boolean fields from an inner class causes the compiler - * to generate an accessor method that performs the boolean operation. - * Unfortunately the generated method takes an integer as an argument, - * not a boolean, which makes the verifier upset when the result of the - * operation is written back to a boolean field. - */ -public class Main { - private boolean mInstance; - private static boolean mStatic; - - public static void main(String[] args) { - Main foo = new Main(); - foo.test(); - - System.out.println("Done"); - } - - void test() { - Innard innard = new Innard(); - innard.doStuff(); - } - - class Innard { - void doStuff() { - mInstance |= true; - mStatic |= true; - } - } -} diff --git a/tests/077-method-override/expected.txt b/tests/077-method-override/expected.txt deleted file mode 100644 index 2e9bda33f..000000000 --- a/tests/077-method-override/expected.txt +++ /dev/null @@ -1,15 +0,0 @@ -declaredInBase: Base -notDeclaredInBase: Derived -wasOverridden: Derived -overrideWithPublic: Derived -overrideProtectedWithPublic: Derived -overridePublicWithProtected: Derived -overridePublicWithPrivate: Base -overridePrivateWithPublic: Base -overridePrivateWithPublic: Derived -overrideVirtualWithStatic: Base -overrideVirtualWithStatic: Derived -overrideStaticWithVirtual: Base -overrideStaticWithVirtual: Derived -Got expected exception - ovws -Got expected exception - oswv diff --git a/tests/077-method-override/info.txt b/tests/077-method-override/info.txt deleted file mode 100644 index 914b4f253..000000000 --- a/tests/077-method-override/info.txt +++ /dev/null @@ -1,2 +0,0 @@ -Test various forms of method overrides, including some not allowed by the -compiler but possible with separate compilation. diff --git a/tests/077-method-override/src/Base.java b/tests/077-method-override/src/Base.java deleted file mode 100644 index befe2e228..000000000 --- a/tests/077-method-override/src/Base.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class Base { - public void declaredInBase() { - System.out.println("declaredInBase: Base"); - } - - public void overridden() { - System.out.println("overridden: Base"); - } - - /* src2: removed */ - public void wasOverridden() { - System.out.println("wasOverridden: Base"); - } - - public void callOverrideWithPublic() { - overrideWithPublic(); - } - public void overrideWithPublic() { - System.out.println("overrideWithPublic: Base"); - } - - public void callOverridePublicWithProtected() { - overridePublicWithProtected(); - } - /* src2: public */ - protected void overridePublicWithProtected() { - System.out.println("overridePublicWithProtected: Base"); - } - - public void callOverrideProtectedWithPublic() { - overrideProtectedWithPublic(); - } - protected void overrideProtectedWithPublic() { - System.out.println("overrideProtectedWithPublic: Base"); - } - - public void callOverridePublicWithPrivate() { - overridePublicWithPrivate(); - } - /* src2: public */ - private void overridePublicWithPrivate() { - System.out.println("overridePublicWithPrivate: Base"); - } - - public void callOverridePrivateWithPublic() { - overridePrivateWithPublic(); - } - private void overridePrivateWithPublic() { - System.out.println("overridePrivateWithPublic: Base"); - } - - public void callOverrideVirtualWithStatic() { - overrideVirtualWithStatic(); - } - /* src2: non-static */ - public static void overrideVirtualWithStatic() { - System.out.println("overrideVirtualWithStatic: Base"); - } - - public void callOverrideStaticWithVirtual() { - overrideStaticWithVirtual(); - } - /* src2: static */ - public void overrideStaticWithVirtual() { - System.out.println("overrideStaticWithVirtual: Base"); - } -} diff --git a/tests/077-method-override/src/Derived.java b/tests/077-method-override/src/Derived.java deleted file mode 100644 index 7dc43d0a5..000000000 --- a/tests/077-method-override/src/Derived.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class Derived extends Base { - public static void notDeclaredInBase() { - System.out.println("notDeclaredInBase: Derived"); - } - - public void overridden() { - System.out.println("overridden: Derived"); - } - - public void wasOverridden() { - System.out.println("wasOverridden: Derived"); - } - - public void overrideWithPublic() { - System.out.println("overrideWithPublic: Derived"); - } - - protected void overridePublicWithProtected() { - System.out.println("overridePublicWithProtected: Derived"); - } - - public void overrideProtectedWithPublic() { - System.out.println("overrideProtectedWithPublic: Derived"); - } - - private void overridePublicWithPrivate() { - System.out.println("overridePublicWithPrivate: Derived"); - } - - public void overridePrivateWithPublic() { - System.out.println("overridePrivateWithPublic: Derived"); - } - - /* not really an "override"; just has same method signature */ - public static void overrideVirtualWithStatic() { - System.out.println("overrideVirtualWithStatic: Derived"); - } - - /* not really an "override"; just has same method signature */ - public void overrideStaticWithVirtual() { - System.out.println("overrideStaticWithVirtual: Derived"); - } -} diff --git a/tests/077-method-override/src/Main.java b/tests/077-method-override/src/Main.java deleted file mode 100644 index 2d10ee02d..000000000 --- a/tests/077-method-override/src/Main.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class Main { - public static void main(String args[]) { - Derived derived = new Derived(); - - derived.declaredInBase(); - derived.notDeclaredInBase(); - derived.wasOverridden(); - - derived.callOverrideWithPublic(); - derived.callOverrideProtectedWithPublic(); - derived.callOverridePublicWithProtected(); - derived.callOverridePublicWithPrivate(); - derived.callOverridePrivateWithPublic(); - derived.overridePrivateWithPublic(); - derived.callOverrideVirtualWithStatic(); - derived.overrideVirtualWithStatic(); - derived.callOverrideStaticWithVirtual(); - derived.overrideStaticWithVirtual(); - - try { - ((Base)derived).overrideVirtualWithStatic(); - } catch (NoSuchMethodError nsme) { - /* NSME is subclass of ICCE, so check it explicitly */ - System.err.println("Got NSME - ovws"); - } catch (IncompatibleClassChangeError icce) { - System.out.println("Got expected exception - ovws"); - } - - try { - ((Base)derived).overrideStaticWithVirtual(); - } catch (NoSuchMethodError nsme) { - System.err.println("Got NSME - ovws"); - } catch (IncompatibleClassChangeError icce) { - System.out.println("Got expected exception - oswv"); - } - } -} diff --git a/tests/077-method-override/src2/Base.java b/tests/077-method-override/src2/Base.java deleted file mode 100644 index ab2a28bb5..000000000 --- a/tests/077-method-override/src2/Base.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class Base { - public void declaredInBase() { - System.out.println("declaredInBase: Base"); - } - - public void overridden() { - System.out.println("overridden: Base"); - } - - /* src2: removed */ - //public void wasOverridden() { - // System.out.println("wasOverridden: Base"); - //} - - public void callOverrideWithPublic() { - overrideWithPublic(); - } - public void overrideWithPublic() { - System.out.println("overrideWithPublic: Base"); - } - - public void callOverridePublicWithProtected() { - overridePublicWithProtected(); - } - /* src2: public */ - public void overridePublicWithProtected() { - System.out.println("overridePublicWithProtected: Base"); - } - - public void callOverrideProtectedWithPublic() { - overrideProtectedWithPublic(); - } - protected void overrideProtectedWithPublic() { - System.out.println("overrideProtectedWithPublic: Base"); - } - - public void callOverridePublicWithPrivate() { - overridePublicWithPrivate(); - } - /* src2: public */ - public void overridePublicWithPrivate() { - System.out.println("overridePublicWithPrivate: Base"); - } - - public void callOverridePrivateWithPublic() { - overridePrivateWithPublic(); - } - private void overridePrivateWithPublic() { - System.out.println("overridePrivateWithPublic: Base"); - } - - public void callOverrideVirtualWithStatic() { - overrideVirtualWithStatic(); - } - /* src2: non-static */ - public void overrideVirtualWithStatic() { - System.out.println("overrideVirtualWithStatic: Base"); - } - - public void callOverrideStaticWithVirtual() { - overrideStaticWithVirtual(); - } - public static void overrideStaticWithVirtual() { - System.out.println("overrideStaticWithVirtual: Base"); - } -} diff --git a/tests/078-polymorphic-virtual/expected.txt b/tests/078-polymorphic-virtual/expected.txt deleted file mode 100644 index 0d2972823..000000000 --- a/tests/078-polymorphic-virtual/expected.txt +++ /dev/null @@ -1,3 +0,0 @@ -10000000 -20000000 -30000000 diff --git a/tests/078-polymorphic-virtual/info.txt b/tests/078-polymorphic-virtual/info.txt deleted file mode 100644 index 7c8a561b1..000000000 --- a/tests/078-polymorphic-virtual/info.txt +++ /dev/null @@ -1,2 +0,0 @@ -Stress test predicted chaining for overloaded virtual callsite with 3 resolved -calless invoked 10,000,000 times each in three threads. diff --git a/tests/078-polymorphic-virtual/src/Base.java b/tests/078-polymorphic-virtual/src/Base.java deleted file mode 100644 index ec3aaddea..000000000 --- a/tests/078-polymorphic-virtual/src/Base.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class Base extends Thread { - int value; - - public void run() { - for (int i = 0; i < 10000000; i++) { - incrimentValue(); - } - } - - public void incrimentValue() { - } - - public int getValue() { - return value; - } -} diff --git a/tests/078-polymorphic-virtual/src/Derived1.java b/tests/078-polymorphic-virtual/src/Derived1.java deleted file mode 100644 index 57bd3b0c4..000000000 --- a/tests/078-polymorphic-virtual/src/Derived1.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class Derived1 extends Base { - public void incrimentValue() { - value += 1; - } -} diff --git a/tests/078-polymorphic-virtual/src/Derived2.java b/tests/078-polymorphic-virtual/src/Derived2.java deleted file mode 100644 index 1d7de575e..000000000 --- a/tests/078-polymorphic-virtual/src/Derived2.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class Derived2 extends Base { - public void incrimentValue() { - value += 2; - } -} diff --git a/tests/078-polymorphic-virtual/src/Derived3.java b/tests/078-polymorphic-virtual/src/Derived3.java deleted file mode 100644 index c2594d276..000000000 --- a/tests/078-polymorphic-virtual/src/Derived3.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class Derived3 extends Base { - public void incrimentValue() { - value += 3; - } -} diff --git a/tests/078-polymorphic-virtual/src/Main.java b/tests/078-polymorphic-virtual/src/Main.java deleted file mode 100644 index 0514e53d7..000000000 --- a/tests/078-polymorphic-virtual/src/Main.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class Main { - public static void main(String args[]) { - Derived1 derived1 = new Derived1(); - Derived2 derived2 = new Derived2(); - Derived3 derived3 = new Derived3(); - - derived1.start(); - derived2.start(); - derived3.start(); - - try { - derived1.join(); - derived2.join(); - derived3.join(); - } catch (Exception e) { - System.out.println(e); - return; - } - - System.out.println(derived1.getValue()); - System.out.println(derived2.getValue()); - System.out.println(derived3.getValue()); - } -} diff --git a/tests/079-phantom/expected.txt b/tests/079-phantom/expected.txt deleted file mode 100644 index a932b770c..000000000 --- a/tests/079-phantom/expected.txt +++ /dev/null @@ -1,14 +0,0 @@ -start -Created Bitmap one: 10x10 (100) -Created Bitmap two: 20x20 (101) -Created Bitmap three/four: 20x20 (101) -Drawing Bitmap two: 20x20 (101) -nulling 1 -freeNativeStorage: 100 -nulling 2 -nulling 3 -nulling 4 -freeNativeStorage: 101 -intr -Bitmap has shut down -done diff --git a/tests/079-phantom/info.txt b/tests/079-phantom/info.txt deleted file mode 100644 index d974e2c68..000000000 --- a/tests/079-phantom/info.txt +++ /dev/null @@ -1 +0,0 @@ -Exercise phantom references. diff --git a/tests/079-phantom/src/Bitmap.java b/tests/079-phantom/src/Bitmap.java deleted file mode 100644 index 9d03cbd3d..000000000 --- a/tests/079-phantom/src/Bitmap.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (C) 2009 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.ref.ReferenceQueue; -import java.lang.ref.PhantomReference; -import java.util.ArrayList; - -public class Bitmap { - String mName; /* for debugging */ - int mWidth, mHeight; - Bitmap.NativeWrapper mNativeWrapper; - - private static int sSerial = 100; - private static ArrayList sPhantomList = new ArrayList<PhantomWrapper>(); - private static ReferenceQueue<PhantomWrapper> sPhantomQueue = - new ReferenceQueue<PhantomWrapper>(); - private static BitmapWatcher sWatcher = new BitmapWatcher(sPhantomQueue); - static { - sWatcher.start(); - }; - - Bitmap(String name, int width, int height, Bitmap.NativeWrapper nativeData) { - mName = name; - mWidth = width; - mHeight = height; - mNativeWrapper = nativeData; - - System.out.println("Created " + this); - } - - public String toString() { - return "Bitmap " + mName + ": " + mWidth + "x" + mHeight + " (" + - mNativeWrapper.mNativeData + ")"; - } - - public void drawAt(int x, int y) { - System.out.println("Drawing " + this); - } - - public static void shutDown() { - sWatcher.shutDown(); - try { - sWatcher.join(); - } catch (InterruptedException ie) { - System.out.println("join intr"); - } - System.out.println("Bitmap has shut down"); - } - - /* - * Pretend we're allocating native storage. Just returns a unique - * serial number. - */ - static Bitmap.NativeWrapper allocNativeStorage(int width, int height) { - int nativeData; - - synchronized (Bitmap.class) { - nativeData = sSerial++; - } - - Bitmap.NativeWrapper wrapper = new Bitmap.NativeWrapper(nativeData); - PhantomWrapper phan = new PhantomWrapper(wrapper, sPhantomQueue, - nativeData); - sPhantomList.add(phan); - return wrapper; - } - - static void freeNativeStorage(int nativeDataPtr) { - System.out.println("freeNativeStorage: " + nativeDataPtr); - } - - /* - * Wraps a native data pointer in an object. When this object is no - * longer referenced, we free the native data. - */ - static class NativeWrapper { - public NativeWrapper(int nativeDataPtr) { - mNativeData = nativeDataPtr; - } - public int mNativeData; - - /* - @Override - protected void finalize() throws Throwable { - System.out.println("finalized " + mNativeData); - } - */ - } -} - -/* - * Keep an eye on the native data. - * - * We keep a copy of the native data pointer value, and set the wrapper - * as our referent. We need the copy because you can't get the referred-to - * object back out of a PhantomReference. - */ -class PhantomWrapper extends PhantomReference { - PhantomWrapper(Bitmap.NativeWrapper wrapper, - ReferenceQueue<PhantomWrapper> queue, int nativeDataPtr) - { - super(wrapper, queue); - mNativeData = nativeDataPtr; - } - - public int mNativeData; -} - -/* - * Thread that watches for un-referenced bitmap data. - */ -class BitmapWatcher extends Thread { - ReferenceQueue<PhantomWrapper> mQueue; - volatile boolean mQuit = false; - - BitmapWatcher(ReferenceQueue<PhantomWrapper> queue) { - mQueue = queue; - setName("Bitmap Watcher"); - } - - public void run() { - while (!mQuit) { - try { - PhantomWrapper ref = (PhantomWrapper) mQueue.remove(); - //System.out.println("dequeued ref " + ref.mNativeData + - // " - " + ref); - Bitmap.freeNativeStorage(ref.mNativeData); - //ref.clear(); - } catch (InterruptedException ie) { - System.out.println("intr"); - } - } - } - - public void shutDown() { - mQuit = true; - interrupt(); - } -} diff --git a/tests/079-phantom/src/Main.java b/tests/079-phantom/src/Main.java deleted file mode 100644 index 9c459c9d9..000000000 --- a/tests/079-phantom/src/Main.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class Main { - Bitmap mBitmap1, mBitmap2, mBitmap3, mBitmap4; - - public static void sleep(int ms) { - try { - Thread.sleep(ms); - } catch (InterruptedException ie) { - System.err.println("sleep interrupted"); - } - } - - public static void main(String args[]) { - System.out.println("start"); - - Main main = new Main(); - main.run(); - - sleep(1000); - System.out.println("done"); - } - - public void run() { - createBitmaps(); - - System.gc(); - sleep(250); - - mBitmap2.drawAt(0, 0); - - System.out.println("nulling 1"); - mBitmap1 = null; - System.gc(); - sleep(500); - - System.out.println("nulling 2"); - mBitmap2 = null; - System.gc(); - sleep(500); - - System.out.println("nulling 3"); - mBitmap3 = null; - System.gc(); - sleep(500); - - System.out.println("nulling 4"); - mBitmap4 = null; - System.gc(); - sleep(500); - - Bitmap.shutDown(); - } - - /* - * Create bitmaps. - * - * bitmap1 is 10x10 and unique - * bitmap2 and bitmap3 are 20x20 and share the same storage. - * bitmap4 is just another reference to bitmap3 - * - * When we return there should be no local refs lurking on the stack. - */ - public void createBitmaps() { - Bitmap.NativeWrapper dataA = Bitmap.allocNativeStorage(10, 10); - Bitmap.NativeWrapper dataB = Bitmap.allocNativeStorage(20, 20); - mBitmap1 = new Bitmap("one", 10, 10, dataA); - mBitmap2 = new Bitmap("two", 20, 20, dataB); - mBitmap3 = mBitmap4 = new Bitmap("three/four", 20, 20, dataB); - } -} diff --git a/tests/080-oom-throw/expected.txt b/tests/080-oom-throw/expected.txt deleted file mode 100644 index 73cc0d8b3..000000000 --- a/tests/080-oom-throw/expected.txt +++ /dev/null @@ -1,2 +0,0 @@ -NEW_ARRAY correctly threw OOME -NEW_INSTANCE correctly threw OOME diff --git a/tests/080-oom-throw/info.txt b/tests/080-oom-throw/info.txt deleted file mode 100644 index e8ae6f680..000000000 --- a/tests/080-oom-throw/info.txt +++ /dev/null @@ -1,3 +0,0 @@ -Inject memory allocation failures for NEW_ARRAY and NEW_INSTANCE and make sure -the JIT'ed code handles OOM exception correctly since it cannot fall back to -the interpreter and re-execute the bytecode. diff --git a/tests/080-oom-throw/src/Main.java b/tests/080-oom-throw/src/Main.java deleted file mode 100644 index 3ffe2f38a..000000000 --- a/tests/080-oom-throw/src/Main.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class Main { - static class ArrayMemEater { - static boolean sawOome; - - static void blowup(char[][] holder) { - try { - for (int i = 0; i < holder.length; ++i) { - holder[i] = new char[128 * 1024]; - } - } catch (OutOfMemoryError oome) { - ArrayMemEater.sawOome = true; - } - } - } - - static class InstanceMemEater { - static boolean sawOome; - - InstanceMemEater next; - double d1, d2, d3, d4, d5, d6, d7, d8; // Bloat this object so we fill the heap faster. - - static InstanceMemEater allocate() { - try { - return new InstanceMemEater(); - } catch (OutOfMemoryError e) { - InstanceMemEater.sawOome = true; - return null; - } - } - - static void confuseCompilerOptimization(InstanceMemEater instance) { - } - } - - static boolean triggerArrayOOM() { - ArrayMemEater.blowup(new char[1 * 1024 * 1024][]); - return ArrayMemEater.sawOome; - } - - static boolean triggerInstanceOOM() { - InstanceMemEater memEater = InstanceMemEater.allocate(); - InstanceMemEater lastMemEater = memEater; - do { - lastMemEater.next = InstanceMemEater.allocate(); - lastMemEater = lastMemEater.next; - } while (lastMemEater != null); - memEater.confuseCompilerOptimization(memEater); - return InstanceMemEater.sawOome; - } - - public static void main(String[] args) { - if (triggerArrayOOM()) { - System.out.println("NEW_ARRAY correctly threw OOME"); - } - - if (triggerInstanceOOM()) { - System.out.println("NEW_INSTANCE correctly threw OOME"); - } - } -} diff --git a/tests/081-hot-exceptions/expected.txt b/tests/081-hot-exceptions/expected.txt deleted file mode 100644 index 2432ff455..000000000 --- a/tests/081-hot-exceptions/expected.txt +++ /dev/null @@ -1,2 +0,0 @@ -sum = 0 -exception = 1024 diff --git a/tests/081-hot-exceptions/info.txt b/tests/081-hot-exceptions/info.txt deleted file mode 100644 index cc514f3de..000000000 --- a/tests/081-hot-exceptions/info.txt +++ /dev/null @@ -1,3 +0,0 @@ -Make a hot exception-throwing path to stress test how the trace builder handles -exceptions encountered during trace selection. The existence of exceptions will -cause a control flow change to deviate from the current method. diff --git a/tests/081-hot-exceptions/src/Main.java b/tests/081-hot-exceptions/src/Main.java deleted file mode 100644 index 90e7af28a..000000000 --- a/tests/081-hot-exceptions/src/Main.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -public class Main { - static class ArrayObj { - int[] array; - - int getArrayElement(int i) throws NullPointerException { - return array[i]; - } - } - - public static void main(String[] args) { - ArrayObj arrayObj2 = new ArrayObj(); - int sum = 0; - int exception = 0; - - for (int i = 0; i < 1024; i++) { - try { - // A hot method invocation that always encounters exceptions - sum += arrayObj2.getArrayElement(i); - } catch (NullPointerException npe) { - exception++; - } - } - System.out.println("sum = " + sum); - System.out.println("exception = " + exception); - } -} diff --git a/tests/082-inline-execute/expected.txt b/tests/082-inline-execute/expected.txt deleted file mode 100644 index 5059fe8b6..000000000 --- a/tests/082-inline-execute/expected.txt +++ /dev/null @@ -1,8 +0,0 @@ -Length of : 0 -Length of x : 1 -Length of 01234567890123456789012345678901234567890123456789012345678901234567890123456789 : 80 -Now is the time[0] = "N" -Now is the time[1] = "o" -Now is the time[10] = " " -Now is the time[last] = "e" -Num throws 2000 diff --git a/tests/082-inline-execute/info.txt b/tests/082-inline-execute/info.txt deleted file mode 100644 index ddc31fe7d..000000000 --- a/tests/082-inline-execute/info.txt +++ /dev/null @@ -1,8 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -This test covers the string inline-execute tests, and it done in a -looping manner to ensure that the tests are translated when a Jit is -active. diff --git a/tests/082-inline-execute/src/Main.java b/tests/082-inline-execute/src/Main.java deleted file mode 100644 index b512091cf..000000000 --- a/tests/082-inline-execute/src/Main.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -/** - * Test for Jit's handling of string inline-execute. Should be tested - * twice - once using self-cosimulation (if available) and once without. - * The non-self-cosimulation test ensures that the answer computed the first - * time through (via the interpreter) is the same after looping enough - * to trigger translation. - */ - -import junit.framework.Assert; - -public class Main { - public static void main(String args[]) { - int i; - stringLengthTest(); - stringCharAtTest(); - stringIndexOfTest(); - for (i = 0; i < 1000; i++) - stringCompareToTest(); - } - - public static void stringLengthTest() { - String str0 = ""; - String str1 = "x"; - String str80 = "01234567890123456789012345678901234567890123456789012345678901234567890123456789"; - int len0 = str0.length(); - int len1 = str1.length(); - int len80 = str80.length(); - int i; - - System.out.println("Length of " + str0 + " : " + len0); - System.out.println("Length of " + str1 + " : " + len1); - System.out.println("Length of " + str80 + " : " + len80); - - for (i = 0; i < 1000; i++) { - assert(str0.length() == len0); - assert(str1.length() == len1); - assert(str80.length() == len80); - } - } - - public static void stringCharAtTest() { - String testStr = "Now is the time"; - int under = -1; - int over = testStr.length(); - int numThrown = 0; - int numNotThrown = 0; - int at0 = testStr.charAt(0); - int at1 = testStr.charAt(1); - int at10 = testStr.charAt(10); - int atLast = testStr.charAt(testStr.length()-1); - int i; - - System.out.println(testStr + "[0] = \"" + (char)at0 + "\""); - System.out.println(testStr + "[1] = \"" + (char)at1 + "\""); - System.out.println(testStr + "[10] = \"" + (char)at10 + "\""); - System.out.println(testStr + "[last] = \"" + (char)atLast + "\""); - - for (i = 0; i < 1000; i++) { - assert(at0 == testStr.charAt(0)); - assert(at1 == testStr.charAt(1)); - assert(at10 == testStr.charAt(10)); - assert(atLast == testStr.charAt(testStr.length()-1)); - } - - for (i = 0; i < 1000; i++) { - try { - testStr.charAt(under); - numNotThrown++; - } catch (StringIndexOutOfBoundsException sioobe) { - numThrown++; - } - try { - testStr.charAt(over); - numNotThrown++; - } catch (StringIndexOutOfBoundsException sioobe) { - numThrown++; - } - } - assert(numNotThrown == 0); - System.out.println("Num throws " + numThrown); - } - - - public static void stringIndexOfTest() { - String str0 = ""; - String str3 = "abc"; - String str10 = "abcdefghij"; - String str40 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabc"; - int i; - - for (i = 0; i < 1000; i++) { - assert(str0.indexOf('a') == -1); - assert(str3.indexOf('a') == 0); - assert(str3.indexOf('b') == 1); - assert(str3.indexOf('c') == 2); - assert(str10.indexOf('j') == 9); - assert(str40.indexOf('a') == 0); - assert(str40.indexOf('b') == 38); - assert(str40.indexOf('c') == 39); - assert(str0.indexOf('a',20) == -1); - assert(str0.indexOf('a',0) == -1); - assert(str0.indexOf('a',-1) == -1); - assert(str3.indexOf('a',0) == 0); - assert(str3.indexOf('a',1) == -1); - assert(str3.indexOf('a',1234) == -1); - assert(str3.indexOf('b',0) == 1); - assert(str3.indexOf('b',1) == 1); - assert(str3.indexOf('c',2) == 2); - assert(str10.indexOf('j',5) == 9); - assert(str10.indexOf('j',9) == 9); - assert(str40.indexOf('a',10) == 10); - assert(str40.indexOf('b',40) == -1); - } - - } - - public static void stringCompareToTest() { - String test = "0123456789"; - String test1 = new String("0123456789"); // different object - String test2 = new String("0123456780"); // different value - String offset = new String("xxx0123456789yyy"); - String sub = offset.substring(3, 13); - String str32 = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; - String str33 = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy"; - String lc = "abcdefg"; - String uc = "ABCDEFG"; - Object blah = new Object(); - - for (int i = 0; i < 100; i++) { - String y = lc.toUpperCase(); - Assert.assertTrue(y.equals(uc)); - } - - Assert.assertEquals(str32.compareTo(str33), -1); - Assert.assertEquals(str33.compareTo(str32), 1); - - Assert.assertTrue(test.equals(test)); - Assert.assertTrue(test.equals(test1)); - Assert.assertFalse(test.equals(test2)); - - Assert.assertEquals(test.compareTo(test1), 0); - Assert.assertTrue(test1.compareTo(test2) > 0); - Assert.assertTrue(test2.compareTo(test1) < 0); - - /* compare string with a nonzero offset, in left/right side */ - Assert.assertEquals(test.compareTo(sub), 0); - Assert.assertEquals(sub.compareTo(test), 0); - Assert.assertTrue(test.equals(sub)); - Assert.assertTrue(sub.equals(test)); - /* same base, one is a substring */ - Assert.assertFalse(offset.equals(sub)); - Assert.assertFalse(sub.equals(offset)); - /* wrong class */ - Assert.assertFalse(test.equals(blah)); - - /* null ptr - throw */ - try { - test.compareTo(null); - Assert.fail("didn't get expected npe"); - } catch (NullPointerException npe) { - } - /* null ptr - ok */ - Assert.assertFalse(test.equals(null)); - - test = test.substring(1); - Assert.assertTrue(test.equals("123456789")); - Assert.assertFalse(test.equals(test1)); - - test = test.substring(1); - Assert.assertTrue(test.equals("23456789")); - - test = test.substring(1); - Assert.assertTrue(test.equals("3456789")); - - test = test.substring(1); - Assert.assertTrue(test.equals("456789")); - - test = test.substring(3,5); - Assert.assertTrue(test.equals("78")); - - test = "this/is/a/path"; - String[] strings = test.split("/"); - Assert.assertEquals(4, strings.length); - - Assert.assertEquals("this is a path", test.replaceAll("/", " ")); - Assert.assertEquals("this is a path", test.replace("/", " ")); - } - -} diff --git a/tests/082-inline-execute/src/junit/framework/Assert.java b/tests/082-inline-execute/src/junit/framework/Assert.java deleted file mode 100644 index 364e646ff..000000000 --- a/tests/082-inline-execute/src/junit/framework/Assert.java +++ /dev/null @@ -1,291 +0,0 @@ -package junit.framework; - -/** - * A set of assert methods. Messages are only displayed when an assert fails. - */ - -public class Assert { - /** - * Protect constructor since it is a static only class - */ - protected Assert() { - } - - /** - * Asserts that a condition is true. If it isn't it throws - * an AssertionFailedError with the given message. - */ - static public void assertTrue(String message, boolean condition) { - if (!condition) - fail(message); - } - /** - * Asserts that a condition is true. If it isn't it throws - * an AssertionFailedError. - */ - static public void assertTrue(boolean condition) { - assertTrue(null, condition); - } - /** - * Asserts that a condition is false. If it isn't it throws - * an AssertionFailedError with the given message. - */ - static public void assertFalse(String message, boolean condition) { - assertTrue(message, !condition); - } - /** - * Asserts that a condition is false. If it isn't it throws - * an AssertionFailedError. - */ - static public void assertFalse(boolean condition) { - assertFalse(null, condition); - } - /** - * Fails a test with the given message. - */ - static public void fail(String message) { - throw new AssertionFailedError(message); - } - /** - * Fails a test with no message. - */ - static public void fail() { - fail(null); - } - /** - * Asserts that two objects are equal. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertEquals(String message, Object expected, Object actual) { - if (expected == null && actual == null) - return; - if (expected != null && expected.equals(actual)) - return; - failNotEquals(message, expected, actual); - } - /** - * Asserts that two objects are equal. If they are not - * an AssertionFailedError is thrown. - */ - static public void assertEquals(Object expected, Object actual) { - assertEquals(null, expected, actual); - } - /** - * Asserts that two Strings are equal. - */ - static public void assertEquals(String message, String expected, String actual) { - if (expected == null && actual == null) - return; - if (expected != null && expected.equals(actual)) - return; - throw new ComparisonFailure(message, expected, actual); - } - /** - * Asserts that two Strings are equal. - */ - static public void assertEquals(String expected, String actual) { - assertEquals(null, expected, actual); - } - /** - * Asserts that two doubles are equal concerning a delta. If they are not - * an AssertionFailedError is thrown with the given message. If the expected - * value is infinity then the delta value is ignored. - */ - static public void assertEquals(String message, double expected, double actual, double delta) { - // handle infinity specially since subtracting to infinite values gives NaN and the - // the following test fails - if (Double.isInfinite(expected)) { - if (!(expected == actual)) - failNotEquals(message, new Double(expected), new Double(actual)); - } else if (!(Math.abs(expected-actual) <= delta)) // Because comparison with NaN always returns false - failNotEquals(message, new Double(expected), new Double(actual)); - } - /** - * Asserts that two doubles are equal concerning a delta. If the expected - * value is infinity then the delta value is ignored. - */ - static public void assertEquals(double expected, double actual, double delta) { - assertEquals(null, expected, actual, delta); - } - /** - * Asserts that two floats are equal concerning a delta. If they are not - * an AssertionFailedError is thrown with the given message. If the expected - * value is infinity then the delta value is ignored. - */ - static public void assertEquals(String message, float expected, float actual, float delta) { - // handle infinity specially since subtracting to infinite values gives NaN and the - // the following test fails - if (Float.isInfinite(expected)) { - if (!(expected == actual)) - failNotEquals(message, new Float(expected), new Float(actual)); - } else if (!(Math.abs(expected-actual) <= delta)) - failNotEquals(message, new Float(expected), new Float(actual)); - } - /** - * Asserts that two floats are equal concerning a delta. If the expected - * value is infinity then the delta value is ignored. - */ - static public void assertEquals(float expected, float actual, float delta) { - assertEquals(null, expected, actual, delta); - } - /** - * Asserts that two longs are equal. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertEquals(String message, long expected, long actual) { - assertEquals(message, new Long(expected), new Long(actual)); - } - /** - * Asserts that two longs are equal. - */ - static public void assertEquals(long expected, long actual) { - assertEquals(null, expected, actual); - } - /** - * Asserts that two booleans are equal. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertEquals(String message, boolean expected, boolean actual) { - assertEquals(message, new Boolean(expected), new Boolean(actual)); - } - /** - * Asserts that two booleans are equal. - */ - static public void assertEquals(boolean expected, boolean actual) { - assertEquals(null, expected, actual); - } - /** - * Asserts that two bytes are equal. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertEquals(String message, byte expected, byte actual) { - assertEquals(message, new Byte(expected), new Byte(actual)); - } - /** - * Asserts that two bytes are equal. - */ - static public void assertEquals(byte expected, byte actual) { - assertEquals(null, expected, actual); - } - /** - * Asserts that two chars are equal. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertEquals(String message, char expected, char actual) { - assertEquals(message, new Character(expected), new Character(actual)); - } - /** - * Asserts that two chars are equal. - */ - static public void assertEquals(char expected, char actual) { - assertEquals(null, expected, actual); - } - /** - * Asserts that two shorts are equal. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertEquals(String message, short expected, short actual) { - assertEquals(message, new Short(expected), new Short(actual)); - } - /** - * Asserts that two shorts are equal. - */ - static public void assertEquals(short expected, short actual) { - assertEquals(null, expected, actual); - } - /** - * Asserts that two ints are equal. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertEquals(String message, int expected, int actual) { - assertEquals(message, new Integer(expected), new Integer(actual)); - } - /** - * Asserts that two ints are equal. - */ - static public void assertEquals(int expected, int actual) { - assertEquals(null, expected, actual); - } - /** - * Asserts that an object isn't null. - */ - static public void assertNotNull(Object object) { - assertNotNull(null, object); - } - /** - * Asserts that an object isn't null. If it is - * an AssertionFailedError is thrown with the given message. - */ - static public void assertNotNull(String message, Object object) { - assertTrue(message, object != null); - } - /** - * Asserts that an object is null. - */ - static public void assertNull(Object object) { - assertNull(null, object); - } - /** - * Asserts that an object is null. If it is not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertNull(String message, Object object) { - assertTrue(message, object == null); - } - /** - * Asserts that two objects refer to the same object. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertSame(String message, Object expected, Object actual) { - if (expected == actual) - return; - failNotSame(message, expected, actual); - } - /** - * Asserts that two objects refer to the same object. If they are not - * the same an AssertionFailedError is thrown. - */ - static public void assertSame(Object expected, Object actual) { - assertSame(null, expected, actual); - } - /** - * Asserts that two objects refer to the same object. If they are not - * an AssertionFailedError is thrown with the given message. - */ - static public void assertNotSame(String message, Object expected, Object actual) { - if (expected == actual) - failSame(message); - } - /** - * Asserts that two objects refer to the same object. If they are not - * the same an AssertionFailedError is thrown. - */ - static public void assertNotSame(Object expected, Object actual) { - assertNotSame(null, expected, actual); - } - - static private void failSame(String message) { - String formatted= ""; - if (message != null) - formatted= message+" "; - fail(formatted+"expected not same"); - } - - static private void failNotSame(String message, Object expected, Object actual) { - String formatted= ""; - if (message != null) - formatted= message+" "; - fail(formatted+"expected same:<"+expected+"> was not:<"+actual+">"); - } - - static private void failNotEquals(String message, Object expected, Object actual) { - fail(format(message, expected, actual)); - } - - static String format(String message, Object expected, Object actual) { - String formatted= ""; - if (message != null) - formatted= message+" "; - return formatted+"expected:<"+expected+"> but was:<"+actual+">"; - } -} diff --git a/tests/082-inline-execute/src/junit/framework/AssertionFailedError.java b/tests/082-inline-execute/src/junit/framework/AssertionFailedError.java deleted file mode 100644 index e9cb3a385..000000000 --- a/tests/082-inline-execute/src/junit/framework/AssertionFailedError.java +++ /dev/null @@ -1,13 +0,0 @@ -package junit.framework; - -/** - * Thrown when an assertion failed. - */ -public class AssertionFailedError extends Error { - - public AssertionFailedError () { - } - public AssertionFailedError (String message) { - super (message); - } -} diff --git a/tests/082-inline-execute/src/junit/framework/ComparisonFailure.java b/tests/082-inline-execute/src/junit/framework/ComparisonFailure.java deleted file mode 100644 index 0cb2cee91..000000000 --- a/tests/082-inline-execute/src/junit/framework/ComparisonFailure.java +++ /dev/null @@ -1,68 +0,0 @@ -package junit.framework; - -/** - * Thrown when an assert equals for Strings failed. - * - * Inspired by a patch from Alex Chaffee mailto:alex@purpletech.com - */ -public class ComparisonFailure extends AssertionFailedError { - private String fExpected; - private String fActual; - - /** - * Constructs a comparison failure. - * @param message the identifying message or null - * @param expected the expected string value - * @param actual the actual string value - */ - public ComparisonFailure (String message, String expected, String actual) { - super (message); - fExpected= expected; - fActual= actual; - } - - /** - * Returns "..." in place of common prefix and "..." in - * place of common suffix between expected and actual. - * - * @see java.lang.Throwable#getMessage() - */ - public String getMessage() { - if (fExpected == null || fActual == null) - return Assert.format(super.getMessage(), fExpected, fActual); - - int end= Math.min(fExpected.length(), fActual.length()); - - int i= 0; - for(; i < end; i++) { - if (fExpected.charAt(i) != fActual.charAt(i)) - break; - } - int j= fExpected.length()-1; - int k= fActual.length()-1; - for (; k >= i && j >= i; k--,j--) { - if (fExpected.charAt(j) != fActual.charAt(k)) - break; - } - String actual, expected; - - // equal strings - if (j < i && k < i) { - expected= fExpected; - actual= fActual; - } else { - expected= fExpected.substring(i, j+1); - actual= fActual.substring(i, k+1); - if (i <= end && i > 0) { - expected= "..."+expected; - actual= "..."+actual; - } - - if (j < fExpected.length()-1) - expected= expected+"..."; - if (k < fActual.length()-1) - actual= actual+"..."; - } - return Assert.format(super.getMessage(), expected, actual); - } -} diff --git a/tests/083-jit-regressions/expected.txt b/tests/083-jit-regressions/expected.txt deleted file mode 100644 index 7f9f14c65..000000000 --- a/tests/083-jit-regressions/expected.txt +++ /dev/null @@ -1,6 +0,0 @@ -b2296099 passes -b2302318 passes -b2487514 passes -b5884080 passes -longDivTest passes -longModTest passes diff --git a/tests/083-jit-regressions/info.txt b/tests/083-jit-regressions/info.txt deleted file mode 100644 index 00c24ee6f..000000000 --- a/tests/083-jit-regressions/info.txt +++ /dev/null @@ -1,11 +0,0 @@ -This is a miscellaneous test that was imported into the new-at-the-time -runtime test framework. The test is intended to exercise basic features, -and as such cannot be build on top of junit, since failure of such basic -features might disrupt junit. - -This test covers JIT regressions - -2296099 JIT shift bug -2302318 Crash during spin-on-suspend testing -2487514 Missed exception in PriorityBlockingQueueTest.testToArray1_BadArg -5884080 ICS JIT regression in nested loop formation diff --git a/tests/083-jit-regressions/src/Main.java b/tests/083-jit-regressions/src/Main.java deleted file mode 100644 index 68bfa3732..000000000 --- a/tests/083-jit-regressions/src/Main.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2009 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.util.concurrent.*; - -/** - * Test for Jit regressions. - */ -public class Main { - public static void main(String args[]) throws Exception { - b2296099Test(); - b2302318Test(); - b2487514Test(); - b5884080Test(); - zeroTest(); - } - - static void b2296099Test() throws Exception { - int x = -1190771042; - int dist = 360530809; - int xl = -1190771042; - int distl = 360530809; - - for (int i = 0; i < 100000; i++) { - int b = rotateLeft(x, dist); - if (b != 1030884493) - throw new RuntimeException("Unexpected value: " + b - + " after " + i + " iterations"); - } - for (int i = 0; i < 100000; i++) { - long bl = rotateLeft(xl, distl); - if (bl != 1030884493) - throw new RuntimeException("Unexpected value: " + bl - + " after " + i + " iterations"); - } - System.out.println("b2296099 passes"); - } - - static int rotateLeft(int i, int distance) { - return ((i << distance) | (i >>> (-distance))); - } - - static void b2302318Test() { - System.gc(); - - SpinThread slow = new SpinThread(Thread.MIN_PRIORITY); - SpinThread fast1 = new SpinThread(Thread.NORM_PRIORITY); - SpinThread fast2 = new SpinThread(Thread.MAX_PRIORITY); - - slow.setDaemon(true); - fast1.setDaemon(true); - fast2.setDaemon(true); - - fast2.start(); - slow.start(); - fast1.start(); - try { - Thread.sleep(3000); - } catch (InterruptedException ie) {/*ignore */} - System.gc(); - - System.out.println("b2302318 passes"); - } - - static void b2487514Test() { - PriorityBlockingQueue q = new PriorityBlockingQueue(10); - int catchCount = 0; - - q.offer(new Integer(0)); - /* - * Warm up the code cache to have toArray() compiled. The key here is - * to pass a compatible type so that there are no exceptions when - * executing the method body (ie the APUT_OBJECT bytecode). - */ - for (int i = 0; i < 1000; i++) { - Integer[] ints = (Integer[]) q.toArray(new Integer[5]); - } - - /* Now pass an incompatible type which is guaranteed to throw */ - for (int i = 0; i < 1000; i++) { - try { - Object[] obj = q.toArray(new String[5]); - } - catch (ArrayStoreException success) { - catchCount++; - } - } - - if (catchCount == 1000) { - System.out.println("b2487514 passes"); - } - else { - System.out.println("b2487514 fails: catchCount is " + catchCount + - " (expecting 1000)"); - } - } - - static void b5884080Test() { - int vA = 1; - - int l = 0; - do { - int k = 0; - do - vA += 1; - while(++k < 100); - } while (++l < 1000); - if (vA == 100001) { - System.out.println("b5884080 passes"); - } - else { - System.out.println("b5884080 fails: vA is " + vA + - " (expecting 100001)"); - } - } - - static void zeroTest() throws Exception { - ZeroTests zt = new ZeroTests(); - try { - zt.longDivTest(); - } catch (Throwable th) { - th.printStackTrace(); - } - try { - zt.longModTest(); - } catch (Throwable th) { - th.printStackTrace(); - } - } -} - -class SpinThread extends Thread { - int mPriority; - - SpinThread(int prio) { - super("Spin prio=" + prio); - mPriority = prio; - } - - public void run() { - setPriority(mPriority); - while (true) {} - } -} diff --git a/tests/083-jit-regressions/src/ZeroTests.java b/tests/083-jit-regressions/src/ZeroTests.java deleted file mode 100644 index 57ca151c0..000000000 --- a/tests/083-jit-regressions/src/ZeroTests.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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. - */ - -import java.util.Random; - -/** - * Tests long division by zero for both / and %. - */ -public class ZeroTests { - public void longDivTest() throws Exception { - longTest("longDivTest", true); - } - - public void longModTest() throws Exception { - longTest("longModTest", false); - } - - private static void longTest(String name, boolean divide) throws Exception { - // Warm up JIT. - for (int i = 0; i < 10000; ++i) { - try { - // We won't JIT code that hasn't completed successfully, so rhs can't be 0 here! - if (divide) { - longDiv(1, 1); - } else { - longMod(1, 1); - } - } catch (ArithmeticException expected) { - throw new AssertionError(name + " threw during warmup"); - } - } - - // Boom? - int catchCount = 0; - for (int i = 0; i < 10000; ++i) { - try { - if (divide) { - longDiv(1, 0); - } else { - longMod(1, 0); - } - throw new AssertionError(name + " failed to throw: " + i); - } catch (ArithmeticException expected) { - ++catchCount; - } - } - if (catchCount != 10000) throw new AssertionError(name + " failed: " + catchCount); - - System.out.println(name + " passes"); - } - - private static long longDiv(long lhs, long rhs) { - return lhs / rhs; - } - - private static long longMod(long lhs, long rhs) { - return lhs % rhs; - } -} diff --git a/tests/084-class-init/expected.txt b/tests/084-class-init/expected.txt deleted file mode 100644 index 68a2b384a..000000000 --- a/tests/084-class-init/expected.txt +++ /dev/null @@ -1,9 +0,0 @@ -Got expected EIIE for FIELD0 -Got expected NCDFE for FIELD0 -Got expected NCDFE for FIELD1 -Got expected 'hello!' from Exploder -SlowInit static block pre-sleep -SlowInit static block post-sleep -MethodThread message -Fields (child thread): 111222333444 -Fields (main thread): 111222333444 diff --git a/tests/084-class-init/info.txt b/tests/084-class-init/info.txt deleted file mode 100644 index 00fa31b7f..000000000 --- a/tests/084-class-init/info.txt +++ /dev/null @@ -1 +0,0 @@ -Test class initialization edge cases and race conditions. diff --git a/tests/084-class-init/src/Exploder.java b/tests/084-class-init/src/Exploder.java deleted file mode 100644 index 911e5febe..000000000 --- a/tests/084-class-init/src/Exploder.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ - - -/** - * Throws an Error rather than an exception from its class initializer. - */ -public class Exploder { - public static final Object FIELD = new AssertThrower(); - static class AssertThrower { - AssertThrower() { - throw new AssertionError("hello!"); - } - } -} diff --git a/tests/084-class-init/src/IntHolder.java b/tests/084-class-init/src/IntHolder.java deleted file mode 100644 index 4012d6e8b..000000000 --- a/tests/084-class-init/src/IntHolder.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - - -/** - * Holds an int. - */ -public class IntHolder { - private int mValue = 0; - - /** - * Constructs an IntHolder with the specified value. Throws an - * exception if the initial value is less than zero. - */ - public IntHolder(int initialVal) { - if (initialVal < 0) - throw new RuntimeException("negative number"); - - mValue = initialVal; - } - - public int getValue() { - return mValue; - } - public void setValue(int val) { - mValue = val; - } -} diff --git a/tests/084-class-init/src/Main.java b/tests/084-class-init/src/Main.java deleted file mode 100644 index 29681ceae..000000000 --- a/tests/084-class-init/src/Main.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -public class Main { - public static void main(String[] args) { - checkExceptions(); - checkTiming(); - } - - public static void sleep(int msec) { - try { - Thread.sleep(msec); - } catch (InterruptedException ie) { - System.err.println("sleep interrupted"); - } - } - - static void checkExceptions() { - try { - System.out.println(PartialInit.FIELD0); - System.err.println("Construction of PartialInit succeeded unexpectedly"); - } catch (ExceptionInInitializerError eiie) { - System.out.println("Got expected EIIE for FIELD0"); - } - - try { - System.out.println(PartialInit.FIELD0); - System.err.println("Load of FIELD0 succeeded unexpectedly"); - } catch (NoClassDefFoundError ncdfe) { - System.out.println("Got expected NCDFE for FIELD0"); - } - try { - System.out.println(PartialInit.FIELD1); - System.err.println("Load of FIELD1 succeeded unexpectedly"); - } catch (NoClassDefFoundError ncdfe) { - System.out.println("Got expected NCDFE for FIELD1"); - } - - try { - System.out.println(Exploder.FIELD); - System.err.println("Load of FIELD succeeded unexpectedly"); - } catch (AssertionError expected) { - System.out.println("Got expected '" + expected.getMessage() + "' from Exploder"); - } - } - - static void checkTiming() { - FieldThread fieldThread = new FieldThread(); - MethodThread methodThread = new MethodThread(); - - fieldThread.start(); - methodThread.start(); - - /* start class init */ - IntHolder zero = SlowInit.FIELD0; - - /* wait for children to complete */ - try { - fieldThread.join(); - methodThread.join(); - } catch (InterruptedException ie) { - System.err.println(ie); - } - - /* print all values */ - System.out.println("Fields (main thread): " + - SlowInit.FIELD0.getValue() + SlowInit.FIELD1.getValue() + - SlowInit.FIELD2.getValue() + SlowInit.FIELD3.getValue()); - } - - static class FieldThread extends Thread { - public void run() { - /* allow SlowInit's <clinit> to start */ - Main.sleep(1000); - - /* collect fields; should delay until class init completes */ - int field0, field1, field2, field3; - field0 = SlowInit.FIELD0.getValue(); - field1 = SlowInit.FIELD1.getValue(); - field2 = SlowInit.FIELD2.getValue(); - field3 = SlowInit.FIELD3.getValue(); - - /* let MethodThread print first */ - Main.sleep(5000); - System.out.println("Fields (child thread): " + - field0 + field1 + field2 + field3); - } - } - - static class MethodThread extends Thread { - public void run() { - /* allow SlowInit's <clinit> to start */ - Main.sleep(1000); - - /* use a method that shouldn't be accessible yet */ - SlowInit.printMsg("MethodThread message"); - } - } -} diff --git a/tests/084-class-init/src/PartialInit.java b/tests/084-class-init/src/PartialInit.java deleted file mode 100644 index d4c71ffec..000000000 --- a/tests/084-class-init/src/PartialInit.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - - -/** - * Partially-initialized class. - */ -public class PartialInit { - public static final IntHolder FIELD0 = new IntHolder(1); // succeeds - public static final IntHolder FIELD1 = new IntHolder(-2); // throws -} diff --git a/tests/084-class-init/src/SlowInit.java b/tests/084-class-init/src/SlowInit.java deleted file mode 100644 index f0c691975..000000000 --- a/tests/084-class-init/src/SlowInit.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2010 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 that initializes with a pause. - */ -public class SlowInit { - - public static final IntHolder FIELD0 = new IntHolder(0); - public static final IntHolder FIELD1 = new IntHolder(0); - public static final IntHolder FIELD2 = new IntHolder(0); - public static final IntHolder FIELD3 = new IntHolder(0); - - public static void printMsg(String msg) { - System.out.println(msg); - } - - static { - FIELD0.setValue(111); - FIELD1.setValue(222); - printMsg("SlowInit static block pre-sleep"); - Main.sleep(4000); - printMsg("SlowInit static block post-sleep"); - FIELD2.setValue(333); - FIELD3.setValue(444); - }; -} diff --git a/tests/085-old-style-inner-class/build b/tests/085-old-style-inner-class/build deleted file mode 100644 index dc6f3bb12..000000000 --- a/tests/085-old-style-inner-class/build +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2010 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. - -# Stop if something fails. -set -e - -# We compile for a 1.4 target to suppress the use of EnclosingMethod -# attributes. -mkdir classes -${JAVAC} -source 1.4 -target 1.4 -d classes `find src -name '*.java'` - -# Suppress stderr to keep the inner class warnings out of the expected output. -dx --debug --dex --dump-to=classes.lst --output=classes.dex \ - --dump-width=1000 classes 2>/dev/null - -zip test.jar classes.dex diff --git a/tests/085-old-style-inner-class/expected.txt b/tests/085-old-style-inner-class/expected.txt deleted file mode 100644 index 63a007606..000000000 --- a/tests/085-old-style-inner-class/expected.txt +++ /dev/null @@ -1,8 +0,0 @@ -Class: Main$1 - getDeclaringClass(): (null) - getEnclosingClass(): (null) - getEnclosingMethod(): (null) -Class: Main$2 - getDeclaringClass(): (null) - getEnclosingClass(): (null) - getEnclosingMethod(): (null) diff --git a/tests/085-old-style-inner-class/info.txt b/tests/085-old-style-inner-class/info.txt deleted file mode 100644 index 9e5c4f901..000000000 --- a/tests/085-old-style-inner-class/info.txt +++ /dev/null @@ -1,2 +0,0 @@ -Test that the conversion of an old-style (pre-1.5) inner class results -in a loss of inner class reflection information. diff --git a/tests/085-old-style-inner-class/src/Main.java b/tests/085-old-style-inner-class/src/Main.java deleted file mode 100644 index c9a5b72db..000000000 --- a/tests/085-old-style-inner-class/src/Main.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2010 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.Method; - -/** - * Test reflection on old-style inner classes. - */ -public class Main { - private static Runnable theRunnable = new Runnable() { - public void run() { } - }; - - private static Runnable create() { - return new Runnable() { - public void run() { } - }; - } - - private static String nameOf(Class clazz) { - return (clazz == null) ? "(null)" : clazz.getName(); - } - - private static String nameOf(Method meth) { - return (meth == null) ? "(null)" : meth.toString(); - } - - private static void infoFor(Class clazz) { - System.out.println("Class: " + nameOf(clazz) + "\n" + - " getDeclaringClass(): " + - nameOf(clazz.getDeclaringClass()) + "\n" + - " getEnclosingClass(): " + - nameOf(clazz.getEnclosingClass()) + "\n" + - " getEnclosingMethod(): " + - nameOf(clazz.getEnclosingMethod())); - } - - public static void main(String args[]) { - infoFor(theRunnable.getClass()); - infoFor(create().getClass()); - } -} diff --git a/tests/086-null-super/expected.txt b/tests/086-null-super/expected.txt deleted file mode 100644 index 20c6796db..000000000 --- a/tests/086-null-super/expected.txt +++ /dev/null @@ -1 +0,0 @@ -Got expected ITE/NPE diff --git a/tests/086-null-super/info.txt b/tests/086-null-super/info.txt deleted file mode 100644 index f983bd0dd..000000000 --- a/tests/086-null-super/info.txt +++ /dev/null @@ -1,7 +0,0 @@ -ClassLoader.loadClass() is expected to throw an exception, usually -ClassNotFound, if it can't find the given Class, and not return null. - -This is a regression test for a defect in Dalvik, which was assuming -that if there was no exception, the value returned would be non-null. - -This test is not expected to work for the reference implementation. diff --git a/tests/086-null-super/src/Main.java b/tests/086-null-super/src/Main.java deleted file mode 100644 index 82237c523..000000000 --- a/tests/086-null-super/src/Main.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2010 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.Constructor; -import java.lang.reflect.Method; -import java.lang.reflect.InvocationTargetException; - -/** - * Class loader test. - */ -public class Main { - /** - * Thrown when an unexpected Exception is caught internally. - */ - static class TestFailed extends Exception { - public TestFailed(Throwable cause) { - super(cause); - } - } - - /** - * A class loader which loads classes from the dex file - * "test.jar". However, it will return null when asked to load the - * class InaccessibleSuper. - * - * When testing code calls BrokenDexLoader's findBrokenClass(), - * a BrokenDexLoader will be the defining loader for the class - * Inaccessible. The VM will call the defining loader for - * "InaccessibleSuper", which will return null, which the VM - * should be able to deal with gracefully. - * - * Note that this depends heavily on the Dalvik test harness. - */ - static class BrokenDexLoader extends ClassLoader { - - /** We return null when asked to load InaccessibleSuper. */ - private static class InaccessibleSuper {} - private static class Inaccessible extends InaccessibleSuper {} - - private static final String SUPERCLASS_NAME = - "Main$BrokenDexLoader$InaccessibleSuper"; - private static final String CLASS_NAME = - "Main$BrokenDexLoader$Inaccessible"; - - private static final String DEX_FILE = "test.jar"; - - public BrokenDexLoader(ClassLoader parent) { - super(parent); - } - - /** - * Finds the class with the specified binary name, from DEX_FILE. - * - * If we don't find a match, we throw an exception. - */ - private Class<?> findDexClass(String name) - throws TestFailed, InvocationTargetException - { - - try { - /* - * Find the DexFile class, and construct a DexFile object - * through reflection, then call loadCLass on it. - */ - Class mDexClass = ClassLoader.getSystemClassLoader(). - loadClass("dalvik.system.DexFile"); - Constructor ctor = mDexClass. - getConstructor(new Class[] {String.class}); - Object mDexFile = ctor.newInstance(DEX_FILE); - Method meth = mDexClass. - getMethod("loadClass", - new Class[] { String.class, ClassLoader.class }); - /* - * Invoking loadClass on CLASS_NAME is expected to - * throw an InvocationTargetException. Anything else - * is an error we can't recover from. - */ - meth.invoke(mDexFile, name, this); - } catch (NoSuchMethodException nsme) { - throw new TestFailed(nsme); - } catch (InstantiationException ie) { - throw new TestFailed(ie); - } catch (IllegalAccessException iae) { - throw new TestFailed(iae); - } catch (ClassNotFoundException cnfe) { - throw new TestFailed(cnfe); - } - - return null; - } - - /** - * Load a class. - * - * Return null if the class's name is SUPERCLASS_NAME; - * otherwise invoke the super's loadClass method. - */ - public Class<?> loadClass(String name, boolean resolve) - throws ClassNotFoundException - { - if (SUPERCLASS_NAME.equals(name)) { - return null; - } - - return super.loadClass(name, resolve); - } - - /** - * Attempt to find the class with the superclass we refuse to - * load. This is expected to throw an - * InvocationTargetException, with a NullPointerException as - * its cause. - */ - public void findBrokenClass() - throws TestFailed, InvocationTargetException - { - findDexClass(CLASS_NAME); - } - } - - /** - * Main entry point. - */ - public static void main(String[] args) - throws TestFailed, ClassNotFoundException { - /* - * Run test. - */ - testFailLoadAndGc(); - } - - /** - * See if we can GC after a failed load. - */ - static void testFailLoadAndGc() throws TestFailed { - try { - BrokenDexLoader loader; - - loader = new BrokenDexLoader(ClassLoader.getSystemClassLoader()); - loader.findBrokenClass(); - System.err.println("ERROR: Inaccessible was accessible"); - } catch (InvocationTargetException ite) { - Throwable cause = ite.getCause(); - if (cause instanceof NullPointerException) { - System.err.println("Got expected ITE/NPE"); - } else { - System.err.println("Got unexpected ITE"); - ite.printStackTrace(); - } - } - } -} diff --git a/tests/087-gc-after-link/expected.txt b/tests/087-gc-after-link/expected.txt deleted file mode 100644 index 3b2d33a6b..000000000 --- a/tests/087-gc-after-link/expected.txt +++ /dev/null @@ -1,2 +0,0 @@ -Got expected ITE/NPE -GC complete. diff --git a/tests/087-gc-after-link/info.txt b/tests/087-gc-after-link/info.txt deleted file mode 100644 index 948383815..000000000 --- a/tests/087-gc-after-link/info.txt +++ /dev/null @@ -1,8 +0,0 @@ -This test causes a linkage error, which calls dvmFreeClassInnards on -the unlinked Class. - -This is a regression test for a defect in Dalvik, which was assuming -that dvmFreeClassInnards could be called twice on the same class. - -This test is a modified version of test 086. -This test is not expected to work for the reference implementation. diff --git a/tests/087-gc-after-link/src/Main.java b/tests/087-gc-after-link/src/Main.java deleted file mode 100644 index 11fb2d316..000000000 --- a/tests/087-gc-after-link/src/Main.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (C) 2010 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.Constructor; -import java.lang.reflect.Method; -import java.lang.reflect.InvocationTargetException; - -/** - * Class loader test. - */ -public class Main { - /** - * Thrown when an unexpected Exception is caught internally. - */ - static class TestFailed extends Exception { - public TestFailed(Throwable cause) { - super(cause); - } - } - - /** - * A class loader which loads classes from the dex file - * "test.jar". However, it will return null when asked to load the - * class InaccessibleSuper. - * - * When testing code calls BrokenDexLoader's findBrokenClass(), - * a BrokenDexLoader will be the defining loader for the class - * Inaccessible. The VM will call the defining loader for - * "InaccessibleSuper", which will return null, which the VM - * should be able to deal with gracefully. - * - * Note that this depends heavily on the Dalvik test harness. - */ - static class BrokenDexLoader extends ClassLoader { - - /** We return null when asked to load InaccessibleSuper. */ - private static class InaccessibleSuper {} - private static class Inaccessible extends InaccessibleSuper {} - - private static final String SUPERCLASS_NAME = - "Main$BrokenDexLoader$InaccessibleSuper"; - private static final String CLASS_NAME = - "Main$BrokenDexLoader$Inaccessible"; - - private static final String DEX_FILE = "test.jar"; - - public BrokenDexLoader(ClassLoader parent) { - super(parent); - } - - /** - * Finds the class with the specified binary name, from DEX_FILE. - * - * If we don't find a match, we throw an exception. - */ - private Class<?> findDexClass(String name) - throws TestFailed, InvocationTargetException - { - Object dexFile = null; - Class dexClass = null; - - try { - try { - /* - * Find the DexFile class, and construct a DexFile object - * through reflection, then call loadClass on it. - */ - dexClass = ClassLoader.getSystemClassLoader(). - loadClass("dalvik.system.DexFile"); - Constructor ctor = dexClass. - getConstructor(new Class[] {String.class}); - dexFile = ctor.newInstance(DEX_FILE); - Method meth = dexClass.getMethod("loadClass", - new Class[] { String.class, ClassLoader.class }); - /* - * Invoking loadClass on CLASS_NAME is expected to - * throw an InvocationTargetException. Anything else - * is an error we can't recover from. - */ - meth.invoke(dexFile, name, this); - } finally { - if (dexFile != null) { - /* close the DexFile to make CloseGuard happy */ - Method meth = dexClass.getMethod("close", (Class[]) null); - meth.invoke(dexFile); - } - } - } catch (NoSuchMethodException nsme) { - throw new TestFailed(nsme); - } catch (InstantiationException ie) { - throw new TestFailed(ie); - } catch (IllegalAccessException iae) { - throw new TestFailed(iae); - } catch (ClassNotFoundException cnfe) { - throw new TestFailed(cnfe); - } - - return null; - } - - /** - * Load a class. - * - * Return null if the class's name is SUPERCLASS_NAME; - * otherwise invoke the super's loadClass method. - */ - public Class<?> loadClass(String name, boolean resolve) - throws ClassNotFoundException - { - if (SUPERCLASS_NAME.equals(name)) { - return null; - } - - return super.loadClass(name, resolve); - } - - /** - * Attempt to find the class with the superclass we refuse to - * load. This is expected to throw an - * InvocationTargetException, with a NullPointerException as - * its cause. - */ - public void findBrokenClass() - throws TestFailed, InvocationTargetException - { - findDexClass(CLASS_NAME); - } - } - - /** - * Main entry point. - */ - public static void main(String[] args) - throws TestFailed, ClassNotFoundException { - /* - * Run test. - */ - testFailLoadAndGc(); - } - - /** - * See if we can GC after a failed load. - */ - static void testFailLoadAndGc() throws TestFailed { - try { - BrokenDexLoader loader; - - loader = new BrokenDexLoader(ClassLoader.getSystemClassLoader()); - loader.findBrokenClass(); - System.err.println("ERROR: Inaccessible was accessible"); - } catch (InvocationTargetException ite) { - Throwable cause = ite.getCause(); - if (cause instanceof NullPointerException) { - System.err.println("Got expected ITE/NPE"); - } else { - System.err.println("Got unexpected ITE"); - ite.printStackTrace(); - } - } - System.gc(); - System.out.println("GC complete."); - } -} diff --git a/tests/088-monitor-verification/expected.txt b/tests/088-monitor-verification/expected.txt deleted file mode 100644 index 07f5b0be8..000000000 --- a/tests/088-monitor-verification/expected.txt +++ /dev/null @@ -1,7 +0,0 @@ -recursiveSync ok -nestedMayThrow ok -constantLock ok -excessiveNesting ok -notNested ok -twoPath ok -triplet ok diff --git a/tests/088-monitor-verification/info.txt b/tests/088-monitor-verification/info.txt deleted file mode 100644 index c00cb1c1f..000000000 --- a/tests/088-monitor-verification/info.txt +++ /dev/null @@ -1,2 +0,0 @@ -Try different arrangements of "synchronized" to exercise the structured -lock checks in the bytecode verifier. diff --git a/tests/088-monitor-verification/src/Main.java b/tests/088-monitor-verification/src/Main.java deleted file mode 100644 index aa90b92da..000000000 --- a/tests/088-monitor-verification/src/Main.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - - -/* - * Entry point and tests that are expected to succeed. - */ -public class Main { - /** - * Drives tests. - */ - public static void main(String[] args) { - Main m = new Main(); - - m.recursiveSync(0); - - m.nestedMayThrow(false); - try { - m.nestedMayThrow(true); - System.err.println("nestedThrow(true) did not throw"); - } catch (MyException me) {} - System.out.println("nestedMayThrow ok"); - - m.constantLock(); - System.out.println("constantLock ok"); - - m.notExcessiveNesting(); - if (false) { // TODO: remove when verification is turned on - try { - TooDeep.excessiveNesting(); - System.err.println("excessiveNesting did not throw"); - } catch (VerifyError ve) {} - } - System.out.println("excessiveNesting ok"); - - m.notNested(); - System.out.println("notNested ok"); - - Object obj1 = new Object(); - Object obj2 = new Object(); - - m.twoPath(obj1, obj2, 0); - System.out.println("twoPath ok"); - - m.triplet(obj1, obj2, 0); - System.out.println("triplet ok"); - } - - /** - * Recursive synchronized method. - */ - synchronized void recursiveSync(int iter) { - if (iter < 40) { - recursiveSync(iter+1); - } else { - System.out.println("recursiveSync ok"); - } - } - - /** - * Tests simple nesting, with and without a throw. - */ - void nestedMayThrow(boolean doThrow) { - synchronized (this) { - synchronized (Main.class) { - synchronized (new Object()) { - synchronized(Class.class) { - if (doThrow) { - throw new MyException(); - } - } - } - } - } - } - - /** - * Exercises bug 3215458. - */ - void constantLock() { - Class thing = Thread.class; - synchronized (Thread.class) {} - } - - /** - * Confirms that we can have 32 nested monitors on one method. - */ - void notExcessiveNesting() { - synchronized (this) { // 1 - synchronized (this) { // 2 - synchronized (this) { // 3 - synchronized (this) { // 4 - synchronized (this) { // 5 - synchronized (this) { // 6 - synchronized (this) { // 7 - synchronized (this) { // 8 - synchronized (this) { // 9 - synchronized (this) { // 10 - synchronized (this) { // 11 - synchronized (this) { // 12 - synchronized (this) { // 13 - synchronized (this) { // 14 - synchronized (this) { // 15 - synchronized (this) { // 16 - synchronized (this) { // 17 - synchronized (this) { // 18 - synchronized (this) { // 19 - synchronized (this) { // 20 - synchronized (this) { // 21 - synchronized (this) { // 22 - synchronized (this) { // 23 - synchronized (this) { // 24 - synchronized (this) { // 25 - synchronized (this) { // 26 - synchronized (this) { // 27 - synchronized (this) { // 28 - synchronized (this) { // 29 - synchronized (this) { // 30 - synchronized (this) { // 31 - synchronized (this) { // 32 - }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} - } - - /** - * Confirms that we can have more than 32 non-nested monitors in one - * method. - */ - void notNested() { - synchronized (this) {} // 1 - synchronized (this) {} // 2 - synchronized (this) {} // 3 - synchronized (this) {} // 4 - synchronized (this) {} // 5 - synchronized (this) {} // 6 - synchronized (this) {} // 7 - synchronized (this) {} // 8 - synchronized (this) {} // 9 - synchronized (this) {} // 10 - synchronized (this) {} // 11 - synchronized (this) {} // 12 - synchronized (this) {} // 13 - synchronized (this) {} // 14 - synchronized (this) {} // 15 - synchronized (this) {} // 16 - synchronized (this) {} // 17 - synchronized (this) {} // 18 - synchronized (this) {} // 19 - synchronized (this) {} // 20 - synchronized (this) {} // 21 - synchronized (this) {} // 22 - synchronized (this) {} // 23 - synchronized (this) {} // 24 - synchronized (this) {} // 25 - synchronized (this) {} // 26 - synchronized (this) {} // 27 - synchronized (this) {} // 28 - synchronized (this) {} // 29 - synchronized (this) {} // 30 - synchronized (this) {} // 31 - synchronized (this) {} // 32 - synchronized (this) {} // 33 - synchronized (this) {} // 34 - } - - /* does nothing but ensure that the compiler doesn't discard an object */ - private void doNothing(Object obj) {} - - /** - * Conditionally uses one of the synchronized objects. - */ - public void twoPath(Object obj1, Object obj2, int x) { - Object localObj; - - synchronized (obj1) { - synchronized(obj2) { - if (x == 0) { - localObj = obj2; - } else { - localObj = obj1; - } - } - } - - doNothing(localObj); - } - - /** - * Lock the monitor two or three times, and make use of the locked or - * unlocked object. - */ - public void triplet(Object obj1, Object obj2, int x) { - Object localObj; - - synchronized (obj1) { - synchronized(obj1) { - if (x == 0) { - synchronized(obj1) { - localObj = obj2; - } - } else { - localObj = obj1; - } - } - } - - doNothing(localObj); - } -} diff --git a/tests/088-monitor-verification/src/MyException.java b/tests/088-monitor-verification/src/MyException.java deleted file mode 100644 index cf65d6da4..000000000 --- a/tests/088-monitor-verification/src/MyException.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -public class MyException extends RuntimeException { - public MyException() { - super(); - } - public MyException(String msg) { - super(msg); - } -} diff --git a/tests/088-monitor-verification/src/TooDeep.java b/tests/088-monitor-verification/src/TooDeep.java deleted file mode 100644 index 76192e55c..000000000 --- a/tests/088-monitor-verification/src/TooDeep.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - - -/** - * The class has a method with too many levels of nested "synchronized" - * blocks. The verifier will reject it. - * - * (It would be perfectly okay if the verifier *didn't* reject this. - * The goal here is just to exercise the failure path. It also serves - * as a check to see if the monitor checks are enabled.) - */ -public class TooDeep { - - public static void excessiveNesting() { - synchronized (TooDeep.class) { // 1 - synchronized (TooDeep.class) { // 2 - synchronized (TooDeep.class) { // 3 - synchronized (TooDeep.class) { // 4 - synchronized (TooDeep.class) { // 5 - synchronized (TooDeep.class) { // 6 - synchronized (TooDeep.class) { // 7 - synchronized (TooDeep.class) { // 8 - synchronized (TooDeep.class) { // 9 - synchronized (TooDeep.class) { // 10 - synchronized (TooDeep.class) { // 11 - synchronized (TooDeep.class) { // 12 - synchronized (TooDeep.class) { // 13 - synchronized (TooDeep.class) { // 14 - synchronized (TooDeep.class) { // 15 - synchronized (TooDeep.class) { // 16 - synchronized (TooDeep.class) { // 17 - synchronized (TooDeep.class) { // 18 - synchronized (TooDeep.class) { // 19 - synchronized (TooDeep.class) { // 20 - synchronized (TooDeep.class) { // 21 - synchronized (TooDeep.class) { // 22 - synchronized (TooDeep.class) { // 23 - synchronized (TooDeep.class) { // 24 - synchronized (TooDeep.class) { // 25 - synchronized (TooDeep.class) { // 26 - synchronized (TooDeep.class) { // 27 - synchronized (TooDeep.class) { // 28 - synchronized (TooDeep.class) { // 29 - synchronized (TooDeep.class) { // 30 - synchronized (TooDeep.class) { // 31 - synchronized (TooDeep.class) { // 32 - synchronized (TooDeep.class) { // 33 - }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} - } -} diff --git a/tests/089-many-methods/build b/tests/089-many-methods/build deleted file mode 100644 index 0bd90c28a..000000000 --- a/tests/089-many-methods/build +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2008 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. - -# Stop if something fails. -set -e - -# Write out files with 65500 total static fields, instance fields, and methods -# to exceed the dex format's limits. -mkdir src -awk ' -BEGIN { - writeFileField("FillerStatic", "static public int staticInt"); - writeFileField("FillerField", "public int fieldInt"); - writeFileMethod("FillerMethod"); -} -function writeFileField(name, type) { - fileName = "src/" name ".java"; - printf("public class %s {\n", name) > fileName; - for (i = 1; i <= 65500; i++) { - printf(" %s%d;\n", type, i) > fileName; - } - printf("}\n") > fileName; -} -function writeFileMethod(name) { - fileName = "src/" name ".java"; - printf("public class %s {\n", name) > fileName; - for (i = 1; i <= 65500; i++) { - printf(" public void meth%d() { }\n", i) > fileName; - } - printf("}\n") > fileName; -}' - -mkdir classes -${JAVAC} -d classes `find src -name '*.java'` -dx -JXmx1024m --dex --no-optimize classes - diff --git a/tests/089-many-methods/expected.txt b/tests/089-many-methods/expected.txt deleted file mode 100644 index b74e0eef8..000000000 --- a/tests/089-many-methods/expected.txt +++ /dev/null @@ -1,6 +0,0 @@ - -trouble writing output: Too many field references: 131000; max is 65536. -You may try using --multi-dex option. -References by package: -131000 default -build exit status: 2 diff --git a/tests/089-many-methods/info.txt b/tests/089-many-methods/info.txt deleted file mode 100644 index 4f73bd605..000000000 --- a/tests/089-many-methods/info.txt +++ /dev/null @@ -1,2 +0,0 @@ -Test that we print a reasonable message when the application exceeds more -than 65536 methods. diff --git a/tests/090-loop-formation/expected.txt b/tests/090-loop-formation/expected.txt deleted file mode 100644 index b7e0bb3d1..000000000 --- a/tests/090-loop-formation/expected.txt +++ /dev/null @@ -1,5 +0,0 @@ -counter1 is 0 -counter2 is 32767 -counter3 is 32767 -counter4 is 0 -counter5 is 65534 diff --git a/tests/090-loop-formation/info.txt b/tests/090-loop-formation/info.txt deleted file mode 100644 index 98d1d4bef..000000000 --- a/tests/090-loop-formation/info.txt +++ /dev/null @@ -1,3 +0,0 @@ -Test loop formation heuristics and code generation. Basically the problem to -catch here is to make sure that some never-exercised code blocks are included -in the loop region, and the JIT compiler won't choke on unresolved fields. diff --git a/tests/090-loop-formation/src/Main.java b/tests/090-loop-formation/src/Main.java deleted file mode 100644 index 7c16667ff..000000000 --- a/tests/090-loop-formation/src/Main.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ - -/* - * Create two versions of loops where the unresolved field is on either the - * taken or the non-taken path to make sure that the loop detection code bails - * on unresolved fields. - */ -public class Main { - static int counter1; - static int counter2; - static int counter3; - static int counter4; - static int counter5; - - public static void main(String[] args) { - /* counter1 is not resolved */ - for (int i = 0; i < 32767; i++) { - if (i < 0) { - counter1++; - } else { - counter2++; - } - counter5++; - } - - /* counter4 is not resolved */ - for (int i = 0; i < 32767; i++) { - if (i >= 0) { - counter3++; - } else { - counter4++; - } - counter5++; - } - - System.out.println("counter1 is " + counter1); - System.out.println("counter2 is " + counter2); - System.out.println("counter3 is " + counter3); - System.out.println("counter4 is " + counter4); - System.out.println("counter5 is " + counter5); - } -} diff --git a/tests/091-deep-interface-hierarchy/expected.txt b/tests/091-deep-interface-hierarchy/expected.txt deleted file mode 100644 index 33bcb024d..000000000 --- a/tests/091-deep-interface-hierarchy/expected.txt +++ /dev/null @@ -1 +0,0 @@ -A new instance of Z was created successfully diff --git a/tests/091-deep-interface-hierarchy/info.txt b/tests/091-deep-interface-hierarchy/info.txt deleted file mode 100644 index b62cec60f..000000000 --- a/tests/091-deep-interface-hierarchy/info.txt +++ /dev/null @@ -1,4 +0,0 @@ -Test class loading for deep interface hierarchies. The problem was that in a deep interface -hierarchy super-interfaces were recursively concatenated without looking for duplicates. -In cases like this can quickly lead to excessive LinearAlloc consumption due to more than linear -duplication of iftables. diff --git a/tests/091-deep-interface-hierarchy/src/Main.java b/tests/091-deep-interface-hierarchy/src/Main.java deleted file mode 100644 index 8ab47f373..000000000 --- a/tests/091-deep-interface-hierarchy/src/Main.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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. - */ - -/** - * Create a hierarchy of interfaces to check if that overflows the LinearAlloc - * with iftable entries. - */ -public class Main { - interface A1 {} - interface A2 {} - interface A3 {} - interface A4 {} - interface A5 {} - - interface B1 extends A1, A2, A3, A4, A5 {} - interface B2 extends A1, A2, A3, A4, A5 {} - interface B3 extends A1, A2, A3, A4, A5 {} - interface B4 extends A1, A2, A3, A4, A5 {} - interface B5 extends A1, A2, A3, A4, A5 {} - - interface C1 extends B1, B2, B3, B4, B5 {} - interface C2 extends B1, B2, B3, B4, B5 {} - interface C3 extends B1, B2, B3, B4, B5 {} - interface C4 extends B1, B2, B3, B4, B5 {} - interface C5 extends B1, B2, B3, B4, B5 {} - - interface D1 extends C1, C2, C3, C4, C5 {} - interface D2 extends C1, C2, C3, C4, C5 {} - interface D3 extends C1, C2, C3, C4, C5 {} - interface D4 extends C1, C2, C3, C4, C5 {} - interface D5 extends C1, C2, C3, C4, C5 {} - - interface E1 extends D1, D2, D3, D4, D5 {} - interface E2 extends D1, D2, D3, D4, D5 {} - interface E3 extends D1, D2, D3, D4, D5 {} - interface E4 extends D1, D2, D3, D4, D5 {} - interface E5 extends D1, D2, D3, D4, D5 {} - - interface F1 extends E1, E2, E3, E4, E5 {} - interface F2 extends E1, E2, E3, E4, E5 {} - interface F3 extends E1, E2, E3, E4, E5 {} - interface F4 extends E1, E2, E3, E4, E5 {} - interface F5 extends E1, E2, E3, E4, E5 {} - - interface G1 extends F1, F2, F3, F4, F5 {} - interface G2 extends F1, F2, F3, F4, F5 {} - interface G3 extends F1, F2, F3, F4, F5 {} - interface G4 extends F1, F2, F3, F4, F5 {} - interface G5 extends F1, F2, F3, F4, F5 {} - - interface H1 extends G1, G2, G3, G4, G5 {} - interface H2 extends G1, G2, G3, G4, G5 {} - interface H3 extends G1, G2, G3, G4, G5 {} - interface H4 extends G1, G2, G3, G4, G5 {} - interface H5 extends G1, G2, G3, G4, G5 {} - - interface Z extends H1, H2, H3, H4, H5 {} - - public static void main(String[] args) { - Z instance = new Z() {}; - System.out.println("A new instance of Z was created successfully"); - } -} diff --git a/tests/092-locale/expected.txt b/tests/092-locale/expected.txt deleted file mode 100644 index 0a955e729..000000000 --- a/tests/092-locale/expected.txt +++ /dev/null @@ -1,12 +0,0 @@ -USA(GMT): Sunday, January 1, 2012 -USA: first=1, name=Sunday -France(GMT): Monday, January 2, 2012 -France: first=2, name=lundi -USA dfs: [AM, PM] -en_US: USD $2 -jp_JP: JPY ¥0 -Normalizer passed -loc: en_US - iso3=eng -loc: eng_USA - iso3=eng diff --git a/tests/092-locale/info.txt b/tests/092-locale/info.txt deleted file mode 100644 index e3c3a98a5..000000000 --- a/tests/092-locale/info.txt +++ /dev/null @@ -1 +0,0 @@ -Exercise some locale-specific classes. diff --git a/tests/092-locale/src/Main.java b/tests/092-locale/src/Main.java deleted file mode 100644 index 8916a29c4..000000000 --- a/tests/092-locale/src/Main.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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. - */ - -import java.text.DateFormat; -import java.text.DateFormatSymbols; -import java.text.Normalizer; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Currency; -import java.util.Date; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.TimeZone; - -/** - * Exercise some locale-table-driven stuff. - */ -public class Main { - - public static void main(String[] args) { - try { - testCalendar(); - } catch (Exception ex) { - ex.printStackTrace(); - } - - try { - testDateFormatSymbols(); - } catch (Exception ex) { - ex.printStackTrace(); - } - - try { - testCurrency(); - } catch (Exception ex) { - ex.printStackTrace(); - } - - try { - testNormalizer(); - } catch (Exception ex) { - ex.printStackTrace(); - } - - try { - testIso3(); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - static void testCalendar() { - TimeZone tz = TimeZone.getTimeZone("GMT"); - - Locale usa = new Locale("en", "US"); - Calendar usaCal = Calendar.getInstance(tz, usa); - usaCal.clear(); // don't want current date/time - usaCal.set(2012, Calendar.JANUARY, 1); - - Date when = usaCal.getTime(); - DateFormat fmt = DateFormat.getDateInstance(DateFormat.FULL, usa); - fmt.setTimeZone(tz); // defaults to local TZ; force GMT - System.out.println("USA(" + fmt.getTimeZone().getID() + "): " - + fmt.format(when)); - - System.out.println("USA: first=" - + usaCal.getFirstDayOfWeek() + ", name=" - + usaCal.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, usa)); - - - Locale france = new Locale("fr", "FR"); - Calendar franceCal = Calendar.getInstance(tz, france); - franceCal.clear(); - franceCal.set(2012, Calendar.JANUARY, 2); - - when = franceCal.getTime(); - fmt = DateFormat.getDateInstance(DateFormat.FULL, usa); - fmt.setTimeZone(tz); // defaults to local TZ; force GMT - System.out.println("France(" + fmt.getTimeZone().getID() + "): " - + fmt.format(when)); - - System.out.println("France: first=" - + franceCal.getFirstDayOfWeek() + ", name=" - + franceCal.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, france)); - } - - static void testDateFormatSymbols() { - Locale usa = new Locale("en", "US"); - DateFormatSymbols syms = DateFormatSymbols.getInstance(usa); - String[] list = syms.getAmPmStrings(); - System.out.println("USA dfs: " + Arrays.deepToString(list)); - } - - static void testCurrency() { - Locale usa = new Locale("en", "US"); - Currency dollars = Currency.getInstance(usa); - - System.out.println(usa.toString() + ": " + dollars.toString() - + " " + dollars.getSymbol() + dollars.getDefaultFractionDigits()); - - Locale japan = new Locale("jp", "JP"); - Currency yen = Currency.getInstance(japan); - - System.out.println(japan.toString() + ": " + yen.toString() - + " " + yen.getSymbol() + yen.getDefaultFractionDigits()); - } - - static void testNormalizer() { - String composed = "Bl\u00c1ah"; - String decomposed = "Bl\u0041\u0301ah"; - String res; - - res = Normalizer.normalize(composed, Normalizer.Form.NFD); - if (!decomposed.equals(res)) { - System.err.println("Bad decompose: '" + composed + "' --> '" - + res + "'"); - } - - res = Normalizer.normalize(decomposed, Normalizer.Form.NFC); - if (!composed.equals(res)) { - System.err.println("Bad compose: '" + decomposed + "' --> '" - + res + "'"); - } - - System.out.println("Normalizer passed"); - } - - /* - * Test that we can set and get an ISO3 language code. Support for this - * is expected by the Android framework. - */ - static void testIso3() { - Locale loc; - loc = new Locale("en", "US"); - System.out.println("loc: " + loc); - System.out.println(" iso3=" + loc.getISO3Language()); - - loc = new Locale("eng", "USA"); - System.out.println("loc: " + loc); - try { - System.out.println(" iso3=" + loc.getISO3Language()); - } catch (MissingResourceException mre) { - System.err.println("couldn't get iso3 language"); - } - } -} diff --git a/tests/093-serialization/expected.txt b/tests/093-serialization/expected.txt deleted file mode 100644 index 60c64f8e9..000000000 --- a/tests/093-serialization/expected.txt +++ /dev/null @@ -1 +0,0 @@ -one=true two=2 three=three four=4.0 five=5.0 six=6 seven=7 eight=8 nine=9 thing=X diff --git a/tests/093-serialization/info.txt b/tests/093-serialization/info.txt deleted file mode 100644 index effe3d8bf..000000000 --- a/tests/093-serialization/info.txt +++ /dev/null @@ -1 +0,0 @@ -Tests object serialization. diff --git a/tests/093-serialization/src/Main.java b/tests/093-serialization/src/Main.java deleted file mode 100644 index ca3dc9fd0..000000000 --- a/tests/093-serialization/src/Main.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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. - */ - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; - -/** - * Exercise serialization. - */ -public class Main { - - public static void main(String[] args) { - testObjectSerialization(); - } - - static void testObjectSerialization() { - byte[] serialData; - - try { - serialData = createStream(); - checkStream(serialData); - } catch (IOException ioe) { - throw new RuntimeException(ioe); - } - } - - static byte[] createStream() throws IOException { - ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); - ObjectOutputStream objStream = new ObjectOutputStream(byteStream); - - Sub sub = new Sub('X'); - objStream.writeObject(sub); - byte[] bytes = byteStream.toByteArray(); - - objStream.close(); - byteStream.close(); - return bytes; - } - - static void checkStream(byte[] input) throws IOException { - ByteArrayInputStream byteStream = new ByteArrayInputStream(input); - ObjectInputStream objStream = new ObjectInputStream(byteStream); - - Sub sub; - try { - sub = (Sub) objStream.readObject(); - } catch (ClassNotFoundException cnfe) { - throw new RuntimeException(cnfe); - } - - objStream.close(); - byteStream.close(); - - sub.check(); - } -} - -class Base implements Serializable { - private static final long serialVersionUID = 12345; - - Boolean one; - Integer two; - String three; - - public Base() { - one = true; - two = Integer.valueOf(2); - three = "three"; - } -} - -class Sub extends Base { - private static final long serialVersionUID = 54321; - - Double four; - Float five; - private Byte six = 26; - Character seven = '7'; - Short eight; - long nine; - public Character thing; - - public Sub(char thing) { - four = 4.0; - five = 5.0f; - six = 6; - eight = 8; - nine = 9; - this.thing = thing; - } - - public void check() { - System.out.println("one=" + one + " two=" + two + " three=" + three - + " four=" + four + " five=" + five + " six=" + six - + " seven=" + seven + " eight=" + eight + " nine=" + nine - + " thing=" + thing); - } -} - diff --git a/tests/094-pattern/expected.txt b/tests/094-pattern/expected.txt deleted file mode 100644 index 4af0c66dd..000000000 --- a/tests/094-pattern/expected.txt +++ /dev/null @@ -1,3 +0,0 @@ -str1 matches: true -str2 matches: false -str3 matches: true diff --git a/tests/094-pattern/info.txt b/tests/094-pattern/info.txt deleted file mode 100644 index c1ade3336..000000000 --- a/tests/094-pattern/info.txt +++ /dev/null @@ -1,4 +0,0 @@ -A simple test to exercise pattern matching. - -The test may throw a StackOverflowError if the stack size is too small. With -some regex libs, -Xss65k is the minimum allowable size. diff --git a/tests/094-pattern/src/Main.java b/tests/094-pattern/src/Main.java deleted file mode 100644 index 4d7e1a316..000000000 --- a/tests/094-pattern/src/Main.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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. - */ - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class Main { - // from android.util.Patterns - public static final String GOOD_IRI_CHAR = - "a-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF"; - - public static final String TOP_LEVEL_DOMAIN_STR_FOR_WEB_URL = - "(?:" - + "(?:aero|arpa|asia|a[cdefgilmnoqrstuwxz])" - + "|(?:biz|b[abdefghijmnorstvwyz])" - + "|(?:cat|com|coop|c[acdfghiklmnoruvxyz])" - + "|d[ejkmoz]" - + "|(?:edu|e[cegrstu])" - + "|f[ijkmor]" - + "|(?:gov|g[abdefghilmnpqrstuwy])" - + "|h[kmnrtu]" - + "|(?:info|int|i[delmnoqrst])" - + "|(?:jobs|j[emop])" - + "|k[eghimnprwyz]" - + "|l[abcikrstuvy]" - + "|(?:mil|mobi|museum|m[acdeghklmnopqrstuvwxyz])" - + "|(?:name|net|n[acefgilopruz])" - + "|(?:org|om)" - + "|(?:pro|p[aefghklmnrstwy])" - + "|qa" - + "|r[eosuw]" - + "|s[abcdeghijklmnortuvyz]" - + "|(?:tel|travel|t[cdfghjklmnoprtvwz])" - + "|u[agksyz]" - + "|v[aceginu]" - + "|w[fs]" - + "|(?:\u03b4\u03bf\u03ba\u03b9\u03bc\u03ae|\u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435|\u0440\u0444|\u0441\u0440\u0431|\u05d8\u05e2\u05e1\u05d8|\u0622\u0632\u0645\u0627\u06cc\u0634\u06cc|\u0625\u062e\u062a\u0628\u0627\u0631|\u0627\u0644\u0627\u0631\u062f\u0646|\u0627\u0644\u062c\u0632\u0627\u0626\u0631|\u0627\u0644\u0633\u0639\u0648\u062f\u064a\u0629|\u0627\u0644\u0645\u063a\u0631\u0628|\u0627\u0645\u0627\u0631\u0627\u062a|\u0628\u06be\u0627\u0631\u062a|\u062a\u0648\u0646\u0633|\u0633\u0648\u0631\u064a\u0629|\u0641\u0644\u0633\u0637\u064a\u0646|\u0642\u0637\u0631|\u0645\u0635\u0631|\u092a\u0930\u0940\u0915\u094d\u0937\u093e|\u092d\u093e\u0930\u0924|\u09ad\u09be\u09b0\u09a4|\u0a2d\u0a3e\u0a30\u0a24|\u0aad\u0abe\u0ab0\u0aa4|\u0b87\u0ba8\u0bcd\u0ba4\u0bbf\u0baf\u0bbe|\u0b87\u0bb2\u0b99\u0bcd\u0b95\u0bc8|\u0b9a\u0bbf\u0b99\u0bcd\u0b95\u0baa\u0bcd\u0baa\u0bc2\u0bb0\u0bcd|\u0baa\u0bb0\u0bbf\u0b9f\u0bcd\u0b9a\u0bc8|\u0c2d\u0c3e\u0c30\u0c24\u0c4d|\u0dbd\u0d82\u0d9a\u0dcf|\u0e44\u0e17\u0e22|\u30c6\u30b9\u30c8|\u4e2d\u56fd|\u4e2d\u570b|\u53f0\u6e7e|\u53f0\u7063|\u65b0\u52a0\u5761|\u6d4b\u8bd5|\u6e2c\u8a66|\u9999\u6e2f|\ud14c\uc2a4\ud2b8|\ud55c\uad6d|xn\\-\\-0zwm56d|xn\\-\\-11b5bs3a9aj6g|xn\\-\\-3e0b707e|xn\\-\\-45brj9c|xn\\-\\-80akhbyknj4f|xn\\-\\-90a3ac|xn\\-\\-9t4b11yi5a|xn\\-\\-clchc0ea0b2g2a9gcd|xn\\-\\-deba0ad|xn\\-\\-fiqs8s|xn\\-\\-fiqz9s|xn\\-\\-fpcrj9c3d|xn\\-\\-fzc2c9e2c|xn\\-\\-g6w251d|xn\\-\\-gecrj9c|xn\\-\\-h2brj9c|xn\\-\\-hgbk6aj7f53bba|xn\\-\\-hlcj6aya9esc7a|xn\\-\\-j6w193g|xn\\-\\-jxalpdlp|xn\\-\\-kgbechtv|xn\\-\\-kprw13d|xn\\-\\-kpry57d|xn\\-\\-lgbbat1ad8j|xn\\-\\-mgbaam7a8h|xn\\-\\-mgbayh7gpa|xn\\-\\-mgbbh1a71e|xn\\-\\-mgbc0a9azcg|xn\\-\\-mgberp4a5d4ar|xn\\-\\-o3cw4h|xn\\-\\-ogbpf8fl|xn\\-\\-p1ai|xn\\-\\-pgbs0dh|xn\\-\\-s9brj9c|xn\\-\\-wgbh1c|xn\\-\\-wgbl6a|xn\\-\\-xkc2al3hye2a|xn\\-\\-xkc2dl3a5ee0h|xn\\-\\-yfro4i67o|xn\\-\\-ygbi2ammx|xn\\-\\-zckzah|xxx)" - + "|y[et]" - + "|z[amw]))"; - - public static final String WEB_URL_STR = - "((?:(http|https|Http|Https|rtsp|Rtsp):\\/\\/(?:(?:[a-zA-Z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)" - + "\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,64}(?:\\:(?:[a-zA-Z0-9\\$\\-\\_" - + "\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,25})?\\@)?)?" - + "((?:(?:[" + GOOD_IRI_CHAR + "][" + GOOD_IRI_CHAR + "\\-]{0,64}\\.)+" // named host - + TOP_LEVEL_DOMAIN_STR_FOR_WEB_URL - + "|(?:(?:25[0-5]|2[0-4]" // or ip address - + "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(?:25[0-5]|2[0-4][0-9]" - + "|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1]" - + "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}" - + "|[1-9][0-9]|[0-9])))" - + "(?:\\:\\d{1,5})?)" // plus option port number - + "(\\/(?:(?:[" + GOOD_IRI_CHAR + "\\;\\/\\?\\:\\@\\&\\=\\#\\~" // plus option query params - + "\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])|(?:\\%[a-fA-F0-9]{2}))*)?" - + "(?:\\b|$)"; // and finally, a word boundary or end of - // input. This is to stop foo.sure from - // matching as foo.su - - public static final Pattern WEB_URL = Pattern.compile(WEB_URL_STR); - - public static final String testStr1 = - "http://www.google.com/blah?client=tablet-android&source=android-home"; - public static final String testStr2 = "http:///www.google.com/"; - public static final String testStr3 = - "http://www.google.com/search?hl=en&redir_esc=&client=tablet-android-verizon&source=android-browser-type&v=141000000&qsubts=1327020479959&action=devloc&q=cnn"; - - public static void main(String[] args) { - System.out.println("str1 matches: " + WEB_URL.matcher(testStr1).matches()); - System.out.println("str2 matches: " + WEB_URL.matcher(testStr2).matches()); - System.out.println("str3 matches: " + WEB_URL.matcher(testStr3).matches()); - } - - static String getStringAsHex(String text) { - StringBuilder sb = new StringBuilder(text.length() * 4); - - for (int i = 0; i < text.length(); i++) { - sb.append(Integer.toHexString((int) text.charAt(i))); - } - - return sb.toString(); - } -} diff --git a/tests/095-switch-MAX_INT/expected.txt b/tests/095-switch-MAX_INT/expected.txt deleted file mode 100644 index 12799ccbe..000000000 --- a/tests/095-switch-MAX_INT/expected.txt +++ /dev/null @@ -1 +0,0 @@ -good diff --git a/tests/095-switch-MAX_INT/info.txt b/tests/095-switch-MAX_INT/info.txt deleted file mode 100644 index bb901dbf4..000000000 --- a/tests/095-switch-MAX_INT/info.txt +++ /dev/null @@ -1 +0,0 @@ -Bug: http://code.google.com/p/android/issues/detail?id=22344 diff --git a/tests/095-switch-MAX_INT/src/Main.java b/tests/095-switch-MAX_INT/src/Main.java deleted file mode 100644 index d1171ea6b..000000000 --- a/tests/095-switch-MAX_INT/src/Main.java +++ /dev/null @@ -1,11 +0,0 @@ -public class Main { - static public void main(String[] args) throws Exception { - switch (0x7fffffff) { - case 0x7fffffff: - System.err.println("good"); - break; - default: - throw new AssertionError(); - } - } -} diff --git a/tests/096-array-copy-concurrent-gc/expected.txt b/tests/096-array-copy-concurrent-gc/expected.txt deleted file mode 100644 index 23b9dab6b..000000000 --- a/tests/096-array-copy-concurrent-gc/expected.txt +++ /dev/null @@ -1,3 +0,0 @@ -Initializing... -Starting the test -Test OK diff --git a/tests/096-array-copy-concurrent-gc/info.txt b/tests/096-array-copy-concurrent-gc/info.txt deleted file mode 100644 index 37dd8be9b..000000000 --- a/tests/096-array-copy-concurrent-gc/info.txt +++ /dev/null @@ -1,2 +0,0 @@ -This is a test to verify that System.arraycopy works nice together with -the concurrent gc. diff --git a/tests/096-array-copy-concurrent-gc/src/Main.java b/tests/096-array-copy-concurrent-gc/src/Main.java deleted file mode 100644 index c8e538b5e..000000000 --- a/tests/096-array-copy-concurrent-gc/src/Main.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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. - */ - -/** - * Running concurrent gc and doing some System.arraycopy - * Several threads is created in order to increase the probability - * of thread switches at critical points. Without creating several - * threads the test case usually passed even when there were bugs. - * Size of array and amount of garbage created is based on experimental - * numbers and is a tradeoff between time that the test takes when - * it succeeds and the probability that the test discovers a problem. - */ -public class Main { - public static void main(String args[]) { - new ObjectCreatorThread(true).start(); - new ObjectCreatorThread(false).start(); - new ObjectCreatorThread(false).start(); - } - - static class ObjectCreatorThread extends Thread { - boolean mDoLog; - public ObjectCreatorThread(boolean doLog) { - mDoLog = doLog; - } - - @Override - public void run() { - new Main().stressArray(mDoLog); - } - } - - Object [] array = new Object[10000]; - - void stressArray(boolean doLog) { - // We want many references in the array - // We also want elements close to each other to have large - // diff in address so lets skip every 2:nd address so it is null - if (doLog) { - System.out.println("Initializing..."); - } - for (int i = 0; i < array.length; i+=2) { - array[i] = new String("Creating some garbage" + i); - } - - if (doLog) { - System.out.println("Starting the test"); - } - - for (int j = 0; j < array.length; j++) { - Object obj = array[array.length - 1]; - System.arraycopy(array, 0, array, 1, array.length - 1); - array[0] = obj; - new String("Creating some garbage" + Math.random()); - new String("Creating some garbage" + Math.random()); - new String("Creating some garbage" + Math.random()); - new String("Creating some garbage" + Math.random()); - } - - for (int j = 0; j < array.length; j++) { - Object obj = array[0]; - System.arraycopy(array, 1, array, 0, array.length - 1); - array[array.length - 1] = obj; - new String("Creating some garbage" + Math.random()); - new String("Creating some garbage" + Math.random()); - new String("Creating some garbage" + Math.random()); - new String("Creating some garbage" + Math.random()); - } - - if (doLog) { - System.out.println("Test OK"); - } - } -} diff --git a/tests/097-suspend-check/expected.txt b/tests/097-suspend-check/expected.txt deleted file mode 100644 index 07cc8253d..000000000 --- a/tests/097-suspend-check/expected.txt +++ /dev/null @@ -1,7 +0,0 @@ -Running (5 seconds) ... -. -. -. -. -. -Done. diff --git a/tests/097-suspend-check/info.txt b/tests/097-suspend-check/info.txt deleted file mode 100644 index d89d66aed..000000000 --- a/tests/097-suspend-check/info.txt +++ /dev/null @@ -1,2 +0,0 @@ -To support garbage collection, debugging and profiling the VM must be able to send all threads -to a safepoint. This tests the ability of the VM to do this for a tight loop. diff --git a/tests/097-suspend-check/src/Main.java b/tests/097-suspend-check/src/Main.java deleted file mode 100644 index d92b9e507..000000000 --- a/tests/097-suspend-check/src/Main.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -public class Main { - private static final int TEST_TIME = 5; - - public static void main(String[] args) { - System.out.println("Running (" + TEST_TIME + " seconds) ..."); - InfiniteForLoop forLoop = new InfiniteForLoop(); - InfiniteWhileLoop whileLoop = new InfiniteWhileLoop(); - InfiniteDoWhileLoop doWhileLoop = new InfiniteDoWhileLoop(); - MakeGarbage garbage = new MakeGarbage(); - forLoop.start(); - whileLoop.start(); - doWhileLoop.start(); - garbage.start(); - for (int i = 0; i < TEST_TIME; i++) { - System.gc(); - System.out.println("."); - sleep(1000); - } - forLoop.stopNow(); - whileLoop.stopNow(); - doWhileLoop.stopNow(); - garbage.stopNow(); - System.out.println("Done."); - } - - public static void sleep(int ms) { - try { - Thread.sleep(ms); - } catch (InterruptedException ie) { - System.err.println("sleep was interrupted"); - } - } -} - -class InfiniteWhileLoop extends Thread { - volatile private boolean keepGoing = true; - public void run() { - int i = 0; - while (keepGoing) { - i++; - } - } - public void stopNow() { - keepGoing = false; - } -} - -class InfiniteDoWhileLoop extends Thread { - volatile private boolean keepGoing = true; - public void run() { - int i = 0; - do { - i++; - } while (keepGoing); - } - public void stopNow() { - keepGoing = false; - } -} - -class InfiniteForLoop extends Thread { - int count = 100000; - volatile private boolean keepGoing = true; - public void run() { - int i = 0; - for (int j = 0; keepGoing; j++) { - i += j; - } - } - public void stopNow() { - keepGoing = false; - } -} - - -class MakeGarbage extends Thread { - volatile private boolean keepGoing = true; - public void run() { - while (keepGoing) { - byte[] garbage = new byte[100000]; - } - } - public void stopNow() { - keepGoing = false; - } -} diff --git a/tests/098-native-allocations/expected.txt b/tests/098-native-allocations/expected.txt deleted file mode 100644 index f75da10ca..000000000 --- a/tests/098-native-allocations/expected.txt +++ /dev/null @@ -1 +0,0 @@ -Test complete diff --git a/tests/098-native-allocations/info.txt b/tests/098-native-allocations/info.txt deleted file mode 100644 index 2e5b88ac6..000000000 --- a/tests/098-native-allocations/info.txt +++ /dev/null @@ -1,2 +0,0 @@ -This is a test to verify that native allocation successfully runs -finalizers and prevents OOM. diff --git a/tests/098-native-allocations/src/Main.java b/tests/098-native-allocations/src/Main.java deleted file mode 100644 index 87179b54e..000000000 --- a/tests/098-native-allocations/src/Main.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2013 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.*; - -class Main { - static Object nativeLock = new Object(); - static int nativeBytes = 0; - static Object runtime; - static Method register_native_allocation; - static Method register_native_free; - static int maxMem = 64 * 1024 * 1024; - - static class NativeAllocation { - private int bytes; - - NativeAllocation(int bytes) throws Exception { - this.bytes = bytes; - register_native_allocation.invoke(runtime, bytes); - synchronized (nativeLock) { - nativeBytes += bytes; - if (nativeBytes > maxMem) { - throw new OutOfMemoryError(); - } - } - } - - protected void finalize() throws Exception { - synchronized (nativeLock) { - nativeBytes -= bytes; - } - register_native_free.invoke(runtime, bytes); - } - } - - public static void main(String[] args) throws Exception { - Class<?> vm_runtime = Class.forName("dalvik.system.VMRuntime"); - Method get_runtime = vm_runtime.getDeclaredMethod("getRuntime"); - runtime = get_runtime.invoke(null); - register_native_allocation = vm_runtime.getDeclaredMethod("registerNativeAllocation", Integer.TYPE); - register_native_free = vm_runtime.getDeclaredMethod("registerNativeFree", Integer.TYPE); - int count = 16; - int size = 512 * 0x400; - int allocation_count = 256; - NativeAllocation[] allocations = new NativeAllocation[count]; - for (int i = 0; i < allocation_count; ++i) { - allocations[i % count] = new NativeAllocation(size); - } - System.out.println("Test complete"); - } -} - diff --git a/tests/300-package-override/expected.txt b/tests/300-package-override/expected.txt deleted file mode 100644 index b0aad4deb..000000000 --- a/tests/300-package-override/expected.txt +++ /dev/null @@ -1 +0,0 @@ -passed diff --git a/tests/300-package-override/info.txt b/tests/300-package-override/info.txt deleted file mode 100644 index 0ed59eb0f..000000000 --- a/tests/300-package-override/info.txt +++ /dev/null @@ -1,2 +0,0 @@ -Tests a dalvik bug where we'd allow subclasses to override package-protected -methods.
\ No newline at end of file diff --git a/tests/300-package-override/src/Main.java b/tests/300-package-override/src/Main.java deleted file mode 100644 index ad7eaaf5b..000000000 --- a/tests/300-package-override/src/Main.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ - -public class Main { - public static void main(String args[]) throws Exception { - p1.BaseClass c = new p2.DerivedClass(); - c.run(); - } -} diff --git a/tests/300-package-override/src/p1/BaseClass.java b/tests/300-package-override/src/p1/BaseClass.java deleted file mode 100644 index 1c048ac8f..000000000 --- a/tests/300-package-override/src/p1/BaseClass.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ - -package p1; - -public class BaseClass { - public void run() { foo(); } - void foo() { System.out.println("passed"); } // It should not be possible to override this. -} diff --git a/tests/300-package-override/src/p2/DerivedClass.java b/tests/300-package-override/src/p2/DerivedClass.java deleted file mode 100644 index 860f50ccd..000000000 --- a/tests/300-package-override/src/p2/DerivedClass.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ - -package p2; - -public class DerivedClass extends p1.BaseClass { - void foo() { System.out.println("DerivedClass overrode package-private method!"); } // This should not override BaseClass.foo. -} diff --git a/tests/301-abstract-protected/expected.txt b/tests/301-abstract-protected/expected.txt deleted file mode 100644 index b0aad4deb..000000000 --- a/tests/301-abstract-protected/expected.txt +++ /dev/null @@ -1 +0,0 @@ -passed diff --git a/tests/301-abstract-protected/info.txt b/tests/301-abstract-protected/info.txt deleted file mode 100644 index 0751eff5a..000000000 --- a/tests/301-abstract-protected/info.txt +++ /dev/null @@ -1,3 +0,0 @@ -Tests a dalvik bug where we'd treat an abstract method as an implementation -of an interface method; the RI only cares about the visibility of the actual -implementation in non-abstract subclasses. diff --git a/tests/302-float-conversion/expected.txt b/tests/302-float-conversion/expected.txt deleted file mode 100644 index 6939a5ccc..000000000 --- a/tests/302-float-conversion/expected.txt +++ /dev/null @@ -1 +0,0 @@ -Result is as expected diff --git a/tests/302-float-conversion/info.txt b/tests/302-float-conversion/info.txt deleted file mode 100644 index 2b8bc2174..000000000 --- a/tests/302-float-conversion/info.txt +++ /dev/null @@ -1,4 +0,0 @@ -Tests whether constant conversions of double values to long values are -properly handled by the VM. For example, x86 systems using the x87 stack - should not overflow under constant conversions. - diff --git a/tests/302-float-conversion/src/Main.java b/tests/302-float-conversion/src/Main.java deleted file mode 100644 index dc512c5dc..000000000 --- a/tests/302-float-conversion/src/Main.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -public class Main { - static final long NUM_ITERATIONS = 50000; - static volatile double negInfinity = Double.NEGATIVE_INFINITY; - - public static void main(String args[]) { - - long sumInf = 0; - long sumRes = 0; - - for (long i = 0 ; i < NUM_ITERATIONS ; i++) { - //Every second iteration, sumInf becomes 0 - sumInf += (long) negInfinity; - - //Some extra work for compilers to make this - //loop seem important - if (sumInf == Long.MIN_VALUE) { - sumRes++; - } - } - - if (sumRes == NUM_ITERATIONS / 2) { - System.out.println("Result is as expected"); - } else { - System.out.println("Conversions failed over " + NUM_ITERATIONS + " iterations"); - } - } -} diff --git a/tests/README.txt b/tests/README.txt deleted file mode 100644 index eb1ce36f5..000000000 --- a/tests/README.txt +++ /dev/null @@ -1,13 +0,0 @@ -VM test harness. - -Use "./run-all-tests" to run all tests, or "./run-test <number>" to run a -single test. Run "./run-test" with no arguments to see command flags; -in particular, the tests can be run on the desktop, on a USB-attached -device, or using the desktop "reference implementation". - - -For most tests, the sources are in the "src" subdirectory. Sources found -in the "src2" directory are compiled separately but to the same output -directory; this can be used to exercise "API mismatch" situations by -replacing class files created in the first pass. The "src-ex" directory -is built separately, and is intended for exercising class loaders. diff --git a/tests/etc/default-build b/tests/etc/default-build deleted file mode 100755 index b8df44298..000000000 --- a/tests/etc/default-build +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2008 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. - -# Stop if something fails. -set -e - -mkdir classes -${JAVAC} -d classes `find src -name '*.java'` - -if [ -r src2 ]; then - ${JAVAC} -d classes `find src2 -name '*.java'` -fi - -dx -JXmx256m --debug --dex --dump-to=classes.lst --output=classes.dex \ - --dump-width=1000 classes -zip test.jar classes.dex - -if [ -r src-ex ]; then - mkdir classes-ex - ${JAVAC} -d classes-ex -cp classes `find src-ex -name '*.java'` - dx -JXmx256m --debug --dex --dump-to=classes-ex.lst \ - --output=classes-ex.dex --dump-width=1000 classes-ex - - # quick shuffle so that the stored name is "classes.dex" - mv classes.dex classes-1.dex - mv classes-ex.dex classes.dex - zip test-ex.jar classes.dex - mv classes.dex classes-ex.dex - mv classes-1.dex classes.dex -fi diff --git a/tests/etc/default-run b/tests/etc/default-run deleted file mode 100755 index ecbbbc7c4..000000000 --- a/tests/etc/default-run +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2008 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. - -exec ${RUN} "$@" diff --git a/tests/etc/host-run-test-jar b/tests/etc/host-run-test-jar deleted file mode 100755 index addac3192..000000000 --- a/tests/etc/host-run-test-jar +++ /dev/null @@ -1,159 +0,0 @@ -#!/bin/sh -# -# Run the code in test.jar using the host-mode virtual machine. The jar should -# contain a top-level class named Main to run. -# -# Options: -# --quiet -- don't chatter -# --fast -- use the fast interpreter (the default) -# --jit -- use the jit -# --portable -- use the portable interpreter -# --debug -- wait for debugger to attach -# --valgrind -- use valgrind -# --no-verify -- turn off verification (on by default) -# --no-optimize -- turn off optimization (on by default) - -msg() { - if [ "$QUIET" = "n" ]; then - echo "$@" - fi -} - -INTERP="" -DEBUG="n" -GDB="n" -VERIFY="y" -OPTIMIZE="y" -VALGRIND="n" -DEV_MODE="n" -QUIET="n" -PRECISE="y" - -while true; do - if [ "x$1" = "x--quiet" ]; then - QUIET="y" - shift - elif [ "x$1" = "x--jit" ]; then - INTERP="jit" - msg "Using jit" - shift - elif [ "x$1" = "x--fast" ]; then - INTERP="fast" - msg "Using fast interpreter" - shift - elif [ "x$1" = "x--portable" ]; then - INTERP="portable" - msg "Using portable interpreter" - shift - elif [ "x$1" = "x--debug" ]; then - DEBUG="y" - shift - elif [ "x$1" = "x--gdb" ]; then - GDB="y" - shift - elif [ "x$1" = "x--valgrind" ]; then - VALGRIND="y" - shift - elif [ "x$1" = "x--dev" ]; then - DEV_MODE="y" - shift - elif [ "x$1" = "x--no-verify" ]; then - VERIFY="n" - shift - elif [ "x$1" = "x--no-optimize" ]; then - OPTIMIZE="n" - shift - elif [ "x$1" = "x--no-precise" ]; then - PRECISE="n" - shift - elif [ "x$1" = "x--" ]; then - shift - break - elif expr "x$1" : "x--" >/dev/null 2>&1; then - echo "unknown option: $1" 1>&2 - exit 1 - else - break - fi -done - -if [ "x$INTERP" = "x" ]; then - INTERP="jit" - msg "Using jit by default" -fi - -if [ "$OPTIMIZE" = "y" ]; then - if [ "$VERIFY" = "y" ]; then - DEX_OPTIMIZE="-Xdexopt:verified" - else - DEX_OPTIMIZE="-Xdexopt:all" - fi - msg "Performing optimizations" -else - DEX_OPTIMIZE="-Xdexopt:none" - msg "Skipping optimizations" -fi - -if [ "$VERIFY" = "y" ]; then - DEX_VERIFY="" - msg "Performing verification" -else - DEX_VERIFY="-Xverify:none" - msg "Skipping verification" -fi - -if [ "$VALGRIND" = "y" ]; then - msg "Running with valgrind" - valgrind_cmd="valgrind" - #valgrind_cmd="valgrind --leak-check=full" -else - valgrind_cmd="" -fi - -if [ "$PRECISE" = "y" ]; then - GC_OPTS="-Xgc:precise -Xgenregmap" -else - GC_OPTS="-Xgc:noprecise" -fi - -msg "------------------------------" - -HOSTBASE="${ANDROID_BUILD_TOP}/out/host" -BASE="$OUT" # from build environment -DATA_DIR=/tmp -DEBUG_OPTS="-Xcheck:jni -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n" - -if [ ! -d $DATA_DIR/dalvik-cache ]; then - mkdir -p $DATA_DIR/dalvik-cache - [[ $? -ne 0 ]] && exit -fi - -export ANDROID_PRINTF_LOG=brief -if [ "$DEV_MODE" = "y" ]; then - export ANDROID_LOG_TAGS='*:d' -else - export ANDROID_LOG_TAGS='*:s' -fi -export ANDROID_DATA="$DATA_DIR" -export ANDROID_ROOT="${HOSTBASE}/linux-x86" -export LD_LIBRARY_PATH="${ANDROID_ROOT}/lib" -export DYLD_LIBRARY_PATH="${ANDROID_ROOT}/lib" - -exe="${ANDROID_ROOT}/bin/dalvikvm" -framework="${BASE}/system/framework" -bpath="${framework}/core.jar:${framework}/conscrypt.jar:${framework}/ext.jar:${framework}/framework.jar" - -if [ "$DEBUG" = "y" ]; then - PORT=8000 - msg "Waiting for debugger to connect on localhost:$PORT" - DEX_DEBUG="-agentlib:jdwp=transport=dt_socket,addres=$PORT,server=y,suspend=y" -fi - -if [ "$GDB" = "y" ]; then - gdb=gdb - gdbargs="--args $exe" -fi - -$valgrind_cmd $gdb $exe $gdbargs "-Xbootclasspath:${bpath}" \ - $DEX_VERIFY $DEX_OPTIMIZE $DEX_DEBUG $GC_OPTS "-Xint:${INTERP}" -ea \ - -cp test.jar Main "$@" diff --git a/tests/etc/push-and-run-test-jar b/tests/etc/push-and-run-test-jar deleted file mode 100755 index 202821792..000000000 --- a/tests/etc/push-and-run-test-jar +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/sh -# -# Run the code in test.jar on the device. The jar should contain a top-level -# class named Main to run. -# -# Options: -# --quiet -- don't chatter -# --fast -- use the fast interpreter (the default) -# --jit -- use the jit -# --portable -- use the portable interpreter -# --debug -- wait for debugger to attach -# --dev -- development mode (print the vm invocation cmdline) -# --no-verify -- turn off verification (on by default) -# --no-optimize -- turn off optimization (on by default) -# --no-precise -- turn off precise GC (on by default) - -msg() { - if [ "$QUIET" = "n" ]; then - echo "$@" - fi -} - -INTERP="" -DEBUG="n" -VERIFY="y" -OPTIMIZE="y" -QUIET="n" -PRECISE="y" -DEV_MODE="n" - -while true; do - if [ "x$1" = "x--quiet" ]; then - QUIET="y" - shift - elif [ "x$1" = "x--fast" ]; then - INTERP="fast" - msg "Using fast interpreter" - shift - elif [ "x$1" = "x--jit" ]; then - INTERP="jit" - msg "Using jit" - shift - elif [ "x$1" = "x--portable" ]; then - INTERP="portable" - msg "Using portable interpreter" - shift - elif [ "x$1" = "x--debug" ]; then - DEBUG="y" - shift - elif [ "x$1" = "x--dev" ]; then - DEV_MODE="y" - shift - elif [ "x$1" = "x--no-verify" ]; then - VERIFY="n" - shift - elif [ "x$1" = "x--no-optimize" ]; then - OPTIMIZE="n" - shift - elif [ "x$1" = "x--no-precise" ]; then - PRECISE="n" - shift - elif [ "x$1" = "x--" ]; then - shift - break - elif expr "x$1" : "x--" >/dev/null 2>&1; then - echo "unknown option: $1" 1>&2 - exit 1 - else - break - fi -done - -if [ "x$INTERP" = "x" ]; then - INTERP="jit" - msg "Using jit by default" -fi - -if [ "$OPTIMIZE" = "y" ]; then - if [ "$VERIFY" = "y" ]; then - DEX_OPTIMIZE="-Xdexopt:verified" - else - DEX_OPTIMIZE="-Xdexopt:all" - fi - msg "Performing optimizations" -else - DEX_OPTIMIZE="-Xdexopt:none" - msg "Skipping optimizations" -fi - -if [ "$VERIFY" = "y" ]; then - DEX_VERIFY="" - msg "Performing verification" -else - DEX_VERIFY="-Xverify:none" - msg "Skipping verification" -fi - -msg "------------------------------" - -if [ "$QUIET" = "n" ]; then - adb push test.jar /data - adb push test-ex.jar /data -else - adb push test.jar /data >/dev/null 2>&1 - adb push test-ex.jar /data >/dev/null 2>&1 -fi - -if [ "$DEBUG" = "y" ]; then - DEX_DEBUG="-agentlib:jdwp=transport=dt_android_adb,server=y,suspend=y" -fi - -if [ "$PRECISE" = "y" ]; then - GC_OPTS="-Xgc:precise -Xgenregmap" -else - GC_OPTS="-Xgc:noprecise" -fi - -cmdline="cd /data; dalvikvm $DEX_VERIFY $DEX_OPTIMIZE $DEX_DEBUG \ - $GC_OPTS -cp test.jar -Xint:${INTERP} -ea Main" -if [ "$DEV_MODE" = "y" ]; then - echo $cmdline "$@" -fi -adb shell $cmdline "$@" diff --git a/tests/etc/reference-run-test-classes b/tests/etc/reference-run-test-classes deleted file mode 100755 index 94c805066..000000000 --- a/tests/etc/reference-run-test-classes +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -# -# Run the code in a classes directory on a host-local reference virtual -# machine. The jar should contain a top-level class named Main to run. -# -# Options: -# --quiet -- don't chatter -# --debug -- wait for debugger to attach -# --no-verify -- turn off verification (on by default) -# --dev -- development mode - -msg() { - if [ "$QUIET" = "n" ]; then - echo "$@" - fi -} - -DEBUG="n" -QUIET="n" -VERIFY="y" - -while true; do - if [ "x$1" = "x--quiet" ]; then - QUIET="y" - shift - elif [ "x$1" = "x--debug" ]; then - DEBUG="y" - shift - elif [ "x$1" = "x--no-verify" ]; then - VERIFY="n" - shift - elif [ "x$1" = "x--dev" ]; then - # not used; ignore - shift - elif [ "x$1" = "x--" ]; then - shift - break - elif expr "x$1" : "x--" >/dev/null 2>&1; then - echo "unknown option: $1" 1>&2 - exit 1 - else - break - fi -done - -if [ "$VERIFY" = "y" ]; then - VERIFY_ARG="-Xverify:all" - msg "Performing verification" -else - VERIFY_ARG="-Xverify:none" - msg "Skipping verification" -fi - -if [ "$DEBUG" = "y" ]; then - PORT=8000 - msg "Waiting for debugger to connect on localhost:$PORT" - DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,address=$PORT,server=y,suspend=y" -fi - -${JAVA} ${DEBUG_OPTS} -ea ${VERIFY_ARG} -classpath classes Main "$@" diff --git a/tests/run-all-tests b/tests/run-all-tests deleted file mode 100755 index f66cd767a..000000000 --- a/tests/run-all-tests +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2007 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. - -# Set up prog to be the path of this script, including following symlinks, -# and set up progdir to be the fully-qualified pathname of its directory. -prog="$0" -while [ -h "${prog}" ]; do - newProg=`/bin/ls -ld "${prog}"` - newProg=`expr "${newProg}" : ".* -> \(.*\)$"` - if expr "x${newProg}" : 'x/' >/dev/null; then - prog="${newProg}" - else - progdir=`dirname "${prog}"` - prog="${progdir}/${newProg}" - fi -done -oldwd=`pwd` -progdir=`dirname "${prog}"` -cd "${progdir}" -progdir=`pwd` -prog="${progdir}"/`basename "${prog}"` - -run_args="" -usage="no" - -while true; do - if [ "x$1" = "x--host" ]; then - run_args="${run_args} --host" - shift - elif [ "x$1" = "x--reference" ]; then - run_args="${run_args} --reference" - shift - elif [ "x$1" = "x--jit" ]; then - run_args="${run_args} --jit" - shift - elif [ "x$1" = "x--fast" ]; then - run_args="${run_args} --fast" - shift - elif [ "x$1" = "x--portable" ]; then - run_args="${run_args} --portable" - shift - elif [ "x$1" = "x--debug" ]; then - run_args="${run_args} --debug" - shift - elif [ "x$1" = "x--zygote" ]; then - run_args="${run_args} --zygote" - shift - elif [ "x$1" = "x--no-verify" ]; then - run_args="${run_args} --no-verify" - shift - elif [ "x$1" = "x--no-optimize" ]; then - run_args="${run_args} --no-optimize" - shift - elif [ "x$1" = "x--valgrind" ]; then - run_args="${run_args} --valgrind" - shift - elif [ "x$1" = "x--dev" ]; then - run_args="${run_args} --dev" - shift - elif [ "x$1" = "x--update" ]; then - run_args="${run_args} --update" - shift - elif [ "x$1" = "x--help" ]; then - usage="yes" - shift - elif expr "x$1" : "x--" >/dev/null 2>&1; then - echo "unknown option: $1" 1>&2 - usage="yes" - break - else - break - fi -done - -if [ "$usage" = "yes" ]; then - prog=`basename $prog` - ( - echo "usage:" - echo " $prog --help Print this message." - echo " $prog [options] Run all tests with the given options." - echo " Options are all passed to run-test; refer to that for " \ - "further documentation:" - echo " --debug --dev --fast --host --no-optimize --no-verify" \ - "--portable" - echo " --reference --update --valgrind --zygote" - ) 1>&2 - exit 1 -fi - -passed=0 -failed=0 -failNames="" - -for i in *; do - if [ -d "$i" -a -r "$i" -a -r "${i}/info.txt" ]; then - ./run-test ${run_args} "$i" - if [ "$?" = "0" ]; then - ((passed += 1)) - else - ((failed += 1)) - failNames="$failNames $i" - fi - fi -done - -echo "passed: $passed test(s)" -echo "failed: $failed test(s)" - -for i in $failNames; do - echo "failed: $i" -done diff --git a/tests/run-test b/tests/run-test deleted file mode 100755 index 6c8c457b5..000000000 --- a/tests/run-test +++ /dev/null @@ -1,254 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2007 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. - -# Set up prog to be the path of this script, including following symlinks, -# and set up progdir to be the fully-qualified pathname of its directory. -prog="$0" -while [ -h "${prog}" ]; do - newProg=`/bin/ls -ld "${prog}"` - newProg=`expr "${newProg}" : ".* -> \(.*\)$"` - if expr "x${newProg}" : 'x/' >/dev/null; then - prog="${newProg}" - else - progdir=`dirname "${prog}"` - prog="${progdir}/${newProg}" - fi -done -oldwd=`pwd` -progdir=`dirname "${prog}"` -cd "${progdir}" -progdir=`pwd` -prog="${progdir}"/`basename "${prog}"` - -export JAVA="java" -export JAVAC="javac -source 1.5 -target 1.5" -export RUN="${progdir}/etc/push-and-run-test-jar" - -info="info.txt" -build="build" -run="run" -expected="expected.txt" -output="output.txt" -build_output="build-output.txt" -run_args="--quiet" - -dev_mode="no" -update_mode="no" -debug_mode="no" -usage="no" - -while true; do - if [ "x$1" = "x--host" ]; then - RUN="${progdir}/etc/host-run-test-jar" - shift - elif [ "x$1" = "x--reference" ]; then - RUN="${progdir}/etc/reference-run-test-classes" - shift - elif [ "x$1" = "x--jit" ]; then - run_args="${run_args} --jit" - shift - elif [ "x$1" = "x--fast" ]; then - run_args="${run_args} --fast" - shift - elif [ "x$1" = "x--portable" ]; then - run_args="${run_args} --portable" - shift - elif [ "x$1" = "x--debug" ]; then - run_args="${run_args} --debug" - shift - elif [ "x$1" = "x--gdb" ]; then - run_args="${run_args} --gdb" - dev_mode="yes" - shift - elif [ "x$1" = "x--zygote" ]; then - run_args="${run_args} --zygote" - shift - elif [ "x$1" = "x--no-verify" ]; then - run_args="${run_args} --no-verify" - shift - elif [ "x$1" = "x--no-optimize" ]; then - run_args="${run_args} --no-optimize" - shift - elif [ "x$1" = "x--no-precise" ]; then - run_args="${run_args} --no-precise" - shift - elif [ "x$1" = "x--valgrind" ]; then - run_args="${run_args} --valgrind" - shift - elif [ "x$1" = "x--dev" ]; then - run_args="${run_args} --dev" - dev_mode="yes" - shift - elif [ "x$1" = "x--update" ]; then - update_mode="yes" - shift - elif [ "x$1" = "x--help" ]; then - usage="yes" - shift - elif expr "x$1" : "x--" >/dev/null 2>&1; then - echo "unknown option: $1" 1>&2 - usage="yes" - break - else - break - fi -done - -if [ "$dev_mode" = "yes" -a "$update_mode" = "yes" ]; then - echo "--dev and --update are mutually exclusive" 1>&2 - usage="yes" -fi - -if [ "$usage" = "no" ]; then - if [ "x$1" = "x" -o "x$1" = "x-" ]; then - test_dir=`basename "$oldwd"` - else - test_dir="$1" - fi - - if [ '!' -d "$test_dir" ]; then - td2=`echo ${test_dir}-*` - if [ '!' -d "$td2" ]; then - echo "${test_dir}: no such test directory" 1>&2 - usage="yes" - fi - test_dir="$td2" - fi - - # Shift to get rid of the test name argument. The rest of the arguments - # will get passed to the test run. - shift -fi - -if [ "$usage" = "yes" ]; then - prog=`basename $prog` - ( - echo "usage:" - echo " $prog --help Print this message." - echo " $prog [options] [test-name] Run test normally." - echo " $prog --dev [options] [test-name] Development mode" \ - "(dumps to stdout)." - echo " $prog --update [options] [test-name] Update mode" \ - "(replaces expected.txt)." - echo ' Omitting the test name or specifying "-" will use the' \ - "current directory." - echo " Runtime Options:" - echo " --fast Use the fast interpreter." - echo " --jit Use the jit (the default)." - echo " --portable Use the portable interpreter." - echo " --debug Wait for a debugger to attach." - #echo " --gdb Run under gdb; incompatible with some tests." - echo " --no-verify Turn off verification (on by default)." - echo " --no-optimize Turn off optimization (on by default)." - echo " --no-precise Turn off precise GC (on by default)." - echo " --zygote Spawn the process from the Zygote." \ - "If used, then the" - echo " other runtime options are ignored." - echo " --host Use the host-mode virtual machine." - echo " --valgrind Use valgrind when running locally." - echo " --reference Use a host-local reference virtual machine." - ) 1>&2 - exit 1 -fi - -cd "$test_dir" -test_dir=`pwd` - -td_info="${test_dir}/${info}" -td_expected="${test_dir}/${expected}" - -tmp_dir="/tmp/test-$$" - -if [ '!' '(' -r "$td_info" -a -r "$td_expected" ')' ]; then - echo "${test_dir}: missing files" 1>&2 - exit 1 -fi - -# copy the test to a temp dir and run it - -echo "${test_dir}: running..." 1>&2 - -rm -rf "$tmp_dir" -cp -Rp "$test_dir" "$tmp_dir" -cd "$tmp_dir" - -if [ '!' -r "$build" ]; then - cp "${progdir}/etc/default-build" build -fi - -if [ '!' -r "$run" ]; then - cp "${progdir}/etc/default-run" run -fi - -chmod 755 "$build" -chmod 755 "$run" - -good="no" -if [ "$dev_mode" = "yes" ]; then - "./${build}" 2>&1 - echo "build exit status: $?" 1>&2 - "./${run}" $run_args "$@" 2>&1 - echo "run exit status: $?" 1>&2 - good="yes" -elif [ "$update_mode" = "yes" ]; then - "./${build}" >"$build_output" 2>&1 - build_exit="$?" - if [ "$build_exit" = '0' ]; then - "./${run}" $run_args "$@" >"$output" 2>&1 - sed -e 's/[[:cntrl:]]$//g' < "$output" >"${td_expected}" - good="yes" - else - cat "$build_output" 1>&2 - echo "build exit status: $build_exit" 1>&2 - fi -else - "./${build}" >"$build_output" 2>&1 - build_exit="$?" - if [ "$build_exit" = '0' ]; then - "./${run}" $run_args "$@" >"$output" 2>&1 - else - cp "$build_output" "$output" - echo "build exit status: $build_exit" >>"$output" - fi - diff --strip-trailing-cr -q "$expected" "$output" >/dev/null - if [ "$?" = "0" ]; then - # output == expected - good="yes" - echo "${test_dir}: succeeded!" 1>&2 - fi -fi - -if [ "$good" = "yes" ]; then - cd "$oldwd" - rm -rf "$tmp_dir" - exit 0 -fi - -( - if [ "$update_mode" '!=' "yes" ]; then - echo "${test_dir}: FAILED!" - echo ' ' - echo '#################### info' - cat "${td_info}" | sed 's/^/# /g' - echo '#################### diffs' - diff --strip-trailing-cr -u "$expected" "$output" - echo '####################' - echo ' ' - fi - echo "files left in ${tmp_dir}" -) 1>&2 - -exit 1 diff --git a/tools/dmtracedump/TraceDump.c b/tools/dmtracedump/TraceDump.c index 0dfeed37e..7ec067d81 100644 --- a/tools/dmtracedump/TraceDump.c +++ b/tools/dmtracedump/TraceDump.c @@ -159,7 +159,7 @@ typedef struct UniqueMethodEntry { * Entry from the method list. */ typedef struct MethodEntry { - unsigned int methodId; + int64_t methodId; const char* className; const char* methodName; const char* signature; @@ -297,7 +297,7 @@ char *htmlEscape(const char *src, char *dest, int len) /* Initializes a MethodEntry */ -void initMethodEntry(MethodEntry *method, unsigned int methodId, +void initMethodEntry(MethodEntry *method, int64_t methodId, const char *className, const char *methodName, const char *signature, const char* fileName, const char* lineNumStr) @@ -345,8 +345,8 @@ int compareElapsedExclusive(const void *a, const void *b) { result = strcmp(methodA->className, methodB->className); if (result == 0) { if (methodA->methodName == NULL || methodB->methodName == NULL) { - unsigned int idA = methodA->methodId; - unsigned int idB = methodB->methodId; + int64_t idA = methodA->methodId; + int64_t idB = methodB->methodId; if (idA < idB) return -1; if (idA > idB) @@ -384,8 +384,8 @@ int compareElapsedInclusive(const void *a, const void *b) { result = strcmp(methodA->className, methodB->className); if (result == 0) { if (methodA->methodName == NULL || methodB->methodName == NULL) { - unsigned int idA = methodA->methodId; - unsigned int idB = methodB->methodId; + int64_t idA = methodA->methodId; + int64_t idB = methodB->methodId; if (idA < idB) return -1; if (idA > idB) @@ -425,8 +425,8 @@ int compareTimedMethod(const void *a, const void *b) { result = strcmp(methodA->className, methodB->className); if (result == 0) { if (methodA->methodName == NULL || methodB->methodName == NULL) { - unsigned int idA = methodA->methodId; - unsigned int idB = methodB->methodId; + int64_t idA = methodA->methodId; + int64_t idB = methodB->methodId; if (idA < idB) return -1; if (idA > idB) @@ -451,8 +451,8 @@ int compareClassNames(const void *a, const void *b) { const MethodEntry *methodB = *(const MethodEntry**)b; result = strcmp(methodA->className, methodB->className); if (result == 0) { - unsigned int idA = methodA->methodId; - unsigned int idB = methodB->methodId; + int64_t idA = methodA->methodId; + int64_t idB = methodB->methodId; if (idA < idB) return -1; if (idA > idB) @@ -487,8 +487,8 @@ int compareClassExclusive(const void *a, const void *b) { /* Break ties with the first method id. This is probably not * needed. */ - unsigned int idA = classA->methods[0]->methodId; - unsigned int idB = classB->methods[0]->methodId; + int64_t idA = classA->methods[0]->methodId; + int64_t idB = classB->methods[0]->methodId; if (idA < idB) return -1; if (idA > idB) @@ -515,8 +515,8 @@ int compareMethodNames(const void *a, const void *b) { if (result == 0) { result = strcmp(methodA->className, methodB->className); if (result == 0) { - unsigned int idA = methodA->methodId; - unsigned int idB = methodB->methodId; + int64_t idA = methodA->methodId; + int64_t idB = methodB->methodId; if (idA < idB) return -1; if (idA > idB) @@ -550,8 +550,8 @@ int compareUniqueExclusive(const void *a, const void *b) { result = strcmp(uniqueA->methods[0]->className, uniqueB->methods[0]->className); if (result == 0) { - unsigned int idA = uniqueA->methods[0]->methodId; - unsigned int idB = uniqueB->methods[0]->methodId; + int64_t idA = uniqueA->methods[0]->methodId; + int64_t idB = uniqueB->methods[0]->methodId; if (idA < idB) return -1; if (idA > idB) @@ -794,9 +794,9 @@ long parseMethods(DataKeys* pKeys, long offset) pKeys->methods = (MethodEntry*) malloc(sizeof(MethodEntry) * count); if (pKeys->methods == NULL) return -1; - initMethodEntry(&pKeys->methods[TOPLEVEL_INDEX], 0, "(toplevel)", + initMethodEntry(&pKeys->methods[TOPLEVEL_INDEX], -2, "(toplevel)", NULL, NULL, NULL, NULL); - initMethodEntry(&pKeys->methods[UNKNOWN_INDEX], 0, "(unknown)", + initMethodEntry(&pKeys->methods[UNKNOWN_INDEX], -1, "(unknown)", NULL, NULL, NULL, NULL); /* @@ -804,7 +804,7 @@ long parseMethods(DataKeys* pKeys, long offset) */ for (i = UNKNOWN_INDEX + 1; i < count; i++) { int tab1, tab2, tab3, tab4, tab5; - unsigned int id; + int64_t id; char* endptr; next = findNextChar(data, dataEnd - data, '\n'); @@ -912,7 +912,7 @@ void sortThreadList(DataKeys* pKeys) */ static int compareMethods(const void* meth1, const void* meth2) { - unsigned int id1, id2; + int64_t id1, id2; id1 = ((const MethodEntry*) meth1)->methodId; id2 = ((const MethodEntry*) meth2)->methodId; @@ -1099,10 +1099,10 @@ int parseDataHeader(FILE *fp, DataHeader* pHeader) * * Returns NULL if no matching method was found. */ -MethodEntry* lookupMethod(DataKeys* pKeys, unsigned int methodId) +MethodEntry* lookupMethod(DataKeys* pKeys, int64_t methodId) { int hi, lo, mid; - unsigned int id; + int64_t id; lo = 0; hi = pKeys->numMethods - 1; @@ -1186,7 +1186,7 @@ void dumpTrace() for (i = 0; i < MAX_THREADS; i++) traceData.depth[i] = 2; // adjust for return from start function - dataFp = fopen(gOptions.traceFileName, "r"); + dataFp = fopen(gOptions.traceFileName, "rb"); if (dataFp == NULL) goto bail; @@ -1204,7 +1204,7 @@ void dumpTrace() unsigned int methodVal; uint64_t elapsedTime; int action, printDepth; - unsigned int methodId, lastEnter = 0; + int64_t methodId, lastEnter = 0; int mismatch = 0; char depthNote; @@ -1242,7 +1242,7 @@ void dumpTrace() method = lookupMethod(pKeys, methodId); if (method == NULL) { method = &bogusMethod; - sprintf(bogusBuf, "methodId: %#x", methodId); + sprintf(bogusBuf, "methodId: %#" PRIx64 "", methodId); method->signature = bogusBuf; } @@ -1664,7 +1664,7 @@ void createInclusiveProfileGraphNew(DataKeys* dataKeys) if (gOptions.keepDotFile) { snprintf(path, FILENAME_MAX, "%s.dot", gOptions.graphFileName); } else { - snprintf(path, FILENAME_MAX, "/tmp/dot-%d-%d.dot", (int)time(NULL), rand()); + snprintf(path, FILENAME_MAX, "dot-%d-%d.dot", (int)time(NULL), rand()); } FILE* file = fopen(path, "w+"); @@ -1679,7 +1679,7 @@ void createInclusiveProfileGraphNew(DataKeys* dataKeys) // now that we have the dot file generate the image char command[1024]; - snprintf(command, 1024, "dot -Tpng -o '%s' '%s'", gOptions.graphFileName, path); + snprintf(command, 1024, "dot -Tpng -o \"%s\" \"%s\"", gOptions.graphFileName, path); system(command); @@ -2301,7 +2301,7 @@ DataKeys* parseDataKeys(TraceData* traceData, const char* traceFileName, uint64_ uint64_t currentTime; MethodEntry* caller; - dataFp = fopen(traceFileName, "r"); + dataFp = fopen(traceFileName, "rb"); if (dataFp == NULL) goto bail; @@ -2318,7 +2318,7 @@ DataKeys* parseDataKeys(TraceData* traceData, const char* traceFileName, uint64_ int threadId; unsigned int methodVal; int action; - unsigned int methodId; + int64_t methodId; CallStack *pStack; /* * Extract values from file. diff --git a/unit-tests/Android.mk b/unit-tests/Android.mk index 62b666a20..1e14c0806 100644 --- a/unit-tests/Android.mk +++ b/unit-tests/Android.mk @@ -17,7 +17,6 @@ LOCAL_PATH := $(call my-dir) test_module = dalvik-vm-unit-tests -test_tags = eng tests test_src_files = \ dvmHumanReadableDescriptor_test.cpp \ @@ -32,7 +31,6 @@ include $(CLEAR_VARS) LOCAL_CFLAGS += -DANDROID_SMP=1 LOCAL_C_INCLUDES += $(test_c_includes) LOCAL_MODULE := $(test_module) -LOCAL_MODULE_TAGS := $(test_tags) LOCAL_SRC_FILES := $(test_src_files) LOCAL_SHARED_LIBRARIES += libcutils libdvm include $(BUILD_NATIVE_TEST) @@ -43,7 +41,6 @@ include $(BUILD_NATIVE_TEST) #include $(CLEAR_VARS) #LOCAL_C_INCLUDES += $(test_c_includes) #LOCAL_MODULE := $(test_module) -#LOCAL_MODULE_TAGS := $(test_tags) #LOCAL_SRC_FILES := $(test_src_files) #LOCAL_SHARED_LIBRARIES += libdvm libcrypto libssl libicuuc libicui18n #LOCAL_WHOLE_STATIC_LIBRARIES += libcutils liblog libdvm diff --git a/vm/Android.mk b/vm/Android.mk index e5d5448ce..909190c69 100644 --- a/vm/Android.mk +++ b/vm/Android.mk @@ -46,11 +46,14 @@ include $(LOCAL_PATH)/ReconfigureDvm.mk # Overwrite default settings LOCAL_MODULE := libdvm LOCAL_CFLAGS += $(target_smp_flag) +ifeq ($(TARGET_ARCH),x86) +LOCAL_LDFLAGS += -Wl,--no-fatal-warnings +endif # Define WITH_ADDRESS_SANITIZER to build an ASan-instrumented version of the # library in /system/lib/asan/libdvm.so. ifneq ($(strip $(WITH_ADDRESS_SANITIZER)),) - LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/asan + LOCAL_MODULE_RELATIVE_PATH := asan LOCAL_ADDRESS_SANITIZER := true LOCAL_CFLAGS := $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(LOCAL_CFLAGS)) endif @@ -68,6 +71,9 @@ LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT \ # TODO: split out the asflags. LOCAL_ASFLAGS := $(LOCAL_CFLAGS) LOCAL_MODULE := libdvm_assert +ifeq ($(TARGET_ARCH),x86) +LOCAL_LDFLAGS += -Wl,--no-fatal-warnings +endif include $(BUILD_SHARED_LIBRARY) ifneq ($(dvm_arch),mips) # MIPS support for self-verification is incomplete @@ -80,6 +86,9 @@ ifneq ($(dvm_arch),mips) # MIPS support for self-verification is incomplete # TODO: split out the asflags. LOCAL_ASFLAGS := $(LOCAL_CFLAGS) LOCAL_MODULE := libdvm_sv + ifeq ($(TARGET_ARCH),x86) + LOCAL_LDFLAGS += -Wl,--no-fatal-warnings + endif include $(BUILD_SHARED_LIBRARY) endif # dvm_arch!=mips @@ -92,6 +101,9 @@ LOCAL_CFLAGS += $(target_smp_flag) # TODO: split out the asflags. LOCAL_ASFLAGS := $(LOCAL_CFLAGS) LOCAL_MODULE := libdvm_interp +ifeq ($(TARGET_ARCH),x86) +LOCAL_LDFLAGS += -Wl,--no-fatal-warnings +endif include $(BUILD_SHARED_LIBRARY) @@ -123,6 +135,7 @@ ifeq ($(WITH_HOST_DALVIK),true) # time. When building this target as a regular static library, certain # dependencies like expat are not found by the linker. LOCAL_WHOLE_STATIC_LIBRARIES += libexpat libcutils libdex liblog libz + LOCAL_STATIC_LIBRARIES += libutils # The libffi from the source tree should never be used by host builds. # The recommendation is that host builds should always either diff --git a/vm/Dalvik.h b/vm/Dalvik.h index eecbf8d37..27174e72b 100644 --- a/vm/Dalvik.h +++ b/vm/Dalvik.h @@ -30,7 +30,6 @@ #include "libdex/DexFile.h" #include "libdex/DexProto.h" #include "libdex/DexUtf.h" -#include "libdex/ZipArchive.h" #include "DvmDex.h" #include "RawDexFile.h" #include "Sync.h" @@ -19,6 +19,9 @@ #ifndef DALVIK_DDM_H_ #define DALVIK_DDM_H_ +#include <stdbool.h> +#include "Thread.h" + /* * Handle a packet full of DDM goodness. * @@ -26,8 +26,9 @@ # LOCAL_CFLAGS += -fstrict-aliasing -Wstrict-aliasing=2 -LOCAL_CFLAGS += -Wall -Wextra -Wno-unused-parameter +LOCAL_CFLAGS += -Wall -Wextra -Wno-unused-parameter -Wno-unused-but-set-variable LOCAL_CFLAGS += -DARCH_VARIANT=\"$(dvm_arch_variant)\" +LOCAL_CFLAGS += -D__STDC_LIMIT_MACROS ifneq ($(strip $(LOCAL_CLANG)),true) LOCAL_CFLAGS += -fno-align-jumps @@ -284,6 +285,10 @@ ifeq ($(dvm_arch),mips) compiler/codegen/mips/GlobalOptimizations.cpp \ compiler/template/out/CompilerTemplateAsm-$(dvm_arch_variant).S endif + + ifeq ($(strip $(ARCH_HAVE_ALIGNED_DOUBLES)),true) + LOCAL_CFLAGS += -DARCH_HAVE_ALIGNED_DOUBLES + endif endif ifeq ($(dvm_arch),x86) @@ -292,10 +297,10 @@ ifeq ($(dvm_arch),x86) LOCAL_CFLAGS += -DDVM_JMP_TABLE_MTERP=1 \ -DMTERP_STUB LOCAL_SRC_FILES += \ - arch/$(dvm_arch_variant)/Call386ABI.S \ - arch/$(dvm_arch_variant)/Hints386ABI.cpp \ - mterp/out/InterpC-$(dvm_arch_variant).cpp \ - mterp/out/InterpAsm-$(dvm_arch_variant).S + arch/$(dvm_arch)/Call386ABI.S \ + arch/$(dvm_arch)/Hints386ABI.cpp \ + mterp/out/InterpC-$(dvm_arch).cpp \ + mterp/out/InterpAsm-$(dvm_arch).S ifeq ($(WITH_JIT),true) LOCAL_CFLAGS += -DARCH_IA32 LOCAL_SRC_FILES += \ @@ -351,3 +356,12 @@ ifeq ($(MTERP_ARCH_KNOWN),false) LOCAL_CFLAGS += -DdvmAsmInstructionStart=0 -DdvmAsmInstructionEnd=0 \ -DdvmAsmSisterStart=0 -DdvmAsmSisterEnd=0 -DDVM_NO_ASM_INTERP=1 endif + +# Needed because getLongFromArray etc. are defined in +# vm/mterp/c/header.cpp, but only used if some asm +# implementations aren't available. +# To fix this without generating unused functions, +# gen-mterp.py would need to be a lot more intelligent +# (picking just the parts of header.cpp that are +# actually used in C code). Doesn't seem to be worth it. +LOCAL_CFLAGS += -Wno-error=unused-function diff --git a/vm/Exception.cpp b/vm/Exception.cpp index ca7614096..36f2d20c0 100644 --- a/vm/Exception.cpp +++ b/vm/Exception.cpp @@ -1225,7 +1225,7 @@ void dvmThrowArrayStoreExceptionNotArray(ClassObject* actual, const char* label) void dvmThrowArrayStoreExceptionIncompatibleArrays(ClassObject* source, ClassObject* destination) { throwTypeError(gDvm.exArrayStoreException, - "%s and %s are incompatible array types", + "Incompatible types: src=%s, dst=%s", source, destination); } diff --git a/vm/Init.cpp b/vm/Init.cpp index f1762c96c..ccd5115fa 100644 --- a/vm/Init.cpp +++ b/vm/Init.cpp @@ -17,7 +17,6 @@ /* * Dalvik initialization, shutdown, and command-line argument processing. */ -#define __STDC_LIMIT_MACROS #include <stdlib.h> #include <stdio.h> #include <signal.h> @@ -80,8 +79,9 @@ int gDvmICHitCount; * * We follow the tradition of unhyphenated compound words. */ -static void usage(const char* progName) +static void usage() { + const char* progName = "dalvikvm"; dvmFprintf(stderr, "%s: [options] class [argument ...]\n", progName); dvmFprintf(stderr, "%s: [options] -jar file.jar [argument ...]\n",progName); dvmFprintf(stderr, "\n"); @@ -804,7 +804,8 @@ static int processOptions(int argc, const char* const argv[], for (i = 0; i < argc; i++) { if (strcmp(argv[i], "-help") == 0) { /* show usage and stop */ - return -1; + usage(); + exit(0); } else if (strcmp(argv[i], "-version") == 0) { /* show version and stop */ @@ -1399,7 +1400,7 @@ std::string dvmStartup(int argc, const char* const argv[], if (cc != 0) { if (cc < 0) { dvmFprintf(stderr, "\n"); - usage("dalvikvm"); + usage(); } return "syntax error"; } diff --git a/vm/JarFile.cpp b/vm/JarFile.cpp index e643a5fe5..aabb50fee 100644 --- a/vm/JarFile.cpp +++ b/vm/JarFile.cpp @@ -24,6 +24,7 @@ #include "Dalvik.h" #include "libdex/OptInvocation.h" +#include "JarFile.h" #include <stdlib.h> #include <string.h> @@ -87,7 +88,7 @@ bail: */ DexCacheStatus dvmDexCacheStatus(const char *fileName) { - ZipArchive archive; + ZipArchiveHandle archive; char* cachedName = NULL; int fd; DexCacheStatus result = DEX_CACHE_ERROR; @@ -130,8 +131,7 @@ tryArchive: * Pre-created .odex absent or stale. Look inside the jar for a * "classes.dex". */ - entry = dexZipFindEntry(&archive, kDexInJarName); - if (entry != NULL) { + if (dexZipFindEntry(archive, kDexInJarName, &entry) == 0) { bool newFile = false; /* @@ -144,8 +144,7 @@ tryArchive: return DEX_CACHE_BAD_ARCHIVE; fd = dvmOpenCachedDexFile(fileName, cachedName, - dexGetZipEntryModTime(&archive, entry), - dexGetZipEntryCrc32(&archive, entry), + entry.mod_time, entry.crc32, /*isBootstrap=*/false, &newFile, /*createIfMissing=*/false); ALOGV("dvmOpenCachedDexFile returned fd %d", fd); if (fd < 0) { @@ -171,7 +170,7 @@ tryArchive: result = DEX_CACHE_OK; bail: - dexZipCloseArchive(&archive); + dexZipCloseArchive(archive); free(cachedName); if (fd >= 0) { close(fd); @@ -197,7 +196,7 @@ int dvmJarFileOpen(const char* fileName, const char* odexOutputName, * dvmRawDexFileOpen() in RawDexFile.c. This should be refactored. */ - ZipArchive archive; + ZipArchiveHandle archive; DvmDex* pDvmDex = NULL; char* cachedName = NULL; bool archiveOpen = false; @@ -214,7 +213,7 @@ int dvmJarFileOpen(const char* fileName, const char* odexOutputName, /* If we fork/exec into dexopt, don't let it inherit the archive's fd. */ - dvmSetCloseOnExec(dexZipGetArchiveFd(&archive)); + dvmSetCloseOnExec(dexZipGetArchiveFd(archive)); /* First, look for a ".odex" alongside the jar file. It will * have the same name/path except for the extension. @@ -243,8 +242,7 @@ tryArchive: * Pre-created .odex absent or stale. Look inside the jar for a * "classes.dex". */ - entry = dexZipFindEntry(&archive, kDexInJarName); - if (entry != NULL) { + if (dexZipFindEntry(archive, kDexInJarName, &entry) == 0) { bool newFile = false; /* @@ -269,8 +267,8 @@ tryArchive: ALOGV("dvmJarFileOpen: Checking cache for %s (%s)", fileName, cachedName); fd = dvmOpenCachedDexFile(fileName, cachedName, - dexGetZipEntryModTime(&archive, entry), - dexGetZipEntryCrc32(&archive, entry), + entry.mod_time, + entry.crc32, isBootstrap, &newFile, /*createIfMissing=*/true); if (fd < 0) { ALOGI("Unable to open or create cache for %s (%s)", @@ -295,15 +293,15 @@ tryArchive: if (result) { startWhen = dvmGetRelativeTimeUsec(); - result = dexZipExtractEntryToFile(&archive, entry, fd) == 0; + result = dexZipExtractEntryToFile(archive, &entry, fd) == 0; extractWhen = dvmGetRelativeTimeUsec(); } if (result) { result = dvmOptimizeDexFile(fd, dexOffset, - dexGetZipEntryUncompLen(&archive, entry), + entry.uncompressed_length, fileName, - dexGetZipEntryModTime(&archive, entry), - dexGetZipEntryCrc32(&archive, entry), + entry.mod_time, + entry.crc32, isBootstrap); } @@ -357,7 +355,7 @@ tryArchive: bail: /* clean up, closing the open file */ if (archiveOpen && result != 0) - dexZipCloseArchive(&archive); + dexZipCloseArchive(archive); free(cachedName); if (fd >= 0) { if (locked) @@ -376,7 +374,7 @@ void dvmJarFileFree(JarFile* pJarFile) return; dvmDexFileFree(pJarFile->pDvmDex); - dexZipCloseArchive(&pJarFile->archive); + dexZipCloseArchive(pJarFile->archive); free(pJarFile->cacheFileName); free(pJarFile); } diff --git a/vm/JarFile.h b/vm/JarFile.h index d8fd99881..b3a8a0f2e 100644 --- a/vm/JarFile.h +++ b/vm/JarFile.h @@ -19,12 +19,14 @@ #ifndef DALVIK_JARFILE_H_ #define DALVIK_JARFILE_H_ +#include "libdex/ZipArchive.h" + /* * This represents an open, scanned Jar file. (It's actually for any Zip * archive that happens to hold a Dex file.) */ struct JarFile { - ZipArchive archive; + ZipArchiveHandle archive; //MemMapping map; char* cacheFileName; DvmDex* pDvmDex; diff --git a/vm/ReconfigureDvm.mk b/vm/ReconfigureDvm.mk index 6e161c97a..d7ad1ccc9 100644 --- a/vm/ReconfigureDvm.mk +++ b/vm/ReconfigureDvm.mk @@ -22,12 +22,13 @@ dvm_arch_variant := $(TARGET_ARCH_VARIANT) include $(LOCAL_PATH)/Dvm.mk LOCAL_SHARED_LIBRARIES += \ - libcorkscrew \ + libbacktrace \ libcutils \ libdl \ liblog \ libnativehelper \ libselinux \ + libutils \ libz LOCAL_STATIC_LIBRARIES += libdex diff --git a/vm/Thread.cpp b/vm/Thread.cpp index 1ebfca74c..c3d944b0c 100644 --- a/vm/Thread.cpp +++ b/vm/Thread.cpp @@ -1179,11 +1179,17 @@ static bool createFakeRunFrame(Thread* thread) /* * Helper function to set the name of the current thread */ -static void setThreadName(const char *threadName) +void dvmSetThreadName(const char *threadName) { int hasAt = 0; int hasDot = 0; const char *s = threadName; + + if (s == NULL) { + ALOGW("Unable to set the name of current thread to NULL"); + return; + } + while (*s) { if (*s == '.') hasDot = 1; else if (*s == '@') hasAt = 1; @@ -1462,7 +1468,7 @@ static void* interpThreadStart(void* arg) Thread* self = (Thread*) arg; std::string threadName(dvmGetThreadName(self)); - setThreadName(threadName.c_str()); + dvmSetThreadName(threadName.c_str()); /* * Finish initializing the Thread struct. @@ -1724,7 +1730,7 @@ static void* internalThreadStart(void* arg) jniArgs.name = pArgs->name; jniArgs.group = reinterpret_cast<jobject>(pArgs->group); - setThreadName(pArgs->name); + dvmSetThreadName(pArgs->name); /* use local jniArgs as stack top */ if (dvmAttachCurrentThread(&jniArgs, pArgs->isDaemon)) { diff --git a/vm/Thread.h b/vm/Thread.h index 19bd49c3b..0bf15e637 100644 --- a/vm/Thread.h +++ b/vm/Thread.h @@ -608,4 +608,11 @@ void dvmDumpAllThreadsEx(const DebugOutputTarget* target, bool grabLock); */ void dvmNukeThread(Thread* thread); +/* + * Sets the thread's name as pointed to by threadName in task_struct->comm. + * Note this field has a limited width, and larger values will be truncated + * to this width starting from the end. + */ +void dvmSetThreadName(const char *threadName); + #endif // DALVIK_THREAD_H_ diff --git a/vm/alloc/Copying.cpp b/vm/alloc/Copying.cpp index 77cdac33c..195670eb1 100644 --- a/vm/alloc/Copying.cpp +++ b/vm/alloc/Copying.cpp @@ -461,7 +461,7 @@ GcHeap *dvmHeapSourceStartup(size_t startSize, size_t absoluteMaxSize) heapSource->allocBlocks = 0; heapSource->totalBlocks = (heapSource->limitBlock - heapSource->baseBlock); - assert(heapSource->totalBlocks = heapSource->maximumSize / BLOCK_SIZE); + assert(heapSource->totalBlocks == heapSource->maximumSize / BLOCK_SIZE); { size_t size = sizeof(heapSource->blockQueue[0]); diff --git a/vm/alloc/HeapSource.cpp b/vm/alloc/HeapSource.cpp index 82c2b9e95..2c722be86 100644 --- a/vm/alloc/HeapSource.cpp +++ b/vm/alloc/HeapSource.cpp @@ -19,8 +19,6 @@ #include <errno.h> #include <cutils/ashmem.h> -#define SIZE_MAX UINT_MAX // TODO: get SIZE_MAX from stdint.h - #include "Dalvik.h" #include "alloc/DlMalloc.h" #include "alloc/Heap.h" @@ -592,8 +590,8 @@ static void freeMarkStack(GcMarkStack *stack) GcHeap* dvmHeapSourceStartup(size_t startSize, size_t maximumSize, size_t growthLimit) { - GcHeap *gcHeap; - HeapSource *hs; + GcHeap *gcHeap = NULL; + HeapSource *hs = NULL; mspace msp; size_t length; void *base; @@ -613,7 +611,7 @@ GcHeap* dvmHeapSourceStartup(size_t startSize, size_t maximumSize, length = ALIGN_UP_TO_PAGE_SIZE(maximumSize); base = dvmAllocRegion(length, PROT_NONE, gDvm.zygote ? "dalvik-zygote" : "dalvik-heap"); if (base == NULL) { - return NULL; + dvmAbort(); } /* Create an unlocked dlmalloc mspace to use as @@ -621,20 +619,19 @@ GcHeap* dvmHeapSourceStartup(size_t startSize, size_t maximumSize, */ msp = createMspace(base, kInitialMorecoreStart, startSize); if (msp == NULL) { - goto fail; + dvmAbort(); } gcHeap = (GcHeap *)calloc(1, sizeof(*gcHeap)); if (gcHeap == NULL) { LOGE_HEAP("Can't allocate heap descriptor"); - goto fail; + dvmAbort(); } hs = (HeapSource *)calloc(1, sizeof(*hs)); if (hs == NULL) { LOGE_HEAP("Can't allocate heap source"); - free(gcHeap); - goto fail; + dvmAbort(); } hs->targetUtilization = gDvm.heapTargetUtilization * HEAP_UTILIZATION_MAX; @@ -666,32 +663,28 @@ GcHeap* dvmHeapSourceStartup(size_t startSize, size_t maximumSize, if (!addInitialHeap(hs, msp, growthLimit)) { LOGE_HEAP("Can't add initial heap"); - goto fail; + dvmAbort(); } if (!dvmHeapBitmapInit(&hs->liveBits, base, length, "dalvik-bitmap-1")) { LOGE_HEAP("Can't create liveBits"); - goto fail; + dvmAbort(); } if (!dvmHeapBitmapInit(&hs->markBits, base, length, "dalvik-bitmap-2")) { LOGE_HEAP("Can't create markBits"); dvmHeapBitmapDelete(&hs->liveBits); - goto fail; + dvmAbort(); } if (!allocMarkStack(&gcHeap->markContext.stack, hs->maximumSize)) { ALOGE("Can't create markStack"); dvmHeapBitmapDelete(&hs->markBits); dvmHeapBitmapDelete(&hs->liveBits); - goto fail; + dvmAbort(); } gcHeap->markContext.bitmap = &hs->markBits; gcHeap->heapSource = hs; gHs = hs; return gcHeap; - -fail: - munmap(base, length); - return NULL; } bool dvmHeapSourceStartupAfterZygote() diff --git a/vm/alloc/MarkSweep.cpp b/vm/alloc/MarkSweep.cpp index 2781a7cfa..008b40423 100644 --- a/vm/alloc/MarkSweep.cpp +++ b/vm/alloc/MarkSweep.cpp @@ -26,9 +26,6 @@ #include <sys/mman.h> // for madvise(), mmap() #include <errno.h> -typedef unsigned long Word; -const size_t kWordSize = sizeof(Word); - /* * Returns true if the given object is marked. */ diff --git a/vm/arch/arm/CallEABI.S b/vm/arch/arm/CallEABI.S index 9971b5dc4..d870306c2 100644 --- a/vm/arch/arm/CallEABI.S +++ b/vm/arch/arm/CallEABI.S @@ -254,12 +254,7 @@ DBG strcs ip, [r8] @ DEBUG DEBUG ldmia r9, {r2-r3} @ r2/r3<- argv[0]/argv[1] ldr ip, [fp, #8+FP_ADJ] @ ip<- func -#ifdef __ARM_HAVE_BLX blx ip @ call func -#else - mov lr, pc @ call func the old-fashioned way - bx ip -#endif @ We're back, result is in r0 or (for long/double) r0-r1. @ @@ -279,12 +274,7 @@ DBG strcs ip, [r8] @ DEBUG DEBUG @ Restore the registers we saved and return. On >= ARMv5TE we can @ restore PC directly from the saved LR. -#ifdef __ARM_HAVE_PC_INTERWORK ldmfd sp!, {r6, r7, r8, r9, fp, pc} -#else - ldmfd sp!, {r6, r7, r8, r9, fp, lr} - bx lr -#endif @@ -417,12 +407,7 @@ common_squeak\num: ldr r0, strSqueak mov r1, #\num bl printf -#ifdef __ARM_HAVE_PC_INTERWORK ldmfd sp!, {r0, r1, r2, r3, ip, pc} -#else - ldmfd sp!, {r0, r1, r2, r3, ip, lr} - bx lr -#endif .endm SQUEAK 0 diff --git a/vm/arch/arm/CallOldABI.S b/vm/arch/arm/CallOldABI.S index 2463d3cb4..d75f6f793 100644 --- a/vm/arch/arm/CallOldABI.S +++ b/vm/arch/arm/CallOldABI.S @@ -144,13 +144,8 @@ dvmPlatformInvoke: @ address supplied by the caller. The value for "pc" is offset by 8 @ due to instruction prefetching. @ -#ifdef __ARM_HAVE_PC_INTERWORK mov lr, pc ldr pc, [r4, #8] -#else - ldr ip, [r4, #8] - blx ip -#endif @ We're back, result is in r0 or (for long/double) r0-r1. @ @@ -160,14 +155,9 @@ dvmPlatformInvoke: ldr ip, [r4, #12] stmia ip, {r0-r1} -#ifdef __ARM_HAVE_PC_INTERWORK @ Restore the registers we saved and return. Note this remaps stuff, @ so that "sp" comes from "ip", "pc" comes from "lr", and the "pc" @ we pushed on evaporates when we restore "sp". ldmfd r5, {r4, r5, r6, fp, sp, pc} -#else - ldmfd r5, {r4, r5, r6, fp, sp, lr} - bx lr -#endif #endif /*__ARM_EABI__*/ diff --git a/vm/arch/x86/Call386ABI.S b/vm/arch/x86/Call386ABI.S index 766aff725..7765e5d28 100644 --- a/vm/arch/x86/Call386ABI.S +++ b/vm/arch/x86/Call386ABI.S @@ -87,13 +87,17 @@ Float and double returned on top of FP stack. * */ dvmPlatformInvoke: -/* Establish the frame pointer, spill & align to 16b */ +/* Establish the frame pointer and spill. */ pushl %ebp movl %esp,%ebp pushl %edi pushl %esi pushl %ebx - subl $12,%esp + +/* Align stack to 16b. */ + subl $15,%esp + andl $0xfffffff0,%esp + /* For 386 ABI, argInfo hints should always be valid. Abort if not. */ movl 16(%ebp),%ebx testl %ebx,%ebx diff --git a/vm/compiler/Compiler.cpp b/vm/compiler/Compiler.cpp index f5b96b1ef..04d645668 100644 --- a/vm/compiler/Compiler.cpp +++ b/vm/compiler/Compiler.cpp @@ -129,7 +129,7 @@ bool dvmCompilerWorkEnqueue(const u2 *pc, WorkOrderKind kind, void* info) newOrder->pc = pc; newOrder->kind = kind; newOrder->info = info; - newOrder->result.methodCompilationAborted = NULL; + newOrder->result.methodCompilationAborted = false; newOrder->result.codeAddress = NULL; newOrder->result.discardResult = (kind == kWorkOrderTraceDebug) ? true : false; diff --git a/vm/compiler/codegen/arm/ArmLIR.h b/vm/compiler/codegen/arm/ArmLIR.h index e159aecdb..e4278893e 100644 --- a/vm/compiler/codegen/arm/ArmLIR.h +++ b/vm/compiler/codegen/arm/ArmLIR.h @@ -432,6 +432,8 @@ typedef enum ArmOpcode { rd[15-12] [10100000] rm[3..0] */ kThumb2Vdivd, /* vdiv vd, vn, vm [111011101000] rn[19..16] rd[15-12] [10110000] rm[3..0] */ + kThumb2VmlaF64, /* vmla.F64 vd, vn, vm [111011100000] vn[19..16] + vd[15..12] [10110000] vm[3..0] */ kThumb2VcvtIF, /* vcvt.F32 vd, vm [1110111010111000] vd[15..12] [10101100] vm[3..0] */ kThumb2VcvtID, /* vcvt.F64 vd, vm [1110111010111000] vd[15..12] @@ -444,6 +446,10 @@ typedef enum ArmOpcode { [10101100] vm[3..0] */ kThumb2VcvtDF, /* vcvt.F32.F64 vd, vm [1110111010110111] vd[15..12] [10111100] vm[3..0] */ + kThumb2VcvtF64S32, /* vcvt.F64.S32 vd, vm [1110111010111000] vd[15..12] + [10111100] vm[3..0] */ + kThumb2VcvtF64U32, /* vcvt.F64.U32 vd, vm [1110111010111000] vd[15..12] + [10110100] vm[3..0] */ kThumb2Vsqrts, /* vsqrt.f32 vd, vm [1110111010110001] vd[15..12] [10101100] vm[3..0] */ kThumb2Vsqrtd, /* vsqrt.f64 vd, vm [1110111010110001] vd[15..12] @@ -613,8 +619,14 @@ typedef enum ArmOpcode { [10110000] imm4l[3-0] */ kThumb2Mla, /* mla [111110110000] rn[19-16] ra[15-12] rd[7-4] [0000] rm[3-0] */ + kThumb2MlsRRRR, /* mls [1111101110000] rn[19-16] ra[15-12] rd[11-8] + [0001] rm[3-0] */ kThumb2Umull, /* umull [111110111010] rn[19-16], rdlo[15-12] rdhi[11-8] [0000] rm[3-0] */ + kThumb2SdivRRR, /* sdiv [1111101111001 rn[19-16] [1111] rd[11-8] + [1111] rm[3-0] */ + kThumb2UdivRRR, /* udiv [1111101111011 rn[19-16] [1111] rd[11-8] + [1111] rm[3-0] */ kThumb2Ldrex, /* ldrex [111010000101] rn[19-16] rt[11-8] [1111] imm8[7-0] */ kThumb2Strex, /* strex [111010000100] rn[19-16] rt[11-8] rd[11-8] diff --git a/vm/compiler/codegen/arm/Assemble.cpp b/vm/compiler/codegen/arm/Assemble.cpp index 10572eb5f..5f2de72d6 100644 --- a/vm/compiler/codegen/arm/Assemble.cpp +++ b/vm/compiler/codegen/arm/Assemble.cpp @@ -447,6 +447,10 @@ ArmEncodingMap EncodingMap[kArmLast] = { kFmtDfp, 22, 12, kFmtDfp, 7, 16, kFmtDfp, 5, 0, kFmtUnused, -1, -1, IS_TERTIARY_OP | REG_DEF0_USE12, "vdivd", "!0S, !1S, !2S", 2), + ENCODING_MAP(kThumb2VmlaF64, 0xee000b00, + kFmtDfp, 22, 12, kFmtDfp, 7, 16, kFmtDfp, 5, 0, + kFmtUnused, -1, -1, IS_TERTIARY_OP | REG_DEF0 | REG_USE012, + "vmla", "!0S, !1S, !2S", 2), ENCODING_MAP(kThumb2VcvtIF, 0xeeb80ac0, kFmtSfp, 22, 12, kFmtSfp, 5, 0, kFmtUnused, -1, -1, kFmtUnused, -1, -1, IS_BINARY_OP | REG_DEF0_USE1, @@ -471,6 +475,14 @@ ArmEncodingMap EncodingMap[kArmLast] = { kFmtSfp, 22, 12, kFmtDfp, 5, 0, kFmtUnused, -1, -1, kFmtUnused, -1, -1, IS_BINARY_OP | REG_DEF0_USE1, "vcvt.f32.f64 ", "!0s, !1S", 2), + ENCODING_MAP(kThumb2VcvtF64S32, 0xeeb80bc0, + kFmtDfp, 22, 12, kFmtSfp, 5, 0, kFmtUnused, -1, -1, + kFmtUnused, -1, -1, IS_BINARY_OP | REG_DEF0_USE1, + "vcvt.f64.s32 ", "!0S, !1s", 2), + ENCODING_MAP(kThumb2VcvtF64U32, 0xeeb80b40, + kFmtDfp, 22, 12, kFmtSfp, 5, 0, kFmtUnused, -1, -1, + kFmtUnused, -1, -1, IS_BINARY_OP | REG_DEF0_USE1, + "vcvt.f64.u32 ", "!0S, !1s", 2), ENCODING_MAP(kThumb2Vsqrts, 0xeeb10ac0, kFmtSfp, 22, 12, kFmtSfp, 5, 0, kFmtUnused, -1, -1, kFmtUnused, -1, -1, IS_BINARY_OP | REG_DEF0_USE1, @@ -847,11 +859,26 @@ ArmEncodingMap EncodingMap[kArmLast] = { kFmtBitBlt, 15, 12, IS_QUAD_OP | REG_DEF0 | REG_USE1 | REG_USE2 | REG_USE3, "mla", "r!0d, r!1d, r!2d, r!3d", 2), + ENCODING_MAP(kThumb2MlsRRRR, 0xfb000010, + kFmtBitBlt, 11, 8, kFmtBitBlt, 19, 16, kFmtBitBlt, 3, 0, + kFmtBitBlt, 15, 12, + IS_QUAD_OP | REG_DEF0 | REG_USE1 | REG_USE2 | REG_USE3, + "mls", "r!0d, r!1d, r!2d, r!3d", 2), ENCODING_MAP(kThumb2Umull, 0xfba00000, kFmtBitBlt, 15, 12, kFmtBitBlt, 11, 8, kFmtBitBlt, 19, 16, kFmtBitBlt, 3, 0, IS_QUAD_OP | REG_DEF0 | REG_DEF1 | REG_USE2 | REG_USE3, "umull", "r!0d, r!1d, r!2d, r!3d", 2), + ENCODING_MAP(kThumb2SdivRRR, 0xfb90f0f0, + kFmtBitBlt, 11, 8, kFmtBitBlt, 19, 16, kFmtBitBlt, 3, 0, + kFmtUnused, -1, -1, + IS_TERTIARY_OP | REG_DEF0_USE12, + "sdiv", "r!0d, r!1d, r!2d", 2), + ENCODING_MAP(kThumb2UdivRRR, 0xfbb0f0f0, + kFmtBitBlt, 19, 16, kFmtBitBlt, 11, 8, kFmtBitBlt, 3, 0, + kFmtUnused, -1, -1, + IS_TERTIARY_OP | REG_DEF0 | REG_USE1 | REG_USE2, + "udiv", "r!0d, r!1d, r!2d", 2), ENCODING_MAP(kThumb2Ldrex, 0xe8500f00, kFmtBitBlt, 15, 12, kFmtBitBlt, 19, 16, kFmtBitBlt, 7, 0, kFmtUnused, -1, -1, IS_TERTIARY_OP | REG_DEF0_USE1 | IS_LOAD, diff --git a/vm/compiler/codegen/arm/CodegenDriver.cpp b/vm/compiler/codegen/arm/CodegenDriver.cpp index 44a48f7d0..499ac4928 100644 --- a/vm/compiler/codegen/arm/CodegenDriver.cpp +++ b/vm/compiler/codegen/arm/CodegenDriver.cpp @@ -362,7 +362,7 @@ static void genIGet(CompilationUnit *cUnit, MIR *mir, OpSize size, size, rlObj.sRegLow); HEAP_ACCESS_SHADOW(false); if (isVolatile) { - dvmCompilerGenMemBarrier(cUnit, kSY); + dvmCompilerGenMemBarrier(cUnit, kISH); } storeValue(cUnit, rlDest, rlResult); @@ -384,13 +384,13 @@ static void genIPut(CompilationUnit *cUnit, MIR *mir, OpSize size, NULL);/* null object? */ if (isVolatile) { - dvmCompilerGenMemBarrier(cUnit, kST); + dvmCompilerGenMemBarrier(cUnit, kISHST); } HEAP_ACCESS_SHADOW(true); storeBaseDisp(cUnit, rlObj.lowReg, fieldOffset, rlSrc.lowReg, size); HEAP_ACCESS_SHADOW(false); if (isVolatile) { - dvmCompilerGenMemBarrier(cUnit, kSY); + dvmCompilerGenMemBarrier(cUnit, kISH); } if (isObject) { /* NOTE: marking card based on object head */ @@ -780,9 +780,10 @@ static bool genArithOpInt(CompilationUnit *cUnit, MIR *mir, bool checkZero = false; bool unary = false; int retReg = r0; - int (*callTgt)(int, int); + int (*callTgt)(int, int) = NULL; RegLocation rlResult; bool shiftOp = false; + bool remOp = false; switch (mir->dalvikInsn.opcode) { case OP_NEG_INT: @@ -807,18 +808,27 @@ static bool genArithOpInt(CompilationUnit *cUnit, MIR *mir, break; case OP_DIV_INT: case OP_DIV_INT_2ADDR: +#ifdef __ARM_ARCH_EXT_IDIV__ + op = kOpDiv; +#else callOut = true; - checkZero = true; callTgt = __aeabi_idiv; retReg = r0; +#endif + checkZero = true; break; /* NOTE: returns in r1 */ case OP_REM_INT: case OP_REM_INT_2ADDR: +#ifdef __ARM_ARCH_EXT_IDIV__ + op = kOpRem; + remOp = true; +#else callOut = true; - checkZero = true; callTgt = __aeabi_idivmod; retReg = r1; +#endif + checkZero = true; break; case OP_AND_INT: case OP_AND_INT_2ADDR: @@ -860,6 +870,11 @@ static bool genArithOpInt(CompilationUnit *cUnit, MIR *mir, rlSrc1.lowReg); } else { rlSrc2 = loadValue(cUnit, rlSrc2, kCoreReg); +#ifdef __ARM_ARCH_EXT_IDIV__ + if (checkZero) { + genNullCheck(cUnit, rlSrc2.sRegLow, r1, mir->offset, NULL); + } +#endif if (shiftOp) { int tReg = dvmCompilerAllocTemp(cUnit); opRegRegImm(cUnit, kOpAnd, tReg, rlSrc2.lowReg, 31); @@ -867,6 +882,14 @@ static bool genArithOpInt(CompilationUnit *cUnit, MIR *mir, opRegRegReg(cUnit, op, rlResult.lowReg, rlSrc1.lowReg, tReg); dvmCompilerFreeTemp(cUnit, tReg); + } else if(remOp) { + int tReg = dvmCompilerAllocTemp(cUnit); + opRegRegReg(cUnit, kOpDiv, tReg, + rlSrc1.lowReg, rlSrc2.lowReg); + rlResult = dvmCompilerEvalLoc(cUnit, rlDest, kCoreReg, true); + opRegRegRegReg(cUnit, op, rlResult.lowReg, + rlSrc2.lowReg, tReg, rlSrc1.lowReg); + dvmCompilerFreeTemp(cUnit, tReg); } else { rlResult = dvmCompilerEvalLoc(cUnit, rlDest, kCoreReg, true); opRegRegReg(cUnit, op, rlResult.lowReg, @@ -1490,7 +1513,7 @@ static bool handleFmt10x(CompilationUnit *cUnit, MIR *mir) } switch (dalvikOpcode) { case OP_RETURN_VOID_BARRIER: - dvmCompilerGenMemBarrier(cUnit, kST); + dvmCompilerGenMemBarrier(cUnit, kISHST); // Intentional fallthrough case OP_RETURN_VOID: genReturnCommon(cUnit,mir); @@ -1664,7 +1687,7 @@ static bool handleFmt21c_Fmt31c(CompilationUnit *cUnit, MIR *mir) loadConstant(cUnit, tReg, (int) fieldPtr + valOffset); if (isVolatile) { - dvmCompilerGenMemBarrier(cUnit, kSY); + dvmCompilerGenMemBarrier(cUnit, kISH); } HEAP_ACCESS_SHADOW(true); loadWordDisp(cUnit, tReg, 0, rlResult.lowReg); @@ -1742,14 +1765,14 @@ static bool handleFmt21c_Fmt31c(CompilationUnit *cUnit, MIR *mir) loadWordDisp(cUnit, tReg, OFFSETOF_MEMBER(Field, clazz), objHead); } if (isVolatile) { - dvmCompilerGenMemBarrier(cUnit, kST); + dvmCompilerGenMemBarrier(cUnit, kISHST); } HEAP_ACCESS_SHADOW(true); storeWordDisp(cUnit, tReg, valOffset ,rlSrc.lowReg); dvmCompilerFreeTemp(cUnit, tReg); HEAP_ACCESS_SHADOW(false); if (isVolatile) { - dvmCompilerGenMemBarrier(cUnit, kSY); + dvmCompilerGenMemBarrier(cUnit, kISH); } if (isSputObject) { /* NOTE: marking card based sfield->clazz */ @@ -2273,6 +2296,7 @@ static bool handleFmt22b_Fmt22s(CompilationUnit *cUnit, MIR *mir) OpKind op = (OpKind)0; /* Make gcc happy */ int shiftOp = false; bool isDiv = false; + bool isRem = false; switch (dalvikOpcode) { case OP_RSUB_INT_LIT8: @@ -2342,6 +2366,17 @@ static bool handleFmt22b_Fmt22s(CompilationUnit *cUnit, MIR *mir) if (handleEasyDivide(cUnit, dalvikOpcode, rlSrc, rlDest, lit)) { return false; } +#ifdef __ARM_ARCH_EXT_IDIV__ + if ((dalvikOpcode == OP_DIV_INT_LIT8) || + (dalvikOpcode == OP_DIV_INT_LIT16)) { + op = kOpDiv; + } + else { + isRem = true; + op = kOpRem; + } + break; +#endif dvmCompilerFlushAllRegs(cUnit); /* Everything to home location */ loadValueDirectFixed(cUnit, rlSrc, r0); dvmCompilerClobber(cUnit, r0); @@ -2371,6 +2406,15 @@ static bool handleFmt22b_Fmt22s(CompilationUnit *cUnit, MIR *mir) // Avoid shifts by literal 0 - no support in Thumb. Change to copy if (shiftOp && (lit == 0)) { genRegCopy(cUnit, rlResult.lowReg, rlSrc.lowReg); + } else if(isRem) { + int tReg1 = dvmCompilerAllocTemp(cUnit); + int tReg2 = dvmCompilerAllocTemp(cUnit); + + loadConstant(cUnit, tReg2, lit); + opRegRegReg(cUnit, kOpDiv, tReg1, rlSrc.lowReg, tReg2); + opRegRegRegReg(cUnit, op, rlResult.lowReg, tReg2, tReg1, rlSrc.lowReg); + dvmCompilerFreeTemp(cUnit, tReg1); + dvmCompilerFreeTemp(cUnit, tReg2); } else { opRegRegImm(cUnit, op, rlResult.lowReg, rlSrc.lowReg, lit); } diff --git a/vm/compiler/codegen/arm/FP/Thumb2VFP.cpp b/vm/compiler/codegen/arm/FP/Thumb2VFP.cpp index abbf2c9b4..3ecb38114 100644 --- a/vm/compiler/codegen/arm/FP/Thumb2VFP.cpp +++ b/vm/compiler/codegen/arm/FP/Thumb2VFP.cpp @@ -108,6 +108,30 @@ static bool genArithOpDouble(CompilationUnit *cUnit, MIR *mir, return false; } +static bool genConversionL2D(CompilationUnit *cUnit, MIR *mir) +{ + int srcReg, tmp1, tmp2; + RegLocation rlSrc; + RegLocation rlDest; + RegLocation rlResult; + + rlSrc = dvmCompilerGetSrcWide(cUnit, mir, 0, 1); + rlSrc = loadValueWide(cUnit, rlSrc, kFPReg); + srcReg = S2D(rlSrc.lowReg, rlSrc.highReg); + rlDest = dvmCompilerGetDestWide(cUnit, mir, 0, 1); + rlResult = dvmCompilerEvalLoc(cUnit, rlDest, kFPReg, true); + tmp1 = dvmCompilerAllocTypedTempPair(cUnit, true, kFPReg); + tmp2 = dvmCompilerAllocTypedTempPair(cUnit, true, kFPReg); + newLIR2(cUnit, (ArmOpcode)kThumb2VcvtF64S32, tmp1, ((srcReg & 0xff)+1)); + newLIR2(cUnit, (ArmOpcode)kThumb2VcvtF64U32, S2D(rlResult.lowReg, rlResult.highReg), + (srcReg & 0xff)); + loadConstantValueWide(cUnit, (tmp2 & 0xff), ((tmp2 >> 8) & 0xff), 0x0, 0x41f00000); + newLIR3(cUnit, (ArmOpcode)kThumb2VmlaF64, S2D(rlResult.lowReg, rlResult.highReg), + tmp1, tmp2); + storeValueWide(cUnit, rlDest, rlResult); + return false; +} + static bool genConversion(CompilationUnit *cUnit, MIR *mir) { Opcode opcode = mir->dalvikInsn.opcode; @@ -151,6 +175,7 @@ static bool genConversion(CompilationUnit *cUnit, MIR *mir) op = kThumb2VcvtDI; break; case OP_LONG_TO_DOUBLE: + return genConversionL2D(cUnit, mir); case OP_FLOAT_TO_LONG: case OP_LONG_TO_FLOAT: case OP_DOUBLE_TO_LONG: diff --git a/vm/compiler/codegen/arm/Thumb2/Factory.cpp b/vm/compiler/codegen/arm/Thumb2/Factory.cpp index b9265e823..cc036cb8b 100644 --- a/vm/compiler/codegen/arm/Thumb2/Factory.cpp +++ b/vm/compiler/codegen/arm/Thumb2/Factory.cpp @@ -352,6 +352,10 @@ static ArmLIR *opRegRegShift(CompilationUnit *cUnit, OpKind op, int rDestSrc1, assert(shift == 0); opcode = (thumbForm) ? kThumbMul : kThumb2MulRRR; break; + case kOpDiv: + assert(shift == 0); + opcode = kThumb2SdivRRR; + break; case kOpMvn: opcode = (thumbForm) ? kThumbMvn : kThumb2MnvRR; break; @@ -454,6 +458,13 @@ static ArmLIR *opRegRegRegShift(CompilationUnit *cUnit, OpKind op, assert(shift == 0); opcode = kThumb2MulRRR; break; + case kOpDiv: + assert(shift == 0); + opcode = kThumb2SdivRRR; + break; + case kOpRem: + opcode = kThumb2MlsRRRR; + break; case kOpOr: opcode = kThumb2OrrRRR; break; @@ -495,6 +506,12 @@ static ArmLIR *opRegRegReg(CompilationUnit *cUnit, OpKind op, int rDest, return opRegRegRegShift(cUnit, op, rDest, rSrc1, rSrc2, 0); } +static ArmLIR *opRegRegRegReg(CompilationUnit *cUnit, OpKind op, int rDest, + int rSrc1, int rSrc2, int rSrc3) +{ + return opRegRegRegShift(cUnit, op, rDest, rSrc1, rSrc2, rSrc3); +} + static ArmLIR *opRegRegImm(CompilationUnit *cUnit, OpKind op, int rDest, int rSrc1, int value) { @@ -586,6 +603,10 @@ static ArmLIR *opRegRegImm(CompilationUnit *cUnit, OpKind op, int rDest, modImm = -1; altOpcode = kThumb2MulRRR; break; + case kOpDiv: + modImm = -1; + altOpcode = kThumb2SdivRRR; + break; case kOpCmp: { int modImm = modifiedImmediate(value); ArmLIR *res; diff --git a/vm/compiler/codegen/arm/Thumb2/Gen.cpp b/vm/compiler/codegen/arm/Thumb2/Gen.cpp index 950da906c..4154483f2 100644 --- a/vm/compiler/codegen/arm/Thumb2/Gen.cpp +++ b/vm/compiler/codegen/arm/Thumb2/Gen.cpp @@ -257,7 +257,7 @@ static void genMonitorEnter(CompilationUnit *cUnit, MIR *mir) LW_LOCK_OWNER_SHIFT - 1); hopBranch = newLIR2(cUnit, kThumb2Cbnz, r2, 0); newLIR4(cUnit, kThumb2Strex, r2, r3, r1, offsetof(Object, lock) >> 2); - dvmCompilerGenMemBarrier(cUnit, kSY); + dvmCompilerGenMemBarrier(cUnit, kISH); branch = newLIR2(cUnit, kThumb2Cbz, r2, 0); hopTarget = newLIR0(cUnit, kArmPseudoTargetLabel); @@ -312,7 +312,7 @@ static void genMonitorExit(CompilationUnit *cUnit, MIR *mir) LW_LOCK_OWNER_SHIFT - 1); opRegReg(cUnit, kOpSub, r2, r3); hopBranch = opCondBranch(cUnit, kArmCondNe); - dvmCompilerGenMemBarrier(cUnit, kSY); + dvmCompilerGenMemBarrier(cUnit, kISH); storeWordDisp(cUnit, r1, offsetof(Object, lock), r7); branch = opNone(cUnit, kOpUncondBr); diff --git a/vm/compiler/codegen/mips/ArchUtility.cpp b/vm/compiler/codegen/mips/ArchUtility.cpp index 1f6d59376..47c4c6de1 100644 --- a/vm/compiler/codegen/mips/ArchUtility.cpp +++ b/vm/compiler/codegen/mips/ArchUtility.cpp @@ -38,6 +38,7 @@ static void buildInsnString(const char *fmt, MipsLIR *lir, char* buf, char *bufEnd = &buf[size-1]; const char *fmtEnd = &fmt[strlen(fmt)]; char tbuf[256]; + const char *name; char nc; while (fmt < fmtEnd) { int operand; @@ -142,6 +143,32 @@ static void buildInsnString(const char *fmt, MipsLIR *lir, char* buf, assert(operand >= 0 && operand < MIPS_REG_COUNT); strcpy(tbuf, mipsRegName[operand]); break; + case 'B': + switch (operand) { + case kSY: + name = "0/sy"; + break; + case kWMB: + name = "4/wmb"; + break; + case kMB: + name = "16/mb"; + break; + case kACQUIRE: + name = "17/acquire"; + break; + case kRELEASE: + name = "18/release"; + break; + case kRMB: + name = "19/rmb"; + break; + default: + name = "DecodeError"; + break; + } + strcpy(tbuf, name); + break; default: strcpy(tbuf,"DecodeError"); break; diff --git a/vm/compiler/codegen/mips/Assemble.cpp b/vm/compiler/codegen/mips/Assemble.cpp index 713bced68..36a301c9a 100644 --- a/vm/compiler/codegen/mips/Assemble.cpp +++ b/vm/compiler/codegen/mips/Assemble.cpp @@ -73,6 +73,7 @@ * n -> complimented Thumb2 modified immediate * M -> Thumb2 16-bit zero-extended immediate * b -> 4-digit binary + * B -> sync option string (SY, WMB, MB, ACQUIRE, RELEASE, RMB) * * [!] escape. To insert "!", use "!!" */ @@ -294,6 +295,10 @@ MipsEncodingMap EncodingMap[kMipsLast] = { kFmtBitBlt, 20, 16, kFmtBitBlt, 15, 0, kFmtBitBlt, 25, 21, kFmtUnused, -1, -1, IS_TERTIARY_OP | REG_USE02 | IS_STORE, "sw", "!0r,!1d(!2r)", 2), + ENCODING_MAP(kMipsSync, 0x0000000F, + kFmtBitBlt, 10, 6, kFmtUnused, -1, -1, kFmtUnused, -1, -1, + kFmtUnused, -1, -1, IS_UNARY_OP, + "sync", "!0B", 2), ENCODING_MAP(kMipsXor, 0x00000026, kFmtBitBlt, 15, 11, kFmtBitBlt, 25, 21, kFmtBitBlt, 20, 16, kFmtUnused, -1, -1, IS_TERTIARY_OP | REG_DEF0_USE12, diff --git a/vm/compiler/codegen/mips/CodegenDriver.cpp b/vm/compiler/codegen/mips/CodegenDriver.cpp index 62a9a4fb9..273a154e2 100644 --- a/vm/compiler/codegen/mips/CodegenDriver.cpp +++ b/vm/compiler/codegen/mips/CodegenDriver.cpp @@ -428,7 +428,7 @@ static void genIGet(CompilationUnit *cUnit, MIR *mir, OpSize size, size, rlObj.sRegLow); HEAP_ACCESS_SHADOW(false); if (isVolatile) { - dvmCompilerGenMemBarrier(cUnit, 0); + dvmCompilerGenMemBarrier(cUnit, kSY); } storeValue(cUnit, rlDest, rlResult); @@ -450,13 +450,13 @@ static void genIPut(CompilationUnit *cUnit, MIR *mir, OpSize size, NULL);/* null object? */ if (isVolatile) { - dvmCompilerGenMemBarrier(cUnit, 0); + dvmCompilerGenMemBarrier(cUnit, kSY); } HEAP_ACCESS_SHADOW(true); storeBaseDisp(cUnit, rlObj.lowReg, fieldOffset, rlSrc.lowReg, size); HEAP_ACCESS_SHADOW(false); if (isVolatile) { - dvmCompilerGenMemBarrier(cUnit, 0); + dvmCompilerGenMemBarrier(cUnit, kSY); } if (isObject) { /* NOTE: marking card based on object head */ @@ -1558,7 +1558,7 @@ static bool handleFmt10x(CompilationUnit *cUnit, MIR *mir) } switch (dalvikOpcode) { case OP_RETURN_VOID_BARRIER: - dvmCompilerGenMemBarrier(cUnit, 0); + dvmCompilerGenMemBarrier(cUnit, kSY); // Intentional fallthrough case OP_RETURN_VOID: genReturnCommon(cUnit,mir); @@ -1732,7 +1732,7 @@ static bool handleFmt21c_Fmt31c(CompilationUnit *cUnit, MIR *mir) loadConstant(cUnit, tReg, (int) fieldPtr + valOffset); if (isVolatile) { - dvmCompilerGenMemBarrier(cUnit, 0); + dvmCompilerGenMemBarrier(cUnit, kSY); } HEAP_ACCESS_SHADOW(true); loadWordDisp(cUnit, tReg, 0, rlResult.lowReg); @@ -1810,14 +1810,14 @@ static bool handleFmt21c_Fmt31c(CompilationUnit *cUnit, MIR *mir) loadWordDisp(cUnit, tReg, OFFSETOF_MEMBER(Field, clazz), objHead); } if (isVolatile) { - dvmCompilerGenMemBarrier(cUnit, 0); + dvmCompilerGenMemBarrier(cUnit, kSY); } HEAP_ACCESS_SHADOW(true); storeWordDisp(cUnit, tReg, valOffset ,rlSrc.lowReg); dvmCompilerFreeTemp(cUnit, tReg); HEAP_ACCESS_SHADOW(false); if (isVolatile) { - dvmCompilerGenMemBarrier(cUnit, 0); + dvmCompilerGenMemBarrier(cUnit, kSY); } if (isSputObject) { /* NOTE: marking card based sfield->clazz */ diff --git a/vm/compiler/codegen/mips/MipsLIR.h b/vm/compiler/codegen/mips/MipsLIR.h index fc82da255..de407552d 100644 --- a/vm/compiler/codegen/mips/MipsLIR.h +++ b/vm/compiler/codegen/mips/MipsLIR.h @@ -457,6 +457,7 @@ typedef enum MipsOpCode { kMipsSrlv, /* srlv d,t,s [000000] s[25..21] t[20..16] d[15..11] [00000000110] */ kMipsSubu, /* subu d,s,t [000000] s[25..21] t[20..16] d[15..11] [00000100011] */ kMipsSw, /* sw t,o(b) [101011] b[25..21] t[20..16] o[15..0] */ + kMipsSync, /* sync hint [000000000000000000000] hint[10..6] [001111] */ kMipsXor, /* xor d,s,t [000000] s[25..21] t[20..16] d[15..11] [00000100110] */ kMipsXori, /* xori t,s,imm16 [001110] s[25..21] t[20..16] imm16[15..0] */ #ifdef __mips_hard_float @@ -487,6 +488,24 @@ typedef enum MipsOpCode { kMipsLast } MipsOpCode; +/* Sync option encodings */ +typedef enum MipsSyncOptions { + /* + * sync guarantees ordering of Load/Store operations wrt itself + * + * Older: instruction classes that must be ordered before the sync instruction completes + * Younger: instruction classes that must be ordered after the sync instruction completes + * Global: instruction classes that must be performed globally when the sync completes + */ + /* Older Younger Global */ + kSY = 0x00, /* Load,Store Load,Store Load,Store */ + kWMB = 0x04, /* Store Store */ + kMB = 0x10, /* Load,Store Load,Store */ + kACQUIRE = 0x11, /* Load Load,Store */ + kRELEASE = 0x12, /* Load,Store Store */ + kRMB = 0x13 /* Load Load */ +} MipsSyncOptions; + /* Bit flags describing the behavior of each native opcode */ typedef enum MipsOpFeatureFlags { kIsBranch = 0, diff --git a/vm/compiler/codegen/mips/mips/ArchVariant.cpp b/vm/compiler/codegen/mips/mips/ArchVariant.cpp index 10f5da10d..473b88e8b 100644 --- a/vm/compiler/codegen/mips/mips/ArchVariant.cpp +++ b/vm/compiler/codegen/mips/mips/ArchVariant.cpp @@ -109,5 +109,8 @@ int dvmCompilerTargetOptHint(int key) void dvmCompilerGenMemBarrier(CompilationUnit *cUnit, int barrierKind) { - __asm__ __volatile__ ("" : : : "memory"); +#if ANDROID_SMP != 0 + MipsLIR *sync = newLIR1(cUnit, kMipsSync, barrierKind); + sync->defMask = ENCODE_ALL; +#endif } diff --git a/vm/compiler/template/mips/TEMPLATE_CMPL_DOUBLE_VFP.S b/vm/compiler/template/mips/TEMPLATE_CMPL_DOUBLE_VFP.S index 0a1dd68ff..ee8f99efe 100644 --- a/vm/compiler/template/mips/TEMPLATE_CMPL_DOUBLE_VFP.S +++ b/vm/compiler/template/mips/TEMPLATE_CMPL_DOUBLE_VFP.S @@ -48,15 +48,15 @@ li rTEMP, 1 # vAA<- 1 bgtz v0, ${opcode}_finish #else - LOAD64_F(fs0, fs0f, a0) # fs0<- vBB - LOAD64_F(fs1, fs1f, a1) # fs1<- vCC - c.olt.d fcc0, fs0, fs1 # Is fs0 < fs1 + LOAD64_F(ft0, ft0f, a0) # ft0<- vBB + LOAD64_F(ft1, ft1f, a1) # ft1<- vCC + c.olt.d fcc0, ft0, ft1 # Is ft0 < ft1 li rTEMP, -1 bc1t fcc0, ${opcode}_finish - c.olt.d fcc0, fs1, fs0 + c.olt.d fcc0, ft1, ft0 li rTEMP, 1 bc1t fcc0, ${opcode}_finish - c.eq.d fcc0, fs0, fs1 + c.eq.d fcc0, ft0, ft1 li rTEMP, 0 bc1t fcc0, ${opcode}_finish #endif diff --git a/vm/compiler/template/mips/TEMPLATE_CMPL_FLOAT_VFP.S b/vm/compiler/template/mips/TEMPLATE_CMPL_FLOAT_VFP.S index 7ef772388..d509ea6ef 100644 --- a/vm/compiler/template/mips/TEMPLATE_CMPL_FLOAT_VFP.S +++ b/vm/compiler/template/mips/TEMPLATE_CMPL_FLOAT_VFP.S @@ -48,15 +48,15 @@ li rTEMP, 1 # vAA<- 1 bgtz v0, ${opcode}_finish #else - LOAD_F(fs0, a0) # fs0<- vBB - LOAD_F(fs1, a1) # fs1<- vCC - c.olt.s fcc0, fs0, fs1 #Is fs0 < fs1 + LOAD_F(ft0, a0) # ft0<- vBB + LOAD_F(ft1, a1) # ft1<- vCC + c.olt.s fcc0, ft0, ft1 #Is ft0 < ft1 li rTEMP, -1 bc1t fcc0, ${opcode}_finish - c.olt.s fcc0, fs1, fs0 + c.olt.s fcc0, ft1, ft0 li rTEMP, 1 bc1t fcc0, ${opcode}_finish - c.eq.s fcc0, fs0, fs1 + c.eq.s fcc0, ft0, ft1 li rTEMP, 0 bc1t fcc0, ${opcode}_finish #endif diff --git a/vm/compiler/template/mips/header.S b/vm/compiler/template/mips/header.S index de4a0519c..39419f64d 100644 --- a/vm/compiler/template/mips/header.S +++ b/vm/compiler/template/mips/header.S @@ -23,8 +23,6 @@ #include "../../../mterp/common/asm-constants.h" #include "../../../mterp/common/mips-defines.h" #include "../../../mterp/common/jit-config.h" -#include <asm/regdef.h> -#include <asm/fpregdef.h> #ifdef __mips_hard_float #define HARD_FLOAT diff --git a/vm/compiler/template/out/CompilerTemplateAsm-mips.S b/vm/compiler/template/out/CompilerTemplateAsm-mips.S index d7f9d62a9..4daf5ce02 100644 --- a/vm/compiler/template/out/CompilerTemplateAsm-mips.S +++ b/vm/compiler/template/out/CompilerTemplateAsm-mips.S @@ -30,8 +30,6 @@ #include "../../../mterp/common/asm-constants.h" #include "../../../mterp/common/mips-defines.h" #include "../../../mterp/common/jit-config.h" -#include <asm/regdef.h> -#include <asm/fpregdef.h> #ifdef __mips_hard_float #define HARD_FLOAT @@ -1780,15 +1778,15 @@ dvmCompiler_TEMPLATE_CMPG_DOUBLE_VFP: li rTEMP, 1 # vAA<- 1 bgtz v0, TEMPLATE_CMPG_DOUBLE_VFP_finish #else - LOAD64_F(fs0, fs0f, a0) # fs0<- vBB - LOAD64_F(fs1, fs1f, a1) # fs1<- vCC - c.olt.d fcc0, fs0, fs1 # Is fs0 < fs1 + LOAD64_F(ft0, ft0f, a0) # ft0<- vBB + LOAD64_F(ft1, ft1f, a1) # ft1<- vCC + c.olt.d fcc0, ft0, ft1 # Is ft0 < ft1 li rTEMP, -1 bc1t fcc0, TEMPLATE_CMPG_DOUBLE_VFP_finish - c.olt.d fcc0, fs1, fs0 + c.olt.d fcc0, ft1, ft0 li rTEMP, 1 bc1t fcc0, TEMPLATE_CMPG_DOUBLE_VFP_finish - c.eq.d fcc0, fs0, fs1 + c.eq.d fcc0, ft0, ft1 li rTEMP, 0 bc1t fcc0, TEMPLATE_CMPG_DOUBLE_VFP_finish #endif @@ -1850,15 +1848,15 @@ dvmCompiler_TEMPLATE_CMPL_DOUBLE_VFP: li rTEMP, 1 # vAA<- 1 bgtz v0, TEMPLATE_CMPL_DOUBLE_VFP_finish #else - LOAD64_F(fs0, fs0f, a0) # fs0<- vBB - LOAD64_F(fs1, fs1f, a1) # fs1<- vCC - c.olt.d fcc0, fs0, fs1 # Is fs0 < fs1 + LOAD64_F(ft0, ft0f, a0) # ft0<- vBB + LOAD64_F(ft1, ft1f, a1) # ft1<- vCC + c.olt.d fcc0, ft0, ft1 # Is ft0 < ft1 li rTEMP, -1 bc1t fcc0, TEMPLATE_CMPL_DOUBLE_VFP_finish - c.olt.d fcc0, fs1, fs0 + c.olt.d fcc0, ft1, ft0 li rTEMP, 1 bc1t fcc0, TEMPLATE_CMPL_DOUBLE_VFP_finish - c.eq.d fcc0, fs0, fs1 + c.eq.d fcc0, ft0, ft1 li rTEMP, 0 bc1t fcc0, TEMPLATE_CMPL_DOUBLE_VFP_finish #endif @@ -1920,15 +1918,15 @@ dvmCompiler_TEMPLATE_CMPG_FLOAT_VFP: li rTEMP, 1 # vAA<- 1 bgtz v0, TEMPLATE_CMPG_FLOAT_VFP_finish #else - LOAD_F(fs0, a0) # fs0<- vBB - LOAD_F(fs1, a1) # fs1<- vCC - c.olt.s fcc0, fs0, fs1 #Is fs0 < fs1 + LOAD_F(ft0, a0) # ft0<- vBB + LOAD_F(ft1, a1) # ft1<- vCC + c.olt.s fcc0, ft0, ft1 #Is ft0 < ft1 li rTEMP, -1 bc1t fcc0, TEMPLATE_CMPG_FLOAT_VFP_finish - c.olt.s fcc0, fs1, fs0 + c.olt.s fcc0, ft1, ft0 li rTEMP, 1 bc1t fcc0, TEMPLATE_CMPG_FLOAT_VFP_finish - c.eq.s fcc0, fs0, fs1 + c.eq.s fcc0, ft0, ft1 li rTEMP, 0 bc1t fcc0, TEMPLATE_CMPG_FLOAT_VFP_finish #endif @@ -1990,15 +1988,15 @@ dvmCompiler_TEMPLATE_CMPL_FLOAT_VFP: li rTEMP, 1 # vAA<- 1 bgtz v0, TEMPLATE_CMPL_FLOAT_VFP_finish #else - LOAD_F(fs0, a0) # fs0<- vBB - LOAD_F(fs1, a1) # fs1<- vCC - c.olt.s fcc0, fs0, fs1 #Is fs0 < fs1 + LOAD_F(ft0, a0) # ft0<- vBB + LOAD_F(ft1, a1) # ft1<- vCC + c.olt.s fcc0, ft0, ft1 #Is ft0 < ft1 li rTEMP, -1 bc1t fcc0, TEMPLATE_CMPL_FLOAT_VFP_finish - c.olt.s fcc0, fs1, fs0 + c.olt.s fcc0, ft1, ft0 li rTEMP, 1 bc1t fcc0, TEMPLATE_CMPL_FLOAT_VFP_finish - c.eq.s fcc0, fs0, fs1 + c.eq.s fcc0, ft0, ft1 li rTEMP, 0 bc1t fcc0, TEMPLATE_CMPL_FLOAT_VFP_finish #endif diff --git a/vm/interp/Stack.cpp b/vm/interp/Stack.cpp index 1433f13dc..ef0a0de87 100644 --- a/vm/interp/Stack.cpp +++ b/vm/interp/Stack.cpp @@ -26,7 +26,8 @@ #include <stdarg.h> #ifdef HAVE_ANDROID_OS -#include <corkscrew/backtrace.h> +#include <backtrace/Backtrace.h> +#include "UniquePtr.h" #endif /* @@ -1389,23 +1390,14 @@ void dvmDumpRunningThreadStack(const DebugOutputTarget* target, Thread* thread) void dvmDumpNativeStack(const DebugOutputTarget* target, pid_t tid) { #ifdef HAVE_ANDROID_OS - const size_t MAX_DEPTH = 32; - backtrace_frame_t backtrace[MAX_DEPTH]; - ssize_t frames = unwind_backtrace_thread(tid, backtrace, 0, MAX_DEPTH); - if (frames > 0) { - backtrace_symbol_t backtrace_symbols[MAX_DEPTH]; - get_backtrace_symbols(backtrace, frames, backtrace_symbols); - - for (size_t i = 0; i < size_t(frames); i++) { - char line[MAX_BACKTRACE_LINE_LENGTH]; - format_backtrace_line(i, &backtrace[i], &backtrace_symbols[i], - line, MAX_BACKTRACE_LINE_LENGTH); - dvmPrintDebugMessage(target, " %s\n", line); - } - - free_backtrace_symbols(backtrace_symbols, frames); - } else { + UniquePtr<Backtrace> backtrace(Backtrace::Create(BACKTRACE_CURRENT_PROCESS, tid)); + if (!backtrace->Unwind(0) || backtrace->NumFrames() == 0) { dvmPrintDebugMessage(target, " (native backtrace unavailable)\n"); + } else { + for (size_t i = 0; i < backtrace->NumFrames(); i++) { + dvmPrintDebugMessage(target, " %s\n", + backtrace->FormatFrameData(i).c_str()); + } } #endif } diff --git a/vm/mterp/arm-vfp/OP_LONG_TO_DOUBLE.S b/vm/mterp/arm-vfp/OP_LONG_TO_DOUBLE.S new file mode 100644 index 000000000..3ed3b194b --- /dev/null +++ b/vm/mterp/arm-vfp/OP_LONG_TO_DOUBLE.S @@ -0,0 +1,28 @@ +%default {} +%verify "executed" + /* + * Specialised 64-bit floating point operation. + * + * Note: The result will be returned in d2. + * + * For: long-to-double + */ + mov r3, rINST, lsr #12 @ r3<- B + ubfx r9, rINST, #8, #4 @ r9<- A + add r3, rFP, r3, lsl #2 @ r3<- &fp[B] + add r9, rFP, r9, lsl #2 @ r9<- &fp[A] + vldr d0, [r3] @ d0<- vAA + FETCH_ADVANCE_INST(1) @ advance rPC, load rINST + + vcvt.f64.s32 d1, s1 @ d1<- (double)(vAAh) + vcvt.f64.u32 d2, s0 @ d2<- (double)(vAAl) + vldr d3, constval$opcode + vmla.f64 d2, d1, d3 @ d2<- vAAh*2^32 + vAAl + + GET_INST_OPCODE(ip) @ extract opcode from rINST + vstr.64 d2, [r9] @ vAA<- d2 + GOTO_OPCODE(ip) @ jump to next instruction + + /* literal pool helper */ +constval${opcode}: + .8byte 0x41f0000000000000 diff --git a/vm/mterp/armv7-a/OP_DIV_INT.S b/vm/mterp/armv7-a/OP_DIV_INT.S new file mode 100644 index 000000000..9c88b2600 --- /dev/null +++ b/vm/mterp/armv7-a/OP_DIV_INT.S @@ -0,0 +1,31 @@ +%default {} +%verify "executed" + /* + * Specialized 32-bit binary operation + * + * Performs "r0 = r0 div r1". The selection between sdiv or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * div-int + * + */ + FETCH(r0, 1) @ r0<- CCBB + mov r9, rINST, lsr #8 @ r9<- AA + mov r3, r0, lsr #8 @ r3<- CC + and r2, r0, #255 @ r2<- BB + GET_VREG(r1, r3) @ r1<- vCC + GET_VREG(r0, r2) @ r0<- vBB + cmp r1, #0 @ is second operand zero? + beq common_errDivideByZero + + FETCH_ADVANCE_INST(2) @ advance rPC, load rINST +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r0, r0, r1 @ r0<- op +#else + bl __aeabi_idiv @ r0<- op, r0-r3 changed +#endif + GET_INST_OPCODE(ip) @ extract opcode from rINST + SET_VREG(r0, r9) @ vAA<- r0 + GOTO_OPCODE(ip) @ jump to next instruction + /* 11-14 instructions */ diff --git a/vm/mterp/armv7-a/OP_DIV_INT_2ADDR.S b/vm/mterp/armv7-a/OP_DIV_INT_2ADDR.S new file mode 100644 index 000000000..be6de6d11 --- /dev/null +++ b/vm/mterp/armv7-a/OP_DIV_INT_2ADDR.S @@ -0,0 +1,30 @@ +%default {} +%verify "executed" + /* + * Specialized 32-bit binary operation + * + * Performs "r0 = r0 div r1". The selection between sdiv or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * div-int/2addr + * + */ + mov r3, rINST, lsr #12 @ r3<- B + ubfx r9, rINST, #8, #4 @ r9<- A + GET_VREG(r1, r3) @ r1<- vB + GET_VREG(r0, r9) @ r0<- vA + cmp r1, #0 @ is second operand zero? + beq common_errDivideByZero + FETCH_ADVANCE_INST(1) @ advance rPC, load rINST + +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r0, r0, r1 @ r0<- op +#else + bl __aeabi_idiv @ r0<- op, r0-r3 changed +#endif + GET_INST_OPCODE(ip) @ extract opcode from rINST + SET_VREG(r0, r9) @ vAA<- r0 + GOTO_OPCODE(ip) @ jump to next instruction + /* 10-13 instructions */ + diff --git a/vm/mterp/armv7-a/OP_DIV_INT_LIT16.S b/vm/mterp/armv7-a/OP_DIV_INT_LIT16.S new file mode 100644 index 000000000..f140c3cf1 --- /dev/null +++ b/vm/mterp/armv7-a/OP_DIV_INT_LIT16.S @@ -0,0 +1,29 @@ +%default {} +%verify "executed" + /* + * Specialized 32-bit binary operation + * + * Performs "r0 = r0 div r1". The selection between sdiv or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * div-int/lit16 + * + */ + FETCH_S(r1, 1) @ r1<- ssssCCCC (sign-extended) + mov r2, rINST, lsr #12 @ r2<- B + ubfx r9, rINST, #8, #4 @ r9<- A + GET_VREG(r0, r2) @ r0<- vB + cmp r1, #0 @ is second operand zero? + beq common_errDivideByZero + FETCH_ADVANCE_INST(2) @ advance rPC, load rINST + +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r0, r0, r1 @ r0<- op +#else + bl __aeabi_idiv @ r0<- op, r0-r3 changed +#endif + GET_INST_OPCODE(ip) @ extract opcode from rINST + SET_VREG(r0, r9) @ vAA<- r0 + GOTO_OPCODE(ip) @ jump to next instruction + /* 10-13 instructions */ diff --git a/vm/mterp/armv7-a/OP_DIV_INT_LIT8.S b/vm/mterp/armv7-a/OP_DIV_INT_LIT8.S new file mode 100644 index 000000000..08d67fa4e --- /dev/null +++ b/vm/mterp/armv7-a/OP_DIV_INT_LIT8.S @@ -0,0 +1,30 @@ +%default {} +%verify "executed" + /* + * Specialized 32-bit binary operation + * + * Performs "r0 = r0 div r1". The selection between sdiv or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * div-int/lit8 + * + */ + FETCH_S(r3, 1) @ r3<- ssssCCBB (sign-extended for CC) + mov r9, rINST, lsr #8 @ r9<- AA + and r2, r3, #255 @ r2<- BB + GET_VREG(r0, r2) @ r0<- vBB + movs r1, r3, asr #8 @ r1<- ssssssCC (sign extended) + @cmp r1, #0 @ is second operand zero? + beq common_errDivideByZero + FETCH_ADVANCE_INST(2) @ advance rPC, load rINST + +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r0, r0, r1 @ r0<- op +#else + bl __aeabi_idiv @ r0<- op, r0-r3 changed +#endif + GET_INST_OPCODE(ip) @ extract opcode from rINST + SET_VREG(r0, r9) @ vAA<- r0 + GOTO_OPCODE(ip) @ jump to next instruction + /* 10-12 instructions */ diff --git a/vm/mterp/armv7-a/OP_REM_INT.S b/vm/mterp/armv7-a/OP_REM_INT.S new file mode 100644 index 000000000..cd033381c --- /dev/null +++ b/vm/mterp/armv7-a/OP_REM_INT.S @@ -0,0 +1,34 @@ +%default {} +%verify "executed" + /* + * Specialized 32-bit binary operation + * + * Performs "r1 = r0 rem r1". The selection between sdiv block or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * NOTE: idivmod returns quotient in r0 and remainder in r1 + * + * rem-int + * + */ + FETCH(r0, 1) @ r0<- CCBB + mov r9, rINST, lsr #8 @ r9<- AA + mov r3, r0, lsr #8 @ r3<- CC + and r2, r0, #255 @ r2<- BB + GET_VREG(r1, r3) @ r1<- vCC + GET_VREG(r0, r2) @ r0<- vBB + cmp r1, #0 @ is second operand zero? + beq common_errDivideByZero + + FETCH_ADVANCE_INST(2) @ advance rPC, load rINST +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r2, r0, r1 + mls r1, r1, r2, r0 @ r1<- op, r0-r2 changed +#else + bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#endif + GET_INST_OPCODE(ip) @ extract opcode from rINST + SET_VREG(r1, r9) @ vAA<- r1 + GOTO_OPCODE(ip) @ jump to next instruction + /* 11-14 instructions */ diff --git a/vm/mterp/armv7-a/OP_REM_INT_2ADDR.S b/vm/mterp/armv7-a/OP_REM_INT_2ADDR.S new file mode 100644 index 000000000..509964274 --- /dev/null +++ b/vm/mterp/armv7-a/OP_REM_INT_2ADDR.S @@ -0,0 +1,33 @@ +%default {} +%verify "executed" + /* + * Specialized 32-bit binary operation + * + * Performs "r1 = r0 rem r1". The selection between sdiv block or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * NOTE: idivmod returns quotient in r0 and remainder in r1 + * + * rem-int/2addr + * + */ + mov r3, rINST, lsr #12 @ r3<- B + ubfx r9, rINST, #8, #4 @ r9<- A + GET_VREG(r1, r3) @ r1<- vB + GET_VREG(r0, r9) @ r0<- vA + cmp r1, #0 @ is second operand zero? + beq common_errDivideByZero + FETCH_ADVANCE_INST(1) @ advance rPC, load rINST + +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r2, r0, r1 + mls r1, r1, r2, r0 @ r1<- op +#else + bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#endif + GET_INST_OPCODE(ip) @ extract opcode from rINST + SET_VREG(r1, r9) @ vAA<- r1 + GOTO_OPCODE(ip) @ jump to next instruction + /* 10-13 instructions */ + diff --git a/vm/mterp/armv7-a/OP_REM_INT_LIT16.S b/vm/mterp/armv7-a/OP_REM_INT_LIT16.S new file mode 100644 index 000000000..3fc86a405 --- /dev/null +++ b/vm/mterp/armv7-a/OP_REM_INT_LIT16.S @@ -0,0 +1,32 @@ +%default {} +%verify "executed" + /* + * Specialized 32-bit binary operation + * + * Performs "r1 = r0 rem r1". The selection between sdiv block or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * NOTE: idivmod returns quotient in r0 and remainder in r1 + * + * rem-int/lit16 + * + */ + FETCH_S(r1, 1) @ r1<- ssssCCCC (sign-extended) + mov r2, rINST, lsr #12 @ r2<- B + ubfx r9, rINST, #8, #4 @ r9<- A + GET_VREG(r0, r2) @ r0<- vB + cmp r1, #0 @ is second operand zero? + beq common_errDivideByZero + FETCH_ADVANCE_INST(2) @ advance rPC, load rINST + +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r2, r0, r1 + mls r1, r1, r2, r0 @ r1<- op +#else + bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#endif + GET_INST_OPCODE(ip) @ extract opcode from rINST + SET_VREG(r1, r9) @ vAA<- r1 + GOTO_OPCODE(ip) @ jump to next instruction + /* 10-13 instructions */ diff --git a/vm/mterp/armv7-a/OP_REM_INT_LIT8.S b/vm/mterp/armv7-a/OP_REM_INT_LIT8.S new file mode 100644 index 000000000..61bffff98 --- /dev/null +++ b/vm/mterp/armv7-a/OP_REM_INT_LIT8.S @@ -0,0 +1,33 @@ +%default {} +%verify "executed" + /* + * Specialized 32-bit binary operation + * + * Performs "r1 = r0 rem r1". The selection between sdiv block or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * NOTE: idivmod returns quotient in r0 and remainder in r1 + * + * rem-int/lit8 + * + */ + FETCH_S(r3, 1) @ r3<- ssssCCBB (sign-extended for CC) + mov r9, rINST, lsr #8 @ r9<- AA + and r2, r3, #255 @ r2<- BB + GET_VREG(r0, r2) @ r0<- vBB + movs r1, r3, asr #8 @ r1<- ssssssCC (sign extended) + @cmp r1, #0 @ is second operand zero? + beq common_errDivideByZero + FETCH_ADVANCE_INST(2) @ advance rPC, load rINST + +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r2, r0, r1 + mls r1, r1, r2, r0 @ r1<- op +#else + bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#endif + GET_INST_OPCODE(ip) @ extract opcode from rINST + SET_VREG(r1, r9) @ vAA<- r1 + GOTO_OPCODE(ip) @ jump to next instruction + /* 10-12 instructions */ diff --git a/vm/mterp/armv7-a/platform.S b/vm/mterp/armv7-a/platform.S index 96ff2c256..b11350aec 100644 --- a/vm/mterp/armv7-a/platform.S +++ b/vm/mterp/armv7-a/platform.S @@ -13,7 +13,7 @@ */ .macro SMP_DMB #if ANDROID_SMP != 0 - dmb + dmb ish #else /* not SMP */ #endif @@ -24,7 +24,7 @@ */ .macro SMP_DMB_ST #if ANDROID_SMP != 0 - dmb st + dmb ishst #else /* not SMP */ #endif diff --git a/vm/mterp/common/mips-defines.h b/vm/mterp/common/mips-defines.h index 1e11a30c3..90852ad01 100644 --- a/vm/mterp/common/mips-defines.h +++ b/vm/mterp/common/mips-defines.h @@ -1,3 +1,21 @@ +#include <machine/regdef.h> + +#define fp $30 + #define fcc0 $fcc0 #define fcc1 $fcc1 +#define fv0 $f0 +#define fv0f $f1 +#define fv1 $f2 +#define fv1f $f3 + +#define fa0 $f12 +#define fa0f $f13 +#define fa1 $f14 +#define fa1f $f15 + +#define ft0 $f4 +#define ft0f $f5 +#define ft1 $f6 +#define ft1f $f7 diff --git a/vm/mterp/config-armv7-a b/vm/mterp/config-armv7-a index eadaeca35..3f609ce0c 100644 --- a/vm/mterp/config-armv7-a +++ b/vm/mterp/config-armv7-a @@ -61,8 +61,10 @@ op-start armv5te op OP_CONST_4 armv6t2 op OP_DIV_DOUBLE_2ADDR armv6t2 op OP_DIV_FLOAT_2ADDR armv6t2 - op OP_DIV_INT_2ADDR armv6t2 - op OP_DIV_INT_LIT16 armv6t2 + op OP_DIV_INT armv7-a + op OP_DIV_INT_2ADDR armv7-a + op OP_DIV_INT_LIT16 armv7-a + op OP_DIV_INT_LIT8 armv7-a op OP_DIV_LONG_2ADDR armv6t2 op OP_DOUBLE_TO_FLOAT armv6t2 op OP_DOUBLE_TO_INT armv6t2 @@ -110,8 +112,10 @@ op-start armv5te op OP_OR_LONG_2ADDR armv6t2 op OP_REM_DOUBLE_2ADDR armv6t2 op OP_REM_FLOAT_2ADDR armv6t2 - op OP_REM_INT_2ADDR armv6t2 - op OP_REM_INT_LIT16 armv6t2 + op OP_REM_INT armv7-a + op OP_REM_INT_2ADDR armv7-a + op OP_REM_INT_LIT16 armv7-a + op OP_REM_INT_LIT8 armv7-a op OP_REM_LONG_2ADDR armv6t2 op OP_RSUB_INT armv6t2 op OP_SHL_INT_2ADDR armv6t2 diff --git a/vm/mterp/config-armv7-a-neon b/vm/mterp/config-armv7-a-neon index 5f91365e0..e91661a85 100644 --- a/vm/mterp/config-armv7-a-neon +++ b/vm/mterp/config-armv7-a-neon @@ -61,8 +61,10 @@ op-start armv5te op OP_CONST_4 armv6t2 op OP_DIV_DOUBLE_2ADDR armv6t2 op OP_DIV_FLOAT_2ADDR armv6t2 - op OP_DIV_INT_2ADDR armv6t2 - op OP_DIV_INT_LIT16 armv6t2 + op OP_DIV_INT armv7-a + op OP_DIV_INT_2ADDR armv7-a + op OP_DIV_INT_LIT16 armv7-a + op OP_DIV_INT_LIT8 armv7-a op OP_DIV_LONG_2ADDR armv6t2 op OP_DOUBLE_TO_FLOAT armv6t2 op OP_DOUBLE_TO_INT armv6t2 @@ -90,7 +92,7 @@ op-start armv5te op OP_IPUT_QUICK armv6t2 op OP_IPUT_WIDE armv6t2 op OP_IPUT_WIDE_QUICK armv6t2 - op OP_LONG_TO_DOUBLE armv6t2 + op OP_LONG_TO_DOUBLE arm-vfp op OP_LONG_TO_FLOAT armv6t2 op OP_MOVE armv6t2 op OP_MOVE_WIDE armv6t2 @@ -110,8 +112,10 @@ op-start armv5te op OP_OR_LONG_2ADDR armv6t2 op OP_REM_DOUBLE_2ADDR armv6t2 op OP_REM_FLOAT_2ADDR armv6t2 - op OP_REM_INT_2ADDR armv6t2 - op OP_REM_INT_LIT16 armv6t2 + op OP_REM_INT armv7-a + op OP_REM_INT_2ADDR armv7-a + op OP_REM_INT_LIT16 armv7-a + op OP_REM_INT_LIT8 armv7-a op OP_REM_LONG_2ADDR armv6t2 op OP_RSUB_INT armv6t2 op OP_SHL_INT_2ADDR armv6t2 diff --git a/vm/mterp/mips/OP_APUT_OBJECT.S b/vm/mterp/mips/OP_APUT_OBJECT.S index 1d5b06e50..03b6d3834 100644 --- a/vm/mterp/mips/OP_APUT_OBJECT.S +++ b/vm/mterp/mips/OP_APUT_OBJECT.S @@ -27,8 +27,8 @@ bnez rBIX, .L${opcode}_checks # yes, skip type checks .L${opcode}_finish: FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST sw rBIX, offArrayObject_contents(rOBJ) # vBB[vCC] <- vAA + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction %break diff --git a/vm/mterp/mips/OP_IGET.S b/vm/mterp/mips/OP_IGET.S index ba4fada1d..87dd9b83f 100644 --- a/vm/mterp/mips/OP_IGET.S +++ b/vm/mterp/mips/OP_IGET.S @@ -43,7 +43,7 @@ $barrier # acquiring load GET_OPA4(a2) # a2 <- A+ FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(a0, a2) # fp[A] <- a0 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction diff --git a/vm/mterp/mips/OP_IGET_QUICK.S b/vm/mterp/mips/OP_IGET_QUICK.S index 449079693..7d869caab 100644 --- a/vm/mterp/mips/OP_IGET_QUICK.S +++ b/vm/mterp/mips/OP_IGET_QUICK.S @@ -11,7 +11,7 @@ addu t0, a3, a1 # lw a0, 0(t0) # a0 <- obj.field (always 32 bits) FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(a0, a2) # fp[A] <- a0 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction diff --git a/vm/mterp/mips/OP_IPUT.S b/vm/mterp/mips/OP_IPUT.S index 626cc9229..375508915 100644 --- a/vm/mterp/mips/OP_IPUT.S +++ b/vm/mterp/mips/OP_IPUT.S @@ -41,10 +41,10 @@ # check object for null beqz rOBJ, common_errNullObject # object was null FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST addu rOBJ, rOBJ, a3 # form address $prebarrier # releasing store $store a0, (rOBJ) # obj.field (8/16/32 bits) <- a0 $postbarrier + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction diff --git a/vm/mterp/mips/OP_IPUT_OBJECT.S b/vm/mterp/mips/OP_IPUT_OBJECT.S index 0382fa8fe..829deabdb 100644 --- a/vm/mterp/mips/OP_IPUT_OBJECT.S +++ b/vm/mterp/mips/OP_IPUT_OBJECT.S @@ -42,11 +42,11 @@ # check object for null beqz rOBJ, common_errNullObject # object was null FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST addu t2, rOBJ, a3 # form address $prebarrier # releasing store $store a0, (t2) # obj.field (32 bits) <- a0 $postbarrier + GET_INST_OPCODE(t0) # extract opcode from rINST beqz a0, 1f # stored a null reference? srl t1, rOBJ, GC_CARD_SHIFT addu t2, a2, t1 diff --git a/vm/mterp/mips/OP_MOVE_RESULT_WIDE.S b/vm/mterp/mips/OP_MOVE_RESULT_WIDE.S index 8a548d1fc..56671e64b 100644 --- a/vm/mterp/mips/OP_MOVE_RESULT_WIDE.S +++ b/vm/mterp/mips/OP_MOVE_RESULT_WIDE.S @@ -5,7 +5,7 @@ EAS2(a2, rFP, a2) # a2 <- &fp[AA] LOAD64(a0, a1, a3) # a0/a1 <- retval.j FETCH_ADVANCE_INST(1) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST STORE64(a0, a1, a2) # fp[AA] <- a0/a1 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction diff --git a/vm/mterp/mips/OP_MOVE_WIDE.S b/vm/mterp/mips/OP_MOVE_WIDE.S index 747006125..0a2b1400c 100644 --- a/vm/mterp/mips/OP_MOVE_WIDE.S +++ b/vm/mterp/mips/OP_MOVE_WIDE.S @@ -7,7 +7,7 @@ EAS2(a2, rFP, a2) # a2 <- &fp[A] LOAD64(a0, a1, a3) # a0/a1 <- fp[B] FETCH_ADVANCE_INST(1) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST STORE64(a0, a1, a2) # fp[A] <- a0/a1 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction diff --git a/vm/mterp/mips/OP_MOVE_WIDE_16.S b/vm/mterp/mips/OP_MOVE_WIDE_16.S index bdd9f2690..16e9d6e7f 100644 --- a/vm/mterp/mips/OP_MOVE_WIDE_16.S +++ b/vm/mterp/mips/OP_MOVE_WIDE_16.S @@ -7,7 +7,7 @@ EAS2(a2, rFP, a2) # a2 <- &fp[AAAA] LOAD64(a0, a1, a3) # a0/a1 <- fp[BBBB] FETCH_ADVANCE_INST(3) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST STORE64(a0, a1, a2) # fp[AAAA] <- a0/a1 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction diff --git a/vm/mterp/mips/OP_MOVE_WIDE_FROM16.S b/vm/mterp/mips/OP_MOVE_WIDE_FROM16.S index 44251f451..7fd217a0e 100644 --- a/vm/mterp/mips/OP_MOVE_WIDE_FROM16.S +++ b/vm/mterp/mips/OP_MOVE_WIDE_FROM16.S @@ -7,7 +7,7 @@ EAS2(a2, rFP, a2) # a2 <- &fp[AA] LOAD64(a0, a1, a3) # a0/a1 <- fp[BBBB] FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST STORE64(a0, a1, a2) # fp[AA] <- a0/a1 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction diff --git a/vm/mterp/mips/OP_NEW_ARRAY.S b/vm/mterp/mips/OP_NEW_ARRAY.S index 5d0179447..2529744d7 100644 --- a/vm/mterp/mips/OP_NEW_ARRAY.S +++ b/vm/mterp/mips/OP_NEW_ARRAY.S @@ -34,8 +34,8 @@ # failed? beqz v0, common_exceptionThrown # yes, handle the exception FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(v0, a2) # vA <- v0 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction %break diff --git a/vm/mterp/mips/OP_NEW_INSTANCE.S b/vm/mterp/mips/OP_NEW_INSTANCE.S index ca946add3..f40ddd531 100644 --- a/vm/mterp/mips/OP_NEW_INSTANCE.S +++ b/vm/mterp/mips/OP_NEW_INSTANCE.S @@ -52,8 +52,8 @@ .L${opcode}_continue: FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(v0, a3) # vAA <- v0 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction #if defined(WITH_JIT) @@ -72,8 +72,8 @@ move a1, rPC JAL(dvmJitEndTraceSelect) # (self, pc) FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(rOBJ, rBIX) # vAA <- new object + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction #endif diff --git a/vm/mterp/mips/header.S b/vm/mterp/mips/header.S index 0f03599f6..38e922a56 100644 --- a/vm/mterp/mips/header.S +++ b/vm/mterp/mips/header.S @@ -1,7 +1,5 @@ #include "../common/asm-constants.h" #include "../common/mips-defines.h" -#include <asm/regdef.h> -#include <asm/fpregdef.h> #ifdef __mips_hard_float #define HARD_FLOAT diff --git a/vm/mterp/out/InterpAsm-armv7-a-neon.S b/vm/mterp/out/InterpAsm-armv7-a-neon.S index c3419c230..d83005333 100644 --- a/vm/mterp/out/InterpAsm-armv7-a-neon.S +++ b/vm/mterp/out/InterpAsm-armv7-a-neon.S @@ -218,7 +218,7 @@ unspecified registers or condition codes. */ .macro SMP_DMB #if ANDROID_SMP != 0 - dmb + dmb ish #else /* not SMP */ #endif @@ -229,7 +229,7 @@ unspecified registers or condition codes. */ .macro SMP_DMB_ST #if ANDROID_SMP != 0 - dmb st + dmb ishst #else /* not SMP */ #endif @@ -3667,29 +3667,33 @@ dalvik_inst: /* ------------------------------ */ .balign 64 .L_OP_LONG_TO_DOUBLE: /* 0x86 */ -/* File: armv6t2/OP_LONG_TO_DOUBLE.S */ -/* File: armv6t2/unopWide.S */ +/* File: arm-vfp/OP_LONG_TO_DOUBLE.S */ /* - * Generic 64-bit unary operation. Provide an "instr" line that - * specifies an instruction that performs "result = op r0/r1". - * This could be an ARM instruction or a function call. + * Specialised 64-bit floating point operation. * - * For: neg-long, not-long, neg-double, long-to-double, double-to-long + * Note: The result will be returned in d2. + * + * For: long-to-double */ - /* unop vA, vB */ mov r3, rINST, lsr #12 @ r3<- B ubfx r9, rINST, #8, #4 @ r9<- A add r3, rFP, r3, lsl #2 @ r3<- &fp[B] add r9, rFP, r9, lsl #2 @ r9<- &fp[A] - ldmia r3, {r0-r1} @ r0/r1<- vAA + vldr d0, [r3] @ d0<- vAA FETCH_ADVANCE_INST(1) @ advance rPC, load rINST - @ optional op; may set condition codes - bl __aeabi_l2d @ r0/r1<- op, r2-r3 changed + + vcvt.f64.s32 d1, s1 @ d1<- (double)(vAAh) + vcvt.f64.u32 d2, s0 @ d2<- (double)(vAAl) + vldr d3, constvalOP_LONG_TO_DOUBLE + vmla.f64 d2, d1, d3 @ d2<- vAAh*2^32 + vAAl + GET_INST_OPCODE(ip) @ extract opcode from rINST - stmia r9, {r0-r1} @ vAA<- r0/r1 + vstr.64 d2, [r9] @ vAA<- d2 GOTO_OPCODE(ip) @ jump to next instruction - /* 10-11 instructions */ + /* literal pool helper */ +constvalOP_LONG_TO_DOUBLE: + .8byte 0x41f0000000000000 /* ------------------------------ */ .balign 64 @@ -4053,86 +4057,74 @@ dalvik_inst: /* ------------------------------ */ .balign 64 .L_OP_DIV_INT: /* 0x93 */ -/* File: armv5te/OP_DIV_INT.S */ -/* File: armv5te/binop.S */ +/* File: armv7-a/OP_DIV_INT.S */ /* - * Generic 32-bit binary operation. Provide an "instr" line that - * specifies an instruction that performs "result = r0 op r1". - * This could be an ARM instruction or a function call. (If the result - * comes back in a register other than r0, you can override "result".) + * Specialized 32-bit binary operation * - * If "chkzero" is set to 1, we perform a divide-by-zero check on - * vCC (r1). Useful for integer division and modulus. Note that we - * *don't* check for (INT_MIN / -1) here, because the ARM math lib - * handles it correctly. + * Performs "r0 = r0 div r1". The selection between sdiv or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * div-int * - * For: add-int, sub-int, mul-int, div-int, rem-int, and-int, or-int, - * xor-int, shl-int, shr-int, ushr-int, add-float, sub-float, - * mul-float, div-float, rem-float */ - /* binop vAA, vBB, vCC */ FETCH(r0, 1) @ r0<- CCBB mov r9, rINST, lsr #8 @ r9<- AA mov r3, r0, lsr #8 @ r3<- CC and r2, r0, #255 @ r2<- BB GET_VREG(r1, r3) @ r1<- vCC GET_VREG(r0, r2) @ r0<- vBB - .if 1 cmp r1, #0 @ is second operand zero? beq common_errDivideByZero - .endif FETCH_ADVANCE_INST(2) @ advance rPC, load rINST - @ optional op; may set condition codes - bl __aeabi_idiv @ r0<- op, r0-r3 changed +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r0, r0, r1 @ r0<- op +#else + bl __aeabi_idiv @ r0<- op, r0-r3 changed +#endif GET_INST_OPCODE(ip) @ extract opcode from rINST - SET_VREG(r0, r9) @ vAA<- r0 + SET_VREG(r0, r9) @ vAA<- r0 GOTO_OPCODE(ip) @ jump to next instruction /* 11-14 instructions */ - /* ------------------------------ */ .balign 64 .L_OP_REM_INT: /* 0x94 */ -/* File: armv5te/OP_REM_INT.S */ -/* idivmod returns quotient in r0 and remainder in r1 */ -/* File: armv5te/binop.S */ +/* File: armv7-a/OP_REM_INT.S */ /* - * Generic 32-bit binary operation. Provide an "instr" line that - * specifies an instruction that performs "result = r0 op r1". - * This could be an ARM instruction or a function call. (If the result - * comes back in a register other than r0, you can override "result".) + * Specialized 32-bit binary operation * - * If "chkzero" is set to 1, we perform a divide-by-zero check on - * vCC (r1). Useful for integer division and modulus. Note that we - * *don't* check for (INT_MIN / -1) here, because the ARM math lib - * handles it correctly. + * Performs "r1 = r0 rem r1". The selection between sdiv block or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * NOTE: idivmod returns quotient in r0 and remainder in r1 + * + * rem-int * - * For: add-int, sub-int, mul-int, div-int, rem-int, and-int, or-int, - * xor-int, shl-int, shr-int, ushr-int, add-float, sub-float, - * mul-float, div-float, rem-float */ - /* binop vAA, vBB, vCC */ FETCH(r0, 1) @ r0<- CCBB mov r9, rINST, lsr #8 @ r9<- AA mov r3, r0, lsr #8 @ r3<- CC and r2, r0, #255 @ r2<- BB GET_VREG(r1, r3) @ r1<- vCC GET_VREG(r0, r2) @ r0<- vBB - .if 1 cmp r1, #0 @ is second operand zero? beq common_errDivideByZero - .endif FETCH_ADVANCE_INST(2) @ advance rPC, load rINST - @ optional op; may set condition codes - bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r2, r0, r1 + mls r1, r1, r2, r0 @ r1<- op, r0-r2 changed +#else + bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#endif GET_INST_OPCODE(ip) @ extract opcode from rINST - SET_VREG(r1, r9) @ vAA<- r1 + SET_VREG(r1, r9) @ vAA<- r1 GOTO_OPCODE(ip) @ jump to next instruction /* 11-14 instructions */ - /* ------------------------------ */ .balign 64 .L_OP_AND_INT: /* 0x95 */ @@ -5259,37 +5251,32 @@ dalvik_inst: /* ------------------------------ */ .balign 64 .L_OP_DIV_INT_2ADDR: /* 0xb3 */ -/* File: armv6t2/OP_DIV_INT_2ADDR.S */ -/* File: armv6t2/binop2addr.S */ +/* File: armv7-a/OP_DIV_INT_2ADDR.S */ /* - * Generic 32-bit "/2addr" binary operation. Provide an "instr" line - * that specifies an instruction that performs "result = r0 op r1". - * This could be an ARM instruction or a function call. (If the result - * comes back in a register other than r0, you can override "result".) + * Specialized 32-bit binary operation * - * If "chkzero" is set to 1, we perform a divide-by-zero check on - * vCC (r1). Useful for integer division and modulus. + * Performs "r0 = r0 div r1". The selection between sdiv or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * div-int/2addr * - * For: add-int/2addr, sub-int/2addr, mul-int/2addr, div-int/2addr, - * rem-int/2addr, and-int/2addr, or-int/2addr, xor-int/2addr, - * shl-int/2addr, shr-int/2addr, ushr-int/2addr, add-float/2addr, - * sub-float/2addr, mul-float/2addr, div-float/2addr, rem-float/2addr */ - /* binop/2addr vA, vB */ mov r3, rINST, lsr #12 @ r3<- B ubfx r9, rINST, #8, #4 @ r9<- A GET_VREG(r1, r3) @ r1<- vB GET_VREG(r0, r9) @ r0<- vA - .if 1 cmp r1, #0 @ is second operand zero? beq common_errDivideByZero - .endif FETCH_ADVANCE_INST(1) @ advance rPC, load rINST - @ optional op; may set condition codes - bl __aeabi_idiv @ r0<- op, r0-r3 changed +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r0, r0, r1 @ r0<- op +#else + bl __aeabi_idiv @ r0<- op, r0-r3 changed +#endif GET_INST_OPCODE(ip) @ extract opcode from rINST - SET_VREG(r0, r9) @ vAA<- r0 + SET_VREG(r0, r9) @ vAA<- r0 GOTO_OPCODE(ip) @ jump to next instruction /* 10-13 instructions */ @@ -5297,38 +5284,35 @@ dalvik_inst: /* ------------------------------ */ .balign 64 .L_OP_REM_INT_2ADDR: /* 0xb4 */ -/* File: armv6t2/OP_REM_INT_2ADDR.S */ -/* idivmod returns quotient in r0 and remainder in r1 */ -/* File: armv6t2/binop2addr.S */ +/* File: armv7-a/OP_REM_INT_2ADDR.S */ /* - * Generic 32-bit "/2addr" binary operation. Provide an "instr" line - * that specifies an instruction that performs "result = r0 op r1". - * This could be an ARM instruction or a function call. (If the result - * comes back in a register other than r0, you can override "result".) + * Specialized 32-bit binary operation * - * If "chkzero" is set to 1, we perform a divide-by-zero check on - * vCC (r1). Useful for integer division and modulus. + * Performs "r1 = r0 rem r1". The selection between sdiv block or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * NOTE: idivmod returns quotient in r0 and remainder in r1 + * + * rem-int/2addr * - * For: add-int/2addr, sub-int/2addr, mul-int/2addr, div-int/2addr, - * rem-int/2addr, and-int/2addr, or-int/2addr, xor-int/2addr, - * shl-int/2addr, shr-int/2addr, ushr-int/2addr, add-float/2addr, - * sub-float/2addr, mul-float/2addr, div-float/2addr, rem-float/2addr */ - /* binop/2addr vA, vB */ mov r3, rINST, lsr #12 @ r3<- B ubfx r9, rINST, #8, #4 @ r9<- A GET_VREG(r1, r3) @ r1<- vB GET_VREG(r0, r9) @ r0<- vA - .if 1 cmp r1, #0 @ is second operand zero? beq common_errDivideByZero - .endif FETCH_ADVANCE_INST(1) @ advance rPC, load rINST - @ optional op; may set condition codes - bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r2, r0, r1 + mls r1, r1, r2, r0 @ r1<- op +#else + bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#endif GET_INST_OPCODE(ip) @ extract opcode from rINST - SET_VREG(r1, r9) @ vAA<- r1 + SET_VREG(r1, r9) @ vAA<- r1 GOTO_OPCODE(ip) @ jump to next instruction /* 10-13 instructions */ @@ -6364,74 +6348,70 @@ dalvik_inst: /* ------------------------------ */ .balign 64 .L_OP_DIV_INT_LIT16: /* 0xd3 */ -/* File: armv6t2/OP_DIV_INT_LIT16.S */ -/* File: armv6t2/binopLit16.S */ +/* File: armv7-a/OP_DIV_INT_LIT16.S */ /* - * Generic 32-bit "lit16" binary operation. Provide an "instr" line - * that specifies an instruction that performs "result = r0 op r1". - * This could be an ARM instruction or a function call. (If the result - * comes back in a register other than r0, you can override "result".) + * Specialized 32-bit binary operation * - * If "chkzero" is set to 1, we perform a divide-by-zero check on - * vCC (r1). Useful for integer division and modulus. + * Performs "r0 = r0 div r1". The selection between sdiv or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * div-int/lit16 * - * For: add-int/lit16, rsub-int, mul-int/lit16, div-int/lit16, - * rem-int/lit16, and-int/lit16, or-int/lit16, xor-int/lit16 */ - /* binop/lit16 vA, vB, #+CCCC */ FETCH_S(r1, 1) @ r1<- ssssCCCC (sign-extended) mov r2, rINST, lsr #12 @ r2<- B ubfx r9, rINST, #8, #4 @ r9<- A GET_VREG(r0, r2) @ r0<- vB - .if 1 cmp r1, #0 @ is second operand zero? beq common_errDivideByZero - .endif FETCH_ADVANCE_INST(2) @ advance rPC, load rINST - bl __aeabi_idiv @ r0<- op, r0-r3 changed +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r0, r0, r1 @ r0<- op +#else + bl __aeabi_idiv @ r0<- op, r0-r3 changed +#endif GET_INST_OPCODE(ip) @ extract opcode from rINST - SET_VREG(r0, r9) @ vAA<- r0 + SET_VREG(r0, r9) @ vAA<- r0 GOTO_OPCODE(ip) @ jump to next instruction /* 10-13 instructions */ - /* ------------------------------ */ .balign 64 .L_OP_REM_INT_LIT16: /* 0xd4 */ -/* File: armv6t2/OP_REM_INT_LIT16.S */ -/* idivmod returns quotient in r0 and remainder in r1 */ -/* File: armv6t2/binopLit16.S */ +/* File: armv7-a/OP_REM_INT_LIT16.S */ /* - * Generic 32-bit "lit16" binary operation. Provide an "instr" line - * that specifies an instruction that performs "result = r0 op r1". - * This could be an ARM instruction or a function call. (If the result - * comes back in a register other than r0, you can override "result".) + * Specialized 32-bit binary operation * - * If "chkzero" is set to 1, we perform a divide-by-zero check on - * vCC (r1). Useful for integer division and modulus. + * Performs "r1 = r0 rem r1". The selection between sdiv block or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * NOTE: idivmod returns quotient in r0 and remainder in r1 + * + * rem-int/lit16 * - * For: add-int/lit16, rsub-int, mul-int/lit16, div-int/lit16, - * rem-int/lit16, and-int/lit16, or-int/lit16, xor-int/lit16 */ - /* binop/lit16 vA, vB, #+CCCC */ FETCH_S(r1, 1) @ r1<- ssssCCCC (sign-extended) mov r2, rINST, lsr #12 @ r2<- B ubfx r9, rINST, #8, #4 @ r9<- A GET_VREG(r0, r2) @ r0<- vB - .if 1 cmp r1, #0 @ is second operand zero? beq common_errDivideByZero - .endif FETCH_ADVANCE_INST(2) @ advance rPC, load rINST - bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r2, r0, r1 + mls r1, r1, r2, r0 @ r1<- op +#else + bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#endif GET_INST_OPCODE(ip) @ extract opcode from rINST - SET_VREG(r1, r9) @ vAA<- r1 + SET_VREG(r1, r9) @ vAA<- r1 GOTO_OPCODE(ip) @ jump to next instruction /* 10-13 instructions */ - /* ------------------------------ */ .balign 64 .L_OP_AND_INT_LIT16: /* 0xd5 */ @@ -6655,80 +6635,72 @@ dalvik_inst: /* ------------------------------ */ .balign 64 .L_OP_DIV_INT_LIT8: /* 0xdb */ -/* File: armv5te/OP_DIV_INT_LIT8.S */ -/* File: armv5te/binopLit8.S */ +/* File: armv7-a/OP_DIV_INT_LIT8.S */ /* - * Generic 32-bit "lit8" binary operation. Provide an "instr" line - * that specifies an instruction that performs "result = r0 op r1". - * This could be an ARM instruction or a function call. (If the result - * comes back in a register other than r0, you can override "result".) + * Specialized 32-bit binary operation * - * If "chkzero" is set to 1, we perform a divide-by-zero check on - * vCC (r1). Useful for integer division and modulus. + * Performs "r0 = r0 div r1". The selection between sdiv or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * div-int/lit8 * - * For: add-int/lit8, rsub-int/lit8, mul-int/lit8, div-int/lit8, - * rem-int/lit8, and-int/lit8, or-int/lit8, xor-int/lit8, - * shl-int/lit8, shr-int/lit8, ushr-int/lit8 */ - /* binop/lit8 vAA, vBB, #+CC */ FETCH_S(r3, 1) @ r3<- ssssCCBB (sign-extended for CC) mov r9, rINST, lsr #8 @ r9<- AA and r2, r3, #255 @ r2<- BB GET_VREG(r0, r2) @ r0<- vBB movs r1, r3, asr #8 @ r1<- ssssssCC (sign extended) - .if 1 - @cmp r1, #0 @ is second operand zero? + @cmp r1, #0 @ is second operand zero? beq common_errDivideByZero - .endif FETCH_ADVANCE_INST(2) @ advance rPC, load rINST - @ optional op; may set condition codes - bl __aeabi_idiv @ r0<- op, r0-r3 changed +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r0, r0, r1 @ r0<- op +#else + bl __aeabi_idiv @ r0<- op, r0-r3 changed +#endif GET_INST_OPCODE(ip) @ extract opcode from rINST - SET_VREG(r0, r9) @ vAA<- r0 + SET_VREG(r0, r9) @ vAA<- r0 GOTO_OPCODE(ip) @ jump to next instruction /* 10-12 instructions */ - /* ------------------------------ */ .balign 64 .L_OP_REM_INT_LIT8: /* 0xdc */ -/* File: armv5te/OP_REM_INT_LIT8.S */ -/* idivmod returns quotient in r0 and remainder in r1 */ -/* File: armv5te/binopLit8.S */ +/* File: armv7-a/OP_REM_INT_LIT8.S */ /* - * Generic 32-bit "lit8" binary operation. Provide an "instr" line - * that specifies an instruction that performs "result = r0 op r1". - * This could be an ARM instruction or a function call. (If the result - * comes back in a register other than r0, you can override "result".) + * Specialized 32-bit binary operation * - * If "chkzero" is set to 1, we perform a divide-by-zero check on - * vCC (r1). Useful for integer division and modulus. + * Performs "r1 = r0 rem r1". The selection between sdiv block or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * NOTE: idivmod returns quotient in r0 and remainder in r1 + * + * rem-int/lit8 * - * For: add-int/lit8, rsub-int/lit8, mul-int/lit8, div-int/lit8, - * rem-int/lit8, and-int/lit8, or-int/lit8, xor-int/lit8, - * shl-int/lit8, shr-int/lit8, ushr-int/lit8 */ - /* binop/lit8 vAA, vBB, #+CC */ FETCH_S(r3, 1) @ r3<- ssssCCBB (sign-extended for CC) mov r9, rINST, lsr #8 @ r9<- AA and r2, r3, #255 @ r2<- BB GET_VREG(r0, r2) @ r0<- vBB movs r1, r3, asr #8 @ r1<- ssssssCC (sign extended) - .if 1 - @cmp r1, #0 @ is second operand zero? + @cmp r1, #0 @ is second operand zero? beq common_errDivideByZero - .endif FETCH_ADVANCE_INST(2) @ advance rPC, load rINST - @ optional op; may set condition codes - bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r2, r0, r1 + mls r1, r1, r2, r0 @ r1<- op +#else + bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#endif GET_INST_OPCODE(ip) @ extract opcode from rINST - SET_VREG(r1, r9) @ vAA<- r1 + SET_VREG(r1, r9) @ vAA<- r1 GOTO_OPCODE(ip) @ jump to next instruction /* 10-12 instructions */ - /* ------------------------------ */ .balign 64 .L_OP_AND_INT_LIT8: /* 0xdd */ diff --git a/vm/mterp/out/InterpAsm-armv7-a.S b/vm/mterp/out/InterpAsm-armv7-a.S index 254224566..65c4a7047 100644 --- a/vm/mterp/out/InterpAsm-armv7-a.S +++ b/vm/mterp/out/InterpAsm-armv7-a.S @@ -218,7 +218,7 @@ unspecified registers or condition codes. */ .macro SMP_DMB #if ANDROID_SMP != 0 - dmb + dmb ish #else /* not SMP */ #endif @@ -229,7 +229,7 @@ unspecified registers or condition codes. */ .macro SMP_DMB_ST #if ANDROID_SMP != 0 - dmb st + dmb ishst #else /* not SMP */ #endif @@ -4053,86 +4053,74 @@ dalvik_inst: /* ------------------------------ */ .balign 64 .L_OP_DIV_INT: /* 0x93 */ -/* File: armv5te/OP_DIV_INT.S */ -/* File: armv5te/binop.S */ +/* File: armv7-a/OP_DIV_INT.S */ /* - * Generic 32-bit binary operation. Provide an "instr" line that - * specifies an instruction that performs "result = r0 op r1". - * This could be an ARM instruction or a function call. (If the result - * comes back in a register other than r0, you can override "result".) + * Specialized 32-bit binary operation * - * If "chkzero" is set to 1, we perform a divide-by-zero check on - * vCC (r1). Useful for integer division and modulus. Note that we - * *don't* check for (INT_MIN / -1) here, because the ARM math lib - * handles it correctly. + * Performs "r0 = r0 div r1". The selection between sdiv or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * div-int * - * For: add-int, sub-int, mul-int, div-int, rem-int, and-int, or-int, - * xor-int, shl-int, shr-int, ushr-int, add-float, sub-float, - * mul-float, div-float, rem-float */ - /* binop vAA, vBB, vCC */ FETCH(r0, 1) @ r0<- CCBB mov r9, rINST, lsr #8 @ r9<- AA mov r3, r0, lsr #8 @ r3<- CC and r2, r0, #255 @ r2<- BB GET_VREG(r1, r3) @ r1<- vCC GET_VREG(r0, r2) @ r0<- vBB - .if 1 cmp r1, #0 @ is second operand zero? beq common_errDivideByZero - .endif FETCH_ADVANCE_INST(2) @ advance rPC, load rINST - @ optional op; may set condition codes - bl __aeabi_idiv @ r0<- op, r0-r3 changed +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r0, r0, r1 @ r0<- op +#else + bl __aeabi_idiv @ r0<- op, r0-r3 changed +#endif GET_INST_OPCODE(ip) @ extract opcode from rINST - SET_VREG(r0, r9) @ vAA<- r0 + SET_VREG(r0, r9) @ vAA<- r0 GOTO_OPCODE(ip) @ jump to next instruction /* 11-14 instructions */ - /* ------------------------------ */ .balign 64 .L_OP_REM_INT: /* 0x94 */ -/* File: armv5te/OP_REM_INT.S */ -/* idivmod returns quotient in r0 and remainder in r1 */ -/* File: armv5te/binop.S */ +/* File: armv7-a/OP_REM_INT.S */ /* - * Generic 32-bit binary operation. Provide an "instr" line that - * specifies an instruction that performs "result = r0 op r1". - * This could be an ARM instruction or a function call. (If the result - * comes back in a register other than r0, you can override "result".) + * Specialized 32-bit binary operation * - * If "chkzero" is set to 1, we perform a divide-by-zero check on - * vCC (r1). Useful for integer division and modulus. Note that we - * *don't* check for (INT_MIN / -1) here, because the ARM math lib - * handles it correctly. + * Performs "r1 = r0 rem r1". The selection between sdiv block or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * NOTE: idivmod returns quotient in r0 and remainder in r1 + * + * rem-int * - * For: add-int, sub-int, mul-int, div-int, rem-int, and-int, or-int, - * xor-int, shl-int, shr-int, ushr-int, add-float, sub-float, - * mul-float, div-float, rem-float */ - /* binop vAA, vBB, vCC */ FETCH(r0, 1) @ r0<- CCBB mov r9, rINST, lsr #8 @ r9<- AA mov r3, r0, lsr #8 @ r3<- CC and r2, r0, #255 @ r2<- BB GET_VREG(r1, r3) @ r1<- vCC GET_VREG(r0, r2) @ r0<- vBB - .if 1 cmp r1, #0 @ is second operand zero? beq common_errDivideByZero - .endif FETCH_ADVANCE_INST(2) @ advance rPC, load rINST - @ optional op; may set condition codes - bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r2, r0, r1 + mls r1, r1, r2, r0 @ r1<- op, r0-r2 changed +#else + bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#endif GET_INST_OPCODE(ip) @ extract opcode from rINST - SET_VREG(r1, r9) @ vAA<- r1 + SET_VREG(r1, r9) @ vAA<- r1 GOTO_OPCODE(ip) @ jump to next instruction /* 11-14 instructions */ - /* ------------------------------ */ .balign 64 .L_OP_AND_INT: /* 0x95 */ @@ -5259,37 +5247,32 @@ dalvik_inst: /* ------------------------------ */ .balign 64 .L_OP_DIV_INT_2ADDR: /* 0xb3 */ -/* File: armv6t2/OP_DIV_INT_2ADDR.S */ -/* File: armv6t2/binop2addr.S */ +/* File: armv7-a/OP_DIV_INT_2ADDR.S */ /* - * Generic 32-bit "/2addr" binary operation. Provide an "instr" line - * that specifies an instruction that performs "result = r0 op r1". - * This could be an ARM instruction or a function call. (If the result - * comes back in a register other than r0, you can override "result".) + * Specialized 32-bit binary operation * - * If "chkzero" is set to 1, we perform a divide-by-zero check on - * vCC (r1). Useful for integer division and modulus. + * Performs "r0 = r0 div r1". The selection between sdiv or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * div-int/2addr * - * For: add-int/2addr, sub-int/2addr, mul-int/2addr, div-int/2addr, - * rem-int/2addr, and-int/2addr, or-int/2addr, xor-int/2addr, - * shl-int/2addr, shr-int/2addr, ushr-int/2addr, add-float/2addr, - * sub-float/2addr, mul-float/2addr, div-float/2addr, rem-float/2addr */ - /* binop/2addr vA, vB */ mov r3, rINST, lsr #12 @ r3<- B ubfx r9, rINST, #8, #4 @ r9<- A GET_VREG(r1, r3) @ r1<- vB GET_VREG(r0, r9) @ r0<- vA - .if 1 cmp r1, #0 @ is second operand zero? beq common_errDivideByZero - .endif FETCH_ADVANCE_INST(1) @ advance rPC, load rINST - @ optional op; may set condition codes - bl __aeabi_idiv @ r0<- op, r0-r3 changed +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r0, r0, r1 @ r0<- op +#else + bl __aeabi_idiv @ r0<- op, r0-r3 changed +#endif GET_INST_OPCODE(ip) @ extract opcode from rINST - SET_VREG(r0, r9) @ vAA<- r0 + SET_VREG(r0, r9) @ vAA<- r0 GOTO_OPCODE(ip) @ jump to next instruction /* 10-13 instructions */ @@ -5297,38 +5280,35 @@ dalvik_inst: /* ------------------------------ */ .balign 64 .L_OP_REM_INT_2ADDR: /* 0xb4 */ -/* File: armv6t2/OP_REM_INT_2ADDR.S */ -/* idivmod returns quotient in r0 and remainder in r1 */ -/* File: armv6t2/binop2addr.S */ +/* File: armv7-a/OP_REM_INT_2ADDR.S */ /* - * Generic 32-bit "/2addr" binary operation. Provide an "instr" line - * that specifies an instruction that performs "result = r0 op r1". - * This could be an ARM instruction or a function call. (If the result - * comes back in a register other than r0, you can override "result".) + * Specialized 32-bit binary operation * - * If "chkzero" is set to 1, we perform a divide-by-zero check on - * vCC (r1). Useful for integer division and modulus. + * Performs "r1 = r0 rem r1". The selection between sdiv block or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * NOTE: idivmod returns quotient in r0 and remainder in r1 + * + * rem-int/2addr * - * For: add-int/2addr, sub-int/2addr, mul-int/2addr, div-int/2addr, - * rem-int/2addr, and-int/2addr, or-int/2addr, xor-int/2addr, - * shl-int/2addr, shr-int/2addr, ushr-int/2addr, add-float/2addr, - * sub-float/2addr, mul-float/2addr, div-float/2addr, rem-float/2addr */ - /* binop/2addr vA, vB */ mov r3, rINST, lsr #12 @ r3<- B ubfx r9, rINST, #8, #4 @ r9<- A GET_VREG(r1, r3) @ r1<- vB GET_VREG(r0, r9) @ r0<- vA - .if 1 cmp r1, #0 @ is second operand zero? beq common_errDivideByZero - .endif FETCH_ADVANCE_INST(1) @ advance rPC, load rINST - @ optional op; may set condition codes - bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r2, r0, r1 + mls r1, r1, r2, r0 @ r1<- op +#else + bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#endif GET_INST_OPCODE(ip) @ extract opcode from rINST - SET_VREG(r1, r9) @ vAA<- r1 + SET_VREG(r1, r9) @ vAA<- r1 GOTO_OPCODE(ip) @ jump to next instruction /* 10-13 instructions */ @@ -6364,74 +6344,70 @@ dalvik_inst: /* ------------------------------ */ .balign 64 .L_OP_DIV_INT_LIT16: /* 0xd3 */ -/* File: armv6t2/OP_DIV_INT_LIT16.S */ -/* File: armv6t2/binopLit16.S */ +/* File: armv7-a/OP_DIV_INT_LIT16.S */ /* - * Generic 32-bit "lit16" binary operation. Provide an "instr" line - * that specifies an instruction that performs "result = r0 op r1". - * This could be an ARM instruction or a function call. (If the result - * comes back in a register other than r0, you can override "result".) + * Specialized 32-bit binary operation * - * If "chkzero" is set to 1, we perform a divide-by-zero check on - * vCC (r1). Useful for integer division and modulus. + * Performs "r0 = r0 div r1". The selection between sdiv or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * div-int/lit16 * - * For: add-int/lit16, rsub-int, mul-int/lit16, div-int/lit16, - * rem-int/lit16, and-int/lit16, or-int/lit16, xor-int/lit16 */ - /* binop/lit16 vA, vB, #+CCCC */ FETCH_S(r1, 1) @ r1<- ssssCCCC (sign-extended) mov r2, rINST, lsr #12 @ r2<- B ubfx r9, rINST, #8, #4 @ r9<- A GET_VREG(r0, r2) @ r0<- vB - .if 1 cmp r1, #0 @ is second operand zero? beq common_errDivideByZero - .endif FETCH_ADVANCE_INST(2) @ advance rPC, load rINST - bl __aeabi_idiv @ r0<- op, r0-r3 changed +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r0, r0, r1 @ r0<- op +#else + bl __aeabi_idiv @ r0<- op, r0-r3 changed +#endif GET_INST_OPCODE(ip) @ extract opcode from rINST - SET_VREG(r0, r9) @ vAA<- r0 + SET_VREG(r0, r9) @ vAA<- r0 GOTO_OPCODE(ip) @ jump to next instruction /* 10-13 instructions */ - /* ------------------------------ */ .balign 64 .L_OP_REM_INT_LIT16: /* 0xd4 */ -/* File: armv6t2/OP_REM_INT_LIT16.S */ -/* idivmod returns quotient in r0 and remainder in r1 */ -/* File: armv6t2/binopLit16.S */ +/* File: armv7-a/OP_REM_INT_LIT16.S */ /* - * Generic 32-bit "lit16" binary operation. Provide an "instr" line - * that specifies an instruction that performs "result = r0 op r1". - * This could be an ARM instruction or a function call. (If the result - * comes back in a register other than r0, you can override "result".) + * Specialized 32-bit binary operation * - * If "chkzero" is set to 1, we perform a divide-by-zero check on - * vCC (r1). Useful for integer division and modulus. + * Performs "r1 = r0 rem r1". The selection between sdiv block or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * NOTE: idivmod returns quotient in r0 and remainder in r1 + * + * rem-int/lit16 * - * For: add-int/lit16, rsub-int, mul-int/lit16, div-int/lit16, - * rem-int/lit16, and-int/lit16, or-int/lit16, xor-int/lit16 */ - /* binop/lit16 vA, vB, #+CCCC */ FETCH_S(r1, 1) @ r1<- ssssCCCC (sign-extended) mov r2, rINST, lsr #12 @ r2<- B ubfx r9, rINST, #8, #4 @ r9<- A GET_VREG(r0, r2) @ r0<- vB - .if 1 cmp r1, #0 @ is second operand zero? beq common_errDivideByZero - .endif FETCH_ADVANCE_INST(2) @ advance rPC, load rINST - bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r2, r0, r1 + mls r1, r1, r2, r0 @ r1<- op +#else + bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#endif GET_INST_OPCODE(ip) @ extract opcode from rINST - SET_VREG(r1, r9) @ vAA<- r1 + SET_VREG(r1, r9) @ vAA<- r1 GOTO_OPCODE(ip) @ jump to next instruction /* 10-13 instructions */ - /* ------------------------------ */ .balign 64 .L_OP_AND_INT_LIT16: /* 0xd5 */ @@ -6655,80 +6631,72 @@ dalvik_inst: /* ------------------------------ */ .balign 64 .L_OP_DIV_INT_LIT8: /* 0xdb */ -/* File: armv5te/OP_DIV_INT_LIT8.S */ -/* File: armv5te/binopLit8.S */ +/* File: armv7-a/OP_DIV_INT_LIT8.S */ /* - * Generic 32-bit "lit8" binary operation. Provide an "instr" line - * that specifies an instruction that performs "result = r0 op r1". - * This could be an ARM instruction or a function call. (If the result - * comes back in a register other than r0, you can override "result".) + * Specialized 32-bit binary operation * - * If "chkzero" is set to 1, we perform a divide-by-zero check on - * vCC (r1). Useful for integer division and modulus. + * Performs "r0 = r0 div r1". The selection between sdiv or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * div-int/lit8 * - * For: add-int/lit8, rsub-int/lit8, mul-int/lit8, div-int/lit8, - * rem-int/lit8, and-int/lit8, or-int/lit8, xor-int/lit8, - * shl-int/lit8, shr-int/lit8, ushr-int/lit8 */ - /* binop/lit8 vAA, vBB, #+CC */ FETCH_S(r3, 1) @ r3<- ssssCCBB (sign-extended for CC) mov r9, rINST, lsr #8 @ r9<- AA and r2, r3, #255 @ r2<- BB GET_VREG(r0, r2) @ r0<- vBB movs r1, r3, asr #8 @ r1<- ssssssCC (sign extended) - .if 1 - @cmp r1, #0 @ is second operand zero? + @cmp r1, #0 @ is second operand zero? beq common_errDivideByZero - .endif FETCH_ADVANCE_INST(2) @ advance rPC, load rINST - @ optional op; may set condition codes - bl __aeabi_idiv @ r0<- op, r0-r3 changed +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r0, r0, r1 @ r0<- op +#else + bl __aeabi_idiv @ r0<- op, r0-r3 changed +#endif GET_INST_OPCODE(ip) @ extract opcode from rINST - SET_VREG(r0, r9) @ vAA<- r0 + SET_VREG(r0, r9) @ vAA<- r0 GOTO_OPCODE(ip) @ jump to next instruction /* 10-12 instructions */ - /* ------------------------------ */ .balign 64 .L_OP_REM_INT_LIT8: /* 0xdc */ -/* File: armv5te/OP_REM_INT_LIT8.S */ -/* idivmod returns quotient in r0 and remainder in r1 */ -/* File: armv5te/binopLit8.S */ +/* File: armv7-a/OP_REM_INT_LIT8.S */ /* - * Generic 32-bit "lit8" binary operation. Provide an "instr" line - * that specifies an instruction that performs "result = r0 op r1". - * This could be an ARM instruction or a function call. (If the result - * comes back in a register other than r0, you can override "result".) + * Specialized 32-bit binary operation * - * If "chkzero" is set to 1, we perform a divide-by-zero check on - * vCC (r1). Useful for integer division and modulus. + * Performs "r1 = r0 rem r1". The selection between sdiv block or the gcc helper + * depends on the compile time value of __ARM_ARCH_EXT_IDIV__ (defined for + * ARMv7 CPUs that have hardware division support). + * + * NOTE: idivmod returns quotient in r0 and remainder in r1 + * + * rem-int/lit8 * - * For: add-int/lit8, rsub-int/lit8, mul-int/lit8, div-int/lit8, - * rem-int/lit8, and-int/lit8, or-int/lit8, xor-int/lit8, - * shl-int/lit8, shr-int/lit8, ushr-int/lit8 */ - /* binop/lit8 vAA, vBB, #+CC */ FETCH_S(r3, 1) @ r3<- ssssCCBB (sign-extended for CC) mov r9, rINST, lsr #8 @ r9<- AA and r2, r3, #255 @ r2<- BB GET_VREG(r0, r2) @ r0<- vBB movs r1, r3, asr #8 @ r1<- ssssssCC (sign extended) - .if 1 - @cmp r1, #0 @ is second operand zero? + @cmp r1, #0 @ is second operand zero? beq common_errDivideByZero - .endif FETCH_ADVANCE_INST(2) @ advance rPC, load rINST - @ optional op; may set condition codes - bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#ifdef __ARM_ARCH_EXT_IDIV__ + sdiv r2, r0, r1 + mls r1, r1, r2, r0 @ r1<- op +#else + bl __aeabi_idivmod @ r1<- op, r0-r3 changed +#endif GET_INST_OPCODE(ip) @ extract opcode from rINST - SET_VREG(r1, r9) @ vAA<- r1 + SET_VREG(r1, r9) @ vAA<- r1 GOTO_OPCODE(ip) @ jump to next instruction /* 10-12 instructions */ - /* ------------------------------ */ .balign 64 .L_OP_AND_INT_LIT8: /* 0xdd */ diff --git a/vm/mterp/out/InterpAsm-mips.S b/vm/mterp/out/InterpAsm-mips.S index 3e1c67084..af4ad236b 100644 --- a/vm/mterp/out/InterpAsm-mips.S +++ b/vm/mterp/out/InterpAsm-mips.S @@ -7,8 +7,6 @@ /* File: mips/header.S */ #include "../common/asm-constants.h" #include "../common/mips-defines.h" -#include <asm/regdef.h> -#include <asm/fpregdef.h> #ifdef __mips_hard_float #define HARD_FLOAT @@ -571,8 +569,8 @@ dalvik_inst: EAS2(a2, rFP, a2) # a2 <- &fp[A] LOAD64(a0, a1, a3) # a0/a1 <- fp[B] FETCH_ADVANCE_INST(1) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST STORE64(a0, a1, a2) # fp[A] <- a0/a1 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -588,8 +586,8 @@ dalvik_inst: EAS2(a2, rFP, a2) # a2 <- &fp[AA] LOAD64(a0, a1, a3) # a0/a1 <- fp[BBBB] FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST STORE64(a0, a1, a2) # fp[AA] <- a0/a1 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -605,8 +603,8 @@ dalvik_inst: EAS2(a2, rFP, a2) # a2 <- &fp[AAAA] LOAD64(a0, a1, a3) # a0/a1 <- fp[BBBB] FETCH_ADVANCE_INST(3) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST STORE64(a0, a1, a2) # fp[AAAA] <- a0/a1 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -681,8 +679,8 @@ dalvik_inst: EAS2(a2, rFP, a2) # a2 <- &fp[AA] LOAD64(a0, a1, a3) # a0/a1 <- retval.j FETCH_ADVANCE_INST(1) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST STORE64(a0, a1, a2) # fp[AA] <- a0/a1 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -1235,8 +1233,8 @@ dalvik_inst: # failed? beqz v0, common_exceptionThrown # yes, handle the exception FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(v0, a2) # vA <- v0 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction /* ------------------------------ */ @@ -2627,8 +2625,8 @@ dalvik_inst: bnez rBIX, .LOP_APUT_OBJECT_checks # yes, skip type checks .LOP_APUT_OBJECT_finish: FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST sw rBIX, offArrayObject_contents(rOBJ) # vBB[vCC] <- vAA + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -8856,8 +8854,8 @@ dalvik_inst: addu t0, a3, a1 # lw a0, 0(t0) # a0 <- obj.field (always 32 bits) FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(a0, a2) # fp[A] <- a0 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -8897,8 +8895,8 @@ dalvik_inst: addu t0, a3, a1 # lw a0, 0(t0) # a0 <- obj.field (always 32 bits) FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(a0, a2) # fp[A] <- a0 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -9283,8 +9281,8 @@ dvmAsmSisterStart: .LOP_NEW_INSTANCE_continue: FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(v0, a3) # vAA <- v0 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction #if defined(WITH_JIT) @@ -9303,8 +9301,8 @@ dvmAsmSisterStart: move a1, rPC JAL(dvmJitEndTraceSelect) # (self, pc) FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(rOBJ, rBIX) # vAA <- new object + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction #endif @@ -9666,8 +9664,8 @@ OP_CMPG_DOUBLE_finish: # noop # acquiring load GET_OPA4(a2) # a2 <- A+ FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(a0, a2) # fp[A] <- a0 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -9712,8 +9710,8 @@ OP_CMPG_DOUBLE_finish: # noop # acquiring load GET_OPA4(a2) # a2 <- A+ FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(a0, a2) # fp[A] <- a0 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -9734,8 +9732,8 @@ OP_CMPG_DOUBLE_finish: # noop # acquiring load GET_OPA4(a2) # a2 <- A+ FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(a0, a2) # fp[A] <- a0 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -9756,8 +9754,8 @@ OP_CMPG_DOUBLE_finish: # noop # acquiring load GET_OPA4(a2) # a2 <- A+ FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(a0, a2) # fp[A] <- a0 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -9778,8 +9776,8 @@ OP_CMPG_DOUBLE_finish: # noop # acquiring load GET_OPA4(a2) # a2 <- A+ FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(a0, a2) # fp[A] <- a0 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -9800,8 +9798,8 @@ OP_CMPG_DOUBLE_finish: # noop # acquiring load GET_OPA4(a2) # a2 <- A+ FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(a0, a2) # fp[A] <- a0 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -9820,11 +9818,11 @@ OP_CMPG_DOUBLE_finish: # check object for null beqz rOBJ, common_errNullObject # object was null FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST addu rOBJ, rOBJ, a3 # form address # noop # releasing store sw a0, (rOBJ) # obj.field (8/16/32 bits) <- a0 # noop + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -9870,11 +9868,11 @@ OP_CMPG_DOUBLE_finish: # check object for null beqz rOBJ, common_errNullObject # object was null FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST addu t2, rOBJ, a3 # form address # noop # releasing store sw a0, (t2) # obj.field (32 bits) <- a0 # noop + GET_INST_OPCODE(t0) # extract opcode from rINST beqz a0, 1f # stored a null reference? srl t1, rOBJ, GC_CARD_SHIFT addu t2, a2, t1 @@ -9898,11 +9896,11 @@ OP_CMPG_DOUBLE_finish: # check object for null beqz rOBJ, common_errNullObject # object was null FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST addu rOBJ, rOBJ, a3 # form address # noop # releasing store sw a0, (rOBJ) # obj.field (8/16/32 bits) <- a0 # noop + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -9921,11 +9919,11 @@ OP_CMPG_DOUBLE_finish: # check object for null beqz rOBJ, common_errNullObject # object was null FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST addu rOBJ, rOBJ, a3 # form address # noop # releasing store sw a0, (rOBJ) # obj.field (8/16/32 bits) <- a0 # noop + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -9944,11 +9942,11 @@ OP_CMPG_DOUBLE_finish: # check object for null beqz rOBJ, common_errNullObject # object was null FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST addu rOBJ, rOBJ, a3 # form address # noop # releasing store sw a0, (rOBJ) # obj.field (8/16/32 bits) <- a0 # noop + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -9967,11 +9965,11 @@ OP_CMPG_DOUBLE_finish: # check object for null beqz rOBJ, common_errNullObject # object was null FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST addu rOBJ, rOBJ, a3 # form address # noop # releasing store sw a0, (rOBJ) # obj.field (8/16/32 bits) <- a0 # noop + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -10619,8 +10617,8 @@ d2l_doconv: SMP_DMB # acquiring load GET_OPA4(a2) # a2 <- A+ FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(a0, a2) # fp[A] <- a0 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -10639,11 +10637,11 @@ d2l_doconv: # check object for null beqz rOBJ, common_errNullObject # object was null FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST addu rOBJ, rOBJ, a3 # form address SMP_DMB_ST # releasing store sw a0, (rOBJ) # obj.field (8/16/32 bits) <- a0 SMP_DMB + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -10687,8 +10685,8 @@ d2l_doconv: SMP_DMB # acquiring load GET_OPA4(a2) # a2 <- A+ FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST SET_VREG(a0, a2) # fp[A] <- a0 + GET_INST_OPCODE(t0) # extract opcode from rINST GOTO_OPCODE(t0) # jump to next instruction @@ -10954,11 +10952,11 @@ d2l_doconv: # check object for null beqz rOBJ, common_errNullObject # object was null FETCH_ADVANCE_INST(2) # advance rPC, load rINST - GET_INST_OPCODE(t0) # extract opcode from rINST addu t2, rOBJ, a3 # form address SMP_DMB_ST # releasing store sw a0, (t2) # obj.field (32 bits) <- a0 SMP_DMB + GET_INST_OPCODE(t0) # extract opcode from rINST beqz a0, 1f # stored a null reference? srl t1, rOBJ, GC_CARD_SHIFT addu t2, a2, t1 diff --git a/vm/native/dalvik_system_VMDebug.cpp b/vm/native/dalvik_system_VMDebug.cpp index 53773575f..227d1c16f 100644 --- a/vm/native/dalvik_system_VMDebug.cpp +++ b/vm/native/dalvik_system_VMDebug.cpp @@ -244,7 +244,7 @@ static void Dalvik_dalvik_system_VMDebug_startMethodTracingDdmsImpl(const u4* ar /* * static void startMethodTracingFd(String traceFileName, FileDescriptor fd, - * int bufferSize, int flags) + * int bufferSize, int flags, boolean samplingEnabled, int intervalUs) * * Start method trace profiling, sending results to a file descriptor. */ @@ -255,6 +255,8 @@ static void Dalvik_dalvik_system_VMDebug_startMethodTracingFd(const u4* args, Object* traceFd = (Object*) args[1]; int bufferSize = args[2]; int flags = args[3]; + bool samplingEnabled = args[4]; + int intervalUs = args[5]; int origFd = getFileDescriptor(traceFd); if (origFd < 0) @@ -272,14 +274,15 @@ static void Dalvik_dalvik_system_VMDebug_startMethodTracingFd(const u4* args, RETURN_VOID(); } - dvmMethodTraceStart(traceFileName, fd, bufferSize, flags, false, false, 0); + dvmMethodTraceStart(traceFileName, fd, bufferSize, flags, false, + samplingEnabled, intervalUs); free(traceFileName); RETURN_VOID(); } /* * static void startMethodTracingFilename(String traceFileName, int bufferSize, - * int flags) + * int flags, boolean samplingEnabled, int intervalUs) * * Start method trace profiling, sending results to a file. */ @@ -289,13 +292,16 @@ static void Dalvik_dalvik_system_VMDebug_startMethodTracingFilename(const u4* ar StringObject* traceFileStr = (StringObject*) args[0]; int bufferSize = args[1]; int flags = args[2]; + bool samplingEnabled = args[3]; + int intervalUs = args[4]; char* traceFileName = dvmCreateCstrFromString(traceFileStr); if (traceFileName == NULL) { RETURN_VOID(); } - dvmMethodTraceStart(traceFileName, -1, bufferSize, flags, false, false, 0); + dvmMethodTraceStart(traceFileName, -1, bufferSize, flags, false, + samplingEnabled, intervalUs); free(traceFileName); RETURN_VOID(); } @@ -823,9 +829,9 @@ const DalvikNativeMethod dvm_dalvik_system_VMDebug[] = { Dalvik_dalvik_system_VMDebug_stopAllocCounting }, { "startMethodTracingDdmsImpl", "(IIZI)V", Dalvik_dalvik_system_VMDebug_startMethodTracingDdmsImpl }, - { "startMethodTracingFd", "(Ljava/lang/String;Ljava/io/FileDescriptor;II)V", + { "startMethodTracingFd", "(Ljava/lang/String;Ljava/io/FileDescriptor;IIZI)V", Dalvik_dalvik_system_VMDebug_startMethodTracingFd }, - { "startMethodTracingFilename", "(Ljava/lang/String;II)V", + { "startMethodTracingFilename", "(Ljava/lang/String;IIZI)V", Dalvik_dalvik_system_VMDebug_startMethodTracingFilename }, { "getMethodTracingMode", "()I", Dalvik_dalvik_system_VMDebug_getMethodTracingMode }, diff --git a/vm/native/dalvik_system_VMRuntime.cpp b/vm/native/dalvik_system_VMRuntime.cpp index 4123426d8..b5cbe4883 100644 --- a/vm/native/dalvik_system_VMRuntime.cpp +++ b/vm/native/dalvik_system_VMRuntime.cpp @@ -104,11 +104,11 @@ static void Dalvik_dalvik_system_VMRuntime_newNonMovableArray(const u4* args, if (elementClass == NULL) { dvmThrowNullPointerException("elementClass == null"); - RETURN_VOID(); + RETURN_PTR(NULL); } if (length < 0) { dvmThrowNegativeArraySizeException(length); - RETURN_VOID(); + RETURN_PTR(NULL); } // TODO: right now, we don't have a copying collector, so there's no need @@ -120,7 +120,7 @@ static void Dalvik_dalvik_system_VMRuntime_newNonMovableArray(const u4* args, ALLOC_NON_MOVING); if (newArray == NULL) { assert(dvmCheckException(dvmThreadSelf())); - RETURN_VOID(); + RETURN_PTR(NULL); } dvmReleaseTrackedAlloc((Object*) newArray, NULL); @@ -195,7 +195,8 @@ static void Dalvik_dalvik_system_VMRuntime_vmLibrary(const u4* args, returnCString(pResult, "libdvm.so"); } -static void Dalvik_dalvik_system_VMRuntime_setTargetSdkVersion(const u4* args, +static void Dalvik_dalvik_system_VMRuntime_setTargetSdkVersionNative( + const u4* args, JValue* pResult) { // This is the target SDK version of the app we're about to run. @@ -238,6 +239,13 @@ static void Dalvik_dalvik_system_VMRuntime_registerNativeFree(const u4* args, RETURN_VOID(); } +static void Dalvik_dalvik_system_VMRuntime_updateProcessState(const u4* args, + JValue* pResult) +{ + RETURN_VOID(); +} + + static DvmDex* getDvmDexFromClassPathEntry(ClassPathEntry* cpe) { if (cpe->kind == kCpeDex) { return ((RawDexFile*) cpe->ptr)->pDvmDex; @@ -568,8 +576,8 @@ const DalvikNativeMethod dvm_dalvik_system_VMRuntime[] = { Dalvik_dalvik_system_VMRuntime_newNonMovableArray }, { "properties", "()[Ljava/lang/String;", Dalvik_dalvik_system_VMRuntime_properties }, - { "setTargetSdkVersion", "(I)V", - Dalvik_dalvik_system_VMRuntime_setTargetSdkVersion }, + { "setTargetSdkVersionNative", "(I)V", + Dalvik_dalvik_system_VMRuntime_setTargetSdkVersionNative }, { "startJitCompilation", "()V", Dalvik_dalvik_system_VMRuntime_startJitCompilation }, { "vmVersion", "()Ljava/lang/String;", @@ -580,6 +588,8 @@ const DalvikNativeMethod dvm_dalvik_system_VMRuntime[] = { Dalvik_dalvik_system_VMRuntime_registerNativeAllocation }, { "registerNativeFree", "(I)V", Dalvik_dalvik_system_VMRuntime_registerNativeFree }, + { "updateProcessState", "(I)V", + Dalvik_dalvik_system_VMRuntime_updateProcessState }, { "preloadDexCaches", "()V", Dalvik_dalvik_system_VMRuntime_preloadDexCaches }, { NULL, NULL, NULL }, diff --git a/vm/native/dalvik_system_Zygote.cpp b/vm/native/dalvik_system_Zygote.cpp index e2b618bab..e2d01022c 100644 --- a/vm/native/dalvik_system_Zygote.cpp +++ b/vm/native/dalvik_system_Zygote.cpp @@ -18,6 +18,7 @@ * dalvik.system.Zygote */ #include "Dalvik.h" +#include "Thread.h" #include "native/InternalNativePriv.h" #include <selinux/android.h> @@ -38,6 +39,7 @@ #include <sched.h> #include <sys/utsname.h> #include <sys/capability.h> +#include <sys/resource.h> #if defined(HAVE_PRCTL) # include <sys/prctl.h> @@ -285,13 +287,15 @@ static int mountEmulatedStorage(uid_t uid, u4 mountMode) { if (mountMode == MOUNT_EXTERNAL_MULTIUSER_ALL) { // Mount entire external storage tree for all users - if (mount(source, target, NULL, MS_BIND, NULL) == -1) { + if (TEMP_FAILURE_RETRY( + mount(source, target, NULL, MS_BIND, NULL)) == -1) { ALOGE("Failed to mount %s to %s: %s", source, target, strerror(errno)); return -1; } } else { // Only mount user-specific external storage - if (mount(source_user, target_user, NULL, MS_BIND, NULL) == -1) { + if (TEMP_FAILURE_RETRY( + mount(source_user, target_user, NULL, MS_BIND, NULL)) == -1) { ALOGE("Failed to mount %s to %s: %s", source_user, target_user, strerror(errno)); return -1; } @@ -302,7 +306,8 @@ static int mountEmulatedStorage(uid_t uid, u4 mountMode) { } // Finally, mount user-specific path into place for legacy users - if (mount(target_user, legacy, NULL, MS_BIND | MS_REC, NULL) == -1) { + if (TEMP_FAILURE_RETRY( + mount(target_user, legacy, NULL, MS_BIND | MS_REC, NULL)) == -1) { ALOGE("Failed to mount %s to %s: %s", target_user, legacy, strerror(errno)); return -1; } @@ -427,21 +432,22 @@ static void enableDebugFeatures(u4 debugFlags) static int setCapabilities(int64_t permitted, int64_t effective) { #ifdef HAVE_ANDROID_OS - struct __user_cap_header_struct capheader; - struct __user_cap_data_struct capdata; - + __user_cap_header_struct capheader; memset(&capheader, 0, sizeof(capheader)); - memset(&capdata, 0, sizeof(capdata)); - - capheader.version = _LINUX_CAPABILITY_VERSION; + capheader.version = _LINUX_CAPABILITY_VERSION_3; capheader.pid = 0; - capdata.effective = effective; - capdata.permitted = permitted; + __user_cap_data_struct capdata[2]; + memset(&capdata, 0, sizeof(capdata)); + capdata[0].effective = effective; + capdata[1].effective = effective >> 32; + capdata[0].permitted = permitted; + capdata[1].permitted = permitted >> 32; - ALOGV("CAPSET perm=%llx eff=%llx", permitted, effective); - if (capset(&capheader, &capdata) != 0) + if (capset(&capheader, &capdata[0]) == -1) { + ALOGE("capset(perm=%llx, eff=%llx) failed: %s", permitted, effective, strerror(errno)); return errno; + } #endif /*HAVE_ANDROID_OS*/ return 0; @@ -649,6 +655,13 @@ static pid_t forkAndSpecializeCommon(const u4* args, bool isSystemServer) ALOGE("cannot set SELinux context: %s\n", strerror(errno)); dvmAbort(); } + + // Set the comm to a nicer name. + if (isSystemServer && niceName == NULL) { + dvmSetThreadName("system_server"); + } else { + dvmSetThreadName(niceName); + } // These free(3) calls are safe because we know we're only ever forking // a single-threaded process, so we know no other thread held the heap // lock when we forked. diff --git a/vm/native/java_lang_Class.cpp b/vm/native/java_lang_Class.cpp index 9b3b2f0f5..f8a3a92f7 100644 --- a/vm/native/java_lang_Class.cpp +++ b/vm/native/java_lang_Class.cpp @@ -562,36 +562,6 @@ static void Dalvik_java_lang_Class_newInstance(const u4* args, JValue* pResult) } /* - * private Object[] getSignatureAnnotation() - * - * Returns the signature annotation array. - */ -static void Dalvik_java_lang_Class_getSignatureAnnotation(const u4* args, - JValue* pResult) -{ - ClassObject* clazz = (ClassObject*) args[0]; - ArrayObject* arr = dvmGetClassSignatureAnnotation(clazz); - - dvmReleaseTrackedAlloc((Object*) arr, NULL); - RETURN_PTR(arr); -} - -/* - * public Class getDeclaringClass() - * - * Get the class that encloses this class (if any). - */ -static void Dalvik_java_lang_Class_getDeclaringClass(const u4* args, - JValue* pResult) -{ - ClassObject* clazz = (ClassObject*) args[0]; - - ClassObject* enclosing = dvmGetDeclaringClass(clazz); - dvmReleaseTrackedAlloc((Object*) enclosing, NULL); - RETURN_PTR(enclosing); -} - -/* * public Class getEnclosingClass() * * Get the class that encloses this class (if any). @@ -648,32 +618,6 @@ static void Dalvik_java_lang_Class_getEnclosingMethod(const u4* args, RETURN_PTR(NULL); } -#if 0 -static void Dalvik_java_lang_Class_getGenericInterfaces(const u4* args, - JValue* pResult) -{ - dvmThrowUnsupportedOperationException("native method not implemented"); - - RETURN_PTR(NULL); -} - -static void Dalvik_java_lang_Class_getGenericSuperclass(const u4* args, - JValue* pResult) -{ - dvmThrowUnsupportedOperationException("native method not implemented"); - - RETURN_PTR(NULL); -} - -static void Dalvik_java_lang_Class_getTypeParameters(const u4* args, - JValue* pResult) -{ - dvmThrowUnsupportedOperationException("native method not implemented"); - - RETURN_PTR(NULL); -} -#endif - /* * public boolean isAnonymousClass() * @@ -699,6 +643,27 @@ static void Dalvik_java_lang_Class_isAnonymousClass(const u4* args, } /* + * public Class getDeclaringClass() + * + * Get the class that encloses this class (if any). + */ +static void Dalvik_java_lang_Class_getDeclaringClass(const u4* args, + JValue* pResult) +{ + JValue isAnonymousClass; + Dalvik_java_lang_Class_isAnonymousClass(args, &isAnonymousClass); + if (isAnonymousClass.z) { + RETURN_PTR(NULL); + } + + ClassObject* clazz = (ClassObject*) args[0]; + + ClassObject* enclosing = dvmGetDeclaringClass(clazz); + dvmReleaseTrackedAlloc((Object*) enclosing, NULL); + RETURN_PTR(enclosing); +} + +/* * private Annotation[] getDeclaredAnnotations() * * Return the annotations declared on this class. @@ -813,8 +778,6 @@ const DalvikNativeMethod dvm_java_lang_Class[] = { Dalvik_java_lang_Class_getClassLoader }, { "getComponentType", "()Ljava/lang/Class;", Dalvik_java_lang_Class_getComponentType }, - { "getSignatureAnnotation", "()[Ljava/lang/Object;", - Dalvik_java_lang_Class_getSignatureAnnotation }, { "getDeclaredClasses", "(Ljava/lang/Class;Z)[Ljava/lang/Class;", Dalvik_java_lang_Class_getDeclaredClasses }, { "getDeclaredConstructors", "(Ljava/lang/Class;Z)[Ljava/lang/reflect/Constructor;", diff --git a/vm/native/java_lang_System.cpp b/vm/native/java_lang_System.cpp index 1b07f85ad..d4aecac45 100644 --- a/vm/native/java_lang_System.cpp +++ b/vm/native/java_lang_System.cpp @@ -360,6 +360,41 @@ static void Dalvik_java_lang_System_arraycopy(const u4* args, JValue* pResult) } /* + * public static void arraycopyCharUnchecked(char[] src, int srcPos, char[] dest, + * int destPos, int length) + * + * This is a char[] specialized, native, unchecked version of + * arraycopy(). This assumes error checking has been done. + */ +static void Dalvik_java_lang_System_arraycopyCharUnchecked(const u4* args, JValue* pResult) +{ + ArrayObject* srcArray = (ArrayObject*) args[0]; + int srcPos = args[1]; + ArrayObject* dstArray = (ArrayObject*) args[2]; + int dstPos = args[3]; + int length = args[4]; + assert(srcArray != NULL); + assert(dstArray != NULL); + assert(dvmIsArray(srcArray)); + assert(dvmIsArray(dstArray)); + assert(srcPos >= 0 && dstPos >= 0 && length >= 0 && + srcPos + length <= (int) srcArray->length && + dstPos + length <= (int) dstArray->length); +#ifndef NDEBUG + ClassObject* srcClass = srcArray->clazz; + ClassObject* dstClass = dstArray->clazz; + char srcType = srcClass->descriptor[1]; + char dstType = dstClass->descriptor[1]; + assert(srcType == 'C' && dstType == 'C'); +#endif + /* 2 bytes per element */ + move16((u1*) dstArray->contents + dstPos * 2, + (const u1*) srcArray->contents + srcPos * 2, + length * 2); + RETURN_VOID(); +} + +/* * static int identityHashCode(Object x) * * Returns that hash code that the default hashCode() @@ -376,6 +411,8 @@ static void Dalvik_java_lang_System_identityHashCode(const u4* args, const DalvikNativeMethod dvm_java_lang_System[] = { { "arraycopy", "(Ljava/lang/Object;ILjava/lang/Object;II)V", Dalvik_java_lang_System_arraycopy }, + { "arraycopyCharUnchecked", "([CI[CII)V", + Dalvik_java_lang_System_arraycopyCharUnchecked }, { "identityHashCode", "(Ljava/lang/Object;)I", Dalvik_java_lang_System_identityHashCode }, { NULL, NULL, NULL }, diff --git a/vm/oo/Array.cpp b/vm/oo/Array.cpp index a03b29551..f5ede0497 100644 --- a/vm/oo/Array.cpp +++ b/vm/oo/Array.cpp @@ -59,6 +59,7 @@ static ArrayObject* allocArray(ClassObject* arrayClass, size_t length, if (newArray != NULL) { DVM_OBJECT_INIT(newArray, arrayClass); newArray->length = length; + ANDROID_MEMBAR_STORE(); dvmTrackAllocation(arrayClass, totalSize); } return newArray; diff --git a/vm/oo/Class.cpp b/vm/oo/Class.cpp index db5340ef5..904d53db5 100644 --- a/vm/oo/Class.cpp +++ b/vm/oo/Class.cpp @@ -23,6 +23,7 @@ #include "Dalvik.h" #include "libdex/DexClass.h" +#include "libdex/ZipArchive.h" #include "analysis/Optimize.h" #include <stdlib.h> @@ -886,6 +887,7 @@ StringObject* dvmGetBootPathResource(const char* name, int idx) const int kUrlOverhead = 13; // worst case for Jar URL const ClassPathEntry* cpe = gDvm.bootClassPath; StringObject* urlObj = NULL; + ZipEntry entry; ALOGV("+++ searching for resource '%s' in %d(%s)", name, idx, cpe[idx].fileName); @@ -904,7 +906,7 @@ StringObject* dvmGetBootPathResource(const char* name, int idx) case kCpeJar: { JarFile* pJarFile = (JarFile*) cpe->ptr; - if (dexZipFindEntry(&pJarFile->archive, name) == NULL) + if (dexZipFindEntry(pJarFile->archive, name, &entry) != 0) goto bail; sprintf(urlBuf, "jar:file://%s!/%s", cpe->fileName, name); } diff --git a/vm/reflect/Annotation.cpp b/vm/reflect/Annotation.cpp index 942027c7b..bbd58e953 100644 --- a/vm/reflect/Annotation.cpp +++ b/vm/reflect/Annotation.cpp @@ -1288,7 +1288,7 @@ bool dvmIsClassAnnotationPresent(const ClassObject* clazz, { const DexAnnotationSetItem* pAnnoSet = findAnnotationSetForClass(clazz); if (pAnnoSet == NULL) { - return NULL; + return false; } const DexAnnotationItem* pAnnoItem = getAnnotationItemFromAnnotationSet( clazz, pAnnoSet, kDexVisibilityRuntime, annotationClazz); @@ -1743,7 +1743,7 @@ bool dvmIsMethodAnnotationPresent(const ClassObject* clazz, { const DexAnnotationSetItem* pAnnoSet = findAnnotationSetForMethod(method); if (pAnnoSet == NULL) { - return NULL; + return false; } const DexAnnotationItem* pAnnoItem = getAnnotationItemFromAnnotationSet( clazz, pAnnoSet, kDexVisibilityRuntime, annotationClazz); @@ -2053,7 +2053,7 @@ bool dvmIsFieldAnnotationPresent(const ClassObject* clazz, { const DexAnnotationSetItem* pAnnoSet = findAnnotationSetForField(field); if (pAnnoSet == NULL) { - return NULL; + return false; } const DexAnnotationItem* pAnnoItem = getAnnotationItemFromAnnotationSet( clazz, pAnnoSet, kDexVisibilityRuntime, annotationClazz); |