< prev index next >

src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp

Print this page
rev 47591 : Add Thread Local handshakes and thread local polling
   1 /*
   2  * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 173   __ ret(0);
 174 
 175   return entry;
 176 }
 177 #endif  // __WIN64
 178 
 179 /**
 180  * Method entry for static native methods:
 181  *   int java.util.zip.CRC32.update(int crc, int b)
 182  */
 183 address TemplateInterpreterGenerator::generate_CRC32_update_entry() {
 184   if (UseCRC32Intrinsics) {
 185     address entry = __ pc();
 186 
 187     // rbx,: Method*
 188     // r13: senderSP must preserved for slow path, set SP to it on fast path
 189     // c_rarg0: scratch (rdi on non-Win64, rcx on Win64)
 190     // c_rarg1: scratch (rsi on non-Win64, rdx on Win64)
 191 
 192     Label slow_path;
 193     // If we need a safepoint check, generate full interpreter entry.
 194     ExternalAddress state(SafepointSynchronize::address_of_state());
 195     __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
 196              SafepointSynchronize::_not_synchronized);
 197     __ jcc(Assembler::notEqual, slow_path);
 198 
 199     // We don't generate local frame and don't align stack because
 200     // we call stub code and there is no safepoint on this path.
 201 
 202     // Load parameters
 203     const Register crc = rax;  // crc
 204     const Register val = c_rarg0;  // source java byte value
 205     const Register tbl = c_rarg1;  // scratch
 206 
 207     // Arguments are reversed on java expression stack
 208     __ movl(val, Address(rsp,   wordSize)); // byte value
 209     __ movl(crc, Address(rsp, 2*wordSize)); // Initial CRC
 210 
 211     __ lea(tbl, ExternalAddress(StubRoutines::crc_table_addr()));
 212     __ notl(crc); // ~crc
 213     __ update_byte_crc32(crc, val, tbl);
 214     __ notl(crc); // ~crc
 215     // result in rax
 216 
 217     // _areturn


 223     __ bind(slow_path);
 224     __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native));
 225     return entry;
 226   }
 227   return NULL;
 228 }
 229 
 230 /**
 231  * Method entry for static native methods:
 232  *   int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int len)
 233  *   int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len)
 234  */
 235 address TemplateInterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) {
 236   if (UseCRC32Intrinsics) {
 237     address entry = __ pc();
 238 
 239     // rbx,: Method*
 240     // r13: senderSP must preserved for slow path, set SP to it on fast path
 241 
 242     Label slow_path;
 243     // If we need a safepoint check, generate full interpreter entry.
 244     ExternalAddress state(SafepointSynchronize::address_of_state());
 245     __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
 246              SafepointSynchronize::_not_synchronized);
 247     __ jcc(Assembler::notEqual, slow_path);
 248 
 249     // We don't generate local frame and don't align stack because
 250     // we call stub code and there is no safepoint on this path.
 251 
 252     // Load parameters
 253     const Register crc = c_rarg0;  // crc
 254     const Register buf = c_rarg1;  // source java byte array address
 255     const Register len = c_rarg2;  // length
 256     const Register off = len;      // offset (never overlaps with 'len')
 257 
 258     // Arguments are reversed on java expression stack
 259     // Calculate address of start element
 260     if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) {
 261       __ movptr(buf, Address(rsp, 3*wordSize)); // long buf
 262       __ movl2ptr(off, Address(rsp, 2*wordSize)); // offset
 263       __ addq(buf, off); // + offset
 264       __ movl(crc,   Address(rsp, 5*wordSize)); // Initial CRC
 265     } else {
 266       __ movptr(buf, Address(rsp, 3*wordSize)); // byte[] array
 267       __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size


   1 /*
   2  * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 173   __ ret(0);
 174 
 175   return entry;
 176 }
 177 #endif  // __WIN64
 178 
 179 /**
 180  * Method entry for static native methods:
 181  *   int java.util.zip.CRC32.update(int crc, int b)
 182  */
 183 address TemplateInterpreterGenerator::generate_CRC32_update_entry() {
 184   if (UseCRC32Intrinsics) {
 185     address entry = __ pc();
 186 
 187     // rbx,: Method*
 188     // r13: senderSP must preserved for slow path, set SP to it on fast path
 189     // c_rarg0: scratch (rdi on non-Win64, rcx on Win64)
 190     // c_rarg1: scratch (rsi on non-Win64, rdx on Win64)
 191 
 192     Label slow_path;
 193     __ safepoint_poll(slow_path, r15_thread, rscratch1);




 194 
 195     // We don't generate local frame and don't align stack because
 196     // we call stub code and there is no safepoint on this path.
 197 
 198     // Load parameters
 199     const Register crc = rax;  // crc
 200     const Register val = c_rarg0;  // source java byte value
 201     const Register tbl = c_rarg1;  // scratch
 202 
 203     // Arguments are reversed on java expression stack
 204     __ movl(val, Address(rsp,   wordSize)); // byte value
 205     __ movl(crc, Address(rsp, 2*wordSize)); // Initial CRC
 206 
 207     __ lea(tbl, ExternalAddress(StubRoutines::crc_table_addr()));
 208     __ notl(crc); // ~crc
 209     __ update_byte_crc32(crc, val, tbl);
 210     __ notl(crc); // ~crc
 211     // result in rax
 212 
 213     // _areturn


 219     __ bind(slow_path);
 220     __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native));
 221     return entry;
 222   }
 223   return NULL;
 224 }
 225 
 226 /**
 227  * Method entry for static native methods:
 228  *   int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int len)
 229  *   int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len)
 230  */
 231 address TemplateInterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) {
 232   if (UseCRC32Intrinsics) {
 233     address entry = __ pc();
 234 
 235     // rbx,: Method*
 236     // r13: senderSP must preserved for slow path, set SP to it on fast path
 237 
 238     Label slow_path;
 239     __ safepoint_poll(slow_path, r15_thread, rscratch1);




 240 
 241     // We don't generate local frame and don't align stack because
 242     // we call stub code and there is no safepoint on this path.
 243 
 244     // Load parameters
 245     const Register crc = c_rarg0;  // crc
 246     const Register buf = c_rarg1;  // source java byte array address
 247     const Register len = c_rarg2;  // length
 248     const Register off = len;      // offset (never overlaps with 'len')
 249 
 250     // Arguments are reversed on java expression stack
 251     // Calculate address of start element
 252     if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) {
 253       __ movptr(buf, Address(rsp, 3*wordSize)); // long buf
 254       __ movl2ptr(off, Address(rsp, 2*wordSize)); // offset
 255       __ addq(buf, off); // + offset
 256       __ movl(crc,   Address(rsp, 5*wordSize)); // Initial CRC
 257     } else {
 258       __ movptr(buf, Address(rsp, 3*wordSize)); // byte[] array
 259       __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size


< prev index next >