hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86_32.cpp
author vdeshpande
Wed, 06 Apr 2016 10:29:26 -0700
changeset 38018 1dc6c6f21231
parent 35495 e27da438fa13
child 38699 f8bec5f6b09c
permissions -rw-r--r--
8152907: Update for x86 tan and log10 in the math lib Summary: Optimize Math.tan() and log10() for 64 and 32 bit X86 architecture using Intel LIBM implementation. Reviewed-by: kvn, twisti Contributed-by: shravya.rukmannagari@intel.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
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) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5419
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5419
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5419
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    25
#include "precompiled.hpp"
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 13728
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"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
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"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    31
#include "runtime/arguments.hpp"
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    32
#include "runtime/sharedRuntime.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
#define __ _masm->
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
35479
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
  // rbx,: method
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    40
  // rcx: temporary
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    41
  // rdi: pointer to locals
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    42
  // rsp: end of copied parameters area
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    43
  __ mov(rcx, rsp);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    44
  __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::slow_signature_handler), rbx, rdi, rcx);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    45
  __ ret(0);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    46
  return entry;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    47
}
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    48
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    49
/**
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    50
 * Method entry for static native methods:
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    51
 *   int java.util.zip.CRC32.update(int crc, int b)
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    52
 */
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
    53
address TemplateInterpreterGenerator::generate_CRC32_update_entry() {
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    54
  if (UseCRC32Intrinsics) {
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    55
    address entry = __ pc();
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    56
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
    57
    // rbx: Method*
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    58
    // rsi: senderSP must preserved for slow path, set SP to it on fast path
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    59
    // rdx: scratch
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    60
    // rdi: scratch
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    61
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    62
    Label slow_path;
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    63
    // If we need a safepoint check, generate full interpreter entry.
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    64
    ExternalAddress state(SafepointSynchronize::address_of_state());
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    65
    __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    66
             SafepointSynchronize::_not_synchronized);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    67
    __ jcc(Assembler::notEqual, slow_path);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    68
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    69
    // We don't generate local frame and don't align stack because
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    70
    // we call stub code and there is no safepoint on this path.
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    71
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    72
    // Load parameters
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    73
    const Register crc = rax;  // crc
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    74
    const Register val = rdx;  // source java byte value
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    75
    const Register tbl = rdi;  // scratch
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    76
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    77
    // Arguments are reversed on java expression stack
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    78
    __ movl(val, Address(rsp,   wordSize)); // byte value
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    79
    __ movl(crc, Address(rsp, 2*wordSize)); // Initial CRC
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    80
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    81
    __ lea(tbl, ExternalAddress(StubRoutines::crc_table_addr()));
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    82
    __ notl(crc); // ~crc
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    83
    __ update_byte_crc32(crc, val, tbl);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    84
    __ notl(crc); // ~crc
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    85
    // result in rax
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    86
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    87
    // _areturn
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    88
    __ pop(rdi);                // get return address
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    89
    __ mov(rsp, rsi);           // set sp to sender sp
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    90
    __ jmp(rdi);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    91
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    92
    // generate a vanilla native entry as the slow path
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    93
    __ bind(slow_path);
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
    94
    __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native));
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    95
    return entry;
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    96
  }
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
    97
  return NULL;
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    98
}
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    99
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   100
/**
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   101
 * Method entry for static native methods:
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   102
 *   int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int len)
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   103
 *   int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len)
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   104
 */
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
   105
address TemplateInterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) {
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   106
  if (UseCRC32Intrinsics) {
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   107
    address entry = __ pc();
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   108
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   109
    // rbx,: Method*
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   110
    // rsi: senderSP must preserved for slow path, set SP to it on fast path
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   111
    // rdx: scratch
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   112
    // rdi: scratch
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   113
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   114
    Label slow_path;
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   115
    // If we need a safepoint check, generate full interpreter entry.
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   116
    ExternalAddress state(SafepointSynchronize::address_of_state());
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   117
    __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   118
             SafepointSynchronize::_not_synchronized);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   119
    __ jcc(Assembler::notEqual, slow_path);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   120
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   121
    // We don't generate local frame and don't align stack because
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   122
    // we call stub code and there is no safepoint on this path.
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   123
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   124
    // Load parameters
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   125
    const Register crc = rax;  // crc
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   126
    const Register buf = rdx;  // source java byte array address
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   127
    const Register len = rdi;  // length
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   128
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   129
    // value              x86_32
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   130
    // interp. arg ptr    ESP + 4
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   131
    // int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int len)
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   132
    //                                         3           2      1        0
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   133
    // int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len)
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   134
    //                                              4         2,3      1        0
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   135
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   136
    // Arguments are reversed on java expression stack
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   137
    __ movl(len,   Address(rsp,   4 + 0)); // Length
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   138
    // Calculate address of start element
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   139
    if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) {
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   140
      __ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // long buf
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   141
      __ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   142
      __ movl(crc,   Address(rsp, 4 + 4 * wordSize)); // Initial CRC
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   143
    } else {
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   144
      __ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // byte[] array
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   145
      __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   146
      __ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   147
      __ movl(crc,   Address(rsp, 4 + 3 * wordSize)); // Initial CRC
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   148
    }
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   149
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   150
    __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   151
    // result in rax
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   152
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   153
    // _areturn
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   154
    __ pop(rdi);                // get return address
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   155
    __ mov(rsp, rsi);           // set sp to sender sp
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   156
    __ jmp(rdi);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   157
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   158
    // generate a vanilla native entry as the slow path
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   159
    __ bind(slow_path);
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   160
    __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native));
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   161
    return entry;
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   162
  }
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   163
  return NULL;
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   164
}
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   165
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   166
/**
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   167
* Method entry for static native methods:
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   168
*   int java.util.zip.CRC32C.updateBytes(int crc, byte[] b, int off, int end)
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   169
*   int java.util.zip.CRC32C.updateByteBuffer(int crc, long address, int off, int end)
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   170
*/
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
   171
address TemplateInterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) {
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   172
  if (UseCRC32CIntrinsics) {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   173
    address entry = __ pc();
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   174
    // Load parameters
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   175
    const Register crc = rax;  // crc
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   176
    const Register buf = rcx;  // source java byte array address
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   177
    const Register len = rdx;  // length
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   178
    const Register end = len;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   179
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   180
    // value              x86_32
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   181
    // interp. arg ptr    ESP + 4
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   182
    // int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int end)
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   183
    //                                         3           2      1        0
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   184
    // int java.util.zip.CRC32.updateByteBuffer(int crc, long address, int off, int end)
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   185
    //                                              4         2,3          1        0
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   186
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   187
    // Arguments are reversed on java expression stack
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   188
    __ movl(end, Address(rsp, 4 + 0)); // end
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   189
    __ subl(len, Address(rsp, 4 + 1 * wordSize));  // end - offset == length
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   190
    // Calculate address of start element
33087
5945b51448e9 8139094: Tier1 test java/util/zip/TestCRC32C.java fails due to fixes for JDK-8134553
iveresov
parents: 33070
diff changeset
   191
    if (kind == Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer) {
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   192
      __ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // long address
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   193
      __ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   194
      __ movl(crc, Address(rsp, 4 + 4 * wordSize)); // Initial CRC
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   195
    } else {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   196
      __ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // byte[] array
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   197
      __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   198
      __ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   199
      __ movl(crc, Address(rsp, 4 + 3 * wordSize)); // Initial CRC
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   200
    }
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   201
    __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32C()), crc, buf, len);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   202
    // result in rax
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   203
    // _areturn
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   204
    __ pop(rdi);                // get return address
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   205
    __ mov(rsp, rsi);           // set sp to sender sp
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   206
    __ jmp(rdi);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   207
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   208
    return entry;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   209
  }
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   210
  return NULL;
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   211
}
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   212
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   213
/**
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   214
 * Method entry for static native method:
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   215
 *    java.lang.Float.intBitsToFloat(int bits)
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   216
 */
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
   217
address TemplateInterpreterGenerator::generate_Float_intBitsToFloat_entry() {
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   218
  if (UseSSE >= 1) {
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   219
    address entry = __ pc();
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   220
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   221
    // rsi: the sender's SP
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   222
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   223
    // Skip safepoint check (compiler intrinsic versions of this method
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   224
    // do not perform safepoint checks either).
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   225
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   226
    // Load 'bits' into xmm0 (interpreter returns results in xmm0)
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   227
    __ movflt(xmm0, Address(rsp, wordSize));
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   228
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   229
    // Return
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   230
    __ pop(rdi); // get return address
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   231
    __ mov(rsp, rsi); // set rsp to the sender's SP
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   232
    __ jmp(rdi);
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   233
    return entry;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   234
  }
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   235
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   236
  return NULL;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   237
}
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   238
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   239
/**
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   240
 * Method entry for static native method:
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   241
 *    java.lang.Float.floatToRawIntBits(float value)
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   242
 */
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
   243
