ykjit / yk

yk packages
https://ykjit.github.io/yk/
Other
28 stars 7 forks source link

Use specific "testing only" `CompiledTrace` instances. #1264

Closed ltratt closed 1 month ago

ltratt commented 1 month ago

Previously we abused LLVMCompiledTrace to also be the generic "use a CompiledTrace that doesn't do much except in testing". This wasn't ideal for several reasons, and since we soon want to remove the LLVM backend, the time has come to remove this.

The solution this commit introduces is relatively simple: we provide two new test-only structs (CompiledTraceTesting and CompiledTraceTestingWithHl) that implement the CompiledTrace trait. This gives the effect we want in tests without overloading LLVMCompiledTrace.

Note: we could have provided only 1 struct, and used an Option type for the HotLocation. That said, forcing the user to choose what they want makes it clearer what testing-only functionality they want in different testing scenarios, which seems helpful.