Commit Graph

418 Commits

Author SHA1 Message Date
Michael W. Hudson 800ba2375a This is my patch:
[ 1005891 ] support --with-tsc on PPC

plus a trivial change to settscdump's docstring and a Misc/NEWS entry.
2004-08-12 18:19:17 +00:00
Armin Rigo 618fbf5469 This was quite a dark bug in my recent in-place string concatenation
hack: it would resize *interned* strings in-place!  This occurred because
their reference counts do not have their expected value -- stringobject.c
hacks them.  Mea culpa.
2004-08-07 20:58:32 +00:00
Raymond Hettinger 52a21b8e65 SF patch #980695: efficient string concatenation
(Original patch by Armin Rigo).
2004-08-06 18:43:09 +00:00
Michael W. Hudson a3711f73c1 Fix for the unfortunate fact that PyDict_GetItem and PyObject_GetItem
have differing refcount semantics.  If anyone sees a prettier way to
acheive the same ends, then please go for it.

I think this is the first time I've ever used Py_XINCREF.
2004-08-02 14:50:43 +00:00
Raymond Hettinger 66bd233225 Completed the patch for Bug #215126.
* Fixes an incorrect variable in a PyDict_CheckExact.
* Allow general mapping locals arguments for the execfile() function
  and exec statement.
* Add tests.
2004-08-02 08:30:07 +00:00
Neal Norwitz 93468eac72 Remove unused macros in .c files 2004-07-08 01:49:00 +00:00
Michael W. Hudson 30ea2f223f This closes patch:
[ 960406 ] unblock signals in threads

although the changes do not correspond exactly to any patch attached to
that report.

Non-main threads no longer have all signals masked.

A different interface to readline is used.

The handling of signals inside calls to PyOS_Readline is now rather
different.

These changes are all a bit scary!  Review and cross-platform testing
much appreciated.
2004-07-07 17:44:12 +00:00
Raymond Hettinger 214b1c3aae SF Bug #215126: Over restricted type checking on eval() function
The builtin eval() function now accepts any mapping for the locals argument.
Time sensitive steps guarded by PyDict_CheckExact() to keep from slowing
down the normal case.  My timings so no measurable impact.
2004-07-02 06:41:07 +00:00
Martin v. Löwis 8d97e33bb7 Patch #966493: Cleanup generator/eval_frame exposure. 2004-06-27 15:43:12 +00:00
Raymond Hettinger a7f56bc0cc Get ceval.c to compile again by moving declarations before other statments. 2004-06-26 04:34:33 +00:00
Nicholas Bastin d858a7763a Massive performance improvement for C extension and builtin tracing code 2004-06-25 23:31:06 +00:00
Nicholas Bastin 941b8bc41a Less ugly #ifdefs for C profiling fix 2004-06-22 15:37:51 +00:00
Nicholas Bastin bbffbd1983 One forgotten C profiling #ifdef 2004-06-22 04:18:47 +00:00
Nicholas Bastin 4c70b69fb1 Making C profiling a configure option (at least temporarily) 2004-06-22 03:51:38 +00:00
Raymond Hettinger 9c18e81fb2 Install two code generation optimizations that depend on NOP.
Reduces the cost of "not" to almost zero.
2004-06-21 16:31:15 +00:00
Armin Rigo 8817fcdba5 Performance tweak: allow stack_pointer and oparg to be register variables.
SF patch #943898
2004-06-17 10:22:40 +00:00
Martin v. Löwis f30d60edbc Patch #510695: Add TSC profiling for the VM. 2004-06-08 08:17:44 +00:00
Raymond Hettinger f2c0830585 SF bug #963956: Bad error mesage when subclassing a module
Add a more informative message for the common user mistake of subclassing
from a module name rather than another class (i.e. random instead of
random.random).
2004-06-05 06:16:22 +00:00
Martin v. Löwis e440e47e91 Patch #957398: Add public API for Generator Object/Type. 2004-06-01 15:22:42 +00:00
Raymond Hettinger c8aa08b172 Some (but not all) of the why code bitfield tests ran faster as
separate equality tests.  Now, all are set to their best timing.
2004-04-11 14:59:33 +00:00
Raymond Hettinger 5bed456056 Revert 2.393, elimination of pre-decrementing, which
did not stand-up to additional timings.
2004-04-10 23:34:17 +00:00
Raymond Hettinger 7eddd78a15 Use continue instead of break whereever possible. 2004-04-07 14:38:08 +00:00
Raymond Hettinger d3b836d202 * Improve readability and remove data dependencies by converting
pre-increment forms to post-increment forms.  Post-incrementing
also eliminates the need for negative array indices for oparg fetches.

* In exception handling code, check for class based exceptions before
  the older string based exceptions.
2004-04-07 13:17:27 +00:00
Raymond Hettinger 467a698bd2 Small code improvements for readability, code size, and/or speed.
BINARY_SUBSCR:
    * invert test for normal case fall through
    * eliminate err handling code by jumping to slow_case

LOAD_LOCALS:
    * invert test for normal case fall through
    * continue instead of break for the non-error case

STORE_NAME and DELETE_NAME:
    * invert test for normal case fall through

LOAD_NAME:
    * continue instead of break for the non-error case

DELETE_FAST:
    * invert test for normal case fall through

LOAD_DEREF:
    * invert test for normal case fall through
    * continue instead of break for the non-error case
