Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Truffle] Add check if property is undefined for uncached specialization #4434

Closed
wants to merge 1 commit into from

Conversation

bjfish
Copy link
Contributor

@bjfish bjfish commented Jan 11, 2017

I wanted to get code review on this since I am not too familiar with this.

I was getting instance variable not defined errors on this line when running Addressable specs: https://github.com/sporkmonger/addressable/blob/4983bf53765c83b5f06b8b9707e6c4cbc2225acb/lib/addressable/uri.rb#L2488

This change resolved these errors to reduce Addressable spec failures from 62 => 9.

If I understand this correctly, it appears to me that the cached node was checking to see if a property was defined but the uncached version was not.

@bjfish bjfish added the truffle label Jan 11, 2017
@bjfish bjfish requested a review from eregon January 11, 2017 05:54
@@ -58,6 +58,9 @@ public Object updateShapeAndRead(DynamicObject object) {
@TruffleBoundary
@Specialization(contains = { "readObjectFieldCached", "updateShapeAndRead" })
protected Object readObjectFieldUncached(DynamicObject receiver) {
if(getProperty(receiver.getShape(), name) == null){
return defaultValue;
}
return receiver.get(name, defaultValue);
Copy link
Member

Choose a reason for hiding this comment

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

This line intended to be the same since http://lafo.ssw.uni-linz.ac.at/javadoc/truffle/latest/com/oracle/truffle/api/object/DynamicObject.html#get-java.lang.Object-java.lang.Object- should return defaultValue if the property does not exist.
However, this is a problem as we have a "removed property flag" and so we need to use PropertyFlags.isDefined(property). I'll fix, thanks for the report and analysis!

eregon added a commit that referenced this pull request Jan 11, 2017
…ned.

* Removing an ivar on a shared object only marks the property as "removed"
  but does not actually remove it to allow unsynchronized reads.
* Closes #4434.
@eregon eregon closed this Jan 11, 2017
@eregon eregon deleted the truffle-read-object-field-undefined branch January 11, 2017 14:28
@enebo enebo added this to the truffle-dev milestone Mar 6, 2017
@enebo enebo added this to the Non-Release milestone Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants