Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions core/src/main/scala/org/apache/spark/util/ClosureCleaner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ private[spark] class ReturnStatementInClosureException
extends SparkException("Return statements aren't allowed in Spark closures")

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

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

new MethodVisitor(ASM5) {
new MethodVisitor(ASM6) {
override def visitTypeInsn(op: Int, tp: String) {
if (op == NEW && tp.contains("scala/runtime/NonLocalReturnControl") && isTargetMethod) {
throw new ReturnStatementInClosureException
}
}
}
} else {
new MethodVisitor(ASM5) {}
new MethodVisitor(ASM6) {}
}
}
}
Expand All @@ -471,7 +471,7 @@ private[util] class FieldAccessFinder(
findTransitively: Boolean,
specificMethod: Option[MethodIdentifier[_]] = None,
visitedMethods: Set[MethodIdentifier[_]] = Set.empty)
extends ClassVisitor(ASM5) {
extends ClassVisitor(ASM6) {

override def visitMethod(
access: Int,
Expand All @@ -486,7 +486,7 @@ private[util] class FieldAccessFinder(
return null
}

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

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

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

override def visitMethod(access: Int, name: String, desc: String,
sig: String, exceptions: Array[String]): MethodVisitor = {
new MethodVisitor(ASM5) {
new MethodVisitor(ASM6) {
override def visitMethodInsn(
op: Int, owner: String, name: String, desc: String, itf: Boolean) {
val argTypes = Type.getArgumentTypes(desc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ private[graphx] object BytecodeUtils {
* determine the actual method invoked by inspecting the bytecode.
*/
private class MethodInvocationFinder(className: String, methodName: String)
extends ClassVisitor(ASM5) {
extends ClassVisitor(ASM6) {

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

override def visitMethod(access: Int, name: String, desc: String,
sig: String, exceptions: Array[String]): MethodVisitor = {
if (name == methodName) {
new MethodVisitor(ASM5) {
new MethodVisitor(ASM6) {
override def visitMethodInsn(
op: Int, owner: String, name: String, desc: String, itf: Boolean) {
if (op == INVOKEVIRTUAL || op == INVOKESPECIAL || op == INVOKESTATIC) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class ExecutorClassLoader(
}

class ConstructorCleaner(className: String, cv: ClassVisitor)
extends ClassVisitor(ASM5, cv) {
extends ClassVisitor(ASM6, cv) {
override def visitMethod(access: Int, name: String, desc: String,
sig: String, exceptions: Array[String]): MethodVisitor = {
val mv = cv.visitMethod(access, name, desc, sig, exceptions)
Expand Down