73 lines
2.2 KiB
Markdown
73 lines
2.2 KiB
Markdown
# 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
|
|
|
|
1. Ordenacao de funcoes ainda pode depender de string legado.
|
|
2. Entrypoint pode cair em selecao name-only, mantendo ambiguidade residual.
|
|
3. Contrato qualificado existe, mas nao e estrito.
|
|
|
|
## Target
|
|
|
|
Tornar lowering estritamente orientado por identidade:
|
|
|
|
1. ordenacao por `ModuleId -> modulePool` somente,
|
|
2. entrypoint obrigatoriamente qualificado (`entryPointModuleId + callableName`),
|
|
3. remover fallback textual/heuristico.
|
|
|
|
## Dependencies
|
|
|
|
Prerequisitos diretos:
|
|
|
|
1. `PR-09.1`
|
|
2. `PR-09.2`
|
|
|
|
## Scope
|
|
|
|
1. Atualizar `LowerToIRVMService` para eliminar `fallbackModuleKey`.
|
|
2. Validar presenca obrigatoria de `entryPointModuleId` para entrada executavel.
|
|
3. Atualizar testes de ordenacao, ambiguidades e erros deterministas.
|
|
|
|
## Non-Goals
|
|
|
|
1. Nao alterar regra `func_id=0` (continua entrypoint).
|
|
2. Nao alterar emissao de opcodes.
|
|
|
|
## Method
|
|
|
|
### O que deve ser feito explicitamente
|
|
|
|
1. Substituir `moduleSortKey(...)` textual por leitura canonica direta do `modulePool` indexado por `ModuleId`.
|
|
2. Em `orderFunctions`, rejeitar entrada sem `entryPointModuleId`.
|
|
3. Remover caminho de erro/controle baseado em entrypoint name-only.
|
|
4. Cobrir com testes:
|
|
- entrypoint qualificado valido,
|
|
- entrypoint qualificado ausente,
|
|
- homonimos em modulos distintos com qualificacao.
|
|
|
|
## Acceptance Criteria
|
|
|
|
1. Nenhum fallback para `moduleKey` no LowerToIRVM.
|
|
2. Entrypoint e sempre resolvido por identidade qualificada.
|
|
3. Determinismo preservado em rebuild equivalente.
|
|
|
|
## Tests
|
|
|
|
1. `:prometeu-compiler:prometeu-build-pipeline:test --tests *LowerToIRVMServiceTest*`
|
|
2. `:prometeu-compiler:prometeu-build-pipeline:test --tests *BackendSafetyGateSUTest*`
|
|
|
|
## Affected Documents
|
|
|
|
1. `docs/general/specs/20. IRBackend to IRVM Lowering Specification.md`
|
|
2. `docs/general/specs/15. Bytecode and PBX Mapping Specification.md`
|
|
3. `docs/general/specs/22. Backend Spec-to-Test Conformance Matrix.md`
|
|
|
|
## Open Questions
|
|
|
|
1. Nenhuma. Esta PR fecha o fallback de entrypoint name-only.
|