Fix value comparison and sorting semantics
Build / AerScript (push) Successful in 31s

This commit is contained in:
2026-11-05 22:26:00 +01:00
parent 3c3c15281a
commit d98f6a8e91
10 changed files with 1956 additions and 681 deletions
+9 -1
View File
@@ -790,6 +790,7 @@ struct ph7_hashmap {
sxu32(*xIntHash)(sxi64); /* Hash function for int_keys */
sxu32(*xBlobHash)(const void *, sxu32); /* Hash function for blob_keys */
sxi64 iNextIdx; /* Next available automatically assigned index */
sxi32 bIdxExhausted; /* TRUE once the int64 index space is exhausted (no index after SXI64_HIGH) */
sxi32 iRef; /* Reference count */
};
/* An instance of the following structure is the context
@@ -866,6 +867,7 @@ struct GenBlock {
ph7_gen_state *pGen; /* State of the code generator */
GenBlock *pParent; /* Upper block or NULL if global */
sxu32 nFirstInstr; /* First instruction to execute */
sxu32 nSerial; /* Unique id of this instance [ph7_gen_state::nBlockSerial] */
sxi32 iFlags; /* Block control flags (see below) */
SySet aJumpFix; /* Jump fixup (JumpFixup instance) */
void *pUserData; /* Upper layer private data */
@@ -889,6 +891,8 @@ struct ph7_gen_state {
SyHash hLiteral; /* Constant string Literals table */
SyHash hNumLiteral; /* Numeric literals table */
SyHash hVar; /* Collected variable hashtable */
SyHash hDeclType; /* Declared-type categories of the variables currently visible [GenDeclType instance]. An entry is dropped as soon as the compiler emits an unset() on that name [its storage cell is destroyed] */
sxu32 nBlockSerial; /* Monotonic counter feeding GenBlock::nSerial. Unique inside one code-generator episode: PH7_InitCodeGenerator() zeroes it with the hDeclType table it empties, and PH7_CompileIncludedChunk() saves/restores the enclosing episode's counter in lockstep with that table, so a pooled block address is never mistaken for another live entry's instance */
GenBlock *pCurrent; /* Current processed block */
GenBlock sGlobal; /* Global block */
ProcConsumer xErr; /* Error consumer callback */
@@ -1676,7 +1680,11 @@ static inline sxi64 PH7_Int64ShiftRight(sxi64 a, sxi32 b) {
PH7_PRIVATE sxi32 PH7_MemObjDump(SyBlob *pOut, ph7_value *pObj, int ShowType, int nTab, int nDepth);
PH7_PRIVATE const char *PH7_MemObjTypeDump(ph7_value *pVal);
PH7_PRIVATE sxi32 PH7_MemObjAdd(ph7_value *pObj1, ph7_value *pObj2, int bAddStore);
PH7_PRIVATE sxi32 PH7_MemObjCmp(ph7_value *pObj1, ph7_value *pObj2, int bStrict, int iNest);
PH7_PRIVATE sxi32 PH7_MemObjCmp(ph7_value *pObj1, ph7_value *pObj2, int bStrict, int iNest, const char *zOp);
PH7_PRIVATE sxi32 PH7_MemObjCmpSafe(ph7_value *pObj1, ph7_value *pObj2, int bStrict, int iNest, const char *zOp);
PH7_PRIVATE sxi32 PH7_MemObjComparable(ph7_value *pObj1, ph7_value *pObj2);
PH7_PRIVATE sxi32 PH7_MemObjOrderable(ph7_value *pObj1, ph7_value *pObj2);
PH7_PRIVATE void PH7_VmThrowNoOrder(ph7_value *pObj1, ph7_value *pObj2, const char *zOp);
PH7_PRIVATE sxi32 PH7_MemObjInitFromString(ph7_vm *pVm, ph7_value *pObj, const SyString *pVal);
PH7_PRIVATE sxi32 PH7_MemObjInitFromArray(ph7_vm *pVm, ph7_value *pObj, ph7_hashmap *pArray);
PH7_PRIVATE sxi32 PH7_MemObjInitFromReal(ph7_vm *pVm, ph7_value *pObj, ph7_real rVal);