Mercurial > hg > graal-compiler
comparison src/share/vm/graal/graalVMEntries.cpp @ 3637:ff6a991c6e3c
Use GraalEnv to look up types.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 16 Nov 2011 01:48:25 +0100 |
parents | c7d4198a9bce |
children | e53cfcb230a7 |
comparison
equal
deleted
inserted
replaced
3636:c7d4198a9bce | 3637:ff6a991c6e3c |
---|---|
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 | 23 |
24 #include "precompiled.hpp" | 24 #include "precompiled.hpp" |
25 #include "runtime/fieldDescriptor.hpp" | |
25 #include "c1/c1_Runtime1.hpp" | 26 #include "c1/c1_Runtime1.hpp" |
26 #include "ci/ciMethodData.hpp" | 27 #include "ci/ciMethodData.hpp" |
27 #include "compiler/compileBroker.hpp" | 28 #include "compiler/compileBroker.hpp" |
28 #include "graal/graalVMEntries.hpp" | 29 #include "graal/graalVMEntries.hpp" |
29 #include "graal/graalCompiler.hpp" | 30 #include "graal/graalCompiler.hpp" |
31 #include "graal/graalEnv.hpp" | |
30 #include "graal/graalJavaAccess.hpp" | 32 #include "graal/graalJavaAccess.hpp" |
31 #include "graal/graalCodeInstaller.hpp" | 33 #include "graal/graalCodeInstaller.hpp" |
32 #include "graal/graalVMExits.hpp" | 34 #include "graal/graalVMExits.hpp" |
33 #include "graal/graalVmIds.hpp" | 35 #include "graal/graalVmIds.hpp" |
34 #include "memory/oopFactory.hpp" | 36 #include "memory/oopFactory.hpp" |
118 | 120 |
119 if (catch_class_index == 0) { | 121 if (catch_class_index == 0) { |
120 HotSpotExceptionHandler::set_catchClass(entry, NULL); | 122 HotSpotExceptionHandler::set_catchClass(entry, NULL); |
121 } else { | 123 } else { |
122 constantPoolOop cp = instanceKlass::cast(method->method_holder())->constants(); | 124 constantPoolOop cp = instanceKlass::cast(method->method_holder())->constants(); |
123 ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(method->method_holder()); | 125 KlassHandle loading_klass = method->method_holder(); |
124 bool is_accessible = false; | 126 oop catch_class = GraalCompiler::get_RiType(cp, catch_class_index, loading_klass, CHECK_NULL); |
125 ciKlass *klass = CURRENT_ENV->get_klass_by_index(cp, catch_class_index, is_accessible, loading_klass); | |
126 oop catch_class = GraalCompiler::get_RiType(klass, method->method_holder(), CHECK_NULL); | |
127 | |
128 HotSpotExceptionHandler::set_catchClass(entry, catch_class); | 127 HotSpotExceptionHandler::set_catchClass(entry, catch_class); |
129 } | 128 } |
130 array->obj_at_put(i, entry()); | 129 array->obj_at_put(i, entry()); |
131 } | 130 } |
132 | 131 |
306 for (uint i = 0; i < recv->row_limit(); i++) { | 305 for (uint i = 0; i < recv->row_limit(); i++) { |
307 KlassHandle receiver = recv->receiver(i); | 306 KlassHandle receiver = recv->receiver(i); |
308 if (receiver.is_null()) continue; | 307 if (receiver.is_null()) continue; |
309 | 308 |
310 float prob = recv->receiver_count(i) / (float) total_count; | 309 float prob = recv->receiver_count(i) / (float) total_count; |
311 oop type = GraalCompiler::get_RiType(receiver, KlassHandle(), CHECK_NULL); | 310 oop type = GraalCompiler::get_RiType(receiver, CHECK_NULL); |
312 | 311 |
313 probabilities->float_at_put(pos, prob); | 312 probabilities->float_at_put(pos, prob); |
314 types->obj_at_put(pos, type); | 313 types->obj_at_put(pos, type); |
315 | 314 |
316 pos++; | 315 pos++; |
510 } | 509 } |
511 } | 510 } |
512 result = VMExits::createCiConstantObject(string, CHECK_0); | 511 result = VMExits::createCiConstantObject(string, CHECK_0); |
513 } else if (tag.is_klass() || tag.is_unresolved_klass()) { | 512 } else if (tag.is_klass() || tag.is_unresolved_klass()) { |
514 bool ignore; | 513 bool ignore; |
515 ciInstanceKlass* accessor = (ciInstanceKlass*) ciEnv::current()->get_object(cp->pool_holder()); | 514 KlassHandle klass = GraalEnv::get_klass_by_index(cp, index, ignore, cp->pool_holder()); |
516 ciKlass* klass = ciEnv::current()->get_klass_by_index(cp, index, ignore, accessor); | 515 result = GraalCompiler::get_RiType(klass, CHECK_NULL); |
517 result = GraalCompiler::get_RiType(klass, cp->pool_holder(), CHECK_NULL); | |
518 } else if (tag.is_object()) { | 516 } else if (tag.is_object()) { |
519 oop obj = cp->object_at(index); | 517 oop obj = cp->object_at(index); |
520 assert(obj->is_instance(), "must be an instance"); | 518 assert(obj->is_instance(), "must be an instance"); |
521 result = VMExits::createCiConstantObject(obj, CHECK_NULL); | 519 result = VMExits::createCiConstantObject(obj, CHECK_NULL); |
522 } else { | 520 } else { |
529 // public RiMethod RiConstantPool_lookupMethod(long vmId, int cpi, byte byteCode); | 527 // public RiMethod RiConstantPool_lookupMethod(long vmId, int cpi, byte byteCode); |
530 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiConstantPool_1lookupMethod(JNIEnv *env, jobject, jobject type, jint index, jbyte byteCode) { | 528 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiConstantPool_1lookupMethod(JNIEnv *env, jobject, jobject type, jint index, jbyte byteCode) { |
531 TRACE_graal_3("VMEntries::RiConstantPool_lookupMethod"); | 529 TRACE_graal_3("VMEntries::RiConstantPool_lookupMethod"); |
532 VM_ENTRY_MARK; | 530 VM_ENTRY_MARK; |
533 index = GraalCompiler::to_cp_index_u2(index); | 531 index = GraalCompiler::to_cp_index_u2(index); |
534 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); | 532 constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); |
535 | 533 |
536 Bytecodes::Code bc = (Bytecodes::Code) (((int) byteCode) & 0xFF); | 534 Bytecodes::Code bc = (Bytecodes::Code) (((int) byteCode) & 0xFF); |
537 ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(cp->pool_holder()); | 535 ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(cp->pool_holder()); |
538 ciMethod *cimethod = CURRENT_ENV->get_method_by_index(cp, index, bc, loading_klass); | 536 ciMethod *cimethod = CURRENT_ENV->get_method_by_index(cp, index, bc, loading_klass); |
539 if (cimethod->is_loaded()) { | 537 if (cimethod->is_loaded()) { |
540 methodOop method = (methodOop) cimethod->get_oop(); | 538 methodOop method = (methodOop) cimethod->get_oop(); |
541 oop ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL); | 539 oop ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL); |
542 return JNIHandles::make_local(THREAD, ret); | 540 return JNIHandles::make_local(THREAD, ret); |
543 } else { | 541 } else { |
544 Handle name = VmIds::toString<Handle>(cimethod->name()->get_symbol(), CHECK_NULL); | 542 // Get the method's name and signature. |
545 Handle signature = VmIds::toString<Handle>(cimethod->signature()->as_symbol()->get_symbol(), CHECK_NULL); | 543 Handle name = VmIds::toString<Handle>(cp->name_ref_at(index), CHECK_NULL); |
546 Handle holder = GraalCompiler::get_RiType(cimethod->holder(), cp->klass(), THREAD); | 544 Handle signature = VmIds::toString<Handle>(cp->signature_ref_at(index), CHECK_NULL); |
547 return JNIHandles::make_local(THREAD, VMExits::createRiMethodUnresolved(name, signature, holder, THREAD)); | 545 int holder_index = cp->klass_ref_index_at(index); |
546 Handle type = GraalCompiler::get_RiType(cp, holder_index, cp->pool_holder(), CHECK_NULL); | |
547 return JNIHandles::make_local(THREAD, VMExits::createRiMethodUnresolved(name, signature, type, THREAD)); | |
548 } | 548 } |
549 } | 549 } |
550 | 550 |
551 // public RiType RiConstantPool_lookupType(long vmId, int cpi); | 551 // public RiType RiConstantPool_lookupType(long vmId, int cpi); |
552 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiConstantPool_1lookupType(JNIEnv *env, jobject, jobject type, jint index) { | 552 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiConstantPool_1lookupType(JNIEnv *env, jobject, jobject type, jint index) { |
553 TRACE_graal_3("VMEntries::RiConstantPool_lookupType"); | 553 TRACE_graal_3("VMEntries::RiConstantPool_lookupType"); |
554 VM_ENTRY_MARK; | 554 VM_ENTRY_MARK; |
555 | 555 |
556 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); | 556 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); |
557 | 557 oop result = GraalCompiler::get_RiType(cp, index, cp->pool_holder(), CHECK_NULL); |
558 ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(cp->pool_holder()); | 558 return JNIHandles::make_local(THREAD, result); |
559 bool is_accessible = false; | |
560 ciKlass *klass = CURRENT_ENV->get_klass_by_index(cp, index, is_accessible, loading_klass); | |
561 return JNIHandles::make_local(THREAD, GraalCompiler::get_RiType(klass, cp->klass(), THREAD)); | |
562 } | 559 } |
563 | 560 |
564 // public void RiConstantPool_loadReferencedType(long vmId, int cpi); | 561 // public void RiConstantPool_loadReferencedType(long vmId, int cpi); |
565 JNIEXPORT void JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiConstantPool_1loadReferencedType(JNIEnv *env, jobject, jobject type, jint index, jbyte op) { | 562 JNIEXPORT void JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiConstantPool_1loadReferencedType(JNIEnv *env, jobject, jobject type, jint index, jbyte op) { |
566 TRACE_graal_3("VMEntries::RiConstantPool_lookupType"); | 563 TRACE_graal_3("VMEntries::RiConstantPool_lookupType"); |
584 } | 581 } |
585 } | 582 } |
586 } | 583 } |
587 | 584 |
588 // public RiField RiConstantPool_lookupField(long vmId, int cpi); | 585 // public RiField RiConstantPool_lookupField(long vmId, int cpi); |
589 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiConstantPool_1lookupField(JNIEnv *env, jobject, jobject type, jint index, jbyte byteCode) { | 586 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiConstantPool_1lookupField(JNIEnv *env, jobject, jobject constantPoolHolder, jint index, jbyte byteCode) { |
590 TRACE_graal_3("VMEntries::RiConstantPool_lookupField"); | 587 TRACE_graal_3("VMEntries::RiConstantPool_lookupField"); |
591 VM_ENTRY_MARK; | 588 VM_ENTRY_MARK; |
592 | 589 |
593 index = GraalCompiler::to_cp_index_u2(index); | 590 index = GraalCompiler::to_cp_index_u2(index); |
594 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); | 591 constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(constantPoolHolder)))->constants(); |
595 | 592 |
596 ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(cp->pool_holder()); | 593 ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(cp->pool_holder()); |
597 ciField *field = CURRENT_ENV->get_field_by_index(loading_klass, index); | 594 ciField *field = CURRENT_ENV->get_field_by_index(loading_klass, index); |
598 | 595 |
596 int nt_index = cp->name_and_type_ref_index_at(index); | |
597 int sig_index = cp->signature_ref_index_at(nt_index); | |
598 Symbol* signature = cp->symbol_at(sig_index); | |
599 int holder_index = cp->klass_ref_index_at(index); | |
600 Handle holder = GraalCompiler::get_RiType(cp, holder_index, cp->pool_holder(), CHECK_NULL); | |
601 | |
599 Bytecodes::Code code = (Bytecodes::Code)(((int) byteCode) & 0xFF); | 602 Bytecodes::Code code = (Bytecodes::Code)(((int) byteCode) & 0xFF); |
600 Handle field_handle = GraalCompiler::get_RiField(field, loading_klass, cp->pool_holder(), code, THREAD); | 603 if (holder->klass() == SystemDictionary::HotSpotTypeResolved_klass()) { |
604 FieldAccessInfo result; | |
605 LinkResolver::resolve_field(result, cp, index, | |
606 Bytecodes::java_code(code), | |
607 true, false, Thread::current()); | |
608 if (HAS_PENDING_EXCEPTION) { | |
609 CLEAR_PENDING_EXCEPTION; | |
610 } | |
611 //result.field_offset(); | |
612 holder = GraalCompiler::get_RiType(result.klass(), CHECK_NULL); | |
613 } | |
614 | |
615 Handle type = GraalCompiler::get_RiTypeFromSignature(cp, sig_index, cp->pool_holder(), CHECK_NULL); | |
616 Handle field_handle = GraalCompiler::get_RiField(field, loading_klass, holder, type, code, THREAD); | |
601 bool is_constant = field->is_constant(); | 617 bool is_constant = field->is_constant(); |
602 if (is_constant && field->is_static()) { | 618 if (is_constant && field->is_static()) { |
603 ciConstant constant = field->constant_value(); | 619 ciConstant constant = field->constant_value(); |
604 oop constant_object = NULL; | 620 oop constant_object = NULL; |
605 switch (constant.basic_type()) { | 621 switch (constant.basic_type()) { |
690 } | 706 } |
691 | 707 |
692 // public RiType RiType_componentType(HotSpotResolvedType klass); | 708 // public RiType RiType_componentType(HotSpotResolvedType klass); |
693 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiType_1componentType(JNIEnv *, jobject, jobject klass) { | 709 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiType_1componentType(JNIEnv *, jobject, jobject klass) { |
694 TRACE_graal_3("VMEntries::RiType_componentType"); | 710 TRACE_graal_3("VMEntries::RiType_componentType"); |
695 ciArrayKlass* array_klass; | 711 VM_ENTRY_MARK; |
696 { | 712 KlassHandle array_klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); |
697 VM_ENTRY_MARK; | 713 assert(array_klass->oop_is_objArray(), "just checking"); |
698 assert(JNIHandles::resolve(klass) != NULL, ""); | 714 klassOop element_type = objArrayKlass::cast(array_klass())->element_klass(); |
699 array_klass = (ciArrayKlass *) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); | |
700 } | |
701 ciType* element_type = array_klass->element_type(); | |
702 | |
703 VM_ENTRY_MARK; | |
704 assert(JNIHandles::resolve(klass) != NULL, ""); | 715 assert(JNIHandles::resolve(klass) != NULL, ""); |
705 return JNIHandles::make_local(GraalCompiler::get_RiType(element_type, java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)), THREAD)); | 716 return JNIHandles::make_local(GraalCompiler::get_RiType(element_type, THREAD)); |
706 } | 717 } |
707 | 718 |
708 // public RiType RiType_superType(HotSpotResolvedType klass); | 719 // public RiType RiType_superType(HotSpotResolvedType klass); |
709 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiType_1superType(JNIEnv *, jobject, jobject klass) { | 720 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiType_1superType(JNIEnv *, jobject, jobject klass) { |
710 TRACE_graal_3("VMEntries::RiType_superType"); | 721 TRACE_graal_3("VMEntries::RiType_superType"); |
711 VM_ENTRY_MARK; | 722 VM_ENTRY_MARK; |
712 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); | 723 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); |
713 ciInstanceKlass* k = NULL; | 724 klassOop k; |
714 | 725 |
715 if (klass_handle->oop_is_array()) { | 726 if (klass_handle->oop_is_array()) { |
716 k = (ciInstanceKlass *) CURRENT_ENV->get_object(SystemDictionary::Object_klass()); | 727 k = SystemDictionary::Object_klass(); |
717 } else { | 728 } else { |
718 guarantee(klass_handle->oop_is_instance(), "must be instance klass"); | 729 guarantee(klass_handle->oop_is_instance(), "must be instance klass"); |
719 k = (ciInstanceKlass *) CURRENT_ENV->get_object(klass_handle()); | 730 k = klass_handle->super(); |
720 k = k->super(); | |
721 } | 731 } |
722 | 732 |
723 if (k != NULL) { | 733 if (k != NULL) { |
724 return JNIHandles::make_local(GraalCompiler::get_RiType(k, klass_handle, THREAD)); | 734 return JNIHandles::make_local(GraalCompiler::get_RiType(k, THREAD)); |
725 } else { | 735 } else { |
726 return NULL; | 736 return NULL; |
727 } | 737 } |
728 } | 738 } |
729 | 739 |
730 // public RiType RiType_uniqueConcreteSubtype(HotSpotResolvedType klass); | 740 // public RiType RiType_uniqueConcreteSubtype(HotSpotResolvedType klass); |
731 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiType_1uniqueConcreteSubtype(JNIEnv *, jobject, jobject klass) { | 741 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiType_1uniqueConcreteSubtype(JNIEnv *, jobject, jobject klass) { |
732 TRACE_graal_3("VMEntries::RiType_uniqueConcreteSubtype"); | 742 TRACE_graal_3("VMEntries::RiType_uniqueConcreteSubtype"); |
733 Thread* THREAD = Thread::current(); | 743 VM_ENTRY_MARK; |
734 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); | 744 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); |
735 ciInstanceKlass* k = NULL; | 745 Klass *up_cast = klass_handle->up_cast_abstract(); |
736 { | 746 if (up_cast->is_leaf_class()) { |
737 VM_ENTRY_MARK; | 747 return JNIHandles::make_local(GraalCompiler::get_RiType(up_cast, THREAD)); |
738 k = (ciInstanceKlass *) CURRENT_ENV->get_object(klass_handle()); | 748 } |
739 } | |
740 | |
741 if (k->is_abstract()) { | |
742 ciInstanceKlass* sub = k->unique_concrete_subklass(); | |
743 if (sub != NULL && sub->is_leaf_type()) { | |
744 VM_ENTRY_MARK; | |
745 return JNIHandles::make_local(GraalCompiler::get_RiType(sub, klass_handle, THREAD)); | |
746 } | |
747 } else if (k->is_leaf_type()) { | |
748 assert(!k->is_interface(), ""); | |
749 return klass; | |
750 } | |
751 | |
752 return NULL; | 749 return NULL; |
753 } | 750 } |
754 | 751 |
755 // public bool RiType_isInitialized(HotSpotResolvedType klass); | 752 // public bool RiType_isInitialized(HotSpotResolvedType klass); |
756 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiType_1isInitialized(JNIEnv *, jobject, jobject hotspot_klass) { | 753 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiType_1isInitialized(JNIEnv *, jobject, jobject hotspot_klass) { |
772 } | 769 } |
773 | 770 |
774 // public RiField[] RiType_fields(HotSpotTypeResolved klass); | 771 // public RiField[] RiType_fields(HotSpotTypeResolved klass); |
775 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiType_1fields(JNIEnv *, jobject, jobject klass) { | 772 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiType_1fields(JNIEnv *, jobject, jobject klass) { |
776 TRACE_graal_3("VMEntries::RiType_fields"); | 773 TRACE_graal_3("VMEntries::RiType_fields"); |
777 KlassHandle klass_handle; | 774 VM_ENTRY_MARK; |
778 ciInstanceKlass* instance_klass; | 775 |
779 objArrayHandle fieldsArray; | 776 instanceKlassHandle k = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); |
780 HandleMark hm; | 777 objArrayHandle field_array = oopFactory::new_objArray(SystemDictionary::RiField_klass(), k->fields()->length() / instanceKlass::next_offset, CHECK_NULL); |
781 { | 778 class MyFieldClosure : public FieldClosure { |
782 VM_ENTRY_MARK; | 779 public: |
783 klass_handle = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); | 780 instanceKlassHandle _holder; |
784 instance_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(klass_handle()); | 781 Handle _resolved_type_holder; |
785 } | 782 objArrayHandle _field_array; |
786 GrowableArray<ciField*>* fields = instance_klass->non_static_fields(); | 783 int _current; |
787 { | 784 |
788 VM_ENTRY_MARK; | 785 MyFieldClosure(instanceKlassHandle& holder, Handle resolved_type_holder, objArrayHandle field_array) : _holder(holder), _resolved_type_holder(resolved_type_holder), _field_array(field_array), _current(0) { } |
789 | 786 |
790 int count = 0; | 787 virtual void do_field(fieldDescriptor* fd) { |
791 for (int i = 0; i < fields->length(); i++) { | 788 if (!Thread::current()->has_pending_exception()) { |
792 ciField* field = fields->at(i); | 789 if (fd->field_holder() == _holder()) { |
793 if (field->holder() == instance_klass) { | 790 Handle type = GraalCompiler::get_RiTypeFromSignature(fd->constants(), fd->signature_index(), fd->field_holder(), Thread::current()); |
794 count++; | 791 Handle field = VMExits::createRiField(_resolved_type_holder, VmIds::toString<Handle>(fd->name(), Thread::current()), type, fd->offset(), fd->access_flags().as_int(), Thread::current()); |
792 _field_array->obj_at_put(_current++, field()); | |
793 } | |
795 } | 794 } |
796 } | 795 } |
797 | 796 }; |
798 fieldsArray = oopFactory::new_objArray(SystemDictionary::RiField_klass(), count, CHECK_NULL); | 797 MyFieldClosure closure(k, JNIHandles::resolve(klass), field_array); |
799 int z = 0; | 798 k->do_nonstatic_fields(&closure); |
800 for (int i = 0; i < fields->length(); i++) { | 799 return JNIHandles::make_local(field_array()); |
801 ciField* field = fields->at(i); | |
802 if (field->holder() == instance_klass) { | |
803 Handle field_handle = GraalCompiler::get_RiField(field, instance_klass, klass_handle, Bytecodes::_illegal, CHECK_NULL); | |
804 fieldsArray->obj_at_put(z, field_handle()); | |
805 z++; | |
806 } | |
807 } | |
808 } | |
809 return JNIHandles::make_local(fieldsArray()); | |
810 } | 800 } |
811 | 801 |
812 // public RiType getPrimitiveArrayType(CiKind kind); | 802 // public RiType getPrimitiveArrayType(CiKind kind); |
813 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_getPrimitiveArrayType(JNIEnv *env, jobject, jobject kind) { | 803 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_getPrimitiveArrayType(JNIEnv *env, jobject, jobject kind) { |
814 TRACE_graal_3("VMEntries::VMEntries_getPrimitiveArrayType"); | 804 TRACE_graal_3("VMEntries::VMEntries_getPrimitiveArrayType"); |
815 VM_ENTRY_MARK; | 805 VM_ENTRY_MARK; |
816 BasicType type = GraalCompiler::kindToBasicType(CiKind::typeChar(kind)); | 806 BasicType type = GraalCompiler::kindToBasicType(CiKind::typeChar(kind)); |
817 assert(type != T_OBJECT, "primitive type expecteds"); | 807 assert(type != T_OBJECT, "primitive type expecteds"); |
818 ciKlass* klass = ciTypeArrayKlass::make(type); | 808 return JNIHandles::make_local(THREAD, GraalCompiler::get_RiType(Universe::typeArrayKlassObj(type), THREAD)); |
819 return JNIHandles::make_local(THREAD, GraalCompiler::get_RiType(klass, KlassHandle(), THREAD)); | |
820 } | 809 } |
821 | 810 |
822 // public long getMaxCallTargetOffset(CiRuntimeCall rtcall); | 811 // public long getMaxCallTargetOffset(CiRuntimeCall rtcall); |
823 JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_VMEntries_getMaxCallTargetOffset(JNIEnv *env, jobject, jobject rtcall) { | 812 JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_VMEntries_getMaxCallTargetOffset(JNIEnv *env, jobject, jobject rtcall) { |
824 TRACE_graal_3("VMEntries::VMEntries_getMaxCallTargetOffset"); | 813 TRACE_graal_3("VMEntries::VMEntries_getMaxCallTargetOffset"); |