src/hotspot/cpu/x86/templateInterpreterGenerator_x86_32.cpp
author ihse
Tue, 22 Oct 2019 09:51:52 +0200
branchihse-cflags-rewrite-branch
changeset 58736 e878a0b7cff0
parent 51056 3ddf41505d54
permissions -rw-r--r--
Add doubunder on solaris in two places.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
49027
8dc742d9bbab 8195112: x86 (32 bit): implementation for Thread-local handshakes
mdoerr
parents: 47216
diff changeset
     2
 * Copyright (c) 1997, 2018, 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"
51056
3ddf41505d54 8204267: Generate comments in -XX:+PrintInterpreter to link to source code
iklam
parents: 49027
diff changeset
    27
#include "compiler/disassembler.hpp"
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
    28
#include "interpreter/interp_masm.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    29
#include "interpreter/interpreter.hpp"
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    30
#include "interpreter/interpreterRuntime.hpp"
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
    31
#include "interpreter/templateInterpreterGenerator.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6453
diff changeset
    32
#include "runtime/arguments.hpp"
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    33
#include "runtime/sharedRuntime.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
51056
3ddf41505d54 8204267: Generate comments in -XX:+PrintInterpreter to link to source code
iklam
parents: 49027
diff changeset
    35
#define __ Disassembler::hook<InterpreterMacroAssembler>(__FILE__, __LINE__, _masm)->
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    38
address TemplateInterpreterGenerator::generate_slow_signature_handler() {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    39
  address entry = __ pc();
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
  // rcx: temporary
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    42
  // rdi: pointer to locals
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    43
  // rsp: end of copied parameters area
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    44
  __ mov(rcx, rsp);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    45
  __ 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
    46
  __ ret(0);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    47
  return entry;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    48
}
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
    49
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    50
/**
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    51
 * Method entry for static native methods:
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    52
 *   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
    53
 */
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
    54
address TemplateInterpreterGenerator::generate_CRC32_update_entry() {
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    55
  if (UseCRC32Intrinsics) {
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    56
    address entry = __ pc();
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    57
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
    58
    // rbx: Method*
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    59
    // 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
    60
    // rdx: scratch
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    61
    // rdi: scratch
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    62
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    63
    Label slow_path;
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    64
    // If we need a safepoint check, generate full interpreter entry.
49027
8dc742d9bbab 8195112: x86 (32 bit): implementation for Thread-local handshakes
mdoerr
parents: 47216
diff changeset
    65
    __ safepoint_poll(slow_path, noreg, rdi);
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    66
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    67
    // 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
    68
    // 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
    69
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    70
    // Load parameters
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    71
    const Register crc = rax;  // crc
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    72
    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
    73
    const Register tbl = rdi;  // scratch
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    74
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    75
    // Arguments are reversed on java expression stack
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    76
    __ movl(val, Address(rsp,   wordSize)); // byte value
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    77
    __ 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
    78
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    79
    __ lea(tbl, ExternalAddress(StubRoutines::crc_table_addr()));
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    80
    __ notl(crc); // ~crc
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    81
    __ update_byte_crc32(crc, val, tbl);
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
    // result in rax
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    84
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    85
    // _areturn
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    86
    __ pop(rdi);                // get return address
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    87
    __ 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
    88
    __ jmp(rdi);
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    89
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    90
    // 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
    91
    __ bind(slow_path);
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
    92
    __ 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
    93
    return entry;
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    94
  }
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
    95
  return NULL;
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    96
}
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
    97
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
 * Method entry for static native methods:
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   100
 *   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
   101
 *   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
   102
 */
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
   103
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
   104
  if (UseCRC32Intrinsics) {
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   105
    address entry = __ pc();
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   106
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   107
    // rbx,: Method*
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   108
    // 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
   109
    // rdx: scratch
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   110
    // rdi: scratch
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   111
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   112
    Label slow_path;
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   113
    // If we need a safepoint check, generate full interpreter entry.
49027
8dc742d9bbab 8195112: x86 (32 bit): implementation for Thread-local handshakes
mdoerr
parents: 47216
diff changeset
   114
    __ safepoint_poll(slow_path, noreg, rdi);
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   115
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   116
    // 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
   117
    // 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
   118
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   119
    // Load parameters
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   120
    const Register crc = rax;  // crc
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   121
    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
   122
    const Register len = rdi;  // length
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   123
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   124
    // value              x86_32
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   125
    // interp. arg ptr    ESP + 4
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   126
    // 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
   127
    //                                         3           2      1        0
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   128
    // 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
   129
    //                                              4         2,3      1        0
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   130
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   131
    // Arguments are reversed on java expression stack
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   132
    __ 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
   133
    // Calculate address of start element
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   134
    if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) {
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   135
      __ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // long buf
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   136
      __ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   137
      __ 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
   138
    } else {
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   139
      __ 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
   140
      __ 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
   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 + 3 * wordSize)); // Initial CRC
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   143
    }
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   144
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   145
    __ 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
   146
    // result in rax
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   147
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   148
    // _areturn
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   149
    __ pop(rdi);                // get return address
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   150
    __ 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
   151
    __ jmp(rdi);
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
    // 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
   154
    __ bind(slow_path);
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   155
    __ 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
   156
    return entry;
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   157
  }
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   158
  return NULL;
