Version 8 (modified by NotFound, 11 years ago) |
---|
Parrot Deprecations for 3.0
CodeString
The CodeString PMC has been removed
Rationale
Equivalent and more efficient functionality is available from StringBuilder.
Replacement
CodeString contains a number of convenience methods in addition to its core functionality. It is easier to replace these first.
- CodeString.lineof can be replaced by PGE;Util;line_number
- CodeString.unique can be replaced by PGE;Util;unique, PAST;Compiler;unique, or PAST;Compiler;uniquereg
- CodeString.escape can be replaced by PGE;Util;pir_str_escape
- CodeString.key can be replaced by PGE;Util;pir_key_escape
- CodeString.charname_to_ord can be replaced by the find_codepoint opcode
After these replacements, StringBuilder can be substituted for CodeString by changing .emit to .append_format. append_format does not add newlines, so these must be added to the format string.
:unique_reg PIR value flag
The :unique_reg flag on registers in PIR is no longer available.
Rationale
It doesn't do anything. Also, this is a terrible way to work around register allocator failures if/when we get a register allocator.
Replacement
s/:unique_reg//g
.nci_call and .meth_call PIR special forms
Specifying the type of call being performed is no longer required thanks to the magic of virtual dispatch.
Rationale
They're old, crufty, and don't do anything that cannot be acheived by .call. Except obfuscasion of course.
Replacement
Use .call. It should be a simple text replacement fix.
Indirect Register Access Ops
Opcodes that access registers that are not their direct arguments are deprecated. Note, however, that direct arguments does include keys and pcc ops.
Ops that are known to have this behaviour are clear{i,n,s,p} and set{i,n,s,p}_ind. These have been removed. No other core ops are known to have this behaviour. If you've created a dynop that has this behaviour, it and code using it is subject to breakage without notice (we reserve the right to implement optimizers).
Rationale
They don't fit well with the level of the rest of parrot's opcodes. They make register lifetime analysis impossible, preventing many optimizations.
Replacement
If you really are using this, rethink your code. Stop using the register frame as an aggregate. Use an object aggregate in stead.
Exchange Op
Description
The exchange ops are deprecated.
Rationale
They operate at too low a level to be useful as parrot ops.
Replacement
You aren't using this. Seriously?
.macro xchg_int(a, b) $I0 = .a .a = .b .b = $I0 .endm
PIR string literals with charset and encoding are deprecated
Description
PIR string literals of the form
encoding:charset:"string"
are deprecated.
Rationale
After the charset/encoding merge, they're unneeded.
Replacement
They can be replaced with
encoding:"string"
The encoding should be one of the new unified encodings.
Remaining string_* functions are deprecated
Description
The string_* functions have been deprecated for a while. The remaining functions are:
string_make string_ord string_chr string_to_cstring_nullable string_max_bytes string_increment
Rationale
They're old cruft.
Replacement
string_make should be replaced with Parrot_str_new_init. You can use Parrot_find_encoding to get an encoding from a cstring.
Replace string_ord with Parrot_str_indexed.
Replace string_chr with Parrot_str_chr.
Replace string_to_cstring_nullable with Parrot_str_to_cstring.
string_max_bytes and string_increment will be removed.
Method lower in String PMC
Description
The method lower in the String PMC has been removed.
Rationale
HLLs may need its own version with different name and semantic, having a generic one is confusing. For other usages string registers are more convenient.
Replacement
Use string registers and the downcase opcode. For HLLs, provide its own version in the HLL mapped String type.