diff options
Diffstat (limited to 'compiler/oat_test.cc')
-rw-r--r-- | compiler/oat_test.cc | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/compiler/oat_test.cc b/compiler/oat_test.cc index 3fcc369c5e..847fa0d08f 100644 --- a/compiler/oat_test.cc +++ b/compiler/oat_test.cc @@ -44,11 +44,11 @@ class OatTest : public CommonCompilerTest { compiler_driver_->GetCompiledMethod(MethodReference(dex_file, method->GetDexMethodIndex())); - if (compiled_method == NULL) { - EXPECT_TRUE(oat_method.GetQuickCode() == NULL) << PrettyMethod(method) << " " - << oat_method.GetQuickCode(); - EXPECT_TRUE(oat_method.GetPortableCode() == NULL) << PrettyMethod(method) << " " - << oat_method.GetPortableCode(); + if (compiled_method == nullptr) { + EXPECT_TRUE(oat_method.GetQuickCode() == nullptr) << PrettyMethod(method) << " " + << oat_method.GetQuickCode(); + EXPECT_TRUE(oat_method.GetPortableCode() == nullptr) << PrettyMethod(method) << " " + << oat_method.GetPortableCode(); EXPECT_EQ(oat_method.GetFrameSizeInBytes(), 0U); EXPECT_EQ(oat_method.GetCoreSpillMask(), 0U); EXPECT_EQ(oat_method.GetFpSpillMask(), 0U); @@ -95,7 +95,10 @@ TEST_F(OatTest, WriteRead) { : Compiler::kQuick; InstructionSet insn_set = kIsTargetBuild ? kThumb2 : kX86; - InstructionSetFeatures insn_features; + std::string error_msg; + std::unique_ptr<const InstructionSetFeatures> insn_features( + InstructionSetFeatures::FromFeatureString(insn_set, "default", &error_msg)); + ASSERT_TRUE(insn_features.get() != nullptr) << error_msg; compiler_options_.reset(new CompilerOptions); verification_results_.reset(new VerificationResults(compiler_options_.get())); method_inliner_map_.reset(new DexFileToMethodInlinerMap); @@ -106,9 +109,9 @@ TEST_F(OatTest, WriteRead) { verification_results_.get(), method_inliner_map_.get(), compiler_kind, insn_set, - insn_features, false, NULL, 2, true, true, - timer_.get())); - jobject class_loader = NULL; + insn_features.get(), false, nullptr, 2, true, true, + timer_.get(), "")); + jobject class_loader = nullptr; if (kCompile) { TimingLogger timings("OatTest::WriteRead", false, false); compiler_driver_->CompileAll(class_loader, class_linker->GetBootClassPath(), &timings); @@ -135,9 +138,8 @@ TEST_F(OatTest, WriteRead) { if (kCompile) { // OatWriter strips the code, regenerate to compare compiler_driver_->CompileAll(class_loader, class_linker->GetBootClassPath(), &timings); } - std::string error_msg; - std::unique_ptr<OatFile> oat_file(OatFile::Open(tmp.GetFilename(), tmp.GetFilename(), NULL, false, - &error_msg)); + std::unique_ptr<OatFile> oat_file(OatFile::Open(tmp.GetFilename(), tmp.GetFilename(), nullptr, + false, &error_msg)); ASSERT_TRUE(oat_file.get() != nullptr) << error_msg; const OatHeader& oat_header = oat_file->GetOatHeader(); ASSERT_TRUE(oat_header.IsValid()); @@ -157,7 +159,7 @@ TEST_F(OatTest, WriteRead) { const DexFile::ClassDef& class_def = dex_file->GetClassDef(i); const uint8_t* class_data = dex_file->GetClassData(class_def); size_t num_virtual_methods = 0; - if (class_data != NULL) { + if (class_data != nullptr) { ClassDataItemIterator it(*dex_file, class_data); num_virtual_methods = it.NumVirtualMethods(); } @@ -193,13 +195,16 @@ TEST_F(OatTest, OatHeaderSizeCheck) { } TEST_F(OatTest, OatHeaderIsValid) { - InstructionSet instruction_set = kX86; - InstructionSetFeatures instruction_set_features; + InstructionSet insn_set = kX86; + std::string error_msg; + std::unique_ptr<const InstructionSetFeatures> insn_features( + InstructionSetFeatures::FromFeatureString(insn_set, "default", &error_msg)); + ASSERT_TRUE(insn_features.get() != nullptr) << error_msg; std::vector<const DexFile*> dex_files; uint32_t image_file_location_oat_checksum = 0; uint32_t image_file_location_oat_begin = 0; - std::unique_ptr<OatHeader> oat_header(OatHeader::Create(instruction_set, - instruction_set_features, + std::unique_ptr<OatHeader> oat_header(OatHeader::Create(insn_set, + insn_features.get(), &dex_files, image_file_location_oat_checksum, image_file_location_oat_begin, |