Skip to content

Merge lcache into context #2498

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

Conversation

akosthekiss
Copy link
Member

It is superfluous to maintain multiple globals when the whole
reason of context is to keep them in a single place. It also
simplifies initialization and external context creation a bit.

Also removed unused lcache header includes.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu

@akosthekiss akosthekiss added the ecma core Related to core ECMA functionality label Aug 30, 2018
@akosthekiss
Copy link
Member Author

Note: this is the first part of a series of patches about refactoring the context concept.

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.

Is there a perf change after this patch?

ecma_lcache_hash_entry_t lcache[ECMA_LCACHE_HASH_ROWS_COUNT][ECMA_LCACHE_HASH_ROW_LENGTH]; /**< Hash table for
* caching the last
* access of properties.
*/
Copy link
Member

Choose a reason for hiding this comment

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

I would intorduce a typedef for this or move the comment the line before. Also add a comment that this must be the last member of the context for performance reasons.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll move the comment, typedef would be an overkill for this.

@@ -36,7 +35,6 @@
void
ecma_init (void)
{
ecma_lcache_init ();
Copy link
Member

Choose a reason for hiding this comment

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

Is the cache cleared along the context?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, jerry_init clears all the context with memset. Now that lcache is part of the context, it's initialization is also handled there.

@akosthekiss
Copy link
Member Author

The PR has no performance implications (perhaps just some noise in the measurements):

Benchmark Perf (sec)
3d-cube.js 0.789 -> 0.793 : -0.597%
3d-raytrace.js 1.022 -> 1.021 : +0.129%
access-binary-trees.js 0.558 -> 0.552 : +0.969%
access-fannkuch.js 2.034 -> 2.043 : -0.416%
access-nbody.js 1.064 -> 1.069 : -0.501%
bitops-3bit-bits-in-byte.js 0.485 -> 0.486 : -0.258%
bitops-bits-in-byte.js 0.638 -> 0.635 : +0.515%
bitops-bitwise-and.js 0.921 -> 0.923 : -0.250%
bitops-nsieve-bits.js 1.095 -> 1.101 : -0.556%
controlflow-recursive.js 0.367 -> 0.367 : -0.010%
crypto-aes.js 0.865 -> 0.866 : -0.106%
crypto-md5.js 0.601 -> 0.591 : +1.695%
crypto-sha1.js 0.591 -> 0.582 : +1.619%
date-format-tofte.js 0.717 -> 0.715 : +0.250%
date-format-xparb.js 0.433 -> 0.431 : +0.450%
math-cordic.js 1.157 -> 1.149 : +0.642%
math-partial-sums.js 0.719 -> 0.719 : +0.025%
math-spectral-norm.js 0.534 -> 0.528 : +1.108%
string-base64.js 1.416 -> 1.422 : -0.419%
string-fasta.js 1.337 -> 1.322 : +1.129%
Geometric mean: +0.273%

Binary sizes (bytes)
a264560:132660
5729317:132660

I'll deal with the comment placement review remark and update the patch.

It is superfluous to maintain multiple globals when the whole
reason of context is to keep them in a single place. It also
simplifies initialization and external context creation a bit.

Also removed unused lcache header includes.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
@akosthekiss akosthekiss force-pushed the context-rework-lcache branch from 5729317 to 466d219 Compare August 31, 2018 09:56
@akosthekiss
Copy link
Member Author

PR updated according to the review.

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

@akosthekiss akosthekiss merged commit 6049c03 into jerryscript-project:master Aug 31, 2018
@akosthekiss akosthekiss deleted the context-rework-lcache branch August 31, 2018 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ecma core Related to core ECMA functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants