Skip to content

Commit 4c1f540

Browse files
committed
Upgrade to scala-asm 6.2
See: scala/scala-asm#5 Upstream changes in ASM: scala/scala-asm@ASM_6_0...ASM_6_2 http://asm.ow2.io/versions.html The motivations, other than just keeping current, are: - support for Java 9/10/11 updates to the classfile format. - reducing needless String => Array[Char] conversions thanks to internal changes in ASM. This PR will fail to build until we publish artifact from scala/scala-asm.
1 parent d94d9bc commit 4c1f540

File tree

6 files changed

+18
-25
lines changed

6 files changed

+18
-25
lines changed

src/compiler/scala/tools/asm/LabelAccess.java

-18
This file was deleted.

src/compiler/scala/tools/nsc/backend/jvm/BTypes.scala

+2
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ abstract class BTypes {
761761
// finds the first common one.
762762
// MOST LIKELY the answer can be found here, see the comments and links by Miguel:
763763
// - https://github.com/scala/bug/issues/3872
764+
// @jz Wouldn't it be better to walk the superclass chain of both types in reverse (starting from Object), and
765+
// finding the last common link? That would be O(N), whereas this looks O(N^2)
764766
firstCommonSuffix(this :: this.superClassesTransitive.orThrow, other :: other.superClassesTransitive.orThrow)
765767
}
766768

src/compiler/scala/tools/nsc/backend/jvm/analysis/BackendUtils.scala

+13-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import scala.tools.asm
1313
import scala.tools.asm.Opcodes._
1414
import scala.tools.asm.tree._
1515
import scala.tools.asm.tree.analysis._
16-
import scala.tools.asm.{Handle, Label, LabelAccess, Type}
16+
import scala.tools.asm.{Handle, Label, Type}
1717
import scala.tools.nsc.backend.jvm.BTypes._
1818
import scala.tools.nsc.backend.jvm.GenBCode._
1919
import scala.tools.nsc.backend.jvm.analysis.BackendUtils._
@@ -591,9 +591,18 @@ object BackendUtils {
591591
def clearDceDone(method: MethodNode) = method.access &= ~ACC_DCE_DONE
592592

593593
private val LABEL_REACHABLE_STATUS = 0x1000000
594-
def isLabelReachable(label: LabelNode) = LabelAccess.isLabelFlagSet(label.getLabel, LABEL_REACHABLE_STATUS)
595-
def setLabelReachable(label: LabelNode) = LabelAccess.setLabelFlag(label.getLabel, LABEL_REACHABLE_STATUS)
596-
def clearLabelReachable(label: LabelNode) = LabelAccess.clearLabelFlag(label.getLabel, LABEL_REACHABLE_STATUS)
594+
private def isLabelFlagSet(l: Label, f: Int): Boolean = (l.flags & f) != 0
595+
596+
private def setLabelFlag(l: Label, f: Int): Unit = {
597+
l.flags |= f
598+
}
599+
600+
private def clearLabelFlag(l: Label, f: Int): Unit = {
601+
l.flags &= ~f
602+
}
603+
def isLabelReachable(label: LabelNode) = isLabelFlagSet(label.getLabel, LABEL_REACHABLE_STATUS)
604+
def setLabelReachable(label: LabelNode) = setLabelFlag(label.getLabel, LABEL_REACHABLE_STATUS)
605+
def clearLabelReachable(label: LabelNode) = clearLabelFlag(label.getLabel, LABEL_REACHABLE_STATUS)
597606

598607
abstract class NestedClassesCollector[T] extends GenericSignatureVisitor {
599608
val innerClasses = mutable.Set.empty[T]

src/compiler/scala/tools/nsc/backend/jvm/analysis/ProdConsAnalyzerImpl.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ case class ParameterProducer(local: Int)
457457
case class UninitializedLocalProducer(local: Int) extends InitialProducer
458458
case class ExceptionProducer[V <: Value](handlerLabel: LabelNode, handlerFrame: Frame[V]) extends InitialProducer
459459

460-
class InitialProducerSourceInterpreter extends SourceInterpreter {
460+
class InitialProducerSourceInterpreter extends SourceInterpreter(scala.tools.asm.Opcodes.ASM7_EXPERIMENTAL) {
461461
override def newParameterValue(isInstanceMethod: Boolean, local: Int, tp: Type): SourceValue = {
462462
new SourceValue(tp.getSize, ParameterProducer(local))
463463
}

src/compiler/scala/tools/nsc/backend/jvm/analysis/TypeFlowInterpreter.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package analysis
55
import scala.tools.asm.Type
66
import scala.tools.asm.tree.analysis.{BasicValue, BasicInterpreter}
77

8-
abstract class TypeFlowInterpreter extends BasicInterpreter {
8+
abstract class TypeFlowInterpreter extends BasicInterpreter(scala.tools.asm.Opcodes.ASM7_EXPERIMENTAL) {
99
override def newValue(tp: Type) = {
1010
if (tp == null) super.newValue(tp)
1111
else if (isRef(tp)) new BasicValue(tp)

versions.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ starr.version=2.13.0-M4
77
# Other usages:
88
# - scala-asm: jar content included in scala-compiler
99
# - jline: shaded with JarJar and included in scala-compiler
10-
scala-asm.version=6.0.0-scala-1
10+
scala-asm.version=6.2.0-scala-2
1111
jline.version=2.14.6

0 commit comments

Comments
 (0)