mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8339642: Reduce overheads in InvokerBytecodeGenerator
Reviewed-by: liach
This commit is contained in:
parent
cb00333d6a
commit
d2b36f0907
2 changed files with 43 additions and 45 deletions
|
@ -1555,6 +1555,7 @@ class LambdaForm {
|
|||
* Return -1 if the name is not used.
|
||||
*/
|
||||
int lastUseIndex(Name n) {
|
||||
Object[] arguments = this.arguments;
|
||||
if (arguments == null) return -1;
|
||||
for (int i = arguments.length; --i >= 0; ) {
|
||||
if (arguments[i] == n) return i;
|
||||
|
@ -1562,21 +1563,6 @@ class LambdaForm {
|
|||
return -1;
|
||||
}
|
||||
|
||||
/** Return the number of occurrences of n in the argument array.
|
||||
* Return 0 if the name is not used.
|
||||
*/
|
||||
int useCount(Name n) {
|
||||
int count = 0;
|
||||
if (arguments != null) {
|
||||
for (Object argument : arguments) {
|
||||
if (argument == n) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public boolean equals(Name that) {
|
||||
if (this == that) return true;
|
||||
if (isParam())
|
||||
|
@ -1618,8 +1604,16 @@ class LambdaForm {
|
|||
int useCount(Name n) {
|
||||
int count = (result == n.index) ? 1 : 0;
|
||||
int i = Math.max(n.index + 1, arity);
|
||||
Name[] names = this.names;
|
||||
while (i < names.length) {
|
||||
count += names[i++].useCount(n);
|
||||
Object[] arguments = names[i++].arguments;
|
||||
if (arguments != null) {
|
||||
for (Object argument : arguments) {
|
||||
if (argument == n) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue