3 ms·
Why doesn't the JIT assume classes are effectively sealed until it sees a subclass, like the JVM does.
by chrisseaton 8y ago
Why doesn't the JIT assume classes are effectively sealed until it sees a subclass, like the JVM does.
- pjmlp 8y agoBecause it is bad design known as fragile base class, which usually leads to hard to track down bugs, because someone somewhere is accessing methods or internal class data structures that they shouldn't have to in first place.
- chrisseaton 8y agoThat sounds more like an argument to seal your classes, rather than for why the JIT doesn't, in addition to that, assume classes as sealed until proved otherwise. You're talking about the programming model, where I'm talking about the implementation.
- pjmlp 8y agoWell, JIT heuristics end up being designed to live with the typical code patterns of the programming language. In Java's case, since methods are virtual by default so with open classes a large majority of the code has a possible indirection, hence such optimizations.
- steve-s 8y agoBecause AFAIK .net cannot deopt when another implementation is loaded dynamically
- tluyben2 8y agoI think Core 3.0 can?