< prev index next >

src/share/vm/c1/c1_Compiler.cpp

Print this page
rev 12711 : 8181292: Backport Rename internal Unsafe.compare methods from 10 to 9
Reviewed-by: psandoz, dholmes, thartmann
Contributed-by: ron.pressler@oracle.com, claes.redestad@oracle.com
   1 /*
   2  * Copyright (c) 1999, 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  *


  91     Compilation::desired_max_constant_size();
  92 
  93   BufferBlob* buffer_blob = BufferBlob::create("C1 temporary CodeBuffer", code_buffer_size);
  94   if (buffer_blob != NULL) {
  95     CompilerThread::current()->set_buffer_blob(buffer_blob);
  96   }
  97 
  98   return buffer_blob;
  99 }
 100 
 101 bool Compiler::is_intrinsic_supported(const methodHandle& method) {
 102   vmIntrinsics::ID id = method->intrinsic_id();
 103   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 104 
 105   if (method->is_synchronized()) {
 106     // C1 does not support intrinsification of synchronized methods.
 107     return false;
 108   }
 109 
 110   switch (id) {
 111   case vmIntrinsics::_compareAndSwapLong:
 112     if (!VM_Version::supports_cx8()) return false;
 113     break;
 114   case vmIntrinsics::_getAndAddInt:
 115     if (!VM_Version::supports_atomic_getadd4()) return false;
 116     break;
 117   case vmIntrinsics::_getAndAddLong:
 118     if (!VM_Version::supports_atomic_getadd8()) return false;
 119     break;
 120   case vmIntrinsics::_getAndSetInt:
 121     if (!VM_Version::supports_atomic_getset4()) return false;
 122     break;
 123   case vmIntrinsics::_getAndSetLong:
 124     if (!VM_Version::supports_atomic_getset8()) return false;
 125     break;
 126   case vmIntrinsics::_getAndSetObject:
 127 #ifdef _LP64
 128     if (!UseCompressedOops && !VM_Version::supports_atomic_getset8()) return false;
 129     if (UseCompressedOops && !VM_Version::supports_atomic_getset4()) return false;
 130 #else
 131     if (!VM_Version::supports_atomic_getset4()) return false;


 200   case vmIntrinsics::_putLongVolatile:
 201   case vmIntrinsics::_putFloatVolatile:
 202   case vmIntrinsics::_putDoubleVolatile:
 203   case vmIntrinsics::_getShortUnaligned:
 204   case vmIntrinsics::_getCharUnaligned:
 205   case vmIntrinsics::_getIntUnaligned:
 206   case vmIntrinsics::_getLongUnaligned:
 207   case vmIntrinsics::_putShortUnaligned:
 208   case vmIntrinsics::_putCharUnaligned:
 209   case vmIntrinsics::_putIntUnaligned:
 210   case vmIntrinsics::_putLongUnaligned:
 211   case vmIntrinsics::_checkIndex:
 212   case vmIntrinsics::_updateCRC32:
 213   case vmIntrinsics::_updateBytesCRC32:
 214   case vmIntrinsics::_updateByteBufferCRC32:
 215 #ifdef SPARC
 216   case vmIntrinsics::_updateBytesCRC32C:
 217   case vmIntrinsics::_updateDirectByteBufferCRC32C:
 218 #endif
 219   case vmIntrinsics::_vectorizedMismatch:
 220   case vmIntrinsics::_compareAndSwapInt:
 221   case vmIntrinsics::_compareAndSwapObject:
 222   case vmIntrinsics::_getCharStringU:
 223   case vmIntrinsics::_putCharStringU:
 224 #ifdef TRACE_HAVE_INTRINSICS
 225   case vmIntrinsics::_counterTime:
 226   case vmIntrinsics::_getBufferWriter:
 227 #if defined(_LP64) || !defined(TRACE_ID_CLASS_SHIFT)
 228   case vmIntrinsics::_getClassId:
 229 #endif
 230 #endif
 231     break;
 232   default:
 233     return false; // Intrinsics not on the previous list are not available.
 234   }
 235 
 236   return true;
 237 }
 238 
 239 void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci, DirectiveSet* directive) {
 240   BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
 241   assert(buffer_blob != NULL, "Must exist");
   1 /*
   2  * Copyright (c) 1999, 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  *


  91     Compilation::desired_max_constant_size();
  92 
  93   BufferBlob* buffer_blob = BufferBlob::create("C1 temporary CodeBuffer", code_buffer_size);
  94   if (buffer_blob != NULL) {
  95     CompilerThread::current()->set_buffer_blob(buffer_blob);
  96   }
  97 
  98   return buffer_blob;
  99 }
 100 
 101 bool Compiler::is_intrinsic_supported(const methodHandle& method) {
 102   vmIntrinsics::ID id = method->intrinsic_id();
 103   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 104 
 105   if (method->is_synchronized()) {
 106     // C1 does not support intrinsification of synchronized methods.
 107     return false;
 108   }
 109 
 110   switch (id) {
 111   case vmIntrinsics::_compareAndSetLong:
 112     if (!VM_Version::supports_cx8()) return false;
 113     break;
 114   case vmIntrinsics::_getAndAddInt:
 115     if (!VM_Version::supports_atomic_getadd4()) return false;
 116     break;
 117   case vmIntrinsics::_getAndAddLong:
 118     if (!VM_Version::supports_atomic_getadd8()) return false;
 119     break;
 120   case vmIntrinsics::_getAndSetInt:
 121     if (!VM_Version::supports_atomic_getset4()) return false;
 122     break;
 123   case vmIntrinsics::_getAndSetLong:
 124     if (!VM_Version::supports_atomic_getset8()) return false;
 125     break;
 126   case vmIntrinsics::_getAndSetObject:
 127 #ifdef _LP64
 128     if (!UseCompressedOops && !VM_Version::supports_atomic_getset8()) return false;
 129     if (UseCompressedOops && !VM_Version::supports_atomic_getset4()) return false;
 130 #else
 131     if (!VM_Version::supports_atomic_getset4()) return false;


 200   case vmIntrinsics::_putLongVolatile:
 201   case vmIntrinsics::_putFloatVolatile:
 202   case vmIntrinsics::_putDoubleVolatile:
 203   case vmIntrinsics::_getShortUnaligned:
 204   case vmIntrinsics::_getCharUnaligned:
 205   case vmIntrinsics::_getIntUnaligned:
 206   case vmIntrinsics::_getLongUnaligned:
 207   case vmIntrinsics::_putShortUnaligned:
 208   case vmIntrinsics::_putCharUnaligned:
 209   case vmIntrinsics::_putIntUnaligned:
 210   case vmIntrinsics::_putLongUnaligned:
 211   case vmIntrinsics::_checkIndex:
 212   case vmIntrinsics::_updateCRC32:
 213   case vmIntrinsics::_updateBytesCRC32:
 214   case vmIntrinsics::_updateByteBufferCRC32:
 215 #ifdef SPARC
 216   case vmIntrinsics::_updateBytesCRC32C:
 217   case vmIntrinsics::_updateDirectByteBufferCRC32C:
 218 #endif
 219   case vmIntrinsics::_vectorizedMismatch:
 220   case vmIntrinsics::_compareAndSetInt:
 221   case vmIntrinsics::_compareAndSetObject:
 222   case vmIntrinsics::_getCharStringU:
 223   case vmIntrinsics::_putCharStringU:
 224 #ifdef TRACE_HAVE_INTRINSICS
 225   case vmIntrinsics::_counterTime:
 226   case vmIntrinsics::_getBufferWriter:
 227 #if defined(_LP64) || !defined(TRACE_ID_CLASS_SHIFT)
 228   case vmIntrinsics::_getClassId:
 229 #endif
 230 #endif
 231     break;
 232   default:
 233     return false; // Intrinsics not on the previous list are not available.
 234   }
 235 
 236   return true;
 237 }
 238 
 239 void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci, DirectiveSet* directive) {
 240   BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
 241   assert(buffer_blob != NULL, "Must exist");
< prev index next >