@@ -239,57 +239,8 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
239
239
}
240
240
241
241
242
- /*
243
- * must-single-thread
244
- */
245
- def getFileForClassfile (base : AbstractFile , clsName : String , suffix : String ): AbstractFile = {
246
- getFile(base, clsName, suffix)
247
- }
248
-
249
- /*
250
- * must-single-thread
251
- */
252
- def getOutFolder (csym : Symbol , cName : String , cunit : CompilationUnit ): _root_.scala.tools.nsc.io.AbstractFile =
253
- _root_.scala.util.Try {
254
- outputDirectory(csym)
255
- }.recover {
256
- case ex : Throwable =>
257
- reporter.error(cunit.body.pos, s " Couldn't create file for class $cName\n ${ex.getMessage}" )
258
- null
259
- }.get
260
-
261
242
var pickledBytes = 0 // statistics
262
243
263
- // -----------------------------------------------------------------------------------------
264
- // finding the least upper bound in agreement with the bytecode verifier (given two internal names handed by ASM)
265
- // Background:
266
- // http://gallium.inria.fr/~xleroy/publi/bytecode-verification-JAR.pdf
267
- // http://comments.gmane.org/gmane.comp.java.vm.languages/2293
268
- // https://github.com/scala/bug/issues/3872
269
- // -----------------------------------------------------------------------------------------
270
-
271
- /* An `asm.ClassWriter` that uses `jvmWiseLUB()`
272
- * The internal name of the least common ancestor of the types given by inameA and inameB.
273
- * It's what ASM needs to know in order to compute stack map frames, http://asm.ow2.org/doc/developer-guide.html#controlflow
274
- */
275
- final class CClassWriter (flags : Int ) extends asm.ClassWriter (flags) {
276
-
277
- /**
278
- * This method is used by asm when computing stack map frames. It is thread-safe: it depends
279
- * only on the BTypes component, which does not depend on global.
280
- * TODO @lry move to a different place where no global is in scope, on bTypes.
281
- */
282
- override def getCommonSuperClass (inameA : String , inameB : String ): String = {
283
- // All types that appear in a class node need to have their ClassBType cached, see [[cachedClassBType]].
284
- val a = cachedClassBType(inameA).get
285
- val b = cachedClassBType(inameB).get
286
- val lub = a.jvmWiseLUB(b).get
287
- val lubName = lub.internalName
288
- assert(lubName != " scala/Any" )
289
- lubName // ASM caches the answer during the lifetime of a ClassWriter. We outlive that. Not sure whether caching on our side would improve things.
290
- }
291
- }
292
-
293
244
/*
294
245
* must-single-thread
295
246
*/
@@ -406,29 +357,6 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
406
357
case AnnotationInfo (_, _, (_, LiteralAnnotArg (const)) :: Nil ) => const.longValue
407
358
}
408
359
409
- /*
410
- * Populates the InnerClasses JVM attribute with `refedInnerClasses`. See also the doc on inner
411
- * classes in BTypes.scala.
412
- *
413
- * `refedInnerClasses` may contain duplicates, need not contain the enclosing inner classes of
414
- * each inner class it lists (those are looked up and included).
415
- *
416
- * This method serializes in the InnerClasses JVM attribute in an appropriate order, not
417
- * necessarily that given by `refedInnerClasses`.
418
- *
419
- * can-multi-thread
420
- */
421
- final def addInnerClasses (jclass : asm.ClassVisitor , refedInnerClasses : List [ClassBType ]) {
422
- val allNestedClasses = refedInnerClasses.flatMap(_.enclosingNestedClassesChain.get).distinct
423
-
424
- // sorting ensures nested classes are listed after their enclosing class thus satisfying the Eclipse Java compiler
425
- for (nestedClass <- allNestedClasses.sortBy(_.internalName.toString)) {
426
- // Extract the innerClassEntry - we know it exists, enclosingNestedClassesChain only returns nested classes.
427
- val Some (e) = nestedClass.innerClassAttributeEntry.get
428
- jclass.visitInnerClass(e.name, e.outerName, e.innerName, e.flags)
429
- }
430
- }
431
-
432
360
/*
433
361
* Custom attribute (JVMS 4.7.1) "ScalaSig" used as marker only
434
362
* i.e., the pickle is contained in a custom annotation, see:
@@ -1058,7 +986,7 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
1058
986
val bType = mirrorClassClassBType(moduleClass)
1059
987
val mirrorClass = new asm.tree.ClassNode
1060
988
mirrorClass.visit(
1061
- classfileVersion,
989
+ backendUtils. classfileVersion,
1062
990
bType.info.get.flags,
1063
991
bType.internalName,
1064
992
null /* no java-generic-signature */ ,
@@ -1102,7 +1030,7 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
1102
1030
1103
1031
val beanInfoClass = new asm.tree.ClassNode
1104
1032
beanInfoClass.visit(
1105
- classfileVersion,
1033
+ backendUtils. classfileVersion,
1106
1034
beanInfoType.info.get.flags,
1107
1035
beanInfoType.internalName,
1108
1036
null , // no java-generic-signature
0 commit comments