5 ms·
Guide to the CoreCLR Source Code
- cm2187 10y agogc.cpp, 37,000 lines of code. And some want to remove Regions from the .net framework!
- matthewwarren 10y agoYeah people always find that file surprising. I think the reason for it being soo large is that the GC is shared across all the .NET versions, so having it in one file has some advantages. See https://github.com/dotnet/coreclr/issues/408 https://github.com/dotnet/coreclr/issues/408 for a discussion on reorganizing it.
- LeanderK 10y agosadly, no. Excerpt from the issue > In #401 @cnblogs-dudu referenced a post explaining that the GC was machine-generated from LISP. Since gc.cpp is not a real source code (just intermediate code), but the lisp code is, should it be more useful to publish the lisp source and the transpiler (Source-to-source compiler) for LISP -> CPP?
- matthewwarren 10y agoIt's my understanding that the LISP -> CPP was only done in the beginning and is no longer carried out. I.e. all recent development is done directly in the .cpp source. There's a reply from a Microsoft employee that seems to confirm this, see https://github.com/dotnet/coreclr/issues/408#issuecomment-78081022 https://github.com/dotnet/coreclr/issues/408#issuecomment-78...
- teh_klev 10y agoHere's a comment by Patrick Dussud on an old blog entry explaining the LISP origins of the GC: https://blogs.msdn.microsoft.com/patrick_dussud/2006/11/21/how-it-all-startedaka-the-birth-of-the-clr/#comment-163 https://blogs.msdn.microsoft.com/patrick_dussud/2006/11/21/h... I thought I knew a thing or two about .NET, having used it since beta days, I had no idea LISP was used to bootstrap the original GC code. Fascinating stuff. I've archived it here just in case: http://archive.is/1qk25 http://archive.is/1qk25 Patrick is also interviewed on Channel9 and he talks about the GC. Not watched it yet: https://channel9.msdn.com/Shows/Going+Deep/Patrick-Dussud-Garbage-Collection-Past-Present-and-Future https://channel9.msdn.com/Shows/Going+Deep/Patrick-Dussud-Ga...
- matthewwarren 10y agoYeah that's a great video, he really knows his stuff!
- deleted 10y ago[deleted]
- UnoriginalGuy 10y agoRegions aren't a .Net Framework feature, they're a language feature. There's absolutely no reason they should be in C# and encourage bad coding practices (like overly long .cs files). Even if you need all your code in a single class, you can shard that class across several .cs files to make organisation and maintainability easier. Regions are just a crutch people use to allow them to create 10K+ line .cs files that will eventually become a maintainability nightmare (as well as making merges/check-ins/finding things more annoying in general). Only region I'll use is the built DEBUG one and I only use that to create: private bool IsDebug() { #if DEBUG return true; #else return false; #endif } Stackoverflow answer for why regions are bad: http://softwareengineering.stackexchange.com/questions/53086/are-regions-an-antipattern-or-code-smell http://softwareengineering.stackexchange.com/questions/53086...
- taco_emoji 10y agoI agree about regions, but `#if` et al are preprocessor directives, not regions. They actually influence how your code is compiled.
- lazyman75 10y agoWell, just because YOU cannot write good code with regions doesn't mean it's a bad feature. It's actually very very useful thing, but as with everything, you have to know when and how to use it.
- tombert 10y agoI find these runtime VMs fascinating to ogle at after looking at how Erlang's GC worked. I think you have provided me reading material for this weekend.
- matthewwarren 10y agoGlad to be of service!! BTW if it's reading material you want, you should also check out me other post 'Research papers in the .NET source' http://mattwarren.org/2016/12/12/Research-papers-in-the-.NET-source/ http://mattwarren.org/2016/12/12/Research-papers-in-the-.NET...
- NeverTrump 10y agoI want to note something that my interest some: The second biggest fear which made Sun sue Microsoft was that when MS licensed Java, their VM was faster than Sun's. Microsoft is (was?) the king of JIT. Technically biggest since if theirs was faster, they wouldn't have cared for Microsoft's anyway. Even now CLR is generally considered much faster than JRE. I don't know how Chakra compares against v8 but then it also depends on what makes money for MS.
- chrisseaton 10y ago> Microsoft is (was?) the king of JIT. Hmmm really? I'm not sure I can think of many technological breakthroughs in the area of JITs that Microsoft have been responsible for? Google and Mozilla have made lots of advances, as have Sun and Oracle, and lots of academics like the PyPy people, HP with Dynamo. What have Microsoft done in the area of JITs that so notable as to earn them the title 'king' of JITs? Can you say anything specific?
- NeverTrump 10y agoIt's my first meaningful sentence you retard.
- jeff_petersen 10y agoPlease don't use ableist slurs :^)
- dang 10y agoWe've banned this account for violating the HN guidelines.
- cm2187 10y agoMostly I never understood the point of JIT in the .net framework. You pay a price in term of startup time, but the reality is that you can only run .net on x86 and x64. So we might as well have saved the trouble. And the first time .net was given an opportunity to run on ARM (WinRT), they disallowed regular .net applications in order to introduce a toll through the windows store. We would have been better off without JIT. Even now with ARM. You compile to 3 architectures,... so what?
- giancarlostoro 10y ago>> Just over 2 years ago Microsoft open-sourced the entire .NET framework, Except they open-sourced a new .NET stack, not really the entire .NET Framework, .NET Core and .NET Framework are similar but not fully backwards compatible. I've been porting .NET Framework code to .NET Core and depending on how specialized your project is you may not always find the same libraries supporting your project. A project that perfectly compiles with .NET 2.0 will not just compile for .NET Core, at least not as easily as using a .NET Framework 2.0 project in .NET Framework 4.6. I love Microsoft and .NET but I think Core is executed poorly. You also have EntityFramework vs. EntityFramework Core which lacks features from EF which were deemed "unused" which bites some people in the face.
- UK-AL 10y agoI think it needed to be done. There is a lot of stuff .net framework that doesn't really make sense anymore.
- matthewwarren 10y agoWell, it depends how you look at it, but you have a point. I guess I could've written 'Microsoft open-sourced the entire .NET stack'. I wanted to make it clear that they open-sourced everything, i.e. runtime, JIT, GC, base-class libraries, etc
- giancarlostoro 10y agoI understood what you meant, but I figure some might not understand what you meant, overall I appreciate the write up, I will take the time to read through it when I'm not working. It also inspired me to want to read through the source code behind .NET's CoreCLR.
- matthewwarren 10y ago> I will take the time to read through it when I'm not working. It also inspired me to want to read through the source code behind .NET's CoreCLR. Excellent, that's the effect I hope my posts have!
- youdontknowtho 10y agoThe GC Sample is really interesting.
- matthewwarren 10y agoYeah it's great, I learnt so much about the GC from looking at that sample. BTW if you want a bit more info on it, I wrote a whole blog post, see http://mattwarren.org/2016/02/04/learning-how-garbage-collectors-work-part-1/ http://mattwarren.org/2016/02/04/learning-how-garbage-collec...
- eiji 10y agoWhat's with the Smalltalk portion? Anyone knows why that is?
- desdiv 10y agoThere's no actual Smalltalk code in there. It's just a Github display bug. https://github.com/dotnet/coreclr/search?l=smalltalk https://github.com/dotnet/coreclr/search?l=smalltalk
- matthewwarren 10y agoI didn't notice that before, I wonder what file extension it's incorrectly assuming are smalltalk? There is a whole lot of '.S' files in there, I wonder if it's those?
- jidenna 10y agoI was always having these gut feelings about my partner cheating on me with her boss at work but i couldn't confront her about it because i didn't want to cause any problems where there's none. Then Contact World Best Hackers: They are Set of professionals that provide Quality Hacking Services. They have series of testimonies from Their clients Worldwide,they are Proficient in Hacking every areas of ICT which include: * Hack and access DATA FROM ANY COMPANY Web Sites, he hack hack into a company email account call log,Hack Visichat Room ? Hack Flash Chat Room ? Hack Ftp User & Pass ? Hack Database ? Hack Yahoo Mail ? Hack Gmail Id ? Hack Websites ? Hack FaceBook Account ? hack Vb Forum ? Hack WordPress Blog ? hack C C any country ? hack moneybroker ACCOUNT ? hack liberty Reverse Account ? hack paypal Account ? increase your credit score today? bypass Google phone verification, ? Hash Crack ? Hack Bank Account ? increase your credit score today,online game access?hack twitter?and listened to all his calls and upgrading result making changes in database,such as your college/university grades,Retrival of lost files,preventing you from been hacked or tracked,You can reach out to him for any hack related exploit {{alandavid76@tutanota dot com} for an effective service and consider your big problems solved..