[code-reflection] RFR: Model uninitialized variables [v2]

Paul Sandoz psandoz at openjdk.org
Thu Oct 24 18:26:53 UTC 2024


> Uninitialized variables are currently modeled as if they are variables initialized with a default value.
> 
> To directly model uninitialized variables we introduce the undefined value operation. This operation has a result that is an undefined value whose type is the undefined type. Such a value can be used as the init operand of a var operation. Thereby we can distinguish between the modeling of uninitialized variables and variables initialized with a default value.
> 
> The approach of using a special value means there are very little changes to code operating on models, and undefined values can be tracked. For example, there were no changes required to the SSA transformation. Although, we should update that transformation to check if a value being used is an unitialized value, and if so throw an exception that the variable is not definitely assigned.
> 
> A value of the undefined type holds another value of the undefined type's value type, but we don't know what the actual value is and nor can we obtain it.

Paul Sandoz has updated the pull request incrementally with one additional commit since the last revision:

  Use the term unknown rather than undefined

-------------

Changes:
  - all: https://git.openjdk.org/babylon/pull/263/files
  - new: https://git.openjdk.org/babylon/pull/263/files/3258ce7e..9d23d34c

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=babylon&pr=263&range=01
 - incr: https://webrevs.openjdk.org/?repo=babylon&pr=263&range=00-01

  Stats: 148 lines in 10 files changed: 59 ins; 61 del; 28 mod
  Patch: https://git.openjdk.org/babylon/pull/263.diff
  Fetch: git fetch https://git.openjdk.org/babylon.git pull/263/head:pull/263

PR: https://git.openjdk.org/babylon/pull/263


More information about the babylon-dev mailing list