< prev index next >

src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp

Print this page


   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  *


 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
 260       __ movl2ptr(off, Address(rsp, 2*wordSize)); // offset
 261       __ addq(buf, off); // + offset
 262       __ movl(crc,   Address(rsp, 4*wordSize)); // Initial CRC
 263     }
 264     // Can now load 'len' since we're finished with 'off'
 265     __ movl(len, Address(rsp, wordSize)); // Length
 266 
 267     __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len);
 268     // result in rax
 269 
 270     // _areturn
 271     __ pop(rdi);                // get return address
 272     __ mov(rsp, r13);           // set sp to sender sp
 273     __ jmp(rdi);
 274 
 275     // generate a vanilla native entry as the slow path
 276     __ bind(slow_path);
 277     __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native));
 278     return entry;


 294     const Register len = c_rarg2;
 295     const Register off = c_rarg3;  // offset
 296     const Register end = len;
 297 
 298     // Arguments are reversed on java expression stack
 299     // Calculate address of start element
 300     if (kind == Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer) {
 301       __ movptr(buf, Address(rsp, 3 * wordSize)); // long address
 302       __ movl2ptr(off, Address(rsp, 2 * wordSize)); // offset
 303       __ addq(buf, off); // + offset
 304       __ movl(crc, Address(rsp, 5 * wordSize)); // Initial CRC
 305       // Note on 5 * wordSize vs. 4 * wordSize:
 306       // *   int java.util.zip.CRC32C.updateByteBuffer(int crc, long address, int off, int end)
 307       //                                                   4         2,3          1        0
 308       // end starts at SP + 8
 309       // The Java(R) Virtual Machine Specification Java SE 7 Edition
 310       // 4.10.2.3. Values of Types long and double
 311       //    "When calculating operand stack length, values of type long and double have length two."
 312     } else {
 313       __ movptr(buf, Address(rsp, 3 * wordSize)); // byte[] array

 314       __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
 315       __ movl2ptr(off, Address(rsp, 2 * wordSize)); // offset
 316       __ addq(buf, off); // + offset
 317       __ movl(crc, Address(rsp, 4 * wordSize)); // Initial CRC
 318     }
 319     __ movl(end, Address(rsp, wordSize)); // end
 320     __ subl(end, off); // end - off
 321     __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32C()), crc, buf, len);
 322     // result in rax
 323     // _areturn
 324     __ pop(rdi);                // get return address
 325     __ mov(rsp, r13);           // set sp to sender sp
 326     __ jmp(rdi);
 327 
 328     return entry;
 329   }
 330 
 331   return NULL;
 332 }
 333 


   1 /*
   2  * Copyright (c) 2003, 2018, 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  *


 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       __ resolve_for_read(IS_NOT_NULL, buf);
 260       __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
 261       __ movl2ptr(off, Address(rsp, 2*wordSize)); // offset
 262       __ addq(buf, off); // + offset
 263       __ movl(crc,   Address(rsp, 4*wordSize)); // Initial CRC
 264     }
 265     // Can now load 'len' since we're finished with 'off'
 266     __ movl(len, Address(rsp, wordSize)); // Length
 267 
 268     __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len);
 269     // result in rax
 270 
 271     // _areturn
 272     __ pop(rdi);                // get return address
 273     __ mov(rsp, r13);           // set sp to sender sp
 274     __ jmp(rdi);
 275 
 276     // generate a vanilla native entry as the slow path
 277     __ bind(slow_path);
 278     __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native));
 279     return entry;


 295     const Register len = c_rarg2;
 296     const Register off = c_rarg3;  // offset
 297     const Register end = len;
 298 
 299     // Arguments are reversed on java expression stack
 300     // Calculate address of start element
 301     if (kind == Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer) {
 302       __ movptr(buf, Address(rsp, 3 * wordSize)); // long address
 303       __ movl2ptr(off, Address(rsp, 2 * wordSize)); // offset
 304       __ addq(buf, off); // + offset
 305       __ movl(crc, Address(rsp, 5 * wordSize)); // Initial CRC
 306       // Note on 5 * wordSize vs. 4 * wordSize:
 307       // *   int java.util.zip.CRC32C.updateByteBuffer(int crc, long address, int off, int end)
 308       //                                                   4         2,3          1        0
 309       // end starts at SP + 8
 310       // The Java(R) Virtual Machine Specification Java SE 7 Edition
 311       // 4.10.2.3. Values of Types long and double
 312       //    "When calculating operand stack length, values of type long and double have length two."
 313     } else {
 314       __ movptr(buf, Address(rsp, 3 * wordSize)); // byte[] array
 315       __ resolve_for_read(IS_NOT_NULL, buf);
 316       __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
 317       __ movl2ptr(off, Address(rsp, 2 * wordSize)); // offset
 318       __ addq(buf, off); // + offset
 319       __ movl(crc, Address(rsp, 4 * wordSize)); // Initial CRC
 320     }
 321     __ movl(end, Address(rsp, wordSize)); // end
 322     __ subl(end, off); // end - off
 323     __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32C()), crc, buf, len);
 324     // result in rax
 325     // _areturn
 326     __ pop(rdi);                // get return address
 327     __ mov(rsp, r13);           // set sp to sender sp
 328     __ jmp(rdi);
 329 
 330     return entry;
 331   }
 332 
 333   return NULL;
 334 }
 335 


< prev index next >