2004-04-07 11:39:21 +00:00
Raymond Hettinger 7c9586545e Simplify previous checkin (bitfields for WHY codes).
Restores the self-documenting enum declaration.
2004-04-06 10:11:10 +00:00
Raymond Hettinger 06032cb664 Coded WHY flags as bitfields (taking inspiration from tp_flags).
This allows multiple flags to be tested in a single compare
which eliminates unnecessary compares and saves a few bytes.
2004-04-06 09:37:35 +00:00
Tim Peters 8a5c3c76be Since the fast_yield branch target was introduced, it appears that most
tests of "why" against WHY_YIELD became useless.  This patch removes them,
but assert()s that why != WHY_YIELD everywhere such a test was removed.
The test suite ran fine under a debug build (i.e., the asserts never
triggered).
2004-04-05 19:36:21 +00:00
Nicholas Bastin e5662aedef Changed random calls to PyThreadState_Get() to use the macro 2004-03-24 22:22:12 +00:00
Nicholas Bastin c69ebe8d50 Enable the profiling of C functions (builtins and extensions) 2004-03-24 21:57:10 +00:00
Armin Rigo bf57a14522 Fix SF bug #765624. 2004-03-22 19:24:58 +00:00
Armin Rigo 9dbf9084e8 Cancelled checkin, sorry. 2004-03-20 21:50:13 +00:00
Armin Rigo 1515fc2a01 A 2% speed improvement with gcc on low-endian machines. My guess is that this
new pattern for NEXTARG() is detected and optimized as a single (*short)
loading.
2004-03-20 20:03:17 +00:00
Raymond Hettinger fba1cfc49a LIST_APPEND is predicably followed by JUMP_ABSOLUTE.
Reduces loop overhead by an additional 10%.
2004-03-12 16:33:17 +00:00
Raymond Hettinger 2d783e9b16 Move the code for BREAK and CONTINUE_LOOP to be near FOR_ITER.
Makes it more likely that all loop operations are in the cache
at the same time.
2004-03-12 09:12:22 +00:00
Raymond Hettinger db0de9e7ca Speedup for-loops by inlining PyIter_Next(). Saves duplicate tests
and a function call resulting in a 15% reduction of total loop overhead
(as measured by timeit.Timer('pass')).
2004-03-12 08:41:36 +00:00
Raymond Hettinger f114a3ae63 Refactor and optimize code for UNPACK_SEQUENCE.
* Defer error handling for wrong number of arguments to the
  unpack_iterable() function.  Cuts the code size almost in half.

* Replace function calls to PyList_Size() and PyTuple_Size() with
  their smaller and faster macro counterparts.

* Move the constant structure references outside of the inner loops.
2004-03-08 23:25:30 +00:00
Raymond Hettinger dd80f76265 SF patch #910929: Optimize list comprehensions
Add a new opcode, LIST_APPEND, and apply it to the code generation for
list comprehensions.  Reduces the per-loop overhead by about a third.
2004-03-07 07:31:06 +00:00
Skip Montanaro 786ea6bc23 Add pystack definition to Misc/gdbinit with some explanation of its behavior
and add flag comments to ceval.c and main.c alerting people to the coupling
between pystack and the layout of those files.
2004-03-01 15:44:05 +00:00
Michael W. Hudson ecfeb7f095 This is my patch #876198 plus a NEWS entry and a header frob.
Remove the ability to use (from C) arbitrary objects supporting the
read buffer interface as the co_code member of code objects.
2004-02-12 15:28:27 +00:00
Skip Montanaro 7befb9966e remove support for missing ANSI C header files (limits.h, stddef.h, etc). 2004-02-10 16:50:21 +00:00
Raymond Hettinger a72169871d SF patch #884022: dynamic execution profiling vs opcode prediction
(Contributed by Andrew I MacIntyre.)

disables opcode prediction when dynamic execution
profiling is in effect, so the profiling counters at
the top of the main interpreter loop in eval_frame()
are updated for each opcode.
2004-02-08 19:59:27 +00:00
Raymond Hettinger 1dd8309246 SF patch #864059: optimize eval_frame
Simplified version of Neal Norwitz's patch which adds gotos for
opcodes that set "why".  This skips a number of tests where the
outcome of the tests are known in advance.
2004-02-06 18:32:33 +00:00
Jack Jansen eddc1449ba Getting rid of all the code inside #ifdef macintosh too. 2003-11-20 01:44:59 +00:00
Jeremy Hylton 904ed86a77 Make undetected error on stack unwind a fatal error. 2003-11-05 17:29:35 +00:00
Armin Rigo 2b3eb4062c Deleting cyclic object comparison.
SF patch 825639
http://mail.python.org/pipermail/python-dev/2003-October/039445.html
2003-10-28 12:05:48 +00:00
Armin Rigo 1d313ab9d1 oh dear. Wrong manipulation. Committed a version of ceval.c from my
no-cyclic-comparison patch at the same time as errors.c.

Reverting ceval.c to the previous revision.
2003-10-25 14:33:09 +00:00
Armin Rigo 092381a979 Made function declaration a proper C prototype 2003-10-25 14:29:27 +00:00
Raymond Hettinger 8ae4689657 Simplify and speedup uses of Py_BuildValue():
* Py_BuildValue("(OOO)",a,b,c)  -->  PyTuple_Pack(3,a,b,c)
* Py_BuildValue("()",a)         -->  PyTuple_New(0)
* Py_BuildValue("O", a)         -->  Py_INCREF(a)
2003-10-12 19:09:37 +00:00
Neal Norwitz c5131bc256 Fix SF #762455, segfault when sys.stdout is changed in getattr
Will backport.
2003-06-29 14:48:32 +00:00
Guido van Rossum b8b6d0c2c6 Add PyThreadState_SetAsyncExc(long, PyObject *).
A new API (only accessible from C) to interrupt a thread by sending it
an exception.  This is not always effective, but might help some people.
Requested by Just van Rossum and Alex Martelli.  It is intentional
that you have to write your own C extension to call it from Python.

Docs will have to wait.
2003-06-28 21:53:52 +00:00