10000 partial parallelisation of genbcode, and code that it touches by mkeskells · Pull Request #5815 · scala/scala · GitHub
[go: up one dir, main page]

Skip to content

partial parallelisation of genbcode, and code that it touches #5815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
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
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/Global.scala
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
}
}

final def withCurrentUnitNoLog(unit: CompilationUnit)(task: => Unit) {
@inline final def withCurrentUnitNoLog[T](unit: CompilationUnit)(task: => T):T = {
val unit0 = currentUnit
try {
currentRun.currentUnit = unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import scala.tools.nsc.backend.jvm.BCodeHelpers.{InvokeStyle, TestOp}
*
*/
abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
import global._
import global.{reporter => _, _}
import definitions._
import bTypes._
import coreBTypes._
Expand Down Expand Up @@ -1363,11 +1363,11 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {

private def visitInvokeDynamicInsnLMF(jmethod: MethodNode, samName: String, invokedType: String, samMethodType: asm.Type,
implMethodHandle: asm.Handle, instantiatedMethodType: asm.Type,
serializable: Boolean, markerInterfaces: Seq[asm.Type]) = {
serializable: Boolean, markerInterfaces: List[asm.Type]) = {
import java.lang.invoke.LambdaMetafactory.{FLAG_MARKERS, FLAG_SERIALIZABLE}
def flagIf(b: Boolean, flag: Int): Int = if (b) flag else 0
val flags = FLAG_MARKERS | flagIf(serializable, FLAG_SERIALIZABLE)
val bsmArgs = Seq(samMethodType, implMethodHandle, instantiatedMethodType, Int.box(flags), Int.box(markerInterfaces.length)) ++ markerInterfaces
val bsmArgs = samMethodType :: implMethodHandle :: instantiatedMethodType :: Int.box(flags) :: Int.box(markerInterfaces.length) :: markerInterfaces
jmethod.visitInvokeDynamicInsn(samName, invokedType, lambdaMetaFactoryAltMetafactoryHandle, bsmArgs: _*)
}

Expand Down
35 changes: 4 additions & 31 deletions src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package tools.nsc
package backend.jvm

import scala.tools.asm
import scala.tools.nsc.io.AbstractFile
import scala.tools.nsc.io.{AbstractFile, JFile}
import GenBCode._
import BackendReporting._
import scala.reflect.internal.Flags
Expand All @@ -20,8 +20,8 @@ import scala.reflect.internal.Flags
* @version 1.0
*
*/
abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
import global._
abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters with HasReporter {
import global.{reporter => _, _}
import definitions._
import bTypes._
import coreBTypes._
Expand Down Expand Up @@ -228,37 +228,10 @@ abstract class BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
def completeSilentlyAndCheckErroneous(sym: Symbol): Boolean =
if (sym.hasCompleteInfo) false
else {
val originalReporter = global.reporter
val storeReporter = new reporters.StoreReporter()
global.reporter = storeReporter
try {
sym.info
} finally {
global.reporter = originalReporter
}
withoutReporting(sym.info)
sym.isErroneous
}


/*
* must-single-thread
*/
def getFileForClassfile(base: AbstractFile, clsName: String, suffix: String): AbstractFile = {
getFile(base, clsName, suffix)
}

/*
* must-single-thread
*/
def getOutFolder(csym: Symbol, cName: String, cunit: CompilationUnit): _root_.scala.tools.nsc.io.AbstractFile =
_root_.scala.util.Try {
outputDirectory(csym)
}.recover {
case ex: Throwable =>
reporter.error(cunit.body.pos, s"Couldn't create file for class $cName\n${ex.getMessage}")
null
}.get

var pickledBytes = 0 // statistics

// -----------------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/scala/tools/nsc/backend/jvm/BCodeIdiomatic.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import scala.tools.nsc.backend.jvm.BCodeHelpers.TestOp
* @version 1.0
*
*/
abstract class BCodeIdiomatic extends SubComponent {
abstract class BCodeIdiomatic extends SubComponent with HasReporter {
val bTypes = new BTypesFromSymbols[global.type](global)

import global._
import global.{reporter => _, _}
import bTypes._
import coreBTypes._

Expand Down
8 changes: 8 additions & 0 deletions src/compiler/scala/tools/nsc/backend/jvm/BCodeParallel.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package scala.tools.nsc.backend.jvm

/**
* Created by dev on 26/02/2017.
*/
trait BCodeParallel {

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import scala.tools.nsc.backend.jvm.BCodeHelpers.InvokeStyle
*
*/
abstract class BCodeSkelBuilder extends BCodeHelpers {
import global._
import global.{reporter => _, _}
import bTypes._
import coreBTypes._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import scala.tools.asm
*
*/
abstract class BCodeSyncAndTry extends BCodeBodyBuilder {
import global._
import global.{reporter => _, _}
import bTypes._
import coreBTypes._

Expand Down
Loading
0