Skip to content

Conversation

@Taym95
Copy link
Member

@Taym95 Taym95 commented Oct 25, 2025

No description provided.

@Taym95 Taym95 force-pushed the define-RootedFixedValueArray branch 2 times, most recently from d2105c5 to d6891a6 Compare October 25, 2025 14:27
@Taym95 Taym95 changed the title Introduce RootedFixedValueArray Introduce RootedFixedValueArray and RootedDynamicValueArray Oct 25, 2025
@Taym95 Taym95 requested review from gterzian and jdm October 25, 2025 14:41
/// Inline, fixed capacity buffer of JS values with GC barriers.
/// Backed by `[Heap<JSVal>; N]`, and a manual `len`.
pub struct FixedValueArray<const N: usize> {
elems: [Heap<JSVal>; N],
Copy link
Member Author

Choose a reason for hiding this comment

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

@jdm what do you think about this? and how it is used in servo/servo#40166 ?

@Taym95 Taym95 force-pushed the define-RootedFixedValueArray branch from d6891a6 to 635e032 Compare October 27, 2025 20:06
Copy link
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

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

This isn't quite what I had in mind—we should not need new macros for this, and we should not need heap values for the fixed size array. While I was looking for links for how I would restructure, it, I came across

/// A fixed-size array of values, for use inside Rooted<>.
which is exactly what I was trying to describe in the original issue. It's all set up for HandleValueArray, too: https://github.com/servo/mozjs/blob/main/mozjs/src/gc/root.rs#L108 . Try following the example of
rooted!(in(rt.cx()) let mut args = ValueArray::new([ObjectValue(module.get()), ObjectValue(imports.get())]));
to use it in Servo?

@Taym95
Copy link
Member Author

Taym95 commented Oct 28, 2025

This isn't quite what I had in mind—we should not need new macros for this, and we should not need heap values for the fixed size array. While I was looking for links for how I would restructure, it, I came across

/// A fixed-size array of values, for use inside Rooted<>.

which is exactly what I was trying to describe in the original issue. It's all set up for HandleValueArray, too: https://github.com/servo/mozjs/blob/main/mozjs/src/gc/root.rs#L108 . Try following the example of

rooted!(in(rt.cx()) let mut args = ValueArray::new([ObjectValue(module.get()), ObjectValue(imports.get())]));

to use it in Servo?

I see, let me see what I can do

@Taym95 Taym95 closed this Nov 2, 2025
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.

2 participants