src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 42580 hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86_64.cpp@56304dee97f3
child 47881 0ce0ac68ace7
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34651
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
     1
/*
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
     2
 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
34651
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
     4
 *
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
     8
 *
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    13
 * accompanied this code).
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    14
 *
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    18
 *
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    21
 * questions.
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    22
 *
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    23
 */
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    24
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    25
#include "precompiled.hpp"
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    26
#include "asm/macroAssembler.hpp"
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
    27
#include "interpreter/interp_masm.hpp"
34651
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    28
#include "interpreter/interpreter.hpp"
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    29
#include "interpreter/interpreterRuntime.hpp"
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
    30
#include "interpreter/templateInterpreterGenerator.hpp"
34651
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    31
#include "runtime/arguments.hpp"
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
    32
#include "runtime/sharedRuntime.hpp"
34651
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    33
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    34
#define __ _masm->
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
    35
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    36
#ifdef _WIN64
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    37
address TemplateInterpreterGenerator::generate_slow_signature_handler() {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    38
  address entry = __ pc();
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    39
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    40
  // rbx: method
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    41
  // r14: pointer to locals
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    42
  // c_rarg3: first stack arg - wordSize
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    43
  __ mov(c_rarg3, rsp);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    44
  // adjust rsp
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    45
  __ subptr(rsp, 4 * wordSize);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    46
  __ call_VM(noreg,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    47
             CAST_FROM_FN_PTR(address,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    48
                              InterpreterRuntime::slow_signature_handler),
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    49
             rbx, r14, c_rarg3);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    50
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    51
  // rax: result handler
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    52
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    53
  // Stack layout:
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    54
  // rsp: 3 integer or float args (if static first is unused)
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    55
  //      1 float/double identifiers
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    56
  //        return address
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    57
  //        stack args
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    58
  //        garbage
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    59
  //        expression stack bottom
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    60
  //        bcp (NULL)
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    61
  //        ...
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    62
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    63
  // Do FP first so we can use c_rarg3 as temp
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    64
  __ movl(c_rarg3, Address(rsp, 3 * wordSize)); // float/double identifiers
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    65
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    66
  for ( int i= 0; i < Argument::n_int_register_parameters_c-1; i++ ) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    67
    XMMRegister floatreg = as_XMMRegister(i+1);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    68
    Label isfloatordouble, isdouble, next;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    69
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    70
    __ testl(c_rarg3, 1 << (i*2));      // Float or Double?
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    71
    __ jcc(Assembler::notZero, isfloatordouble);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    72
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    73
    // Do Int register here
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    74
    switch ( i ) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    75
      case 0:
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    76
        __ movl(rscratch1, Address(rbx, Method::access_flags_offset()));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    77
        __ testl(rscratch1, JVM_ACC_STATIC);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    78
        __ cmovptr(Assembler::zero, c_rarg1, Address(rsp, 0));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    79
        break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    80
      case 1:
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    81
        __ movptr(c_rarg2, Address(rsp, wordSize));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    82
        break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    83
      case 2:
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    84
        __ movptr(c_rarg3, Address(rsp, 2 * wordSize));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    85
        break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    86
      default:
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    87
        break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    88
    }
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    89
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    90
    __ jmp (next);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    91
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    92
    __ bind(isfloatordouble);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    93
    __ testl(c_rarg3, 1 << ((i*2)+1));     // Double?
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    94
    __ jcc(Assembler::notZero, isdouble);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    95
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    96
// Do Float Here
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    97
    __ movflt(floatreg, Address(rsp, i * wordSize));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    98
    __ jmp(next);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    99
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   100
// Do Double here
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   101
    __ bind(isdouble);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   102
    __ movdbl(floatreg, Address(rsp, i * wordSize));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   103
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   104
    __ bind(next);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   105
  }
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   106
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   107
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   108
  // restore rsp
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   109
  __ addptr(rsp, 4 * wordSize);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   110
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   111
  __ ret(0);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   112
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   113
  return entry;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   114
}
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   115
#else
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   116
address TemplateInterpreterGenerator::generate_slow_signature_handler() {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   117
  address entry = __ pc();
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   118
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   119
  // rbx: method
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   120
  // r14: pointer to locals
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   121
  // c_rarg3: first stack arg - wordSize
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   122
  __ mov(c_rarg3, rsp);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   123
  // adjust rsp
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   124
  __ subptr(rsp, 14 * wordSize);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   125
  __ call_VM(noreg,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   126
             CAST_FROM_FN_PTR(address,
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   127
                              InterpreterRuntime::slow_signature_handler),
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   128
             rbx, r14, c_rarg3);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   129
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   130
  // rax: result handler
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   131
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   132
  // Stack layout:
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   133
  // rsp: 5 integer args (if static first is unused)
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   134
  //      1 float/double identifiers
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   135
  //      8 double args
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   136
  //        return address
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   137
  //        stack args
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   138
  //        garbage
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   139
  //        expression stack bottom
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   140
  //        bcp (NULL)
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   141
  //        ...
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   142
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   143
  // Do FP first so we can use c_rarg3 as temp
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   144
  __ movl(c_rarg3, Address(rsp, 5 * wordSize)); // float/double identifiers
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   145
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   146
  for (int i = 0; i < Argument::n_float_register_parameters_c; i++) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   147
    const XMMRegister r = as_XMMRegister(i);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   148
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   149
    Label d, done;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   150
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   151
    __ testl(c_rarg3, 1 << i);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   152
    __ jcc(Assembler::notZero, d);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   153
    __ movflt(r, Address(rsp, (6 + i) * wordSize));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   154
    __ jmp(done);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   155
    __ bind(d);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   156
    __ movdbl(r, Address(rsp, (6 + i) * wordSize));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   157
    __ bind(done);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   158
  }
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   159
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   160
  // Now handle integrals.  Only do c_rarg1 if not static.
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   161
  __ movl(c_rarg3, Address(rbx, Method::access_flags_offset()));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   162
  __ testl(c_rarg3, JVM_ACC_STATIC);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   163
  __ cmovptr(Assembler::zero, c_rarg1, Address(rsp, 0));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   164
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   165
  __ movptr(c_rarg2, Address(rsp, wordSize));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   166
  __ movptr(c_rarg3, Address(rsp, 2 * wordSize));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   167
  __ movptr(c_rarg4, Address(rsp, 3 * wordSize));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   168
  __ movptr(c_rarg5, Address(rsp, 4 * wordSize));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   169
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   170
  // restore rsp
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   171
  __ addptr(rsp, 14 * wordSize);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   172
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   173
  __ ret(0);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   174
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   175
  return entry;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   176
}
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   177
#endif  // __WIN64
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   178
34651
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   179
/**
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   180
 * Method entry for static native methods:
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   181
 *   int java.util.zip.CRC32.update(int crc, int b)
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   182
 */
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
   183
