Skip to content

Commit

Permalink
[Truffle] Make native openssl the default again
Browse files Browse the repository at this point in the history
- Make cext failures LoadError, so that handling a missing openssl still works
- Put openssl simply on the normal load path
  • Loading branch information
chrisseaton committed Oct 2, 2016
1 parent b84c467 commit bdab5fe
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 27 deletions.
20 changes: 0 additions & 20 deletions lib/ruby/truffle/truffle/openssl.rb

This file was deleted.

Expand Up @@ -126,29 +126,29 @@ private String findFeatureWithExactPath(String path) {
}
}

public void ensureCExtImplementationLoaded(VirtualFrame frame, IndirectCallNode callNode) {
public void ensureCExtImplementationLoaded(VirtualFrame frame, String feature, IndirectCallNode callNode) {
synchronized (cextImplementationLock) {
if (cextImplementationLoaded) {
return;
}

if (!context.getEnv().isMimeTypeSupported(RubyLanguage.CEXT_MIME_TYPE)) {
throw new RaiseException(context.getCoreExceptions().internalError("Sulong is required to support C extensions, and it doesn't appear to be available", null));
throw new RaiseException(context.getCoreExceptions().loadError("Sulong is required to support C extensions, and it doesn't appear to be available", feature, null));
}

final CallTarget callTarget = getCExtLibRuby();
final CallTarget callTarget = getCExtLibRuby(feature);
callNode.call(frame, callTarget, new Object[] {});

cextImplementationLoaded = true;
}
}

@TruffleBoundary
private CallTarget getCExtLibRuby() {
private CallTarget getCExtLibRuby(String feature) {
final String path = context.getJRubyInterop().getJRubyHome() + "/lib/ruby/truffle/cext/ruby.su";

if (!new File(path).exists()) {
throw new RaiseException(context.getCoreExceptions().internalError("This JRuby distribution does not have the C extension implementation file ruby.su", null));
throw new RaiseException(context.getCoreExceptions().loadError("This JRuby distribution does not have the C extension implementation file ruby.su", feature, null));
}

try {
Expand Down
Expand Up @@ -126,7 +126,7 @@ protected boolean require(VirtualFrame frame, String feature,

deferredCall.call(frame, callNode);
} else if (RubyLanguage.CEXT_MIME_TYPE.equals(mimeType)) {
featureLoader.ensureCExtImplementationLoaded(frame, callNode);
featureLoader.ensureCExtImplementationLoaded(frame, feature, callNode);

final CallTarget callTarget = featureLoader.parseSource(source);
callNode.call(frame, callTarget, new Object[] {});
Expand Down
2 changes: 1 addition & 1 deletion truffle/src/main/ruby/core/post.rb
Expand Up @@ -61,8 +61,8 @@ def self.const_exists?(mod, name, inherit = true)
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-securerandom/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-timeout/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-webrick/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/openssl'
$LOAD_PATH.push home + '/lib/ruby/truffle/truffle'
#$LOAD_PATH.push home + '/lib/ruby/truffle/openssl'

# We defined Psych at the top level because several things depend on its name.
# Here we fix that up and put it back into Truffle.
Expand Down

0 comments on commit bdab5fe

Please sign in to comment.