hotspot/src/share/vm/classfile/javaClasses.cpp
changeset 37301 a936b4e01afb
parent 37179 4dbcb3a642d2
child 37479 14a195eaf2c5
equal deleted inserted replaced
37300:82e233a4a546 37301:a936b4e01afb
  2748   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
  2748   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
  2749   assert(has_type_annotations_field(), "type_annotations field must be present");
  2749   assert(has_type_annotations_field(), "type_annotations field must be present");
  2750   field->obj_field_put(type_annotations_offset, value);
  2750   field->obj_field_put(type_annotations_offset, value);
  2751 }
  2751 }
  2752 
  2752 
  2753 void sun_reflect_ConstantPool::compute_offsets() {
  2753 void reflect_ConstantPool::compute_offsets() {
  2754   Klass* k = SystemDictionary::reflect_ConstantPool_klass();
  2754   Klass* k = SystemDictionary::reflect_ConstantPool_klass();
  2755   // This null test can be removed post beta
  2755   // This null test can be removed post beta
  2756   if (k != NULL) {
  2756   if (k != NULL) {
  2757     // The field is called ConstantPool* in the sun.reflect.ConstantPool class.
  2757     // The field is called ConstantPool* in the sun.reflect.ConstantPool class.
  2758     compute_offset(_oop_offset, k, vmSymbols::ConstantPool_name(), vmSymbols::object_signature());
  2758     compute_offset(_oop_offset, k, vmSymbols::ConstantPool_name(), vmSymbols::object_signature());
  2892   assert(module != NULL, "module can't be null");
  2892   assert(module != NULL, "module can't be null");
  2893   assert(module->is_oop(), "module must be oop");
  2893   assert(module->is_oop(), "module must be oop");
  2894   module->address_field_put(_module_entry_offset, (address)module_entry);
  2894   module->address_field_put(_module_entry_offset, (address)module_entry);
  2895 }
  2895 }
  2896 
  2896 
  2897 Handle sun_reflect_ConstantPool::create(TRAPS) {
  2897 Handle reflect_ConstantPool::create(TRAPS) {
  2898   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
  2898   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
  2899   Klass* k = SystemDictionary::reflect_ConstantPool_klass();
  2899   Klass* k = SystemDictionary::reflect_ConstantPool_klass();
  2900   instanceKlassHandle klass (THREAD, k);
  2900   instanceKlassHandle klass (THREAD, k);
  2901   // Ensure it is initialized
  2901   // Ensure it is initialized
  2902   klass->initialize(CHECK_NH);
  2902   klass->initialize(CHECK_NH);
  2903   return klass->allocate_instance_handle(THREAD);
  2903   return klass->allocate_instance_handle(THREAD);
  2904 }
  2904 }
  2905 
  2905 
  2906 
  2906 
  2907 void sun_reflect_ConstantPool::set_cp(oop reflect, ConstantPool* value) {
  2907 void reflect_ConstantPool::set_cp(oop reflect, ConstantPool* value) {
  2908   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
  2908   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
  2909   oop mirror = value->pool_holder()->java_mirror();
  2909   oop mirror = value->pool_holder()->java_mirror();
  2910   // Save the mirror to get back the constant pool.
  2910   // Save the mirror to get back the constant pool.
  2911   reflect->obj_field_put(_oop_offset, mirror);
  2911   reflect->obj_field_put(_oop_offset, mirror);
  2912 }
  2912 }
  2913 
  2913 
  2914 ConstantPool* sun_reflect_ConstantPool::get_cp(oop reflect) {
  2914 ConstantPool* reflect_ConstantPool::get_cp(oop reflect) {
  2915   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
  2915   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
  2916 
  2916 
  2917   oop mirror = reflect->obj_field(_oop_offset);
  2917   oop mirror = reflect->obj_field(_oop_offset);
  2918   Klass* k = java_lang_Class::as_Klass(mirror);
  2918   Klass* k = java_lang_Class::as_Klass(mirror);
  2919   assert(k->is_instance_klass(), "Must be");
  2919   assert(k->is_instance_klass(), "Must be");
  2924   // no longer done in the future, this will have to change to save
  2924   // no longer done in the future, this will have to change to save
  2925   // the original.
  2925   // the original.
  2926   return InstanceKlass::cast(k)->constants();
  2926   return InstanceKlass::cast(k)->constants();
  2927 }
  2927 }
  2928 
  2928 
  2929 void sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets() {
  2929 void reflect_UnsafeStaticFieldAccessorImpl::compute_offsets() {
  2930   Klass* k = SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass();
  2930   Klass* k = SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass();
  2931   // This null test can be removed post beta
  2931   // This null test can be removed post beta
  2932   if (k != NULL) {
  2932   if (k != NULL) {
  2933     compute_offset(_base_offset, k,
  2933     compute_offset(_base_offset, k,
  2934                    vmSymbols::base_name(), vmSymbols::object_signature());
  2934                    vmSymbols::base_name(), vmSymbols::object_signature());
  3704 int java_lang_AssertionStatusDirectives::packages_offset;
  3704 int java_lang_AssertionStatusDirectives::packages_offset;
  3705 int java_lang_AssertionStatusDirectives::packageEnabled_offset;
  3705 int java_lang_AssertionStatusDirectives::packageEnabled_offset;
  3706 int java_lang_AssertionStatusDirectives::deflt_offset;
  3706 int java_lang_AssertionStatusDirectives::deflt_offset;
  3707 int java_nio_Buffer::_limit_offset;
  3707 int java_nio_Buffer::_limit_offset;
  3708 int java_util_concurrent_locks_AbstractOwnableSynchronizer::_owner_offset = 0;
  3708 int java_util_concurrent_locks_AbstractOwnableSynchronizer::_owner_offset = 0;
  3709 int sun_reflect_ConstantPool::_oop_offset;
  3709 int reflect_ConstantPool::_oop_offset;
  3710 int sun_reflect_UnsafeStaticFieldAccessorImpl::_base_offset;
  3710 int reflect_UnsafeStaticFieldAccessorImpl::_base_offset;
  3711 
  3711 
  3712 
  3712 
  3713 // Support for java_lang_StackTraceElement
  3713 // Support for java_lang_StackTraceElement
  3714 
  3714 
  3715 void java_lang_StackTraceElement::set_fileName(oop element, oop value) {
  3715 void java_lang_StackTraceElement::set_fileName(oop element, oop value) {
  3910   java_lang_reflect_AccessibleObject::compute_offsets();
  3910   java_lang_reflect_AccessibleObject::compute_offsets();
  3911   java_lang_reflect_Method::compute_offsets();
  3911   java_lang_reflect_Method::compute_offsets();
  3912   java_lang_reflect_Constructor::compute_offsets();
  3912   java_lang_reflect_Constructor::compute_offsets();
  3913   java_lang_reflect_Field::compute_offsets();
  3913   java_lang_reflect_Field::compute_offsets();
  3914   java_nio_Buffer::compute_offsets();
  3914   java_nio_Buffer::compute_offsets();
  3915   sun_reflect_ConstantPool::compute_offsets();
  3915   reflect_ConstantPool::compute_offsets();
  3916   sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
  3916   reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
  3917   java_lang_reflect_Parameter::compute_offsets();
  3917   java_lang_reflect_Parameter::compute_offsets();
  3918   java_lang_reflect_Module::compute_offsets();
  3918   java_lang_reflect_Module::compute_offsets();
  3919   java_lang_StackFrameInfo::compute_offsets();
  3919   java_lang_StackFrameInfo::compute_offsets();
  3920   java_lang_LiveStackFrameInfo::compute_offsets();
  3920   java_lang_LiveStackFrameInfo::compute_offsets();
  3921 
  3921