Skip to content

Commit

Permalink
Showing 2 changed files with 16 additions and 14 deletions.
File renamed without changes.
30 changes: 16 additions & 14 deletions truffle/src/main/java/org/jruby/truffle/core/CoreLibrary.java
Original file line number Diff line number Diff line change
@@ -912,23 +912,25 @@ public void initializeAfterBasicMethodsAdded() {
}

public void initializePostBoot() {
// Load code that can't be run until everything else is boostrapped, such as pre-loaded Ruby stdlib.
if (context.getOptions().PLATFORM_SAFE_LOAD) {
// 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("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);
}

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);
}
}

0 comments on commit bb00950

Please sign in to comment.