[Patches] [Patch #101022] Removal of SET_LINENO (experimental)

noreply@sourceforge.net noreply@sourceforge.net
Wed, 25 Oct 2000 17:42:41 -0700


Patch #101022 has been updated. 

Project: python
Category: core (C code)
Status: Open
Summary: Removal of SET_LINENO (experimental)

Follow-Ups:

Date: 2000-Jul-30 16:12
By: marangoz

Comment:
For testing, as discussed on python-dev. For a gentle summary, see:
http://www.python.org/pipermail/python-dev/2000-July/014364.html

-------------------------------------------------------

Date: 2000-Jul-30 18:16
By: marangoz

Comment:
A nit: inline the argfetch in CALL_TRACE and goto the switch,
instead of jumping to get_oparg which splits the sequence
[fetch opcode, fetch oparg] -- this can slow things down.

-------------------------------------------------------

Date: 2000-Jul-31 06:40
By: gvanrossum

Comment:
Status set to postponed to indicate that this is still experimental.
-------------------------------------------------------

Date: 2000-Jul-31 07:57
By: marangoz

Comment:
Another rewrite, making this whole strategy b/w compatible according to
the 1st incompatibility point a) described in: http://www.python.org/pipermail/python-dev/2000-July/014364.html

Changes:

1. f.f_lineno is computed and updated on f_lineno attribute requests for
   f, given f.f_lasti. Correctness is ensured because f.f_lasti is updated
   on *all* attribute accesses (in LOAD_ATTR in the main loop).

2. The standard setup does not generate SET_LINENO, but uses
   co_lnotab for computing the source line number (e.g. tracebacks)
   This is equivalent to the actual "python -O".

3. With "python -d", we fall back to the current version of the
   interpreter (with SET_LINENO) thus making it easy to test whether
   this patch fully replaces SET_LINENO's behavior.
   (modulo f->f_lineno accesses from legacy C code, but this is insane).

IMO, this version already worths the pain to be truly tested and improved.

One improvement is to define a nicer public C API for breakpoints:
 - PyCode_SetBreakPointAtLine(line)
 - PyCode_SetBreakPointAtAddr(addr)
or similar, which would install a CALL_TRACE opcode in the appropriate
location of the copy of co_code.

Another idea is to avoid duplicating the entire co_code just for storing
the CALL_TRACE opcodes. We can store them in the original and keep
a table of breakpoints. Setting the breakpoints would occur whenever
the sys.settrace hook is set.
-------------------------------------------------------

Date: 2000-Jul-31 10:50
By: marangoz

Comment:
A last tiny fix of the SET_LINENO opcode for better b/w compatibility.
Stopping here and entering standby mode for reactions & feedback.

PS: the last idea about not duplicating co_code and tweaking the
original with CALL_TRACE is a bad one. I remember Guido being
against it because co_code could be used elsewhere (copied, written
to disk, whatever) and he's right! Better operate on an internal copy
created in ceval.
-------------------------------------------------------

Date: 2000-Aug-03 12:22
By: marangoz

Comment:
Fix missing DECREF on error condition in start_tracing()
+ some renaming.
-------------------------------------------------------

Date: 2000-Oct-25 13:56
By: gvanrossum

Comment:
Vladimir, are you there?

The patch doesn't apply cleanly to the current CVS tree any more...
-------------------------------------------------------

Date: 2000-Oct-25 17:42
By: marangoz

Comment:
noreply@sourceforge.net wrote:
>
> Date: 2000-Oct-25 13:56
> By: gvanrossum
> 
> Comment:
> Vladimir, are you there?

So-so :) I'm a moving target, checking my mail occasionally these days.
Luckily, today is one of these days.

> 
> The patch doesn't apply cleanly to the current CVS tree any more...

Ah, this one's easy. Here's an update relative to 2.0 final, not CVS.
I got some r/w access error trying to update my CVS copy from SF
that I have no time to investigate right now... The Web interface still
works though :)
-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=101022&group_id=5470