Skip to content

Commit a992827

Browse files
gatorsmiledbtsai
authored andcommitted
[SPARK-24420][BUILD][FOLLOW-UP] Upgrade ASM6 APIs
## What changes were proposed in this pull request? Use ASM 6 APIs after we upgrading it to ASM6. ## How was this patch tested? N/A Closes apache#22082 from gatorsmile/asm6. Authored-by: Xiao Li <[email protected]> Signed-off-by: DB Tsai <[email protected]>
1 parent 5d6abad commit a992827

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

core/src/main/scala/org/apache/spark/util/ClosureCleaner.scala

+7-7
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ private[spark] class ReturnStatementInClosureException
425425
extends SparkException("Return statements aren't allowed in Spark closures")
426426

427427
private class ReturnStatementFinder(targetMethodName: Option[String] = None)
428-
extends ClassVisitor(ASM5) {
428+
extends ClassVisitor(ASM6) {
429429
override def visitMethod(access: Int, name: String, desc: String,
430430
sig: String, exceptions: Array[String]): MethodVisitor = {
431431

@@ -439,15 +439,15 @@ private class ReturnStatementFinder(targetMethodName: Option[String] = None)
439439
val isTargetMethod = targetMethodName.isEmpty ||
440440
name == targetMethodName.get || name == targetMethodName.get.stripSuffix("$adapted")
441441

442-
new MethodVisitor(ASM5) {
442+
new MethodVisitor(ASM6) {
443443
override def visitTypeInsn(op: Int, tp: String) {
444444
if (op == NEW && tp.contains("scala/runtime/NonLocalReturnControl") && isTargetMethod) {
445445
throw new ReturnStatementInClosureException
446446
}
447447
}
448448
}
449449
} else {
450-
new MethodVisitor(ASM5) {}
450+
new MethodVisitor(ASM6) {}
451451
}
452452
}
453453
}
@@ -471,7 +471,7 @@ private[util] class FieldAccessFinder(
471471
findTransitively: Boolean,
472472
specificMethod: Option[MethodIdentifier[_]] = None,
473473
visitedMethods: Set[MethodIdentifier[_]] = Set.empty)
474-
extends ClassVisitor(ASM5) {
474+
extends ClassVisitor(ASM6) {
475475

476476
override def visitMethod(
477477
access: Int,
@@ -486,7 +486,7 @@ private[util] class FieldAccessFinder(
486486
return null
487487
}
488488

489-
new MethodVisitor(ASM5) {
489+
new MethodVisitor(ASM6) {
490490
override def visitFieldInsn(op: Int, owner: String, name: String, desc: String) {
491491
if (op == GETFIELD) {
492492
for (cl <- fields.keys if cl.getName == owner.replace('/', '.')) {
@@ -526,7 +526,7 @@ private[util] class FieldAccessFinder(
526526
}
527527
}
528528

529-
private class InnerClosureFinder(output: Set[Class[_]]) extends ClassVisitor(ASM5) {
529+
private class InnerClosureFinder(output: Set[Class[_]]) extends ClassVisitor(ASM6) {
530530
var myName: String = null
531531

532532
// TODO: Recursively find inner closures that we indirectly reference, e.g.
@@ -541,7 +541,7 @@ private class InnerClosureFinder(output: Set[Class[_]]) extends ClassVisitor(ASM
541541

542542
override def visitMethod(access: Int, name: String, desc: String,
543543
sig: String, exceptions: Array[String]): MethodVisitor = {
544-
new MethodVisitor(ASM5) {
544+
new MethodVisitor(ASM6) {
545545
override def visitMethodInsn(
546546
op: Int, owner: String, name: String, desc: String, itf: Boolean) {
547547
val argTypes = Type.getArgumentTypes(desc)

graphx/src/main/scala/org/apache/spark/graphx/util/BytecodeUtils.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ private[graphx] object BytecodeUtils {
109109
* determine the actual method invoked by inspecting the bytecode.
110110
*/
111111
private class MethodInvocationFinder(className: String, methodName: String)
112-
extends ClassVisitor(ASM5) {
112+
extends ClassVisitor(ASM6) {
113113

114114
val methodsInvoked = new HashSet[(Class[_], String)]
115115

116116
override def visitMethod(access: Int, name: String, desc: String,
117117
sig: String, exceptions: Array[String]): MethodVisitor = {
118118
if (name == methodName) {
119-
new MethodVisitor(ASM5) {
119+
new MethodVisitor(ASM6) {
120120
override def visitMethodInsn(
121121
op: Int, owner: String, name: String, desc: String, itf: Boolean) {
122122
if (op == INVOKEVIRTUAL || op == INVOKESPECIAL || op == INVOKESTATIC) {

repl/src/main/scala/org/apache/spark/repl/ExecutorClassLoader.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class ExecutorClassLoader(
187187
}
188188

189189
class ConstructorCleaner(className: String, cv: ClassVisitor)
190-
extends ClassVisitor(ASM5, cv) {
190+
extends ClassVisitor(ASM6, cv) {
191191
override def visitMethod(access: Int, name: String, desc: String,
192192
sig: String, exceptions: Array[String]): MethodVisitor = {
193193
val mv = cv.visitMethod(access, name, desc, sig, exceptions)

0 commit comments

Comments
 (0)