< prev index next >

src/share/vm/classfile/vmSymbols.cpp

Print this page

        

@@ -414,13 +414,50 @@
   default:
     return 0;
   }
 }
 
+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");
+
+  ResourceMark rm;
+  ccstr DisableIntrinsicString = DirectiveSet::canonicalize_disableintrinsic(DisableIntrinsic);
+  // Create a copy of the string that contains the list of disabled
+  // intrinsics. The copy is created because the string
+  // will be modified by strtok(). Then, the list is tokenized with
+  // ',' as a separator.
+  size_t length = strlen(DisableIntrinsicString);
+  char* local_list = NEW_RESOURCE_ARRAY(char, length + 1);
+  strncpy(local_list, DisableIntrinsicString, length + 1);
+
+  char* token = strtok(local_list, ",");
+  while (token != NULL) {
+    if (strcmp(token, vmIntrinsics::name_at(id)) == 0) {
+      return true;
+    }
+    else {
+      token = strtok(NULL, ",");
+    }
+  }
+
+  return false;
+}
+
+
 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.
   if (!InlineNatives) {
     switch (id) {
< prev index next >