May 20, 2005 Re: v0.123 borks the vTable ~ Example | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kris | "Kris" <fu@bar.com> wrote in message news:d6lfa6$1j0r$1@digitaldaemon.com... > Right; but isn't that trying to salvage a use-case that's already broken? I > mean, you're working with a invalid null instance at that point - yes? Casting a null class reference to an interface should produce a null, not a small offset value. |
May 20, 2005 Re: v0.123 borks the vTable ~ Example | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kris | "Kris" <fu@bar.com> wrote in message news:d6lfpg$1jiu$1@digitaldaemon.com... > Shall I test it against Mango? I want to look at the package problem first. |
May 20, 2005 Re: v0.123 borks the vTable ~ Example | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <newshound@digitalmars.com> wrote in message news:d6lg1n$1jrk$1@digitaldaemon.com... > > "Kris" <fu@bar.com> wrote in message news:d6lfa6$1j0r$1@digitaldaemon.com... > > Right; but isn't that trying to salvage a use-case that's already broken? > I > > mean, you're working with a invalid null instance at that point - yes? > > Casting a null class reference to an interface should produce a null, not a > small offset value. Arguably so. But then what should one do with -release? This can lead to quite a bit of bloat, and the extra jumps don't help any with pipeline bubbles in todays CPUs ... seems a shame to really penalize the usage of interfaces in this manner, especially with code that (a) has no null object references, or (b) does explicit checks for them in the most appropriate places, such as DbC; (c) the library function used for casting should do this check, but inline code? with full optimization enabled? We have to wonder ... The codegen used to be a whole lot better in these cases. For example, here's the codegen distinction between where CR is an object and where CR is an interface ~ CR implements an interface in both cases, which is expected by the called method: 2449: Stdout.put (CR); 0041ECD3 push dword ptr [_D5mango2io6Writer2CRC5mango2io5model7IWriter14INewlineWriter (00550e38)] 0041ECD9 mov eax,[_D5mango2io6Stdout6StdoutC5mango2io6Stdout13ConsoleWriter (005512b0)] 0041ECDE mov ecx,dword ptr [eax] 0041ECE0 call dword ptr [ecx+38h] 2449: Stdout.put (CR); 0041F093 cmp dword ptr [_D5mango2io6Writer2CRC5mango2io6Writer13NewlineWriter (00551e38)],0 0041F09A je _D8unittest14testTextWriterFZv+1Ah (0041f0a6) 0041F09C mov eax,[_D5mango2io6Writer2CRC5mango2io6Writer13NewlineWriter (00551e38)] 0041F0A1 lea ecx,[eax+10h] 0041F0A4 jmp _D8unittest14testTextWriterFZv+1Ch (0041f0a8) 0041F0A6 xor ecx,ecx 0041F0A8 push ecx 0041F0A9 mov eax,[_D5mango2io6Stdout6StdoutC5mango2io6Stdout13ConsoleWriter (005522b0)] 0041F0AE mov edx,dword ptr [eax] 0041F0B0 call dword ptr [edx+38h] These used to be *almost* identical. Should people avoid using interfaces, since their usage inccurs two wholly unecessary jumps for every function call that accepts one? |
Copyright © 1999-2021 by the D Language Foundation