From 06b8107df44650205ad50a7173be9ea7237c41e4 Mon Sep 17 00:00:00 2001 From: Uwe Kubosch Date: Sat, 21 Sep 2013 15:36:25 +0200 Subject: [PATCH] * Issue #1034 Disable invokedynamic for Java 7 --- .classpath | 2 ++ .settings/org.eclipse.core.resources.prefs | 2 ++ .../main/java/org/jruby/util/cli/Options.java | 36 +++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 .settings/org.eclipse.core.resources.prefs diff --git a/.classpath b/.classpath index c6337743a87..26d37b7deb5 100644 --- a/.classpath +++ b/.classpath @@ -1,5 +1,7 @@ + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000000..6d65655350e --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=utf-8 diff --git a/core/src/main/java/org/jruby/util/cli/Options.java b/core/src/main/java/org/jruby/util/cli/Options.java index 97934641125..02f11ea4d45 100644 --- a/core/src/main/java/org/jruby/util/cli/Options.java +++ b/core/src/main/java/org/jruby/util/cli/Options.java @@ -246,28 +246,24 @@ private static > Option 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