[Issue 5748] New: @naked annotation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 17 10:05:42 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5748

           Summary: @naked annotation
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2011-03-17 10:02:29 PDT ---
I think that the "naked" that currently is usable inside asm blocks is a
property of the whole function that contains the asm block and not just of the
asm block, so I suggest to deprecate (and later remove) the "naked" and to add
a @naked function annotation.

An example, from (from dmd\src\druntime\src\core\thread.d):


version( D_InlineAsm_X86 ) {
    static void* getBasePtr() {
        asm {
            naked;
            mov EAX, EBP;
            ret;
        }
    }

    obj.m_main.bstack = getBasePtr();
} else version( D_InlineAsm_X86_64 ) {
    static void* getBasePtr() {
        asm {
            naked;
            mov RAX, RBP;
            ret;
        }
    }

    obj.m_main.bstack = getBasePtr();
}


To:

version( D_InlineAsm_X86 ) {
    @naked static void* getBasePtr() {
        asm {
            mov EAX, EBP;
            ret;
        }
    }

    obj.m_main.bstack = getBasePtr();
} else version( D_InlineAsm_X86_64 ) {
    @naked static void* getBasePtr() {
        asm {
            mov RAX, RBP;
            ret;
        }
    }

    obj.m_main.bstack = getBasePtr();
}

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


More information about the Digitalmars-d-bugs mailing list