Skip to content

Commit 181109f

Browse files
committed
Update Lua inliner storage assertion
1 parent 8fe5040 commit 181109f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/LuaBackendAuditTests.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,8 +2048,12 @@ public void tinyMonomorphicMethodsInlineOnLua() {
20482048
String body = topLevelFunctionBodyWithPrefix(compiled, "hotLoop");
20492049
assertFalse("a tiny method with exactly one implementation must inline in optimized Lua:\n" + body,
20502050
body.contains("Accumulator_add("));
2051-
assertTrue("the inlined method must retain its field read:\n" + body,
2052-
body.contains("Accumulator_offset_storage["));
2051+
java.util.regex.Matcher offsetAlias = java.util.regex.Pattern
2052+
.compile("local (\\w+) = Accumulator_offset_storage").matcher(body);
2053+
assertTrue("the inlined method's field storage must be localized:\n" + body,
2054+
offsetAlias.find());
2055+
assertTrue("the inlined method must retain its field read through the local alias:\n" + body,
2056+
body.contains(offsetAlias.group(1) + "["));
20532057
String dynamicBody = topLevelFunctionBodyWithPrefix(compiled, "dynamicCall");
20542058
assertTrue("a genuinely virtual method call must retain dispatch:\n" + dynamicBody,
20552059
dynamicBody.contains("dispatch_"));

0 commit comments

Comments
 (0)