< prev index next >

src/share/vm/runtime/fieldDescriptor.cpp

Print this page

        

@@ -96,11 +96,35 @@
 
 oop fieldDescriptor::string_initial_value(TRAPS) const {
   return constants()->uncached_string_at(initial_value_index(), THREAD);
 }
 
+void fieldDescriptor::reinitialize_accessor(InstanceKlass* ik) {
+    //assert(_getAccessor != -1 && _putAccessor != -1, "asymetric accesor configuration");
+    if (_cp.is_null()) {
+        _cp = constantPoolHandle(Thread::current(), ik->constants());
+        assert(!_cp.is_null(), "must be initialized");
+    }
+    Method* getM = ik->method_with_idnum(_getAccessor);
+    Method* putM = ik->method_with_idnum(_putAccessor);
+    
+    assert(getM->access_flags().get_flags() == putM->access_flags().get_flags(), "asymetic accessiblity in accessor configuration");
+    _access_flags = accessFlags_from(getM->access_flags().get_flags());
+        
+    // Somehow the memory has to be freed. Maybe create a destructor for fieldDescriptor
+    _accessor_info = NEW_C_HEAP_ARRAY(FieldInfo,1,mtInternal);
+    // How do I get an index for the signature. There maybe no signature in constant-pool of this class.
+    // Fortunatly the signature is not used for this prototype.
+    _accessor_info->initialize(/*_access_flags*/_access_flags.as_short(),_field_name_from_accessor,/*sig_index*/0,/*initval*/0);
+    // fieldDescriptor for accessor initialized completely
+    // maybe more checks are needed in future.
+    _is_accessor = true;
+}
+
 void fieldDescriptor::reinitialize(InstanceKlass* ik, int index) {
+  _is_accessor = false;
+  _accessor_info = NULL;
   if (_cp.is_null() || field_holder() != ik) {
     _cp = constantPoolHandle(Thread::current(), ik->constants());
     // _cp should now reference ik's constant pool; i.e., ik is now field_holder.
     assert(field_holder() == ik, "must be already initialized to this class");
   }
< prev index next >