address TemplateInterpreterGenerator::generate_CRC32_update_entry() {
34651
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   184
  if (UseCRC32Intrinsics) {
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   185
    address entry = __ pc();
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   186
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   187
    // rbx,: Method*
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   188
    // r13: senderSP must preserved for slow path, set SP to it on fast path
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   189
    // c_rarg0: scratch (rdi on non-Win64, rcx on Win64)
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   190
    // c_rarg1: scratch (rsi on non-Win64, rdx on Win64)
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   191
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   192
    Label slow_path;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   193
    // If we need a safepoint check, generate full interpreter entry.
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   194
    ExternalAddress state(SafepointSynchronize::address_of_state());
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   195
    __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   196
             SafepointSynchronize::_not_synchronized);
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   197
    __ jcc(Assembler::notEqual, slow_path);
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   198
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   199
    // We don't generate local frame and don't align stack because
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   200
    // we call stub code and there is no safepoint on this path.
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   201
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   202
    // Load parameters
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   203
    const Register crc = rax;  // crc
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   204
    const Register val = c_rarg0;  // source java byte value
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   205
    const Register tbl = c_rarg1;  // scratch
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   206
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   207
    // Arguments are reversed on java expression stack
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   208
    __ movl(val, Address(rsp,   wordSize)); // byte value
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   209
    __ movl(crc, Address(rsp, 2*wordSize)); // Initial CRC
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   210
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   211
    __ lea(tbl, ExternalAddress(StubRoutines::crc_table_addr()));
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   212
    __ notl(crc); // ~crc
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   213
    __ update_byte_crc32(crc, val, tbl);
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   214
    __ notl(crc); // ~crc
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   215
    // result in rax
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   216
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   217
    // _areturn
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   218
    __ pop(rdi);                // get return address
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   219
    __ mov(rsp, r13);           // set sp to sender sp
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   220
    __ jmp(rdi);
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   221
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   222
    // generate a vanilla native entry as the slow path
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   223
    __ bind(slow_path);
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   224
    __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native));
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   225
    return entry;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   226
  }
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   227
  return NULL;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   228
}
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   229
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   230
/**
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   231
 * Method entry for static native methods:
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   232
 *   int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int len)
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   233
 *   int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len)
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   234
 */
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
   235
address TemplateInterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) {
34651
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   236
  if (UseCRC32Intrinsics) {
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   237
    address entry = __ pc();
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   238
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   239
    // rbx,: Method*
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   240
    // r13: senderSP must preserved for slow path, set SP to it on fast path
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   241
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   242
    Label slow_path;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   243
    // If we need a safepoint check, generate full interpreter entry.
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   244
    ExternalAddress state(SafepointSynchronize::address_of_state());
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   245
    __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   246
             SafepointSynchronize::_not_synchronized);
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   247
    __ jcc(Assembler::notEqual, slow_path);
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   248
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   249
    // We don't generate local frame and don't align stack because
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   250
    // we call stub code and there is no safepoint on this path.
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   251
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   252
    // Load parameters
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   253
    const Register crc = c_rarg0;  // crc
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   254
    const Register buf = c_rarg1;  // source java byte array address
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   255
    const Register len = c_rarg2;  // length
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   256
    const Register off = len;      // offset (never overlaps with 'len')
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   257
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   258
    // Arguments are reversed on java expression stack
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   259
    // Calculate address of start element
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   260
    if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) {
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   261
      __ movptr(buf, Address(rsp, 3*wordSize)); // long buf
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   262
      __ movl2ptr(off, Address(rsp, 2*wordSize)); // offset
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   263
      __ addq(buf, off); // + offset
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   264
      __ movl(crc,   Address(rsp, 5*wordSize)); // Initial CRC
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   265
    } else {
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   266
      __ movptr(buf, Address(rsp, 3*wordSize)); // byte[] array
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   267
      __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   268
      __ movl2ptr(off, Address(rsp, 2*wordSize)); // offset
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   269
      __ addq(buf, off); // + offset
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   270
      __ movl(crc,   Address(rsp, 4*wordSize)); // Initial CRC
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   271
    }
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   272
    // Can now load 'len' since we're finished with 'off'
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   273
    __ movl(len, Address(rsp, wordSize)); // Length
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   274
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   275
    __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len);
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   276
    // result in rax
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   277
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   278
    // _areturn
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   279
    __ pop(rdi);                // get return address
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   280
    __ mov(rsp, r13);           // set sp to sender sp
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   281
    __ jmp(rdi);
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   282
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   283
    // generate a vanilla native entry as the slow path
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   284
    __ bind(slow_path);
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   285
    __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native));
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   286
    return entry;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   287
  }
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   288
  return NULL;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   289
}
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   290
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   291
/**
38238
1bbcc430c78d 8151268: Wire up the x86 _vectorizedMismatch stub routine in C1
psandoz
parents: 38018
diff changeset
   292
* Method entry for static (non-native) methods:
34651
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   293
*   int java.util.zip.CRC32C.updateBytes(int crc, byte[] b, int off, int end)
38238
1bbcc430c78d 8151268: Wire up the x86 _vectorizedMismatch stub routine in C1
psandoz
parents: 38018
diff changeset
   294
*   int java.util.zip.CRC32C.updateDirectByteBuffer(int crc, long address, int off, int end)
34651
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   295
*/
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
   296
address TemplateInterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) {
34651
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   297
  if (UseCRC32CIntrinsics) {
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   298
    address entry = __ pc();
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   299
    // Load parameters
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   300
    const Register crc = c_rarg0;  // crc
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   301
    const Register buf = c_rarg1;  // source java byte array address
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   302
    const Register len = c_rarg2;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   303
    const Register off = c_rarg3;  // offset
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   304
    const Register end = len;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   305
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   306
    // Arguments are reversed on java expression stack
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   307
    // Calculate address of start element
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   308
    if (kind == Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer) {
38238
1bbcc430c78d 8151268: Wire up the x86 _vectorizedMismatch stub routine in C1
psandoz
parents: 38018
diff changeset
   309
      __ movptr(buf, Address(rsp, 3 * wordSize)); // long address
34651
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   310
      __ movl2ptr(off, Address(rsp, 2 * wordSize)); // offset
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   311
      __ addq(buf, off); // + offset
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   312
      __ movl(crc, Address(rsp, 5 * wordSize)); // Initial CRC
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   313
      // Note on 5 * wordSize vs. 4 * wordSize:
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   314
      // *   int java.util.zip.CRC32C.updateByteBuffer(int crc, long address, int off, int end)
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   315
      //                                                   4         2,3          1        0
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   316
      // end starts at SP + 8
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   317
      // The Java(R) Virtual Machine Specification Java SE 7 Edition
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   318
      // 4.10.2.3. Values of Types long and double
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   319
      //    "When calculating operand stack length, values of type long and double have length two."
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   320
    } else {
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   321
      __ movptr(buf, Address(rsp, 3 * wordSize)); // byte[] array
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   322
      __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   323
      __ movl2ptr(off, Address(rsp, 2 * wordSize)); // offset
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   324
      __ addq(buf, off); // + offset
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   325
      __ movl(crc, Address(rsp, 4 * wordSize)); // Initial CRC
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   326
    }
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   327
    __ movl(end, Address(rsp, wordSize)); // end
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   328
    __ subl(end, off); // end - off
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   329
    __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32C()), crc, buf, len);
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   330
    // result in rax
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   331
    // _areturn
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   332
    __ pop(rdi);                // get return address
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   333
    __ mov(rsp, r13);           // set sp to sender sp
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   334
    __ jmp(rdi);
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   335
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   336
    return entry;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   337
  }
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   338
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   339
  return NULL;
07b1cc0f6040 8144534: Refactor templateInterpreter and templateInterpreterGenerator functions
coleenp
parents:
diff changeset
   340
}
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   341
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   342
//
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   343
// Various method entries
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   344
//
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   345
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   346
address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::MethodKind kind) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   347
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   348
  // rbx,: Method*
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   349
  // rcx: scratrch
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   350
  // r13: sender sp
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   351
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   352
  if (!InlineIntrinsics) return NULL; // Generate a vanilla entry
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   353
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   354
  address entry_point = __ pc();
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   355
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   356
  // These don't need a safepoint check because they aren't virtually
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   357
  // callable. We won't enter these intrinsics from compiled code.
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   358
  // If in the future we added an intrinsic which was virtually callable
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   359
  // we'd have to worry about how to safepoint so that this code is used.
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   360
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   361
  // mathematical functions inlined by compiler
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   362
  // (interpreter must provide identical implementation
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   363
  // in order to avoid monotonicity bugs when switching
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   364
  // from interpreter to compiler in the middle of some
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   365
  // computation)
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   366
  //
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   367
  // stack: [ ret adr ] <-- rsp
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   368
  //        [ lo(arg) ]
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   369
  //        [ hi(arg) ]
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   370
  //
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   371
41323
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   372
  if (kind == Interpreter::java_lang_math_fmaD) {
42580
56304dee97f3 8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents: 41323
diff changeset
   373
    if (!UseFMA) {
56304dee97f3 8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents: 41323
diff changeset
   374
      return NULL; // Generate a vanilla entry
56304dee97f3 8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents: 41323
diff changeset
   375
    }
41323
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   376
    __ movdbl(xmm0, Address(rsp, wordSize));
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   377
    __ movdbl(xmm1, Address(rsp, 3 * wordSize));
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   378
    __ movdbl(xmm2, Address(rsp, 5 * wordSize));
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   379
    __ fmad(xmm0, xmm1, xmm2, xmm0);
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   380
  } else if (kind == Interpreter::java_lang_math_fmaF) {
42580
56304dee97f3 8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents: 41323
diff changeset
   381
    if (!UseFMA) {
56304dee97f3 8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents: 41323
diff changeset
   382
      return NULL; // Generate a vanilla entry
56304dee97f3 8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents: 41323
diff changeset
   383
    }
41323
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   384
    __ movflt(xmm0, Address(rsp, wordSize));
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   385
    __ movflt(xmm1, Address(rsp, 2 * wordSize));
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   386
    __ movflt(xmm2, Address(rsp, 3 * wordSize));
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   387
    __ fmaf(xmm0, xmm1, xmm2, xmm0);
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   388
  } else if (kind == Interpreter::java_lang_math_sqrt) {
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   389
    __ sqrtsd(xmm0, Address(rsp, wordSize));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   390
  } else if (kind == Interpreter::java_lang_math_exp) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   391
    __ movdbl(xmm0, Address(rsp, wordSize));
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   392
    if (StubRoutines::dexp() != NULL) {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   393
      __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dexp())));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   394
    } else {
38699
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38238
diff changeset
   395
      __ call_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dexp));
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   396
    }
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   397
  } else if (kind == Interpreter::java_lang_math_log) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   398
    __ movdbl(xmm0, Address(rsp, wordSize));
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   399
    if (StubRoutines::dlog() != NULL) {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   400
      __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlog())));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   401
    } else {
38699
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38238
diff changeset
   402
      __ call_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dlog));
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   403
    }
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   404
  } else if (kind == Interpreter::java_lang_math_log10) {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   405
    __ movdbl(xmm0, Address(rsp, wordSize));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   406
    if (StubRoutines::dlog10() != NULL) {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   407
      __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlog10())));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   408
    } else {
38699
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38238
diff changeset
   409
      __ call_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dlog10));
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   410
    }
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   411
  } else if (kind == Interpreter::java_lang_math_sin) {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   412
    __ movdbl(xmm0, Address(rsp, wordSize));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   413
    if (StubRoutines::dsin() != NULL) {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   414
      __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dsin())));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   415
    } else {
38699
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38238
diff changeset
   416
      __ call_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dsin));
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   417
    }
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   418
  } else if (kind == Interpreter::java_lang_math_cos) {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   419
    __ movdbl(xmm0, Address(rsp, wordSize));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   420
    if (StubRoutines::dcos() != NULL) {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   421
      __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dcos())));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   422
    } else {
38699
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38238
diff changeset
   423
      __ call_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dcos));
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   424
    }
35495
jwilhelm
parents: 35479
diff changeset
   425
  } else if (kind == Interpreter::java_lang_math_pow) {
jwilhelm
parents: 35479
diff changeset
   426
    __ movdbl(xmm1, Address(rsp, wordSize));
jwilhelm
parents: 35479
diff changeset
   427
    __ movdbl(xmm0, Address(rsp, 3 * wordSize));
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   428
    if (StubRoutines::dpow() != NULL) {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   429
      __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dpow())));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   430
    } else {
38699
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38238
diff changeset
   431
      __ call_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dpow));
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   432
    }
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   433
  } else if (kind == Interpreter::java_lang_math_tan) {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   434
    __ movdbl(xmm0, Address(rsp, wordSize));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   435
    if (StubRoutines::dtan() != NULL) {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   436
      __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dtan())));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   437
    } else {
38699
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38238
diff changeset
   438
      __ call_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dtan));
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   439
    }
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   440
  } else {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   441
    __ fld_d(Address(rsp, wordSize));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   442
    switch (kind) {
38699
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38238
diff changeset
   443
    case Interpreter::java_lang_math_abs:
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38238
diff changeset
   444
      __ fabs();
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38238
diff changeset
   445
      break;
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38238
diff changeset
   446
    default:
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38238
diff changeset
   447
      ShouldNotReachHere();
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   448
    }
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   449
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   450
    // return double result in xmm0 for interpreter and compilers.
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   451
    __ subptr(rsp, 2*wordSize);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   452
    // Round to 64bit precision
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   453
    __ fstp_d(Address(rsp, 0));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   454
    __ movdbl(xmm0, Address(rsp, 0));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   455
    __ addptr(rsp, 2*wordSize);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   456
  }
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   457
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   458
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   459
  __ pop(rax);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   460
  __ mov(rsp, r13);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   461
  __ jmp(rax);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   462
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   463
  return entry_point;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   464
}
38699
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38238
diff changeset
   465