summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dmitrii Ishcheikin <ishcheikin@google.com> 2024-01-22 13:47:24 +0000
committer Dmitrii Ishcheikin <ishcheikin@google.com> 2024-01-22 16:10:44 +0000
commit689cca840843eeced3206da16e475856de953360 (patch)
treef65bcc4b6f9805acd2a9535e1a2ac0fd1bb1a762
parentca4fab9f32b2253d36a6b6cecbc351a89eda30e2 (diff)
Add visibility attributes in runtime/oat
Bug: 260881207 Test: presubmit Test: abtd app_compat_drm Test: abtd app_compat_top_100 Test: abtd app_compat_banking Change-Id: I519641809a15361af5bb62556f6f23ee187e9f1e
-rw-r--r--runtime/oat/image-inl.h2
-rw-r--r--runtime/oat/image.cc2
-rw-r--r--runtime/oat/image.h75
-rw-r--r--runtime/oat/index_bss_mapping.cc2
-rw-r--r--runtime/oat/index_bss_mapping.h3
-rw-r--r--runtime/oat/oat.cc2
-rw-r--r--runtime/oat/oat.h4
-rw-r--r--runtime/oat/oat_file-inl.h2
-rw-r--r--runtime/oat/oat_file.cc2
-rw-r--r--runtime/oat/oat_file.h81
-rw-r--r--runtime/oat/oat_file_assistant.cc2
-rw-r--r--runtime/oat/oat_file_assistant.h83
-rw-r--r--runtime/oat/oat_file_assistant_context.cc2
-rw-r--r--runtime/oat/oat_file_assistant_context.h9
-rw-r--r--runtime/oat/oat_file_assistant_test.cc2
-rw-r--r--runtime/oat/oat_file_manager.cc2
-rw-r--r--runtime/oat/oat_file_manager.h13
-rw-r--r--runtime/oat/oat_file_test.cc2
-rw-r--r--runtime/oat/oat_quick_method_header.cc2
-rw-r--r--runtime/oat/oat_quick_method_header.h14
-rw-r--r--runtime/oat/stack_map.cc2
-rw-r--r--runtime/oat/stack_map.h34
22 files changed, 174 insertions, 168 deletions
diff --git a/runtime/oat/image-inl.h b/runtime/oat/image-inl.h
index b8664da269..5995600c27 100644
--- a/runtime/oat/image-inl.h
+++ b/runtime/oat/image-inl.h
@@ -26,7 +26,7 @@
#include "obj_ptr-inl.h"
#include "read_barrier-inl.h"
-namespace art {
+namespace art HIDDEN {
template <ReadBarrierOption kReadBarrierOption>
inline ObjPtr<mirror::Object> ImageHeader::GetImageRoot(ImageRoot image_root) const {
diff --git a/runtime/oat/image.cc b/runtime/oat/image.cc
index b005cd0586..a7ac8e0ebd 100644
--- a/runtime/oat/image.cc
+++ b/runtime/oat/image.cc
@@ -31,7 +31,7 @@
#include "mirror/object_array-inl.h"
#include "mirror/object_array.h"
-namespace art {
+namespace art HIDDEN {
const uint8_t ImageHeader::kImageMagic[] = { 'a', 'r', 't', '\n' };
// Last change: Split intrinsics list - with and without HIR.
diff --git a/runtime/oat/image.h b/runtime/oat/image.h
index 3bcbdd9db3..23c92a1aa8 100644
--- a/runtime/oat/image.h
+++ b/runtime/oat/image.h
@@ -21,12 +21,13 @@
#include "base/enums.h"
#include "base/iteration_range.h"
+#include "base/macros.h"
#include "base/os.h"
#include "base/unix_file/fd_file.h"
#include "mirror/object.h"
#include "runtime_globals.h"
-namespace art {
+namespace art HIDDEN {
class ArtField;
class ArtMethod;
@@ -128,25 +129,25 @@ class PACKED(8) ImageHeader {
};
ImageHeader() {}
- ImageHeader(uint32_t image_reservation_size,
- uint32_t component_count,
- uint32_t image_begin,
- uint32_t image_size,
- ImageSection* sections,
- uint32_t image_roots,
- uint32_t oat_checksum,
- uint32_t oat_file_begin,
- uint32_t oat_data_begin,
- uint32_t oat_data_end,
- uint32_t oat_file_end,
- uint32_t boot_image_begin,
- uint32_t boot_image_size,
- uint32_t boot_image_component_count,
- uint32_t boot_image_checksum,
- uint32_t pointer_size);
-
- bool IsValid() const;
- const char* GetMagic() const;
+ EXPORT ImageHeader(uint32_t image_reservation_size,
+ uint32_t component_count,
+ uint32_t image_begin,
+ uint32_t image_size,
+ ImageSection* sections,
+ uint32_t image_roots,
+ uint32_t oat_checksum,
+ uint32_t oat_file_begin,
+ uint32_t oat_data_begin,
+ uint32_t oat_data_end,
+ uint32_t oat_file_end,
+ uint32_t boot_image_begin,
+ uint32_t boot_image_size,
+ uint32_t boot_image_component_count,
+ uint32_t boot_image_checksum,
+ uint32_t pointer_size);
+
+ EXPORT bool IsValid() const;
+ EXPORT const char* GetMagic() const;
uint32_t GetImageReservationSize() const {
return image_reservation_size_;
@@ -198,7 +199,7 @@ class PACKED(8) ImageHeader {
return reinterpret_cast<uint8_t*>(oat_file_end_);
}
- PointerSize GetPointerSize() const;
+ EXPORT PointerSize GetPointerSize() const;
uint32_t GetPointerSizeUnchecked() const {
return pointer_size_;
@@ -280,9 +281,9 @@ class PACKED(8) ImageHeader {
return kImageRootsMax;
}
- ArtMethod* GetImageMethod(ImageMethod index) const;
+ EXPORT ArtMethod* GetImageMethod(ImageMethod index) const;
- static const char* GetImageSectionName(ImageSections index);
+ EXPORT static const char* GetImageSectionName(ImageSections index);
ImageSection& GetImageSection(ImageSections index) {
DCHECK_LT(static_cast<size_t>(index), kSectionCount);
@@ -369,15 +370,13 @@ class PACKED(8) ImageHeader {
return data_size_;
}
- bool IsAppImage() const;
+ EXPORT bool IsAppImage() const;
- uint32_t GetImageSpaceCount() const;
+ EXPORT uint32_t GetImageSpaceCount() const;
// Visit mirror::Objects in the section starting at base.
// TODO: Delete base parameter if it is always equal to GetImageBegin.
- void VisitObjects(ObjectVisitor* visitor,
- uint8_t* base,
- PointerSize pointer_size) const
+ EXPORT void VisitObjects(ObjectVisitor* visitor, uint8_t* base, PointerSize pointer_size) const
REQUIRES_SHARED(Locks::mutator_lock_);
// Visit ArtMethods in the section starting at base. Includes runtime methods.
@@ -424,13 +423,13 @@ class PACKED(8) ImageHeader {
// Helper for writing `data` and `bitmap_data` into `image_file`, following
// the information stored in this header and passed as arguments.
- bool WriteData(const ImageFileGuard& image_file,
- const uint8_t* data,
- const uint8_t* bitmap_data,
- ImageHeader::StorageMode image_storage_mode,
- uint32_t max_image_block_size,
- bool update_checksum,
- std::string* error_msg);
+ EXPORT bool WriteData(const ImageFileGuard& image_file,
+ const uint8_t* data,
+ const uint8_t* bitmap_data,
+ ImageHeader::StorageMode image_storage_mode,
+ uint32_t max_image_block_size,
+ bool update_checksum,
+ std::string* error_msg);
private:
static const uint8_t kImageMagic[4];
@@ -591,10 +590,10 @@ using AppImageReferenceOffsetInfo = std::pair<uint32_t, uint32_t>;
std::ostream& operator<<(std::ostream& os, ImageHeader::ImageMethod method);
std::ostream& operator<<(std::ostream& os, ImageHeader::ImageRoot root);
-std::ostream& operator<<(std::ostream& os, ImageHeader::ImageSections section);
-std::ostream& operator<<(std::ostream& os, ImageHeader::StorageMode mode);
+EXPORT std::ostream& operator<<(std::ostream& os, ImageHeader::ImageSections section);
+EXPORT std::ostream& operator<<(std::ostream& os, ImageHeader::StorageMode mode);
-std::ostream& operator<<(std::ostream& os, const ImageSection& section);
+EXPORT std::ostream& operator<<(std::ostream& os, const ImageSection& section);
// Wrapper over LZ4_decompress_safe() that checks if return value is negative. See b/242914915.
bool LZ4_decompress_safe_checked(const char* source,
diff --git a/runtime/oat/index_bss_mapping.cc b/runtime/oat/index_bss_mapping.cc
index f6e083d613..ce1923067d 100644
--- a/runtime/oat/index_bss_mapping.cc
+++ b/runtime/oat/index_bss_mapping.cc
@@ -21,7 +21,7 @@
#include "base/bit_utils.h"
#include "base/length_prefixed_array.h"
-namespace art {
+namespace art HIDDEN {
size_t IndexBssMappingEntry::GetBssOffset(size_t index_bits,
uint32_t index,
diff --git a/runtime/oat/index_bss_mapping.h b/runtime/oat/index_bss_mapping.h
index bc8db33fc9..9fd4214fc6 100644
--- a/runtime/oat/index_bss_mapping.h
+++ b/runtime/oat/index_bss_mapping.h
@@ -20,8 +20,9 @@
#include <android-base/logging.h>
#include "base/bit_utils.h"
+#include "base/macros.h"
-namespace art {
+namespace art HIDDEN {
template<typename T> class LengthPrefixedArray;
diff --git a/runtime/oat/oat.cc b/runtime/oat/oat.cc
index e83d27736c..9cec2e9869 100644
--- a/runtime/oat/oat.cc
+++ b/runtime/oat/oat.cc
@@ -25,7 +25,7 @@
#include "base/bit_utils.h"
#include "base/strlcpy.h"
-namespace art {
+namespace art HIDDEN {
using android::base::StringPrintf;
diff --git a/runtime/oat/oat.h b/runtime/oat/oat.h
index 6db50e3b7b..1d6a71a560 100644
--- a/runtime/oat/oat.h
+++ b/runtime/oat/oat.h
@@ -24,7 +24,7 @@
#include "base/macros.h"
#include "base/safe_map.h"
-namespace art {
+namespace art HIDDEN {
enum class InstructionSet;
class InstructionSetFeatures;
@@ -41,7 +41,7 @@ enum class StubType {
};
std::ostream& operator<<(std::ostream& stream, StubType stub_type);
-class PACKED(4) OatHeader {
+class EXPORT PACKED(4) OatHeader {
public:
static constexpr std::array<uint8_t, 4> kOatMagic { { 'o', 'a', 't', '\n' } };
// Last oat version changed reason: store resolved MethodType-s in .bss.
diff --git a/runtime/oat/oat_file-inl.h b/runtime/oat/oat_file-inl.h
index eeb94d7260..1a81f22b6c 100644
--- a/runtime/oat/oat_file-inl.h
+++ b/runtime/oat/oat_file-inl.h
@@ -23,7 +23,7 @@
#include "oat_quick_method_header.h"
#include "runtime-inl.h"
-namespace art {
+namespace art HIDDEN {
inline const OatQuickMethodHeader* OatFile::OatMethod::GetOatQuickMethodHeader() const {
const void* code = EntryPointToCodePointer(GetQuickCode());
diff --git a/runtime/oat/oat_file.cc b/runtime/oat/oat_file.cc
index ce2d4fec7b..4e1c887faa 100644
--- a/runtime/oat/oat_file.cc
+++ b/runtime/oat/oat_file.cc
@@ -74,7 +74,7 @@
#include "vdex_file.h"
#include "verifier/verifier_deps.h"
-namespace art {
+namespace art HIDDEN {
using android::base::StringPrintf;
diff --git a/runtime/oat/oat_file.h b/runtime/oat/oat_file.h
index 9ce6547e38..3c7aaa7d3c 100644
--- a/runtime/oat/oat_file.h
+++ b/runtime/oat/oat_file.h
@@ -25,6 +25,7 @@
#include "base/array_ref.h"
#include "base/compiler_filter.h"
+#include "base/macros.h"
#include "base/mutex.h"
#include "base/os.h"
#include "base/safe_map.h"
@@ -37,7 +38,7 @@
#include "index_bss_mapping.h"
#include "mirror/object.h"
-namespace art {
+namespace art HIDDEN {
class BitVector;
class ClassLoaderContext;
@@ -76,7 +77,7 @@ enum class OatClassType : uint8_t {
kOatClassMax = 3,
};
-std::ostream& operator<<(std::ostream& os, OatClassType rhs);
+EXPORT std::ostream& operator<<(std::ostream& os, OatClassType rhs);
class PACKED(4) OatMethodOffsets {
public:
@@ -105,23 +106,23 @@ class OatFile {
// from oat file when opening the dex files if they are not embedded in the
// vdex file. These may differ for cross-compilation (the dex file name is
// the host path and dex location is the future path on target) and testing.
- static OatFile* Open(int zip_fd,
- const std::string& filename,
- const std::string& location,
- bool executable,
- bool low_4gb,
- ArrayRef<const std::string> dex_filenames,
- ArrayRef<File> dex_files,
- /*inout*/ MemMap* reservation, // Where to load if not null.
- /*out*/ std::string* error_msg);
+ EXPORT static OatFile* Open(int zip_fd,
+ const std::string& filename,
+ const std::string& location,
+ bool executable,
+ bool low_4gb,
+ ArrayRef<const std::string> dex_filenames,
+ ArrayRef<File> dex_files,
+ /*inout*/ MemMap* reservation, // Where to load if not null.
+ /*out*/ std::string* error_msg);
// Helper overload that takes a single dex filename and no reservation.
- static OatFile* Open(int zip_fd,
- const std::string& filename,
- const std::string& location,
- bool executable,
- bool low_4gb,
- const std::string& dex_filename,
- /*out*/std::string* error_msg) {
+ EXPORT static OatFile* Open(int zip_fd,
+ const std::string& filename,
+ const std::string& location,
+ bool executable,
+ bool low_4gb,
+ const std::string& dex_filename,
+ /*out*/ std::string* error_msg) {
return Open(zip_fd,
filename,
location,
@@ -191,7 +192,7 @@ class OatFile {
// Indicates whether the oat file was compiled with full debugging capability.
bool IsDebuggable() const;
- CompilerFilter::Filter GetCompilerFilter() const;
+ EXPORT CompilerFilter::Filter GetCompilerFilter() const;
std::string GetClassLoaderContext() const;
@@ -201,7 +202,7 @@ class OatFile {
return location_;
}
- const OatHeader& GetOatHeader() const;
+ EXPORT const OatHeader& GetOatHeader() const;
class OatMethod final {
public:
@@ -260,17 +261,17 @@ class OatFile {
// defintion. Direct methods come first, followed by virtual
// methods. Note that runtime created methods such as miranda
// methods are not included.
- const OatMethod GetOatMethod(uint32_t method_index) const;
+ EXPORT const OatMethod GetOatMethod(uint32_t method_index) const;
// Return a pointer to the OatMethodOffsets for the requested
// method_index, or null if none is present. Note that most
// callers should use GetOatMethod.
- const OatMethodOffsets* GetOatMethodOffsets(uint32_t method_index) const;
+ EXPORT const OatMethodOffsets* GetOatMethodOffsets(uint32_t method_index) const;
// Return the offset from the start of the OatFile to the
// OatMethodOffsets for the requested method_index, or 0 if none
// is present. Note that most callers should use GetOatMethod.
- uint32_t GetOatMethodOffsetsOffset(uint32_t method_index) const;
+ EXPORT uint32_t GetOatMethodOffsetsOffset(uint32_t method_index) const;
// A representation of an invalid OatClass, used when an OatClass can't be found.
// See FindOatClass().
@@ -348,8 +349,8 @@ class OatFile {
return DexEnd() - DexBegin();
}
- const uint8_t* Begin() const;
- const uint8_t* End() const;
+ EXPORT const uint8_t* Begin() const;
+ EXPORT const uint8_t* End() const;
const uint8_t* DataBimgRelRoBegin() const { return data_bimg_rel_ro_begin_; }
const uint8_t* DataBimgRelRoEnd() const { return data_bimg_rel_ro_end_; }
@@ -360,19 +361,19 @@ class OatFile {
const uint8_t* VdexBegin() const { return vdex_begin_; }
const uint8_t* VdexEnd() const { return vdex_end_; }
- const uint8_t* DexBegin() const;
- const uint8_t* DexEnd() const;
+ EXPORT const uint8_t* DexBegin() const;
+ EXPORT const uint8_t* DexEnd() const;
- ArrayRef<const uint32_t> GetBootImageRelocations() const;
- ArrayRef<ArtMethod*> GetBssMethods() const;
- ArrayRef<GcRoot<mirror::Object>> GetBssGcRoots() const;
+ EXPORT ArrayRef<const uint32_t> GetBootImageRelocations() const;
+ EXPORT ArrayRef<ArtMethod*> GetBssMethods() const;
+ EXPORT ArrayRef<GcRoot<mirror::Object>> GetBssGcRoots() const;
// Initialize relocation sections (.data.bimg.rel.ro and .bss).
void InitializeRelocations() const;
// Finds the associated oat class for a dex_file and descriptor. Returns an invalid OatClass on
// error and sets found to false.
- static OatClass FindOatClass(const DexFile& dex_file, uint16_t class_def_idx, bool* found);
+ EXPORT static OatClass FindOatClass(const DexFile& dex_file, uint16_t class_def_idx, bool* found);
VdexFile* GetVdexFile() const {
return vdex_.get();
@@ -503,7 +504,7 @@ class OatFile {
class OatDexFile final {
public:
// Opens the DexFile referred to by this OatDexFile from within the containing OatFile.
- std::unique_ptr<const DexFile> OpenDexFile(std::string* error_msg) const;
+ EXPORT std::unique_ptr<const DexFile> OpenDexFile(std::string* error_msg) const;
// May return null if the OatDexFile only contains a type lookup table. This case only happens
// for the compiler to speed up compilation, or in jitzygote.
@@ -512,7 +513,7 @@ class OatDexFile final {
}
// Returns the size of the DexFile refered to by this OatDexFile.
- size_t FileSize() const;
+ EXPORT size_t FileSize() const;
// Returns original path of DexFile that was the source of this OatDexFile.
const std::string& GetDexFileLocation() const {
@@ -542,10 +543,10 @@ class OatDexFile final {
DexFile::Sha1 GetSha1() const { return dex_file_sha1_; }
// Returns the OatClass for the class specified by the given DexFile class_def_index.
- OatFile::OatClass GetOatClass(uint16_t class_def_index) const;
+ EXPORT OatFile::OatClass GetOatClass(uint16_t class_def_index) const;
// Returns the offset to the OatClass information. Most callers should use GetOatClass.
- uint32_t GetOatClassOffset(uint16_t class_def_index) const;
+ EXPORT uint32_t GetOatClassOffset(uint16_t class_def_index) const;
const uint8_t* GetLookupTableData() const {
return lookup_table_data_;
@@ -581,18 +582,18 @@ class OatDexFile final {
// Looks up a class definition by its class descriptor. Hash must be
// ComputeModifiedUtf8Hash(descriptor).
- static const dex::ClassDef* FindClassDef(const DexFile& dex_file,
- const char* descriptor,
- size_t hash);
+ EXPORT static const dex::ClassDef* FindClassDef(const DexFile& dex_file,
+ const char* descriptor,
+ size_t hash);
const TypeLookupTable& GetTypeLookupTable() const {
return lookup_table_;
}
- ~OatDexFile();
+ EXPORT ~OatDexFile();
// Create only with a type lookup table, used by the compiler to speed up compilation.
- explicit OatDexFile(TypeLookupTable&& lookup_table);
+ EXPORT explicit OatDexFile(TypeLookupTable&& lookup_table);
// Return the dex layout sections.
const DexLayoutSections* GetDexLayoutSections() const {
diff --git a/runtime/oat/oat_file_assistant.cc b/runtime/oat/oat_file_assistant.cc
index 41f7709979..2eaf966ec6 100644
--- a/runtime/oat/oat_file_assistant.cc
+++ b/runtime/oat/oat_file_assistant.cc
@@ -56,7 +56,7 @@
#include "vdex_file.h"
#include "zlib.h"
-namespace art {
+namespace art HIDDEN {
using ::android::base::ConsumePrefix;
using ::android::base::StringPrintf;
diff --git a/runtime/oat/oat_file_assistant.h b/runtime/oat/oat_file_assistant.h
index 01fe7c5aad..2c9b8ab204 100644
--- a/runtime/oat/oat_file_assistant.h
+++ b/runtime/oat/oat_file_assistant.h
@@ -27,6 +27,7 @@
#include "arch/instruction_set.h"
#include "base/compiler_filter.h"
+#include "base/macros.h"
#include "base/os.h"
#include "base/scoped_flock.h"
#include "base/unix_file/fd_file.h"
@@ -34,7 +35,7 @@
#include "oat_file.h"
#include "oat_file_assistant_context.h"
-namespace art {
+namespace art HIDDEN {
namespace gc {
namespace space {
@@ -161,31 +162,31 @@ class OatFileAssistant {
//
// runtime_options should be provided with all the required fields filled if the caller intends to
// use OatFileAssistant without a runtime.
- OatFileAssistant(const char* dex_location,
- const InstructionSet isa,
- ClassLoaderContext* context,
- bool load_executable,
- bool only_load_trusted_executable = false,
- OatFileAssistantContext* ofa_context = nullptr);
+ EXPORT OatFileAssistant(const char* dex_location,
+ const InstructionSet isa,
+ ClassLoaderContext* context,
+ bool load_executable,
+ bool only_load_trusted_executable = false,
+ OatFileAssistantContext* ofa_context = nullptr);
// Similar to this(const char*, const InstructionSet, bool), however, if a valid zip_fd is
// provided, vdex, oat, and zip files will be read from vdex_fd, oat_fd and zip_fd respectively.
// Otherwise, dex_location will be used to construct necessary filenames.
- OatFileAssistant(const char* dex_location,
- const InstructionSet isa,
- ClassLoaderContext* context,
- bool load_executable,
- bool only_load_trusted_executable,
- OatFileAssistantContext* ofa_context,
- int vdex_fd,
- int oat_fd,
- int zip_fd);
+ EXPORT OatFileAssistant(const char* dex_location,
+ const InstructionSet isa,
+ ClassLoaderContext* context,
+ bool load_executable,
+ bool only_load_trusted_executable,
+ OatFileAssistantContext* ofa_context,
+ int vdex_fd,
+ int oat_fd,
+ int zip_fd);
// A convenient factory function that accepts ISA, class loader context, and compiler filter in
// strings. Returns the created instance and ClassLoaderContext on success, or returns nullptr and
// outputs an error message if it fails to parse the input strings.
// The returned ClassLoaderContext must live at least as long as the OatFileAssistant.
- static std::unique_ptr<OatFileAssistant> Create(
+ EXPORT static std::unique_ptr<OatFileAssistant> Create(
const std::string& filename,
const std::string& isa_str,
const std::optional<std::string>& context_str,
@@ -197,7 +198,7 @@ class OatFileAssistant {
// Returns true if the dex location refers to an element of the boot class
// path.
- bool IsInBootClassPath();
+ EXPORT bool IsInBootClassPath();
// Return what action needs to be taken to produce up-to-date code for this
// dex location. If "downgrade" is set to false, it verifies if the current
@@ -215,15 +216,15 @@ class OatFileAssistant {
// the oat file in the odex location.
//
// Deprecated. Use the other overload.
- int GetDexOptNeeded(CompilerFilter::Filter target_compiler_filter,
- bool profile_changed = false,
- bool downgrade = false);
+ EXPORT int GetDexOptNeeded(CompilerFilter::Filter target_compiler_filter,
+ bool profile_changed = false,
+ bool downgrade = false);
// Returns true if dexopt needs to be performed with respect to the given target compilation
// filter and dexopt trigger. Also returns the status of the current oat file and/or vdex file.
- bool GetDexOptNeeded(CompilerFilter::Filter target_compiler_filter,
- const DexOptTrigger dexopt_trigger,
- /*out*/ DexOptStatus* dexopt_status);
+ EXPORT bool GetDexOptNeeded(CompilerFilter::Filter target_compiler_filter,
+ const DexOptTrigger dexopt_trigger,
+ /*out*/ DexOptStatus* dexopt_status);
// Returns true if there is up-to-date code for this dex location,
// irrespective of the compiler filter of the up-to-date code.
@@ -254,11 +255,11 @@ class OatFileAssistant {
// This method will try to mimic the runtime effect of loading the dex file.
// For example, if there is no usable oat file, the compiler filter will be set
// to "run-from-apk".
- void GetOptimizationStatus(std::string* out_odex_location,
- std::string* out_compilation_filter,
- std::string* out_compilation_reason,
- std::string* out_odex_status,
- Location* out_location);
+ EXPORT void GetOptimizationStatus(std::string* out_odex_location,
+ std::string* out_compilation_filter,
+ std::string* out_compilation_reason,
+ std::string* out_odex_status,
+ Location* out_location);
static void GetOptimizationStatus(const std::string& filename,
InstructionSet isa,
@@ -288,7 +289,7 @@ class OatFileAssistant {
std::vector<std::unique_ptr<const DexFile>>* out_dex_files);
// Returns whether this is an apk/zip wit a classes.dex entry, or nullopt if an error occurred.
- std::optional<bool> HasDexFiles(std::string* error_msg);
+ EXPORT std::optional<bool> HasDexFiles(std::string* error_msg);
// If the dex file has been installed with a compiled oat file alongside
// it, the compiled oat file will have the extension .odex, and is referred
@@ -317,10 +318,10 @@ class OatFileAssistant {
// Returns false on error, in which case error_msg describes the error and
// odex_filename is not changed.
// Neither odex_filename nor error_msg may be null.
- static bool DexLocationToOdexFilename(const std::string& location,
- InstructionSet isa,
- std::string* odex_filename,
- std::string* error_msg);
+ EXPORT static bool DexLocationToOdexFilename(const std::string& location,
+ InstructionSet isa,
+ std::string* odex_filename,
+ std::string* error_msg);
// Constructs the oat file name for the given dex location.
// Returns true on success, in which case oat_filename is set to the oat
@@ -338,11 +339,11 @@ class OatFileAssistant {
// Same as above, but also takes `deny_art_apex_data_files` from input.
//
// Calling this function does not require an active runtime.
- static bool DexLocationToOatFilename(const std::string& location,
- InstructionSet isa,
- bool deny_art_apex_data_files,
- std::string* oat_filename,
- std::string* error_msg);
+ EXPORT static bool DexLocationToOatFilename(const std::string& location,
+ InstructionSet isa,
+ bool deny_art_apex_data_files,
+ std::string* oat_filename,
+ std::string* error_msg);
// Computes the dex location and vdex filename. If the data directory of the process
// is known, creates an absolute path in that directory and tries to infer path
@@ -357,12 +358,12 @@ class OatFileAssistant {
// Returns true if a filename (given as basename) is a name of a vdex for
// anonymous dex file(s) created by AnonymousDexVdexLocation.
- static bool IsAnonymousVdexBasename(const std::string& basename);
+ EXPORT static bool IsAnonymousVdexBasename(const std::string& basename);
bool ClassLoaderContextIsOkay(const OatFile& oat_file) const;
// Validates the boot class path checksum of an OatFile.
- bool ValidateBootClassPathChecksums(const OatFile& oat_file);
+ EXPORT bool ValidateBootClassPathChecksums(const OatFile& oat_file);
// Validates the given bootclasspath and bootclasspath checksums found in an oat header.
static bool ValidateBootClassPathChecksums(OatFileAssistantContext* ofa_context,
diff --git a/runtime/oat/oat_file_assistant_context.cc b/runtime/oat/oat_file_assistant_context.cc
index 0e53c5cf38..fd168ffa04 100644
--- a/runtime/oat/oat_file_assistant_context.cc
+++ b/runtime/oat/oat_file_assistant_context.cc
@@ -33,7 +33,7 @@
#include "gc/heap.h"
#include "gc/space/image_space.h"
-namespace art {
+namespace art HIDDEN {
using ::android::base::StringPrintf;
using ::art::gc::space::ImageSpace;
diff --git a/runtime/oat/oat_file_assistant_context.h b/runtime/oat/oat_file_assistant_context.h
index 3029bbd25d..82b79edef0 100644
--- a/runtime/oat/oat_file_assistant_context.h
+++ b/runtime/oat/oat_file_assistant_context.h
@@ -23,9 +23,10 @@
#include <vector>
#include "arch/instruction_set.h"
+#include "base/macros.h"
#include "runtime.h"
-namespace art {
+namespace art HIDDEN {
// A helper class for OatFileAssistant that fetches and caches information including boot image
// checksums, bootclasspath checksums, and APEX versions. The same instance can be reused across
@@ -59,7 +60,7 @@ class OatFileAssistantContext {
// Constructs OatFileAssistantContext from runtime options. Does not fetch information on
// construction. Information will be fetched from disk when needed.
- explicit OatFileAssistantContext(std::unique_ptr<RuntimeOptions> runtime_options);
+ EXPORT explicit OatFileAssistantContext(std::unique_ptr<RuntimeOptions> runtime_options);
// Constructs OatFileAssistantContext from a runtime instance. Fetches as much information as
// possible from the runtime. The rest information will be fetched from disk when needed.
explicit OatFileAssistantContext(Runtime* runtime);
@@ -67,9 +68,9 @@ class OatFileAssistantContext {
const RuntimeOptions& GetRuntimeOptions() const;
// Fetches all information that hasn't been fetched from disk and caches it. All operations will
// be read-only after a successful call to this function.
- bool FetchAll(std::string* error_msg);
+ EXPORT bool FetchAll(std::string* error_msg);
// Returns information about the boot image of the given instruction set.
- const std::vector<BootImageInfo>& GetBootImageInfoList(InstructionSet isa);
+ EXPORT const std::vector<BootImageInfo>& GetBootImageInfoList(InstructionSet isa);
// Returns the checksums of the dex files in the BCP jar at the given index, or nullptr on error.
// The format of each checksum is "/<checksum_in_8_digit_hex>".
const std::vector<std::string>* GetBcpChecksums(size_t bcp_index, std::string* error_msg);
diff --git a/runtime/oat/oat_file_assistant_test.cc b/runtime/oat/oat_file_assistant_test.cc
index 132640d440..a3b370470f 100644
--- a/runtime/oat/oat_file_assistant_test.cc
+++ b/runtime/oat/oat_file_assistant_test.cc
@@ -45,7 +45,7 @@
#include "scoped_thread_state_change.h"
#include "thread.h"
-namespace art {
+namespace art HIDDEN {
class OatFileAssistantBaseTest : public DexoptTest {};
diff --git a/runtime/oat/oat_file_manager.cc b/runtime/oat/oat_file_manager.cc
index f7b8e7d989..11333b0249 100644
--- a/runtime/oat/oat_file_manager.cc
+++ b/runtime/oat/oat_file_manager.cc
@@ -60,7 +60,7 @@
#include "verifier/verifier_deps.h"
#include "well_known_classes.h"
-namespace art {
+namespace art HIDDEN {
using android::base::StringPrintf;
diff --git a/runtime/oat/oat_file_manager.h b/runtime/oat/oat_file_manager.h
index ecf285bb8a..c5d79c9fa0 100644
--- a/runtime/oat/oat_file_manager.h
+++ b/runtime/oat/oat_file_manager.h
@@ -28,7 +28,7 @@
#include "base/macros.h"
#include "jni.h"
-namespace art {
+namespace art HIDDEN {
namespace gc {
namespace space {
@@ -55,14 +55,15 @@ class OatFileManager {
// with the same base address. Returns the oat file pointer from oat_file.
// The `in_memory` parameter is whether the oat file is not present on disk,
// but only in memory (for example files created with memfd).
- const OatFile* RegisterOatFile(std::unique_ptr<const OatFile> oat_file, bool in_memory = false)
+ EXPORT const OatFile* RegisterOatFile(std::unique_ptr<const OatFile> oat_file,
+ bool in_memory = false)
REQUIRES(!Locks::oat_file_manager_lock_);
void UnRegisterAndDeleteOatFile(const OatFile* oat_file)
REQUIRES(!Locks::oat_file_manager_lock_);
// Find the first opened oat file with the same location, returns null if there are none.
- const OatFile* FindOpenedOatFileFromOatLocation(const std::string& oat_location) const
+ EXPORT const OatFile* FindOpenedOatFileFromOatLocation(const std::string& oat_location) const
REQUIRES(!Locks::oat_file_manager_lock_);
// Find the oat file which contains a dex files with the given dex base location,
@@ -71,7 +72,7 @@ class OatFileManager {
REQUIRES(!Locks::oat_file_manager_lock_);
// Returns the boot image oat files.
- std::vector<const OatFile*> GetBootOatFiles() const;
+ EXPORT std::vector<const OatFile*> GetBootOatFiles() const;
// Returns the oat files for the images, registers the oat files.
// Takes ownership of the imagespace's underlying oat files.
@@ -135,10 +136,10 @@ class OatFileManager {
void DeleteThreadPool();
// Wait for any ongoing background verification tasks to finish.
- void WaitForBackgroundVerificationTasksToFinish();
+ EXPORT void WaitForBackgroundVerificationTasksToFinish();
// Wait for all background verification tasks to finish. This is only used by tests.
- void WaitForBackgroundVerificationTasks();
+ EXPORT void WaitForBackgroundVerificationTasks();
// Maximum number of anonymous vdex files kept in the process' data folder.
static constexpr size_t kAnonymousVdexCacheSize = 8u;
diff --git a/runtime/oat/oat_file_test.cc b/runtime/oat/oat_file_test.cc
index 80265f77f5..12a26f1cc1 100644
--- a/runtime/oat/oat_file_test.cc
+++ b/runtime/oat/oat_file_test.cc
@@ -24,7 +24,7 @@
#include "scoped_thread_state_change-inl.h"
#include "vdex_file.h"
-namespace art {
+namespace art HIDDEN {
class OatFileTest : public DexoptTest {};
diff --git a/runtime/oat/oat_quick_method_header.cc b/runtime/oat/oat_quick_method_header.cc
index 33cb152810..3d086e88bf 100644
--- a/runtime/oat/oat_quick_method_header.cc
+++ b/runtime/oat/oat_quick_method_header.cc
@@ -31,7 +31,7 @@
#include "stack_map.h"
#include "thread.h"
-namespace art {
+namespace art HIDDEN {
uint32_t OatQuickMethodHeader::ToDexPc(ArtMethod** frame,
const uintptr_t pc,
diff --git a/runtime/oat/oat_quick_method_header.h b/runtime/oat/oat_quick_method_header.h
index 07b320fcbe..c32eb7f41a 100644
--- a/runtime/oat/oat_quick_method_header.h
+++ b/runtime/oat/oat_quick_method_header.h
@@ -26,7 +26,7 @@
#include "quick/quick_method_frame_info.h"
#include "stack_map.h"
-namespace art {
+namespace art HIDDEN {
class ArtMethod;
@@ -43,10 +43,10 @@ class PACKED(4) OatQuickMethodHeader {
}
static OatQuickMethodHeader* NterpMethodHeader;
- static ArrayRef<const uint8_t> NterpWithClinitImpl;
- static ArrayRef<const uint8_t> NterpImpl;
+ EXPORT static ArrayRef<const uint8_t> NterpWithClinitImpl;
+ EXPORT static ArrayRef<const uint8_t> NterpImpl;
- bool IsNterpMethodHeader() const;
+ EXPORT bool IsNterpMethodHeader() const;
static bool IsNterpPc(uintptr_t pc) {
return OatQuickMethodHeader::NterpMethodHeader != nullptr &&
@@ -176,9 +176,9 @@ class PACKED(4) OatQuickMethodHeader {
}
// For non-catch handlers. Only used in test code.
- uintptr_t ToNativeQuickPc(ArtMethod* method,
- const uint32_t dex_pc,
- bool abort_on_failure = true) const;
+ EXPORT uintptr_t ToNativeQuickPc(ArtMethod* method,
+ const uint32_t dex_pc,
+ bool abort_on_failure = true) const;
// For catch handlers.
uintptr_t ToNativeQuickPcForCatchHandlers(ArtMethod* method,
diff --git a/runtime/oat/stack_map.cc b/runtime/oat/stack_map.cc
index 2c311fb85e..abef5cdad9 100644
--- a/runtime/oat/stack_map.cc
+++ b/runtime/oat/stack_map.cc
@@ -25,7 +25,7 @@
#include "oat_quick_method_header.h"
#include "scoped_thread_state_change-inl.h"
-namespace art {
+namespace art HIDDEN {
// The callback is used to inform the caller about memory bounds of the bit-tables.
template<typename DecodeCallback>
diff --git a/runtime/oat/stack_map.h b/runtime/oat/stack_map.h
index be7c11dfab..07f393aa9d 100644
--- a/runtime/oat/stack_map.h
+++ b/runtime/oat/stack_map.h
@@ -26,12 +26,13 @@
#include "base/bit_utils.h"
#include "base/globals.h"
#include "base/logging.h"
+#include "base/macros.h"
#include "base/memory_region.h"
#include "dex/dex_file_types.h"
#include "dex_register_location.h"
#include "quick/quick_method_frame_info.h"
-namespace art {
+namespace art HIDDEN {
namespace linker {
class CodeInfoTableDeduper;
@@ -166,10 +167,10 @@ class StackMap : public BitTableAccessor<8> {
return native_pc;
}
- void Dump(VariableIndentationOutputStream* vios,
- const CodeInfo& code_info,
- uint32_t code_offset,
- InstructionSet instruction_set) const;
+ EXPORT void Dump(VariableIndentationOutputStream* vios,
+ const CodeInfo& code_info,
+ uint32_t code_offset,
+ InstructionSet instruction_set) const;
};
/**
@@ -287,8 +288,8 @@ class MethodInfo : public BitTableAccessor<3> {
class CodeInfo {
public:
ALWAYS_INLINE CodeInfo() {}
- ALWAYS_INLINE explicit CodeInfo(const uint8_t* data, size_t* num_read_bits = nullptr);
- ALWAYS_INLINE explicit CodeInfo(const OatQuickMethodHeader* header);
+ EXPORT ALWAYS_INLINE explicit CodeInfo(const uint8_t* data, size_t* num_read_bits = nullptr);
+ EXPORT ALWAYS_INLINE explicit CodeInfo(const OatQuickMethodHeader* header);
// The following methods decode only part of the data.
static CodeInfo DecodeGcMasksOnly(const OatQuickMethodHeader* header);
@@ -467,17 +468,18 @@ class CodeInfo {
return stack_maps_.GetInvalidRow();
}
- StackMap GetStackMapForNativePcOffset(uintptr_t pc, InstructionSet isa = kRuntimeISA) const;
+ EXPORT StackMap GetStackMapForNativePcOffset(uintptr_t pc,
+ InstructionSet isa = kRuntimeISA) const;
// Dump this CodeInfo object on `vios`.
// `code_offset` is the (absolute) native PC of the compiled method.
- void Dump(VariableIndentationOutputStream* vios,
- uint32_t code_offset,
- bool verbose,
- InstructionSet instruction_set) const;
+ EXPORT void Dump(VariableIndentationOutputStream* vios,
+ uint32_t code_offset,
+ bool verbose,
+ InstructionSet instruction_set) const;
// Accumulate code info size statistics into the given Stats tree.
- static void CollectSizeStats(const uint8_t* code_info, /*out*/ Stats& parent);
+ EXPORT static void CollectSizeStats(const uint8_t* code_info, /*out*/ Stats& parent);
template <uint32_t kFlag>
ALWAYS_INLINE static bool HasFlag(const uint8_t* code_info_data) {
@@ -519,9 +521,9 @@ class CodeInfo {
private:
// Scan backward to determine dex register locations at given stack map.
- void DecodeDexRegisterMap(uint32_t stack_map_index,
- uint32_t first_dex_register,
- /*out*/ DexRegisterMap* map) const;
+ EXPORT void DecodeDexRegisterMap(uint32_t stack_map_index,
+ uint32_t first_dex_register,
+ /*out*/ DexRegisterMap* map) const;
template<typename DecodeCallback> // (size_t index, BitTable<...>*, BitMemoryRegion).
ALWAYS_INLINE CodeInfo(const uint8_t* data, size_t* num_read_bits, DecodeCallback callback);