Skip to content

Commit

Permalink
Merge branch 'main' into i16-wrapping-ops
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikbhargavan authored Sep 3, 2024
2 parents 9267a0e + 5050efe commit 16c4478
Show file tree
Hide file tree
Showing 16 changed files with 283 additions and 51 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ KRML_HOME ?= $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../karamel
EURYDICE ?= ./eurydice $(EURYDICE_FLAGS)
CHARON ?= $(CHARON_HOME)/bin/charon

BROKEN_TESTS = step_by where_clauses chunks mutable_slice_range closure
BROKEN_TESTS = step_by where_clauses chunks mutable_slice_range closure issue_49
TEST_DIRS = $(filter-out $(BROKEN_TESTS),$(subst test/,,$(shell find test -maxdepth 1 -mindepth 1 -type d)))

.PHONY: all
Expand Down
4 changes: 4 additions & 0 deletions bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ Supported options:|}
fail __FILE__ __LINE__;
Eurydice.Logging.log "Phase2.1" "%a" pfiles files;
let files = Eurydice.Cleanup2.improve_names files in
let files = Eurydice.Cleanup2.recognize_asserts#visit_files () files in
let files = Krml.Monomorphization.functions files in
let files = Krml.Monomorphization.datatypes files in
let files =
Expand Down Expand Up @@ -329,6 +330,9 @@ Supported options:|}
in

Eurydice.Logging.log "Phase3.3" "%a" pfiles files;
let files = List.map (fun (f, ds) -> f, List.filter (fun d ->
not (Krml.Idents.LidSet.mem (Krml.Ast.lid_of_decl d) Eurydice.Builtin.skip))
ds) files in
let files = AstToCStar.mk_files files c_name_map Idents.LidSet.empty macros in

let headers = CStarToC11.mk_headers c_name_map files in
Expand Down
30 changes: 15 additions & 15 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions include/eurydice_glue.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ extern "C" {
#include "krml/lowstar_endianness.h"

#define LowStar_Ignore_ignore(e, t, _ret_t) ((void)e)
#define EURYDICE_ASSERT(test, msg) do { \
if (!(test)) { \
fprintf(stderr, \
"assertion \"%s\" failed: file \"%s\", line %d\n", \
msg, __FILE__, __LINE__); \
} \
} while (0)

// SLICES, ARRAYS, ETC.

Expand Down Expand Up @@ -130,13 +137,18 @@ static inline void core_num__u32_8__to_be_bytes(uint32_t src, uint8_t dst[4]) {
memcpy(dst, &x, 4);
}

static inline void core_num__u32_8__to_le_bytes(uint32_t src, uint8_t dst[4]) {
store32_le(dst, src);
}

static inline uint32_t core_num__u32_8__from_le_bytes(uint8_t buf[4]) {
return load32_le(buf);
}

static inline void core_num__u64_9__to_le_bytes(uint64_t v, uint8_t buf[8]) {
store64_le(buf, v);
}

static inline uint64_t core_num__u64_9__from_le_bytes(uint8_t buf[8]) {
return load64_le(buf);
}
Expand Down Expand Up @@ -202,6 +214,9 @@ static inline uint8_t Eurydice_bitand_pv_u8(uint8_t *p, uint8_t v) {
static inline uint8_t Eurydice_shr_pv_u8(uint8_t *p, int32_t v) {
return (*p) >> v;
}
static inline uint32_t Eurydice_min_u32(uint32_t x, uint32_t y) {
return x < y ? x : y;
}

#define core_num_nonzero_private_NonZeroUsizeInner size_t
static inline core_num_nonzero_private_NonZeroUsizeInner
Expand Down
Loading

0 comments on commit 16c4478

Please sign in to comment.