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

Commits on Nov 23, 2016

  1. Copy the full SHA
    c5795cc View commit details
  2. Copy the full SHA
    6bad037 View commit details
  3. Copy the full SHA
    2c21660 View commit details
  4. Copy the full SHA
    b4e1de4 View commit details
  5. Copy the full SHA
    e7a7582 View commit details
  6. Copy the full SHA
    aae2f16 View commit details
  7. 2
    Copy the full SHA
    68ff93c View commit details
  8. Copy the full SHA
    0594bfe View commit details
  9. Copy the full SHA
    fc6b12e View commit details
  10. [Truffle] Remove argon2.

    chrisseaton committed Nov 23, 2016
    Copy the full SHA
    cd07bce View commit details
  11. Copy the full SHA
    e4d94e1 View commit details
  12. Copy the full SHA
    71b91a5 View commit details
  13. Copy the full SHA
    8392d31 View commit details
  14. 5
    Copy the full SHA
    fff27c3 View commit details
  15. Copy the full SHA
    d65e38f View commit details
6 changes: 3 additions & 3 deletions ci.hocon
Original file line number Diff line number Diff line change
@@ -361,8 +361,8 @@ cext-benchmarks: ${sulong} {
}

setup: ${sulong.setup} ${gem-test-pack.setup} ${bench.setup} [
${jt} [cextc_extconf, ../ruby-benchmarks/chunky_png/oily_png],
${jt} [cextc_extconf, ../ruby-benchmarks/psd.rb/psd_native]
${jt} [cextc, ../ruby-benchmarks/chunky_png/oily_png],
${jt} [cextc, ../ruby-benchmarks/psd.rb/psd_native]
]

