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: 6c8e051098a8
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 26a682206bb2
Choose a head ref
  • 4 commits
  • 7 files changed
  • 1 contributor

Commits on Dec 10, 2016

  1. [Truffle] Fix mx warning.

    chrisseaton committed Dec 10, 2016
    Copy the full SHA
    c4120ac View commit details
  2. Copy the full SHA
    1fb4b4a View commit details
  3. Copy the full SHA
    8ed664f View commit details
  4. Copy the full SHA
    26a6822 View commit details
30 changes: 6 additions & 24 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -369,19 +369,6 @@ def mvn(*args)
sh *options, './mvnw', *args
end

def maven_options(*options)
maven_options = []
build_pack = options.delete('--build-pack')
offline = options.delete('--offline')
if build_pack || offline
maven_options.push "-Dmaven.repo.local=#{Utilities.find_repo('jruby-build-pack')}/maven"
end
if offline
maven_options.push '--offline'
end
return [maven_options, options]
end

def mx(dir, *args)
command = ['mx', '-p', dir]
command.push *args
@@ -444,8 +431,6 @@ def help
cexts [--no-openssl] build the cext backend (set SULONG_HOME)
parser build the parser
options build the options
--build-pack use the build pack
--offline use the build pack to build offline
jt clean clean
jt irb irb
jt rebuild clean and build
@@ -530,17 +515,15 @@ def checkout(branch)
end

def bootstrap(*options)
maven_options, other_options = maven_options(*options)
mvn *maven_options, '-Pbootstrap-no-launcher'
mvn *options, '-Pbootstrap-no-launcher'
end

def build(*options)
maven_options, other_options = maven_options(*options)
project = other_options.first
project = options.first
env = VERBOSE ? {} : {'JRUBY_BUILD_MORE_QUIET' => 'true'}
case project
when 'truffle'
mvn env, *maven_options, '-pl', 'truffle', 'package'
mvn env, '-pl', 'truffle', 'package'
when 'cexts'
no_openssl = options.delete('--no-openssl')
build_ruby_su
@@ -556,7 +539,7 @@ def build(*options)
when 'options'
sh 'tool/truffle/generate-options.rb'
when nil
mvn env, *maven_options, 'package'
mvn env, 'package'
else
raise ArgumentError, project
end
@@ -1260,8 +1243,7 @@ def get_times(trace, total)
end

def tarball(*options)
maven_options, other_options = maven_options(*options)
mvn *maven_options, '-Pdist'
mvn '-Pdist'
generated_file = "#{JRUBY_DIR}/maven/jruby-dist/target/jruby-dist-#{Utilities.jruby_version}-bin.tar.gz"
final_file = "#{JRUBY_DIR}/jruby-bin-#{Utilities.jruby_version}.tar.gz"
FileUtils.copy generated_file, final_file
@@ -1342,7 +1324,7 @@ def main(args)
send(args.shift)
when "build"
command = [args.shift]
while ['truffle', 'cexts', 'parser', 'options', '--offline', '--build-pack', '--no-openssl'].include?(args.first)
while ['truffle', 'cexts', 'parser', 'options', '--no-openssl'].include?(args.first)
command << args.shift
end
send(*command)
8 changes: 0 additions & 8 deletions tool/travis-install.sh
Original file line number Diff line number Diff line change
@@ -3,14 +3,6 @@
set -e
set -x

if [[ -v USE_BUILD_PACK ]]
then
git clone --depth 1 https://github.com/jruby/jruby-build-pack.git
MAVEN_CLI_OPTS="-Dmaven.repo.local=jruby-build-pack/maven --offline"
cp bin/jruby.bash bin/jruby
chmod +x bin/jruby
fi

if [[ -n "$PHASE" && $JAVA_HOME == *"java-8"* ]]
then
./mvnw $MAVEN_CLI_OPTS package -B --projects '!truffle' -Dinvoker.skip -Dmaven.test.skip;
5 changes: 0 additions & 5 deletions tool/travis-script.sh
Original file line number Diff line number Diff line change
@@ -3,11 +3,6 @@
set -e
set -x

if [[ -v USE_BUILD_PACK ]]
then
MAVEN_CLI_OPTS="-Dmaven.repo.local=jruby-build-pack/maven --offline"
fi

