Skip to content

Commit

Permalink
Add TODO about optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
liufengyun committed Sep 29, 2024
1 parent aa27034 commit 4ae29fb
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions compiler/src/dotty/tools/dotc/transform/init/Objects.scala
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,32 @@ class Objects(using Context @constructorOnly):

/** Cache used to terminate the check */
object Cache:
/**
* TODO: heap optimization with memory side-effect analysis
*
* Observation:
*
* 1. Most methods will not read/mutate the heap (it may create more heap
* cells), despite the fact that portions of the heap is reachable from
* the method arugments and global objects.
*
* 2. If a particular execution of a method does not read any memory
* addresses of the initial heap, then execution of the method with any
* configuration cannot read memory addresses of the initial heap.
*
* The above implies that in analyzing most methods, it suffices to use the
* empty heap which is a better version of the footprint optimization.
*
* To figure out the memory effects of a method, we need to perform an
* analysis of the method. This effect analysis result can be computed as
* part of the analysis as part of the fixed-point computation:
*
* Method => HeapSensitive | HeapInsensitive
*
* Initially, we can always assume a method to be heap-insensitive. If it
* is discovered to be heap-sensitive, another round of computation can be
* performed.
*/
enum Config:
val heap: Heap.Data

Expand Down

0 comments on commit 4ae29fb

Please sign in to comment.