< prev index next >

src/hotspot/share/classfile/javaClasses.cpp

Print this page




3649 int java_lang_reflect_Field::name_offset;
3650 int java_lang_reflect_Field::type_offset;
3651 int java_lang_reflect_Field::slot_offset;
3652 int java_lang_reflect_Field::modifiers_offset;
3653 int java_lang_reflect_Field::signature_offset;
3654 int java_lang_reflect_Field::annotations_offset;
3655 int java_lang_reflect_Field::type_annotations_offset;
3656 int java_lang_reflect_Parameter::name_offset;
3657 int java_lang_reflect_Parameter::modifiers_offset;
3658 int java_lang_reflect_Parameter::index_offset;
3659 int java_lang_reflect_Parameter::executable_offset;
3660 int java_lang_boxing_object::value_offset;
3661 int java_lang_boxing_object::long_value_offset;
3662 int java_lang_ref_Reference::referent_offset;
3663 int java_lang_ref_Reference::queue_offset;
3664 int java_lang_ref_Reference::next_offset;
3665 int java_lang_ref_Reference::discovered_offset;
3666 int java_lang_ref_Reference::number_of_fake_oop_fields;
3667 int java_lang_ref_SoftReference::timestamp_offset;
3668 int java_lang_ref_SoftReference::static_clock_offset;











3669 int java_lang_ClassLoader::parent_offset;
3670 int java_lang_System::static_in_offset;
3671 int java_lang_System::static_out_offset;
3672 int java_lang_System::static_err_offset;
3673 int java_lang_System::static_security_offset;
3674 int java_lang_StackTraceElement::methodName_offset;
3675 int java_lang_StackTraceElement::fileName_offset;
3676 int java_lang_StackTraceElement::lineNumber_offset;
3677 int java_lang_StackTraceElement::moduleName_offset;
3678 int java_lang_StackTraceElement::moduleVersion_offset;
3679 int java_lang_StackTraceElement::classLoaderName_offset;
3680 int java_lang_StackTraceElement::declaringClass_offset;
3681 int java_lang_StackTraceElement::declaringClassObject_offset;
3682 int java_lang_StackFrameInfo::_declaringClass_offset;
3683 int java_lang_StackFrameInfo::_memberName_offset;
3684 int java_lang_StackFrameInfo::_bci_offset;
3685 int java_lang_StackFrameInfo::_version_offset;
3686 int java_lang_LiveStackFrameInfo::_monitors_offset;
3687 int java_lang_LiveStackFrameInfo::_locals_offset;
3688 int java_lang_LiveStackFrameInfo::_operands_offset;


3767   o->obj_field_put(classes_offset, val);
3768 }
3769 
3770 void java_lang_AssertionStatusDirectives::set_classEnabled(oop o, oop val) {
3771   o->obj_field_put(classEnabled_offset, val);
3772 }
3773 
3774 void java_lang_AssertionStatusDirectives::set_packages(oop o, oop val) {
3775   o->obj_field_put(packages_offset, val);
3776 }
3777 
3778 void java_lang_AssertionStatusDirectives::set_packageEnabled(oop o, oop val) {
3779   o->obj_field_put(packageEnabled_offset, val);
3780 }
3781 
3782 void java_lang_AssertionStatusDirectives::set_deflt(oop o, bool val) {
3783   o->bool_field_put(deflt_offset, val);
3784 }
3785 
3786 


































3787 // Support for intrinsification of java.nio.Buffer.checkIndex
3788 int java_nio_Buffer::limit_offset() {
3789   return _limit_offset;
3790 }
3791 
3792 
3793 void java_nio_Buffer::compute_offsets() {
3794   Klass* k = SystemDictionary::nio_Buffer_klass();
3795   assert(k != NULL, "must be loaded in 1.4+");
3796   compute_offset(_limit_offset, k, vmSymbols::limit_name(), vmSymbols::int_signature());
3797 }
3798 
3799 void java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(TRAPS) {
3800   if (_owner_offset != 0) return;
3801 
3802   SystemDictionary::load_abstract_ownable_synchronizer_klass(CHECK);
3803   Klass* k = SystemDictionary::abstract_ownable_synchronizer_klass();
3804   compute_offset(_owner_offset, k,
3805                  vmSymbols::exclusive_owner_thread_name(), vmSymbols::thread_signature());
3806 }


