46 Commits

Author SHA1 Message Date
Kay Hayen
718ab60539 Bump copyright year 2025-04-28 11:04:36 +02:00
Kay Hayen
f34f8d0c63 Bump copyright year
* Also split copyright notices between the top and bottom,
  such that readability of just opened files is not harmed
  by license text.
2024-12-18 10:48:16 +01:00
Kay Hayen
909d41f02d Bump copyright year 2023-06-02 15:07:22 +02:00
Kay Hayen
d9ada19072 Quality: Updated to latest PyLint
* The 3.11 with newer pip cannot build dependencies of older
  astroid due to some breaking of pip, so we are kind of pushed
  to update this.

* A few nice findings, but unfortunately arguments-differ no
  longer is usable.
2023-06-02 15:07:21 +02:00
Kay Hayen
ac12a0f89e Optimization: Massive enhancements for comparisons and binary operations
* Swap comparison arguments during code generation for mixed
  types to the responsible one, removing useless duplicates. This
  way the "LONG" and "INT" comparison only needs one variant, with
  code generating changing the comparator used.

* Swap binary operation arguments for commutative operations
  around for mixed number types.

* Comparisons and binary operations are now either "CBOOL" result
  or "NBOOL" result, depending on wether they are know to raise or
  not at compile time.

* Avoid "NBOOL" comparisons where possible, operations that never
  raise now use "CBOOL" instead and produce the "NBOOL" out of it
  should it be desired by using code.

* Added special comparisons for floats values with constant
  values too. This should accelerate comparison of these value
  with constant values by a lot. Integer constants are handled
  via "CFLOAT" as well.

* Make sure we only use target types that ignore exceptions when
  there cannot be one. This should catch inconsistencies if there
  are any.

* Renamed some C type modules to better spellings for enhanced
  readability.

* Avoids having many comparison helpers, because of reduced set
  of operations or argument orders.

* For comparison operations that cannot raise, create the object
  values from boolean values, but do not have a helper to do that
  as it does nothing else.

* Also cleanup the C types somewhat, making "CBOOL" more usable as a
  result type was now needed, and fixed spelling of "inplace" solving
  a TODO for binary operations, where this was used in different
  spellings.

* Give up on the suffix "_INPLACE" for inplace operations and instead
  make it more clear by different prefix "INPLACE_", avoiding complexity
  for the new helper selection code.

* Remove useless module for operator codes used for very little that
  better should be where it's used.

* Remove "CBOOL" comparisons that can raise, using them is bug hiding
  and there were unwarrented uses, that have been addressed now.

* Added mixed operations for "INT" and "CLONG" C types, the template
  already could handle it, but we never had code generation capable
  of deciding to use it.

* Changed comparison and binary operation helper selection to use a
  much simpler protocol and be shared better.

* Enhanced usage of "CBOOL" comparison for argument names in compiled
  type calls. These indeed cannot raise, but the helper was still not
  a good idea to have.

* Also correct assign conversion code to take care of value release
  or transfer during conversion operation consistently
2022-09-18 11:20:35 +02:00
Kay Hayen
4cfdd9f9c0 Bump copyright year 2022-05-23 10:28:11 +02:00
Kay Hayen
e43b72e087 Bump copyright year to 2021. 2021-01-22 09:58:00 +01:00
Kay Hayen
dd5a9f2dd5 Cleanup, avoid decimal and string comparisons for version checks
* This is in preparation for 3.10 which will fail to work that work.

* Extended numeric values to be hexadecimal.

* Using tuples over strings in testing.
2020-12-17 09:06:53 +01:00
Kay Hayen
d57c5124c9 Optimization: Annotate boolean type shape for exception matching
* This causes optimization for "not" to need the inverse operation
  too, so add that, also for more compact node tree.

* This avoids using Py_True and Py_False in conditions, given a
  slight performance increase due to the more direct check.

* Also the "not" exception_match code generates more direct code
  without a manual inversion of the value, but simply other check.
2020-05-10 15:52:43 +02:00
Kay Hayen
3270ecb868 Optimization: Target types for operations and comparisons
* All helpers now have a target type added, mostly OBJECT now, but e.g.
  also NBOOL and CBOOL can be used.

