hotspot/src/cpu/x86/vm/jniFastGetField_x86_64.cpp
author jwilhelm
Thu, 06 Jul 2017 01:50:26 +0200
changeset 46630 75aa3e39d02c
parent 44406 a46a6c4d1dd9
permissions -rw-r--r--
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8 8182656: Make the required changes in GC code to build on OSX 10 + Xcode 8 8182657: Make the required changes in Runtime code to build on OSX 10 + Xcode 8 8182658: Make the required changes in Compiler code to build on OSX 10 + Xcode 8 Reviewed-by: jwilhelm, ehelin, phh Contributed-by: phh <hohensee@amazon.com>, jwilhelm <jesper.wilhelmsson@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
44406
a46a6c4d1dd9 8176100: [REDO][REDO] G1 Needs pre barrier on dereference of weak JNI handles
mgerdin
parents: 44093
diff changeset
     2
 * Copyright (c) 2004, 2017, 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: 1217
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1217
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: 1217
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: 6418
diff changeset
    25
#include "precompiled.hpp"
14626
0cf4eccf130f 8003240: x86: move MacroAssembler into separate file
twisti
parents: 7397
diff changeset
    26
#include "asm/macroAssembler.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    27
#include "memory/resourceArea.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    28
#include "prims/jniFastGetField.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    29
#include "prims/jvm_misc.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6418
diff changeset
    30
#include "runtime/safepoint.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
#define __ masm->
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
#define BUFFER_SIZE 30*wordSize
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
// Instead of issuing lfence for LoadLoad barrier, we create data dependency
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
// between loads, which is more efficient than lfence.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// Common register usage:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// rax/xmm0: result
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// c_rarg0:    jni env
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
// c_rarg1:    obj
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
// c_rarg2:    jfield id
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
static const Register robj          = r9;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
static const Register rcounter      = r10;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
static const Register roffset       = r11;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
static const Register rcounter_addr = r11;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
// Warning: do not use rip relative addressing after the first counter load
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
// since that may scratch r10!
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
33589
7cbd1b2c139b 8139040: Fix initializations before ShouldNotReachHere() etc. and enable -Wuninitialized on linux.
goetz
parents: 14626
diff changeset
    54
  const char *name = NULL;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  switch (type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    case T_BOOLEAN: name = "jni_fast_GetBooleanField"; break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
    case T_BYTE:    name = "jni_fast_GetByteField";    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
    case T_CHAR:    name = "jni_fast_GetCharField";    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
    case T_SHORT:   name = "jni_fast_GetShortField";   break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    case T_INT:     name = "jni_fast_GetIntField";     break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
    case T_LONG:    name = "jni_fast_GetLongField";    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
    default:        ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  ResourceMark rm;
6418
6671edbd230e 6978355: renaming for 6961697
twisti
parents: 5547
diff changeset
    65
  BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE);
6671edbd230e 6978355: renaming for 6961697
twisti
parents: 5547
diff changeset
    66
  CodeBuffer cbuf(blob);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  MacroAssembler* masm = new MacroAssembler(&cbuf);
