Mercurial > hg > truffle
comparison src/share/vm/runtime/reflection.hpp @ 3895:19241ae0d839
7082263: Reflection::resolve_field/field_get/field_set are broken
Reviewed-by: kvn, dholmes, stefank, coleenp
author | never |
---|---|
date | Tue, 30 Aug 2011 00:54:09 -0700 |
parents | 1d1603768966 |
children | da91efe96a93 |
comparison
equal
deleted
inserted
replaced
3894:b27c72d69fd1 | 3895:19241ae0d839 |
---|---|
25 #ifndef SHARE_VM_RUNTIME_REFLECTION_HPP | 25 #ifndef SHARE_VM_RUNTIME_REFLECTION_HPP |
26 #define SHARE_VM_RUNTIME_REFLECTION_HPP | 26 #define SHARE_VM_RUNTIME_REFLECTION_HPP |
27 | 27 |
28 #include "oops/oop.hpp" | 28 #include "oops/oop.hpp" |
29 #include "runtime/fieldDescriptor.hpp" | 29 #include "runtime/fieldDescriptor.hpp" |
30 #include "runtime/reflectionCompat.hpp" | |
31 #include "utilities/accessFlags.hpp" | 30 #include "utilities/accessFlags.hpp" |
32 #include "utilities/growableArray.hpp" | 31 #include "utilities/growableArray.hpp" |
33 | 32 |
34 // Class Reflection contains utility methods needed for implementing the | 33 // Class Reflection contains utility methods needed for implementing the |
35 // reflection api. | 34 // reflection api. |
118 // Create a java.lang.reflect.Constructor object based on a method | 117 // Create a java.lang.reflect.Constructor object based on a method |
119 static oop new_constructor(methodHandle method, TRAPS); | 118 static oop new_constructor(methodHandle method, TRAPS); |
120 // Create a java.lang.reflect.Field object based on a field descriptor | 119 // Create a java.lang.reflect.Field object based on a field descriptor |
121 static oop new_field(fieldDescriptor* fd, bool intern_name, TRAPS); | 120 static oop new_field(fieldDescriptor* fd, bool intern_name, TRAPS); |
122 | 121 |
123 //--------------------------------------------------------------------------- | |
124 // | |
125 // Support for old native code-based reflection (pre-JDK 1.4) | |
126 // | |
127 // NOTE: the method and constructor invocation code is still used | |
128 // for startup time reasons; see reflectionCompat.hpp. | |
129 // | |
130 //--------------------------------------------------------------------------- | |
131 | |
132 #ifdef SUPPORT_OLD_REFLECTION | |
133 private: | 122 private: |
134 // method resolution for invoke | 123 // method resolution for invoke |
135 static methodHandle resolve_interface_call(instanceKlassHandle klass, methodHandle method, KlassHandle recv_klass, Handle receiver, TRAPS); | 124 static methodHandle resolve_interface_call(instanceKlassHandle klass, methodHandle method, KlassHandle recv_klass, Handle receiver, TRAPS); |
136 // Method call (shared by invoke_method and invoke_constructor) | 125 // Method call (shared by invoke_method and invoke_constructor) |
137 static oop invoke(instanceKlassHandle klass, methodHandle method, Handle receiver, bool override, objArrayHandle ptypes, BasicType rtype, objArrayHandle args, bool is_method_invoke, TRAPS); | 126 static oop invoke(instanceKlassHandle klass, methodHandle method, Handle receiver, bool override, objArrayHandle ptypes, BasicType rtype, objArrayHandle args, bool is_method_invoke, TRAPS); |
142 static void narrow(jvalue* value, BasicType narrow_type, TRAPS); | 131 static void narrow(jvalue* value, BasicType narrow_type, TRAPS); |
143 | 132 |
144 // Conversion | 133 // Conversion |
145 static BasicType basic_type_mirror_to_basic_type(oop basic_type_mirror, TRAPS); | 134 static BasicType basic_type_mirror_to_basic_type(oop basic_type_mirror, TRAPS); |
146 | 135 |
147 static bool match_parameter_types(methodHandle method, objArrayHandle types, int parameter_count, TRAPS); | |
148 // Creating new java.lang.reflect.xxx wrappers | |
149 static oop new_field(FieldStream* st, TRAPS); | |
150 | |
151 public: | 136 public: |
152 // Field lookup and verification. | |
153 static bool resolve_field(Handle field_mirror, Handle& receiver, fieldDescriptor* fd, bool check_final, TRAPS); | |
154 | |
155 // Reflective field access. Returns type code. Throws IllegalArgumentException. | |
156 static BasicType field_get(jvalue* value, fieldDescriptor* fd, Handle receiver); | |
157 static void field_set(jvalue* value, fieldDescriptor* fd, Handle receiver, BasicType value_type, TRAPS); | |
158 | |
159 // Reflective lookup of fields. Returns java.lang.reflect.Field instances. | |
160 static oop reflect_field(oop mirror, Symbol* field_name, jint which, TRAPS); | |
161 static objArrayOop reflect_fields(oop mirror, jint which, TRAPS); | |
162 | |
163 // Reflective lookup of methods. Returns java.lang.reflect.Method instances. | |
164 static oop reflect_method(oop mirror, Symbol* method_name, objArrayHandle types, jint which, TRAPS); | |
165 static objArrayOop reflect_methods(oop mirror, jint which, TRAPS); | |
166 | |
167 // Reflective lookup of constructors. Returns java.lang.reflect.Constructor instances. | |
168 static oop reflect_constructor(oop mirror, objArrayHandle types, jint which, TRAPS); | |
169 static objArrayOop reflect_constructors(oop mirror, jint which, TRAPS); | |
170 | |
171 // Method invokation through java.lang.reflect.Method | 137 // Method invokation through java.lang.reflect.Method |
172 static oop invoke_method(oop method_mirror, Handle receiver, objArrayHandle args, TRAPS); | 138 static oop invoke_method(oop method_mirror, Handle receiver, objArrayHandle args, TRAPS); |
173 // Method invokation through java.lang.reflect.Constructor | 139 // Method invokation through java.lang.reflect.Constructor |
174 static oop invoke_constructor(oop method_mirror, objArrayHandle args, TRAPS); | 140 static oop invoke_constructor(oop method_mirror, objArrayHandle args, TRAPS); |
175 #endif /* SUPPORT_OLD_REFLECTION */ | |
176 | 141 |
177 }; | 142 }; |
178 | 143 |
179 #endif // SHARE_VM_RUNTIME_REFLECTION_HPP | 144 #endif // SHARE_VM_RUNTIME_REFLECTION_HPP |