--- a/hotspot/src/share/vm/classfile/vmSymbols.cpp Fri May 20 18:27:03 2016 +0300
+++ b/hotspot/src/share/vm/classfile/vmSymbols.cpp Fri May 20 14:17:55 2016 -0700
@@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "classfile/vmSymbols.hpp"
+#include "compiler/compilerDirectives.hpp"
#include "memory/oopFactory.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/handles.inline.hpp"
@@ -418,9 +419,43 @@
}
}
+bool vmIntrinsics::is_intrinsic_available(vmIntrinsics::ID id) {
+ return !vmIntrinsics::is_intrinsic_disabled(id) &&
+ !vmIntrinsics::is_disabled_by_flags(id);
+}
+
+bool vmIntrinsics::is_intrinsic_disabled(vmIntrinsics::ID id) {
+ assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
+
+ // Canonicalize DisableIntrinsic to contain only ',' as a separator.
+ // Note, DirectiveSet may not be created at this point yet since this code
+ // is called from initial stub geenration code.
+ char* local_list = (char*)DirectiveSet::canonicalize_disableintrinsic(DisableIntrinsic);
+
+ bool found = false;
+ char* token = strtok(local_list, ",");
+ while (token != NULL) {
+ if (strcmp(token, vmIntrinsics::name_at(id)) == 0) {
+ found = true;
+ break;
+ } else {
+ token = strtok(NULL, ",");
+ }
+ }
+
+ FREE_C_HEAP_ARRAY(char, local_list);
+ return found;
+}
+
+
bool vmIntrinsics::is_disabled_by_flags(const methodHandle& method) {
vmIntrinsics::ID id = method->intrinsic_id();
assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
+ return is_disabled_by_flags(id);
+}
+
+bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
+ assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
// -XX:-InlineNatives disables nearly all intrinsics except the ones listed in
// the following switch statement.