Skip to content

Commit

Permalink
Apply missed fixes on llvm 18 pr (lambdaclass#620)
Browse files Browse the repository at this point in the history
* apply missed fixes

* update readme
  • Loading branch information
edg-l authored and Gerson2102 committed May 26, 2024
1 parent e48a304 commit e284cfa
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 23 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ This is a list of the current progress implementing each **libfunc**.
1. `call_contract_syscall` (StarkNet)
1. `class_hash_to_felt252` (StarkNet)
1. `class_hash_try_from_felt252` (StarkNet)
1. `const_as_box`
1. `contract_address_const` (StarkNet)
1. `contract_address_to_felt252` (StarkNet)
1. `contract_address_try_from_felt252` (StarkNet)
Expand Down Expand Up @@ -134,6 +135,16 @@ This is a list of the current progress implementing each **libfunc**.
1. `rename`
1. `replace_class_syscall` (StarkNet)
1. `revoke_ap_tracking`
1. `secp256k1_add_syscall` (StarkNet)
1. `secp256k1_get_point_from_x_syscall` (StarkNet)
1. `secp256k1_get_xy_syscall` (StarkNet)
1. `secp256k1_mul_syscall` (StarkNet)
1. `secp256k1_new_syscall` (StarkNet)
1. `secp256r1_add_syscall` (StarkNet)
1. `secp256r1_get_point_from_x_syscall` (StarkNet)
1. `secp256r1_get_xy_syscall` (StarkNet)
1. `secp256r1_mul_syscall` (StarkNet)
1. `secp256r1_new_syscall` (StarkNet)
1. `send_message_to_l1_syscall` (StarkNet)
1. `snapshot_take` (1)
1. `span_from_tuple`
Expand Down Expand Up @@ -214,18 +225,7 @@ This is a list of the current progress implementing each **libfunc**.

<details>
<summary>Not yet implemented libfuncs (click to open)</summary>

1. `const_as_box`
1. `secp256k1_add_syscall` (StarkNet)
1. `secp256k1_get_point_from_x_syscall` (StarkNet)
1. `secp256k1_get_xy_syscall` (StarkNet)
1. `secp256k1_mul_syscall` (StarkNet)
1. `secp256k1_new_syscall` (StarkNet)
1. `secp256r1_add_syscall` (StarkNet)
1. `secp256r1_get_point_from_x_syscall` (StarkNet)
1. `secp256r1_get_xy_syscall` (StarkNet)
1. `secp256r1_mul_syscall` (StarkNet)
1. `secp256r1_new_syscall` (StarkNet)
1. coupon
</details>

<details>
Expand Down Expand Up @@ -262,7 +262,7 @@ Footnotes on the libfuncs list:

- Linux or macOS (aarch64 included) only for now
- LLVM 18 with MLIR: On debian you can use [apt.llvm.org](https://apt.llvm.org/), on macOS you can use brew
- Rust 1.76.0
- Rust 1.78.0 or later, since we make use of the u128 [abi change](https://blog.rust-lang.org/2024/03/30/i128-layout-update.html).
- Git

### Setup
Expand Down
4 changes: 2 additions & 2 deletions src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ impl<'a> ArgumentMapper<'a> {

#[cfg(target_arch = "x86_64")]
const NUM_REGISTER_ARGS: usize = 6;
#[cfg(not(target_arch = "x86_64"))]
#[cfg(target_arch = "aarch64")]
const NUM_REGISTER_ARGS: usize = 8;

if align == 16 {
Expand All @@ -380,7 +380,7 @@ impl<'a> ArgumentMapper<'a> {
self.invoke_data.push(0);
} else {
let new_len = self.invoke_data.len() + values.len();
if new_len >= 8 && new_len % 2 != 0 {
if new_len >= NUM_REGISTER_ARGS && new_len % 2 != 0 {
let chunk;
(chunk, values) = if values.len() >= 4 {
values.split_at(4)
Expand Down
5 changes: 1 addition & 4 deletions src/libfuncs/felt252_dict_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ use cairo_lang_sierra::{
program_registry::ProgramRegistry,
};
use melior::{
dialect::{
cf,
llvm::{self},
},
dialect::{cf, llvm},
ir::{
attribute::IntegerAttribute, operation::OperationBuilder, r#type::IntegerType, Block,
Identifier, Location, Value, ValueLike,
Expand Down
6 changes: 2 additions & 4 deletions src/starknet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ pub struct ArrayAbi<T> {

/// Binary representation of a `Felt` (in MLIR).
#[derive(Debug, Clone)]
#[cfg_attr(target_arch = "x86_64", repr(C, align(16)))]
#[cfg_attr(not(target_arch = "x86_64"), repr(C, align(16)))]
#[repr(C, align(16))]
pub struct Felt252Abi(pub [u8; 32]);
/// Binary representation of a `u256` (in MLIR).
// TODO: This shouldn't need to be public.
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(target_arch = "x86_64", repr(C, align(16)))]
#[cfg_attr(not(target_arch = "x86_64"), repr(C, align(16)))]
#[repr(C, align(16))]
pub struct U256 {
pub hi: u128,
pub lo: u128,
Expand Down

0 comments on commit e284cfa

Please sign in to comment.