< prev index next >

src/hotspot/share/prims/whitebox.cpp

Print this page
   1 /*
   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.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


1685 WB_END
1686 
1687 WB_ENTRY(jobject, WB_GetMethodStringOption(JNIEnv* env, jobject wb, jobject method, jstring name))
1688   ccstr ccstrResult;
1689   if (GetMethodOption <ccstr> (thread, env, method, name, &ccstrResult)) {
1690     // can't be in VM when we call JNI
1691     ThreadToNativeFromVM ttnfv(thread);
1692     jstring result = env->NewStringUTF(ccstrResult);
1693     CHECK_JNI_EXCEPTION_(env, NULL);
1694     return result;
1695   }
1696   return NULL;
1697 WB_END
1698 
1699 WB_ENTRY(jboolean, WB_IsShared(JNIEnv* env, jobject wb, jobject obj))
1700   oop obj_oop = JNIHandles::resolve(obj);
1701   return oopDesc::is_archive_object(obj_oop);
1702 WB_END
1703 
1704 WB_ENTRY(jboolean, WB_IsSharedClass(JNIEnv* env, jobject wb, jclass clazz))
1705   return (jboolean)MetaspaceShared::is_in_shared_space(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
1706 WB_END
1707 
1708 WB_ENTRY(jboolean, WB_AreSharedStringsIgnored(JNIEnv* env))
1709   return !StringTable::shared_string_mapped();
1710 WB_END
1711 
1712 WB_ENTRY(jobject, WB_GetResolvedReferences(JNIEnv* env, jobject wb, jclass clazz))
1713   Klass *k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz));
1714   if (k->is_instance_klass()) {
1715     InstanceKlass *ik = InstanceKlass::cast(k);
1716     ConstantPool *cp = ik->constants();
1717     objArrayOop refs =  cp->resolved_references();
1718     return (jobject)JNIHandles::make_local(env, refs);
1719   } else {
1720     return NULL;
1721   }
1722 WB_END
1723 
1724 WB_ENTRY(jboolean, WB_AreOpenArchiveHeapObjectsMapped(JNIEnv* env))
1725   return MetaspaceShared::open_archive_heap_region_mapped();


   1 /*
   2  * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


1685 WB_END
1686 
1687 WB_ENTRY(jobject, WB_GetMethodStringOption(JNIEnv* env, jobject wb, jobject method, jstring name))
1688   ccstr ccstrResult;
1689   if (GetMethodOption <ccstr> (thread, env, method, name, &ccstrResult)) {
1690     // can't be in VM when we call JNI
1691     ThreadToNativeFromVM ttnfv(thread);
1692     jstring result = env->NewStringUTF(ccstrResult);
1693     CHECK_JNI_EXCEPTION_(env, NULL);
1694     return result;
1695   }
1696   return NULL;
1697 WB_END
1698 
1699 WB_ENTRY(jboolean, WB_IsShared(JNIEnv* env, jobject wb, jobject obj))
1700   oop obj_oop = JNIHandles::resolve(obj);
1701   return oopDesc::is_archive_object(obj_oop);
1702 WB_END
1703 
1704 WB_ENTRY(jboolean, WB_IsSharedClass(JNIEnv* env, jobject wb, jclass clazz))
1705   return (jboolean)MetaspaceShared::is_in_shared_metaspace(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
1706 WB_END
1707 
1708 WB_ENTRY(jboolean, WB_AreSharedStringsIgnored(JNIEnv* env))
1709   return !StringTable::shared_string_mapped();
1710 WB_END
1711 
1712 WB_ENTRY(jobject, WB_GetResolvedReferences(JNIEnv* env, jobject wb, jclass clazz))
1713   Klass *k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz));
1714   if (k->is_instance_klass()) {
1715     InstanceKlass *ik = InstanceKlass::cast(k);
1716     ConstantPool *cp = ik->constants();
1717     objArrayOop refs =  cp->resolved_references();
1718     return (jobject)JNIHandles::make_local(env, refs);
1719   } else {
1720     return NULL;
1721   }
1722 WB_END
1723 
1724 WB_ENTRY(jboolean, WB_AreOpenArchiveHeapObjectsMapped(JNIEnv* env))
1725   return MetaspaceShared::open_archive_heap_region_mapped();


< prev index next >