Skip to content

Conversation

@phischu
Copy link
Collaborator

@phischu phischu commented May 31, 2024

No description provided.

@phischu phischu force-pushed the llvm/mutable_arrays branch from f90caa3 to 5e451e0 Compare June 1, 2024 08:25
@phischu phischu changed the title WIP: Mutable arrays in the LLVM backend Mutable arrays in the LLVM backend Jun 1, 2024
@phischu phischu requested a review from b-studios June 1, 2024 08:27
@b-studios
Copy link
Collaborator

Really great, thanks that you implemented both arrays and refs.

Btw, in my drafts of promises in #469 I tried to stick to a similar strategy of storing the eraser after the RC and treat Promise as Pos this way.

One issue that I have is: do you really want to directly test the "unsafe" variants?

@phischu phischu force-pushed the llvm/mutable_arrays branch from dc91c3c to 901c480 Compare June 3, 2024 09:52
*
* +--[ Header ]--+------+------------+
* | Rc | Eraser | Size | Fields ... |
* +--------------+------+------------+
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess we do not save the size in the tag because we need it in the eraser?

/**
* Creates a new Array of size `size` filled with the value `init`
*/
extern global def fresh[T](size: Int, init: T): Array[T] =
Copy link
Contributor

@jiribenes jiribenes Jun 3, 2024

Choose a reason for hiding this comment

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

Note that fill is also already used in the stdlib for the same operation on lists — it might be worth it to think about synchronizing the two names.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm.. here we used fresh since it is the same name as for Ref.

@b-studios
Copy link
Collaborator

We would like to rename:

unsafeFresh -> allocate
fresh -> array / Array (same for ref, and bytes, and ...)

document in allocate that the default constructor should be preferred and that it is unsafe...

@b-studios b-studios merged commit fb93d4c into master Jun 4, 2024
@b-studios b-studios deleted the llvm/mutable_arrays branch June 4, 2024 15:08
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.

4 participants