From 4a34a428c6a2588e0857ef6baf88f1b73ce65958 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Thu, 3 Apr 2014 10:38:37 +0100 Subject: Support passing arguments to invoke-static* instructions. - Stop using the frame pointer for accessing locals. - Stop emulating a stack when doing code generation. Instead, rely on dex register model, where instructions only reference registers. Change-Id: Id51bd7d33ac430cb87a53c9f4b0c864eeb1006f9 --- compiler/optimizing/code_generator.h | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'compiler/optimizing/code_generator.h') diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h index 24dcab6131..01bbcc0bb6 100644 --- a/compiler/optimizing/code_generator.h +++ b/compiler/optimizing/code_generator.h @@ -141,8 +141,7 @@ class CodeGenerator : public ArenaObject { virtual void GenerateFrameEntry() = 0; virtual void GenerateFrameExit() = 0; virtual void Bind(Label* label) = 0; - virtual void Move(HInstruction* instruction, Location location) = 0; - virtual void Push(HInstruction* instruction, Location location) = 0; + virtual void Move(HInstruction* instruction, Location location, HInstruction* move_for) = 0; virtual HGraphVisitor* GetLocationBuilder() = 0; virtual HGraphVisitor* GetInstructionVisitor() = 0; virtual Assembler* GetAssembler() = 0; @@ -191,6 +190,33 @@ class CodeGenerator : public ArenaObject { DISALLOW_COPY_AND_ASSIGN(CodeGenerator); }; +template +class CallingConvention { + public: + CallingConvention(const T* registers, int number_of_registers) + : registers_(registers), number_of_registers_(number_of_registers) {} + + size_t GetNumberOfRegisters() const { return number_of_registers_; } + + T GetRegisterAt(size_t index) const { + DCHECK_LT(index, number_of_registers_); + return registers_[index]; + } + + uint8_t GetStackOffsetOf(size_t index) const { + DCHECK_GE(index, number_of_registers_); + // We still reserve the space for parameters passed by registers. + // Add kWordSize for the method pointer. + return index * kWordSize + kWordSize; + } + + private: + const T* registers_; + const size_t number_of_registers_; + + DISALLOW_COPY_AND_ASSIGN(CallingConvention); +}; + } // namespace art #endif // ART_COMPILER_OPTIMIZING_CODE_GENERATOR_H_ -- cgit v1.2.3-59-g8ed1b