18507
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   159
}
61bfc8995bb3 7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents: 17875
diff changeset
   160
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   161
/**
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   162
* Method entry for static native methods:
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   163
*   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
   164
*   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
   165
*/
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
   166
address TemplateInterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) {
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   167
  if (UseCRC32CIntrinsics) {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   168
    address entry = __ pc();
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   169
    // Load parameters
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   170
    const Register crc = rax;  // crc
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   171
    const Register buf = rcx;  // source java byte array address
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   172
    const Register len = rdx;  // length
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   173
    const Register end = len;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   174
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   175
    // value              x86_32
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   176
    // interp. arg ptr    ESP + 4
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   177
    // 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
   178
    //                                         3           2      1        0
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   179
    // 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
   180
    //                                              4         2,3          1        0
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   181
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   182
    // Arguments are reversed on java expression stack
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   183
    __ movl(end, Address(rsp, 4 + 0)); // end
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   184
    __ subl(len, Address(rsp, 4 + 1 * wordSize));  // end - offset == length
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   185
    // 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
   186
    if (kind == Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer) {
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   187
      __ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // long address
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   188
      __ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   189
      __ movl(crc, Address(rsp, 4 + 4 * wordSize)); // Initial CRC
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   190
    } else {
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   191
      __ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // byte[] array
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   192
      __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
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 + 3 * wordSize)); // Initial CRC
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   195
    }
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   196
    __ 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
   197
    // result in rax
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   198
    // _areturn
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   199
    __ pop(rdi);                // get return address
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   200
    __ mov(rsp, rsi);           // set sp to sender sp
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   201
    __ jmp(rdi);
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   202
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   203
    return entry;
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   204
  }
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   205
  return NULL;
33066
d98eab8215c4 8134553: CRC32C implementations for x86/x64 targets
kvn
parents: 32391
diff changeset
   206
}
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
/**
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   209
 * 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
   210
 *    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
   211
 */
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
   212
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
   213
  if (UseSSE >= 1) {
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   214
    address entry = __ pc();
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   215
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   216
    // rsi: the sender's SP
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   217
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   218
    // 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
   219
    // 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
   220
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   221
    // 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
   222
    __ movflt(xmm0, Address(rsp, wordSize));
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   223
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   224
    // Return
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   225
    __ pop(rdi); // get return address
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   226
    __ 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
   227
    __ jmp(rdi);
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   228
    return entry;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   229
  }
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   230
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   231
  return NULL;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   232
}
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   233
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
 * 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
   236
 *    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
   237
 */
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
   238
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
   239
  if (UseSSE >= 1) {
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   240
    address entry = __ pc();
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   241
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   242
    // rsi: the sender's SP
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   243
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   244
    // 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
   245
    // 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
   246
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   247
    // 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
   248
    __ movl(rax, Address(rsp, wordSize));
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   249
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   250
    // Return
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   251
    __ pop(rdi); // get return address
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   252
    __ 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
   253
    __ jmp(rdi);
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   254
    return entry;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   255
  }
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   256
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   257
  return NULL;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   258
}
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   259
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
/**
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   262
 * 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
   263
 *    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
   264
 */
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
   265
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
   266
   if (UseSSE >= 2) {
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   267
     address entry = __ pc();
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   268
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   269
     // rsi: the sender's SP
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   270
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   271
     // 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
   272
     // 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
   273
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   274
     // 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
   275
     __ movdbl(xmm0, Address(rsp, wordSize));
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   276
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   277
     // Return
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   278
     __ pop(rdi); // get return address
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   279
     __ 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
   280
     __ jmp(rdi);
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   281
     return entry;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   282
   }
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   283
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   284
   return NULL;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   285
}
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   286
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
 * 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
   289
 *    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
   290
 */
