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

Commits on May 17, 2016

  1. [Truffle] Disabled the 'safe' integration test.

    This test doesn't work when auto-requiring rubygems is introduced. We need to investigate it.
    nirvdrum committed May 17, 2016
    Copy the full SHA
    805efce View commit details
  2. Revert "Revert "[Truffle] Added a post-boot phase for loading Ruby co…

    …de after everything else has bootstrapped.""
    
    This reverts commit c2aed02.
    nirvdrum committed May 17, 2016
    1
    Copy the full SHA
    ea9a7af View commit details
File renamed without changes.
2 changes: 2 additions & 0 deletions truffle/src/main/java/org/jruby/truffle/RubyContext.java
Original file line number Diff line number Diff line change
@@ -172,6 +172,8 @@ public RubyContext(Ruby jrubyRuntime, TruffleLanguage.Env env) {
attachmentsManager = new AttachmentsManager(this, instrumenter);
traceManager = new TraceManager(this, instrumenter);
coverageManager = new CoverageManager(this, instrumenter);

coreLibrary.initializePostBoot();
}

public Object send(Object object, String methodName, DynamicObject block, Object... arguments) {
21 changes: 21 additions & 0 deletions truffle/src/main/java/org/jruby/truffle/core/CoreLibrary.java
Original file line number Diff line number Diff line change
@@ -911,6 +911,27 @@ public void initializeAfterBasicMethodsAdded() {
assert Layouts.CLASS.isClass(eagainWaitWritable);
}

public void initializePostBoot() {
// Load code that can't be run until everything else is boostrapped, such as pre-loaded Ruby stdlib.

try {
Main.printTruffleTimeMetric("before-post-boot");
try {
final RubyRootNode rootNode = context.getCodeLoader().parse(context.getSourceCache().getSource(getCoreLoadPath() + "/core/post-boot.rb"), UTF8Encoding.INSTANCE, ParserContext.TOP_LEVEL, null, true, node);
final CodeLoader.DeferredCall deferredCall = context.getCodeLoader().prepareExecute(ParserContext.TOP_LEVEL, DeclarationContext.TOP_LEVEL, rootNode, null, context.getCoreLibrary().getMainObject());
deferredCall.callWithoutCallNode();
} catch (IOException e) {
throw new RuntimeException(e);
}

Main.printTruffleTimeMetric("after-post-boot");
} catch (RaiseException e) {
final DynamicObject rubyException = e.getException();
BacktraceFormatter.createDefaultFormatter(getContext()).printBacktrace(context, rubyException, Layouts.EXCEPTION.getBacktrace(rubyException));
throw new TruffleFatalException("couldn't load the post-boot code", e);
}
}

private void initializeRubiniusFFI() {
Layouts.MODULE.getFields(rubiniusFFIModule).setConstant(context, node, "TYPE_CHAR", RubiniusTypes.TYPE_CHAR);
Layouts.MODULE.getFields(rubiniusFFIModule).setConstant(context, node, "TYPE_UCHAR", RubiniusTypes.TYPE_UCHAR);
10 changes: 10 additions & 0 deletions truffle/src/main/ruby/core/post-boot.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 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

require 'rubygems'
Truffle::Boot.require_core 'core/post-boot/shims'
14 changes: 14 additions & 0 deletions truffle/src/main/ruby/core/post-boot/shims.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 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

module Gem
# Update the default_dir to match JRuby's.
def self.default_dir
File.expand_path(File.join(ConfigMap[:libdir], '..', '..', 'ruby', 'gems', 'shared'))
end
end