rename PrimOpPhase

This commit is contained in:
2026-07-12 21:11:38 +08:00
parent dde3052e2d
commit 7220b42024
14 changed files with 349 additions and 345 deletions
+233 -232
View File
@@ -31,7 +31,7 @@ pub enum Op {
MakePatternClosure,
Call,
DispatchPrimOp,
DispatchCont,
MakeAttrs,
MakeEmptyAttrs,
@@ -133,128 +133,140 @@ pub enum OperandData {
#[repr(u8)]
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
pub enum PrimOpPhase {
Abort,
Add,
AddErrorContext,
pub enum Continuation {
// primops
PAbort,
PAdd,
PAddErrorContext,
All,
AllCallPred,
AllCheck,
PAll,
PAllCallPred,
PAllCheck,
Any,
AnyCallPred,
AnyCheck,
PAny,
PAnyCallPred,
PAnyCheck,
AppendContext,
AttrNames,
AttrValues,
BaseNameOf,
BitAnd,
BitOr,
BitXor,
Break,
CatAttrs,
Ceil,
CompareVersions,
ConcatLists,
ConcatMap,
ConcatStringsSep,
ConvertHash,
PAppendContext,
PAppendContextLoop,
PAppendContextEntryForced,
PAppendContextOutputsForced,
PAppendContextOutputElementLoop,
PAppendContextOutputElementForced,
DeepSeq,
DeepSeqPush,
DeepSeqLoop,
PAttrNames,
PAttrValues,
PBaseNameOf,
PBitAnd,
PBitOr,
PBitXor,
PBreak,
PCatAttrs,
PCeil,
PCompareVersions,
PConcatLists,
PConcatMap,
PConcatStringsSep,
PConvertHash,
Derivation,
DerivationStrict,
DirOf,
Div,
Elem,
ElemAt,
FetchGit,
FetchMercurial,
FetchTarball,
FetchTree,
FetchUrl,
PDeepSeq,
PDeepSeqPush,
PDeepSeqLoop,
FilterForceList,
FilterCallPred,
FilterCheck,
PDerivation,
PDerivationStrict,
PDirOf,
PDiv,
PElem,
PElemAt,
PFetchGit,
PFetchMercurial,
PFetchTarball,
PFetchTree,
PFetchUrl,
FilterSource,
FindFile,
Floor,
FoldlStrict,
FoldlStrictEmpty,
FoldlStrictCall1,
FoldlStrictCall2,
FoldlStrictUpdate,
FromJSON,
FromTOML,
FunctionArgs,
GenList,
GenericClosure,
GetAttr,
GetContext,
GetEnv,
GroupBy,
HasAttr,
HasContext,
HashFile,
HashString,
Head,
Import,
IntersectAttrs,
IsAttrs,
IsBool,
IsFloat,
IsFunction,
IsInt,
IsList,
IsNull,
IsPath,
IsString,
Length,
LessThan,
ListToAttrs,
Map,
MapAttrs,
Match,
Mul,
ParseDrvName,
Partition,
Path,
PathExists,
Placeholder,
ReadDir,
ReadFile,
ReadFileType,
RemoveAttrs,
ReplaceStrings,
ScopedImport,
Seq,
Sort,
Split,
SplitVersion,
StorePath,
StringLength,
Sub,
Substring,
Tail,
Throw,
ToFile,
ToJSON,
ToPath,
ToString,
ToXML,
Trace,
TryEval,
TypeOf,
UnsafeDiscardStringContext,
UnsafeGetAttrPos,
Warn,
ZipAttrsWith,
PFilterForceList,
PFilterCallPred,
PFilterCheck,
PFilterSource,
PFindFile,
PFloor,
PFoldlStrict,
PFoldlStrictEmpty,
PFoldlStrictCall1,
PFoldlStrictCall2,
PFoldlStrictUpdate,
PFromJSON,
PFromTOML,
PFunctionArgs,
PGenList,
PGenericClosure,
PGetAttr,
PGetContext,
PGetEnv,
PGroupBy,
PHasAttr,
PHasContext,
PHashFile,
PHashString,
PHead,
PImport,
PImportFinalize,
PScopedImport,
PScopedImportFinalize,
PIntersectAttrs,
PIsAttrs,
PIsBool,
PIsFloat,
PIsFunction,
PIsInt,
PIsList,
PIsNull,
PIsPath,
PIsString,
PLength,
PLessThan,
PListToAttrs,
PMap,
PMapAttrs,
PMatch,
PMul,
PParseDrvName,
PPartition,
PPath,
PPathExists,
PPlaceholder,
PReadDir,
PReadFile,
PReadFileType,
PRemoveAttrs,
PReplaceStrings,
PSeq,
PSort,
PSplit,
PSplitVersion,
PStorePath,
PStringLength,
PSub,
PSubstring,
PTail,
PThrow,
PToFile,
PToJSON,
PToPath,
PToString,
PToXML,
PTrace,
PTryEval,
PTypeOf,
PUnsafeDiscardStringContext,
PUnsafeGetAttrPos,
PWarn,
PZipAttrsWith,
PUnsafeDiscardOutputDependency,
ForceResultShallow,
ForceResultShallowPush,
@@ -268,21 +280,10 @@ pub enum PrimOpPhase {
CallFunctor1,
CallFunctor2,
ImportFinalize,
ScopedImportFinalize,
AppendContextLoop,
AppendContextEntryForced,
AppendContextOutputsForced,
AppendContextOutputElementLoop,
AppendContextOutputElementForced,
UnsafeDiscardOutputDependency,
Illegal,
}
impl TryFrom<u8> for PrimOpPhase {
impl TryFrom<u8> for Continuation {
type Error = u8;
fn try_from(value: u8) -> Result<Self, Self::Error> {
@@ -294,113 +295,113 @@ impl TryFrom<u8> for PrimOpPhase {
}
}
impl PrimOpPhase {
impl Continuation {
pub fn entry_for_builtin(id: BuiltinId) -> Self {
use BuiltinId::*;
match id {
Abort => Self::Abort,
Add => Self::Add,
AddErrorContext => Self::AddErrorContext,
All => Self::All,
Any => Self::Any,
AppendContext => Self::AppendContext,
AttrNames => Self::AttrNames,
AttrValues => Self::AttrValues,
BaseNameOf => Self::BaseNameOf,
BitAnd => Self::BitAnd,
BitOr => Self::BitOr,
BitXor => Self::BitXor,
Break => Self::Break,
CatAttrs => Self::CatAttrs,
Ceil => Self::Ceil,
CompareVersions => Self::CompareVersions,
ConcatLists => Self::ConcatLists,
ConcatMap => Self::ConcatMap,
ConcatStringsSep => Self::ConcatStringsSep,
ConvertHash => Self::ConvertHash,
DeepSeq => Self::DeepSeq,
Derivation => Self::Derivation,
DerivationStrict => Self::DerivationStrict,
DirOf => Self::DirOf,
Div => Self::Div,
Elem => Self::Elem,
ElemAt => Self::ElemAt,
FetchGit => Self::FetchGit,
FetchMercurial => Self::FetchMercurial,
FetchTarball => Self::FetchTarball,
FetchTree => Self::FetchTree,
FetchUrl => Self::FetchUrl,
Filter => Self::FilterForceList,
FilterSource => Self::FilterSource,
FindFile => Self::FindFile,
Floor => Self::Floor,
FoldlStrict => Self::FoldlStrict,
FromJSON => Self::FromJSON,
FromTOML => Self::FromTOML,
FunctionArgs => Self::FunctionArgs,
GenList => Self::GenList,
GenericClosure => Self::GenericClosure,
GetAttr => Self::GetAttr,
GetContext => Self::GetContext,
GetEnv => Self::GetEnv,
GroupBy => Self::GroupBy,
HasAttr => Self::HasAttr,
HasContext => Self::HasContext,
HashFile => Self::HashFile,
HashString => Self::HashString,
Head => Self::Head,
Import => Self::Import,
IntersectAttrs => Self::IntersectAttrs,
IsAttrs => Self::IsAttrs,
IsBool => Self::IsBool,
IsFloat => Self::IsFloat,
IsFunction => Self::IsFunction,
IsInt => Self::IsInt,
IsList => Self::IsList,
IsNull => Self::IsNull,
IsPath => Self::IsPath,
IsString => Self::IsString,
Length => Self::Length,
LessThan => Self::LessThan,
ListToAttrs => Self::ListToAttrs,
Map => Self::Map,
MapAttrs => Self::MapAttrs,
Match => Self::Match,
Mul => Self::Mul,
ParseDrvName => Self::ParseDrvName,
Partition => Self::Partition,
Path => Self::Path,
PathExists => Self::PathExists,
Placeholder => Self::Placeholder,
ReadDir => Self::ReadDir,
ReadFile => Self::ReadFile,
ReadFileType => Self::ReadFileType,
RemoveAttrs => Self::RemoveAttrs,
ReplaceStrings => Self::ReplaceStrings,
ScopedImport => Self::ScopedImport,
Seq => Self::Seq,
Sort => Self::Sort,
Split => Self::Split,
SplitVersion => Self::SplitVersion,
StorePath => Self::StorePath,
StringLength => Self::StringLength,
Sub => Self::Sub,
Substring => Self::Substring,
Tail => Self::Tail,
Throw => Self::Throw,
ToFile => Self::ToFile,
ToJSON => Self::ToJSON,
ToPath => Self::ToPath,
ToString => Self::ToString,
ToXML => Self::ToXML,
Trace => Self::Trace,
TryEval => Self::TryEval,
TypeOf => Self::TypeOf,
UnsafeDiscardStringContext => Self::UnsafeDiscardStringContext,
UnsafeDiscardOutputDependency => Self::UnsafeDiscardOutputDependency,
UnsafeGetAttrPos => Self::UnsafeGetAttrPos,
Warn => Self::Warn,
ZipAttrsWith => Self::ZipAttrsWith,
Abort => Self::PAbort,
Add => Self::PAdd,
AddErrorContext => Self::PAddErrorContext,
All => Self::PAll,
Any => Self::PAny,
AppendContext => Self::PAppendContext,
AttrNames => Self::PAttrNames,
AttrValues => Self::PAttrValues,
BaseNameOf => Self::PBaseNameOf,
BitAnd => Self::PBitAnd,
BitOr => Self::PBitOr,
BitXor => Self::PBitXor,
Break => Self::PBreak,
CatAttrs => Self::PCatAttrs,
Ceil => Self::PCeil,
CompareVersions => Self::PCompareVersions,
ConcatLists => Self::PConcatLists,
ConcatMap => Self::PConcatMap,
ConcatStringsSep => Self::PConcatStringsSep,
ConvertHash => Self::PConvertHash,
DeepSeq => Self::PDeepSeq,
Derivation => Self::PDerivation,
DerivationStrict => Self::PDerivationStrict,
DirOf => Self::PDirOf,
Div => Self::PDiv,
Elem => Self::PElem,
ElemAt => Self::PElemAt,
FetchGit => Self::PFetchGit,
FetchMercurial => Self::PFetchMercurial,
FetchTarball => Self::PFetchTarball,
FetchTree => Self::PFetchTree,
FetchUrl => Self::PFetchUrl,
Filter => Self::PFilterForceList,
FilterSource => Self::PFilterSource,
FindFile => Self::PFindFile,
Floor => Self::PFloor,
FoldlStrict => Self::PFoldlStrict,
FromJSON => Self::PFromJSON,
FromTOML => Self::PFromTOML,
FunctionArgs => Self::PFunctionArgs,
GenList => Self::PGenList,
GenericClosure => Self::PGenericClosure,
GetAttr => Self::PGetAttr,
GetContext => Self::PGetContext,
GetEnv => Self::PGetEnv,
GroupBy => Self::PGroupBy,
HasAttr => Self::PHasAttr,
HasContext => Self::PHasContext,
HashFile => Self::PHashFile,
HashString => Self::PHashString,
Head => Self::PHead,
Import => Self::PImport,
IntersectAttrs => Self::PIntersectAttrs,
IsAttrs => Self::PIsAttrs,
IsBool => Self::PIsBool,
IsFloat => Self::PIsFloat,
IsFunction => Self::PIsFunction,
IsInt => Self::PIsInt,
IsList => Self::PIsList,
IsNull => Self::PIsNull,
IsPath => Self::PIsPath,
IsString => Self::PIsString,
Length => Self::PLength,
LessThan => Self::PLessThan,
ListToAttrs => Self::PListToAttrs,
Map => Self::PMap,
MapAttrs => Self::PMapAttrs,
Match => Self::PMatch,
Mul => Self::PMul,
ParseDrvName => Self::PParseDrvName,
Partition => Self::PPartition,
Path => Self::PPath,
PathExists => Self::PPathExists,
Placeholder => Self::PPlaceholder,
ReadDir => Self::PReadDir,
ReadFile => Self::PReadFile,
ReadFileType => Self::PReadFileType,
RemoveAttrs => Self::PRemoveAttrs,
ReplaceStrings => Self::PReplaceStrings,
ScopedImport => Self::PScopedImport,
Seq => Self::PSeq,
Sort => Self::PSort,
Split => Self::PSplit,
SplitVersion => Self::PSplitVersion,
StorePath => Self::PStorePath,
StringLength => Self::PStringLength,
Sub => Self::PSub,
Substring => Self::PSubstring,
Tail => Self::PTail,
Throw => Self::PThrow,
ToFile => Self::PToFile,
ToJSON => Self::PToJSON,
ToPath => Self::PToPath,
ToString => Self::PToString,
ToXML => Self::PToXML,
Trace => Self::PTrace,
TryEval => Self::PTryEval,
TypeOf => Self::PTypeOf,
UnsafeDiscardStringContext => Self::PUnsafeDiscardStringContext,
UnsafeDiscardOutputDependency => Self::PUnsafeDiscardOutputDependency,
UnsafeGetAttrPos => Self::PUnsafeGetAttrPos,
Warn => Self::PWarn,
ZipAttrsWith => Self::PZipAttrsWith,
}
}