From a8ac9130b872c080299afacf5dcaab513d13ea87 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Fri, 13 Mar 2015 16:36:36 +0000 Subject: 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 --- compiler/optimizing/code_generator.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'compiler/optimizing/code_generator.h') diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h index b8f4572abd..81fc684ccf 100644 --- a/compiler/optimizing/code_generator.h +++ b/compiler/optimizing/code_generator.h @@ -73,6 +73,10 @@ class SlowPathCode : public ArenaObject { 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 @@ class CodeGenerator { void BuildNativeGCMap( std::vector* vector, const DexCompilationUnit& dex_compilation_unit) const; void BuildStackMaps(std::vector* vector); - void SaveLiveRegisters(LocationSummary* locations); - void RestoreLiveRegisters(LocationSummary* locations); bool IsLeafMethod() const { return is_leaf_; @@ -267,6 +269,15 @@ class CodeGenerator { } } + 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 @@ class CodeGenerator { 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) -- cgit v1.2.3-59-g8ed1b