330 JVMCIENV->copy_bytes_from(reconstituted_code, result, 0, code_size); |
330 JVMCIENV->copy_bytes_from(reconstituted_code, result, 0, code_size); |
331 return JVMCIENV->get_jbyteArray(result); |
331 return JVMCIENV->get_jbyteArray(result); |
332 C2V_END |
332 C2V_END |
333 |
333 |
334 C2V_VMENTRY_0(jint, getExceptionTableLength, (JNIEnv* env, jobject, jobject jvmci_method)) |
334 C2V_VMENTRY_0(jint, getExceptionTableLength, (JNIEnv* env, jobject, jobject jvmci_method)) |
335 methodHandle method = JVMCIENV->asMethod(jvmci_method); |
335 Method* method = JVMCIENV->asMethod(jvmci_method); |
336 return method->exception_table_length(); |
336 return method->exception_table_length(); |
337 C2V_END |
337 C2V_END |
338 |
338 |
339 C2V_VMENTRY_0(jlong, getExceptionTableStart, (JNIEnv* env, jobject, jobject jvmci_method)) |
339 C2V_VMENTRY_0(jlong, getExceptionTableStart, (JNIEnv* env, jobject, jobject jvmci_method)) |
340 methodHandle method = JVMCIENV->asMethod(jvmci_method); |
340 Method* method = JVMCIENV->asMethod(jvmci_method); |
341 if (method->exception_table_length() == 0) { |
341 if (method->exception_table_length() == 0) { |
342 return 0L; |
342 return 0L; |
343 } |
343 } |
344 return (jlong) (address) method->exception_table_start(); |
344 return (jlong) (address) method->exception_table_start(); |
345 C2V_END |
345 C2V_END |
357 assert(executable->klass() == SystemDictionary::reflect_Method_klass(), "wrong type"); |
357 assert(executable->klass() == SystemDictionary::reflect_Method_klass(), "wrong type"); |
358 mirror = java_lang_reflect_Method::clazz(executable); |
358 mirror = java_lang_reflect_Method::clazz(executable); |
359 slot = java_lang_reflect_Method::slot(executable); |
359 slot = java_lang_reflect_Method::slot(executable); |
360 } |
360 } |
361 Klass* holder = java_lang_Class::as_Klass(mirror); |
361 Klass* holder = java_lang_Class::as_Klass(mirror); |
362 methodHandle method = InstanceKlass::cast(holder)->method_with_idnum(slot); |
362 methodHandle method (THREAD, InstanceKlass::cast(holder)->method_with_idnum(slot)); |
363 JVMCIObject result = JVMCIENV->get_jvmci_method(method, JVMCI_CHECK_NULL); |
363 JVMCIObject result = JVMCIENV->get_jvmci_method(method, JVMCI_CHECK_NULL); |
364 return JVMCIENV->get_jobject(result); |
364 return JVMCIENV->get_jobject(result); |
365 } |
365 } |
366 |
366 |
367 C2V_VMENTRY_NULL(jobject, getResolvedJavaMethod, (JNIEnv* env, jobject, jobject base, jlong offset)) |
367 C2V_VMENTRY_NULL(jobject, getResolvedJavaMethod, (JNIEnv* env, jobject, jobject base, jlong offset)) |
368 methodHandle method; |
368 Method* method; |
369 JVMCIObject base_object = JVMCIENV->wrap(base); |
369 JVMCIObject base_object = JVMCIENV->wrap(base); |
370 if (base_object.is_null()) { |
370 if (base_object.is_null()) { |
371 method = *((Method**)(offset)); |
371 method = *((Method**)(offset)); |
372 } else if (JVMCIENV->isa_HotSpotObjectConstantImpl(base_object)) { |
372 } else if (JVMCIENV->isa_HotSpotObjectConstantImpl(base_object)) { |
373 Handle obj = JVMCIENV->asConstant(base_object, JVMCI_CHECK_NULL); |
373 Handle obj = JVMCIENV->asConstant(base_object, JVMCI_CHECK_NULL); |
377 JVMCI_THROW_MSG_NULL(IllegalArgumentException, err_msg("Unexpected type: %s", obj->klass()->external_name())); |
377 JVMCI_THROW_MSG_NULL(IllegalArgumentException, err_msg("Unexpected type: %s", obj->klass()->external_name())); |
378 } |
378 } |
379 } else if (JVMCIENV->isa_HotSpotResolvedJavaMethodImpl(base_object)) { |
379 } else if (JVMCIENV->isa_HotSpotResolvedJavaMethodImpl(base_object)) { |
380 method = JVMCIENV->asMethod(base_object); |
380 method = JVMCIENV->asMethod(base_object); |
381 } |
381 } |
382 if (method.is_null()) { |
382 if (method == NULL) { |
383 JVMCI_THROW_MSG_NULL(IllegalArgumentException, err_msg("Unexpected type: %s", JVMCIENV->klass_name(base_object))); |
383 JVMCI_THROW_MSG_NULL(IllegalArgumentException, err_msg("Unexpected type: %s", JVMCIENV->klass_name(base_object))); |
384 } |
384 } |
385 assert (method.is_null() || method->is_method(), "invalid read"); |
385 assert (method->is_method(), "invalid read"); |
386 JVMCIObject result = JVMCIENV->get_jvmci_method(method, JVMCI_CHECK_NULL); |
386 JVMCIObject result = JVMCIENV->get_jvmci_method(methodHandle(THREAD, method), JVMCI_CHECK_NULL); |
387 return JVMCIENV->get_jobject(result); |
387 return JVMCIENV->get_jobject(result); |
388 } |
388 } |
389 |
389 |
390 C2V_VMENTRY_NULL(jobject, getConstantPool, (JNIEnv* env, jobject, jobject object_handle)) |
390 C2V_VMENTRY_NULL(jobject, getConstantPool, (JNIEnv* env, jobject, jobject object_handle)) |
391 constantPoolHandle cp; |
391 ConstantPool* cp = NULL; |
392 JVMCIObject object = JVMCIENV->wrap(object_handle); |
392 JVMCIObject object = JVMCIENV->wrap(object_handle); |
393 if (object.is_null()) { |
393 if (object.is_null()) { |
394 JVMCI_THROW_NULL(NullPointerException); |
394 JVMCI_THROW_NULL(NullPointerException); |
395 } |
395 } |
396 if (JVMCIENV->isa_HotSpotResolvedJavaMethodImpl(object)) { |
396 if (JVMCIENV->isa_HotSpotResolvedJavaMethodImpl(object)) { |
399 cp = InstanceKlass::cast(JVMCIENV->asKlass(object))->constants(); |
399 cp = InstanceKlass::cast(JVMCIENV->asKlass(object))->constants(); |
400 } else { |
400 } else { |
401 JVMCI_THROW_MSG_NULL(IllegalArgumentException, |
401 JVMCI_THROW_MSG_NULL(IllegalArgumentException, |
402 err_msg("Unexpected type: %s", JVMCIENV->klass_name(object))); |
402 err_msg("Unexpected type: %s", JVMCIENV->klass_name(object))); |
403 } |
403 } |
404 assert(!cp.is_null(), "npe"); |
404 assert(cp != NULL, "npe"); |
405 |
405 |
406 JVMCIObject result = JVMCIENV->get_jvmci_constant_pool(cp, JVMCI_CHECK_NULL); |
406 JVMCIObject result = JVMCIENV->get_jvmci_constant_pool(constantPoolHandle(THREAD, cp), JVMCI_CHECK_NULL); |
407 return JVMCIENV->get_jobject(result); |
407 return JVMCIENV->get_jobject(result); |
408 } |
408 } |
409 |
409 |
410 C2V_VMENTRY_NULL(jobject, getResolvedJavaType0, (JNIEnv* env, jobject, jobject base, jlong offset, jboolean compressed)) |
410 C2V_VMENTRY_NULL(jobject, getResolvedJavaType0, (JNIEnv* env, jobject, jobject base, jlong offset, jboolean compressed)) |
411 JVMCIKlassHandle klass(THREAD); |
411 JVMCIKlassHandle klass(THREAD); |
449 JVMCIObject result = JVMCIENV->get_jvmci_type(klass, JVMCI_CHECK_NULL); |
449 JVMCIObject result = JVMCIENV->get_jvmci_type(klass, JVMCI_CHECK_NULL); |
450 return JVMCIENV->get_jobject(result); |
450 return JVMCIENV->get_jobject(result); |
451 } |
451 } |
452 |
452 |
453 C2V_VMENTRY_NULL(jobject, findUniqueConcreteMethod, (JNIEnv* env, jobject, jobject jvmci_type, jobject jvmci_method)) |
453 C2V_VMENTRY_NULL(jobject, findUniqueConcreteMethod, (JNIEnv* env, jobject, jobject jvmci_type, jobject jvmci_method)) |
454 methodHandle method = JVMCIENV->asMethod(jvmci_method); |
454 methodHandle method (THREAD, JVMCIENV->asMethod(jvmci_method)); |
455 Klass* holder = JVMCIENV->asKlass(jvmci_type); |
455 Klass* holder = JVMCIENV->asKlass(jvmci_type); |
456 if (holder->is_interface()) { |
456 if (holder->is_interface()) { |
457 JVMCI_THROW_MSG_NULL(InternalError, err_msg("Interface %s should be handled in Java code", holder->external_name())); |
457 JVMCI_THROW_MSG_NULL(InternalError, err_msg("Interface %s should be handled in Java code", holder->external_name())); |
458 } |
458 } |
459 if (method->can_be_statically_bound()) { |
459 if (method->can_be_statically_bound()) { |
485 JVMCIObject implementor = JVMCIENV->get_jvmci_type(handle, JVMCI_CHECK_NULL); |
485 JVMCIObject implementor = JVMCIENV->get_jvmci_type(handle, JVMCI_CHECK_NULL); |
486 return JVMCIENV->get_jobject(implementor); |
486 return JVMCIENV->get_jobject(implementor); |
487 C2V_END |
487 C2V_END |
488 |
488 |
489 C2V_VMENTRY_0(jboolean, methodIsIgnoredBySecurityStackWalk,(JNIEnv* env, jobject, jobject jvmci_method)) |
489 C2V_VMENTRY_0(jboolean, methodIsIgnoredBySecurityStackWalk,(JNIEnv* env, jobject, jobject jvmci_method)) |
490 methodHandle method = JVMCIENV->asMethod(jvmci_method); |
490 Method* method = JVMCIENV->asMethod(jvmci_method); |
491 return method->is_ignored_by_security_stack_walk(); |
491 return method->is_ignored_by_security_stack_walk(); |
492 C2V_END |
492 C2V_END |
493 |
493 |
494 C2V_VMENTRY_0(jboolean, isCompilable,(JNIEnv* env, jobject, jobject jvmci_method)) |
494 C2V_VMENTRY_0(jboolean, isCompilable,(JNIEnv* env, jobject, jobject jvmci_method)) |
495 methodHandle method = JVMCIENV->asMethod(jvmci_method); |
495 Method* method = JVMCIENV->asMethod(jvmci_method); |
496 constantPoolHandle cp = method->constMethod()->constants(); |
496 ConstantPool* cp = method->constMethod()->constants(); |
497 assert(!cp.is_null(), "npe"); |
497 assert(cp != NULL, "npe"); |
498 // don't inline method when constant pool contains a CONSTANT_Dynamic |
498 // don't inline method when constant pool contains a CONSTANT_Dynamic |
499 return !method->is_not_compilable(CompLevel_full_optimization) && !cp->has_dynamic_constant(); |
499 return !method->is_not_compilable(CompLevel_full_optimization) && !cp->has_dynamic_constant(); |
500 C2V_END |
500 C2V_END |
501 |
501 |
502 C2V_VMENTRY_0(jboolean, hasNeverInlineDirective,(JNIEnv* env, jobject, jobject jvmci_method)) |
502 C2V_VMENTRY_0(jboolean, hasNeverInlineDirective,(JNIEnv* env, jobject, jobject jvmci_method)) |
503 methodHandle method = JVMCIENV->asMethod(jvmci_method); |
503 methodHandle method (THREAD, JVMCIENV->asMethod(jvmci_method)); |
504 return !Inline || CompilerOracle::should_not_inline(method) || method->dont_inline(); |
504 return !Inline || CompilerOracle::should_not_inline(method) || method->dont_inline(); |
505 C2V_END |
505 C2V_END |
506 |
506 |
507 C2V_VMENTRY_0(jboolean, shouldInlineMethod,(JNIEnv* env, jobject, jobject jvmci_method)) |
507 C2V_VMENTRY_0(jboolean, shouldInlineMethod,(JNIEnv* env, jobject, jobject jvmci_method)) |
508 methodHandle method = JVMCIENV->asMethod(jvmci_method); |
508 methodHandle method (THREAD, JVMCIENV->asMethod(jvmci_method)); |
509 return CompilerOracle::should_inline(method) || method->force_inline(); |
509 return CompilerOracle::should_inline(method) || method->force_inline(); |
510 C2V_END |
510 C2V_END |
511 |
511 |
512 C2V_VMENTRY_NULL(jobject, lookupType, (JNIEnv* env, jobject, jstring jname, jclass accessing_class, jboolean resolve)) |
512 C2V_VMENTRY_NULL(jobject, lookupType, (JNIEnv* env, jobject, jstring jname, jclass accessing_class, jboolean resolve)) |
513 JVMCIObject name = JVMCIENV->wrap(jname); |
513 JVMCIObject name = JVMCIENV->wrap(jname); |
611 JVMCIObject result = JVMCIENV->get_jvmci_type(klass, JVMCI_CHECK_NULL); |
611 JVMCIObject result = JVMCIENV->get_jvmci_type(klass, JVMCI_CHECK_NULL); |
612 return JVMCIENV->get_jobject(result); |
612 return JVMCIENV->get_jobject(result); |
613 } |
613 } |
614 |
614 |
615 C2V_VMENTRY_NULL(jobject, resolvePossiblyCachedConstantInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index)) |
615 C2V_VMENTRY_NULL(jobject, resolvePossiblyCachedConstantInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index)) |
616 constantPoolHandle cp = JVMCIENV->asConstantPool(jvmci_constant_pool); |
616 constantPoolHandle cp(THREAD, JVMCIENV->asConstantPool(jvmci_constant_pool)); |
617 oop result = cp->resolve_possibly_cached_constant_at(index, CHECK_NULL); |
617 oop result = cp->resolve_possibly_cached_constant_at(index, CHECK_NULL); |
618 return JVMCIENV->get_jobject(JVMCIENV->get_object_constant(result)); |
618 return JVMCIENV->get_jobject(JVMCIENV->get_object_constant(result)); |
619 C2V_END |
619 C2V_END |
620 |
620 |
621 C2V_VMENTRY_0(jint, lookupNameAndTypeRefIndexInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index)) |
621 C2V_VMENTRY_0(jint, lookupNameAndTypeRefIndexInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index)) |
622 constantPoolHandle cp = JVMCIENV->asConstantPool(jvmci_constant_pool); |
622 constantPoolHandle cp(THREAD, JVMCIENV->asConstantPool(jvmci_constant_pool)); |
623 return cp->name_and_type_ref_index_at(index); |
623 return cp->name_and_type_ref_index_at(index); |
624 C2V_END |
624 C2V_END |
625 |
625 |
626 C2V_VMENTRY_NULL(jobject, lookupNameInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint which)) |
626 C2V_VMENTRY_NULL(jobject, lookupNameInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint which)) |
627 constantPoolHandle cp = JVMCIENV->asConstantPool(jvmci_constant_pool); |
627 constantPoolHandle cp(THREAD, JVMCIENV->asConstantPool(jvmci_constant_pool)); |
628 JVMCIObject sym = JVMCIENV->create_string(cp->name_ref_at(which), JVMCI_CHECK_NULL); |
628 JVMCIObject sym = JVMCIENV->create_string(cp->name_ref_at(which), JVMCI_CHECK_NULL); |
629 return JVMCIENV->get_jobject(sym); |
629 return JVMCIENV->get_jobject(sym); |
630 C2V_END |
630 C2V_END |
631 |
631 |
632 C2V_VMENTRY_NULL(jobject, lookupSignatureInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint which)) |
632 C2V_VMENTRY_NULL(jobject, lookupSignatureInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint which)) |
633 constantPoolHandle cp = JVMCIENV->asConstantPool(jvmci_constant_pool); |
633 constantPoolHandle cp(THREAD, JVMCIENV->asConstantPool(jvmci_constant_pool)); |
634 JVMCIObject sym = JVMCIENV->create_string(cp->signature_ref_at(which), JVMCI_CHECK_NULL); |
634 JVMCIObject sym = JVMCIENV->create_string(cp->signature_ref_at(which), JVMCI_CHECK_NULL); |
635 return JVMCIENV->get_jobject(sym); |
635 return JVMCIENV->get_jobject(sym); |
636 C2V_END |
636 C2V_END |
637 |
637 |
638 C2V_VMENTRY_0(jint, lookupKlassRefIndexInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index)) |
638 C2V_VMENTRY_0(jint, lookupKlassRefIndexInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index)) |
639 constantPoolHandle cp = JVMCIENV->asConstantPool(jvmci_constant_pool); |
639 constantPoolHandle cp(THREAD, JVMCIENV->asConstantPool(jvmci_constant_pool)); |
640 return cp->klass_ref_index_at(index); |
640 return cp->klass_ref_index_at(index); |
641 C2V_END |
641 C2V_END |
642 |
642 |
643 C2V_VMENTRY_NULL(jobject, resolveTypeInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index)) |
643 C2V_VMENTRY_NULL(jobject, resolveTypeInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index)) |
644 constantPoolHandle cp = JVMCIENV->asConstantPool(jvmci_constant_pool); |
644 constantPoolHandle cp(THREAD, JVMCIENV->asConstantPool(jvmci_constant_pool)); |
645 Klass* klass = cp->klass_at(index, CHECK_NULL); |
645 Klass* klass = cp->klass_at(index, CHECK_NULL); |
646 JVMCIKlassHandle resolved_klass(THREAD, klass); |
646 JVMCIKlassHandle resolved_klass(THREAD, klass); |
647 if (resolved_klass->is_instance_klass()) { |
647 if (resolved_klass->is_instance_klass()) { |
648 InstanceKlass::cast(resolved_klass())->link_class(CHECK_NULL); |
648 InstanceKlass::cast(resolved_klass())->link_class(CHECK_NULL); |
649 if (!InstanceKlass::cast(resolved_klass())->is_linked()) { |
649 if (!InstanceKlass::cast(resolved_klass())->is_linked()) { |
654 JVMCIObject klassObject = JVMCIENV->get_jvmci_type(resolved_klass, JVMCI_CHECK_NULL); |
654 JVMCIObject klassObject = JVMCIENV->get_jvmci_type(resolved_klass, JVMCI_CHECK_NULL); |
655 return JVMCIENV->get_jobject(klassObject); |
655 return JVMCIENV->get_jobject(klassObject); |
656 C2V_END |
656 C2V_END |
657 |
657 |
658 C2V_VMENTRY_NULL(jobject, lookupKlassInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode)) |
658 C2V_VMENTRY_NULL(jobject, lookupKlassInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode)) |
659 constantPoolHandle cp = JVMCIENV->asConstantPool(jvmci_constant_pool); |
659 constantPoolHandle cp(THREAD, JVMCIENV->asConstantPool(jvmci_constant_pool)); |
660 Klass* loading_klass = cp->pool_holder(); |
660 Klass* loading_klass = cp->pool_holder(); |
661 bool is_accessible = false; |
661 bool is_accessible = false; |
662 JVMCIKlassHandle klass(THREAD, JVMCIRuntime::get_klass_by_index(cp, index, is_accessible, loading_klass)); |
662 JVMCIKlassHandle klass(THREAD, JVMCIRuntime::get_klass_by_index(cp, index, is_accessible, loading_klass)); |
663 Symbol* symbol = NULL; |
663 Symbol* symbol = NULL; |
664 if (klass.is_null()) { |
664 if (klass.is_null()) { |
682 } |
682 } |
683 return JVMCIENV->get_jobject(result); |
683 return JVMCIENV->get_jobject(result); |
684 C2V_END |
684 C2V_END |
685 |
685 |
686 C2V_VMENTRY_NULL(jobject, lookupAppendixInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index)) |
686 C2V_VMENTRY_NULL(jobject, lookupAppendixInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index)) |
687 constantPoolHandle cp = JVMCIENV->asConstantPool(jvmci_constant_pool); |
687 constantPoolHandle cp(THREAD, JVMCIENV->asConstantPool(jvmci_constant_pool)); |
688 oop appendix_oop = ConstantPool::appendix_at_if_loaded(cp, index); |
688 oop appendix_oop = ConstantPool::appendix_at_if_loaded(cp, index); |
689 return JVMCIENV->get_jobject(JVMCIENV->get_object_constant(appendix_oop)); |
689 return JVMCIENV->get_jobject(JVMCIENV->get_object_constant(appendix_oop)); |
690 C2V_END |
690 C2V_END |
691 |
691 |
692 C2V_VMENTRY_NULL(jobject, lookupMethodInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode)) |
692 C2V_VMENTRY_NULL(jobject, lookupMethodInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode)) |
693 constantPoolHandle cp = JVMCIENV->asConstantPool(jvmci_constant_pool); |
693 constantPoolHandle cp(THREAD, JVMCIENV->asConstantPool(jvmci_constant_pool)); |
694 InstanceKlass* pool_holder = cp->pool_holder(); |
694 InstanceKlass* pool_holder = cp->pool_holder(); |
695 Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF); |
695 Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF); |
696 methodHandle method = JVMCIRuntime::get_method_by_index(cp, index, bc, pool_holder); |
696 methodHandle method(THREAD, JVMCIRuntime::get_method_by_index(cp, index, bc, pool_holder)); |
697 JVMCIObject result = JVMCIENV->get_jvmci_method(method, JVMCI_CHECK_NULL); |
697 JVMCIObject result = JVMCIENV->get_jvmci_method(method, JVMCI_CHECK_NULL); |
698 return JVMCIENV->get_jobject(result); |
698 return JVMCIENV->get_jobject(result); |
699 C2V_END |
699 C2V_END |
700 |
700 |
701 C2V_VMENTRY_0(jint, constantPoolRemapInstructionOperandFromCache, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index)) |
701 C2V_VMENTRY_0(jint, constantPoolRemapInstructionOperandFromCache, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index)) |
702 constantPoolHandle cp = JVMCIENV->asConstantPool(jvmci_constant_pool); |
702 constantPoolHandle cp(THREAD, JVMCIENV->asConstantPool(jvmci_constant_pool)); |
703 return cp->remap_instruction_operand_from_cache(index); |
703 return cp->remap_instruction_operand_from_cache(index); |
704 C2V_END |
704 C2V_END |
705 |
705 |
706 C2V_VMENTRY_NULL(jobject, resolveFieldInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index, jobject jvmci_method, jbyte opcode, jintArray info_handle)) |
706 C2V_VMENTRY_NULL(jobject, resolveFieldInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index, jobject jvmci_method, jbyte opcode, jintArray info_handle)) |
707 constantPoolHandle cp = JVMCIENV->asConstantPool(jvmci_constant_pool); |
707 constantPoolHandle cp(THREAD, JVMCIENV->asConstantPool(jvmci_constant_pool)); |
708 Bytecodes::Code code = (Bytecodes::Code)(((int) opcode) & 0xFF); |
708 Bytecodes::Code code = (Bytecodes::Code)(((int) opcode) & 0xFF); |
709 fieldDescriptor fd; |
709 fieldDescriptor fd; |
710 LinkInfo link_info(cp, index, (jvmci_method != NULL) ? JVMCIENV->asMethod(jvmci_method) : NULL, CHECK_0); |
710 methodHandle mh(THREAD, (jvmci_method != NULL) ? JVMCIENV->asMethod(jvmci_method) : NULL); |
|
711 LinkInfo link_info(cp, index, mh, CHECK_0); |
711 LinkResolver::resolve_field(fd, link_info, Bytecodes::java_code(code), false, CHECK_0); |
712 LinkResolver::resolve_field(fd, link_info, Bytecodes::java_code(code), false, CHECK_0); |
712 JVMCIPrimitiveArray info = JVMCIENV->wrap(info_handle); |
713 JVMCIPrimitiveArray info = JVMCIENV->wrap(info_handle); |
713 if (info.is_null() || JVMCIENV->get_length(info) != 3) { |
714 if (info.is_null() || JVMCIENV->get_length(info) != 3) { |
714 JVMCI_ERROR_NULL("info must not be null and have a length of 3"); |
715 JVMCI_ERROR_NULL("info must not be null and have a length of 3"); |
715 } |
716 } |
721 return JVMCIENV->get_jobject(field_holder); |
722 return JVMCIENV->get_jobject(field_holder); |
722 C2V_END |
723 C2V_END |
723 |
724 |
724 C2V_VMENTRY_0(jint, getVtableIndexForInterfaceMethod, (JNIEnv* env, jobject, jobject jvmci_type, jobject jvmci_method)) |
725 C2V_VMENTRY_0(jint, getVtableIndexForInterfaceMethod, (JNIEnv* env, jobject, jobject jvmci_type, jobject jvmci_method)) |
725 Klass* klass = JVMCIENV->asKlass(jvmci_type); |
726 Klass* klass = JVMCIENV->asKlass(jvmci_type); |
726 Method* method = JVMCIENV->asMethod(jvmci_method); |
727 methodHandle method(THREAD, JVMCIENV->asMethod(jvmci_method)); |
727 if (klass->is_interface()) { |
728 if (klass->is_interface()) { |
728 JVMCI_THROW_MSG_0(InternalError, err_msg("Interface %s should be handled in Java code", klass->external_name())); |
729 JVMCI_THROW_MSG_0(InternalError, err_msg("Interface %s should be handled in Java code", klass->external_name())); |
729 } |
730 } |
730 if (!method->method_holder()->is_interface()) { |
731 if (!method->method_holder()->is_interface()) { |
731 JVMCI_THROW_MSG_0(InternalError, err_msg("Method %s is not held by an interface, this case should be handled in Java code", method->name_and_sig_as_C_string())); |
732 JVMCI_THROW_MSG_0(InternalError, err_msg("Method %s is not held by an interface, this case should be handled in Java code", method->name_and_sig_as_C_string())); |
740 C2V_END |
741 C2V_END |
741 |
742 |
742 C2V_VMENTRY_NULL(jobject, resolveMethod, (JNIEnv* env, jobject, jobject receiver_jvmci_type, jobject jvmci_method, jobject caller_jvmci_type)) |
743 C2V_VMENTRY_NULL(jobject, resolveMethod, (JNIEnv* env, jobject, jobject receiver_jvmci_type, jobject jvmci_method, jobject caller_jvmci_type)) |
743 Klass* recv_klass = JVMCIENV->asKlass(receiver_jvmci_type); |
744 Klass* recv_klass = JVMCIENV->asKlass(receiver_jvmci_type); |
744 Klass* caller_klass = JVMCIENV->asKlass(caller_jvmci_type); |
745 Klass* caller_klass = JVMCIENV->asKlass(caller_jvmci_type); |
745 methodHandle method = JVMCIENV->asMethod(jvmci_method); |
746 methodHandle method(THREAD, JVMCIENV->asMethod(jvmci_method)); |
746 |
747 |
747 Klass* resolved = method->method_holder(); |
748 Klass* resolved = method->method_holder(); |
748 Symbol* h_name = method->name(); |
749 Symbol* h_name = method->name(); |
749 Symbol* h_signature = method->signature(); |
750 Symbol* h_signature = method->signature(); |
750 |
751 |
763 // LinkResolver::check_method_accessability for the matching logic. |
764 // LinkResolver::check_method_accessability for the matching logic. |
764 resolved = recv_klass; |
765 resolved = recv_klass; |
765 } |
766 } |
766 |
767 |
767 LinkInfo link_info(resolved, h_name, h_signature, caller_klass); |
768 LinkInfo link_info(resolved, h_name, h_signature, caller_klass); |
768 methodHandle m; |
769 Method* m = NULL; |
769 // Only do exact lookup if receiver klass has been linked. Otherwise, |
770 // Only do exact lookup if receiver klass has been linked. Otherwise, |
770 // the vtable has not been setup, and the LinkResolver will fail. |
771 // the vtable has not been setup, and the LinkResolver will fail. |
771 if (recv_klass->is_array_klass() || |
772 if (recv_klass->is_array_klass() || |
772 (InstanceKlass::cast(recv_klass)->is_linked() && !recv_klass->is_interface())) { |
773 (InstanceKlass::cast(recv_klass)->is_linked() && !recv_klass->is_interface())) { |
773 if (resolved->is_interface()) { |
774 if (resolved->is_interface()) { |
775 } else { |
776 } else { |
776 m = LinkResolver::resolve_virtual_call_or_null(recv_klass, link_info); |
777 m = LinkResolver::resolve_virtual_call_or_null(recv_klass, link_info); |
777 } |
778 } |
778 } |
779 } |
779 |
780 |
780 if (m.is_null()) { |
781 if (m == NULL) { |
781 // Return NULL if there was a problem with lookup (uninitialized class, etc.) |
782 // Return NULL if there was a problem with lookup (uninitialized class, etc.) |
782 return NULL; |
783 return NULL; |
783 } |
784 } |
784 |
785 |
785 JVMCIObject result = JVMCIENV->get_jvmci_method(m, JVMCI_CHECK_NULL); |
786 JVMCIObject result = JVMCIENV->get_jvmci_method(methodHandle(THREAD, m), JVMCI_CHECK_NULL); |
786 return JVMCIENV->get_jobject(result); |
787 return JVMCIENV->get_jobject(result); |
787 C2V_END |
788 C2V_END |
788 |
789 |
789 C2V_VMENTRY_0(jboolean, hasFinalizableSubclass,(JNIEnv* env, jobject, jobject jvmci_type)) |
790 C2V_VMENTRY_0(jboolean, hasFinalizableSubclass,(JNIEnv* env, jobject, jobject jvmci_type)) |
790 Klass* klass = JVMCIENV->asKlass(jvmci_type); |
791 Klass* klass = JVMCIENV->asKlass(jvmci_type); |
796 Klass* klass = JVMCIENV->asKlass(jvmci_type); |
797 Klass* klass = JVMCIENV->asKlass(jvmci_type); |
797 if (!klass->is_instance_klass()) { |
798 if (!klass->is_instance_klass()) { |
798 return NULL; |
799 return NULL; |
799 } |
800 } |
800 InstanceKlass* iklass = InstanceKlass::cast(klass); |
801 InstanceKlass* iklass = InstanceKlass::cast(klass); |
801 JVMCIObject result = JVMCIENV->get_jvmci_method(iklass->class_initializer(), JVMCI_CHECK_NULL); |
802 methodHandle clinit(THREAD, iklass->class_initializer()); |
|
803 JVMCIObject result = JVMCIENV->get_jvmci_method(clinit, JVMCI_CHECK_NULL); |
802 return JVMCIENV->get_jobject(result); |
804 return JVMCIENV->get_jobject(result); |
803 C2V_END |
805 C2V_END |
804 |
806 |
805 C2V_VMENTRY_0(jlong, getMaxCallTargetOffset, (JNIEnv* env, jobject, jlong addr)) |
807 C2V_VMENTRY_0(jlong, getMaxCallTargetOffset, (JNIEnv* env, jobject, jlong addr)) |
806 address target_addr = (address) addr; |
808 address target_addr = (address) addr; |
1007 C2V_END |
1009 C2V_END |
1008 |
1010 |
1009 C2V_VMENTRY_NULL(jobject, getStackTraceElement, (JNIEnv* env, jobject, jobject jvmci_method, int bci)) |
1011 C2V_VMENTRY_NULL(jobject, getStackTraceElement, (JNIEnv* env, jobject, jobject jvmci_method, int bci)) |
1010 HandleMark hm; |
1012 HandleMark hm; |
1011 |
1013 |
1012 methodHandle method = JVMCIENV->asMethod(jvmci_method); |
1014 methodHandle method(THREAD, JVMCIENV->asMethod(jvmci_method)); |
1013 JVMCIObject element = JVMCIENV->new_StackTraceElement(method, bci, JVMCI_CHECK_NULL); |
1015 JVMCIObject element = JVMCIENV->new_StackTraceElement(method, bci, JVMCI_CHECK_NULL); |
1014 return JVMCIENV->get_jobject(element); |
1016 return JVMCIENV->get_jobject(element); |
1015 C2V_END |
1017 C2V_END |
1016 |
1018 |
1017 C2V_VMENTRY_NULL(jobject, executeHotSpotNmethod, (JNIEnv* env, jobject, jobject args, jobject hs_nmethod)) |
1019 C2V_VMENTRY_NULL(jobject, executeHotSpotNmethod, (JNIEnv* env, jobject, jobject args, jobject hs_nmethod)) |
1024 JVMCIObject nmethod_mirror = JVMCIENV->wrap(hs_nmethod); |
1026 JVMCIObject nmethod_mirror = JVMCIENV->wrap(hs_nmethod); |
1025 nmethod* nm = JVMCIENV->asNmethod(nmethod_mirror); |
1027 nmethod* nm = JVMCIENV->asNmethod(nmethod_mirror); |
1026 if (nm == NULL) { |
1028 if (nm == NULL) { |
1027 JVMCI_THROW_NULL(InvalidInstalledCodeException); |
1029 JVMCI_THROW_NULL(InvalidInstalledCodeException); |
1028 } |
1030 } |
1029 methodHandle mh = nm->method(); |
1031 methodHandle mh(THREAD, nm->method()); |
1030 Symbol* signature = mh->signature(); |
1032 Symbol* signature = mh->signature(); |
1031 JavaCallArguments jca(mh->size_of_parameters()); |
1033 JavaCallArguments jca(mh->size_of_parameters()); |
1032 |
1034 |
1033 JavaArgumentUnboxer jap(signature, &jca, (arrayOop) JNIHandles::resolve(args), mh->is_static()); |
1035 JavaArgumentUnboxer jap(signature, &jca, (arrayOop) JNIHandles::resolve(args), mh->is_static()); |
1034 JavaValue result(jap.get_ret_type()); |
1036 JavaValue result(jap.get_ret_type()); |
1159 C2V_VMENTRY_0(jint, allocateCompileId, (JNIEnv* env, jobject, jobject jvmci_method, int entry_bci)) |
1161 C2V_VMENTRY_0(jint, allocateCompileId, (JNIEnv* env, jobject, jobject jvmci_method, int entry_bci)) |
1160 HandleMark hm; |
1162 HandleMark hm; |
1161 if (jvmci_method == NULL) { |
1163 if (jvmci_method == NULL) { |
1162 JVMCI_THROW_0(NullPointerException); |
1164 JVMCI_THROW_0(NullPointerException); |
1163 } |
1165 } |
1164 Method* method = JVMCIENV->asMethod(jvmci_method); |
1166 methodHandle method(THREAD, JVMCIENV->asMethod(jvmci_method)); |
1165 if (entry_bci >= method->code_size() || entry_bci < -1) { |
1167 if (entry_bci >= method->code_size() || entry_bci < -1) { |
1166 JVMCI_THROW_MSG_0(IllegalArgumentException, err_msg("Unexpected bci %d", entry_bci)); |
1168 JVMCI_THROW_MSG_0(IllegalArgumentException, err_msg("Unexpected bci %d", entry_bci)); |
1167 } |
1169 } |
1168 return CompileBroker::assign_compile_id_unlocked(THREAD, method, entry_bci); |
1170 return CompileBroker::assign_compile_id_unlocked(THREAD, method, entry_bci); |
1169 C2V_END |
1171 C2V_END |
1201 Handle receiver = args->receiver(); |
1203 Handle receiver = args->receiver(); |
1202 Klass* recvrKlass = receiver.is_null() ? (Klass*)NULL : receiver->klass(); |
1204 Klass* recvrKlass = receiver.is_null() ? (Klass*)NULL : receiver->klass(); |
1203 LinkInfo link_info(spec_klass, name, signature); |
1205 LinkInfo link_info(spec_klass, name, signature); |
1204 LinkResolver::resolve_interface_call( |
1206 LinkResolver::resolve_interface_call( |
1205 callinfo, receiver, recvrKlass, link_info, true, CHECK); |
1207 callinfo, receiver, recvrKlass, link_info, true, CHECK); |
1206 methodHandle method = callinfo.selected_method(); |
1208 methodHandle method(THREAD, callinfo.selected_method()); |
1207 assert(method.not_null(), "should have thrown exception"); |
1209 assert(method.not_null(), "should have thrown exception"); |
1208 |
1210 |
1209 // Invoke the method |
1211 // Invoke the method |
1210 JavaCalls::call(result, method, args, CHECK); |
1212 JavaCalls::call(result, method, args, CHECK); |
1211 } |
1213 } |
1275 HotSpotJVMCI::HotSpotStackFrameReference::set_localIsVirtual(JVMCIENV, frame_reference(), NULL); |
1277 HotSpotJVMCI::HotSpotStackFrameReference::set_localIsVirtual(JVMCIENV, frame_reference(), NULL); |
1276 } |
1278 } |
1277 |
1279 |
1278 locals = cvf->locals(); |
1280 locals = cvf->locals(); |
1279 HotSpotJVMCI::HotSpotStackFrameReference::set_bci(JVMCIENV, frame_reference(), cvf->bci()); |
1281 HotSpotJVMCI::HotSpotStackFrameReference::set_bci(JVMCIENV, frame_reference(), cvf->bci()); |
1280 JVMCIObject method = JVMCIENV->get_jvmci_method(cvf->method(), JVMCI_CHECK_NULL); |
1282 methodHandle mh(THREAD, cvf->method()); |
|
1283 JVMCIObject method = JVMCIENV->get_jvmci_method(mh, JVMCI_CHECK_NULL); |
1281 HotSpotJVMCI::HotSpotStackFrameReference::set_method(JVMCIENV, frame_reference(), JNIHandles::resolve(method.as_jobject())); |
1284 HotSpotJVMCI::HotSpotStackFrameReference::set_method(JVMCIENV, frame_reference(), JNIHandles::resolve(method.as_jobject())); |
1282 } |
1285 } |
1283 } |
1286 } |
1284 } else if (vf->is_interpreted_frame()) { |
1287 } else if (vf->is_interpreted_frame()) { |
1285 // interpreted method frame |
1288 // interpreted method frame |
1288 if (initialSkip > 0) { |
1291 if (initialSkip > 0) { |
1289 initialSkip--; |
1292 initialSkip--; |
1290 } else { |
1293 } else { |
1291 locals = ivf->locals(); |
1294 locals = ivf->locals(); |
1292 HotSpotJVMCI::HotSpotStackFrameReference::set_bci(JVMCIENV, frame_reference(), ivf->bci()); |
1295 HotSpotJVMCI::HotSpotStackFrameReference::set_bci(JVMCIENV, frame_reference(), ivf->bci()); |
1293 JVMCIObject method = JVMCIENV->get_jvmci_method(ivf->method(), JVMCI_CHECK_NULL); |
1296 methodHandle mh(THREAD, ivf->method()); |
|
1297 JVMCIObject method = JVMCIENV->get_jvmci_method(mh, JVMCI_CHECK_NULL); |
1294 HotSpotJVMCI::HotSpotStackFrameReference::set_method(JVMCIENV, frame_reference(), JNIHandles::resolve(method.as_jobject())); |
1298 HotSpotJVMCI::HotSpotStackFrameReference::set_method(JVMCIENV, frame_reference(), JNIHandles::resolve(method.as_jobject())); |
1295 HotSpotJVMCI::HotSpotStackFrameReference::set_localIsVirtual(JVMCIENV, frame_reference(), NULL); |
1299 HotSpotJVMCI::HotSpotStackFrameReference::set_localIsVirtual(JVMCIENV, frame_reference(), NULL); |
1296 } |
1300 } |
1297 } |
1301 } |
1298 } |
1302 } |
1368 // the end was reached without finding a matching method |
1372 // the end was reached without finding a matching method |
1369 return NULL; |
1373 return NULL; |
1370 C2V_END |
1374 C2V_END |
1371 |
1375 |
1372 C2V_VMENTRY(void, resolveInvokeDynamicInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index)) |
1376 C2V_VMENTRY(void, resolveInvokeDynamicInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index)) |
1373 constantPoolHandle cp = JVMCIENV->asConstantPool(jvmci_constant_pool); |
1377 constantPoolHandle cp(THREAD, JVMCIENV->asConstantPool(jvmci_constant_pool)); |
1374 CallInfo callInfo; |
1378 CallInfo callInfo; |
1375 LinkResolver::resolve_invoke(callInfo, Handle(), cp, index, Bytecodes::_invokedynamic, CHECK); |
1379 LinkResolver::resolve_invoke(callInfo, Handle(), cp, index, Bytecodes::_invokedynamic, CHECK); |
1376 ConstantPoolCacheEntry* cp_cache_entry = cp->invokedynamic_cp_cache_entry_at(index); |
1380 ConstantPoolCacheEntry* cp_cache_entry = cp->invokedynamic_cp_cache_entry_at(index); |
1377 cp_cache_entry->set_dynamic_call(cp, callInfo); |
1381 cp_cache_entry->set_dynamic_call(cp, callInfo); |
1378 C2V_END |
1382 C2V_END |
1379 |
1383 |
1380 C2V_VMENTRY(void, resolveInvokeHandleInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index)) |
1384 C2V_VMENTRY(void, resolveInvokeHandleInPool, (JNIEnv* env, jobject, jobject jvmci_constant_pool, jint index)) |
1381 constantPoolHandle cp = JVMCIENV->asConstantPool(jvmci_constant_pool); |
1385 constantPoolHandle cp(THREAD, JVMCIENV->asConstantPool(jvmci_constant_pool)); |
1382 Klass* holder = cp->klass_ref_at(index, CHECK); |
1386 Klass* holder = cp->klass_ref_at(index, CHECK); |
1383 Symbol* name = cp->name_ref_at(index); |
1387 Symbol* name = cp->name_ref_at(index); |
1384 if (MethodHandles::is_signature_polymorphic_name(holder, name)) { |
1388 if (MethodHandles::is_signature_polymorphic_name(holder, name)) { |
1385 CallInfo callInfo; |
1389 CallInfo callInfo; |
1386 LinkResolver::resolve_invoke(callInfo, Handle(), cp, index, Bytecodes::_invokehandle, CHECK); |
1390 LinkResolver::resolve_invoke(callInfo, Handle(), cp, index, Bytecodes::_invokehandle, CHECK); |
1403 Symbol* name_sym = cp->name_ref_at(index); |
1407 Symbol* name_sym = cp->name_ref_at(index); |
1404 |
1408 |
1405 vmassert(MethodHandles::is_method_handle_invoke_name(resolved_klass, name_sym), "!"); |
1409 vmassert(MethodHandles::is_method_handle_invoke_name(resolved_klass, name_sym), "!"); |
1406 vmassert(MethodHandles::is_signature_polymorphic_name(resolved_klass, name_sym), "!"); |
1410 vmassert(MethodHandles::is_signature_polymorphic_name(resolved_klass, name_sym), "!"); |
1407 |
1411 |
1408 methodHandle adapter_method(cp_cache_entry->f1_as_method()); |
1412 methodHandle adapter_method(THREAD, cp_cache_entry->f1_as_method()); |
1409 |
1413 |
1410 methodHandle resolved_method(adapter_method); |
1414 methodHandle resolved_method(adapter_method); |
1411 |
1415 |
1412 // Can we treat it as a regular invokevirtual? |
1416 // Can we treat it as a regular invokevirtual? |
1413 if (resolved_method->method_holder() == resolved_klass && resolved_method->name() == name_sym) { |
1417 if (resolved_method->method_holder() == resolved_klass && resolved_method->name() == name_sym) { |
1414 vmassert(!resolved_method->is_static(),"!"); |
1418 vmassert(!resolved_method->is_static(),"!"); |
1415 vmassert(MethodHandles::is_signature_polymorphic_method(resolved_method()),"!"); |
1419 vmassert(MethodHandles::is_signature_polymorphic_method(resolved_method()),"!"); |
1416 vmassert(!MethodHandles::is_signature_polymorphic_static(resolved_method->intrinsic_id()), "!"); |
1420 vmassert(!MethodHandles::is_signature_polymorphic_static(resolved_method->intrinsic_id()), "!"); |
1417 vmassert(cp_cache_entry->appendix_if_resolved(cp) == NULL, "!"); |
1421 vmassert(cp_cache_entry->appendix_if_resolved(cp) == NULL, "!"); |
1418 |
1422 |
1419 methodHandle m(LinkResolver::linktime_resolve_virtual_method_or_null(link_info)); |
1423 methodHandle m(THREAD, LinkResolver::linktime_resolve_virtual_method_or_null(link_info)); |
1420 vmassert(m == resolved_method, "!!"); |
1424 vmassert(m == resolved_method, "!!"); |
1421 return -1; |
1425 return -1; |
1422 } |
1426 } |
1423 |
1427 |
1424 return Bytecodes::_invokevirtual; |
1428 return Bytecodes::_invokevirtual; |
2423 JVMCIEnv* thisEnv = JVMCIENV; |
2429 JVMCIEnv* thisEnv = JVMCIENV; |
2424 |
2430 |
2425 JVMCIObject obj = thisEnv->wrap(obj_handle); |
2431 JVMCIObject obj = thisEnv->wrap(obj_handle); |
2426 JVMCIObject result; |
2432 JVMCIObject result; |
2427 if (thisEnv->isa_HotSpotResolvedJavaMethodImpl(obj)) { |
2433 if (thisEnv->isa_HotSpotResolvedJavaMethodImpl(obj)) { |
2428 Method* method = thisEnv->asMethod(obj); |
2434 methodHandle method(THREAD, thisEnv->asMethod(obj)); |
2429 result = peerEnv->get_jvmci_method(method, JVMCI_CHECK_0); |
2435 result = peerEnv->get_jvmci_method(method, JVMCI_CHECK_0); |
2430 } else if (thisEnv->isa_HotSpotResolvedObjectTypeImpl(obj)) { |
2436 } else if (thisEnv->isa_HotSpotResolvedObjectTypeImpl(obj)) { |
2431 Klass* klass = thisEnv->asKlass(obj); |
2437 Klass* klass = thisEnv->asKlass(obj); |
2432 JVMCIKlassHandle klass_handle(THREAD); |
2438 JVMCIKlassHandle klass_handle(THREAD); |
2433 klass_handle = klass; |
2439 klass_handle = klass; |
2454 } |
2460 } |
2455 } |
2461 } |
2456 } |
2462 } |
2457 if (result.is_null()) { |
2463 if (result.is_null()) { |
2458 JVMCIObject methodObject = thisEnv->get_HotSpotNmethod_method(obj); |
2464 JVMCIObject methodObject = thisEnv->get_HotSpotNmethod_method(obj); |
2459 methodHandle mh = thisEnv->asMethod(methodObject); |
2465 methodHandle mh(THREAD, thisEnv->asMethod(methodObject)); |
2460 jboolean isDefault = thisEnv->get_HotSpotNmethod_isDefault(obj); |
2466 jboolean isDefault = thisEnv->get_HotSpotNmethod_isDefault(obj); |
2461 jlong compileIdSnapshot = thisEnv->get_HotSpotNmethod_compileIdSnapshot(obj); |
2467 jlong compileIdSnapshot = thisEnv->get_HotSpotNmethod_compileIdSnapshot(obj); |
2462 JVMCIObject name_string = thisEnv->get_InstalledCode_name(obj); |
2468 JVMCIObject name_string = thisEnv->get_InstalledCode_name(obj); |
2463 const char* cstring = name_string.is_null() ? NULL : thisEnv->as_utf8_string(name_string); |
2469 const char* cstring = name_string.is_null() ? NULL : thisEnv->as_utf8_string(name_string); |
2464 // Create a new HotSpotNmethod instance in the peer runtime |
2470 // Create a new HotSpotNmethod instance in the peer runtime |
2465 result = peerEnv->new_HotSpotNmethod(mh(), cstring, isDefault, compileIdSnapshot, JVMCI_CHECK_0); |
2471 result = peerEnv->new_HotSpotNmethod(mh, cstring, isDefault, compileIdSnapshot, JVMCI_CHECK_0); |
2466 if (nm == NULL) { |
2472 if (nm == NULL) { |
2467 // nmethod must have been unloaded |
2473 // nmethod must have been unloaded |
2468 } else { |
2474 } else { |
2469 // Link the new HotSpotNmethod to the nmethod |
2475 // Link the new HotSpotNmethod to the nmethod |
2470 peerEnv->initialize_installed_code(result, nm, JVMCI_CHECK_0); |
2476 peerEnv->initialize_installed_code(result, nm, JVMCI_CHECK_0); |
2520 return JVMCIENV->get_jbyteArray(result); |
2526 return JVMCIENV->get_jbyteArray(result); |
2521 } |
2527 } |
2522 |
2528 |
2523 C2V_VMENTRY_NULL(jobject, asReflectionExecutable, (JNIEnv* env, jobject, jobject jvmci_method)) |
2529 C2V_VMENTRY_NULL(jobject, asReflectionExecutable, (JNIEnv* env, jobject, jobject jvmci_method)) |
2524 requireInHotSpot("asReflectionExecutable", JVMCI_CHECK_NULL); |
2530 requireInHotSpot("asReflectionExecutable", JVMCI_CHECK_NULL); |
2525 methodHandle m = JVMCIENV->asMethod(jvmci_method); |
2531 methodHandle m(THREAD, JVMCIENV->asMethod(jvmci_method)); |
2526 oop executable; |
2532 oop executable; |
2527 if (m->is_initializer()) { |
2533 if (m->is_initializer()) { |
2528 if (m->is_static_initializer()) { |
2534 if (m->is_static_initializer()) { |
2529 JVMCI_THROW_MSG_NULL(IllegalArgumentException, |
2535 JVMCI_THROW_MSG_NULL(IllegalArgumentException, |
2530 "Cannot create java.lang.reflect.Method for class initializer"); |
2536 "Cannot create java.lang.reflect.Method for class initializer"); |
2585 } |
2591 } |
2586 return JVMCIENV->get_jobjectArray(result); |
2592 return JVMCIENV->get_jobjectArray(result); |
2587 } |
2593 } |
2588 |
2594 |
2589 C2V_VMENTRY_0(jlong, getFailedSpeculationsAddress, (JNIEnv* env, jobject, jobject jvmci_method)) |
2595 C2V_VMENTRY_0(jlong, getFailedSpeculationsAddress, (JNIEnv* env, jobject, jobject jvmci_method)) |
2590 methodHandle method = JVMCIENV->asMethod(jvmci_method); |
2596 methodHandle method(THREAD, JVMCIENV->asMethod(jvmci_method)); |
2591 MethodData* method_data = method->method_data(); |
2597 MethodData* method_data = method->method_data(); |
2592 if (method_data == NULL) { |
2598 if (method_data == NULL) { |
2593 ClassLoaderData* loader_data = method->method_holder()->class_loader_data(); |
2599 ClassLoaderData* loader_data = method->method_holder()->class_loader_data(); |
2594 method_data = MethodData::allocate(loader_data, method, CHECK_0); |
2600 method_data = MethodData::allocate(loader_data, method, CHECK_0); |
2595 method->set_method_data(method_data); |
2601 method->set_method_data(method_data); |