Skip to content

codegen: Pine int is 64-bit — epoch-millisecond int arrays and out-of-int32 literal products (round 8 family U, latibonit15) - #123

Merged
luisleo526 merged 1 commit into
mainfrom
round8/famU-latibonit
Sep 5, 2026
Merged

codegen: Pine int is 64-bit — epoch-millisecond int arrays and out-of-int32 literal products (round 8 family U, latibonit15)#123
luisleo526 merged 1 commit into
mainfrom
round8/famU-latibonit

Conversation

@luisleo526

Copy link
Copy Markdown
Contributor

What

var int[] levelTimes = array.new_int() holding time stamps was emitted as std::vector<int> (truncating epoch milliseconds) and 90*24*60*60*1000 was folded in C++ int (wrapping to −813,934,592), so latibonit15's 3-month level expiry fired on day one. Now: an int array that receives a wide value (time/time_close/timestamp/wide callable) via push/unshift/set/insert/fill or built by new_int/new/from → element int64 (std::vector<int64_t>) at every resolution/registration/declaration/constructor site, element reads carry the provenance; an int-literal-only +−* tree beyond int32 is folded and emitted as a 64-bit literal (in-range trees byte-identical). Population transpile diff over 4116 sources: 15 generated files (latibonit ×9, jevondijefferson ×6 — trades byte-identical). +5 pin tests; full suite green.

Gate

Composite with engine PR pineforge-engine round9/candidate-p (2185c9f): pineforge-pr-gate execution pineforge-pr-gate-qwb9c PASS (score +6, hard 0), recorded for engine 2185c9f / codegen c80926f. latibonit NQ1@15 moderate → excellent, ES1@15 strong → excellent (with the engine side). Merged by fast-forward; promoted with lab promote --composite.

🤖 Generated with Claude Code

https://claude.ai/code/session_01793pKdqw3UST3YdPVsdgpa

…conds is std::vector<int64_t>, and an int-literal product beyond int32 is a 64-bit literal (round 8 family U, latibonit15)

latibonit15 execution-signals-confluence (six non-excellent lanes under
baseline 6c1ec7f: NQ1@15 moderate 94.6, ES1 96.5, F 97.1, XAUUSD 99.8,
EURUSD 99.8, AAPL +1) keeps its 1H level creation times in
``var int[] levelTimes = array.new_int()`` and expires a level when
``(time - existingTime) > 90 * 24 * 60 * 60 * 1000``. Generated as
``std::vector<int> levelTimes`` the ms stamp truncated on push, the element
read into ``int existingTime`` again, and ``((((90 * 24) * 60) * 60) * 1000)``
wrapped to -813 934 592 in C++ int arithmetic -- so every nearby level
"expired" and was replaced on day 1 where TradingView blocks the duplicate
for three months (lab tv u-lati-levels-nq15 vs the engine, 2026-09-05: first
divergence at the 2025-04-02 05:45Z hour, TV code=1102 blocked / engine 1012
expired+added; 2038 of 6385 hours then differ in level count, 744 in the
added level, 1092 in the removal code; the confluence flips entries on and
off because TradingView drops every over-equity confluence entry, family O).

Two rules, both by the codegen's existing wide-int idiom (the epoch-ms
builtins are already promoted to int64_t at member/local/parameter sites):

1. A Pine int array is wide -- TypeSpec element ``int64`` -> ``int64_t`` --
   when it receives a wide value through array.push/unshift/set/insert/fill
   (functional or method form) or is built by array.new_int / array.new<int>
   / array.from from one (``_wide_int_array_names``, a fixpoint over the
   whole AST). The widened spec is applied wherever the name resolves
   (``_collection_spec_for_name``, the registration sites, the member
   declaration) and its constructors spell the same type
   (``_array_ctor_target_name`` at the declaration / first-bar init sites).
   An element read off a wide array (get/first/last/pop/shift/remove/max/min)
   carries the provenance, so ``existingTime = array.get(levelTimes, i)`` is
   ``int64_t``. A user method on ``array<int>`` still binds to it.

2. An int-literal-only ``+ - *`` tree whose exact value leaves int32 is
   folded in Python and emitted as ``static_cast<int64_t>(7776000000LL)``;
   the tree is wide for declaration typing. In-range trees are emitted
   exactly as before.

Population effect (transpile of 4116 scrapper + corpus sources): 15 generated
files change -- latibonit15 on its 9 lanes and jevondijefferson-big-breakout
on 6 (its ``var array<int> times`` receives ``time``); every other script is
byte-identical. tests/test_wide_int_arrays_and_literals.py pins both rules
and the narrow-array control.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013m9vtaC12Wn76TRmknMMY9
@luisleo526
luisleo526 merged commit c80926f into main Sep 5, 2026
9 checks passed
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.

1 participant