summaryrefslogtreecommitdiff
path: root/opcode.h
Commit message (Collapse)AuthorAgeFilesLines
* Refactor unpack’s newDEFSVOP logic; correct prototypeFather Chrysostomos2011-08-211-2/+2
| | | | | | | | | | | | | | | | | unpack is the only op that takes an implicit $_ for its second argu- ment. (For others it’s the first.) Instead of special-casing unpack with its own ck_ routine, we can sim- ply modify the logic in ck_fun to apply OA_DEFGV to the first optional argument, not just the first argument. Currently OA_DEFGV is not set in PL_opargs[OP_UNPACK], which means the automatically-generated prototype is ($;$), instead of ($_). This commit sets the flag on the op, changes it to use ck_fun directly, and updates ck_fun and the prototype-generation code accord- ingly. I couldn’t put this in multiple commits, as the changes are interdependent.
* Add coreargs opFather Chrysostomos2011-08-181-0/+5
| | | | &CORE::foo subs will use this operator for sorting out @_.
* Change (l)stat’s prototype from * to ;*Father Chrysostomos2011-08-121-2/+2
| | | | | | | | | | | | | | Since the argument is optional, we need a semicolon. This commit accomplishes that by setting the OA_OPTIONAL flag for the appropriate entries in PL_opargs. This should not affect anything else, as ck_ftst (the check routine for [l]stat) doesn’t even look at PL_opargs. It also has to tweak the prototype-generation logic slightly, because PL_opargs also has OA_DEFGV set. I think this is insignificant enough not to warrant a delta entry.
* Reorder ops so that trans{,r} and aelemfast{,_lex} are adjacent.Nicholas Clark2011-06-121-12/+12
|
* Split OP_AELEMFAST_LEX out from OP_AELEMFAST.Nicholas Clark2011-06-121-0/+6
| | | | | | | | | | | | | 6a077020aea1c5f0 extended the OP_AELEMFAST optimisation to lexical arrays. Previously OP_AELEMFAST was only used as an optimisation for OP_GV, which is a PADOP/SVOP. However, by reusing the same opcode, and signalling (pad) lexical vs package, it introduced a myriad of special cases, because OP_PADAV is a BASEOP (not a PADOP), whilst OP_AELEMFAST is a PADOP/SVOP (which is larger). Using two OP numbers allows each variant to have the correct OP flags in PL_opargs. Both can continue to share the same C code.
* Make push/shift $scalar accept only unblessed aryrefsFather Chrysostomos2011-04-181-3/+3
| | | | See ticket #80626.
* Move all the generated file header printing into read_only_top()Nicholas Clark2011-01-231-4/+4
| | | | | | | | | Previously all the scripts in regen/ had code to generate header comments (buffer-read-only, "do not edit this file", and optionally regeneration script, regeneration data, copyright years and filename). This change results in some minor reformatting of header blocks, and standardises the copyright line as "Larry Wall and others".
* Merge the implementations of {end,set}{gr,pw}ent with endhostent.Nicholas Clark2011-01-101-4/+8
| | | | | Unlike set{host,net,proto,serv}ent, set{gr,pw}ent don't have stayopen parameter, hence their "signature" is the same as the ent*ent functions.
* Merge the implementations of pp_s{host,net,proto,serv}ent.Nicholas Clark2011-01-101-3/+6
|
* Merge the implementations of pp_e{host,net,proto,serv}ent.Nicholas Clark2011-01-101-3/+6
| | | | | | | PL_op_desc[] rather than PL_op_name(), as the OPs are internally named e*ent, but implement the ent*ent functions, and when unimplemented report themselves using the function name. No need for OP_DESC(), as the switch statement means that we can't encounter OP_CUSTOM.
* Generate "Unsupported socket function" stubs using PL_ppaddr.Nicholas Clark2011-01-091-0/+18
| | | | | | | | | | | | | | | Instead of having each socket op conditionally compile as either the implementation or a DIE() depending on #HAS_SOCKET 1: remove the conditional code from the ops themselves 2: only compile the ops if HAS_SOCKET is defined 3: general conditional code for the intialisation of PL_ppaddr - as appropriate either the ops, or Perl_unimplemented_op 4: Amend Perl_unimplemented_op to generate the appropriate DIE() for socket ops (ie not the "panic"... message) Whilst this complicates the support code in regen/opcode.pl, it's already a net saving of 5 lines in the C code.
* Rename pp_send to pp_syswrite, making send an alias for syswrite.Nicholas Clark2011-01-091-3/+3
| | | | | Previously syswrite was an alias for send. However, syswrite is always available, whereas send is not implemented if HAS_SOCKET is not defined.
* In opcode.h, use the alias macros in PL_ppaddr[]Nicholas Clark2011-01-091-96/+96
| | | | | | | | For OPs that share implementations, use #define aliases for the "original" names in PL_ppaddr[], instead of having regen/opcode.pl replace them with the name of the implementing OP body. Whilst this initially adds another layer of indirection, it will give more flexibility where conditional compilation of OPs is determined by the feature macros in config.h
* regen/opcode.pl should only generate prototypes for pp_* functions that exist.Nicholas Clark2011-01-091-3/+0
| | | | | | | It now generates prototypes for all functions that implement OPs. Hence Perl_unimplemented_op no longer needs a special-case prototype. As it is now generating a prototype for Perl_do_kv, no need for regen/embed.pl to duplicate this. Convert the last two users of the macro do_kv() to Perl_do_kv(aTHX).
* Replace OP stubs in mathoms.c with #define aliases in opcode.hNicholas Clark2011-01-091-7/+99
| | | | | | | External code that references OPs by name will still link (and work). Unlike the other compatibility functions in mathoms.c, the OP stubs were simply making calls onwards to their replacements, so simply taking up space without adding anything.
* Merge the opcode bodies for pp_bind and pp_connect.Nicholas Clark2010-12-301-1/+1
|
* Merge the opcode bodies for chop/chomp and schop/schomp.Nicholas Clark2010-12-271-4/+4
|
* Make entertry a LOGOP, not BASEOP/UNOPReini Urban2010-12-121-1/+1
| | | | | | | The initial parse-time UNOP is upgraded at ck_eval to an LOGOP - op_other holding the ptr to leavetry - which causes problems at run-time B optype inspection. The opclass info was always wrong, the Bytecode compiler broke with 5.12.
* Improve custom OP support.Ben Morrow2010-11-141-5/+0
| | | | | | | | | | | | | | | | | Change the custom op registrations from two separate hashes to one hash holding structure pointers, and add API functions to register ops and look them up. This will make it easier to add new properties of custom ops in the future. Copy entries across from the old hashes where necessary, to preserve compatibility. Add two new properties, in addition to the already-existing 'name' and 'description': 'class' and 'peep'. 'class' is one of the OA_*OP constants, and allows B and other introspection mechanisms to work with custom ops that aren't BASEOPs. 'peep' is a pointer to a function that will be called for ops of this type from Perl_rpeep. Adjust B.xs to take account of the new properties, and also to give custom ops their registered name rather than simply 'custom'.
* Add transr op typeFather Chrysostomos2010-11-021-1/+6
| | | | | for the upcoming y///r feature. There are not enough flag bits, hence the extra type.
* Allow push/pop/keys/etc to act on referencesDavid Golden2010-10-311-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All built-in functions that operate directly on array or hash containers now also accept hard references to arrays or hashes: |----------------------------+---------------------------| | Traditional syntax | Terse syntax | |----------------------------+---------------------------| | push @$arrayref, @stuff | push $arrayref, @stuff | | unshift @$arrayref, @stuff | unshift $arrayref, @stuff | | pop @$arrayref | pop $arrayref | | shift @$arrayref | shift $arrayref | | splice @$arrayref, 0, 2 | splice $arrayref, 0, 2 | | keys %$hashref | keys $hashref | | keys @$arrayref | keys $arrayref | | values %$hashref | values $hashref | | values @$arrayref | values $arrayref | | ($k,$v) = each %$hashref | ($k,$v) = each $hashref | | ($k,$v) = each @$arrayref | ($k,$v) = each $arrayref | |----------------------------+---------------------------| This allows these built-in functions to act on long dereferencing chains or on the return value of subroutines without needing to wrap them in C<@{}> or C<%{}>: push @{$obj->tags}, $new_tag; # old way push $obj->tags, $new_tag; # new way for ( keys %{$hoh->{genres}{artists}} ) {...} # old way for ( keys $hoh->{genres}{artists} ) {...} # new way For C<push>, C<unshift> and C<splice>, the reference will auto-vivify if it is not defined, just as if it were wrapped with C<@{}>. Calling C<keys> or C<values> directly on a reference gives a substantial performance improvement over explicit dereferencing. For C<keys>, C<values>, C<each>, when overloaded dereferencing is present, the overloaded dereference is used instead of dereferencing the underlying reftype. Warnings are issued about assumptions made in the following three ambiguous cases: (a) If both %{} and @{} overloading exists, %{} is used (b) If %{} overloading exists on a blessed arrayref, %{} is used (c) If @{} overloading exists on a blessed hashref, @{} is used
* opcode.pl -> regen/opcode.plFather Chrysostomos2010-10-131-2/+2
|
* Remove MEMBER_TO_FPTR.Ben Morrow2010-10-061-732/+732
| | | | This is left over from PERL_OBJECT (see beeff2, 16c915, and so on).
* Remove OA_RETINTEGER, unused since 2002 (commit e7311069df54baa6)Nicholas Clark2010-08-281-344/+344
| | | | | | | | This returns us to 8 flag bits, and restores OCSHIFT and OASHIFT to 8 and 12 Previously these were 9 and 13, and effectively PL_opargs[] was using 33 of 32 bits, relying on the ugly hack that no 5 argument builtin had an optional 5th argument, hence the (13 + 5 * 4)th bit was always zero. is effectively 33 bits.
* srand: change to return its seedKarl Williamson2010-07-281-1/+1
| | | | | | | | | | | | | | This commit changes srand to to return the seed instead of always returning 1. The motivation behind this is to allow applications to not have to come up with their own pseudo-random generator if they want repeatable results. The previous return behavior has never been documented. Note that it is possible, but very unlikely, for the seed to end up being 0, which means that if someone were relying on the undocumented previous behavior of srand returning true, that in very rare instances it would return 0, failing, and the next time they ran it, it would succeed, possibly leading to puzzlement and very rare unexplained failures.
* Make eval {} compile directly to OP_ENTERTRYRafael Garcia-Suarez2009-12-201-2/+2
| | | | | This way, it's correctly caught and blocked by Safe, separately from eval "".
* Move the boolkeys op to the group of hash ops.Nicholas Clark2009-10-151-5/+5
| | | | This breaks binary compatibility.
* Optimise if (%foo) to be faster than if(keys %foo)demerphq2009-10-151-0/+5
| | | | | | | | | | | Thread was "[PATCH] Make if (%hash) {} act the same as if (keys %hash) {}" http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2006-11/msg00432.html but the implementation evolved from the approach described in the subject, to instead add a new opcode pp_boolkeys, to exactly preserve the existing behaviour. Various conflicts with the passage of time resolved, 'register' removed, and a $VERSION bump.
* Ensure that constant folding runs with IN_PERL_RUNTIME true, by copyingNicholas Clark2008-02-251-1/+1
| | | | | | the current compiling cop to a different address. This ensures that lexical hints are correctly honoured, and allows us to fold sprintf. p4raw-id: //depot/perl@33369
* Re: [PATCH] Splitting OP_CONST (Was: pp_const, not, that, hot?)Vincent Pit2008-02-231-0/+5
| | | | | | Message-ID: <47B60D72.50708@profvince.com> Date: Fri, 15 Feb 2008 23:08:50 +0100 p4raw-id: //depot/perl@33356
* Eliminate ck_lengthconst.Nicholas Clark2008-02-201-1/+1
| | | p4raw-id: //depot/perl@33338
* Setting the f flag on length causes the op to be constant folded.Nicholas Clark2008-02-201-1/+1
| | | p4raw-id: //depot/perl@33337
* [patch] optimize OP_IS_(FILETEST|SOCKET) macrosJim Cromie2008-02-101-10/+10
| | | | | | Message-ID: <47ADBF3B.2050108@gmail.com> Date: Sat, 09 Feb 2008 07:56:59 -0700 p4raw-id: //depot/perl@33267
* Eliminate the OP_SETSTATE, which had been disabled by change 4309.Nicholas Clark2008-01-261-5/+0
| | | p4raw-id: //depot/perl@33072
* Implement each @array.Nicholas Clark2007-12-201-3/+18
| | | | | | Documentation needed, FIXME for proper 64 bit support of arrays longer than 2**32, re-order the new ops at the end if merging to 5.10.x. p4raw-id: //depot/perl@32680
* Make state $zok = slosh(); behave as the Perl 6 design with an implicitNicholas Clark2007-09-061-0/+5
| | | | | | | | | | | | | | | START block. First time through, call slosh() and assign to $zok. Subsequently neither call slosh() nor assign to $zok. Adds a new op ONCE to control the conditonal call and assign. No change to list context, so state ($zok) = slosh() and (state $zok) = ... etc will still repeatedly evaluate and assign. [Can't fix that before 5.10] Use as an RVALUE is as Larry's design - my $boff = state $zok = ...; will evaluate, assign and return first time, and subsequently act as if it were written my $boff = $zok; FIXME - state $zok = ...; won't deparse - I believe op->op_last isn't being correctly set on the sassign, but I don't know how to fix this. This change may be backed out before 5.10. p4raw-id: //depot/perl@31798
* A logical rearrangement of ops, to get the post 5.005 ops to theirNicholas Clark2007-03-301-60/+60
| | | | | logical groups. p4raw-id: //depot/perl@30784
* Remove the restriction that op_custom has to be the last op.Nicholas Clark2007-03-301-0/+1
| | | | | This allows more ops to be added during the life of a stable release. p4raw-id: //depot/perl@30782
* Make readline() default to *ARGV.Rafael Garcia-Suarez2007-03-241-1/+1
| | | | | Plus MAD fixes. p4raw-id: //depot/perl@30750
* Now that readpipe defaults to $_, I should update the prototype tableRafael Garcia-Suarez2007-03-241-1/+1
| | | | | in opcode.pl too. p4raw-id: //depot/perl@30749
* blead (honestly :-) g++ with -DPERL_GLOBAL_STRUCT_PRIVATE needs tweakingJarkko Hietaniemi2007-02-191-1/+2
| | | | | | | | Message-Id: <20070219174107.63EEB43A67@anubis.hut.fi> Plus a regen picked up changes in pod/perlapi.pod related to change #30347. p4raw-id: //depot/perl@30362
* pp_rv2av and pp_rv2hv have a lot of common code, so it's certainly aNicholas Clark2007-01-151-1/+1
| | | | | space saving to merge them. Hopefully this will reduce L2 cache misses. p4raw-id: //depot/perl@29836
* Eliminate pp_threadsv, as it was only ever used by 5005 threads.Nicholas Clark2007-01-081-7/+2
| | | p4raw-id: //depot/perl@29727
* Re-order ops to the implementation order in pp_sys.c - this makes aNicholas Clark2006-11-121-25/+25
| | | | | branch table corresponding to a switch statement slightly smaller. p4raw-id: //depot/perl@29251
* Re: $, and sayGisle Aas2006-11-021-1/+1
| | | | | | | | Message-ID: <lrek2t1e8n.fsf@caliper.activestate.com> with tweaks so "say;" continues to default to $_ plus a regression test p4raw-id: //depot/perl@29187
* Make readpipe() overridable (and also `` and qx//)Rafael Garcia-Suarez2006-10-311-1/+1
| | | p4raw-id: //depot/perl@29168
* C++: Solaris CC now compiles "perl"Jarkko Hietaniemi2006-09-111-2/+2
| | | | | Message-ID: <4502B398.6060505@iki.fi> p4raw-id: //depot/perl@28814
* Re: [PATCH] Trie jumpingYves Orton2006-09-051-2/+2
| | | | | Message-ID: <9b18b3110609020740y2eb9004cpab313c3353a437ca@mail.gmail.com> p4raw-id: //depot/perl@28785
* g++ stage 1 reachedJarkko Hietaniemi2006-08-081-2/+2
| | | | | Message-ID: <44D7AA6B.4040802@iki.fi> p4raw-id: //depot/perl@28674
* Merging pp_bit_or and pp_bit_xor shrinks the object code by about .7K.Nicholas Clark2006-02-071-1/+1
| | | | | The overloading tests are not free. p4raw-id: //depot/perl@27126