8223504: Improve performance of forall loops by better inlining of "iterator()" methods
Reviewed-by: vlivanov, shade
This commit is contained in:
parent
76361f63bd
commit
145f06a155
@ -214,6 +214,9 @@ class OopStorage;
|
||||
do_klass(Integer_klass, java_lang_Integer ) \
|
||||
do_klass(Long_klass, java_lang_Long ) \
|
||||
\
|
||||
/* force inline of iterators */ \
|
||||
do_klass(Iterator_klass, java_util_Iterator ) \
|
||||
\
|
||||
/*end*/
|
||||
|
||||
|
||||
|
@ -126,6 +126,7 @@
|
||||
template(getBootClassPathEntryForClass_name, "getBootClassPathEntryForClass") \
|
||||
template(jdk_internal_vm_PostVMInitHook, "jdk/internal/vm/PostVMInitHook") \
|
||||
template(sun_net_www_ParseUtil, "sun/net/www/ParseUtil") \
|
||||
template(java_util_Iterator, "java/util/Iterator") \
|
||||
\
|
||||
template(jdk_internal_loader_ClassLoaders_AppClassLoader, "jdk/internal/loader/ClassLoaders$AppClassLoader") \
|
||||
template(jdk_internal_loader_ClassLoaders_PlatformClassLoader, "jdk/internal/loader/ClassLoaders$PlatformClassLoader") \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2019, 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
|
||||
@ -77,6 +77,8 @@ InlineTree::InlineTree(Compile* c,
|
||||
* Return true when EA is ON and a java constructor is called or
|
||||
* a super constructor is called from an inlined java constructor.
|
||||
* Also return true for boxing methods.
|
||||
* Also return true for methods returning Iterator (including Iterable::iterator())
|
||||
* that is essential for forall-loops performance.
|
||||
*/
|
||||
static bool is_init_with_ea(ciMethod* callee_method,
|
||||
ciMethod* caller_method, Compile* C) {
|
||||
@ -94,6 +96,11 @@ static bool is_init_with_ea(ciMethod* callee_method,
|
||||
if (C->eliminate_boxing() && callee_method->is_boxing_method()) {
|
||||
return true;
|
||||
}
|
||||
ciType *retType = callee_method->signature()->return_type();
|
||||
ciKlass *iter = C->env()->Iterator_klass();
|
||||
if(retType->is_loaded() && iter->is_loaded() && retType->is_subtype_of(iter)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user