address TemplateInterpreterGenerator::generate_Float_floatToRawIntBits_entry() {
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   244
  if (UseSSE >= 1) {
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   245
    address entry = __ pc();
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   246
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   247
    // rsi: the sender's SP
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   248
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   249
    // Skip safepoint check (compiler intrinsic versions of this method
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   250
    // do not perform safepoint checks either).
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   251
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   252
    // Load the parameter (a floating-point value) into rax.
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   253
    __ movl(rax, Address(rsp, wordSize));
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   254
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   255
    // Return
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   256
    __ pop(rdi); // get return address
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   257
    __ mov(rsp, rsi); // set rsp to the sender's SP
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   258
    __ jmp(rdi);
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   259
    return entry;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   260
  }
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   261
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   262
  return NULL;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   263
}
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   264
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   265
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   266
/**
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   267
 * Method entry for static native method:
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   268
 *    java.lang.Double.longBitsToDouble(long bits)
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   269
 */
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
   270
address TemplateInterpreterGenerator::generate_Double_longBitsToDouble_entry() {
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   271
   if (UseSSE >= 2) {
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   272
     address entry = __ pc();
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   273
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   274
     // rsi: the sender's SP
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   275
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   276
     // Skip safepoint check (compiler intrinsic versions of this method
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   277
     // do not perform safepoint checks either).
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   278
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   279
     // Load 'bits' into xmm0 (interpreter returns results in xmm0)
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   280
     __ movdbl(xmm0, Address(rsp, wordSize));
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   281
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   282
     // Return
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   283
     __ pop(rdi); // get return address
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   284
     __ mov(rsp, rsi); // set rsp to the sender's SP
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   285
     __ jmp(rdi);
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   286
     return entry;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   287
   }
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   288
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   289
   return NULL;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   290
}
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   291
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   292
/**
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   293
 * Method entry for static native method:
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   294
 *    java.lang.Double.doubleToRawLongBits(double value)
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   295
 */
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
   296
