@@ -1587,4 +1587,41 @@ class InlinerTest extends BytecodeTesting {
1587
1587
val List (c, t) = compile(code)
1588
1588
assertNoIndy(getMethod(c, " t1" ))
1589
1589
}
1590
+
1591
+ @ Test
1592
+ def limitInlinedLocalVariableNames (): Unit = {
1593
+ val code =
1594
+ """ class C {
1595
+ | def f(x: Int): Int = x
1596
+ | @inline final def methodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(param: Int) =
1597
+ | f(param)
1598
+ | @inline final def anotherMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(param: Int) =
1599
+ | methodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(f(param))
1600
+ | @inline final def oneMoreMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(param: Int) =
1601
+ | anotherMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(f(param))
1602
+ | @inline final def yetAnotherMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(param: Int) =
1603
+ | oneMoreMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(f(param))
1604
+ | @inline final def oneLastMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(param: Int) =
1605
+ | yetAnotherMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(f(param))
1606
+ | def t(p: Int) =
1607
+ | oneLastMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(f(p)) +
1608
+ | oneLastMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence(f(p))
1609
+ |}
1610
+ """ .stripMargin
1611
+
1612
+ val List (c) = compile(code)
1613
+ assertEquals(getAsmMethod(c, " t" ).localVariables.asScala.toList.map(l => (l.name, l.index)).sortBy(_._2),List (
1614
+ (" this" ,0 ),
1615
+ (" p" ,1 ),
1616
+ (" oneLastMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence_param" ,2 ),
1617
+ (" oneLastMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchS_yetAnotherMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFren_param" ,3 ),
1618
+ (" oneLastMethodWithVeryVeryLongNameAlmostLik_yetAnotherMethodWithVeryVeryLongNameAlmost_oneMoreMethodWithVeryVeryLongNameAlmostLik_param" ,4 ),
1619
+ (" oneLastMethodWithVeryVeryLongNam_yetAnotherMethodWithVeryVeryLong_oneMoreMethodWithVeryVeryLongNam_anotherMethodWithVeryVeryLongNam_param" ,5 ),
1620
+ (" oneLastMethodWithVeryVery_yetAnotherMethodWithVeryV_oneMoreMethodWithVeryVery_anotherMethodWithVeryVery_methodWithVeryVeryLongNam_param" ,6 ),
1621
+ (" oneLastMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchSentence_param" ,7 ),
1622
+ (" oneLastMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFrenchS_yetAnotherMethodWithVeryVeryLongNameAlmostLikeAGermanWordOrAFren_param" ,8 ),
1623
+ (" oneLastMethodWithVeryVeryLongNameAlmostLik_yetAnotherMethodWithVeryVeryLongNameAlmost_oneMoreMethodWithVeryVeryLongNameAlmostLik_param" ,9 ),
1624
+ (" oneLastMethodWithVeryVeryLongNam_yetAnotherMethodWithVeryVeryLong_oneMoreMethodWithVeryVeryLongNam_anotherMethodWithVeryVeryLongNam_param" ,10 ),
1625
+ (" oneLastMethodWithVeryVery_yetAnotherMethodWithVeryV_oneMoreMethodWithVeryVery_anotherMethodWithVeryVery_methodWithVeryVeryLongNam_param" ,11 )))
1626
+ }
1590
1627
}
0 commit comments