Index: runtime/vm/object.h |
diff --git a/runtime/vm/object.h b/runtime/vm/object.h |
index 189b2ec2dca1b8eb71c2c5cc42df515e620821b1..b3d85fe7d84fb1581a7fefd979bc92e9c900de03 100644 |
--- a/runtime/vm/object.h |
+++ b/runtime/vm/object.h |
@@ -2156,13 +2156,17 @@ class Function : public Object { |
// Return the most recently compiled and installed code for this function. |
// It is not the only Code object that points to this function. |
RawCode* CurrentCode() const { |
- return raw_ptr()->instructions_->ptr()->code_; |
+ return raw_ptr()->code_; |
} |
RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; } |
void set_unoptimized_code(const Code& value) const; |
bool HasCode() const; |
+ static intptr_t code_offset() { |
+ return OFFSET_OF(RawFunction, code_); |
+ } |
+ |
static intptr_t entry_point_offset() { |
return OFFSET_OF(RawFunction, entry_point_); |
} |
@@ -3691,14 +3695,6 @@ class ObjectPool : public Object { |
class Instructions : public Object { |
public: |
intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize(). |
- RawCode* code() const { return raw_ptr()->code_; } |
- static intptr_t code_offset() { |
- return OFFSET_OF(RawInstructions, code_); |
- } |
- RawObjectPool* object_pool() const { return raw_ptr()->object_pool_; } |
- static intptr_t object_pool_offset() { |
- return OFFSET_OF(RawInstructions, object_pool_); |
- } |
uword EntryPoint() const { |
return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); |
@@ -3737,12 +3733,6 @@ class Instructions : public Object { |
void set_size(intptr_t size) const { |
StoreNonPointer(&raw_ptr()->size_, size); |
} |
- void set_code(RawCode* code) const { |
- StorePointer(&raw_ptr()->code_, code); |
- } |
- void set_object_pool(RawObjectPool* object_pool) const { |
- StorePointer(&raw_ptr()->object_pool_, object_pool); |
- } |
// New is a private method as RawInstruction and RawCode objects should |
// only be created using the Code::FinalizeCode method. This method creates |
@@ -4074,12 +4064,25 @@ class DeoptInfo : public AllStatic { |
class Code : public Object { |
public: |
+ RawInstructions* active_instructions() const { |
+ return raw_ptr()->active_instructions_; |
+ } |
+ |
RawInstructions* instructions() const { return raw_ptr()->instructions_; } |
+ static intptr_t instructions_offset() { |
+ return OFFSET_OF(RawCode, active_instructions_); |
+ } |
+ |
static intptr_t entry_point_offset() { |
return OFFSET_OF(RawCode, entry_point_); |
} |
+ RawObjectPool* object_pool() const { return raw_ptr()->object_pool_; } |
+ static intptr_t object_pool_offset() { |
+ return OFFSET_OF(RawCode, object_pool_); |
+ } |
+ |
intptr_t pointer_offsets_length() const { |
return PtrOffBits::decode(raw_ptr()->state_bits_); |
} |
@@ -4094,17 +4097,14 @@ class Code : public Object { |
void set_is_alive(bool value) const; |
uword EntryPoint() const { |
- ASSERT(raw_ptr()->entry_point_ == |
- Instructions::Handle(instructions()).EntryPoint()); |
- return raw_ptr()->entry_point_; |
+ return Instructions::Handle(instructions()).EntryPoint(); |
} |
intptr_t Size() const { |
const Instructions& instr = Instructions::Handle(instructions()); |
return instr.size(); |
} |
RawObjectPool* GetObjectPool() const { |
- const Instructions& instr = Instructions::Handle(instructions()); |
- return instr.object_pool(); |
+ return object_pool(); |
} |
bool ContainsInstructionAt(uword addr) const { |
const Instructions& instr = Instructions::Handle(instructions()); |
@@ -4299,10 +4299,6 @@ class Code : public Object { |
kInvalidPc = -1 |
}; |
- // Returns 0 if code is not patchable |
- uword GetEntryPatchPc() const; |
- uword GetPatchCodePc() const; |
- |
uword GetLazyDeoptPc() const; |
// Find pc, return 0 if not found. |
@@ -4316,22 +4312,6 @@ class Code : public Object { |
return raw_ptr()->compile_timestamp_; |
} |
- intptr_t entry_patch_pc_offset() const { |
- return raw_ptr()->entry_patch_pc_offset_; |
- } |
- void set_entry_patch_pc_offset(intptr_t pc) const { |
- StoreNonPointer(&raw_ptr()->entry_patch_pc_offset_, pc); |
- } |
- |
- |
- intptr_t patch_code_pc_offset() const { |
- return raw_ptr()->patch_code_pc_offset_; |
- } |
- void set_patch_code_pc_offset(intptr_t pc) const { |
- StoreNonPointer(&raw_ptr()->patch_code_pc_offset_, pc); |
- } |
- |
- |
intptr_t lazy_deopt_pc_offset() const { |
return raw_ptr()->lazy_deopt_pc_offset_; |
} |
@@ -4346,6 +4326,10 @@ class Code : public Object { |
private: |
void set_state_bits(intptr_t bits) const; |
+ void set_object_pool(RawObjectPool* object_pool) const { |
+ StorePointer(&raw_ptr()->object_pool_, object_pool); |
+ } |
+ |
friend class RawObject; // For RawObject::SizeFromClass(). |
friend class RawCode; |
enum { |
@@ -4366,8 +4350,6 @@ class Code : public Object { |
: FindObjectVisitor(Isolate::Current()), pc_(pc) { } |
virtual ~FindRawCodeVisitor() { } |
- virtual uword filter_addr() const { return pc_; } |
- |
// Check if object matches find condition. |
virtual bool FindObject(RawObject* obj) const; |
@@ -4387,13 +4369,17 @@ class Code : public Object { |
StoreNonPointer(&raw_ptr()->compile_timestamp_, timestamp); |
} |
- void set_instructions(RawInstructions* instructions) { |
+ void set_active_instructions(RawInstructions* instructions) const { |
// RawInstructions are never allocated in New space and hence a |
// store buffer update is not needed here. |
+ StorePointer(&raw_ptr()->active_instructions_, instructions); |
+ StoreNonPointer(&raw_ptr()->entry_point_, |
+ reinterpret_cast<uword>(instructions->ptr()) + |
+ Instructions::HeaderSize()); |
+ } |
+ |
+ void set_instructions(RawInstructions* instructions) const { |
StorePointer(&raw_ptr()->instructions_, instructions); |
- uword entry_point = reinterpret_cast<uword>(instructions->ptr()) + |
- Instructions::HeaderSize(); |
- StoreNonPointer(&raw_ptr()->entry_point_, entry_point); |
} |
void set_pointer_offsets_length(intptr_t value) { |
@@ -4427,7 +4413,7 @@ class Code : public Object { |
FINAL_HEAP_OBJECT_IMPLEMENTATION(Code, Object); |
friend class Class; |
friend class SnapshotWriter; |
- |
+ friend class CodePatcher; // for set_instructions |
// So that the RawFunction pointer visitor can determine whether code the |
// function points to is optimized. |
friend class RawFunction; |