Skip to content

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Aug 15, 2025

Add 2 more unsafe methods to Allocator to meddle with its internals. These methods are only present when from_raw_parts cargo feature is enabled.

These methods are used in a later PR in this stack, to write flags for which JS threads an Allocator is shared with into the Allocators memory.

@github-actions github-actions bot added the C-enhancement Category - New feature or request label Aug 15, 2025
Copy link
Member Author

overlookmotel commented Aug 15, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 15, 2025

CodSpeed Instrumentation Performance Report

Merging #13134 will not alter performance

Comparing 08-15-feat_allocator_add_data_end_ptr_and_set_cursor_ptr_methods_to_allocator_ (7cf6186) with main (aecacae)1

Summary

✅ 34 untouched benchmarks

Footnotes

  1. No successful run was found on main (7cf6186) during the generation of this report, so aecacae was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@overlookmotel overlookmotel marked this pull request as ready for review August 15, 2025 23:53
@overlookmotel overlookmotel force-pushed the 08-15-feat_allocator_add_data_end_ptr_and_set_cursor_ptr_methods_to_allocator_ branch from 11cb71b to ab90104 Compare August 15, 2025 23:53
@overlookmotel overlookmotel force-pushed the 08-15-feat_allocator_add_data_end_ptr_and_set_cursor_ptr_methods_to_allocator_ branch from ab90104 to 81db99e Compare August 16, 2025 00:12
@camc314 camc314 requested a review from Copilot August 16, 2025 11:55
@graphite-app graphite-app bot changed the base branch from 08-15-refactor_napi_parser_move_creating_js_buffer_into_separate_function to graphite-base/13134 August 16, 2025 11:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds two new unsafe methods to the Allocator struct to provide lower-level memory management capabilities. The methods allow direct manipulation of the allocator's internal pointers and are only available when the from_raw_parts cargo feature is enabled.

  • Adds set_cursor_ptr method for manually setting the cursor pointer within the current chunk
  • Adds data_end_ptr method to get a pointer to the end of the data region in the current chunk

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@graphite-app graphite-app bot force-pushed the graphite-base/13134 branch from 3a1001c to c8b97de Compare August 16, 2025 12:01
@graphite-app graphite-app bot force-pushed the 08-15-feat_allocator_add_data_end_ptr_and_set_cursor_ptr_methods_to_allocator_ branch from 81db99e to 7e6db63 Compare August 16, 2025 12:01
@graphite-app graphite-app bot changed the base branch from graphite-base/13134 to main August 16, 2025 12:02
@graphite-app graphite-app bot force-pushed the 08-15-feat_allocator_add_data_end_ptr_and_set_cursor_ptr_methods_to_allocator_ branch from 7e6db63 to 5bd7d9e Compare August 16, 2025 12:02
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Aug 16, 2025
Copy link
Member Author

overlookmotel commented Aug 16, 2025

Merge activity

…Allocator` (#13134)

Add 2 more unsafe methods to `Allocator` to meddle with its internals. These methods are only present when `from_raw_parts` cargo feature is enabled.

These methods are used in a later PR in this stack, to write flags for which JS threads an `Allocator` is shared with into the `Allocator`s memory.
@graphite-app graphite-app bot force-pushed the 08-15-feat_allocator_add_data_end_ptr_and_set_cursor_ptr_methods_to_allocator_ branch from 5bd7d9e to 7cf6186 Compare August 16, 2025 12:13
@graphite-app graphite-app bot merged commit 7cf6186 into main Aug 16, 2025
26 checks passed
@graphite-app graphite-app bot deleted the 08-15-feat_allocator_add_data_end_ptr_and_set_cursor_ptr_methods_to_allocator_ branch August 16, 2025 12:18
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 16, 2025
graphite-app bot pushed a commit that referenced this pull request Aug 17, 2025
…thods (#13139)

Correct safety comments on unsafe methods of `Allocator`, as suggested by AI in #13134 (review).

Also expand the safety comments for `Allocator::set_data_ptr`, and add comments on how its invariants are upheld at call sites.

Also correct typos and improve comment formatting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants