Appendix A Revision History
- Improved type nesting rules (SectionType nesting rules).
- Clarified that directionless extern parameters are passed by reference.
-
Introduced distinction between local compile-time known and compile-time known values (SectionCompile-time known and local compile-time known values).
-
Added header stack expressions (Section Header stack expressions).
- Allow casts from a type to itself (Section Casts).
- Added an invalid header or header union expression
{#}(Sections Operations on headers and Operations on header unions). - Added a concept of numeric values (Section Numeric types).
- Added a section on operations on extern objects (Section
Operations on
externobjects). - Added note in sections operations on types for types that support compile-time size determination.
- Clarified that header stacks are arrays of headers or header unions.
- Added distinctness of fields for types that have fields including error, match kind, struct, header, and header union.
- Clarified types
bit<W>,int<W>, andvarbit<W>encompass the case where the width is a compile-time known expression evaluating to an appropriate integer (Section Unsigned integers (bit-strings), Section Signed Integers, Section Dynamically-sized bit-strings). - Clarified restrictions for parameters with default values (Section Justification).
- Added optional trailing commas (Section Optional trailing commas).
- Clarified the scope of parser namespaces (Section Parser declarations).
- Specified that algorithm for generating control-plane names for keys is optional (Section Keys).
- Clarified types of expressions that may appear in
select(Section Select expressions). - Added description of semantics of the core.p4 match kinds (Section Keys).
- Explicitly disallow overloading of parsers, controls, and packages (Section Extern objects).
- Clarified implicit casts present in select expressions (Section Select expressions).
- Clarified that slices can be applied to arbitrary-precision integers (Section Operations on arbitrary-precision integers).
- Clarified that direct invocation is not possible for objects that have constructor arguments (Section Direct type invocation).
- Added comparison for tuples as a legal operation (Section Operations on tuple expressions).
- Clarified the behavior of
lookaheadon header-typed values (Section Lookahead). - Added
static_assertfunction (Section Static assertions). - Clarified semantics of ranges where the start is bigger than the end (Section Ranges).
- Allow ranges to be specified by serializable enums (Section Ranges).
- Specified type produced by the
*sizeInB*methods (Section Compile-time size determination). - Added section with operations on
match_kindvalues (Section Operations onmatch_kindtypes). - Renamed infinite-precision integers to arbitrary-precision integers (Section Arbitrary-precision integers).
- compiler-inserted
default_actionis notconst(Section Tables). - Clarified the restrictions on run time for tables with
const entries(Section Entries). - renamed list expressions to tuple expressions
- Added
listtype (Section List types). - Defined
entriestable property withoutconst, for entries installed when the P4 program is loaded, but the control plane can later change them or add to them (Section Entries). -
Clarified behavior of table with no
keyproperty, or if its list of keys is empty (Section Keys). -
Extended
minSizeInBitsandminSizeInBytesto apply to more expressions (Section Compile-time size determination). - Added support for
maxSizeInBitsandmaxSizeInBytes(Section Compile-time size determination). - Added support for empty lists of const entries in tables (Section Entries).
- Added support for
switchstatements in actions (Section Actions). - Added support for direct invocation of controls and parsers (Section Parameterization).
- Added parser
value_setto list of control-plane visible names (Section Control plane names). - Added
match_kindas a base type (Section The match kind type). - Removed structure initializers as they are subsumed by structure-valued expressions (Section Operations on structure-valued expressions).
- Specified operations on values typed as type variables (Section Operations on types that are type variables).
- Clarified semantics of compile-time known values (Section Compile-time known and local compile-time known values).
- Clarified semantics of directionless parameters (Section Calling convention: call by copy in/copy out).
- Clarified semantics of arbitrary precision integers (Section Arbitrary-precision integers).
- Clarified semantics of bit slices, shifts, and concatenation (Section Operations on fixed-width bit types (unsigned integers)).
- Clarified semantics of optional parameters (Section Optional parameters).
- Clarified restrictions on extern method and function invocation (Section Restrictions on compile time and run time calls).
-
Clarified semantics of implicit casts (Section Implicit casts).
-
Added support for accessing tuple fields (Section Operations on tuple expressions).
- Added support for generic structures (Section Type specialization).
- Added support for integers,
enums, anderrors inswitchstatements (Section Switch statement). - Added support for additional enumeration types (Section Enumeration types).
- Added support for abstract methods (Section Abstract methods).
- Added support for conditional statements and empty statements in parsers (Section Parser states).
- Added support for casts from
inttobool(Section Casts). - Added support for 0-width bitstrings and varbits (Section Reading uninitialized values and writing fields of invalid headers).
- Clarified that
default_actionisNoActionif otherwise unspecified (Section Tables). - Clarified the types of expressions that may be used as indexes for header stacks (Section Operations on header stacks).
- Clarified representation of Booleans in headers (Section Header types).
- Clarified representation of empty types (Section Reading uninitialized values and writing fields of invalid headers).
- Clarified that action data can be specified by the control plane,
default_actiontable property, orconst entriestable property (Section Actions). - Fixed several typos and inconsistencies in grammar (Section P4 grammar).
-
Eliminated annotations on
constentries in grammar (Section P4 grammar). -
Added structure-value expressions (Section Operations on structure-valued expressions).
- Added support for default values (Section Default values).
- Added support for concatenating signed strings (Section Concatenation).
- Added key-value and list-structured annotations (Section Annotations).
- Added
@pureand@noSideEffectsannotations (Section Extern function/method annotations). - Added
@noWarnannotation (Section No warnings annotation). - Generalized typing for masks to allow serializable
enums (Section Masks). - Restricted the right operands of bit shifts involving arbitrary-precision integers to be constant and positive (Section Operations on arbitrary-precision integers).
- Clarified copy-out behavior for
return(Section Return statement) andexit(Section Exit statement) statements. - Clarified semantics of invalid header stacks (Section Reading uninitialized values and writing fields of invalid headers).
- Clarified initialization semantics (Section L-values and Calling convention: call by copy in/copy out), especially for headers and local variables.
- Clarified evaluation order for table keys (Section Match-action unit execution semantics).
-
Fixed grammar to clarify parsing of right shift operator (
>>), allow empty statements in parser (Section Parser states), and eliminate annotations on const entries (Section Entries). -
Added
table.apply().miss(Section Match-action unit invocation). - Added
stringtype (Section Strings). - Added implicit casts from enum values (Section
Operations on
enumtypes). - Allow 1-bit signed values
- Define the type of bit slices from signed and unsigned values to be unsigned.
- Constrain
defaultlabel position forswitchstatements. - Allow empty tuples.
- Added
@deprecatedannotation. - Relaxed the structure of annotation bodies.
- Removed the
@pkginfoannotation, which is now defined by the P4Runtime specification. - Added
inttype (Section Arbitrary-precision integers). - Added error
ParserInvalidArgument(Sections Variable-width extraction, Skipping bits). - Clarified the significance of order of entries in
const entries(Section Entries). -
Added methods to calculate header size (Section Operations on headers).
-
Top-level functions (Section Function declarations)
- Functions may be declared at the top-level of a P4 program.
- Optional and named parameters (Section Calling convention: call by copy in/copy out)
- Parameters may be specified by name, with a default value, or designated as optional.
enumrepresentations (Section Operations onenumtypes)enumvalues to be specified with a concrete representation.
- Parser values sets (Section Parser Value Sets)
value_setobjects for control-plane programmableselectlabels.
- Type definitions (Section Introducing new types)
- New types may be introduced in programs.
- Saturating arithmetic (Section Operations on fixed-width bit types (unsigned integers))
- Saturating arithmetic is supported on some targets.
- Structured annotations (Section Annotations)
- Annotations may be specified as lists of key-value pairs
- Globalname (Section Annotations controlling naming)
- The reserved
globalnameannotation has been removed.
- The reserved
- Table
sizeproperty (Section Size)- Meaning of optional
sizeproperty for tables has been defined.
- Meaning of optional
- Invalid headers (Section Operations on headers)
- Clarified semantics of operations on invalid headers.
- Calling restrictions (Section Restrictions on compile time and run time calls)
- Added restrictions on kinds of values that may be passed as arguments to calls.
- Bitwise operator precedence (Section P4 grammar)
- Modified precedence conventions so that bitwise operators
&|and^have higher precedence than relation operators<><=>=.
- Modified precedence conventions so that bitwise operators
- Computed bitwidths (Section Base types)
- Added support for specifying widths using expressions in
bitandvarbittypes.
- Added support for specifying widths using expressions in