summaryrefslogtreecommitdiff
path: root/compiler/optimizing/code_generator.h
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2022-03-22 15:44:57 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2022-07-08 10:00:33 +0000
commitc37e3a0a532fb89b62753d0478c1ba3c9fc87bb3 (patch)
tree93d519edbe9d5cf5a42e2ca9de15e5dee4c283f5 /compiler/optimizing/code_generator.h
parentd88c1499efe2f718f3cc1f45a3dc178471b22ce6 (diff)
Add clinit checks at entry for some boot image methods.
Look at the list of preloaded classes to know whether the class will be initialized. If it's not in the list, add explicit clinit checks at entry. Update FixupStaticTrampolines to only update the entrypoint if it is the resolution stub. This adds two pages to current on-device boot classpath oat files. Test: imgdiag Bug: 162110941 Change-Id: Ic7b0b01a772444bc615b62cdb9305a1ef555c780
Diffstat (limited to 'compiler/optimizing/code_generator.h')
-rw-r--r--compiler/optimizing/code_generator.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h
index b09219a2ed..43cb9862c2 100644
--- a/compiler/optimizing/code_generator.h
+++ b/compiler/optimizing/code_generator.h
@@ -37,6 +37,7 @@
#include "optimizing_compiler_stats.h"
#include "read_barrier_option.h"
#include "stack.h"
+#include "subtype_check.h"
#include "utils/assembler.h"
#include "utils/label.h"
@@ -60,6 +61,14 @@ static int64_t constexpr kPrimLongMax = INT64_C(0x7fffffffffffffff);
static constexpr ReadBarrierOption kCompilerReadBarrierOption =
kEmitCompilerReadBarrier ? kWithReadBarrier : kWithoutReadBarrier;
+constexpr size_t status_lsb_position = SubtypeCheckBits::BitStructSizeOf();
+constexpr size_t status_byte_offset =
+ mirror::Class::StatusOffset().SizeValue() + (status_lsb_position / kBitsPerByte);
+constexpr uint32_t shifted_visibly_initialized_value =
+ enum_cast<uint32_t>(ClassStatus::kVisiblyInitialized) << (status_lsb_position % kBitsPerByte);
+constexpr uint32_t shifted_initializing_value =
+ enum_cast<uint32_t>(ClassStatus::kInitializing) << (status_lsb_position % kBitsPerByte);
+
class Assembler;
class CodeGenerator;
class CompilerOptions;