35214
d86005e0b4c2 8074457: Remove the non-Zero CPP Interpreter
coleenp
parents: 34651
diff changeset
   291
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
   292
  if (UseSSE >= 2) {
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   293
    address entry = __ pc();
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   294
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   295
    // rsi: the sender's SP
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   296
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   297
    // 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
   298
    // 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
   299
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   300
    // 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
   301
    __ 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
   302
    __ movl(rax, Address(rsp, wordSize));
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   303
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   304
    // Return
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   305
    __ pop(rdi); // get return address
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   306
    __ 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
   307
    __ jmp(rdi);
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   308
    return entry;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   309
  }
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   310
33070
54f3f085b165 8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents: 33066
diff changeset
   311
  return NULL;
32391
01e2f5e916c7 8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents: 31790
diff changeset
   312
}
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   313
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   314
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
   315
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   316
  // rbx,: Method*
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   317
  // rcx: scratrch
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   318
  // rsi: sender sp
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   319
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   320
  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
   321
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   322
  address entry_point = __ pc();
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   323
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   324
  // 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
   325
  // 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
   326
  // 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
   327
  // 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
   328
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   329
  // mathematical functions inlined by compiler
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   330
  // (interpreter must provide identical implementation
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   331
  // 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
   332
  // 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
   333
  // computation)
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   334
  //
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   335
  // stack: [ ret adr ] <-- rsp
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   336
  //        [ lo(arg) ]
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   337
  //        [ hi(arg) ]
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   338
  //
41323
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   339
  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
   340
    if (!UseFMA) {
56304dee97f3 8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents: 41323
diff changeset
   341
      return NULL; // Generate a vanilla entry
56304dee97f3 8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents: 41323
diff changeset
   342
    }
41323
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   343
    __ movdbl(xmm2, Address(rsp, 5 * wordSize));
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   344
    __ movdbl(xmm1, Address(rsp, 3 * wordSize));
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   345
    __ movdbl(xmm0, Address(rsp, 1 * wordSize));
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   346
    __ fmad(xmm0, xmm1, xmm2, xmm0);
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   347
    __ pop(rdi);                               // get return address
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   348
    __ mov(rsp, rsi);                          // set sp to sender sp
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   349
    __ jmp(rdi);
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   350
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   351
    return entry_point;
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   352
  } 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
   353
    if (!UseFMA) {
56304dee97f3 8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents: 41323
diff changeset
   354
      return NULL; // Generate a vanilla entry
56304dee97f3 8169711: CDS does not patch entry trampoline if intrinsic method is disabled
thartmann
parents: 41323
diff changeset
   355
    }
41323
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   356
    __ movflt(xmm2, Address(rsp, 3 * wordSize));
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   357
    __ movflt(xmm1, Address(rsp, 2 * wordSize));
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   358
    __ movflt(xmm0, Address(rsp, 1 * wordSize));
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   359
    __ fmaf(xmm0, xmm1, xmm2, xmm0);
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   360
    __ pop(rdi);                               // get return address
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   361
    __ mov(rsp, rsi);                          // set sp to sender sp
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   362
    __ jmp(rdi);
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   363
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   364
    return entry_point;
ddd5600d4762 8154122: Intrinsify fused mac operations
vdeshpande
parents: 38699
diff changeset
   365
 }
