Commit 02e3372
feat(#533): inline small-enum constants in _data to avoid boxing
Extend the inline-constant path to cover enum types whose underlying type
is ≤ 32 bits (byte/sbyte/char/short/ushort/int/uint — virtually all C# enums).
Raw bits are stored in _data via System.Convert.ToInt64 + uint cast; the
Reader reconstructs the typed enum via Enum.ToObject using the underlying
TypeCode. Long/ulong-backed enums (extremely rare) continue to be boxed
in Obj.
Add FlatExpressionThrow.UnsupportedInlineConstantType(Type, TypeCode)
overload for the error path in ReadInlineValue.
Add Flat_enum_constant_stored_inline_roundtrip test covering all six
underlying types (byte/sbyte/short/ushort/int/uint), verifying no
ClosureConstants allocation and correct value round-trip. (1679 tests)
Agent-Logs-Url: https://github.com/dadhi/FastExpressionCompiler/sessions/0ffda673-c511-49f5-ad08-e070318b3781
Co-authored-by: dadhi <39516+dadhi@users.noreply.github.com>1 parent 170ad90 commit 02e3372
2 files changed
Lines changed: 78 additions & 5 deletions
File tree
- src/FastExpressionCompiler.LightExpression
- test/FastExpressionCompiler.LightExpression.UnitTests
Lines changed: 40 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
| 193 | + | |
194 | 194 | | |
195 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
196 | 205 | | |
197 | 206 | | |
198 | 207 | | |
| |||
1003 | 1012 | | |
1004 | 1013 | | |
1005 | 1014 | | |
1006 | | - | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
1007 | 1024 | | |
| 1025 | + | |
1008 | 1026 | | |
1009 | 1027 | | |
1010 | 1028 | | |
| |||
1669 | 1687 | | |
1670 | 1688 | | |
1671 | 1689 | | |
1672 | | - | |
1673 | | - | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
1674 | 1705 | | |
1675 | 1706 | | |
1676 | 1707 | | |
| |||
1683 | 1714 | | |
1684 | 1715 | | |
1685 | 1716 | | |
| 1717 | + | |
1686 | 1718 | | |
1687 | 1719 | | |
1688 | 1720 | | |
| |||
1722 | 1754 | | |
1723 | 1755 | | |
1724 | 1756 | | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
1725 | 1761 | | |
1726 | 1762 | | |
1727 | 1763 | | |
| |||
Lines changed: 38 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
649 | 650 | | |
650 | 651 | | |
651 | 652 | | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
652 | 689 | | |
653 | 690 | | |
0 commit comments