Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit23937ee

Browse files
committed
Merge branch 'delite-develop2'
2 parentse13e21d +556229a commit23937ee

File tree

42 files changed

+3560
-455
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3560
-455
lines changed

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ more seamless.
2020
###How to build:
2121

2222
1. Install the simple build tool ([SBT](http://www.scala-sbt.org/)).
23-
You will needaversion 0.12.0 of the[sbt-launch.jar](http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.12.0/sbt-launch.jar).
23+
You will need version 0.12.0 of[sbt-launch.jar](http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.12.0/sbt-launch.jar).
2424
Follow the[installation instructions](http://www.scala-sbt.org/download.html#manual) on the SBT website.
2525

2626
2. Run`sbt test` to run the test suite.

‎build.sbt‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
name:="LMS"
22

3-
version:="0.2"
3+
version:="0.3-SNAPSHOT"
44

55
organization:="EPFL"
66

77
resolvers+=ScalaToolsSnapshots
88

9-
resolvers+= dropboxScalaTestRepo
9+
//resolvers += dropboxScalaTestRepo
1010

11-
scalaOrganization:="org.scala-lang"
11+
resolvers+= prereleaseScalaTest
12+
13+
//scalaHome := Some(file("/Users/tiark/scala/build/pack"))
14+
15+
scalaOrganization:="org.scala-lang.virtualized"
1216

1317
//scalaBinaryVersion := virtScala // necessary??
1418

‎project/Build.scala‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ import java.io.File
44
objectLMSBuildextendsBuild {
55
// FIXME: custom-built scalatest
66
valdropboxScalaTestRepo="Dropbox" at"http://dl.dropbox.com/u/12870350/scala-virtualized"
7-
valscalaTest="org.scalatest"%"scalatest_2.10.0-virtualized-SNAPSHOT"%"1.6.1-SNAPSHOT"%"test"
8-
valvirtScala=Option(System.getenv("SCALA_VIRTUALIZED_VERSION")).getOrElse("2.10.0-M1-virtualized")
7+
8+
valprereleaseScalaTest="XXX" at"https://oss.sonatype.org/content/groups/public"// "org/scalatest/scalatest_2.10.0-M5/1.9-2.10.0-M5-B2/"
9+
10+
//val scalaTest = "org.scalatest" % "scalatest_2.10.0-virtualized-SNAPSHOT" % "1.6.1-SNAPSHOT" % "test"
11+
// TODO: use M7 version
12+
valscalaTest="org.scalatest"%"scalatest_2.10.0-M7"%"1.9-2.10.0-M7-B1"%"test"
13+
14+
valvirtScala=Option(System.getenv("SCALA_VIRTUALIZED_VERSION")).getOrElse("2.10.0-M7")
915

1016
lazyvallms=Project("LMS", file("."))
1117
}

‎src/common/ArrayOps.scala‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ trait ArrayOpsExp extends ArrayOps with EffectExp with VariablesExp {
9696
// mirroring
9797

9898
overridedefmirror[A:Manifest](e:Def[A],f:Transformer)(implicitpos:SourceContext):Exp[A]= (ematch {
99-
caseArrayApply(a,x)=> array_apply(f(a),f(x))
99+
caseArrayApply(a,x)=> array_apply(f(a),f(x))(mtype(manifest[A]),pos)
100100
caseArrayLength(x)=> array_length(f(x))
101101
case e@ArraySort(x)=> array_sort(f(x))(e.m,pos)
102102
case e@ArrayCopy(a,ap,d,dp,l)=> toAtom(ArrayCopy(f(a),f(ap),f(d),f(dp),f(l))(e.m))(mtype(manifest[A]),pos)
103103
caseReflect(e@ArrayNew(n), u, es)=> reflectMirrored(Reflect(ArrayNew(f(n))(e.m), mapOver(f,u), f(es)))(mtype(manifest[A]))
104104
caseReflect(e@ArrayLength(x), u, es)=> reflectMirrored(Reflect(ArrayLength(f(x))(e.m), mapOver(f,u), f(es)))(mtype(manifest[A]))
105-
caseReflect(ArrayApply(l,r), u, es)=> reflectMirrored(Reflect(ArrayApply(f(l),f(r)), mapOver(f,u), f(es)))(mtype(manifest[A]))
105+
caseReflect(ArrayApply(l,r), u, es)=> reflectMirrored(Reflect(ArrayApply(f(l),f(r))(mtype(manifest[A])), mapOver(f,u), f(es)))(mtype(manifest[A]))
106106
caseReflect(e@ArraySort(x), u, es)=> reflectMirrored(Reflect(ArraySort(f(x))(e.m), mapOver(f,u), f(es)))(mtype(manifest[A]))
107107
caseReflect(ArrayUpdate(l,i,r), u, es)=> reflectMirrored(Reflect(ArrayUpdate(f(l),f(i),f(r)), mapOver(f,u), f(es)))(mtype(manifest[A]))
108108
caseReflect(e@ArrayCopy(a,ap,d,dp,l), u, es)=> reflectMirrored(Reflect(ArrayCopy(f(a),f(ap),f(d),f(dp),f(l))(e.m), mapOver(f,u), f(es)))(mtype(manifest[A]))

‎src/common/CastingOps.scala‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ trait CastingOps extends Variables with OverloadHack {
1818
}
1919

2020
defrep_isinstanceof[A,B](lhs:Rep[A],mA:Manifest[A],mB:Manifest[B])(implicitpos:SourceContext):Rep[Boolean]
21-
defrep_asinstanceof[A,B:Manifest](lhs:Rep[A],mA:Manifest[A],mB:Manifest[B])(implicitpos:SourceContext):Rep[B]
21+
defrep_asinstanceof[A,B](lhs:Rep[A],mA:Manifest[A],mB:Manifest[B])(implicitpos:SourceContext):Rep[B]
2222
}
2323

2424
traitCastingOpsExpextendsCastingOpswithBaseExp {
2525
this:ImplicitOps=>
2626

2727
caseclassRepIsInstanceOf[A,B](lhs:Exp[A],mA:Manifest[A],mB:Manifest[B])extendsDef[Boolean]
28-
caseclassRepAsInstanceOf[A,B:Manifest](lhs:Exp[A],mA:Manifest[A],mB:Manifest[B])extendsDef[B]
28+
caseclassRepAsInstanceOf[A,B](lhs:Exp[A],mA:Manifest[A],mB:Manifest[B])extendsDef[B]
2929

3030
defrep_isinstanceof[A,B](lhs:Exp[A],mA:Manifest[A],mB:Manifest[B])(implicitpos:SourceContext)=RepIsInstanceOf(lhs,mA,mB)
31-
defrep_asinstanceof[A,B:Manifest](lhs:Exp[A],mA:Manifest[A],mB:Manifest[B])(implicitpos:SourceContext):Exp[B]=RepAsInstanceOf(lhs,mA,mB)
31+
defrep_asinstanceof[A,B](lhs:Exp[A],mA:Manifest[A],mB:Manifest[B])(implicitpos:SourceContext):Exp[B]=toAtom(RepAsInstanceOf(lhs,mA,mB))(mB,pos)
3232

3333
overridedefmirror[A:Manifest](e:Def[A],f:Transformer)(implicitpos:SourceContext):Exp[A]= (ematch {
3434
caseRepAsInstanceOf(lhs, mA, mB)=> rep_asinstanceof(f(lhs), mA,mB)

‎src/common/ForwardTransformer.scala‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import scala.collection.{immutable,mutable}
55
importscala.reflect.SourceContext
66

77
traitForwardTransformerextends internal.AbstractSubstTransformerwith internal.FatBlockTraversal { self=>
8-
valIR:LoopsFatExpwithIfThenElseFatExp
8+
valIR:BaseFatExpwithEffectExp//LoopsFatExp with IfThenElseFatExp
99
importIR._
1010

1111
deftransformBlock[A:Manifest](block:Block[A]):Block[A]= {

‎src/common/ImplicitOps.scala‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ trait ImplicitOpsExp extends ImplicitOps with BaseExp {
2222
}
2323

2424
overridedefmirror[A:Manifest](e:Def[A],f:Transformer)(implicitpos:SourceContext):Exp[A]= (ematch {
25-
case im@ImplicitConvert(x)=> toAtom(ImplicitConvert(f(x))(im.mX,im.mY))
25+
case im@ImplicitConvert(x)=> toAtom(ImplicitConvert(f(x))(im.mX,im.mY))(mtype(manifest[A]),pos)
2626
case _=>super.mirror(e,f)
2727
}).asInstanceOf[Exp[A]]
2828

‎src/common/NumericOps.scala‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ trait NumericOpsExp extends NumericOps with VariablesExp with BaseFatExp {
5454
defnumeric_times[T:Numeric:Manifest](lhs:Exp[T],rhs:Exp[T])(implicitpos:SourceContext):Exp[T]=NumericTimes(lhs, rhs)
5555
defnumeric_divide[T:Numeric:Manifest](lhs:Exp[T],rhs:Exp[T])(implicitpos:SourceContext):Exp[T]=NumericDivide(lhs, rhs)
5656

57-
overridedefmirror[A:Manifest](e:Def[A],f:Transformer)(implicitpos:SourceContext):Exp[A]= ematch {
58-
case e@NumericPlus(l,r)=> numeric_plus(f(l), f(r))(e.aev,e.mev, pos)
59-
case e@NumericMinus(l,r)=> numeric_minus(f(l), f(r))(e.aev,e.mev, pos)
60-
case e@NumericTimes(l,r)=> numeric_times(f(l), f(r))(e.aev,e.mev, pos)
61-
case e@NumericDivide(l,r)=> numeric_divide(f(l), f(r))(e.aev,e.mev, pos)
57+
overridedefmirror[A:Manifest](e:Def[A],f:Transformer)(implicitpos:SourceContext):Exp[A]=(ematch {
58+
case e@NumericPlus(l,r)=> numeric_plus(f(l), f(r))(e.aev.asInstanceOf[Numeric[A]], mtype(e.mev), pos)
59+
case e@NumericMinus(l,r)=> numeric_minus(f(l), f(r))(e.aev.asInstanceOf[Numeric[A]], mtype(e.mev), pos)
60+
case e@NumericTimes(l,r)=> numeric_times(f(l), f(r))(e.aev.asInstanceOf[Numeric[A]], mtype(e.mev), pos)
61+
case e@NumericDivide(l,r)=> numeric_divide(f(l), f(r))(e.aev.asInstanceOf[Numeric[A]], mtype(e.mev), pos)
6262
case _=>super.mirror(e,f)
63-
}
63+
}).asInstanceOf[Exp[A]]
6464

6565
}
6666

@@ -73,7 +73,10 @@ trait NumericOpsExpOpt extends NumericOpsExp {
7373
case (x,Const(y))if y== implicitly[Numeric[T]].zero=> x
7474
case _=>super.numeric_plus(lhs,rhs)
7575
}
76-
overridedefnumeric_minus[T:Numeric:Manifest](lhs:Exp[T],rhs:Exp[T])(implicitpos:SourceContext):Exp[T]=NumericMinus(lhs, rhs)
76+
overridedefnumeric_minus[T:Numeric:Manifest](lhs:Exp[T],rhs:Exp[T])(implicitpos:SourceContext):Exp[T]= (lhs,rhs)match {
77+
case (Const(x),Const(y))=>Const(implicitly[Numeric[T]].minus(x,y))
78+
case _=>super.numeric_minus(lhs,rhs)
79+
}
7780
overridedefnumeric_times[T:Numeric:Manifest](lhs:Exp[T],rhs:Exp[T])(implicitpos:SourceContext):Exp[T]= (lhs,rhs)match {
7881
case (Const(x),Const(y))=>Const(implicitly[Numeric[T]].times(x,y))
7982
case (Const(x), y)if x== implicitly[Numeric[T]].zero=>Const(x)
@@ -82,8 +85,11 @@ trait NumericOpsExpOpt extends NumericOpsExp {
8285
case (x,Const(y))if y== implicitly[Numeric[T]].one=> x
8386
case _=>super.numeric_times(lhs,rhs)
8487
}
85-
overridedefnumeric_divide[T:Numeric:Manifest](lhs:Exp[T],rhs:Exp[T])(implicitpos:SourceContext):Exp[T]=NumericDivide(lhs, rhs)
86-
88+
overridedefnumeric_divide[T:Numeric:Manifest](lhs:Exp[T],rhs:Exp[T])(implicitpos:SourceContext):Exp[T]= (lhs,rhs)match {
89+
// CAVEAT: Numeric doesn't have .div, Fractional has
90+
case (Const(x),Const(y))=>Const(implicitly[Numeric[T]].asInstanceOf[Fractional[T]].div(x,y))
91+
case _=>super.numeric_divide(lhs,rhs)
92+
}
8793
}
8894

8995

‎src/common/ObjectOps.scala‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ trait ObjectOpsExp extends ObjectOps with VariablesExp {
3838
// mirroring
3939

4040
overridedefmirror[A:Manifest](e:Def[A],f:Transformer)(implicitpos:SourceContext):Exp[A]= (ematch {
41-
case e@ObjectUnsafeImmutable(a)=> object_unsafe_immutable(f(a))(e.m,pos)
41+
case e@ObjectUnsafeImmutable(a)=> object_unsafe_immutable(f(a))(mtype(e.m),pos)
4242
case e@ObjectToString(a)=> object_tostring(f(a))
43-
caseReflect(e@ObjectUnsafeImmutable(a), u, es)=> reflectMirrored(Reflect(ObjectUnsafeImmutable(f(a))(e.m), mapOver(f,u), f(es)))(mtype(manifest[A]))
44-
caseReflect(e@ObjectUnsafeMutable(a), u, es)=> reflectMirrored(Reflect(ObjectUnsafeMutable(f(a))(e.m), mapOver(f,u), f(es)))(mtype(manifest[A]))
43+
caseReflect(e@ObjectUnsafeImmutable(a), u, es)=> reflectMirrored(Reflect(ObjectUnsafeImmutable(f(a))(mtype(e.m)), mapOver(f,u), f(es)))(mtype(manifest[A]))
44+
caseReflect(e@ObjectUnsafeMutable(a), u, es)=> reflectMirrored(Reflect(ObjectUnsafeMutable(f(a))(mtype(e.m)), mapOver(f,u), f(es)))(mtype(manifest[A]))
4545
case _=>super.mirror(e,f)
4646
}).asInstanceOf[Exp[A]]
4747

‎src/common/OrderingOps.scala‎

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,17 @@ trait OrderingOps extends Base with Variables with OverloadHack {
4848

4949

5050
traitOrderingOpsExpextendsOrderingOpswithVariablesExp {
51-
52-
caseclassOrderingLT[T:Ordering:Manifest](lhs:Exp[T],rhs:Exp[T])extendsDef[Boolean]
53-
caseclassOrderingLTEQ[T:Ordering:Manifest](lhs:Exp[T],rhs:Exp[T])extendsDef[Boolean]
54-
caseclassOrderingGT[T:Ordering:Manifest](lhs:Exp[T],rhs:Exp[T])extendsDef[Boolean]
55-
caseclassOrderingGTEQ[T:Ordering:Manifest](lhs:Exp[T],rhs:Exp[T])extendsDef[Boolean]
56-
caseclassOrderingEquiv[T:Ordering:Manifest](lhs:Exp[T],rhs:Exp[T])extendsDef[Boolean]
57-
caseclassOrderingMax[T:Ordering:Manifest](lhs:Exp[T],rhs:Exp[T])extendsDef[T]
58-
caseclassOrderingMin[T:Ordering:Manifest](lhs:Exp[T],rhs:Exp[T])extendsDef[T]
51+
abstractclassDefMN[T:Ordering:Manifest,A]extendsDef[A] {
52+
defmev= manifest[T]
53+
defaev= implicitly[Ordering[T]]
54+
}
55+
caseclassOrderingLT[T:Ordering:Manifest](lhs:Exp[T],rhs:Exp[T])extendsDefMN[T,Boolean]
56+
caseclassOrderingLTEQ[T:Ordering:Manifest](lhs:Exp[T],rhs:Exp[T])extendsDefMN[T,Boolean]
57+
caseclassOrderingGT[T:Ordering:Manifest](lhs:Exp[T],rhs:Exp[T])extendsDefMN[T,Boolean]
58+
caseclassOrderingGTEQ[T:Ordering:Manifest](lhs:Exp[T],rhs:Exp[T])extendsDefMN[T,Boolean]
59+
caseclassOrderingEquiv[T:Ordering:Manifest](lhs:Exp[T],rhs:Exp[T])extendsDefMN[T,Boolean]
60+
caseclassOrderingMax[T:Ordering:Manifest](lhs:Exp[T],rhs:Exp[T])extendsDefMN[T,T]
61+
caseclassOrderingMin[T:Ordering:Manifest](lhs:Exp[T],rhs:Exp[T])extendsDefMN[T,T]
5962

6063
defordering_lt[T:Ordering:Manifest](lhs:Exp[T],rhs:Exp[T])(implicitpos:SourceContext):Rep[Boolean]=OrderingLT(lhs,rhs)
6164
defordering_lteq[T:Ordering:Manifest](lhs:Exp[T],rhs:Exp[T])(implicitpos:SourceContext):Rep[Boolean]=OrderingLTEQ(lhs,rhs)
@@ -66,16 +69,14 @@ trait OrderingOpsExp extends OrderingOps with VariablesExp {
6669
defordering_min[T:Ordering:Manifest](lhs:Exp[T],rhs:Exp[T])(implicitpos:SourceContext):Rep[T]=OrderingMin(lhs,rhs)
6770

6871
overridedefmirror[A:Manifest](e:Def[A],f:Transformer)(implicitpos:SourceContext):Exp[A]= {
69-
implicitvalz1:Ordering[Any]=null// hack!! need to store it in Def instances??
70-
implicitvalz2:Ordering[A]=null// hack!! need to store it in Def instances??
7172
(ematch {
72-
caseOrderingLT(a,b)=> ordering_lt(f(a),f(b))
73-
caseOrderingLTEQ(a,b)=> ordering_lteq(f(a),f(b))
74-
caseOrderingGT(a,b)=> ordering_gt(f(a),f(b))
75-
caseOrderingGTEQ(a,b)=> ordering_gteq(f(a),f(b))
76-
caseOrderingEquiv(a,b)=> ordering_equiv(f(a),f(b))
77-
caseOrderingMax(a,b)=> ordering_max(f(a),f(b))
78-
caseOrderingMin(a,b)=> ordering_min(f(a),f(b))
73+
casee@OrderingLT(a,b)=> ordering_lt(f(a),f(b))(e.aev,e.mev,pos)
74+
casee@OrderingLTEQ(a,b)=> ordering_lteq(f(a),f(b))(e.aev,e.mev,pos)
75+
casee@OrderingGT(a,b)=> ordering_gt(f(a),f(b))(e.aev,e.mev,pos)
76+
casee@OrderingGTEQ(a,b)=> ordering_gteq(f(a),f(b))(e.aev,e.mev,pos)
77+
casee@OrderingEquiv(a,b)=> ordering_equiv(f(a),f(b))(e.aev,e.mev,pos)
78+
casee@OrderingMax(a,b)=> ordering_max(f(a),f(b))(e.aev.asInstanceOf[Ordering[A]],mtype(e.mev),pos)
79+
casee@OrderingMin(a,b)=> ordering_min(f(a),f(b))(e.aev.asInstanceOf[Ordering[A]],mtype(e.mev),pos)
7980
case _=>super.mirror(e, f)
8081
}).asInstanceOf[Exp[A]]
8182
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp