Refactor code in preparation of correct stack maps in slow path.
Move the logic of saving/restoring live registers in slow path
in the SlowPathCode method. Also add a RecordPcInfo helper to
SlowPathCode, that will act as the placeholder of saving correct
stack maps.
Change-Id: I25c2bc7a642ef854bbc8a3eb570e5c8c8d2d030c
diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h
index b8f4572..81fc684 100644
--- a/compiler/optimizing/code_generator.h
+++ b/compiler/optimizing/code_generator.h
@@ -73,6 +73,10 @@
virtual void EmitNativeCode(CodeGenerator* codegen) = 0;
+ void SaveLiveRegisters(CodeGenerator* codegen, LocationSummary* locations);
+ void RestoreLiveRegisters(CodeGenerator* codegen, LocationSummary* locations);
+ void RecordPcInfo(CodeGenerator* codegen, HInstruction* instruction, uint32_t dex_pc);
+
private:
DISALLOW_COPY_AND_ASSIGN(SlowPathCode);
};
@@ -182,8 +186,6 @@
void BuildNativeGCMap(
std::vector<uint8_t>* vector, const DexCompilationUnit& dex_compilation_unit) const;
void BuildStackMaps(std::vector<uint8_t>* vector);
- void SaveLiveRegisters(LocationSummary* locations);
- void RestoreLiveRegisters(LocationSummary* locations);
bool IsLeafMethod() const {
return is_leaf_;
@@ -267,6 +269,15 @@
}
}
+ size_t GetFirstRegisterSlotInSlowPath() const {
+ return first_register_slot_in_slow_path_;
+ }
+
+ uint32_t FrameEntrySpillSize() const {
+ return GetFpuSpillSize() + GetCoreSpillSize();
+ }
+
+
protected:
CodeGenerator(HGraph* graph,
size_t number_of_core_registers,
@@ -326,10 +337,6 @@
return POPCOUNT(core_spill_mask_) * GetWordSize();
}
- uint32_t FrameEntrySpillSize() const {
- return GetFpuSpillSize() + GetCoreSpillSize();
- }
-
bool HasAllocatedCalleeSaveRegisters() const {
// We check the core registers against 1 because it always comprises the return PC.
return (POPCOUNT(allocated_registers_.GetCoreRegisters() & core_callee_save_mask_) != 1)