summaryrefslogtreecommitdiff
path: root/plugins/workflow_objc/src/workflow.rs
diff options
context:
space:
mode:
authorMark Rowe <mark@vector35.com>2025-09-29 17:02:13 -0700
committerMark Rowe <mark@vector35.com>2025-10-02 09:33:41 -0700
commit82e8eaca7db9dc7284e3fb382eecbfbecef7bcb6 (patch)
treea820cd105a79efb74c8e35cf76e532c62e3a5fae /plugins/workflow_objc/src/workflow.rs
parentc3225e7249815ff073794054a99c337f9602c413 (diff)
[ObjC] Add support for removing runtime calls that perform retain count operations
A new activity is added that will remove calls to `objc_retain`, `objc_release`, `objc_autorelease`, and related functions. It is disabled by default due to the fact it changes the semantics of the code. It can be enabled on a per-function basis via the Function Settings context menu or command palette entry. Alternatively, it can be enabled in Open with Options or in user settings if a user would prefer it be on for an entire file or for all files they open. For now the activity is only eligible within arm64 binaries. Supporting x86_64 will require matching some slightly different IL patterns.
Diffstat (limited to 'plugins/workflow_objc/src/workflow.rs')
-rw-r--r--plugins/workflow_objc/src/workflow.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/workflow_objc/src/workflow.rs b/plugins/workflow_objc/src/workflow.rs
index f411951b..f1054411 100644
--- a/plugins/workflow_objc/src/workflow.rs
+++ b/plugins/workflow_objc/src/workflow.rs
@@ -69,9 +69,28 @@ pub fn register_activities() -> Result<(), WorkflowRegistrationError> {
run(activities::super_init::process),
);
+ let remove_memory_management_activity = Activity::new_with_action(
+ activity::Config::action(
+ "core.function.objectiveC.removeMemoryManagement",
+ "Obj-C: Remove reference counting calls",
+ "Remove calls to objc_retain / objc_release / objc_autorelease to simplify the resulting higher-level ILs",
+ )
+ .eligibility(
+ activity::Eligibility::auto_with_default(false).matching_all_predicates(&[
+ activity::ViewType::in_(["Mach-O", "DSCView"]).into(),
+ activity::Platform::in_(["mac-aarch64", "ios-aarch64"]).into()
+ ])
+ ),
+ run(activities::remove_memory_management::process),
+ );
+
workflow
.activity_after(&inline_stubs_activity, "core.function.translateTailCalls")?
.activity_after(&objc_msg_send_calls_activity, &inline_stubs_activity.name())?
+ .activity_before(
+ &remove_memory_management_activity,
+ "core.function.generateMediumLevelIL",
+ )?
.activity_after(&super_init_activity, "core.function.generateMediumLevelIL")?
.register_with_config(WORKFLOW_INFO)?;