Skip to content

Preserve effects of discarded member initializers - #625

Open
jogibear9988 wants to merge 1 commit into
dadhi:masterfrom
jogibear9988:fix/ignored-member-initializers-independent
Open

jogibear9988 wants to merge 1 commit into
dadhi:masterfrom
jogibear9988:fix/ignored-member-initializers-independent

Conversation

@jogibear9988

Copy link
Copy Markdown
Contributor

Discarding a member initializer must still construct its object and evaluate assignment values. Clear outer result/address flags while emitting values, then discard the completed initializer result.

Class and struct initializers, field/property assignments, constructor and RHS effects, and compiler flags. Regressions require strict FEC compilation. Native suites cover Standard and LightExpression.

Validation

Local validation uses master baseline 094d067 plus this change. Release solution build: zero warnings/errors.

Runtime TestX groups Legacy tests
.NET 10 489 passed 1,756 passed
.NET 8 489 passed 1,755 passed
.NET Framework 4.7.2 468 passed 1,639 passed

Measurements

Master baseline 094d0678 → this change, Release, Windows ARM64, .NET 8.0.28 / 10.0.9. Compilation uses prebuilt trees; runtime measures invocation through the same wrapper. Two fresh process rounds with reversed load order, seven samples per round, about 30 ms calibration, one logical CPU and tiered compilation disabled. Tables use the median of the two per-round medians.

The controls below produce correct results on master for their measured inputs. Newly supported trees have no valid before/after execution comparison because master rejects them, produces incorrect results or emits invalid IL. Timings include machine and JIT/code-placement variation; the unchanged add control helps show that variation. These observations do not prove universal performance neutrality.

net8.0 results (master → change)
API / workload Compile ns Invoke ns Compile B/op Invoke B/op
Standard / add_control 1387.6 → 1419.5 2.3 → 2.3 872.0 → 872.0 0.0 → 0.0
Standard / member_init 1681.2 → 1783.5 4.4 → 4.2 1064.1 → 1064.1 24.0 → 24.0
Standard / member_init_constructor 1846.9 → 1834.7 4.2 → 4.7 976.1 → 976.1 24.0 → 24.0
Light / add_control 1239.9 → 1205.5 2.3 → 2.4 872.0 → 872.0 0.0 → 0.0
Light / member_init 1946.0 → 1677.0 5.7 → 5.1 1064.0 → 1064.0 24.0 → 24.0
Light / member_init_constructor 1707.4 → 1578.2 4.7 → 5.0 976.0 → 976.0 24.0 → 24.0
net10.0 results (master → change)
API / workload Compile ns Invoke ns Compile B/op Invoke B/op
Standard / add_control 3825.7 → 3811.6 2.3 → 2.3 872.0 → 872.0 0.0 → 0.0
Standard / member_init 4762.3 → 4822.0 4.3 → 4.4 1064.2 → 1064.2 24.0 → 24.0
Standard / member_init_constructor 4659.5 → 4876.5 4.4 → 4.3 976.2 → 976.2 24.0 → 24.0
Light / add_control 2985.0 → 2913.1 2.3 → 2.2 872.0 → 872.0 0.0 → 0.0
Light / member_init 3467.4 → 3614.2 4.3 → 4.4 1064.0 → 1064.0 24.0 → 24.0
Light / member_init_constructor 3665.1 → 3457.0 4.3 → 4.9 976.0 → 976.0 24.0 → 24.0

Emitted IL differs in these measured workloads: none.
No measured allocation increase above 0.1 B/op in these controls.

Discarding a member initializer must still construct its object and evaluate assignment values. Clear outer result/address flags while emitting values, then discard the completed initializer result.

Validation: Release solution build; full Standard and LightExpression .NET 8, .NET 10 and Framework runners pass.

Measurements: master 094d067 versus this change, compilation and invocation, both APIs, .NET 8/10, two opposite-order process rounds with seven samples each. No measured allocation increase above 0.1 B/op in the selected working controls. Timings and emitted IL are recorded in the PR description; these controls do not establish universal performance neutrality.
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.

1 participant