Observation
During boot, the L1A (X86 bytecode visitor) emits multiple warnings of the form:
HH:MM:SS,mmm WARN Unbalanced item handling in org.jnode.core.BootInfos-scanManifestResource(Ljava/io/InputStream;)V
HH:MM:SS,mmm WARN Unbalanced item handling in org.jnode.core.BundleLauncherService-launch(Lorg/jnode/core/BundleLauncherService;)V
The ItemFactory maintains an active-list stack tracking operand items during L1A bytecode translation. The logWarning() method fires when activeCount != expected, indicating an imbalance between pushes and pops tracked by the visitor.
What we know
- Log site:
X86BytecodeVisitor.java — now routed through BootLog (previously raw System.out)
- Detection:
ItemFactory.isBalanced(int expected) compares activeCount (tracking depth relative to maxStack) against an expected delta
- Files involved:
core/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java — the L1A visitor that translates each bytecode
core/src/core/org/jnode/vm/x86/compiler/l1a/ItemFactory.java — manages the active list of operand items
core/src/core/org/jnode/vm/x86/compiler/l1a/X86StackFrame.java — stack frame setup
- Affected methods seen in boot:
BootInfos.scanManifestResource, BundleLauncherService.launch
Questions to investigate
- Root cause: Is the imbalance a real correctness issue (compiled code has wrong stack handling), or a bookkeeping quirk of the active-list tracking (e.g., dead items, exception handler boundaries, or phi merges)?
- Scope: Does it affect only these two methods, or does it fire more widely at DEBUG level? Boot with
log4j.logger.org.jnode.vm.x86.compiler.l1a=DEBUG to see full output.
- Downstream effect: Can the affected methods be compiled and run successfully despite the warning? (They appear to work in practice.)
- Correctness: Verify the active-list delta accounting against the bytecode verifier's
maxStack — if the warning indicates a real mismatch, the compiled native code may have a subtle stack layout error in the JIT.
- Reproduction: Can we write a focused unit test that reproduces the imbalance with a minimal bytecode snippet?
Environment
- Seen during standard
cd-x86-combined-lite boot (VirtualBox + serial console)
- L1A compiler on both x86 and x86_64
Observation
During boot, the L1A (X86 bytecode visitor) emits multiple warnings of the form:
The
ItemFactorymaintains an active-list stack tracking operand items during L1A bytecode translation. ThelogWarning()method fires whenactiveCount != expected, indicating an imbalance between pushes and pops tracked by the visitor.What we know
X86BytecodeVisitor.java— now routed through BootLog (previously rawSystem.out)ItemFactory.isBalanced(int expected)comparesactiveCount(tracking depth relative tomaxStack) against an expected deltacore/src/core/org/jnode/vm/x86/compiler/l1a/X86BytecodeVisitor.java— the L1A visitor that translates each bytecodecore/src/core/org/jnode/vm/x86/compiler/l1a/ItemFactory.java— manages the active list of operand itemscore/src/core/org/jnode/vm/x86/compiler/l1a/X86StackFrame.java— stack frame setupBootInfos.scanManifestResource,BundleLauncherService.launchQuestions to investigate
log4j.logger.org.jnode.vm.x86.compiler.l1a=DEBUGto see full output.maxStack— if the warning indicates a real mismatch, the compiled native code may have a subtle stack layout error in the JIT.Environment
cd-x86-combined-liteboot (VirtualBox + serial console)