address TemplateInterpreterGenerator::generate_Double_doubleToRawLongBits_entry() {
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   297
  if (UseSSE >= 2) {
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   298
    address entry = __ pc();
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   299
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   300
    // rsi: the sender's SP
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   301
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   302
    // Skip safepoint check (compiler intrinsic versions of this method
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   303
    // do not perform safepoint checks either).
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   304
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   305
    // Load the parameter (a floating-point value) into rax.
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   306
    __ movl(rdx, Address(rsp, 2*wordSize));
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   307
    __ movl(rax, Address(rsp, wordSize));
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   308
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   309
    // Return
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   310
    __ pop(rdi); // get return address
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   311
    __ mov(rsp, rsi); // set rsp to the sender's SP
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   312
    __ jmp(rdi);
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   313
    return entry;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   314
  }
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   315
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   316
  return NULL;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   317
}
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   318
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   319
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
   320
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   321
  // rbx,: Method*
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   322
  // rcx: scratrch
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   323
  // rsi: sender sp
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   324
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   325
  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
   326
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   327
  address entry_point = __ pc();
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   328
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   329
  // 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
   330
  // 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
   331
  // 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
   332
  // 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
   333
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   334
  // mathematical functions inlined by compiler
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   335
  // (interpreter must provide identical implementation
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   336
  // 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
   337
  // 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
   338
  // computation)
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   339
  //
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   340
  // stack: [ ret adr ] <-- rsp
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   341
  //        [ lo(arg) ]
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   342
  //        [ hi(arg) ]
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   343
  //
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
  __ fld_d(Address(rsp, 1*wordSize));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   346
  switch (kind) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   347
    case Interpreter::java_lang_math_sin :
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   348
        __ subptr(rsp, 2 * wordSize);
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   349
        __ fstp_d(Address(rsp, 0));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   350
        if (VM_Version::supports_sse2() && StubRoutines::dsin() != NULL) {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   351
          __ 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
   352
        } else {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   353
          __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dsin)));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   354
        }
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   355
        __ addptr(rsp, 2 * wordSize);
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   356
        break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   357
    case Interpreter::java_lang_math_cos :
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   358
        __ subptr(rsp, 2 * wordSize);
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   359
        __ fstp_d(Address(rsp, 0));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   360
        if (VM_Version::supports_sse2() && StubRoutines::dcos() != NULL) {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   361
          __ 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
   362
        } else {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   363
          __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dcos)));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   364
        }
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   365
        __ addptr(rsp, 2 * wordSize);
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   366
        break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   367
    case Interpreter::java_lang_math_tan :
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   368
        __ subptr(rsp, 2 * wordSize);
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   369
        __ fstp_d(Address(rsp, 0));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   370
        if (StubRoutines::dtan() != NULL) {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   371
          __ 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
   372
        } else {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   373
          __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dtan)));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   374
        }
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   375
        __ addptr(rsp, 2 * wordSize);
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   376
        break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   377
    case Interpreter::java_lang_math_sqrt:
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   378
        __ fsqrt();
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   379
        break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   380
    case Interpreter::java_lang_math_abs:
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   381
        __ fabs();
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   382
        break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   383
    case Interpreter::java_lang_math_log:
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   384
        __ subptr(rsp, 2 * wordSize);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   385
        __ fstp_d(Address(rsp, 0));
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   386
        if (StubRoutines::dlog() != NULL) {
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   387
          __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dlog())));
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   388
        } else {
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   389
          __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dlog)));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   390
        }
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   391
        __ addptr(rsp, 2 * wordSize);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   392
        break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   393
    case Interpreter::java_lang_math_log10:
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   394
        __ subptr(rsp, 2 * wordSize);
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   395
        __ fstp_d(Address(rsp, 0));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   396
        if (StubRoutines::dlog10() != NULL) {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   397
          __ 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
   398
        } else {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   399
          __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dlog10)));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   400
        }
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   401
        __ addptr(rsp, 2 * wordSize);
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   402
        break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   403
    case Interpreter::java_lang_math_pow:
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   404
      __ fld_d(Address(rsp, 3*wordSize)); // second argument
35495
jwilhelm
parents: 35479
diff changeset
   405
      __ subptr(rsp, 4 * wordSize);
jwilhelm
parents: 35479
diff changeset
   406
      __ fstp_d(Address(rsp, 0));
jwilhelm
parents: 35479
diff changeset
   407
      __ fstp_d(Address(rsp, 2 * wordSize));
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   408
      if (StubRoutines::dpow() != NULL) {
35495
jwilhelm
parents: 35479
diff changeset
   409
        __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dpow())));
jwilhelm
parents: 35479
diff changeset
   410
      } else {
jwilhelm
parents: 35479
diff changeset
   411
        __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dpow)));
jwilhelm
parents: 35479
diff changeset
   412
      }
jwilhelm
parents: 35479
diff changeset
   413
      __ addptr(rsp, 4 * wordSize);
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   414
      break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   415
    case Interpreter::java_lang_math_exp:
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   416
      __ subptr(rsp, 2*wordSize);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   417
      __ fstp_d(Address(rsp, 0));
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   418
      if (StubRoutines::dexp() != NULL) {
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   419
        __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dexp())));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   420
      } else {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   421
        __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::dexp)));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   422
      }
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   423
      __ addptr(rsp, 2*wordSize);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   424
    break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   425
    default                              :
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   426
        ShouldNotReachHere();
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   427
  }
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   428
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   429
  // 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
   430
  if (UseSSE >= 2) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   431
    __ subptr(rsp, 2*wordSize);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   432
    __ fstp_d(Address(rsp, 0));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   433
    __ movdbl(xmm0, Address(rsp, 0));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   434
    __ addptr(rsp, 2*wordSize);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   435
  }
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   436
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   437
  // done, result in FPU ST(0) or XMM0
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   438
  __ pop(rdi);                               // get return address
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   439
  __ mov(rsp, rsi);                          // set sp to sender sp
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   440
  __ jmp(rdi);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   441
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   442
  return entry_point;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   443
}