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

Commits on Dec 4, 2015

  1. [Truffle] Import pr-zlib

    chrisseaton committed Dec 4, 2015
    Copy the full SHA
    0a96551 View commit details
  2. Copy the full SHA
    e44cefc View commit details
Showing with 8,761 additions and 508 deletions.
  1. +4 −0 COPYING
  2. +1 −0 lib/ruby/truffle/README.md
  3. +23 −0 lib/ruby/truffle/pr-zlib/CHANGES
  4. +20 −0 lib/ruby/truffle/pr-zlib/MANIFEST
  5. +52 −0 lib/ruby/truffle/pr-zlib/README
  6. +116 −0 lib/ruby/truffle/pr-zlib/Rakefile
  7. +173 −0 lib/ruby/truffle/pr-zlib/bin/minizip.rb
  8. +21 −0 lib/ruby/truffle/pr-zlib/certs/djberg96_pub.pem
  9. +385 −0 lib/ruby/truffle/pr-zlib/examples/example_rbzlib.rb
  10. +1 −0 lib/ruby/truffle/pr-zlib/lib/pr-zlib.rb
  11. +5,079 −0 lib/ruby/truffle/pr-zlib/lib/pr/rbzlib.rb
  12. +1,567 −0 lib/ruby/truffle/pr-zlib/lib/pr/zlib.rb
  13. +24 −0 lib/ruby/truffle/pr-zlib/pr-zlib.gemspec
  14. +43 −0 lib/ruby/truffle/pr-zlib/profile/bench_pr_zlib.rb
  15. +43 −0 lib/ruby/truffle/pr-zlib/profile/bench_zlib.rb
  16. +28 −0 lib/ruby/truffle/pr-zlib/profile/profile_pr_zlib_read.rb
  17. +26 −0 lib/ruby/truffle/pr-zlib/profile/profile_pr_zlib_write.rb
  18. +133 −0 lib/ruby/truffle/pr-zlib/test/test_rbzlib.rb
  19. +76 −0 lib/ruby/truffle/pr-zlib/test/test_rbzlib_bytef.rb
  20. +56 −0 lib/ruby/truffle/pr-zlib/test/test_rbzlib_posf.rb
  21. +168 −0 lib/ruby/truffle/pr-zlib/test/test_zlib.rb
  22. +55 −0 lib/ruby/truffle/pr-zlib/test/test_zlib_deflate.rb
  23. +93 −0 lib/ruby/truffle/pr-zlib/test/test_zlib_gzip_file.rb
  24. +183 −0 lib/ruby/truffle/pr-zlib/test/test_zlib_gzip_reader.rb
  25. +186 −0 lib/ruby/truffle/pr-zlib/test/test_zlib_gzip_writer.rb
  26. +55 −0 lib/ruby/truffle/pr-zlib/test/test_zlib_inflate.rb
  27. +146 −0 lib/ruby/truffle/pr-zlib/test/test_zlib_zstream.rb
  28. +1 −250 lib/ruby/truffle/truffle/zlib.rb
  29. +3 −0 spec/truffle/tags/library/zlib/crc32_tags.txt
  30. +0 −1 spec/truffle/tags/library/zlib/crc_table_tags.txt
  31. +0 −2 spec/truffle/tags/library/zlib/deflate/deflate_tags.txt
  32. +0 −1 spec/truffle/tags/library/zlib/deflate/set_dictionary_tags.txt
  33. +0 −1 spec/truffle/tags/library/zlib/gzipfile/close_tags.txt
  34. +0 −1 spec/truffle/tags/library/zlib/gzipfile/closed_tags.txt
  35. +0 −2 spec/truffle/tags/library/zlib/gzipfile/comment_tags.txt
  36. +0 −2 spec/truffle/tags/library/zlib/gzipfile/orig_name_tags.txt
  37. +0 −1 spec/truffle/tags/library/zlib/gzipreader/each_byte_tags.txt
  38. +0 −5 spec/truffle/tags/library/zlib/gzipreader/eof_tags.txt
  39. +0 −3 spec/truffle/tags/library/zlib/gzipreader/getc_tags.txt
  40. +0 −1 spec/truffle/tags/library/zlib/gzipreader/pos_tags.txt
  41. +0 −7 spec/truffle/tags/library/zlib/gzipreader/read_tags.txt
  42. +0 −3 spec/truffle/tags/library/zlib/gzipreader/rewind_tags.txt
  43. +0 −3 spec/truffle/tags/library/zlib/gzipwriter/mtime_tags.txt
  44. +0 −2 spec/truffle/tags/library/zlib/gzipwriter/write_tags.txt
  45. +0 −7 spec/truffle/tags/library/zlib/inflate/append_tags.txt
  46. +0 −5 spec/truffle/tags/library/zlib/inflate/inflate_tags.txt
  47. +0 −1 spec/truffle/tags/library/zlib/inflate/set_dictionary_tags.txt
  48. +0 −1 spec/truffle/tags/library/zlib/zstream/adler_tags.txt
  49. +0 −1 spec/truffle/tags/library/zlib/zstream/avail_in_tags.txt
  50. +0 −1 spec/truffle/tags/library/zlib/zstream/avail_out_tags.txt
  51. +0 −1 spec/truffle/tags/library/zlib/zstream/data_type_tags.txt
  52. +0 −1 spec/truffle/tags/library/zlib/zstream/flush_next_out_tags.txt
  53. +0 −203 truffle/src/main/java/org/jruby/truffle/nodes/ext/ZlibNodes.java
  54. +0 −2 truffle/src/main/java/org/jruby/truffle/runtime/core/CoreLibrary.java