run: [
@@ -404,7 +404,7 @@ test-cexts: ${sulong} ${gem-test-pack} {

run: [
${jt} [test, specs, --graal, ":capi"],
${jt} [test, cexts, --no-argon2]
${jt} [test, cexts]
]
}

7 changes: 5 additions & 2 deletions lib/ruby/truffle/mri/mkmf.rb
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
require 'rbconfig'
require 'fileutils'
require 'shellwords'
require 'pathname'

# :stopdoc:
class String
@@ -225,8 +226,10 @@ def map_dir(dir, map = nil)
end

# topdir = File.dirname(File.dirname(__FILE__))
# topdir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) # MODIFED two more folders up to jruby
topdir = File.dirname(File.dirname(File.dirname(File.dirname(File.dirname(__FILE__))))) # MODIFED 3 more folders up to jruby
# Modified for JRuby+Truffle
topdir = Pathname.new(File.dirname(__FILE__)).enum_for(:ascend).detect { |dir|
dir.join('ci.hocon').exist?
}.to_s
path = File.expand_path($0)
until (dir = File.dirname(path)) == path
if File.identical?(dir, topdir)
2 changes: 0 additions & 2 deletions test/truffle/cexts/globals/.jruby-cext-build.yml

This file was deleted.

2 changes: 0 additions & 2 deletions test/truffle/cexts/method/.jruby-cext-build.yml

This file was deleted.

2 changes: 0 additions & 2 deletions test/truffle/cexts/minimum/.jruby-cext-build.yml

This file was deleted.

2 changes: 0 additions & 2 deletions test/truffle/cexts/module/.jruby-cext-build.yml

This file was deleted.

4 changes: 0 additions & 4 deletions test/truffle/cexts/nokogiri/.jruby-cext-build.yml

This file was deleted.

2 changes: 0 additions & 2 deletions test/truffle/cexts/oily_png/.jruby-cext-build.yml

This file was deleted.

2 changes: 0 additions & 2 deletions test/truffle/cexts/psd_native/.jruby-cext-build.yml

This file was deleted.

4 changes: 0 additions & 4 deletions test/truffle/cexts/xml/.jruby-cext-build.yml

This file was deleted.

4 changes: 0 additions & 4 deletions test/truffle/cexts/xopenssl/.jruby-cext-build.yml

This file was deleted.

86 changes: 8 additions & 78 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -30,7 +30,6 @@
JDEBUG_TEST = "-Dmaven.surefire.debug=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=#{JDEBUG_PORT} -Xnoagent -Djava.compiler=NONE"
JEXCEPTION = "-Xtruffle.exceptions.print_java=true"
METRICS_REPS = 10
CEXTC_CONF_FILE = '.jruby-cext-build.yml'

VERBOSE = ENV.include? 'V'

@@ -485,7 +484,7 @@ def help
jt test bundle tests using bundler
jt test gems tests using gems
jt test ecosystem [TESTS] tests using the wider ecosystem such as bundler, Rails, etc
jt test cexts [--no-libxml --no-openssl --no-argon2] run C extension tests
jt test cexts [--no-libxml --no-openssl] run C extension tests
(implies --graal, where Graal needs to include Sulong, set SULONG_HOME to a built checkout of Sulong, and set GEM_HOME)
jt test report :language build a report on language specs
:core (results go into test/target/mspec-html-report)
@@ -713,67 +712,7 @@ def build_ruby_su(cext_dir=nil)
end
private :build_ruby_su

def cextc(cext_dir, *clang_opts)
build_ruby_su(cext_dir)

config_file = File.join(cext_dir, CEXTC_CONF_FILE)
unless File.exist?(config_file)
abort "There is no #{CEXTC_CONF_FILE} in #{cext_dir} at the moment - I don't know how to build it"
end

config = YAML.load_file(config_file)
config_src = config['src']

src = replace_env_vars(config['src'])
# Expand relative to the cext directory
src = File.expand_path(src, cext_dir)
src_files = Dir[src].sort
raise "No source files found in #{src}!" if src_files.empty?

config_cflags = config['cflags'] || ''
config_cflags = replace_env_vars(config_cflags)
config_cflags = config_cflags.split
# Expand include paths
config_cflags.map! { |cflag|
if cflag.start_with? '-I'
inc = File.expand_path(cflag[2..-1], cext_dir)
"-I#{inc}"
else
cflag
end
}

out = File.expand_path(config['out'], cext_dir)

lls = []

src_files.each do |src|
ll = File.join(File.dirname(out), File.basename(src, '.*') + '.ll')

clang "-I#{SULONG_HOME}/include", '-Ilib/ruby/truffle/cext', '-S', '-emit-llvm', *config_cflags, *clang_opts, src, '-o', ll
llvm_opt '-S', '-always-inline', '-mem2reg', ll, '-o', ll

lls.push ll
end

config_libs = config['libs'] || ''
config_libs = replace_env_vars(config_libs)
config_libs = config_libs.split(' ')

if MAC
config_libs.each do |lib|
if lib.include?('.so')
lib['.so'] = '.dylib'
end
end
end

config_libs = config_libs.flat_map { |l| ['-l', l] }

sulong_link '-o', out, *config_libs, *lls
end

def cextc_extconf(cext_dir, test_gem=false, *clang_opts)
def cextc(cext_dir, test_gem=false, *clang_opts)
build_ruby_su(cext_dir)

is_ruby = cext_dir == "#{JRUBY_DIR}/truffle/src/main/c/cext"
@@ -794,11 +733,14 @@ def cextc_extconf(cext_dir, test_gem=false, *clang_opts)
end
copy_target = if is_ruby
"#{JRUBY_DIR}/lib/ruby/truffle/cext/ruby.su"
elsif cext_dir == "#{JRUBY_DIR}/truffle/src/main/c/openssl"
"#{JRUBY_DIR}/truffle/src/main/c/openssl/openssl.su"
else
"#{JRUBY_DIR}/test/truffle/cexts/#{gem_name}/lib/#{gem_name}/#{gem_name}.su"
end

Dir.chdir(gem_dir) do
STDERR.puts "in #{gem_dir}..."
run("extconf.rb")
raw_sh("make")
FileUtils.copy_file("#{gem_name}.su", copy_target)
@@ -878,7 +820,6 @@ def test_compiler(*args)
def test_cexts(*args)
no_libxml = args.delete('--no-libxml')
no_openssl = args.delete('--no-openssl')
no_argon2 = args.delete('--no-argon2')

# Test that we can compile and run some basic C code that uses libxml and openssl

@@ -916,7 +857,7 @@ def test_cexts(*args)
next if gem_name == 'xml' && no_libxml
next if gem_name == 'xopenssl' && no_openssl
dir = "#{JRUBY_DIR}/test/truffle/cexts/#{gem_name}"
cextc dir
cextc dir, true
name = File.basename(dir)
next if gem_name == 'globals' # globals is excluded just for running
run '--graal', "-I#{dir}/lib", "#{dir}/bin/#{name}", :out => output_file
@@ -935,23 +876,12 @@ def test_cexts(*args)
['psd_native', ['chunky_png-1.3.6', 'oily_png-1.2.0', 'bindata-2.3.1', 'hashie-3.4.4', 'psd-enginedata-1.1.1', 'psd-2.1.2', 'psd_native-1.1.3'], ['oily_png', 'psd_native']],
['nokogiri', [], ['nokogiri']]
]