* The helpers for operations are now built with factory functions for their
  consistency

* Added shapes for all operations for the common types.

* Added dedicated nodes for all in-place operations solving a TODO.

* Inplace operations to be created are now derived from the binary
  operations.

* Conversions for missing target types instead of falling back to
  most generic helper.

* Converted manual comparison helpers to new Jinja template for
  generating code automatically.

* Added optimization for more operations and their types, e.g. tuples,
  floats, and more operations.

* More generalized templates to allow more C types that are not objects.

* Added tests to cover in-place operations

* Test infrastructure for generated tests from Jinja2 templates.

* Type shapes are now all instances, avoid mixing classes and instances
  for clarity of code and correctness.

* Enable warnings for all operations in case of specific shape
  combinatations not defined.

* Some corrections to boolean C target type code, now applied in many
  more test cases.

* Proper void C type added, to be used in code specialization later.
2020-05-01 11:33:15 +02:00
Kay Hayen
b2083575cf Bump copyright year to 2020. 2020-02-01 07:42:45 +01:00
Kay Hayen
d6b7a34a4d Eclipse: Remove PyDev annotations
* We are going to not recommend Eclipse anymore, and PyLint should be
  all that is used either way.

* This was causing only noise in the source code.
2019-09-22 08:48:03 +02:00
Kay Hayen
8034a765aa Fix, compile time floor division was not working correctly. 2019-08-24 09:26:53 +02:00
Batakrishna Sahu
4c8a69bead Optimize the "abs" built-in (#419)
Optimization: Added support for "abs" built-in and "abs" operation.
2019-07-27 19:51:49 +02:00
Kay Hayen
f3752e381d Quality: Reformated code to black
* Autoformat currently only sorts pylint disable comments, and does
  not call black yet.

* This also adds a few doc strings that I failed to keep separate as a
  commit, but who cares.
2019-02-13 16:27:25 +01:00
Kay Hayen
47c99d377e Bump copyright year to 2019. 2019-01-24 16:28:13 +01:00
Kay Hayen
2fb0c54c46 Optimization: Mark "+" and "<" for known good types as not escaping.
* Provide proper type shape of comparison results, for "in" and "is"
  operations, bool is known definitely, for rich comparisons it's a
  result of the input shapes, but now e.g. "int < int" will be known
  to be a "bool" type shape.

* As an aside, this generalizes the "not" operation on comparisons
  to be effective on all "bool" shape comparisons, where now some
  of the rich comparisons can take part.

* Specialized all rich comparisons to dedicated nodes, saving to have
  an actual "self.comparator" instance for future memory savings once
  dual children nodes are using slots too.

* Added control flow escape descriptions to be returned by shape
  operations to indicate exception possibilities and control flow
  escape.

* Many more binary add shape provisions.
2018-12-05 13:51:34 +01:00
Kay Hayen
3957ee8628 Updated copyright year to 2018. 2018-04-30 09:46:54 +02:00
Kay Hayen
37864c0e3f Optimization: Added support for "divmod" built-in.
* This is a number operation that is also a built-in function, and
  therefore kind of in the middle.
2017-07-19 09:28:56 +02:00
Kay Hayen
70ad44e592 Minor cleanups
* Changing PyLint identifiers to symbolic instead of message ids, easier
  to come up it and know.

* Make sure to error exit PyLint checking. This was regressed when making
  it a tool.

* Some other PyLint cleanups.
2017-05-27 08:08:44 +02:00
Kay Hayen
5ee23197d1 Optimization: Also optimize "true" division.
* For Python3 that is the standard division operator and it was not
  optimized yet, only the Python2 one was.

* Also use "true" division for in-place division operations. This was
  not done before and is a bug fix.

* Also optimize floor division for both Python2 and Python3.

* This also solves a TODO by stopping to monkey patch "operators" module
  for Python3 to work with the similar code.
2017-05-23 18:51:10 +02:00
Kay Hayen
064df32ff0 Updated copyright year to 2017. 2017-01-09 07:25:38 +01:00
Kay Hayen
72ac16cfd9 Updated copyright year to 2016 2016-01-04 09:34:48 +01:00
Kay Hayen
66e283074b Cleanups: Massive refactoring cleanups for code generation
* All statement and expression code generation now goes through some
  dispatching instead of "elif" test chains. Should be much faster.

* More homegenous naming of generation functions all with the same
  signature.

* Moved more generation functions to the topic modules and added more
  of them.

* Cleanup of naming for break and continue nodes, more of that should
  follow.

* Added more generation functions where they were missing and things
  had been done in the "elif" chain directly.

* The dispatching will be faster, but it's unclear how much an issue
  that was. Probably not important.

* Using python_version from the dedicated module instead of Utils is
  also cleaner.
2016-01-03 09:26:36 +01:00
Kay Hayen
66bab30036 Python3.5: Added support for "@" operator.
* Didn't yet encounter this in the wild, but it's simple to add in the
  current structure.
2015-10-01 11:02:27 +02:00
Kay Hayen
7f8932e838 Added instance counters to most popular classes.
* These are reported in the --show-progress case and will help find out
  about memory leaks of Nuitka at compile time.

* Finally make utils a package, moving the complete Utils to its inside,
  but it's going to be split up over time. That cleanup will help to
  structure things nicely.

* Added instance counter tools as utils package.
2015-04-04 16:01:19 +02:00
Kay Hayen
bc8367e3bd Updated copyright year to 2015 2015-01-13 08:43:41 +01:00
Kay Hayen
32f43088c5 Cleanups
* Applied isort to all source files, harmonizing the format of import statements.

* PyLint stuff

* Packages should do relative imports to themselves only

* No up imports "from .."
2014-06-17 06:39:18 +02:00
Kay Hayen
7e608f9b12 PyLint cleanups 2014-06-02 18:57:54 +02:00
Kay Hayen
f7681d62dd "Cish", major refactoring
* Use less C++ classes, and generate more C-like code. Temporary variables
  are now used, where previously everything in a statement was wrapped in
  C++ temporary objects.

* Exception handling is now pure C code, no more "throw" at all. That means
  return codes are checked. This gives a huge performance increase for the
  use of Python exceptions.

* Generation of tuples and lists is now done without helper functions, these
  were only increasing code complexity.

* Access to local and global variables with more direct code.

* Less use of templates, more code is manually crafted.

* Moved publishing and preservation of exceptions to node tree.

* Enhanced handling of try/except and try/finally for Python3 by doing
  reformulations for their handler semantics.

* Exception handling as now done via branching.

  Huge simplification for SSA, as exception catching is now explicit
  via normal branch analysis, removing handlers as special cases.

* Many asorted improvements.

* Many, many cleanups.
2014-05-16 23:42:02 +02:00
Kay Hayen
bf480213dd Updated copyright year to 2014 2014-03-02 07:57:59 +01:00
Kay Hayen
2163f64b1c New optimizations
* Optimize the "not" operation through a new "computeNodeOperationNot"
  method that handles it. Also covers all compile time constants now.

* Detect side effects of "not" operator from side effects of "bool"
  operation, which avoids side effects being created.

* Explicitly invert conditional statements with empty yes case into
  inverted conditions.

* Optimize invertable conditions "is"/"is not" and "in"/"not in" directly
  into other variant when "not" is applied, for cleaner code.
2013-01-28 16:41:14 +01:00
Kay Hayen
50da5af696 Updated copyright year in notices. 2013-01-12 10:35:22 +01:00
Kay Hayen
149bc9c9c9 Changed my email address towards the outside world. 2012-12-29 14:42:43 +01:00
Kay Hayen
0b15300f08 Change Nuitka to Apache License 2.0, making it usable for everybody. 2012-06-30 23:43:00 +02:00
Kay Hayen
645ba7d5b4 Cleanup, don't have a "getPythonVersion()" but a "python_version" instead, there is no point for this to be a function. 2012-04-18 20:25:59 +02:00
Kay Hayen
76b4b8c282 Big node refactoring
* Sequentialize the "del" statement with multiple targets to ones with
  only each target. The grouping has no meaning for them.
* Introduce temporary variable blocks and use them to re-formulate the
  in-place assignments in tree building already, allowing the removal
  of a lot of special code dedicated to them.
2012-02-21 10:47:31 +01:00
Kay Hayen
33e156e1c7 Change contributors agreement from copyright assignment to me to a general "Apache 2.0 license". 2012-01-06 23:41:02 +01:00
Kay Hayen
1608a3f4c6 Node cleanups regarding boolean nodes
* The "not" is not really only a fairly normal operator and was changed
  to use the unary operation as a base class.

* Use "operands" and "operand" for the "and" and "or" nodes, so it's more
  similar to an operation

* Unify the code generation for "and" and "or" a bit more.

* Added simulator functions for "and" and "or" nodes.
2012-01-06 15:44:18 +01:00
Kay Hayen
ad9c704b62 Whitespace only, remove leading blank lines from tests. 2012-01-05 10:25:17 +01:00
Kay Hayen
c03f222a4f New copyright year, license cleanups.
* Removed copyright notice from inline copy of Scons, added by accident only
* Claim stronger copyright over basic, program, and reflected tests to release
  them under public domain.
* Updated debian/copyright to include "odict" and "oset" licenses, and
  full text for ARM ucontext parts
* Remove benchmarks from Debian package, too diverse licenses and not for
  users.
2012-01-02 09:48:38 +01:00
Kay Hayen
24a2a8cb8d Nuitka 0.3.10pre5
- Corrected the behaviour of sys.exc_info() values for the case of nested
exceptions. There is now use of "FrameExceptionKeeper" when a try/except is
used that can preserve existing exceptions and restore as necessary.

- Removed the documentation that said scons is required. It's now included
and therefore always there.

- Added status information for the optimizations plan of README.txt to make
it easier to discover.

- Optimize the case of calling a function with only star list parameter as
it is really very trivial to implement.

- Removed TODO as it's now clear that weakrefs must be supported for the
generator functions, CPython does it too. We did, but were not sure it
was the right thing.

- Refactored exception raising code, so it is easier to understand, set
the traceback indicator inside functions if needed.

- Removed useless globals variable header file. As every module has it
now for itself, no need to have that file and moved the remaining parts
to better places.

- Much improved XML dump output. Intended for regression testing the
optimization changes. Gives a tree with roles.

- Changes all nodes to children having, there were a few holdouts. Now
the order of children is fixed, and every child has a name and a role
so a pretty tree can be made.

- Added mayHaveSideEffects and mayRaiseException where the knowledge that
something might change things behind your back or raise an exception can
be represented.

- Do away with lambda bodies, use function bodies instead. This allows to
do away with special code, and allows optimizations to work more generally
on functions and lambdas the same.

- Added infrastructure for simulation of operations, used for the constant
propagation of them.

- Added support for referencing builtin exceptions and for making their
objects as nodes. This leads to exception creation being optimized not
using global name lookups, but faster creation of just the right object.

- Treat the `` operator just like any other operator, optimize it as well.

- Optimize comparison functions with constant operators as well.

- Use assign targets in exception handlers, make handler an object, with
proper structure, instead of having lists with difficult to recognize
correspondance.

- Cleanup of Contexts, removing lots of unused stuff.

- Make it more clear where a generator expression is meant in the context
of code generation for contractions, these are not generators.

- Temporary variables for comparison chains are no longer module global,
but local to the containing function body, class body, etc.

- Removed the need for assigning the parent of whole trees. Operations that
change the tree now ensure it's correct.

- Added optimizations of try/except with known exception raises, and the
try/finally with no exception possible.

- Made the source executable with Python3.2 again, was broken. Doesn't work
with it at all though.

- Extended to coverage of optimizing builtin exceptions in many cases, more
variants supported.
2011-08-14 19:46:55 +02:00
Kay Hayen
5f0d282eb4 Nuitka 0.3.7 pre1 2011-03-13 16:13:27 +01:00
Kay Hayen
b4c9124867 Changed the copyright to 2011, don't call it an attempt anymore. 2011-01-09 23:53:41 +01:00
Kay Hayen
1a90bd27e3 Nuitka 0.3.5 pre5 2011-01-09 23:42:25 +01:00
Nicolas Dumazet
74aed4b0cf move Python files to a nuitka package.
This requires renaming a few imports, but overall makes execution
and packaging much easier.
2011-01-04 20:25:19 +09:00