develooper Front page | perl.perl5.porters | Postings from April 2008

Saving a pointer in every COP?

Thread Next
Nicholas Clark
April 6, 2008 12:33
Saving a pointer in every COP?
Message ID:
I had a thought. It might be possible to save a pointer in (nearly) every COP.
Thoughts? Takers?

Nicholas Clark

Change 33652 by nicholas@mouse-mill on 2008/04/06 19:32:03

	Add attempting Exterminate! cop_label to perltodo.

Affected files ...

... //depot/perl/pod/perltodo.pod#216 edit

Differences ...

==== //depot/perl/pod/perltodo.pod#216 (text) ====

@@ -720,6 +720,28 @@
 These tasks would need C knowledge, and knowledge of how the interpreter works,
 or a willingness to learn.
+=head2 Abolish cop_label?
+C<struct cop> contains
+    char *	cop_label;	/* label for this construct */
+Most statements don't have labels. It might be possible to eliminate this
+member and instead store the label, if present, in
+    struct refcounted_he * cop_hints_hash;
+(with a hint bit, similar to
+    #define HINT_ARYBASE	0x00000010 /* $[ is non-zero */
+    #define HINT_LEXICAL_IO_IN	0x00040000 /* ${^OPEN} is set for input */
+    #define HINT_LEXICAL_IO_OUT	0x00080000 /* ${^OPEN} is set for output */
+). The trick would be ensuring that this faked lexical hint doesn't get
+propagated to nested scopes. It might be as simple as moving the setting of
+"cop_label" in C<Perl_newSTATEOP> after the code to set up
 =head2 lexicals used only once
 This warns:

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About