if [[ -v PHASE ]]
then
DOWNLOAD_OUTPUT_FILTER='Download|\\[exec\\] [[:digit:]]+/[[:digit:]]+|^[[:space:]]*\\[exec\\][[:space:]]*$'
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ public DynamicObject randomizerSeed(DynamicObject randomizer, long seed) {

@TruffleBoundary
protected static org.jruby.truffle.util.Random randomFromLong(long seed) {
return org.jruby.truffle.util.Random.RandomType.randomFromLong(seed);
return org.jruby.truffle.util.Random.randomFromLong(seed);
}

public static int N = 624;
Original file line number Diff line number Diff line change
@@ -700,7 +700,7 @@ public static final byte[] twosComplementToUnsignedBytes(byte[] in, int shift, b
int bitcnt = 0;
for(int i = ilen, o = olen; --o >= 0; ) {
if(bitcnt < shift) {
bitbuf |= ((int)in[--i] & (int)0xff) << bitcnt;
bitbuf |= ((int)in[--i] & 0xff) << bitcnt;
bitcnt += 8;
}
out[o] = digits[bitbuf & mask];
61 changes: 9 additions & 52 deletions truffle/src/main/java/org/jruby/truffle/util/Random.java
Original file line number Diff line number Diff line change
@@ -25,7 +25,6 @@
***** END LICENSE BLOCK *****/
package org.jruby.truffle.util;

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

public class Random {
@@ -57,19 +56,6 @@ public Random(int[] initKey) {
initByArray(initKey);
}

public Random(Random orig) {
System.arraycopy(orig.state, 0, this.state, 0, this.state.length);
this.left = orig.left;
}

public Random(int[] state, int left) {
if (state.length != this.state.length) {
throw new IllegalStateException("wrong state length: " + state.length);
}
System.arraycopy(state, 0, this.state, 0, this.state.length);
this.left = left;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -160,30 +146,6 @@ public int genrandInt32() {
return y;
}

public double genrandReal() {
int a = genrandInt32() >>> 5;
int b = genrandInt32() >>> 6;
return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0);
}

public double genrandReal2() {
int a = genrandInt32();
int b = genrandInt32();
return intPairToRealInclusive(a, b);
}

private static final BigInteger INTPAIR_CONST = BigInteger.valueOf((1L << 53) + 1);
private static final double LDEXP_CONST = Math.pow(2.0, -53);

// c: ldexp((a<< 32)|b) * ((1<<53)+1) >> 64, -53)
// TODO: not enough prec...
private double intPairToRealInclusive(int a, int b) {
BigInteger c = BigInteger.valueOf(a & 0xffffffffL);
BigInteger d = BigInteger.valueOf(b & 0xffffffffL);
return c.shiftLeft(32).or(d).multiply(INTPAIR_CONST).shiftRight(64).doubleValue()
* LDEXP_CONST;
}

public int[] getState() {
return state;
}
@@ -192,21 +154,16 @@ public int getLeft() {
return left;
}


public static class RandomType {

public static Random randomFromLong(long seed) {
long v = Math.abs(seed);
if (v == (v & 0xffffffffL)) {
return new Random((int) v);
} else {
int[] ints = new int[2];
ints[0] = (int) v;
ints[1] = (int) (v >> 32);
return new Random(ints);
}
public static Random randomFromLong(long seed) {
long v = Math.abs(seed);
if (v == (v & 0xffffffffL)) {
return new Random((int) v);
} else {
int[] ints = new int[2];
ints[0] = (int) v;
ints[1] = (int) (v >> 32);
return new Random(ints);
}

}

}
54 changes: 4 additions & 50 deletions truffle/src/main/java/org/jruby/truffle/util/SipHashInline.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package org.jruby.truffle.util;

import sun.misc.Unsafe;

import java.nio.ByteOrder;
import java.nio.ByteBuffer;

/**
* SipHash implementation with hand inlining the SIPROUND.
@@ -33,9 +31,11 @@ public static long hash24(long k0, long k1, byte[] src, int offset, int length)
throw new ArrayIndexOutOfBoundsException(src.length);
}

final ByteBuffer buffer = ByteBuffer.wrap(src, offset, length);

// processing 8 bytes blocks in data
while (i < last) {
m = LongReader.INSTANCE.getLong(src, i);
m = buffer.getLong(i);
i += 8;
// MSGROUND {
v3 ^= m;
@@ -143,50 +143,4 @@ public static long hash24(long k0, long k1, byte[] src, int offset, int length)
return v0 ^ v1 ^ v2 ^ v3;
}

private static abstract class LongReader {
public abstract long getLong(byte[] src, int offset);

public static final LongReader INSTANCE = createBestLongReader();

private static LongReader createBestLongReader() {
try {
if (UnsafeHolder.U != null) {
if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
return new UnsafeLongReader(UnsafeHolder.U);
}
}
} catch (Exception e) {
}
return new FallbackLongReader();
}

private static final class FallbackLongReader extends SipHashInline.LongReader {
@Override
public long getLong(byte[] src, int offset) {
return (long) src[offset++] |
(long) src[offset++] << 8 |
(long) src[offset++] << 16 |
(long) src[offset++] << 24 |
(long) src[offset++] << 32 |
(long) src[offset++] << 40 |
(long) src[offset++] << 48 |
(long) src[offset++] << 56 ;
}
}

private static final class UnsafeLongReader extends SipHashInline.LongReader {
final Unsafe unsafe;
final int byteArrayBaseOffset;

public UnsafeLongReader(Unsafe unsafe) {
this.unsafe = unsafe;
this.byteArrayBaseOffset = unsafe.arrayBaseOffset(byte[].class);
}

@Override
public final long getLong(byte[] src, int offset) {
return unsafe.getLong(src, byteArrayBaseOffset + (long)offset);
}
}
}
}