Mercurial > hg > truffle
comparison src/share/vm/oops/methodOop.cpp @ 3795:b16582d6c7db
Merge
author | kvn |
---|---|
date | Thu, 07 Jul 2011 10:51:07 -0700 |
parents | 4bf3cbef0b3e ddd894528dbc |
children | ac8738449b6f |
comparison
equal
deleted
inserted
replaced
3780:4bf3cbef0b3e | 3795:b16582d6c7db |
---|---|
927 | 927 |
928 // invariant: cp->symbol_at_put is preceded by a refcount increment (more usually a lookup) | 928 // invariant: cp->symbol_at_put is preceded by a refcount increment (more usually a lookup) |
929 name->increment_refcount(); | 929 name->increment_refcount(); |
930 signature->increment_refcount(); | 930 signature->increment_refcount(); |
931 | 931 |
932 // record non-BCP method types in the constant pool | |
933 GrowableArray<KlassHandle>* extra_klasses = NULL; | |
934 for (int i = -1, len = java_lang_invoke_MethodType::ptype_count(method_type()); i < len; i++) { | |
935 oop ptype = (i == -1 | |
936 ? java_lang_invoke_MethodType::rtype(method_type()) | |
937 : java_lang_invoke_MethodType::ptype(method_type(), i)); | |
938 klassOop klass = check_non_bcp_klass(java_lang_Class::as_klassOop(ptype)); | |
939 if (klass != NULL) { | |
940 if (extra_klasses == NULL) | |
941 extra_klasses = new GrowableArray<KlassHandle>(len+1); | |
942 bool dup = false; | |
943 for (int j = 0; j < extra_klasses->length(); j++) { | |
944 if (extra_klasses->at(j) == klass) { dup = true; break; } | |
945 } | |
946 if (!dup) | |
947 extra_klasses->append(KlassHandle(THREAD, klass)); | |
948 } | |
949 } | |
950 | |
951 int extra_klass_count = (extra_klasses == NULL ? 0 : extra_klasses->length()); | |
952 int cp_length = _imcp_limit + extra_klass_count; | |
932 constantPoolHandle cp; | 953 constantPoolHandle cp; |
933 { | 954 { |
934 constantPoolOop cp_oop = oopFactory::new_constantPool(_imcp_limit, IsSafeConc, CHECK_(empty)); | 955 constantPoolOop cp_oop = oopFactory::new_constantPool(cp_length, IsSafeConc, CHECK_(empty)); |
935 cp = constantPoolHandle(THREAD, cp_oop); | 956 cp = constantPoolHandle(THREAD, cp_oop); |
936 } | 957 } |
937 cp->symbol_at_put(_imcp_invoke_name, name); | 958 cp->symbol_at_put(_imcp_invoke_name, name); |
938 cp->symbol_at_put(_imcp_invoke_signature, signature); | 959 cp->symbol_at_put(_imcp_invoke_signature, signature); |
939 cp->string_at_put(_imcp_method_type_value, Universe::the_null_string()); | 960 cp->string_at_put(_imcp_method_type_value, Universe::the_null_string()); |
961 for (int j = 0; j < extra_klass_count; j++) { | |
962 KlassHandle klass = extra_klasses->at(j); | |
963 cp->klass_at_put(_imcp_limit + j, klass()); | |
964 } | |
965 cp->set_preresolution(); | |
940 cp->set_pool_holder(holder()); | 966 cp->set_pool_holder(holder()); |
941 | 967 |
942 // set up the fancy stuff: | 968 // set up the fancy stuff: |
943 cp->pseudo_string_at_put(_imcp_method_type_value, method_type()); | 969 cp->pseudo_string_at_put(_imcp_method_type_value, method_type()); |
944 methodHandle m; | 970 methodHandle m; |
983 m->print_on(tty); | 1009 m->print_on(tty); |
984 | 1010 |
985 return m; | 1011 return m; |
986 } | 1012 } |
987 | 1013 |
1014 klassOop methodOopDesc::check_non_bcp_klass(klassOop klass) { | |
1015 if (klass != NULL && Klass::cast(klass)->class_loader() != NULL) { | |
1016 if (Klass::cast(klass)->oop_is_objArray()) | |
1017 klass = objArrayKlass::cast(klass)->bottom_klass(); | |
1018 return klass; | |
1019 } | |
1020 return NULL; | |
1021 } | |
988 | 1022 |
989 | 1023 |
990 methodHandle methodOopDesc:: clone_with_new_data(methodHandle m, u_char* new_code, int new_code_length, | 1024 methodHandle methodOopDesc:: clone_with_new_data(methodHandle m, u_char* new_code, int new_code_length, |
991 u_char* new_compressed_linenumber_table, int new_compressed_linenumber_size, TRAPS) { | 1025 u_char* new_compressed_linenumber_table, int new_compressed_linenumber_size, TRAPS) { |
992 // Code below does not work for native methods - they should never get rewritten anyway | 1026 // Code below does not work for native methods - they should never get rewritten anyway |