[PATCH] D11491: [Polly] Move computations out of constructors
llvm at meinersbur.de
Fri Jul 24 12:44:33 PDT 2015
Meinersbur created this revision.
Meinersbur added a reviewer: grosser.
Meinersbur added subscribers: pollydev, llvm-commits.
Meinersbur added a project: Polly.
It is common practice to keep constructors lightweight. The reasons include:
- The vtable during the constructor's execution is set to the static type of the object, not to the vtable of the derived class. That is, method calls behave differently in constructors and ordinary methods. This way it is possible to call unimplemented methods of abstract classes, which usually results in a segmentation fault.
- If an exception is thrown in the constructor, the destructor is not called, potentially leaking memory.
- Code in constructors cannot be called in a regular way, e.g. from non-constructor methods of derived classes.
- Because it is common practice, people (including me) do not expect the constructor to do more than initializing data and skip them when looking for bugs.
Not all of these are applicable to LLVM (e.g. exceptions are disabled).
This patch refactors out the computational work in the constructors of Scop, ScopStmt and IslAst into regular init functions and introduces static create-functions as replacement. The constructor ScopArrayInfo also has calls, but it is small and does not call methods of its own class.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 12956 bytes
Desc: not available
More information about the llvm-commits