carbon-language / carbon-lang

Carbon Language's main repository: documents, design, implementation, and related tools. (NOTE: Carbon Language is experimental; see README)
https://github.com/carbon-language/carbon-lang/blob/trunk/README.md
Other
32.3k stars 1.48k forks source link

Create an array stack type for a shared use-case #4100

Closed jonmeow closed 1 day ago

jonmeow commented 3 days ago

Based on discussion around the region handling in generic_region_stack, create a generic structure for the stack-of-vectors support. I also want to add this to InstBlockStack, but that's a little more complex due to GlobalInit, so cutting a PR here to check with review.

My work here is how I noticed #4099; I want to be sure that I'm correct about the issue, but it's the difference between being able to use PeekArray or not.

Note in scope_stack.h, I believe we could remove next_compile_time_index and make it just based on elements_size(). However, I want to verify with you before I make further changes there.

jonmeow commented 3 days ago

Depends on #4099

chandlerc commented 3 days ago

Shouldn't block this PR either way, but wanted to also ask whether for completely general data structures we should keep them in //common instead of //toolchain/base?

jonmeow commented 3 days ago

Shouldn't block this PR either way, but wanted to also ask whether for completely general data structures we should keep them in //common instead of //toolchain/base?

Done