-
Notifications
You must be signed in to change notification settings - Fork 682
Implement handle scope API in jerry-ext #2753
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
Conversation
f0a2834
to
ce1871f
Compare
791b655
to
22bc118
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late response, I found a few style issues. Please update the PR.
22bc118
to
6402dbe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this patch. I have a few questions though.
|
||
#define JERRYX_HANDLE_SCOPE_FIELDS \ | ||
jerry_value_t handle_prelist[JERRYX_HANDLE_PRELIST_SIZE]; \ | ||
size_t handle_count; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I understand correctly that handle_count must be lass than JERRYX_HANDLE_PRELIST_SIZE? If so, uint8_t should be enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, handle_count
could grows greater than JERRYX_HANDLE_PRELIST_SIZE, after then new handles would be allocated outside of prelist as a chained list instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to count those handles in the chained list? It seems to me there is no api function to get the number of handles, and the rest of the functions could be changed to handle_count to not grow after reaching JERRYX_HANDLE_PRELIST_SIZE. Is there a function where it would be a large performance drawback to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated :). Only handles in prelist would be counted then.
|
||
typedef struct jerryx_handle_scope_s jerryx_handle_scope_t; | ||
typedef jerryx_handle_scope_t *jerryx_handle_scope; | ||
typedef jerryx_handle_scope_t *jerryx_escapable_handle_scope; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it worth to have two structures for this? Can we gain much on having a "non-escapable" handle scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently there is no differences between those two types. It's just declared as two different type for possible future data struct migration issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we gain much on having a "non-escapable" handle scope?
A bool
field escaped
could be saved in the case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yet since there is a list of pre-allocated handle scopes, these handle scopes in the list must be escapable for possible usage.
6402dbe
to
dde2fda
Compare
Just forgot to push a naming issue here. Updated 😅 |
dde2fda
to
c51245e
Compare
Any update on this PR? |
JerryScript-DCO-1.0-Signed-off-by: legendecas legendecas@gmail.com
c51245e
to
56a8069
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
close #2732.
Picked from https://github.com/yodaos-project/ShadowNode/tree/master/deps/jerry/jerry-ext/handle-scope
JerryScript-DCO-1.0-Signed-off-by: legendecas legendecas@gmail.com