3824   java_lang_Throwable::static_unassigned_stacktrace_offset = java_lang_Throwable::hc_static_unassigned_stacktrace_offset *  x;
3825 
3826   // java_lang_boxing_object
3827   java_lang_boxing_object::value_offset = java_lang_boxing_object::hc_value_offset + header;
3828   java_lang_boxing_object::long_value_offset = align_up((java_lang_boxing_object::hc_value_offset + header), BytesPerLong);
3829 
3830   // java_lang_ref_Reference:
3831   java_lang_ref_Reference::referent_offset = java_lang_ref_Reference::hc_referent_offset * x + header;
3832   java_lang_ref_Reference::queue_offset = java_lang_ref_Reference::hc_queue_offset * x + header;
3833   java_lang_ref_Reference::next_offset  = java_lang_ref_Reference::hc_next_offset * x + header;
3834   java_lang_ref_Reference::discovered_offset  = java_lang_ref_Reference::hc_discovered_offset * x + header;
3835   // Artificial fields for java_lang_ref_Reference
3836   // The first field is for the discovered field added in 1.4
3837   java_lang_ref_Reference::number_of_fake_oop_fields = 1;
3838 
3839   // java_lang_ref_SoftReference Class
3840   java_lang_ref_SoftReference::timestamp_offset = align_up((java_lang_ref_SoftReference::hc_timestamp_offset * x + header), BytesPerLong);
3841   // Don't multiply static fields because they are always in wordSize units
3842   java_lang_ref_SoftReference::static_clock_offset = java_lang_ref_SoftReference::hc_static_clock_offset * x;
3843 












3844   // java_lang_ClassLoader
3845   java_lang_ClassLoader::parent_offset = java_lang_ClassLoader::hc_parent_offset * x + header;
3846 
3847   // java_lang_System
3848   java_lang_System::static_in_offset  = java_lang_System::hc_static_in_offset  * x;
3849   java_lang_System::static_out_offset = java_lang_System::hc_static_out_offset * x;
3850   java_lang_System::static_err_offset = java_lang_System::hc_static_err_offset * x;
3851   java_lang_System::static_security_offset = java_lang_System::hc_static_security_offset * x;
3852 
3853   // java_lang_StackTraceElement
3854   java_lang_StackTraceElement::declaringClassObject_offset = java_lang_StackTraceElement::hc_declaringClassObject_offset * x + header;
3855   java_lang_StackTraceElement::classLoaderName_offset = java_lang_StackTraceElement::hc_classLoaderName_offset * x + header;
3856   java_lang_StackTraceElement::moduleName_offset = java_lang_StackTraceElement::hc_moduleName_offset * x + header;
3857   java_lang_StackTraceElement::moduleVersion_offset = java_lang_StackTraceElement::hc_moduleVersion_offset * x + header;
3858   java_lang_StackTraceElement::declaringClass_offset = java_lang_StackTraceElement::hc_declaringClass_offset  * x + header;
3859   java_lang_StackTraceElement::methodName_offset = java_lang_StackTraceElement::hc_methodName_offset * x + header;
3860   java_lang_StackTraceElement::fileName_offset   = java_lang_StackTraceElement::hc_fileName_offset   * x + header;
3861   java_lang_StackTraceElement::lineNumber_offset = java_lang_StackTraceElement::hc_lineNumber_offset * x + header;
3862   java_lang_AssertionStatusDirectives::classes_offset = java_lang_AssertionStatusDirectives::hc_classes_offset * x + header;
3863   java_lang_AssertionStatusDirectives::classEnabled_offset = java_lang_AssertionStatusDirectives::hc_classEnabled_offset * x + header;


3883   java_lang_invoke_MethodType::compute_offsets();
3884   java_lang_invoke_CallSite::compute_offsets();
3885   java_lang_invoke_MethodHandleNatives_CallSiteContext::compute_offsets();
3886   java_security_AccessControlContext::compute_offsets();
3887   // Initialize reflection classes. The layouts of these classes
3888   // changed with the new reflection implementation in JDK 1.4, and
3889   // since the Universe doesn't know what JDK version it is until this
3890   // point we defer computation of these offsets until now.
3891   java_lang_reflect_AccessibleObject::compute_offsets();
3892   java_lang_reflect_Method::compute_offsets();
3893   java_lang_reflect_Constructor::compute_offsets();
3894   java_lang_reflect_Field::compute_offsets();
3895   java_nio_Buffer::compute_offsets();
3896   reflect_ConstantPool::compute_offsets();
3897   reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
3898   java_lang_reflect_Parameter::compute_offsets();
3899   java_lang_Module::compute_offsets();
3900   java_lang_StackFrameInfo::compute_offsets();
3901   java_lang_LiveStackFrameInfo::compute_offsets();
3902 


3903   // generated interpreter code wants to know about the offsets we just computed:
3904   AbstractAssembler::update_delayed_values();
3905 }
3906 
3907 #ifndef PRODUCT
3908 
3909 // These functions exist to assert the validity of hard-coded field offsets to guard
3910 // against changes in the class files
3911 
3912 bool JavaClasses::check_offset(const char *klass_name, int hardcoded_offset, const char *field_name, const char* field_sig) {
3913   EXCEPTION_MARK;
3914   fieldDescriptor fd;
3915   TempNewSymbol klass_sym = SymbolTable::new_symbol(klass_name, CATCH);
3916   Klass* k = SystemDictionary::resolve_or_fail(klass_sym, true, CATCH);
3917   InstanceKlass* ik = InstanceKlass::cast(k);
3918   TempNewSymbol f_name = SymbolTable::new_symbol(field_name, CATCH);
3919   TempNewSymbol f_sig  = SymbolTable::new_symbol(field_sig, CATCH);
3920   if (!ik->find_local_field(f_name, f_sig, &fd)) {
3921     tty->print_cr("Nonstatic field %s.%s not found", klass_name, field_name);
3922     return false;


4050 
4051   // java.lang.StackTraceElement
4052 
4053   CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, declaringClassObject, "Ljava/lang/Class;");
4054   CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, classLoaderName, "Ljava/lang/String;");
4055   CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, moduleName,      "Ljava/lang/String;");
4056   CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, moduleVersion,   "Ljava/lang/String;");
4057   CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, declaringClass,  "Ljava/lang/String;");
4058   CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, methodName,      "Ljava/lang/String;");
4059   CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, fileName,        "Ljava/lang/String;");
4060   CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, lineNumber,      "I");
4061 
4062   // java.lang.ref.Reference
4063 
4064   CHECK_OFFSET("java/lang/ref/Reference", java_lang_ref_Reference, referent, "Ljava/lang/Object;");
4065   CHECK_OFFSET("java/lang/ref/Reference", java_lang_ref_Reference, queue, "Ljava/lang/ref/ReferenceQueue;");
4066   CHECK_OFFSET("java/lang/ref/Reference", java_lang_ref_Reference, next, "Ljava/lang/ref/Reference;");
4067   // Fake field
4068   //CHECK_OFFSET("java/lang/ref/Reference", java_lang_ref_Reference, discovered, "Ljava/lang/ref/Reference;");
4069 













