< prev index next >

src/hotspot/share/compiler/methodMatcher.cpp

Print this page

268 
269   if (!MethodMatcher::canonicalize(line, error_msg)) {
270     assert(error_msg != nullptr, "Message must be set if parsing failed");
271     return;
272   }
273 
274   skip_leading_spaces(line, &total_bytes_read);
275   if (*line == '\0') {
276     error_msg = "Method pattern missing from command";
277     return;
278   }
279 
280   if (2 == sscanf(line, "%255" RANGESLASH "%*[ ]" "%255"  RANGE0 "%n", class_name, method_name, &bytes_read)) {
281     c_match = check_mode(class_name, error_msg);
282     m_match = check_mode(method_name, error_msg);
283 
284     // Over-consumption
285     // method_name points to an option type or option name because the method name is not specified by users.
286     // In very rare case, the method name happens to be same as option type/name, so look ahead to make sure
287     // it doesn't show up again.
288     if ((OptionType::Unknown != CompilerOracle::parse_option_type(method_name) ||
289         CompileCommandEnum::Unknown != CompilerOracle::parse_option_name(method_name)) &&
290         *(line + bytes_read) != '\0' &&
291         strstr(line + bytes_read, method_name) == nullptr) {
292       error_msg = "Did not specify any method name";
293       method_name[0] = '\0';
294       return;
295     }

296 
297     if ((strchr(class_name, JVM_SIGNATURE_SPECIAL) != nullptr) ||
298         (strchr(class_name, JVM_SIGNATURE_ENDSPECIAL) != nullptr)) {
299       error_msg = "Chars '<' and '>' not allowed in class name";
300       return;
301     }
302 
303     if ((strchr(method_name, JVM_SIGNATURE_SPECIAL) != nullptr) ||
304         (strchr(method_name, JVM_SIGNATURE_ENDSPECIAL) != nullptr)) {
305       if (!vmSymbols::object_initializer_name()->equals(method_name) &&
306           !vmSymbols::class_initializer_name()->equals(method_name)) {
307         error_msg = "Chars '<' and '>' only allowed in <init> and <clinit>";
308         return;
309       }
310     }
311 
312     if (c_match == MethodMatcher::Unknown || m_match == MethodMatcher::Unknown) {
313       assert(error_msg != nullptr, "Must have been set by check_mode()");
314       return;
315     }

268 
269   if (!MethodMatcher::canonicalize(line, error_msg)) {
270     assert(error_msg != nullptr, "Message must be set if parsing failed");
271     return;
272   }
273 
274   skip_leading_spaces(line, &total_bytes_read);
275   if (*line == '\0') {
276     error_msg = "Method pattern missing from command";
277     return;
278   }
279 
280   if (2 == sscanf(line, "%255" RANGESLASH "%*[ ]" "%255"  RANGE0 "%n", class_name, method_name, &bytes_read)) {
281     c_match = check_mode(class_name, error_msg);
282     m_match = check_mode(method_name, error_msg);
283 
284     // Over-consumption
285     // method_name points to an option type or option name because the method name is not specified by users.
286     // In very rare case, the method name happens to be same as option type/name, so look ahead to make sure
287     // it doesn't show up again.
288     // !!! FIXME !!! rejects TooManyTrapsAtBCI,CLS::print()V,199 command
289 //    if ((OptionType::Unknown != CompilerOracle::parse_option_type(method_name) ||
290 //        CompileCommandEnum::Unknown != CompilerOracle::parse_option_name(method_name)) &&
291 //        *(line + bytes_read) != '\0' &&
292 //        strstr(line + bytes_read, method_name) == nullptr) {
293 //      error_msg = "Did not specify any method name";
294 //      method_name[0] = '\0';
295 //      return;
296 //    }
297 
298     if ((strchr(class_name, JVM_SIGNATURE_SPECIAL) != nullptr) ||
299         (strchr(class_name, JVM_SIGNATURE_ENDSPECIAL) != nullptr)) {
300       error_msg = "Chars '<' and '>' not allowed in class name";
301       return;
302     }
303 
304     if ((strchr(method_name, JVM_SIGNATURE_SPECIAL) != nullptr) ||
305         (strchr(method_name, JVM_SIGNATURE_ENDSPECIAL) != nullptr)) {
306       if (!vmSymbols::object_initializer_name()->equals(method_name) &&
307           !vmSymbols::class_initializer_name()->equals(method_name)) {
308         error_msg = "Chars '<' and '>' only allowed in <init> and <clinit>";
309         return;
310       }
311     }
312 
313     if (c_match == MethodMatcher::Unknown || m_match == MethodMatcher::Unknown) {
314       assert(error_msg != nullptr, "Must have been set by check_mode()");
315       return;
316     }
< prev index next >