Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Truffle] Shared Objects: no need to synchronize on updateShape(), it…
… is forbidden on shared objects.
  • Loading branch information
eregon committed Nov 10, 2016
1 parent 497d654 commit 9cc1e7f
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -15,14 +15,17 @@
import com.oracle.truffle.api.object.ObjectType;
import com.oracle.truffle.api.object.Shape;
import org.jruby.truffle.Layouts;
import org.jruby.truffle.language.objects.shared.SharedObjects;

public abstract class ShapeCachingGuards {

public static boolean updateShape(DynamicObject object) {
CompilerDirectives.transferToInterpreter();
synchronized (object) {
return object.updateShape();
boolean updated = object.updateShape();
if (updated) {
assert !SharedObjects.isShared(object);
}
return updated;
}

public static boolean isArrayShape(Shape shape) {
Expand Down

0 comments on commit 9cc1e7f

Please sign in to comment.