pascal-lab / Tai-e

An easy-to-learn/use static analysis framework for Java
https://tai-e.pascal-lab.net/docs/index.html
GNU Lesser General Public License v3.0
1.35k stars 171 forks source link

Is it possible to cache the analysis results of classes in jdk? #29

Closed struce2 closed 1 year ago

struce2 commented 1 year ago

Tai-e is resident in memory as a service, so as to avoid repeated analysis of public classes in jdk.

silverbullettt commented 1 year ago

By default, Tai-e dose not delete analysis results after running analyses (unless you specify option --keep-result to only keep results of some specific analyses). So if you write another program that calls pascal.taie.Main.main(args), then after Main.main(args) finishes, the analysis results still stay in memory, and you can obtain them via World.get().get....

struce2 commented 1 year ago

I have 2 programs A and B, after analyzing A, if I want to analyze B, I need to call initSoot, in initSoot, internalTransform calls builder.build, in builder.build, it will reset theWorld to null.

These two programs seem to analyze the classes in jdk when analyzing, like this case, can we share the analysis result of jdk? So that we don't have to analyze the jdk 2 times? I don't know if this is possible.

silverbullettt commented 1 year ago

It is impossible in current architecture. Tai-e (relies on Soot) builds closed world via a reference analysis, and A and B may reference different classes in JDK, so they cannot directly share JDK classes. We would try to reuse abstraction of JDK (e.g., IR, JClass, etc.) in the future.