diff src/share/vm/runtime/compilationPolicy.cpp @ 1174:ddb7834449d0

6849984: Value methods for platform dependent math functions constant fold incorrectly Reviewed-by: kvn, twisti
author never
date Fri, 15 Jan 2010 11:53:33 -0800
parents a61af66fc99e
children 5f24d0319e54
line wrap: on
line diff
--- a/src/share/vm/runtime/compilationPolicy.cpp	Wed Jan 13 23:05:52 2010 -0800
+++ b/src/share/vm/runtime/compilationPolicy.cpp	Fri Jan 15 11:53:33 2010 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2010 Sun Microsystems, Inc.  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
@@ -74,6 +74,16 @@
   if (m->is_abstract()) return false;
   if (DontCompileHugeMethods && m->code_size() > HugeMethodLimit) return false;
 
+  // Math intrinsics should never be compiled as this can lead to
+  // monotonicity problems because the interpreter will prefer the
+  // compiled code to the intrinsic version.  This can't happen in
+  // production because the invocation counter can't be incremented
+  // but we shouldn't expose the system to this problem in testing
+  // modes.
+  if (!AbstractInterpreter::can_be_compiled(m)) {
+    return false;
+  }
+
   return !m->is_not_compilable();
 }