Repository navigation
Preserve TypeDelegator and TypeBuilder constant identity - #580
jogibear9988 wants to merge 2 commits into
Conversation
|
The private static readonly Type RuntimeType = typeof(object).GetType();
// Only the real RuntimeType can be emitted via ldtoken; TypeDelegator/TypeBuilder must stay in the closure to preserve identity.Then use |
Cache the concrete runtime Type implementation once and explain why TypeDelegator and TypeBuilder constants must stay in the closure to preserve identity, as requested in the review of dadhi#580. Verified Standard and Light identity regressions on net8.0, net10.0 and net472; full Release build passes. Legacy suites and Framework runner pass. Existing master nullable MultiplyChecked parity failures remain unchanged. Measured control allocations and decoded IL are unchanged.
Keep TypeDelegator and unfinished TypeBuilder objects in the existing constants closure rather than emitting ldtoken for them. Keep runtime Type token emission and the ordinary constant classification order. Add shared Standard/Light identity and runtime-token regressions.
Cache the concrete runtime Type implementation once and explain why TypeDelegator and TypeBuilder constants must stay in the closure to preserve identity, as requested in the review of dadhi#580. Verified Standard and Light identity regressions on net8.0, net10.0 and net472; full Release build passes. Legacy suites and Framework runner pass. Existing master nullable MultiplyChecked parity failures remain unchanged. Measured control allocations and decoded IL are unchanged.
40213c0 to
55dca61
Compare
|
Implemented in 55dca61. The existing identity regressions cover TypeDelegator, unfinished TypeBuilder, repeated references, and runtime Type values for both Standard and LightExpression. They pass on .NET 8, .NET 10, and .NET Framework 4.7.2. Also rebased onto freshly fetched master (750e1e8), preserving both sets of test registrations. Release solution build passes without warnings/errors; legacy suites and Framework runner pass. The previously observed nullable MultiplyChecked parity failures remain in the .NET 8/10 full runners. |
A TypeDelegator or unfinished TypeBuilder constant is treated as an ldtoken-compatible runtime Type, so strict compilation throws ArgumentException instead of returning the original object. Keep non-runtime Type instances in FEC's existing constants closure. Actual runtime Type values retain token emission and their identity.
One constant-classification condition and a cached concrete runtime Type. The comparison now uses a named
RuntimeTypefield, initialized once, with a source comment explaining why TypeDelegator/TypeBuilder must stay in the closure to preserve identity (review feedback).TypeCode.Objectdoes not distinguish these implementations. Keep the ordinary constant short-circuit order. Shared Standard/Light tests cover identity, repeated constants, null, runtime/generic parameter, byref and array Type values.This is an independent extraction from #558, based directly on master
750e1e8ea602a7e72a90072ee80b0c1376f5b72d. It has the original fix plus a separate review-clarification commit and does not depend on either of the other standalone fixes. #558 and #559 are unchanged.Validation
ParityTests.Binary_operators_with_methods_and_nullable_operands_are_the_same_as_systemfor nullable MultiplyChecked in both input variants. The identical failures reproduce on unmodified master. No other fixture failures were observed; the legacy suites were invoked separately because this existing TestX failure gates the normal runner.Rebase
Rebased onto freshly fetched upstream master
750e1e8eon November 3, 2026. Both test-runner registration conflicts were resolved by retaining master's reduction regressions alongside this PR's identity regressions. The PR remains two focused commits directly above master. All validation results above were rerun after the rebase.The earlier performance table used the previous master base and has been removed. Performance measurements have not been rerun against this new base; no timing or allocation claims are made for the rebased branch.