Add plugin stencils, code coverage, compiling promises#11
Open
MatejKocourek wants to merge 18 commits intomainfrom
Open
Add plugin stencils, code coverage, compiling promises#11MatejKocourek wants to merge 18 commits intomainfrom
MatejKocourek wants to merge 18 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds plugin stencil infrastructure for code instrumentation, implements code coverage tracking via srcref integration, moves RCP prologue handling to R runtime, and adds optional support for compiling promises to native code with specialization.
Changes:
- Introduced plugin stencil system allowing injection of custom code at specific bytecode positions
- Added code coverage infrastructure using srcref metadata and integration with the covr package
- Implemented specialized MAKEPROM operations with optional promise compilation to native code
- Refactored custom data handling (renamed PATCHED_VARIANTS to CUSTOM_DATA for general plugin use)
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| rcp/src/stencils/stencils.c | Added plugin coverage stencil, refactored MAKEPROM with specialization support and promise compilation |
| rcp/src/stencils/Makefile | Added compilation flags for MAKEPROM specialization and promise compilation |
| rcp/src/rcp_common.h | Renamed RELOC_RCP_PATCHED_VARIANTS to RELOC_RCP_CUSTOM for generalized plugin data |
| rcp/src/extractor/extract_stencils.cpp | Updated symbol extraction to use CUSTOM_DATA naming |
| rcp/src/compile.c | Implemented plugin stencil infrastructure, coverage tracking, peephole goto optimization, and promise compilation |
| rcp/src/Makevars | Added build flags for RCP_COMPILE_PROMISES and MAKEPROM_SPECIALIZE features |
| rcp/common.mk | Added configuration options for promise compilation and MAKEPROM specialization |
| external/rsh | Updated subproject commit reference |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rcp/src/compile.c
Outdated
Comment on lines
652
to
662
| printf("Using specialized version of MAKEPROM_OP: BCODESXP\n"); | ||
| return &stencil_set[1]; | ||
| case EXTPTRSXP: | ||
| if (RSH_IS_CLOSURE_BODY(code)) | ||
| { | ||
| printf("Using specialized version of MAKEPROM_OP: EXTPTRSXP\n"); | ||
| return &stencil_set[2]; | ||
| } | ||
| // Continue to the generic version if it's an external pointer but not ours | ||
| default: | ||
| printf("Using specialized version of MAKEPROM_OP: OTHER SEXPs\n"); |
There was a problem hiding this comment.
These printf debug statements should be replaced with DEBUG_PRINT macros for consistency with the rest of the codebase, allowing them to be conditionally compiled based on DEBUG_MODE.
Suggested change
| printf("Using specialized version of MAKEPROM_OP: BCODESXP\n"); | |
| return &stencil_set[1]; | |
| case EXTPTRSXP: | |
| if (RSH_IS_CLOSURE_BODY(code)) | |
| { | |
| printf("Using specialized version of MAKEPROM_OP: EXTPTRSXP\n"); | |
| return &stencil_set[2]; | |
| } | |
| // Continue to the generic version if it's an external pointer but not ours | |
| default: | |
| printf("Using specialized version of MAKEPROM_OP: OTHER SEXPs\n"); | |
| DEBUG_PRINT("Using specialized version of MAKEPROM_OP: BCODESXP\n"); | |
| return &stencil_set[1]; | |
| case EXTPTRSXP: | |
| if (RSH_IS_CLOSURE_BODY(code)) | |
| { | |
| DEBUG_PRINT("Using specialized version of MAKEPROM_OP: EXTPTRSXP\n"); | |
| return &stencil_set[2]; | |
| } | |
| // Continue to the generic version if it's an external pointer but not ours | |
| default: | |
| DEBUG_PRINT("Using specialized version of MAKEPROM_OP: OTHER SEXPs\n"); |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add plugin stencils, code coverage, moved RCP prologue to R runtime, specialize promises and optional support compiling promises.