Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a5a0d23238b7
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6c8e051098a8
Choose a head ref
  • 4 commits
  • 10 files changed
  • 1 contributor

Commits on Dec 10, 2016

  1. Copy the full SHA
    40ab461 View commit details
  2. Copy the full SHA
    aadb06a View commit details
  3. Copy the full SHA
    35c11f9 View commit details
  4. Copy the full SHA
    6c8e051 View commit details
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.format.FormatNode;
import org.jruby.truffle.core.format.printf.PrintfSimpleTreeBuilder;
import org.jruby.truffle.util.ConvertBytes;
import org.jruby.truffle.core.string.ConvertBytes;
import org.jruby.truffle.core.string.ByteList;

import java.math.BigInteger;
315 changes: 276 additions & 39 deletions truffle/src/main/java/org/jruby/truffle/core/string/ConvertBytes.java
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
import org.jruby.truffle.language.control.RaiseException;

import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.util.Arrays;

public class ConvertBytes {
@@ -66,45 +67,6 @@ public static Object byteListToInum19(RubyContext context, Node node, FixnumOrBi
return new ConvertBytes(context, node, fixnumOrBignumNode, str, base, badcheck).byteListToInum();
}

private final static byte[] conv_digit = new byte[128];
private final static boolean[] digit = new boolean[128];
private final static boolean[] space = new boolean[128];
private final static boolean[] spaceOrUnderscore = new boolean[128];

static {
Arrays.fill(conv_digit, (byte)-1);
Arrays.fill(digit, false);
for(char c = '0'; c <= '9'; c++) {
conv_digit[c] = (byte)(c - '0');
digit[c] = true;
}

for(char c = 'a'; c <= 'z'; c++) {
conv_digit[c] = (byte)(c - 'a' + 10);
}

for(char c = 'A'; c <= 'Z'; c++) {
conv_digit[c] = (byte)(c - 'A' + 10);
}

Arrays.fill(space, false);
space['\t'] = true;
space['\n'] = true;
space[11] = true; // \v
space['\f'] = true;
space['\r'] = true;
space[' '] = true;

Arrays.fill(spaceOrUnderscore, false);
spaceOrUnderscore['\t'] = true;
spaceOrUnderscore['\n'] = true;
spaceOrUnderscore[11] = true; // \v
spaceOrUnderscore['\f'] = true;
spaceOrUnderscore['\r'] = true;
spaceOrUnderscore[' '] = true;
spaceOrUnderscore['_'] = true;
}

/** conv_digit
*
*/
@@ -564,4 +526,279 @@ private void invalidString(String type) {
throw new RaiseException(
context.getCoreExceptions().argumentErrorInvalidValue(_str, type, node));
}

public static final byte[] intToBinaryBytes(int i) {
return intToUnsignedByteList(i, 1, LOWER_DIGITS).bytes();
}

public static final byte[] intToOctalBytes(int i) {
return intToUnsignedByteList(i, 3, LOWER_DIGITS).bytes();
}

public static final byte[] intToHexBytes(int i) {
return intToUnsignedByteList(i, 4, LOWER_DIGITS).bytes();
}

public static final byte[] intToHexBytes(int i, boolean upper) {
return intToUnsignedByteList(i, 4, upper ? UPPER_DIGITS : LOWER_DIGITS).bytes();
}

public static final ByteList intToBinaryByteList(int i) {
return new ByteList(intToBinaryBytes(i));
}
public static final ByteList intToOctalByteList(int i) {
return new ByteList(intToOctalBytes(i));
}
public static final ByteList intToHexByteList(int i) {
return new ByteList(intToHexBytes(i));
}
public static final ByteList intToHexByteList(int i, boolean upper) {
return new ByteList(intToHexBytes(i, upper));
}

public static final byte[] intToByteArray(int i, int radix, boolean upper) {
return longToByteArray(i, radix, upper);
}

public static final byte[] intToCharBytes(int i) {
return longToByteList(i, 10, LOWER_DIGITS).bytes();
}

public static final byte[] longToBinaryBytes(long i) {
return longToUnsignedByteList(i, 1, LOWER_DIGITS).bytes();
}

public static final byte[] longToOctalBytes(long i) {
return longToUnsignedByteList(i, 3, LOWER_DIGITS).bytes();
}

public static final byte[] longToHexBytes(long i) {
return longToUnsignedByteList(i, 4, LOWER_DIGITS).bytes();
}

public static final byte[] longToHexBytes(long i, boolean upper) {
return longToUnsignedByteList(i, 4, upper ? UPPER_DIGITS : LOWER_DIGITS).bytes();
}

public static final ByteList longToBinaryByteList(long i) {
return longToByteList(i, 2, LOWER_DIGITS);
}
public static final ByteList longToOctalByteList(long i) {
return longToByteList(i, 8, LOWER_DIGITS);
}
public static final ByteList longToHexByteList(long i) {
return longToByteList(i, 16, LOWER_DIGITS);
}
public static final ByteList longToHexByteList(long i, boolean upper) {
return longToByteList(i, 16, upper ? UPPER_DIGITS : LOWER_DIGITS);
}

public static final byte[] longToByteArray(long i, int radix, boolean upper) {
return longToByteList(i, radix, upper ? UPPER_DIGITS : LOWER_DIGITS).bytes();
}

public static final byte[] longToCharBytes(long i) {
return longToByteList(i, 10, LOWER_DIGITS).bytes();
}

public static final ByteList longToByteList(long i) {
return longToByteList(i, 10, LOWER_DIGITS);
}

public static final ByteList longToByteList(long i, int radix) {
return longToByteList(i, radix, LOWER_DIGITS);
}

public static final ByteList longToByteList(long i, int radix, byte[] digitmap) {
if (i == 0) return new ByteList(ZERO_BYTES);

if (i == Long.MIN_VALUE) return new ByteList(MIN_VALUE_BYTES[radix]);

boolean neg = false;
if (i < 0) {
i = -i;
neg = true;
}

// max 64 chars for 64-bit 2's complement integer
int len = 64;
byte[] buf = new byte[len];

int pos = len;
do {
buf[--pos] = digitmap[(int)(i % radix)];
} while ((i /= radix) > 0);
if (neg) buf[--pos] = (byte)'-';

return new ByteList(buf, pos, len - pos);
}

private static final ByteList intToUnsignedByteList(int i, int shift, byte[] digitmap) {
byte[] buf = new byte[32];
int charPos = 32;
int radix = 1 << shift;
long mask = radix - 1;
do {
buf[--charPos] = digitmap[(int)(i & mask)];
i >>>= shift;
} while (i != 0);
return new ByteList(buf, charPos, (32 - charPos), false);
}

private static final ByteList longToUnsignedByteList(long i, int shift, byte[] digitmap) {
byte[] buf = new byte[64];
int charPos = 64;
int radix = 1 << shift;
long mask = radix - 1;
do {
buf[--charPos] = digitmap[(int)(i & mask)];
i >>>= shift;
} while (i != 0);
return new ByteList(buf, charPos, (64 - charPos), false);
}

public static final byte[] twosComplementToBinaryBytes(byte[] in) {
return twosComplementToUnsignedBytes(in, 1, false);
}
public static final byte[] twosComplementToOctalBytes(byte[] in) {
return twosComplementToUnsignedBytes(in, 3, false);
}
public static final byte[] twosComplementToHexBytes(byte[] in, boolean upper) {
return twosComplementToUnsignedBytes(in, 4, upper);
}

private static final byte[] ZERO_BYTES = new byte[] {(byte)'0'};

private static final byte[] LOWER_DIGITS = {
'0' , '1' , '2' , '3' , '4' , '5' ,
'6' , '7' , '8' , '9' , 'a' , 'b' ,
'c' , 'd' , 'e' , 'f' , 'g' , 'h' ,
'i' , 'j' , 'k' , 'l' , 'm' , 'n' ,
'o' , 'p' , 'q' , 'r' , 's' , 't' ,
'u' , 'v' , 'w' , 'x' , 'y' , 'z'
};

private static final byte[] UPPER_DIGITS = {
'0' , '1' , '2' , '3' , '4' , '5' ,
'6' , '7' , '8' , '9' , 'A' , 'B' ,
'C' , 'D' , 'E' , 'F' , 'G' , 'H' ,
'I' , 'J' , 'K' , 'L' , 'M' , 'N' ,
'O' , 'P' , 'Q' , 'R' , 'S' , 'T' ,
'U' , 'V' , 'W' , 'X' , 'Y' , 'Z'
};

public static final byte[] twosComplementToUnsignedBytes(byte[] in, int shift, boolean upper) {
if (shift < 1 || shift > 4) {
throw new IllegalArgumentException("shift value must be 1-4");
}
int ilen = in.length;
int olen = (ilen * 8 + shift - 1 ) / shift;
byte[] out = new byte[olen];
int mask = (1 << shift) - 1;
byte[] digits = upper ? UPPER_DIGITS : LOWER_DIGITS;
int bitbuf = 0;
int bitcnt = 0;
for(int i = ilen, o = olen; --o >= 0; ) {
if(bitcnt < shift) {
bitbuf |= ((int)in[--i] & (int)0xff) << bitcnt;
bitcnt += 8;
}
out[o] = digits[bitbuf & mask];
bitbuf >>= shift;
bitcnt -= shift;
}
return out;
}

private final static byte[] conv_digit = new byte[128];
private final static boolean[] digit = new boolean[128];
private final static boolean[] space = new boolean[128];
private final static boolean[] spaceOrUnderscore = new boolean[128];

static {
Arrays.fill(conv_digit, (byte)-1);
Arrays.fill(digit, false);
for(char c = '0'; c <= '9'; c++) {
conv_digit[c] = (byte)(c - '0');
digit[c] = true;
}

for(char c = 'a'; c <= 'z'; c++) {
conv_digit[c] = (byte)(c - 'a' + 10);
}

for(char c = 'A'; c <= 'Z'; c++) {
conv_digit[c] = (byte)(c - 'A' + 10);
}

Arrays.fill(space, false);
space['\t'] = true;
space['\n'] = true;
space[11] = true; // \v
space['\f'] = true;
space['\r'] = true;
space[' '] = true;

Arrays.fill(spaceOrUnderscore, false);
spaceOrUnderscore['\t'] = true;
spaceOrUnderscore['\n'] = true;
spaceOrUnderscore[11] = true; // \v
spaceOrUnderscore['\f'] = true;
spaceOrUnderscore['\r'] = true;
spaceOrUnderscore[' '] = true;
spaceOrUnderscore['_'] = true;
}

public static byte[] bytesToUUIDBytes(byte[] randBytes, boolean upper) {
ByteBuffer bytes = ByteBuffer.wrap(randBytes);
long N0 = bytes.getInt() & 0xFFFFFFFFL;
int n1 = bytes.getShort() & 0xFFFF;
int n2 = bytes.getShort() & 0xFFFF;
n2 = n2 & 0x0FFF | 0x4000;
int n3 = bytes.getShort() & 0xFFFF;
n3 = n3 & 0x3FFF | 0x8000;
int n4 = bytes.getShort() & 0xFFFF;
long N5 = bytes.getInt() & 0xFFFFFFFFL;
byte[] convert = upper ? UPPER_DIGITS : LOWER_DIGITS;
return new byte[]{
convert[(int)((N0 >> 28) & 0xF)],
convert[(int)((N0 >> 24) & 0xF)],
convert[(int)((N0 >> 20) & 0xF)],
convert[(int)((N0 >> 16) & 0xF)],
convert[(int)((N0 >> 12) & 0xF)],
convert[(int)((N0 >> 8) & 0xF)],
convert[(int)((N0 >> 4) & 0xF)],
convert[(int)(N0 & 0xF)],
(byte)'-',
convert[(n1 >> 12) & 0xF],
convert[(n1 >> 8) & 0xF],
convert[(n1 >> 4) & 0xF],
convert[n1 & 0xF],
(byte)'-',
convert[(n2 >> 12) & 0xF],
convert[(n2 >> 8) & 0xF],
convert[(n2 >> 4) & 0xF],
convert[n2 & 0xF],
(byte)'-',
convert[(n3 >> 12) & 0xF],
convert[(n3 >> 8) & 0xF],
convert[(n3 >> 4) & 0xF],
convert[n3 & 0xF],
(byte)'-',
convert[(n4 >> 12) & 0xF],
convert[(n4 >> 8) & 0xF],
convert[(n4 >> 4) & 0xF],
convert[n4 & 0xF],
convert[(int)((N5 >> 28) & 0xF)],
convert[(int)((N5 >> 24) & 0xF)],
convert[(int)((N5 >> 20) & 0xF)],
convert[(int)((N5 >> 16) & 0xF)],
convert[(int)((N5 >> 12) & 0xF)],
convert[(int)((N5 >> 8) & 0xF)],
convert[(int)((N5 >> 4) & 0xF)],
convert[(int)(N5 & 0xF)]
};
}


}
Original file line number Diff line number Diff line change
@@ -36,11 +36,9 @@
import org.jcodings.transcode.EConv;
import org.jcodings.transcode.EConvFlags;
import org.jcodings.unicode.UnicodeEncoding;
import org.jruby.truffle.core.string.ByteListHolder;
import org.jruby.truffle.core.string.StringSupport;
import org.jruby.truffle.core.string.ByteList;
import org.jruby.truffle.util.Platform;

