www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2326] New: Methods within final class are not considered final when optimizing

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2326

           Summary: Methods within final class are not considered final when
                    optimizing
           Product: D
           Version: 1.034
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: matti.niemenmaa+dbugzilla iki.fi


final class A {
        int i;
              void f() { ++i; }
        final void g() { ++i; }

        void foo() {
                f();
                g();
        }
}

A snippet from obj2asm on the above, compiled with "dmd -c -O -inline
-release":

_D4asdf1A3fooMFZv       comdat
        assume  CS:_D4asdf1A3fooMFZv
                push    EBX
                mov     EBX,EAX
                mov     ECX,[EBX]
                call    dword ptr 014h[ECX]
                inc     dword ptr 8[EBX]
                pop     EBX
                ret

The call to g is inlined, but the call to f is not. Since class A is final, all
methods within it should be considered final for purposes of optimization;
thus, in this case, both f and g should be inlined.


-- 
Sep 01 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2326





------- Comment #1 from bugzilla digitalmars.com  2008-11-14 22:13 -------
This only happens on D1.


-- 
Nov 14 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2326





------- Comment #2 from 2korden gmail.com  2008-11-15 06:41 -------
(In reply to comment #1)
 This only happens on D1.
 

So? Does this mean that the bug is not considered harmful and thus wont be fixed in D1? --
Nov 15 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2326





------- Comment #3 from fraserofthenight gmail.com  2008-11-15 08:14 -------
Yes, I would very much like to see this fixed in D1, especially since it's not
a spec change at all.


-- 
Nov 15 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2326


torhu yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |torhu yahoo.com




------- Comment #4 from torhu yahoo.com  2008-12-07 06:54 -------
This is listed in the changelog for 1.037, can anyone confirm that it's fixed?


-- 
Dec 07 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2326


matti.niemenmaa+dbugzilla iki.fi changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #5 from matti.niemenmaa+dbugzilla iki.fi  2008-12-07 09:11
-------
Fixed in DMD 1.037. (At least the simple example in the report.)


-- 
Dec 07 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2326


Matti Niemenmaa <matti.niemenmaa+dbugzilla iki.fi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow gmail.com


--- Comment #6 from Matti Niemenmaa <matti.niemenmaa+dbugzilla iki.fi>
2009-09-18 06:13:00 PDT ---
*** Issue 1909 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 18 2009