[Issue 9243] Order locals to prevent buffer overflow attacks

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 29 18:30:22 PST 2012


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



--- Comment #2 from Walter Bright <bugzilla at digitalmars.com> 2012-12-29 18:30:18 PST ---
(In reply to comment #1)
> (In reply to comment #0)
> > but this enhancement has zero cost, so why not?
> 
> Advanced compilers do two things:
> - If in a function you have nested scopes that define variables, two successive
> scopes are sometimes allowed to re-use the same stack space inside the same
> stack frame. I think this can "shuffle" (change) the position of variables in
> the stack frame.

Dmd already does this using graph coloring. I guess dmd is advanced? :-)


> - I think they sometimes use profile-driven optimization to tell what are the
> hottest stack variables used in a stack frame. This information is probably
> later used to set the position of the variables in the stack frame to put the
> hottest closer, or on the contrary to let them go different CPU cache lines, to
> avoid a slower modify-and-read access patterns.

Dmd doesn't do this one, although it could based on the same weighting
algorithm used to prioritize register assignments.

-- 
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