Skip to content

Conversation

@francescoo22
Copy link
Contributor

This should save 2 calls on the call stack when calling acceptVoid, acceptChildrenVoid, transformVoid and transformChildrenVoid methods.

Example:

Before: irBody.acceptVoid(visitor) -> IrElement.acceptVoid(visitor) -> IrBlockBody.accept(visitor, null) -> IrVisitorVoid.visitBlockBody(visitBlockBody, null) -> IrVisitorVoid.visitBlockBody(visitBlockBody)

Now: irBody.acceptVoid(visitor) -> IrBlockBody.acceptVoid(visitor) -> IrVisitorVoid.visitBlockBody(visitBlockBody)

@francescoo22
Copy link
Contributor Author

These are the results for Intellij project. Lowering time is visibly improved and overall time looks slightly improved.
There are 3 runs from my branch that are pretty similar in terms of changes.
Screenshot 2025-12-22 at 12 25 33
Screenshot 2025-12-22 at 12 25 58

@francescoo22
Copy link
Contributor Author

These are the results for Full Kotlin. Overall time seems higher than last builds, but still aligned with previous ones. This looks to be caused by analysis time that shouldn't be affected by my changes. So, perhaps it is just noise, but I'm not sure.
Lowering time looks slightly improved as well on Full Kotlin. But not as much as it was for Intellij project
Screenshot 2025-12-22 at 12 59 14
Screenshot 2025-12-22 at 12 59 43
Screenshot 2025-12-22 at 13 00 15

@francescoo22 francescoo22 marked this pull request as draft January 16, 2026 13:39
this.body()
return this
}

protected fun IrElement.transformChildrenVoid() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we remove this function? It is used a lot, and quite handy? As you probably have only a single Transformer in code in most cases, and passing correct this is not very useful for readability.

override fun <D> transform(transformer: IrTransformer<D>, data: D): IrBranch =
accept(transformer, data) as IrBranch

override fun transformVoid(transformer: IrElementTransformerVoid): IrBranch =
accept(transformer, null) as IrBranch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we not calling acceptVoid here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants