[code-reflection] RFR: Model uninitialized variables [v5]
Paul Sandoz
psandoz at openjdk.org
Thu Oct 24 20:02:33 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 two additional commits since the last revision:
- Typo
- Cleanups
-------------
Changes:
- all: https://git.openjdk.org/babylon/pull/263/files
- new: https://git.openjdk.org/babylon/pull/263/files/1adfe6c1..17d6034b
Webrevs:
- full: https://webrevs.openjdk.org/?repo=babylon&pr=263&range=04
- incr: https://webrevs.openjdk.org/?repo=babylon&pr=263&range=03-04
Stats: 5 lines in 2 files changed: 1 ins; 1 del; 3 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