35479
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
  __ fld_d(Address(rsp, 1*wordSize));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   368
  switch (kind) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   369
    case Interpreter::java_lang_math_sin :
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   370
        __ subptr(rsp, 2 * wordSize);
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   371
        __ fstp_d(Address(rsp, 0));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   372
        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
   373
          __ 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
   374
        } else {
38699
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38018
diff changeset
   375
          __ 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
   376
        }
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   377
        __ addptr(rsp, 2 * wordSize);
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   378
        break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   379
    case Interpreter::java_lang_math_cos :
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   380
        __ subptr(rsp, 2 * wordSize);
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   381
        __ fstp_d(Address(rsp, 0));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   382
        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
   383
          __ 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
   384
        } else {
38699
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38018
diff changeset
   385
          __ 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
   386
        }
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   387
        __ addptr(rsp, 2 * wordSize);
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   388
        break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   389
    case Interpreter::java_lang_math_tan :
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   390
        __ subptr(rsp, 2 * wordSize);
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   391
        __ fstp_d(Address(rsp, 0));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   392
        if (StubRoutines::dtan() != 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::dtan())));
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: 38018
diff changeset
   395
          __ 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
   396
        }
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   397
        __ addptr(rsp, 2 * wordSize);
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   398
        break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   399
    case Interpreter::java_lang_math_sqrt:
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   400
        __ fsqrt();
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   401
        break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   402
    case Interpreter::java_lang_math_abs:
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   403
        __ fabs();
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   404
        break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   405
    case Interpreter::java_lang_math_log:
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   406
        __ subptr(rsp, 2 * wordSize);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   407
        __ fstp_d(Address(rsp, 0));
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   408
        if (StubRoutines::dlog() != NULL) {
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   409
          __ 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
   410
        } else {
38699
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38018
diff changeset
   411
          __ call_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dlog));
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   412
        }
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   413
        __ addptr(rsp, 2 * wordSize);
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_log10:
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   416
        __ subptr(rsp, 2 * wordSize);
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   417
        __ fstp_d(Address(rsp, 0));
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   418
        if (StubRoutines::dlog10() != NULL) {
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   419
          __ 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
   420
        } else {
38699
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38018
diff changeset
   421
          __ 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
   422
        }
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   423
        __ addptr(rsp, 2 * wordSize);
35479
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
    case Interpreter::java_lang_math_pow:
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   426
      __ fld_d(Address(rsp, 3*wordSize)); // second argument
35495
jwilhelm
parents: 35479
diff changeset
   427
      __ subptr(rsp, 4 * wordSize);
jwilhelm
parents: 35479
diff changeset
   428
      __ fstp_d(Address(rsp, 0));
jwilhelm
parents: 35479
diff changeset
   429
      __ fstp_d(Address(rsp, 2 * wordSize));
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   430
      if (StubRoutines::dpow() != NULL) {
35495
jwilhelm
parents: 35479
diff changeset
   431
        __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, StubRoutines::dpow())));
jwilhelm
parents: 35479
diff changeset
   432
      } else {
38699
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38018
diff changeset
   433
        __ call_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dpow));
35495
jwilhelm
parents: 35479
diff changeset
   434
      }
jwilhelm
parents: 35479
diff changeset
   435
      __ addptr(rsp, 4 * wordSize);
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   436
      break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   437
    case Interpreter::java_lang_math_exp:
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   438
      __ subptr(rsp, 2*wordSize);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   439
      __ fstp_d(Address(rsp, 0));
38018
1dc6c6f21231 8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents: 35495
diff changeset
   440
      if (StubRoutines::dexp() != NULL) {
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   441
        __ 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
   442
      } else {
38699
f8bec5f6b09c 8154473: Update for CompilerDirectives to control stub generation and intrinsics
vdeshpande
parents: 38018
diff changeset
   443
        __ call_VM_leaf0(CAST_FROM_FN_PTR(address, SharedRuntime::dexp));
35479
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   444
      }
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   445
      __ addptr(rsp, 2*wordSize);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   446
    break;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   447
    default                              :
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   448
        ShouldNotReachHere();
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
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   451
  // 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
   452
  if (UseSSE >= 2) {
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   453
    __ subptr(rsp, 2*wordSize);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   454
    __ fstp_d(Address(rsp, 0));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   455
    __ movdbl(xmm0, Address(rsp, 0));
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   456
    __ addptr(rsp, 2*wordSize);
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
  // 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
   460
  __ pop(rdi);                               // get return address
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   461
  __ 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
   462
  __ jmp(rdi);
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   463
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   464
  return entry_point;
62c12ca7a45e 8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents: 35214
diff changeset
   465
}