Skip to content

Commit

Permalink
* Issue #1034 Disable invokedynamic for Java 7
Browse files Browse the repository at this point in the history
  • Loading branch information
donv committed Sep 21, 2013
1 parent e90ed41 commit 06b8107
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .classpath
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="core/src/main/java"/>
<classpathentry kind="src" path="core/src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="build.eclipse"/>
</classpath>
2 changes: 2 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=utf-8
36 changes: 16 additions & 20 deletions core/src/main/java/org/jruby/util/cli/Options.java
Expand Up @@ -246,28 +246,24 @@ private static <T extends Enum<T>> Option<T> enumeration(Category category, Stri
}
private static boolean calculateInvokedynamicDefault() {
String vmName = SafePropertyAccessor.getProperty("java.vm.name", "").toLowerCase();

String javaVersion = SafePropertyAccessor.getProperty("java.specification.version", "");
if (!javaVersion.equals("") && new BigDecimal(javaVersion).compareTo(new BigDecimal("1.7")) >= 0){
if (!vmName.contains("ibm j9 vm")) {
// if not on HotSpot or J9, on if specification version supports indy
if (!javaVersion.equals("") && new BigDecimal(javaVersion).compareTo(new BigDecimal("1.8")) >= 0) {
return true;
} else if (vmName.contains("ibm j9 vm")) { // IBM J9 VM
String runtimeVersion = SafePropertyAccessor.getProperty("java.runtime.version", "");
int dash = runtimeVersion.indexOf('-');
int dateStamp;
try { // There is a release datestamp, YYYYMMDD, after the first dash "-"
dateStamp = Integer.parseInt(runtimeVersion.substring(dash+1, dash+9));
} catch (Exception e) {
dateStamp = -1;
}
// The initial release and first few service releases had a crash issue.
// Narrow range so unexpected will tend to default to invokedynamic on.
if (dateStamp > 20110731 && dateStamp < 20121101) {
return false;
} else { // SR4 and beyond include APAR IV34500: crash fix
return true;
} else { // IBM J9 VM
String runtimeVersion = SafePropertyAccessor.getProperty("java.runtime.version", "");
int dash = runtimeVersion.indexOf('-');
int dateStamp;
try { // There is a release datestamp, YYYYMMDD, after the first dash "-"
dateStamp = Integer.parseInt(runtimeVersion.substring(dash+1, dash+9));
} catch (Exception e) {
dateStamp = -1;
}
// The initial release and first few service releases had a crash issue.
// Narrow range so unexpected will tend to default to invokedynamic on.
if (dateStamp > 20110731 && dateStamp < 20121101) {
return false;
} else { // SR4 and beyond include APAR IV34500: crash fix
return true;
}
}
} else {
// on only if forced
Expand Down

0 comments on commit 06b8107

Please sign in to comment.