Skip to content

Pickling modularization reorg #520

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

Merged
merged 1 commit into from
May 3, 2015
Merged
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
3 changes: 1 addition & 2 deletions src/dotty/tools/dotc/CompilationUnit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ package dotty.tools
package dotc

import dotty.tools.dotc.core.Types.Type
import dotty.tools.dotc.core.pickling.{TastyBuffer, TastyPickler}
import dotty.tools.dotc.core.tasty.{TastyBuffer, TastyPickler}
import util.SourceFile
import ast.{tpd, untpd}
import TastyBuffer._
import dotty.tools.dotc.core.Symbols._

class CompilationUnit(val source: SourceFile) {
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/FromTasty.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Phases.Phase
import util._
import Decorators._
import dotty.tools.dotc.transform.Pickler
import pickling.DottyUnpickler
import tasty.DottyUnpickler
import ast.tpd._

/** Compiler for TASTY files.
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/ast/TreeInfo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] =>
/** Does tree contain an initialization part when seen as a member of a class or trait?
*/
def isNoInitMember(tree: Tree): Boolean = unsplice(tree) match {
case EmptyTree | Import(_, _) | TypeDef(_, _) => true
case EmptyTree | Import(_, _) | TypeDef(_, _) | DefDef(_, _, _, _, _) => true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems unrelated to this PR.

case tree: ValDef => tree.unforcedRhs == EmptyTree
case _ => false
}
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/core/Definitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package core

import Types._, Contexts._, Symbols._, Denotations._, SymDenotations._, StdNames._, Names._
import Flags._, Scopes._, Decorators._, NameOps._, util.Positions._
import pickling.Scala2Unpickler.ensureConstructor
import unpickleScala2.Scala2Unpickler.ensureConstructor
import scala.annotation.{ switch, meta }
import scala.collection.{ mutable, immutable }
import PartialFunction._
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/core/SymbolLoaders.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import dotty.tools.io.{ ClassPath, AbstractFile }
import Contexts._, Symbols._, Flags._, SymDenotations._, Types._, Scopes._, util.Positions._, Names._
import StdNames._, NameOps._
import Decorators.{StringDecorator, StringInterpolators}
import pickling.ClassfileParser
import classfile.ClassfileParser
import scala.util.control.NonFatal

object SymbolLoaders {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dotty.tools
package dotc
package core
package pickling
package classfile

import java.lang.Float.intBitsToFloat
import java.lang.Double.longBitsToDouble
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
package dotty.tools.dotc.core.pickling
package dotty.tools.dotc.core.classfile

object ByteCodecs {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dotty.tools.dotc.core
package pickling
package dotty.tools.dotc
package core
package classfile

import scala.annotation.switch

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package dotty.tools
package dotc
package core
package pickling
package classfile

import Contexts._, Symbols._, Types._, Names._, StdNames._, NameOps._, Scopes._, Decorators._
import SymDenotations._, Scala2Unpickler._, Constants._, Annotations._, util.Positions._
import SymDenotations._, unpickleScala2.Scala2Unpickler._, Constants._, Annotations._, util.Positions._
import ast.tpd._
import java.io.{ File, IOException }
import java.lang.Integer.toHexString
Expand Down Expand Up @@ -672,13 +672,13 @@ class ClassfileParser(
}

def unpickleScala(bytes: Array[Byte]): Some[Embedded] = {
val unpickler = new Scala2Unpickler(bytes, classRoot, moduleRoot)(ctx)
val unpickler = new unpickleScala2.Scala2Unpickler(bytes, classRoot, moduleRoot)(ctx)
unpickler.run()
Some(unpickler)
}

def unpickleTASTY(bytes: Array[Byte]): Some[Embedded] = {
val unpickler = new DottyUnpickler(bytes)
val unpickler = new tasty.DottyUnpickler(bytes)
unpickler.enter(roots = Set(classRoot, moduleRoot, moduleRoot.sourceModule))
Some(unpickler)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package dotty.tools
package dotc
package core
package pickling
package tasty

import Contexts._, SymDenotations._
import dotty.tools.dotc.ast.tpd
import TastyUnpickler._, TastyBuffer._
import util.Positions._
import util.{SourceFile, NoSource}
import PositionUnpickler._
import classfile.ClassfileParser

object DottyUnpickler {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package dotty.tools
package dotc
package core
package pickling
package tasty

import collection.mutable
import Names.{Name, chrs}
import Decorators._, NameOps._
import TastyBuffer._
import scala.io.Codec
import TastyName._
import PickleFormat._
import TastyFormat._

class NameBuffer extends TastyBuffer(10000) {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package dotty.tools
package dotc
package core
package pickling
package tasty

import ast.tpd._
import ast.Trees.WithLazyField
import PickleFormat._
import TastyFormat._
import core._
import Contexts._, Symbols._, Types._, Names._, Constants._, Decorators._, Annotations._
import collection.mutable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package dotty.tools
package dotc
package core
package pickling
package tasty


import util.Positions._
import collection.mutable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dotty.tools
package dotc
package core
package pickling
package tasty

import util.Util.dble

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dotty.tools.dotc
package core
package pickling
package tasty

/************************************************************
Notation:
Expand Down Expand Up @@ -205,7 +205,7 @@ Standard Section: "Positions" sourceLength_Nat Assoc*

**************************************************************************************/

object PickleFormat {
object TastyFormat {

final val header = Array(0x5C, 0xA1, 0xAB, 0x1F)
final val MajorVersion = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dotty.tools
package dotc
package core
package pickling
package tasty

import core.Names.TermName
import collection.mutable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package dotty.tools
package dotc
package core
package pickling
package tasty

import PickleFormat._
import TastyFormat._
import collection.mutable
import TastyBuffer._
import java.util.UUID
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dotty.tools.dotc
package core
package pickling
package tasty

import Contexts._, Decorators._
import printing.Texts._
Expand Down Expand Up @@ -43,7 +43,7 @@ class TastyPrinter(bytes: Array[Byte])(implicit ctx: Context) {
}

class TreeSectionUnpickler extends SectionUnpickler[Unit]("ASTs") {
import PickleFormat._
import TastyFormat._
def unpickle(reader: TastyReader, tastyName: TastyName.Table): Unit = {
import reader._
var indent = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package dotty.tools
package dotc
package core
package pickling

package tasty

import TastyBuffer._
import TastyName.NameRef
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package dotty.tools.dotc
package core
package pickling
package tasty

import scala.collection.mutable
import PickleFormat._
import TastyFormat._
import Names.{Name, termName}
import java.util.UUID

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dotty.tools
package dotc
package core
package pickling
package tasty

import util.Util.{bestFit, dble}
import TastyBuffer.{Addr, AddrWidth}
Expand All @@ -17,7 +17,7 @@ class TreeBuffer extends TastyBuffer(50000) {
private var delta: Array[Int] = _
private var numOffsets = 0

private[pickling] val pickledTrees = new java.util.IdentityHashMap[Tree, Any] // Value type is really Addr, but that's not compatible with null
private[tasty] val pickledTrees = new java.util.IdentityHashMap[Tree, Any] // Value type is really Addr, but that's not compatible with null

def addrOfTree(tree: Tree): Option[Addr] = pickledTrees.get(tree) match {
case null => None
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package dotty.tools
package dotc
package core
package pickling
package tasty

import ast.Trees._
import PickleFormat._
import core._
import TastyFormat._
import Contexts._, Symbols._, Types._, Names._, Constants._, Decorators._, Annotations._, StdNames.tpnme, NameOps._
import collection.mutable
import NameOps._
Expand Down Expand Up @@ -190,7 +189,7 @@ class TreePickler(pickler: TastyPickler) {
pickleName(tpe.name); pickleType(tpe.prefix)
}
case tpe: ThisType =>
if (tpe.cls.is(Flags.Package) && !tpe.cls.isEffectiveRoot)
if (tpe.cls.is(Flags.Package) && !tpe.cls.isEffectiveRoot)
picklePackageRef(tpe.cls)
else {
writeByte(THIS)
Expand Down Expand Up @@ -260,7 +259,7 @@ class TreePickler(pickler: TastyPickler) {
println(i"error while pickling type $tpe")
throw ex
}

def picklePackageRef(pkg: Symbol): Unit = {
writeByte(TERMREFpkg)
pickleName(qualifiedName(pkg))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
package dotty.tools
package dotc
package core
package pickling
package tasty

import Contexts._, Symbols._, Types._, Scopes._, SymDenotations._, Names._, NameOps._
import StdNames._, Denotations._, Flags._, Constants._, Annotations._
import util.Positions._
import dotty.tools.dotc.ast.{tpd, Trees, untpd}
import Trees._
import Decorators._
import TastyUnpickler._, TastyBuffer._
import TastyUnpickler._, TastyBuffer._, PositionPickler._
import annotation.switch
import scala.collection.{ mutable, immutable }
import typer.Mode
import config.Printers.pickling
import PositionPickler._

/** Unpickler for typed trees
* @param reader the reader from which to unpickle
* @param tastyName the nametable
*/
class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table) {
import dotty.tools.dotc.core.pickling.PickleFormat._
import TastyFormat._
import TastyName._
import tpd._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dotty.tools
package dotc
package core
package pickling
package unpickleScala2

import Flags._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dotty.tools
package dotc
package core
package pickling
package unpickleScala2

import java.io.IOException
import java.lang.Float.intBitsToFloat
Expand All @@ -20,6 +20,7 @@ import typer.Checking.checkNonCyclic
import PickleBuffer._
import scala.reflect.internal.pickling.PickleFormat._
import Decorators._
import classfile.ClassfileParser
import scala.collection.{ mutable, immutable }
import scala.collection.mutable.ListBuffer
import scala.annotation.switch
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/transform/Pickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package transform
import core._
import Contexts.Context
import Decorators._
import pickling._
import tasty._
import config.Printers.{noPrinter, pickling}
import java.io.PrintStream
import Periods._
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/util/ShowPickled.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.lang.Float.intBitsToFloat
import java.lang.Double.longBitsToDouble
import scala.reflect.internal.Flags
import scala.reflect.internal.pickling.PickleFormat
import core.pickling.PickleBuffer
import core.unpickleScala2.PickleBuffer
import core.Names._

object ShowPickled {
Expand Down