Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Replace slp_dont_optimize... vars by more appropriate code #181

Closed
akruis opened this issue Nov 11, 2018 · 1 comment
Closed

Replace slp_dont_optimize... vars by more appropriate code #181

akruis opened this issue Nov 11, 2018 · 1 comment

Comments

@akruis
Copy link

akruis commented Nov 11, 2018

Stackless contains a few places, where it has to prevent overly compiler optimisation for the following reasons:

  • Stack pointer manipulation using alloca() without accessing the allocated memory.
  • Storing data on the stack just before hard switching
  • Using the address of identical functions to identify the function.

Currently Stackless writes the address of the object / a dummy value to a global variable with external linkage. This works as long as the compiler/linker can't optimise away this variable. A conventional compile, then link tool chain can't do this, but a tool chain with whole program optimisation can. Pull request #163 reports such a problem and issue #173 might also be caused by whole program optimisation. Linux is not affected, because ELF requires that a variable with external linkage can be dynamically linked at run time.

Plan: use pull request #163 and the code available at https://github.com/facebook/folly/blob/master/folly/Benchmark.h to write a portable macro, that acts as a sink for a pointer variable.

@akruis akruis self-assigned this Nov 11, 2018
@akruis akruis changed the title Replace slp_dont_optimize... vars by more apropriate code Replace slp_dont_optimize... vars by more appropriate code Nov 11, 2018
akruis pushed a commit that referenced this issue Nov 11, 2018
by more appropriate compiler specific code. The new code should work
with whole program optimisation.

(cherry picked from commit 464ef17bcbf634ae33b37672a5b803f0ce940086)
akruis pushed a commit that referenced this issue Nov 11, 2018
by more appropriate compiler specific code. The new code should work
with whole program optimisation.
@akruis
Copy link
Author

akruis commented Nov 11, 2018

Done for master-slp and 3.6-slp. Unfortunately it didn't fix #173.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant