8159850: Remove unneeded parsing of optional-size when parsing array types
Summary: Remove skip_optional_size() methods and calls to them.
Reviewed-by: coleenp, iklam
--- a/src/hotspot/share/runtime/fieldType.cpp Wed Mar 07 10:58:59 2018 +0100
+++ b/src/hotspot/share/runtime/fieldType.cpp Wed Mar 07 09:32:46 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,14 +31,6 @@
#include "runtime/fieldType.hpp"
#include "runtime/signature.hpp"
-void FieldType::skip_optional_size(Symbol* signature, int* index) {
- jchar c = signature->byte_at(*index);
- while (c >= '0' && c <= '9') {
- *index = *index + 1;
- c = signature->byte_at(*index);
- }
-}
-
BasicType FieldType::basic_type(Symbol* signature) {
return char2type(signature->byte_at(0));
}
@@ -78,11 +70,9 @@
assert(basic_type(signature) == T_ARRAY, "must be array");
int index = 1;
int dim = 1;
- skip_optional_size(signature, &index);
while (signature->byte_at(index) == '[') {
index++;
dim++;
- skip_optional_size(signature, &index);
}
ResourceMark rm;
char *element = signature->as_C_string() + index;
--- a/src/hotspot/share/runtime/fieldType.hpp Wed Mar 07 10:58:59 2018 +0100
+++ b/src/hotspot/share/runtime/fieldType.hpp Wed Mar 07 09:32:46 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,6 @@
class FieldType: public AllStatic {
private:
- static void skip_optional_size(Symbol* signature, int* index);
static bool is_valid_array_signature(Symbol* signature);
public:
--- a/src/hotspot/share/runtime/signature.cpp Wed Mar 07 10:58:59 2018 +0100
+++ b/src/hotspot/share/runtime/signature.cpp Wed Mar 07 09:32:46 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -54,14 +54,6 @@
_index++;
}
-
-void SignatureIterator::skip_optional_size() {
- Symbol* sig = _signature;
- char c = sig->byte_at(_index);
- while ('0' <= c && c <= '9') c = sig->byte_at(++_index);
-}
-
-
int SignatureIterator::parse_type() {
// Note: This function could be simplified by using "return T_XXX_size;"
// instead of the assignment and the break statements. However, it
@@ -99,11 +91,9 @@
break;
case '[':
{ int begin = ++_index;
- skip_optional_size();
Symbol* sig = _signature;
while (sig->byte_at(_index) == '[') {
_index++;
- skip_optional_size();
}
if (sig->byte_at(_index) == 'L') {
while (sig->byte_at(_index++) != ';') ;
@@ -250,10 +240,8 @@
case '[':
{
int begin = ++_index;
- skip_optional_size();
while (sig->byte_at(_index) == '[') {
_index++;
- skip_optional_size();
}
if (sig->byte_at(_index) == 'L') {
while (sig->byte_at(_index++) != ';') ;
--- a/src/hotspot/share/runtime/signature.hpp Wed Mar 07 10:58:59 2018 +0100
+++ b/src/hotspot/share/runtime/signature.hpp Wed Mar 07 09:32:46 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -52,7 +52,6 @@
BasicType _return_type;
void expect(char c);
- void skip_optional_size();
int parse_type(); // returns the parameter size in words (0 for void)
void check_signature_end();