Skip to content

Commit

Permalink
[MERGE #4731 @leirocks] fixes for dynamic profile caching
Browse files Browse the repository at this point in the history
Merge pull request #4731 from leirocks:dpcmaster

Previously there's leak because dynamic profile info is pinned and causes two roots(another is global function body) on a ring.
The fix is to use a heap allocated structure to save the information to dump to dynamic profile cache.
The fix missed a scenario the while loading from cache, it didn't save to the heap allocated dynamicProfileInfoMap,
and later some function is inlined, cause the info is missed while saving to the cache file, causes the cache file mismatch with the script code
  • Loading branch information
leirocks committed Feb 27, 2018
2 parents 71c9428 + 15b14ab commit 81aaed2
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 83 deletions.
3 changes: 3 additions & 0 deletions lib/Runtime/Language/DynamicProfileInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1971,11 +1971,13 @@ namespace Js

if (!reader->Read(functionId))
{
AssertOrFailFast(false);
return nullptr;
}

if (!reader->Read(&paramInfoCount))
{
AssertOrFailFast(false);
return nullptr;
}

Expand Down Expand Up @@ -2206,6 +2208,7 @@ namespace Js
}

Error:
AssertOrFailFast(false);
return nullptr;
}

Expand Down
2 changes: 2 additions & 0 deletions lib/Runtime/Language/DynamicProfileInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,7 @@ namespace Js
{
if (lengthLeft < sizeof(T))
{
AssertOrFailFast(false);
return false;
}
*data = *(T *)current;
Expand All @@ -914,6 +915,7 @@ namespace Js
size_t size = sizeof(T) * len;
if (lengthLeft < size)
{
AssertOrFailFast(false);
return false;
}
memcpy_s(data, size, current, size);
Expand Down
Loading

0 comments on commit 81aaed2

Please sign in to comment.