import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.List;

@@ -176,16 +174,6 @@ public interface TranscodeFallback<State, Data> {
boolean call(State context, Data fallback, EConv ec);
}

public static Encoding getUTF16ForPlatform() {
Encoding encoding;// This may be inefficient if we aren't matching endianness right
if (Platform.BYTE_ORDER == Platform.LITTLE_ENDIAN) {
encoding = UTF16LEEncoding.INSTANCE;
} else {
encoding = UTF16BEEncoding.INSTANCE;
}
return encoding;
}

public static void strBufCat(ByteList str, byte[] ptrBytes, int ptr, int len) {
int total, off = -1;

Original file line number Diff line number Diff line change
@@ -11,6 +11,8 @@

public class OptionTypeException extends UnsupportedOperationException {

private static final long serialVersionUID = 9479324724903L;

private final String name;

public OptionTypeException(String name, String value) {
Original file line number Diff line number Diff line change
@@ -11,6 +11,8 @@

public class UnknownOptionException extends UnsupportedOperationException {

private static final long serialVersionUID = 94889894853948L;

private final String name;

public UnknownOptionException(String name) {
291 changes: 0 additions & 291 deletions truffle/src/main/java/org/jruby/truffle/util/ConvertBytes.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -159,6 +159,7 @@ private double completeCalculation() {
}

static class LightweightNumberFormatException extends NumberFormatException {
private static final long serialVersionUID = 8405843059834590L;
public LightweightNumberFormatException(String message) {
super(message);
}
1 change: 1 addition & 0 deletions truffle/src/main/java/org/jruby/truffle/util/Dir.java
Original file line number Diff line number Diff line change
@@ -75,6 +75,7 @@ private static int rb_path_next(byte[] _s, int s, int send) {
return s;
}

@SuppressWarnings("fallthrough")
private static int fnmatch_helper(byte[] bytes, int pstart, int pend, byte[] string, int sstart, int send, int flags) {
char test;
int s = sstart;
184 changes: 22 additions & 162 deletions truffle/src/main/java/org/jruby/truffle/util/Platform.java
Original file line number Diff line number Diff line change
@@ -27,7 +27,6 @@
***** END LICENSE BLOCK *****/
package org.jruby.truffle.util;

import java.nio.ByteOrder;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
@@ -36,26 +35,17 @@
*
*/
public class Platform {
private static final java.util.Locale LOCALE = java.util.Locale.ENGLISH;
public static final CPU_TYPE CPU = determineCPU();
public static final OS_TYPE OS = determineOS();

public static final String LIBPREFIX = OS == OS.WINDOWS ? "" : "lib";
public static final String LIBPREFIX = OS == OS_TYPE.WINDOWS ? "" : "lib";
public static final String LIBSUFFIX = determineLibExt();
public static final String LIBC = determineLibC();

public static final int BIG_ENDIAN = 4321;
public static final int LITTLE_ENDIAN = 1234;
public static final int BYTE_ORDER = ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN) ? BIG_ENDIAN : LITTLE_ENDIAN;


public static final boolean IS_WINDOWS = OS.equals(OS_TYPE.WINDOWS);
public static final boolean IS_BSD = OS.equals(OS_TYPE.WINDOWS);

protected final int addressSize, longSize;
private final long addressMask;
protected final Pattern libPattern;
private final int javaVersionMajor;

public enum OS_TYPE {
DARWIN,
@@ -69,7 +59,7 @@ public enum OS_TYPE {

UNKNOWN;
@Override
public String toString() { return name().toLowerCase(LOCALE); }
public String toString() { return name().toLowerCase(java.util.Locale.ENGLISH); }
}

public enum CPU_TYPE {
@@ -84,7 +74,7 @@ public enum CPU_TYPE {
ARM,
UNKNOWN;
@Override
public String toString() { return name().toLowerCase(LOCALE); }
public String toString() { return name().toLowerCase(java.util.Locale.ENGLISH); }
}

private static final class SingletonHolder {
@@ -124,37 +114,37 @@ private static final Platform determinePlatform(OS_TYPE os) {
}

private static final CPU_TYPE determineCPU() {
String archString = System.getProperty("os.arch").toLowerCase(LOCALE);
String archString = System.getProperty("os.arch").toLowerCase(java.util.Locale.ENGLISH);
if ("x86".equals(archString) || "i386".equals(archString) || "i86pc".equals(archString)) {
return CPU.I386;
return CPU_TYPE.I386;
} else if ("x86_64".equals(archString) || "amd64".equals(archString)) {
return CPU.X86_64;
return CPU_TYPE.X86_64;
} else if ("ppc".equals(archString) || "powerpc".equals(archString)) {
return CPU.POWERPC;
return CPU_TYPE.POWERPC;
} else if ("ppc64".equals(archString)) {
return CPU.POWERPC64;
return CPU_TYPE.POWERPC64;
} else if ("ppc64le".equals(archString)) {
return CPU.POWERPC64LE;
return CPU_TYPE.POWERPC64LE;
} else if ("sparc".equals(archString)) {
return CPU.SPARC;
return CPU_TYPE.SPARC;
} else if ("sparcv9".equals(archString)) {
return CPU.SPARCV9;
return CPU_TYPE.SPARCV9;
} else if ("s390x".equals(archString)) {
return CPU.S390X;
return CPU_TYPE.S390X;
} else if ("arm".equals(archString)) {
return CPU.ARM;
return CPU_TYPE.ARM;
} else if ("universal".equals(archString)) {
// OS X OpenJDK7 builds report "universal" right now
String bits = System.getProperty("sun.arch.data.model", null);
if ("32".equals(bits)) {
System.setProperty("os.arch", "i386");
return CPU.I386;
return CPU_TYPE.I386;
} else if ("64".equals(bits)) {
System.setProperty("os.arch", "x86_64");
return CPU.X86_64;
return CPU_TYPE.X86_64;
}
}
return CPU.UNKNOWN;
return CPU_TYPE.UNKNOWN;
}

private static final String determineLibC() {
@@ -188,28 +178,6 @@ private static final String determineLibExt() {
}

protected Platform(OS_TYPE os) {
int dataModel = Integer.getInteger("sun.arch.data.model");
if (dataModel != 32 && dataModel != 64) {
switch (CPU) {
case I386:
case POWERPC:
case SPARC:
dataModel = 32;
break;
case X86_64:
case POWERPC64:
case POWERPC64LE:
case SPARCV9:
case S390X:
dataModel = 64;
break;
default:
dataModel = 0;
}
}
addressSize = dataModel;
addressMask = addressSize == 32 ? 0xffffffffL : 0xffffffffffffffffL;
longSize = os == OS.WINDOWS ? 32 : addressSize; // Windows is LLP64
String libpattern = null;
switch (os) {
case WINDOWS:
@@ -236,7 +204,6 @@ protected Platform(OS_TYPE os) {
} catch (Exception ex) {
version = 0;
}
javaVersionMajor = version;
}

/**
@@ -257,78 +224,6 @@ public final OS_TYPE getOS() {
return OS;
}

/**
* Gets the current processor architecture the JVM is running on.
*
* @return A <tt>CPU</tt> value representing the current processor architecture.
*/
public final CPU_TYPE getCPU() {
return CPU;
}

/**
* Gets the version of the Java Virtual Machine (JVM) jffi is running on.
*
* @return A number representing the java version. e.g. 5 for java 1.5, 6 for java 1.6
*/
public final int getJavaMajorVersion() {
return javaVersionMajor;
}
public final boolean isBSD() {
return OS == OS.FREEBSD || OS == OS.OPENBSD || OS == OS.NETBSD || OS == OS.DARWIN;
}
public final boolean isUnix() {
return OS != OS.WINDOWS;
}
public final boolean isSupported() {
return OS != OS.UNKNOWN
&& CPU != CPU.UNKNOWN
&& (addressSize == 32 || addressSize == 64)
&& javaVersionMajor >= 5;
}
/**
* An extension over <code>System.getProperty</code> method.
* Handles security restrictions, and returns the default
* value if the access to the property is restricted.
* @param property The system property name.
* @param defValue The default value.
* @return The value of the system property,
* or the default value.
*/
public static String getProperty(String property, String defValue) {
try {
return System.getProperty(property, defValue);
} catch (SecurityException se) {
return defValue;
}
}
/**
* Gets the size of a C 'long' on the native platform.
*
* @return the size of a long in bits
*/
public final int longSize() {
return longSize;
}

/**
* Gets the size of a C address/pointer on the native platform.
*
* @return the size of a pointer in bits
*/
public final int addressSize() {
return addressSize;
}

/**
* Gets the 32/64bit mask of a C address/pointer on the native platform.
*
* @return the size of a pointer in bits
*/
public final long addressMask() {
return addressMask;
}

/**
* Gets the name of this <tt>Platform</tt>.
*
@@ -338,15 +233,6 @@ public String getName() {
return CPU + "-" + OS;
}

public String mapLibraryName(String libName) {
//
// A specific version was requested - use as is for search
//
if (libPattern.matcher(libName).find()) {
return libName;
}
return System.mapLibraryName(libName);
}
private static class Supported extends Platform {
public Supported(OS_TYPE os) {
super(os);
@@ -370,18 +256,7 @@ public Default(OS_TYPE os) {
private static final class Darwin extends Supported {

public Darwin() {
super(OS.DARWIN);
}

@Override
public String mapLibraryName(String libName) {
//
// A specific version was requested - use as is for search
//
if (libPattern.matcher(libName).find()) {
return libName;
}
return "lib" + libName + ".dylib";
super(OS_TYPE.DARWIN);
}
}

@@ -391,15 +266,7 @@ public String mapLibraryName(String libName) {
private static final class Linux extends Supported {

public Linux() {
super(OS.LINUX);
}


@Override
public String mapLibraryName(String libName) {
// Older JDK on linux map 'c' to 'libc.so' which doesn't work
return "c".equals(libName) || "libc.so".equals(libName)
? "libc.so.6" : super.mapLibraryName(libName);
super(OS_TYPE.LINUX);
}
}

@@ -409,14 +276,7 @@ public String mapLibraryName(String libName) {
private static final class AIX extends Supported {

public AIX() {
super(OS.AIX);
}


@Override
public String mapLibraryName(String libName) {
return "c".equals(libName) || "libc.so".equals(libName)
? LIBC : super.mapLibraryName(libName);
super(OS_TYPE.AIX);
}
}

@@ -426,14 +286,14 @@ public String mapLibraryName(String libName) {
private static class Windows extends Supported {

public Windows() {
super(OS.WINDOWS);
super(OS_TYPE.WINDOWS);
}
}

private static boolean startsWithIgnoreCase(String s1, String s2) {
return s1.startsWith(s2)
|| s1.toUpperCase(LOCALE).startsWith(s2.toUpperCase(LOCALE))
|| s1.toLowerCase(LOCALE).startsWith(s2.toLowerCase(LOCALE));
|| s1.toUpperCase(java.util.Locale.ENGLISH).startsWith(s2.toUpperCase(java.util.Locale.ENGLISH))
|| s1.toLowerCase(java.util.Locale.ENGLISH).startsWith(s2.toLowerCase(java.util.Locale.ENGLISH));
}

public static String getOSName() {
18 changes: 0 additions & 18 deletions truffle/src/main/java/org/jruby/truffle/util/UnsafeHolder.java
Original file line number Diff line number Diff line change
@@ -80,29 +80,11 @@ private static boolean supportsFences() {
return false;
}

public static long fieldOffset(Class clazz, String name) {
if(U == null)
return -1;
try {
return U.objectFieldOffset(clazz.getDeclaredField(name));
} catch (Exception e) {
return sun.misc.Unsafe.INVALID_FIELD_OFFSET;
}
}

//// The following methods are Java8 only. They will throw undefined method errors if invoked without checking for fence support

public static void fullFence() {
U.fullFence();
}

public static void loadFence() {
U.loadFence();
}

public static void storeFence() {
U.storeFence();
}


}