Skip to content

Commit 56a6823

Browse files
committed
Optimize exceptions
PullRequest: truffleruby/530
2 parents c5e449b + b0915b2 commit 56a6823

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

src/main/java/org/truffleruby/core/fiber/FiberLayout.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ DynamicObject createFiber(DynamicObjectFactory factory,
3434
DynamicObject rubyThread,
3535
@Volatile @Nullable DynamicObject lastResumedByFiber,
3636
@Volatile boolean alive,
37-
@Volatile @Nullable Thread thread,
37+
@Nullable Thread thread,
3838
@Volatile boolean transferred);
3939

4040
boolean isFiber(DynamicObject object);

src/main/java/org/truffleruby/core/thread/ThreadNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ public DynamicObject wakeup(DynamicObject rubyThread,
430430
@Cached("new()") YieldNode yieldNode) {
431431
final DynamicObject currentFiber = Layouts.THREAD.getFiberManager(rubyThread).getCurrentFiberRacy();
432432
final Thread thread = Layouts.FIBER.getThread(currentFiber);
433-
if (thread == null) {
433+
if (!Layouts.FIBER.getAlive(currentFiber) || thread == null) {
434434
throw new RaiseException(getContext(), coreExceptions().threadErrorKilledThread(this));
435435
}
436436

src/main/java/org/truffleruby/language/RubyBaseRootNode.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ public final SourceSection getSourceSection() {
2828
return sourceSection;
2929
}
3030

31+
// NOTE (eregon, 11 Jan 2019): TruffleStackTrace calls this on the fast path, so it should constant-fold.
32+
@Override
33+
public boolean isInternal() {
34+
if (sourceSection != null) {
35+
return sourceSection.getSource().isInternal();
36+
}
37+
return false;
38+
}
39+
3140
@Override
3241
public boolean isCaptureFramesForTrace() {
3342
return true;

tool/jt.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ def find_graal_javacmd_and_options
160160
elsif graal_home = find_auto_graal_home
161161
javacmd = "#{find_graal_java_home(graal_home)}/bin/java"
162162
graal_jars = [
163-
"#{graal_home}/mxbuild/dists/graal.jar",
164-
"#{graal_home}/mxbuild/dists/graal-management.jar"
163+
"#{graal_home}/mxbuild/dists/jdk1.8/graal.jar",
164+
"#{graal_home}/mxbuild/dists/jdk1.8/graal-management.jar"
165165
]
166166
vm_args = [
167167
'-XX:+UnlockExperimentalVMOptions',
@@ -179,7 +179,7 @@ def find_graal_javacmd_and_options
179179
def find_auto_graal_home
180180
sibling_compiler = File.expand_path('../graal/compiler', TRUFFLERUBY_DIR)
181181
return nil unless Dir.exist?(sibling_compiler)
182-
return nil unless File.exist?("#{sibling_compiler}/mxbuild/dists/graal-compiler.jar")
182+
return nil unless File.exist?("#{sibling_compiler}/mxbuild/dists/jdk1.8/graal-compiler.jar")
183183
sibling_compiler
184184
end
185185

@@ -723,7 +723,7 @@ def run_ruby(*args)
723723
vm_args << "-J-Dgraal.TraceTruffleCompilation=true"
724724
when '--igv', '--igv-full'
725725
graal = true
726-
vm_args << (arg == '--igv-full') ? "-J-Dgraal.Dump=:2" : "-J-Dgraal.Dump=TruffleTree,PartialEscape:2"
726+
vm_args << (arg == '--igv-full' ? "-J-Dgraal.Dump=:2" : "-J-Dgraal.Dump=TruffleTree,PartialEscape:2")
727727
vm_args << "-J-Dgraal.PrintGraphFile=true" unless igv_running?
728728
vm_args << "-J-Dgraal.PrintBackendCFG=false"
729729
when '--no-print-cmd'

0 commit comments

Comments
 (0)