1 /* 2 * Copyright (c) 2011, 2015, 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 */ 23 24 #include "precompiled.hpp" 25 #include "code/compiledIC.hpp" 26 #include "compiler/compileBroker.hpp" 27 #include "compiler/disassembler.hpp" 28 #include "oops/oop.inline.hpp" 29 #include "oops/objArrayOop.inline.hpp" 30 #include "runtime/javaCalls.hpp" 31 #include "jvmci/jvmciEnv.hpp" 32 #include "jvmci/jvmciCompiler.hpp" 33 #include "jvmci/jvmciCodeInstaller.hpp" 34 #include "jvmci/jvmciJavaClasses.hpp" 35 #include "jvmci/jvmciCompilerToVM.hpp" 36 #include "jvmci/jvmciRuntime.hpp" 37 #include "asm/register.hpp" 38 #include "classfile/vmSymbols.hpp" 39 #include "code/vmreg.hpp" 40 41 #ifdef TARGET_ARCH_x86 42 # include "vmreg_x86.inline.hpp" 43 #endif 44 #ifdef TARGET_ARCH_sparc 45 # include "vmreg_sparc.inline.hpp" 46 #endif 47 #ifdef TARGET_ARCH_zero 48 # include "vmreg_zero.inline.hpp" 49 #endif 50 #ifdef TARGET_ARCH_arm 51 # include "vmreg_arm.inline.hpp" 52 #endif 53 #ifdef TARGET_ARCH_ppc 54 # include "vmreg_ppc.inline.hpp" 55 #endif 56 57 58 // frequently used constants 59 // Allocate them with new so they are never destroyed (otherwise, a 60 // forced exit could destroy these objects while they are still in 61 // use). 62 ConstantOopWriteValue* CodeInstaller::_oop_null_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantOopWriteValue(NULL); 63 ConstantIntValue* CodeInstaller::_int_m1_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(-1); 64 ConstantIntValue* CodeInstaller::_int_0_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(0); 65 ConstantIntValue* CodeInstaller::_int_1_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(1); 66 ConstantIntValue* CodeInstaller::_int_2_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(2); 67 LocationValue* CodeInstaller::_illegal_value = new (ResourceObj::C_HEAP, mtCompiler) LocationValue(Location()); 68 69 Method* getMethodFromHotSpotMethod(oop hotspot_method) { 70 assert(hotspot_method != NULL && hotspot_method->is_a(HotSpotResolvedJavaMethodImpl::klass()), "sanity"); 71 return CompilerToVM::asMethod(hotspot_method); 72 } 73 74 VMReg getVMRegFromLocation(oop location, int total_frame_size) { 75 oop reg = code_Location::reg(location); 76 jint offset = code_Location::offset(location); 77 78 if (reg != NULL) { 79 // register 80 jint number = code_Register::number(reg); 81 VMReg vmReg = CodeInstaller::get_hotspot_reg(number); 82 assert(offset % 4 == 0, "must be aligned"); 83 return vmReg->next(offset / 4); 84 } else { 85 // stack slot 86 assert(offset % 4 == 0, "must be aligned"); 87 return VMRegImpl::stack2reg(offset / 4); 88 } 89 } 90 91 // creates a HotSpot oop map out of the byte arrays provided by DebugInfo 92 OopMap* CodeInstaller::create_oop_map(oop debug_info) { 93 oop reference_map = DebugInfo::referenceMap(debug_info); 94 if (HotSpotReferenceMap::maxRegisterSize(reference_map) > 16) { 95 _has_wide_vector = true; 96 } 97 OopMap* map = new OopMap(_total_frame_size, _parameter_count); 98 objArrayOop objects = HotSpotReferenceMap::objects(reference_map); 99 objArrayOop derivedBase = HotSpotReferenceMap::derivedBase(reference_map); 100 typeArrayOop sizeInBytes = HotSpotReferenceMap::sizeInBytes(reference_map); 101 for (int i = 0; i < objects->length(); i++) { 102 oop location = objects->obj_at(i); 103 oop baseLocation = derivedBase->obj_at(i); 104 int bytes = sizeInBytes->int_at(i); 105 106 VMReg vmReg = getVMRegFromLocation(location, _total_frame_size); 107 if (baseLocation != NULL) { 108 // derived oop 109 assert(bytes == 8, "derived oop can't be compressed"); 110 VMReg baseReg = getVMRegFromLocation(baseLocation, _total_frame_size); 111 map->set_derived_oop(vmReg, baseReg); 112 } else if (bytes == 8) { 113 // wide oop 114 map->set_oop(vmReg); 115 } else { 116 // narrow oop 117 assert(bytes == 4, "wrong size"); 118 map->set_narrowoop(vmReg); 119 } 120 } 121 122 oop callee_save_info = (oop) DebugInfo::calleeSaveInfo(debug_info); 123 if (callee_save_info != NULL) { 124 objArrayOop registers = RegisterSaveLayout::registers(callee_save_info); 125 typeArrayOop slots = RegisterSaveLayout::slots(callee_save_info); 126 for (jint i = 0; i < slots->length(); i++) { 127 oop jvmci_reg = registers->obj_at(i); 128 jint jvmci_reg_number = code_Register::number(jvmci_reg); 129 VMReg hotspot_reg = CodeInstaller::get_hotspot_reg(jvmci_reg_number); 130 // HotSpot stack slots are 4 bytes 131 jint jvmci_slot = slots->int_at(i); 132 jint hotspot_slot = jvmci_slot * VMRegImpl::slots_per_word; 133 VMReg hotspot_slot_as_reg = VMRegImpl::stack2reg(hotspot_slot); 134 map->set_callee_saved(hotspot_slot_as_reg, hotspot_reg); 135 #ifdef _LP64 136 // (copied from generate_oop_map() in c1_Runtime1_x86.cpp) 137 VMReg hotspot_slot_hi_as_reg = VMRegImpl::stack2reg(hotspot_slot + 1); 138 map->set_callee_saved(hotspot_slot_hi_as_reg, hotspot_reg->next()); 139 #endif 140 } 141 } 142 return map; 143 } 144 145 Metadata* CodeInstaller::record_metadata_reference(Handle& constant) { 146 oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant); 147 if (obj->is_a(HotSpotResolvedObjectTypeImpl::klass())) { 148 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj)); 149 assert(!HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected compressed klass pointer %s @ " INTPTR_FORMAT, klass->name()->as_C_string(), p2i(klass)); 150 int index = _oop_recorder->find_index(klass); 151 TRACE_jvmci_3("metadata[%d of %d] = %s", index, _oop_recorder->metadata_count(), klass->name()->as_C_string()); 152 return klass; 153 } else if (obj->is_a(HotSpotResolvedJavaMethodImpl::klass())) { 154 Method* method = (Method*) (address) HotSpotResolvedJavaMethodImpl::metaspaceMethod(obj); 155 assert(!HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected compressed method pointer %s @ " INTPTR_FORMAT, method->name()->as_C_string(), p2i(method)); 156 int index = _oop_recorder->find_index(method); 157 TRACE_jvmci_3("metadata[%d of %d] = %s", index, _oop_recorder->metadata_count(), method->name()->as_C_string()); 158 return method; 159 } else { 160 fatal("unexpected metadata reference for constant of type %s", obj->klass()->name()->as_C_string()); 161 return NULL; 162 } 163 } 164 165 #ifdef _LP64 166 narrowKlass CodeInstaller::record_narrow_metadata_reference(Handle& constant) { 167 oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant); 168 assert(HotSpotMetaspaceConstantImpl::compressed(constant), "unexpected uncompressed pointer"); 169 assert(obj->is_a(HotSpotResolvedObjectTypeImpl::klass()), "unexpected compressed pointer of type %s", obj->klass()->name()->as_C_string()); 170 171 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj)); 172 int index = _oop_recorder->find_index(klass); 173 TRACE_jvmci_3("narrowKlass[%d of %d] = %s", index, _oop_recorder->metadata_count(), klass->name()->as_C_string()); 174 return Klass::encode_klass(klass); 175 } 176 #endif 177 178 Location::Type CodeInstaller::get_oop_type(oop value) { 179 oop lirKind = Value::lirKind(value); 180 oop platformKind = LIRKind::platformKind(lirKind); 181 assert(LIRKind::referenceMask(lirKind) == 1, "unexpected referenceMask"); 182 183 if (platformKind == word_kind()) { 184 return Location::oop; 185 } else { 186 return Location::narrowoop; 187 } 188 } 189 190 ScopeValue* CodeInstaller::get_scope_value(oop value, BasicType type, GrowableArray<ScopeValue*>* objects, ScopeValue* &second) { 191 second = NULL; 192 if (value == Value::ILLEGAL()) { 193 assert(type == T_ILLEGAL, "expected legal value"); 194 return _illegal_value; 195 } else if (value->is_a(RegisterValue::klass())) { 196 oop reg = RegisterValue::reg(value); 197 jint number = code_Register::number(reg); 198 VMReg hotspotRegister = get_hotspot_reg(number); 199 if (is_general_purpose_reg(hotspotRegister)) { 200 Location::Type locationType; 201 if (type == T_OBJECT) { 202 locationType = get_oop_type(value); 203 } else if (type == T_LONG) { 204 locationType = Location::lng; 205 } else { 206 assert(type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN, "unexpected type in cpu register"); 207 locationType = Location::int_in_long; 208 } 209 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister)); 210 if (type == T_LONG) { 211 second = value; 212 } 213 return value; 214 } else { 215 assert(type == T_FLOAT || type == T_DOUBLE, "only float and double expected in xmm register"); 216 Location::Type locationType; 217 if (type == T_FLOAT) { 218 // this seems weird, but the same value is used in c1_LinearScan 219 locationType = Location::normal; 220 } else { 221 locationType = Location::dbl; 222 } 223 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister)); 224 if (type == T_DOUBLE) { 225 second = value; 226 } 227 return value; 228 } 229 } else if (value->is_a(StackSlot::klass())) { 230 jint offset = StackSlot::offset(value); 231 if (StackSlot::addFrameSize(value)) { 232 offset += _total_frame_size; 233 } 234 235 Location::Type locationType; 236 if (type == T_OBJECT) { 237 locationType = get_oop_type(value); 238 } else if (type == T_LONG) { 239 locationType = Location::lng; 240 } else if (type == T_DOUBLE) { 241 locationType = Location::dbl; 242 } else { 243 assert(type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN, "unexpected type in stack slot"); 244 locationType = Location::normal; 245 } 246 ScopeValue* value = new LocationValue(Location::new_stk_loc(locationType, offset)); 247 if (type == T_DOUBLE || type == T_LONG) { 248 second = value; 249 } 250 return value; 251 } else if (value->is_a(JavaConstant::klass())) { 252 if (value->is_a(PrimitiveConstant::klass())) { 253 if (value->is_a(RawConstant::klass())) { 254 jlong prim = PrimitiveConstant::primitive(value); 255 return new ConstantLongValue(prim); 256 } else { 257 assert(type == JVMCIRuntime::kindToBasicType(JavaKind::typeChar(PrimitiveConstant::kind(value))), "primitive constant type doesn't match"); 258 if (type == T_INT || type == T_FLOAT) { 259 jint prim = (jint)PrimitiveConstant::primitive(value); 260 switch (prim) { 261 case -1: return _int_m1_scope_value; 262 case 0: return _int_0_scope_value; 263 case 1: return _int_1_scope_value; 264 case 2: return _int_2_scope_value; 265 default: return new ConstantIntValue(prim); 266 } 267 } else { 268 assert(type == T_LONG || type == T_DOUBLE, "unexpected primitive constant type"); 269 jlong prim = PrimitiveConstant::primitive(value); 270 second = _int_1_scope_value; 271 return new ConstantLongValue(prim); 272 } 273 } 274 } else { 275 assert(type == T_OBJECT, "unexpected object constant"); 276 if (value->is_a(NullConstant::klass()) || value->is_a(HotSpotCompressedNullConstant::klass())) { 277 return _oop_null_scope_value; 278 } else { 279 assert(value->is_a(HotSpotObjectConstantImpl::klass()), "unexpected constant type"); 280 oop obj = HotSpotObjectConstantImpl::object(value); 281 assert(obj != NULL, "null value must be in NullConstant"); 282 return new ConstantOopWriteValue(JNIHandles::make_local(obj)); 283 } 284 } 285 } else if (value->is_a(VirtualObject::klass())) { 286 assert(type == T_OBJECT, "unexpected virtual object"); 287 int id = VirtualObject::id(value); 288 ScopeValue* object = objects->at(id); 289 assert(object != NULL, "missing value"); 290 return object; 291 } else { 292 value->klass()->print(); 293 value->print(); 294 } 295 ShouldNotReachHere(); 296 return NULL; 297 } 298 299 void CodeInstaller::record_object_value(ObjectValue* sv, oop value, GrowableArray<ScopeValue*>* objects) { 300 oop type = VirtualObject::type(value); 301 int id = VirtualObject::id(value); 302 oop javaMirror = HotSpotResolvedObjectTypeImpl::javaClass(type); 303 Klass* klass = java_lang_Class::as_Klass(javaMirror); 304 bool isLongArray = klass == Universe::longArrayKlassObj(); 305 306 objArrayOop values = VirtualObject::values(value); 307 objArrayOop slotKinds = VirtualObject::slotKinds(value); 308 for (jint i = 0; i < values->length(); i++) { 309 ScopeValue* cur_second = NULL; 310 oop object = values->obj_at(i); 311 oop kind = slotKinds->obj_at(i); 312 BasicType type = JVMCIRuntime::kindToBasicType(JavaKind::typeChar(kind)); 313 ScopeValue* value = get_scope_value(object, type, objects, cur_second); 314 315 if (isLongArray && cur_second == NULL) { 316 // we're trying to put ints into a long array... this isn't really valid, but it's used for some optimizations. 317 // add an int 0 constant 318 cur_second = _int_0_scope_value; 319 } 320 321 if (cur_second != NULL) { 322 sv->field_values()->append(cur_second); 323 } 324 assert(value != NULL, "missing value"); 325 sv->field_values()->append(value); 326 } 327 } 328 329 MonitorValue* CodeInstaller::get_monitor_value(oop value, GrowableArray<ScopeValue*>* objects) { 330 guarantee(value->is_a(StackLockValue::klass()), "Monitors must be of type StackLockValue"); 331 332 ScopeValue* second = NULL; 333 ScopeValue* owner_value = get_scope_value(StackLockValue::owner(value), T_OBJECT, objects, second); 334 assert(second == NULL, "monitor cannot occupy two stack slots"); 335 336 ScopeValue* lock_data_value = get_scope_value(StackLockValue::slot(value), T_LONG, objects, second); 337 assert(second == lock_data_value, "monitor is LONG value that occupies two stack slots"); 338 assert(lock_data_value->is_location(), "invalid monitor location"); 339 Location lock_data_loc = ((LocationValue*)lock_data_value)->location(); 340 341 bool eliminated = false; 342 if (StackLockValue::eliminated(value)) { 343 eliminated = true; 344 } 345 346 return new MonitorValue(owner_value, lock_data_loc, eliminated); 347 } 348 349 void CodeInstaller::initialize_dependencies(oop compiled_code, OopRecorder* recorder) { 350 JavaThread* thread = JavaThread::current(); 351 CompilerThread* compilerThread = thread->is_Compiler_thread() ? thread->as_CompilerThread() : NULL; 352 _oop_recorder = recorder; 353 _dependencies = new Dependencies(&_arena, _oop_recorder, compilerThread != NULL ? compilerThread->log() : NULL); 354 objArrayHandle assumptions = HotSpotCompiledCode::assumptions(compiled_code); 355 if (!assumptions.is_null()) { 356 int length = assumptions->length(); 357 for (int i = 0; i < length; ++i) { 358 Handle assumption = assumptions->obj_at(i); 359 if (!assumption.is_null()) { 360 if (assumption->klass() == Assumptions_NoFinalizableSubclass::klass()) { 361 assumption_NoFinalizableSubclass(assumption); 362 } else if (assumption->klass() == Assumptions_ConcreteSubtype::klass()) { 363 assumption_ConcreteSubtype(assumption); 364 } else if (assumption->klass() == Assumptions_LeafType::klass()) { 365 assumption_LeafType(assumption); 366 } else if (assumption->klass() == Assumptions_ConcreteMethod::klass()) { 367 assumption_ConcreteMethod(assumption); 368 } else if (assumption->klass() == Assumptions_CallSiteTargetValue::klass()) { 369 assumption_CallSiteTargetValue(assumption); 370 } else { 371 assumption->print(); 372 fatal("unexpected Assumption subclass"); 373 } 374 } 375 } 376 } 377 if (JvmtiExport::can_hotswap_or_post_breakpoint()) { 378 objArrayHandle methods = HotSpotCompiledCode::methods(compiled_code); 379 if (!methods.is_null()) { 380 int length = methods->length(); 381 for (int i = 0; i < length; ++i) { 382 Handle method_handle = methods->obj_at(i); 383 methodHandle method = getMethodFromHotSpotMethod(method_handle()); 384 _dependencies->assert_evol_method(method()); 385 } 386 } 387 } 388 } 389 390 RelocBuffer::~RelocBuffer() { 391 if (_buffer != NULL) { 392 FREE_C_HEAP_ARRAY(char, _buffer); 393 } 394 } 395 396 address RelocBuffer::begin() const { 397 if (_buffer != NULL) { 398 return (address) _buffer; 399 } 400 return (address) _static_buffer; 401 } 402 403 void RelocBuffer::set_size(size_t bytes) { 404 assert(bytes <= _size, "can't grow in size!"); 405 _size = bytes; 406 } 407 408 void RelocBuffer::ensure_size(size_t bytes) { 409 assert(_buffer == NULL, "can only be used once"); 410 assert(_size == 0, "can only be used once"); 411 if (bytes >= RelocBuffer::stack_size) { 412 _buffer = NEW_C_HEAP_ARRAY(char, bytes, mtInternal); 413 } 414 _size = bytes; 415 } 416 417 JVMCIEnv::CodeInstallResult CodeInstaller::gather_metadata(Handle target, Handle& compiled_code, CodeMetadata& metadata) { 418 CodeBuffer buffer("JVMCI Compiler CodeBuffer for Metadata"); 419 jobject compiled_code_obj = JNIHandles::make_local(compiled_code()); 420 initialize_dependencies(JNIHandles::resolve(compiled_code_obj), NULL); 421 422 // Get instructions and constants CodeSections early because we need it. 423 _instructions = buffer.insts(); 424 _constants = buffer.consts(); 425 426 initialize_fields(target(), JNIHandles::resolve(compiled_code_obj)); 427 if (!initialize_buffer(buffer)) { 428 return JVMCIEnv::code_too_large; 429 } 430 process_exception_handlers(); 431 432 _debug_recorder->pcs_size(); // ehm, create the sentinel record 433 434 assert(_debug_recorder->pcs_length() >= 2, "must be at least 2"); 435 436 metadata.set_pc_desc(_debug_recorder->pcs(), _debug_recorder->pcs_length()); 437 metadata.set_scopes(_debug_recorder->stream()->buffer(), _debug_recorder->data_size()); 438 metadata.set_exception_table(&_exception_handler_table); 439 440 RelocBuffer* reloc_buffer = metadata.get_reloc_buffer(); 441 442 reloc_buffer->ensure_size(buffer.total_relocation_size()); 443 size_t size = (size_t) buffer.copy_relocations_to(reloc_buffer->begin(), (CodeBuffer::csize_t) reloc_buffer->size(), true); 444 reloc_buffer->set_size(size); 445 return JVMCIEnv::ok; 446 } 447 448 // constructor used to create a method 449 JVMCIEnv::CodeInstallResult CodeInstaller::install(JVMCICompiler* compiler, Handle target, Handle& compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log) { 450 CodeBuffer buffer("JVMCI Compiler CodeBuffer"); 451 jobject compiled_code_obj = JNIHandles::make_local(compiled_code()); 452 OopRecorder* recorder = new OopRecorder(&_arena, true); 453 initialize_dependencies(JNIHandles::resolve(compiled_code_obj), recorder); 454 455 // Get instructions and constants CodeSections early because we need it. 456 _instructions = buffer.insts(); 457 _constants = buffer.consts(); 458 459 initialize_fields(target(), JNIHandles::resolve(compiled_code_obj)); 460 JVMCIEnv::CodeInstallResult result = initialize_buffer(buffer); 461 if (result != JVMCIEnv::ok) { 462 return result; 463 } 464 process_exception_handlers(); 465 466 int stack_slots = _total_frame_size / HeapWordSize; // conversion to words 467 468 if (!compiled_code->is_a(HotSpotCompiledNmethod::klass())) { 469 oop stubName = HotSpotCompiledCode::name(compiled_code_obj); 470 char* name = strdup(java_lang_String::as_utf8_string(stubName)); 471 cb = RuntimeStub::new_runtime_stub(name, 472 &buffer, 473 CodeOffsets::frame_never_safe, 474 stack_slots, 475 _debug_recorder->_oopmaps, 476 false); 477 result = JVMCIEnv::ok; 478 } else { 479 nmethod* nm = NULL; 480 methodHandle method = getMethodFromHotSpotMethod(HotSpotCompiledNmethod::method(compiled_code)); 481 jint entry_bci = HotSpotCompiledNmethod::entryBCI(compiled_code); 482 jint id = HotSpotCompiledNmethod::id(compiled_code); 483 bool has_unsafe_access = HotSpotCompiledNmethod::hasUnsafeAccess(compiled_code) == JNI_TRUE; 484 JVMCIEnv* env = (JVMCIEnv*) (address) HotSpotCompiledNmethod::jvmciEnv(compiled_code); 485 if (id == -1) { 486 // Make sure a valid compile_id is associated with every compile 487 id = CompileBroker::assign_compile_id_unlocked(Thread::current(), method, entry_bci); 488 } 489 result = JVMCIEnv::register_method(method, nm, entry_bci, &_offsets, _custom_stack_area_offset, &buffer, 490 stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table, 491 compiler, _debug_recorder, _dependencies, env, id, 492 has_unsafe_access, _has_wide_vector, installed_code, compiled_code, speculation_log); 493 cb = nm; 494 } 495 496 if (cb != NULL) { 497 // Make sure the pre-calculated constants section size was correct. 498 guarantee((cb->code_begin() - cb->content_begin()) >= _constants_size, "%d < %d", (int)(cb->code_begin() - cb->content_begin()), _constants_size); 499 } 500 return result; 501 } 502 503 void CodeInstaller::initialize_fields(oop target, oop compiled_code) { 504 if (compiled_code->is_a(HotSpotCompiledNmethod::klass())) { 505 Handle hotspotJavaMethod = HotSpotCompiledNmethod::method(compiled_code); 506 methodHandle method = getMethodFromHotSpotMethod(hotspotJavaMethod()); 507 _parameter_count = method->size_of_parameters(); 508 TRACE_jvmci_2("installing code for %s", method->name_and_sig_as_C_string()); 509 } else { 510 // Must be a HotSpotCompiledRuntimeStub. 511 // Only used in OopMap constructor for non-product builds 512 _parameter_count = 0; 513 } 514 _sites_handle = JNIHandles::make_local(HotSpotCompiledCode::sites(compiled_code)); 515 _exception_handlers_handle = JNIHandles::make_local(HotSpotCompiledCode::exceptionHandlers(compiled_code)); 516 517 _code_handle = JNIHandles::make_local(HotSpotCompiledCode::targetCode(compiled_code)); 518 _code_size = HotSpotCompiledCode::targetCodeSize(compiled_code); 519 _total_frame_size = HotSpotCompiledCode::totalFrameSize(compiled_code); 520 _custom_stack_area_offset = HotSpotCompiledCode::customStackAreaOffset(compiled_code); 521 522 // Pre-calculate the constants section size. This is required for PC-relative addressing. 523 _data_section_handle = JNIHandles::make_local(HotSpotCompiledCode::dataSection(compiled_code)); 524 guarantee(HotSpotCompiledCode::dataSectionAlignment(compiled_code) <= _constants->alignment(), "Alignment inside constants section is restricted by alignment of section begin"); 525 _constants_size = data_section()->length(); 526 527 _data_section_patches_handle = JNIHandles::make_local(HotSpotCompiledCode::dataSectionPatches(compiled_code)); 528 529 #ifndef PRODUCT 530 _comments_handle = JNIHandles::make_local(HotSpotCompiledCode::comments(compiled_code)); 531 #endif 532 533 _next_call_type = INVOKE_INVALID; 534 535 _has_wide_vector = false; 536 537 oop arch = TargetDescription::arch(target); 538 _word_kind_handle = JNIHandles::make_local(Architecture::wordKind(arch)); 539 } 540 541 int CodeInstaller::estimate_stubs_size() { 542 // Estimate the number of static call stubs that might be emitted. 543 int static_call_stubs = 0; 544 objArrayOop sites = this->sites(); 545 for (int i = 0; i < sites->length(); i++) { 546 oop site = sites->obj_at(i); 547 if (site->is_a(CompilationResult_Mark::klass())) { 548 oop id_obj = CompilationResult_Mark::id(site); 549 if (id_obj != NULL) { 550 assert(java_lang_boxing_object::is_instance(id_obj, T_INT), "Integer id expected"); 551 jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT)); 552 if (id == INVOKESTATIC || id == INVOKESPECIAL) { 553 static_call_stubs++; 554 } 555 } 556 } 557 } 558 return static_call_stubs * CompiledStaticCall::to_interp_stub_size(); 559 } 560 561 // perform data and call relocation on the CodeBuffer 562 JVMCIEnv::CodeInstallResult CodeInstaller::initialize_buffer(CodeBuffer& buffer) { 563 HandleMark hm; 564 objArrayHandle sites = this->sites(); 565 int locs_buffer_size = sites->length() * (relocInfo::length_limit + sizeof(relocInfo)); 566 567 // Allocate enough space in the stub section for the static call 568 // stubs. Stubs have extra relocs but they are managed by the stub 569 // section itself so they don't need to be accounted for in the 570 // locs_buffer above. 571 int stubs_size = estimate_stubs_size(); 572 int total_size = round_to(_code_size, buffer.insts()->alignment()) + round_to(_constants_size, buffer.consts()->alignment()) + round_to(stubs_size, buffer.stubs()->alignment()); 573 574 if (total_size > JVMCINMethodSizeLimit) { 575 return JVMCIEnv::code_too_large; 576 } 577 578 buffer.initialize(total_size, locs_buffer_size); 579 if (buffer.blob() == NULL) { 580 return JVMCIEnv::cache_full; 581 } 582 buffer.initialize_stubs_size(stubs_size); 583 buffer.initialize_consts_size(_constants_size); 584 585 _debug_recorder = new DebugInformationRecorder(_oop_recorder); 586 _debug_recorder->set_oopmaps(new OopMapSet()); 587 588 buffer.initialize_oop_recorder(_oop_recorder); 589 590 // copy the constant data into the newly created CodeBuffer 591 address end_data = _constants->start() + _constants_size; 592 memcpy(_constants->start(), data_section()->base(T_BYTE), _constants_size); 593 _constants->set_end(end_data); 594 595 // copy the code into the newly created CodeBuffer 596 address end_pc = _instructions->start() + _code_size; 597 guarantee(_instructions->allocates2(end_pc), "initialize should have reserved enough space for all the code"); 598 memcpy(_instructions->start(), code()->base(T_BYTE), _code_size); 599 _instructions->set_end(end_pc); 600 601 for (int i = 0; i < data_section_patches()->length(); i++) { 602 Handle patch = data_section_patches()->obj_at(i); 603 Handle reference = CompilationResult_DataPatch::reference(patch); 604 assert(reference->is_a(CompilationResult_ConstantReference::klass()), "patch in data section must be a ConstantReference"); 605 Handle constant = CompilationResult_ConstantReference::constant(reference); 606 address dest = _constants->start() + CompilationResult_Site::pcOffset(patch); 607 if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) { 608 if (HotSpotMetaspaceConstantImpl::compressed(constant)) { 609 #ifdef _LP64 610 *((narrowKlass*) dest) = record_narrow_metadata_reference(constant); 611 #else 612 fatal("unexpected compressed Klass* in 32-bit mode"); 613 #endif 614 } else { 615 *((Metadata**) dest) = record_metadata_reference(constant); 616 } 617 } else if (constant->is_a(HotSpotObjectConstantImpl::klass())) { 618 Handle obj = HotSpotObjectConstantImpl::object(constant); 619 jobject value = JNIHandles::make_local(obj()); 620 int oop_index = _oop_recorder->find_index(value); 621 622 if (HotSpotObjectConstantImpl::compressed(constant)) { 623 #ifdef _LP64 624 _constants->relocate(dest, oop_Relocation::spec(oop_index), relocInfo::narrow_oop_in_const); 625 #else 626 fatal("unexpected compressed oop in 32-bit mode"); 627 #endif 628 } else { 629 _constants->relocate(dest, oop_Relocation::spec(oop_index)); 630 } 631 } else { 632 ShouldNotReachHere(); 633 } 634 } 635 jint last_pc_offset = -1; 636 for (int i = 0; i < sites->length(); i++) { 637 { 638 No_Safepoint_Verifier no_safepoint; 639 oop site = sites->obj_at(i); 640 jint pc_offset = CompilationResult_Site::pcOffset(site); 641 642 if (site->is_a(CompilationResult_Call::klass())) { 643 TRACE_jvmci_4("call at %i", pc_offset); 644 site_Call(buffer, pc_offset, site); 645 } else if (site->is_a(CompilationResult_Infopoint::klass())) { 646 // three reasons for infopoints denote actual safepoints 647 oop reason = CompilationResult_Infopoint::reason(site); 648 if (InfopointReason::SAFEPOINT() == reason || InfopointReason::CALL() == reason || InfopointReason::IMPLICIT_EXCEPTION() == reason) { 649 TRACE_jvmci_4("safepoint at %i", pc_offset); 650 site_Safepoint(buffer, pc_offset, site); 651 } else { 652 // if the infopoint is not an actual safepoint, it must have one of the other reasons 653 // (safeguard against new safepoint types that require handling above) 654 assert(InfopointReason::METHOD_START() == reason || InfopointReason::METHOD_END() == reason || InfopointReason::LINE_NUMBER() == reason, ""); 655 site_Infopoint(buffer, pc_offset, site); 656 } 657 } else if (site->is_a(CompilationResult_DataPatch::klass())) { 658 TRACE_jvmci_4("datapatch at %i", pc_offset); 659 site_DataPatch(buffer, pc_offset, site); 660 } else if (site->is_a(CompilationResult_Mark::klass())) { 661 TRACE_jvmci_4("mark at %i", pc_offset); 662 site_Mark(buffer, pc_offset, site); 663 } else { 664 fatal("unexpected Site subclass"); 665 } 666 last_pc_offset = pc_offset; 667 } 668 if (CodeInstallSafepointChecks && SafepointSynchronize::do_call_back()) { 669 // this is a hacky way to force a safepoint check but nothing else was jumping out at me. 670 ThreadToNativeFromVM ttnfv(JavaThread::current()); 671 } 672 } 673 674 #ifndef PRODUCT 675 if (comments() != NULL) { 676 No_Safepoint_Verifier no_safepoint; 677 for (int i = 0; i < comments()->length(); i++) { 678 oop comment = comments()->obj_at(i); 679 assert(comment->is_a(HotSpotCompiledCode_Comment::klass()), "cce"); 680 jint offset = HotSpotCompiledCode_Comment::pcOffset(comment); 681 char* text = java_lang_String::as_utf8_string(HotSpotCompiledCode_Comment::text(comment)); 682 buffer.block_comment(offset, text); 683 } 684 } 685 #endif 686 return JVMCIEnv::ok; 687 } 688 689 void CodeInstaller::assumption_NoFinalizableSubclass(Handle assumption) { 690 Handle receiverType_handle = Assumptions_NoFinalizableSubclass::receiverType(assumption()); 691 Klass* receiverType = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(receiverType_handle)); 692 _dependencies->assert_has_no_finalizable_subclasses(receiverType); 693 } 694 695 void CodeInstaller::assumption_ConcreteSubtype(Handle assumption) { 696 Handle context_handle = Assumptions_ConcreteSubtype::context(assumption()); 697 Handle subtype_handle = Assumptions_ConcreteSubtype::subtype(assumption()); 698 Klass* context = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(context_handle)); 699 Klass* subtype = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(subtype_handle)); 700 701 assert(context->is_abstract(), ""); 702 _dependencies->assert_abstract_with_unique_concrete_subtype(context, subtype); 703 } 704 705 void CodeInstaller::assumption_LeafType(Handle assumption) { 706 Handle context_handle = Assumptions_LeafType::context(assumption()); 707 Klass* context = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(context_handle)); 708 709 _dependencies->assert_leaf_type(context); 710 } 711 712 void CodeInstaller::assumption_ConcreteMethod(Handle assumption) { 713 Handle impl_handle = Assumptions_ConcreteMethod::impl(assumption()); 714 Handle context_handle = Assumptions_ConcreteMethod::context(assumption()); 715 716 methodHandle impl = getMethodFromHotSpotMethod(impl_handle()); 717 Klass* context = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(context_handle)); 718 719 _dependencies->assert_unique_concrete_method(context, impl()); 720 } 721 722 void CodeInstaller::assumption_CallSiteTargetValue(Handle assumption) { 723 Handle callSite = Assumptions_CallSiteTargetValue::callSite(assumption()); 724 Handle methodHandle = Assumptions_CallSiteTargetValue::methodHandle(assumption()); 725 726 _dependencies->assert_call_site_target_value(callSite(), methodHandle()); 727 } 728 729 void CodeInstaller::process_exception_handlers() { 730 if (exception_handlers() != NULL) { 731 objArrayOop handlers = exception_handlers(); 732 for (int i = 0; i < handlers->length(); i++) { 733 oop exc = handlers->obj_at(i); 734 jint pc_offset = CompilationResult_Site::pcOffset(exc); 735 jint handler_offset = CompilationResult_ExceptionHandler::handlerPos(exc); 736 737 // Subtable header 738 _exception_handler_table.add_entry(HandlerTableEntry(1, pc_offset, 0)); 739 740 // Subtable entry 741 _exception_handler_table.add_entry(HandlerTableEntry(-1, handler_offset, 0)); 742 } 743 } 744 } 745 746 // If deoptimization happens, the interpreter should reexecute these bytecodes. 747 // This function mainly helps the compilers to set up the reexecute bit. 748 static bool bytecode_should_reexecute(Bytecodes::Code code) { 749 switch (code) { 750 case Bytecodes::_invokedynamic: 751 case Bytecodes::_invokevirtual: 752 case Bytecodes::_invokeinterface: 753 case Bytecodes::_invokespecial: 754 case Bytecodes::_invokestatic: 755 return false; 756 default: 757 return true; 758 } 759 return true; 760 } 761 762 GrowableArray<ScopeValue*>* CodeInstaller::record_virtual_objects(oop debug_info) { 763 objArrayOop virtualObjects = DebugInfo::virtualObjectMapping(debug_info); 764 if (virtualObjects == NULL) { 765 return NULL; 766 } 767 GrowableArray<ScopeValue*>* objects = new GrowableArray<ScopeValue*>(virtualObjects->length(), virtualObjects->length(), NULL); 768 // Create the unique ObjectValues 769 for (int i = 0; i < virtualObjects->length(); i++) { 770 oop value = virtualObjects->obj_at(i); 771 int id = VirtualObject::id(value); 772 oop type = VirtualObject::type(value); 773 oop javaMirror = HotSpotResolvedObjectTypeImpl::javaClass(type); 774 ObjectValue* sv = new ObjectValue(id, new ConstantOopWriteValue(JNIHandles::make_local(Thread::current(), javaMirror))); 775 assert(objects->at(id) == NULL, "once"); 776 objects->at_put(id, sv); 777 } 778 // All the values which could be referenced by the VirtualObjects 779 // exist, so now describe all the VirtualObjects themselves. 780 for (int i = 0; i < virtualObjects->length(); i++) { 781 oop value = virtualObjects->obj_at(i); 782 int id = VirtualObject::id(value); 783 record_object_value(objects->at(id)->as_ObjectValue(), value, objects); 784 } 785 _debug_recorder->dump_object_pool(objects); 786 return objects; 787 } 788 789 void CodeInstaller::record_scope(jint pc_offset, oop debug_info) { 790 oop position = DebugInfo::bytecodePosition(debug_info); 791 if (position == NULL) { 792 // Stubs do not record scope info, just oop maps 793 return; 794 } 795 796 GrowableArray<ScopeValue*>* objectMapping = record_virtual_objects(debug_info); 797 record_scope(pc_offset, position, objectMapping); 798 } 799 800 void CodeInstaller::record_scope(jint pc_offset, oop position, GrowableArray<ScopeValue*>* objects) { 801 oop frame = NULL; 802 if (position->is_a(BytecodeFrame::klass())) { 803 frame = position; 804 } 805 oop caller_frame = BytecodePosition::caller(position); 806 if (caller_frame != NULL) { 807 record_scope(pc_offset, caller_frame, objects); 808 } 809 810 oop hotspot_method = BytecodePosition::method(position); 811 Method* method = getMethodFromHotSpotMethod(hotspot_method); 812 jint bci = BytecodePosition::bci(position); 813 if (bci == BytecodeFrame::BEFORE_BCI()) { 814 bci = SynchronizationEntryBCI; 815 } 816 817 TRACE_jvmci_2("Recording scope pc_offset=%d bci=%d method=%s", pc_offset, bci, method->name_and_sig_as_C_string()); 818 819 bool reexecute = false; 820 if (frame != NULL) { 821 if (bci == SynchronizationEntryBCI){ 822 reexecute = false; 823 } else { 824 Bytecodes::Code code = Bytecodes::java_code_at(method, method->bcp_from(bci)); 825 reexecute = bytecode_should_reexecute(code); 826 if (frame != NULL) { 827 reexecute = (BytecodeFrame::duringCall(frame) == JNI_FALSE); 828 } 829 } 830 } 831 832 DebugToken* locals_token = NULL; 833 DebugToken* expressions_token = NULL; 834 DebugToken* monitors_token = NULL; 835 bool throw_exception = false; 836 837 if (frame != NULL) { 838 jint local_count = BytecodeFrame::numLocals(frame); 839 jint expression_count = BytecodeFrame::numStack(frame); 840 jint monitor_count = BytecodeFrame::numLocks(frame); 841 objArrayOop values = BytecodeFrame::values(frame); 842 objArrayOop slotKinds = BytecodeFrame::slotKinds(frame); 843 844 assert(local_count + expression_count + monitor_count == values->length(), "unexpected values length"); 845 assert(local_count + expression_count == slotKinds->length(), "unexpected slotKinds length"); 846 847 GrowableArray<ScopeValue*>* locals = local_count > 0 ? new GrowableArray<ScopeValue*> (local_count) : NULL; 848 GrowableArray<ScopeValue*>* expressions = expression_count > 0 ? new GrowableArray<ScopeValue*> (expression_count) : NULL; 849 GrowableArray<MonitorValue*>* monitors = monitor_count > 0 ? new GrowableArray<MonitorValue*> (monitor_count) : NULL; 850 851 TRACE_jvmci_2("Scope at bci %d with %d values", bci, values->length()); 852 TRACE_jvmci_2("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count); 853 854 for (jint i = 0; i < values->length(); i++) { 855 ScopeValue* second = NULL; 856 oop value = values->obj_at(i); 857 if (i < local_count) { 858 oop kind = slotKinds->obj_at(i); 859 BasicType type = JVMCIRuntime::kindToBasicType(JavaKind::typeChar(kind)); 860 ScopeValue* first = get_scope_value(value, type, objects, second); 861 if (second != NULL) { 862 locals->append(second); 863 } 864 locals->append(first); 865 } else if (i < local_count + expression_count) { 866 oop kind = slotKinds->obj_at(i); 867 BasicType type = JVMCIRuntime::kindToBasicType(JavaKind::typeChar(kind)); 868 ScopeValue* first = get_scope_value(value, type, objects, second); 869 if (second != NULL) { 870 expressions->append(second); 871 } 872 expressions->append(first); 873 } else { 874 monitors->append(get_monitor_value(value, objects)); 875 } 876 if (second != NULL) { 877 i++; 878 assert(i < values->length(), "double-slot value not followed by Value.ILLEGAL"); 879 assert(values->obj_at(i) == Value::ILLEGAL(), "double-slot value not followed by Value.ILLEGAL"); 880 } 881 } 882 883 locals_token = _debug_recorder->create_scope_values(locals); 884 expressions_token = _debug_recorder->create_scope_values(expressions); 885 monitors_token = _debug_recorder->create_monitor_values(monitors); 886 887 throw_exception = BytecodeFrame::rethrowException(frame) == JNI_TRUE; 888 } 889 890 _debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, throw_exception, false, false, 891 locals_token, expressions_token, monitors_token); 892 } 893 894 void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, oop site) { 895 oop debug_info = CompilationResult_Infopoint::debugInfo(site); 896 assert(debug_info != NULL, "debug info expected"); 897 898 // address instruction = _instructions->start() + pc_offset; 899 // jint next_pc_offset = Assembler::locate_next_instruction(instruction) - _instructions->start(); 900 _debug_recorder->add_safepoint(pc_offset, create_oop_map(debug_info)); 901 record_scope(pc_offset, debug_info); 902 _debug_recorder->end_safepoint(pc_offset); 903 } 904 905 void CodeInstaller::site_Infopoint(CodeBuffer& buffer, jint pc_offset, oop site) { 906 oop debug_info = CompilationResult_Infopoint::debugInfo(site); 907 assert(debug_info != NULL, "debug info expected"); 908 909 _debug_recorder->add_non_safepoint(pc_offset); 910 record_scope(pc_offset, debug_info); 911 _debug_recorder->end_non_safepoint(pc_offset); 912 } 913 914 void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, oop site) { 915 oop target = CompilationResult_Call::target(site); 916 InstanceKlass* target_klass = InstanceKlass::cast(target->klass()); 917 918 oop hotspot_method = NULL; // JavaMethod 919 oop foreign_call = NULL; 920 921 if (target_klass->is_subclass_of(SystemDictionary::HotSpotForeignCallTarget_klass())) { 922 foreign_call = target; 923 } else { 924 hotspot_method = target; 925 } 926 927 oop debug_info = CompilationResult_Call::debugInfo(site); 928 929 assert(!!hotspot_method ^ !!foreign_call, "Call site needs exactly one type"); 930 931 NativeInstruction* inst = nativeInstruction_at(_instructions->start() + pc_offset); 932 jint next_pc_offset = CodeInstaller::pd_next_offset(inst, pc_offset, hotspot_method); 933 934 if (debug_info != NULL) { 935 _debug_recorder->add_safepoint(next_pc_offset, create_oop_map(debug_info)); 936 record_scope(next_pc_offset, debug_info); 937 } 938 939 if (foreign_call != NULL) { 940 jlong foreign_call_destination = HotSpotForeignCallTarget::address(foreign_call); 941 CodeInstaller::pd_relocate_ForeignCall(inst, foreign_call_destination); 942 } else { // method != NULL 943 assert(hotspot_method != NULL, "unexpected JavaMethod"); 944 assert(debug_info != NULL, "debug info expected"); 945 946 TRACE_jvmci_3("method call"); 947 CodeInstaller::pd_relocate_JavaMethod(hotspot_method, pc_offset); 948 if (_next_call_type == INVOKESTATIC || _next_call_type == INVOKESPECIAL) { 949 // Need a static call stub for transitions from compiled to interpreted. 950 CompiledStaticCall::emit_to_interp_stub(buffer, _instructions->start() + pc_offset); 951 } 952 } 953 954 _next_call_type = INVOKE_INVALID; 955 956 if (debug_info != NULL) { 957 _debug_recorder->end_safepoint(next_pc_offset); 958 } 959 } 960 961 void CodeInstaller::site_DataPatch(CodeBuffer& buffer, jint pc_offset, oop site) { 962 oop reference = CompilationResult_DataPatch::reference(site); 963 if (reference->is_a(CompilationResult_ConstantReference::klass())) { 964 Handle constant = CompilationResult_ConstantReference::constant(reference); 965 if (constant->is_a(HotSpotObjectConstantImpl::klass())) { 966 pd_patch_OopConstant(pc_offset, constant); 967 } else if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) { 968 pd_patch_MetaspaceConstant(pc_offset, constant); 969 } else if (constant->is_a(HotSpotSentinelConstant::klass())) { 970 fatal("sentinel constant unsupported"); 971 } else { 972 fatal("unknown constant type in data patch"); 973 } 974 } else if (reference->is_a(CompilationResult_DataSectionReference::klass())) { 975 int data_offset = CompilationResult_DataSectionReference::offset(reference); 976 assert(0 <= data_offset && data_offset < _constants_size, "data offset 0x%X points outside data section (size 0x%X)", data_offset, _constants_size); 977 pd_patch_DataSectionReference(pc_offset, data_offset); 978 } else { 979 fatal("unknown data patch type"); 980 } 981 } 982 983 void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, oop site) { 984 oop id_obj = CompilationResult_Mark::id(site); 985 986 if (id_obj != NULL) { 987 assert(java_lang_boxing_object::is_instance(id_obj, T_INT), "Integer id expected"); 988 jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT)); 989 990 address pc = _instructions->start() + pc_offset; 991 992 switch (id) { 993 case UNVERIFIED_ENTRY: 994 _offsets.set_value(CodeOffsets::Entry, pc_offset); 995 break; 996 case VERIFIED_ENTRY: 997 _offsets.set_value(CodeOffsets::Verified_Entry, pc_offset); 998 break; 999 case OSR_ENTRY: 1000 _offsets.set_value(CodeOffsets::OSR_Entry, pc_offset); 1001 break; 1002 case EXCEPTION_HANDLER_ENTRY: 1003 _offsets.set_value(CodeOffsets::Exceptions, pc_offset); 1004 break; 1005 case DEOPT_HANDLER_ENTRY: 1006 _offsets.set_value(CodeOffsets::Deopt, pc_offset); 1007 break; 1008 case INVOKEVIRTUAL: 1009 case INVOKEINTERFACE: 1010 case INLINE_INVOKE: 1011 case INVOKESTATIC: 1012 case INVOKESPECIAL: 1013 _next_call_type = (MarkId) id; 1014 _invoke_mark_pc = pc; 1015 break; 1016 case POLL_NEAR: 1017 case POLL_FAR: 1018 case POLL_RETURN_NEAR: 1019 case POLL_RETURN_FAR: 1020 pd_relocate_poll(pc, id); 1021 break; 1022 case CARD_TABLE_SHIFT: 1023 case CARD_TABLE_ADDRESS: 1024 case HEAP_TOP_ADDRESS: 1025 case HEAP_END_ADDRESS: 1026 case NARROW_KLASS_BASE_ADDRESS: 1027 case CRC_TABLE_ADDRESS: 1028 break; 1029 default: 1030 ShouldNotReachHere(); 1031 break; 1032 } 1033 } 1034 } 1035