hotspot/src/share/vm/prims/whitebox.cpp
changeset 46271 979ebd346ecf
parent 42650 1f304d0c888b
child 46289 1904e7ec236e
equal deleted inserted replaced
46270:2e7898927798 46271:979ebd346ecf
     1 /*
     1 /*
     2  * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   122         return _found;
   122         return _found;
   123     }
   123     }
   124 };
   124 };
   125 
   125 
   126 WB_ENTRY(jboolean, WB_IsClassAlive(JNIEnv* env, jobject target, jstring name))
   126 WB_ENTRY(jboolean, WB_IsClassAlive(JNIEnv* env, jobject target, jstring name))
   127   Handle h_name = JNIHandles::resolve(name);
   127   oop h_name = JNIHandles::resolve(name);
   128   if (h_name.is_null()) return false;
   128   if (h_name == NULL) return false;
   129   Symbol* sym = java_lang_String::as_symbol(h_name, CHECK_false);
   129   Symbol* sym = java_lang_String::as_symbol(h_name, CHECK_false);
   130   TempNewSymbol tsym(sym); // Make sure to decrement reference count on sym on return
   130   TempNewSymbol tsym(sym); // Make sure to decrement reference count on sym on return
   131 
   131 
   132   WBIsKlassAliveClosure closure(sym);
   132   WBIsKlassAliveClosure closure(sym);
   133   ClassLoaderDataGraph::classes_do(&closure);
   133   ClassLoaderDataGraph::classes_do(&closure);
  1912 JVM_ENTRY(void, JVM_RegisterWhiteBoxMethods(JNIEnv* env, jclass wbclass))
  1912 JVM_ENTRY(void, JVM_RegisterWhiteBoxMethods(JNIEnv* env, jclass wbclass))
  1913   {
  1913   {
  1914     if (WhiteBoxAPI) {
  1914     if (WhiteBoxAPI) {
  1915       // Make sure that wbclass is loaded by the null classloader
  1915       // Make sure that wbclass is loaded by the null classloader
  1916       instanceKlassHandle ikh = instanceKlassHandle(JNIHandles::resolve(wbclass)->klass());
  1916       instanceKlassHandle ikh = instanceKlassHandle(JNIHandles::resolve(wbclass)->klass());
  1917       Handle loader(ikh->class_loader());
  1917       Handle loader(THREAD, ikh->class_loader());
  1918       if (loader.is_null()) {
  1918       if (loader.is_null()) {
  1919         WhiteBox::register_methods(env, wbclass, thread, methods, sizeof(methods) / sizeof(methods[0]));
  1919         WhiteBox::register_methods(env, wbclass, thread, methods, sizeof(methods) / sizeof(methods[0]));
  1920         WhiteBox::register_extended(env, wbclass, thread);
  1920         WhiteBox::register_extended(env, wbclass, thread);
  1921         WhiteBox::set_used();
  1921         WhiteBox::set_used();
  1922       }
  1922       }