Merge "ART: Verifier support for VarHandles"
diff --git a/compiler/compiler.cc b/compiler/compiler.cc
index 47f44ff..60977b6 100644
--- a/compiler/compiler.cc
+++ b/compiler/compiler.cc
@@ -19,7 +19,7 @@
#include <android-base/logging.h>
#include "base/macros.h"
-#include "code_item_accessors-inl.h"
+#include "dex/code_item_accessors-inl.h"
#include "driver/compiler_driver.h"
#include "optimizing/optimizing_compiler.h"
#include "utils.h"
diff --git a/compiler/compiler.h b/compiler/compiler.h
index 85abd66..b92bff6 100644
--- a/compiler/compiler.h
+++ b/compiler/compiler.h
@@ -18,7 +18,7 @@
#define ART_COMPILER_COMPILER_H_
#include "base/mutex.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "os.h"
namespace art {
diff --git a/compiler/debug/elf_debug_info_writer.h b/compiler/debug/elf_debug_info_writer.h
index 0e11e32..e2bea8e 100644
--- a/compiler/debug/elf_debug_info_writer.h
+++ b/compiler/debug/elf_debug_info_writer.h
@@ -22,14 +22,14 @@
#include <vector>
#include "art_field-inl.h"
-#include "code_item_accessors-inl.h"
#include "debug/dwarf/debug_abbrev_writer.h"
#include "debug/dwarf/debug_info_entry_writer.h"
#include "debug/elf_compilation_unit.h"
#include "debug/elf_debug_loc_writer.h"
#include "debug/method_debug_info.h"
-#include "dex_file-inl.h"
-#include "dex_file.h"
+#include "dex/code_item_accessors-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file.h"
#include "heap_poisoning.h"
#include "linear_alloc.h"
#include "linker/elf_builder.h"
diff --git a/compiler/debug/elf_debug_line_writer.h b/compiler/debug/elf_debug_line_writer.h
index d7fd524..9910e7a 100644
--- a/compiler/debug/elf_debug_line_writer.h
+++ b/compiler/debug/elf_debug_line_writer.h
@@ -24,7 +24,7 @@
#include "debug/dwarf/headers.h"
#include "debug/elf_compilation_unit.h"
#include "debug/src_map_elem.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "linker/elf_builder.h"
#include "oat_file.h"
#include "stack_map.h"
diff --git a/compiler/debug/method_debug_info.h b/compiler/debug/method_debug_info.h
index a8225fa..43c8de2 100644
--- a/compiler/debug/method_debug_info.h
+++ b/compiler/debug/method_debug_info.h
@@ -21,7 +21,7 @@
#include "arch/instruction_set.h"
#include "base/array_ref.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
namespace art {
namespace debug {
diff --git a/compiler/dex/dex_to_dex_compiler.cc b/compiler/dex/dex_to_dex_compiler.cc
index 7e41c53..52cb217 100644
--- a/compiler/dex/dex_to_dex_compiler.cc
+++ b/compiler/dex/dex_to_dex_compiler.cc
@@ -26,8 +26,8 @@
#include "base/mutex.h"
#include "bytecode_utils.h"
#include "compiled_method.h"
-#include "dex_file-inl.h"
-#include "dex_instruction-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_instruction-inl.h"
#include "driver/compiler_driver.h"
#include "driver/dex_compilation_unit.h"
#include "mirror/dex_cache.h"
diff --git a/compiler/dex/dex_to_dex_compiler.h b/compiler/dex/dex_to_dex_compiler.h
index 87ddb39..80b94d2 100644
--- a/compiler/dex/dex_to_dex_compiler.h
+++ b/compiler/dex/dex_to_dex_compiler.h
@@ -17,7 +17,7 @@
#ifndef ART_COMPILER_DEX_DEX_TO_DEX_COMPILER_H_
#define ART_COMPILER_DEX_DEX_TO_DEX_COMPILER_H_
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "handle.h"
#include "invoke_type.h"
diff --git a/compiler/dex/dex_to_dex_decompiler_test.cc b/compiler/dex/dex_to_dex_decompiler_test.cc
index 89a63c0..19b1900 100644
--- a/compiler/dex/dex_to_dex_decompiler_test.cc
+++ b/compiler/dex/dex_to_dex_decompiler_test.cc
@@ -20,7 +20,7 @@
#include "common_compiler_test.h"
#include "compiled_method-inl.h"
#include "compiler_callbacks.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "driver/compiler_driver.h"
#include "driver/compiler_options.h"
#include "handle_scope-inl.h"
@@ -99,7 +99,7 @@
if (compiled_method != nullptr) {
table = compiled_method->GetVmapTable();
}
- optimizer::ArtDecompileDEX(updated_dex_file,
+ optimizer::ArtDecompileDEX(*updated_dex_file,
*it.GetMethodCodeItem(),
table,
/* decompile_return_instruction */ true);
diff --git a/compiler/dex/inline_method_analyser.cc b/compiler/dex/inline_method_analyser.cc
index 80677b9..ce67b85 100644
--- a/compiler/dex/inline_method_analyser.cc
+++ b/compiler/dex/inline_method_analyser.cc
@@ -20,11 +20,11 @@
#include "art_method-inl.h"
#include "base/enums.h"
#include "class_linker-inl.h"
-#include "code_item_accessors-inl.h"
-#include "dex_file-inl.h"
-#include "dex_instruction-inl.h"
-#include "dex_instruction.h"
-#include "dex_instruction_utils.h"
+#include "dex/code_item_accessors-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_instruction-inl.h"
+#include "dex/dex_instruction.h"
+#include "dex/dex_instruction_utils.h"
#include "mirror/class-inl.h"
#include "mirror/dex_cache-inl.h"
diff --git a/compiler/dex/inline_method_analyser.h b/compiler/dex/inline_method_analyser.h
index cde2147..837cc85 100644
--- a/compiler/dex/inline_method_analyser.h
+++ b/compiler/dex/inline_method_analyser.h
@@ -19,8 +19,8 @@
#include "base/macros.h"
#include "base/mutex.h"
-#include "dex_file.h"
-#include "dex_instruction.h"
+#include "dex/dex_file.h"
+#include "dex/dex_instruction.h"
#include "method_reference.h"
/*
diff --git a/compiler/dex/quick_compiler_callbacks.cc b/compiler/dex/quick_compiler_callbacks.cc
index 92b1230..540bd0c 100644
--- a/compiler/dex/quick_compiler_callbacks.cc
+++ b/compiler/dex/quick_compiler_callbacks.cc
@@ -38,7 +38,7 @@
// If we don't have class unloading enabled in the compiler, we will never see class that were
// previously verified. Return false to avoid overhead from the lookup in the compiler driver.
if (!does_class_unloading_) {
- return ClassStatus::kStatusNotReady;
+ return ClassStatus::kNotReady;
}
DCHECK(compiler_driver_ != nullptr);
// In the case of the quicken filter: avoiding verification of quickened instructions, which the
diff --git a/compiler/dex/verified_method.cc b/compiler/dex/verified_method.cc
index 8934201..f2da3ff 100644
--- a/compiler/dex/verified_method.cc
+++ b/compiler/dex/verified_method.cc
@@ -21,9 +21,9 @@
#include <android-base/logging.h>
-#include "code_item_accessors-inl.h"
-#include "dex_file.h"
-#include "dex_instruction-inl.h"
+#include "dex/code_item_accessors-inl.h"
+#include "dex/dex_file.h"
+#include "dex/dex_instruction-inl.h"
#include "runtime.h"
#include "verifier/method_verifier-inl.h"
#include "verifier/reg_type-inl.h"
diff --git a/compiler/dex/verified_method.h b/compiler/dex/verified_method.h
index 64b3f44..2ed17f1 100644
--- a/compiler/dex/verified_method.h
+++ b/compiler/dex/verified_method.h
@@ -20,7 +20,7 @@
#include <vector>
#include "base/mutex.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "method_reference.h"
#include "safe_map.h"
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 5d4ed46..fe83a66 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -42,13 +42,13 @@
#include "compiler.h"
#include "compiler_callbacks.h"
#include "compiler_driver-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_annotations.h"
+#include "dex/dex_instruction-inl.h"
#include "dex/dex_to_dex_compiler.h"
#include "dex/verification_results.h"
#include "dex/verified_method.h"
#include "dex_compilation_unit.h"
-#include "dex_file-inl.h"
-#include "dex_file_annotations.h"
-#include "dex_instruction-inl.h"
#include "driver/compiler_options.h"
#include "gc/accounting/card_table-inl.h"
#include "gc/accounting/heap_bitmap.h"
@@ -702,7 +702,7 @@
// stable order.
static void ResolveConstStrings(Handle<mirror::DexCache> dex_cache,
- const DexFile* dex_file,
+ const DexFile& dex_file,
const DexFile::CodeItem* code_item)
REQUIRES_SHARED(Locks::mutator_lock_) {
if (code_item == nullptr) {
@@ -711,7 +711,7 @@
}
ClassLinker* const class_linker = Runtime::Current()->GetClassLinker();
- for (const DexInstructionPcPair& inst : CodeItemInstructionAccessor(dex_file, code_item)) {
+ for (const DexInstructionPcPair& inst : CodeItemInstructionAccessor(&dex_file, code_item)) {
switch (inst->Opcode()) {
case Instruction::CONST_STRING:
case Instruction::CONST_STRING_JUMBO: {
@@ -773,7 +773,7 @@
continue;
}
previous_method_idx = method_idx;
- ResolveConstStrings(dex_cache, dex_file, it.GetMethodCodeItem());
+ ResolveConstStrings(dex_cache, *dex_file, it.GetMethodCodeItem());
it.Next();
}
DCHECK(!it.HasNext());
@@ -1809,7 +1809,7 @@
static void LoadAndUpdateStatus(const DexFile& dex_file,
const DexFile::ClassDef& class_def,
- mirror::Class::Status status,
+ ClassStatus status,
Handle<mirror::ClassLoader> class_loader,
Thread* self)
REQUIRES_SHARED(Locks::mutator_lock_) {
@@ -1868,16 +1868,16 @@
// Just update the compiled_classes_ map. The compiler doesn't need to resolve
// the type.
ClassReference ref(dex_file, i);
- mirror::Class::Status existing = mirror::Class::kStatusNotReady;
+ ClassStatus existing = ClassStatus::kNotReady;
DCHECK(compiled_classes_.Get(ref, &existing)) << ref.dex_file->GetLocation();
ClassStateTable::InsertResult result =
- compiled_classes_.Insert(ref, existing, mirror::Class::kStatusVerified);
+ compiled_classes_.Insert(ref, existing, ClassStatus::kVerified);
CHECK_EQ(result, ClassStateTable::kInsertResultSuccess);
} else {
// Update the class status, so later compilation stages know they don't need to verify
// the class.
LoadAndUpdateStatus(
- *dex_file, class_def, mirror::Class::kStatusVerified, class_loader, soa.Self());
+ *dex_file, class_def, ClassStatus::kVerified, class_loader, soa.Self());
// Create `VerifiedMethod`s for each methods, the compiler expects one for
// quickening or compiling.
// Note that this means:
@@ -1891,7 +1891,7 @@
// this class again.
LoadAndUpdateStatus(*dex_file,
class_def,
- mirror::Class::kStatusRetryVerificationAtRuntime,
+ ClassStatus::kRetryVerificationAtRuntime,
class_loader,
soa.Self());
}
@@ -2105,10 +2105,10 @@
// Only do this if the class is resolved. If even resolution fails, quickening will go very,
// very wrong.
if (klass->IsResolved() && !klass->IsErroneousResolved()) {
- if (klass->GetStatus() < mirror::Class::kStatusVerified) {
+ if (klass->GetStatus() < ClassStatus::kVerified) {
ObjectLock<mirror::Class> lock(soa.Self(), klass);
// Set class status to verified.
- mirror::Class::SetStatus(klass, mirror::Class::kStatusVerified, soa.Self());
+ mirror::Class::SetStatus(klass, ClassStatus::kVerified, soa.Self());
// Mark methods as pre-verified. If we don't do this, the interpreter will run with
// access checks.
klass->SetSkipAccessChecksFlagOnAllMethods(
@@ -2185,7 +2185,7 @@
const bool is_boot_image = manager_->GetCompiler()->GetCompilerOptions().IsBootImage();
const bool is_app_image = manager_->GetCompiler()->GetCompilerOptions().IsAppImage();
- mirror::Class::Status old_status = klass->GetStatus();
+ ClassStatus old_status = klass->GetStatus();
// Don't initialize classes in boot space when compiling app image
if (is_app_image && klass->IsBootStrapClassLoaded()) {
// Also return early and don't store the class status in the recorded class status.
@@ -2310,7 +2310,7 @@
// would do so they can be skipped at runtime.
if (!klass->IsInitialized() &&
manager_->GetClassLinker()->ValidateSuperClassDescriptors(klass)) {
- old_status = mirror::Class::kStatusSuperclassValidated;
+ old_status = ClassStatus::kSuperclassValidated;
} else {
soa.Self()->ClearException();
}
@@ -2771,36 +2771,36 @@
DCHECK(GetCompiledMethod(method_ref) != nullptr) << method_ref.PrettyMethod();
}
-bool CompilerDriver::GetCompiledClass(const ClassReference& ref,
- mirror::Class::Status* status) const {
+bool CompilerDriver::GetCompiledClass(const ClassReference& ref, ClassStatus* status) const {
DCHECK(status != nullptr);
// The table doesn't know if something wasn't inserted. For this case it will return
- // kStatusNotReady. To handle this, just assume anything we didn't try to verify is not compiled.
+ // ClassStatus::kNotReady. To handle this, just assume anything we didn't try to verify
+ // is not compiled.
if (!compiled_classes_.Get(ref, status) ||
- *status < mirror::Class::kStatusRetryVerificationAtRuntime) {
+ *status < ClassStatus::kRetryVerificationAtRuntime) {
return false;
}
return true;
}
-mirror::Class::Status CompilerDriver::GetClassStatus(const ClassReference& ref) const {
- mirror::Class::Status status = ClassStatus::kStatusNotReady;
+ClassStatus CompilerDriver::GetClassStatus(const ClassReference& ref) const {
+ ClassStatus status = ClassStatus::kNotReady;
if (!GetCompiledClass(ref, &status)) {
classpath_classes_.Get(ref, &status);
}
return status;
}
-void CompilerDriver::RecordClassStatus(const ClassReference& ref, mirror::Class::Status status) {
+void CompilerDriver::RecordClassStatus(const ClassReference& ref, ClassStatus status) {
switch (status) {
- case mirror::Class::kStatusErrorResolved:
- case mirror::Class::kStatusErrorUnresolved:
- case mirror::Class::kStatusNotReady:
- case mirror::Class::kStatusResolved:
- case mirror::Class::kStatusRetryVerificationAtRuntime:
- case mirror::Class::kStatusVerified:
- case mirror::Class::kStatusSuperclassValidated:
- case mirror::Class::kStatusInitialized:
+ case ClassStatus::kErrorResolved:
+ case ClassStatus::kErrorUnresolved:
+ case ClassStatus::kNotReady:
+ case ClassStatus::kResolved:
+ case ClassStatus::kRetryVerificationAtRuntime:
+ case ClassStatus::kVerified:
+ case ClassStatus::kSuperclassValidated:
+ case ClassStatus::kInitialized:
break; // Expected states.
default:
LOG(FATAL) << "Unexpected class status for class "
@@ -2812,7 +2812,7 @@
ClassStateTable::InsertResult result;
ClassStateTable* table = &compiled_classes_;
do {
- mirror::Class::Status existing = mirror::Class::kStatusNotReady;
+ ClassStatus existing = ClassStatus::kNotReady;
if (!table->Get(ref, &existing)) {
// A classpath class.
if (kIsDebugBuild) {
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index e001726..ef16212 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -31,13 +31,13 @@
#include "base/mutex.h"
#include "base/timing_logger.h"
#include "class_reference.h"
+#include "class_status.h"
#include "compiler.h"
-#include "dex_file.h"
-#include "dex_file_types.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_types.h"
#include "driver/compiled_method_storage.h"
#include "jit/profile_compilation_info.h"
#include "method_reference.h"
-#include "mirror/class.h" // For mirror::Class::Status.
#include "os.h"
#include "safe_map.h"
#include "thread_pool.h"
@@ -47,6 +47,7 @@
namespace art {
namespace mirror {
+class Class;
class DexCache;
} // namespace mirror
@@ -55,18 +56,21 @@
class VerifierDepsTest;
} // namespace verifier
+class ArtField;
class BitVector;
class CompiledMethod;
class CompilerOptions;
class DexCompilationUnit;
+template<class T> class Handle;
struct InlineIGetIPutData;
class InstructionSetFeatures;
class InternTable;
enum InvokeType : uint32_t;
+class MemberOffset;
+template<class MirrorType> class ObjPtr;
class ParallelCompilationManager;
class ScopedObjectAccess;
template <class Allocator> class SrcMap;
-template<class T> class Handle;
class TimingLogger;
class VdexFile;
class VerificationResults;
@@ -152,8 +156,8 @@
std::unique_ptr<const std::vector<uint8_t>> CreateQuickResolutionTrampoline() const;
std::unique_ptr<const std::vector<uint8_t>> CreateQuickToInterpreterBridge() const;
- mirror::Class::Status GetClassStatus(const ClassReference& ref) const;
- bool GetCompiledClass(const ClassReference& ref, mirror::Class::Status* status) const;
+ ClassStatus GetClassStatus(const ClassReference& ref) const;
+ bool GetCompiledClass(const ClassReference& ref, ClassStatus* status) const;
CompiledMethod* GetCompiledMethod(MethodReference ref) const;
size_t GetNonRelativeLinkerPatchCount() const;
@@ -321,7 +325,7 @@
// according to the profile file.
bool ShouldVerifyClassBasedOnProfile(const DexFile& dex_file, uint16_t class_idx) const;
- void RecordClassStatus(const ClassReference& ref, mirror::Class::Status status);
+ void RecordClassStatus(const ClassReference& ref, ClassStatus status);
// Checks if the specified method has been verified without failures. Returns
// false if the method is not in the verification results (GetVerificationResults).
@@ -476,7 +480,7 @@
GUARDED_BY(requires_constructor_barrier_lock_);
// All class references that this compiler has compiled. Indexed by class defs.
- using ClassStateTable = AtomicDexRefMap<ClassReference, mirror::Class::Status>;
+ using ClassStateTable = AtomicDexRefMap<ClassReference, ClassStatus>;
ClassStateTable compiled_classes_;
// All class references that are in the classpath. Indexed by class defs.
ClassStateTable classpath_classes_;
diff --git a/compiler/driver/compiler_driver_test.cc b/compiler/driver/compiler_driver_test.cc
index 278358b..162904c 100644
--- a/compiler/driver/compiler_driver_test.cc
+++ b/compiler/driver/compiler_driver_test.cc
@@ -16,16 +16,18 @@
#include "driver/compiler_driver.h"
+#include <limits>
#include <stdint.h>
#include <stdio.h>
#include <memory>
#include "art_method-inl.h"
+#include "base/casts.h"
#include "class_linker-inl.h"
#include "common_compiler_test.h"
#include "compiler_callbacks.h"
-#include "dex_file.h"
-#include "dex_file_types.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_types.h"
#include "gc/heap.h"
#include "handle_scope-inl.h"
#include "jit/profile_compilation_info.h"
@@ -344,11 +346,11 @@
ASSERT_NE(klass, nullptr);
EXPECT_TRUE(klass->IsVerified());
- mirror::Class::Status status;
+ ClassStatus status;
bool found = compiler_driver_->GetCompiledClass(
ClassReference(&klass->GetDexFile(), klass->GetDexTypeIndex().index_), &status);
ASSERT_TRUE(found);
- EXPECT_EQ(status, mirror::Class::kStatusVerified);
+ EXPECT_EQ(status, ClassStatus::kVerified);
}
};
@@ -367,8 +369,8 @@
CheckVerifiedClass(class_loader, "LSecond;");
}
-// Test that a class of status kStatusRetryVerificationAtRuntime is indeed recorded that way in the
-// driver.
+// Test that a class of status ClassStatus::kRetryVerificationAtRuntime is indeed
+// recorded that way in the driver.
TEST_F(CompilerDriverVerifyTest, RetryVerifcationStatusCheckVerified) {
Thread* const self = Thread::Current();
jobject class_loader;
@@ -386,17 +388,19 @@
callbacks_->SetDoesClassUnloading(true, compiler_driver_.get());
ClassReference ref(dex_file, 0u);
// Test that the status is read from the compiler driver as expected.
- for (size_t i = mirror::Class::kStatusRetryVerificationAtRuntime;
- i < mirror::Class::kStatusMax;
- ++i) {
- const mirror::Class::Status expected_status = static_cast<mirror::Class::Status>(i);
+ static_assert(enum_cast<size_t>(ClassStatus::kLast) < std::numeric_limits<size_t>::max(),
+ "Make sure incrementing the class status does not overflow.");
+ for (size_t i = enum_cast<size_t>(ClassStatus::kRetryVerificationAtRuntime);
+ i <= enum_cast<size_t>(ClassStatus::kLast);
+ ++i) {
+ const ClassStatus expected_status = enum_cast<ClassStatus>(i);
// Skip unsupported status that are not supposed to be ever recorded.
- if (expected_status == mirror::Class::kStatusVerifyingAtRuntime ||
- expected_status == mirror::Class::kStatusInitializing) {
+ if (expected_status == ClassStatus::kVerifyingAtRuntime ||
+ expected_status == ClassStatus::kInitializing) {
continue;
}
compiler_driver_->RecordClassStatus(ref, expected_status);
- mirror::Class::Status status = {};
+ ClassStatus status = {};
ASSERT_TRUE(compiler_driver_->GetCompiledClass(ref, &status));
EXPECT_EQ(status, expected_status);
}
diff --git a/compiler/driver/dex_compilation_unit.cc b/compiler/driver/dex_compilation_unit.cc
index 76e1299..1fe30de 100644
--- a/compiler/driver/dex_compilation_unit.cc
+++ b/compiler/driver/dex_compilation_unit.cc
@@ -16,7 +16,7 @@
#include "dex_compilation_unit.h"
-#include "code_item_accessors-inl.h"
+#include "dex/code_item_accessors-inl.h"
#include "mirror/dex_cache.h"
#include "utils.h"
diff --git a/compiler/driver/dex_compilation_unit.h b/compiler/driver/dex_compilation_unit.h
index cdc505f..c1ae3c9 100644
--- a/compiler/driver/dex_compilation_unit.h
+++ b/compiler/driver/dex_compilation_unit.h
@@ -20,8 +20,8 @@
#include <stdint.h>
#include "base/arena_object.h"
-#include "code_item_accessors.h"
-#include "dex_file.h"
+#include "dex/code_item_accessors.h"
+#include "dex/dex_file.h"
#include "handle.h"
#include "jni.h"
diff --git a/compiler/exception_test.cc b/compiler/exception_test.cc
index 59d20f8..8f7ab05 100644
--- a/compiler/exception_test.cc
+++ b/compiler/exception_test.cc
@@ -20,11 +20,11 @@
#include "base/callee_save_type.h"
#include "base/enums.h"
#include "class_linker.h"
-#include "code_item_accessors-inl.h"
#include "common_runtime_test.h"
-#include "dex_file-inl.h"
-#include "dex_file.h"
-#include "dex_file_exception_helpers.h"
+#include "dex/code_item_accessors-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_exception_helpers.h"
#include "gtest/gtest.h"
#include "handle_scope-inl.h"
#include "leb128.h"
diff --git a/compiler/jni/jni_compiler_test.cc b/compiler/jni/jni_compiler_test.cc
index daf64d1..f34e9b8 100644
--- a/compiler/jni/jni_compiler_test.cc
+++ b/compiler/jni/jni_compiler_test.cc
@@ -24,7 +24,7 @@
#include "class_linker.h"
#include "common_compiler_test.h"
#include "compiler.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "gtest/gtest.h"
#include "indirect_reference_table.h"
#include "java_vm_ext.h"
@@ -299,7 +299,6 @@
}
// JNI operations after runtime start.
env_ = Thread::Current()->GetJniEnv();
- library_search_path_ = env_->NewStringUTF("");
jklass_ = env_->FindClass("MyClassNatives");
ASSERT_TRUE(jklass_ != nullptr) << method_name << " " << method_sig;
@@ -380,7 +379,6 @@
void CriticalNativeImpl();
JNIEnv* env_;
- jstring library_search_path_;
jmethodID jmethod_;
private:
@@ -660,7 +658,7 @@
std::string reason;
ASSERT_TRUE(Runtime::Current()->GetJavaVM()->
- LoadNativeLibrary(env_, "", class_loader_, library_search_path_, &reason))
+ LoadNativeLibrary(env_, "", class_loader_, &reason))
<< reason;
jint result = env_->CallNonvirtualIntMethod(jobj_, jklass_, jmethod_, 24);
@@ -676,7 +674,7 @@
std::string reason;
ASSERT_TRUE(Runtime::Current()->GetJavaVM()->
- LoadNativeLibrary(env_, "", class_loader_, library_search_path_, &reason))
+ LoadNativeLibrary(env_, "", class_loader_, &reason))
<< reason;
jint result = env_->CallStaticIntMethod(jklass_, jmethod_, 42);
diff --git a/compiler/jni/quick/jni_compiler.cc b/compiler/jni/quick/jni_compiler.cc
index 136e3db..fc44927 100644
--- a/compiler/jni/quick/jni_compiler.cc
+++ b/compiler/jni/quick/jni_compiler.cc
@@ -30,7 +30,7 @@
#include "calling_convention.h"
#include "class_linker.h"
#include "debug/dwarf/debug_frame_opcode_writer.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "driver/compiler_driver.h"
#include "driver/compiler_options.h"
#include "entrypoints/quick/quick_entrypoints.h"
diff --git a/compiler/linker/arm/relative_patcher_arm_base.cc b/compiler/linker/arm/relative_patcher_arm_base.cc
index 2cb23d1..cedbe5d 100644
--- a/compiler/linker/arm/relative_patcher_arm_base.cc
+++ b/compiler/linker/arm/relative_patcher_arm_base.cc
@@ -19,7 +19,7 @@
#include "base/stl_util.h"
#include "compiled_method-inl.h"
#include "debug/method_debug_info.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "linker/linker_patch.h"
#include "linker/output_stream.h"
#include "oat.h"
diff --git a/compiler/optimizing/block_builder.cc b/compiler/optimizing/block_builder.cc
index 0c92600..2b568bc 100644
--- a/compiler/optimizing/block_builder.cc
+++ b/compiler/optimizing/block_builder.cc
@@ -18,8 +18,8 @@
#include "base/logging.h" // FOR VLOG.
#include "bytecode_utils.h"
-#include "code_item_accessors-inl.h"
-#include "dex_file_exception_helpers.h"
+#include "dex/code_item_accessors-inl.h"
+#include "dex/dex_file_exception_helpers.h"
#include "quicken_info.h"
namespace art {
diff --git a/compiler/optimizing/block_builder.h b/compiler/optimizing/block_builder.h
index e68b95c..2c1f034 100644
--- a/compiler/optimizing/block_builder.h
+++ b/compiler/optimizing/block_builder.h
@@ -19,8 +19,8 @@
#include "base/scoped_arena_allocator.h"
#include "base/scoped_arena_containers.h"
-#include "code_item_accessors.h"
-#include "dex_file.h"
+#include "dex/code_item_accessors.h"
+#include "dex/dex_file.h"
#include "nodes.h"
namespace art {
diff --git a/compiler/optimizing/builder.h b/compiler/optimizing/builder.h
index c40e0b4..c16a3a9 100644
--- a/compiler/optimizing/builder.h
+++ b/compiler/optimizing/builder.h
@@ -18,9 +18,9 @@
#define ART_COMPILER_OPTIMIZING_BUILDER_H_
#include "base/arena_object.h"
-#include "code_item_accessors.h"
-#include "dex_file-inl.h"
-#include "dex_file.h"
+#include "dex/code_item_accessors.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file.h"
#include "driver/compiler_driver.h"
#include "nodes.h"
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc
index 729b08e..07894fd 100644
--- a/compiler/optimizing/code_generator.cc
+++ b/compiler/optimizing/code_generator.cc
@@ -45,8 +45,8 @@
#include "base/casts.h"
#include "bytecode_utils.h"
#include "class_linker.h"
-#include "code_item_accessors-inl.h"
#include "compiled_method.h"
+#include "dex/code_item_accessors-inl.h"
#include "dex/verified_method.h"
#include "driver/compiler_driver.h"
#include "graph_visualizer.h"
diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc
index f9dcb5d..13886b3 100644
--- a/compiler/optimizing/code_generator_arm64.cc
+++ b/compiler/optimizing/code_generator_arm64.cc
@@ -2103,9 +2103,8 @@
// TODO(vixl): Let the MacroAssembler handle MemOperand.
__ Add(temp, class_reg, status_offset);
__ Ldarb(temp, HeapOperand(temp));
- __ Cmp(temp, mirror::Class::kStatusInitialized);
- __ B(ne, slow_path->GetEntryLabel());
- // Use Bne instead of Blt because ARM64 doesn't have Ldarsb.
+ __ Cmp(temp, enum_cast<>(ClassStatus::kInitialized));
+ __ B(lo, slow_path->GetEntryLabel());
__ Bind(slow_path->GetExitLabel());
}
diff --git a/compiler/optimizing/code_generator_arm64.h b/compiler/optimizing/code_generator_arm64.h
index e53773c..f92c94f 100644
--- a/compiler/optimizing/code_generator_arm64.h
+++ b/compiler/optimizing/code_generator_arm64.h
@@ -20,7 +20,7 @@
#include "arch/arm64/quick_method_frame_info_arm64.h"
#include "code_generator.h"
#include "common_arm64.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "driver/compiler_options.h"
#include "nodes.h"
#include "parallel_move_resolver.h"
diff --git a/compiler/optimizing/code_generator_arm_vixl.cc b/compiler/optimizing/code_generator_arm_vixl.cc
index c6e1b04..7f83533 100644
--- a/compiler/optimizing/code_generator_arm_vixl.cc
+++ b/compiler/optimizing/code_generator_arm_vixl.cc
@@ -7173,12 +7173,12 @@
LoadClassSlowPathARMVIXL* slow_path, vixl32::Register class_reg) {
UseScratchRegisterScope temps(GetVIXLAssembler());
vixl32::Register temp = temps.Acquire();
- GetAssembler()->LoadFromOffset(kLoadSignedByte,
+ GetAssembler()->LoadFromOffset(kLoadUnsignedByte,
temp,
class_reg,
mirror::Class::StatusOffset().Int32Value());
- __ Cmp(temp, mirror::Class::kStatusInitialized);
- __ B(lt, slow_path->GetEntryLabel());
+ __ Cmp(temp, enum_cast<>(ClassStatus::kInitialized));
+ __ B(lo, slow_path->GetEntryLabel());
// Even if the initialized flag is set, we may be in a situation where caches are not synced
// properly. Therefore, we do a memory fence.
__ Dmb(ISH);
diff --git a/compiler/optimizing/code_generator_mips.cc b/compiler/optimizing/code_generator_mips.cc
index c4772ad..ebe252a 100644
--- a/compiler/optimizing/code_generator_mips.cc
+++ b/compiler/optimizing/code_generator_mips.cc
@@ -1915,9 +1915,9 @@
void InstructionCodeGeneratorMIPS::GenerateClassInitializationCheck(SlowPathCodeMIPS* slow_path,
Register class_reg) {
- __ LoadFromOffset(kLoadSignedByte, TMP, class_reg, mirror::Class::StatusOffset().Int32Value());
- __ LoadConst32(AT, mirror::Class::kStatusInitialized);
- __ Blt(TMP, AT, slow_path->GetEntryLabel());
+ __ LoadFromOffset(kLoadUnsignedByte, TMP, class_reg, mirror::Class::StatusOffset().Int32Value());
+ __ LoadConst32(AT, enum_cast<>(ClassStatus::kInitialized));
+ __ Bltu(TMP, AT, slow_path->GetEntryLabel());
// Even if the initialized flag is set, we need to ensure consistent memory ordering.
__ Sync(0);
__ Bind(slow_path->GetExitLabel());
diff --git a/compiler/optimizing/code_generator_mips.h b/compiler/optimizing/code_generator_mips.h
index cf8e7a3..32b3e42 100644
--- a/compiler/optimizing/code_generator_mips.h
+++ b/compiler/optimizing/code_generator_mips.h
@@ -18,7 +18,7 @@
#define ART_COMPILER_OPTIMIZING_CODE_GENERATOR_MIPS_H_
#include "code_generator.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "driver/compiler_options.h"
#include "nodes.h"
#include "parallel_move_resolver.h"
diff --git a/compiler/optimizing/code_generator_mips64.cc b/compiler/optimizing/code_generator_mips64.cc
index c8891ed..3ea7b82 100644
--- a/compiler/optimizing/code_generator_mips64.cc
+++ b/compiler/optimizing/code_generator_mips64.cc
@@ -1761,9 +1761,9 @@
void InstructionCodeGeneratorMIPS64::GenerateClassInitializationCheck(SlowPathCodeMIPS64* slow_path,
GpuRegister class_reg) {
- __ LoadFromOffset(kLoadSignedByte, TMP, class_reg, mirror::Class::StatusOffset().Int32Value());
- __ LoadConst32(AT, mirror::Class::kStatusInitialized);
- __ Bltc(TMP, AT, slow_path->GetEntryLabel());
+ __ LoadFromOffset(kLoadUnsignedByte, TMP, class_reg, mirror::Class::StatusOffset().Int32Value());
+ __ LoadConst32(AT, enum_cast<>(ClassStatus::kInitialized));
+ __ Bltuc(TMP, AT, slow_path->GetEntryLabel());
// Even if the initialized flag is set, we need to ensure consistent memory ordering.
__ Sync(0);
__ Bind(slow_path->GetExitLabel());
diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc
index ba222fe..6853238 100644
--- a/compiler/optimizing/code_generator_x86.cc
+++ b/compiler/optimizing/code_generator_x86.cc
@@ -6220,8 +6220,8 @@
void InstructionCodeGeneratorX86::GenerateClassInitializationCheck(
SlowPathCode* slow_path, Register class_reg) {
__ cmpb(Address(class_reg, mirror::Class::StatusOffset().Int32Value()),
- Immediate(mirror::Class::kStatusInitialized));
- __ j(kLess, slow_path->GetEntryLabel());
+ Immediate(enum_cast<>(ClassStatus::kInitialized)));
+ __ j(kBelow, slow_path->GetEntryLabel());
__ Bind(slow_path->GetExitLabel());
// No need for memory fence, thanks to the X86 memory model.
}
diff --git a/compiler/optimizing/code_generator_x86.h b/compiler/optimizing/code_generator_x86.h
index 40b7e3c..0082853 100644
--- a/compiler/optimizing/code_generator_x86.h
+++ b/compiler/optimizing/code_generator_x86.h
@@ -20,7 +20,7 @@
#include "arch/x86/instruction_set_features_x86.h"
#include "base/enums.h"
#include "code_generator.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "driver/compiler_options.h"
#include "nodes.h"
#include "parallel_move_resolver.h"
diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc
index caad788..1f8d822 100644
--- a/compiler/optimizing/code_generator_x86_64.cc
+++ b/compiler/optimizing/code_generator_x86_64.cc
@@ -5426,8 +5426,8 @@
void InstructionCodeGeneratorX86_64::GenerateClassInitializationCheck(
SlowPathCode* slow_path, CpuRegister class_reg) {
__ cmpb(Address(class_reg, mirror::Class::StatusOffset().Int32Value()),
- Immediate(mirror::Class::kStatusInitialized));
- __ j(kLess, slow_path->GetEntryLabel());
+ Immediate(enum_cast<>(ClassStatus::kInitialized)));
+ __ j(kBelow, slow_path->GetEntryLabel());
__ Bind(slow_path->GetExitLabel());
// No need for memory fence, thanks to the x86-64 memory model.
}
diff --git a/compiler/optimizing/codegen_test.cc b/compiler/optimizing/codegen_test.cc
index ba431a5..6eda289 100644
--- a/compiler/optimizing/codegen_test.cc
+++ b/compiler/optimizing/codegen_test.cc
@@ -20,8 +20,8 @@
#include "base/macros.h"
#include "builder.h"
#include "codegen_test_utils.h"
-#include "dex_file.h"
-#include "dex_instruction.h"
+#include "dex/dex_file.h"
+#include "dex/dex_instruction.h"
#include "driver/compiler_options.h"
#include "nodes.h"
#include "optimizing_unit_test.h"
diff --git a/compiler/optimizing/dominator_test.cc b/compiler/optimizing/dominator_test.cc
index 6bf3a59..572466e 100644
--- a/compiler/optimizing/dominator_test.cc
+++ b/compiler/optimizing/dominator_test.cc
@@ -16,7 +16,7 @@
#include "base/arena_allocator.h"
#include "builder.h"
-#include "dex_instruction.h"
+#include "dex/dex_instruction.h"
#include "nodes.h"
#include "optimizing_unit_test.h"
diff --git a/compiler/optimizing/find_loops_test.cc b/compiler/optimizing/find_loops_test.cc
index c917528..b799fb4 100644
--- a/compiler/optimizing/find_loops_test.cc
+++ b/compiler/optimizing/find_loops_test.cc
@@ -16,8 +16,8 @@
#include "base/arena_allocator.h"
#include "builder.h"
-#include "dex_file.h"
-#include "dex_instruction.h"
+#include "dex/dex_file.h"
+#include "dex/dex_instruction.h"
#include "nodes.h"
#include "optimizing_unit_test.h"
#include "pretty_printer.h"
diff --git a/compiler/optimizing/inliner.h b/compiler/optimizing/inliner.h
index 042eee3..e81d97b 100644
--- a/compiler/optimizing/inliner.h
+++ b/compiler/optimizing/inliner.h
@@ -17,7 +17,7 @@
#ifndef ART_COMPILER_OPTIMIZING_INLINER_H_
#define ART_COMPILER_OPTIMIZING_INLINER_H_
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "invoke_type.h"
#include "jit/profile_compilation_info.h"
#include "optimization.h"
diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc
index 3f5923f..72a93c1 100644
--- a/compiler/optimizing/instruction_builder.cc
+++ b/compiler/optimizing/instruction_builder.cc
@@ -23,7 +23,7 @@
#include "bytecode_utils.h"
#include "class_linker.h"
#include "data_type-inl.h"
-#include "dex_instruction-inl.h"
+#include "dex/dex_instruction-inl.h"
#include "driver/compiler_driver-inl.h"
#include "driver/dex_compilation_unit.h"
#include "driver/compiler_options.h"
diff --git a/compiler/optimizing/instruction_builder.h b/compiler/optimizing/instruction_builder.h
index b4e3051..708a097 100644
--- a/compiler/optimizing/instruction_builder.h
+++ b/compiler/optimizing/instruction_builder.h
@@ -19,10 +19,10 @@
#include "base/scoped_arena_allocator.h"
#include "base/scoped_arena_containers.h"
-#include "code_item_accessors.h"
#include "data_type.h"
-#include "dex_file.h"
-#include "dex_file_types.h"
+#include "dex/code_item_accessors.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_types.h"
#include "handle.h"
#include "nodes.h"
#include "quicken_info.h"
diff --git a/compiler/optimizing/linearize_test.cc b/compiler/optimizing/linearize_test.cc
index b2a9c0a..43b63a7 100644
--- a/compiler/optimizing/linearize_test.cc
+++ b/compiler/optimizing/linearize_test.cc
@@ -21,8 +21,8 @@
#include "builder.h"
#include "code_generator.h"
#include "code_generator_x86.h"
-#include "dex_file.h"
-#include "dex_instruction.h"
+#include "dex/dex_file.h"
+#include "dex/dex_instruction.h"
#include "driver/compiler_options.h"
#include "graph_visualizer.h"
#include "nodes.h"
diff --git a/compiler/optimizing/live_ranges_test.cc b/compiler/optimizing/live_ranges_test.cc
index ddcad5a..e45d7c8 100644
--- a/compiler/optimizing/live_ranges_test.cc
+++ b/compiler/optimizing/live_ranges_test.cc
@@ -19,8 +19,8 @@
#include "builder.h"
#include "code_generator.h"
#include "code_generator_x86.h"
-#include "dex_file.h"
-#include "dex_instruction.h"
+#include "dex/dex_file.h"
+#include "dex/dex_instruction.h"
#include "driver/compiler_options.h"
#include "nodes.h"
#include "optimizing_unit_test.h"
diff --git a/compiler/optimizing/liveness_test.cc b/compiler/optimizing/liveness_test.cc
index 3eadc8f..35bc4ff 100644
--- a/compiler/optimizing/liveness_test.cc
+++ b/compiler/optimizing/liveness_test.cc
@@ -19,8 +19,8 @@
#include "builder.h"
#include "code_generator.h"
#include "code_generator_x86.h"
-#include "dex_file.h"
-#include "dex_instruction.h"
+#include "dex/dex_file.h"
+#include "dex/dex_instruction.h"
#include "driver/compiler_options.h"
#include "nodes.h"
#include "optimizing_unit_test.h"
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index d13f5b4..d4382c6 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -30,8 +30,8 @@
#include "base/transform_array_ref.h"
#include "data_type.h"
#include "deoptimization_kind.h"
-#include "dex_file.h"
-#include "dex_file_types.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_types.h"
#include "entrypoints/quick/quick_entrypoints_enum.h"
#include "handle.h"
#include "handle_scope.h"
diff --git a/compiler/optimizing/optimization.cc b/compiler/optimizing/optimization.cc
index d8ac696..92b427c 100644
--- a/compiler/optimizing/optimization.cc
+++ b/compiler/optimizing/optimization.cc
@@ -35,11 +35,11 @@
#include "bounds_check_elimination.h"
#include "cha_guard_optimization.h"
-#include "code_item_accessors-inl.h"
#include "code_sinking.h"
#include "constant_folding.h"
#include "constructor_fence_redundancy_elimination.h"
#include "dead_code_elimination.h"
+#include "dex/code_item_accessors-inl.h"
#include "driver/dex_compilation_unit.h"
#include "gvn.h"
#include "induction_var_analysis.h"
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index 9d04dd8..b64f82c 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -36,9 +36,9 @@
#include "compiler.h"
#include "debug/elf_debug_writer.h"
#include "debug/method_debug_info.h"
+#include "dex/dex_file_types.h"
#include "dex/verification_results.h"
#include "dex/verified_method.h"
-#include "dex_file_types.h"
#include "driver/compiler_driver-inl.h"
#include "driver/compiler_options.h"
#include "driver/dex_compilation_unit.h"
diff --git a/compiler/optimizing/optimizing_unit_test.h b/compiler/optimizing/optimizing_unit_test.h
index 7d05262..661abb1 100644
--- a/compiler/optimizing/optimizing_unit_test.h
+++ b/compiler/optimizing/optimizing_unit_test.h
@@ -19,10 +19,10 @@
#include "base/scoped_arena_allocator.h"
#include "builder.h"
-#include "code_item_accessors-inl.h"
#include "common_compiler_test.h"
-#include "dex_file.h"
-#include "dex_instruction.h"
+#include "dex/code_item_accessors-inl.h"
+#include "dex/dex_file.h"
+#include "dex/dex_instruction.h"
#include "driver/dex_compilation_unit.h"
#include "handle_scope-inl.h"
#include "mirror/class_loader.h"
diff --git a/compiler/optimizing/prepare_for_register_allocation.cc b/compiler/optimizing/prepare_for_register_allocation.cc
index 1ed190d..f843c00 100644
--- a/compiler/optimizing/prepare_for_register_allocation.cc
+++ b/compiler/optimizing/prepare_for_register_allocation.cc
@@ -16,7 +16,7 @@
#include "prepare_for_register_allocation.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "jni_internal.h"
#include "optimizing_compiler_stats.h"
#include "well_known_classes.h"
diff --git a/compiler/optimizing/pretty_printer_test.cc b/compiler/optimizing/pretty_printer_test.cc
index 4aec6d3..4fc7fe9 100644
--- a/compiler/optimizing/pretty_printer_test.cc
+++ b/compiler/optimizing/pretty_printer_test.cc
@@ -18,8 +18,8 @@
#include "base/arena_allocator.h"
#include "builder.h"
-#include "dex_file.h"
-#include "dex_instruction.h"
+#include "dex/dex_file.h"
+#include "dex/dex_instruction.h"
#include "nodes.h"
#include "optimizing_unit_test.h"
diff --git a/compiler/optimizing/register_allocator_test.cc b/compiler/optimizing/register_allocator_test.cc
index 69ed8c7..3748d59 100644
--- a/compiler/optimizing/register_allocator_test.cc
+++ b/compiler/optimizing/register_allocator_test.cc
@@ -21,9 +21,9 @@
#include "builder.h"
#include "code_generator.h"
#include "code_generator_x86.h"
-#include "dex_file.h"
-#include "dex_file_types.h"
-#include "dex_instruction.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_types.h"
+#include "dex/dex_instruction.h"
#include "driver/compiler_options.h"
#include "nodes.h"
#include "optimizing_unit_test.h"
diff --git a/compiler/optimizing/ssa_test.cc b/compiler/optimizing/ssa_test.cc
index e08904e..77e70d7 100644
--- a/compiler/optimizing/ssa_test.cc
+++ b/compiler/optimizing/ssa_test.cc
@@ -18,8 +18,8 @@
#include "base/arena_allocator.h"
#include "builder.h"
-#include "dex_file.h"
-#include "dex_instruction.h"
+#include "dex/dex_file.h"
+#include "dex/dex_instruction.h"
#include "nodes.h"
#include "optimizing_unit_test.h"
#include "pretty_printer.h"
diff --git a/compiler/optimizing/stack_map_stream.cc b/compiler/optimizing/stack_map_stream.cc
index 4f43eb3..7010e3f 100644
--- a/compiler/optimizing/stack_map_stream.cc
+++ b/compiler/optimizing/stack_map_stream.cc
@@ -18,7 +18,7 @@
#include "art_method-inl.h"
#include "base/stl_util.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "optimizing/optimizing_compiler.h"
#include "runtime.h"
#include "scoped_thread_state_change-inl.h"
diff --git a/compiler/optimizing/suspend_check_test.cc b/compiler/optimizing/suspend_check_test.cc
index 88336b0..7e83f8c 100644
--- a/compiler/optimizing/suspend_check_test.cc
+++ b/compiler/optimizing/suspend_check_test.cc
@@ -15,7 +15,7 @@
*/
#include "builder.h"
-#include "dex_instruction.h"
+#include "dex/dex_instruction.h"
#include "nodes.h"
#include "optimizing_unit_test.h"
#include "pretty_printer.h"
diff --git a/compiler/trampolines/trampoline_compiler.h b/compiler/trampolines/trampoline_compiler.h
index 1a10e4c..64c1eb5 100644
--- a/compiler/trampolines/trampoline_compiler.h
+++ b/compiler/trampolines/trampoline_compiler.h
@@ -21,6 +21,7 @@
#include <vector>
#include "driver/compiler_driver.h"
+#include "offsets.h"
namespace art {
diff --git a/compiler/utils/atomic_dex_ref_map-inl.h b/compiler/utils/atomic_dex_ref_map-inl.h
index 00db09a..203e484 100644
--- a/compiler/utils/atomic_dex_ref_map-inl.h
+++ b/compiler/utils/atomic_dex_ref_map-inl.h
@@ -21,8 +21,8 @@
#include <type_traits>
-#include "dex_file-inl.h"
#include "class_reference.h"
+#include "dex/dex_file-inl.h"
#include "method_reference.h"
#include "type_reference.h"
diff --git a/compiler/utils/atomic_dex_ref_map.h b/compiler/utils/atomic_dex_ref_map.h
index 205543f..9ff506d 100644
--- a/compiler/utils/atomic_dex_ref_map.h
+++ b/compiler/utils/atomic_dex_ref_map.h
@@ -18,7 +18,7 @@
#define ART_COMPILER_UTILS_ATOMIC_DEX_REF_MAP_H_
#include "base/dchecked_vector.h"
-#include "dex_file_reference.h"
+#include "dex/dex_file_reference.h"
#include "safe_map.h"
namespace art {
diff --git a/compiler/utils/atomic_dex_ref_map_test.cc b/compiler/utils/atomic_dex_ref_map_test.cc
index 8fce36f..d58d60b 100644
--- a/compiler/utils/atomic_dex_ref_map_test.cc
+++ b/compiler/utils/atomic_dex_ref_map_test.cc
@@ -19,7 +19,7 @@
#include <memory>
#include "common_runtime_test.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "method_reference.h"
#include "scoped_thread_state_change-inl.h"
diff --git a/compiler/utils/string_reference_test.cc b/compiler/utils/string_reference_test.cc
index 90335eb..4b07e65 100644
--- a/compiler/utils/string_reference_test.cc
+++ b/compiler/utils/string_reference_test.cc
@@ -18,7 +18,7 @@
#include <memory>
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "gtest/gtest.h"
#include "utils/test_dex_file_builder.h"
diff --git a/compiler/utils/test_dex_file_builder.h b/compiler/utils/test_dex_file_builder.h
index 441ef8e..04fba51 100644
--- a/compiler/utils/test_dex_file_builder.h
+++ b/compiler/utils/test_dex_file_builder.h
@@ -27,8 +27,8 @@
#include <android-base/logging.h>
#include "base/bit_utils.h"
-#include "dex_file_loader.h"
-#include "standard_dex_file.h"
+#include "dex/dex_file_loader.h"
+#include "dex/standard_dex_file.h"
namespace art {
diff --git a/compiler/utils/test_dex_file_builder_test.cc b/compiler/utils/test_dex_file_builder_test.cc
index c76739b..736a17e 100644
--- a/compiler/utils/test_dex_file_builder_test.cc
+++ b/compiler/utils/test_dex_file_builder_test.cc
@@ -16,7 +16,7 @@
#include "test_dex_file_builder.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "gtest/gtest.h"
#include "utils.h"
diff --git a/compiler/verifier_deps_test.cc b/compiler/verifier_deps_test.cc
index ee1d7c6..76448d8 100644
--- a/compiler/verifier_deps_test.cc
+++ b/compiler/verifier_deps_test.cc
@@ -21,10 +21,10 @@
#include "class_linker.h"
#include "common_compiler_test.h"
#include "compiler_callbacks.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_types.h"
#include "dex/verification_results.h"
#include "dex/verified_method.h"
-#include "dex_file-inl.h"
-#include "dex_file_types.h"
#include "driver/compiler_driver-inl.h"
#include "driver/compiler_options.h"
#include "handle_scope-inl.h"
@@ -237,9 +237,9 @@
CHECK(soa.Self()->IsExceptionPending());
soa.Self()->ClearException();
} else if (unverified_classes.find(class_def.class_idx_) == unverified_classes.end()) {
- ASSERT_EQ(cls->GetStatus(), mirror::Class::kStatusVerified);
+ ASSERT_EQ(cls->GetStatus(), ClassStatus::kVerified);
} else {
- ASSERT_LT(cls->GetStatus(), mirror::Class::kStatusVerified);
+ ASSERT_LT(cls->GetStatus(), ClassStatus::kVerified);
}
}
}
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 11c9031..dabe07f 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -59,11 +59,11 @@
#include "debug/elf_debug_writer.h"
#include "debug/method_debug_info.h"
#include "dexlayout.h"
+#include "dex/dex_file-inl.h"
#include "dex/quick_compiler_callbacks.h"
#include "dex/verification_results.h"
#include "dex2oat_options.h"
#include "dex2oat_return_codes.h"
-#include "dex_file-inl.h"
#include "driver/compiler_driver.h"
#include "driver/compiler_options.h"
#include "driver/compiler_options_map-inl.h"
diff --git a/dex2oat/dex2oat_image_test.cc b/dex2oat/dex2oat_image_test.cc
index 035b395..980363b 100644
--- a/dex2oat/dex2oat_image_test.cc
+++ b/dex2oat/dex2oat_image_test.cc
@@ -29,8 +29,8 @@
#include "base/file_utils.h"
#include "base/macros.h"
#include "base/unix_file/fd_file.h"
-#include "dex_file-inl.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_loader.h"
#include "jit/profile_compilation_info.h"
#include "method_reference.h"
#include "runtime.h"
diff --git a/dex2oat/dex2oat_options.h b/dex2oat/dex2oat_options.h
index f8198ee..ccc85c8 100644
--- a/dex2oat/dex2oat_options.h
+++ b/dex2oat/dex2oat_options.h
@@ -22,9 +22,9 @@
#include <vector>
#include "base/variant_map.h"
-#include "cdex/compact_dex_level.h"
#include "cmdline_types.h" // TODO: don't need to include this file here
#include "compiler.h"
+#include "dex/compact_dex_level.h"
#include "driver/compiler_options_map.h"
#include "image.h"
diff --git a/dex2oat/dex2oat_test.cc b/dex2oat/dex2oat_test.cc
index b338d08..c91240e 100644
--- a/dex2oat/dex2oat_test.cc
+++ b/dex2oat/dex2oat_test.cc
@@ -30,11 +30,11 @@
#include "base/macros.h"
#include "base/mutex-inl.h"
#include "bytecode_utils.h"
-#include "code_item_accessors-inl.h"
+#include "dex/code_item_accessors-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_loader.h"
#include "dex2oat_environment_test.h"
#include "dex2oat_return_codes.h"
-#include "dex_file-inl.h"
-#include "dex_file_loader.h"
#include "jit/profile_compilation_info.h"
#include "oat.h"
#include "oat_file.h"
diff --git a/dex2oat/linker/image_writer.cc b/dex2oat/linker/image_writer.cc
index 738bbf8..73eaad4 100644
--- a/dex2oat/linker/image_writer.cc
+++ b/dex2oat/linker/image_writer.cc
@@ -33,8 +33,8 @@
#include "base/unix_file/fd_file.h"
#include "class_linker-inl.h"
#include "compiled_method.h"
-#include "dex_file-inl.h"
-#include "dex_file_types.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_types.h"
#include "driver/compiler_driver.h"
#include "elf_file.h"
#include "elf_utils.h"
@@ -585,7 +585,7 @@
if (dirty_image_objects_ != nullptr &&
dirty_image_objects_->find(klass->PrettyDescriptor()) != dirty_image_objects_->end()) {
bin = Bin::kKnownDirty;
- } else if (klass->GetStatus() == Class::kStatusInitialized) {
+ } else if (klass->GetStatus() == ClassStatus::kInitialized) {
bin = Bin::kClassInitialized;
// If the class's static fields are all final, put it into a separate bin
@@ -650,7 +650,7 @@
}
mirror::Class* declaring_class = m->GetDeclaringClass();
// Initialized is highly unlikely to dirty since there's no entry points to mutate.
- return declaring_class == nullptr || declaring_class->GetStatus() != Class::kStatusInitialized;
+ return declaring_class == nullptr || declaring_class->GetStatus() != ClassStatus::kInitialized;
}
bool ImageWriter::IsImageBinSlotAssigned(mirror::Object* object) const {
diff --git a/dex2oat/linker/image_writer.h b/dex2oat/linker/image_writer.h
index 3aceceb..a7c1439 100644
--- a/dex2oat/linker/image_writer.h
+++ b/dex2oat/linker/image_writer.h
@@ -62,6 +62,7 @@
} // namespace mirror
class ClassLoaderVisitor;
+class ImTable;
class ImtConflictTable;
static constexpr int kInvalidFd = -1;
diff --git a/dex2oat/linker/oat_writer.cc b/dex2oat/linker/oat_writer.cc
index d261679..cb1b80d 100644
--- a/dex2oat/linker/oat_writer.cc
+++ b/dex2oat/linker/oat_writer.cc
@@ -33,10 +33,11 @@
#include "class_table-inl.h"
#include "compiled_method-inl.h"
#include "debug/method_debug_info.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_loader.h"
+#include "dex/dex_file_types.h"
+#include "dex/standard_dex_file.h"
#include "dex/verification_results.h"
-#include "dex_file-inl.h"
-#include "dex_file_loader.h"
-#include "dex_file_types.h"
#include "dexlayout.h"
#include "driver/compiler_driver-inl.h"
#include "driver/compiler_options.h"
@@ -54,7 +55,6 @@
#include "mirror/class_loader.h"
#include "mirror/dex_cache-inl.h"
#include "mirror/object-inl.h"
-#include "standard_dex_file.h"
#include "oat_quick_method_header.h"
#include "os.h"
#include "safe_map.h"
@@ -188,8 +188,8 @@
OatClassHeader(uint32_t offset,
uint32_t num_non_null_compiled_methods,
uint32_t num_methods,
- mirror::Class::Status status)
- : status_(status),
+ ClassStatus status)
+ : status_(enum_cast<uint16_t>(status)),
offset_(offset) {
// We just arbitrarily say that 0 methods means kOatClassNoneCompiled and that we won't use
// kOatClassAllCompiled unless there is at least one compiled method. This means in an
@@ -210,8 +210,8 @@
}
// Data to write.
- static_assert(mirror::Class::Status::kStatusMax < (1 << 16), "class status won't fit in 16bits");
- int16_t status_;
+ static_assert(enum_cast<>(ClassStatus::kLast) < (1 << 16), "class status won't fit in 16bits");
+ uint16_t status_;
static_assert(OatClassType::kOatClassMax < (1 << 16), "oat_class type won't fit in 16bits");
uint16_t type_;
@@ -931,17 +931,17 @@
bool EndClass() OVERRIDE {
ClassReference class_ref(dex_file_, class_def_index_);
- mirror::Class::Status status;
+ ClassStatus status;
bool found = writer_->compiler_driver_->GetCompiledClass(class_ref, &status);
if (!found) {
VerificationResults* results = writer_->compiler_driver_->GetVerificationResults();
if (results != nullptr && results->IsClassRejected(class_ref)) {
// The oat class status is used only for verification of resolved classes,
- // so use kStatusErrorResolved whether the class was resolved or unresolved
+ // so use ClassStatus::kErrorResolved whether the class was resolved or unresolved
// during compile-time verification.
- status = mirror::Class::kStatusErrorResolved;
+ status = ClassStatus::kErrorResolved;
} else {
- status = mirror::Class::kStatusNotReady;
+ status = ClassStatus::kNotReady;
}
}
diff --git a/dex2oat/linker/oat_writer.h b/dex2oat/linker/oat_writer.h
index 4055878..ba29e3b 100644
--- a/dex2oat/linker/oat_writer.h
+++ b/dex2oat/linker/oat_writer.h
@@ -24,7 +24,7 @@
#include "base/array_ref.h"
#include "base/dchecked_vector.h"
-#include "cdex/compact_dex_level.h"
+#include "dex/compact_dex_level.h"
#include "linker/relative_patcher.h" // For RelativePatcherTargetProvider.
#include "mem_map.h"
#include "method_reference.h"
diff --git a/dex2oat/linker/oat_writer_test.cc b/dex2oat/linker/oat_writer_test.cc
index e9958b1..4888060 100644
--- a/dex2oat/linker/oat_writer_test.cc
+++ b/dex2oat/linker/oat_writer_test.cc
@@ -26,7 +26,7 @@
#include "compiled_method-inl.h"
#include "compiler.h"
#include "debug/method_debug_info.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file_loader.h"
#include "dex/quick_compiler_callbacks.h"
#include "dex/verification_results.h"
#include "driver/compiler_driver.h"
@@ -455,7 +455,7 @@
ScopedNullHandle<mirror::ClassLoader>());
const OatFile::OatClass oat_class = oat_dex_file->GetOatClass(i);
- CHECK_EQ(mirror::Class::Status::kStatusNotReady, oat_class.GetStatus()) << descriptor;
+ CHECK_EQ(ClassStatus::kNotReady, oat_class.GetStatus()) << descriptor;
CHECK_EQ(kCompile ? OatClassType::kOatClassAllCompiled : OatClassType::kOatClassNoneCompiled,
oat_class.GetType()) << descriptor;
diff --git a/dexdump/dexdump.cc b/dexdump/dexdump.cc
index ba2a922..8a06f44 100644
--- a/dexdump/dexdump.cc
+++ b/dexdump/dexdump.cc
@@ -44,12 +44,12 @@
#include "android-base/stringprintf.h"
-#include "code_item_accessors-no_art-inl.h"
-#include "dex_file-inl.h"
-#include "dex_file_loader.h"
-#include "dex_file_types.h"
-#include "dex_file_exception_helpers.h"
-#include "dex_instruction-inl.h"
+#include "dex/code_item_accessors-no_art-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_exception_helpers.h"
+#include "dex/dex_file_loader.h"
+#include "dex/dex_file_types.h"
+#include "dex/dex_instruction-inl.h"
#include "dexdump_cfg.h"
namespace art {
diff --git a/dexdump/dexdump_cfg.cc b/dexdump/dexdump_cfg.cc
index 7e9f113..f08ea74 100644
--- a/dexdump/dexdump_cfg.cc
+++ b/dexdump/dexdump_cfg.cc
@@ -25,10 +25,10 @@
#include <set>
#include <sstream>
-#include "code_item_accessors-no_art-inl.h"
-#include "dex_file-inl.h"
-#include "dex_file_exception_helpers.h"
-#include "dex_instruction-inl.h"
+#include "dex/code_item_accessors-no_art-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_exception_helpers.h"
+#include "dex/dex_instruction-inl.h"
namespace art {
diff --git a/dexlayout/compact_dex_writer.cc b/dexlayout/compact_dex_writer.cc
index f44eaef..1c5b16d 100644
--- a/dexlayout/compact_dex_writer.cc
+++ b/dexlayout/compact_dex_writer.cc
@@ -16,7 +16,7 @@
#include "compact_dex_writer.h"
-#include "cdex/compact_dex_file.h"
+#include "dex/compact_dex_file.h"
namespace art {
diff --git a/dexlayout/dex_ir.cc b/dexlayout/dex_ir.cc
index 157d4ef..8ed3a79 100644
--- a/dexlayout/dex_ir.cc
+++ b/dexlayout/dex_ir.cc
@@ -22,9 +22,9 @@
#include "dex_ir.h"
-#include "code_item_accessors-inl.h"
-#include "dex_file_exception_helpers.h"
-#include "dex_instruction-inl.h"
+#include "dex/code_item_accessors-inl.h"
+#include "dex/dex_file_exception_helpers.h"
+#include "dex/dex_instruction-inl.h"
#include "dex_ir_builder.h"
namespace art {
@@ -669,7 +669,7 @@
}
}
- uint32_t size = DexFile::GetCodeItemSize(disk_code_item);
+ uint32_t size = dex_file.GetCodeItemSize(disk_code_item);
CodeItem* code_item = new CodeItem(
registers_size, ins_size, outs_size, debug_info, insns_size, insns, tries, handler_list);
code_item->SetSize(size);
diff --git a/dexlayout/dex_ir.h b/dexlayout/dex_ir.h
index a54c46f..6797fa5 100644
--- a/dexlayout/dex_ir.h
+++ b/dexlayout/dex_ir.h
@@ -25,8 +25,8 @@
#include <vector>
#include "base/stl_util.h"
-#include "dex_file-inl.h"
-#include "dex_file_types.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_types.h"
#include "leb128.h"
#include "utf.h"
diff --git a/dexlayout/dex_writer.cc b/dexlayout/dex_writer.cc
index 41fdcbd..a18a2cf 100644
--- a/dexlayout/dex_writer.cc
+++ b/dexlayout/dex_writer.cc
@@ -20,12 +20,12 @@
#include <vector>
-#include "cdex/compact_dex_file.h"
#include "compact_dex_writer.h"
-#include "dex_file_layout.h"
-#include "dex_file_types.h"
+#include "dex/compact_dex_file.h"
+#include "dex/dex_file_layout.h"
+#include "dex/dex_file_types.h"
+#include "dex/standard_dex_file.h"
#include "dexlayout.h"
-#include "standard_dex_file.h"
#include "utf.h"
namespace art {
diff --git a/dexlayout/dex_writer.h b/dexlayout/dex_writer.h
index 3929526..92a002e 100644
--- a/dexlayout/dex_writer.h
+++ b/dexlayout/dex_writer.h
@@ -22,7 +22,7 @@
#include <functional>
#include "base/unix_file/fd_file.h"
-#include "cdex/compact_dex_level.h"
+#include "dex/compact_dex_level.h"
#include "dex_ir.h"
#include "mem_map.h"
#include "os.h"
diff --git a/dexlayout/dexdiag.cc b/dexlayout/dexdiag.cc
index b250701..99b1f38 100644
--- a/dexlayout/dexdiag.cc
+++ b/dexlayout/dexdiag.cc
@@ -29,7 +29,7 @@
#include "base/logging.h" // For InitLogging.
#include "base/stringpiece.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "dex_ir.h"
#include "dex_ir_builder.h"
#ifdef ART_TARGET_ANDROID
diff --git a/dexlayout/dexlayout.cc b/dexlayout/dexlayout.cc
index f87778a..47a3e94 100644
--- a/dexlayout/dexlayout.cc
+++ b/dexlayout/dexlayout.cc
@@ -34,12 +34,12 @@
#include "android-base/stringprintf.h"
#include "base/logging.h" // For VLOG_IS_ON.
-#include "dex_file-inl.h"
-#include "dex_file_layout.h"
-#include "dex_file_loader.h"
-#include "dex_file_types.h"
-#include "dex_file_verifier.h"
-#include "dex_instruction-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_layout.h"
+#include "dex/dex_file_loader.h"
+#include "dex/dex_file_types.h"
+#include "dex/dex_file_verifier.h"
+#include "dex/dex_instruction-inl.h"
#include "dex_ir_builder.h"
#include "dex_verify.h"
#include "dex_visualize.h"
diff --git a/dexlayout/dexlayout.h b/dexlayout/dexlayout.h
index 958251e..25afb77 100644
--- a/dexlayout/dexlayout.h
+++ b/dexlayout/dexlayout.h
@@ -27,8 +27,8 @@
#include <stdio.h>
#include <unordered_map>
-#include "cdex/compact_dex_level.h"
-#include "dex_file_layout.h"
+#include "dex/compact_dex_level.h"
+#include "dex/dex_file_layout.h"
#include "dex_ir.h"
#include "mem_map.h"
diff --git a/dexlayout/dexlayout_test.cc b/dexlayout/dexlayout_test.cc
index 360f234..b8cff6d 100644
--- a/dexlayout/dexlayout_test.cc
+++ b/dexlayout/dexlayout_test.cc
@@ -22,10 +22,10 @@
#include <unistd.h>
#include "base/unix_file/fd_file.h"
-#include "code_item_accessors-inl.h"
#include "common_runtime_test.h"
-#include "dex_file-inl.h"
-#include "dex_file_loader.h"
+#include "dex/code_item_accessors-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_loader.h"
#include "exec_utils.h"
#include "jit/profile_compilation_info.h"
#include "utils.h"
diff --git a/dexlist/dexlist.cc b/dexlist/dexlist.cc
index 2c910d4..348f501 100644
--- a/dexlist/dexlist.cc
+++ b/dexlist/dexlist.cc
@@ -27,9 +27,9 @@
#include <stdlib.h>
#include "base/logging.h" // For InitLogging.
-#include "code_item_accessors-no_art-inl.h"
-#include "dex_file-inl.h"
-#include "dex_file_loader.h"
+#include "dex/code_item_accessors-no_art-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_loader.h"
#include "mem_map.h"
#include "runtime.h"
diff --git a/dexoptanalyzer/dexoptanalyzer.cc b/dexoptanalyzer/dexoptanalyzer.cc
index eead2dc..bedc457 100644
--- a/dexoptanalyzer/dexoptanalyzer.cc
+++ b/dexoptanalyzer/dexoptanalyzer.cc
@@ -23,7 +23,7 @@
#include "base/logging.h" // For InitLogging.
#include "compiler_filter.h"
#include "class_loader_context.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "noop_compiler_callbacks.h"
#include "oat_file_assistant.h"
#include "os.h"
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index a97dd2a..6a99c5a 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -37,12 +37,12 @@
#include "base/unix_file/fd_file.h"
#include "class_linker-inl.h"
#include "class_linker.h"
-#include "code_item_accessors-inl.h"
#include "compiled_method.h"
#include "debug/elf_debug_writer.h"
#include "debug/method_debug_info.h"
-#include "dex_file-inl.h"
-#include "dex_instruction-inl.h"
+#include "dex/code_item_accessors-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_instruction-inl.h"
#include "disassembler.h"
#include "gc/accounting/space_bitmap-inl.h"
#include "gc/space/image_space.h"
diff --git a/openjdkjvm/OpenjdkJvm.cc b/openjdkjvm/OpenjdkJvm.cc
index ff839f5..3c87fe2 100644
--- a/openjdkjvm/OpenjdkJvm.cc
+++ b/openjdkjvm/OpenjdkJvm.cc
@@ -322,8 +322,7 @@
JNIEXPORT jstring JVM_NativeLoad(JNIEnv* env,
jstring javaFilename,
- jobject javaLoader,
- jstring javaLibrarySearchPath) {
+ jobject javaLoader) {
ScopedUtfChars filename(env, javaFilename);
if (filename.c_str() == NULL) {
return NULL;
@@ -335,7 +334,6 @@
bool success = vm->LoadNativeLibrary(env,
filename.c_str(),
javaLoader,
- javaLibrarySearchPath,
&error_msg);
if (success) {
return nullptr;
diff --git a/openjdkjvmti/deopt_manager.cc b/openjdkjvmti/deopt_manager.cc
index f843054..aced769 100644
--- a/openjdkjvmti/deopt_manager.cc
+++ b/openjdkjvmti/deopt_manager.cc
@@ -37,7 +37,7 @@
#include "art_method-inl.h"
#include "base/enums.h"
#include "base/mutex-inl.h"
-#include "dex_file_annotations.h"
+#include "dex/dex_file_annotations.h"
#include "events-inl.h"
#include "jni_internal.h"
#include "mirror/class-inl.h"
diff --git a/openjdkjvmti/events.cc b/openjdkjvmti/events.cc
index 330a3de..d98fda5 100644
--- a/openjdkjvmti/events.cc
+++ b/openjdkjvmti/events.cc
@@ -37,7 +37,7 @@
#include "art_jvmti.h"
#include "art_method-inl.h"
#include "deopt_manager.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "gc/allocation_listener.h"
#include "gc/gc_pause_listener.h"
#include "gc/heap.h"
diff --git a/openjdkjvmti/fixed_up_dex_file.cc b/openjdkjvmti/fixed_up_dex_file.cc
index 64dc3a5..ad928d9 100644
--- a/openjdkjvmti/fixed_up_dex_file.cc
+++ b/openjdkjvmti/fixed_up_dex_file.cc
@@ -30,8 +30,8 @@
*/
#include "fixed_up_dex_file.h"
-#include "dex_file_loader.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_loader.h"
// Runtime includes.
#include "dex_to_dex_decompiler.h"
diff --git a/openjdkjvmti/fixed_up_dex_file.h b/openjdkjvmti/fixed_up_dex_file.h
index 4cb39cf..b8f349c 100644
--- a/openjdkjvmti/fixed_up_dex_file.h
+++ b/openjdkjvmti/fixed_up_dex_file.h
@@ -39,7 +39,7 @@
#include "jvmti.h"
#include "base/mutex.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
namespace openjdkjvmti {
diff --git a/openjdkjvmti/ti_breakpoint.cc b/openjdkjvmti/ti_breakpoint.cc
index 7634fa3..fa7a344 100644
--- a/openjdkjvmti/ti_breakpoint.cc
+++ b/openjdkjvmti/ti_breakpoint.cc
@@ -38,7 +38,7 @@
#include "base/enums.h"
#include "base/mutex-inl.h"
#include "deopt_manager.h"
-#include "dex_file_annotations.h"
+#include "dex/dex_file_annotations.h"
#include "events-inl.h"
#include "jni_internal.h"
#include "mirror/class-inl.h"
diff --git a/openjdkjvmti/ti_class.cc b/openjdkjvmti/ti_class.cc
index 60ab0a5..f9eb008 100644
--- a/openjdkjvmti/ti_class.cc
+++ b/openjdkjvmti/ti_class.cc
@@ -42,8 +42,8 @@
#include "class_linker.h"
#include "class_table-inl.h"
#include "common_throws.h"
-#include "dex_file_annotations.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file_annotations.h"
+#include "dex/dex_file_loader.h"
#include "events-inl.h"
#include "fixed_up_dex_file.h"
#include "gc/heap-visit-objects-inl.h"
diff --git a/openjdkjvmti/ti_class_definition.cc b/openjdkjvmti/ti_class_definition.cc
index c73ef0d..6560570 100644
--- a/openjdkjvmti/ti_class_definition.cc
+++ b/openjdkjvmti/ti_class_definition.cc
@@ -33,7 +33,7 @@
#include "base/array_slice.h"
#include "class_linker-inl.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "fixed_up_dex_file.h"
#include "handle.h"
#include "handle_scope-inl.h"
diff --git a/openjdkjvmti/ti_class_loader.cc b/openjdkjvmti/ti_class_loader.cc
index 701ba80..d594d6e 100644
--- a/openjdkjvmti/ti_class_loader.cc
+++ b/openjdkjvmti/ti_class_loader.cc
@@ -38,8 +38,8 @@
#include "art_field-inl.h"
#include "art_jvmti.h"
-#include "dex_file.h"
-#include "dex_file_types.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_types.h"
#include "events-inl.h"
#include "gc/allocation_listener.h"
#include "gc/heap.h"
diff --git a/openjdkjvmti/ti_class_loader.h b/openjdkjvmti/ti_class_loader.h
index 767e258..27ea3f5 100644
--- a/openjdkjvmti/ti_class_loader.h
+++ b/openjdkjvmti/ti_class_loader.h
@@ -40,7 +40,7 @@
#include "art_method.h"
#include "base/array_slice.h"
#include "class_linker.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "gc_root-inl.h"
#include "globals.h"
#include "jni_env_ext-inl.h"
diff --git a/openjdkjvmti/ti_field.cc b/openjdkjvmti/ti_field.cc
index b869183..db5c31c 100644
--- a/openjdkjvmti/ti_field.cc
+++ b/openjdkjvmti/ti_field.cc
@@ -34,7 +34,7 @@
#include "art_field-inl.h"
#include "art_jvmti.h"
#include "base/enums.h"
-#include "dex_file_annotations.h"
+#include "dex/dex_file_annotations.h"
#include "jni_internal.h"
#include "mirror/object_array-inl.h"
#include "modifiers.h"
diff --git a/openjdkjvmti/ti_method.cc b/openjdkjvmti/ti_method.cc
index 947ba79..57fb699 100644
--- a/openjdkjvmti/ti_method.cc
+++ b/openjdkjvmti/ti_method.cc
@@ -37,9 +37,9 @@
#include "art_method-inl.h"
#include "base/enums.h"
#include "base/mutex-inl.h"
-#include "code_item_accessors-inl.h"
-#include "dex_file_annotations.h"
-#include "dex_file_types.h"
+#include "dex/code_item_accessors-inl.h"
+#include "dex/dex_file_annotations.h"
+#include "dex/dex_file_types.h"
#include "events-inl.h"
#include "jit/jit.h"
#include "jni_internal.h"
diff --git a/openjdkjvmti/ti_redefine.cc b/openjdkjvmti/ti_redefine.cc
index c18b354..6194d1e 100644
--- a/openjdkjvmti/ti_redefine.cc
+++ b/openjdkjvmti/ti_redefine.cc
@@ -43,9 +43,9 @@
#include "base/stringpiece.h"
#include "class_linker-inl.h"
#include "debugger.h"
-#include "dex_file.h"
-#include "dex_file_loader.h"
-#include "dex_file_types.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_loader.h"
+#include "dex/dex_file_types.h"
#include "events-inl.h"
#include "gc/allocation_listener.h"
#include "gc/heap.h"
diff --git a/openjdkjvmti/ti_redefine.h b/openjdkjvmti/ti_redefine.h
index 528563b..b537e1b 100644
--- a/openjdkjvmti/ti_redefine.h
+++ b/openjdkjvmti/ti_redefine.h
@@ -40,7 +40,7 @@
#include "art_method.h"
#include "base/array_ref.h"
#include "class_linker.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "gc_root-inl.h"
#include "globals.h"
#include "jni_env_ext-inl.h"
diff --git a/openjdkjvmti/ti_search.cc b/openjdkjvmti/ti_search.cc
index fe12a25..9d5f4ea 100644
--- a/openjdkjvmti/ti_search.cc
+++ b/openjdkjvmti/ti_search.cc
@@ -38,8 +38,8 @@
#include "base/enums.h"
#include "base/macros.h"
#include "class_linker.h"
-#include "dex_file.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_loader.h"
#include "jni_internal.h"
#include "mirror/class-inl.h"
#include "mirror/object.h"
diff --git a/openjdkjvmti/ti_stack.cc b/openjdkjvmti/ti_stack.cc
index f7e3b51..bc77753 100644
--- a/openjdkjvmti/ti_stack.cc
+++ b/openjdkjvmti/ti_stack.cc
@@ -44,10 +44,10 @@
#include "base/bit_utils.h"
#include "base/enums.h"
#include "base/mutex.h"
-#include "code_item_accessors-inl.h"
-#include "dex_file.h"
-#include "dex_file_annotations.h"
-#include "dex_file_types.h"
+#include "dex/code_item_accessors-inl.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_annotations.h"
+#include "dex/dex_file_types.h"
#include "gc_root.h"
#include "handle_scope-inl.h"
#include "jni_env_ext.h"
diff --git a/openjdkjvmti/transform.cc b/openjdkjvmti/transform.cc
index 1d7f137..3a5fccc 100644
--- a/openjdkjvmti/transform.cc
+++ b/openjdkjvmti/transform.cc
@@ -37,8 +37,8 @@
#include "art_method.h"
#include "base/array_ref.h"
#include "class_linker.h"
-#include "dex_file.h"
-#include "dex_file_types.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_types.h"
#include "events-inl.h"
#include "gc_root-inl.h"
#include "globals.h"
diff --git a/profman/boot_image_profile.cc b/profman/boot_image_profile.cc
index 48b87c9..a750105 100644
--- a/profman/boot_image_profile.cc
+++ b/profman/boot_image_profile.cc
@@ -18,7 +18,7 @@
#include <set>
#include "boot_image_profile.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "method_reference.h"
#include "type_reference.h"
diff --git a/profman/boot_image_profile.h b/profman/boot_image_profile.h
index d02e408c..eb43b7c 100644
--- a/profman/boot_image_profile.h
+++ b/profman/boot_image_profile.h
@@ -21,7 +21,7 @@
#include <memory>
#include <vector>
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "jit/profile_compilation_info.h"
namespace art {
diff --git a/profman/profman.cc b/profman/profman.cc
index 10b9f64..71f7f9d 100644
--- a/profman/profman.cc
+++ b/profman/profman.cc
@@ -39,10 +39,10 @@
#include "base/unix_file/fd_file.h"
#include "boot_image_profile.h"
#include "bytecode_utils.h"
-#include "code_item_accessors-inl.h"
-#include "dex_file.h"
-#include "dex_file_loader.h"
-#include "dex_file_types.h"
+#include "dex/code_item_accessors-inl.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_loader.h"
+#include "dex/dex_file_types.h"
#include "jit/profile_compilation_info.h"
#include "profile_assistant.h"
#include "runtime.h"
diff --git a/runtime/Android.bp b/runtime/Android.bp
index 8fe901d..2657f4f 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -48,7 +48,6 @@
"base/timing_logger.cc",
"base/unix_file/fd_file.cc",
"base/unix_file/random_access_file_utils.cc",
- "cdex/compact_dex_file.cc",
"cha.cc",
"check_jni.cc",
"class_linker.cc",
@@ -57,14 +56,16 @@
"common_throws.cc",
"compiler_filter.cc",
"debugger.cc",
- "dex_file.cc",
- "dex_file_annotations.cc",
- "dex_file_exception_helpers.cc",
- "dex_file_loader.cc",
- "dex_file_layout.cc",
- "dex_file_tracking_registrar.cc",
- "dex_file_verifier.cc",
- "dex_instruction.cc",
+ "dex/compact_dex_file.cc",
+ "dex/dex_file.cc",
+ "dex/dex_file_annotations.cc",
+ "dex/dex_file_exception_helpers.cc",
+ "dex/dex_file_layout.cc",
+ "dex/dex_file_loader.cc",
+ "dex/dex_file_tracking_registrar.cc",
+ "dex/dex_file_verifier.cc",
+ "dex/dex_instruction.cc",
+ "dex/standard_dex_file.cc",
"dex_to_dex_decompiler.cc",
"elf_file.cc",
"exec_utils.cc",
@@ -214,7 +215,6 @@
"signal_catcher.cc",
"stack.cc",
"stack_map.cc",
- "standard_dex_file.cc",
"thread.cc",
"thread_list.cc",
"thread_pool.cc",
@@ -454,10 +454,10 @@
"debugger.h",
"base/unix_file/fd_file.h",
"class_status.h",
- "dex_file.h",
- "dex_file_layout.h",
- "dex_instruction.h",
- "dex_instruction_utils.h",
+ "dex/dex_file.h",
+ "dex/dex_file_layout.h",
+ "dex/dex_instruction.h",
+ "dex/dex_instruction_utils.h",
"gc_root.h",
"gc/allocator_type.h",
"gc/allocator/rosalloc.h",
@@ -566,16 +566,16 @@
"base/transform_iterator_test.cc",
"base/variant_map_test.cc",
"base/unix_file/fd_file_test.cc",
- "cdex/compact_dex_file_test.cc",
"cha_test.cc",
"class_linker_test.cc",
"class_loader_context_test.cc",
"class_table_test.cc",
- "code_item_accessors_test.cc",
"compiler_filter_test.cc",
- "dex_file_test.cc",
- "dex_file_verifier_test.cc",
- "dex_instruction_test.cc",
+ "dex/code_item_accessors_test.cc",
+ "dex/compact_dex_file_test.cc",
+ "dex/dex_file_test.cc",
+ "dex/dex_file_verifier_test.cc",
+ "dex/dex_instruction_test.cc",
"entrypoints/math_entrypoints_test.cc",
"entrypoints/quick/quick_trampoline_entrypoints_test.cc",
"entrypoints_order_test.cc",
diff --git a/runtime/aot_class_linker.cc b/runtime/aot_class_linker.cc
index a62cbec..93e02ef 100644
--- a/runtime/aot_class_linker.cc
+++ b/runtime/aot_class_linker.cc
@@ -44,7 +44,7 @@
// Don't initialize klass if it's superclass is not initialized, because superclass might abort
// the transaction and rolled back after klass's change is commited.
if (strict_mode_ && !klass->IsInterface() && klass->HasSuperClass()) {
- if (klass->GetSuperClass()->GetStatus() == mirror::Class::kStatusInitializing) {
+ if (klass->GetSuperClass()->GetStatus() == ClassStatus::kInitializing) {
runtime->AbortTransactionAndThrowAbortError(self, "Can't resolve "
+ klass->PrettyTypeOf() + " because it's superclass is not initialized.");
return false;
@@ -79,11 +79,11 @@
ClassStatus old_status = callbacks->GetPreviousClassState(
ClassReference(&klass->GetDexFile(), klass->GetDexClassDefIndex()));
// Was it verified? Report no failure.
- if (old_status >= ClassStatus::kStatusVerified) {
+ if (old_status >= ClassStatus::kVerified) {
return verifier::FailureKind::kNoFailure;
}
// Does it need to be verified at runtime? Report soft failure.
- if (old_status >= ClassStatus::kStatusRetryVerificationAtRuntime) {
+ if (old_status >= ClassStatus::kRetryVerificationAtRuntime) {
// Error messages from here are only reported through -verbose:class. It is not worth it to
// create a message.
return verifier::FailureKind::kSoftFailure;
diff --git a/runtime/arch/arm/quick_entrypoints_arm.S b/runtime/arch/arm/quick_entrypoints_arm.S
index 6ec9c48..c09baea 100644
--- a/runtime/arch/arm/quick_entrypoints_arm.S
+++ b/runtime/arch/arm/quick_entrypoints_arm.S
@@ -1026,8 +1026,8 @@
ONE_ARG_SAVE_EVERYTHING_DOWNCALL art_quick_initialize_type_and_verify_access, artInitializeTypeAndVerifyAccessFromCode
ONE_ARG_SAVE_EVERYTHING_DOWNCALL art_quick_resolve_string, artResolveStringFromCode
-// Note: Functions `art{Get,Set}<Kind>{Static,Instance>FromCompiledCode` are
-// defined by macros in runtime/entrypoints/quick/quick_field_entrypoints.cc.
+// Note: Functions `art{Get,Set}<Kind>{Static,Instance}FromCompiledCode` are
+// defined with a macro in runtime/entrypoints/quick/quick_field_entrypoints.cc.
/*
* Called by managed code to resolve a static field and load a non-wide value.
diff --git a/runtime/arch/arm64/quick_entrypoints_arm64.S b/runtime/arch/arm64/quick_entrypoints_arm64.S
index 47efeb9..96a1cad 100644
--- a/runtime/arch/arm64/quick_entrypoints_arm64.S
+++ b/runtime/arch/arm64/quick_entrypoints_arm64.S
@@ -1638,8 +1638,8 @@
ONE_ARG_SAVE_EVERYTHING_DOWNCALL art_quick_initialize_type_and_verify_access, artInitializeTypeAndVerifyAccessFromCode
ONE_ARG_SAVE_EVERYTHING_DOWNCALL art_quick_resolve_string, artResolveStringFromCode
-// Note: Functions `art{Get,Set}<Kind>{Static,Instance>FromCompiledCode` are
-// defined by macros in runtime/entrypoints/quick/quick_field_entrypoints.cc.
+// Note: Functions `art{Get,Set}<Kind>{Static,Instance}FromCompiledCode` are
+// defined with a macro in runtime/entrypoints/quick/quick_field_entrypoints.cc.
ONE_ARG_REF_DOWNCALL art_quick_get_boolean_static, artGetBooleanStaticFromCompiledCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1
ONE_ARG_REF_DOWNCALL art_quick_get_byte_static, artGetByteStaticFromCompiledCode, RETURN_OR_DELIVER_PENDING_EXCEPTION_X1
diff --git a/runtime/arch/mips/quick_entrypoints_mips.S b/runtime/arch/mips/quick_entrypoints_mips.S
index fc77a64..b2f7e10 100644
--- a/runtime/arch/mips/quick_entrypoints_mips.S
+++ b/runtime/arch/mips/quick_entrypoints_mips.S
@@ -1637,6 +1637,9 @@
/*
* Called by managed code to resolve a static/instance field and load/store a value.
+ *
+ * Note: Functions `art{Get,Set}<Kind>{Static,Instance}FromCompiledCode` are
+ * defined with a macro in runtime/entrypoints/quick/quick_field_entrypoints.cc.
*/
ONE_ARG_REF_DOWNCALL art_quick_get_byte_static, artGetByteStaticFromCompiledCode, RETURN_IF_NO_EXCEPTION
ONE_ARG_REF_DOWNCALL art_quick_get_boolean_static, artGetBooleanStaticFromCompiledCode, RETURN_IF_NO_EXCEPTION
diff --git a/runtime/arch/mips64/quick_entrypoints_mips64.S b/runtime/arch/mips64/quick_entrypoints_mips64.S
index 3fb83d9..63f4f6c 100644
--- a/runtime/arch/mips64/quick_entrypoints_mips64.S
+++ b/runtime/arch/mips64/quick_entrypoints_mips64.S
@@ -1565,6 +1565,9 @@
/*
* Called by managed code to resolve a static/instance field and load/store a value.
+ *
+ * Note: Functions `art{Get,Set}<Kind>{Static,Instance}FromCompiledCode` are
+ * defined with a macro in runtime/entrypoints/quick/quick_field_entrypoints.cc.
*/
ONE_ARG_REF_DOWNCALL art_quick_get_byte_static, artGetByteStaticFromCompiledCode, RETURN_IF_NO_EXCEPTION
ONE_ARG_REF_DOWNCALL art_quick_get_boolean_static, artGetBooleanStaticFromCompiledCode, RETURN_IF_NO_EXCEPTION
diff --git a/runtime/arch/x86/quick_entrypoints_x86.S b/runtime/arch/x86/quick_entrypoints_x86.S
index a46ceeb..93cb665 100644
--- a/runtime/arch/x86/quick_entrypoints_x86.S
+++ b/runtime/arch/x86/quick_entrypoints_x86.S
@@ -1709,6 +1709,9 @@
ret
END_FUNCTION art_quick_lushr
+// Note: Functions `art{Get,Set}<Kind>{Static,Instance}FromCompiledCode` are
+// defined with a macro in runtime/entrypoints/quick/quick_field_entrypoints.cc.
+
ONE_ARG_REF_DOWNCALL art_quick_get_boolean_static, artGetBooleanStaticFromCompiledCode, RETURN_OR_DELIVER_PENDING_EXCEPTION
ONE_ARG_REF_DOWNCALL art_quick_get_byte_static, artGetByteStaticFromCompiledCode, RETURN_OR_DELIVER_PENDING_EXCEPTION
ONE_ARG_REF_DOWNCALL art_quick_get_char_static, artGetCharStaticFromCompiledCode, RETURN_OR_DELIVER_PENDING_EXCEPTION
diff --git a/runtime/arch/x86_64/quick_entrypoints_x86_64.S b/runtime/arch/x86_64/quick_entrypoints_x86_64.S
index 463e5a2..85f9723 100644
--- a/runtime/arch/x86_64/quick_entrypoints_x86_64.S
+++ b/runtime/arch/x86_64/quick_entrypoints_x86_64.S
@@ -1594,6 +1594,9 @@
UNIMPLEMENTED art_quick_lshr
UNIMPLEMENTED art_quick_lushr
+// Note: Functions `art{Get,Set}<Kind>{Static,Instance}FromCompiledCode` are
+// defined with a macro in runtime/entrypoints/quick/quick_field_entrypoints.cc.
+
THREE_ARG_REF_DOWNCALL art_quick_set8_instance, artSet8InstanceFromCompiledCode, RETURN_IF_EAX_ZERO
THREE_ARG_REF_DOWNCALL art_quick_set16_instance, artSet16InstanceFromCompiledCode, RETURN_IF_EAX_ZERO
THREE_ARG_REF_DOWNCALL art_quick_set32_instance, artSet32InstanceFromCompiledCode, RETURN_IF_EAX_ZERO
diff --git a/runtime/art_field-inl.h b/runtime/art_field-inl.h
index 2b18577..99634a0 100644
--- a/runtime/art_field-inl.h
+++ b/runtime/art_field-inl.h
@@ -22,7 +22,7 @@
#include <android-base/logging.h>
#include "class_linker.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "gc/accounting/card_table-inl.h"
#include "gc_root-inl.h"
#include "jvalue.h"
diff --git a/runtime/art_field.h b/runtime/art_field.h
index 8d2f9ff..46b013d 100644
--- a/runtime/art_field.h
+++ b/runtime/art_field.h
@@ -19,7 +19,7 @@
#include <jni.h>
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "gc_root.h"
#include "modifiers.h"
#include "obj_ptr.h"
diff --git a/runtime/art_method-inl.h b/runtime/art_method-inl.h
index fc7920f..bdebe2d 100644
--- a/runtime/art_method-inl.h
+++ b/runtime/art_method-inl.h
@@ -22,11 +22,11 @@
#include "art_field.h"
#include "base/callee_save_type.h"
#include "class_linker-inl.h"
-#include "code_item_accessors-inl.h"
#include "common_throws.h"
-#include "dex_file-inl.h"
-#include "dex_file_annotations.h"
-#include "dex_file_types.h"
+#include "dex/code_item_accessors-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_annotations.h"
+#include "dex/dex_file_types.h"
#include "gc_root-inl.h"
#include "invoke_type.h"
#include "jit/profiling_info.h"
diff --git a/runtime/art_method.cc b/runtime/art_method.cc
index d6e4ce5..44a5dde 100644
--- a/runtime/art_method.cc
+++ b/runtime/art_method.cc
@@ -25,9 +25,9 @@
#include "base/stringpiece.h"
#include "class_linker-inl.h"
#include "debugger.h"
-#include "dex_file-inl.h"
-#include "dex_file_exception_helpers.h"
-#include "dex_instruction.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_exception_helpers.h"
+#include "dex/dex_instruction.h"
#include "entrypoints/runtime_asm_entrypoints.h"
#include "gc/accounting/card_table-inl.h"
#include "interpreter/interpreter.h"
diff --git a/runtime/art_method.h b/runtime/art_method.h
index ab90a10..c4a586e 100644
--- a/runtime/art_method.h
+++ b/runtime/art_method.h
@@ -27,9 +27,9 @@
#include "base/iteration_range.h"
#include "base/macros.h"
#include "base/runtime_debug.h"
-#include "code_item_accessors.h"
-#include "dex_file.h"
-#include "dex_instruction_iterator.h"
+#include "dex/code_item_accessors.h"
+#include "dex/dex_file.h"
+#include "dex/dex_instruction_iterator.h"
#include "gc_root.h"
#include "modifiers.h"
#include "obj_ptr.h"
diff --git a/runtime/base/casts.h b/runtime/base/casts.h
index ac1a10c..3c6b2be 100644
--- a/runtime/base/casts.h
+++ b/runtime/base/casts.h
@@ -26,6 +26,8 @@
#include <android-base/logging.h>
+#include "stl_util_identity.h"
+
namespace art {
// Use implicit_cast as a safe version of static_cast or const_cast
@@ -97,7 +99,7 @@
// A version of static_cast that DCHECKs that the value can be precisely represented
// when converting to Dest.
template <typename Dest, typename Source>
-inline Dest dchecked_integral_cast(const Source source) {
+constexpr Dest dchecked_integral_cast(Source source) {
DCHECK(
// Check that the value is within the lower limit of Dest.
(static_cast<intmax_t>(std::numeric_limits<Dest>::min()) <=
@@ -113,6 +115,33 @@
return static_cast<Dest>(source);
}
+// A version of dchecked_integral_cast casting between an integral type and an enum type.
+// When casting to an enum type, the cast does not check if the value corresponds to an enumerator.
+// When casting from an enum type, the target type can be omitted and the enum's underlying type
+// shall be used.
+
+template <typename Dest, typename Source>
+constexpr
+typename std::enable_if<!std::is_enum<Source>::value, Dest>::type
+enum_cast(Source value) {
+ return static_cast<Dest>(
+ dchecked_integral_cast<typename std::underlying_type<Dest>::type>(value));
+}
+
+template <typename Dest = void, typename Source>
+constexpr
+typename std::enable_if<std::is_enum<Source>::value,
+ typename std::conditional<std::is_same<Dest, void>::value,
+ std::underlying_type<Source>,
+ Identity<Dest>>::type>::type::type
+enum_cast(Source value) {
+ using return_type = typename std::conditional<std::is_same<Dest, void>::value,
+ std::underlying_type<Source>,
+ Identity<Dest>>::type::type;
+ return dchecked_integral_cast<return_type>(
+ static_cast<typename std::underlying_type<Source>::type>(value));
+}
+
// A version of reinterpret_cast<>() between pointers and int64_t/uint64_t
// that goes through uintptr_t to avoid treating the pointer as "signed."
diff --git a/runtime/base/file_magic.cc b/runtime/base/file_magic.cc
index ac2e184..e668699 100644
--- a/runtime/base/file_magic.cc
+++ b/runtime/base/file_magic.cc
@@ -24,7 +24,7 @@
#include <android-base/stringprintf.h>
#include "base/unix_file/fd_file.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
namespace art {
diff --git a/runtime/base/file_utils.cc b/runtime/base/file_utils.cc
index db49860..63b4ac5 100644
--- a/runtime/base/file_utils.cc
+++ b/runtime/base/file_utils.cc
@@ -47,9 +47,9 @@
#include "base/stl_util.h"
#include "base/unix_file/fd_file.h"
-#include "dex_file-inl.h"
-#include "dex_file_loader.h"
-#include "dex_instruction.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_loader.h"
+#include "dex/dex_instruction.h"
#include "oat_quick_method_header.h"
#include "os.h"
#include "scoped_thread_state_change-inl.h"
diff --git a/runtime/bytecode_utils.h b/runtime/bytecode_utils.h
index 815e0ba..a7e0abf 100644
--- a/runtime/bytecode_utils.h
+++ b/runtime/bytecode_utils.h
@@ -18,9 +18,9 @@
#define ART_RUNTIME_BYTECODE_UTILS_H_
#include "base/arena_object.h"
-#include "dex_file-inl.h"
-#include "dex_file.h"
-#include "dex_instruction-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file.h"
+#include "dex/dex_instruction-inl.h"
namespace art {
diff --git a/runtime/cdex/compact_dex_file.cc b/runtime/cdex/compact_dex_file.cc
deleted file mode 100644
index a92ab28..0000000
--- a/runtime/cdex/compact_dex_file.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2017 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 "compact_dex_file.h"
-
-namespace art {
-
-constexpr uint8_t CompactDexFile::kDexMagic[kDexMagicSize];
-constexpr uint8_t CompactDexFile::kDexMagicVersion[];
-
-void CompactDexFile::WriteMagic(uint8_t* magic) {
- std::copy_n(kDexMagic, kDexMagicSize, magic);
-}
-
-void CompactDexFile::WriteCurrentVersion(uint8_t* magic) {
- std::copy_n(kDexMagicVersion, kDexVersionLen, magic + kDexMagicSize);
-}
-
-bool CompactDexFile::IsMagicValid(const uint8_t* magic) {
- return (memcmp(magic, kDexMagic, sizeof(kDexMagic)) == 0);
-}
-
-bool CompactDexFile::IsVersionValid(const uint8_t* magic) {
- const uint8_t* version = &magic[sizeof(kDexMagic)];
- return memcmp(version, kDexMagicVersion, kDexVersionLen) == 0;
-}
-
-bool CompactDexFile::IsMagicValid() const {
- return IsMagicValid(header_->magic_);
-}
-
-bool CompactDexFile::IsVersionValid() const {
- return IsVersionValid(header_->magic_);
-}
-
-bool CompactDexFile::SupportsDefaultMethods() const {
- return (GetHeader().GetFeatureFlags() &
- static_cast<uint32_t>(FeatureFlags::kDefaultMethods)) != 0;
-}
-
-} // namespace art
diff --git a/runtime/check_jni.cc b/runtime/check_jni.cc
index ce4cee8..5549122 100644
--- a/runtime/check_jni.cc
+++ b/runtime/check_jni.cc
@@ -31,7 +31,7 @@
#include "base/time_utils.h"
#include "class_linker-inl.h"
#include "class_linker.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "gc/space/space.h"
#include "java_vm_ext.h"
#include "jni_internal.h"
diff --git a/runtime/check_reference_map_visitor.h b/runtime/check_reference_map_visitor.h
index c4a613a..0c29e25 100644
--- a/runtime/check_reference_map_visitor.h
+++ b/runtime/check_reference_map_visitor.h
@@ -18,8 +18,8 @@
#define ART_RUNTIME_CHECK_REFERENCE_MAP_VISITOR_H_
#include "art_method-inl.h"
-#include "code_item_accessors-inl.h"
-#include "dex_file_types.h"
+#include "dex/code_item_accessors-inl.h"
+#include "dex/dex_file_types.h"
#include "oat_quick_method_header.h"
#include "scoped_thread_state_change-inl.h"
#include "stack.h"
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 727dd14..8776542 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -50,9 +50,9 @@
#include "class_table-inl.h"
#include "compiler_callbacks.h"
#include "debugger.h"
-#include "dex_file-inl.h"
-#include "dex_file_exception_helpers.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_exception_helpers.h"
+#include "dex/dex_file_loader.h"
#include "entrypoints/entrypoint_utils.h"
#include "entrypoints/runtime_asm_entrypoints.h"
#include "experimental_flags.h"
@@ -445,7 +445,7 @@
CHECK(java_lang_Object != nullptr);
// backfill Object as the super class of Class.
java_lang_Class->SetSuperClass(java_lang_Object.Get());
- mirror::Class::SetStatus(java_lang_Object, mirror::Class::kStatusLoaded, self);
+ mirror::Class::SetStatus(java_lang_Object, ClassStatus::kLoaded, self);
java_lang_Object->SetObjectSize(sizeof(mirror::Object));
// Allocate in non-movable so that it's possible to check if a JNI weak global ref has been
@@ -494,14 +494,14 @@
AllocClass(self, java_lang_Class.Get(), mirror::String::ClassSize(image_pointer_size_))));
java_lang_String->SetStringClass();
mirror::String::SetClass(java_lang_String.Get());
- mirror::Class::SetStatus(java_lang_String, mirror::Class::kStatusResolved, self);
+ mirror::Class::SetStatus(java_lang_String, ClassStatus::kResolved, self);
// Setup java.lang.ref.Reference.
Handle<mirror::Class> java_lang_ref_Reference(hs.NewHandle(
AllocClass(self, java_lang_Class.Get(), mirror::Reference::ClassSize(image_pointer_size_))));
mirror::Reference::SetClass(java_lang_ref_Reference.Get());
java_lang_ref_Reference->SetObjectSize(mirror::Reference::InstanceSize());
- mirror::Class::SetStatus(java_lang_ref_Reference, mirror::Class::kStatusResolved, self);
+ mirror::Class::SetStatus(java_lang_ref_Reference, ClassStatus::kResolved, self);
// Create storage for root classes, save away our work so far (requires descriptors).
class_roots_ = GcRoot<mirror::ObjectArray<mirror::Class>>(
@@ -554,7 +554,7 @@
SetClassRoot(kJavaLangDexCache, java_lang_DexCache.Get());
java_lang_DexCache->SetDexCacheClass();
java_lang_DexCache->SetObjectSize(mirror::DexCache::InstanceSize());
- mirror::Class::SetStatus(java_lang_DexCache, mirror::Class::kStatusResolved, self);
+ mirror::Class::SetStatus(java_lang_DexCache, ClassStatus::kResolved, self);
// Setup dalvik.system.ClassExt
@@ -562,7 +562,7 @@
AllocClass(self, java_lang_Class.Get(), mirror::ClassExt::ClassSize(image_pointer_size_))));
SetClassRoot(kDalvikSystemClassExt, dalvik_system_ClassExt.Get());
mirror::ClassExt::SetClass(dalvik_system_ClassExt.Get());
- mirror::Class::SetStatus(dalvik_system_ClassExt, mirror::Class::kStatusResolved, self);
+ mirror::Class::SetStatus(dalvik_system_ClassExt, ClassStatus::kResolved, self);
// Set up array classes for string, field, method
Handle<mirror::Class> object_array_string(hs.NewHandle(
@@ -610,15 +610,15 @@
}
// Object, String, ClassExt and DexCache need to be rerun through FindSystemClass to finish init
- mirror::Class::SetStatus(java_lang_Object, mirror::Class::kStatusNotReady, self);
+ mirror::Class::SetStatus(java_lang_Object, ClassStatus::kNotReady, self);
CheckSystemClass(self, java_lang_Object, "Ljava/lang/Object;");
CHECK_EQ(java_lang_Object->GetObjectSize(), mirror::Object::InstanceSize());
- mirror::Class::SetStatus(java_lang_String, mirror::Class::kStatusNotReady, self);
+ mirror::Class::SetStatus(java_lang_String, ClassStatus::kNotReady, self);
CheckSystemClass(self, java_lang_String, "Ljava/lang/String;");
- mirror::Class::SetStatus(java_lang_DexCache, mirror::Class::kStatusNotReady, self);
+ mirror::Class::SetStatus(java_lang_DexCache, ClassStatus::kNotReady, self);
CheckSystemClass(self, java_lang_DexCache, "Ljava/lang/DexCache;");
CHECK_EQ(java_lang_DexCache->GetObjectSize(), mirror::DexCache::InstanceSize());
- mirror::Class::SetStatus(dalvik_system_ClassExt, mirror::Class::kStatusNotReady, self);
+ mirror::Class::SetStatus(dalvik_system_ClassExt, ClassStatus::kNotReady, self);
CheckSystemClass(self, dalvik_system_ClassExt, "Ldalvik/system/ClassExt;");
CHECK_EQ(dalvik_system_ClassExt->GetObjectSize(), mirror::ClassExt::InstanceSize());
@@ -772,7 +772,7 @@
// java.lang.ref classes need to be specially flagged, but otherwise are normal classes
// finish initializing Reference class
- mirror::Class::SetStatus(java_lang_ref_Reference, mirror::Class::kStatusNotReady, self);
+ mirror::Class::SetStatus(java_lang_ref_Reference, ClassStatus::kNotReady, self);
CheckSystemClass(self, java_lang_ref_Reference, "Ljava/lang/ref/Reference;");
CHECK_EQ(java_lang_ref_Reference->GetObjectSize(), mirror::Reference::InstanceSize());
CHECK_EQ(java_lang_ref_Reference->GetClassSize(),
@@ -2309,7 +2309,7 @@
// Check for circular dependencies between classes, the lock is required for SetStatus.
if (!h_class->IsResolved() && h_class->GetClinitThreadId() == self->GetTid()) {
ThrowClassCircularityError(h_class.Get());
- mirror::Class::SetStatus(h_class, mirror::Class::kStatusErrorUnresolved, self);
+ mirror::Class::SetStatus(h_class, ClassStatus::kErrorUnresolved, self);
return nullptr;
}
}
@@ -2771,7 +2771,7 @@
// An exception occured during load, set status to erroneous while holding klass' lock in case
// notification is necessary.
if (!klass->IsErroneous()) {
- mirror::Class::SetStatus(klass, mirror::Class::kStatusErrorUnresolved, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kErrorUnresolved, self);
}
return nullptr;
}
@@ -2781,7 +2781,7 @@
if (!LoadSuperAndInterfaces(klass, *new_dex_file)) {
// Loading failed.
if (!klass->IsErroneous()) {
- mirror::Class::SetStatus(klass, mirror::Class::kStatusErrorUnresolved, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kErrorUnresolved, self);
}
return nullptr;
}
@@ -2800,7 +2800,7 @@
if (!LinkClass(self, descriptor, klass, interfaces, &h_new_class)) {
// Linking failed.
if (!klass->IsErroneous()) {
- mirror::Class::SetStatus(klass, mirror::Class::kStatusErrorUnresolved, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kErrorUnresolved, self);
}
return nullptr;
}
@@ -3087,7 +3087,7 @@
ObjPtr<mirror::ClassLoader> class_loader) {
CHECK(klass != nullptr);
CHECK(klass->GetDexCache() != nullptr);
- CHECK_EQ(mirror::Class::kStatusNotReady, klass->GetStatus());
+ CHECK_EQ(ClassStatus::kNotReady, klass->GetStatus());
const char* descriptor = dex_file.GetClassDescriptor(dex_class_def);
CHECK(descriptor != nullptr);
@@ -3097,7 +3097,7 @@
klass->SetAccessFlags(access_flags);
klass->SetClassLoader(class_loader);
DCHECK_EQ(klass->GetPrimitiveType(), Primitive::kPrimNot);
- mirror::Class::SetStatus(klass, mirror::Class::kStatusIdx, nullptr);
+ mirror::Class::SetStatus(klass, ClassStatus::kIdx, nullptr);
klass->SetDexClassDefIndex(dex_file.GetIndexForClassDef(dex_class_def));
klass->SetDexTypeIndex(dex_class_def.class_idx_);
@@ -3623,7 +3623,7 @@
h_class->SetAccessFlags(kAccPublic | kAccFinal | kAccAbstract);
h_class->SetPrimitiveType(type);
h_class->SetIfTable(GetClassRoot(kJavaLangObject)->GetIfTable());
- mirror::Class::SetStatus(h_class, mirror::Class::kStatusInitialized, self);
+ mirror::Class::SetStatus(h_class, ClassStatus::kInitialized, self);
const char* descriptor = Primitive::Descriptor(type);
ObjPtr<mirror::Class> existing = InsertClass(descriptor,
h_class.Get(),
@@ -3738,11 +3738,11 @@
} else {
new_class->SetClassFlags(mirror::kClassFlagObjectArray);
}
- mirror::Class::SetStatus(new_class, mirror::Class::kStatusLoaded, self);
+ mirror::Class::SetStatus(new_class, ClassStatus::kLoaded, self);
new_class->PopulateEmbeddedVTable(image_pointer_size_);
ImTable* object_imt = java_lang_Object->GetImt(image_pointer_size_);
new_class->SetImt(object_imt, image_pointer_size_);
- mirror::Class::SetStatus(new_class, mirror::Class::kStatusInitialized, self);
+ mirror::Class::SetStatus(new_class, ClassStatus::kInitialized, self);
// don't need to set new_class->SetObjectSize(..)
// because Object::SizeOf delegates to Array::SizeOf
@@ -4000,7 +4000,7 @@
}
// Need to grab the lock to change status.
ObjectLock<mirror::Class> super_lock(self, klass);
- mirror::Class::SetStatus(klass, mirror::Class::kStatusErrorResolved, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kErrorResolved, self);
return false;
}
@@ -4022,9 +4022,9 @@
ObjectLock<mirror::Class> lock(self, klass);
// Is somebody verifying this now?
- mirror::Class::Status old_status = klass->GetStatus();
- while (old_status == mirror::Class::kStatusVerifying ||
- old_status == mirror::Class::kStatusVerifyingAtRuntime) {
+ ClassStatus old_status = klass->GetStatus();
+ while (old_status == ClassStatus::kVerifying ||
+ old_status == ClassStatus::kVerifyingAtRuntime) {
lock.WaitIgnoringInterrupts();
// WaitIgnoringInterrupts can still receive an interrupt and return early, in this
// case we may see the same status again. b/62912904. This is why the check is
@@ -4055,18 +4055,18 @@
return verifier::FailureKind::kSoftFailure;
}
- if (klass->GetStatus() == mirror::Class::kStatusResolved) {
- mirror::Class::SetStatus(klass, mirror::Class::kStatusVerifying, self);
+ if (klass->GetStatus() == ClassStatus::kResolved) {
+ mirror::Class::SetStatus(klass, ClassStatus::kVerifying, self);
} else {
- CHECK_EQ(klass->GetStatus(), mirror::Class::kStatusRetryVerificationAtRuntime)
+ CHECK_EQ(klass->GetStatus(), ClassStatus::kRetryVerificationAtRuntime)
<< klass->PrettyClass();
CHECK(!Runtime::Current()->IsAotCompiler());
- mirror::Class::SetStatus(klass, mirror::Class::kStatusVerifyingAtRuntime, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kVerifyingAtRuntime, self);
}
// Skip verification if disabled.
if (!Runtime::Current()->IsVerificationEnabled()) {
- mirror::Class::SetStatus(klass, mirror::Class::kStatusVerified, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kVerified, self);
EnsureSkipAccessChecksMethods(klass, image_pointer_size_);
return verifier::FailureKind::kNoFailure;
}
@@ -4128,7 +4128,7 @@
// Try to use verification information from the oat file, otherwise do runtime verification.
const DexFile& dex_file = *klass->GetDexCache()->GetDexFile();
- mirror::Class::Status oat_file_class_status(mirror::Class::kStatusNotReady);
+ ClassStatus oat_file_class_status(ClassStatus::kNotReady);
bool preverified = VerifyClassUsingOatFile(dex_file, klass.Get(), oat_file_class_status);
VLOG(class_linker) << "Class preverified status for class "
@@ -4165,10 +4165,10 @@
// Even though there were no verifier failures we need to respect whether the super-class and
// super-default-interfaces were verified or requiring runtime reverification.
if (supertype == nullptr || supertype->IsVerified()) {
- mirror::Class::SetStatus(klass, mirror::Class::kStatusVerified, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kVerified, self);
} else {
- CHECK_EQ(supertype->GetStatus(), mirror::Class::kStatusRetryVerificationAtRuntime);
- mirror::Class::SetStatus(klass, mirror::Class::kStatusRetryVerificationAtRuntime, self);
+ CHECK_EQ(supertype->GetStatus(), ClassStatus::kRetryVerificationAtRuntime);
+ mirror::Class::SetStatus(klass, ClassStatus::kRetryVerificationAtRuntime, self);
// Pretend a soft failure occurred so that we don't consider the class verified below.
verifier_failure = verifier::FailureKind::kSoftFailure;
}
@@ -4178,9 +4178,9 @@
// failures at runtime will be handled by slow paths in the generated
// code. Set status accordingly.
if (Runtime::Current()->IsAotCompiler()) {
- mirror::Class::SetStatus(klass, mirror::Class::kStatusRetryVerificationAtRuntime, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kRetryVerificationAtRuntime, self);
} else {
- mirror::Class::SetStatus(klass, mirror::Class::kStatusVerified, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kVerified, self);
// As this is a fake verified status, make sure the methods are _not_ marked
// kAccSkipAccessChecks later.
klass->SetVerificationAttempted();
@@ -4192,7 +4192,7 @@
<< " because: " << error_msg;
self->AssertNoPendingException();
ThrowVerifyError(klass.Get(), "%s", error_msg.c_str());
- mirror::Class::SetStatus(klass, mirror::Class::kStatusErrorResolved, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kErrorResolved, self);
}
if (preverified || verifier_failure == verifier::FailureKind::kNoFailure) {
// Class is verified so we don't need to do any access check on its methods.
@@ -4234,7 +4234,7 @@
bool ClassLinker::VerifyClassUsingOatFile(const DexFile& dex_file,
ObjPtr<mirror::Class> klass,
- mirror::Class::Status& oat_file_class_status) {
+ ClassStatus& oat_file_class_status) {
// If we're compiling, we can only verify the class using the oat file if
// we are not compiling the image or if the class we're verifying is not part of
// the app. In other words, we will only check for preverification of bootclasspath
@@ -4260,15 +4260,15 @@
uint16_t class_def_index = klass->GetDexClassDefIndex();
oat_file_class_status = oat_dex_file->GetOatClass(class_def_index).GetStatus();
- if (oat_file_class_status >= mirror::Class::kStatusVerified) {
+ if (oat_file_class_status >= ClassStatus::kVerified) {
return true;
}
// If we only verified a subset of the classes at compile time, we can end up with classes that
// were resolved by the verifier.
- if (oat_file_class_status == mirror::Class::kStatusResolved) {
+ if (oat_file_class_status == ClassStatus::kResolved) {
return false;
}
- if (oat_file_class_status == mirror::Class::kStatusRetryVerificationAtRuntime) {
+ if (oat_file_class_status == ClassStatus::kRetryVerificationAtRuntime) {
// Compile time verification failed with a soft error. Compile time verification can fail
// because we have incomplete type information. Consider the following:
// class ... {
@@ -4293,7 +4293,7 @@
// in the class. These errors are unrecoverable.
return false;
}
- if (oat_file_class_status == mirror::Class::kStatusNotReady) {
+ if (oat_file_class_status == ClassStatus::kNotReady) {
// Status is uninitialized if we couldn't determine the status at compile time, for example,
// not loading the class.
// TODO: when the verifier doesn't rely on Class-es failing to resolve/load the type hierarchy
@@ -4366,7 +4366,7 @@
temp_klass->SetDexCache(GetClassRoot(kJavaLangReflectProxy)->GetDexCache());
// Object has an empty iftable, copy it for that reason.
temp_klass->SetIfTable(GetClassRoot(kJavaLangObject)->GetIfTable());
- mirror::Class::SetStatus(temp_klass, mirror::Class::kStatusIdx, self);
+ mirror::Class::SetStatus(temp_klass, ClassStatus::kIdx, self);
std::string descriptor(GetDescriptorForProxy(temp_klass.Get()));
const size_t hash = ComputeModifiedUtf8Hash(descriptor.c_str());
@@ -4434,7 +4434,7 @@
// The super class is java.lang.reflect.Proxy
temp_klass->SetSuperClass(GetClassRoot(kJavaLangReflectProxy));
// Now effectively in the loaded state.
- mirror::Class::SetStatus(temp_klass, mirror::Class::kStatusLoaded, self);
+ mirror::Class::SetStatus(temp_klass, ClassStatus::kLoaded, self);
self->AssertNoPendingException();
// At this point the class is loaded. Publish a ClassLoad event.
@@ -4450,7 +4450,7 @@
Handle<mirror::ObjectArray<mirror::Class>> h_interfaces(
hs.NewHandle(soa.Decode<mirror::ObjectArray<mirror::Class>>(interfaces)));
if (!LinkClass(self, descriptor.c_str(), temp_klass, h_interfaces, &klass)) {
- mirror::Class::SetStatus(temp_klass, mirror::Class::kStatusErrorUnresolved, self);
+ mirror::Class::SetStatus(temp_klass, ClassStatus::kErrorUnresolved, self);
return nullptr;
}
}
@@ -4471,7 +4471,7 @@
{
// Lock on klass is released. Lock new class object.
ObjectLock<mirror::Class> initialization_lock(self, klass);
- mirror::Class::SetStatus(klass, mirror::Class::kStatusInitialized, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kInitialized, self);
}
// sanity checks
@@ -4687,7 +4687,7 @@
VlogClassInitializationFailure(klass);
} else {
CHECK(Runtime::Current()->IsAotCompiler());
- CHECK_EQ(klass->GetStatus(), mirror::Class::kStatusRetryVerificationAtRuntime);
+ CHECK_EQ(klass->GetStatus(), ClassStatus::kRetryVerificationAtRuntime);
}
return false;
} else {
@@ -4703,12 +4703,12 @@
}
}
- // If the class is kStatusInitializing, either this thread is
+ // If the class is ClassStatus::kInitializing, either this thread is
// initializing higher up the stack or another thread has beat us
// to initializing and we need to wait. Either way, this
// invocation of InitializeClass will not be responsible for
// running <clinit> and will return.
- if (klass->GetStatus() == mirror::Class::kStatusInitializing) {
+ if (klass->GetStatus() == ClassStatus::kInitializing) {
// Could have got an exception during verification.
if (self->IsExceptionPending()) {
VlogClassInitializationFailure(klass);
@@ -4733,20 +4733,20 @@
const OatFile::OatClass oat_class = (runtime->IsStarted() && !runtime->IsAotCompiler())
? OatFile::FindOatClass(klass->GetDexFile(), klass->GetDexClassDefIndex(), &has_oat_class)
: OatFile::OatClass::Invalid();
- if (oat_class.GetStatus() < mirror::Class::kStatusSuperclassValidated &&
+ if (oat_class.GetStatus() < ClassStatus::kSuperclassValidated &&
!ValidateSuperClassDescriptors(klass)) {
- mirror::Class::SetStatus(klass, mirror::Class::kStatusErrorResolved, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kErrorResolved, self);
return false;
}
self->AllowThreadSuspension();
- CHECK_EQ(klass->GetStatus(), mirror::Class::kStatusVerified) << klass->PrettyClass()
+ CHECK_EQ(klass->GetStatus(), ClassStatus::kVerified) << klass->PrettyClass()
<< " self.tid=" << self->GetTid() << " clinit.tid=" << klass->GetClinitThreadId();
// From here out other threads may observe that we're initializing and so changes of state
// require the a notification.
klass->SetClinitThreadId(self->GetTid());
- mirror::Class::SetStatus(klass, mirror::Class::kStatusInitializing, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kInitializing, self);
t0 = NanoTime();
}
@@ -4773,7 +4773,7 @@
<< (self->GetException() != nullptr ? self->GetException()->Dump() : "");
ObjectLock<mirror::Class> lock(self, klass);
// Initialization failed because the super-class is erroneous.
- mirror::Class::SetStatus(klass, mirror::Class::kStatusErrorResolved, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kErrorResolved, self);
return false;
}
}
@@ -4804,7 +4804,7 @@
if (!iface_initialized) {
ObjectLock<mirror::Class> lock(self, klass);
// Initialization failed because one of our interfaces with default methods is erroneous.
- mirror::Class::SetStatus(klass, mirror::Class::kStatusErrorResolved, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kErrorResolved, self);
return false;
}
}
@@ -4876,7 +4876,7 @@
if (self->IsExceptionPending()) {
WrapExceptionInInitializer(klass);
- mirror::Class::SetStatus(klass, mirror::Class::kStatusErrorResolved, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kErrorResolved, self);
success = false;
} else if (Runtime::Current()->IsTransactionAborted()) {
// The exception thrown when the transaction aborted has been caught and cleared
@@ -4885,7 +4885,7 @@
<< mirror::Class::PrettyDescriptor(klass.Get())
<< " without exception while transaction was aborted: re-throw it now.";
Runtime::Current()->ThrowTransactionAbortError(self);
- mirror::Class::SetStatus(klass, mirror::Class::kStatusErrorResolved, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kErrorResolved, self);
success = false;
} else {
RuntimeStats* global_stats = Runtime::Current()->GetStats();
@@ -4895,7 +4895,7 @@
global_stats->class_init_time_ns += (t1 - t0);
thread_stats->class_init_time_ns += (t1 - t0);
// Set the class as initialized except if failed to initialize static fields.
- mirror::Class::SetStatus(klass, mirror::Class::kStatusInitialized, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kInitialized, self);
if (VLOG_IS_ON(class_linker)) {
std::string temp;
LOG(INFO) << "Initialized class " << klass->GetDescriptor(&temp) << " from " <<
@@ -4969,14 +4969,14 @@
// we were not using WaitIgnoringInterrupts), bail out.
if (self->IsExceptionPending()) {
WrapExceptionInInitializer(klass);
- mirror::Class::SetStatus(klass, mirror::Class::kStatusErrorResolved, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kErrorResolved, self);
return false;
}
// Spurious wakeup? Go back to waiting.
- if (klass->GetStatus() == mirror::Class::kStatusInitializing) {
+ if (klass->GetStatus() == ClassStatus::kInitializing) {
continue;
}
- if (klass->GetStatus() == mirror::Class::kStatusVerified &&
+ if (klass->GetStatus() == ClassStatus::kVerified &&
Runtime::Current()->IsAotCompiler()) {
// Compile time initialization failed.
return false;
@@ -5309,7 +5309,7 @@
Handle<mirror::Class> klass,
Handle<mirror::ObjectArray<mirror::Class>> interfaces,
MutableHandle<mirror::Class>* h_new_class_out) {
- CHECK_EQ(mirror::Class::kStatusLoaded, klass->GetStatus());
+ CHECK_EQ(ClassStatus::kLoaded, klass->GetStatus());
if (!LinkSuperClass(klass)) {
return false;
@@ -5329,7 +5329,7 @@
return false;
}
CreateReferenceInstanceOffsets(klass);
- CHECK_EQ(mirror::Class::kStatusLoaded, klass->GetStatus());
+ CHECK_EQ(ClassStatus::kLoaded, klass->GetStatus());
ImTable* imt = nullptr;
if (klass->ShouldHaveImt()) {
@@ -5382,7 +5382,7 @@
// This will notify waiters on klass that saw the not yet resolved
// class in the class_table_ during EnsureResolved.
- mirror::Class::SetStatus(klass, mirror::Class::kStatusResolved, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kResolved, self);
h_new_class_out->Assign(klass.Get());
} else {
CHECK(!klass->IsResolved());
@@ -5398,7 +5398,7 @@
klass->SetIFieldsPtrUnchecked(nullptr);
if (UNLIKELY(h_new_class == nullptr)) {
self->AssertPendingOOMException();
- mirror::Class::SetStatus(klass, mirror::Class::kStatusErrorUnresolved, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kErrorUnresolved, self);
return false;
}
@@ -5432,12 +5432,12 @@
// This will notify waiters on temp class that saw the not yet resolved class in the
// class_table_ during EnsureResolved.
- mirror::Class::SetStatus(klass, mirror::Class::kStatusRetired, self);
+ mirror::Class::SetStatus(klass, ClassStatus::kRetired, self);
- CHECK_EQ(h_new_class->GetStatus(), mirror::Class::kStatusResolving);
+ CHECK_EQ(h_new_class->GetStatus(), ClassStatus::kResolving);
// This will notify waiters on new_class that saw the not yet resolved
// class in the class_table_ during EnsureResolved.
- mirror::Class::SetStatus(h_new_class, mirror::Class::kStatusResolved, self);
+ mirror::Class::SetStatus(h_new_class, ClassStatus::kResolved, self);
// Return the new class.
h_new_class_out->Assign(h_new_class.Get());
}
@@ -5445,7 +5445,7 @@
}
bool ClassLinker::LoadSuperAndInterfaces(Handle<mirror::Class> klass, const DexFile& dex_file) {
- CHECK_EQ(mirror::Class::kStatusIdx, klass->GetStatus());
+ CHECK_EQ(ClassStatus::kIdx, klass->GetStatus());
const DexFile::ClassDef& class_def = dex_file.GetClassDef(klass->GetDexClassDefIndex());
dex::TypeIndex super_class_idx = class_def.superclass_idx_;
if (super_class_idx.IsValid()) {
@@ -5498,7 +5498,7 @@
}
}
// Mark the class as loaded.
- mirror::Class::SetStatus(klass, mirror::Class::kStatusLoaded, nullptr);
+ mirror::Class::SetStatus(klass, ClassStatus::kLoaded, nullptr);
return true;
}
@@ -8706,9 +8706,9 @@
}
jobject ClassLinker::CreateWellKnownClassLoader(Thread* self,
- const std::vector<const DexFile*>& dex_files,
- jclass loader_class,
- jobject parent_loader) {
+ const std::vector<const DexFile*>& dex_files,
+ jclass loader_class,
+ jobject parent_loader) {
CHECK(self->GetJniEnv()->IsSameObject(loader_class,
WellKnownClasses::dalvik_system_PathClassLoader) ||
self->GetJniEnv()->IsSameObject(loader_class,
@@ -8784,6 +8784,29 @@
DCHECK(h_dex_path_list != nullptr);
// Set elements.
dex_elements_field->SetObject<false>(h_dex_path_list.Get(), h_dex_elements.Get());
+ // Create an empty List for the "nativeLibraryDirectories," required for native tests.
+ // Note: this code is uncommon(oatdump)/testing-only, so don't add further WellKnownClasses
+ // elements.
+ {
+ ArtField* native_lib_dirs = dex_elements_field->GetDeclaringClass()->
+ FindDeclaredInstanceField("nativeLibraryDirectories", "Ljava/util/List;");
+ DCHECK(native_lib_dirs != nullptr);
+ ObjPtr<mirror::Class> list_class = FindSystemClass(self, "Ljava/util/ArrayList;");
+ DCHECK(list_class != nullptr);
+ {
+ StackHandleScope<1> h_list_scope(self);
+ Handle<mirror::Class> h_list_class(h_list_scope.NewHandle<mirror::Class>(list_class));
+ bool list_init = EnsureInitialized(self, h_list_class, true, true);
+ DCHECK(list_init);
+ list_class = h_list_class.Get();
+ }
+ ObjPtr<mirror::Object> list_object = list_class->AllocObject(self);
+ // Note: we leave the object uninitialized. This must never leak into any non-testing code, but
+ // is fine for testing. While it violates a Java-code invariant (the elementData field is
+ // normally never null), as long as one does not try to add elements, this will still
+ // work.
+ native_lib_dirs->SetObject<false>(h_dex_path_list.Get(), list_object);
+ }
// Create the class loader..
Handle<mirror::Class> h_loader_class = hs.NewHandle(soa.Decode<mirror::Class>(loader_class));
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 10562f0..3e3425f 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -27,9 +27,9 @@
#include "base/enums.h"
#include "base/macros.h"
#include "base/mutex.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_types.h"
#include "dex_cache_resolved_classes.h"
-#include "dex_file.h"
-#include "dex_file_types.h"
#include "gc_root.h"
#include "handle.h"
#include "jni.h"
@@ -478,7 +478,7 @@
REQUIRES(!Locks::dex_lock_);
bool VerifyClassUsingOatFile(const DexFile& dex_file,
ObjPtr<mirror::Class> klass,
- mirror::Class::Status& oat_file_class_status)
+ ClassStatus& oat_file_class_status)
REQUIRES_SHARED(Locks::mutator_lock_)
REQUIRES(!Locks::dex_lock_);
void ResolveClassExceptionHandlerTypes(Handle<mirror::Class> klass)
diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc
index 3dca2f9..80ef654 100644
--- a/runtime/class_linker_test.cc
+++ b/runtime/class_linker_test.cc
@@ -26,7 +26,8 @@
#include "base/enums.h"
#include "class_linker-inl.h"
#include "common_runtime_test.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
+#include "dex/standard_dex_file.h"
#include "entrypoints/entrypoint_utils-inl.h"
#include "experimental_flags.h"
#include "gc/heap.h"
@@ -50,7 +51,6 @@
#include "mirror/string-inl.h"
#include "mirror/var_handle.h"
#include "scoped_thread_state_change-inl.h"
-#include "standard_dex_file.h"
#include "thread-current-inl.h"
namespace art {
@@ -86,7 +86,7 @@
EXPECT_TRUE(primitive->GetSuperClass() == nullptr);
EXPECT_FALSE(primitive->HasSuperClass());
EXPECT_TRUE(primitive->GetClassLoader() == nullptr);
- EXPECT_EQ(mirror::Class::kStatusInitialized, primitive->GetStatus());
+ EXPECT_EQ(ClassStatus::kInitialized, primitive->GetStatus());
EXPECT_FALSE(primitive->IsErroneous());
EXPECT_TRUE(primitive->IsLoaded());
EXPECT_TRUE(primitive->IsResolved());
@@ -125,7 +125,7 @@
EXPECT_TRUE(JavaLangObject->GetSuperClass() == nullptr);
EXPECT_FALSE(JavaLangObject->HasSuperClass());
EXPECT_TRUE(JavaLangObject->GetClassLoader() == nullptr);
- EXPECT_EQ(mirror::Class::kStatusInitialized, JavaLangObject->GetStatus());
+ EXPECT_EQ(ClassStatus::kInitialized, JavaLangObject->GetStatus());
EXPECT_FALSE(JavaLangObject->IsErroneous());
EXPECT_TRUE(JavaLangObject->IsLoaded());
EXPECT_TRUE(JavaLangObject->IsResolved());
@@ -200,7 +200,7 @@
EXPECT_TRUE(array->HasSuperClass());
ASSERT_TRUE(array->GetComponentType() != nullptr);
ASSERT_GT(strlen(array->GetComponentType()->GetDescriptor(&temp)), 0U);
- EXPECT_EQ(mirror::Class::kStatusInitialized, array->GetStatus());
+ EXPECT_EQ(ClassStatus::kInitialized, array->GetStatus());
EXPECT_FALSE(array->IsErroneous());
EXPECT_TRUE(array->IsLoaded());
EXPECT_TRUE(array->IsResolved());
@@ -919,7 +919,7 @@
EXPECT_TRUE(MyClass->GetSuperClass() == JavaLangObject);
EXPECT_TRUE(MyClass->HasSuperClass());
EXPECT_EQ(class_loader.Get(), MyClass->GetClassLoader());
- EXPECT_EQ(mirror::Class::kStatusResolved, MyClass->GetStatus());
+ EXPECT_EQ(ClassStatus::kResolved, MyClass->GetStatus());
EXPECT_FALSE(MyClass->IsErroneous());
EXPECT_TRUE(MyClass->IsLoaded());
EXPECT_TRUE(MyClass->IsResolved());
diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc
index 54e7558..3ec5335 100644
--- a/runtime/class_loader_context.cc
+++ b/runtime/class_loader_context.cc
@@ -21,8 +21,8 @@
#include "base/stl_util.h"
#include "class_linker.h"
#include "class_loader_utils.h"
-#include "dex_file.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_loader.h"
#include "handle_scope-inl.h"
#include "jni_internal.h"
#include "oat_file_assistant.h"
diff --git a/runtime/class_loader_context_test.cc b/runtime/class_loader_context_test.cc
index fc3446c..bc72635 100644
--- a/runtime/class_loader_context_test.cc
+++ b/runtime/class_loader_context_test.cc
@@ -23,7 +23,7 @@
#include "base/stl_util.h"
#include "class_linker.h"
#include "common_runtime_test.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "handle_scope-inl.h"
#include "mirror/class.h"
#include "mirror/class_loader.h"
diff --git a/runtime/class_reference.h b/runtime/class_reference.h
index 2ef9ab8..e8e668e 100644
--- a/runtime/class_reference.h
+++ b/runtime/class_reference.h
@@ -20,7 +20,7 @@
#include <stdint.h>
#include <utility>
-#include "dex_file_reference.h"
+#include "dex/dex_file_reference.h"
namespace art {
diff --git a/runtime/class_status.h b/runtime/class_status.h
index 7f2ef6a..ada2863 100644
--- a/runtime/class_status.h
+++ b/runtime/class_status.h
@@ -24,70 +24,70 @@
// Class Status
//
-// kStatusRetired: Class that's temporarily used till class linking time
+// kRetired: Class that's temporarily used till class linking time
// has its (vtable) size figured out and has been cloned to one with the
// right size which will be the one used later. The old one is retired and
// will be gc'ed once all refs to the class point to the newly
// cloned version.
//
-// kStatusErrorUnresolved, kStatusErrorResolved: Class is erroneous. We need
+// kErrorUnresolved, kErrorResolved: Class is erroneous. We need
// to distinguish between classes that have been resolved and classes that
// have not. This is important because the const-class instruction needs to
// return a previously resolved class even if its subsequent initialization
// failed. We also need this to decide whether to wrap a previous
// initialization failure in ClassDefNotFound error or not.
//
-// kStatusNotReady: If a Class cannot be found in the class table by
+// kNotReady: If a Class cannot be found in the class table by
// FindClass, it allocates an new one with AllocClass in the
-// kStatusNotReady and calls LoadClass. Note if it does find a
-// class, it may not be kStatusResolved and it will try to push it
-// forward toward kStatusResolved.
+// kNotReady and calls LoadClass. Note if it does find a
+// class, it may not be kResolved and it will try to push it
+// forward toward kResolved.
//
-// kStatusIdx: LoadClass populates with Class with information from
-// the DexFile, moving the status to kStatusIdx, indicating that the
+// kIdx: LoadClass populates with Class with information from
+// the DexFile, moving the status to kIdx, indicating that the
// Class value in super_class_ has not been populated. The new Class
// can then be inserted into the classes table.
//
-// kStatusLoaded: After taking a lock on Class, the ClassLinker will
-// attempt to move a kStatusIdx class forward to kStatusLoaded by
+// kLoaded: After taking a lock on Class, the ClassLinker will
+// attempt to move a kIdx class forward to kLoaded by
// using ResolveClass to initialize the super_class_ and ensuring the
// interfaces are resolved.
//
-// kStatusResolving: Class is just cloned with the right size from
+// kResolving: Class is just cloned with the right size from
// temporary class that's acting as a placeholder for linking. The old
// class will be retired. New class is set to this status first before
// moving on to being resolved.
//
-// kStatusResolved: Still holding the lock on Class, the ClassLinker
+// kResolved: Still holding the lock on Class, the ClassLinker
// shows linking is complete and fields of the Class populated by making
-// it kStatusResolved. Java allows circularities of the form where a super
+// it kResolved. Java allows circularities of the form where a super
// class has a field that is of the type of the sub class. We need to be able
// to fully resolve super classes while resolving types for fields.
//
-// kStatusRetryVerificationAtRuntime: The verifier sets a class to
+// kRetryVerificationAtRuntime: The verifier sets a class to
// this state if it encounters a soft failure at compile time. This
// often happens when there are unresolved classes in other dex
// files, and this status marks a class as needing to be verified
// again at runtime.
//
// TODO: Explain the other states
-enum ClassStatus : int8_t {
- kStatusRetired = -3, // Retired, should not be used. Use the newly cloned one instead.
- kStatusErrorResolved = -2,
- kStatusErrorUnresolved = -1,
- kStatusNotReady = 0,
- kStatusIdx = 1, // Loaded, DEX idx in super_class_type_idx_ and interfaces_type_idx_.
- kStatusLoaded = 2, // DEX idx values resolved.
- kStatusResolving = 3, // Just cloned from temporary class object.
- kStatusResolved = 4, // Part of linking.
- kStatusVerifying = 5, // In the process of being verified.
- kStatusRetryVerificationAtRuntime = 6, // Compile time verification failed, retry at runtime.
- kStatusVerifyingAtRuntime = 7, // Retrying verification at runtime.
- kStatusVerified = 8, // Logically part of linking; done pre-init.
- kStatusSuperclassValidated = 9, // Superclass validation part of init done.
- kStatusInitializing = 10, // Class init in progress.
- kStatusInitialized = 11, // Ready to go.
- kStatusMax = 12,
+enum class ClassStatus : uint8_t {
+ kNotReady = 0, // Zero-initialized Class object starts in this state.
+ kRetired = 1, // Retired, should not be used. Use the newly cloned one instead.
+ kErrorResolved = 2,
+ kErrorUnresolved = 3,
+ kIdx = 4, // Loaded, DEX idx in super_class_type_idx_ and interfaces_type_idx_.
+ kLoaded = 5, // DEX idx values resolved.
+ kResolving = 6, // Just cloned from temporary class object.
+ kResolved = 7, // Part of linking.
+ kVerifying = 8, // In the process of being verified.
+ kRetryVerificationAtRuntime = 9, // Compile time verification failed, retry at runtime.
+ kVerifyingAtRuntime = 10, // Retrying verification at runtime.
+ kVerified = 11, // Logically part of linking; done pre-init.
+ kSuperclassValidated = 12, // Superclass validation part of init done.
+ kInitializing = 13, // Class init in progress.
+ kInitialized = 14, // Ready to go.
+ kLast = kInitialized
};
std::ostream& operator<<(std::ostream& os, const ClassStatus& rhs);
diff --git a/runtime/class_table.cc b/runtime/class_table.cc
index c45bbe5..e313ec5 100644
--- a/runtime/class_table.cc
+++ b/runtime/class_table.cc
@@ -79,7 +79,7 @@
mirror::Class* const existing = existing_it->Read();
CHECK_NE(existing, klass) << descriptor;
CHECK(!existing->IsResolved()) << descriptor;
- CHECK_EQ(klass->GetStatus(), mirror::Class::kStatusResolving) << descriptor;
+ CHECK_EQ(klass->GetStatus(), ClassStatus::kResolving) << descriptor;
CHECK(!klass->IsTemp()) << descriptor;
VerifyObject(klass);
// Update the element in the hash set with the new class. This is safe to do since the descriptor
diff --git a/runtime/class_table_test.cc b/runtime/class_table_test.cc
index 18c2b82..fdf6ad1 100644
--- a/runtime/class_table_test.cc
+++ b/runtime/class_table_test.cc
@@ -20,7 +20,7 @@
#include "art_method-inl.h"
#include "class_linker-inl.h"
#include "common_runtime_test.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "gc/accounting/card_table-inl.h"
#include "gc/heap.h"
#include "handle_scope-inl.h"
diff --git a/runtime/common_dex_operations.h b/runtime/common_dex_operations.h
index 8988702..1db25c4 100644
--- a/runtime/common_dex_operations.h
+++ b/runtime/common_dex_operations.h
@@ -23,7 +23,7 @@
#include "base/macros.h"
#include "base/mutex.h"
#include "class_linker.h"
-#include "code_item_accessors.h"
+#include "dex/code_item_accessors.h"
#include "handle_scope-inl.h"
#include "instrumentation.h"
#include "interpreter/shadow_frame.h"
diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc
index 6db4d92..96d660f 100644
--- a/runtime/common_runtime_test.cc
+++ b/runtime/common_runtime_test.cc
@@ -35,8 +35,8 @@
#include "base/unix_file/fd_file.h"
#include "class_linker.h"
#include "compiler_callbacks.h"
-#include "dex_file-inl.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_loader.h"
#include "gc/heap.h"
#include "gc_root-inl.h"
#include "gtest/gtest.h"
diff --git a/runtime/common_runtime_test.h b/runtime/common_runtime_test.h
index 625884d..1c73240 100644
--- a/runtime/common_runtime_test.h
+++ b/runtime/common_runtime_test.h
@@ -26,7 +26,7 @@
#include "arch/instruction_set.h"
#include "base/mutex.h"
-#include "cdex/compact_dex_level.h"
+#include "dex/compact_dex_level.h"
#include "globals.h"
// TODO: Add inl file and avoid including inl.
#include "obj_ptr-inl.h"
diff --git a/runtime/common_throws.cc b/runtime/common_throws.cc
index 707885c..92d8651 100644
--- a/runtime/common_throws.cc
+++ b/runtime/common_throws.cc
@@ -24,8 +24,8 @@
#include "art_field-inl.h"
#include "art_method-inl.h"
#include "class_linker-inl.h"
-#include "dex_file-inl.h"
-#include "dex_instruction-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_instruction-inl.h"
#include "invoke_type.h"
#include "mirror/class-inl.h"
#include "mirror/method_type.h"
diff --git a/runtime/compiler_callbacks.h b/runtime/compiler_callbacks.h
index 9041df9..4560bca 100644
--- a/runtime/compiler_callbacks.h
+++ b/runtime/compiler_callbacks.h
@@ -55,7 +55,7 @@
// Return the class status of a previous stage of the compilation. This can be used, for example,
// when class unloading is enabled during multidex compilation.
virtual ClassStatus GetPreviousClassState(ClassReference ref ATTRIBUTE_UNUSED) {
- return ClassStatus::kStatusNotReady;
+ return ClassStatus::kNotReady;
}
virtual void SetDoesClassUnloading(bool does_class_unloading ATTRIBUTE_UNUSED,
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index f504d86..842cd73 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -33,10 +33,10 @@
#include "base/time_utils.h"
#include "class_linker-inl.h"
#include "class_linker.h"
-#include "dex_file-inl.h"
-#include "dex_file_annotations.h"
-#include "dex_file_types.h"
-#include "dex_instruction.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_annotations.h"
+#include "dex/dex_file_types.h"
+#include "dex/dex_instruction.h"
#include "entrypoints/runtime_asm_entrypoints.h"
#include "gc/accounting/card_table-inl.h"
#include "gc/allocation_record.h"
diff --git a/runtime/code_item_accessors-inl.h b/runtime/dex/code_item_accessors-inl.h
similarity index 89%
rename from runtime/code_item_accessors-inl.h
rename to runtime/dex/code_item_accessors-inl.h
index f63ea69..2fdf262 100644
--- a/runtime/code_item_accessors-inl.h
+++ b/runtime/dex/code_item_accessors-inl.h
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_CODE_ITEM_ACCESSORS_INL_H_
-#define ART_RUNTIME_CODE_ITEM_ACCESSORS_INL_H_
+#ifndef ART_RUNTIME_DEX_CODE_ITEM_ACCESSORS_INL_H_
+#define ART_RUNTIME_DEX_CODE_ITEM_ACCESSORS_INL_H_
#include "code_item_accessors-no_art-inl.h"
#include "art_method-inl.h"
-#include "cdex/compact_dex_file.h"
+#include "compact_dex_file.h"
#include "dex_file-inl.h"
#include "oat_file.h"
#include "standard_dex_file.h"
@@ -46,4 +46,4 @@
} // namespace art
-#endif // ART_RUNTIME_CODE_ITEM_ACCESSORS_INL_H_
+#endif // ART_RUNTIME_DEX_CODE_ITEM_ACCESSORS_INL_H_
diff --git a/runtime/code_item_accessors-no_art-inl.h b/runtime/dex/code_item_accessors-no_art-inl.h
similarity index 96%
rename from runtime/code_item_accessors-no_art-inl.h
rename to runtime/dex/code_item_accessors-no_art-inl.h
index 38ce8fb..016923d 100644
--- a/runtime/code_item_accessors-no_art-inl.h
+++ b/runtime/dex/code_item_accessors-no_art-inl.h
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_CODE_ITEM_ACCESSORS_NO_ART_INL_H_
-#define ART_RUNTIME_CODE_ITEM_ACCESSORS_NO_ART_INL_H_
+#ifndef ART_RUNTIME_DEX_CODE_ITEM_ACCESSORS_NO_ART_INL_H_
+#define ART_RUNTIME_DEX_CODE_ITEM_ACCESSORS_NO_ART_INL_H_
#include "code_item_accessors.h"
-#include "cdex/compact_dex_file.h"
+#include "compact_dex_file.h"
#include "dex_file-inl.h"
#include "standard_dex_file.h"
@@ -163,4 +163,4 @@
} // namespace art
-#endif // ART_RUNTIME_CODE_ITEM_ACCESSORS_NO_ART_INL_H_
+#endif // ART_RUNTIME_DEX_CODE_ITEM_ACCESSORS_NO_ART_INL_H_
diff --git a/runtime/code_item_accessors.h b/runtime/dex/code_item_accessors.h
similarity index 96%
rename from runtime/code_item_accessors.h
rename to runtime/dex/code_item_accessors.h
index 4cbe7a1..65cc0bf 100644
--- a/runtime/code_item_accessors.h
+++ b/runtime/dex/code_item_accessors.h
@@ -16,11 +16,11 @@
// TODO: Dex helpers have ART specific APIs, we may want to refactor these for use in dexdump.
-#ifndef ART_RUNTIME_CODE_ITEM_ACCESSORS_H_
-#define ART_RUNTIME_CODE_ITEM_ACCESSORS_H_
+#ifndef ART_RUNTIME_DEX_CODE_ITEM_ACCESSORS_H_
+#define ART_RUNTIME_DEX_CODE_ITEM_ACCESSORS_H_
#include "base/mutex.h"
-#include "cdex/compact_dex_file.h"
+#include "compact_dex_file.h"
#include "dex_file.h"
#include "dex_instruction_iterator.h"
#include "standard_dex_file.h"
@@ -167,4 +167,4 @@
} // namespace art
-#endif // ART_RUNTIME_CODE_ITEM_ACCESSORS_H_
+#endif // ART_RUNTIME_DEX_CODE_ITEM_ACCESSORS_H_
diff --git a/runtime/code_item_accessors_test.cc b/runtime/dex/code_item_accessors_test.cc
similarity index 100%
rename from runtime/code_item_accessors_test.cc
rename to runtime/dex/code_item_accessors_test.cc
diff --git a/runtime/dex/compact_dex_file.cc b/runtime/dex/compact_dex_file.cc
new file mode 100644
index 0000000..8f90e09
--- /dev/null
+++ b/runtime/dex/compact_dex_file.cc
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2017 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 "compact_dex_file.h"
+
+#include "dex_file-inl.h"
+#include "leb128.h"
+
+namespace art {
+
+constexpr uint8_t CompactDexFile::kDexMagic[kDexMagicSize];
+constexpr uint8_t CompactDexFile::kDexMagicVersion[];
+
+void CompactDexFile::WriteMagic(uint8_t* magic) {
+ std::copy_n(kDexMagic, kDexMagicSize, magic);
+}
+
+void CompactDexFile::WriteCurrentVersion(uint8_t* magic) {
+ std::copy_n(kDexMagicVersion, kDexVersionLen, magic + kDexMagicSize);
+}
+
+bool CompactDexFile::IsMagicValid(const uint8_t* magic) {
+ return (memcmp(magic, kDexMagic, sizeof(kDexMagic)) == 0);
+}
+
+bool CompactDexFile::IsVersionValid(const uint8_t* magic) {
+ const uint8_t* version = &magic[sizeof(kDexMagic)];
+ return memcmp(version, kDexMagicVersion, kDexVersionLen) == 0;
+}
+
+bool CompactDexFile::IsMagicValid() const {
+ return IsMagicValid(header_->magic_);
+}
+
+bool CompactDexFile::IsVersionValid() const {
+ return IsVersionValid(header_->magic_);
+}
+
+bool CompactDexFile::SupportsDefaultMethods() const {
+ return (GetHeader().GetFeatureFlags() &
+ static_cast<uint32_t>(FeatureFlags::kDefaultMethods)) != 0;
+}
+
+uint32_t CompactDexFile::GetCodeItemSize(const DexFile::CodeItem& item) const {
+ // TODO: Clean up this temporary code duplication with StandardDexFile. Eventually the
+ // implementations will differ.
+ DCHECK(HasAddress(&item));
+ const CodeItem& code_item = down_cast<const CodeItem&>(item);
+ uintptr_t code_item_start = reinterpret_cast<uintptr_t>(&code_item);
+ uint32_t insns_size = code_item.insns_size_in_code_units_;
+ uint32_t tries_size = code_item.tries_size_;
+ const uint8_t* handler_data = GetCatchHandlerData(
+ DexInstructionIterator(code_item.insns_, code_item.insns_size_in_code_units_),
+ code_item.tries_size_,
+ 0);
+
+ if (tries_size == 0 || handler_data == nullptr) {
+ uintptr_t insns_end = reinterpret_cast<uintptr_t>(&code_item.insns_[insns_size]);
+ return insns_end - code_item_start;
+ } else {
+ // Get the start of the handler data.
+ uint32_t handlers_size = DecodeUnsignedLeb128(&handler_data);
+ // Manually read each handler.
+ for (uint32_t i = 0; i < handlers_size; ++i) {
+ int32_t uleb128_count = DecodeSignedLeb128(&handler_data) * 2;
+ if (uleb128_count <= 0) {
+ uleb128_count = -uleb128_count + 1;
+ }
+ for (int32_t j = 0; j < uleb128_count; ++j) {
+ DecodeUnsignedLeb128(&handler_data);
+ }
+ }
+ return reinterpret_cast<uintptr_t>(handler_data) - code_item_start;
+ }
+}
+
+} // namespace art
diff --git a/runtime/cdex/compact_dex_file.h b/runtime/dex/compact_dex_file.h
similarity index 91%
rename from runtime/cdex/compact_dex_file.h
rename to runtime/dex/compact_dex_file.h
index e47f97e..280c6f7 100644
--- a/runtime/cdex/compact_dex_file.h
+++ b/runtime/dex/compact_dex_file.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_CDEX_COMPACT_DEX_FILE_H_
-#define ART_RUNTIME_CDEX_COMPACT_DEX_FILE_H_
+#ifndef ART_RUNTIME_DEX_COMPACT_DEX_FILE_H_
+#define ART_RUNTIME_DEX_COMPACT_DEX_FILE_H_
#include "base/casts.h"
#include "dex_file.h"
@@ -47,6 +47,7 @@
struct CodeItem : public DexFile::CodeItem {
private:
// TODO: Insert compact dex specific fields here.
+ friend class CompactDexFile;
DISALLOW_COPY_AND_ASSIGN(CodeItem);
};
@@ -70,6 +71,8 @@
virtual bool SupportsDefaultMethods() const OVERRIDE;
+ uint32_t GetCodeItemSize(const DexFile::CodeItem& item) const OVERRIDE;
+
private:
// Not supported yet.
CompactDexFile(const uint8_t* base,
@@ -94,4 +97,4 @@
} // namespace art
-#endif // ART_RUNTIME_CDEX_COMPACT_DEX_FILE_H_
+#endif // ART_RUNTIME_DEX_COMPACT_DEX_FILE_H_
diff --git a/runtime/cdex/compact_dex_file_test.cc b/runtime/dex/compact_dex_file_test.cc
similarity index 97%
rename from runtime/cdex/compact_dex_file_test.cc
rename to runtime/dex/compact_dex_file_test.cc
index b43b35d..d665dc9 100644
--- a/runtime/cdex/compact_dex_file_test.cc
+++ b/runtime/dex/compact_dex_file_test.cc
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-#include "cdex/compact_dex_file.h"
-#include "dex_file_loader.h"
#include "common_runtime_test.h"
+#include "compact_dex_file.h"
+#include "dex_file_loader.h"
namespace art {
diff --git a/runtime/cdex/compact_dex_level.h b/runtime/dex/compact_dex_level.h
similarity index 91%
rename from runtime/cdex/compact_dex_level.h
rename to runtime/dex/compact_dex_level.h
index 5aec001..de9ca3c 100644
--- a/runtime/cdex/compact_dex_level.h
+++ b/runtime/dex/compact_dex_level.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_CDEX_COMPACT_DEX_LEVEL_H_
-#define ART_RUNTIME_CDEX_COMPACT_DEX_LEVEL_H_
+#ifndef ART_RUNTIME_DEX_COMPACT_DEX_LEVEL_H_
+#define ART_RUNTIME_DEX_COMPACT_DEX_LEVEL_H_
#include <string>
@@ -47,4 +47,4 @@
} // namespace art
-#endif // ART_RUNTIME_CDEX_COMPACT_DEX_LEVEL_H_
+#endif // ART_RUNTIME_DEX_COMPACT_DEX_LEVEL_H_
diff --git a/runtime/dex_file-inl.h b/runtime/dex/dex_file-inl.h
similarity index 96%
rename from runtime/dex_file-inl.h
rename to runtime/dex/dex_file-inl.h
index 7cc8b87..9b56328 100644
--- a/runtime/dex_file-inl.h
+++ b/runtime/dex/dex_file-inl.h
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_DEX_FILE_INL_H_
-#define ART_RUNTIME_DEX_FILE_INL_H_
+#ifndef ART_RUNTIME_DEX_DEX_FILE_INL_H_
+#define ART_RUNTIME_DEX_DEX_FILE_INL_H_
#include "base/bit_utils.h"
#include "base/casts.h"
#include "base/stringpiece.h"
-#include "cdex/compact_dex_file.h"
+#include "compact_dex_file.h"
#include "dex_file.h"
#include "invoke_type.h"
#include "leb128.h"
@@ -507,6 +507,15 @@
return down_cast<const StandardDexFile*>(this);
}
+// Get the base of the encoded data for the given DexCode.
+inline const uint8_t* DexFile::GetCatchHandlerData(const DexInstructionIterator& code_item_end,
+ uint32_t tries_size,
+ uint32_t offset) {
+ const uint8_t* handler_data =
+ reinterpret_cast<const uint8_t*>(GetTryItems(code_item_end, tries_size));
+ return handler_data + offset;
+}
+
} // namespace art
-#endif // ART_RUNTIME_DEX_FILE_INL_H_
+#endif // ART_RUNTIME_DEX_DEX_FILE_INL_H_
diff --git a/runtime/dex_file.cc b/runtime/dex/dex_file.cc
similarity index 95%
rename from runtime/dex_file.cc
rename to runtime/dex/dex_file.cc
index d6469c6..16325b8 100644
--- a/runtime/dex_file.cc
+++ b/runtime/dex/dex_file.cc
@@ -217,35 +217,6 @@
UNREACHABLE();
}
-uint32_t DexFile::GetCodeItemSize(const DexFile::CodeItem& code_item) {
- uintptr_t code_item_start = reinterpret_cast<uintptr_t>(&code_item);
- uint32_t insns_size = code_item.insns_size_in_code_units_;
- uint32_t tries_size = code_item.tries_size_;
- const uint8_t* handler_data = GetCatchHandlerData(
- DexInstructionIterator(code_item.insns_, code_item.insns_size_in_code_units_),
- code_item.tries_size_,
- 0);
-
- if (tries_size == 0 || handler_data == nullptr) {
- uintptr_t insns_end = reinterpret_cast<uintptr_t>(&code_item.insns_[insns_size]);
- return insns_end - code_item_start;
- } else {
- // Get the start of the handler data.
- uint32_t handlers_size = DecodeUnsignedLeb128(&handler_data);
- // Manually read each handler.
- for (uint32_t i = 0; i < handlers_size; ++i) {
- int32_t uleb128_count = DecodeSignedLeb128(&handler_data) * 2;
- if (uleb128_count <= 0) {
- uleb128_count = -uleb128_count + 1;
- }
- for (int32_t j = 0; j < uleb128_count; ++j) {
- DecodeUnsignedLeb128(&handler_data);
- }
- }
- return reinterpret_cast<uintptr_t>(handler_data) - code_item_start;
- }
-}
-
const DexFile::FieldId* DexFile::FindFieldId(const DexFile::TypeId& declaring_klass,
const DexFile::StringId& name,
const DexFile::TypeId& type) const {
diff --git a/runtime/dex_file.h b/runtime/dex/dex_file.h
similarity index 98%
rename from runtime/dex_file.h
rename to runtime/dex/dex_file.h
index b9bf119..c2a36ce 100644
--- a/runtime/dex_file.h
+++ b/runtime/dex/dex_file.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_DEX_FILE_H_
-#define ART_RUNTIME_DEX_FILE_H_
+#ifndef ART_RUNTIME_DEX_DEX_FILE_H_
+#define ART_RUNTIME_DEX_DEX_FILE_H_
#include <memory>
#include <string>
@@ -308,7 +308,11 @@
debug_info_off_ = new_offset;
}
- private:
+ uint32_t GetDebugInfoOffset() const {
+ return debug_info_off_;
+ }
+
+ protected:
uint16_t registers_size_; // the number of registers used by this code
// (locals + parameters)
uint16_t ins_size_; // the number of words of incoming arguments to the method
@@ -333,7 +337,6 @@
friend class CodeItemDataAccessor;
friend class CodeItemDebugInfoAccessor;
friend class CodeItemInstructionAccessor;
- friend class DexFile; // TODO: Remove this one when it's cleaned up.
friend class VdexFile; // TODO: Remove this one when it's cleaned up.
DISALLOW_COPY_AND_ASSIGN(CodeItem);
};
@@ -583,7 +586,7 @@
uint32_t FindCodeItemOffset(const DexFile::ClassDef& class_def,
uint32_t dex_method_idx) const;
- static uint32_t GetCodeItemSize(const DexFile::CodeItem& disk_code_item);
+ virtual uint32_t GetCodeItemSize(const DexFile::CodeItem& disk_code_item) const = 0;
// Returns the declaring class descriptor string of a field id.
const char* GetFieldDeclaringClassDescriptor(const FieldId& field_id) const {
@@ -715,7 +718,7 @@
}
CHECK(oat_dex_file_ == nullptr)
<< "Should only use GetDebugInfoOffset in a non runtime setup";
- return code_item->debug_info_off_;
+ return code_item->GetDebugInfoOffset();
}
const char* GetReturnTypeDescriptor(const ProtoId& proto_id) const;
@@ -778,11 +781,7 @@
// Get the base of the encoded data for the given DexCode.
static const uint8_t* GetCatchHandlerData(const DexInstructionIterator& code_item_end,
uint32_t tries_size,
- uint32_t offset) {
- const uint8_t* handler_data =
- reinterpret_cast<const uint8_t*>(GetTryItems(code_item_end, tries_size));
- return handler_data + offset;
- }
+ uint32_t offset);
// Find which try region is associated with the given address (ie dex pc). Returns -1 if none.
static int32_t FindTryItem(const TryItem* try_items, uint32_t tries_size, uint32_t address);
@@ -1457,4 +1456,4 @@
} // namespace art
-#endif // ART_RUNTIME_DEX_FILE_H_
+#endif // ART_RUNTIME_DEX_DEX_FILE_H_
diff --git a/runtime/dex_file_annotations.cc b/runtime/dex/dex_file_annotations.cc
similarity index 100%
rename from runtime/dex_file_annotations.cc
rename to runtime/dex/dex_file_annotations.cc
diff --git a/runtime/dex_file_annotations.h b/runtime/dex/dex_file_annotations.h
similarity index 97%
rename from runtime/dex_file_annotations.h
rename to runtime/dex/dex_file_annotations.h
index 9ff0929..2677372 100644
--- a/runtime/dex_file_annotations.h
+++ b/runtime/dex/dex_file_annotations.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_DEX_FILE_ANNOTATIONS_H_
-#define ART_RUNTIME_DEX_FILE_ANNOTATIONS_H_
+#ifndef ART_RUNTIME_DEX_DEX_FILE_ANNOTATIONS_H_
+#define ART_RUNTIME_DEX_DEX_FILE_ANNOTATIONS_H_
#include "dex_file.h"
@@ -141,4 +141,4 @@
} // namespace art
-#endif // ART_RUNTIME_DEX_FILE_ANNOTATIONS_H_
+#endif // ART_RUNTIME_DEX_DEX_FILE_ANNOTATIONS_H_
diff --git a/runtime/dex_file_exception_helpers.cc b/runtime/dex/dex_file_exception_helpers.cc
similarity index 100%
rename from runtime/dex_file_exception_helpers.cc
rename to runtime/dex/dex_file_exception_helpers.cc
diff --git a/runtime/dex_file_exception_helpers.h b/runtime/dex/dex_file_exception_helpers.h
similarity index 92%
rename from runtime/dex_file_exception_helpers.h
rename to runtime/dex/dex_file_exception_helpers.h
index 739ed1f..bd6cb7e 100644
--- a/runtime/dex_file_exception_helpers.h
+++ b/runtime/dex/dex_file_exception_helpers.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_DEX_FILE_EXCEPTION_HELPERS_H_
-#define ART_RUNTIME_DEX_FILE_EXCEPTION_HELPERS_H_
+#ifndef ART_RUNTIME_DEX_DEX_FILE_EXCEPTION_HELPERS_H_
+#define ART_RUNTIME_DEX_DEX_FILE_EXCEPTION_HELPERS_H_
#include "dex_file.h"
@@ -65,4 +65,4 @@
} // namespace art
-#endif // ART_RUNTIME_DEX_FILE_EXCEPTION_HELPERS_H_
+#endif // ART_RUNTIME_DEX_DEX_FILE_EXCEPTION_HELPERS_H_
diff --git a/runtime/dex_file_layout.cc b/runtime/dex/dex_file_layout.cc
similarity index 100%
rename from runtime/dex_file_layout.cc
rename to runtime/dex/dex_file_layout.cc
diff --git a/runtime/dex_file_layout.h b/runtime/dex/dex_file_layout.h
similarity index 96%
rename from runtime/dex_file_layout.h
rename to runtime/dex/dex_file_layout.h
index 9fac5f8..a7b9051 100644
--- a/runtime/dex_file_layout.h
+++ b/runtime/dex/dex_file_layout.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_DEX_FILE_LAYOUT_H_
-#define ART_RUNTIME_DEX_FILE_LAYOUT_H_
+#ifndef ART_RUNTIME_DEX_DEX_FILE_LAYOUT_H_
+#define ART_RUNTIME_DEX_DEX_FILE_LAYOUT_H_
#include <algorithm>
#include <cstdint>
@@ -121,4 +121,4 @@
} // namespace art
-#endif // ART_RUNTIME_DEX_FILE_LAYOUT_H_
+#endif // ART_RUNTIME_DEX_DEX_FILE_LAYOUT_H_
diff --git a/runtime/dex_file_loader.cc b/runtime/dex/dex_file_loader.cc
similarity index 99%
rename from runtime/dex_file_loader.cc
rename to runtime/dex/dex_file_loader.cc
index bc92769..fafd698 100644
--- a/runtime/dex_file_loader.cc
+++ b/runtime/dex/dex_file_loader.cc
@@ -25,7 +25,7 @@
#include "base/stl_util.h"
#include "base/systrace.h"
#include "base/unix_file/fd_file.h"
-#include "cdex/compact_dex_file.h"
+#include "compact_dex_file.h"
#include "dex_file.h"
#include "dex_file_verifier.h"
#include "standard_dex_file.h"
diff --git a/runtime/dex_file_loader.h b/runtime/dex/dex_file_loader.h
similarity index 98%
rename from runtime/dex_file_loader.h
rename to runtime/dex/dex_file_loader.h
index 1763123..7db8d8e 100644
--- a/runtime/dex_file_loader.h
+++ b/runtime/dex/dex_file_loader.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_DEX_FILE_LOADER_H_
-#define ART_RUNTIME_DEX_FILE_LOADER_H_
+#ifndef ART_RUNTIME_DEX_DEX_FILE_LOADER_H_
+#define ART_RUNTIME_DEX_DEX_FILE_LOADER_H_
#include <cstdint>
#include <memory>
@@ -202,4 +202,4 @@
} // namespace art
-#endif // ART_RUNTIME_DEX_FILE_LOADER_H_
+#endif // ART_RUNTIME_DEX_DEX_FILE_LOADER_H_
diff --git a/runtime/dex_file_reference.h b/runtime/dex/dex_file_reference.h
similarity index 90%
rename from runtime/dex_file_reference.h
rename to runtime/dex/dex_file_reference.h
index 01a6425..6f88290 100644
--- a/runtime/dex_file_reference.h
+++ b/runtime/dex/dex_file_reference.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_DEX_FILE_REFERENCE_H_
-#define ART_RUNTIME_DEX_FILE_REFERENCE_H_
+#ifndef ART_RUNTIME_DEX_DEX_FILE_REFERENCE_H_
+#define ART_RUNTIME_DEX_DEX_FILE_REFERENCE_H_
#include <cstdint>
@@ -49,4 +49,4 @@
} // namespace art
-#endif // ART_RUNTIME_DEX_FILE_REFERENCE_H_
+#endif // ART_RUNTIME_DEX_DEX_FILE_REFERENCE_H_
diff --git a/runtime/dex_file_test.cc b/runtime/dex/dex_file_test.cc
similarity index 100%
rename from runtime/dex_file_test.cc
rename to runtime/dex/dex_file_test.cc
diff --git a/runtime/dex_file_tracking_registrar.cc b/runtime/dex/dex_file_tracking_registrar.cc
similarity index 98%
rename from runtime/dex_file_tracking_registrar.cc
rename to runtime/dex/dex_file_tracking_registrar.cc
index c157ddc..bffca55 100644
--- a/runtime/dex_file_tracking_registrar.cc
+++ b/runtime/dex/dex_file_tracking_registrar.cc
@@ -164,7 +164,7 @@
const DexFile::CodeItem* code_item = cdit.GetMethodCodeItem();
if (code_item != nullptr) {
const void* code_item_begin = reinterpret_cast<const void*>(code_item);
- size_t code_item_size = DexFile::GetCodeItemSize(*code_item);
+ size_t code_item_size = dex_file_->GetCodeItemSize(*code_item);
range_values_.push_back(std::make_tuple(code_item_begin, code_item_size, should_poison));
}
cdit.Next();
@@ -233,7 +233,7 @@
const DexFile::CodeItem* code_item = cdit.GetMethodCodeItem();
if (code_item != nullptr && strcmp(methodid_name, class_name) == 0) {
const void* code_item_begin = reinterpret_cast<const void*>(code_item);
- size_t code_item_size = DexFile::GetCodeItemSize(*code_item);
+ size_t code_item_size = dex_file_->GetCodeItemSize(*code_item);
range_values_.push_back(std::make_tuple(code_item_begin, code_item_size, should_poison));
}
cdit.Next();
diff --git a/runtime/dex_file_tracking_registrar.h b/runtime/dex/dex_file_tracking_registrar.h
similarity index 93%
rename from runtime/dex_file_tracking_registrar.h
rename to runtime/dex/dex_file_tracking_registrar.h
index 5c0e0f5..71b8ed7 100644
--- a/runtime/dex_file_tracking_registrar.h
+++ b/runtime/dex/dex_file_tracking_registrar.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_DEX_FILE_TRACKING_REGISTRAR_H_
-#define ART_RUNTIME_DEX_FILE_TRACKING_REGISTRAR_H_
+#ifndef ART_RUNTIME_DEX_DEX_FILE_TRACKING_REGISTRAR_H_
+#define ART_RUNTIME_DEX_DEX_FILE_TRACKING_REGISTRAR_H_
#include <deque>
#include <tuple>
@@ -78,4 +78,4 @@
} // namespace dex
} // namespace art
-#endif // ART_RUNTIME_DEX_FILE_TRACKING_REGISTRAR_H_
+#endif // ART_RUNTIME_DEX_DEX_FILE_TRACKING_REGISTRAR_H_
diff --git a/runtime/dex_file_types.h b/runtime/dex/dex_file_types.h
similarity index 95%
rename from runtime/dex_file_types.h
rename to runtime/dex/dex_file_types.h
index acca7c0..2c508f9 100644
--- a/runtime/dex_file_types.h
+++ b/runtime/dex/dex_file_types.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_DEX_FILE_TYPES_H_
-#define ART_RUNTIME_DEX_FILE_TYPES_H_
+#ifndef ART_RUNTIME_DEX_DEX_FILE_TYPES_H_
+#define ART_RUNTIME_DEX_DEX_FILE_TYPES_H_
#include <limits>
#include <ostream>
@@ -114,4 +114,4 @@
} // namespace std
-#endif // ART_RUNTIME_DEX_FILE_TYPES_H_
+#endif // ART_RUNTIME_DEX_DEX_FILE_TYPES_H_
diff --git a/runtime/dex_file_verifier.cc b/runtime/dex/dex_file_verifier.cc
similarity index 100%
rename from runtime/dex_file_verifier.cc
rename to runtime/dex/dex_file_verifier.cc
diff --git a/runtime/dex_file_verifier.h b/runtime/dex/dex_file_verifier.h
similarity index 98%
rename from runtime/dex_file_verifier.h
rename to runtime/dex/dex_file_verifier.h
index 23089fa..6cb5d4c 100644
--- a/runtime/dex_file_verifier.h
+++ b/runtime/dex/dex_file_verifier.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_DEX_FILE_VERIFIER_H_
-#define ART_RUNTIME_DEX_FILE_VERIFIER_H_
+#ifndef ART_RUNTIME_DEX_DEX_FILE_VERIFIER_H_
+#define ART_RUNTIME_DEX_DEX_FILE_VERIFIER_H_
#include <unordered_set>
@@ -254,4 +254,4 @@
} // namespace art
-#endif // ART_RUNTIME_DEX_FILE_VERIFIER_H_
+#endif // ART_RUNTIME_DEX_DEX_FILE_VERIFIER_H_
diff --git a/runtime/dex_file_verifier_test.cc b/runtime/dex/dex_file_verifier_test.cc
similarity index 100%
rename from runtime/dex_file_verifier_test.cc
rename to runtime/dex/dex_file_verifier_test.cc
diff --git a/runtime/dex_instruction-inl.h b/runtime/dex/dex_instruction-inl.h
similarity index 98%
rename from runtime/dex_instruction-inl.h
rename to runtime/dex/dex_instruction-inl.h
index f6ed1f0..a6b8414 100644
--- a/runtime/dex_instruction-inl.h
+++ b/runtime/dex/dex_instruction-inl.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_DEX_INSTRUCTION_INL_H_
-#define ART_RUNTIME_DEX_INSTRUCTION_INL_H_
+#ifndef ART_RUNTIME_DEX_DEX_INSTRUCTION_INL_H_
+#define ART_RUNTIME_DEX_DEX_INSTRUCTION_INL_H_
#include "dex_instruction.h"
@@ -555,4 +555,4 @@
} // namespace art
-#endif // ART_RUNTIME_DEX_INSTRUCTION_INL_H_
+#endif // ART_RUNTIME_DEX_DEX_INSTRUCTION_INL_H_
diff --git a/runtime/dex_instruction.cc b/runtime/dex/dex_instruction.cc
similarity index 100%
rename from runtime/dex_instruction.cc
rename to runtime/dex/dex_instruction.cc
diff --git a/runtime/dex_instruction.h b/runtime/dex/dex_instruction.h
similarity index 99%
rename from runtime/dex_instruction.h
rename to runtime/dex/dex_instruction.h
index 3ced692..8b1a5ce 100644
--- a/runtime/dex_instruction.h
+++ b/runtime/dex/dex_instruction.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_DEX_INSTRUCTION_H_
-#define ART_RUNTIME_DEX_INSTRUCTION_H_
+#ifndef ART_RUNTIME_DEX_DEX_INSTRUCTION_H_
+#define ART_RUNTIME_DEX_DEX_INSTRUCTION_H_
#include <android-base/logging.h>
@@ -739,4 +739,4 @@
} // namespace art
-#endif // ART_RUNTIME_DEX_INSTRUCTION_H_
+#endif // ART_RUNTIME_DEX_DEX_INSTRUCTION_H_
diff --git a/runtime/dex_instruction_iterator.h b/runtime/dex/dex_instruction_iterator.h
similarity index 97%
rename from runtime/dex_instruction_iterator.h
rename to runtime/dex/dex_instruction_iterator.h
index eabe009..c1b3118 100644
--- a/runtime/dex_instruction_iterator.h
+++ b/runtime/dex/dex_instruction_iterator.h
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_DEX_INSTRUCTION_ITERATOR_H_
-#define ART_RUNTIME_DEX_INSTRUCTION_ITERATOR_H_
+#ifndef ART_RUNTIME_DEX_DEX_INSTRUCTION_ITERATOR_H_
+#define ART_RUNTIME_DEX_DEX_INSTRUCTION_ITERATOR_H_
#include <iterator>
#include <android-base/logging.h>
-#include "dex_instruction.h"
#include "base/macros.h"
+#include "dex_instruction.h"
namespace art {
@@ -234,4 +234,4 @@
} // namespace art
-#endif // ART_RUNTIME_DEX_INSTRUCTION_ITERATOR_H_
+#endif // ART_RUNTIME_DEX_DEX_INSTRUCTION_ITERATOR_H_
diff --git a/runtime/dex_instruction_list.h b/runtime/dex/dex_instruction_list.h
similarity index 98%
rename from runtime/dex_instruction_list.h
rename to runtime/dex/dex_instruction_list.h
index ef83bdc..aa63fad 100644
--- a/runtime/dex_instruction_list.h
+++ b/runtime/dex/dex_instruction_list.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_DEX_INSTRUCTION_LIST_H_
-#define ART_RUNTIME_DEX_INSTRUCTION_LIST_H_
+#ifndef ART_RUNTIME_DEX_DEX_INSTRUCTION_LIST_H_
+#define ART_RUNTIME_DEX_DEX_INSTRUCTION_LIST_H_
// V(opcode, instruction_code, name, format, index, flags, extended_flags, verifier_flags);
#define DEX_INSTRUCTION_LIST(V) \
@@ -304,5 +304,5 @@
V(k4rcc) \
V(k51l)
-#endif // ART_RUNTIME_DEX_INSTRUCTION_LIST_H_
-#undef ART_RUNTIME_DEX_INSTRUCTION_LIST_H_ // the guard in this file is just for cpplint
+#endif // ART_RUNTIME_DEX_DEX_INSTRUCTION_LIST_H_
+#undef ART_RUNTIME_DEX_DEX_INSTRUCTION_LIST_H_ // the guard in this file is just for cpplint
diff --git a/runtime/dex_instruction_test.cc b/runtime/dex/dex_instruction_test.cc
similarity index 100%
rename from runtime/dex_instruction_test.cc
rename to runtime/dex/dex_instruction_test.cc
diff --git a/runtime/dex_instruction_utils.h b/runtime/dex/dex_instruction_utils.h
similarity index 97%
rename from runtime/dex_instruction_utils.h
rename to runtime/dex/dex_instruction_utils.h
index 72d8244..2750192 100644
--- a/runtime/dex_instruction_utils.h
+++ b/runtime/dex/dex_instruction_utils.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_DEX_INSTRUCTION_UTILS_H_
-#define ART_RUNTIME_DEX_INSTRUCTION_UTILS_H_
+#ifndef ART_RUNTIME_DEX_DEX_INSTRUCTION_UTILS_H_
+#define ART_RUNTIME_DEX_DEX_INSTRUCTION_UTILS_H_
#include "dex_instruction.h"
@@ -216,4 +216,4 @@
} // namespace art
-#endif // ART_RUNTIME_DEX_INSTRUCTION_UTILS_H_
+#endif // ART_RUNTIME_DEX_DEX_INSTRUCTION_UTILS_H_
diff --git a/runtime/standard_dex_file.cc b/runtime/dex/standard_dex_file.cc
similarity index 63%
rename from runtime/standard_dex_file.cc
rename to runtime/dex/standard_dex_file.cc
index b608341..843508d 100644
--- a/runtime/standard_dex_file.cc
+++ b/runtime/dex/standard_dex_file.cc
@@ -16,6 +16,10 @@
#include "standard_dex_file.h"
+#include "base/casts.h"
+#include "dex_file-inl.h"
+#include "leb128.h"
+
namespace art {
const uint8_t StandardDexFile::kDexMagic[] = { 'd', 'e', 'x', '\n' };
@@ -67,4 +71,35 @@
return GetDexVersion() >= DexFile::kDefaultMethodsVersion;
}
+uint32_t StandardDexFile::GetCodeItemSize(const DexFile::CodeItem& item) const {
+ DCHECK(HasAddress(&item));
+ const CodeItem& code_item = down_cast<const CodeItem&>(item);
+ uintptr_t code_item_start = reinterpret_cast<uintptr_t>(&code_item);
+ uint32_t insns_size = code_item.insns_size_in_code_units_;
+ uint32_t tries_size = code_item.tries_size_;
+ const uint8_t* handler_data = GetCatchHandlerData(
+ DexInstructionIterator(code_item.insns_, code_item.insns_size_in_code_units_),
+ code_item.tries_size_,
+ 0);
+
+ if (tries_size == 0 || handler_data == nullptr) {
+ uintptr_t insns_end = reinterpret_cast<uintptr_t>(&code_item.insns_[insns_size]);
+ return insns_end - code_item_start;
+ } else {
+ // Get the start of the handler data.
+ uint32_t handlers_size = DecodeUnsignedLeb128(&handler_data);
+ // Manually read each handler.
+ for (uint32_t i = 0; i < handlers_size; ++i) {
+ int32_t uleb128_count = DecodeSignedLeb128(&handler_data) * 2;
+ if (uleb128_count <= 0) {
+ uleb128_count = -uleb128_count + 1;
+ }
+ for (int32_t j = 0; j < uleb128_count; ++j) {
+ DecodeUnsignedLeb128(&handler_data);
+ }
+ }
+ return reinterpret_cast<uintptr_t>(handler_data) - code_item_start;
+ }
+}
+
} // namespace art
diff --git a/runtime/standard_dex_file.h b/runtime/dex/standard_dex_file.h
similarity index 90%
rename from runtime/standard_dex_file.h
rename to runtime/dex/standard_dex_file.h
index 80c406e..fb2f720 100644
--- a/runtime/standard_dex_file.h
+++ b/runtime/dex/standard_dex_file.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_STANDARD_DEX_FILE_H_
-#define ART_RUNTIME_STANDARD_DEX_FILE_H_
+#ifndef ART_RUNTIME_DEX_STANDARD_DEX_FILE_H_
+#define ART_RUNTIME_DEX_STANDARD_DEX_FILE_H_
#include <iosfwd>
@@ -35,6 +35,7 @@
struct CodeItem : public DexFile::CodeItem {
private:
// TODO: Insert standard dex specific fields here.
+ friend class StandardDexFile;
DISALLOW_COPY_AND_ASSIGN(CodeItem);
};
@@ -58,6 +59,8 @@
virtual bool SupportsDefaultMethods() const OVERRIDE;
+ uint32_t GetCodeItemSize(const DexFile::CodeItem& item) const OVERRIDE;
+
private:
StandardDexFile(const uint8_t* base,
size_t size,
@@ -83,4 +86,4 @@
} // namespace art
-#endif // ART_RUNTIME_STANDARD_DEX_FILE_H_
+#endif // ART_RUNTIME_DEX_STANDARD_DEX_FILE_H_
diff --git a/runtime/dex2oat_environment_test.h b/runtime/dex2oat_environment_test.h
index 5f9b3cf..e459f09 100644
--- a/runtime/dex2oat_environment_test.h
+++ b/runtime/dex2oat_environment_test.h
@@ -27,7 +27,7 @@
#include "base/stl_util.h"
#include "common_runtime_test.h"
#include "compiler_callbacks.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file_loader.h"
#include "exec_utils.h"
#include "gc/heap.h"
#include "gc/space/image_space.h"
diff --git a/runtime/dex_cache_resolved_classes.h b/runtime/dex_cache_resolved_classes.h
index 2278b05..ca6afc5 100644
--- a/runtime/dex_cache_resolved_classes.h
+++ b/runtime/dex_cache_resolved_classes.h
@@ -21,7 +21,7 @@
#include <unordered_set>
#include <vector>
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
namespace art {
diff --git a/runtime/dex_to_dex_decompiler.cc b/runtime/dex_to_dex_decompiler.cc
index dc7e11b..f3f2d52 100644
--- a/runtime/dex_to_dex_decompiler.cc
+++ b/runtime/dex_to_dex_decompiler.cc
@@ -21,9 +21,9 @@
#include "base/macros.h"
#include "base/mutex.h"
#include "bytecode_utils.h"
-#include "code_item_accessors-inl.h"
-#include "dex_file-inl.h"
-#include "dex_instruction-inl.h"
+#include "dex/code_item_accessors-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_instruction-inl.h"
#include "quicken_info.h"
namespace art {
@@ -31,11 +31,11 @@
class DexDecompiler {
public:
- DexDecompiler(const DexFile* dex_file,
+ DexDecompiler(const DexFile& dex_file,
const DexFile::CodeItem& code_item,
const ArrayRef<const uint8_t>& quickened_info,
bool decompile_return_instruction)
- : code_item_accessor_(dex_file, &code_item),
+ : code_item_accessor_(&dex_file, &code_item),
quicken_info_(quickened_info.data()),
quicken_info_number_of_indices_(QuickenInfoTable::NumberOfIndices(quickened_info.size())),
decompile_return_instruction_(decompile_return_instruction) {}
@@ -196,7 +196,7 @@
return true;
}
-bool ArtDecompileDEX(const DexFile* dex_file,
+bool ArtDecompileDEX(const DexFile& dex_file,
const DexFile::CodeItem& code_item,
const ArrayRef<const uint8_t>& quickened_info,
bool decompile_return_instruction) {
diff --git a/runtime/dex_to_dex_decompiler.h b/runtime/dex_to_dex_decompiler.h
index 804b7e8..93711d1 100644
--- a/runtime/dex_to_dex_decompiler.h
+++ b/runtime/dex_to_dex_decompiler.h
@@ -18,7 +18,7 @@
#define ART_RUNTIME_DEX_TO_DEX_DECOMPILER_H_
#include "base/array_ref.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
namespace art {
namespace optimizer {
@@ -29,7 +29,7 @@
// to non-const has too many repercussions on the code base. We make it
// consistent with DexToDexCompiler, but we should really change it to
// DexFile::CodeItem*.
-bool ArtDecompileDEX(const DexFile* dex_file,
+bool ArtDecompileDEX(const DexFile& dex_file,
const DexFile::CodeItem& code_item,
const ArrayRef<const uint8_t>& quickened_data,
bool decompile_return_instruction);
diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h
index 9e50850..3048f45 100644
--- a/runtime/entrypoints/entrypoint_utils-inl.h
+++ b/runtime/entrypoints/entrypoint_utils-inl.h
@@ -24,7 +24,7 @@
#include "base/enums.h"
#include "class_linker-inl.h"
#include "common_throws.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "entrypoints/quick/callee_save_frame.h"
#include "handle_scope-inl.h"
#include "imt_conflict_table.h"
diff --git a/runtime/entrypoints/entrypoint_utils.cc b/runtime/entrypoints/entrypoint_utils.cc
index f3450da..ffa138d 100644
--- a/runtime/entrypoints/entrypoint_utils.cc
+++ b/runtime/entrypoints/entrypoint_utils.cc
@@ -21,7 +21,7 @@
#include "base/enums.h"
#include "base/mutex.h"
#include "class_linker-inl.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "entrypoints/entrypoint_utils-inl.h"
#include "entrypoints/quick/callee_save_frame.h"
#include "entrypoints/runtime_asm_entrypoints.h"
diff --git a/runtime/entrypoints/entrypoint_utils.h b/runtime/entrypoints/entrypoint_utils.h
index 830ef84..eb32153 100644
--- a/runtime/entrypoints/entrypoint_utils.h
+++ b/runtime/entrypoints/entrypoint_utils.h
@@ -23,8 +23,8 @@
#include "base/callee_save_type.h"
#include "base/macros.h"
#include "base/mutex.h"
-#include "dex_file_types.h"
-#include "dex_instruction.h"
+#include "dex/dex_file_types.h"
+#include "dex/dex_instruction.h"
#include "gc/allocator_type.h"
#include "handle.h"
#include "jvalue.h"
diff --git a/runtime/entrypoints/quick/quick_alloc_entrypoints.cc b/runtime/entrypoints/quick/quick_alloc_entrypoints.cc
index b8d96af..1ab67ec 100644
--- a/runtime/entrypoints/quick/quick_alloc_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_alloc_entrypoints.cc
@@ -19,7 +19,7 @@
#include "art_method-inl.h"
#include "base/enums.h"
#include "callee_save_frame.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "entrypoints/entrypoint_utils-inl.h"
#include "mirror/class-inl.h"
#include "mirror/object-inl.h"
diff --git a/runtime/entrypoints/quick/quick_dexcache_entrypoints.cc b/runtime/entrypoints/quick/quick_dexcache_entrypoints.cc
index 9837838..cfb427f 100644
--- a/runtime/entrypoints/quick/quick_dexcache_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_dexcache_entrypoints.cc
@@ -19,8 +19,8 @@
#include "callee_save_frame.h"
#include "class_linker-inl.h"
#include "class_table-inl.h"
-#include "dex_file-inl.h"
-#include "dex_file_types.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_types.h"
#include "entrypoints/entrypoint_utils-inl.h"
#include "gc/heap.h"
#include "mirror/class-inl.h"
diff --git a/runtime/entrypoints/quick/quick_field_entrypoints.cc b/runtime/entrypoints/quick/quick_field_entrypoints.cc
index b13103d..62cc9de 100644
--- a/runtime/entrypoints/quick/quick_field_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_field_entrypoints.cc
@@ -20,7 +20,7 @@
#include "art_method-inl.h"
#include "base/callee_save_type.h"
#include "callee_save_frame.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "entrypoints/entrypoint_utils-inl.h"
#include "gc_root-inl.h"
#include "mirror/class-inl.h"
@@ -68,6 +68,11 @@
return GetCalleeSaveMethodCallerAndOuterMethod(self, CalleeSaveType::kSaveRefsOnly).caller;
}
+// Macro used to define this set of functions:
+//
+// art{Get,Set}<Kind>{Static,Instance}FromCode
+// art{Get,Set}<Kind>{Static,Instance}FromCompiledCode
+//
#define ART_GET_FIELD_FROM_CODE(Kind, PrimitiveType, RetType, SetType, \
PrimitiveOrObject, IsObject, Ptr) \
extern "C" RetType artGet ## Kind ## StaticFromCode(uint32_t field_idx, \
@@ -216,15 +221,100 @@
field_idx, obj, new_value, GetReferrer(self), self); \
}
+// Define these functions:
+//
+// artGetByteStaticFromCode
+// artGetByteInstanceFromCode
+// artSetByteStaticFromCode
+// artSetByteInstanceFromCode
+// artGetByteStaticFromCompiledCode
+// artGetByteInstanceFromCompiledCode
+// artSetByteStaticFromCompiledCode
+// artSetByteInstanceFromCompiledCode
+//
ART_GET_FIELD_FROM_CODE(Byte, int8_t, ssize_t, uint32_t, Primitive, false, )
+
+// Define these functions:
+//
+// artGetBooleanStaticFromCode
+// artGetBooleanInstanceFromCode
+// artSetBooleanStaticFromCode
+// artSetBooleanInstanceFromCode
+// artGetBooleanStaticFromCompiledCode
+// artGetBooleanInstanceFromCompiledCode
+// artSetBooleanStaticFromCompiledCode
+// artSetBooleanInstanceFromCompiledCode
+//
ART_GET_FIELD_FROM_CODE(Boolean, int8_t, size_t, uint32_t, Primitive, false, )
+
+// Define these functions:
+//
+// artGetShortStaticFromCode
+// artGetShortInstanceFromCode
+// artSetShortStaticFromCode
+// artSetShortInstanceFromCode
+// artGetShortStaticFromCompiledCode
+// artGetShortInstanceFromCompiledCode
+// artSetShortStaticFromCompiledCode
+// artSetShortInstanceFromCompiledCode
+//
ART_GET_FIELD_FROM_CODE(Short, int16_t, ssize_t, uint16_t, Primitive, false, )
+
+// Define these functions:
+//
+// artGetCharStaticFromCode
+// artGetCharInstanceFromCode
+// artSetCharStaticFromCode
+// artSetCharInstanceFromCode
+// artGetCharStaticFromCompiledCode
+// artGetCharInstanceFromCompiledCode
+// artSetCharStaticFromCompiledCode
+// artSetCharInstanceFromCompiledCode
+//
ART_GET_FIELD_FROM_CODE(Char, int16_t, size_t, uint16_t, Primitive, false, )
+
+// Define these functions:
+//
+// artGet32StaticFromCode
+// artGet32InstanceFromCode
+// artSet32StaticFromCode
+// artSet32InstanceFromCode
+// artGet32StaticFromCompiledCode
+// artGet32InstanceFromCompiledCode
+// artSet32StaticFromCompiledCode
+// artSet32InstanceFromCompiledCode
+//
ART_GET_FIELD_FROM_CODE(32, int32_t, size_t, uint32_t, Primitive, false, )
+
+// Define these functions:
+//
+// artGet64StaticFromCode
+// artGet64InstanceFromCode
+// artSet64StaticFromCode
+// artSet64InstanceFromCode
+// artGet64StaticFromCompiledCode
+// artGet64InstanceFromCompiledCode
+// artSet64StaticFromCompiledCode
+// artSet64InstanceFromCompiledCode
+//
ART_GET_FIELD_FROM_CODE(64, int64_t, uint64_t, uint64_t, Primitive, false, )
+
+// Define these functions:
+//
+// artGetObjStaticFromCode
+// artGetObjInstanceFromCode
+// artSetObjStaticFromCode
+// artSetObjInstanceFromCode
+// artGetObjStaticFromCompiledCode
+// artGetObjInstanceFromCompiledCode
+// artSetObjStaticFromCompiledCode
+// artSetObjInstanceFromCompiledCode
+//
ART_GET_FIELD_FROM_CODE(Obj, mirror::HeapReference<mirror::Object>, mirror::Object*,
mirror::Object*, Object, true, .Ptr())
+#undef ART_GET_FIELD_FROM_CODE
+
// To cut on the number of entrypoints, we have shared entries for
// byte/boolean and char/short for setting an instance or static field. We just
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index 7192058..f727690 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -20,9 +20,9 @@
#include "callee_save_frame.h"
#include "common_throws.h"
#include "debugger.h"
-#include "dex_file-inl.h"
-#include "dex_file_types.h"
-#include "dex_instruction-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_types.h"
+#include "dex/dex_instruction-inl.h"
#include "entrypoints/entrypoint_utils-inl.h"
#include "entrypoints/runtime_asm_entrypoints.h"
#include "gc/accounting/card_table-inl.h"
diff --git a/runtime/fault_handler.cc b/runtime/fault_handler.cc
index f66836f..49c2a15 100644
--- a/runtime/fault_handler.cc
+++ b/runtime/fault_handler.cc
@@ -24,7 +24,7 @@
#include "base/logging.h" // For VLOG
#include "base/safe_copy.h"
#include "base/stl_util.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "mirror/class.h"
#include "mirror/object_reference.h"
#include "oat_quick_method_header.h"
diff --git a/runtime/gc/accounting/space_bitmap.cc b/runtime/gc/accounting/space_bitmap.cc
index 280c0b1..237ee80 100644
--- a/runtime/gc/accounting/space_bitmap.cc
+++ b/runtime/gc/accounting/space_bitmap.cc
@@ -19,7 +19,7 @@
#include "android-base/stringprintf.h"
#include "art_field-inl.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "mem_map.h"
#include "mirror/class-inl.h"
#include "mirror/object-inl.h"
diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc
index e1055f2..cf83716 100644
--- a/runtime/gc/collector/concurrent_copying.cc
+++ b/runtime/gc/collector/concurrent_copying.cc
@@ -88,6 +88,7 @@
from_space_num_bytes_at_first_pause_(0),
mark_stack_mode_(kMarkStackModeOff),
weak_ref_access_enabled_(true),
+ max_peak_num_non_free_regions_(0),
skipped_blocks_lock_("concurrent copying bytes blocks lock", kMarkSweepMarkStackLock),
measure_read_barrier_slow_path_(measure_read_barrier_slow_path),
mark_from_read_barrier_measurements_(false),
@@ -1754,6 +1755,8 @@
cumulative_bytes_moved_.FetchAndAddRelaxed(to_bytes);
uint64_t to_objects = objects_moved_.LoadSequentiallyConsistent();
cumulative_objects_moved_.FetchAndAddRelaxed(to_objects);
+ max_peak_num_non_free_regions_ = std::max(max_peak_num_non_free_regions_,
+ region_space_->GetNumNonFreeRegions());
if (kEnableFromSpaceAccountingCheck) {
CHECK_EQ(from_space_num_objects_at_first_pause_, from_objects + unevac_from_objects);
CHECK_EQ(from_space_num_bytes_at_first_pause_, from_bytes + unevac_from_bytes);
@@ -2691,6 +2694,13 @@
}
os << "Cumulative bytes moved " << cumulative_bytes_moved_.LoadRelaxed() << "\n";
os << "Cumulative objects moved " << cumulative_objects_moved_.LoadRelaxed() << "\n";
+
+ os << "Peak regions allocated "
+ << max_peak_num_non_free_regions_ << " ("
+ << PrettySize(max_peak_num_non_free_regions_ * space::RegionSpace::kRegionSize)
+ << ") / " << region_space_->GetNumRegions() << " ("
+ << PrettySize(region_space_->GetNumRegions() * space::RegionSpace::kRegionSize)
+ << ")\n";
}
} // namespace collector
diff --git a/runtime/gc/collector/concurrent_copying.h b/runtime/gc/collector/concurrent_copying.h
index 8b4b58e..939e7fc 100644
--- a/runtime/gc/collector/concurrent_copying.h
+++ b/runtime/gc/collector/concurrent_copying.h
@@ -308,6 +308,11 @@
Atomic<uint64_t> cumulative_bytes_moved_;
Atomic<uint64_t> cumulative_objects_moved_;
+ // Maintain the maximum of number of non-free regions collected just before
+ // reclaim in each GC cycle. At this moment in cycle, highest number of
+ // regions are in non-free.
+ size_t max_peak_num_non_free_regions_;
+
// The skipped blocks are memory blocks/chucks that were copies of
// objects that were unused due to lost races (cas failures) at
// object copy/forward pointer install. They are reused.
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index d2df833..9edba96 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -38,7 +38,7 @@
#include "common_throws.h"
#include "cutils/sched_policy.h"
#include "debugger.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "entrypoints/quick/quick_alloc_entrypoints.h"
#include "gc/accounting/card_table-inl.h"
#include "gc/accounting/heap_bitmap-inl.h"
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index bcfc68c..251d94c 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -36,7 +36,7 @@
#include "base/stl_util.h"
#include "base/systrace.h"
#include "base/time_utils.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file_loader.h"
#include "exec_utils.h"
#include "gc/accounting/space_bitmap-inl.h"
#include "image-inl.h"
diff --git a/runtime/gc/space/region_space.h b/runtime/gc/space/region_space.h
index 77d76fb..c9c9136 100644
--- a/runtime/gc/space/region_space.h
+++ b/runtime/gc/space/region_space.h
@@ -138,6 +138,13 @@
uint64_t GetObjectsAllocatedInUnevacFromSpace() REQUIRES(!region_lock_) {
return GetObjectsAllocatedInternal<RegionType::kRegionTypeUnevacFromSpace>();
}
+ // It is OK to do a racy read here as it's only for performance dump.
+ size_t GetNumNonFreeRegions() const {
+ return num_non_free_regions_;
+ }
+ size_t GetNumRegions() const {
+ return num_regions_;
+ }
bool CanMoveObjects() const OVERRIDE {
return true;
diff --git a/runtime/generated/asm_support_gen.h b/runtime/generated/asm_support_gen.h
index e158212..46630db 100644
--- a/runtime/generated/asm_support_gen.h
+++ b/runtime/generated/asm_support_gen.h
@@ -54,8 +54,6 @@
DEFINE_CHECK_EQ(static_cast<int32_t>(MIRROR_OBJECT_CLASS_OFFSET), (static_cast<int32_t>(art::mirror::Object::ClassOffset().Int32Value())))
#define MIRROR_OBJECT_LOCK_WORD_OFFSET 4
DEFINE_CHECK_EQ(static_cast<int32_t>(MIRROR_OBJECT_LOCK_WORD_OFFSET), (static_cast<int32_t>(art::mirror::Object::MonitorOffset().Int32Value())))
-#define MIRROR_CLASS_STATUS_INITIALIZED 0xb
-DEFINE_CHECK_EQ(static_cast<uint32_t>(MIRROR_CLASS_STATUS_INITIALIZED), (static_cast<uint32_t>((art::mirror::Class::kStatusInitialized))))
#define ACCESS_FLAGS_CLASS_IS_FINALIZABLE 0x80000000
DEFINE_CHECK_EQ(static_cast<uint32_t>(ACCESS_FLAGS_CLASS_IS_FINALIZABLE), (static_cast<uint32_t>((art::kAccClassIsFinalizable))))
#define ACCESS_FLAGS_CLASS_IS_INTERFACE 0x200
diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc
index f4fc85b..ea8a684 100644
--- a/runtime/hprof/hprof.cc
+++ b/runtime/hprof/hprof.cc
@@ -48,7 +48,7 @@
#include "class_linker.h"
#include "common_throws.h"
#include "debugger.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "gc/accounting/heap_bitmap.h"
#include "gc/allocation_record.h"
#include "gc/heap-visit-objects-inl.h"
diff --git a/runtime/image.cc b/runtime/image.cc
index 8f35d84..b9d955c 100644
--- a/runtime/image.cc
+++ b/runtime/image.cc
@@ -26,7 +26,7 @@
namespace art {
const uint8_t ImageHeader::kImageMagic[] = { 'a', 'r', 't', '\n' };
-const uint8_t ImageHeader::kImageVersion[] = { '0', '5', '1', '\0' }; // @FastNative access flags.
+const uint8_t ImageHeader::kImageVersion[] = { '0', '5', '2', '\0' }; // 4-bit ClassStatus.
ImageHeader::ImageHeader(uint32_t image_begin,
uint32_t image_size,
diff --git a/runtime/imtable-inl.h b/runtime/imtable-inl.h
index cb85fa6..6237cca 100644
--- a/runtime/imtable-inl.h
+++ b/runtime/imtable-inl.h
@@ -20,7 +20,7 @@
#include "imtable.h"
#include "art_method-inl.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "utf.h"
namespace art {
diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc
index a4ee21d..4524448 100644
--- a/runtime/instrumentation.cc
+++ b/runtime/instrumentation.cc
@@ -25,9 +25,9 @@
#include "base/callee_save_type.h"
#include "class_linker.h"
#include "debugger.h"
-#include "dex_file-inl.h"
-#include "dex_file_types.h"
-#include "dex_instruction-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_types.h"
+#include "dex/dex_instruction-inl.h"
#include "entrypoints/quick/quick_alloc_entrypoints.h"
#include "entrypoints/quick/quick_entrypoints.h"
#include "entrypoints/runtime_asm_entrypoints.h"
diff --git a/runtime/instrumentation_test.cc b/runtime/instrumentation_test.cc
index 89baa35..836bbe7 100644
--- a/runtime/instrumentation_test.cc
+++ b/runtime/instrumentation_test.cc
@@ -21,7 +21,7 @@
#include "class_linker-inl.h"
#include "common_runtime_test.h"
#include "common_throws.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "gc/scoped_gc_critical_section.h"
#include "handle_scope-inl.h"
#include "jni_internal.h"
diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc
index 9b81819..54db872 100644
--- a/runtime/interpreter/interpreter.cc
+++ b/runtime/interpreter/interpreter.cc
@@ -20,7 +20,7 @@
#include "common_dex_operations.h"
#include "common_throws.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "interpreter_common.h"
#include "interpreter_mterp_impl.h"
#include "interpreter_switch_impl.h"
diff --git a/runtime/interpreter/interpreter.h b/runtime/interpreter/interpreter.h
index f9d7774..0d43b90 100644
--- a/runtime/interpreter/interpreter.h
+++ b/runtime/interpreter/interpreter.h
@@ -18,7 +18,7 @@
#define ART_RUNTIME_INTERPRETER_INTERPRETER_H_
#include "base/mutex.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "obj_ptr.h"
namespace art {
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc
index deed16b..475f938 100644
--- a/runtime/interpreter/interpreter_common.cc
+++ b/runtime/interpreter/interpreter_common.cc
@@ -20,7 +20,7 @@
#include "base/enums.h"
#include "debugger.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "entrypoints/runtime_asm_entrypoints.h"
#include "intrinsics_enum.h"
#include "jit/jit.h"
diff --git a/runtime/interpreter/interpreter_common.h b/runtime/interpreter/interpreter_common.h
index 269b013..8180222 100644
--- a/runtime/interpreter/interpreter_common.h
+++ b/runtime/interpreter/interpreter_common.h
@@ -37,8 +37,8 @@
#include "class_linker-inl.h"
#include "common_dex_operations.h"
#include "common_throws.h"
-#include "dex_file-inl.h"
-#include "dex_instruction-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_instruction-inl.h"
#include "entrypoints/entrypoint_utils-inl.h"
#include "handle_scope-inl.h"
#include "jit/jit.h"
diff --git a/runtime/interpreter/interpreter_intrinsics.cc b/runtime/interpreter/interpreter_intrinsics.cc
index 37593bc..99a4f76 100644
--- a/runtime/interpreter/interpreter_intrinsics.cc
+++ b/runtime/interpreter/interpreter_intrinsics.cc
@@ -16,7 +16,7 @@
#include "interpreter/interpreter_intrinsics.h"
-#include "dex_instruction.h"
+#include "dex/dex_instruction.h"
#include "intrinsics_enum.h"
#include "interpreter/interpreter_common.h"
diff --git a/runtime/interpreter/interpreter_mterp_impl.h b/runtime/interpreter/interpreter_mterp_impl.h
index 7aa5a34..d8a764f 100644
--- a/runtime/interpreter/interpreter_mterp_impl.h
+++ b/runtime/interpreter/interpreter_mterp_impl.h
@@ -19,7 +19,7 @@
#include "base/macros.h"
#include "base/mutex.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "jvalue.h"
#include "obj_ptr.h"
diff --git a/runtime/interpreter/interpreter_switch_impl.cc b/runtime/interpreter/interpreter_switch_impl.cc
index 81c1e1d..6f9cad8 100644
--- a/runtime/interpreter/interpreter_switch_impl.cc
+++ b/runtime/interpreter/interpreter_switch_impl.cc
@@ -17,7 +17,7 @@
#include "interpreter_switch_impl.h"
#include "base/enums.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "experimental_flags.h"
#include "interpreter_common.h"
#include "jit/jit.h"
diff --git a/runtime/interpreter/interpreter_switch_impl.h b/runtime/interpreter/interpreter_switch_impl.h
index aa0f854..50db337 100644
--- a/runtime/interpreter/interpreter_switch_impl.h
+++ b/runtime/interpreter/interpreter_switch_impl.h
@@ -19,7 +19,7 @@
#include "base/macros.h"
#include "base/mutex.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "jvalue.h"
#include "obj_ptr.h"
diff --git a/runtime/interpreter/shadow_frame.h b/runtime/interpreter/shadow_frame.h
index be2c943..d5451ff 100644
--- a/runtime/interpreter/shadow_frame.h
+++ b/runtime/interpreter/shadow_frame.h
@@ -23,7 +23,7 @@
#include "base/macros.h"
#include "base/mutex.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "lock_count_data.h"
#include "read_barrier.h"
#include "stack_reference.h"
diff --git a/runtime/interpreter/unstarted_runtime.h b/runtime/interpreter/unstarted_runtime.h
index 2e86dea..b38c685 100644
--- a/runtime/interpreter/unstarted_runtime.h
+++ b/runtime/interpreter/unstarted_runtime.h
@@ -19,7 +19,7 @@
#include "interpreter.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "jvalue.h"
namespace art {
diff --git a/runtime/interpreter/unstarted_runtime_test.cc b/runtime/interpreter/unstarted_runtime_test.cc
index 9db5f88..0986005 100644
--- a/runtime/interpreter/unstarted_runtime_test.cc
+++ b/runtime/interpreter/unstarted_runtime_test.cc
@@ -24,7 +24,7 @@
#include "base/memory_tool.h"
#include "class_linker.h"
#include "common_runtime_test.h"
-#include "dex_instruction.h"
+#include "dex/dex_instruction.h"
#include "handle.h"
#include "handle_scope-inl.h"
#include "interpreter/interpreter_common.h"
diff --git a/runtime/java_vm_ext.cc b/runtime/java_vm_ext.cc
index e159436..da4c4b2 100644
--- a/runtime/java_vm_ext.cc
+++ b/runtime/java_vm_ext.cc
@@ -26,7 +26,7 @@
#include "base/stl_util.h"
#include "base/systrace.h"
#include "check_jni.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "fault_handler.h"
#include "gc/allocation_record.h"
#include "gc/heap.h"
@@ -48,6 +48,7 @@
#include "thread-inl.h"
#include "thread_list.h"
#include "ti/agent.h"
+#include "well_known_classes.h"
namespace art {
@@ -853,7 +854,6 @@
bool JavaVMExt::LoadNativeLibrary(JNIEnv* env,
const std::string& path,
jobject class_loader,
- jstring library_path,
std::string* error_msg) {
error_msg->clear();
@@ -950,6 +950,9 @@
// class unloading. Libraries will only be unloaded when the reference count (incremented by
// dlopen) becomes zero from dlclose.
+ // Retrieve the library path from the classloader, if necessary.
+ ScopedLocalRef<jstring> library_path(env, GetLibrarySearchPath(env, class_loader));
+
Locks::mutator_lock_->AssertNotHeld(self);
const char* path_str = path.empty() ? nullptr : path.c_str();
bool needs_native_bridge = false;
@@ -957,7 +960,7 @@
runtime_->GetTargetSdkVersion(),
path_str,
class_loader,
- library_path,
+ library_path.get(),
&needs_native_bridge,
error_msg);
@@ -1119,6 +1122,18 @@
// The weak_globals table is visited by the GC itself (because it mutates the table).
}
+jstring JavaVMExt::GetLibrarySearchPath(JNIEnv* env, jobject class_loader) {
+ if (class_loader == nullptr) {
+ return nullptr;
+ }
+ if (!env->IsInstanceOf(class_loader, WellKnownClasses::dalvik_system_BaseDexClassLoader)) {
+ return nullptr;
+ }
+ return reinterpret_cast<jstring>(env->CallObjectMethod(
+ class_loader,
+ WellKnownClasses::dalvik_system_BaseDexClassLoader_getLdLibraryPath));
+}
+
// JNI Invocation interface.
extern "C" jint JNI_CreateJavaVM(JavaVM** p_vm, JNIEnv** p_env, void* vm_args) {
diff --git a/runtime/java_vm_ext.h b/runtime/java_vm_ext.h
index 7c2755f..8c81c25 100644
--- a/runtime/java_vm_ext.h
+++ b/runtime/java_vm_ext.h
@@ -101,7 +101,6 @@
bool LoadNativeLibrary(JNIEnv* env,
const std::string& path,
jobject class_loader,
- jstring library_path,
std::string* error_msg);
// Unload native libraries with cleared class loaders.
@@ -200,6 +199,11 @@
static bool IsBadJniVersion(int version);
+ // Return the library search path for the given classloader, if the classloader is of a
+ // well-known type. The jobject will be a local reference and is expected to be managed by the
+ // caller.
+ static jstring GetLibrarySearchPath(JNIEnv* env, jobject class_loader);
+
private:
// The constructor should not be called directly. It may leave the object in
// an erroneous state, and the result needs to be checked.
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index 6f03a68..659c55a 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -27,7 +27,7 @@
#include "base/time_utils.h"
#include "cha.h"
#include "debugger_interface.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file_loader.h"
#include "entrypoints/runtime_asm_entrypoints.h"
#include "gc/accounting/bitmap-inl.h"
#include "gc/scoped_gc_critical_section.h"
diff --git a/runtime/jit/profile_compilation_info.cc b/runtime/jit/profile_compilation_info.cc
index 7754777..74bf237 100644
--- a/runtime/jit/profile_compilation_info.cc
+++ b/runtime/jit/profile_compilation_info.cc
@@ -42,7 +42,7 @@
#include "base/systrace.h"
#include "base/time_utils.h"
#include "base/unix_file/fd_file.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file_loader.h"
#include "jit/profiling_info.h"
#include "os.h"
#include "safe_map.h"
diff --git a/runtime/jit/profile_compilation_info.h b/runtime/jit/profile_compilation_info.h
index 8dbb43f..7c30dee 100644
--- a/runtime/jit/profile_compilation_info.h
+++ b/runtime/jit/profile_compilation_info.h
@@ -25,8 +25,8 @@
#include "base/arena_object.h"
#include "bit_memory_region.h"
#include "dex_cache_resolved_classes.h"
-#include "dex_file.h"
-#include "dex_file_types.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_types.h"
#include "method_reference.h"
#include "safe_map.h"
#include "type_reference.h"
diff --git a/runtime/jit/profile_compilation_info_test.cc b/runtime/jit/profile_compilation_info_test.cc
index f155d7e..08042cc 100644
--- a/runtime/jit/profile_compilation_info_test.cc
+++ b/runtime/jit/profile_compilation_info_test.cc
@@ -20,7 +20,7 @@
#include "base/unix_file/fd_file.h"
#include "class_linker-inl.h"
#include "common_runtime_test.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "handle_scope-inl.h"
#include "jit/profile_compilation_info.h"
#include "linear_alloc.h"
diff --git a/runtime/jit/profile_saver.cc b/runtime/jit/profile_saver.cc
index ee11cfd..8f0ac33 100644
--- a/runtime/jit/profile_saver.cc
+++ b/runtime/jit/profile_saver.cc
@@ -32,7 +32,7 @@
#include "base/time_utils.h"
#include "class_table-inl.h"
#include "compiler_filter.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file_loader.h"
#include "dex_reference_collection.h"
#include "gc/collector_type.h"
#include "gc/gc_cause.h"
diff --git a/runtime/jit/profiling_info.cc b/runtime/jit/profiling_info.cc
index 01481d1..9126bea 100644
--- a/runtime/jit/profiling_info.cc
+++ b/runtime/jit/profiling_info.cc
@@ -17,7 +17,7 @@
#include "profiling_info.h"
#include "art_method-inl.h"
-#include "dex_instruction.h"
+#include "dex/dex_instruction.h"
#include "jit/jit.h"
#include "jit/jit_code_cache.h"
#include "scoped_thread_state_change-inl.h"
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index 53ae628..b8e6ebe 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -32,7 +32,7 @@
#include "base/mutex.h"
#include "base/stl_util.h"
#include "class_linker-inl.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "fault_handler.h"
#include "gc/accounting/card_table-inl.h"
#include "gc_root.h"
diff --git a/runtime/method_handles-inl.h b/runtime/method_handles-inl.h
index 08b8ad9..2bc71f4 100644
--- a/runtime/method_handles-inl.h
+++ b/runtime/method_handles-inl.h
@@ -20,7 +20,7 @@
#include "method_handles.h"
#include "common_throws.h"
-#include "dex_instruction.h"
+#include "dex/dex_instruction.h"
#include "interpreter/interpreter_common.h"
#include "jvalue.h"
#include "mirror/class.h"
diff --git a/runtime/method_handles.h b/runtime/method_handles.h
index bc74bf2..6ffd1a8 100644
--- a/runtime/method_handles.h
+++ b/runtime/method_handles.h
@@ -19,7 +19,7 @@
#include <ostream>
-#include "dex_instruction.h"
+#include "dex/dex_instruction.h"
#include "handle.h"
#include "interpreter/shadow_frame.h"
#include "jvalue.h"
diff --git a/runtime/method_reference.h b/runtime/method_reference.h
index 31f3b8e..50b6d6e 100644
--- a/runtime/method_reference.h
+++ b/runtime/method_reference.h
@@ -19,8 +19,8 @@
#include <stdint.h>
#include <string>
-#include "dex_file.h"
-#include "dex_file_reference.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_reference.h"
namespace art {
diff --git a/runtime/mirror/array.cc b/runtime/mirror/array.cc
index 6218dd9..25283bc 100644
--- a/runtime/mirror/array.cc
+++ b/runtime/mirror/array.cc
@@ -20,7 +20,7 @@
#include "class.h"
#include "class_linker-inl.h"
#include "common_throws.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "gc/accounting/card_table-inl.h"
#include "handle_scope-inl.h"
#include "object-inl.h"
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index b4f5d81..302a5e6 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -27,7 +27,7 @@
#include "class_loader.h"
#include "common_throws.h"
#include "dex_cache.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "gc/heap-inl.h"
#include "iftable.h"
#include "invoke_type.h"
diff --git a/runtime/mirror/class-refvisitor-inl.h b/runtime/mirror/class-refvisitor-inl.h
index 3d52ead..263b774 100644
--- a/runtime/mirror/class-refvisitor-inl.h
+++ b/runtime/mirror/class-refvisitor-inl.h
@@ -32,12 +32,12 @@
inline void Class::VisitReferences(ObjPtr<Class> klass, const Visitor& visitor) {
VisitInstanceFieldsReferences<kVerifyFlags, kReadBarrierOption>(klass.Ptr(), visitor);
// Right after a class is allocated, but not yet loaded
- // (kStatusNotReady, see ClassLinker::LoadClass()), GC may find it
+ // (ClassStatus::kNotReady, see ClassLinker::LoadClass()), GC may find it
// and scan it. IsTemp() may call Class::GetAccessFlags() but may
// fail in the DCHECK in Class::GetAccessFlags() because the class
- // status is kStatusNotReady. To avoid it, rely on IsResolved()
+ // status is ClassStatus::kNotReady. To avoid it, rely on IsResolved()
// only. This is fine because a temp class never goes into the
- // kStatusResolved state.
+ // ClassStatus::kResolved state.
if (IsResolved<kVerifyFlags>()) {
// Temp classes don't ever populate imt/vtable or static fields and they are not even
// allocated with the right size for those. Also, unresolved classes don't have fields
diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc
index 10daebb..8a7defd 100644
--- a/runtime/mirror/class.cc
+++ b/runtime/mirror/class.cc
@@ -25,9 +25,9 @@
#include "class_ext.h"
#include "class_linker-inl.h"
#include "class_loader.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_annotations.h"
#include "dex_cache.h"
-#include "dex_file-inl.h"
-#include "dex_file_annotations.h"
#include "gc/accounting/card_table-inl.h"
#include "handle_scope-inl.h"
#include "subtype_check.h"
@@ -54,23 +54,6 @@
GcRoot<Class> Class::java_lang_Class_;
-constexpr Class::Status Class::kStatusRetired;
-constexpr Class::Status Class::kStatusErrorResolved;
-constexpr Class::Status Class::kStatusErrorUnresolved;
-constexpr Class::Status Class::kStatusNotReady;
-constexpr Class::Status Class::kStatusIdx;
-constexpr Class::Status Class::kStatusLoaded;
-constexpr Class::Status Class::kStatusResolving;
-constexpr Class::Status Class::kStatusResolved;
-constexpr Class::Status Class::kStatusVerifying;
-constexpr Class::Status Class::kStatusRetryVerificationAtRuntime;
-constexpr Class::Status Class::kStatusVerifyingAtRuntime;
-constexpr Class::Status Class::kStatusVerified;
-constexpr Class::Status Class::kStatusSuperclassValidated;
-constexpr Class::Status Class::kStatusInitializing;
-constexpr Class::Status Class::kStatusInitialized;
-constexpr Class::Status Class::kStatusMax;
-
void Class::SetClassClass(ObjPtr<Class> java_lang_Class) {
CHECK(java_lang_Class_.IsNull())
<< java_lang_Class_.Read()
@@ -131,19 +114,19 @@
}
}
-void Class::SetStatus(Handle<Class> h_this, Status new_status, Thread* self) {
- Status old_status = h_this->GetStatus();
+void Class::SetStatus(Handle<Class> h_this, ClassStatus new_status, Thread* self) {
+ ClassStatus old_status = h_this->GetStatus();
ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
bool class_linker_initialized = class_linker != nullptr && class_linker->IsInitialized();
if (LIKELY(class_linker_initialized)) {
if (UNLIKELY(new_status <= old_status &&
- new_status != kStatusErrorUnresolved &&
- new_status != kStatusErrorResolved &&
- new_status != kStatusRetired)) {
+ new_status != ClassStatus::kErrorUnresolved &&
+ new_status != ClassStatus::kErrorResolved &&
+ new_status != ClassStatus::kRetired)) {
LOG(FATAL) << "Unexpected change back of class status for " << h_this->PrettyClass()
<< " " << old_status << " -> " << new_status;
}
- if (new_status >= kStatusResolved || old_status >= kStatusResolved) {
+ if (new_status >= ClassStatus::kResolved || old_status >= ClassStatus::kResolved) {
// When classes are being resolved the resolution code should hold the lock.
CHECK_EQ(h_this->GetLockOwnerThreadId(), self->GetThreadId())
<< "Attempt to change status of class while not holding its lock: "
@@ -155,7 +138,7 @@
<< "Attempt to set as erroneous an already erroneous class "
<< h_this->PrettyClass()
<< " old_status: " << old_status << " new_status: " << new_status;
- CHECK_EQ(new_status == kStatusErrorResolved, old_status >= kStatusResolved);
+ CHECK_EQ(new_status == ClassStatus::kErrorResolved, old_status >= ClassStatus::kResolved);
if (VLOG_IS_ON(class_linker)) {
LOG(ERROR) << "Setting " << h_this->PrettyDescriptor() << " to erroneous.";
if (self->IsExceptionPending()) {
@@ -181,7 +164,7 @@
// Setting the object size alloc fast path needs to be after the status write so that if the
// alloc path sees a valid object size, we would know that it's initialized as long as it has a
// load-acquire/fake dependency.
- if (new_status == kStatusInitialized && !h_this->IsVariableSize()) {
+ if (new_status == ClassStatus::kInitialized && !h_this->IsVariableSize()) {
DCHECK_EQ(h_this->GetObjectSizeAllocFastPath(), std::numeric_limits<uint32_t>::max());
// Finalizable objects must always go slow path.
if (!h_this->IsFinalizable()) {
@@ -199,13 +182,13 @@
if (h_this->IsTemp()) {
// Class is a temporary one, ensure that waiters for resolution get notified of retirement
// so that they can grab the new version of the class from the class linker's table.
- CHECK_LT(new_status, kStatusResolved) << h_this->PrettyDescriptor();
- if (new_status == kStatusRetired || new_status == kStatusErrorUnresolved) {
+ CHECK_LT(new_status, ClassStatus::kResolved) << h_this->PrettyDescriptor();
+ if (new_status == ClassStatus::kRetired || new_status == ClassStatus::kErrorUnresolved) {
h_this->NotifyAll(self);
}
} else {
- CHECK_NE(new_status, kStatusRetired);
- if (old_status >= kStatusResolved || new_status >= kStatusResolved) {
+ CHECK_NE(new_status, ClassStatus::kRetired);
+ if (old_status >= ClassStatus::kResolved || new_status >= ClassStatus::kResolved) {
h_this->NotifyAll(self);
}
}
@@ -1154,7 +1137,7 @@
StackHandleScope<1> hs(self_);
Handle<mirror::Class> h_new_class_obj(hs.NewHandle(obj->AsClass()));
Object::CopyObject(h_new_class_obj.Get(), orig_->Get(), copy_bytes_);
- Class::SetStatus(h_new_class_obj, Class::kStatusResolving, self_);
+ Class::SetStatus(h_new_class_obj, ClassStatus::kResolving, self_);
h_new_class_obj->PopulateEmbeddedVTable(pointer_size_);
h_new_class_obj->SetImt(imt_, pointer_size_);
h_new_class_obj->SetClassSize(new_length_);
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index c545a9b..55c5889 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -18,12 +18,13 @@
#define ART_RUNTIME_MIRROR_CLASS_H_
#include "base/bit_utils.h"
+#include "base/casts.h"
#include "base/enums.h"
#include "base/iteration_range.h"
#include "class_flags.h"
#include "class_status.h"
-#include "dex_file.h"
-#include "dex_file_types.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_types.h"
#include "gc/allocator_type.h"
#include "gc_root.h"
#include "imtable.h"
@@ -77,38 +78,16 @@
static constexpr uint32_t kPrimitiveTypeSizeShiftShift = 16;
static constexpr uint32_t kPrimitiveTypeMask = (1u << kPrimitiveTypeSizeShiftShift) - 1;
- // Make ClassStatus available as Class::Status.
- using Status = ClassStatus;
-
- // Required for a minimal change. Fix up and remove in a future change.
- static constexpr Status kStatusRetired = Status::kStatusRetired;
- static constexpr Status kStatusErrorResolved = Status::kStatusErrorResolved;
- static constexpr Status kStatusErrorUnresolved = Status::kStatusErrorUnresolved;
- static constexpr Status kStatusNotReady = Status::kStatusNotReady;
- static constexpr Status kStatusIdx = Status::kStatusIdx;
- static constexpr Status kStatusLoaded = Status::kStatusLoaded;
- static constexpr Status kStatusResolving = Status::kStatusResolving;
- static constexpr Status kStatusResolved = Status::kStatusResolved;
- static constexpr Status kStatusVerifying = Status::kStatusVerifying;
- static constexpr Status kStatusRetryVerificationAtRuntime =
- Status::kStatusRetryVerificationAtRuntime;
- static constexpr Status kStatusVerifyingAtRuntime = Status::kStatusVerifyingAtRuntime;
- static constexpr Status kStatusVerified = Status::kStatusVerified;
- static constexpr Status kStatusSuperclassValidated = Status::kStatusSuperclassValidated;
- static constexpr Status kStatusInitializing = Status::kStatusInitializing;
- static constexpr Status kStatusInitialized = Status::kStatusInitialized;
- static constexpr Status kStatusMax = Status::kStatusMax;
-
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
- Status GetStatus() REQUIRES_SHARED(Locks::mutator_lock_) {
+ ClassStatus GetStatus() REQUIRES_SHARED(Locks::mutator_lock_) {
// Avoid including "subtype_check_bits_and_status.h" to get the field.
// The ClassStatus is always in the least-significant bits of status_.
- return static_cast<Status>(static_cast<uint8_t>(
- static_cast<uint32_t>(GetField32Volatile<kVerifyFlags>(StatusOffset())) & 0xff));
+ return enum_cast<ClassStatus>(
+ static_cast<uint32_t>(GetField32Volatile<kVerifyFlags>(StatusOffset())) & 0xff);
}
// This is static because 'this' may be moved by GC.
- static void SetStatus(Handle<Class> h_this, Status new_status, Thread* self)
+ static void SetStatus(Handle<Class> h_this, ClassStatus new_status, Thread* self)
REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_);
static MemberOffset StatusOffset() {
@@ -118,24 +97,24 @@
// Returns true if the class has been retired.
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
bool IsRetired() REQUIRES_SHARED(Locks::mutator_lock_) {
- return GetStatus<kVerifyFlags>() == kStatusRetired;
+ return GetStatus<kVerifyFlags>() == ClassStatus::kRetired;
}
// Returns true if the class has failed to link.
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
bool IsErroneousUnresolved() REQUIRES_SHARED(Locks::mutator_lock_) {
- return GetStatus<kVerifyFlags>() == kStatusErrorUnresolved;
+ return GetStatus<kVerifyFlags>() == ClassStatus::kErrorUnresolved;
}
// Returns true if the class has failed to initialize.
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
bool IsErroneousResolved() REQUIRES_SHARED(Locks::mutator_lock_) {
- return GetStatus<kVerifyFlags>() == kStatusErrorResolved;
+ return GetStatus<kVerifyFlags>() == ClassStatus::kErrorResolved;
}
// Returns true if the class status indicets that the class has failed to link or initialize.
- static bool IsErroneous(Status status) {
- return status == kStatusErrorUnresolved || status == kStatusErrorResolved;
+ static bool IsErroneous(ClassStatus status) {
+ return status == ClassStatus::kErrorUnresolved || status == ClassStatus::kErrorResolved;
}
// Returns true if the class has failed to link or initialize.
@@ -147,44 +126,44 @@
// Returns true if the class has been loaded.
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
bool IsIdxLoaded() REQUIRES_SHARED(Locks::mutator_lock_) {
- return GetStatus<kVerifyFlags>() >= kStatusIdx;
+ return GetStatus<kVerifyFlags>() >= ClassStatus::kIdx;
}
// Returns true if the class has been loaded.
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
bool IsLoaded() REQUIRES_SHARED(Locks::mutator_lock_) {
- return GetStatus<kVerifyFlags>() >= kStatusLoaded;
+ return GetStatus<kVerifyFlags>() >= ClassStatus::kLoaded;
}
// Returns true if the class has been linked.
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
bool IsResolved() REQUIRES_SHARED(Locks::mutator_lock_) {
- Status status = GetStatus<kVerifyFlags>();
- return status >= kStatusResolved || status == kStatusErrorResolved;
+ ClassStatus status = GetStatus<kVerifyFlags>();
+ return status >= ClassStatus::kResolved || status == ClassStatus::kErrorResolved;
}
// Returns true if the class should be verified at runtime.
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
bool ShouldVerifyAtRuntime() REQUIRES_SHARED(Locks::mutator_lock_) {
- return GetStatus<kVerifyFlags>() == kStatusRetryVerificationAtRuntime;
+ return GetStatus<kVerifyFlags>() == ClassStatus::kRetryVerificationAtRuntime;
}
// Returns true if the class has been verified.
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
bool IsVerified() REQUIRES_SHARED(Locks::mutator_lock_) {
- return GetStatus<kVerifyFlags>() >= kStatusVerified;
+ return GetStatus<kVerifyFlags>() >= ClassStatus::kVerified;
}
// Returns true if the class is initializing.
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
bool IsInitializing() REQUIRES_SHARED(Locks::mutator_lock_) {
- return GetStatus<kVerifyFlags>() >= kStatusInitializing;
+ return GetStatus<kVerifyFlags>() >= ClassStatus::kInitializing;
}
// Returns true if the class is initialized.
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
bool IsInitialized() REQUIRES_SHARED(Locks::mutator_lock_) {
- return GetStatus<kVerifyFlags>() == kStatusInitialized;
+ return GetStatus<kVerifyFlags>() == ClassStatus::kInitialized;
}
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
@@ -333,8 +312,10 @@
// Returns true if this class is the placeholder and should retire and
// be replaced with a class with the right size for embedded imt/vtable.
bool IsTemp() REQUIRES_SHARED(Locks::mutator_lock_) {
- Status s = GetStatus();
- return s < Status::kStatusResolving && s != kStatusErrorResolved && ShouldHaveEmbeddedVTable();
+ ClassStatus s = GetStatus();
+ return s < ClassStatus::kResolving &&
+ s != ClassStatus::kErrorResolved &&
+ ShouldHaveEmbeddedVTable();
}
String* GetName() REQUIRES_SHARED(Locks::mutator_lock_); // Returns the cached name.
diff --git a/runtime/mirror/class_ext.cc b/runtime/mirror/class_ext.cc
index 32d49bb..c18b219 100644
--- a/runtime/mirror/class_ext.cc
+++ b/runtime/mirror/class_ext.cc
@@ -20,7 +20,7 @@
#include "base/casts.h"
#include "base/enums.h"
#include "class-inl.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "gc/accounting/card_table-inl.h"
#include "object-inl.h"
#include "object_array.h"
diff --git a/runtime/mirror/dex_cache-inl.h b/runtime/mirror/dex_cache-inl.h
index e1d04e2..573244e 100644
--- a/runtime/mirror/dex_cache-inl.h
+++ b/runtime/mirror/dex_cache-inl.h
@@ -26,7 +26,7 @@
#include "base/casts.h"
#include "base/enums.h"
#include "class_linker.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "gc/heap-inl.h"
#include "gc_root.h"
#include "mirror/call_site.h"
diff --git a/runtime/mirror/dex_cache.h b/runtime/mirror/dex_cache.h
index 509db02..b46d80c 100644
--- a/runtime/mirror/dex_cache.h
+++ b/runtime/mirror/dex_cache.h
@@ -20,7 +20,7 @@
#include "array.h"
#include "base/bit_utils.h"
#include "base/mutex.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "object.h"
#include "object_array.h"
diff --git a/runtime/mirror/emulated_stack_frame.h b/runtime/mirror/emulated_stack_frame.h
index b6aa949..9bfa4d6 100644
--- a/runtime/mirror/emulated_stack_frame.h
+++ b/runtime/mirror/emulated_stack_frame.h
@@ -17,7 +17,7 @@
#ifndef ART_RUNTIME_MIRROR_EMULATED_STACK_FRAME_H_
#define ART_RUNTIME_MIRROR_EMULATED_STACK_FRAME_H_
-#include "dex_instruction.h"
+#include "dex/dex_instruction.h"
#include "method_type.h"
#include "object.h"
#include "stack.h"
diff --git a/runtime/mirror/object.cc b/runtime/mirror/object.cc
index 52e6a7e..3765d0a 100644
--- a/runtime/mirror/object.cc
+++ b/runtime/mirror/object.cc
@@ -24,7 +24,7 @@
#include "class-inl.h"
#include "class.h"
#include "class_linker-inl.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "gc/accounting/card_table-inl.h"
#include "gc/heap.h"
#include "handle_scope-inl.h"
diff --git a/runtime/mirror/object_test.cc b/runtime/mirror/object_test.cc
index 1a0fc76..32a99eb 100644
--- a/runtime/mirror/object_test.cc
+++ b/runtime/mirror/object_test.cc
@@ -29,7 +29,7 @@
#include "class_linker-inl.h"
#include "class_linker.h"
#include "common_runtime_test.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "entrypoints/entrypoint_utils-inl.h"
#include "gc/accounting/card_table-inl.h"
#include "gc/heap.h"
diff --git a/runtime/mirror/throwable.cc b/runtime/mirror/throwable.cc
index 077ad50..a7a6d08 100644
--- a/runtime/mirror/throwable.cc
+++ b/runtime/mirror/throwable.cc
@@ -21,7 +21,7 @@
#include "art_method-inl.h"
#include "base/enums.h"
#include "class-inl.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "gc/accounting/card_table-inl.h"
#include "object-inl.h"
#include "object_array-inl.h"
diff --git a/runtime/monitor.cc b/runtime/monitor.cc
index 475ec21..325591f 100644
--- a/runtime/monitor.cc
+++ b/runtime/monitor.cc
@@ -27,9 +27,9 @@
#include "base/systrace.h"
#include "base/time_utils.h"
#include "class_linker.h"
-#include "dex_file-inl.h"
-#include "dex_file_types.h"
-#include "dex_instruction-inl.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_types.h"
+#include "dex/dex_instruction-inl.h"
#include "lock_word-inl.h"
#include "mirror/class-inl.h"
#include "mirror/object-inl.h"
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
index c0de374..a992b5c 100644
--- a/runtime/native/dalvik_system_DexFile.cc
+++ b/runtime/native/dalvik_system_DexFile.cc
@@ -27,8 +27,8 @@
#include <class_loader_context.h>
#include "common_throws.h"
#include "compiler_filter.h"
-#include "dex_file-inl.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_loader.h"
#include "jni_internal.h"
#include "mirror/class_loader.h"
#include "mirror/object-inl.h"
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index 6446e1b..400518d 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -32,8 +32,8 @@
#include "class_linker-inl.h"
#include "common_throws.h"
#include "debugger.h"
-#include "dex_file-inl.h"
-#include "dex_file_types.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_types.h"
#include "gc/accounting/card_table-inl.h"
#include "gc/allocator/dlmalloc.h"
#include "gc/heap.h"
diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc
index da5cee1..7b999c0 100644
--- a/runtime/native/java_lang_Class.cc
+++ b/runtime/native/java_lang_Class.cc
@@ -23,8 +23,8 @@
#include "base/enums.h"
#include "class_linker-inl.h"
#include "common_throws.h"
-#include "dex_file-inl.h"
-#include "dex_file_annotations.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_annotations.h"
#include "jni_internal.h"
#include "mirror/class-inl.h"
#include "mirror/class_loader.h"
diff --git a/runtime/native/java_lang_VMClassLoader.cc b/runtime/native/java_lang_VMClassLoader.cc
index 5130ad5..6eebff4 100644
--- a/runtime/native/java_lang_VMClassLoader.cc
+++ b/runtime/native/java_lang_VMClassLoader.cc
@@ -17,7 +17,7 @@
#include "java_lang_VMClassLoader.h"
#include "class_linker.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file_loader.h"
#include "jni_internal.h"
#include "mirror/class_loader.h"
#include "mirror/object-inl.h"
diff --git a/runtime/native/java_lang_reflect_Array.cc b/runtime/native/java_lang_reflect_Array.cc
index 5be3171..12d4008 100644
--- a/runtime/native/java_lang_reflect_Array.cc
+++ b/runtime/native/java_lang_reflect_Array.cc
@@ -20,7 +20,7 @@
#include "class_linker-inl.h"
#include "common_throws.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "handle_scope-inl.h"
#include "jni_internal.h"
#include "mirror/class-inl.h"
diff --git a/runtime/native/java_lang_reflect_Constructor.cc b/runtime/native/java_lang_reflect_Constructor.cc
index abbb347..8612438 100644
--- a/runtime/native/java_lang_reflect_Constructor.cc
+++ b/runtime/native/java_lang_reflect_Constructor.cc
@@ -22,7 +22,7 @@
#include "base/enums.h"
#include "class_linker-inl.h"
#include "class_linker.h"
-#include "dex_file_annotations.h"
+#include "dex/dex_file_annotations.h"
#include "jni_internal.h"
#include "mirror/class-inl.h"
#include "mirror/method.h"
diff --git a/runtime/native/java_lang_reflect_Executable.cc b/runtime/native/java_lang_reflect_Executable.cc
index f209f1d..e37c14b 100644
--- a/runtime/native/java_lang_reflect_Executable.cc
+++ b/runtime/native/java_lang_reflect_Executable.cc
@@ -20,7 +20,7 @@
#include "nativehelper/jni_macros.h"
#include "art_method-inl.h"
-#include "dex_file_annotations.h"
+#include "dex/dex_file_annotations.h"
#include "handle.h"
#include "jni_internal.h"
#include "mirror/class-inl.h"
diff --git a/runtime/native/java_lang_reflect_Field.cc b/runtime/native/java_lang_reflect_Field.cc
index 2e4dd8a..f990c04 100644
--- a/runtime/native/java_lang_reflect_Field.cc
+++ b/runtime/native/java_lang_reflect_Field.cc
@@ -23,8 +23,8 @@
#include "class_linker-inl.h"
#include "class_linker.h"
#include "common_throws.h"
-#include "dex_file-inl.h"
-#include "dex_file_annotations.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_annotations.h"
#include "jni_internal.h"
#include "mirror/class-inl.h"
#include "mirror/field-inl.h"
diff --git a/runtime/native/java_lang_reflect_Method.cc b/runtime/native/java_lang_reflect_Method.cc
index 18ff9c3..b604dc0 100644
--- a/runtime/native/java_lang_reflect_Method.cc
+++ b/runtime/native/java_lang_reflect_Method.cc
@@ -22,7 +22,7 @@
#include "base/enums.h"
#include "class_linker-inl.h"
#include "class_linker.h"
-#include "dex_file_annotations.h"
+#include "dex/dex_file_annotations.h"
#include "jni_internal.h"
#include "mirror/class-inl.h"
#include "mirror/object-inl.h"
diff --git a/runtime/native/java_lang_reflect_Parameter.cc b/runtime/native/java_lang_reflect_Parameter.cc
index c4ab5d6..0b3015b 100644
--- a/runtime/native/java_lang_reflect_Parameter.cc
+++ b/runtime/native/java_lang_reflect_Parameter.cc
@@ -21,8 +21,8 @@
#include "art_method-inl.h"
#include "common_throws.h"
-#include "dex_file-inl.h"
-#include "dex_file_annotations.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_annotations.h"
#include "jni_internal.h"
#include "native_util.h"
#include "scoped_fast_native_object_access-inl.h"
diff --git a/runtime/native_bridge_art_interface.cc b/runtime/native_bridge_art_interface.cc
index 10d1091..7d72805 100644
--- a/runtime/native_bridge_art_interface.cc
+++ b/runtime/native_bridge_art_interface.cc
@@ -24,7 +24,7 @@
#include "base/enums.h"
#include "base/logging.h" // For VLOG.
#include "base/macros.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "jni_internal.h"
#include "mirror/class-inl.h"
#include "scoped_thread_state_change-inl.h"
diff --git a/runtime/oat.h b/runtime/oat.h
index 9d21180..6d4f18b 100644
--- a/runtime/oat.h
+++ b/runtime/oat.h
@@ -22,7 +22,7 @@
#include "arch/instruction_set.h"
#include "base/macros.h"
#include "compiler_filter.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "safe_map.h"
namespace art {
@@ -32,8 +32,8 @@
class PACKED(4) OatHeader {
public:
static constexpr uint8_t kOatMagic[] = { 'o', 'a', 't', '\n' };
- // Last oat version changed reason: .bss index mapping change.
- static constexpr uint8_t kOatVersion[] = { '1', '3', '5', '\0' };
+ // Last oat version changed reason: 4-bit ClassStatus.
+ static constexpr uint8_t kOatVersion[] = { '1', '3', '6', '\0' };
static constexpr const char* kImageLocationKey = "image-location";
static constexpr const char* kDex2OatCmdLineKey = "dex2oat-cmdline";
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index f437db2..df07a19 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -43,8 +43,9 @@
#include "base/stl_util.h"
#include "base/systrace.h"
#include "base/unix_file/fd_file.h"
-#include "dex_file_types.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file_loader.h"
+#include "dex/dex_file_types.h"
+#include "dex/standard_dex_file.h"
#include "elf_file.h"
#include "elf_utils.h"
#include "gc_root.h"
@@ -57,7 +58,6 @@
#include "oat_file_manager.h"
#include "os.h"
#include "runtime.h"
-#include "standard_dex_file.h"
#include "type_lookup_table.h"
#include "utf-inl.h"
#include "utils.h"
@@ -1654,9 +1654,8 @@
const uint8_t* status_pointer = oat_class_pointer;
CHECK_LT(status_pointer, oat_file_->End()) << oat_file_->GetLocation();
- mirror::Class::Status status =
- static_cast<mirror::Class::Status>(*reinterpret_cast<const int16_t*>(status_pointer));
- CHECK_LT(status, mirror::Class::kStatusMax);
+ ClassStatus status = enum_cast<ClassStatus>(*reinterpret_cast<const int16_t*>(status_pointer));
+ CHECK_LE(status, ClassStatus::kLast);
const uint8_t* type_pointer = status_pointer + sizeof(uint16_t);
CHECK_LT(type_pointer, oat_file_->End()) << oat_file_->GetLocation();
@@ -1737,7 +1736,7 @@
}
OatFile::OatClass::OatClass(const OatFile* oat_file,
- mirror::Class::Status status,
+ ClassStatus status,
OatClassType type,
uint32_t bitmap_size,
const uint32_t* bitmap_pointer,
diff --git a/runtime/oat_file.h b/runtime/oat_file.h
index 1fb17a4..02318b6 100644
--- a/runtime/oat_file.h
+++ b/runtime/oat_file.h
@@ -24,11 +24,12 @@
#include "base/array_ref.h"
#include "base/mutex.h"
#include "base/stringpiece.h"
+#include "class_status.h"
#include "compiler_filter.h"
-#include "dex_file.h"
-#include "dex_file_layout.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_layout.h"
#include "index_bss_mapping.h"
-#include "mirror/class.h"
+#include "mirror/object.h"
#include "oat.h"
#include "os.h"
#include "type_lookup_table.h"
@@ -196,7 +197,7 @@
class OatClass FINAL {
public:
- mirror::Class::Status GetStatus() const {
+ ClassStatus GetStatus() const {
return status_;
}
@@ -224,7 +225,7 @@
// See FindOatClass().
static OatClass Invalid() {
return OatClass(/* oat_file */ nullptr,
- mirror::Class::kStatusErrorUnresolved,
+ ClassStatus::kErrorUnresolved,
kOatClassNoneCompiled,
/* bitmap_size */ 0,
/* bitmap_pointer */ nullptr,
@@ -233,7 +234,7 @@
private:
OatClass(const OatFile* oat_file,
- mirror::Class::Status status,
+ ClassStatus status,
OatClassType type,
uint32_t bitmap_size,
const uint32_t* bitmap_pointer,
@@ -241,7 +242,7 @@
const OatFile* const oat_file_;
- const mirror::Class::Status status_;
+ const ClassStatus status_;
const OatClassType type_;
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index 8707e73..240030c 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -28,7 +28,7 @@
#include "base/stl_util.h"
#include "class_linker.h"
#include "compiler_filter.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file_loader.h"
#include "exec_utils.h"
#include "gc/heap.h"
#include "gc/space/image_space.h"
diff --git a/runtime/oat_file_manager.cc b/runtime/oat_file_manager.cc
index 91a138a..29b9bfc 100644
--- a/runtime/oat_file_manager.cc
+++ b/runtime/oat_file_manager.cc
@@ -31,9 +31,9 @@
#include "base/systrace.h"
#include "class_linker.h"
#include "class_loader_context.h"
-#include "dex_file-inl.h"
-#include "dex_file_loader.h"
-#include "dex_file_tracking_registrar.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_loader.h"
+#include "dex/dex_file_tracking_registrar.h"
#include "gc/scoped_gc_critical_section.h"
#include "gc/space/image_space.h"
#include "handle_scope-inl.h"
diff --git a/runtime/oat_quick_method_header.cc b/runtime/oat_quick_method_header.cc
index aa28fd8..98238e5 100644
--- a/runtime/oat_quick_method_header.cc
+++ b/runtime/oat_quick_method_header.cc
@@ -17,7 +17,7 @@
#include "oat_quick_method_header.h"
#include "art_method.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "scoped_thread_state_change-inl.h"
#include "thread.h"
diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc
index 06b94c3..3a7640f 100644
--- a/runtime/quick_exception_handler.cc
+++ b/runtime/quick_exception_handler.cc
@@ -20,8 +20,8 @@
#include "art_method-inl.h"
#include "base/enums.h"
#include "base/logging.h" // For VLOG_IS_ON.
-#include "dex_file_types.h"
-#include "dex_instruction.h"
+#include "dex/dex_file_types.h"
+#include "dex/dex_instruction.h"
#include "entrypoints/entrypoint_utils.h"
#include "entrypoints/quick/quick_entrypoints_enum.h"
#include "entrypoints/runtime_asm_entrypoints.h"
diff --git a/runtime/quicken_info.h b/runtime/quicken_info.h
index 5b72468..ce11f3c 100644
--- a/runtime/quicken_info.h
+++ b/runtime/quicken_info.h
@@ -17,7 +17,7 @@
#ifndef ART_RUNTIME_QUICKEN_INFO_H_
#define ART_RUNTIME_QUICKEN_INFO_H_
-#include "dex_instruction.h"
+#include "dex/dex_instruction.h"
namespace art {
diff --git a/runtime/reflection.cc b/runtime/reflection.cc
index cacbe87..635a03a 100644
--- a/runtime/reflection.cc
+++ b/runtime/reflection.cc
@@ -21,7 +21,7 @@
#include "base/enums.h"
#include "class_linker.h"
#include "common_throws.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "indirect_reference_table-inl.h"
#include "java_vm_ext.h"
#include "jni_internal.h"
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 42f724a..e8fa572 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -69,7 +69,7 @@
#include "class_linker-inl.h"
#include "compiler_callbacks.h"
#include "debugger.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file_loader.h"
#include "elf_file.h"
#include "entrypoints/runtime_asm_entrypoints.h"
#include "experimental_flags.h"
@@ -1619,7 +1619,7 @@
// libcore can't because it's the library that implements System.loadLibrary!
{
std::string error_msg;
- if (!java_vm_->LoadNativeLibrary(env, "libjavacore.so", nullptr, nullptr, &error_msg)) {
+ if (!java_vm_->LoadNativeLibrary(env, "libjavacore.so", nullptr, &error_msg)) {
LOG(FATAL) << "LoadNativeLibrary failed for \"libjavacore.so\": " << error_msg;
}
}
@@ -1628,7 +1628,7 @@
? "libopenjdkd.so"
: "libopenjdk.so";
std::string error_msg;
- if (!java_vm_->LoadNativeLibrary(env, kOpenJdkLibrary, nullptr, nullptr, &error_msg)) {
+ if (!java_vm_->LoadNativeLibrary(env, kOpenJdkLibrary, nullptr, &error_msg)) {
LOG(FATAL) << "LoadNativeLibrary failed for \"" << kOpenJdkLibrary << "\": " << error_msg;
}
}
diff --git a/runtime/runtime.h b/runtime/runtime.h
index ac29ed4..c3abfe0 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -31,7 +31,7 @@
#include "base/macros.h"
#include "base/mutex.h"
#include "deoptimization_kind.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "experimental_flags.h"
#include "gc_root.h"
#include "instrumentation.h"
diff --git a/runtime/runtime_callbacks.h b/runtime/runtime_callbacks.h
index f405c9f..24386ba 100644
--- a/runtime/runtime_callbacks.h
+++ b/runtime/runtime_callbacks.h
@@ -22,7 +22,7 @@
#include "base/array_ref.h"
#include "base/macros.h"
#include "base/mutex.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "handle.h"
namespace art {
diff --git a/runtime/stack.cc b/runtime/stack.cc
index bbea48b..dfdea28 100644
--- a/runtime/stack.cc
+++ b/runtime/stack.cc
@@ -23,7 +23,7 @@
#include "base/callee_save_type.h"
#include "base/enums.h"
#include "base/hex_dump.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "entrypoints/entrypoint_utils-inl.h"
#include "entrypoints/runtime_asm_entrypoints.h"
#include "gc/space/image_space.h"
diff --git a/runtime/stack_map.h b/runtime/stack_map.h
index 85c734e..62fb54f 100644
--- a/runtime/stack_map.h
+++ b/runtime/stack_map.h
@@ -23,8 +23,8 @@
#include "base/bit_utils.h"
#include "base/bit_vector.h"
#include "bit_memory_region.h"
+#include "dex/dex_file_types.h"
#include "leb128.h"
-#include "dex_file_types.h"
#include "memory_region.h"
#include "method_info.h"
diff --git a/runtime/string_reference.h b/runtime/string_reference.h
index 24a4253..97661c6 100644
--- a/runtime/string_reference.h
+++ b/runtime/string_reference.h
@@ -21,9 +21,9 @@
#include <android-base/logging.h>
-#include "dex_file-inl.h"
-#include "dex_file_reference.h"
-#include "dex_file_types.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_reference.h"
+#include "dex/dex_file_types.h"
#include "utf-inl.h"
namespace art {
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 5700ca8..9f4e544 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -47,9 +47,9 @@
#include "base/to_str.h"
#include "class_linker-inl.h"
#include "debugger.h"
-#include "dex_file-inl.h"
-#include "dex_file_annotations.h"
-#include "dex_file_types.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_annotations.h"
+#include "dex/dex_file_types.h"
#include "entrypoints/entrypoint_utils.h"
#include "entrypoints/quick/quick_alloc_entrypoints.h"
#include "gc/accounting/card_table-inl.h"
diff --git a/runtime/trace.cc b/runtime/trace.cc
index d9038b2..f9d22df 100644
--- a/runtime/trace.cc
+++ b/runtime/trace.cc
@@ -31,7 +31,7 @@
#include "class_linker.h"
#include "common_throws.h"
#include "debugger.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "entrypoints/quick/quick_entrypoints.h"
#include "gc/scoped_gc_critical_section.h"
#include "instrumentation.h"
diff --git a/runtime/transaction.h b/runtime/transaction.h
index 4e9cde5..8539ebc 100644
--- a/runtime/transaction.h
+++ b/runtime/transaction.h
@@ -20,7 +20,7 @@
#include "base/macros.h"
#include "base/mutex.h"
#include "base/value_object.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "gc_root.h"
#include "offsets.h"
#include "primitive.h"
diff --git a/runtime/transaction_test.cc b/runtime/transaction_test.cc
index 304017e..02e61d7 100644
--- a/runtime/transaction_test.cc
+++ b/runtime/transaction_test.cc
@@ -20,7 +20,7 @@
#include "art_method-inl.h"
#include "class_linker-inl.h"
#include "common_runtime_test.h"
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "mirror/array-inl.h"
#include "scoped_thread_state_change-inl.h"
@@ -66,7 +66,7 @@
class_linker_->VerifyClass(soa.Self(), h_klass);
ASSERT_TRUE(h_klass->IsVerified());
- mirror::Class::Status old_status = h_klass->GetStatus();
+ ClassStatus old_status = h_klass->GetStatus();
LockWord old_lock_word = h_klass->GetLockWord(false);
Runtime::Current()->EnterTransactionMode();
diff --git a/runtime/type_lookup_table.cc b/runtime/type_lookup_table.cc
index 4fab39c..6eb3d83 100644
--- a/runtime/type_lookup_table.cc
+++ b/runtime/type_lookup_table.cc
@@ -20,7 +20,7 @@
#include <memory>
#include "base/bit_utils.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "utf-inl.h"
#include "utils.h"
diff --git a/runtime/type_lookup_table.h b/runtime/type_lookup_table.h
index 780b380..6a6f47f 100644
--- a/runtime/type_lookup_table.h
+++ b/runtime/type_lookup_table.h
@@ -17,7 +17,7 @@
#ifndef ART_RUNTIME_TYPE_LOOKUP_TABLE_H_
#define ART_RUNTIME_TYPE_LOOKUP_TABLE_H_
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "leb128.h"
#include "utf.h"
diff --git a/runtime/type_lookup_table_test.cc b/runtime/type_lookup_table_test.cc
index 0f8f288..d04652a 100644
--- a/runtime/type_lookup_table_test.cc
+++ b/runtime/type_lookup_table_test.cc
@@ -19,7 +19,7 @@
#include <memory>
#include "common_runtime_test.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "scoped_thread_state_change-inl.h"
#include "utf-inl.h"
diff --git a/runtime/type_reference.h b/runtime/type_reference.h
index 10a67b1..2b0b99f 100644
--- a/runtime/type_reference.h
+++ b/runtime/type_reference.h
@@ -21,7 +21,7 @@
#include <android-base/logging.h>
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "string_reference.h"
namespace art {
diff --git a/runtime/utils.cc b/runtime/utils.cc
index f6533a7..bd4175f 100644
--- a/runtime/utils.cc
+++ b/runtime/utils.cc
@@ -30,7 +30,7 @@
#include "android-base/strings.h"
#include "base/file_utils.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "os.h"
#include "utf-inl.h"
diff --git a/runtime/utils/dex_cache_arrays_layout.h b/runtime/utils/dex_cache_arrays_layout.h
index fc04159..6f689f3 100644
--- a/runtime/utils/dex_cache_arrays_layout.h
+++ b/runtime/utils/dex_cache_arrays_layout.h
@@ -17,8 +17,8 @@
#ifndef ART_RUNTIME_UTILS_DEX_CACHE_ARRAYS_LAYOUT_H_
#define ART_RUNTIME_UTILS_DEX_CACHE_ARRAYS_LAYOUT_H_
-#include "dex_file.h"
-#include "dex_file_types.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_types.h"
namespace art {
diff --git a/runtime/vdex_file.cc b/runtime/vdex_file.cc
index a9af97d..a53556f 100644
--- a/runtime/vdex_file.cc
+++ b/runtime/vdex_file.cc
@@ -25,8 +25,8 @@
#include "base/bit_utils.h"
#include "base/stl_util.h"
#include "base/unix_file/fd_file.h"
-#include "dex_file.h"
-#include "dex_file_loader.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_loader.h"
#include "dex_to_dex_decompiler.h"
namespace art {
@@ -254,7 +254,7 @@
quickening_info));
}
optimizer::ArtDecompileDEX(
- &target_dex_file,
+ target_dex_file,
*code_item,
GetQuickeningInfoAt(quickening_info, quickening_offset),
decompile_return_instruction);
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 8d9b82e..2183b60 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -31,10 +31,10 @@
#include "base/time_utils.h"
#include "class_linker.h"
#include "compiler_callbacks.h"
-#include "dex_file-inl.h"
-#include "dex_file_exception_helpers.h"
-#include "dex_instruction-inl.h"
-#include "dex_instruction_utils.h"
+#include "dex/dex_file-inl.h"
+#include "dex/dex_file_exception_helpers.h"
+#include "dex/dex_instruction-inl.h"
+#include "dex/dex_instruction_utils.h"
#include "experimental_flags.h"
#include "gc/accounting/card_table-inl.h"
#include "handle_scope-inl.h"
diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h
index b66433c..cadf4eb 100644
--- a/runtime/verifier/method_verifier.h
+++ b/runtime/verifier/method_verifier.h
@@ -25,9 +25,9 @@
#include "base/macros.h"
#include "base/scoped_arena_containers.h"
#include "base/value_object.h"
-#include "code_item_accessors.h"
-#include "dex_file.h"
-#include "dex_file_types.h"
+#include "dex/code_item_accessors.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_types.h"
#include "handle.h"
#include "instruction_flags.h"
#include "method_reference.h"
diff --git a/runtime/verifier/method_verifier_test.cc b/runtime/verifier/method_verifier_test.cc
index d987467..97c1b62 100644
--- a/runtime/verifier/method_verifier_test.cc
+++ b/runtime/verifier/method_verifier_test.cc
@@ -23,7 +23,7 @@
#include "class_linker-inl.h"
#include "common_runtime_test.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "scoped_thread_state_change-inl.h"
#include "utils.h"
#include "verifier_enums.h"
diff --git a/runtime/verifier/reg_type.cc b/runtime/verifier/reg_type.cc
index 309c374..7ebdd90 100644
--- a/runtime/verifier/reg_type.cc
+++ b/runtime/verifier/reg_type.cc
@@ -22,7 +22,7 @@
#include "base/bit_vector-inl.h"
#include "base/casts.h"
#include "class_linker-inl.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "method_verifier.h"
#include "mirror/class-inl.h"
#include "mirror/class.h"
diff --git a/runtime/verifier/reg_type_cache.cc b/runtime/verifier/reg_type_cache.cc
index c68fa0f..5564684 100644
--- a/runtime/verifier/reg_type_cache.cc
+++ b/runtime/verifier/reg_type_cache.cc
@@ -25,7 +25,7 @@
#include "base/scoped_arena_allocator.h"
#include "base/stl_util.h"
#include "class_linker-inl.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "mirror/class-inl.h"
#include "mirror/object-inl.h"
#include "reg_type-inl.h"
diff --git a/runtime/verifier/register_line.cc b/runtime/verifier/register_line.cc
index 34c406e..ea30e05 100644
--- a/runtime/verifier/register_line.cc
+++ b/runtime/verifier/register_line.cc
@@ -18,7 +18,7 @@
#include "android-base/stringprintf.h"
-#include "dex_instruction-inl.h"
+#include "dex/dex_instruction-inl.h"
#include "method_verifier-inl.h"
#include "reg_type-inl.h"
#include "register_line-inl.h"
diff --git a/runtime/verifier/verifier_deps.cc b/runtime/verifier/verifier_deps.cc
index 0481f24..7d8c5aa 100644
--- a/runtime/verifier/verifier_deps.cc
+++ b/runtime/verifier/verifier_deps.cc
@@ -22,7 +22,7 @@
#include "art_method-inl.h"
#include "base/stl_util.h"
#include "compiler_callbacks.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "indenter.h"
#include "leb128.h"
#include "mirror/class-inl.h"
diff --git a/runtime/verifier/verifier_deps.h b/runtime/verifier/verifier_deps.h
index 4069a11..94441da 100644
--- a/runtime/verifier/verifier_deps.h
+++ b/runtime/verifier/verifier_deps.h
@@ -23,7 +23,7 @@
#include "base/array_ref.h"
#include "base/mutex.h"
-#include "dex_file_types.h"
+#include "dex/dex_file_types.h"
#include "handle.h"
#include "obj_ptr.h"
#include "thread.h"
diff --git a/runtime/well_known_classes.cc b/runtime/well_known_classes.cc
index 5fef7df..dc57f81 100644
--- a/runtime/well_known_classes.cc
+++ b/runtime/well_known_classes.cc
@@ -81,6 +81,7 @@
jclass WellKnownClasses::org_apache_harmony_dalvik_ddmc_Chunk;
jclass WellKnownClasses::org_apache_harmony_dalvik_ddmc_DdmServer;
+jmethodID WellKnownClasses::dalvik_system_BaseDexClassLoader_getLdLibraryPath;
jmethodID WellKnownClasses::dalvik_system_VMRuntime_runFinalization;
jmethodID WellKnownClasses::java_lang_Boolean_valueOf;
jmethodID WellKnownClasses::java_lang_Byte_valueOf;
@@ -325,6 +326,7 @@
org_apache_harmony_dalvik_ddmc_Chunk = CacheClass(env, "org/apache/harmony/dalvik/ddmc/Chunk");
org_apache_harmony_dalvik_ddmc_DdmServer = CacheClass(env, "org/apache/harmony/dalvik/ddmc/DdmServer");
+ dalvik_system_BaseDexClassLoader_getLdLibraryPath = CacheMethod(env, dalvik_system_BaseDexClassLoader, false, "getLdLibraryPath", "()Ljava/lang/String;");
dalvik_system_VMRuntime_runFinalization = CacheMethod(env, dalvik_system_VMRuntime, true, "runFinalization", "(J)V");
java_lang_ClassNotFoundException_init = CacheMethod(env, java_lang_ClassNotFoundException, false, "<init>", "(Ljava/lang/String;Ljava/lang/Throwable;)V");
java_lang_ClassLoader_loadClass = CacheMethod(env, java_lang_ClassLoader, false, "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;");
@@ -406,7 +408,7 @@
// to make sure these JNI methods are available.
java_lang_Runtime_nativeLoad =
CacheMethod(env, java_lang_Runtime.get(), true, "nativeLoad",
- "(Ljava/lang/String;Ljava/lang/ClassLoader;Ljava/lang/String;)"
+ "(Ljava/lang/String;Ljava/lang/ClassLoader;)"
"Ljava/lang/String;");
java_lang_reflect_Proxy_invoke =
CacheMethod(env, java_lang_reflect_Proxy, true, "invoke",
@@ -465,6 +467,7 @@
org_apache_harmony_dalvik_ddmc_Chunk = nullptr;
org_apache_harmony_dalvik_ddmc_DdmServer = nullptr;
+ dalvik_system_BaseDexClassLoader_getLdLibraryPath = nullptr;
dalvik_system_VMRuntime_runFinalization = nullptr;
java_lang_Boolean_valueOf = nullptr;
java_lang_Byte_valueOf = nullptr;
diff --git a/runtime/well_known_classes.h b/runtime/well_known_classes.h
index 3ebcc33..024971a 100644
--- a/runtime/well_known_classes.h
+++ b/runtime/well_known_classes.h
@@ -92,6 +92,7 @@
static jclass org_apache_harmony_dalvik_ddmc_Chunk;
static jclass org_apache_harmony_dalvik_ddmc_DdmServer;
+ static jmethodID dalvik_system_BaseDexClassLoader_getLdLibraryPath;
static jmethodID dalvik_system_VMRuntime_runFinalization;
static jmethodID java_lang_Boolean_valueOf;
static jmethodID java_lang_Byte_valueOf;
diff --git a/test/008-exceptions/src/Main.java b/test/008-exceptions/src/Main.java
index 89fe016..008576a 100644
--- a/test/008-exceptions/src/Main.java
+++ b/test/008-exceptions/src/Main.java
@@ -158,8 +158,8 @@
t.printStackTrace(System.out);
}
try {
- // Before splitting mirror::Class::kStatusError into
- // kStatusErrorUnresolved and kStatusErrorResolved,
+ // Before splitting ClassStatus::kError into
+ // ClassStatus::kErrorUnresolved and ClassStatus::kErrorResolved,
// this would trigger a
// CHECK(super_class->IsResolved())
// failure in
@@ -188,8 +188,8 @@
} catch (Throwable t) {
t.printStackTrace(System.out);
}
- // Before splitting mirror::Class::kStatusError into
- // kStatusErrorUnresolved and kStatusErrorResolved,
+ // Before splitting ClassStatus::kError into
+ // ClassStatus::kErrorUnresolved and ClassStatus::kErrorResolved,
// the exception from wrapper 1 would have been
// wrapped in NoClassDefFoundError but the exception
// from wrapper 2 would have been unwrapped.
diff --git a/test/117-nopatchoat/nopatchoat.cc b/test/117-nopatchoat/nopatchoat.cc
index 2248fc4..7c38258 100644
--- a/test/117-nopatchoat/nopatchoat.cc
+++ b/test/117-nopatchoat/nopatchoat.cc
@@ -15,7 +15,7 @@
*/
#include "class_linker.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "gc/heap.h"
#include "gc/space/image_space.h"
#include "mirror/class-inl.h"
diff --git a/test/150-loadlibrary/src/Main.java b/test/150-loadlibrary/src/Main.java
index 9086937..ec96221 100644
--- a/test/150-loadlibrary/src/Main.java
+++ b/test/150-loadlibrary/src/Main.java
@@ -47,7 +47,7 @@
// Then call an internal function that accepts the classloader. Do not use load(), as it
// is deprecated and only there for backwards compatibility, and prints a warning to the
// log that we'd have to strip (it contains the pid).
- Method m = Runtime.class.getDeclaredMethod("doLoad", String.class, ClassLoader.class);
+ Method m = Runtime.class.getDeclaredMethod("nativeLoad", String.class, ClassLoader.class);
m.setAccessible(true);
Object result = m.invoke(Runtime.getRuntime(), fileName, bootClassLoader);
if (result != null) {
diff --git a/test/466-get-live-vreg/get_live_vreg_jni.cc b/test/466-get-live-vreg/get_live_vreg_jni.cc
index 24792f1..aeb9e44 100644
--- a/test/466-get-live-vreg/get_live_vreg_jni.cc
+++ b/test/466-get-live-vreg/get_live_vreg_jni.cc
@@ -16,7 +16,7 @@
#include "arch/context.h"
#include "art_method-inl.h"
-#include "code_item_accessors-inl.h"
+#include "dex/code_item_accessors-inl.h"
#include "jni.h"
#include "oat_quick_method_header.h"
#include "scoped_thread_state_change-inl.h"
diff --git a/test/595-profile-saving/profile-saving.cc b/test/595-profile-saving/profile-saving.cc
index 06e3fb4..b2af91e 100644
--- a/test/595-profile-saving/profile-saving.cc
+++ b/test/595-profile-saving/profile-saving.cc
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "art_method-inl.h"
#include "jit/profile_compilation_info.h"
diff --git a/test/626-const-class-linking/clear_dex_cache_types.cc b/test/626-const-class-linking/clear_dex_cache_types.cc
index e1af02e..96ef266 100644
--- a/test/626-const-class-linking/clear_dex_cache_types.cc
+++ b/test/626-const-class-linking/clear_dex_cache_types.cc
@@ -36,10 +36,10 @@
ScopedObjectAccess soa(Thread::Current());
StackHandleScope<1> hs(soa.Self());
Handle<mirror::Class> klass = hs.NewHandle(soa.Decode<mirror::Class>(cls));
- mirror::Class::Status status = klass->GetStatus();
- if (status == mirror::Class::kStatusResolved) {
+ ClassStatus status = klass->GetStatus();
+ if (status == ClassStatus::kResolved) {
ObjectLock<mirror::Class> lock(soa.Self(), klass);
- klass->SetStatus(klass, mirror::Class::kStatusVerified, soa.Self());
+ klass->SetStatus(klass, ClassStatus::kVerified, soa.Self());
} else {
LOG(ERROR) << klass->PrettyClass() << " has unexpected status: " << status;
}
diff --git a/test/664-aget-verifier/aget-verifier.cc b/test/664-aget-verifier/aget-verifier.cc
index 41372ad..4a263fa 100644
--- a/test/664-aget-verifier/aget-verifier.cc
+++ b/test/664-aget-verifier/aget-verifier.cc
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "dex_file.h"
+#include "dex/dex_file.h"
#include "art_method-inl.h"
#include "jni.h"
diff --git a/test/983-source-transform-verify/source_transform.cc b/test/983-source-transform-verify/source_transform.cc
index 831e01c..55dc603 100644
--- a/test/983-source-transform-verify/source_transform.cc
+++ b/test/983-source-transform-verify/source_transform.cc
@@ -27,10 +27,10 @@
#include "base/macros.h"
#include "bytecode_utils.h"
-#include "code_item_accessors-inl.h"
-#include "dex_file.h"
-#include "dex_file_loader.h"
-#include "dex_instruction.h"
+#include "dex/code_item_accessors-inl.h"
+#include "dex/dex_file.h"
+#include "dex/dex_file_loader.h"
+#include "dex/dex_instruction.h"
#include "jit/jit.h"
#include "native_stack_dump.h"
#include "runtime.h"
diff --git a/test/common/runtime_state.cc b/test/common/runtime_state.cc
index 1eed80e..22c5106 100644
--- a/test/common/runtime_state.cc
+++ b/test/common/runtime_state.cc
@@ -21,7 +21,7 @@
#include "art_method-inl.h"
#include "base/enums.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "instrumentation.h"
#include "jit/jit.h"
#include "jit/jit_code_cache.h"
diff --git a/test/common/stack_inspect.cc b/test/common/stack_inspect.cc
index 046b1fb..fd62737 100644
--- a/test/common/stack_inspect.cc
+++ b/test/common/stack_inspect.cc
@@ -19,7 +19,7 @@
#include <android-base/logging.h>
#include "base/mutex.h"
-#include "dex_file-inl.h"
+#include "dex/dex_file-inl.h"
#include "jni_internal.h"
#include "mirror/class-inl.h"
#include "nth_caller_visitor.h"
diff --git a/tools/cpp-define-generator/constant_class.def b/tools/cpp-define-generator/constant_class.def
index f46cd33..4f1d875 100644
--- a/tools/cpp-define-generator/constant_class.def
+++ b/tools/cpp-define-generator/constant_class.def
@@ -15,7 +15,6 @@
*/
#if defined(DEFINE_INCLUDE_DEPENDENCIES)
-#include "mirror/class.h" // kStatusInitialized
#include "modifiers.h" // kAccClassIsFinalizable
#include "base/bit_utils.h" // MostSignificantBit
#endif
@@ -23,7 +22,6 @@
#define DEFINE_FLAG_OFFSET(type_name, field_name, expr) \
DEFINE_EXPR(type_name ## _ ## field_name, uint32_t, (expr))
-DEFINE_FLAG_OFFSET(MIRROR_CLASS, STATUS_INITIALIZED, art::mirror::Class::kStatusInitialized)
DEFINE_FLAG_OFFSET(ACCESS_FLAGS, CLASS_IS_FINALIZABLE, art::kAccClassIsFinalizable)
DEFINE_FLAG_OFFSET(ACCESS_FLAGS, CLASS_IS_INTERFACE, art::kAccInterface)
// TODO: We should really have a BitPosition which also checks it's a power of 2.
diff --git a/tools/titrace/instruction_decoder.cc b/tools/titrace/instruction_decoder.cc
index bc4660b..d8fb713 100644
--- a/tools/titrace/instruction_decoder.cc
+++ b/tools/titrace/instruction_decoder.cc
@@ -15,7 +15,7 @@
#include "instruction_decoder.h"
-#include "dex_instruction_list.h"
+#include "dex/dex_instruction_list.h"
#include <android-base/logging.h>