Skip to content

enable identifier hash-consing - #1745

Merged
swissiety merged 8 commits into
developfrom
feature/hash-cons-identifiers
Sep 22, 2026
Merged

swissiety merged 8 commits into
developfrom
feature/hash-cons-identifiers

Conversation

@swissiety

Copy link
Copy Markdown
Collaborator

What does this PR address? (Why)
hide ctor of ClassType,MethodSignature etc. to enfore the usage of the IdentifierFactory. That change allows us to use == and IdentityHashMaps for these objects in the future to improve performance.

Checklist
[x] yes

…through IdentifierFactory

- JavaIdentifierFactory/JavaModuleIdentifierFactory: cache MethodSignature,
  FieldSignature, MethodSubSignature and FieldSubSignature (weak-value Guava
  caches), matching the existing ClassType cache. Equal signatures are now
  the same instance, so callers may compare with ==.
- Route STATIC_INITIALIZER through the same subsignature cache.
- Replace raw new ClassType/MethodSignature/FieldSignature/MethodSubSignature/
  FieldSubSignature construction with IdentifierFactory calls across
  production code (ICFGDotExporter, AbstractCallGraphAlgorithm, apk.frontend
  FieldInstruction/MethodInvocationInstruction, EnumConstant, JavaJimple,
  spark ValueToNodeConversionVisitor) and the remaining test call sites that
  still built ClassTypes directly.
- Add tests asserting hash-consing (assertSame across repeated lookups).
# Conflicts:
#	sootup.qilin/src/main/java/qilin/core/pag/PAG.java
#	sootup.qilin/src/main/java/qilin/util/PTAUtils.java
@swissiety
swissiety enabled auto-merge September 21, 2026 09:02
qilin.util.JavaTypes still called the removed JavaIdentifierFactory
singleton, which broke the build of sootup.qilin and with it the Test,
style and documentation CI jobs. Its well-known JDK types are created
via JavaClassType.of now, and the method-kind checks take the View whose
IdentifierFactory they ask.

Documentation:
- migrating.md/whatsnew.md describe the hidden constructors, the
  identity guarantee and the replacements for the removed getInstance()
  methods.
- the constructor javadoc in JavaClassType had been separated from the
  constructor by the new interner field.

Test JVM: surefire ran whole test classes in parallel with unlimited
threads, so the peak memory of a run was bounded by nothing but the size
of the suite. It parallelises classes only now, and heap and thread
count are properties, so machines with less memory than CI can dial them
down (-Dsurefire.threadCount=1 -Dsurefire.maxHeap=3072M).
The test arrived on develop while this branch added an IdentifierFactory
parameter to AsmUtil.createAnnotationUsage, so the merged state did not
compile.
@codecov

codecov Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.61749% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.64%. Comparing base (ddc9f92) to head (afa4547).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #1745      +/-   ##
=============================================
+ Coverage      72.63%   72.64%   +0.01%     
+ Complexity       239      238       -1     
=============================================
  Files            486      486              
  Lines          20744    20796      +52     
  Branches        3398     3396       -2     
=============================================
+ Hits           15067    15108      +41     
- Misses          4373     4383      +10     
- Partials        1304     1305       +1     
Components Coverage Δ
core 66.52% <81.39%> (+0.01%) ⬆️
java.core 74.04% <98.52%> (+0.01%) ⬆️
java.bytecode.frontend 80.91% <92.48%> (+0.08%) ⬆️
jimple.frontend 70.70% <100.00%> (+0.06%) ⬆️
apk.frontend 77.07% <80.45%> (-0.11%) ⬇️
interceptors 73.47% <ø> (-0.09%) ⬇️
callgraph 85.42% <100.00%> (+0.03%) ⬆️
codepropertygraph 74.35% <ø> (ø)
analysis.intraprocedural 63.86% <ø> (ø)
analysis.interprocedural 68.26% <100.00%> (+0.35%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

# Conflicts:
#	sootup.java.bytecode.frontend/src/main/java/sootup/java/bytecode/frontend/conversion/AsmMethodSource.java
@swissiety
swissiety force-pushed the feature/hash-cons-identifiers branch from 4c3260f to 4f5beed Compare September 22, 2026 12:15
@swissiety
swissiety force-pushed the feature/hash-cons-identifiers branch from 4f5beed to afa4547 Compare September 22, 2026 12:18
@github-actions

Copy link
Copy Markdown
Contributor

@swissiety
swissiety added this pull request to the merge queue Sep 22, 2026
Merged via the queue into develop with commit b17fb1a Sep 22, 2026
11 checks passed
@swissiety
swissiety deleted the feature/hash-cons-identifiers branch September 22, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants