Skip to content

refactor: remove eval#22

Closed
alexandrius wants to merge 1 commit into
exodus-3.16.7from
ap/eval_on_cpp
Closed

refactor: remove eval#22
alexandrius wants to merge 1 commit into
exodus-3.16.7from
ap/eval_on_cpp

Conversation

@alexandrius
Copy link
Copy Markdown

@alexandrius alexandrius commented Mar 28, 2025

Summary

Stores JS worklet code on in the CPP map.
The evaluation of the function is now triggered by the unique hashvalue.
Removes access to JS code evaluation

Test plan

@alexandrius alexandrius changed the title refactor: remove evals refactor: remove eval Mar 28, 2025
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Gemini's work

const jsi::Value &thisValue,
const jsi::Value *args,
size_t count) -> jsi::Value {
auto code = std::make_shared<const jsi::StringBuffer>("("+WorkletStore::getInstance().get(args[0].asNumber())+"\n)");
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

grab the function from the store

const reanimatedWorkletCodeProperty = objectProperty(
identifier('__reanimated_workletCodeWrapper'),
objectExpression([workletCodeProperty])
objectExpression([workletCodeProperty, workletHashProperty])
Copy link
Copy Markdown
Author

@alexandrius alexandrius Mar 28, 2025

Choose a reason for hiding this comment

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

add hash to our wrapper for easy access in Shareables.CPP

auto code = object.getProperty(rt, prop).asString(rt).utf8(rt);
double hash = object.getProperty(rt,jsi::String::createFromUtf8(rt,"hash")).asNumber();
WorkletStore::getInstance().set(hash, code);
shareable = std::make_shared<ShareableString>("");
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No need to return anything

auto code = object.getProperty(rt, prop).asString(rt).utf8(rt);
double hash = object.getProperty(rt,jsi::String::createFromUtf8(rt,"hash")).asNumber();
WorkletStore::getInstance().set(hash, code);
shareable = std::make_shared<ShareableString>("");
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No need to return anything

@alexandrius
Copy link
Copy Markdown
Author

Closing in favor of #21

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