Skip to content
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

Reduce ExecutionState size and compute stacklimit correctly #1275

Merged
merged 2 commits into from
Nov 20, 2023

Conversation

ksh8281
Copy link
Contributor

@ksh8281 ksh8281 commented Nov 16, 2023

No description provided.

…th rareData)

* This path reduce gc_malloc count for try-catch, with, generator, async function

Signed-off-by: Seonghyun Kim <[email protected]>
@ksh8281 ksh8281 force-pushed the work62 branch 3 times, most recently from 20b18aa to 16ffd24 Compare November 16, 2023 04:57
@ksh8281 ksh8281 changed the title Reduce ExecutuionState size and compute stacklimit correctly Reduce ExecutionState size and compute stacklimit correctly Nov 16, 2023
@ksh8281 ksh8281 force-pushed the work62 branch 9 times, most recently from 9f802bf to 82eb49d Compare November 17, 2023 00:34
stackEndAddress = (char*)stackStartAddress + stackSize;
#endif
#endif
stackSize = std::min(stackSize, (size_t)STACK_USAGE_LIMIT);
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that stackSize = std::min(stackSize, (size_t)STACK_USAGE_LIMIT); is not used afterward.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops my mistake


#ifdef STACK_GROWS_DOWN
UNUSED_VARIABLE(stackEndAddress);
g_stackLimit = reinterpret_cast<size_t>(stackStartAddress) + STACK_FREESPACE_FROM_LIMIT;
Copy link
Contributor

Choose a reason for hiding this comment

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

This limit means that we only use STACK_FREESPACE_FROM_LIMIT size for stack which is 256 KB,
Am I correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If real stack size is 8MB, we will use (8MB-STACK_FREESPACE_FROM_LIMIT).
remained space used by computing loc when stackoverflow is occured

Copy link
Contributor

Choose a reason for hiding this comment

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

I see!

Comment on lines +68 to +73
context->m_needsExtendedExecutionState = true;
} else {
index = context->getRegister();
codeBlock->pushCode(LoadLiteral(ByteCodeLOC(m_loc.index), index, Value()), context, this->m_loc.index);
codeBlock->pushCode(ReturnFunctionSlowCase(ByteCodeLOC(m_loc.index), index), context, this->m_loc.index);
context->m_needsExtendedExecutionState = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this marking in return statement also necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ReturnFunctionSlowCase opcode may needs ControlFlowRecord

* Compute stack limit correctly through pthread API or Windows internal API
* Store stack limit in TLS(or global) not a VMInstance or ExecutionState

Signed-off-by: Seonghyun Kim <[email protected]>
Copy link
Contributor

@clover2123 clover2123 left a comment

Choose a reason for hiding this comment

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

LGTM

@clover2123 clover2123 merged commit 195039d into Samsung:master Nov 20, 2023
27 checks passed
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.

2 participants