diff --git a/test/testsuite/android_maple.py b/test/testsuite/android_maple.py index 476d579c063633ec3f442c940cd6deae1c8111bd..34ff480e59bb74c0c6dadbd09ae63cae6f249287 100644 --- a/test/testsuite/android_maple.py +++ b/test/testsuite/android_maple.py @@ -131,24 +131,7 @@ class MultiCompiler: opts.append(options) return opts - -class Javac(MultiCompiler): - def prepare(self, file_list): - temp_list = file_list.copy() - for in_file in temp_list: - name = in_file[0:-len(self._in_suffix)] - if in_file == name + self._in_suffix: - self._is_skipped = False - file_list.remove(in_file) - self._in_files_name = self._in_files_name + in_file + " " - else: - continue - if not self._is_skipped: - self._out_file_name = "*.class" - file_list.append(self._out_file_name) - - -class Jar(MultiCompiler): +class java2mpl(MultiCompiler): def prepare(self, file_list): global output_name temp_list = file_list.copy() @@ -165,15 +148,6 @@ class Jar(MultiCompiler): self._out_file_name = output_name.split("/")[-1].split(".")[0] + self._out_suffix file_list.append(self._out_file_name) - def _gen_cmd(self): - # Specify the output file name - cmd = [self._name] - cmd.extend(self._make_opts()) - cmd.extend(re.sub(r"\s+", " ", self._out_file_name).strip().split(" ")) - cmd.extend(re.sub(r"\s+", " ", self._in_files_name).strip().split(" ")) - return cmd - - class SingleCompiler(MultiCompiler): def prepare(self, file_list): is_single = 0 @@ -289,8 +263,7 @@ def do_prepare(components, info, maple_root): # # ----------------------------------------------------------------------- def do_update(components, file_type): - - if file_type == "java2de": + if file_type == "java2d8": components.pop("dex2mpl") components.pop("maple") components.pop("as") @@ -347,9 +320,8 @@ def main(): # components["jar"] = Jar("/usr/bin/jar", ".class", ".jar", "") # components["jbc2mpl"] = SingleCompiler("jbc2mpl", ".jar", ".mpl", "") - components["java2d8"] = SingleCompiler("java2d8", ".java", ".dex", "") - components["dex2mpl"] = SingleCompiler("dex2mpl", ".dex", ".mpl", "") - + components["java2d8"] = java2mpl("java2d8", ".java", ".dex", "") + components["dex2mpl"] = java2mpl("dex2mpl", ".dex", ".mpl", "") components["maple"] = SingleCompiler("maple", ".mpl", ".VtableImpl.s", "") components["as"] = MultiCompiler("clang++", ".s", ".o", "") components["cc"] = MultiCompiler("clang", ".c", ".o", "") diff --git a/test/testsuite/maple.py b/test/testsuite/maple.py index 48ba4e78e4e3b923cc615ac228da9afd3fd7f3ea..4e6343eba11b8f4c78822ca78bab9bf3312e3871 100644 --- a/test/testsuite/maple.py +++ b/test/testsuite/maple.py @@ -131,24 +131,7 @@ class MultiCompiler: opts.append(options) return opts - -class Javac(MultiCompiler): - def prepare(self, file_list): - temp_list = file_list.copy() - for in_file in temp_list: - name = in_file[0:-len(self._in_suffix)] - if in_file == name + self._in_suffix: - self._is_skipped = False - file_list.remove(in_file) - self._in_files_name = self._in_files_name + in_file + " " - else: - continue - if not self._is_skipped: - self._out_file_name = "*.class" - file_list.append(self._out_file_name) - - -class Jar(MultiCompiler): +class java2mpl(MultiCompiler): def prepare(self, file_list): global output_name temp_list = file_list.copy() @@ -165,15 +148,6 @@ class Jar(MultiCompiler): self._out_file_name = output_name.split("/")[-1].split(".")[0] + self._out_suffix file_list.append(self._out_file_name) - def _gen_cmd(self): - # Specify the output file name - cmd = [self._name] - cmd.extend(self._make_opts()) - cmd.extend(re.sub(r"\s+", " ", self._out_file_name).strip().split(" ")) - cmd.extend(re.sub(r"\s+", " ", self._in_files_name).strip().split(" ")) - return cmd - - class SingleCompiler(MultiCompiler): def prepare(self, file_list): is_single = 0 @@ -215,7 +189,7 @@ def do_init(components): parser.add_argument("-p", "--platform", dest="target", choices=["aarch64"], default="aarch64", help="choose toolchain target, default is aarch64") # Select compile phase - parser.add_argument("-s", "--stage", dest="stage", choices=["javac", "jar", "maple", "as", "ld"], default="ld", + parser.add_argument("-s", "--stage", dest="stage", choices=["java2d8", "dex2mpl", "maple", "as", "ld"], default="ld", help="Select the compiler stage, default is ld") # set timeout limitation parser.add_argument("--timeout", metavar="TIMEOUT", dest="timeout", default=None, type=int, @@ -246,8 +220,6 @@ def do_prepare(components, info, maple_root): maple_out_lib_path = maple_out_path + "/ops" maple_out_bin_path = maple_out_path + "/bin/" gnu_bin_path = maple_root + "/tools/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/" - javac_options = "-g -d . " - jar_options = "-cvf " as_options = "-g3 -O2 -x assembler-with-cpp -march=armv8-a -target aarch64-linux-gnu -c " cc_options = "-g3 -O2 -c -march=armv8-a -target aarch64-linux-gnu" cxx_options = "-g3 -O2 -c -fPIC -march=armv8-a -target aarch64-linux-gnu" @@ -256,45 +228,33 @@ def do_prepare(components, info, maple_root): + "-fuse-ld=lld -rdynamic -lcore-all -lcommon-bridge -Wl,-z,notext -Wl,-T"\ + maple_out_lib_path + "/linker/maplelld.so.lds" - components["javac"].update_info(None, info["javac"]) - components["jar"].update_info(None, info["jar"]) - components["jbc2mpl"].update_info(maple_out_bin_path, info["jbc2mpl"]) + components["java2d8"].update_info(maple_out_bin_path, info["java2d8"]) + components["dex2mpl"].update_info(maple_out_bin_path, info["dex2mpl"]) components["maple"].update_info(maple_out_bin_path, info["maple"]) components["as"].update_info(gnu_bin_path, info["as"]) components["cc"].update_info(gnu_bin_path, info["cc"]) components["cxx"].update_info(gnu_bin_path, info["cxx"]) components["ld"].update_info(gnu_bin_path, info["ld"]) - components["javac"].update_info(None, javac_options) - components["jar"].update_info(None, jar_options) components["as"].update_info(None, as_options) components["cc"].update_info(None, cc_options) components["cxx"].update_info(None, cxx_options) components["ld"].update_info(None, linker_options) - # ------------------------------------------------------------------------ # # Select compile phase: "javac", "jar", "maple", "as", "ld" # # ----------------------------------------------------------------------- def do_update(components, file_type): - if file_type == "javac": - components.pop("jar") - components.pop("jbc2mpl") - components.pop("maple") - components.pop("as") - components.pop("cc") - components.pop("cxx") - components.pop("ld") - elif file_type == "jar": - components.pop("jbc2mpl") + if file_type == "java2d8": + components.pop("dex2mpl") components.pop("maple") components.pop("as") components.pop("cc") components.pop("cxx") components.pop("ld") - elif file_type == "jbc2mpl": + elif file_type == "dex2mpl": components.pop("maple") components.pop("as") components.pop("cc") @@ -340,9 +300,8 @@ def main(): # initial all tool chain components: # set the default name, input suffix, output suffix, and if it support multi-inputs components = collections.OrderedDict() - components["javac"] = Javac("/usr/bin/javac", ".java", ".class", "") - components["jar"] = Jar("/usr/bin/jar", ".class", ".jar", "") - components["jbc2mpl"] = SingleCompiler("jbc2mpl", ".jar", ".mpl", "") + components["java2d8"] = java2mpl("java2d8", ".java", ".dex", "") + components["dex2mpl"] = java2mpl("dex2mpl", ".dex", ".mpl", "") components["maple"] = SingleCompiler("maple", ".mpl", ".VtableImpl.s", "") components["as"] = MultiCompiler("clang++", ".s", ".o", "") components["cc"] = MultiCompiler("clang", ".c", ".o", "") diff --git a/test/testsuite/ouroboros/test.cfg b/test/testsuite/ouroboros/test.cfg index 9fc0522ae09464e771d5d375894927c2c1db653e..08fe53d1a8bfa927c0c9e7bd3220b3483ff07adb 100644 --- a/test/testsuite/ouroboros/test.cfg +++ b/test/testsuite/ouroboros/test.cfg @@ -3,8 +3,11 @@ java = // [internal-var] maple = python3 ${MAPLE_ROOT}/test/testsuite/maple.py + run = python3 ${MAPLE_ROOT}/test/testsuite/run.py -build_option = --javac="-bootclasspath ${MAPLE_ROOT}/output/ops/third_party/JAVA_LIBRARIES/core-oj.com.android.art_intermediates/classes.jar:${MAPLE_ROOT}/output/ops/third_party/JAVA_LIBRARIES/core-libart.com.android.art_intermediates/classes.jar:${MAPLE_ROOT}/output/ops/third_party/JAVA_LIBRARIES/services_intermediates/classes.jar:." --jbc2mpl="-mplt ${MAPLE_ROOT}/libjava-core/libcore-all.mplt -dumpPragma -use-string-factory" --maple="-O0" --ld="-L${MAPLE_ROOT}/output/ops/host-x86_64-O2" --cxx="-I${MAPLE_ROOT}/output/ops/libnativehelper/include_jni" + +build_option = --dex2mpl="-mplt $MAPLE_ROOT/libjava-core/libcore-all.mplt -litprofile=${MAPLE_ROOT}/src/mrt/codetricks/profile.pv/meta.list" --maple="-O0" --ld=" -L${MAPLE_ROOT}/output/ops/host-x86_64-O2" --cxx="-I${MAPLE_ROOT}/output/ops/libnativehelper/include_jni" + run_option = [description]