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

Commits on May 28, 2015

  1. [Truffle] Add boxUntil(Object array, int length).

    * Use it in slowToArray().
    * Fix ary[0,0] = large array.
    eregon committed May 28, 2015
    Copy the full SHA
    d1267c9 View commit details
  2. Copy the full SHA
    3a98013 View commit details
7 changes: 3 additions & 4 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -256,17 +256,16 @@ def print(*args)

def test_mri(*args)
env_vars = {
"EXCLUDES" => "test/mri/excludes_truffle"
"EXCLUDES" => "test/mri/excludes_truffle"
}
jruby_args = %w[-J-Xmx2G -X+T -Xtruffle.exceptions.print_java]

if args.empty?
args = File.readlines("#{JRUBY_DIR}/test/mri_truffle.index").grep(/^[^#]\w+/).map(&:chomp)
end

command = %w[test/mri/runner.rb -v --color=never --tty=no -q --]
args.unshift(*command)
raw_sh(env_vars, "#{JRUBY_DIR}/bin/jruby", *jruby_args, *args)
command = %w[test/mri/runner.rb -v --color=never --tty=no -q]
raw_sh(env_vars, "#{JRUBY_DIR}/bin/jruby", *jruby_args, *command, *args)
end
private :test_mri

Original file line number Diff line number Diff line change
@@ -595,7 +595,7 @@ public Object setOtherArray(VirtualFrame frame, RubyArray array, int start, int
CompilerDirectives.transferToInterpreter();
writeNode = insert(ArrayWriteDenormalizedNodeGen.create(getContext(), getSourceSection(), null, null, null));
}
Object[] values = ArrayUtils.box(value.getStore());
Object[] values = value.slowToArray();
if (value.getSize() == length || (begin + length + 1) > array.getSize()) {
int i = begin;
for (Object obj : values) {
Original file line number Diff line number Diff line change
@@ -196,6 +196,25 @@ public static Object[] boxExtra(double[] unboxed, int extra) {
return boxed;
}

public static Object[] boxExtra(Object array, int extra) {
CompilerAsserts.neverPartOfCompilation();

if (array == null) {
return new Object[extra];
} else if (array instanceof int[]) {
return boxExtra((int[]) array, extra);
} else if (array instanceof long[]) {
return boxExtra((long[]) array, extra);
} else if (array instanceof double[]) {
return boxExtra((double[]) array, extra);
} else if (array instanceof Object[]) {
final Object[] objectArray = (Object[]) array;
return Arrays.copyOf(objectArray, objectArray.length + extra);
} else {
throw new UnsupportedOperationException();
}
}

public static Object[] boxUntil(int[] unboxed, int length) {
final Object[] boxed = new Object[length];

@@ -226,20 +245,20 @@ public static Object[] boxUntil(double[] unboxed, int length) {
return boxed;
}

public static Object[] boxExtra(Object array, int extra) {
public static Object[] boxUntil(Object array, int length) {
CompilerAsserts.neverPartOfCompilation();

if (array == null) {
return new Object[extra];
} if (array instanceof int[]) {
return boxExtra((int[]) array, extra);
return new Object[0];
} else if (array instanceof int[]) {
return boxUntil((int[]) array, length);
} else if (array instanceof long[]) {
return boxExtra((long[]) array, extra);
return boxUntil((long[]) array, length);
} else if (array instanceof double[]) {
return boxExtra((double[]) array, extra);
return boxUntil((double[]) array, length);
} else if (array instanceof Object[]) {
final Object[] objectArray = (Object[]) array;
return Arrays.copyOf(objectArray, objectArray.length + extra);
return Arrays.copyOf(objectArray, length);
} else {
throw new UnsupportedOperationException();
}
Original file line number Diff line number Diff line change
@@ -135,7 +135,7 @@ private static Object storeFromObjects(RubyContext context, Object... objects) {
}

public Object[] slowToArray() {
return Arrays.copyOf(ArrayUtils.box(store), size);
return ArrayUtils.boxUntil(store, size);
}

public Object slowShift() {