4070   // java.lang.ref.SoftReference
4071 
4072   CHECK_OFFSET("java/lang/ref/SoftReference", java_lang_ref_SoftReference, timestamp, "J");
4073   CHECK_STATIC_OFFSET("java/lang/ref/SoftReference", java_lang_ref_SoftReference, clock, "J");
4074 
4075   // java.lang.AssertionStatusDirectives
4076   //
4077   // The CheckAssertionStatusDirectives boolean can be removed from here and
4078   // globals.hpp after the AssertionStatusDirectives class has been integrated
4079   // into merlin "for some time."  Without it, the vm will fail with early
4080   // merlin builds.
4081 
4082   if (CheckAssertionStatusDirectives) {
4083     const char* nm = "java/lang/AssertionStatusDirectives";
4084     const char* sig = "[Ljava/lang/String;";
4085     CHECK_OFFSET(nm, java_lang_AssertionStatusDirectives, classes, sig);
4086     CHECK_OFFSET(nm, java_lang_AssertionStatusDirectives, classEnabled, "[Z");
4087     CHECK_OFFSET(nm, java_lang_AssertionStatusDirectives, packages, sig);
4088     CHECK_OFFSET(nm, java_lang_AssertionStatusDirectives, packageEnabled, "[Z");
4089     CHECK_OFFSET(nm, java_lang_AssertionStatusDirectives, deflt, "Z");




3649 int java_lang_reflect_Field::name_offset;
3650 int java_lang_reflect_Field::type_offset;
3651 int java_lang_reflect_Field::slot_offset;
3652 int java_lang_reflect_Field::modifiers_offset;
3653 int java_lang_reflect_Field::signature_offset;
3654 int java_lang_reflect_Field::annotations_offset;
3655 int java_lang_reflect_Field::type_annotations_offset;
3656 int java_lang_reflect_Parameter::name_offset;
3657 int java_lang_reflect_Parameter::modifiers_offset;
3658 int java_lang_reflect_Parameter::index_offset;
3659 int java_lang_reflect_Parameter::executable_offset;
3660 int java_lang_boxing_object::value_offset;
3661 int java_lang_boxing_object::long_value_offset;
3662 int java_lang_ref_Reference::referent_offset;
3663 int java_lang_ref_Reference::queue_offset;
3664 int java_lang_ref_Reference::next_offset;
3665 int java_lang_ref_Reference::discovered_offset;
3666 int java_lang_ref_Reference::number_of_fake_oop_fields;
3667 int java_lang_ref_SoftReference::timestamp_offset;
3668 int java_lang_ref_SoftReference::static_clock_offset;
3669 int java_lang_Continuation::target_offset;
3670 int java_lang_Continuation::stack_offset;
3671 int java_lang_Continuation::parent_offset;
3672 int java_lang_Continuation::parentSP_offset;
3673 int java_lang_Continuation::parentFP_offset;
3674 int java_lang_Continuation::lastFP_offset;
3675 int java_lang_Continuation::lastSP_offset;
3676 int java_lang_Continuation::reg0_offset;
3677 int java_lang_Continuation::reg1_offset;
3678 int java_lang_Continuation::reg2_offset;
3679 Method* java_lang_Continuation::stack_method;
3680 int java_lang_ClassLoader::parent_offset;
3681 int java_lang_System::static_in_offset;
3682 int java_lang_System::static_out_offset;
3683 int java_lang_System::static_err_offset;
3684 int java_lang_System::static_security_offset;
3685 int java_lang_StackTraceElement::methodName_offset;
3686 int java_lang_StackTraceElement::fileName_offset;
3687 int java_lang_StackTraceElement::lineNumber_offset;
3688 int java_lang_StackTraceElement::moduleName_offset;
3689 int java_lang_StackTraceElement::moduleVersion_offset;
3690 int java_lang_StackTraceElement::classLoaderName_offset;
3691 int java_lang_StackTraceElement::declaringClass_offset;
3692 int java_lang_StackTraceElement::declaringClassObject_offset;
3693 int java_lang_StackFrameInfo::_declaringClass_offset;
3694 int java_lang_StackFrameInfo::_memberName_offset;
3695 int java_lang_StackFrameInfo::_bci_offset;
3696 int java_lang_StackFrameInfo::_version_offset;
3697 int java_lang_LiveStackFrameInfo::_monitors_offset;
3698 int java_lang_LiveStackFrameInfo::_locals_offset;
3699 int java_lang_LiveStackFrameInfo::_operands_offset;


3778   o->obj_field_put(classes_offset, val);
3779 }
3780 
3781 void java_lang_AssertionStatusDirectives::set_classEnabled(oop o, oop val) {
3782   o->obj_field_put(classEnabled_offset, val);
3783 }
3784 
3785 void java_lang_AssertionStatusDirectives::set_packages(oop o, oop val) {
3786   o->obj_field_put(packages_offset, val);
3787 }
3788 
3789 void java_lang_AssertionStatusDirectives::set_packageEnabled(oop o, oop val) {
3790   o->obj_field_put(packageEnabled_offset, val);
3791 }
3792 
3793 void java_lang_AssertionStatusDirectives::set_deflt(oop o, bool val) {
3794   o->bool_field_put(deflt_offset, val);
3795 }
3796 
3797 
3798 // Support for java.lang.Continuation
3799 
3800 Method* java_lang_Continuation::get_stack_method() {
3801   CallInfo callinfo;
3802   Klass* recvrKlass = SystemDictionary::Continuation_klass(); // SystemDictionary::resolve_or_null(vmSymbols::java_lang_Continuation(), NULL); // 
3803   LinkInfo link_info(recvrKlass, vmSymbols::getStack_name(), vmSymbols::continuationGetStack_signature());
3804   LinkResolver::resolve_special_call(callinfo, Handle(), link_info, Thread::current());
3805   methodHandle method = callinfo.selected_method();
3806   assert(method.not_null(), "should have thrown exception");
3807   return method();
3808 }
3809 
3810 void java_lang_Continuation::compute_offsets() {
3811   // Klass* k = SystemDictionary::Continuation_klass();
3812   // compute_offset(target_offset,   k, vmSymbols::target_name(),   vmSymbols::runnable_signature());
3813   // compute_offset(parent_offset,   k, vmSymbols::parent_name(),   vmSymbols::continuation_signature());
3814   // compute_offset(stack_offset,    k, vmSymbols::stack_name(),    vmSymbols::int_array_signature());
3815   // compute_offset(parentSP_offset, k, vmSymbols::parentSP_name(), vmSymbols::long_signature());
3816   // compute_offset(parentFP_offset, k, vmSymbols::parentFP_name(), vmSymbols::long_signature());
3817   // compute_offset(lastFP_offset,   k, vmSymbols::lastFP_name(),   vmSymbols::int_signature());
3818   // compute_offset(lastSP_offset,   k, vmSymbols::lastSP_name(),   vmSymbols::int_signature());
3819   // compute_offset(reg0_offset,     k, vmSymbols::reg0_name(),     vmSymbols::long_signature());
3820   // compute_offset(reg1_offset,     k, vmSymbols::reg1_name(),     vmSymbols::long_signature());
3821   // compute_offset(reg2_offset,     k, vmSymbols::reg2_name(),     vmSymbols::long_signature());
3822 
3823   java_lang_Continuation::stack_method = java_lang_Continuation::get_stack_method();
3824 }
3825 
3826 bool java_lang_Continuation::on_local_stack(oop ref, address adr) {
3827   arrayOop s = stack(ref);
3828   void* base = s->base(T_INT);
3829   return adr >= base && (char*)adr < ((char*)base + (s->length() * 4));
3830 }
3831 
3832 // Support for intrinsification of java.nio.Buffer.checkIndex
3833 int java_nio_Buffer::limit_offset() {
3834   return _limit_offset;
3835 }
3836 
3837 
3838 void java_nio_Buffer::compute_offsets() {
3839   Klass* k = SystemDictionary::nio_Buffer_klass();
3840   assert(k != NULL, "must be loaded in 1.4+");
3841   compute_offset(_limit_offset, k, vmSymbols::limit_name(), vmSymbols::int_signature());
3842 }
3843 
3844 void java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(TRAPS) {
3845   if (_owner_offset != 0) return;
3846 
3847   SystemDictionary::load_abstract_ownable_synchronizer_klass(CHECK);
3848   Klass* k = SystemDictionary::abstract_ownable_synchronizer_klass();
3849   compute_offset(_owner_offset, k,
3850                  vmSymbols::exclusive_owner_thread_name(), vmSymbols::thread_signature());
3851 }


3869   java_lang_Throwable::static_unassigned_stacktrace_offset = java_lang_Throwable::hc_static_unassigned_stacktrace_offset *  x;
3870 
3871   // java_lang_boxing_object
3872   java_lang_boxing_object::value_offset = java_lang_boxing_object::hc_value_offset + header;
3873   java_lang_boxing_object::long_value_offset = align_up((java_lang_boxing_object::hc_value_offset + header), BytesPerLong);
3874 
3875   // java_lang_ref_Reference:
3876   java_lang_ref_Reference::referent_offset = java_lang_ref_Reference::hc_referent_offset * x + header;
3877   java_lang_ref_Reference::queue_offset = java_lang_ref_Reference::hc_queue_offset * x + header;
3878   java_lang_ref_Reference::next_offset  = java_lang_ref_Reference::hc_next_offset * x + header;
3879   java_lang_ref_Reference::discovered_offset  = java_lang_ref_Reference::hc_discovered_offset * x + header;
3880   // Artificial fields for java_lang_ref_Reference
3881   // The first field is for the discovered field added in 1.4
3882   java_lang_ref_Reference::number_of_fake_oop_fields = 1;
3883 
3884   // java_lang_ref_SoftReference Class
3885   java_lang_ref_SoftReference::timestamp_offset = align_up((java_lang_ref_SoftReference::hc_timestamp_offset * x + header), BytesPerLong);
3886   // Don't multiply static fields because they are always in wordSize units
3887   java_lang_ref_SoftReference::static_clock_offset = java_lang_ref_SoftReference::hc_static_clock_offset * x;
3888 
3889   // java_lang_Continuation Class
3890   java_lang_Continuation::target_offset   = java_lang_Continuation::hc_target_offset   * x + header;
3891   java_lang_Continuation::parent_offset   = java_lang_Continuation::hc_parent_offset   * x + header;
3892   java_lang_Continuation::parentSP_offset = java_lang_Continuation::hc_parentSP_offset * x + header;
3893   java_lang_Continuation::parentFP_offset = java_lang_Continuation::hc_parentFP_offset * x + header;
3894   java_lang_Continuation::stack_offset    = java_lang_Continuation::hc_stack_offset    * x + header;
3895   java_lang_Continuation::lastFP_offset   = java_lang_Continuation::hc_lastFP_offset   * x + header;
3896   java_lang_Continuation::lastSP_offset   = java_lang_Continuation::hc_lastSP_offset   * x + header;
3897   java_lang_Continuation::reg0_offset     = java_lang_Continuation::hc_reg0_offset     * x + header;
3898   java_lang_Continuation::reg1_offset     = java_lang_Continuation::hc_reg1_offset     * x + header;
3899   java_lang_Continuation::reg2_offset     = java_lang_Continuation::hc_reg2_offset     * x + header;
3900 
3901   // java_lang_ClassLoader
3902   java_lang_ClassLoader::parent_offset = java_lang_ClassLoader::hc_parent_offset * x + header;
3903 
3904   // java_lang_System
3905   java_lang_System::static_in_offset  = java_lang_System::hc_static_in_offset  * x;
3906   java_lang_System::static_out_offset = java_lang_System::hc_static_out_offset * x;
3907   java_lang_System::static_err_offset = java_lang_System::hc_static_err_offset * x;
3908   java_lang_System::static_security_offset = java_lang_System::hc_static_security_offset * x;
3909 
3910   // java_lang_StackTraceElement
3911   java_lang_StackTraceElement::declaringClassObject_offset = java_lang_StackTraceElement::hc_declaringClassObject_offset * x + header;
3912   java_lang_StackTraceElement::classLoaderName_offset = java_lang_StackTraceElement::hc_classLoaderName_offset * x + header;
3913   java_lang_StackTraceElement::moduleName_offset = java_lang_StackTraceElement::hc_moduleName_offset * x + header;
3914   java_lang_StackTraceElement::moduleVersion_offset = java_lang_StackTraceElement::hc_moduleVersion_offset * x + header;
3915   java_lang_StackTraceElement::declaringClass_offset = java_lang_StackTraceElement::hc_declaringClass_offset  * x + header;
3916   java_lang_StackTraceElement::methodName_offset = java_lang_StackTraceElement::hc_methodName_offset * x + header;
3917   java_lang_StackTraceElement::fileName_offset   = java_lang_StackTraceElement::hc_fileName_offset   * x + header;
3918   java_lang_StackTraceElement::lineNumber_offset = java_lang_StackTraceElement::hc_lineNumber_offset * x + header;
3919   java_lang_AssertionStatusDirectives::classes_offset = java_lang_AssertionStatusDirectives::hc_classes_offset * x + header;
3920   java_lang_AssertionStatusDirectives::classEnabled_offset = java_lang_AssertionStatusDirectives::hc_classEnabled_offset * x + header;


