Skip to content

Instantly share code, notes, and snippets.

View sjrd's full-sized avatar

Sébastien Doeraene sjrd

View GitHub Profile
@sjrd
sjrd / scalajs-test-suite-test-fastopt.js.diff
Created June 20, 2016 12:49
Test suite diff of #2479
--- ../scalajs-test-suite-test-fastopt.js 2016-06-20 11:59:45.273513648 +0200
+++ test-suite/js/target/scala-2.11/scalajs-test-suite-test-fastopt.js 2016-06-20 14:35:19.945320230 +0200
@@ -8937,7 +8937,7 @@
source.addAll__ju_Collection__Z($s_sc_convert_WrapAsJava$class__seqAsJavaList__sc_convert_WrapAsJava__sc_Seq__ju_List(this$45, seq$3));
var this$53 = $m_Lorg_junit_Assert$();
var this$46 = $$this.range__sci_Range();
- var expected$2 = $imul(2, this$46.length__I());
+ var expected$2 = (this$46.length__I() << 1);
var targetSize$4 = target.size__I();
if ((targetSize$4 === 0)) {
@sjrd
sjrd / scalajs-test-suite-test-fastopt.js.diff
Created June 20, 2016 11:33
Test suite diff for #2478
--- ../scalajs-test-suite-test-fastopt.js 2016-06-20 11:59:45.273513648 +0200
+++ test-suite/js/target/scala-2.11/scalajs-test-suite-test-fastopt.js 2016-06-20 13:17:40.497416775 +0200
@@ -1238,18 +1238,11 @@
if ($m_Lorg_scalajs_testsuite_compiler_TC$().is__I__Z(42)) {
throw new $c_Lorg_scalajs_testsuite_compiler_TestException().init___I(238)
};
- if ((kv !== null)) {
- var k = $as_T(kv.$$und1__O());
- var v$1 = $as_Lorg_scalajs_testsuite_compiler_JsValue(kv.$$und2__O());
- var x$3_$_$$und1$f = k;
diff --git "a/C:\\Users\\Sepi\\Documents\\Projets\\scalajs-test-suite-test-fastopt.js" "b/C:\\Users\\Sepi\\Documents\\Projets\\scalajs\\test-suite\\js\\target\\scala-2.11\\scalajs-test-suite-test-fastopt.js"
index 1b121cd..24aedbb 100644
--- "a/C:\\Users\\Sepi\\Documents\\Projets\\scalajs-test-suite-test-fastopt.js"
+++ "b/C:\\Users\\Sepi\\Documents\\Projets\\scalajs\\test-suite\\js\\target\\scala-2.11\\scalajs-test-suite-test-fastopt.js"
@@ -31557,6 +31557,7 @@ $c_Lorg_scalajs_testsuite_compiler_OptimizerTest.prototype.side$undeffect$unddis
})
})(this, b);
var x$2 = $uI(this.org$scalajs$testsuite$compiler$OptimizerTest$$get$1__O__scm_ArrayBuilder__O(1, b));
+ $uI(f());
this.mockPrintln$1__p1__O__scm_ArrayBuilder__V(((x$2 + $uI(f())) | 0), b);
@sjrd
sjrd / test-suite-fastopt.js.diff
Created June 7, 2016 21:48
Impact of PreTransUnaryOp and PreTransBinaryOp on the Scala.js test suite
diff --git "a/C:\\Users\\Sepi\\Documents\\Projets\\scalajs\\test-suite\\js\\target\\scala-2.11\\scalajs-test-suite-test-fastopt.js" "b/C:\\Users\\Sepi\\Documents\\Projets\\scalajs-test-suite-test-fastopt.js"
index 98365f8..338b8c6 100644
--- "a/C:\\Users\\Sepi\\Documents\\Projets\\scalajs\\test-suite\\js\\target\\scala-2.11\\scalajs-test-suite-test-fastopt.js"
+++ "b/C:\\Users\\Sepi\\Documents\\Projets\\scalajs-test-suite-test-fastopt.js"
@@ -30731,7 +30731,6 @@ $c_Lorg_scalajs_testsuite_compiler_OptimizerTest.prototype.must$undnot$undbreak$
if (isEmpty$4) {
/*<skip>*/
};
- var lastElement$4 = (isEmpty$4 ? (((-1) + x) | 0) : 2);
var isEmpty$4$1 = (x < 2);
package example
import scala.scalajs.js
import org.scalajs.dom
@js.native
trait EventName extends js.Any {
type EventType <: dom.Event
}
[error] error: scala.reflect.internal.FatalError:
[error] Could not generate raw function maker for JS function: Found a non-apply method method $anonfun$4 in
@SerialVersionUID(value = 0) final <synthetic> class anonfun$toJSPromise$extension$1 extends scala.scalajs.js
.Function with scala.scalajs.js.Function2 with Serializable {
[error] final def apply(arg1: scala.scalajs.js.Function1, arg2: scala.scalajs.js.Function1): Unit = anonfun$
toJSPromise$extension$1.this.$this$1.onComplete({
[error] ((x0$2: scala.util.Try) => anonfun$toJSPromise$extension$1.this.$anonfun$4(arg1, arg2, x0$2))
[error] }, anonfun$toJSPromise$extension$1.this.executor$1);
[error] final <bridge> <artifact> def apply(arg1: Object, arg2: Object): Object = {
[error] anonfun$toJSPromise$extension$1.this.apply(arg1.$asInstanceOf[scala.scalajs.js.Function1](), arg2.
@sjrd
sjrd / Deep dive into Scala.js internals.md
Created January 22, 2016 14:53
ScalaDays 2016 Proposals

Have you ever dreamed of understanding how Scala.js works under the covers? Knowing your way around its codebase? This is your chance! This advanced talk will take you to the deepest parts of Scala.js: its compiler, its Intermediate Representation, its linker and its optimizer.

Through live coding within the Scala.js codebase, we will explain how the Scala.js compilation pipeline works, and how you can modify it. After this talk, you will understand the Scala.js IR and be able to manipulate it. And you'll be ready to write your custom Linker Plugins!

Attendees are expected to be proficient in Scala and have some compiler background (e.g., knowing what an AST is is vital).

[info] Scala.js IR: found 6 potential binary incompatibilities (filtered 5)
[error] * synthetic method org$scalajs$core$ir$Traversers$Traverser$$$anonfun$17$adapted(scala.Tuple2)java.lang.Object in class org.scalajs.core.ir.Traversers#Traverser's type has changed; was (scala.Tuple2)java.lang.Object, is now: (org.scalajs.core.ir.Trees#Tree)java.lang.Object
[error] filter with: ProblemFilters.exclude[IncompatibleMethTypeProblem]("org.scalajs.core.ir.Traversers#Traverser.org$scalajs$core$ir$Traversers$Traverser$$$anonfun$17$adapted")
[error] * synthetic method org$scalajs$core$ir$Traversers$Traverser$$$anonfun$19$adapted(org.scalajs.core.ir.Trees#Tree)java.lang.Object in class org.scalajs.core.ir.Traversers#Traverser's type has changed; was (org.scalajs.core.ir.Trees#Tree)java.lang.Object, is now: (scala.Tuple2)java.lang.Object
[error] filter with: ProblemFilters.exclude[IncompatibleMethTypeProblem]("org.scalajs.core.ir.Traversers#Traverser.org$scalajs$core$ir$Traversers$Traverser$$$anonfun$19$adapted")
Welcome to Scala version 2.11.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_31).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import scala.collection.JavaConversions._
import scala.collection.JavaConversions._
scala> val list = new java.util.ArrayList[Int]
list: java.util.ArrayList[Int] = []
@sjrd
sjrd / parser-combinators-fastopt.js
Last active August 29, 2015 14:20
Emitted code for PoC fast macro-free parser combinators in Scala.js
ScalaJS.c.LScalaJSExample$.prototype.parse__T__T = (function(s) {
var jsx$2 = ScalaJS.m.sjsr_RuntimeString$();
if (((ScalaJS.uI(s["length"]) > 0) && ((65535 & ScalaJS.uI(s["charCodeAt"](0))) === 104))) {
var value = new ScalaJS.c.jl_Character().init___C(104);
var r1_$_success$1 = true;
var r1_$_value$1 = value;
var r1_$_nextPos$1 = 1
} else {
var r1_$_success$1 = false;
var r1_$_value$1 = null;