aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm/runtime/compilationPolicy.cpp
diff options
context:
space:
mode:
authornever <none@none>2010-01-15 11:53:33 -0800
committernever <none@none>2010-01-15 11:53:33 -0800
commit025714bc1f40750ed95cd0a795f057ee666d74e1 (patch)
tree4d027f0d1d843a2d3c8ffb1a175c90f0b2687d5e /src/share/vm/runtime/compilationPolicy.cpp
parent76a8c2d50adc70f67a058d3c4322ec9f2ea8e52f (diff)
6849984: Value methods for platform dependent math functions constant fold incorrectly
Reviewed-by: kvn, twisti
Diffstat (limited to 'src/share/vm/runtime/compilationPolicy.cpp')
-rw-r--r--src/share/vm/runtime/compilationPolicy.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/share/vm/runtime/compilationPolicy.cpp b/src/share/vm/runtime/compilationPolicy.cpp
index ac870e0cc..2892ef123 100644
--- a/src/share/vm/runtime/compilationPolicy.cpp
+++ b/src/share/vm/runtime/compilationPolicy.cpp
@@ -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 @@ bool CompilationPolicy::canBeCompiled(methodHandle m) {
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();
}