File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed
src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,15 @@ public final ObjectLayout getLayout() {
137
137
return layout ;
138
138
}
139
139
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
+
140
149
public final void changeClassTo (final ClassObject newClass ) {
141
150
setSqueakClass (newClass );
142
151
migrateToLayout (newClass .getLayout ());
Original file line number Diff line number Diff line change 11
11
import com .oracle .truffle .api .Assumption ;
12
12
import com .oracle .truffle .api .CompilerAsserts ;
13
13
import com .oracle .truffle .api .CompilerDirectives .CompilationFinal ;
14
- import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
15
14
import com .oracle .truffle .api .Truffle ;
16
15
import com .oracle .truffle .api .dsl .Idempotent ;
17
16
@@ -207,7 +206,6 @@ public void invalidate() {
207
206
isValidAssumption .invalidate ("Layout no longer valid" );
208
207
}
209
208
210
- @ TruffleBoundary
211
209
public boolean isValid () {
212
210
return isValidAssumption .isValid ();
213
211
}
Original file line number Diff line number Diff line change @@ -189,7 +189,7 @@ private AbstractPointersObjectGuard(final AbstractPointersObject receiver) {
189
189
190
190
@ Override
191
191
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 ) ;
193
193
}
194
194
195
195
@ Override
You can’t perform that action at this time.
0 commit comments