diff options
38 files changed, 523 insertions, 261 deletions
diff --git a/build/Android.common_test.mk b/build/Android.common_test.mk index 93e310e0eb..6b7dc0932e 100644 --- a/build/Android.common_test.mk +++ b/build/Android.common_test.mk @@ -60,8 +60,8 @@ ART_TEST_OPTIMIZING ?= true # Do you want to test the optimizing compiler with graph coloring register allocation? ART_TEST_OPTIMIZING_GRAPH_COLOR ?= $(ART_TEST_FULL) -# Do we want to test a PIC-compiled core image? -ART_TEST_PIC_IMAGE ?= $(ART_TEST_FULL) +# Do we want to test a non-PIC-compiled core image? +ART_TEST_NPIC_IMAGE ?= $(ART_TEST_FULL) # Do we want to test PIC-compiled tests ("apps")? ART_TEST_PIC_TEST ?= $(ART_TEST_FULL) diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk index a7a29a579b..9120a3235d 100644 --- a/build/Android.gtest.mk +++ b/build/Android.gtest.mk @@ -90,16 +90,16 @@ ART_GTEST_transaction_test_DEX_DEPS := Transaction ART_GTEST_type_lookup_table_test_DEX_DEPS := Lookup # The elf writer test has dependencies on core.oat. -ART_GTEST_elf_writer_test_HOST_DEPS := $(HOST_CORE_IMAGE_default_no-pic_64) $(HOST_CORE_IMAGE_default_no-pic_32) -ART_GTEST_elf_writer_test_TARGET_DEPS := $(TARGET_CORE_IMAGE_default_no-pic_64) $(TARGET_CORE_IMAGE_default_no-pic_32) +ART_GTEST_elf_writer_test_HOST_DEPS := $(HOST_CORE_IMAGE_optimizing_no-pic_64) $(HOST_CORE_IMAGE_optimizing_no-pic_32) +ART_GTEST_elf_writer_test_TARGET_DEPS := $(TARGET_CORE_IMAGE_optimizing_no-pic_64) $(TARGET_CORE_IMAGE_optimizing_no-pic_32) ART_GTEST_dex2oat_environment_tests_HOST_DEPS := \ - $(HOST_CORE_IMAGE_default_no-pic_64) \ - $(HOST_CORE_IMAGE_default_no-pic_32) \ + $(HOST_CORE_IMAGE_optimizing_no-pic_64) \ + $(HOST_CORE_IMAGE_optimizing_no-pic_32) \ $(HOST_OUT_EXECUTABLES)/patchoatd ART_GTEST_dex2oat_environment_tests_TARGET_DEPS := \ - $(TARGET_CORE_IMAGE_default_no-pic_64) \ - $(TARGET_CORE_IMAGE_default_no-pic_32) \ + $(TARGET_CORE_IMAGE_optimizing_no-pic_64) \ + $(TARGET_CORE_IMAGE_optimizing_no-pic_32) \ $(TARGET_OUT_EXECUTABLES)/patchoatd ART_GTEST_oat_file_assistant_test_HOST_DEPS := \ @@ -114,62 +114,62 @@ ART_GTEST_dex2oat_test_TARGET_DEPS := \ $(ART_GTEST_dex2oat_environment_tests_TARGET_DEPS) # TODO: document why this is needed. -ART_GTEST_proxy_test_HOST_DEPS := $(HOST_CORE_IMAGE_default_no-pic_64) $(HOST_CORE_IMAGE_default_no-pic_32) +ART_GTEST_proxy_test_HOST_DEPS := $(HOST_CORE_IMAGE_optimizing_no-pic_64) $(HOST_CORE_IMAGE_optimizing_no-pic_32) # The dexdump test requires an image and the dexdump utility. # TODO: rename into dexdump when migration completes ART_GTEST_dexdump_test_HOST_DEPS := \ - $(HOST_CORE_IMAGE_default_no-pic_64) \ - $(HOST_CORE_IMAGE_default_no-pic_32) \ + $(HOST_CORE_IMAGE_optimizing_no-pic_64) \ + $(HOST_CORE_IMAGE_optimizing_no-pic_32) \ $(HOST_OUT_EXECUTABLES)/dexdump2 ART_GTEST_dexdump_test_TARGET_DEPS := \ - $(TARGET_CORE_IMAGE_default_no-pic_64) \ - $(TARGET_CORE_IMAGE_default_no-pic_32) \ + $(TARGET_CORE_IMAGE_optimizing_no-pic_64) \ + $(TARGET_CORE_IMAGE_optimizing_no-pic_32) \ dexdump2 # The dexlayout test requires an image and the dexlayout utility. # TODO: rename into dexdump when migration completes ART_GTEST_dexlayout_test_HOST_DEPS := \ - $(HOST_CORE_IMAGE_default_no-pic_64) \ - $(HOST_CORE_IMAGE_default_no-pic_32) \ + $(HOST_CORE_IMAGE_optimizing_no-pic_64) \ + $(HOST_CORE_IMAGE_optimizing_no-pic_32) \ $(HOST_OUT_EXECUTABLES)/dexlayout \ $(HOST_OUT_EXECUTABLES)/dexdump2 ART_GTEST_dexlayout_test_TARGET_DEPS := \ - $(TARGET_CORE_IMAGE_default_no-pic_64) \ - $(TARGET_CORE_IMAGE_default_no-pic_32) \ + $(TARGET_CORE_IMAGE_optimizing_no-pic_64) \ + $(TARGET_CORE_IMAGE_optimizing_no-pic_32) \ dexlayout \ dexdump2 # The dexlist test requires an image and the dexlist utility. ART_GTEST_dexlist_test_HOST_DEPS := \ - $(HOST_CORE_IMAGE_default_no-pic_64) \ - $(HOST_CORE_IMAGE_default_no-pic_32) \ + $(HOST_CORE_IMAGE_optimizing_no-pic_64) \ + $(HOST_CORE_IMAGE_optimizing_no-pic_32) \ $(HOST_OUT_EXECUTABLES)/dexlist ART_GTEST_dexlist_test_TARGET_DEPS := \ - $(TARGET_CORE_IMAGE_default_no-pic_64) \ - $(TARGET_CORE_IMAGE_default_no-pic_32) \ + $(TARGET_CORE_IMAGE_optimizing_no-pic_64) \ + $(TARGET_CORE_IMAGE_optimizing_no-pic_32) \ dexlist # The imgdiag test has dependencies on core.oat since it needs to load it during the test. # For the host, also add the installed tool (in the base size, that should suffice). For the # target, just the module is fine, the sync will happen late enough. ART_GTEST_imgdiag_test_HOST_DEPS := \ - $(HOST_CORE_IMAGE_default_no-pic_64) \ - $(HOST_CORE_IMAGE_default_no-pic_32) \ + $(HOST_CORE_IMAGE_optimizing_no-pic_64) \ + $(HOST_CORE_IMAGE_optimizing_no-pic_32) \ $(HOST_OUT_EXECUTABLES)/imgdiagd ART_GTEST_imgdiag_test_TARGET_DEPS := \ - $(TARGET_CORE_IMAGE_default_no-pic_64) \ - $(TARGET_CORE_IMAGE_default_no-pic_32) \ + $(TARGET_CORE_IMAGE_optimizing_no-pic_64) \ + $(TARGET_CORE_IMAGE_optimizing_no-pic_32) \ imgdiagd # Oatdump test requires an image and oatfile to dump. ART_GTEST_oatdump_test_HOST_DEPS := \ - $(HOST_CORE_IMAGE_default_no-pic_64) \ - $(HOST_CORE_IMAGE_default_no-pic_32) \ + $(HOST_CORE_IMAGE_optimizing_no-pic_64) \ + $(HOST_CORE_IMAGE_optimizing_no-pic_32) \ $(HOST_OUT_EXECUTABLES)/oatdumpd ART_GTEST_oatdump_test_TARGET_DEPS := \ - $(TARGET_CORE_IMAGE_default_no-pic_64) \ - $(TARGET_CORE_IMAGE_default_no-pic_32) \ + $(TARGET_CORE_IMAGE_optimizing_no-pic_64) \ + $(TARGET_CORE_IMAGE_optimizing_no-pic_32) \ oatdump # Profile assistant tests requires profman utility. @@ -695,7 +695,7 @@ valgrind-test-art-target-gtest-$$(art_gtest_name): $$(ART_TEST_TARGET_VALGRIND_G LOCAL_CLANG := $$(ART_HOST_CLANG) LOCAL_CFLAGS += $$(ART_HOST_CFLAGS) $$(ART_HOST_DEBUG_CFLAGS) LOCAL_ASFLAGS += $$(ART_HOST_ASFLAGS) $$(ART_HOST_DEBUG_ASFLAGS) - LOCAL_SHARED_LIBRARIES += libicuuc-host libicui18n-host libnativehelper libziparchive libz-host libvixld-arm libvixld-arm64 + LOCAL_SHARED_LIBRARIES += libicuuc libicui18n libnativehelper libziparchive libz-host libvixld-arm libvixld-arm64 LOCAL_LDLIBS := -lpthread -ldl LOCAL_IS_HOST_MODULE := true LOCAL_MULTILIB := both diff --git a/build/Android.oat.mk b/build/Android.oat.mk index 884f698cd9..c4887e61ff 100644 --- a/build/Android.oat.mk +++ b/build/Android.oat.mk @@ -37,7 +37,7 @@ else endif # Use dex2oat debug version for better error reporting -# $(1): compiler - default, optimizing, jit, interpreter or interpreter-access-checks. +# $(1): compiler - optimizing, interpreter or interpreter-access-checks. # $(2): pic/no-pic # $(3): 2ND_ or undefined, 2ND_ for 32-bit host builds. # $(4): wrapper, e.g., valgrind. @@ -53,13 +53,9 @@ define create-core-oat-host-rules core_pic_infix := core_dex2oat_dependency := $(DEX2OAT_DEPENDENCY) - ifeq ($(1),default) - core_compile_options += --compiler-backend=Quick - endif ifeq ($(1),optimizing) core_compile_options += --compiler-backend=Optimizing core_dex2oat_dependency := $(DEX2OAT) - core_infix := -optimizing endif ifeq ($(1),interpreter) core_compile_options += --compiler-filter=interpret-only @@ -69,24 +65,16 @@ define create-core-oat-host-rules core_compile_options += --compiler-filter=verify-at-runtime --runtime-arg -Xverify:softfail core_infix := -interp-ac endif - ifeq ($(1),jit) - core_compile_options += --compiler-filter=verify-at-runtime - core_infix := -jit - endif - ifeq ($(1),default) - # Default has no infix, no compile options. - endif - ifneq ($(filter-out default interpreter interp-ac jit optimizing,$(1)),) + ifneq ($(filter-out interpreter interp-ac optimizing,$(1)),) #Technically this test is not precise, but hopefully good enough. - $$(error found $(1) expected default, interpreter, interpreter-access-checks, jit or optimizing) + $$(error found $(1) expected interpreter, interpreter-access-checks, or optimizing) endif ifeq ($(2),pic) core_compile_options += --compile-pic - core_pic_infix := -pic endif ifeq ($(2),no-pic) - # No change for non-pic + core_pic_infix := -npic endif ifneq ($(filter-out pic no-pic,$(2)),) # Technically this test is not precise, but hopefully good enough. @@ -148,7 +136,7 @@ $$(core_oat_name): $$(core_image_name) core_pic_infix := endef # create-core-oat-host-rules -# $(1): compiler - default, optimizing, jit, interpreter or interpreter-access-checks. +# $(1): compiler - optimizing, interpreter or interpreter-access-checks. # $(2): wrapper. # $(3): dex2oat suffix. # $(4): multi-image. @@ -162,24 +150,18 @@ define create-core-oat-host-rule-combination endif endef -$(eval $(call create-core-oat-host-rule-combination,default,,,false)) $(eval $(call create-core-oat-host-rule-combination,optimizing,,,false)) $(eval $(call create-core-oat-host-rule-combination,interpreter,,,false)) $(eval $(call create-core-oat-host-rule-combination,interp-ac,,,false)) -$(eval $(call create-core-oat-host-rule-combination,jit,,,false)) -$(eval $(call create-core-oat-host-rule-combination,default,,,true)) $(eval $(call create-core-oat-host-rule-combination,optimizing,,,true)) $(eval $(call create-core-oat-host-rule-combination,interpreter,,,true)) $(eval $(call create-core-oat-host-rule-combination,interp-ac,,,true)) -$(eval $(call create-core-oat-host-rule-combination,jit,,,true)) valgrindHOST_CORE_IMG_OUTS := valgrindHOST_CORE_OAT_OUTS := -$(eval $(call create-core-oat-host-rule-combination,default,valgrind,32,false)) $(eval $(call create-core-oat-host-rule-combination,optimizing,valgrind,32,false)) $(eval $(call create-core-oat-host-rule-combination,interpreter,valgrind,32,false)) $(eval $(call create-core-oat-host-rule-combination,interp-ac,valgrind,32,false)) -$(eval $(call create-core-oat-host-rule-combination,jit,valgrind,32,false)) valgrind-test-art-host-dex2oat-host: $(valgrindHOST_CORE_IMG_OUTS) @@ -193,15 +175,11 @@ define create-core-oat-target-rules core_pic_infix := core_dex2oat_dependency := $(DEX2OAT_DEPENDENCY) - ifeq ($(1),default) - core_compile_options += --compiler-backend=Quick - endif ifeq ($(1),optimizing) core_compile_options += --compiler-backend=Optimizing # With the optimizing compiler, we want to rerun dex2oat whenever there is # a dex2oat change to catch regressions early. core_dex2oat_dependency := $(DEX2OAT) - core_infix := -optimizing endif ifeq ($(1),interpreter) core_compile_options += --compiler-filter=interpret-only @@ -211,24 +189,16 @@ define create-core-oat-target-rules core_compile_options += --compiler-filter=verify-at-runtime --runtime-arg -Xverify:softfail core_infix := -interp-ac endif - ifeq ($(1),jit) - core_compile_options += --compiler-filter=verify-at-runtime - core_infix := -jit - endif - ifeq ($(1),default) - # Default has no infix, no compile options. - endif - ifneq ($(filter-out default interpreter interp-ac jit optimizing,$(1)),) + ifneq ($(filter-out interpreter interp-ac optimizing,$(1)),) # Technically this test is not precise, but hopefully good enough. - $$(error found $(1) expected default, interpreter, interpreter-access-checks, jit or optimizing) + $$(error found $(1) expected interpreter, interpreter-access-checks, or optimizing) endif ifeq ($(2),pic) core_compile_options += --compile-pic - core_pic_infix := -pic endif ifeq ($(2),no-pic) - # No change for non-pic + core_pic_infix := -npic endif ifneq ($(filter-out pic no-pic,$(2)),) #Technically this test is not precise, but hopefully good enough. @@ -283,7 +253,7 @@ $$(core_oat_name): $$(core_image_name) core_pic_infix := endef # create-core-oat-target-rules -# $(1): compiler - default, optimizing, jit, interpreter or interpreter-access-checks. +# $(1): compiler - optimizing, interpreter or interpreter-access-checks. # $(2): wrapper. # $(3): dex2oat suffix. define create-core-oat-target-rule-combination @@ -296,19 +266,15 @@ define create-core-oat-target-rule-combination endif endef -$(eval $(call create-core-oat-target-rule-combination,default,,)) $(eval $(call create-core-oat-target-rule-combination,optimizing,,)) $(eval $(call create-core-oat-target-rule-combination,interpreter,,)) $(eval $(call create-core-oat-target-rule-combination,interp-ac,,)) -$(eval $(call create-core-oat-target-rule-combination,jit,,)) valgrindTARGET_CORE_IMG_OUTS := valgrindTARGET_CORE_OAT_OUTS := -$(eval $(call create-core-oat-target-rule-combination,default,valgrind,32)) $(eval $(call create-core-oat-target-rule-combination,optimizing,valgrind,32)) $(eval $(call create-core-oat-target-rule-combination,interpreter,valgrind,32)) $(eval $(call create-core-oat-target-rule-combination,interp-ac,valgrind,32)) -$(eval $(call create-core-oat-target-rule-combination,jit,valgrind,32)) valgrind-test-art-host-dex2oat-target: $(valgrindTARGET_CORE_IMG_OUTS) diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index daac7fbb96..53e068edf2 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -72,6 +72,7 @@ #include "utils/swap_space.h" #include "verifier/method_verifier.h" #include "verifier/method_verifier-inl.h" +#include "verifier/verifier_log_mode.h" namespace art { @@ -2258,7 +2259,7 @@ void CompilerDriver::Verify(jobject class_loader, class VerifyClassVisitor : public CompilationVisitor { public: - VerifyClassVisitor(const ParallelCompilationManager* manager, LogSeverity log_level) + VerifyClassVisitor(const ParallelCompilationManager* manager, verifier::HardFailLogMode log_level) : manager_(manager), log_level_(log_level) {} virtual void Visit(size_t class_def_index) REQUIRES(!Locks::mutator_lock_) OVERRIDE { @@ -2329,7 +2330,7 @@ class VerifyClassVisitor : public CompilationVisitor { private: const ParallelCompilationManager* const manager_; - const LogSeverity log_level_; + const verifier::HardFailLogMode log_level_; }; void CompilerDriver::VerifyDexFile(jobject class_loader, @@ -2342,9 +2343,9 @@ void CompilerDriver::VerifyDexFile(jobject class_loader, ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); ParallelCompilationManager context(class_linker, class_loader, this, &dex_file, dex_files, thread_pool); - LogSeverity log_level = GetCompilerOptions().AbortOnHardVerifierFailure() - ? LogSeverity::INTERNAL_FATAL - : LogSeverity::WARNING; + verifier::HardFailLogMode log_level = GetCompilerOptions().AbortOnHardVerifierFailure() + ? verifier::HardFailLogMode::kLogInternalFatal + : verifier::HardFailLogMode::kLogWarning; VerifyClassVisitor visitor(&context, log_level); context.ForAll(0, dex_file.NumClassDefs(), &visitor, thread_count); } diff --git a/compiler/optimizing/codegen_test.cc b/compiler/optimizing/codegen_test.cc index d00a7867e8..d9347f604e 100644 --- a/compiler/optimizing/codegen_test.cc +++ b/compiler/optimizing/codegen_test.cc @@ -74,6 +74,24 @@ namespace art { +typedef CodeGenerator* (*CreateCodegenFn)(HGraph*, const CompilerOptions&); + +class CodegenTargetConfig { + public: + CodegenTargetConfig(InstructionSet isa, CreateCodegenFn create_codegen) + : isa_(isa), create_codegen_(create_codegen) { + } + InstructionSet GetInstructionSet() const { return isa_; } + CodeGenerator* CreateCodeGenerator(HGraph* graph, const CompilerOptions& compiler_options) { + return create_codegen_(graph, compiler_options); + } + + private: + CodegenTargetConfig() {} + InstructionSet isa_; + CreateCodegenFn create_codegen_; +}; + #ifdef ART_ENABLE_CODEGEN_arm // Provide our own codegen, that ensures the C calling conventions // are preserved. Currently, ART and C do not match as R4 is caller-save @@ -222,12 +240,7 @@ static void Run(const InternalCodeAllocator& allocator, VerifyGeneratedCode(target_isa, f, has_result, expected); } -template <typename Expected> -static void RunCode(CodeGenerator* codegen, - HGraph* graph, - std::function<void(HGraph*)> hook_before_codegen, - bool has_result, - Expected expected) { +static void ValidateGraph(HGraph* graph) { GraphChecker graph_checker(graph); graph_checker.Run(); if (!graph_checker.IsValid()) { @@ -236,92 +249,129 @@ static void RunCode(CodeGenerator* codegen, } } ASSERT_TRUE(graph_checker.IsValid()); +} +template <typename Expected> +static void RunCodeNoCheck(CodeGenerator* codegen, + HGraph* graph, + std::function<void(HGraph*)> hook_before_codegen, + bool has_result, + Expected expected) { SsaLivenessAnalysis liveness(graph, codegen); - PrepareForRegisterAllocation(graph).Run(); liveness.Analyze(); RegisterAllocator::Create(graph->GetArena(), codegen, liveness)->AllocateRegisters(); hook_before_codegen(graph); - InternalCodeAllocator allocator; codegen->Compile(&allocator); Run(allocator, *codegen, has_result, expected); } template <typename Expected> -static void RunCode(InstructionSet target_isa, +static void RunCode(CodeGenerator* codegen, + HGraph* graph, + std::function<void(HGraph*)> hook_before_codegen, + bool has_result, + Expected expected) { + ValidateGraph(graph); + RunCodeNoCheck(codegen, graph, hook_before_codegen, has_result, expected); +} + +template <typename Expected> +static void RunCode(CodegenTargetConfig target_config, HGraph* graph, std::function<void(HGraph*)> hook_before_codegen, bool has_result, Expected expected) { CompilerOptions compiler_options; + CodeGenerator* codegen = target_config.CreateCodeGenerator(graph, compiler_options); + RunCode(codegen, graph, hook_before_codegen, has_result, expected); +} + #ifdef ART_ENABLE_CODEGEN_arm - if (target_isa == kArm || target_isa == kThumb2) { - std::unique_ptr<const ArmInstructionSetFeatures> features_arm( - ArmInstructionSetFeatures::FromCppDefines()); - TestCodeGeneratorARM codegenARM(graph, *features_arm.get(), compiler_options); - RunCode(&codegenARM, graph, hook_before_codegen, has_result, expected); - } +CodeGenerator* create_codegen_arm(HGraph* graph, const CompilerOptions& compiler_options) { + std::unique_ptr<const ArmInstructionSetFeatures> features_arm( + ArmInstructionSetFeatures::FromCppDefines()); + return new (graph->GetArena()) TestCodeGeneratorARM(graph, + *features_arm.get(), + compiler_options); +} #endif + #ifdef ART_ENABLE_CODEGEN_arm64 - if (target_isa == kArm64) { - std::unique_ptr<const Arm64InstructionSetFeatures> features_arm64( - Arm64InstructionSetFeatures::FromCppDefines()); - arm64::CodeGeneratorARM64 codegenARM64(graph, *features_arm64.get(), compiler_options); - RunCode(&codegenARM64, graph, hook_before_codegen, has_result, expected); - } +CodeGenerator* create_codegen_arm64(HGraph* graph, const CompilerOptions& compiler_options) { + std::unique_ptr<const Arm64InstructionSetFeatures> features_arm64( + Arm64InstructionSetFeatures::FromCppDefines()); + return new (graph->GetArena()) arm64::CodeGeneratorARM64(graph, + *features_arm64.get(), + compiler_options); +} #endif + #ifdef ART_ENABLE_CODEGEN_x86 - if (target_isa == kX86) { - std::unique_ptr<const X86InstructionSetFeatures> features_x86( - X86InstructionSetFeatures::FromCppDefines()); - TestCodeGeneratorX86 codegenX86(graph, *features_x86.get(), compiler_options); - RunCode(&codegenX86, graph, hook_before_codegen, has_result, expected); - } +CodeGenerator* create_codegen_x86(HGraph* graph, const CompilerOptions& compiler_options) { + std::unique_ptr<const X86InstructionSetFeatures> features_x86( + X86InstructionSetFeatures::FromCppDefines()); + return new (graph->GetArena()) TestCodeGeneratorX86(graph, *features_x86.get(), compiler_options); +} #endif + #ifdef ART_ENABLE_CODEGEN_x86_64 - if (target_isa == kX86_64) { - std::unique_ptr<const X86_64InstructionSetFeatures> features_x86_64( - X86_64InstructionSetFeatures::FromCppDefines()); - x86_64::CodeGeneratorX86_64 codegenX86_64(graph, *features_x86_64.get(), compiler_options); - RunCode(&codegenX86_64, graph, hook_before_codegen, has_result, expected); - } +CodeGenerator* create_codegen_x86_64(HGraph* graph, const CompilerOptions& compiler_options) { + std::unique_ptr<const X86_64InstructionSetFeatures> features_x86_64( + X86_64InstructionSetFeatures::FromCppDefines()); + return new (graph->GetArena()) + x86_64::CodeGeneratorX86_64(graph, *features_x86_64.get(), compiler_options); +} #endif + #ifdef ART_ENABLE_CODEGEN_mips - if (target_isa == kMips) { - std::unique_ptr<const MipsInstructionSetFeatures> features_mips( - MipsInstructionSetFeatures::FromCppDefines()); - mips::CodeGeneratorMIPS codegenMIPS(graph, *features_mips.get(), compiler_options); - RunCode(&codegenMIPS, graph, hook_before_codegen, has_result, expected); - } +CodeGenerator* create_codegen_mips(HGraph* graph, const CompilerOptions& compiler_options) { + std::unique_ptr<const MipsInstructionSetFeatures> features_mips( + MipsInstructionSetFeatures::FromCppDefines()); + return new (graph->GetArena()) + mips::CodeGeneratorMIPS(graph, *features_mips.get(), compiler_options); +} #endif + #ifdef ART_ENABLE_CODEGEN_mips64 - if (target_isa == kMips64) { - std::unique_ptr<const Mips64InstructionSetFeatures> features_mips64( - Mips64InstructionSetFeatures::FromCppDefines()); - mips64::CodeGeneratorMIPS64 codegenMIPS64(graph, *features_mips64.get(), compiler_options); - RunCode(&codegenMIPS64, graph, hook_before_codegen, has_result, expected); - } -#endif +CodeGenerator* create_codegen_mips64(HGraph* graph, const CompilerOptions& compiler_options) { + std::unique_ptr<const Mips64InstructionSetFeatures> features_mips64( + Mips64InstructionSetFeatures::FromCppDefines()); + return new (graph->GetArena()) + mips64::CodeGeneratorMIPS64(graph, *features_mips64.get(), compiler_options); } +#endif -static ::std::vector<InstructionSet> GetTargetISAs() { - ::std::vector<InstructionSet> v; - // Add all ISAs that are executable on hardware or on simulator. - const ::std::vector<InstructionSet> executable_isa_candidates = { - kArm, - kArm64, - kThumb2, - kX86, - kX86_64, - kMips, - kMips64 +// Return all combinations of ISA and code generator that are executable on +// hardware, or on simulator, and that we'd like to test. +static ::std::vector<CodegenTargetConfig> GetTargetConfigs() { + ::std::vector<CodegenTargetConfig> v; + ::std::vector<CodegenTargetConfig> test_config_candidates = { +#ifdef ART_ENABLE_CODEGEN_arm + CodegenTargetConfig(kArm, create_codegen_arm), + CodegenTargetConfig(kThumb2, create_codegen_arm), +#endif +#ifdef ART_ENABLE_CODEGEN_arm64 + CodegenTargetConfig(kArm64, create_codegen_arm64), +#endif +#ifdef ART_ENABLE_CODEGEN_x86 + CodegenTargetConfig(kX86, create_codegen_x86), +#endif +#ifdef ART_ENABLE_CODEGEN_x86_64 + CodegenTargetConfig(kX86_64, create_codegen_x86_64), +#endif +#ifdef ART_ENABLE_CODEGEN_mips + CodegenTargetConfig(kMips, create_codegen_mips), +#endif +#ifdef ART_ENABLE_CODEGEN_mips64 + CodegenTargetConfig(kMips64, create_codegen_mips64) +#endif }; - for (auto target_isa : executable_isa_candidates) { - if (CanExecute(target_isa)) { - v.push_back(target_isa); + for (auto test_config : test_config_candidates) { + if (CanExecute(test_config.GetInstructionSet())) { + v.push_back(test_config); } } @@ -331,26 +381,26 @@ static ::std::vector<InstructionSet> GetTargetISAs() { static void TestCode(const uint16_t* data, bool has_result = false, int32_t expected = 0) { - for (InstructionSet target_isa : GetTargetISAs()) { + for (CodegenTargetConfig target_config : GetTargetConfigs()) { ArenaPool pool; ArenaAllocator arena(&pool); HGraph* graph = CreateCFG(&arena, data); // Remove suspend checks, they cannot be executed in this context. RemoveSuspendChecks(graph); - RunCode(target_isa, graph, [](HGraph*) {}, has_result, expected); + RunCode(target_config, graph, [](HGraph*) {}, has_result, expected); } } static void TestCodeLong(const uint16_t* data, bool has_result, int64_t expected) { - for (InstructionSet target_isa : GetTargetISAs()) { + for (CodegenTargetConfig target_config : GetTargetConfigs()) { ArenaPool pool; ArenaAllocator arena(&pool); HGraph* graph = CreateCFG(&arena, data, Primitive::kPrimLong); // Remove suspend checks, they cannot be executed in this context. RemoveSuspendChecks(graph); - RunCode(target_isa, graph, [](HGraph*) {}, has_result, expected); + RunCode(target_config, graph, [](HGraph*) {}, has_result, expected); } } @@ -667,7 +717,7 @@ TEST_F(CodegenTest, ReturnMulIntLit16) { } TEST_F(CodegenTest, NonMaterializedCondition) { - for (InstructionSet target_isa : GetTargetISAs()) { + for (CodegenTargetConfig target_config : GetTargetConfigs()) { ArenaPool pool; ArenaAllocator allocator(&pool); @@ -715,12 +765,12 @@ TEST_F(CodegenTest, NonMaterializedCondition) { block->InsertInstructionBefore(move, block->GetLastInstruction()); }; - RunCode(target_isa, graph, hook_before_codegen, true, 0); + RunCode(target_config, graph, hook_before_codegen, true, 0); } } TEST_F(CodegenTest, MaterializedCondition1) { - for (InstructionSet target_isa : GetTargetISAs()) { + for (CodegenTargetConfig target_config : GetTargetConfigs()) { // Check that condition are materialized correctly. A materialized condition // should yield `1` if it evaluated to true, and `0` otherwise. // We force the materialization of comparisons for different combinations of @@ -762,13 +812,13 @@ TEST_F(CodegenTest, MaterializedCondition1) { HParallelMove* move = new (graph_in->GetArena()) HParallelMove(graph_in->GetArena()); block->InsertInstructionBefore(move, block->GetLastInstruction()); }; - RunCode(target_isa, graph, hook_before_codegen, true, lhs[i] < rhs[i]); + RunCode(target_config, graph, hook_before_codegen, true, lhs[i] < rhs[i]); } } } TEST_F(CodegenTest, MaterializedCondition2) { - for (InstructionSet target_isa : GetTargetISAs()) { + for (CodegenTargetConfig target_config : GetTargetConfigs()) { // Check that HIf correctly interprets a materialized condition. // We force the materialization of comparisons for different combinations of // inputs. An HIf takes the materialized combination as input and returns a @@ -830,7 +880,7 @@ TEST_F(CodegenTest, MaterializedCondition2) { HParallelMove* move = new (graph_in->GetArena()) HParallelMove(graph_in->GetArena()); block->InsertInstructionBefore(move, block->GetLastInstruction()); }; - RunCode(target_isa, graph, hook_before_codegen, true, lhs[i] < rhs[i]); + RunCode(target_config, graph, hook_before_codegen, true, lhs[i] < rhs[i]); } } } @@ -859,7 +909,7 @@ static void TestComparison(IfCondition condition, int64_t i, int64_t j, Primitive::Type type, - const InstructionSet target_isa) { + const CodegenTargetConfig target_config) { ArenaPool pool; ArenaAllocator allocator(&pool); HGraph* graph = CreateGraph(&allocator); @@ -941,23 +991,16 @@ static void TestComparison(IfCondition condition, block->AddInstruction(new (&allocator) HReturn(comparison)); graph->BuildDominatorTree(); - RunCode(target_isa, graph, [](HGraph*) {}, true, expected_result); + RunCode(target_config, graph, [](HGraph*) {}, true, expected_result); } TEST_F(CodegenTest, ComparisonsInt) { - for (InstructionSet target_isa : GetTargetISAs()) { + for (CodegenTargetConfig target_config : GetTargetConfigs()) { for (int64_t i = -1; i <= 1; i++) { for (int64_t j = -1; j <= 1; j++) { - TestComparison(kCondEQ, i, j, Primitive::kPrimInt, target_isa); - TestComparison(kCondNE, i, j, Primitive::kPrimInt, target_isa); - TestComparison(kCondLT, i, j, Primitive::kPrimInt, target_isa); - TestComparison(kCondLE, i, j, Primitive::kPrimInt, target_isa); - TestComparison(kCondGT, i, j, Primitive::kPrimInt, target_isa); - TestComparison(kCondGE, i, j, Primitive::kPrimInt, target_isa); - TestComparison(kCondB, i, j, Primitive::kPrimInt, target_isa); - TestComparison(kCondBE, i, j, Primitive::kPrimInt, target_isa); - TestComparison(kCondA, i, j, Primitive::kPrimInt, target_isa); - TestComparison(kCondAE, i, j, Primitive::kPrimInt, target_isa); + for (int cond = kCondFirst; cond <= kCondLast; cond++) { + TestComparison(static_cast<IfCondition>(cond), i, j, Primitive::kPrimInt, target_config); + } } } } @@ -969,23 +1012,17 @@ TEST_F(CodegenTest, ComparisonsLong) { return; } - for (InstructionSet target_isa : GetTargetISAs()) { - if (target_isa == kMips || target_isa == kMips64) { + for (CodegenTargetConfig target_config : GetTargetConfigs()) { + if ((target_config.GetInstructionSet() == kMips) || + (target_config.GetInstructionSet() == kMips64)) { continue; } for (int64_t i = -1; i <= 1; i++) { for (int64_t j = -1; j <= 1; j++) { - TestComparison(kCondEQ, i, j, Primitive::kPrimLong, target_isa); - TestComparison(kCondNE, i, j, Primitive::kPrimLong, target_isa); - TestComparison(kCondLT, i, j, Primitive::kPrimLong, target_isa); - TestComparison(kCondLE, i, j, Primitive::kPrimLong, target_isa); - TestComparison(kCondGT, i, j, Primitive::kPrimLong, target_isa); - TestComparison(kCondGE, i, j, Primitive::kPrimLong, target_isa); - TestComparison(kCondB, i, j, Primitive::kPrimLong, target_isa); - TestComparison(kCondBE, i, j, Primitive::kPrimLong, target_isa); - TestComparison(kCondA, i, j, Primitive::kPrimLong, target_isa); - TestComparison(kCondAE, i, j, Primitive::kPrimLong, target_isa); + for (int cond = kCondFirst; cond <= kCondLast; cond++) { + TestComparison(static_cast<IfCondition>(cond), i, j, Primitive::kPrimLong, target_config); + } } } } diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 149a71d1b9..99d7673467 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -109,6 +109,9 @@ enum IfCondition { kCondBE, // <= kCondA, // > kCondAE, // >= + // First and last aliases. + kCondFirst = kCondEQ, + kCondLast = kCondAE, }; enum GraphAnalysisResult { diff --git a/disassembler/Android.bp b/disassembler/Android.bp index d06e4de9b6..b074d9f9bf 100644 --- a/disassembler/Android.bp +++ b/disassembler/Android.bp @@ -26,9 +26,9 @@ art_cc_defaults { "disassembler_mips.cc", "disassembler_x86.cc", ], + include_dirs: ["art/runtime"], shared_libs: [ - "liblog", "libbase", ], export_include_dirs: ["."], @@ -38,9 +38,8 @@ art_cc_library { name: "libart-disassembler", defaults: ["libart-disassembler-defaults"], shared_libs: [ - "libart", // For disassembler_arm64. - "libvixld-arm64", + "libvixl-arm64", ], } @@ -51,7 +50,6 @@ art_cc_library { "art_debug_defaults", ], shared_libs: [ - "libartd", // For disassembler_arm64. "libvixld-arm64", ], diff --git a/runtime/Android.bp b/runtime/Android.bp index a88450506e..b61976c47b 100644 --- a/runtime/Android.bp +++ b/runtime/Android.bp @@ -155,6 +155,7 @@ cc_defaults { "native/java_lang_reflect_Constructor.cc", "native/java_lang_reflect_Field.cc", "native/java_lang_reflect_Method.cc", + "native/java_lang_reflect_Parameter.cc", "native/java_lang_reflect_Proxy.cc", "native/java_util_concurrent_atomic_AtomicLong.cc", "native/libcore_util_CharsetUtils.cc", diff --git a/runtime/base/logging.cc b/runtime/base/logging.cc index 529c391fd3..e00e62d368 100644 --- a/runtime/base/logging.cc +++ b/runtime/base/logging.cc @@ -187,7 +187,7 @@ class LogMessageData { LogMessage::LogMessage(const char* file, unsigned int line, LogSeverity severity, int error) : data_(new LogMessageData(file, line, severity, error)) { if (PrintDirectly(severity)) { - static constexpr char kLogCharacters[] = { 'N', 'V', 'D', 'I', 'W', 'E', 'F', 'F' }; + static constexpr char kLogCharacters[] = { 'V', 'D', 'I', 'W', 'E', 'F', 'F' }; static_assert(arraysize(kLogCharacters) == static_cast<size_t>(INTERNAL_FATAL) + 1, "Wrong character array size"); stream() << ProgramInvocationShortName() << " " << kLogCharacters[static_cast<size_t>(severity)] @@ -198,7 +198,7 @@ LogMessage::~LogMessage() { if (PrintDirectly(data_->GetSeverity())) { // Add newline at the end to match the not printing directly behavior. std::cerr << '\n'; - } else if (data_->GetSeverity() != LogSeverity::NONE) { + } else { if (data_->GetSeverity() < gMinimumLogSeverity) { return; // No need to format something we're not going to output. } @@ -242,7 +242,6 @@ std::ostream& LogMessage::stream() { #ifdef ART_TARGET_ANDROID static const android_LogPriority kLogSeverityToAndroidLogPriority[] = { - ANDROID_LOG_VERBOSE, // NONE, use verbose as stand-in, will never be printed. ANDROID_LOG_VERBOSE, ANDROID_LOG_DEBUG, ANDROID_LOG_INFO, ANDROID_LOG_WARN, ANDROID_LOG_ERROR, ANDROID_LOG_FATAL, ANDROID_LOG_FATAL }; @@ -252,10 +251,6 @@ static_assert(arraysize(kLogSeverityToAndroidLogPriority) == INTERNAL_FATAL + 1, void LogMessage::LogLine(const char* file, unsigned int line, LogSeverity log_severity, const char* message) { - if (log_severity == LogSeverity::NONE) { - return; - } - #ifdef ART_TARGET_ANDROID const char* tag = ProgramInvocationShortName(); int priority = kLogSeverityToAndroidLogPriority[static_cast<size_t>(log_severity)]; @@ -265,7 +260,7 @@ void LogMessage::LogLine(const char* file, unsigned int line, LogSeverity log_se LOG_PRI(priority, tag, "%s", message); } #else - static const char* log_characters = "NVDIWEFF"; + static const char* log_characters = "VDIWEFF"; CHECK_EQ(strlen(log_characters), INTERNAL_FATAL + 1U); char severity = log_characters[log_severity]; fprintf(stderr, "%s %c %5d %5d %s:%u] %s\n", @@ -275,10 +270,6 @@ void LogMessage::LogLine(const char* file, unsigned int line, LogSeverity log_se void LogMessage::LogLineLowStack(const char* file, unsigned int line, LogSeverity log_severity, const char* message) { - if (log_severity == LogSeverity::NONE) { - return; - } - #ifdef ART_TARGET_ANDROID // Use android_writeLog() to avoid stack-based buffers used by android_printLog(). const char* tag = ProgramInvocationShortName(); @@ -300,7 +291,7 @@ void LogMessage::LogLineLowStack(const char* file, unsigned int line, LogSeverit android_writeLog(priority, tag, message); } #else - static constexpr char kLogCharacters[] = { 'N', 'V', 'D', 'I', 'W', 'E', 'F', 'F' }; + static constexpr char kLogCharacters[] = { 'V', 'D', 'I', 'W', 'E', 'F', 'F' }; static_assert(arraysize(kLogCharacters) == static_cast<size_t>(INTERNAL_FATAL) + 1, "Wrong character array size"); diff --git a/runtime/base/logging.h b/runtime/base/logging.h index f43cb8bcc6..185aa0e577 100644 --- a/runtime/base/logging.h +++ b/runtime/base/logging.h @@ -24,7 +24,6 @@ namespace art { enum LogSeverity { - NONE, // Fake level, don't log at all. VERBOSE, DEBUG, INFO, diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 8edb1b4d18..4d252e1be9 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -3848,7 +3848,9 @@ bool ClassLinker::AttemptSupertypeVerification(Thread* self, return false; } -void ClassLinker::VerifyClass(Thread* self, Handle<mirror::Class> klass, LogSeverity log_level) { +void ClassLinker::VerifyClass(Thread* self, + Handle<mirror::Class> klass, + verifier::HardFailLogMode log_level) { { // TODO: assert that the monitor on the Class is held ObjectLock<mirror::Class> lock(self, klass); diff --git a/runtime/class_linker.h b/runtime/class_linker.h index 4bd1bd2428..5e4ae03782 100644 --- a/runtime/class_linker.h +++ b/runtime/class_linker.h @@ -36,6 +36,7 @@ #include "jni.h" #include "oat_file.h" #include "object_callbacks.h" +#include "verifier/verifier_log_mode.h" namespace art { @@ -460,7 +461,7 @@ class ClassLinker { void VerifyClass(Thread* self, Handle<mirror::Class> klass, - LogSeverity log_level = LogSeverity::NONE) + verifier::HardFailLogMode log_level = verifier::HardFailLogMode::kLogNone) REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!dex_lock_); bool VerifyClassUsingOatFile(const DexFile& dex_file, diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc index 3be39a1f79..5e0ee6fe23 100644 --- a/runtime/class_linker_test.cc +++ b/runtime/class_linker_test.cc @@ -697,6 +697,9 @@ struct FieldOffsets : public CheckOffsets<mirror::Field> { struct ExecutableOffsets : public CheckOffsets<mirror::Executable> { ExecutableOffsets() : CheckOffsets<mirror::Executable>( false, "Ljava/lang/reflect/Executable;") { + addOffset(OFFSETOF_MEMBER(mirror::Executable, has_real_parameter_data_), + "hasRealParameterData"); + addOffset(OFFSETOF_MEMBER(mirror::Executable, parameters_), "parameters"); }; }; diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc index dba0a81125..5bc4e88107 100644 --- a/runtime/common_runtime_test.cc +++ b/runtime/common_runtime_test.cc @@ -591,9 +591,9 @@ std::string CommonRuntimeTestImpl::GetCoreFileLocation(const char* suffix) { if (IsHost()) { const char* host_dir = getenv("ANDROID_HOST_OUT"); CHECK(host_dir != nullptr); - location = StringPrintf("%s/framework/core.%s", host_dir, suffix); + location = StringPrintf("%s/framework/core-npic.%s", host_dir, suffix); } else { - location = StringPrintf("/data/art-test/core.%s", suffix); + location = StringPrintf("/data/art-test/core-npic.%s", suffix); } return location; diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc index ebadd7951c..76cd348d8e 100644 --- a/runtime/dex_file.cc +++ b/runtime/dex_file.cc @@ -1431,6 +1431,34 @@ mirror::ObjectArray<mirror::Object>* DexFile::GetParameterAnnotations(ArtMethod* return ProcessAnnotationSetRefList(method_class, set_ref_list, size); } +mirror::Object* DexFile::GetAnnotationForMethodParameter(ArtMethod* method, + uint32_t parameter_idx, + Handle<mirror::Class> annotation_class) + const { + const ParameterAnnotationsItem* parameter_annotations = FindAnnotationsItemForMethod(method); + if (parameter_annotations == nullptr) { + return nullptr; + } + const AnnotationSetRefList* set_ref_list = + GetParameterAnnotationSetRefList(parameter_annotations); + if (set_ref_list == nullptr) { + return nullptr; + } + + if (parameter_idx >= set_ref_list->size_) { + return nullptr; + } + const AnnotationSetRefItem* annotation_set_ref = &set_ref_list->list_[parameter_idx]; + const AnnotationSetItem* annotation_set = GetSetRefItemItem(annotation_set_ref); + + StackHandleScope<1> hs(Thread::Current()); + Handle<mirror::Class> method_class(hs.NewHandle(method->GetDeclaringClass())); + return GetAnnotationObjectFromAnnotationSet(method_class, + annotation_set, + kDexVisibilityRuntime, + annotation_class); +} + mirror::ObjectArray<mirror::String>* DexFile::GetSignatureAnnotationForMethod(ArtMethod* method) const { const AnnotationSetItem* annotation_set = FindAnnotationSetForMethod(method); diff --git a/runtime/dex_file.h b/runtime/dex_file.h index ebbde0a602..23676bdbf7 100644 --- a/runtime/dex_file.h +++ b/runtime/dex_file.h @@ -953,6 +953,10 @@ class DexFile { REQUIRES_SHARED(Locks::mutator_lock_); mirror::Object* GetAnnotationForMethod(ArtMethod* method, Handle<mirror::Class> annotation_class) const REQUIRES_SHARED(Locks::mutator_lock_); + mirror::Object* GetAnnotationForMethodParameter(ArtMethod* method, + uint32_t parameter_idx, + Handle<mirror::Class> annotation_class) const + REQUIRES_SHARED(Locks::mutator_lock_); mirror::ObjectArray<mirror::Object>* GetAnnotationsForMethod(ArtMethod* method) const REQUIRES_SHARED(Locks::mutator_lock_); mirror::ObjectArray<mirror::Class>* GetExceptionTypesForMethod(ArtMethod* method) const diff --git a/runtime/mirror/abstract_method.h b/runtime/mirror/abstract_method.h index 22a3ea860b..9c2061387e 100644 --- a/runtime/mirror/abstract_method.h +++ b/runtime/mirror/abstract_method.h @@ -63,8 +63,8 @@ class MANAGED AbstractMethod : public Executable { HeapReference<mirror::Class> declaring_class_; HeapReference<mirror::Class> declaring_class_of_overridden_method_; - uint32_t access_flags_; uint64_t art_method_; + uint32_t access_flags_; uint32_t dex_method_index_; friend struct art::AbstractMethodOffsets; // for verifying offset information diff --git a/runtime/mirror/accessible_object.h b/runtime/mirror/accessible_object.h index 1d934a8eed..2581ac214f 100644 --- a/runtime/mirror/accessible_object.h +++ b/runtime/mirror/accessible_object.h @@ -47,9 +47,8 @@ class MANAGED AccessibleObject : public Object { private: uint8_t flag_; - // Padding required for now since "packed" will cause reflect.Field fields to not be aligned - // otherwise. - uint8_t padding_[3]; + // Padding required for correct alignment of subclasses like Executable, Field, etc. + uint8_t padding_[1]; DISALLOW_IMPLICIT_CONSTRUCTORS(AccessibleObject); }; diff --git a/runtime/mirror/executable.h b/runtime/mirror/executable.h index 87866579f5..232fce8693 100644 --- a/runtime/mirror/executable.h +++ b/runtime/mirror/executable.h @@ -33,6 +33,9 @@ namespace mirror { // C++ mirror of java.lang.reflect.Executable. class MANAGED Executable : public AccessibleObject { private: + uint16_t has_real_parameter_data_; + HeapReference<mirror::Array> parameters_; + friend struct art::ExecutableOffsets; // for verifying offset information DISALLOW_IMPLICIT_CONSTRUCTORS(Executable); }; diff --git a/runtime/mirror/field.h b/runtime/mirror/field.h index 7eb9da4126..f378568258 100644 --- a/runtime/mirror/field.h +++ b/runtime/mirror/field.h @@ -99,6 +99,9 @@ class MANAGED Field : public AccessibleObject { REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_); private: + // Padding required for matching alignment with the Java peer. + uint8_t padding_[2]; + HeapReference<mirror::Class> declaring_class_; HeapReference<mirror::Class> type_; int32_t access_flags_; diff --git a/runtime/native/java_lang_reflect_Parameter.cc b/runtime/native/java_lang_reflect_Parameter.cc new file mode 100644 index 0000000000..8fe3bb590e --- /dev/null +++ b/runtime/native/java_lang_reflect_Parameter.cc @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2016 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. + */ + +#include "java_lang_reflect_Parameter.h" + +#include "art_method-inl.h" +#include "common_throws.h" +#include "dex_file-inl.h" +#include "jni_internal.h" +#include "scoped_fast_native_object_access.h" +#include "utils.h" + +namespace art { + +static jobject Parameter_getAnnotationNative(JNIEnv* env, + jclass, + jobject javaMethod, + jint parameterIndex, + jclass annotationType) { + ScopedFastNativeObjectAccess soa(env); + if (UNLIKELY(javaMethod == nullptr)) { + ThrowNullPointerException("javaMethod == null"); + return nullptr; + } + + ArtMethod* method = ArtMethod::FromReflectedMethod(soa, javaMethod); + if (method->IsProxyMethod()) { + return nullptr; + } + + uint32_t parameter_count = method->GetParameterTypeList()->Size(); + if (UNLIKELY(parameterIndex < 0 || static_cast<uint32_t>(parameterIndex) >= parameter_count)) { + ThrowIllegalArgumentException( + StringPrintf("Illegal parameterIndex %d for %s, parameter_count is %d", + parameterIndex, + PrettyMethod(method).c_str(), + parameter_count).c_str()); + return nullptr; + } + + StackHandleScope<1> hs(soa.Self()); + Handle<mirror::Class> klass(hs.NewHandle(soa.Decode<mirror::Class*>(annotationType))); + return soa.AddLocalReference<jobject>( + method->GetDexFile()->GetAnnotationForMethodParameter(method, parameterIndex, klass)); +} + +static JNINativeMethod gMethods[] = { + NATIVE_METHOD(Parameter, + getAnnotationNative, + "!(Ljava/lang/reflect/Executable;ILjava/lang/Class;)Ljava/lang/annotation/Annotation;"), +}; + +void register_java_lang_reflect_Parameter(JNIEnv* env) { + REGISTER_NATIVE_METHODS("java/lang/reflect/Parameter"); +} + +} // namespace art diff --git a/runtime/native/java_lang_reflect_Parameter.h b/runtime/native/java_lang_reflect_Parameter.h new file mode 100644 index 0000000000..f6322b146f --- /dev/null +++ b/runtime/native/java_lang_reflect_Parameter.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2016 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. + */ + +#ifndef ART_RUNTIME_NATIVE_JAVA_LANG_REFLECT_PARAMETER_H_ +#define ART_RUNTIME_NATIVE_JAVA_LANG_REFLECT_PARAMETER_H_ + +#include <jni.h> + +namespace art { + +void register_java_lang_reflect_Parameter(JNIEnv* env); + +} // namespace art + +#endif // ART_RUNTIME_NATIVE_JAVA_LANG_REFLECT_PARAMETER_H_ diff --git a/runtime/openjdkjvmti/OpenjdkJvmTi.cc b/runtime/openjdkjvmti/OpenjdkJvmTi.cc index 339c457c66..d3561c1e1b 100644 --- a/runtime/openjdkjvmti/OpenjdkJvmTi.cc +++ b/runtime/openjdkjvmti/OpenjdkJvmTi.cc @@ -32,6 +32,7 @@ #include <jni.h> #include "openjdkjvmti/jvmti.h" +#include "art_jvmti.h" #include "gc_root-inl.h" #include "globals.h" #include "jni_env_ext-inl.h" @@ -44,25 +45,6 @@ namespace openjdkjvmti { -extern const jvmtiInterface_1 gJvmtiInterface; - -// A structure that is a jvmtiEnv with additional information for the runtime. -struct ArtJvmTiEnv : public jvmtiEnv { - art::JavaVMExt* art_vm; - void* local_data; - - explicit ArtJvmTiEnv(art::JavaVMExt* runtime) : art_vm(runtime), local_data(nullptr) { - functions = &gJvmtiInterface; - } -}; - -// Macro and constexpr to make error values less annoying to write. -#define ERR(e) JVMTI_ERROR_ ## e -static constexpr jvmtiError OK = JVMTI_ERROR_NONE; - -// Special error code for unimplemented functions in JVMTI -static constexpr jvmtiError ERR(NOT_IMPLEMENTED) = JVMTI_ERROR_NOT_AVAILABLE; - class JvmtiFunctions { private: static bool IsValidEnv(jvmtiEnv* env) { diff --git a/runtime/openjdkjvmti/art_jvmti.h b/runtime/openjdkjvmti/art_jvmti.h new file mode 100644 index 0000000000..a2c6882ac1 --- /dev/null +++ b/runtime/openjdkjvmti/art_jvmti.h @@ -0,0 +1,74 @@ +/* Copyright (C) 2016 The Android Open Source Project + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This file implements interfaces from the file jvmti.h. This implementation + * is licensed under the same terms as the file jvmti.h. The + * copyright and license information for the file jvmti.h follows. + * + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#ifndef ART_RUNTIME_OPENJDKJVMTI_ART_JVMTI_H_ +#define ART_RUNTIME_OPENJDKJVMTI_ART_JVMTI_H_ + +#include <jni.h> + +#include "java_vm_ext.h" +#include "jni_env_ext.h" +#include "jvmti.h" + +namespace openjdkjvmti { + +extern const jvmtiInterface_1 gJvmtiInterface; + +// A structure that is a jvmtiEnv with additional information for the runtime. +struct ArtJvmTiEnv : public jvmtiEnv { + art::JavaVMExt* art_vm; + void* local_data; + + explicit ArtJvmTiEnv(art::JavaVMExt* runtime) : art_vm(runtime), local_data(nullptr) { + functions = &gJvmtiInterface; + } +}; + +// Macro and constexpr to make error values less annoying to write. +#define ERR(e) JVMTI_ERROR_ ## e +static constexpr jvmtiError OK = JVMTI_ERROR_NONE; + +// Special error code for unimplemented functions in JVMTI +static constexpr jvmtiError ERR(NOT_IMPLEMENTED) = JVMTI_ERROR_NOT_AVAILABLE; + +static inline JNIEnv* GetJniEnv(jvmtiEnv* env) { + JNIEnv* ret_value = nullptr; + jint res = reinterpret_cast<ArtJvmTiEnv*>(env)->art_vm->GetEnv( + reinterpret_cast<void**>(&ret_value), JNI_VERSION_1_1); + if (res != JNI_OK) { + return nullptr; + } + return ret_value; +} + +} // namespace openjdkjvmti + +#endif // ART_RUNTIME_OPENJDKJVMTI_ART_JVMTI_H_ diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 561ada4e2b..97911d4e20 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -113,6 +113,7 @@ #include "native/java_lang_reflect_Constructor.h" #include "native/java_lang_reflect_Field.h" #include "native/java_lang_reflect_Method.h" +#include "native/java_lang_reflect_Parameter.h" #include "native/java_lang_reflect_Proxy.h" #include "native/java_util_concurrent_atomic_AtomicLong.h" #include "native/libcore_util_CharsetUtils.h" @@ -1425,6 +1426,7 @@ void Runtime::RegisterRuntimeNativeMethods(JNIEnv* env) { register_java_lang_reflect_Constructor(env); register_java_lang_reflect_Field(env); register_java_lang_reflect_Method(env); + register_java_lang_reflect_Parameter(env); register_java_lang_reflect_Proxy(env); register_java_lang_ref_Reference(env); register_java_lang_String(env); diff --git a/runtime/thread.cc b/runtime/thread.cc index dde3640dad..43ef1cb22e 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -2835,6 +2835,14 @@ class ReferenceMapVisitor : public StackVisitor { for (size_t i = 0; i < BitSizeOf<uint32_t>(); ++i) { if (register_mask & (1 << i)) { mirror::Object** ref_addr = reinterpret_cast<mirror::Object**>(GetGPRAddress(i)); + if (kIsDebugBuild && ref_addr == nullptr) { + std::string thread_name; + GetThread()->GetThreadName(thread_name); + LOG(INTERNAL_FATAL) << "On thread " << thread_name; + DescribeStack(GetThread()); + LOG(FATAL) << "Found an unsaved callee-save register " << i << " (null GPRAddress) " + << "set in register_mask=" << register_mask << " at " << DescribeLocation(); + } if (*ref_addr != nullptr) { visitor_(ref_addr, -1, this); } diff --git a/runtime/vdex_file.cc b/runtime/vdex_file.cc index 12bc45108e..a71578b1c3 100644 --- a/runtime/vdex_file.cc +++ b/runtime/vdex_file.cc @@ -19,6 +19,7 @@ #include <memory> #include "base/logging.h" +#include "base/unix_file/fd_file.h" namespace art { @@ -81,7 +82,7 @@ VdexFile* VdexFile::Open(const std::string& vdex_filename, } *error_msg = "Success"; - return new VdexFile(vdex_file.release(), mmap.release()); + return new VdexFile(mmap.release()); } } // namespace art diff --git a/runtime/vdex_file.h b/runtime/vdex_file.h index e381eb79ca..9215e52b07 100644 --- a/runtime/vdex_file.h +++ b/runtime/vdex_file.h @@ -21,7 +21,6 @@ #include <string> #include "base/macros.h" -#include "base/unix_file/fd_file.h" #include "mem_map.h" #include "os.h" @@ -66,9 +65,8 @@ class VdexFile { size_t Size() const { return mmap_->Size(); } private: - VdexFile(File* file, MemMap* mmap) : file_(file), mmap_(mmap) {} + explicit VdexFile(MemMap* mmap) : mmap_(mmap) {} - std::unique_ptr<File> file_; std::unique_ptr<MemMap> mmap_; DISALLOW_COPY_AND_ASSIGN(VdexFile); diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index 589e71cf22..6b1170b98e 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -123,7 +123,7 @@ MethodVerifier::FailureKind MethodVerifier::VerifyClass(Thread* self, mirror::Class* klass, CompilerCallbacks* callbacks, bool allow_soft_failures, - LogSeverity log_level, + HardFailLogMode log_level, std::string* error) { if (klass->IsVerified()) { return kNoFailure; @@ -196,7 +196,7 @@ MethodVerifier::FailureData MethodVerifier::VerifyMethods(Thread* self, Handle<mirror::ClassLoader> class_loader, CompilerCallbacks* callbacks, bool allow_soft_failures, - LogSeverity log_level, + HardFailLogMode log_level, bool need_precise_constants, std::string* error_string) { DCHECK(it != nullptr); @@ -267,7 +267,7 @@ MethodVerifier::FailureKind MethodVerifier::VerifyClass(Thread* self, const DexFile::ClassDef& class_def, CompilerCallbacks* callbacks, bool allow_soft_failures, - LogSeverity log_level, + HardFailLogMode log_level, std::string* error) { ScopedTrace trace(__FUNCTION__); @@ -360,7 +360,7 @@ MethodVerifier::FailureData MethodVerifier::VerifyMethod(Thread* self, uint32_t method_access_flags, CompilerCallbacks* callbacks, bool allow_soft_failures, - LogSeverity log_level, + HardFailLogMode log_level, bool need_precise_constants, std::string* hard_failure_msg) { MethodVerifier::FailureData result; @@ -420,11 +420,26 @@ MethodVerifier::FailureData MethodVerifier::VerifyMethod(Thread* self, } else { CHECK(verifier.have_pending_hard_failure_); if (VLOG_IS_ON(verifier)) { - log_level = LogSeverity::VERBOSE; + log_level = std::max(HardFailLogMode::kLogVerbose, log_level); } - if (log_level > LogSeverity::VERBOSE) { - verifier.DumpFailures(LOG(log_level) << "Verification error in " - << PrettyMethod(method_idx, *dex_file) << "\n"); + if (log_level >= HardFailLogMode::kLogVerbose) { + LogSeverity severity; + switch (log_level) { + case HardFailLogMode::kLogVerbose: + severity = LogSeverity::VERBOSE; + break; + case HardFailLogMode::kLogWarning: + severity = LogSeverity::WARNING; + break; + case HardFailLogMode::kLogInternalFatal: + severity = LogSeverity::INTERNAL_FATAL; + break; + default: + LOG(FATAL) << "Unsupported log-level " << static_cast<uint32_t>(log_level); + UNREACHABLE(); + } + verifier.DumpFailures(LOG(severity) << "Verification error in " + << PrettyMethod(method_idx, *dex_file) << "\n"); } if (hard_failure_msg != nullptr) { CHECK(!verifier.failure_messages_.empty()); diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h index d4e12f7b06..c4b1c6eef6 100644 --- a/runtime/verifier/method_verifier.h +++ b/runtime/verifier/method_verifier.h @@ -32,6 +32,7 @@ #include "method_reference.h" #include "register_line.h" #include "reg_type_cache.h" +#include "verifier_log_mode.h" namespace art { @@ -152,7 +153,7 @@ class MethodVerifier { mirror::Class* klass, CompilerCallbacks* callbacks, bool allow_soft_failures, - LogSeverity log_level, + HardFailLogMode log_level, std::string* error) REQUIRES_SHARED(Locks::mutator_lock_); static FailureKind VerifyClass(Thread* self, @@ -162,7 +163,7 @@ class MethodVerifier { const DexFile::ClassDef& class_def, CompilerCallbacks* callbacks, bool allow_soft_failures, - LogSeverity log_level, + HardFailLogMode log_level, std::string* error) REQUIRES_SHARED(Locks::mutator_lock_); @@ -336,7 +337,7 @@ class MethodVerifier { Handle<mirror::ClassLoader> class_loader, CompilerCallbacks* callbacks, bool allow_soft_failures, - LogSeverity log_level, + HardFailLogMode log_level, bool need_precise_constants, std::string* error_string) REQUIRES_SHARED(Locks::mutator_lock_); @@ -362,7 +363,7 @@ class MethodVerifier { uint32_t method_access_flags, CompilerCallbacks* callbacks, bool allow_soft_failures, - LogSeverity log_level, + HardFailLogMode log_level, bool need_precise_constants, std::string* hard_failure_msg) REQUIRES_SHARED(Locks::mutator_lock_); diff --git a/runtime/verifier/method_verifier_test.cc b/runtime/verifier/method_verifier_test.cc index 4fd581d16e..646987a1e5 100644 --- a/runtime/verifier/method_verifier_test.cc +++ b/runtime/verifier/method_verifier_test.cc @@ -23,6 +23,7 @@ #include "common_runtime_test.h" #include "dex_file.h" #include "scoped_thread_state_change.h" +#include "verifier_log_mode.h" namespace art { namespace verifier { @@ -37,12 +38,8 @@ class MethodVerifierTest : public CommonRuntimeTest { // Verify the class std::string error_msg; - MethodVerifier::FailureKind failure = MethodVerifier::VerifyClass(self, - klass, - nullptr, - true, - LogSeverity::WARNING, - &error_msg); + MethodVerifier::FailureKind failure = MethodVerifier::VerifyClass( + self, klass, nullptr, true, HardFailLogMode::kLogWarning, &error_msg); ASSERT_TRUE(failure == MethodVerifier::kNoFailure) << error_msg; } diff --git a/runtime/verifier/verifier_log_mode.h b/runtime/verifier/verifier_log_mode.h new file mode 100644 index 0000000000..3744b9b416 --- /dev/null +++ b/runtime/verifier/verifier_log_mode.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2016 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. + */ + +#ifndef ART_RUNTIME_VERIFIER_VERIFIER_LOG_MODE_H_ +#define ART_RUNTIME_VERIFIER_VERIFIER_LOG_MODE_H_ + +namespace art { +namespace verifier { + +enum class HardFailLogMode { + kLogNone, // Don't log hard failures at all. + kLogVerbose, // Log with severity VERBOSE. + kLogWarning, // Log with severity WARNING. + kLogInternalFatal, // Log with severity INTERNAL_FATAL +}; + +} // namespace verifier +} // namespace art + +#endif // ART_RUNTIME_VERIFIER_VERIFIER_LOG_MODE_H_ diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk index d6957fc39c..e12fd285d4 100644 --- a/test/Android.run-test.mk +++ b/test/Android.run-test.mk @@ -153,17 +153,17 @@ JNI_TYPES := checkjni ifeq ($(ART_TEST_JNI_FORCECOPY),true) JNI_TYPES += forcecopy endif -IMAGE_TYPES := image +IMAGE_TYPES := picimage ifeq ($(ART_TEST_RUN_TEST_NO_IMAGE),true) IMAGE_TYPES += no-image endif ifeq ($(ART_TEST_RUN_TEST_MULTI_IMAGE),true) - IMAGE_TYPES := multiimage + IMAGE_TYPES := multipicimage endif -ifeq ($(ART_TEST_PIC_IMAGE),true) - IMAGE_TYPES += picimage +ifeq ($(ART_TEST_NPIC_IMAGE),true) + IMAGE_TYPES += npicimage ifeq ($(ART_TEST_RUN_TEST_MULTI_IMAGE),true) - IMAGE_TYPES := multipicimage + IMAGE_TYPES := multinpicimage endif endif PICTEST_TYPES := npictest @@ -896,6 +896,11 @@ define define-test-art-run-test ifeq ($(4),regalloc_gc) # Graph coloring tests share the image_suffix with optimizing tests. image_suffix := optimizing + else + ifeq ($(4),jit) + # JIT tests share the image_suffix with interpreter tests. + image_suffix := interpreter + endif endif ifeq ($(9),no-image) test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_IMAGE_RULES @@ -907,8 +912,9 @@ define define-test-art-run-test prereq_rule += $$(TARGET_CORE_IMAGE_$$(image_suffix)_no-pic_$(13)) endif else - ifeq ($(9),image) + ifeq ($(9),npicimage) test_groups += ART_RUN_TEST_$$(uc_host_or_target)_IMAGE_RULES + run_test_options += --npic-image # Add the core dependency. ifeq ($(1),host) prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_no-pic_$(13)) @@ -918,16 +924,15 @@ define define-test-art-run-test else ifeq ($(9),picimage) test_groups += ART_RUN_TEST_$$(uc_host_or_target)_PICIMAGE_RULES - run_test_options += --pic-image ifeq ($(1),host) prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_pic_$(13)) else prereq_rule += $$(TARGET_CORE_IMAGE_$$(image_suffix)_pic_$(13)) endif else - ifeq ($(9),multiimage) + ifeq ($(9),multinpicimage) test_groups += ART_RUN_TEST_$$(uc_host_or_target)_IMAGE_RULES - run_test_options += --multi-image + run_test_options += --npic-image --multi-image ifeq ($(1),host) prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_no-pic_multi_$(13)) else @@ -936,7 +941,7 @@ define define-test-art-run-test else ifeq ($(9),multipicimage) test_groups += ART_RUN_TEST_$$(uc_host_or_target)_PICIMAGE_RULES - run_test_options += --pic-image --multi-image + run_test_options += --multi-image ifeq ($(1),host) prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_pic_multi_$(13)) else diff --git a/test/run-test b/test/run-test index 4c294203b3..8fb2adf445 100755 --- a/test/run-test +++ b/test/run-test @@ -132,7 +132,7 @@ multi_image_suffix="" android_root="/system" # By default we will use optimizing. image_args="" -image_suffix="-optimizing" +image_suffix="" while true; do if [ "x$1" = "x--host" ]; then @@ -180,8 +180,8 @@ while true; do elif [ "x$1" = "x--no-image" ]; then have_image="no" shift - elif [ "x$1" = "x--pic-image" ]; then - pic_image_suffix="-pic" + elif [ "x$1" = "x--npic-image" ]; then + pic_image_suffix="-npic" shift elif [ "x$1" = "x--multi-image" ]; then multi_image_suffix="-multi" @@ -258,11 +258,10 @@ while true; do shift elif [ "x$1" = "x--jit" ]; then image_args="--jit" - image_suffix="-jit" + image_suffix="-interpreter" shift elif [ "x$1" = "x--optimizing" ]; then image_args="-Xcompiler-option --compiler-backend=Optimizing" - image_suffix="-optimizing" shift elif [ "x$1" = "x--no-verify" ]; then run_args="${run_args} --no-verify" @@ -608,8 +607,8 @@ if [ "$usage" = "yes" ]; then echo " --dex2oat-swap Use a dex2oat swap file." echo " --instruction-set-features [string]" echo " Set instruction-set-features for compilation." - echo " --pic-image Use an image compiled with position independent code for the" - echo " boot class path." + echo " --npic-image Use an image compiled with non-position independent code " + echo " for the boot class path." echo " --multi-image Use a set of images compiled with dex2oat multi-image for" echo " the boot class path." echo " --pic-test Compile the test code position independent." @@ -678,7 +677,7 @@ function arch_supports_read_barrier() { # Tests named '<number>-checker-*' will also have their CFGs verified with # Checker when compiled with Optimizing on host. if [[ "$TEST_NAME" =~ ^[0-9]+-checker- ]]; then - if [ "$runtime" = "art" -a "$image_suffix" = "-optimizing" -a "$USE_JACK" = "true" ]; then + if [ "$runtime" = "art" -a "$image_suffix" = "" -a "$USE_JACK" = "true" ]; then # Optimizing has read barrier support for certain architectures # only. On other architectures, compiling is disabled when read # barriers are enabled, meaning that we do not produce a CFG file @@ -100,7 +100,7 @@ ANDROID_DATA=$ANDROID_DATA \ $invoke_with $ANDROID_ROOT/bin/$DALVIKVM $lib \ -XXlib:$LIBART \ -Xnorelocate \ - -Ximage:$ANDROID_ROOT/framework/core-optimizing-pic.art \ + -Ximage:$ANDROID_ROOT/framework/core.art \ $DEBUG_OPTION \ "$@" diff --git a/tools/buildbot-build.sh b/tools/buildbot-build.sh index 12e03386d6..5ef66d196a 100755 --- a/tools/buildbot-build.sh +++ b/tools/buildbot-build.sh @@ -45,6 +45,16 @@ while true; do fi done +# Workaround for repo incompatibilities on the Chromium buildbot. +# TODO: Remove this workaround once https://bugs.chromium.org/p/chromium/issues/detail?id=646329 +# is addressed. +repo=$(which repo) +if [[ $repo == *"depot_tools"* ]]; then + ln -s build/soong/root.bp Android.bp + ln -s build/soong/bootstrap.bash bootstrap.bash + echo "include build/core/main.mk" > Makefile +fi + if [[ $mode == "host" ]]; then make_command="make $j_arg $showcommands build-art-host-tests $common_targets" make_command+=" ${out_dir}/host/linux-x86/lib/libjavacoretests.so " diff --git a/tools/run-jdwp-tests.sh b/tools/run-jdwp-tests.sh index 01dae432e6..74b0f16466 100755 --- a/tools/run-jdwp-tests.sh +++ b/tools/run-jdwp-tests.sh @@ -43,7 +43,7 @@ vm_command="--vm-command=$art" image_compiler_option="" debug="no" verbose="no" -image="-Ximage:/data/art-test/core-optimizing-pic.art" +image="-Ximage:/data/art-test/core.art" vm_args="" # By default, we run the whole JDWP test suite. test="org.apache.harmony.jpda.tests.share.AllTests" diff --git a/tools/run-libcore-tests.sh b/tools/run-libcore-tests.sh index 2a6e172c69..01c7f203f9 100755 --- a/tools/run-libcore-tests.sh +++ b/tools/run-libcore-tests.sh @@ -95,7 +95,7 @@ while true; do if [[ "$1" == "--mode=device" ]]; then vogar_args="$vogar_args --device-dir=/data/local/tmp" vogar_args="$vogar_args --vm-command=/data/local/tmp/system/bin/art" - vogar_args="$vogar_args --vm-arg -Ximage:/data/art-test/core-optimizing.art" + vogar_args="$vogar_args --vm-arg -Ximage:/data/art-test/core.art" shift elif [[ "$1" == "--mode=host" ]]; then # We explicitly give a wrong path for the image, to ensure vogar |