src/share/vm/runtime/stubRoutines.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/runtime

src/share/vm/runtime/stubRoutines.cpp

Print this page
rev 12400 : 8168503: JEP 297: Unified arm32/arm64 Port
Reviewed-by: kvn, enevill, ihse, dholmes, erik, coleenp, cjplummer


   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "asm/codeBuffer.hpp"
  27 #include "code/codeCacheExtensions.hpp"
  28 #include "memory/resourceArea.hpp"
  29 #include "oops/oop.inline.hpp"
  30 #include "runtime/interfaceSupport.hpp"
  31 #include "runtime/timerTrace.hpp"
  32 #include "runtime/sharedRuntime.hpp"
  33 #include "runtime/stubRoutines.hpp"
  34 #include "utilities/copy.hpp"
  35 #ifdef COMPILER2
  36 #include "opto/runtime.hpp"
  37 #endif
  38 
  39 
  40 // Implementation of StubRoutines - for a description
  41 // of how to extend it, see the header file.
  42 
  43 // Class Variables
  44 
  45 BufferBlob* StubRoutines::_code1                                = NULL;
  46 BufferBlob* StubRoutines::_code2                                = NULL;
  47 


 187     ResourceMark rm;
 188     TraceTime timer("StubRoutines generation 1", TRACETIME_LOG(Info, startuptime));
 189     _code1 = BufferBlob::create("StubRoutines (1)", code_size1);
 190     if (_code1 == NULL) {
 191       vm_exit_out_of_memory(code_size1, OOM_MALLOC_ERROR, "CodeCache: no room for StubRoutines (1)");
 192     }
 193     CodeBuffer buffer(_code1);
 194     StubGenerator_generate(&buffer, false);
 195     // When new stubs added we need to make sure there is some space left
 196     // to catch situation when we should increase size again.
 197     assert(code_size1 == 0 || buffer.insts_remaining() > 200, "increase code_size1");
 198   }
 199 }
 200 
 201 
 202 #ifdef ASSERT
 203 typedef void (*arraycopy_fn)(address src, address dst, int count);
 204 
 205 // simple tests of generated arraycopy functions
 206 static void test_arraycopy_func(address func, int alignment) {
 207   if (CodeCacheExtensions::use_pregenerated_interpreter() || !CodeCacheExtensions::is_executable(func)) {
 208     // Exit safely if stubs were generated but cannot be used.
 209     // Also excluding pregenerated interpreter since the code may depend on
 210     // some registers being properly initialized (for instance Rthread)
 211     return;
 212   }
 213   int v = 0xcc;
 214   int v2 = 0x11;
 215   jlong lbuffer[8];
 216   jlong lbuffer2[8];
 217   address fbuffer  = (address) lbuffer;
 218   address fbuffer2 = (address) lbuffer2;
 219   unsigned int i;
 220   for (i = 0; i < sizeof(lbuffer); i++) {
 221     fbuffer[i] = v; fbuffer2[i] = v2;
 222   }
 223   // C++ does not guarantee jlong[] array alignment to 8 bytes.
 224   // Use middle of array to check that memory before it is not modified.
 225   address buffer  = (address) round_to((intptr_t)&lbuffer[4], BytesPerLong);
 226   address buffer2 = (address) round_to((intptr_t)&lbuffer2[4], BytesPerLong);
 227   // do an aligned copy
 228   ((arraycopy_fn)func)(buffer, buffer2, 0);
 229   for (i = 0; i < sizeof(lbuffer); i++) {
 230     assert(fbuffer[i] == v && fbuffer2[i] == v2, "shouldn't have copied anything");
 231   }
 232   // adjust destination alignment




   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "asm/codeBuffer.hpp"

  27 #include "memory/resourceArea.hpp"
  28 #include "oops/oop.inline.hpp"
  29 #include "runtime/interfaceSupport.hpp"
  30 #include "runtime/timerTrace.hpp"
  31 #include "runtime/sharedRuntime.hpp"
  32 #include "runtime/stubRoutines.hpp"
  33 #include "utilities/copy.hpp"
  34 #ifdef COMPILER2
  35 #include "opto/runtime.hpp"
  36 #endif
  37 
  38 
  39 // Implementation of StubRoutines - for a description
  40 // of how to extend it, see the header file.
  41 
  42 // Class Variables
  43 
  44 BufferBlob* StubRoutines::_code1                                = NULL;
  45 BufferBlob* StubRoutines::_code2                                = NULL;
  46 


 186     ResourceMark rm;
 187     TraceTime timer("StubRoutines generation 1", TRACETIME_LOG(Info, startuptime));
 188     _code1 = BufferBlob::create("StubRoutines (1)", code_size1);
 189     if (_code1 == NULL) {
 190       vm_exit_out_of_memory(code_size1, OOM_MALLOC_ERROR, "CodeCache: no room for StubRoutines (1)");
 191     }
 192     CodeBuffer buffer(_code1);
 193     StubGenerator_generate(&buffer, false);
 194     // When new stubs added we need to make sure there is some space left
 195     // to catch situation when we should increase size again.
 196     assert(code_size1 == 0 || buffer.insts_remaining() > 200, "increase code_size1");
 197   }
 198 }
 199 
 200 
 201 #ifdef ASSERT
 202 typedef void (*arraycopy_fn)(address src, address dst, int count);
 203 
 204 // simple tests of generated arraycopy functions
 205 static void test_arraycopy_func(address func, int alignment) {






 206   int v = 0xcc;
 207   int v2 = 0x11;
 208   jlong lbuffer[8];
 209   jlong lbuffer2[8];
 210   address fbuffer  = (address) lbuffer;
 211   address fbuffer2 = (address) lbuffer2;
 212   unsigned int i;
 213   for (i = 0; i < sizeof(lbuffer); i++) {
 214     fbuffer[i] = v; fbuffer2[i] = v2;
 215   }
 216   // C++ does not guarantee jlong[] array alignment to 8 bytes.
 217   // Use middle of array to check that memory before it is not modified.
 218   address buffer  = (address) round_to((intptr_t)&lbuffer[4], BytesPerLong);
 219   address buffer2 = (address) round_to((intptr_t)&lbuffer2[4], BytesPerLong);
 220   // do an aligned copy
 221   ((arraycopy_fn)func)(buffer, buffer2, 0);
 222   for (i = 0; i < sizeof(lbuffer); i++) {
 223     assert(fbuffer[i] == v && fbuffer2[i] == v2, "shouldn't have copied anything");
 224   }
 225   // adjust destination alignment


src/share/vm/runtime/stubRoutines.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File