6418
6671edbd230e 6978355: renaming for 6961697
twisti
parents: 5547
diff changeset
    68
  address fast_entry = __ pc();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  Label slow;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  __ mov32 (rcounter, counter);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    74
  __ mov   (robj, c_rarg1);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  __ testb (rcounter, 1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  __ jcc (Assembler::notZero, slow);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  if (os::is_MP()) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    78
    __ xorptr(robj, rcounter);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    79
    __ xorptr(robj, rcounter);                   // obj, since
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
                                                // robj ^ rcounter ^ rcounter == robj
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
                                                // robj is data dependent on rcounter.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  }
44406
a46a6c4d1dd9 8176100: [REDO][REDO] G1 Needs pre barrier on dereference of weak JNI handles
mgerdin
parents: 44093
diff changeset
    83
a46a6c4d1dd9 8176100: [REDO][REDO] G1 Needs pre barrier on dereference of weak JNI handles
mgerdin
parents: 44093
diff changeset
    84
  __ clear_jweak_tag(robj);
a46a6c4d1dd9 8176100: [REDO][REDO] G1 Needs pre barrier on dereference of weak JNI handles
mgerdin
parents: 44093
diff changeset
    85
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    86
  __ movptr(robj, Address(robj, 0));             // *obj
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    87
  __ mov   (roffset, c_rarg2);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    88
  __ shrptr(roffset, 2);                         // offset
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  speculative_load_pclist[count] = __ pc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  switch (type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    case T_BOOLEAN: __ movzbl (rax, Address(robj, roffset, Address::times_1)); break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
    case T_BYTE:    __ movsbl (rax, Address(robj, roffset, Address::times_1)); break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    case T_CHAR:    __ movzwl (rax, Address(robj, roffset, Address::times_1)); break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    case T_SHORT:   __ movswl (rax, Address(robj, roffset, Address::times_1)); break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    case T_INT:     __ movl   (rax, Address(robj, roffset, Address::times_1)); break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    case T_LONG:    __ movq   (rax, Address(robj, roffset, Address::times_1)); break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    default:        ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  if (os::is_MP()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    __ lea(rcounter_addr, counter);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    // ca is data dependent on rax.
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   105
    __ xorptr(rcounter_addr, rax);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   106
    __ xorptr(rcounter_addr, rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    __ cmpl (rcounter, Address(rcounter_addr, 0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
    __ cmp32 (rcounter, counter);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  __ jcc (Assembler::notEqual, slow);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  __ ret (0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  slowcase_entry_pclist[count++] = __ pc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  __ bind (slow);
33589
7cbd1b2c139b 8139040: Fix initializations before ShouldNotReachHere() etc. and enable -Wuninitialized on linux.
goetz
parents: 14626
diff changeset
   117
  address slow_case_addr = NULL;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  switch (type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    case T_BOOLEAN: slow_case_addr = jni_GetBooleanField_addr(); break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    case T_BYTE:    slow_case_addr = jni_GetByteField_addr();    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
    case T_CHAR:    slow_case_addr = jni_GetCharField_addr();    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    case T_SHORT:   slow_case_addr = jni_GetShortField_addr();   break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    case T_INT:     slow_case_addr = jni_GetIntField_addr();     break;
46630
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 44406
diff changeset
   124
    case T_LONG:    slow_case_addr = jni_GetLongField_addr();    break;
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 44406
diff changeset
   125
    default:                                                     break;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  // tail call
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  __ jump (ExternalAddress(slow_case_addr));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  __ flush ();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  return fast_entry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
address JNI_FastGetField::generate_fast_get_boolean_field() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  return generate_fast_get_int_field0(T_BOOLEAN);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
address JNI_FastGetField::generate_fast_get_byte_field() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  return generate_fast_get_int_field0(T_BYTE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
address JNI_FastGetField::generate_fast_get_char_field() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  return generate_fast_get_int_field0(T_CHAR);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
address JNI_FastGetField::generate_fast_get_short_field() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  return generate_fast_get_int_field0(T_SHORT);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
address JNI_FastGetField::generate_fast_get_int_field() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  return generate_fast_get_int_field0(T_INT);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
address JNI_FastGetField::generate_fast_get_long_field() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  return generate_fast_get_int_field0(T_LONG);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) {
33589
7cbd1b2c139b 8139040: Fix initializations before ShouldNotReachHere() etc. and enable -Wuninitialized on linux.
goetz
parents: 14626
diff changeset
   160
  const char *name = NULL;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  switch (type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
    case T_FLOAT:     name = "jni_fast_GetFloatField";     break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
    case T_DOUBLE:    name = "jni_fast_GetDoubleField";    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
    default:          ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  ResourceMark rm;
6418
6671edbd230e 6978355: renaming for 6961697
twisti
parents: 5547
diff changeset
   167
  BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE);
6671edbd230e 6978355: renaming for 6961697
twisti
parents: 5547
diff changeset
   168
  CodeBuffer cbuf(blob);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  MacroAssembler* masm = new MacroAssembler(&cbuf);
6418
6671edbd230e 6978355: renaming for 6961697
twisti
parents: 5547
diff changeset
   170
  address fast_entry = __ pc();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  Label slow;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  __ mov32 (rcounter, counter);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   176
  __ mov   (robj, c_rarg1);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  __ testb (rcounter, 1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  __ jcc (Assembler::notZero, slow);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  if (os::is_MP()) {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   180
    __ xorptr(robj, rcounter);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   181
    __ xorptr(robj, rcounter);                   // obj, since
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
                                                // robj ^ rcounter ^ rcounter == robj
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
                                                // robj is data dependent on rcounter.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  }
44406
a46a6c4d1dd9 8176100: [REDO][REDO] G1 Needs pre barrier on dereference of weak JNI handles
mgerdin
parents: 44093
diff changeset
   185
a46a6c4d1dd9 8176100: [REDO][REDO] G1 Needs pre barrier on dereference of weak JNI handles
mgerdin
parents: 44093
diff changeset
   186
  __ clear_jweak_tag(robj);
a46a6c4d1dd9 8176100: [REDO][REDO] G1 Needs pre barrier on dereference of weak JNI handles
mgerdin
parents: 44093
diff changeset
   187
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   188
  __ movptr(robj, Address(robj, 0));             // *obj
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   189
  __ mov   (roffset, c_rarg2);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   190
  __ shrptr(roffset, 2);                         // offset
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  speculative_load_pclist[count] = __ pc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  switch (type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
    case T_FLOAT:  __ movflt (xmm0, Address(robj, roffset, Address::times_1)); break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
    case T_DOUBLE: __ movdbl (xmm0, Address(robj, roffset, Address::times_1)); break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    default:        ShouldNotReachHere();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  if (os::is_MP()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
    __ lea(rcounter_addr, counter);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
    __ movdq (rax, xmm0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
    // counter address is data dependent on xmm0.
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   204
    __ xorptr(rcounter_addr, rax);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   205
    __ xorptr(rcounter_addr, rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
    __ cmpl (rcounter, Address(rcounter_addr, 0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
    __ cmp32 (rcounter, counter);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  __ jcc (Assembler::notEqual, slow);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  __ ret (0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  slowcase_entry_pclist[count++] = __ pc();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  __ bind (slow);
33589
7cbd1b2c139b 8139040: Fix initializations before ShouldNotReachHere() etc. and enable -Wuninitialized on linux.
goetz
parents: 14626
diff changeset
   216
  address slow_case_addr = NULL;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  switch (type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
    case T_FLOAT:     slow_case_addr = jni_GetFloatField_addr();  break;
46630
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 44406
diff changeset
   219
    case T_DOUBLE:    slow_case_addr = jni_GetDoubleField_addr(); break;
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 44406
diff changeset
   220
    default:                                                      break;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  // tail call
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  __ jump (ExternalAddress(slow_case_addr));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  __ flush ();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  return fast_entry;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
address JNI_FastGetField::generate_fast_get_float_field() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  return generate_fast_get_float_field0(T_FLOAT);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
address JNI_FastGetField::generate_fast_get_double_field() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  return generate_fast_get_float_field0(T_DOUBLE);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
}