Mercurial > hg > graal-jvmci-8
comparison src/share/vm/prims/methodHandleWalk.cpp @ 1152:cd37471eaecc
6914206: change way of permission checking for generated MethodHandle adapters
Summary: Put generated MH adapter in InvokeDynamic/MethodHandle classes to be able to indentify them easily in the compiler.
Reviewed-by: kvn, never, jrose
author | twisti |
---|---|
date | Fri, 08 Jan 2010 11:09:46 +0100 |
parents | 4ce7240d622c |
children | cd5dbf694d45 |
comparison
equal
deleted
inserted
replaced
1151:1271af4ec18c | 1152:cd37471eaecc |
---|---|
629 | 629 |
630 // Get return type klass. | 630 // Get return type klass. |
631 Handle first_mtype(THREAD, chain().method_type_oop()); | 631 Handle first_mtype(THREAD, chain().method_type_oop()); |
632 // _rklass is NULL for primitives. | 632 // _rklass is NULL for primitives. |
633 _rtype = java_lang_Class::as_BasicType(java_dyn_MethodType::rtype(first_mtype()), &_rklass); | 633 _rtype = java_lang_Class::as_BasicType(java_dyn_MethodType::rtype(first_mtype()), &_rklass); |
634 if (_rtype == T_ARRAY) _rtype = T_OBJECT; | |
634 | 635 |
635 int params = _callee->size_of_parameters(); // Incoming arguments plus receiver. | 636 int params = _callee->size_of_parameters(); // Incoming arguments plus receiver. |
636 _num_params = for_invokedynamic() ? params - 1 : params; // XXX Check if callee is static? | 637 _num_params = for_invokedynamic() ? params - 1 : params; // XXX Check if callee is static? |
637 } | 638 } |
638 | 639 |
955 | 956 |
956 klassOop klass = m->method_holder(); | 957 klassOop klass = m->method_holder(); |
957 symbolOop name = m->name(); | 958 symbolOop name = m->name(); |
958 symbolOop signature = m->signature(); | 959 symbolOop signature = m->signature(); |
959 | 960 |
960 // This generated adapter method should be in the same class as the | |
961 // DMH target method (for accessability reasons). | |
962 if (tailcall) { | 961 if (tailcall) { |
963 _target_klass = klass; | 962 // Actually, in order to make these methods more recognizable, |
963 // let's put them in holder classes MethodHandle and InvokeDynamic. | |
964 // That way stack walkers and compiler heuristics can recognize them. | |
965 _target_klass = (for_invokedynamic() | |
966 ? SystemDictionary::InvokeDynamic_klass() | |
967 : SystemDictionary::MethodHandle_klass()); | |
964 } | 968 } |
965 | 969 |
966 // instanceKlass* ik = instanceKlass::cast(klass); | 970 // instanceKlass* ik = instanceKlass::cast(klass); |
967 // tty->print_cr("MethodHandleCompiler::make_invoke: %s %s.%s%s", Bytecodes::name(op), ik->external_name(), name->as_C_string(), signature->as_C_string()); | 971 // tty->print_cr("MethodHandleCompiler::make_invoke: %s %s.%s%s", Bytecodes::name(op), ik->external_name(), name->as_C_string(), signature->as_C_string()); |
968 | 972 |
1015 } | 1019 } |
1016 | 1020 |
1017 // If tailcall, we have walked all the way to a direct method handle. | 1021 // If tailcall, we have walked all the way to a direct method handle. |
1018 // Otherwise, make a recursive call to some helper routine. | 1022 // Otherwise, make a recursive call to some helper routine. |
1019 BasicType rbt = m->result_type(); | 1023 BasicType rbt = m->result_type(); |
1024 if (rbt == T_ARRAY) rbt = T_OBJECT; | |
1020 ArgToken ret; | 1025 ArgToken ret; |
1021 if (tailcall) { | 1026 if (tailcall) { |
1022 if (rbt != _rtype) { | 1027 if (rbt != _rtype) { |
1023 if (rbt == T_VOID) { | 1028 if (rbt == T_VOID) { |
1024 // push a zero of the right sort | 1029 // push a zero of the right sort |