annotate src/share/vm/c1/c1_Runtime1.cpp @ 2733:c124e2e7463e

7083786: dead various dead chunks of code Reviewed-by: iveresov, kvn
author never
date Wed, 31 Aug 2011 16:46:11 -0700
parents 2c359f27615c
children cec1757a0134
rev   line source
duke@0 1 /*
never@2027 2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
duke@0 7 * published by the Free Software Foundation.
duke@0 8 *
duke@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 * accompanied this code).
duke@0 14 *
duke@0 15 * You should have received a copy of the GNU General Public License version
duke@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 *
trims@1472 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1472 20 * or visit www.oracle.com if you need additional information or have any
trims@1472 21 * questions.
duke@0 22 *
duke@0 23 */
duke@0 24
stefank@1879 25 #include "precompiled.hpp"
stefank@1879 26 #include "asm/codeBuffer.hpp"
stefank@1879 27 #include "c1/c1_CodeStubs.hpp"
stefank@1879 28 #include "c1/c1_Defs.hpp"
stefank@1879 29 #include "c1/c1_FrameMap.hpp"
stefank@1879 30 #include "c1/c1_LIRAssembler.hpp"
stefank@1879 31 #include "c1/c1_MacroAssembler.hpp"
stefank@1879 32 #include "c1/c1_Runtime1.hpp"
stefank@1879 33 #include "classfile/systemDictionary.hpp"
stefank@1879 34 #include "classfile/vmSymbols.hpp"
stefank@1879 35 #include "code/codeBlob.hpp"
stefank@1879 36 #include "code/compiledIC.hpp"
stefank@1879 37 #include "code/pcDesc.hpp"
stefank@1879 38 #include "code/scopeDesc.hpp"
stefank@1879 39 #include "code/vtableStubs.hpp"
stefank@1879 40 #include "compiler/disassembler.hpp"
stefank@1879 41 #include "gc_interface/collectedHeap.hpp"
stefank@1879 42 #include "interpreter/bytecode.hpp"
stefank@1879 43 #include "interpreter/interpreter.hpp"
stefank@1879 44 #include "memory/allocation.inline.hpp"
stefank@1879 45 #include "memory/barrierSet.hpp"
stefank@1879 46 #include "memory/oopFactory.hpp"
stefank@1879 47 #include "memory/resourceArea.hpp"
stefank@1879 48 #include "oops/objArrayKlass.hpp"
stefank@1879 49 #include "oops/oop.inline.hpp"
stefank@1879 50 #include "runtime/biasedLocking.hpp"
stefank@1879 51 #include "runtime/compilationPolicy.hpp"
stefank@1879 52 #include "runtime/interfaceSupport.hpp"
stefank@1879 53 #include "runtime/javaCalls.hpp"
stefank@1879 54 #include "runtime/sharedRuntime.hpp"
stefank@1879 55 #include "runtime/threadCritical.hpp"
stefank@1879 56 #include "runtime/vframe.hpp"
stefank@1879 57 #include "runtime/vframeArray.hpp"
stefank@1879 58 #include "utilities/copy.hpp"
stefank@1879 59 #include "utilities/events.hpp"
duke@0 60
duke@0 61
duke@0 62 // Implementation of StubAssembler
duke@0 63
duke@0 64 StubAssembler::StubAssembler(CodeBuffer* code, const char * name, int stub_id) : C1_MacroAssembler(code) {
duke@0 65 _name = name;
duke@0 66 _must_gc_arguments = false;
duke@0 67 _frame_size = no_frame_size;
duke@0 68 _num_rt_args = 0;
duke@0 69 _stub_id = stub_id;
duke@0 70 }
duke@0 71
duke@0 72
duke@0 73 void StubAssembler::set_info(const char* name, bool must_gc_arguments) {
duke@0 74 _name = name;
duke@0 75 _must_gc_arguments = must_gc_arguments;
duke@0 76 }
duke@0 77
duke@0 78
duke@0 79 void StubAssembler::set_frame_size(int size) {
duke@0 80 if (_frame_size == no_frame_size) {
duke@0 81 _frame_size = size;
duke@0 82 }
duke@0 83 assert(_frame_size == size, "can't change the frame size");
duke@0 84 }
duke@0 85
duke@0 86
duke@0 87 void StubAssembler::set_num_rt_args(int args) {
duke@0 88 if (_num_rt_args == 0) {
duke@0 89 _num_rt_args = args;
duke@0 90 }
duke@0 91 assert(_num_rt_args == args, "can't change the number of args");
duke@0 92 }
duke@0 93
duke@0 94 // Implementation of Runtime1
duke@0 95
duke@0 96 CodeBlob* Runtime1::_blobs[Runtime1::number_of_ids];
duke@0 97 const char *Runtime1::_blob_names[] = {
duke@0 98 RUNTIME1_STUBS(STUB_NAME, LAST_STUB_NAME)
duke@0 99 };
duke@0 100
duke@0 101 #ifndef PRODUCT
duke@0 102 // statistics
duke@0 103 int Runtime1::_generic_arraycopy_cnt = 0;
duke@0 104 int Runtime1::_primitive_arraycopy_cnt = 0;
duke@0 105 int Runtime1::_oop_arraycopy_cnt = 0;
roland@2293 106 int Runtime1::_generic_arraycopystub_cnt = 0;
duke@0 107 int Runtime1::_arraycopy_slowcase_cnt = 0;
roland@2293 108 int Runtime1::_arraycopy_checkcast_cnt = 0;
roland@2293 109 int Runtime1::_arraycopy_checkcast_attempt_cnt = 0;
duke@0 110 int Runtime1::_new_type_array_slowcase_cnt = 0;
duke@0 111 int Runtime1::_new_object_array_slowcase_cnt = 0;
duke@0 112 int Runtime1::_new_instance_slowcase_cnt = 0;
duke@0 113 int Runtime1::_new_multi_array_slowcase_cnt = 0;
duke@0 114 int Runtime1::_monitorenter_slowcase_cnt = 0;
duke@0 115 int Runtime1::_monitorexit_slowcase_cnt = 0;
duke@0 116 int Runtime1::_patch_code_slowcase_cnt = 0;
duke@0 117 int Runtime1::_throw_range_check_exception_count = 0;
duke@0 118 int Runtime1::_throw_index_exception_count = 0;
duke@0 119 int Runtime1::_throw_div0_exception_count = 0;
duke@0 120 int Runtime1::_throw_null_pointer_exception_count = 0;
duke@0 121 int Runtime1::_throw_class_cast_exception_count = 0;
duke@0 122 int Runtime1::_throw_incompatible_class_change_error_count = 0;
duke@0 123 int Runtime1::_throw_array_store_exception_count = 0;
duke@0 124 int Runtime1::_throw_count = 0;
roland@2293 125
roland@2293 126 static int _byte_arraycopy_cnt = 0;
roland@2293 127 static int _short_arraycopy_cnt = 0;
roland@2293 128 static int _int_arraycopy_cnt = 0;
roland@2293 129 static int _long_arraycopy_cnt = 0;
roland@2293 130 static int _oop_arraycopy_cnt = 0;
roland@2293 131
roland@2293 132 address Runtime1::arraycopy_count_address(BasicType type) {
roland@2293 133 switch (type) {
roland@2293 134 case T_BOOLEAN:
roland@2293 135 case T_BYTE: return (address)&_byte_arraycopy_cnt;
roland@2293 136 case T_CHAR:
roland@2293 137 case T_SHORT: return (address)&_short_arraycopy_cnt;
roland@2293 138 case T_FLOAT:
roland@2293 139 case T_INT: return (address)&_int_arraycopy_cnt;
roland@2293 140 case T_DOUBLE:
roland@2293 141 case T_LONG: return (address)&_long_arraycopy_cnt;
roland@2293 142 case T_ARRAY:
roland@2293 143 case T_OBJECT: return (address)&_oop_arraycopy_cnt;
roland@2293 144 default:
roland@2293 145 ShouldNotReachHere();
roland@2293 146 return NULL;
roland@2293 147 }
roland@2293 148 }
roland@2293 149
roland@2293 150
duke@0 151 #endif
duke@0 152
duke@0 153 // Simple helper to see if the caller of a runtime stub which
duke@0 154 // entered the VM has been deoptimized
duke@0 155
duke@0 156 static bool caller_is_deopted() {
duke@0 157 JavaThread* thread = JavaThread::current();
duke@0 158 RegisterMap reg_map(thread, false);
duke@0 159 frame runtime_frame = thread->last_frame();
duke@0 160 frame caller_frame = runtime_frame.sender(&reg_map);
duke@0 161 assert(caller_frame.is_compiled_frame(), "must be compiled");
duke@0 162 return caller_frame.is_deoptimized_frame();
duke@0 163 }
duke@0 164
duke@0 165 // Stress deoptimization
duke@0 166 static void deopt_caller() {
duke@0 167 if ( !caller_is_deopted()) {
duke@0 168 JavaThread* thread = JavaThread::current();
duke@0 169 RegisterMap reg_map(thread, false);
duke@0 170 frame runtime_frame = thread->last_frame();
duke@0 171 frame caller_frame = runtime_frame.sender(&reg_map);
dcubed@1213 172 Deoptimization::deoptimize_frame(thread, caller_frame.id());
duke@0 173 assert(caller_is_deopted(), "Must be deoptimized");
duke@0 174 }
duke@0 175 }
duke@0 176
duke@0 177
iveresov@1504 178 void Runtime1::generate_blob_for(BufferBlob* buffer_blob, StubID id) {
duke@0 179 assert(0 <= id && id < number_of_ids, "illegal stub id");
duke@0 180 ResourceMark rm;
duke@0 181 // create code buffer for code storage
twisti@1668 182 CodeBuffer code(buffer_blob);
duke@0 183
iveresov@1504 184 Compilation::setup_code_buffer(&code, 0);
duke@0 185
duke@0 186 // create assembler for code generation
duke@0 187 StubAssembler* sasm = new StubAssembler(&code, name_for(id), id);
duke@0 188 // generate code for runtime stub
duke@0 189 OopMapSet* oop_maps;
duke@0 190 oop_maps = generate_code_for(id, sasm);
duke@0 191 assert(oop_maps == NULL || sasm->frame_size() != no_frame_size,
duke@0 192 "if stub has an oop map it must have a valid frame size");
duke@0 193
duke@0 194 #ifdef ASSERT
duke@0 195 // Make sure that stubs that need oopmaps have them
duke@0 196 switch (id) {
duke@0 197 // These stubs don't need to have an oopmap
duke@0 198 case dtrace_object_alloc_id:
ysr@342 199 case g1_pre_barrier_slow_id:
ysr@342 200 case g1_post_barrier_slow_id:
duke@0 201 case slow_subtype_check_id:
duke@0 202 case fpu2long_stub_id:
duke@0 203 case unwind_exception_id:
iveresov@1703 204 case counter_overflow_id:
bobv@1601 205 #if defined(SPARC) || defined(PPC)
duke@0 206 case handle_exception_nofpu_id: // Unused on sparc
duke@0 207 #endif
duke@0 208 break;
duke@0 209
duke@0 210 // All other stubs should have oopmaps
duke@0 211 default:
duke@0 212 assert(oop_maps != NULL, "must have an oopmap");
duke@0 213 }
duke@0 214 #endif
duke@0 215
duke@0 216 // align so printing shows nop's instead of random code at the end (SimpleStubs are aligned)
duke@0 217 sasm->align(BytesPerWord);
duke@0 218 // make sure all code is in code buffer
duke@0 219 sasm->flush();
duke@0 220 // create blob - distinguish a few special cases
duke@0 221 CodeBlob* blob = RuntimeStub::new_runtime_stub(name_for(id),
duke@0 222 &code,
duke@0 223 CodeOffsets::frame_never_safe,
duke@0 224 sasm->frame_size(),
duke@0 225 oop_maps,
duke@0 226 sasm->must_gc_arguments());
duke@0 227 // install blob
duke@0 228 assert(blob != NULL, "blob must exist");
duke@0 229 _blobs[id] = blob;
duke@0 230 }
duke@0 231
duke@0 232
iveresov@1504 233 void Runtime1::initialize(BufferBlob* blob) {
iveresov@1504 234 // platform-dependent initialization
iveresov@1504 235 initialize_pd();
iveresov@1504 236 // generate stubs
iveresov@1504 237 for (int id = 0; id < number_of_ids; id++) generate_blob_for(blob, (StubID)id);
iveresov@1504 238 // printing
duke@0 239 #ifndef PRODUCT
iveresov@1504 240 if (PrintSimpleStubs) {
iveresov@1504 241 ResourceMark rm;
iveresov@1504 242 for (int id = 0; id < number_of_ids; id++) {
iveresov@1504 243 _blobs[id]->print();
iveresov@1504 244 if (_blobs[id]->oop_maps() != NULL) {
iveresov@1504 245 _blobs[id]->oop_maps()->print();
duke@0 246 }
duke@0 247 }
iveresov@1504 248 }
duke@0 249 #endif
duke@0 250 }
duke@0 251
duke@0 252
duke@0 253 CodeBlob* Runtime1::blob_for(StubID id) {
duke@0 254 assert(0 <= id && id < number_of_ids, "illegal stub id");
duke@0 255 return _blobs[id];
duke@0 256 }
duke@0 257
duke@0 258
duke@0 259 const char* Runtime1::name_for(StubID id) {
duke@0 260 assert(0 <= id && id < number_of_ids, "illegal stub id");
duke@0 261 return _blob_names[id];
duke@0 262 }
duke@0 263
duke@0 264 const char* Runtime1::name_for_address(address entry) {
duke@0 265 for (int id = 0; id < number_of_ids; id++) {
duke@0 266 if (entry == entry_for((StubID)id)) return name_for((StubID)id);
duke@0 267 }
duke@0 268
duke@0 269 #define FUNCTION_CASE(a, f) \
duke@0 270 if ((intptr_t)a == CAST_FROM_FN_PTR(intptr_t, f)) return #f
duke@0 271
duke@0 272 FUNCTION_CASE(entry, os::javaTimeMillis);
duke@0 273 FUNCTION_CASE(entry, os::javaTimeNanos);
duke@0 274 FUNCTION_CASE(entry, SharedRuntime::OSR_migration_end);
duke@0 275 FUNCTION_CASE(entry, SharedRuntime::d2f);
duke@0 276 FUNCTION_CASE(entry, SharedRuntime::d2i);
duke@0 277 FUNCTION_CASE(entry, SharedRuntime::d2l);
duke@0 278 FUNCTION_CASE(entry, SharedRuntime::dcos);
duke@0 279 FUNCTION_CASE(entry, SharedRuntime::dexp);
duke@0 280 FUNCTION_CASE(entry, SharedRuntime::dlog);
duke@0 281 FUNCTION_CASE(entry, SharedRuntime::dlog10);
duke@0 282 FUNCTION_CASE(entry, SharedRuntime::dpow);
duke@0 283 FUNCTION_CASE(entry, SharedRuntime::drem);
duke@0 284 FUNCTION_CASE(entry, SharedRuntime::dsin);
duke@0 285 FUNCTION_CASE(entry, SharedRuntime::dtan);
duke@0 286 FUNCTION_CASE(entry, SharedRuntime::f2i);
duke@0 287 FUNCTION_CASE(entry, SharedRuntime::f2l);
duke@0 288 FUNCTION_CASE(entry, SharedRuntime::frem);
duke@0 289 FUNCTION_CASE(entry, SharedRuntime::l2d);
duke@0 290 FUNCTION_CASE(entry, SharedRuntime::l2f);
duke@0 291 FUNCTION_CASE(entry, SharedRuntime::ldiv);
duke@0 292 FUNCTION_CASE(entry, SharedRuntime::lmul);
duke@0 293 FUNCTION_CASE(entry, SharedRuntime::lrem);
duke@0 294 FUNCTION_CASE(entry, SharedRuntime::lrem);
duke@0 295 FUNCTION_CASE(entry, SharedRuntime::dtrace_method_entry);
duke@0 296 FUNCTION_CASE(entry, SharedRuntime::dtrace_method_exit);
duke@0 297 FUNCTION_CASE(entry, trace_block_entry);
duke@0 298
duke@0 299 #undef FUNCTION_CASE
duke@0 300
bobv@1601 301 // Soft float adds more runtime names.
bobv@1601 302 return pd_name_for_address(entry);
duke@0 303 }
duke@0 304
duke@0 305
duke@0 306 JRT_ENTRY(void, Runtime1::new_instance(JavaThread* thread, klassOopDesc* klass))
duke@0 307 NOT_PRODUCT(_new_instance_slowcase_cnt++;)
duke@0 308
duke@0 309 assert(oop(klass)->is_klass(), "not a class");
duke@0 310 instanceKlassHandle h(thread, klass);
duke@0 311 h->check_valid_for_instantiation(true, CHECK);
duke@0 312 // make sure klass is initialized
duke@0 313 h->initialize(CHECK);
duke@0 314 // allocate instance and return via TLS
duke@0 315 oop obj = h->allocate_instance(CHECK);
duke@0 316 thread->set_vm_result(obj);
duke@0 317 JRT_END
duke@0 318
duke@0 319
duke@0 320 JRT_ENTRY(void, Runtime1::new_type_array(JavaThread* thread, klassOopDesc* klass, jint length))
duke@0 321 NOT_PRODUCT(_new_type_array_slowcase_cnt++;)
duke@0 322 // Note: no handle for klass needed since they are not used
duke@0 323 // anymore after new_typeArray() and no GC can happen before.
duke@0 324 // (This may have to change if this code changes!)
duke@0 325 assert(oop(klass)->is_klass(), "not a class");
duke@0 326 BasicType elt_type = typeArrayKlass::cast(klass)->element_type();
duke@0 327 oop obj = oopFactory::new_typeArray(elt_type, length, CHECK);
duke@0 328 thread->set_vm_result(obj);
duke@0 329 // This is pretty rare but this runtime patch is stressful to deoptimization
duke@0 330 // if we deoptimize here so force a deopt to stress the path.
duke@0 331 if (DeoptimizeALot) {
duke@0 332 deopt_caller();
duke@0 333 }
duke@0 334
duke@0 335 JRT_END
duke@0 336
duke@0 337
duke@0 338 JRT_ENTRY(void, Runtime1::new_object_array(JavaThread* thread, klassOopDesc* array_klass, jint length))
duke@0 339 NOT_PRODUCT(_new_object_array_slowcase_cnt++;)
duke@0 340
duke@0 341 // Note: no handle for klass needed since they are not used
duke@0 342 // anymore after new_objArray() and no GC can happen before.
duke@0 343 // (This may have to change if this code changes!)
duke@0 344 assert(oop(array_klass)->is_klass(), "not a class");
duke@0 345 klassOop elem_klass = objArrayKlass::cast(array_klass)->element_klass();
duke@0 346 objArrayOop obj = oopFactory::new_objArray(elem_klass, length, CHECK);
duke@0 347 thread->set_vm_result(obj);
duke@0 348 // This is pretty rare but this runtime patch is stressful to deoptimization
duke@0 349 // if we deoptimize here so force a deopt to stress the path.
duke@0 350 if (DeoptimizeALot) {
duke@0 351 deopt_caller();
duke@0 352 }
duke@0 353 JRT_END
duke@0 354
duke@0 355
duke@0 356 JRT_ENTRY(void, Runtime1::new_multi_array(JavaThread* thread, klassOopDesc* klass, int rank, jint* dims))
duke@0 357 NOT_PRODUCT(_new_multi_array_slowcase_cnt++;)
duke@0 358
duke@0 359 assert(oop(klass)->is_klass(), "not a class");
duke@0 360 assert(rank >= 1, "rank must be nonzero");
duke@0 361 oop obj = arrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
duke@0 362 thread->set_vm_result(obj);
duke@0 363 JRT_END
duke@0 364
duke@0 365
duke@0 366 JRT_ENTRY(void, Runtime1::unimplemented_entry(JavaThread* thread, StubID id))
duke@0 367 tty->print_cr("Runtime1::entry_for(%d) returned unimplemented entry point", id);
duke@0 368 JRT_END
duke@0 369
duke@0 370
never@2053 371 JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread, oopDesc* obj))
never@2053 372 ResourceMark rm(thread);
never@2053 373 const char* klass_name = Klass::cast(obj->klass())->external_name();
never@2053 374 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayStoreException(), klass_name);
duke@0 375 JRT_END
duke@0 376
duke@0 377
iveresov@2616 378 // counter_overflow() is called from within C1-compiled methods. The enclosing method is the method
iveresov@2616 379 // associated with the top activation record. The inlinee (that is possibly included in the enclosing
iveresov@2616 380 // method) method oop is passed as an argument. In order to do that it is embedded in the code as
iveresov@2616 381 // a constant.
iveresov@1703 382 static nmethod* counter_overflow_helper(JavaThread* THREAD, int branch_bci, methodOopDesc* m) {
iveresov@1703 383 nmethod* osr_nm = NULL;
iveresov@1703 384 methodHandle method(THREAD, m);
iveresov@1703 385
iveresov@1703 386 RegisterMap map(THREAD, false);
iveresov@1703 387 frame fr = THREAD->last_frame().sender(&map);
duke@0 388 nmethod* nm = (nmethod*) fr.cb();
iveresov@1703 389 assert(nm!= NULL && nm->is_nmethod(), "Sanity check");
iveresov@1703 390 methodHandle enclosing_method(THREAD, nm->method());
iveresov@1703 391
iveresov@1703 392 CompLevel level = (CompLevel)nm->comp_level();
iveresov@1703 393 int bci = InvocationEntryBci;
iveresov@1703 394 if (branch_bci != InvocationEntryBci) {
iveresov@1703 395 // Compute desination bci
iveresov@1703 396 address pc = method()->code_base() + branch_bci;
never@2027 397 Bytecodes::Code branch = Bytecodes::code_at(method(), pc);
iveresov@1703 398 int offset = 0;
iveresov@1703 399 switch (branch) {
iveresov@1703 400 case Bytecodes::_if_icmplt: case Bytecodes::_iflt:
iveresov@1703 401 case Bytecodes::_if_icmpgt: case Bytecodes::_ifgt:
iveresov@1703 402 case Bytecodes::_if_icmple: case Bytecodes::_ifle:
iveresov@1703 403 case Bytecodes::_if_icmpge: case Bytecodes::_ifge:
iveresov@1703 404 case Bytecodes::_if_icmpeq: case Bytecodes::_if_acmpeq: case Bytecodes::_ifeq:
iveresov@1703 405 case Bytecodes::_if_icmpne: case Bytecodes::_if_acmpne: case Bytecodes::_ifne:
iveresov@1703 406 case Bytecodes::_ifnull: case Bytecodes::_ifnonnull: case Bytecodes::_goto:
iveresov@1703 407 offset = (int16_t)Bytes::get_Java_u2(pc + 1);
iveresov@1703 408 break;
iveresov@1703 409 case Bytecodes::_goto_w:
iveresov@1703 410 offset = Bytes::get_Java_u4(pc + 1);
iveresov@1703 411 break;
iveresov@1703 412 default: ;
duke@0 413 }
iveresov@1703 414 bci = branch_bci + offset;
iveresov@1703 415 }
iveresov@1703 416
iveresov@2616 417 osr_nm = CompilationPolicy::policy()->event(enclosing_method, method, branch_bci, bci, level, nm, THREAD);
iveresov@1703 418 return osr_nm;
iveresov@1703 419 }
iveresov@1703 420
iveresov@1703 421 JRT_BLOCK_ENTRY(address, Runtime1::counter_overflow(JavaThread* thread, int bci, methodOopDesc* method))
iveresov@1703 422 nmethod* osr_nm;
iveresov@1703 423 JRT_BLOCK
iveresov@1703 424 osr_nm = counter_overflow_helper(thread, bci, method);
iveresov@1703 425 if (osr_nm != NULL) {
iveresov@1703 426 RegisterMap map(thread, false);
iveresov@1703 427 frame fr = thread->last_frame().sender(&map);
never@1825 428 Deoptimization::deoptimize_frame(thread, fr.id());
duke@0 429 }
iveresov@1703 430 JRT_BLOCK_END
iveresov@1703 431 return NULL;
duke@0 432 JRT_END
duke@0 433
duke@0 434 extern void vm_exit(int code);
duke@0 435
duke@0 436 // Enter this method from compiled code handler below. This is where we transition
duke@0 437 // to VM mode. This is done as a helper routine so that the method called directly
duke@0 438 // from compiled code does not have to transition to VM. This allows the entry
duke@0 439 // method to see if the nmethod that we have just looked up a handler for has
duke@0 440 // been deoptimized while we were in the vm. This simplifies the assembly code
duke@0 441 // cpu directories.
duke@0 442 //
duke@0 443 // We are entering here from exception stub (via the entry method below)
duke@0 444 // If there is a compiled exception handler in this method, we will continue there;
duke@0 445 // otherwise we will unwind the stack and continue at the caller of top frame method
duke@0 446 // Note: we enter in Java using a special JRT wrapper. This wrapper allows us to
duke@0 447 // control the area where we can allow a safepoint. After we exit the safepoint area we can
duke@0 448 // check to see if the handler we are going to return is now in a nmethod that has
duke@0 449 // been deoptimized. If that is the case we return the deopt blob
duke@0 450 // unpack_with_exception entry instead. This makes life for the exception blob easier
duke@0 451 // because making that same check and diverting is painful from assembly language.
duke@0 452 JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* thread, oopDesc* ex, address pc, nmethod*& nm))
twisti@2168 453 // Reset method handle flag.
twisti@2168 454 thread->set_is_method_handle_return(false);
duke@0 455
duke@0 456 Handle exception(thread, ex);
duke@0 457 nm = CodeCache::find_nmethod(pc);
duke@0 458 assert(nm != NULL, "this is not an nmethod");
duke@0 459 // Adjust the pc as needed/
duke@0 460 if (nm->is_deopt_pc(pc)) {
duke@0 461 RegisterMap map(thread, false);
duke@0 462 frame exception_frame = thread->last_frame().sender(&map);
duke@0 463 // if the frame isn't deopted then pc must not correspond to the caller of last_frame
duke@0 464 assert(exception_frame.is_deoptimized_frame(), "must be deopted");
duke@0 465 pc = exception_frame.pc();
duke@0 466 }
duke@0 467 #ifdef ASSERT
duke@0 468 assert(exception.not_null(), "NULL exceptions should be handled by throw_exception");
duke@0 469 assert(exception->is_oop(), "just checking");
duke@0 470 // Check that exception is a subclass of Throwable, otherwise we have a VerifyError
never@1142 471 if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
duke@0 472 if (ExitVMOnVerifyError) vm_exit(-1);
duke@0 473 ShouldNotReachHere();
duke@0 474 }
duke@0 475 #endif
duke@0 476
duke@0 477 // Check the stack guard pages and reenable them if necessary and there is
duke@0 478 // enough space on the stack to do so. Use fast exceptions only if the guard
duke@0 479 // pages are enabled.
duke@0 480 bool guard_pages_enabled = thread->stack_yellow_zone_enabled();
duke@0 481 if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack();
duke@0 482
dcubed@1213 483 if (JvmtiExport::can_post_on_exceptions()) {
duke@0 484 // To ensure correct notification of exception catches and throws
duke@0 485 // we have to deoptimize here. If we attempted to notify the
duke@0 486 // catches and throws during this exception lookup it's possible
duke@0 487 // we could deoptimize on the way out of the VM and end back in
duke@0 488 // the interpreter at the throw site. This would result in double
duke@0 489 // notifications since the interpreter would also notify about
duke@0 490 // these same catches and throws as it unwound the frame.
duke@0 491
duke@0 492 RegisterMap reg_map(thread);
duke@0 493 frame stub_frame = thread->last_frame();
duke@0 494 frame caller_frame = stub_frame.sender(&reg_map);
duke@0 495
duke@0 496 // We don't really want to deoptimize the nmethod itself since we
duke@0 497 // can actually continue in the exception handler ourselves but I
duke@0 498 // don't see an easy way to have the desired effect.
never@1825 499 Deoptimization::deoptimize_frame(thread, caller_frame.id());
never@1825 500 assert(caller_is_deopted(), "Must be deoptimized");
duke@0 501
duke@0 502 return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
duke@0 503 }
duke@0 504
twisti@2168 505 // ExceptionCache is used only for exceptions at call sites and not for implicit exceptions
duke@0 506 if (guard_pages_enabled) {
duke@0 507 address fast_continuation = nm->handler_for_exception_and_pc(exception, pc);
duke@0 508 if (fast_continuation != NULL) {
twisti@2168 509 // Set flag if return address is a method handle call site.
twisti@2168 510 thread->set_is_method_handle_return(nm->is_method_handle_return(pc));
duke@0 511 return fast_continuation;
duke@0 512 }
duke@0 513 }
duke@0 514
duke@0 515 // If the stack guard pages are enabled, check whether there is a handler in
duke@0 516 // the current method. Otherwise (guard pages disabled), force an unwind and
duke@0 517 // skip the exception cache update (i.e., just leave continuation==NULL).
duke@0 518 address continuation = NULL;
duke@0 519 if (guard_pages_enabled) {
duke@0 520
duke@0 521 // New exception handling mechanism can support inlined methods
duke@0 522 // with exception handlers since the mappings are from PC to PC
duke@0 523
duke@0 524 // debugging support
duke@0 525 // tracing
duke@0 526 if (TraceExceptions) {
duke@0 527 ttyLocker ttyl;
duke@0 528 ResourceMark rm;
duke@0 529 tty->print_cr("Exception <%s> (0x%x) thrown in compiled method <%s> at PC " PTR_FORMAT " for thread 0x%x",
duke@0 530 exception->print_value_string(), (address)exception(), nm->method()->print_value_string(), pc, thread);
duke@0 531 }
duke@0 532 // for AbortVMOnException flag
duke@0 533 NOT_PRODUCT(Exceptions::debug_check_abort(exception));
duke@0 534
duke@0 535 // Clear out the exception oop and pc since looking up an
duke@0 536 // exception handler can cause class loading, which might throw an
duke@0 537 // exception and those fields are expected to be clear during
duke@0 538 // normal bytecode execution.
duke@0 539 thread->set_exception_oop(NULL);
duke@0 540 thread->set_exception_pc(NULL);
duke@0 541
duke@0 542 continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false);
duke@0 543 // If an exception was thrown during exception dispatch, the exception oop may have changed
duke@0 544 thread->set_exception_oop(exception());
duke@0 545 thread->set_exception_pc(pc);
duke@0 546
duke@0 547 // the exception cache is used only by non-implicit exceptions
twisti@2168 548 if (continuation != NULL) {
duke@0 549 nm->add_handler_for_exception_and_pc(exception, pc, continuation);
duke@0 550 }
duke@0 551 }
duke@0 552
duke@0 553 thread->set_vm_result(exception());
twisti@2168 554 // Set flag if return address is a method handle call site.
twisti@2168 555 thread->set_is_method_handle_return(nm->is_method_handle_return(pc));
duke@0 556
duke@0 557 if (TraceExceptions) {
duke@0 558 ttyLocker ttyl;
duke@0 559 ResourceMark rm;
duke@0 560 tty->print_cr("Thread " PTR_FORMAT " continuing at PC " PTR_FORMAT " for exception thrown at PC " PTR_FORMAT,
duke@0 561 thread, continuation, pc);
duke@0 562 }
duke@0 563
duke@0 564 return continuation;
duke@0 565 JRT_END
duke@0 566
duke@0 567 // Enter this method from compiled code only if there is a Java exception handler
twisti@2168 568 // in the method handling the exception.
duke@0 569 // We are entering here from exception stub. We don't do a normal VM transition here.
duke@0 570 // We do it in a helper. This is so we can check to see if the nmethod we have just
duke@0 571 // searched for an exception handler has been deoptimized in the meantime.
twisti@2168 572 address Runtime1::exception_handler_for_pc(JavaThread* thread) {
duke@0 573 oop exception = thread->exception_oop();
duke@0 574 address pc = thread->exception_pc();
duke@0 575 // Still in Java mode
twisti@2168 576 DEBUG_ONLY(ResetNoHandleMark rnhm);
duke@0 577 nmethod* nm = NULL;
duke@0 578 address continuation = NULL;
duke@0 579 {
duke@0 580 // Enter VM mode by calling the helper
duke@0 581 ResetNoHandleMark rnhm;
duke@0 582 continuation = exception_handler_for_pc_helper(thread, exception, pc, nm);
duke@0 583 }
duke@0 584 // Back in JAVA, use no oops DON'T safepoint
duke@0 585
duke@0 586 // Now check to see if the nmethod we were called from is now deoptimized.
duke@0 587 // If so we must return to the deopt blob and deoptimize the nmethod
duke@0 588 if (nm != NULL && caller_is_deopted()) {
duke@0 589 continuation = SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
duke@0 590 }
duke@0 591
twisti@2168 592 assert(continuation != NULL, "no handler found");
duke@0 593 return continuation;
duke@0 594 }
duke@0 595
duke@0 596
duke@0 597 JRT_ENTRY(void, Runtime1::throw_range_check_exception(JavaThread* thread, int index))
duke@0 598 NOT_PRODUCT(_throw_range_check_exception_count++;)
duke@0 599 Events::log("throw_range_check");
duke@0 600 char message[jintAsStringSize];
duke@0 601 sprintf(message, "%d", index);
duke@0 602 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message);
duke@0 603 JRT_END
duke@0 604
duke@0 605
duke@0 606 JRT_ENTRY(void, Runtime1::throw_index_exception(JavaThread* thread, int index))
duke@0 607 NOT_PRODUCT(_throw_index_exception_count++;)
duke@0 608 Events::log("throw_index");
duke@0 609 char message[16];
duke@0 610 sprintf(message, "%d", index);
duke@0 611 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_IndexOutOfBoundsException(), message);
duke@0 612 JRT_END
duke@0 613
duke@0 614
duke@0 615 JRT_ENTRY(void, Runtime1::throw_div0_exception(JavaThread* thread))
duke@0 616 NOT_PRODUCT(_throw_div0_exception_count++;)
duke@0 617 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArithmeticException(), "/ by zero");
duke@0 618 JRT_END
duke@0 619
duke@0 620
duke@0 621 JRT_ENTRY(void, Runtime1::throw_null_pointer_exception(JavaThread* thread))
duke@0 622 NOT_PRODUCT(_throw_null_pointer_exception_count++;)
duke@0 623 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_NullPointerException());
duke@0 624 JRT_END
duke@0 625
duke@0 626
duke@0 627 JRT_ENTRY(void, Runtime1::throw_class_cast_exception(JavaThread* thread, oopDesc* object))
duke@0 628 NOT_PRODUCT(_throw_class_cast_exception_count++;)
duke@0 629 ResourceMark rm(thread);
duke@0 630 char* message = SharedRuntime::generate_class_cast_message(
duke@0 631 thread, Klass::cast(object->klass())->external_name());
duke@0 632 SharedRuntime::throw_and_post_jvmti_exception(
duke@0 633 thread, vmSymbols::java_lang_ClassCastException(), message);
duke@0 634 JRT_END
duke@0 635
duke@0 636
duke@0 637 JRT_ENTRY(void, Runtime1::throw_incompatible_class_change_error(JavaThread* thread))
duke@0 638 NOT_PRODUCT(_throw_incompatible_class_change_error_count++;)
duke@0 639 ResourceMark rm(thread);
duke@0 640 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_IncompatibleClassChangeError());
duke@0 641 JRT_END
duke@0 642
duke@0 643
duke@0 644 JRT_ENTRY_NO_ASYNC(void, Runtime1::monitorenter(JavaThread* thread, oopDesc* obj, BasicObjectLock* lock))
duke@0 645 NOT_PRODUCT(_monitorenter_slowcase_cnt++;)
duke@0 646 if (PrintBiasedLockingStatistics) {
duke@0 647 Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
duke@0 648 }
duke@0 649 Handle h_obj(thread, obj);
duke@0 650 assert(h_obj()->is_oop(), "must be NULL or an object");
duke@0 651 if (UseBiasedLocking) {
duke@0 652 // Retry fast entry if bias is revoked to avoid unnecessary inflation
duke@0 653 ObjectSynchronizer::fast_enter(h_obj, lock->lock(), true, CHECK);
duke@0 654 } else {
duke@0 655 if (UseFastLocking) {
duke@0 656 // When using fast locking, the compiled code has already tried the fast case
duke@0 657 assert(obj == lock->obj(), "must match");
duke@0 658 ObjectSynchronizer::slow_enter(h_obj, lock->lock(), THREAD);
duke@0 659 } else {
duke@0 660 lock->set_obj(obj);
duke@0 661 ObjectSynchronizer::fast_enter(h_obj, lock->lock(), false, THREAD);
duke@0 662 }
duke@0 663 }
duke@0 664 JRT_END
duke@0 665
duke@0 666
duke@0 667 JRT_LEAF(void, Runtime1::monitorexit(JavaThread* thread, BasicObjectLock* lock))
duke@0 668 NOT_PRODUCT(_monitorexit_slowcase_cnt++;)
duke@0 669 assert(thread == JavaThread::current(), "threads must correspond");
duke@0 670 assert(thread->last_Java_sp(), "last_Java_sp must be set");
duke@0 671 // monitorexit is non-blocking (leaf routine) => no exceptions can be thrown
duke@0 672 EXCEPTION_MARK;
duke@0 673
duke@0 674 oop obj = lock->obj();
duke@0 675 assert(obj->is_oop(), "must be NULL or an object");
duke@0 676 if (UseFastLocking) {
duke@0 677 // When using fast locking, the compiled code has already tried the fast case
duke@0 678 ObjectSynchronizer::slow_exit(obj, lock->lock(), THREAD);
duke@0 679 } else {
duke@0 680 ObjectSynchronizer::fast_exit(obj, lock->lock(), THREAD);
duke@0 681 }
duke@0 682 JRT_END
duke@0 683
duke@0 684
duke@0 685 static klassOop resolve_field_return_klass(methodHandle caller, int bci, TRAPS) {
never@2027 686 Bytecode_field field_access(caller, bci);
duke@0 687 // This can be static or non-static field access
never@2027 688 Bytecodes::Code code = field_access.code();
duke@0 689
duke@0 690 // We must load class, initialize class and resolvethe field
duke@0 691 FieldAccessInfo result; // initialize class if needed
duke@0 692 constantPoolHandle constants(THREAD, caller->constants());
never@2027 693 LinkResolver::resolve_field(result, constants, field_access.index(), Bytecodes::java_code(code), false, CHECK_NULL);
duke@0 694 return result.klass()();
duke@0 695 }
duke@0 696
duke@0 697
duke@0 698 //
duke@0 699 // This routine patches sites where a class wasn't loaded or
duke@0 700 // initialized at the time the code was generated. It handles
duke@0 701 // references to classes, fields and forcing of initialization. Most
duke@0 702 // of the cases are straightforward and involving simply forcing
duke@0 703 // resolution of a class, rewriting the instruction stream with the
duke@0 704 // needed constant and replacing the call in this function with the
duke@0 705 // patched code. The case for static field is more complicated since
duke@0 706 // the thread which is in the process of initializing a class can
duke@0 707 // access it's static fields but other threads can't so the code
duke@0 708 // either has to deoptimize when this case is detected or execute a
duke@0 709 // check that the current thread is the initializing thread. The
duke@0 710 // current
duke@0 711 //
duke@0 712 // Patches basically look like this:
duke@0 713 //
duke@0 714 //
duke@0 715 // patch_site: jmp patch stub ;; will be patched
duke@0 716 // continue: ...
duke@0 717 // ...
duke@0 718 // ...
duke@0 719 // ...
duke@0 720 //
duke@0 721 // They have a stub which looks like this:
duke@0 722 //
duke@0 723 // ;; patch body
duke@0 724 // movl <const>, reg (for class constants)
duke@0 725 // <or> movl [reg1 + <const>], reg (for field offsets)
duke@0 726 // <or> movl reg, [reg1 + <const>] (for field offsets)
duke@0 727 // <being_init offset> <bytes to copy> <bytes to skip>
duke@0 728 // patch_stub: call Runtime1::patch_code (through a runtime stub)
duke@0 729 // jmp patch_site
duke@0 730 //
duke@0 731 //
duke@0 732 // A normal patch is done by rewriting the patch body, usually a move,
duke@0 733 // and then copying it into place over top of the jmp instruction
duke@0 734 // being careful to flush caches and doing it in an MP-safe way. The
duke@0 735 // constants following the patch body are used to find various pieces
duke@0 736 // of the patch relative to the call site for Runtime1::patch_code.
duke@0 737 // The case for getstatic and putstatic is more complicated because
duke@0 738 // getstatic and putstatic have special semantics when executing while
duke@0 739 // the class is being initialized. getstatic/putstatic on a class
duke@0 740 // which is being_initialized may be executed by the initializing
duke@0 741 // thread but other threads have to block when they execute it. This
duke@0 742 // is accomplished in compiled code by executing a test of the current
duke@0 743 // thread against the initializing thread of the class. It's emitted
duke@0 744 // as boilerplate in their stub which allows the patched code to be
duke@0 745 // executed before it's copied back into the main body of the nmethod.
duke@0 746 //
duke@0 747 // being_init: get_thread(<tmp reg>
duke@0 748 // cmpl [reg1 + <init_thread_offset>], <tmp reg>
duke@0 749 // jne patch_stub
duke@0 750 // movl [reg1 + <const>], reg (for field offsets) <or>
duke@0 751 // movl reg, [reg1 + <const>] (for field offsets)
duke@0 752 // jmp continue
duke@0 753 // <being_init offset> <bytes to copy> <bytes to skip>
duke@0 754 // patch_stub: jmp Runtim1::patch_code (through a runtime stub)
duke@0 755 // jmp patch_site
duke@0 756 //
duke@0 757 // If the class is being initialized the patch body is rewritten and
duke@0 758 // the patch site is rewritten to jump to being_init, instead of
duke@0 759 // patch_stub. Whenever this code is executed it checks the current
duke@0 760 // thread against the intializing thread so other threads will enter
duke@0 761 // the runtime and end up blocked waiting the class to finish
duke@0 762 // initializing inside the calls to resolve_field below. The
duke@0 763 // initializing class will continue on it's way. Once the class is
duke@0 764 // fully_initialized, the intializing_thread of the class becomes
duke@0 765 // NULL, so the next thread to execute this code will fail the test,
duke@0 766 // call into patch_code and complete the patching process by copying
duke@0 767 // the patch body back into the main part of the nmethod and resume
duke@0 768 // executing.
duke@0 769 //
duke@0 770 //
duke@0 771
duke@0 772 JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_id ))
duke@0 773 NOT_PRODUCT(_patch_code_slowcase_cnt++;)
duke@0 774
duke@0 775 ResourceMark rm(thread);
duke@0 776 RegisterMap reg_map(thread, false);
duke@0 777 frame runtime_frame = thread->last_frame();
duke@0 778 frame caller_frame = runtime_frame.sender(&reg_map);
duke@0 779
duke@0 780 // last java frame on stack
duke@0 781 vframeStream vfst(thread, true);
duke@0 782 assert(!vfst.at_end(), "Java frame must exist");
duke@0 783
duke@0 784 methodHandle caller_method(THREAD, vfst.method());
duke@0 785 // Note that caller_method->code() may not be same as caller_code because of OSR's
duke@0 786 // Note also that in the presence of inlining it is not guaranteed
duke@0 787 // that caller_method() == caller_code->method()
duke@0 788
duke@0 789
duke@0 790 int bci = vfst.bci();
duke@0 791
duke@0 792 Events::log("patch_code @ " INTPTR_FORMAT , caller_frame.pc());
duke@0 793
never@2027 794 Bytecodes::Code code = caller_method()->java_code_at(bci);
duke@0 795
duke@0 796 #ifndef PRODUCT
duke@0 797 // this is used by assertions in the access_field_patching_id
duke@0 798 BasicType patch_field_type = T_ILLEGAL;
duke@0 799 #endif // PRODUCT
duke@0 800 bool deoptimize_for_volatile = false;
duke@0 801 int patch_field_offset = -1;
duke@0 802 KlassHandle init_klass(THREAD, klassOop(NULL)); // klass needed by access_field_patching code
duke@0 803 Handle load_klass(THREAD, NULL); // oop needed by load_klass_patching code
duke@0 804 if (stub_id == Runtime1::access_field_patching_id) {
duke@0 805
never@2027 806 Bytecode_field field_access(caller_method, bci);
duke@0 807 FieldAccessInfo result; // initialize class if needed
never@2027 808 Bytecodes::Code code = field_access.code();
duke@0 809 constantPoolHandle constants(THREAD, caller_method->constants());
never@2027 810 LinkResolver::resolve_field(result, constants, field_access.index(), Bytecodes::java_code(code), false, CHECK);
duke@0 811 patch_field_offset = result.field_offset();
duke@0 812
duke@0 813 // If we're patching a field which is volatile then at compile it
duke@0 814 // must not have been know to be volatile, so the generated code
duke@0 815 // isn't correct for a volatile reference. The nmethod has to be
duke@0 816 // deoptimized so that the code can be regenerated correctly.
duke@0 817 // This check is only needed for access_field_patching since this
duke@0 818 // is the path for patching field offsets. load_klass is only
duke@0 819 // used for patching references to oops which don't need special
duke@0 820 // handling in the volatile case.
duke@0 821 deoptimize_for_volatile = result.access_flags().is_volatile();
duke@0 822
duke@0 823 #ifndef PRODUCT
duke@0 824 patch_field_type = result.field_type();
duke@0 825 #endif
duke@0 826 } else if (stub_id == Runtime1::load_klass_patching_id) {
duke@0 827 oop k;
duke@0 828 switch (code) {
duke@0 829 case Bytecodes::_putstatic:
duke@0 830 case Bytecodes::_getstatic:
duke@0 831 { klassOop klass = resolve_field_return_klass(caller_method, bci, CHECK);
duke@0 832 // Save a reference to the class that has to be checked for initialization
duke@0 833 init_klass = KlassHandle(THREAD, klass);
never@2223 834 k = klass->java_mirror();
duke@0 835 }
duke@0 836 break;
duke@0 837 case Bytecodes::_new:
never@2027 838 { Bytecode_new bnew(caller_method(), caller_method->bcp_from(bci));
never@2027 839 k = caller_method->constants()->klass_at(bnew.index(), CHECK);
duke@0 840 }
duke@0 841 break;
duke@0 842 case Bytecodes::_multianewarray:
never@2027 843 { Bytecode_multianewarray mna(caller_method(), caller_method->bcp_from(bci));
never@2027 844 k = caller_method->constants()->klass_at(mna.index(), CHECK);
duke@0 845 }
duke@0 846 break;
duke@0 847 case Bytecodes::_instanceof:
never@2027 848 { Bytecode_instanceof io(caller_method(), caller_method->bcp_from(bci));
never@2027 849 k = caller_method->constants()->klass_at(io.index(), CHECK);
duke@0 850 }
duke@0 851 break;
duke@0 852 case Bytecodes::_checkcast:
never@2027 853 { Bytecode_checkcast cc(caller_method(), caller_method->bcp_from(bci));
never@2027 854 k = caller_method->constants()->klass_at(cc.index(), CHECK);
duke@0 855 }
duke@0 856 break;
duke@0 857 case Bytecodes::_anewarray:
never@2027 858 { Bytecode_anewarray anew(caller_method(), caller_method->bcp_from(bci));
never@2027 859 klassOop ek = caller_method->constants()->klass_at(anew.index(), CHECK);
duke@0 860 k = Klass::cast(ek)->array_klass(CHECK);
duke@0 861 }
duke@0 862 break;
duke@0 863 case Bytecodes::_ldc:
duke@0 864 case Bytecodes::_ldc_w:
duke@0 865 {
never@2027 866 Bytecode_loadconstant cc(caller_method, bci);
never@2027 867 k = cc.resolve_constant(CHECK);
jrose@1522 868 assert(k != NULL && !k->is_klass(), "must be class mirror or other Java constant");
duke@0 869 }
duke@0 870 break;
duke@0 871 default: Unimplemented();
duke@0 872 }
duke@0 873 // convert to handle
duke@0 874 load_klass = Handle(THREAD, k);
duke@0 875 } else {
duke@0 876 ShouldNotReachHere();
duke@0 877 }
duke@0 878
duke@0 879 if (deoptimize_for_volatile) {
duke@0 880 // At compile time we assumed the field wasn't volatile but after
duke@0 881 // loading it turns out it was volatile so we have to throw the
duke@0 882 // compiled code out and let it be regenerated.
duke@0 883 if (TracePatching) {
duke@0 884 tty->print_cr("Deoptimizing for patching volatile field reference");
duke@0 885 }
never@485 886 // It's possible the nmethod was invalidated in the last
never@485 887 // safepoint, but if it's still alive then make it not_entrant.
never@485 888 nmethod* nm = CodeCache::find_nmethod(caller_frame.pc());
never@485 889 if (nm != NULL) {
never@485 890 nm->make_not_entrant();
never@485 891 }
never@485 892
never@1825 893 Deoptimization::deoptimize_frame(thread, caller_frame.id());
duke@0 894
duke@0 895 // Return to the now deoptimized frame.
duke@0 896 }
duke@0 897
jrose@1522 898 // If we are patching in a non-perm oop, make sure the nmethod
jrose@1522 899 // is on the right list.
jrose@1522 900 if (ScavengeRootsInCode && load_klass.not_null() && load_klass->is_scavengable()) {
jrose@1522 901 MutexLockerEx ml_code (CodeCache_lock, Mutex::_no_safepoint_check_flag);
jrose@1522 902 nmethod* nm = CodeCache::find_nmethod(caller_frame.pc());
jrose@1522 903 guarantee(nm != NULL, "only nmethods can contain non-perm oops");
jrose@1522 904 if (!nm->on_scavenge_root_list())
jrose@1522 905 CodeCache::add_scavenge_root_nmethod(nm);
jrose@1522 906 }
duke@0 907
duke@0 908 // Now copy code back
duke@0 909
duke@0 910 {
duke@0 911 MutexLockerEx ml_patch (Patching_lock, Mutex::_no_safepoint_check_flag);
duke@0 912 //
duke@0 913 // Deoptimization may have happened while we waited for the lock.
duke@0 914 // In that case we don't bother to do any patching we just return
duke@0 915 // and let the deopt happen
duke@0 916 if (!caller_is_deopted()) {
duke@0 917 NativeGeneralJump* jump = nativeGeneralJump_at(caller_frame.pc());
duke@0 918 address instr_pc = jump->jump_destination();
duke@0 919 NativeInstruction* ni = nativeInstruction_at(instr_pc);
duke@0 920 if (ni->is_jump() ) {
duke@0 921 // the jump has not been patched yet
duke@0 922 // The jump destination is slow case and therefore not part of the stubs
duke@0 923 // (stubs are only for StaticCalls)
duke@0 924
duke@0 925 // format of buffer
duke@0 926 // ....
duke@0 927 // instr byte 0 <-- copy_buff
duke@0 928 // instr byte 1
duke@0 929 // ..
duke@0 930 // instr byte n-1
duke@0 931 // n
duke@0 932 // .... <-- call destination
duke@0 933
duke@0 934 address stub_location = caller_frame.pc() + PatchingStub::patch_info_offset();
duke@0 935 unsigned char* byte_count = (unsigned char*) (stub_location - 1);
duke@0 936 unsigned char* byte_skip = (unsigned char*) (stub_location - 2);
duke@0 937 unsigned char* being_initialized_entry_offset = (unsigned char*) (stub_location - 3);
duke@0 938 address copy_buff = stub_location - *byte_skip - *byte_count;
duke@0 939 address being_initialized_entry = stub_location - *being_initialized_entry_offset;
duke@0 940 if (TracePatching) {
duke@0 941 tty->print_cr(" Patching %s at bci %d at address 0x%x (%s)", Bytecodes::name(code), bci,
duke@0 942 instr_pc, (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass");
duke@0 943 nmethod* caller_code = CodeCache::find_nmethod(caller_frame.pc());
duke@0 944 assert(caller_code != NULL, "nmethod not found");
duke@0 945
duke@0 946 // NOTE we use pc() not original_pc() because we already know they are
duke@0 947 // identical otherwise we'd have never entered this block of code
duke@0 948
duke@0 949 OopMap* map = caller_code->oop_map_for_return_address(caller_frame.pc());
duke@0 950 assert(map != NULL, "null check");
duke@0 951 map->print();
duke@0 952 tty->cr();
duke@0 953
duke@0 954 Disassembler::decode(copy_buff, copy_buff + *byte_count, tty);
duke@0 955 }
duke@0 956 // depending on the code below, do_patch says whether to copy the patch body back into the nmethod
duke@0 957 bool do_patch = true;
duke@0 958 if (stub_id == Runtime1::access_field_patching_id) {
duke@0 959 // The offset may not be correct if the class was not loaded at code generation time.
duke@0 960 // Set it now.
duke@0 961 NativeMovRegMem* n_move = nativeMovRegMem_at(copy_buff);
duke@0 962 assert(n_move->offset() == 0 || (n_move->offset() == 4 && (patch_field_type == T_DOUBLE || patch_field_type == T_LONG)), "illegal offset for type");
duke@0 963 assert(patch_field_offset >= 0, "illegal offset");
duke@0 964 n_move->add_offset_in_bytes(patch_field_offset);
duke@0 965 } else if (stub_id == Runtime1::load_klass_patching_id) {
duke@0 966 // If a getstatic or putstatic is referencing a klass which
duke@0 967 // isn't fully initialized, the patch body isn't copied into
duke@0 968 // place until initialization is complete. In this case the
duke@0 969 // patch site is setup so that any threads besides the
duke@0 970 // initializing thread are forced to come into the VM and
duke@0 971 // block.
duke@0 972 do_patch = (code != Bytecodes::_getstatic && code != Bytecodes::_putstatic) ||
duke@0 973 instanceKlass::cast(init_klass())->is_initialized();
duke@0 974 NativeGeneralJump* jump = nativeGeneralJump_at(instr_pc);
duke@0 975 if (jump->jump_destination() == being_initialized_entry) {
duke@0 976 assert(do_patch == true, "initialization must be complete at this point");
duke@0 977 } else {
duke@0 978 // patch the instruction <move reg, klass>
duke@0 979 NativeMovConstReg* n_copy = nativeMovConstReg_at(copy_buff);
bobv@1601 980
bobv@1601 981 assert(n_copy->data() == 0 ||
iveresov@1703 982 n_copy->data() == (intptr_t)Universe::non_oop_word(),
bobv@1601 983 "illegal init value");
duke@0 984 assert(load_klass() != NULL, "klass not set");
duke@0 985 n_copy->set_data((intx) (load_klass()));
duke@0 986
duke@0 987 if (TracePatching) {
duke@0 988 Disassembler::decode(copy_buff, copy_buff + *byte_count, tty);
duke@0 989 }
duke@0 990
bobv@1601 991 #if defined(SPARC) || defined(PPC)
duke@0 992 // Update the oop location in the nmethod with the proper
duke@0 993 // oop. When the code was generated, a NULL was stuffed
duke@0 994 // in the oop table and that table needs to be update to
duke@0 995 // have the right value. On intel the value is kept
duke@0 996 // directly in the instruction instead of in the oop
duke@0 997 // table, so set_data above effectively updated the value.
duke@0 998 nmethod* nm = CodeCache::find_nmethod(instr_pc);
duke@0 999 assert(nm != NULL, "invalid nmethod_pc");
duke@0 1000 RelocIterator oops(nm, copy_buff, copy_buff + 1);
duke@0 1001 bool found = false;
duke@0 1002 while (oops.next() && !found) {
duke@0 1003 if (oops.type() == relocInfo::oop_type) {
duke@0 1004 oop_Relocation* r = oops.oop_reloc();
duke@0 1005 oop* oop_adr = r->oop_addr();
duke@0 1006 *oop_adr = load_klass();
duke@0 1007 r->fix_oop_relocation();
duke@0 1008 found = true;
duke@0 1009 }
duke@0 1010 }
duke@0 1011 assert(found, "the oop must exist!");
duke@0 1012 #endif
duke@0 1013
duke@0 1014 }
duke@0 1015 } else {
duke@0 1016 ShouldNotReachHere();
duke@0 1017 }
duke@0 1018 if (do_patch) {
duke@0 1019 // replace instructions
duke@0 1020 // first replace the tail, then the call
bobv@1601 1021 #ifdef ARM
bobv@1601 1022 if(stub_id == Runtime1::load_klass_patching_id && !VM_Version::supports_movw()) {
vladidan@2366 1023 nmethod* nm = CodeCache::find_nmethod(instr_pc);
vladidan@2366 1024 oop* oop_addr = NULL;
vladidan@2366 1025 assert(nm != NULL, "invalid nmethod_pc");
vladidan@2366 1026 RelocIterator oops(nm, copy_buff, copy_buff + 1);
vladidan@2366 1027 while (oops.next()) {
vladidan@2366 1028 if (oops.type() == relocInfo::oop_type) {
vladidan@2366 1029 oop_Relocation* r = oops.oop_reloc();
vladidan@2366 1030 oop_addr = r->oop_addr();
vladidan@2366 1031 break;
vladidan@2366 1032 }
vladidan@2366 1033 }
vladidan@2366 1034 assert(oop_addr != NULL, "oop relocation must exist");
bobv@1601 1035 copy_buff -= *byte_count;
bobv@1601 1036 NativeMovConstReg* n_copy2 = nativeMovConstReg_at(copy_buff);
vladidan@2366 1037 n_copy2->set_pc_relative_offset((address)oop_addr, instr_pc);
bobv@1601 1038 }
bobv@1601 1039 #endif
bobv@1601 1040
duke@0 1041 for (int i = NativeCall::instruction_size; i < *byte_count; i++) {
duke@0 1042 address ptr = copy_buff + i;
duke@0 1043 int a_byte = (*ptr) & 0xFF;
duke@0 1044 address dst = instr_pc + i;
duke@0 1045 *(unsigned char*)dst = (unsigned char) a_byte;
duke@0 1046 }
duke@0 1047 ICache::invalidate_range(instr_pc, *byte_count);
duke@0 1048 NativeGeneralJump::replace_mt_safe(instr_pc, copy_buff);
duke@0 1049
duke@0 1050 if (stub_id == Runtime1::load_klass_patching_id) {
duke@0 1051 // update relocInfo to oop
duke@0 1052 nmethod* nm = CodeCache::find_nmethod(instr_pc);
duke@0 1053 assert(nm != NULL, "invalid nmethod_pc");
duke@0 1054
duke@0 1055 // The old patch site is now a move instruction so update
duke@0 1056 // the reloc info so that it will get updated during
duke@0 1057 // future GCs.
duke@0 1058 RelocIterator iter(nm, (address)instr_pc, (address)(instr_pc + 1));
duke@0 1059 relocInfo::change_reloc_info_for_address(&iter, (address) instr_pc,
duke@0 1060 relocInfo::none, relocInfo::oop_type);
duke@0 1061 #ifdef SPARC
duke@0 1062 // Sparc takes two relocations for an oop so update the second one.
duke@0 1063 address instr_pc2 = instr_pc + NativeMovConstReg::add_offset;
duke@0 1064 RelocIterator iter2(nm, instr_pc2, instr_pc2 + 1);
duke@0 1065 relocInfo::change_reloc_info_for_address(&iter2, (address) instr_pc2,
duke@0 1066 relocInfo::none, relocInfo::oop_type);
duke@0 1067 #endif
bobv@1601 1068 #ifdef PPC
bobv@1601 1069 { address instr_pc2 = instr_pc + NativeMovConstReg::lo_offset;
bobv@1601 1070 RelocIterator iter2(nm, instr_pc2, instr_pc2 + 1);
bobv@1601 1071 relocInfo::change_reloc_info_for_address(&iter2, (address) instr_pc2, relocInfo::none, relocInfo::oop_type);
bobv@1601 1072 }
bobv@1601 1073 #endif
duke@0 1074 }
duke@0 1075
duke@0 1076 } else {
duke@0 1077 ICache::invalidate_range(copy_buff, *byte_count);
duke@0 1078 NativeGeneralJump::insert_unconditional(instr_pc, being_initialized_entry);
duke@0 1079 }
duke@0 1080 }
duke@0 1081 }
duke@0 1082 }
duke@0 1083 JRT_END
duke@0 1084
duke@0 1085 //
duke@0 1086 // Entry point for compiled code. We want to patch a nmethod.
duke@0 1087 // We don't do a normal VM transition here because we want to
duke@0 1088 // know after the patching is complete and any safepoint(s) are taken
duke@0 1089 // if the calling nmethod was deoptimized. We do this by calling a
duke@0 1090 // helper method which does the normal VM transition and when it
duke@0 1091 // completes we can check for deoptimization. This simplifies the
duke@0 1092 // assembly code in the cpu directories.
duke@0 1093 //
duke@0 1094 int Runtime1::move_klass_patching(JavaThread* thread) {
duke@0 1095 //
duke@0 1096 // NOTE: we are still in Java
duke@0 1097 //
duke@0 1098 Thread* THREAD = thread;
duke@0 1099 debug_only(NoHandleMark nhm;)
duke@0 1100 {
duke@0 1101 // Enter VM mode
duke@0 1102
duke@0 1103 ResetNoHandleMark rnhm;
duke@0 1104 patch_code(thread, load_klass_patching_id);
duke@0 1105 }
duke@0 1106 // Back in JAVA, use no oops DON'T safepoint
duke@0 1107
duke@0 1108 // Return true if calling code is deoptimized
duke@0 1109
duke@0 1110 return caller_is_deopted();
duke@0 1111 }
duke@0 1112
duke@0 1113 //
duke@0 1114 // Entry point for compiled code. We want to patch a nmethod.
duke@0 1115 // We don't do a normal VM transition here because we want to
duke@0 1116 // know after the patching is complete and any safepoint(s) are taken
duke@0 1117 // if the calling nmethod was deoptimized. We do this by calling a
duke@0 1118 // helper method which does the normal VM transition and when it
duke@0 1119 // completes we can check for deoptimization. This simplifies the
duke@0 1120 // assembly code in the cpu directories.
duke@0 1121 //
duke@0 1122
duke@0 1123 int Runtime1::access_field_patching(JavaThread* thread) {
duke@0 1124 //
duke@0 1125 // NOTE: we are still in Java
duke@0 1126 //
duke@0 1127 Thread* THREAD = thread;
duke@0 1128 debug_only(NoHandleMark nhm;)
duke@0 1129 {
duke@0 1130 // Enter VM mode
duke@0 1131
duke@0 1132 ResetNoHandleMark rnhm;
duke@0 1133 patch_code(thread, access_field_patching_id);
duke@0 1134 }
duke@0 1135 // Back in JAVA, use no oops DON'T safepoint
duke@0 1136
duke@0 1137 // Return true if calling code is deoptimized
duke@0 1138
duke@0 1139 return caller_is_deopted();
duke@0 1140 JRT_END
duke@0 1141
duke@0 1142
duke@0 1143 JRT_LEAF(void, Runtime1::trace_block_entry(jint block_id))
duke@0 1144 // for now we just print out the block id
duke@0 1145 tty->print("%d ", block_id);
duke@0 1146 JRT_END
duke@0 1147
duke@0 1148
coleenp@113 1149 // Array copy return codes.
coleenp@113 1150 enum {
coleenp@113 1151 ac_failed = -1, // arraycopy failed
coleenp@113 1152 ac_ok = 0 // arraycopy succeeded
coleenp@113 1153 };
coleenp@113 1154
coleenp@113 1155
ysr@1245 1156 // Below length is the # elements copied.
coleenp@113 1157 template <class T> int obj_arraycopy_work(oopDesc* src, T* src_addr,
coleenp@113 1158 oopDesc* dst, T* dst_addr,
coleenp@113 1159 int length) {
coleenp@113 1160
coleenp@113 1161 // For performance reasons, we assume we are using a card marking write
coleenp@113 1162 // barrier. The assert will fail if this is not the case.
coleenp@113 1163 // Note that we use the non-virtual inlineable variant of write_ref_array.
coleenp@113 1164 BarrierSet* bs = Universe::heap()->barrier_set();
ysr@1245 1165 assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt");
ysr@1245 1166 assert(bs->has_write_ref_array_pre_opt(), "For pre-barrier as well.");
coleenp@113 1167 if (src == dst) {
coleenp@113 1168 // same object, no check
ysr@1245 1169 bs->write_ref_array_pre(dst_addr, length);
coleenp@113 1170 Copy::conjoint_oops_atomic(src_addr, dst_addr, length);
ysr@1245 1171 bs->write_ref_array((HeapWord*)dst_addr, length);
coleenp@113 1172 return ac_ok;
coleenp@113 1173 } else {
coleenp@113 1174 klassOop bound = objArrayKlass::cast(dst->klass())->element_klass();
coleenp@113 1175 klassOop stype = objArrayKlass::cast(src->klass())->element_klass();
coleenp@113 1176 if (stype == bound || Klass::cast(stype)->is_subtype_of(bound)) {
coleenp@113 1177 // Elements are guaranteed to be subtypes, so no check necessary
ysr@1245 1178 bs->write_ref_array_pre(dst_addr, length);
coleenp@113 1179 Copy::conjoint_oops_atomic(src_addr, dst_addr, length);
ysr@1245 1180 bs->write_ref_array((HeapWord*)dst_addr, length);
coleenp@113 1181 return ac_ok;
coleenp@113 1182 }
coleenp@113 1183 }
coleenp@113 1184 return ac_failed;
coleenp@113 1185 }
coleenp@113 1186
duke@0 1187 // fast and direct copy of arrays; returning -1, means that an exception may be thrown
duke@0 1188 // and we did not copy anything
duke@0 1189 JRT_LEAF(int, Runtime1::arraycopy(oopDesc* src, int src_pos, oopDesc* dst, int dst_pos, int length))
duke@0 1190 #ifndef PRODUCT
duke@0 1191 _generic_arraycopy_cnt++; // Slow-path oop array copy
duke@0 1192 #endif
duke@0 1193
duke@0 1194 if (src == NULL || dst == NULL || src_pos < 0 || dst_pos < 0 || length < 0) return ac_failed;
duke@0 1195 if (!dst->is_array() || !src->is_array()) return ac_failed;
duke@0 1196 if ((unsigned int) arrayOop(src)->length() < (unsigned int)src_pos + (unsigned int)length) return ac_failed;
duke@0 1197 if ((unsigned int) arrayOop(dst)->length() < (unsigned int)dst_pos + (unsigned int)length) return ac_failed;
duke@0 1198
duke@0 1199 if (length == 0) return ac_ok;
duke@0 1200 if (src->is_typeArray()) {
duke@0 1201 const klassOop klass_oop = src->klass();
duke@0 1202 if (klass_oop != dst->klass()) return ac_failed;
duke@0 1203 typeArrayKlass* klass = typeArrayKlass::cast(klass_oop);
duke@0 1204 const int l2es = klass->log2_element_size();
duke@0 1205 const int ihs = klass->array_header_in_bytes() / wordSize;
duke@0 1206 char* src_addr = (char*) ((oopDesc**)src + ihs) + (src_pos << l2es);
duke@0 1207 char* dst_addr = (char*) ((oopDesc**)dst + ihs) + (dst_pos << l2es);
duke@0 1208 // Potential problem: memmove is not guaranteed to be word atomic
duke@0 1209 // Revisit in Merlin
duke@0 1210 memmove(dst_addr, src_addr, length << l2es);
duke@0 1211 return ac_ok;
duke@0 1212 } else if (src->is_objArray() && dst->is_objArray()) {
iveresov@1909 1213 if (UseCompressedOops) {
coleenp@113 1214 narrowOop *src_addr = objArrayOop(src)->obj_at_addr<narrowOop>(src_pos);
coleenp@113 1215 narrowOop *dst_addr = objArrayOop(dst)->obj_at_addr<narrowOop>(dst_pos);
coleenp@113 1216 return obj_arraycopy_work(src, src_addr, dst, dst_addr, length);
duke@0 1217 } else {
coleenp@113 1218 oop *src_addr = objArrayOop(src)->obj_at_addr<oop>(src_pos);
coleenp@113 1219 oop *dst_addr = objArrayOop(dst)->obj_at_addr<oop>(dst_pos);
coleenp@113 1220 return obj_arraycopy_work(src, src_addr, dst, dst_addr, length);
duke@0 1221 }
duke@0 1222 }
duke@0 1223 return ac_failed;
duke@0 1224 JRT_END
duke@0 1225
duke@0 1226
duke@0 1227 JRT_LEAF(void, Runtime1::primitive_arraycopy(HeapWord* src, HeapWord* dst, int length))
duke@0 1228 #ifndef PRODUCT
duke@0 1229 _primitive_arraycopy_cnt++;
duke@0 1230 #endif
duke@0 1231
duke@0 1232 if (length == 0) return;
duke@0 1233 // Not guaranteed to be word atomic, but that doesn't matter
duke@0 1234 // for anything but an oop array, which is covered by oop_arraycopy.
kvn@1523 1235 Copy::conjoint_jbytes(src, dst, length);
duke@0 1236 JRT_END
duke@0 1237
duke@0 1238 JRT_LEAF(void, Runtime1::oop_arraycopy(HeapWord* src, HeapWord* dst, int num))
duke@0 1239 #ifndef PRODUCT
duke@0 1240 _oop_arraycopy_cnt++;
duke@0 1241 #endif
duke@0 1242
duke@0 1243 if (num == 0) return;
ysr@1245 1244 BarrierSet* bs = Universe::heap()->barrier_set();
ysr@1245 1245 assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt");
ysr@1245 1246 assert(bs->has_write_ref_array_pre_opt(), "For pre-barrier as well.");
ysr@1245 1247 if (UseCompressedOops) {
ysr@1245 1248 bs->write_ref_array_pre((narrowOop*)dst, num);
iveresov@1909 1249 Copy::conjoint_oops_atomic((narrowOop*) src, (narrowOop*) dst, num);
ysr@1245 1250 } else {
ysr@1245 1251 bs->write_ref_array_pre((oop*)dst, num);
iveresov@1909 1252 Copy::conjoint_oops_atomic((oop*) src, (oop*) dst, num);
ysr@1245 1253 }
ysr@1245 1254 bs->write_ref_array(dst, num);
duke@0 1255 JRT_END
duke@0 1256
duke@0 1257
duke@0 1258 #ifndef PRODUCT
duke@0 1259 void Runtime1::print_statistics() {
duke@0 1260 tty->print_cr("C1 Runtime statistics:");
duke@0 1261 tty->print_cr(" _resolve_invoke_virtual_cnt: %d", SharedRuntime::_resolve_virtual_ctr);
duke@0 1262 tty->print_cr(" _resolve_invoke_opt_virtual_cnt: %d", SharedRuntime::_resolve_opt_virtual_ctr);
duke@0 1263 tty->print_cr(" _resolve_invoke_static_cnt: %d", SharedRuntime::_resolve_static_ctr);
duke@0 1264 tty->print_cr(" _handle_wrong_method_cnt: %d", SharedRuntime::_wrong_method_ctr);
duke@0 1265 tty->print_cr(" _ic_miss_cnt: %d", SharedRuntime::_ic_miss_ctr);
duke@0 1266 tty->print_cr(" _generic_arraycopy_cnt: %d", _generic_arraycopy_cnt);
roland@2293 1267 tty->print_cr(" _generic_arraycopystub_cnt: %d", _generic_arraycopystub_cnt);
roland@2293 1268 tty->print_cr(" _byte_arraycopy_cnt: %d", _byte_arraycopy_cnt);
roland@2293 1269 tty->print_cr(" _short_arraycopy_cnt: %d", _short_arraycopy_cnt);
roland@2293 1270 tty->print_cr(" _int_arraycopy_cnt: %d", _int_arraycopy_cnt);
roland@2293 1271 tty->print_cr(" _long_arraycopy_cnt: %d", _long_arraycopy_cnt);
duke@0 1272 tty->print_cr(" _primitive_arraycopy_cnt: %d", _primitive_arraycopy_cnt);
roland@2293 1273 tty->print_cr(" _oop_arraycopy_cnt (C): %d", Runtime1::_oop_arraycopy_cnt);
roland@2293 1274 tty->print_cr(" _oop_arraycopy_cnt (stub): %d", _oop_arraycopy_cnt);
duke@0 1275 tty->print_cr(" _arraycopy_slowcase_cnt: %d", _arraycopy_slowcase_cnt);
roland@2293 1276 tty->print_cr(" _arraycopy_checkcast_cnt: %d", _arraycopy_checkcast_cnt);
roland@2293 1277 tty->print_cr(" _arraycopy_checkcast_attempt_cnt:%d", _arraycopy_checkcast_attempt_cnt);
duke@0 1278
duke@0 1279 tty->print_cr(" _new_type_array_slowcase_cnt: %d", _new_type_array_slowcase_cnt);
duke@0 1280 tty->print_cr(" _new_object_array_slowcase_cnt: %d", _new_object_array_slowcase_cnt);
duke@0 1281 tty->print_cr(" _new_instance_slowcase_cnt: %d", _new_instance_slowcase_cnt);
duke@0 1282 tty->print_cr(" _new_multi_array_slowcase_cnt: %d", _new_multi_array_slowcase_cnt);
duke@0 1283 tty->print_cr(" _monitorenter_slowcase_cnt: %d", _monitorenter_slowcase_cnt);
duke@0 1284 tty->print_cr(" _monitorexit_slowcase_cnt: %d", _monitorexit_slowcase_cnt);
duke@0 1285 tty->print_cr(" _patch_code_slowcase_cnt: %d", _patch_code_slowcase_cnt);
duke@0 1286
duke@0 1287 tty->print_cr(" _throw_range_check_exception_count: %d:", _throw_range_check_exception_count);
duke@0 1288 tty->print_cr(" _throw_index_exception_count: %d:", _throw_index_exception_count);
duke@0 1289 tty->print_cr(" _throw_div0_exception_count: %d:", _throw_div0_exception_count);
duke@0 1290 tty->print_cr(" _throw_null_pointer_exception_count: %d:", _throw_null_pointer_exception_count);
duke@0 1291 tty->print_cr(" _throw_class_cast_exception_count: %d:", _throw_class_cast_exception_count);
duke@0 1292 tty->print_cr(" _throw_incompatible_class_change_error_count: %d:", _throw_incompatible_class_change_error_count);
duke@0 1293 tty->print_cr(" _throw_array_store_exception_count: %d:", _throw_array_store_exception_count);
duke@0 1294 tty->print_cr(" _throw_count: %d:", _throw_count);
duke@0 1295
duke@0 1296 SharedRuntime::print_ic_miss_histogram();
duke@0 1297 tty->cr();
duke@0 1298 }
duke@0 1299 #endif // PRODUCT