Skip to content
Closed
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
e5df76b
added DeclObli type and an update of the mutable field in env
Lin23299 Jul 8, 2025
2436209
changed type, added capture of obligations
Lin23299 Jul 8, 2025
81af396
added logs for debugging
Lin23299 Jul 8, 2025
7a4af25
wip: updating transaltion of array
Lin23299 Jul 9, 2025
36a3318
updated type of ObliMap and use a function to add oblis
Lin23299 Jul 9, 2025
9739fe4
commented redundent special case in expr_of_operand, changed final li…
Lin23299 Jul 9, 2025
afda93f
added translation of AggregatedArray
Lin23299 Jul 9, 2025
27a8839
fixed addrof for array
Lin23299 Jul 10, 2025
337adeb
use K definitions in DeclObli
Lin23299 Jul 10, 2025
a4547a3
minor: Log for obli adding
Lin23299 Jul 10, 2025
bb109a9
changed to generic Arr struct
Lin23299 Jul 11, 2025
fc2835d
first fix for from_fn
Lin23299 Jul 14, 2025
9bed4e1
minor: bug fix
Lin23299 Jul 14, 2025
6733647
similar update to array map
Lin23299 Jul 14, 2025
6b01dd5
slightly changed array.rs to avoid unused variable warning
Lin23299 Jul 14, 2025
74d6c1f
fixed a missing recursive case(bug?) in 'remove_implicit_array_copies'
Lin23299 Jul 15, 2025
09da11e
defined lid and type of generic struct type for array in Builtin.ml a…
Lin23299 Jul 15, 2025
35af6fe
leaving signatures in Builtin.ml unchanged since we cannot return arr…
Lin23299 Jul 16, 2025
fbf03d6
Revert "leaving signatures in Builtin.ml unchanged since we cannot re…
Lin23299 Jul 17, 2025
4f89b03
Merge branch 'AeneasVerif:main' into array_handling
Lin23299 Jul 18, 2025
083dee6
updated the builtin implementations in glue.h, anded a cleanup to fix…
Lin23299 Jul 18, 2025
73556be
moved the decl deletion to Cleanup3 cus it fails the check
Lin23299 Jul 18, 2025
48c4a1a
Merge branch 'AeneasVerif:main' into array_handling
Lin23299 Jul 21, 2025
ad0b5df
updated translation in CastUnsize to support dst.rs
Lin23299 Jul 21, 2025
7eb7448
minor to prevent unused variable
Lin23299 Jul 21, 2025
8be4b91
bug fix in builtin type
Lin23299 Jul 21, 2025
8652d58
Merge branch 'AeneasVerif:main' into array_handling
Lin23299 Jul 23, 2025
44a90c3
wip: updated '
Lin23299 Jul 23, 2025
f9b16d6
minor bug fix
Lin23299 Jul 23, 2025
048fb9a
update remove_array_repeat: added EbufCreateL case in expand_repeat f…
Lin23299 Jul 23, 2025
4676d5e
Merge branch 'AeneasVerif:main' into array_handling
Lin23299 Jul 24, 2025
ba9ac59
minors after debugging of fncg
Lin23299 Jul 24, 2025
f91c003
minor
Lin23299 Jul 24, 2025
dbf2a57
added a macro def for empty array
Lin23299 Jul 25, 2025
15dcf23
typo fix
Lin23299 Jul 25, 2025
a4d6207
updated test cases
Lin23299 Jul 25, 2025
da58586
updated CastUnsize for 4 cases with new test case
Lin23299 Jul 25, 2025
69fef58
cleanup
Lin23299 Jul 25, 2025
3bb4e2c
Merge branch 'main' of github.com:AeneasVerif/eurydice into array_han…
Lin23299 Jul 29, 2025
ec2c900
added test case issue_212.rs
Lin23299 Jul 29, 2025
d66bbf9
cleanup and comments
Lin23299 Jul 29, 2025
208e31e
comments
Lin23299 Jul 29, 2025
fce0d1d
minor
Lin23299 Jul 29, 2025
53888c3
Merge branch 'main' of github.com:AeneasVerif/eurydice into array_han…
Lin23299 Jul 30, 2025
fffc447
Merge branch 'main' into array_handling
msprotz Jul 30, 2025
a3ea6ec
updated define of empty_array to avoid UB in struct initialization
Lin23299 Aug 1, 2025
51632a6
small cleanups in Cleanup2.ml
Lin23299 Aug 4, 2025
eefbfdf
a first fix of expand_repeat
Lin23299 Aug 4, 2025
26e76c9
removal of comments in Builtin.ml
Lin23299 Aug 5, 2025
4593892
removed the special case for nested array in from_fn
Lin23299 Aug 5, 2025
ee3d0c1
Merge branch 'main' of github.com:AeneasVerif/eurydice into array_han…
Lin23299 Aug 6, 2025
a504e42
updated expand_repeat with visit_DGlobal in remove_array_repeat
Lin23299 Aug 6, 2025
3a88cf3
Merge branch 'AeneasVerif:main' into array_handling
Lin23299 Aug 7, 2025
080d3a0
simplification in visit_EGlobal
Lin23299 Aug 7, 2025
2bebcad
Added test for array_eq in array.rs
Lin23299 Aug 7, 2025
390d23d
Merge branch 'AeneasVerif:main' into array_handling
Lin23299 Aug 11, 2025
96cda91
Merge branch 'main' of github.com:AeneasVerif/eurydice into array_han…
Lin23299 Aug 19, 2025
39a167e
Merge branch 'main' of github.com:AeneasVerif/eurydice into array_han…
Lin23299 Aug 26, 2025
02ad68d
Merge branch 'main' into array_handling
ssyram Sep 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ Supported options:|}
let files = Krml.Inlining.drop_unused files in
let files = Eurydice.Cleanup2.remove_array_temporaries#visit_files () files in
Eurydice.Logging.log "Phase2.25" "%a" pfiles files;
let files = Eurydice.Cleanup2.remove_array_repeats#visit_files () files in
let files = Eurydice.Cleanup2.remove_array_repeats#visit_files false files in
Eurydice.Logging.log "Phase2.26" "%a" pfiles files;
let files = Eurydice.Cleanup2.rewrite_slice_to_array#visit_files () files in
let ((map, _, _) as map3), files = Krml.DataTypes.everything files in
Expand Down Expand Up @@ -312,6 +312,7 @@ Supported options:|}
Eurydice.Cleanup3.(also_skip_prefix_for_external_types scope_env)#visit_files () files;
let files = Eurydice.Cleanup3.decay_cg_externals#visit_files (scope_env, false) files in
let files = Eurydice.Cleanup3.add_extra_type_to_slice_index#visit_files () files in
let files = Eurydice.Cleanup3.remove_builtin_decls files in
Eurydice.Logging.log "Phase3.1" "%a" pfiles files;
let macros =
let cg_macros = Eurydice.Cleanup3.build_cg_macros#visit_files () files in
Expand Down
41 changes: 29 additions & 12 deletions include/eurydice_glue.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,30 +254,43 @@ typedef char Eurydice_derefed_slice[];
extern "C" {
#endif

static inline uint16_t core_num__u16__from_le_bytes(uint8_t buf[2]) {
return load16_le(buf);

typedef struct Eurydice_arr_8b_s { uint8_t data[2]; } Eurydice_arr_8b;
typedef struct Eurydice_arr_e9_s { uint8_t data[4]; } Eurydice_arr_e9;
typedef struct Eurydice_arr_c4_s { uint8_t data[8]; } Eurydice_arr_c4;



static inline uint16_t core_num__u16__from_le_bytes(Eurydice_arr_8b buf) {
return load16_le(buf.data);
}

static inline void core_num__u32__to_be_bytes(uint32_t src, uint8_t dst[4]) {
static inline Eurydice_arr_e9 core_num__u32__to_be_bytes(uint32_t src) {
// TODO: why not store32_be?
Eurydice_arr_e9 a;
uint32_t x = htobe32(src);
memcpy(dst, &x, 4);
memcpy(a.data, &x, 4);
return a;
}

static inline void core_num__u32__to_le_bytes(uint32_t src, uint8_t dst[4]) {
store32_le(dst, src);
static inline Eurydice_arr_e9 core_num__u32__to_le_bytes(uint32_t src) {
Eurydice_arr_e9 a;
store32_le(a.data,src);
return a;
}

static inline uint32_t core_num__u32__from_le_bytes(uint8_t buf[4]) {
return load32_le(buf);
static inline uint32_t core_num__u32__from_le_bytes(Eurydice_arr_e9 buf) {
return load32_le(buf.data);
}

static inline void core_num__u64__to_le_bytes(uint64_t v, uint8_t buf[8]) {
store64_le(buf, v);
static inline Eurydice_arr_c4 core_num__u64__to_le_bytes(uint64_t v) {
Eurydice_arr_c4 a;
store64_le(a.data, v);
return a;
}

static inline uint64_t core_num__u64__from_le_bytes(uint8_t buf[8]) {
return load64_le(buf);
static inline uint64_t core_num__u64__from_le_bytes(Eurydice_arr_c4 buf) {
return load64_le(buf.data);
}

static inline int64_t
Expand Down Expand Up @@ -540,6 +553,10 @@ static inline char *malloc_and_init(size_t sz, char *init) {
#define Eurydice_box_new(init, t, t_dst) \
((t_dst)(malloc_and_init(sizeof(t), (char *)(&init))))

// Initilize the struct Eurydice_arr with an empty array as its field
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you say more in this comment? I don't understand from the comment whether it's a default initializer for any array, or just for an array of size zero?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We made this macro specifically for the 0-length arrays. Because direct empty array creation causes complains from the Krml checker. Also, thanks for pointing out the UB problem, but we then have no idea how to implement it. Or, is it still safe to have this UB as the value is of 0-length and shall never be used? (The only concern here may be the unexpected raising errors, or simply reported as bug by the compiler / some analysers?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, a safer way would be to simply match and turn 0-len arrays be simply some other types, e.g.: typedef Eurydice::ZeroLenArr void *;.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may have to do that -- let's wait until the PR is updated and other questions are addressed, and then we can have maybe a special type for zero-sized arrays (something like typedef struct { char data[1]; } Eurydice_zero_arr)

#define Eurydice_empty_array(dummy, t, t_dst) \
((t_dst) { { } })

#define Eurydice_box_new_array(len, ptr, t, t_dst) \
((t_dst)(malloc_and_init(len * sizeof(t), (char *)(ptr))))

Expand Down
Loading
Loading