diff options
-rw-r--r-- | build/Android.oat.mk | 12 | ||||
-rw-r--r-- | compiler/oat_writer.cc | 6 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_mips64.cc | 11 | ||||
-rw-r--r-- | runtime/interpreter/interpreter_common.cc | 6 | ||||
-rw-r--r-- | runtime/safe_map.h | 13 | ||||
-rw-r--r-- | runtime/verifier/method_verifier.cc | 3 | ||||
-rw-r--r-- | test/Android.run-test.mk | 7 | ||||
-rwxr-xr-x | test/run-test | 2 |
8 files changed, 39 insertions, 21 deletions
diff --git a/build/Android.oat.mk b/build/Android.oat.mk index 3a3cb990ca..6e17ed38d6 100644 --- a/build/Android.oat.mk +++ b/build/Android.oat.mk @@ -74,6 +74,10 @@ 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 @@ -154,6 +158,7 @@ $(eval $(call create-core-oat-host-rule-combination,default,,)) $(eval $(call create-core-oat-host-rule-combination,optimizing,,)) $(eval $(call create-core-oat-host-rule-combination,interpreter,,)) $(eval $(call create-core-oat-host-rule-combination,interp-ac,,)) +$(eval $(call create-core-oat-host-rule-combination,jit,,)) valgrindHOST_CORE_IMG_OUTS := valgrindHOST_CORE_OAT_OUTS := @@ -161,6 +166,7 @@ $(eval $(call create-core-oat-host-rule-combination,default,valgrind,32)) $(eval $(call create-core-oat-host-rule-combination,optimizing,valgrind,32)) $(eval $(call create-core-oat-host-rule-combination,interpreter,valgrind,32)) $(eval $(call create-core-oat-host-rule-combination,interp-ac,valgrind,32)) +$(eval $(call create-core-oat-host-rule-combination,jit,valgrind,32)) valgrind-test-art-host-dex2oat-host: $(valgrindHOST_CORE_IMG_OUTS) @@ -194,6 +200,10 @@ 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 @@ -279,6 +289,7 @@ $(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 := @@ -286,6 +297,7 @@ $(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/oat_writer.cc b/compiler/oat_writer.cc index c96b1715d7..4ddd457ac5 100644 --- a/compiler/oat_writer.cc +++ b/compiler/oat_writer.cc @@ -1123,11 +1123,7 @@ size_t OatWriter::InitOatCodeDexFiles(size_t offset) { } while (false) VISIT(InitCodeMethodVisitor); - // InitImageMethodVisitor visits all methods, resolves them (failing if one cannot be resolved, - // which is a bad sign for a working boot image), and then install entrypoints. - // In case of VerifyAtRuntime, there won't be code, and we do not want to resolve the methods - // (this has been skipped in the driver for performance). - if (compiler_driver_->IsImage() && !compiler_driver_->GetCompilerOptions().VerifyAtRuntime()) { + if (compiler_driver_->IsImage()) { VISIT(InitImageMethodVisitor); } diff --git a/compiler/optimizing/code_generator_mips64.cc b/compiler/optimizing/code_generator_mips64.cc index 4722e42694..f4f53d5f32 100644 --- a/compiler/optimizing/code_generator_mips64.cc +++ b/compiler/optimizing/code_generator_mips64.cc @@ -971,11 +971,11 @@ size_t CodeGeneratorMIPS64::RestoreFloatingPointRegister(size_t stack_index, uin } void CodeGeneratorMIPS64::DumpCoreRegister(std::ostream& stream, int reg) const { - stream << Mips64ManagedRegister::FromGpuRegister(GpuRegister(reg)); + stream << GpuRegister(reg); } void CodeGeneratorMIPS64::DumpFloatingPointRegister(std::ostream& stream, int reg) const { - stream << Mips64ManagedRegister::FromFpuRegister(FpuRegister(reg)); + stream << FpuRegister(reg); } void CodeGeneratorMIPS64::InvokeRuntime(QuickEntrypointEnum entrypoint, @@ -1444,12 +1444,11 @@ void InstructionCodeGeneratorMIPS64::VisitArrayLength(HArrayLength* instruction) } void LocationsBuilderMIPS64::VisitArraySet(HArraySet* instruction) { - Primitive::Type value_type = instruction->GetComponentType(); - bool is_object = value_type == Primitive::kPrimNot; + bool needs_runtime_call = instruction->NeedsTypeCheck(); LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary( instruction, - is_object ? LocationSummary::kCall : LocationSummary::kNoCall); - if (is_object) { + needs_runtime_call ? LocationSummary::kCall : LocationSummary::kNoCall); + if (needs_runtime_call) { InvokeRuntimeCallingConvention calling_convention; locations->SetInAt(0, Location::RegisterLocation(calling_convention.GetRegisterAt(0))); locations->SetInAt(1, Location::RegisterLocation(calling_convention.GetRegisterAt(1))); diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc index 68d56f5198..5fbd687452 100644 --- a/runtime/interpreter/interpreter_common.cc +++ b/runtime/interpreter/interpreter_common.cc @@ -709,7 +709,11 @@ static inline bool DoCallCommon(ArtMethod* called_method, SafeMap<uint32_t, std::set<uint32_t>> string_init_map = verifier::MethodVerifier::FindStringInitMap(method); MutexLock mu(self, *Locks::interpreter_string_init_map_lock_); - auto it = method_to_string_init_map.Overwrite(method_ref, string_init_map); + auto it = method_to_string_init_map.lower_bound(method_ref); + if (it == method_to_string_init_map.end() || + method_to_string_init_map.key_comp()(method_ref, it->first)) { + it = method_to_string_init_map.PutBefore(it, method_ref, std::move(string_init_map)); + } string_init_map_ptr = &it->second; } if (string_init_map_ptr->size() != 0) { diff --git a/runtime/safe_map.h b/runtime/safe_map.h index 04549c7889..7ac17b60d6 100644 --- a/runtime/safe_map.h +++ b/runtime/safe_map.h @@ -92,6 +92,11 @@ class SafeMap { DCHECK(result.second); // Check we didn't accidentally overwrite an existing value. return result.first; } + iterator Put(const K& k, const V&& v) { + std::pair<iterator, bool> result = map_.emplace(k, std::move(v)); + DCHECK(result.second); // Check we didn't accidentally overwrite an existing value. + return result.first; + } // Used to insert a new mapping at a known position for better performance. iterator PutBefore(iterator pos, const K& k, const V& v) { @@ -100,10 +105,16 @@ class SafeMap { DCHECK(pos == map_.begin() || map_.key_comp()((--iterator(pos))->first, k)); return map_.emplace_hint(pos, k, v); } + iterator PutBefore(iterator pos, const K& k, const V&& v) { + // Check that we're using the correct position and the key is not in the map. + DCHECK(pos == map_.end() || map_.key_comp()(k, pos->first)); + DCHECK(pos == map_.begin() || map_.key_comp()((--iterator(pos))->first, k)); + return map_.emplace_hint(pos, k, std::move(v)); + } // Used to insert a new mapping or overwrite an existing mapping. Note that if the value type // of this container is a pointer, any overwritten pointer will be lost and if this container - // was the owner, you have a leak. + // was the owner, you have a leak. Returns iterator pointing to the new or overwritten entry. iterator Overwrite(const K& k, const V& v) { std::pair<iterator, bool> result = map_.insert(std::make_pair(k, v)); if (!result.second) { diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index 3d4f04c70c..9938e907e9 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -548,7 +548,8 @@ SafeMap<uint32_t, std::set<uint32_t>> MethodVerifier::FindStringInitMap(ArtMetho MethodVerifier verifier(self, m->GetDexFile(), dex_cache, class_loader, &m->GetClassDef(), m->GetCodeItem(), m->GetDexMethodIndex(), m, m->GetAccessFlags(), true, true, false, true); - return verifier.FindStringInitMap(); + // Avoid copying: The map is moved out of the verifier before the verifier is destroyed. + return std::move(verifier.FindStringInitMap()); } SafeMap<uint32_t, std::set<uint32_t>>& MethodVerifier::FindStringInitMap() { diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk index 439e42331c..29e015f534 100644 --- a/test/Android.run-test.mk +++ b/test/Android.run-test.mk @@ -752,12 +752,7 @@ define define-test-art-run-test endif endif endif - ifeq ($(4),jit) - # Use interpreter image for JIT. - image_suffix := interpreter - else - image_suffix := $(4) - endif + image_suffix := $(4) ifeq ($(9),no-image) test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_IMAGE_RULES run_test_options += --no-image diff --git a/test/run-test b/test/run-test index 73c92d4322..828939d247 100755 --- a/test/run-test +++ b/test/run-test @@ -252,7 +252,7 @@ while true; do shift elif [ "x$1" = "x--jit" ]; then run_args="${run_args} --jit" - image_suffix="-interpreter" + image_suffix="-jit" shift elif [ "x$1" = "x--optimizing" ]; then run_args="${run_args} -Xcompiler-option --compiler-backend=Optimizing" |