comparison src/share/vm/graal/graalCompilerToVM.cpp @ 9027:e0e85d78843b

Merge.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 12 Apr 2013 04:51:28 +0200
parents ff5a32117e02 80aee92588cd
children b78686983a75
comparison
equal deleted inserted replaced
9026:22851e342f0e 9027:e0e85d78843b
414 } 414 }
415 415
416 return JNIHandles::make_local(THREAD, result); 416 return JNIHandles::make_local(THREAD, result);
417 C2V_END 417 C2V_END
418 418
419 C2V_VMENTRY(jobject, lookupAppendixInPool, (JNIEnv *env, jobject, jobject type, jint index)) 419 C2V_VMENTRY(jobject, lookupAppendixInPool, (JNIEnv *env, jobject, jobject type, jint index, jbyte opcode))
420 assert(GraalCompiler::to_index_u4(index) < 0, "not an invokedynamic constant pool index"); 420 Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF);
421 index = GraalCompiler::to_cp_index(index, bc);
421 constantPoolHandle cpool(InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(type)))->constants()); 422 constantPoolHandle cpool(InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(type)))->constants());
422 oop appendix_oop = ConstantPool::appendix_at_if_loaded(cpool, GraalCompiler::to_index_u4(index)); 423 oop appendix_oop = ConstantPool::appendix_at_if_loaded(cpool, index);
423 424
424 return JNIHandles::make_local(THREAD, appendix_oop); 425 return JNIHandles::make_local(THREAD, appendix_oop);
425 C2V_END 426 C2V_END
426 427
427 C2V_VMENTRY(jobject, lookupMethodInPool, (JNIEnv *env, jobject, jobject type, jint index, jbyte opcode)) 428 C2V_VMENTRY(jobject, lookupMethodInPool, (JNIEnv *env, jobject, jobject type, jint index, jbyte opcode))
428 constantPoolHandle cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(type)))->constants(); 429 constantPoolHandle cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(type)))->constants();
429 instanceKlassHandle pool_holder(cp->pool_holder()); 430 instanceKlassHandle pool_holder(cp->pool_holder());
430 431
431 Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF); 432 Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF);
432 index = (bc == Bytecodes::_invokedynamic) ? GraalCompiler::to_index_u4(index) : GraalCompiler::to_cp_index_u2(index); 433 index = GraalCompiler::to_cp_index(index, bc);
433 434
434 methodHandle method = GraalEnv::get_method_by_index(cp, index, bc, pool_holder); 435 methodHandle method = GraalEnv::get_method_by_index(cp, index, bc, pool_holder);
435 if (!method.is_null()) { 436 if (!method.is_null()) {
436 Handle holder = GraalCompiler::get_JavaType(method->method_holder(), CHECK_NULL); 437 Handle holder = GraalCompiler::get_JavaType(method->method_holder(), CHECK_NULL);
437 return JNIHandles::make_local(THREAD, VMToCompiler::createResolvedJavaMethod(holder, method(), THREAD)); 438 return JNIHandles::make_local(THREAD, VMToCompiler::createResolvedJavaMethod(holder, method(), THREAD));
457 return JNIHandles::make_local(THREAD, result()); 458 return JNIHandles::make_local(THREAD, result());
458 C2V_END 459 C2V_END
459 460
460 C2V_VMENTRY(void, lookupReferencedTypeInPool, (JNIEnv *env, jobject, jobject type, jint index, jbyte op)) 461 C2V_VMENTRY(void, lookupReferencedTypeInPool, (JNIEnv *env, jobject, jobject type, jint index, jbyte op))
461 ConstantPool* cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(type)))->constants(); 462 ConstantPool* cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(type)))->constants();
462 int opcode = (op & 0xFF); 463 Bytecodes::Code bc = (Bytecodes::Code) (((int) op) & 0xFF);
463 if (opcode != Bytecodes::_checkcast && opcode != Bytecodes::_instanceof && opcode != Bytecodes::_new && opcode != Bytecodes::_anewarray 464 if (bc != Bytecodes::_checkcast && bc != Bytecodes::_instanceof && bc != Bytecodes::_new && bc != Bytecodes::_anewarray
464 && opcode != Bytecodes::_multianewarray && opcode != Bytecodes::_ldc && opcode != Bytecodes::_ldc_w && opcode != Bytecodes::_ldc2_w) 465 && bc != Bytecodes::_multianewarray && bc != Bytecodes::_ldc && bc != Bytecodes::_ldc_w && bc != Bytecodes::_ldc2_w)
465 { 466 {
466 index = cp->remap_instruction_operand_from_cache((opcode == Bytecodes::_invokedynamic) ? GraalCompiler::to_index_u4(index) : GraalCompiler::to_cp_index_u2(index)); 467 index = cp->remap_instruction_operand_from_cache(GraalCompiler::to_cp_index(index, bc));
467 } 468 }
468 constantTag tag = cp->tag_at(index); 469 constantTag tag = cp->tag_at(index);
469 if (tag.is_field_or_method()) { 470 if (tag.is_field_or_method()) {
470 index = cp->uncached_klass_ref_index_at(index); 471 index = cp->uncached_klass_ref_index_at(index);
471 tag = cp->tag_at(index); 472 tag = cp->tag_at(index);
654 set_int("methodMaxLocalsOffset", in_bytes(ConstMethod::size_of_locals_offset())); 655 set_int("methodMaxLocalsOffset", in_bytes(ConstMethod::size_of_locals_offset()));
655 set_int("methodConstMethodOffset", in_bytes(Method::const_offset())); 656 set_int("methodConstMethodOffset", in_bytes(Method::const_offset()));
656 set_int("constMethodMaxStackOffset", in_bytes(ConstMethod::max_stack_offset())); 657 set_int("constMethodMaxStackOffset", in_bytes(ConstMethod::max_stack_offset()));
657 set_int("extraStackEntries", Method::extra_stack_entries()); 658 set_int("extraStackEntries", Method::extra_stack_entries());
658 set_int("methodAccessFlagsOffset", in_bytes(Method::access_flags_offset())); 659 set_int("methodAccessFlagsOffset", in_bytes(Method::access_flags_offset()));
660 set_int("methodIntrinsicIdOffset", Method::intrinsic_id_offset_in_bytes());
659 set_int("klassHasFinalizerFlag", JVM_ACC_HAS_FINALIZER); 661 set_int("klassHasFinalizerFlag", JVM_ACC_HAS_FINALIZER);
660 set_int("threadExceptionOopOffset", in_bytes(JavaThread::exception_oop_offset())); 662 set_int("threadExceptionOopOffset", in_bytes(JavaThread::exception_oop_offset()));
661 set_int("threadExceptionPcOffset", in_bytes(JavaThread::exception_pc_offset())); 663 set_int("threadExceptionPcOffset", in_bytes(JavaThread::exception_pc_offset()));
662 set_boolean("isPollingPageFar", Assembler::is_polling_page_far()); 664 set_boolean("isPollingPageFar", Assembler::is_polling_page_far());
663 set_int("classMirrorOffset", in_bytes(Klass::java_mirror_offset())); 665 set_int("classMirrorOffset", in_bytes(Klass::java_mirror_offset()));
777 set_int("deoptActionNone", Deoptimization::Action_none); 779 set_int("deoptActionNone", Deoptimization::Action_none);
778 set_int("deoptActionMaybeRecompile", Deoptimization::Action_maybe_recompile); 780 set_int("deoptActionMaybeRecompile", Deoptimization::Action_maybe_recompile);
779 set_int("deoptActionReinterpret", Deoptimization::Action_reinterpret); 781 set_int("deoptActionReinterpret", Deoptimization::Action_reinterpret);
780 set_int("deoptActionMakeNotEntrant", Deoptimization::Action_make_not_entrant); 782 set_int("deoptActionMakeNotEntrant", Deoptimization::Action_make_not_entrant);
781 set_int("deoptActionMakeNotCompilable", Deoptimization::Action_make_not_compilable); 783 set_int("deoptActionMakeNotCompilable", Deoptimization::Action_make_not_compilable);
784
785 set_int("vmIntrinsicInvokeBasic", vmIntrinsics::_invokeBasic);
786 set_int("vmIntrinsicLinkToVirtual", vmIntrinsics::_linkToVirtual);
787 set_int("vmIntrinsicLinkToStatic", vmIntrinsics::_linkToStatic);
788 set_int("vmIntrinsicLinkToSpecial", vmIntrinsics::_linkToSpecial);
789 set_int("vmIntrinsicLinkToInterface", vmIntrinsics::_linkToInterface);
790
782 set_int("g1CardQueueIndexOffset", in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_index())); 791 set_int("g1CardQueueIndexOffset", in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_index()));
783 set_int("g1CardQueueBufferOffset", in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_buf())); 792 set_int("g1CardQueueBufferOffset", in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_buf()));
784 set_int("logOfHRGrainBytes", HeapRegion::LogOfHRGrainBytes); 793 set_int("logOfHRGrainBytes", HeapRegion::LogOfHRGrainBytes);
785 set_int("g1SATBQueueMarkingOffset", in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active())); 794 set_int("g1SATBQueueMarkingOffset", in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active()));
786 set_int("g1SATBQueueIndexOffset", in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_index())); 795 set_int("g1SATBQueueIndexOffset", in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_index()));
990 u4 end_bci = (u4)(start_bci + table[i].length); 999 u4 end_bci = (u4)(start_bci + table[i].length);
991 u2 nameCPIdx = table[i].name_cp_index; 1000 u2 nameCPIdx = table[i].name_cp_index;
992 u2 typeCPIdx = table[i].descriptor_cp_index; 1001 u2 typeCPIdx = table[i].descriptor_cp_index;
993 u2 slot = table[i].slot; 1002 u2 slot = table[i].slot;
994 1003
995 char* name = method->constants()->string_at_noresolve(nameCPIdx); 1004 char* name = method->constants()->symbol_at(nameCPIdx)->as_C_string();
996 Handle nameHandle = java_lang_String::create_from_str(name, CHECK_NULL); 1005 Handle nameHandle = java_lang_String::create_from_str(name, CHECK_NULL);
997 1006
998 char* typeInfo = method->constants()->string_at_noresolve(typeCPIdx); 1007 char* typeInfo = method->constants()->symbol_at(typeCPIdx)->as_C_string();
999 Handle typeHandle = java_lang_String::create_from_str(typeInfo, CHECK_NULL); 1008 Handle typeHandle = java_lang_String::create_from_str(typeInfo, CHECK_NULL);
1000 1009
1001 Handle holderHandle = GraalCompiler::createHotSpotResolvedObjectType(method, CHECK_0); 1010 Handle holderHandle = GraalCompiler::createHotSpotResolvedObjectType(method, CHECK_0);
1002 Handle local = VMToCompiler::createLocal(nameHandle, typeHandle, (int) start_bci, (int) end_bci, (int) slot, holderHandle, Thread::current()); 1011 Handle local = VMToCompiler::createLocal(nameHandle, typeHandle, (int) start_bci, (int) end_bci, (int) slot, holderHandle, Thread::current());
1003 local_array->obj_at_put(i, local()); 1012 local_array->obj_at_put(i, local());
1103 {CC"getInvocationCount", CC"("METASPACE_METHOD")I", FN_PTR(getInvocationCount)}, 1112 {CC"getInvocationCount", CC"("METASPACE_METHOD")I", FN_PTR(getInvocationCount)},
1104 {CC"getCompiledCodeSize", CC"("METASPACE_METHOD")I", FN_PTR(getCompiledCodeSize)}, 1113 {CC"getCompiledCodeSize", CC"("METASPACE_METHOD")I", FN_PTR(getCompiledCodeSize)},
1105 {CC"getVtableEntryOffset", CC"("METASPACE_METHOD")I", FN_PTR(getVtableEntryOffset)}, 1114 {CC"getVtableEntryOffset", CC"("METASPACE_METHOD")I", FN_PTR(getVtableEntryOffset)},
1106 {CC"lookupType", CC"("STRING HS_RESOLVED_TYPE"Z)"TYPE, FN_PTR(lookupType)}, 1115 {CC"lookupType", CC"("STRING HS_RESOLVED_TYPE"Z)"TYPE, FN_PTR(lookupType)},
1107 {CC"lookupConstantInPool", CC"("HS_RESOLVED_TYPE"I)"OBJECT, FN_PTR(lookupConstantInPool)}, 1116 {CC"lookupConstantInPool", CC"("HS_RESOLVED_TYPE"I)"OBJECT, FN_PTR(lookupConstantInPool)},
1108 {CC"lookupAppendixInPool", CC"("HS_RESOLVED_TYPE"I)"OBJECT, FN_PTR(lookupAppendixInPool)}, 1117 {CC"lookupAppendixInPool", CC"("HS_RESOLVED_TYPE"IB)"OBJECT, FN_PTR(lookupAppendixInPool)},
1109 {CC"lookupMethodInPool", CC"("HS_RESOLVED_TYPE"IB)"METHOD, FN_PTR(lookupMethodInPool)}, 1118 {CC"lookupMethodInPool", CC"("HS_RESOLVED_TYPE"IB)"METHOD, FN_PTR(lookupMethodInPool)},
1110 {CC"lookupTypeInPool", CC"("HS_RESOLVED_TYPE"I)"TYPE, FN_PTR(lookupTypeInPool)}, 1119 {CC"lookupTypeInPool", CC"("HS_RESOLVED_TYPE"I)"TYPE, FN_PTR(lookupTypeInPool)},
1111 {CC"lookupReferencedTypeInPool", CC"("HS_RESOLVED_TYPE"IB)V", FN_PTR(lookupReferencedTypeInPool)}, 1120 {CC"lookupReferencedTypeInPool", CC"("HS_RESOLVED_TYPE"IB)V", FN_PTR(lookupReferencedTypeInPool)},
1112 {CC"lookupFieldInPool", CC"("HS_RESOLVED_TYPE"IB)"FIELD, FN_PTR(lookupFieldInPool)}, 1121 {CC"lookupFieldInPool", CC"("HS_RESOLVED_TYPE"IB)"FIELD, FN_PTR(lookupFieldInPool)},
1113 {CC"resolveMethod", CC"("HS_RESOLVED_TYPE STRING STRING")"METHOD, FN_PTR(resolveMethod)}, 1122 {CC"resolveMethod", CC"("HS_RESOLVED_TYPE STRING STRING")"METHOD, FN_PTR(resolveMethod)},