-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests that the methods' bytecodes are similar as variable load/stores are reordered, it ignores which variables are modified when checking for bytecode equality the assert is: `similarBytecode(methNodeA, methNodeB, equalsModuloVar)`
- Loading branch information
Showing
4 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bytecode identical |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-optimize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// this class's bytecode, compiled under -optimize is analyzed by the test | ||
// method a's bytecode should be identical to method b's bytecode | ||
class SameBytecode { | ||
def a(xs: List[Int]) = xs match { | ||
case x :: _ => x | ||
} | ||
|
||
def b(xs: List[Int]) = xs match { | ||
case xs: ::[Int] => xs.hd$1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import scala.tools.partest.BytecodeTest | ||
|
||
import scala.tools.nsc.util.JavaClassPath | ||
import java.io.InputStream | ||
import scala.tools.asm | ||
import asm.ClassReader | ||
import asm.tree.{ClassNode, InsnList} | ||
import scala.collection.JavaConverters._ | ||
|
||
object Test extends BytecodeTest { | ||
def show: Unit = { | ||
val classNode = loadClassNode("SameBytecode") | ||
similarBytecode(getMethod(classNode, "a"), getMethod(classNode, "b"), equalsModuloVar) | ||
} | ||
} |
b2117cf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Job pr-checkin-per-commit failed for b2117cf (results):
Took 4 min.
to rebuild, comment "PLS REBUILD/pr-checkin-per-commit@b2117cf6f4080eff9028b2aa33a013329022efd6"on PR #2112
b2117cf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Job pr-rangepos-per-commit failed for b2117cf (results):
Took 4 min.
to rebuild, comment "PLS REBUILD/pr-rangepos-per-commit@b2117cf6f4080eff9028b2aa33a013329022efd6"on PR #2112