4 changes: 4 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -78,6 +78,10 @@ below. Also see LICENSE.RUBY for most files found in lib/ruby/stdlib.
Some parts of the RubySL implementations of the stdlib in lib/ruby/truffle/rubysl
are copyright (c) 2013 Brian Shirai and are licensed under the 3-clause BSD license.

pr-zlib is copyright Park Heesob and Daniel Berger. "This library is covered
under the same license as zlib itself. For the text of the zlib license,
please see http://zlib.net/zlib_license.html."

The complete text of the Eclipse Public License is as follows:

Eclipse Public License - v 1.0
1 change: 1 addition & 0 deletions lib/ruby/truffle/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pr-zlib is version 1.0.3, commit c1418dd1abde5c4f6bcc7073b7965eeb4c168144
23 changes: 23 additions & 0 deletions lib/ruby/truffle/pr-zlib/CHANGES
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
= 1.0.3 - 3-Dec-2015
* Added a license. This library is now covered under the zlib license.
* Some performance tuning. Reads are 2-3 times faster, while writes are
about twenty percent faster.
* This gem is now signed.
* Added a pr-zlib.rb file for convenience.
* Use require_relative internally where appropriate.
* More stringent value and limit checking added. Thanks go to
Chris Seaton for the patches.

= 1.0.2 - 24-Jun-2015
* Fixed a marshalling issue.

= 1.0.1 - 16-Oct-2014
* Added benchmark and profiler scripts and rake tasks.
* Switched profiling scripts to use ruby-prof.
* The test-unit and ruby-prof libraries are now development dependencies.
* Minor updates to eliminate warnings for Ruby 1.9.3 and 2.1.
* Some minor test suite updates, mostly for 1.9.3.
* Updated the gemspec, removed Rubyforge references.

= 1.0.0 - 12-Jun-2009
* Initial release
20 changes: 20 additions & 0 deletions lib/ruby/truffle/pr-zlib/MANIFEST
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
CHANGES
MANIFEST
README
pr-zlib.gemspec
bin/minizip.rb
certs/djberg96_pub.pem
examples/example_rbzlib.rb
lib/pr-zlib.rb
lib/pr/rbzlib.rb
lib/pr/zlib.rb
test/test_rbzlib_bytef.rb
test/test_rbzlib_posf.rb
test/test_rbzlib.rb
test/test_zlib_deflate.rb
test/test_zlib_gzip_file.rb
test/test_zlib_gzip_reader.rb
test/test_zlib_gzip_writer.rb
test/test_zlib_inflate.rb
test/test_zlib_zstream.rb
test/test_zlib.rb
52 changes: 52 additions & 0 deletions lib/ruby/truffle/pr-zlib/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
= Description
The pr-zlib library is a pure Ruby version of the zlib compression library.
It consists of both a port of zlib.h and the Ruby zlib library that ships as
part of the standard library.

= Synopsis

# Imitating a bit of code used in rubygems
require 'pr/zlib'
require 'stringio'

data = StringIO.new(data)
Zlib::GzipReader.new(data).read

= Motivation

