Skip to content

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

Merged
merged 1 commit into from
Mar 27, 2019

Conversation

legendecas
Copy link
Contributor

@legendecas legendecas commented Feb 10, 2019

@legendecas legendecas force-pushed the handle-scope branch 3 times, most recently from f0a2834 to ce1871f Compare February 14, 2019 11:03
@legendecas legendecas force-pushed the handle-scope branch 3 times, most recently from 791b655 to 22bc118 Compare March 1, 2019 05:12
Copy link
Contributor

@LaszloLango LaszloLango left a 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.

Copy link
Contributor

@LaszloLango LaszloLango left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@zherczeg zherczeg left a 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; \
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

@legendecas legendecas Mar 27, 2019

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;
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

@legendecas legendecas Mar 20, 2019

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.

Copy link
Contributor Author

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.

@legendecas
Copy link
Contributor Author

Just forgot to push a naming issue here. Updated 😅

@LaszloLango
Copy link
Contributor

Any update on this PR?

JerryScript-DCO-1.0-Signed-off-by: legendecas legendecas@gmail.com
Copy link
Member

@zherczeg zherczeg left a comment

Choose a reason for hiding this comment

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

LGTM

@zherczeg zherczeg merged commit 5b29bf6 into jerryscript-project:master Mar 27, 2019
@legendecas legendecas deleted the handle-scope branch March 27, 2019 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Feature implementation jerry-ext Related to the jerry-ext library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle scope support in JerryScript
4 participants