aboutsummaryrefslogtreecommitdiff
path: root/src/dotty
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-02-12 12:10:53 +0100
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2015-03-18 11:09:43 +0100
commit4f804782950d6efcd979df2dc60c2bcf9a04f115 (patch)
treebd3bd6eecb92fa71d1b8ac5108b9e9d935d9fbad /src/dotty
parentf9eaa3eebb7d98f9a4163d44d2a70fcd3522b645 (diff)
downloaddotty-4f804782950d6efcd979df2dc60c2bcf9a04f115.tar.gz
dotty-4f804782950d6efcd979df2dc60c2bcf9a04f115.tar.bz2
dotty-4f804782950d6efcd979df2dc60c2bcf9a04f115.zip
Eliminate raw numbers from Tasy format
They are an irregularity and don't buy us much. Might as well pickle these numbers as Nats/Longs.
Diffstat (limited to 'src/dotty')
-rw-r--r--src/dotty/tools/dotc/core/pickling/PickleFormat.scala4
-rw-r--r--src/dotty/tools/dotc/core/pickling/TastyBuffer.scala13
-rw-r--r--src/dotty/tools/dotc/core/pickling/TreePickler.scala4
3 files changed, 5 insertions, 16 deletions
diff --git a/src/dotty/tools/dotc/core/pickling/PickleFormat.scala b/src/dotty/tools/dotc/core/pickling/PickleFormat.scala
index 6769cd016..338342459 100644
--- a/src/dotty/tools/dotc/core/pickling/PickleFormat.scala
+++ b/src/dotty/tools/dotc/core/pickling/PickleFormat.scala
@@ -113,8 +113,8 @@ Standard-Section: "ASTs" Tree*
INTneg NegNat
LONGconst LongNat
LONGneg NegLongNat
- FLOATconst FullInt
- DOUBLEconst FullLong
+ FLOATconst LongNat
+ DOUBLEconst LongNat
STRINGconst NameRef
NULLconst
CLASSconst Length Type
diff --git a/src/dotty/tools/dotc/core/pickling/TastyBuffer.scala b/src/dotty/tools/dotc/core/pickling/TastyBuffer.scala
index 0e44dbd76..ba033461e 100644
--- a/src/dotty/tools/dotc/core/pickling/TastyBuffer.scala
+++ b/src/dotty/tools/dotc/core/pickling/TastyBuffer.scala
@@ -61,8 +61,7 @@ class TastyBuffer(initialSize: Int) {
writeLongNat(x.toLong & 0x00000000FFFFFFFFL)
/**
- * Like writeNat, but for longs. This is not the same as
- * writeRaw, which writes in base 256. Note that the
+ * Like writeNat, but for longs. Note that the
* binary representation of LongNat is identical to Nat
* if the long value is in the range Int.MIN_VALUE to
* Int.MAX_VALUE.
@@ -77,16 +76,6 @@ class TastyBuffer(initialSize: Int) {
if (y != 0L) writeNatPrefix(y)
writeByte(((x & 0x7f) | 0x80).toInt)
}
-
- /** Write the `nbytes` least significant bytes of `x` in big endian format */
- def writeRaw(x: Long, nbytes: Int): Unit = {
- def recur(x: Long, n: Int): Unit =
- if (n > 0) {
- recur(x >>> 8, n - 1)
- writeByte((x & 0xff).toInt)
- }
- recur(x, nbytes)
- }
// -- Address handling --------------------------------------------
diff --git a/src/dotty/tools/dotc/core/pickling/TreePickler.scala b/src/dotty/tools/dotc/core/pickling/TreePickler.scala
index cc5a8b8f2..b3f228040 100644
--- a/src/dotty/tools/dotc/core/pickling/TreePickler.scala
+++ b/src/dotty/tools/dotc/core/pickling/TreePickler.scala
@@ -88,10 +88,10 @@ class TreePickler(pickler: TastyPickler, picklePositions: Boolean) {
pickleNum(LONGconst, LONGneg)
case FloatTag =>
writeByte(FLOATconst)
- writeRaw(java.lang.Float.floatToRawIntBits(c.floatValue), 4)
+ writeNat(java.lang.Float.floatToRawIntBits(c.floatValue))
case DoubleTag =>
writeByte(DOUBLEconst)
- writeRaw(java.lang.Double.doubleToRawLongBits(c.doubleValue), 8)
+ writeLongNat(java.lang.Double.doubleToRawLongBits(c.doubleValue))
case StringTag =>
writeByte(STRINGconst)
writeNat(nameIndex(c.stringValue).index)