From 8ccc3f5d06fd217cdaabd37e743adab2031d3720 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Wed, 19 Mar 2014 10:34:11 +0000 Subject: Add support for invoke-static in optimizing compiler. Support is limited to calls without parameters and returning void. For simplicity, we currently follow the Quick ABI. Change-Id: I54805161141b7eac5959f1cae0dc138dd0b2e8a5 --- compiler/optimizing/code_generator.h | 40 +++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'compiler/optimizing/code_generator.h') diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h index 63f8cbf429..24dcab6131 100644 --- a/compiler/optimizing/code_generator.h +++ b/compiler/optimizing/code_generator.h @@ -38,6 +38,11 @@ class CodeAllocator { DISALLOW_COPY_AND_ASSIGN(CodeAllocator); }; +struct PcInfo { + uint32_t dex_pc; + uintptr_t native_pc; +}; + /** * A Location is an abstraction over the potential location * of an instruction. It could be in register or stack. @@ -81,7 +86,8 @@ class Location : public ValueObject { class LocationSummary : public ArenaObject { public: explicit LocationSummary(HInstruction* instruction) - : inputs(instruction->GetBlock()->GetGraph()->GetArena(), instruction->InputCount()) { + : inputs(instruction->GetBlock()->GetGraph()->GetArena(), instruction->InputCount()), + temps(instruction->GetBlock()->GetGraph()->GetArena(), 0) { inputs.SetSize(instruction->InputCount()); for (int i = 0; i < instruction->InputCount(); i++) { inputs.Put(i, Location()); @@ -100,10 +106,19 @@ class LocationSummary : public ArenaObject { output = Location(location); } + void AddTemp(Location location) { + temps.Add(location); + } + + Location GetTemp(uint32_t at) const { + return temps.Get(at); + } + Location Out() const { return output; } private: GrowableArray inputs; + GrowableArray temps; Location output; DISALLOW_COPY_AND_ASSIGN(LocationSummary); @@ -134,9 +149,17 @@ class CodeGenerator : public ArenaObject { uint32_t GetFrameSize() const { return frame_size_; } void SetFrameSize(uint32_t size) { frame_size_ = size; } + uint32_t GetCoreSpillMask() const { return core_spill_mask_; } + + void RecordPcInfo(uint32_t dex_pc) { + struct PcInfo pc_info; + pc_info.dex_pc = dex_pc; + pc_info.native_pc = GetAssembler()->CodeSize(); + pc_infos_.Add(pc_info); + } - void BuildMappingTable(std::vector* vector) const { } - void BuildVMapTable(std::vector* vector) const { } + void BuildMappingTable(std::vector* vector) const; + void BuildVMapTable(std::vector* vector) const; void BuildNativeGCMap( std::vector* vector, const DexCompilationUnit& dex_compilation_unit) const; @@ -144,23 +167,26 @@ class CodeGenerator : public ArenaObject { explicit CodeGenerator(HGraph* graph) : frame_size_(0), graph_(graph), - block_labels_(graph->GetArena(), 0) { + block_labels_(graph->GetArena(), 0), + pc_infos_(graph->GetArena(), 32) { block_labels_.SetSize(graph->GetBlocks()->Size()); } ~CodeGenerator() { } + // Frame size required for this method. + uint32_t frame_size_; + uint32_t core_spill_mask_; + private: void InitLocations(HInstruction* instruction); void CompileBlock(HBasicBlock* block); void CompileEntryBlock(); - // Frame size required for this method. - uint32_t frame_size_; - HGraph* const graph_; // Labels for each block that will be compiled. GrowableArray