Skip to content

Conversation

@ggreif
Copy link
Contributor

@ggreif ggreif commented Nov 12, 2025

This PR TBW

@ggreif ggreif self-assigned this Nov 13, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 13, 2025

Comparing from 8fe91aa to b3dc0a5:
In terms of gas, 5 tests regressed and the mean change is +0.0%.
In terms of size, 5 tests regressed and the mean change is +0.0%.

let compile_add_const = compile_op_const I32Op.Add
let compile_sub_const = compile_op_const I32Op.Sub
let compile_mul_const = compile_op_const I32Op.Mul
let compile_mul_const = compile_op_const I32Op.Mul (* TODO: use shift: compile_mul_const 2l *)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See #5651.

(* Go! *)
Bool.lit extended ^^ Bool.to_rts_int32 ^^ get_data_buf ^^ get_typtbl_ptr ^^ get_typtbl_size_ptr ^^ get_maintyps_ptr ^^
let tydesc, _, _ = type_desc env Candid ts in
let tydesc_len = Int64.of_int (String.length tydesc * 2 + 300) in
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't limit when extended.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

May do it in the RTS, but we have to be careful to not reuse functions across this flag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thinking about it, we could leave the rule in, as the type table is not expected to shrink considerably for orthogonal persistence between upgrades. Needs more thinking.

Copy link
Contributor Author

@ggreif ggreif Nov 17, 2025

Choose a reason for hiding this comment

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

Aaah ok, they are separated already: @deserialize_extended and @deserialize.

debug.print: {cycles = 2_509_532; size = +25_528}
ingress Completed: Reply: 0x4449444c0000
debug.print: {cycles = 54_921_553; size = +830_464}
debug.print: {cycles = 54_921_579; size = +830_464}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Minimal penalty.

const WORD_SIZE: usize = core::mem::size_of::<u32>();

if (*buf).ptr.add(WORD_SIZE - 1) >= (*buf).end {
// TODO: use add(WORD_SIZE) and >
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would aid CSE.

const WORD_SIZE: usize = core::mem::size_of::<u32>();

if (*buf).ptr.add(WORD_SIZE - 1) >= (*buf).end {
if (*buf).ptr.add(WORD_SIZE) > (*buf).end {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Allows CSE with line 58. Justified, because buf.ptr is a *mut u8.

(* Go! *)
Bool.lit extended ^^ get_data_buf ^^ get_typtbl_ptr ^^ get_typtbl_size_ptr ^^ get_maintyps_ptr ^^
let tydesc, _, _ = type_desc env ts in
let tydesc_len = Int32.of_int (String.length tydesc * 2 + 300) in
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make this a configurable affine function. See get/setCandidLimits primitives for an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant