Home | History | Annotate | Download | only in arm
      1 /*
      2  * Copyright (C) 2011 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef ART_COMPILER_JNI_QUICK_ARM_CALLING_CONVENTION_ARM_H_
     18 #define ART_COMPILER_JNI_QUICK_ARM_CALLING_CONVENTION_ARM_H_
     19 
     20 #include "jni/quick/calling_convention.h"
     21 
     22 namespace art {
     23 namespace arm {
     24 
     25 class ArmManagedRuntimeCallingConvention : public ManagedRuntimeCallingConvention {
     26  public:
     27   ArmManagedRuntimeCallingConvention(bool is_static, bool is_synchronized, const char* shorty)
     28       : ManagedRuntimeCallingConvention(is_static, is_synchronized, shorty) {}
     29   virtual ~ArmManagedRuntimeCallingConvention() {}
     30   // Calling convention
     31   virtual ManagedRegister ReturnRegister();
     32   virtual ManagedRegister InterproceduralScratchRegister();
     33   // Managed runtime calling convention
     34   virtual ManagedRegister MethodRegister();
     35   virtual bool IsCurrentParamInRegister();
     36   virtual bool IsCurrentParamOnStack();
     37   virtual ManagedRegister CurrentParamRegister();
     38   virtual FrameOffset CurrentParamStackOffset();
     39   virtual const std::vector<ManagedRegister>& EntrySpills();
     40 
     41  private:
     42   std::vector<ManagedRegister> entry_spills_;
     43 
     44   DISALLOW_COPY_AND_ASSIGN(ArmManagedRuntimeCallingConvention);
     45 };
     46 
     47 class ArmJniCallingConvention : public JniCallingConvention {
     48  public:
     49   explicit ArmJniCallingConvention(bool is_static, bool is_synchronized, const char* shorty);
     50   virtual ~ArmJniCallingConvention() {}
     51   // Calling convention
     52   virtual ManagedRegister ReturnRegister();
     53   virtual ManagedRegister IntReturnRegister();
     54   virtual ManagedRegister InterproceduralScratchRegister();
     55   // JNI calling convention
     56   virtual void Next();  // Override default behavior for AAPCS
     57   virtual size_t FrameSize();
     58   virtual size_t OutArgSize();
     59   virtual const std::vector<ManagedRegister>& CalleeSaveRegisters() const {
     60     return callee_save_regs_;
     61   }
     62   virtual ManagedRegister ReturnScratchRegister() const;
     63   virtual uint32_t CoreSpillMask() const;
     64   virtual uint32_t FpSpillMask() const {
     65     return 0;  // Floats aren't spilled in JNI down call
     66   }
     67   virtual bool IsCurrentParamInRegister();
     68   virtual bool IsCurrentParamOnStack();
     69   virtual ManagedRegister CurrentParamRegister();
     70   virtual FrameOffset CurrentParamStackOffset();
     71 
     72  protected:
     73   virtual size_t NumberOfOutgoingStackArgs();
     74 
     75  private:
     76   // TODO: these values aren't unique and can be shared amongst instances
     77   std::vector<ManagedRegister> callee_save_regs_;
     78 
     79   // Padding to ensure longs and doubles are not split in AAPCS
     80   size_t padding_;
     81 
     82   DISALLOW_COPY_AND_ASSIGN(ArmJniCallingConvention);
     83 };
     84 
     85 }  // namespace arm
     86 }  // namespace art
     87 
     88 #endif  // ART_COMPILER_JNI_QUICK_ARM_CALLING_CONVENTION_ARM_H_
     89