1 /*
   2  * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef CPU_X86_VM_INTERPRETERRT_X86_HPP
  26 #define CPU_X86_VM_INTERPRETERRT_X86_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 
  30 // native method calls
  31 
  32 class SignatureHandlerGenerator: public NativeSignatureIterator {
  33  private:
  34   MacroAssembler* _masm;
  35 #ifdef AMD64
  36 #ifdef _WIN64
  37   unsigned int _num_args;
  38 #else
  39   unsigned int _num_fp_args;
  40   unsigned int _num_int_args;
  41 #endif // _WIN64
  42   int _stack_offset;
  43 #else
  44   void move(int from_offset, int to_offset);
  45   void box(int from_offset, int to_offset);
  46 #endif // AMD64
  47 
  48   void pass_int();
  49   void pass_long();
  50   void pass_float();
  51 #ifdef AMD64
  52   void pass_double();
  53 #endif // AMD64
  54   void pass_object();
  55 
  56  public:
  57   // Creation
  58   SignatureHandlerGenerator(const methodHandle& method, CodeBuffer* buffer) : NativeSignatureIterator(method) {
  59     _masm = new MacroAssembler(buffer);
  60 #ifdef AMD64
  61 #ifdef _WIN64
  62     _num_args = (method->is_static() ? 1 : 0);
  63     _stack_offset = (Argument::n_int_register_parameters_c+1)* wordSize; // don't overwrite return address
  64 #else
  65     _num_int_args = (method->is_static() ? 1 : 0);
  66     _num_fp_args = 0;
  67     _stack_offset = wordSize; // don't overwrite return address
  68 #endif // _WIN64
  69 #endif // AMD64
  70   }
  71 
  72   // Code generation
  73   void generate(uint64_t fingerprint);
  74 
  75   // Code generation support
  76   static Register from();
  77   static Register to();
  78   static Register temp();
  79 };
  80 
  81 #endif // CPU_X86_VM_INTERPRETERRT_X86_HPP