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

Commits on Nov 8, 2016

  1. [Truffle] quiet wget

    pitr-ch committed Nov 8, 2016
    Copy the full SHA
    dcea10f View commit details
  2. 1
    Copy the full SHA
    ce64121 View commit details
2 changes: 1 addition & 1 deletion lib/ruby/truffle/truffle/bundler-workarounds.rb
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@ def download(spec, source_uri, install_dir = Gem.dir)
remote_gem_path = source_uri + "gems/#{gem_file_name}"

# WORKAROUND STARTS HERE
cmd = "wget #{remote_gem_path} -O #{local_gem_path}"
cmd = "wget -q #{remote_gem_path} -O #{local_gem_path}"
`#{cmd}`
# self.cache_update_path remote_gem_path, local_gem_path
# WORKAROUND ENDS HERE
26 changes: 26 additions & 0 deletions spec/truffle/specs/truffle/ropes/complex_structure_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. This
# code is released under a tri EPL/GPL/LGPL license. You can use it,
# redistribute it and/or modify it under the terms of the:
#
# Eclipse Public License version 1.0
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1
# OTHER DEALINGS IN THE SOFTWARE.

require_relative '../../../../ruby/spec_helper'

describe "Truffle Rope complex structure" do

[
[(('abcd'*3)[1..-1]+('ABCD')), 'bcdabcdabcdABCD'],
[(('abcd'*3)[1..-2]+('ABCD')), 'bcdabcdabcABCD'],
[(('abcd'*3)[1..-3]+('ABCD')), 'bcdabcdabABCD'],
[(('abcd'*3)[1..-4]+('ABCD')), 'bcdabcdaABCD'],
[(('abcd'*3)[1..-5]+('ABCD')), 'bcdabcdABCD'],
].each_with_index do |(a, b), i|
it format('%d: %s', i, b) do
a.should == b
end
end

end
Original file line number Diff line number Diff line change
@@ -383,16 +383,15 @@ public static byte[] flattenBytes(Rope rope) {
} else {
final int bytesToCopy = substringLengths.peek();
final int patternLength = repeatingRope.getChild().byteLength();
int loopCount = (bytesToCopy + patternLength - 1) / patternLength;

// Fix the offset to be appropriate for a given child. The offset is reset the first time it is
// consumed, so there's no need to worry about adversely affecting anything by adjusting it here.
offset %= repeatingRope.getChild().byteLength();

// Adjust the loop count in case we're straddling two boundaries.
if (offset > 0 && ((bytesToCopy - (patternLength - offset)) % patternLength) > 0) {
loopCount++;
}
// The loopCount has to be precisely determined so every repetion has at least some parts used.
// It has to account for the begging we don't need (offset), has to reach the end but, and must not
// have extra repetitions.
int loopCount = (offset + bytesToCopy + patternLength - 1 ) / patternLength;

// TODO (nirvdrum 25-Aug-2016): Flattening the rope with CR_VALID will cause a character length recalculation, even though we already know what it is. That operation should be made more optimal.
final Rope flattenedChild = flatten(repeatingRope.getChild());