0xMiden / 0xMiden/compiler

Fix `felt!` macro to use `Felt::from_u64_unchecked` (instead of `from_u32`)

Aberta
#361 3 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Rust
Estrelas
115
Forks
84
Merge médio
1d 8h
PRs com merge (30d)
15

Descrição

### What
As discovered in #357, we parse `u64` constants as two `i32` parts on the stack, which makes translating `from_u64_unchecked` calls to `bitcast` op non-optimal. So, temporarily, in #357 I switched for `felt!` macro to use `Felt::from_u32`.

### How
The easiest way is to `peek` into the next translated op in the frontend, and if it's a `Felt::from_u64_unchecked` call translate `u64` constant as one `u64` value on the stack. Alternative would be to allow to alter `n` previous translated ops, i.e. convert `push.i32.i32` to `push.u64`.

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Look at the `felt!` macro implementation and the frontend translation logic. The issue mentions peeking at the next translated op to optimize `u64` constant handling for `Felt::from_u64_unchecked`. Start by finding where constants are parsed and how they are placed on the stack. Check the related PR #357 for context. The goal is to change the macro to use `from_u64_unchecked` efficiently, possibly by adjusting the constant representation.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
rust
Domínio
compilers
Tipo de issue
Bug
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
45/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.