mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8255489: Unify the parsing of @lambda-proxy and @lambda-form-invokers tags in a classlist
Reviewed-by: iklam, minqi
This commit is contained in:
parent
0f48603394
commit
36c150b199
9 changed files with 65 additions and 34 deletions
|
@ -115,13 +115,6 @@ bool ClassListParser::parse_one_line() {
|
|||
_line_len = len;
|
||||
}
|
||||
|
||||
// Check if the line is output TRACE_RESOLVE
|
||||
if (strncmp(_line, LambdaFormInvokers::lambda_form_invoker_tag(),
|
||||
strlen(LambdaFormInvokers::lambda_form_invoker_tag())) == 0) {
|
||||
LambdaFormInvokers::append(os::strdup((const char*)_line, mtInternal));
|
||||
continue;
|
||||
}
|
||||
|
||||
// valid line
|
||||
break;
|
||||
}
|
||||
|
@ -133,6 +126,7 @@ bool ClassListParser::parse_one_line() {
|
|||
_source = NULL;
|
||||
_interfaces_specified = false;
|
||||
_indy_items->clear();
|
||||
_lambda_form_line = false;
|
||||
|
||||
if (_line[0] == '@') {
|
||||
return parse_at_tags();
|
||||
|
@ -185,8 +179,8 @@ bool ClassListParser::parse_one_line() {
|
|||
return true;
|
||||
}
|
||||
|
||||
void ClassListParser::split_tokens_by_whitespace() {
|
||||
int start = 0;
|
||||
void ClassListParser::split_tokens_by_whitespace(int offset) {
|
||||
int start = offset;
|
||||
int end;
|
||||
bool done = false;
|
||||
while (!done) {
|
||||
|
@ -203,19 +197,40 @@ void ClassListParser::split_tokens_by_whitespace() {
|
|||
}
|
||||
}
|
||||
|
||||
int ClassListParser::split_at_tag_from_line() {
|
||||
_token = _line;
|
||||
char* ptr;
|
||||
if ((ptr = strchr(_line, ' ')) == NULL) {
|
||||
error("Too few items following the @ tag \"%s\" line #%d", _line, _line_no);
|
||||
return 0;
|
||||
}
|
||||
*ptr++ = '\0';
|
||||
while (*ptr == ' ' || *ptr == '\t') ptr++;
|
||||
return (int)(ptr - _line);
|
||||
}
|
||||
|
||||
bool ClassListParser::parse_at_tags() {
|
||||
assert(_line[0] == '@', "must be");
|
||||
split_tokens_by_whitespace();
|
||||
if (strcmp(_indy_items->at(0), LAMBDA_PROXY_TAG) == 0) {
|
||||
if (_indy_items->length() < 3) {
|
||||
error("Line with @ tag has too few items \"%s\" line #%d", _line, _line_no);
|
||||
int offset;
|
||||
if ((offset = split_at_tag_from_line()) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strcmp(_token, LAMBDA_PROXY_TAG) == 0) {
|
||||
split_tokens_by_whitespace(offset);
|
||||
if (_indy_items->length() < 2) {
|
||||
error("Line with @ tag has too few items \"%s\" line #%d", _token, _line_no);
|
||||
return false;
|
||||
}
|
||||
// set the class name
|
||||
_class_name = _indy_items->at(1);
|
||||
_class_name = _indy_items->at(0);
|
||||
return true;
|
||||
} else if (strcmp(_token, LAMBDA_FORM_TAG) == 0) {
|
||||
LambdaFormInvokers::append(os::strdup((const char*)(_line + offset), mtInternal));
|
||||
_lambda_form_line = true;
|
||||
return true;
|
||||
} else {
|
||||
error("Invalid @ tag at the beginning of line \"%s\" line #%d", _line, _line_no);
|
||||
error("Invalid @ tag at the beginning of line \"%s\" line #%d", _token, _line_no);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -432,7 +447,7 @@ bool ClassListParser::is_matching_cp_entry(constantPoolHandle &pool, int cp_inde
|
|||
CDSIndyInfo cii;
|
||||
populate_cds_indy_info(pool, cp_index, &cii, THREAD);
|
||||
GrowableArray<const char*>* items = cii.items();
|
||||
int indy_info_offset = 2;
|
||||
int indy_info_offset = 1;
|
||||
if (_indy_items->length() - indy_info_offset != items->length()) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue