Skip to content

Fix concrete invoke dependency resolution when method context is null#4750

Merged
liannacasper merged 2 commits intomasterfrom
codex/investigate-native-method-declaration-issue
Apr 14, 2026
Merged

Fix concrete invoke dependency resolution when method context is null#4750
liannacasper merged 2 commits intomasterfrom
codex/investigate-native-method-declaration-issue

Conversation

@liannacasper
Copy link
Copy Markdown
Collaborator

Motivation

  • Dependency collection could run without a method context, and resolveConcreteInvokeOwner() previously bail/returned null when getMethod() was unavailable which caused concrete-class header/includes to be skipped and later produced calls to targets without declarations.

Description

  • Stop requiring getMethod() to be non-null in Invoke.resolveConcreteInvokeOwner() and CustomInvoke.resolveConcreteInvokeOwner() so concrete-owner resolution can run during dependency analysis even when no method context exists.
  • Make the currentClass lookup null-safe and keep the self/inner-class guard only when currentClass is present.
  • Changes touch vm/ByteCodeTranslator/src/com/codename1/tools/translator/bytecodes/Invoke.java and .../CustomInvoke.java with small, equivalent edits in both files.

Testing

  • Ran mvn -f vm/ByteCodeTranslator/pom.xml -DskipTests compile which succeeded.
  • Attempted the Java 8 setup export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 && export PATH="$JAVA_HOME/bin:$PATH" && mvn -f vm/ByteCodeTranslator/pom.xml -DskipTests compile but that failed because the documented Java 8 path is not available in this environment.

Codex Task

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

✅ ByteCodeTranslator Quality Report

Test & Coverage

  • Tests: 381 total, 0 failed, 2 skipped

Benchmark Results

  • Execution Time: 10302 ms

  • Hotspots (Top 20 sampled methods):

    • 26.55% java.util.ArrayList.indexOf (488 samples)
    • 23.72% java.lang.String.indexOf (436 samples)
    • 19.80% com.codename1.tools.translator.Parser.isMethodUsed (364 samples)
    • 3.70% java.lang.Object.hashCode (68 samples)
    • 2.50% java.lang.System.identityHashCode (46 samples)
    • 1.52% com.codename1.tools.translator.ByteCodeClass.calcUsedByNative (28 samples)
    • 1.36% com.codename1.tools.translator.BytecodeMethod.optimize (25 samples)
    • 1.14% com.codename1.tools.translator.BytecodeMethod.appendCMethodPrefix (21 samples)
    • 0.82% com.codename1.tools.translator.Parser.cullMethods (15 samples)
    • 0.76% com.codename1.tools.translator.ByteCodeClass.markDependent (14 samples)
    • 0.76% com.codename1.tools.translator.Parser.getClassByName (14 samples)
    • 0.76% com.codename1.tools.translator.BytecodeMethod.isMethodUsedByNative (14 samples)
    • 0.65% java.lang.StringBuilder.append (12 samples)
    • 0.60% java.lang.Integer.getChars (11 samples)
    • 0.60% com.codename1.tools.translator.BytecodeMethod.addToConstantPool (11 samples)
    • 0.60% com.codename1.tools.translator.bytecodes.Invoke.addDependencies (11 samples)
    • 0.60% java.lang.StringCoding.encode (11 samples)
    • 0.54% com.codename1.tools.translator.Parser.generateClassAndMethodIndexHeader (10 samples)
    • 0.49% com.codename1.tools.translator.BytecodeMethod.appendMethodSignatureSuffixFromDesc (9 samples)
    • 0.49% com.codename1.tools.translator.ByteCodeClass.markDependencies (9 samples)
  • ⚠️ Coverage report not generated.

Static Analysis

  • ✅ SpotBugs: no findings (report was not generated by the build).
  • ⚠️ PMD report not generated.
  • ⚠️ Checkstyle report not generated.

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Copy Markdown
Collaborator

shai-almog commented Apr 14, 2026

Compared 37 screenshots: 37 matched.
✅ Native iOS screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 114 seconds

Detailed Performance Metrics

Metric Duration
Simulator Boot 1000 ms
Simulator Boot (Run) 0 ms
App Install 2000 ms
App Launch 3000 ms
Test Execution 170000 ms
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 1962.000 ms
Base64 CN1 encode 2123.000 ms
Base64 encode ratio (CN1/native) 1.082x (8.2% slower)
Base64 native decode 1270.000 ms
Base64 CN1 decode 1316.000 ms
Base64 decode ratio (CN1/native) 1.036x (3.6% slower)

@liannacasper liannacasper merged commit c18a383 into master Apr 14, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants