Skip to content

Generate complete clean-target headers and drop test patches#4494

Merged
shai-almog merged 1 commit intomasterfrom
codex/investigate-patchcn1globals-in-tests
Feb 6, 2026
Merged

Generate complete clean-target headers and drop test patches#4494
shai-almog merged 1 commit intomasterfrom
codex/investigate-patchcn1globals-in-tests

Conversation

@shai-almog
Copy link
Collaborator

Motivation

  • Ensure the Bytecode translator emits self-contained, correct C/Obj-C headers so generated projects build without test-time header fixes.
  • Prevent tests from mutating generated translator output at runtime, which masked generator bugs and caused flaky behavior.

Description

  • Add an Objective-C forward declaration for NSString to cn1_globals.h so generated headers are self-contained for Obj-C builds (vm/ByteCodeTranslator/src/cn1_globals.h).
  • Unconditionally emit virtual method function-pointer typedefs, wrappers and header declarations from the translator by removing the virtualMethodsInvoked guard in appendVirtualMethodC/appendVirtualMethodHeader (vm/ByteCodeTranslator/src/com/codename1/tools/translator/BytecodeMethod.java).
  • Remove test-time patching helpers and calls that modified generated headers (remove patchCn1Globals and ensureReentrantReadWriteLockHeader usages), and update integration tests to build the generated source as-is (vm/tests/src/test/java/com/codename1/tools/translator/*).
  • Update CompilerHelper and several integration tests to stop calling the removed patch routines so tests no longer alter translator output (vm/tests/.../CompilerHelper.java, BytecodeInstructionIntegrationTest.java, CleanTargetIntegrationTest.java, FileClassIntegrationTest.java, LambdaIntegrationTest.java, LockIntegrationTest.java, ReadWriteLockIntegrationTest.java, StampedLockIntegrationTest.java).

Testing

  • No automated tests were executed as part of this change (no CI/test run was requested).

Codex Task

@github-actions
Copy link

github-actions bot commented Feb 5, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@github-actions
Copy link

github-actions bot commented Feb 5, 2026

✅ ByteCodeTranslator Quality Report

Test & Coverage

  • Tests: 135 total, 0 failed, 2 skipped

Benchmark Results

  • Execution Time: 9921 ms

  • Hotspots (Top 20 sampled methods):

    • 22.37% java.lang.String.indexOf (385 samples)
    • 18.13% com.codename1.tools.translator.Parser.isMethodUsed (312 samples)
    • 15.46% com.codename1.tools.translator.Parser.addToConstantPool (266 samples)
    • 8.60% java.util.ArrayList.indexOf (148 samples)
    • 4.59% java.lang.Object.hashCode (79 samples)
    • 3.78% com.codename1.tools.translator.ByteCodeClass.calcUsedByNative (65 samples)
    • 2.67% com.codename1.tools.translator.ByteCodeClass.fillVirtualMethodTable (46 samples)
    • 2.56% com.codename1.tools.translator.BytecodeMethod.optimize (44 samples)
    • 2.44% java.lang.System.identityHashCode (42 samples)
    • 1.45% com.codename1.tools.translator.BytecodeMethod.equals (25 samples)
    • 1.34% java.io.FileOutputStream.writeBytes (23 samples)
    • 0.93% com.codename1.tools.translator.Parser.cullMethods (16 samples)
    • 0.93% com.codename1.tools.translator.Parser.generateClassAndMethodIndexHeader (16 samples)
    • 0.81% java.lang.StringBuilder.append (14 samples)
    • 0.76% java.io.FileOutputStream.open0 (13 samples)
    • 0.76% com.codename1.tools.translator.BytecodeMethod.isMethodUsedByNative (13 samples)
    • 0.70% com.codename1.tools.translator.Parser.getClassByName (12 samples)
    • 0.64% com.codename1.tools.translator.BytecodeMethod.addToConstantPool (11 samples)
    • 0.64% com.codename1.tools.translator.ByteCodeClass.markDependent (11 samples)
    • 0.58% java.io.FileInputStream.open0 (10 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
Collaborator Author

shai-almog commented Feb 5, 2026

Compared 30 screenshots: 30 matched.
✅ Native Android screenshot tests passed.

Benchmark Results

  • VM Translation Time: 298 seconds
  • Compilation Time: 362 seconds

Detailed Performance Metrics

Metric Duration
Build Time Statistics
Setup & Unzip 28745 ms
Extract Extensions 22 ms
Google Services Setup 3 ms
Scan Classes 763 ms
Extract Libs 706 ms
Inject Build Hints 35 ms
Generate Unit Tests 2 ms
Generate Stubs 1010 ms
Compile Stubs 2155 ms
Generate Icons 1008 ms
Prepare ParparVM 187 ms
ParparVM Execution 170586 ms
Post-VM Setup 167 ms
CocoaPods 5320 ms
Finalize 15 ms
Total Time 210725 msMaven Overhead : 88000 ms
CocoaPods Install (Script) 1000 ms
Simulator Boot 119000 ms
Simulator Boot (Run) 3000 ms
App Install 15000 ms
App Launch 4000 ms
Test Execution 178000 ms

@shai-almog shai-almog merged commit 1c6189b into master Feb 6, 2026
12 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.

1 participant