-
Notifications
You must be signed in to change notification settings - Fork 229
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
compiler: Infer type generation from _C_ctype #1971
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov Report
@@ Coverage Diff @@
## master #1971 +/- ##
=======================================
Coverage 87.88% 87.88%
=======================================
Files 213 213
Lines 36196 36175 -21
Branches 5449 5459 +10
=======================================
- Hits 31810 31793 -17
+ Misses 3877 3867 -10
- Partials 509 515 +6
Help us with your feedback. Take ten seconds to tell us how you rate us. |
_C_field_nbytes = 'nbytes' | ||
_C_field_dmap = 'dmap' | ||
|
||
_C_ctype = POINTER(type(_C_structname, (Structure,), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you see? a ney symbolic type, ArrayMapped
, but the only thing that needs to be defined is the _C_ctype
. This is enough to create a ctype
, a str
representing its C type, etc etc.
@@ -1269,120 +1269,6 @@ def test_loose_kwargs(self): | |||
@skipif('device') | |||
class TestDeclarator(object): | |||
|
|||
def test_heap_1D(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all these tests were obsolete, a massive PITA to maintain, and basically unnecessary. Hence, dropping
|
||
def ctypes_to_cgen(ctype, fields=None): | ||
""" | ||
Create a cgen.Structure off a ctypes.Struct, or (possibly nested) ctypes.Pointer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gap after period
2dab961
to
1619f80
Compare
1619f80
to
d29d57d
Compare
d29d57d
to
9a5e60d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall not any comment to make.
CodeSymbol subclasses were required to override a subset of
_C_typedata
,_C_typename
,_C_typedecl
,_C_ctype
. This was messy, difficult to understand, challenging to maintain, and also a bit hacky.Now CodeSymbol subclasses are only requested to specialize
_C_ctype
. All other information are derived from_C_ctype
through suitable utility functions (e.g., astr
representation of the C type for code generation will be generated via the utilityctypes_to_cstr
).This is in my opinion a remarkable improvement to the codegen infrastracture, that was long due.
The
ArrayMapped
type is also introduced.