Skip to content

Commit 90bee16

Browse files
some comments
1 parent 8292458 commit 90bee16

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/libfuncs/circuit.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ fn build_get_output<'ctx, 'this>(
927927
location,
928928
outputs,
929929
build_u384_struct_type(context),
930-
1,
930+
2,
931931
)?;
932932

933933
let output_integer_ptr = entry.gep(
@@ -953,10 +953,6 @@ fn build_get_output<'ctx, 'this>(
953953
)?;
954954

955955
// We drop the circuit outputs value, as its consumed by this libfunc.
956-
// NOTE: As this libfunc consumes circuit_outputs, this implies that
957-
// calling it multiple times involves duplicating the circuit outputs
958-
// each time. This could be fixed by implementing a reference counter,
959-
// like we do with regular arrays.
960956
if let Some(drop_overrides_meta) = metadata.get::<DropOverridesMeta>() {
961957
drop_overrides_meta.invoke_override(
962958
context,

src/types/circuit.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,15 @@ pub fn build_circuit_data<'ctx>(
278278
///
279279
/// ## Layout:
280280
///
281-
/// Holds the evaluated circuit output gates and the circuit modulus.
281+
/// Holds the reference count, the evaluated circuit output gates and the circuit modulus.
282+
/// - The reference count is stored as a u8. Tells the amount of currently alived references
283+
/// to the output value.
282284
/// - The data is stored as a dynamic array of u384 integers.
283285
/// - The modulus is stored as a u384 in struct form (multi-limb).
284286
///
285287
/// ```txt
286288
/// type = struct {
289+
/// reference_count: u8,
287290
/// data: *u384,
288291
/// modulus: u384struct,
289292
/// };

0 commit comments

Comments
 (0)