Skip to content

add dummy fields to trees to test cache locality #3133

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

Closed
wants to merge 3 commits into from
Closed
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
18 changes: 18 additions & 0 deletions compiler/src/dotty/tools/dotc/ast/Trees.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,24 @@ object Trees {
/** The type constructor at the root of the tree */
type ThisTree[T >: Untyped] <: Tree[T]

var x1: Int = _
var x2: Int = _
var x3: Int = _
var x4: Int = _
var x5: Int = _
var x6: Int = _
var x7: Int = _
var x8: Int = _
var x9: Int = _
var x10: Int = _
var x11: Int = _
var x12: Int = _
var x13: Int = _
var x14: Int = _
var x15: Int = _
var x16: Int = _


private[this] var myTpe: T = _

/** Destructively set the type of the tree. This should be called only when it is known that
Expand Down
22 changes: 22 additions & 0 deletions compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,30 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
tree.fallbackToText(this)
}

def toTextDummy(tree: Tree): Text = {
"x1 = " ~ tree.x1.toString ~ "\n" ~
"x2 = " ~ tree.x2.toString ~ "\n" ~
"x3 = " ~ tree.x3.toString ~ "\n" ~
"x4 = " ~ tree.x4.toString ~ "\n" ~
"x5 = " ~ tree.x5.toString ~ "\n" ~
"x6 = " ~ tree.x6.toString ~ "\n" ~
"x7 = " ~ tree.x7.toString ~ "\n" ~
"x8 = " ~ tree.x8.toString ~ "\n" ~
"x9 = " ~ tree.x9.toString ~ "\n" ~
"x10 = " ~ tree.x10.toString ~ "\n" ~
"x11 = " ~ tree.x11.toString ~ "\n" ~
"x12 = " ~ tree.x12.toString ~ "\n" ~
"x13 = " ~ tree.x13.toString ~ "\n" ~
"x14 = " ~ tree.x14.toString ~ "\n" ~
"x15 = " ~ tree.x15.toString ~ "\n" ~
"x16 = " ~ tree.x16.toString ~ "\n"
}

var txt = toTextCore(tree)

if (ctx.settings.verbose.value)
txt = txt ~ "\n" ~ toTextDummy(tree)

def suppressTypes =
tree.isType || tree.isDef || // don't print types of types or defs
homogenizedView && ctx.mode.is(Mode.Pattern)
Expand Down