< prev index next >

src/hotspot/share/prims/jvm.cpp

Print this page




 661   if (klass->has_finalizer()) {
 662     assert(obj->is_instance(), "should be instanceOop");
 663     new_obj_oop = InstanceKlass::register_finalizer(instanceOop(new_obj()), CHECK_NULL);
 664     new_obj = Handle(THREAD, new_obj_oop);
 665   }
 666 
 667   return JNIHandles::make_local(env, new_obj());
 668 JVM_END
 669 
 670 // java.io.File ///////////////////////////////////////////////////////////////
 671 
 672 JVM_LEAF(char*, JVM_NativePath(char* path))
 673   JVMWrapper("JVM_NativePath");
 674   return os::native_path(path);
 675 JVM_END
 676 
 677 
 678 // Misc. class handling ///////////////////////////////////////////////////////////
 679 
 680 
 681 JVM_ENTRY(jclass, JVM_GetCallerClass(JNIEnv* env, int depth))
 682   JVMWrapper("JVM_GetCallerClass");
 683 
 684   // Pre-JDK 8 and early builds of JDK 8 don't have a CallerSensitive annotation; or
 685   // sun.reflect.Reflection.getCallerClass with a depth parameter is provided
 686   // temporarily for existing code to use until a replacement API is defined.
 687   if (SystemDictionary::reflect_CallerSensitive_klass() == NULL || depth != JVM_CALLER_DEPTH) {
 688     Klass* k = thread->security_get_caller_class(depth);
 689     return (k == NULL) ? NULL : (jclass) JNIHandles::make_local(env, k->java_mirror());
 690   }
 691 
 692   // Getting the class of the caller frame.
 693   //
 694   // The call stack at this point looks something like this:
 695   //
 696   // [0] [ @CallerSensitive public sun.reflect.Reflection.getCallerClass ]
 697   // [1] [ @CallerSensitive API.method                                   ]
 698   // [.] [ (skipped intermediate frames)                                 ]
 699   // [n] [ caller                                                        ]
 700   vframeStream vfst(thread);
 701   // Cf. LibraryCallKit::inline_native_Reflection_getCallerClass
 702   for (int n = 0; !vfst.at_end(); vfst.security_next(), n++) {
 703     Method* m = vfst.method();
 704     assert(m != NULL, "sanity");
 705     switch (n) {
 706     case 0:
 707       // This must only be called from Reflection.getCallerClass
 708       if (m->intrinsic_id() != vmIntrinsics::_getCallerClass) {
 709         THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), "JVM_GetCallerClass must only be called from Reflection.getCallerClass");
 710       }




 661   if (klass->has_finalizer()) {
 662     assert(obj->is_instance(), "should be instanceOop");
 663     new_obj_oop = InstanceKlass::register_finalizer(instanceOop(new_obj()), CHECK_NULL);
 664     new_obj = Handle(THREAD, new_obj_oop);
 665   }
 666 
 667   return JNIHandles::make_local(env, new_obj());
 668 JVM_END
 669 
 670 // java.io.File ///////////////////////////////////////////////////////////////
 671 
 672 JVM_LEAF(char*, JVM_NativePath(char* path))
 673   JVMWrapper("JVM_NativePath");
 674   return os::native_path(path);
 675 JVM_END
 676 
 677 
 678 // Misc. class handling ///////////////////////////////////////////////////////////
 679 
 680 
 681 JVM_ENTRY(jclass, JVM_GetCallerClass(JNIEnv* env))
 682   JVMWrapper("JVM_GetCallerClass");








 683 
 684   // Getting the class of the caller frame.
 685   //
 686   // The call stack at this point looks something like this:
 687   //
 688   // [0] [ @CallerSensitive public sun.reflect.Reflection.getCallerClass ]
 689   // [1] [ @CallerSensitive API.method                                   ]
 690   // [.] [ (skipped intermediate frames)                                 ]
 691   // [n] [ caller                                                        ]
 692   vframeStream vfst(thread);
 693   // Cf. LibraryCallKit::inline_native_Reflection_getCallerClass
 694   for (int n = 0; !vfst.at_end(); vfst.security_next(), n++) {
 695     Method* m = vfst.method();
 696     assert(m != NULL, "sanity");
 697     switch (n) {
 698     case 0:
 699       // This must only be called from Reflection.getCallerClass
 700       if (m->intrinsic_id() != vmIntrinsics::_getCallerClass) {
 701         THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), "JVM_GetCallerClass must only be called from Reflection.getCallerClass");
 702       }


< prev index next >