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
diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h
index 24dcab6..01bbcc0 100644
--- a/compiler/optimizing/code_generator.h
+++ b/compiler/optimizing/code_generator.h
@@ -141,8 +141,7 @@
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 @@
DISALLOW_COPY_AND_ASSIGN(CodeGenerator);
};
+template <typename T>
+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_