First, building the zlib C library on MS Windows with Visual C++ is very
difficult. However, certain libraries depend on zlib, most notably rubygems.
By providing a pure Ruby version we eliminate any compiler or platform
compatability issues.

Second, even some Unix distributions, such as Debian, do not ship with
the zlib library by default. By creating a pure Ruby version of the zlib
library we eliminate the need to install a 3rd party C library, and
eliminate a potential weak link in the dependency chain.

Third, by creating pure Ruby versions of the library and the interface we
are more likely to receive patches, feature requests, documentation updates,
etc, from the Ruby community since not everyone who knows Ruby also knows C.

Last, the zlib interface that ships as part of the stdlib is a little on the
clunky side. By providing a pure Ruby version, authors can create their own
interface as they see fit.

= TODO

More tests, and better tests, are needed for both Rbzlib and Zlib.

= Caveats
You cannot use both this library and the zlib standard library at the same
time. If you try to use both there is a good chance you will get an allocation
error of some sort. If you already have zlib, you do not need this library.

= License

This library is covered under the same license as zlib itself. For the text
of the zlib license, please see http://zlib.net/zlib_license.html.

= Authors

* Park Heesob (C translation)
* Daniel Berger (Testing, packaging, deployment)
116 changes: 116 additions & 0 deletions lib/ruby/truffle/pr-zlib/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require 'rbconfig'

CLEAN.include("**/*.rbc", "**/*.gem", "**/*.txt", "**/*.gz")

desc 'Install the pr-zlib library as zlib'
task :install_as_zlib do
install_dir = File.join(RbConfig::CONFIG['sitelibdir'], 'pr')
Dir.mkdir(install_dir) unless File.exists?(install_dir)

cp('lib/pr/zlib.rb', RbConfig::CONFIG['sitelibdir'], :verbose => true)
cp('lib/pr/rbzlib.rb', install_dir, :verbose => true)
end

namespace :gem do
desc 'Create the pr-zlib gem'
task :create do
require 'rubygems/package'
spec = eval(IO.read('pr-zlib.gemspec'))
spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
Gem::Package.build(spec, true)
end

desc 'Install the pr-zlib gem'
task :install => [:create] do
file = Dir["*.gem"].first
sh "gem install -l #{file}"
end
end

namespace :bench do
desc "Run the zlib benchmark"
task :zlib do
Dir.chdir('profile'){ ruby "bench_zlib.rb" }
end

desc "Run the pr-zlib benchmark"
task :przlib do
sh "ruby -Ilib profile/bench_pr_zlib.rb"
end
end

namespace :profile do
desc "Run the profiler on the write operation"
task :write do
sh "ruby -Ilib profile/profile_pr_zlib_write.rb"
end

desc "Run the profiler on the read operation"
task :read do
sh "ruby -Ilib profile/profile_pr_zlib_read.rb"
end
end

Rake::TestTask.new do |t|
t.warning = true
t.verbose = true
end

Rake::TestTask.new('test_zlib') do |t|
t.warning = true
t.verbose = true
t.test_files = FileList['test/test_zlib.rb']
end

Rake::TestTask.new('test_gzip_file') do |t|
t.warning = true
t.verbose = true
t.test_files = FileList['test/test_zlib_gzip_file.rb']
end

Rake::TestTask.new('test_gzip_reader') do |t|
t.warning = true
t.verbose = true
t.test_files = FileList['test/test_zlib_gzip_reader.rb']
end

Rake::TestTask.new('test_gzip_writer') do |t|
t.warning = true
t.verbose = true
t.test_files = FileList['test/test_zlib_gzip_writer.rb']
end

Rake::TestTask.new('test_deflate') do |t|
t.warning = true
t.verbose = true
t.test_files = FileList['test/test_zlib_deflate.rb']
end

Rake::TestTask.new('test_inflate') do |t|
t.warning = true
t.verbose = true
t.test_files = FileList['test/test_zlib_inflate.rb']
end

Rake::TestTask.new('test_rbzlib') do |t|
t.warning = true
t.verbose = true
t.test_files = FileList['test/test_rbzlib.rb']
end

Rake::TestTask.new('test_rbzlib_bytef') do |t|
t.warning = true
t.verbose = true
t.test_files = FileList['test/test_rbzlib_bytef.rb']
end

Rake::TestTask.new('test_rbzlib_posf') do |t|
t.warning = true
t.verbose = true
t.test_files = FileList['test/test_rbzlib_posf.rb']
end

task :default => :test
Loading