Skip to content

Commit

Permalink
internal: reduce the CgNode size (nim-works#992)
Browse files Browse the repository at this point in the history
## Summary

* reduce the size of `CgNode` from 48 to 40
* mark the type as being acyclic at run-time

## Details

The `origin` field is an unused leftover that was replaced by the
`info` field. Since the nodes are not allowed to form a cycle, the type
can be marked with `.acyclic`, reducing the pressure on the cycle
collector. In addition, the type's documentation is improved.
  • Loading branch information
zerbina authored Oct 24, 2023
1 parent cdcf25f commit 9ab6714
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/backend/cgir.nim
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ type
LocalId* = distinct uint32
## Identifies a local within a procedure.

CgNode* = ref object
## Code-generator node
origin*: PNode
CgNode* {.acyclic.} = ref object
## A node in the tree structure representing code during the code
## generation stage. The "CG" prefix is short for "code generation".
info*: TLineInfo
typ*: PType
case kind*: CgNodeKind
Expand Down

0 comments on commit 9ab6714

Please sign in to comment.