1 /*
   2  * Copyright (c) 1998, 2005, 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 // native method calls
  26 
  27 class SignatureHandlerGenerator: public NativeSignatureIterator {
  28  private:
  29   MacroAssembler* _masm;
  30 #ifdef AMD64
  31 #ifdef _WIN64
  32   unsigned int _num_args;
  33 #else
  34   unsigned int _num_fp_args;
  35   unsigned int _num_int_args;
  36 #endif // _WIN64
  37   int _stack_offset;
  38 #else
  39   void move(int from_offset, int to_offset);
  40   void box(int from_offset, int to_offset);
  41 #endif // AMD64
  42 
  43   void pass_int();
  44   void pass_long();
  45   void pass_float();
  46 #ifdef AMD64
  47   void pass_double();
  48 #endif // AMD64
  49   void pass_object();
  50 
  51  public:
  52   // Creation
  53   SignatureHandlerGenerator(methodHandle method, CodeBuffer* buffer) : NativeSignatureIterator(method) {
  54     _masm = new MacroAssembler(buffer);
  55 #ifdef AMD64
  56 #ifdef _WIN64
  57     _num_args = (method->is_static() ? 1 : 0);
  58     _stack_offset = (Argument::n_int_register_parameters_c+1)* wordSize; // don't overwrite return address
  59 #else
  60     _num_int_args = (method->is_static() ? 1 : 0);
  61     _num_fp_args = 0;
  62     _stack_offset = wordSize; // don't overwrite return address
  63 #endif // _WIN64
  64 #endif // AMD64
  65   }
  66 
  67   // Code generation
  68   void generate(uint64_t fingerprint);
  69 
  70   // Code generation support
  71   static Register from();
  72   static Register to();
  73   static Register temp();
  74 };