Commit 7050e4d
gen: ebmcodegen emits shared body + thin wrappers (ADR 0047)
Replace per-language full copies of generated main.cpp (77k lines) and
codegen.hpp (6.5k lines) across 18 generators (~1.5M lines total) with:
- shared language-agnostic bodies in src/ebmcodegen/generated/
(class_{codegen,interpret}_{source,header}.inc), where the namespace is
parameterized via the CODEGEN_NAMESPACE macro and per-language strings
are built with EBMCG_STRINGIFY(CODEGEN_NAMESPACE) / CODEGEN_LANG_NAME
- per-language thin wrappers (7 lines) that define those macros and
include the shared body
- new GenerateMode variants <class-mode>-{wrapper,body} following the
"artifact kind = mode" convention
- generated CMakeLists gains target_include_directories(PRIVATE .) so the
shared body's __has_include("visitor/...") resolves per language via -I
(verified: quote-include falls back to -I when the body's own directory
has no visitor/ subdir; the body dir must never contain one)
- script/ebmcodegen.py writes all outputs via write-if-changed to keep
rebuild granularity per language
Net effect: tracked generated text shrinks by ~1.33M lines (94%).
Compile time is unchanged by design; ebmgen-visitor mode and the ebm2all
dummy header keep the non-parameterized emission path.
No regression: ebm2go unictest 209/216 and ebm2rmw 53/54 exactly match
the CI main baseline (same failing inputs); old vs new ebm2go/rust/c
binaries produce byte-identical output on the same EBM inputs.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 37b53f4 commit 7050e4d
64 files changed
Lines changed: 167391 additions & 1502355 deletions
File tree
- rebrgen
- docs/decisions
- script
- src
- ebmcg
- ebm2cpp
- ebm2csharp
- ebm2c
- ebm2go
- ebm2java
- ebm2llvm
- ebm2p4
- ebm2python
- ebm2ruby
- ebm2rust
- ebm2scala
- ebm2ts
- ebm2wuffs
- ebm2z3
- ebm2zig
- ebmcodegen
- generated
- stub
- ebmip
- ebm2ascii
- ebm2json
- ebm2rmw
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 88 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
17 | 64 | | |
18 | 65 | | |
19 | 66 | | |
| |||
74 | 121 | | |
75 | 122 | | |
76 | 123 | | |
77 | | - | |
78 | | - | |
79 | 124 | | |
| 125 | + | |
| 126 | + | |
80 | 127 | | |
81 | 128 | | |
82 | 129 | | |
83 | 130 | | |
84 | | - | |
| 131 | + | |
85 | 132 | | |
86 | 133 | | |
87 | | - | |
88 | | - | |
89 | 134 | | |
90 | 135 | | |
91 | 136 | | |
92 | 137 | | |
93 | 138 | | |
94 | 139 | | |
95 | 140 | | |
96 | | - | |
| 141 | + | |
97 | 142 | | |
98 | 143 | | |
99 | | - | |
100 | | - | |
101 | 144 | | |
102 | 145 | | |
103 | 146 | | |
| |||
109 | 152 | | |
110 | 153 | | |
111 | 154 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 155 | + | |
| 156 | + | |
116 | 157 | | |
117 | | - | |
118 | | - | |
| 158 | + | |
119 | 159 | | |
120 | 160 | | |
121 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
0 commit comments