unless no_argon2
tests.push ['ruby-argon2', [], [], "#{ENV['GEM_HOME']}/bundler/gems/ruby-argon2-bd3fb1e056cf"]
end

tests.each do |gem_name, dependencies, libs, gem_root|
next if gem_name == 'nokogiri' # nokogiri totally excluded
next if gem_name == 'nokogiri' && no_libxml
unless gem_root and File.exist?(File.join(gem_root, CEXTC_CONF_FILE))
gem_root = "#{JRUBY_DIR}/test/truffle/cexts/#{gem_name}"
end
if gem_name == "ruby-argon2"
cextc gem_root, '-Werror=implicit-function-declaration'
else
#cextc_extconf gem_root, false, '-Werror=implicit-function-declaration'
cextc gem_root
end
gem_root = "#{JRUBY_DIR}/test/truffle/cexts/#{gem_name}"
cextc gem_root, false, '-Werror=implicit-function-declaration'

next if gem_name == 'psd_native' # psd_native is excluded just for running
run '--graal',
2 changes: 1 addition & 1 deletion truffle/README.md
Original file line number Diff line number Diff line change
@@ -238,7 +238,7 @@ You can then test C extension support.

```
$ export GEM_HOME=../jruby-truffle-gem-test-pack/gems
$ jt test cexts --no-libxml --no-openssl --no-argon2
$ jt test cexts --no-libxml --no-openssl
```

If you want to test `libxml`, remove that flag and set either `LIBXML_HOME` or
3 changes: 0 additions & 3 deletions truffle/src/main/c/cext/.jruby-cext-build.yml

This file was deleted.

4 changes: 0 additions & 4 deletions truffle/src/main/c/openssl/.jruby-cext-build.yml

This file was deleted.

Empty file.
163 changes: 2 additions & 161 deletions truffle/src/main/c/openssl/extconf.rb
Original file line number Diff line number Diff line change
@@ -1,161 +1,2 @@
# -*- coding: us-ascii -*-
# frozen_string_literal: false
=begin
= Info
'OpenSSL for Ruby 2' project
Copyright (C) 2002 Michal Rokos <m.rokos@sh.cvut.cz>
All rights reserved.
= Licence
This program is licensed under the same licence as Ruby.
(See the file 'LICENCE'.)
=end

require "mkmf"
require File.expand_path('../deprecation', __FILE__)

dir_config("openssl")
dir_config("kerberos")

Logging::message "=== OpenSSL for Ruby configurator ===\n"

##
# Adds -DOSSL_DEBUG for compilation and some more targets when GCC is used
# To turn it on, use: --with-debug or --enable-debug
#
if with_config("debug") or enable_config("debug")
$defs.push("-DOSSL_DEBUG") unless $defs.include? "-DOSSL_DEBUG"
end

Logging::message "=== Checking for system dependent stuff... ===\n"
have_library("nsl", "t_open")
have_library("socket", "socket")
have_header("assert.h")

Logging::message "=== Checking for required stuff... ===\n"
if $mingw
have_library("wsock32")
have_library("gdi32")
end

result = pkg_config("openssl") && have_header("openssl/ssl.h")

unless result
result = have_header("openssl/ssl.h")
result &&= %w[crypto libeay32].any? {|lib| have_library(lib, "OpenSSL_add_all_digests")}
result &&= %w[ssl ssleay32].any? {|lib| have_library(lib, "SSL_library_init")}
unless result
Logging::message "=== Checking for required stuff failed. ===\n"
Logging::message "Makefile wasn't created. Fix the errors above.\n"
exit 1
end
end

unless have_header("openssl/conf_api.h")
raise "OpenSSL 0.9.6 or later required."
end
unless OpenSSL.check_func("SSL_library_init()", "openssl/ssl.h")
raise "Ignore OpenSSL broken by Apple.\nPlease use another openssl. (e.g. using `configure --with-openssl-dir=/path/to/openssl')"
end

Logging::message "=== Checking for OpenSSL features... ===\n"
have_func("ERR_peek_last_error")
have_func("ASN1_put_eoc")
have_func("BN_mod_add")
have_func("BN_mod_sqr")
have_func("BN_mod_sub")
have_func("BN_pseudo_rand_range")
have_func("BN_rand_range")
have_func("CONF_get1_default_config_file")
have_func("EVP_CIPHER_CTX_copy")
have_func("EVP_CIPHER_CTX_set_padding")
have_func("EVP_CipherFinal_ex")
have_func("EVP_CipherInit_ex")
have_func("EVP_DigestFinal_ex")
have_func("EVP_DigestInit_ex")
have_func("EVP_MD_CTX_cleanup")
have_func("EVP_MD_CTX_create")
have_func("EVP_MD_CTX_destroy")
have_func("EVP_MD_CTX_init")
have_func("HMAC_CTX_cleanup")
have_func("HMAC_CTX_copy")
have_func("HMAC_CTX_init")
have_func("PEM_def_callback")
have_func("PKCS5_PBKDF2_HMAC")
have_func("PKCS5_PBKDF2_HMAC_SHA1")
have_func("RAND_egd")
have_func("X509V3_set_nconf")
have_func("X509V3_EXT_nconf_nid")
have_func("X509_CRL_add0_revoked")
have_func("X509_CRL_set_issuer_name")
have_func("X509_CRL_set_version")
have_func("X509_CRL_sort")
have_func("X509_NAME_hash_old")
have_func("X509_STORE_get_ex_data")
have_func("X509_STORE_set_ex_data")
have_func("OBJ_NAME_do_all_sorted")
have_func("SSL_SESSION_get_id")
have_func("SSL_SESSION_cmp")
have_func("OPENSSL_cleanse")
have_func("SSLv2_method")
have_func("SSLv2_server_method")
have_func("SSLv2_client_method")
have_func("SSLv3_method")
have_func("SSLv3_server_method")
have_func("SSLv3_client_method")
have_func("TLSv1_1_method")
have_func("TLSv1_1_server_method")
have_func("TLSv1_1_client_method")
have_func("TLSv1_2_method")
have_func("TLSv1_2_server_method")
have_func("TLSv1_2_client_method")
have_func("SSL_CTX_set_alpn_select_cb")
have_func("SSL_CTX_set_next_proto_select_cb")
unless have_func("SSL_set_tlsext_host_name", ['openssl/ssl.h'])
have_macro("SSL_set_tlsext_host_name", ['openssl/ssl.h']) && $defs.push("-DHAVE_SSL_SET_TLSEXT_HOST_NAME")
end
if have_header("openssl/engine.h")
have_func("ENGINE_add")
have_func("ENGINE_load_builtin_engines")
have_func("ENGINE_load_openbsd_dev_crypto")
have_func("ENGINE_get_digest")
have_func("ENGINE_get_cipher")
have_func("ENGINE_cleanup")
have_func("ENGINE_load_dynamic")
have_func("ENGINE_load_4758cca")
have_func("ENGINE_load_aep")
have_func("ENGINE_load_atalla")
have_func("ENGINE_load_chil")
have_func("ENGINE_load_cswift")
have_func("ENGINE_load_nuron")
have_func("ENGINE_load_sureware")
have_func("ENGINE_load_ubsec")
have_func("ENGINE_load_padlock")
have_func("ENGINE_load_capi")
have_func("ENGINE_load_gmp")
have_func("ENGINE_load_gost")
have_func("ENGINE_load_cryptodev")
have_func("ENGINE_load_aesni")
end
have_func("DH_generate_parameters_ex")
have_func("DSA_generate_parameters_ex")
have_func("RSA_generate_key_ex")
if checking_for('OpenSSL version is 0.9.7 or later') {
try_static_assert('OPENSSL_VERSION_NUMBER >= 0x00907000L', 'openssl/opensslv.h')
}
have_header("openssl/ocsp.h")
end
have_struct_member("CRYPTO_THREADID", "ptr", "openssl/crypto.h")
have_struct_member("EVP_CIPHER_CTX", "flags", "openssl/evp.h")
have_struct_member("EVP_CIPHER_CTX", "engine", "openssl/evp.h")
have_struct_member("X509_ATTRIBUTE", "single", "openssl/x509.h")
have_macro("OPENSSL_FIPS", ['openssl/opensslconf.h']) && $defs.push("-DHAVE_OPENSSL_FIPS")
have_macro("EVP_CTRL_GCM_GET_TAG", ['openssl/evp.h']) && $defs.push("-DHAVE_AUTHENTICATED_ENCRYPTION")

Logging::message "=== Checking done. ===\n"

create_header
create_makefile("openssl") {|conf|
conf << "THREAD_MODEL = #{CONFIG["THREAD_MODEL"]}\n"
}
Logging::message "Done.\n"
require 'mkmf'
create_makefile('openssl')
Loading