Skip to content

Commit

Permalink
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
*/
package org.jruby.truffle.nodes.objectstorage;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.Specialization;
@@ -46,12 +47,22 @@ protected Object readObjectFieldCached(DynamicObject receiver,
}
}

@Specialization(guards = "updateShape(object)")
public Object updateShapeAndRead(DynamicObject object) {
return execute(object);
}

@TruffleBoundary
@Specialization
@Specialization(contains = { "readObjectFieldCached", "updateShapeAndRead" })
protected Object readObjectFieldUncached(DynamicObject receiver) {
return receiver.get(name, defaultValue);
}

protected boolean updateShape(DynamicObject object) {
CompilerDirectives.transferToInterpreter();
return object.updateShape();
}

protected int getCacheLimit() {
return Options.FIELD_LOOKUP_CACHE;
}

0 comments on commit cd849bb

Please sign in to comment.