Working on backend compiler - I want to compile a ...
# kontributors
m
Working on backend compiler - I want to compile a project, but not have to wait for the frontend each time. Can I dump a tree after frontend or after psi2ir and on each run load it from disk and continue from there?
d
No, currently this is not possible. But what is your usecase? If something was changed in project code then you anyway need to run frontend on changed files. And if nothing was changed then incremental compilation will understand that and won't run compiler at all, just reuses binaries from previous compilation
m
I mean, I want to test the compiler itself, i.e. run (and e.g. profile) the lowering phases.
d
Got it. You can only run profiler for whole compilation
m
So there is a built-in profiler? But I want to use external jvm profiler anyway. But even just for debugging etc. it would be nice to skip the 20-second or something frontend part and jump right in. I'm free to modify the entrypoint of the compiler ofc, just looking for a function like `loadIrFromFile`or something.
d
So there is a built-in profiler?
Not, there isn't. We usually use external async profiler
ust looking for a function like 
loadIrFromFile
or something
AFAIK saving IR to file (klib) is fully supported only for JS/IR backend. Native has some support for (idk how full is it) and JVM/IR can't do it at all
nice to skip the 20-second
Can understand your pain (sometimes I face with it by myself). The easiest way to reduce this time is just to run compiler not on whole project but on some smaller module
m
AFAIK saving IR to file (klib) is fully supported only for JS/IR backend
Ok, so for JS the klib is the way to go?
compiler not on whole project but on some smaller module
The problem is I want to test on the bigger ones too.. Btw. all unit tests also work this way - run through frontend and then go to backend? Or are there any direct backend IR tests?
d
Ok, so for JS the klib is the way to go?
Maybe. It's better to ask someone from JS team (cc @bashor)
Btw. all unit tests also work this way - run through frontend and then go to backend?
Yep. All tests run
frontend
->
converter
->
backend
pipeline
👍 1
b
Yeah, using klib should be the simplest way for that.