Commit Graph

1206 Commits

Author SHA1 Message Date
K. Lange
92c0d09999 Implement dict.__ior__ 2022-06-04 20:28:20 +09:00
K. Lange
7d3df0d650 Cache binary operator methods, support inplace variants 2022-06-04 20:25:54 +09:00
K. Lange
ed31f1e314 Try some minor optimizations to function calls 2022-06-04 20:23:44 +09:00
K. Lange
3721ebc97c shift-and-compare is probably better than mask & compare 2022-06-04 20:20:43 +09:00
K. Lange
248f54a8f2 Pull out attributeUnpack to a separate function because I may want to just get rid of it 2022-06-04 16:06:16 +09:00
K. Lange
cdcfb63f41 New '__options__' psuedo-module with compile-time changes 2022-06-04 15:59:24 +09:00
K. Lange
b2846c13ce (bench) python fasttimer should check for exceptions 2022-06-04 15:34:47 +09:00
K. Lange
cd25ada161 Less obtuse list.append() benchmark 2022-06-04 12:13:38 +09:00
K. Lange
75e0ec9e54 Fix up some syntax errors 2022-06-04 06:51:34 +09:00
K. Lange
3bfa32ac83 Print ^s for the whole width of a faulting symbol in a syntax error, looks cooler 2022-06-03 21:35:58 +09:00
K. Lange
4fd68ec5d1 Simplify rewinding infix operators 2022-06-03 16:52:48 +09:00
K. Lange
5f3a2b4747 Expose __args__ directly on codeobject 2022-06-03 16:19:36 +09:00
K. Lange
b4349303e9 Add more keywords to the stdlib highlighter 2022-06-03 13:45:12 +09:00
K. Lange
5a79f27b83 Fix incorrect OP_CLOSURE instruction size returned by dis.examine 2022-06-03 13:07:49 +09:00
K. Lange
9c25e200b8 Take the line number from the previously parsed token when build synthetics 2022-06-03 10:44:58 +09:00
K. Lange
bce994318c (meta) upgrade github codeql workflow 2022-06-02 20:11:34 +09:00
K. Lange
48f9d34a9b Tests for bound method edge cases 2022-06-02 14:34:40 +09:00
K. Lange
2e7bf54d9a Bound methods can be bound to non-function callables 2022-06-02 14:34:40 +09:00
K. Lange
55849aa4f0 Fix edgecases around expanded calls to bound callables when no stack space is available 2022-06-02 14:34:40 +09:00
K. Lange
3bc8d72895 Take best-of-ten in most benchmarks, add inner_loop benchmarks 2022-06-02 08:01:55 +09:00
K. Lange
1ee63c15f6 Use a flag to mark classes not subclassable
A KrkInstance should always have a valid and correct allocSize
available from its class object, which for non-subclassable classes
like the ones representing stack values should be the size of a
normal instance, so that we can safely treat it as an instance
until it can get garbage collected when it is allocated before
the call to __init__ that replaces it with the right kind of
object (or raises an exception).
2022-05-31 18:41:00 +09:00
K. Lange
098b3168f3 prevent functions, codeobjects from being initialized; methods can be 2022-05-31 18:17:28 +09:00
K. Lange
fa2b2c053b Merge flags 2022-05-31 17:31:35 +09:00
K. Lange
c785b2580e kuroko.inspect_value() shows KrkValue byte representation 2022-05-31 16:11:41 +09:00
K. Lange
b3c693eae5 Disallow subclassing of some core types that are not subclasses of Instance 2022-05-31 07:34:19 +09:00
K. Lange
3f0522dd98 Change getsizeof calculations; stack-only values have 0 size 2022-05-31 07:34:00 +09:00
K. Lange
2437e73c82 Bad malloc size in putenv? 2022-05-31 07:02:21 +09:00
K. Lange
f16083a1a6 Pack object type/flags/hash better
This is much a more major ABI break than the other things I've
been doing, but also a much bigger win.
2022-05-31 06:55:54 +09:00
K. Lange
bbfe948b86 Lambda should be able to accept *args and **kwargs 2022-05-30 17:46:24 +09:00
K. Lange
65f7ae3f22 Simplify cached method things; don't expose the enum in headers 2022-05-30 13:47:27 +09:00
K. Lange
a41410dcd9 Stick 'subclasses' before method cache
While were in here breaking ABIs, this makes a lot more sense.
2022-05-30 08:56:56 +09:00
K. Lange
bbf378efe2 Reorder arguments to callNativeOnStack for better fallthrough to native call 2022-05-29 20:00:41 +09:00
K. Lange
d18b08ea46 Native function args should be const 2022-05-29 18:39:46 +09:00
K. Lange
8ade3af008 Support dir() with no arguments; returns globals only 2022-05-28 17:56:53 +09:00
K. Lange
ae10f81387 Start calling this 1.3 2022-05-28 17:33:35 +09:00
K. Lange
285f7cd496 Fix up path search ordering to be more like CPython; implement __main__.krk 2022-05-28 17:31:43 +09:00
K. Lange
a4e2b5c881 Relative imports 2022-05-28 15:41:47 +09:00
K. Lange
3645047051 Same for None 2022-05-28 11:45:38 +09:00
K. Lange
f14ca90792 Avoid NotImplemented.__hash__ resolving to object.__hash__ and segfaulting 2022-05-28 11:38:59 +09:00
K. Lange
81e3bb33a0 Defer freeing pre-grown stacks when using them in native calls
If the stack needs to grow during a native function call that has
taken a pointer into the stack as an argument, defer freeing this
copy of the stack until the outermost such call returns. The new
stack will always point to new memory, as we can not call realloc
in this case, and if repeated nested native function calls result
in multiple stack growths then several copies of the stack may
persistent in memory simultaneously, but we do not need to trouble
native function implementations with the possibility that their
arguments may become invalid, and we do not need to produce copies
of the stack when calling them.

This resolves a long-standing issue with resizable stacks where
native function calls always entailed a memcpy() penalty, and calls
with many arguments also had malloc()/free() overhead for heap
allocated stack copies.

With this change, performance improves, as the wrapper checks around
stack growth are uncommon, so their overall cost is less than the
repeated moving of arguments around for native function calls.
2022-05-27 21:57:17 +09:00
K. Lange
1f6afa7369 Add new CLOSE_MANY and POP_MANY instructions 2022-05-27 18:37:37 +09:00
K. Lange
7dff49ccb7 Fix incorrect hashing of classes in fallback added for subclass tracking 2022-05-27 18:37:37 +09:00
K. Lange
aa6781609e Fix bad encoding of large upvalue indexes 2022-05-27 18:37:37 +09:00
K. Lange
32b3af58cc Unset class bases when doing final free so we don't access potentially-freed subclass tables 2022-05-27 00:15:55 +09:00
K. Lange
1ac8f296b2 Invalidate caches of subclass method pointers when they change in a superclass 2022-05-27 00:05:27 +09:00
K. Lange
1c5fc954ed Update copyright years, it's been 2022 for a while now 2022-05-26 20:46:06 +09:00
K. Lange
3601411f54 Support step value in range() 2022-05-26 20:41:39 +09:00
K. Lange
1acd0243e4 Workaround horrible thread-local performance on macOS (aarch64) 2022-05-24 21:01:42 +09:00
K. Lange
74e064c82c Test case for preceding fix 2022-05-24 13:33:34 +09:00
K. Lange
b9776aec1e Revert loop on 'for ... if ...' 2022-05-24 13:27:01 +09:00