8183232: Avoid resolving method_kind in AbstractInterpreter::can_be_compiled
authorredestad
Mon, 03 Jul 2017 09:01:34 +0200
changeset 46608 b0da00b77053
parent 46607 cbe334268a4c
child 46609 54423de91ff7
8183232: Avoid resolving method_kind in AbstractInterpreter::can_be_compiled Reviewed-by: coleenp, mdoerr, neliasso
hotspot/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp
hotspot/src/cpu/arm/vm/abstractInterpreter_arm.cpp
hotspot/src/cpu/ppc/vm/abstractInterpreter_ppc.cpp
hotspot/src/cpu/s390/vm/abstractInterpreter_s390.cpp
hotspot/src/cpu/sparc/vm/abstractInterpreter_sparc.cpp
hotspot/src/cpu/x86/vm/abstractInterpreter_x86.cpp
hotspot/src/cpu/zero/vm/abstractInterpreter_zero.cpp
hotspot/src/share/vm/interpreter/abstractInterpreter.hpp
--- a/hotspot/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp	Thu Jun 29 14:35:30 2017 -0400
+++ b/hotspot/src/cpu/aarch64/vm/abstractInterpreter_aarch64.cpp	Mon Jul 03 09:01:34 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -53,27 +53,6 @@
   return i;
 }
 
-// These should never be compiled since the interpreter will prefer
-// the compiled version to the intrinsic version.
-bool AbstractInterpreter::can_be_compiled(methodHandle m) {
-  switch (method_kind(m)) {
-    case Interpreter::java_lang_math_sin     : // fall thru
-    case Interpreter::java_lang_math_cos     : // fall thru
-    case Interpreter::java_lang_math_tan     : // fall thru
-    case Interpreter::java_lang_math_abs     : // fall thru
-    case Interpreter::java_lang_math_log     : // fall thru
-    case Interpreter::java_lang_math_log10   : // fall thru
-    case Interpreter::java_lang_math_sqrt    : // fall thru
-    case Interpreter::java_lang_math_pow     : // fall thru
-    case Interpreter::java_lang_math_exp     : // fall thru
-    case Interpreter::java_lang_math_fmaD    : // fall thru
-    case Interpreter::java_lang_math_fmaF    :
-      return false;
-    default:
-      return true;
-  }
-}
-
 // How much stack a method activation needs in words.
 int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
   const int entry_size = frame::interpreter_frame_monitor_size();
--- a/hotspot/src/cpu/arm/vm/abstractInterpreter_arm.cpp	Thu Jun 29 14:35:30 2017 -0400
+++ b/hotspot/src/cpu/arm/vm/abstractInterpreter_arm.cpp	Mon Jul 03 09:01:34 2017 +0200
@@ -68,23 +68,6 @@
   return i;
 }
 
-// These should never be compiled since the interpreter will prefer
-// the compiled version to the intrinsic version.
-bool AbstractInterpreter::can_be_compiled(methodHandle m) {
-  switch (method_kind(m)) {
-    case Interpreter::java_lang_math_sin     : // fall thru
-    case Interpreter::java_lang_math_cos     : // fall thru
-    case Interpreter::java_lang_math_tan     : // fall thru
-    case Interpreter::java_lang_math_abs     : // fall thru
-    case Interpreter::java_lang_math_log     : // fall thru
-    case Interpreter::java_lang_math_log10   : // fall thru
-    case Interpreter::java_lang_math_sqrt    :
-      return false;
-    default:
-      return true;
-  }
-}
-
 // How much stack a method activation needs in words.
 int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
   const int stub_code = AARCH64_ONLY(24) NOT_AARCH64(12);  // see generate_call_stub
--- a/hotspot/src/cpu/ppc/vm/abstractInterpreter_ppc.cpp	Thu Jun 29 14:35:30 2017 -0400
+++ b/hotspot/src/cpu/ppc/vm/abstractInterpreter_ppc.cpp	Mon Jul 03 09:01:34 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2015 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -51,27 +51,6 @@
   return i;
 }
 
-// These should never be compiled since the interpreter will prefer
-// the compiled version to the intrinsic version.
-bool AbstractInterpreter::can_be_compiled(methodHandle m) {
-  switch (method_kind(m)) {
-    case Interpreter::java_lang_math_sin     : // fall thru
-    case Interpreter::java_lang_math_cos     : // fall thru
-    case Interpreter::java_lang_math_tan     : // fall thru
-    case Interpreter::java_lang_math_abs     : // fall thru
-    case Interpreter::java_lang_math_log     : // fall thru
-    case Interpreter::java_lang_math_log10   : // fall thru
-    case Interpreter::java_lang_math_sqrt    : // fall thru
-    case Interpreter::java_lang_math_pow     : // fall thru
-    case Interpreter::java_lang_math_exp     : // fall thru
-    case Interpreter::java_lang_math_fmaD    : // fall thru
-    case Interpreter::java_lang_math_fmaF    :
-      return false;
-    default:
-      return true;
-  }
-}
-
 // How much stack a method activation needs in stack slots.
 // We must calc this exactly like in generate_fixed_frame.
 // Note: This returns the conservative size assuming maximum alignment.
--- a/hotspot/src/cpu/s390/vm/abstractInterpreter_s390.cpp	Thu Jun 29 14:35:30 2017 -0400
+++ b/hotspot/src/cpu/s390/vm/abstractInterpreter_s390.cpp	Mon Jul 03 09:01:34 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2016 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -51,11 +51,6 @@
   return i;
 }
 
-bool AbstractInterpreter::can_be_compiled(methodHandle m) {
-  // No special entry points that preclude compilation.
-  return true;
-}
-
 // How much stack a method top interpreter activation needs in words.
 int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
 
--- a/hotspot/src/cpu/sparc/vm/abstractInterpreter_sparc.cpp	Thu Jun 29 14:35:30 2017 -0400
+++ b/hotspot/src/cpu/sparc/vm/abstractInterpreter_sparc.cpp	Mon Jul 03 09:01:34 2017 +0200
@@ -52,19 +52,6 @@
   return i;
 }
 
-// These should never be compiled since the interpreter will prefer the compiled
-// version to the intrinsic version.
-bool AbstractInterpreter::can_be_compiled(methodHandle m) {
-  switch (method_kind(m)) {
-    case Interpreter::java_lang_math_fmaD:
-    case Interpreter::java_lang_math_fmaF:
-      return false;
-    default:
-      break;
-  }
-  return true;
-}
-
 static int size_activation_helper(int callee_extra_locals, int max_stack, int monitor_size) {
 
   // Figure out the size of an interpreter frame (in words) given that we have a fully allocated
--- a/hotspot/src/cpu/x86/vm/abstractInterpreter_x86.cpp	Thu Jun 29 14:35:30 2017 -0400
+++ b/hotspot/src/cpu/x86/vm/abstractInterpreter_x86.cpp	Mon Jul 03 09:01:34 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -160,27 +160,6 @@
 }
 #endif // _LP64
 
-// These should never be compiled since the interpreter will prefer
-// the compiled version to the intrinsic version.
-bool AbstractInterpreter::can_be_compiled(methodHandle m) {
-  switch (method_kind(m)) {
-    case Interpreter::java_lang_math_sin     : // fall thru
-    case Interpreter::java_lang_math_cos     : // fall thru
-    case Interpreter::java_lang_math_tan     : // fall thru
-    case Interpreter::java_lang_math_abs     : // fall thru
-    case Interpreter::java_lang_math_log     : // fall thru
-    case Interpreter::java_lang_math_log10   : // fall thru
-    case Interpreter::java_lang_math_sqrt    : // fall thru
-    case Interpreter::java_lang_math_pow     : // fall thru
-    case Interpreter::java_lang_math_exp     : // fall thru
-    case Interpreter::java_lang_math_fmaD    : // fall thru
-    case Interpreter::java_lang_math_fmaF    :
-      return false;
-    default:
-      return true;
-  }
-}
-
 // How much stack a method activation needs in words.
 int AbstractInterpreter::size_top_interpreter_activation(Method* method) {
   const int entry_size = frame::interpreter_frame_monitor_size();
--- a/hotspot/src/cpu/zero/vm/abstractInterpreter_zero.cpp	Thu Jun 29 14:35:30 2017 -0400
+++ b/hotspot/src/cpu/zero/vm/abstractInterpreter_zero.cpp	Mon Jul 03 09:01:34 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -29,10 +29,6 @@
 #include "runtime/frame.inline.hpp"
 #include "utilities/globalDefinitions.hpp"
 
-bool AbstractInterpreter::can_be_compiled(methodHandle m) {
-  return true;
-}
-
 int AbstractInterpreter::BasicType_as_index(BasicType type) {
   int i = 0;
   switch (type) {
--- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp	Thu Jun 29 14:35:30 2017 -0400
+++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp	Mon Jul 03 09:01:34 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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
@@ -150,7 +150,26 @@
 
   static void       print_method_kind(MethodKind kind)          PRODUCT_RETURN;
 
-  static bool       can_be_compiled(methodHandle m);
+  // These should never be compiled since the interpreter will prefer
+  // the compiled version to the intrinsic version.
+  static bool       can_be_compiled(const methodHandle& m) {
+    switch (m->intrinsic_id()) {
+      case vmIntrinsics::_dsin  : // fall thru
+      case vmIntrinsics::_dcos  : // fall thru
+      case vmIntrinsics::_dtan  : // fall thru
+      case vmIntrinsics::_dabs  : // fall thru
+      case vmIntrinsics::_dsqrt : // fall thru
+      case vmIntrinsics::_dlog  : // fall thru
+      case vmIntrinsics::_dlog10: // fall thru
+      case vmIntrinsics::_dpow  : // fall thru
+      case vmIntrinsics::_dexp  : // fall thru
+      case vmIntrinsics::_fmaD  : // fall thru
+      case vmIntrinsics::_fmaF  : // fall thru
+        return false;
+      default:
+        return true;
+    }
+  }
 
   // Runtime support