src/share/vm/compiler/compilerDirectives.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/share/vm/compiler/compilerDirectives.cpp	Fri Oct 23 09:49:08 2015
--- new/src/share/vm/compiler/compilerDirectives.cpp	Fri Oct 23 09:49:08 2015

*** 350,361 **** --- 350,396 ---- bool DirectiveSet::is_intrinsic_disabled(methodHandle method) { vmIntrinsics::ID id = method->intrinsic_id(); assert(id != vmIntrinsics::_none, "must be a VM intrinsic"); ! ccstr disable_intr = DisableIntrinsicOption; return ((disable_intr != '\0') && strstr(disable_intr, vmIntrinsics::name_at(id)) != NULL); ! ResourceMark rm; + + // Create a copy of the string that contains the list of disabled + // intrinsics. The copy is created because the string + // will be modified by this method as well as by a callee of + // this method, strtok(). + size_t length = strlen(DisableIntrinsicOption); + char* local_list = NEW_RESOURCE_ARRAY(char, length + 1); + strncpy(local_list, DisableIntrinsicOption, length + 1); + + // In the list of disabled intrinsics, the ID of the disabled intrinsics can separated: + // - by ',' (if -XX:DisableIntrinsic is used once when invoking the VM) or + // - by '\n' (if -XX:DisableIntrinsic is used multiple times when invoking the VM) or + // - by ' ' (if DisableIntrinsic is used on a per-method level, e.g., with CompileCommand). + // + // To simplify the processing of the list, in the local copy of the list '\n' and ' ' + // is replaced with ','. Then, the list is tokenized with ',' as a separator. + char* current = local_list; + while (*current != '\0') { + if (*current == '\n') { + *current = ','; + } else if (*current == ' ') { + *current = ','; + } + current++; + } + + char* token = strtok(local_list, ","); + while (token != NULL) { + if (strcmp(token, vmIntrinsics::name_at(id)) == 0) { + return true; + } else { + token = strtok(NULL, ","); + } + } + + return false; } DirectiveSet* DirectiveSet::clone(DirectiveSet const* src) { DirectiveSet* set = new DirectiveSet(NULL); memcpy(set->_modified, src->_modified, sizeof(src->_modified));

src/share/vm/compiler/compilerDirectives.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File