Commit 234d35c
committed
Fix AOT namespace reloading issue that broke test runner
This fixes a critical bug where AOT-compiled namespaces would reinitialize
their vars (including *loaded-libs*) when required multiple times, causing
test failures when using the test runner with dynamic bindings.
Problem:
- When clojure.data.generators required clojure.core, the AOT loader
would reinitialize *loaded-libs*, removing previously loaded namespaces
- This caused clojure.test to be reloaded inside the test runner's
binding of t/report, leading to "no such method AddMethod" errors
when defmethod tried to add methods to a bound function
Solution:
- Made AOT loaders idempotent by checking namespace metadata before
initializing
- Each LoadNS() function now:
1. Checks if namespace has :aot-loaded metadata
2. Returns immediately if already loaded
3. Sets :aot-loaded metadata after initialization
- This preserves *loaded-libs* and all other dynamic vars across
multiple requires
Changes:
- Modified pkg/runtime/codegen.go to generate idempotent LoadNS functions
- Regenerated all AOT loader files with the new logic
- Updated Makefile test targets (from previous commit)
This ensures AOT namespaces are only initialized once, preventing the
corruption of global state like *loaded-libs* and fixing the multimethod
binding issues in the test runner.1 parent 5d9b908 commit 234d35c
12 files changed
Lines changed: 1042 additions & 830 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
239 | 250 | | |
240 | 251 | | |
241 | 252 | | |
| |||
347 | 358 | | |
348 | 359 | | |
349 | 360 | | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
350 | 374 | | |
351 | 375 | | |
352 | 376 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments