comparison src/share/vm/classfile/javaClasses.cpp @ 726:be93aad57795

6655646: dynamic languages need dynamically linked call sites Summary: invokedynamic instruction (JSR 292 RI) Reviewed-by: twisti, never
author jrose
date Tue, 21 Apr 2009 23:21:04 -0700
parents e5b0439ef4ae
children 9987d9d5eb0e
comparison
equal deleted inserted replaced
725:928912ce8438 726:be93aad57795
2428 assert(mtform->klass() == SystemDictionary::MethodTypeForm_klass(), "MTForm only"); 2428 assert(mtform->klass() == SystemDictionary::MethodTypeForm_klass(), "MTForm only");
2429 return mtform->obj_field(_erasedType_offset); 2429 return mtform->obj_field(_erasedType_offset);
2430 } 2430 }
2431 2431
2432 2432
2433 // Support for sun_dyn_CallSiteImpl
2434
2435 int sun_dyn_CallSiteImpl::_type_offset;
2436 int sun_dyn_CallSiteImpl::_target_offset;
2437 int sun_dyn_CallSiteImpl::_vmmethod_offset;
2438
2439 void sun_dyn_CallSiteImpl::compute_offsets() {
2440 if (!EnableInvokeDynamic) return;
2441 klassOop k = SystemDictionary::CallSiteImpl_klass();
2442 if (k != NULL) {
2443 compute_offset(_type_offset, k, vmSymbols::type_name(), vmSymbols::java_dyn_MethodType_signature(), true);
2444 compute_offset(_target_offset, k, vmSymbols::target_name(), vmSymbols::java_dyn_MethodHandle_signature(), true);
2445 compute_offset(_vmmethod_offset, k, vmSymbols::vmmethod_name(), vmSymbols::object_signature(), true);
2446 }
2447 }
2448
2449 oop sun_dyn_CallSiteImpl::type(oop site) {
2450 return site->obj_field(_type_offset);
2451 }
2452
2453 oop sun_dyn_CallSiteImpl::target(oop site) {
2454 return site->obj_field(_target_offset);
2455 }
2456
2457 void sun_dyn_CallSiteImpl::set_target(oop site, oop target) {
2458 site->obj_field_put(_target_offset, target);
2459 }
2460
2461 oop sun_dyn_CallSiteImpl::vmmethod(oop site) {
2462 return site->obj_field(_vmmethod_offset);
2463 }
2464
2465 void sun_dyn_CallSiteImpl::set_vmmethod(oop site, oop ref) {
2466 site->obj_field_put(_vmmethod_offset, ref);
2467 }
2433 2468
2434 2469
2435 // Support for java_security_AccessControlContext 2470 // Support for java_security_AccessControlContext
2436 2471
2437 int java_security_AccessControlContext::_context_offset = 0; 2472 int java_security_AccessControlContext::_context_offset = 0;
2773 sun_dyn_BoundMethodHandle::compute_offsets(); 2808 sun_dyn_BoundMethodHandle::compute_offsets();
2774 sun_dyn_AdapterMethodHandle::compute_offsets(); 2809 sun_dyn_AdapterMethodHandle::compute_offsets();
2775 java_dyn_MethodType::compute_offsets(); 2810 java_dyn_MethodType::compute_offsets();
2776 java_dyn_MethodTypeForm::compute_offsets(); 2811 java_dyn_MethodTypeForm::compute_offsets();
2777 } 2812 }
2813 if (EnableInvokeDynamic) {
2814 sun_dyn_CallSiteImpl::compute_offsets();
2815 }
2778 java_security_AccessControlContext::compute_offsets(); 2816 java_security_AccessControlContext::compute_offsets();
2779 // Initialize reflection classes. The layouts of these classes 2817 // Initialize reflection classes. The layouts of these classes
2780 // changed with the new reflection implementation in JDK 1.4, and 2818 // changed with the new reflection implementation in JDK 1.4, and
2781 // since the Universe doesn't know what JDK version it is until this 2819 // since the Universe doesn't know what JDK version it is until this
2782 // point we defer computation of these offsets until now. 2820 // point we defer computation of these offsets until now.