This commit is contained in:
Henry Jen 2019-01-15 10:55:26 -08:00
commit 776ef6a071
381 changed files with 8349 additions and 3043 deletions

View file

@ -61,6 +61,7 @@
#include "runtime/handles.inline.hpp"
#include "runtime/init.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/deoptimization.hpp"
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/jfieldIDWorkaround.hpp"
@ -1229,11 +1230,10 @@ JVM_ENTRY(jobject, JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls))
oop protection_domain = NULL;
// Iterate through Java frames
RegisterMap reg_map(thread);
javaVFrame *vf = thread->last_java_vframe(&reg_map);
for (; vf != NULL; vf = vf->java_sender()) {
vframeStream vfst(thread);
for(; !vfst.at_end(); vfst.next()) {
// get method of frame
Method* method = vf->method();
Method* method = vfst.method();
// stop at the first privileged frame
if (method->method_holder() == SystemDictionary::AccessController_klass() &&
@ -1242,13 +1242,15 @@ JVM_ENTRY(jobject, JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls))
// this frame is privileged
is_privileged = true;
javaVFrame *priv = vf; // executePrivileged
javaVFrame *caller_fr = priv->java_sender(); // doPrivileged
caller_fr = caller_fr->java_sender(); // caller
javaVFrame *priv = vfst.asJavaVFrame(); // executePrivileged
StackValueCollection* locals = priv->locals();
privileged_context = locals->obj_at(1);
Handle caller = locals->obj_at(2);
StackValue* ctx_sv = locals->at(1); // AccessControlContext context
StackValue* clr_sv = locals->at(2); // Class<?> caller
assert(!ctx_sv->obj_is_scalar_replaced(), "found scalar-replaced object");
assert(!clr_sv->obj_is_scalar_replaced(), "found scalar-replaced object");
privileged_context = ctx_sv->get_obj();
Handle caller = clr_sv->get_obj();
Klass *caller_klass = java_lang_Class::as_Klass(caller());
protection_domain = caller_klass->protection_domain();