56 #include "prims/privilegedStack.hpp"
57 #include "prims/stackwalk.hpp"
58 #include "runtime/arguments.hpp"
59 #include "runtime/atomic.hpp"
60 #include "runtime/handles.inline.hpp"
61 #include "runtime/init.hpp"
62 #include "runtime/interfaceSupport.inline.hpp"
63 #include "runtime/java.hpp"
64 #include "runtime/javaCalls.hpp"
65 #include "runtime/jfieldIDWorkaround.hpp"
66 #include "runtime/jniHandles.inline.hpp"
67 #include "runtime/orderAccess.inline.hpp"
68 #include "runtime/os.inline.hpp"
69 #include "runtime/perfData.hpp"
70 #include "runtime/reflection.hpp"
71 #include "runtime/thread.inline.hpp"
72 #include "runtime/threadSMR.hpp"
73 #include "runtime/vframe.inline.hpp"
74 #include "runtime/vm_operations.hpp"
75 #include "runtime/vm_version.hpp"
76 #include "services/attachListener.hpp"
77 #include "services/management.hpp"
78 #include "services/threadService.hpp"
79 #include "utilities/copy.hpp"
80 #include "utilities/defaultStream.hpp"
81 #include "utilities/dtrace.hpp"
82 #include "utilities/events.hpp"
83 #include "utilities/histogram.hpp"
84 #include "utilities/macros.hpp"
85 #include "utilities/utf8.hpp"
86 #if INCLUDE_CDS
87 #include "classfile/systemDictionaryShared.hpp"
88 #endif
89
90 #include <errno.h>
91
92 /*
93 NOTE about use of any ctor or function call that can trigger a safepoint/GC:
94 such ctors and calls MUST NOT come between an oop declaration/init and its
95 usage because if objects are move this may cause various memory stomps, bus
663 const int length = ((arrayOop)obj())->length();
664 new_obj_oop = CollectedHeap::array_allocate(klass, size, length, CHECK_NULL);
665 } else {
666 new_obj_oop = CollectedHeap::obj_allocate(klass, size, CHECK_NULL);
667 }
668
669 HeapAccess<>::clone(obj(), new_obj_oop, size);
670
671 Handle new_obj(THREAD, new_obj_oop);
672 // Caution: this involves a java upcall, so the clone should be
673 // "gc-robust" by this stage.
674 if (klass->has_finalizer()) {
675 assert(obj->is_instance(), "should be instanceOop");
676 new_obj_oop = InstanceKlass::register_finalizer(instanceOop(new_obj()), CHECK_NULL);
677 new_obj = Handle(THREAD, new_obj_oop);
678 }
679
680 return JNIHandles::make_local(env, new_obj());
681 JVM_END
682
683 // java.io.File ///////////////////////////////////////////////////////////////
684
685 JVM_LEAF(char*, JVM_NativePath(char* path))
686 JVMWrapper("JVM_NativePath");
687 return os::native_path(path);
688 JVM_END
689
690
691 // Misc. class handling ///////////////////////////////////////////////////////////
692
693
694 JVM_ENTRY(jclass, JVM_GetCallerClass(JNIEnv* env))
695 JVMWrapper("JVM_GetCallerClass");
696
697 // Getting the class of the caller frame.
698 //
699 // The call stack at this point looks something like this:
700 //
701 // [0] [ @CallerSensitive public sun.reflect.Reflection.getCallerClass ]
702 // [1] [ @CallerSensitive API.method ]
|
56 #include "prims/privilegedStack.hpp"
57 #include "prims/stackwalk.hpp"
58 #include "runtime/arguments.hpp"
59 #include "runtime/atomic.hpp"
60 #include "runtime/handles.inline.hpp"
61 #include "runtime/init.hpp"
62 #include "runtime/interfaceSupport.inline.hpp"
63 #include "runtime/java.hpp"
64 #include "runtime/javaCalls.hpp"
65 #include "runtime/jfieldIDWorkaround.hpp"
66 #include "runtime/jniHandles.inline.hpp"
67 #include "runtime/orderAccess.inline.hpp"
68 #include "runtime/os.inline.hpp"
69 #include "runtime/perfData.hpp"
70 #include "runtime/reflection.hpp"
71 #include "runtime/thread.inline.hpp"
72 #include "runtime/threadSMR.hpp"
73 #include "runtime/vframe.inline.hpp"
74 #include "runtime/vm_operations.hpp"
75 #include "runtime/vm_version.hpp"
76 #include "runtime/continuation.hpp"
77 #include "services/attachListener.hpp"
78 #include "services/management.hpp"
79 #include "services/threadService.hpp"
80 #include "utilities/copy.hpp"
81 #include "utilities/defaultStream.hpp"
82 #include "utilities/dtrace.hpp"
83 #include "utilities/events.hpp"
84 #include "utilities/histogram.hpp"
85 #include "utilities/macros.hpp"
86 #include "utilities/utf8.hpp"
87 #if INCLUDE_CDS
88 #include "classfile/systemDictionaryShared.hpp"
89 #endif
90
91 #include <errno.h>
92
93 /*
94 NOTE about use of any ctor or function call that can trigger a safepoint/GC:
95 such ctors and calls MUST NOT come between an oop declaration/init and its
96 usage because if objects are move this may cause various memory stomps, bus
664 const int length = ((arrayOop)obj())->length();
665 new_obj_oop = CollectedHeap::array_allocate(klass, size, length, CHECK_NULL);
666 } else {
667 new_obj_oop = CollectedHeap::obj_allocate(klass, size, CHECK_NULL);
668 }
669
670 HeapAccess<>::clone(obj(), new_obj_oop, size);
671
672 Handle new_obj(THREAD, new_obj_oop);
673 // Caution: this involves a java upcall, so the clone should be
674 // "gc-robust" by this stage.
675 if (klass->has_finalizer()) {
676 assert(obj->is_instance(), "should be instanceOop");
677 new_obj_oop = InstanceKlass::register_finalizer(instanceOop(new_obj()), CHECK_NULL);
678 new_obj = Handle(THREAD, new_obj_oop);
679 }
680
681 return JNIHandles::make_local(env, new_obj());
682 JVM_END
683
684 // java.lang.Continuation /////////////////////////////////////////////////////
685
686 JVM_ENTRY(void, JVM_RegisterContinuationMethods(JNIEnv *env, jclass cls))
687 CONT_RegisterNativeMethods(env, cls);
688 JVM_END
689
690 // java.io.File ///////////////////////////////////////////////////////////////
691
692 JVM_LEAF(char*, JVM_NativePath(char* path))
693 JVMWrapper("JVM_NativePath");
694 return os::native_path(path);
695 JVM_END
696
697
698 // Misc. class handling ///////////////////////////////////////////////////////////
699
700
701 JVM_ENTRY(jclass, JVM_GetCallerClass(JNIEnv* env))
702 JVMWrapper("JVM_GetCallerClass");
703
704 // Getting the class of the caller frame.
705 //
706 // The call stack at this point looks something like this:
707 //
708 // [0] [ @CallerSensitive public sun.reflect.Reflection.getCallerClass ]
709 // [1] [ @CallerSensitive API.method ]
|