Skip to content

Fix js initializer merging - #24050

Merged
Mohamed Hegazy (mhegazy) merged 4 commits into
masterfrom
fix-js-initializer-merging
May 11, 2018
Merged

Fix js initializer merging#24050
Mohamed Hegazy (mhegazy) merged 4 commits into
masterfrom
fix-js-initializer-merging

Conversation

@sandersn

@sandersnNathan Shively-Sanders (sandersn) commented May 11, 2018

Copy link
Copy Markdown
Member

Fixes exponential merging behaviour of special js initialisers. Some baselines change because it fixes some previously incorrect merged symbol structure.

I have not tested it with Visual Studio, but it's basically the same as the fix we had working this afternoon, except that it doesn't break any of our existing tests.

Fixes#24015

@RyanCavanaugh

Copy link
Copy Markdown
Member

Porting to 2.8

@RyanCavanaugh

Copy link
Copy Markdown
Member

Bug is #24015

@RyanCavanaugh

Copy link
Copy Markdown
Member

Since we don't need this fix in master ASAP, let's get some test cases / asserts added to this PR. I'm running manual VS tests in the 2.8 port branch

@sandersn

Copy link
Copy Markdown
MemberAuthor

I added a test case and an assert that immediately catches the problem (1) in compilation (2) in fourslash (3) in interactive VS Code usage, so I think this is ready to go.

@RyanCavanaugh

Copy link
Copy Markdown
Member

Looks good. Can you add another fourslash test for the other repro we got?

@mhegazy
Mohamed Hegazy (mhegazy) deleted the fix-js-initializer-merging branch May 11, 2018 17:45
@sandersn

Copy link
Copy Markdown
MemberAuthor

Ryan Cavanaugh (@RyanCavanaugh) can you send me the other minified repro? Since we didn't change the definition of getJSInitializerSymbol, and the binder code that creates symbols based on getJSInitializer is a single code path, I don't think it will prove anything new, but the cost of adding a second test is low.

Note that without the fix the assert fires for existing tests too: to wit, the ones that had changed baselines.

@RyanCavanaugh

Copy link
Copy Markdown
Member

The two repros I have are

// file1.js
blah.prototype = {
m: "q"
};
// file2.d.ts
declare class blah { }

and

// file1.js
var N = {};
N.X = function() { };
// file2.d.ts
declare namespace N {
class X { }
}

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Symbol table corruption leads to runaway memory usage

3 participants

@sandersn@RyanCavanaugh@mhegazy