Skip to content

Language: global const and define() for VM/JIT/AOT (#204)#690

Merged
PurHur merged 2 commits into
masterfrom
feat/global-constants-204
May 22, 2026
Merged

Language: global const and define() for VM/JIT/AOT (#204)#690
PurHur merged 2 commits into
masterfrom
feat/global-constants-204

Conversation

@PurHur
Copy link
Copy Markdown
Owner

@PurHur PurHur commented May 22, 2026

Summary

  • Register top-level const and compile-time-folded define('NAME', literal) via TYPE_DECLARE_GLOBAL_CONST in the compiler, VM, and JIT preamble.
  • Add define() and defined() stdlib builtins (VM execute; define() folded to global const for JIT/AOT when name/value are literals).
  • Extend JIT binaryOp TYPE_PLUS for __value__ boxes so echo X + Y works in AOT binaries.

Test plan

  • docker run … ./script/docker-ci-local.sh --filter 'global_const_define|const_global|define_runtime|const_define_sum|class_const'
  • Compliance PHPT: const_global, define_runtime, const_define_sum, class_const
  • AOT fixture: global_const_define.phpt

Closes #204

Made with Cursor

PurHur and others added 2 commits May 22, 2026 21:54
Register top-level const and folded define() via TYPE_DECLARE_GLOBAL_CONST,
add define()/defined() stdlib builtins, and extend JIT binary + for __value__
boxes so constant arithmetic works in native binaries.

Co-authored-by: Cursor <cursoragent@cursor.com>
Regenerate bootstrap-inventory.md after merge.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit 5248620 into master May 22, 2026
@PurHur PurHur deleted the feat/global-constants-204 branch May 22, 2026 21:54
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.

Language: User-defined constants (const, define()) and class constants

1 participant