Skip to content

Commit

Permalink
[Truffle] Fix possible correctness issue for constant lookup.
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed May 15, 2015
1 parent 87ef166 commit a26a3e9
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ protected RubyClass singletonClass(RubyBasicObject object) {
public RubyClass getNormalObjectSingletonClass(RubyBasicObject object) {
CompilerAsserts.neverPartOfCompilation();

if (object instanceof RubyClass) { // For the direct caller
return ((RubyClass) object).getSingletonClass();
}

if (object.getMetaClass().isSingleton()) {
return object.getMetaClass();
}
Expand Down

2 comments on commit a26a3e9

@bjfish
Copy link
Contributor

@bjfish bjfish commented on a26a3e9 May 16, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eregon I think there might be a new findbug error here: https://travis-ci.org/jruby/jruby/jobs/62762994

L D BC: Unchecked/unconfirmed cast from org.jruby.truffle.runtime.core.RubyBasicObject to org.jruby.truffle.runtime.core.RubyModule in org.jruby.truffle.nodes.objects.SingletonClassNode.getNormalObjectSingletonClass(RubyBasicObject)  At SingletonClassNode.java:[line 109]

@eregon
Copy link
Member Author

@eregon eregon commented on a26a3e9 May 16, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, however it seems a bug of FindBugs. I manually excluded this case in a new commit.

Please sign in to comment.