< prev index next >

src/hotspot/share/opto/bytecodeInfo.cpp

Print this page
rev 54728 : force inline of iterator() methods for better scalar replacement of iterators
rev 54748 : force inline of iterator() methods for better scalar replacement of iterators, v2.0

@@ -1,7 +1,7 @@
 /*
- * 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -75,10 +75,11 @@
 
 /**
  *  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 Iterable::iterator() invocation that is essential for forall-loops performance.
  */
 static bool is_init_with_ea(ciMethod* callee_method,
                             ciMethod* caller_method, Compile* C) {
   if (!C->do_escape_analysis() || !EliminateAllocations) {
     return false; // EA is off

@@ -92,10 +93,15 @@
     return true; // super constructor is called from inlined constructor
   }
   if (C->eliminate_boxing() && callee_method->is_boxing_method()) {
     return true;
   }
+  if (callee_method->name() == ciSymbol::iterator_name()) {
+    if (callee_method->signature()->return_type()->is_subtype_of(C->env()->Iterator_klass())) {
+      return true;
+    }
+  }
   return false;
 }
 
 /**
  *  Force inlining unboxing accessor.
< prev index next >