diff options
author | Vladimir Marko <vmarko@google.com> | 2014-04-23 08:50:20 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-04-23 08:50:22 +0000 |
commit | de981b0c9124f0b1f29e18ea6b8cb8328f561aab (patch) | |
tree | 899cb8ec473d3a6436ac7cc9445f93c123a7f884 /runtime | |
parent | a08ec9b372d4f5e918b3d68499fbd1731180cd98 (diff) | |
parent | 96c6ab93336b972a38bd2448bcccf19188b8389b (diff) | |
download | art-de981b0c9124f0b1f29e18ea6b8cb8328f561aab.zip art-de981b0c9124f0b1f29e18ea6b8cb8328f561aab.tar.gz art-de981b0c9124f0b1f29e18ea6b8cb8328f561aab.tar.bz2 |
Merge "Separate maps from code in oat file."
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/mirror/art_method-inl.h | 3 | ||||
-rw-r--r-- | runtime/mirror/art_method.h | 6 | ||||
-rw-r--r-- | runtime/oat.cc | 12 | ||||
-rw-r--r-- | runtime/oat.h | 13 |
4 files changed, 30 insertions, 4 deletions
diff --git a/runtime/mirror/art_method-inl.h b/runtime/mirror/art_method-inl.h index d5eccaf..5d62b88 100644 --- a/runtime/mirror/art_method-inl.h +++ b/runtime/mirror/art_method-inl.h @@ -22,6 +22,7 @@ #include "dex_file.h" #include "entrypoints/entrypoint_utils.h" #include "object_array.h" +#include "oat.h" #include "runtime.h" namespace art { @@ -83,7 +84,7 @@ inline uint32_t ArtMethod::GetCodeSize() { } // TODO: make this Thumb2 specific code &= ~0x1; - return reinterpret_cast<uint32_t*>(code)[-1]; + return reinterpret_cast<OatMethodHeader*>(code)[-1].code_size_; } inline bool ArtMethod::CheckIncompatibleClassChange(InvokeType type) { diff --git a/runtime/mirror/art_method.h b/runtime/mirror/art_method.h index 38e44be..d684266 100644 --- a/runtime/mirror/art_method.h +++ b/runtime/mirror/art_method.h @@ -270,9 +270,11 @@ class MANAGED ArtMethod : public Object { return pc == 0; } /* - * During a stack walk, a return PC may point to the end of the code + 1 - * (in the case that the last instruction is a call that isn't expected to + * During a stack walk, a return PC may point past-the-end of the code + * in the case that the last instruction is a call that isn't expected to * return. Thus, we check <= code + GetCodeSize(). + * + * NOTE: For Thumb both pc and code are offset by 1 indicating the Thumb state. */ return (code <= pc && pc <= code + GetCodeSize()); } diff --git a/runtime/oat.cc b/runtime/oat.cc index 246e090..d01dc72 100644 --- a/runtime/oat.cc +++ b/runtime/oat.cc @@ -22,7 +22,7 @@ namespace art { const uint8_t OatHeader::kOatMagic[] = { 'o', 'a', 't', '\n' }; -const uint8_t OatHeader::kOatVersion[] = { '0', '2', '0', '\0' }; +const uint8_t OatHeader::kOatVersion[] = { '0', '2', '1', '\0' }; OatHeader::OatHeader() { memset(this, 0, sizeof(*this)); @@ -372,4 +372,14 @@ OatMethodOffsets::OatMethodOffsets(uint32_t code_offset, OatMethodOffsets::~OatMethodOffsets() {} +OatMethodHeader::OatMethodHeader() + : code_size_(0) +{} + +OatMethodHeader::OatMethodHeader(uint32_t code_size) + : code_size_(code_size) +{} + +OatMethodHeader::~OatMethodHeader() {} + } // namespace art diff --git a/runtime/oat.h b/runtime/oat.h index 2851f5c..035aba1 100644 --- a/runtime/oat.h +++ b/runtime/oat.h @@ -155,6 +155,19 @@ class PACKED(4) OatMethodOffsets { uint32_t gc_map_offset_; }; +// OatMethodHeader precedes the raw code chunk generated by the Quick compiler. +class PACKED(4) OatMethodHeader { + public: + OatMethodHeader(); + + explicit OatMethodHeader(uint32_t code_size); + + ~OatMethodHeader(); + + // The code size in bytes. + uint32_t code_size_; +}; + } // namespace art #endif // ART_RUNTIME_OAT_H_ |