Skip to content

Commit 57fb986

Browse files
committed
Only ever match valid layouts in PIC guard
This avoids blowing inline cache limits unnecessarily.
1 parent e179ddc commit 57fb986

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/AbstractPointersObject.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,15 @@ public final ObjectLayout getLayout() {
137137
return layout;
138138
}
139139

140+
public final boolean matchesLayout(final ObjectLayout expectedLayout) {
141+
if (!getLayout().isValid()) {
142+
CompilerDirectives.transferToInterpreterAndInvalidate();
143+
updateLayout();
144+
}
145+
assert layout.isValid() : "Should only ever match valid layout (invalid expectedLayout will be replaced in PIC)";
146+
return layout == expectedLayout;
147+
}
148+
140149
public final void changeClassTo(final ClassObject newClass) {
141150
setSqueakClass(newClass);
142151
migrateToLayout(newClass.getLayout());

src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/model/layout/ObjectLayout.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import com.oracle.truffle.api.Assumption;
1212
import com.oracle.truffle.api.CompilerAsserts;
1313
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
14-
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
1514
import com.oracle.truffle.api.Truffle;
1615
import com.oracle.truffle.api.dsl.Idempotent;
1716

@@ -207,7 +206,6 @@ public void invalidate() {
207206
isValidAssumption.invalidate("Layout no longer valid");
208207
}
209208

210-
@TruffleBoundary
211209
public boolean isValid() {
212210
return isValidAssumption.isValid();
213211
}

src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/dispatch/LookupClassGuard.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ private AbstractPointersObjectGuard(final AbstractPointersObject receiver) {
189189

190190
@Override
191191
public boolean check(final Object receiver) {
192-
return receiver instanceof final AbstractPointersObject o && o.getLayout() == expectedLayout;
192+
return receiver instanceof final AbstractPointersObject o && o.matchesLayout(expectedLayout);
193193
}
194194

195195
@Override

0 commit comments

Comments
 (0)