An Optimization-Driven Incremental Inline Substitution Algorithm for Just-In-Time Compilers
Aleksandar Prokopec, Gilles Duboscq,
David Leopoldseder, Thomas Würthinger
def main(args: Array[String]) = log(args)
var log: Seq[String] => Unit =
(xs: Seq[String]) => xs.foreach(println)
def main(args: Array[String]) = log(args)
var log: Seq[String] => Unit =
(xs: Seq[String]) => xs.foreach(println)
trait Seq[T] {
def apply(i: Int): T
def length: Int
def foreach(f: T => Unit) = {
var i = 0
while (i < this.length) {
f(this.apply(i))
i += 1
}
}
}
def main(args: Array[String]) =
args.foreach(println)
trait Seq[T] {
def apply(i: Int): T
def length: Int
def foreach(f: T => Unit) = {
var i = 0
while (i < this.length) {
f(this.apply(i))
i += 1
}
}
}
Choose callsites to inline, so that program execution time is minimized.
def main(args: Array[String]) = log(args)
var log: Seq[String] => Unit =
(xs: Seq[String]) => xs.foreach(println)
trait Seq[T] {
def apply(i: Int): T
def length: Int
def foreach(f: T => Unit) = {
var i = 0
while (i < this.length) {
f(this.apply(i))
i += 1
}
}
}
def main(args: Array[String]) = log(args)
def main(args: Array[String]) = log(args)
var log: Seq[String] => Unit =
(xs: Seq[String]) => xs.foreach(println)
trait Seq[T] {
def apply(i: Int): T
def length: Int
def foreach(f: T => Unit) = {
var i = 0
while (i < this.length) {
f(this.apply(i))
i += 1
}
}
}
trait Seq[T] {
def apply(i: Int): T
def length: Int
def foreach(f: T => Unit) = {
var i = 0
while (i < this.length) {
f(this.apply(i))
i += 1
}
}
}
class Array[T](val length: Int)
extends Seq[T] {
def apply(i: Int) = READ(this + i)
def foreach(f: T => Unit) = {
var i = 0
while (i < this.length) {
f(this.apply(i))
i += 1
}
}
}
def main(args: Array[String]) = {
var i = 0
while (i < args.length) {
println(READ(args + i))
i += 1
}
}
Benefit: the expected decrease in program execution time.
Benefit: the expected decrease in program execution time.
Cost c: the increase in the program size from inlining the method.
Callsite clustering results in better performance.
Adaptive thresholds result in better performance than fixed thresholds.
Use a spacebar or arrow keys to navigate