Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename macro defintr #60

Merged
merged 1 commit into from
Dec 29, 2024
Merged

Rename macro defintr #60

merged 1 commit into from
Dec 29, 2024

Conversation

jackalcooper
Copy link
Contributor

@jackalcooper jackalcooper commented Dec 29, 2024

Summary by CodeRabbit

  • Refactor
    • Renamed defintrinsic macro to defintr across multiple modules including Charms.Env, Charms.Intrinsic, Charms.Kernel, Charms.Pointer, Charms.Prelude, Charms.SIMD, and Charms.Term
    • Updated function definitions to use the new defintr keyword while maintaining existing functionality

Copy link
Contributor

coderabbitai bot commented Dec 29, 2024

Walkthrough

The pull request introduces a systematic renaming of the defintrinsic macro to defintr across multiple modules in the Charms library. This change affects modules such as Charms.Env, Charms.Intrinsic, Charms.Kernel, Charms.Pointer, Charms.Prelude, Charms.SIMD, and Charms.Term. The modification appears to be a consistent refactoring effort to simplify the intrinsic function definition syntax while maintaining the existing functionality of the affected functions.

Changes

File Change Summary
lib/charms/env.ex Renamed defintrinsic t() to defintr t()
lib/charms/intrinsic.ex Changed defmacro defintrinsic(call, do: body) to defmacro defintr(call, do: body)
lib/charms/kernel.ex Updated binary and unary operation intrinsic function definitions from defintrinsic to defintr
lib/charms/pointer.ex Replaced defintrinsic with defintr for multiple functions like allocate/1, load/2, store/2, etc.
lib/charms/prelude.ex Renamed intrinsic functions result_at, type_of, const, dump to use defintr
lib/charms/simd.ex Changed defintrinsic to defintr for new/2 and t/2 functions
lib/charms/term.ex Renamed defintrinsic t() to defintr t()

Possibly related PRs

Poem

🐰 Hop, hop, through the code we go,
From defintrinsic to defintr so,
A rabbit's refactor, clean and bright,
Simplifying syntax with pure delight!
Charms library dances, syntax so neat,
Our changes make coding a whimsical treat! 🌟


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
lib/charms/pointer.ex (1)

25-25: Consider refactoring the size allocation logic for clarity.
While the rename is correct, the internal logic for handling different size types (integer, single-element, or MLIR.Value) is quite extensive. Consider extracting it into a helper function for improved readability.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb106d7 and 4a14736.

📒 Files selected for processing (7)
  • lib/charms/env.ex (1 hunks)
  • lib/charms/intrinsic.ex (1 hunks)
  • lib/charms/kernel.ex (2 hunks)
  • lib/charms/pointer.ex (10 hunks)
  • lib/charms/prelude.ex (4 hunks)
  • lib/charms/simd.ex (2 hunks)
  • lib/charms/term.ex (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • lib/charms/simd.ex
🔇 Additional comments (21)
lib/charms/env.ex (1)

8-8: Rename appears consistent.
Renaming from defintrinsic to defintr is clear and consistent. No issues observed with the new definition for t().

lib/charms/term.ex (1)

11-11: Rename aligns well with the new macro usage.
This is a straightforward, consistent rename to defintr. The intrinsic function logic remains the same, so no concerns here.

lib/charms/kernel.ex (2)

Line range hint 52-76: Binary ops definition updated smoothly.
Renaming defintrinsic to defintr for the binary operations is consistent and does not affect the logic. Implementation remains sound, including the handling of mismatched argument types.


Line range hint 80-92: Unary negation rename is coherent with the rest of the changes.
The rename for the !value intrinsic is straightforward. It continues to raise an exception for unsupported types. No issues found with the updated syntax.

lib/charms/prelude.ex (6)

Line range hint 21-30: Consistent rename for result_at/2.
No logic changes noted. The rename from defintrinsic to defintr follows the intended convention across the codebase.


35-37: Refactor retains behavior.
type_of/1 remains the same functionally. The rename is consistent with the rest of the codebase.


Line range hint 39-49: No functional changes for const/1.
The rename is straightforward, and the macro usage for constant creation remains intact.


51-51: dump/1 rename is consistent.
Retains the same debugging/logging logic. The rename has no functional impact.


101-101: Updated signature for ENIF bridging.
The loop-based rename for each ENIF function is correct, ensuring consistency.


Line range hint 1-1: Confirm no leftover references to defintrinsic remain.
All changes appear consistent, though consider verifying other references in the codebase, documentation, or comments that might mention the old macro name.

Use the following script to search for leftover references to defintrinsic:

✅ Verification successful

References to defintrinsic found in lib/charms/intrinsic.ex appear to be intentional

The occurrences of defintrinsic found in lib/charms/intrinsic.ex are part of the internal implementation:

  • Used as a module attribute: @defintrinsic
  • Used in metaprogramming contexts for generating unique identifiers: __defintrinsic_#{name}__

These references are legitimate implementation details rather than leftover usage of a deprecated macro. The pattern suggests these are intentionally used as part of the intrinsic definition mechanism.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Searching for any leftover references to `defintrinsic` across the entire repository.

rg "defintrinsic"

Length of output: 322

lib/charms/intrinsic.ex (1)

70-70: Rename aligns with PR objective and is consistent across the codebase.
The renaming from defintrinsic to defintr is consistent with the broader refactor, and the updated macro logic remains unchanged in essence. Good job!

lib/charms/pointer.ex (10)

16-16: Rename to defintr is consistent and correct.
This change correctly aligns with the newly introduced macro name in Charms.Intrinsic. No issues found.


73-73: Rename to defintr looks good.
No functional concerns with the load(type, ptr). All logic remains unchanged.


88-88: Consistent rename for typed pointer load.
No further changes required here; function behavior is unaffected.


103-103: Store function rename is fine.
Implementation is consistent with the rest of the pointer logic.


150-150: defintr rename is correct; logic for offset calculation remains unchanged.
All good.


182-182: Element pointer overload rename is consistent.
No issues found.


194-194: Rename for element_type/1 remains aligned with the new intrinsic naming convention.
No concerns here.


207-207: Pointer type helper rename to defintr is consistent.
The function is straightforward and remains valid.


212-212: t(elem_t) rename is correct.
The pointer type logic is unchanged and still appropriate.


255-255: Memcopy function rename is consistent with new macro.
Functionality is unaffected, so this is good to go.

@jackalcooper jackalcooper merged commit 9cafb76 into main Dec 29, 2024
2 checks passed
@jackalcooper jackalcooper deleted the rename-defintrinsic-defintr branch December 29, 2024 16:39
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.

1 participant