< prev index next >

src/hotspot/share/prims/jvm.cpp

Print this page
rev 49275 : [mq]: JDK-8199781.patch


1347   oop previous_protection_domain = NULL;
1348   Handle privileged_context(thread, NULL);
1349   bool is_privileged = false;
1350   oop protection_domain = NULL;
1351 
1352   for(; !vfst.at_end(); vfst.next()) {
1353     // get method of frame
1354     Method* method = vfst.method();
1355     intptr_t* frame_id   = vfst.frame_id();
1356 
1357     // check the privileged frames to see if we have a match
1358     if (thread->privileged_stack_top() && thread->privileged_stack_top()->frame_id() == frame_id) {
1359       // this frame is privileged
1360       is_privileged = true;
1361       privileged_context = Handle(thread, thread->privileged_stack_top()->privileged_context());
1362       protection_domain  = thread->privileged_stack_top()->protection_domain();
1363     } else {
1364       protection_domain = method->method_holder()->protection_domain();
1365     }
1366 
1367     if ((previous_protection_domain != protection_domain) && (protection_domain != NULL)) {
1368       local_array->push(protection_domain);
1369       previous_protection_domain = protection_domain;
1370     }
1371 
1372     if (is_privileged) break;
1373   }
1374 
1375 
1376   // either all the domains on the stack were system domains, or
1377   // we had a privileged system domain
1378   if (local_array->is_empty()) {
1379     if (is_privileged && privileged_context.is_null()) return NULL;
1380 
1381     oop result = java_security_AccessControlContext::create(objArrayHandle(), is_privileged, privileged_context, CHECK_NULL);
1382     return JNIHandles::make_local(env, result);
1383   }
1384 
1385   // the resource area must be registered in case of a gc
1386   RegisterArrayForGC ragc(thread, local_array);
1387   objArrayOop context = oopFactory::new_objArray(SystemDictionary::ProtectionDomain_klass(),




1347   oop previous_protection_domain = NULL;
1348   Handle privileged_context(thread, NULL);
1349   bool is_privileged = false;
1350   oop protection_domain = NULL;
1351 
1352   for(; !vfst.at_end(); vfst.next()) {
1353     // get method of frame
1354     Method* method = vfst.method();
1355     intptr_t* frame_id   = vfst.frame_id();
1356 
1357     // check the privileged frames to see if we have a match
1358     if (thread->privileged_stack_top() && thread->privileged_stack_top()->frame_id() == frame_id) {
1359       // this frame is privileged
1360       is_privileged = true;
1361       privileged_context = Handle(thread, thread->privileged_stack_top()->privileged_context());
1362       protection_domain  = thread->privileged_stack_top()->protection_domain();
1363     } else {
1364       protection_domain = method->method_holder()->protection_domain();
1365     }
1366 
1367     if ((!oopDesc::equals(previous_protection_domain, protection_domain)) && (protection_domain != NULL)) {
1368       local_array->push(protection_domain);
1369       previous_protection_domain = protection_domain;
1370     }
1371 
1372     if (is_privileged) break;
1373   }
1374 
1375 
1376   // either all the domains on the stack were system domains, or
1377   // we had a privileged system domain
1378   if (local_array->is_empty()) {
1379     if (is_privileged && privileged_context.is_null()) return NULL;
1380 
1381     oop result = java_security_AccessControlContext::create(objArrayHandle(), is_privileged, privileged_context, CHECK_NULL);
1382     return JNIHandles::make_local(env, result);
1383   }
1384 
1385   // the resource area must be registered in case of a gc
1386   RegisterArrayForGC ragc(thread, local_array);
1387   objArrayOop context = oopFactory::new_objArray(SystemDictionary::ProtectionDomain_klass(),


< prev index next >