Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PoC] compiler: Emit all-kernel_invariant objects as LLVM constants #610

Closed
wants to merge 1 commit into from

Conversation

dnadlinger
Copy link
Collaborator

@dnadlinger dnadlinger commented Nov 8, 2016

This enables constant propagation optimisations, as verified by
the included test case. This is only a first stop-gap measure, though;
we should support optimisation based on kernel invariants on a more
fine-grained level.

This enables constant propagation optimisations, as verified by
the included test case. This is only a first stop-gap measure, though;
we should support optimisation based on kernel invariants on a more
fine-grained level.

Signed-off-by: David Nadlinger <code@klickverbot.at>
@@ -1407,13 +1408,17 @@ def _quote_attributes():
not types.is_c_function(typ.attributes[attr]))
if is_class_function:
attrvalue = self.embedding_map.specialize_function(typ.instance, attrvalue)
if all_attrs_constant:
inst = typ.instance if types.is_constructor(typ) else typ
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@whitequark: This might be dodgy – I wasn't sure about the exact semantics of TConstructor.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is. E.g. in class Foo:, TConstructor is the type of the expression Foo whereas TInstance is the type of the expression Foo(). I'll merge this manually while fixing this.

@whitequark
Copy link
Contributor

Merged manually as described above. kernel_invariants only currently applies to instance attributes, not class attributes; something like class_kernel_invariants would be applicable to class attributes. We can implement this separately if it is desired.

@whitequark whitequark closed this Nov 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants