Skip to content

Commit a862158

Browse files
authored
Remove sentinel for end of KORE terms in the proof hint format (#1076)
This PR removes the sentinel at the end of a KORE terms as it would appear in the proof hint trace. We do not need this sentinel to properly parse the trace because the KORE term binary format includes length information. The hints version has been bumped to 11 and the relevant tests have been updated.
1 parent a2d10ed commit a862158

File tree

90 files changed

+89
-99
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+89
-99
lines changed

docs/proof-trace.md

Lines changed: 2 additions & 2 deletions

include/kllvm/binary/ProofTraceParser.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ static_assert(word(0xAA) == 0xAAAAAAAAAAAAAAAA);
2626
} // namespace detail
2727

2828
constexpr uint64_t config_sentinel = detail::word(0xFF);
29-
constexpr uint64_t kore_end_sentinel = detail::word(0xCC);
3029
constexpr uint64_t function_event_sentinel = detail::word(0xDD);
3130
constexpr uint64_t function_end_sentinel = detail::word(0x11);
3231
constexpr uint64_t hook_event_sentinel = detail::word(0xAA);
@@ -274,7 +273,7 @@ class llvm_rewrite_trace {
274273

275274
class proof_trace_parser {
276275
public:
277-
static constexpr uint32_t expected_version = 10U;
276+
static constexpr uint32_t expected_version = 11U;
278277

279278
private:
280279
bool verbose_;
@@ -332,7 +331,7 @@ class proof_trace_parser {
332331

333332
event->add_substitution(name, kore_term, pattern_len);
334333

335-
return buffer.check_word(kore_end_sentinel);
334+
return true;
336335
}
337336

338337
sptr<llvm_hook_event> parse_hook(proof_trace_buffer &buffer) {
@@ -422,10 +421,6 @@ class proof_trace_parser {
422421
return nullptr;
423422
}
424423

425-
if (!buffer.check_word(kore_end_sentinel)) {
426-
return nullptr;
427-
}
428-
429424
return kore_term;
430425
}
431426

lib/codegen/ProofEvent.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ llvm::BasicBlock *proof_event::rewrite_event_pre(
255255

256256
emit_write_string(outputFile, key.str(), true_block);
257257
emit_serialize_term(*sort, outputFile, val, true_block);
258-
emit_write_uint64(outputFile, detail::word(0xCC), true_block);
259258
}
260259

261260
llvm::BranchInst::Create(merge_block, true_block);
@@ -277,7 +276,6 @@ llvm::BasicBlock *proof_event::rewrite_event_post(
277276

278277
emit_write_uint64(output_file, detail::word(0xFF), true_block);
279278
emit_serialize_term(*return_sort, output_file, return_value, true_block);
280-
emit_write_uint64(output_file, detail::word(0xCC), true_block);
281279

282280
llvm::BranchInst::Create(merge_block, true_block);
283281
return merge_block;
@@ -353,7 +351,6 @@ llvm::BasicBlock *proof_event::side_condition_event_pre(
353351

354352
emit_write_string(outputFile, var_name, true_block);
355353
emit_serialize_term(*sort, outputFile, val, true_block);
356-
emit_write_uint64(outputFile, detail::word(0xCC), true_block);
357354
}
358355

359356
llvm::BranchInst::Create(merge_block, true_block);

runtime/take_steps.ll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ if:
5252
%output_file = load i8*, i8** @output_file
5353
call void @write_uint64_to_file(i8* %output_file, i64 18446744073709551615)
5454
call void @serialize_configuration_to_file_v2(i8* %output_file, %block* %subject)
55-
call void @write_uint64_to_file(i8* %output_file, i64 14757395258967641292)
5655
br label %merge
5756
merge:
5857
store i64 %depth, i64* @depth

runtime/util/finish_rewriting.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ int32_t get_exit_code(block *);
4848
} else if (!error && !proof_hint_instrumentation_slow) {
4949
write_uint64_to_file(output_file, 0xFFFFFFFFFFFFFFFF);
5050
serialize_configuration_to_file_v2(output_file, subject);
51-
write_uint64_to_file(output_file, 0xCCCCCCCCCCCCCCCC);
5251
}
5352

5453
auto exit_code = error ? 113 : get_exit_code(subject);

runtime/util/util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ block *construct_raw_term(void *subject, char const *sort, bool raw_value) {
3535
}
3636

3737
void print_proof_hint_header(FILE *file) {
38-
uint32_t version = 10;
38+
uint32_t version = 11;
3939
fmt::print(file, "HINT");
4040
fwrite(&version, sizeof(version), 1, file);
4141
}

test/output/add-rewrite/input.proof.out.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 10
1+
version: 11
22
hook: MAP.element Lbl'UndsPipe'-'-GT-Unds'{} ()
33
function: Lbl'UndsPipe'-'-GT-Unds'{} ()
44
arg: kore[\dv{SortKConfigVar{}}("$PGM")]

test/output/arith/add.proof.out.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 10
1+
version: 11
22
hook: MAP.element Lbl'UndsPipe'-'-GT-Unds'{} ()
33
function: Lbl'UndsPipe'-'-GT-Unds'{} ()
44
arg: kore[\dv{SortKConfigVar{}}("$PGM")]

test/output/arith/well.proof.out.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 10
1+
version: 11
22
hook: MAP.element Lbl'UndsPipe'-'-GT-Unds'{} ()
33
function: Lbl'UndsPipe'-'-GT-Unds'{} ()
44
arg: kore[\dv{SortKConfigVar{}}("$PGM")]

test/output/assoc-function/left.proof.out.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 10
1+
version: 11
22
function: Lbl'UndsPlus'left'UndsUnds'ASSOC-FUNCTION-SYNTAX'Unds'Foo'Unds'Foo'Unds'Foo{} ()
33
rule: 103 2
44
Var'Unds'X = kore[Lbla'Unds'ASSOC-FUNCTION-SYNTAX'Unds'Foo{}()]

0 commit comments

Comments
 (0)