3940   java_lang_invoke_MethodType::compute_offsets();
3941   java_lang_invoke_CallSite::compute_offsets();
3942   java_lang_invoke_MethodHandleNatives_CallSiteContext::compute_offsets();
3943   java_security_AccessControlContext::compute_offsets();
3944   // Initialize reflection classes. The layouts of these classes
3945   // changed with the new reflection implementation in JDK 1.4, and
3946   // since the Universe doesn't know what JDK version it is until this
3947   // point we defer computation of these offsets until now.
3948   java_lang_reflect_AccessibleObject::compute_offsets();
3949   java_lang_reflect_Method::compute_offsets();
3950   java_lang_reflect_Constructor::compute_offsets();
3951   java_lang_reflect_Field::compute_offsets();
3952   java_nio_Buffer::compute_offsets();
3953   reflect_ConstantPool::compute_offsets();
3954   reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
3955   java_lang_reflect_Parameter::compute_offsets();
3956   java_lang_Module::compute_offsets();
3957   java_lang_StackFrameInfo::compute_offsets();
3958   java_lang_LiveStackFrameInfo::compute_offsets();
3959 
3960   java_lang_Continuation::compute_offsets();
3961 
3962   // generated interpreter code wants to know about the offsets we just computed:
3963   AbstractAssembler::update_delayed_values();
3964 }
3965 
3966 #ifndef PRODUCT
3967 
3968 // These functions exist to assert the validity of hard-coded field offsets to guard
3969 // against changes in the class files
3970 
3971 bool JavaClasses::check_offset(const char *klass_name, int hardcoded_offset, const char *field_name, const char* field_sig) {
3972   EXCEPTION_MARK;
3973   fieldDescriptor fd;
3974   TempNewSymbol klass_sym = SymbolTable::new_symbol(klass_name, CATCH);
3975   Klass* k = SystemDictionary::resolve_or_fail(klass_sym, true, CATCH);
3976   InstanceKlass* ik = InstanceKlass::cast(k);
3977   TempNewSymbol f_name = SymbolTable::new_symbol(field_name, CATCH);
3978   TempNewSymbol f_sig  = SymbolTable::new_symbol(field_sig, CATCH);
3979   if (!ik->find_local_field(f_name, f_sig, &fd)) {
3980     tty->print_cr("Nonstatic field %s.%s not found", klass_name, field_name);
3981     return false;


4109 
4110   // java.lang.StackTraceElement
4111 
4112   CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, declaringClassObject, "Ljava/lang/Class;");
4113   CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, classLoaderName, "Ljava/lang/String;");
4114   CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, moduleName,      "Ljava/lang/String;");
4115   CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, moduleVersion,   "Ljava/lang/String;");
4116   CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, declaringClass,  "Ljava/lang/String;");
4117   CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, methodName,      "Ljava/lang/String;");
4118   CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, fileName,        "Ljava/lang/String;");
4119   CHECK_OFFSET("java/lang/StackTraceElement", java_lang_StackTraceElement, lineNumber,      "I");
4120 
4121   // java.lang.ref.Reference
4122 
4123   CHECK_OFFSET("java/lang/ref/Reference", java_lang_ref_Reference, referent, "Ljava/lang/Object;");
4124   CHECK_OFFSET("java/lang/ref/Reference", java_lang_ref_Reference, queue, "Ljava/lang/ref/ReferenceQueue;");
4125   CHECK_OFFSET("java/lang/ref/Reference", java_lang_ref_Reference, next, "Ljava/lang/ref/Reference;");
4126   // Fake field
4127   //CHECK_OFFSET("java/lang/ref/Reference", java_lang_ref_Reference, discovered, "Ljava/lang/ref/Reference;");
4128 
4129   // java.lang.Continuation
4130 
4131   CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, target,   "Ljava/lang/Runnable;");
4132   CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, stack,    "[I");
4133   CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, parent,   "Ljava/lang/Continuation;");
4134   CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, parentSP, "J");
4135   CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, parentFP, "J");
4136   CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, lastFP,   "I");
4137   CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, lastSP,   "I");
4138   CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, reg0,     "J");
4139   CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, reg1,     "J");
4140   CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, reg2,     "J");
4141 
4142   // java.lang.ref.SoftReference
4143 
4144   CHECK_OFFSET("java/lang/ref/SoftReference", java_lang_ref_SoftReference, timestamp, "J");
4145   CHECK_STATIC_OFFSET("java/lang/ref/SoftReference", java_lang_ref_SoftReference, clock, "J");
4146 
4147   // java.lang.AssertionStatusDirectives
4148   //
4149   // The CheckAssertionStatusDirectives boolean can be removed from here and
4150   // globals.hpp after the AssertionStatusDirectives class has been integrated
4151   // into merlin "for some time."  Without it, the vm will fail with early
4152   // merlin builds.
4153 
4154   if (CheckAssertionStatusDirectives) {
4155     const char* nm = "java/lang/AssertionStatusDirectives";
4156     const char* sig = "[Ljava/lang/String;";
4157     CHECK_OFFSET(nm, java_lang_AssertionStatusDirectives, classes, sig);
4158     CHECK_OFFSET(nm, java_lang_AssertionStatusDirectives, classEnabled, "[Z");
4159     CHECK_OFFSET(nm, java_lang_AssertionStatusDirectives, packages, sig);
4160     CHECK_OFFSET(nm, java_lang_AssertionStatusDirectives, packageEnabled, "[Z");
4161     CHECK_OFFSET(nm, java_lang_AssertionStatusDirectives, deflt, "Z");


< prev index next >