Subject: | Fixing optimizer for modern Perl + ithreads |
optimizer.pm don't work so good with 5.8.8 + ithreads. The attached
patch makes the necessary changes, mostly adding aTHX and Perl_
prefixes, to get it to compile and pass tests.
Subject: | optimizer.patch |
--- optimizer.xs 2006/11/12 04:39:20 1.1
+++ optimizer.xs 2006/11/12 04:58:14
@@ -1,6 +1,7 @@
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
+#include "ppport.h"
/* We have to steal a bunch of code from B.xs so that we can generate
B objects from ops. Disturbing but true. */
@@ -137,7 +138,7 @@
* Despite being a "constant", the SV is written to,
* for reference counts, sv_upgrade() etc. */
if (o->op_sv) {
- PADOFFSET ix = pad_alloc(OP_CONST, SVs_PADTMP);
+ PADOFFSET ix = Perl_pad_alloc(aTHX_ OP_CONST, SVs_PADTMP);
if (SvPADTMP(o->op_sv)) {
/* If op_sv is already a PADTMP then it is being used by
* some pad, so make a copy. */
@@ -162,9 +163,9 @@
STATIC void
no_bareword_allowed(pTHX_ OP *o)
{
- qerror(Perl_mess(aTHX_
- "Bareword \"%s\" not allowed while \"strict subs\" in use",
- SvPV_nolen(cSVOPo_sv)));
+ Perl_qerror(aTHX_ Perl_mess(aTHX_
+ "Bareword \"%s\" not allowed while \"strict subs\" in use",
+ SvPV_nolen(cSVOPo_sv)));
}
void
@@ -176,7 +177,7 @@
if (!o || o->op_seq)
return;
ENTER;
- SAVEOP();
+ Perl_save_op(aTHX);
SAVEVPTR(PL_curcop);
for (; o; o = o->op_next) {
if (o->op_seq)
@@ -200,7 +201,7 @@
* Despite being a "constant", the SV is written to,
* for reference counts, sv_upgrade() etc. */
if (cSVOP->op_sv) {
- PADOFFSET ix = pad_alloc(OP_CONST, SVs_PADTMP);
+ PADOFFSET ix = Perl_pad_alloc(aTHX_ OP_CONST, SVs_PADTMP);
if (SvPADTMP(cSVOPo->op_sv)) {
/* If op_sv is already a PADTMP then it is being used by
* some pad, so make a copy. */
@@ -535,7 +536,7 @@
by the fact that doing stuff while optimization is highly dangerous
*/
- peep(o);
+ Perl_peep(aTHX_ o);
/* Since we get the start here, we should try and find the
leave by following next until we find it