2.2 KiB
2.2 KiB
PR-09.3 - LowerToIRVM: ModuleId-Only Ordering + Strict Qualified Entrypoint
Briefing
LowerToIRVMService ainda possui fallback para moduleKey textual e fallback de entrypoint por nome quando entryPointModuleId nao e informado.
Motivation
Dor atual que esta PR resolve
- Ordenacao de funcoes ainda pode depender de string legado.
- Entrypoint pode cair em selecao name-only, mantendo ambiguidade residual.
- Contrato qualificado existe, mas nao e estrito.
Target
Tornar lowering estritamente orientado por identidade:
- ordenacao por
ModuleId -> modulePoolsomente, - entrypoint obrigatoriamente qualificado (
entryPointModuleId + callableName), - remover fallback textual/heuristico.
Dependencies
Prerequisitos diretos:
PR-09.1PR-09.2
Scope
- Atualizar
LowerToIRVMServicepara eliminarfallbackModuleKey. - Validar presenca obrigatoria de
entryPointModuleIdpara entrada executavel. - Atualizar testes de ordenacao, ambiguidades e erros deterministas.
Non-Goals
- Nao alterar regra
func_id=0(continua entrypoint). - Nao alterar emissao de opcodes.
Method
O que deve ser feito explicitamente
- Substituir
moduleSortKey(...)textual por leitura canonica direta domodulePoolindexado porModuleId. - Em
orderFunctions, rejeitar entrada sementryPointModuleId. - Remover caminho de erro/controle baseado em entrypoint name-only.
- Cobrir com testes:
- entrypoint qualificado valido,
- entrypoint qualificado ausente,
- homonimos em modulos distintos com qualificacao.
Acceptance Criteria
- Nenhum fallback para
moduleKeyno LowerToIRVM. - Entrypoint e sempre resolvido por identidade qualificada.
- Determinismo preservado em rebuild equivalente.
Tests
:prometeu-compiler:prometeu-build-pipeline:test --tests *LowerToIRVMServiceTest*:prometeu-compiler:prometeu-build-pipeline:test --tests *BackendSafetyGateSUTest*
Affected Documents
docs/general/specs/20. IRBackend to IRVM Lowering Specification.mddocs/general/specs/15. Bytecode and PBX Mapping Specification.mddocs/general/specs/22. Backend Spec-to-Test Conformance Matrix.md
Open Questions
- Nenhuma. Esta PR fecha o fallback de entrypoint name-only.