1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-02-03 15:13:03 +00:00

Simplify OPFN/OPFNX macros by removing hand expansion of 1, 2, N bindings (#383)

The OPFN and OPFNX macros had been coded with a hand expansion of a loop
pushing values on the stack to separately handle the cases of 1, 2, and
more values.  This actually lead to larger, likely slower, and certainly
less obvious code.
This commit is contained in:
Nick Briggs
2021-05-18 16:35:21 -07:00
committed by GitHub
parent 91fe7d51f9
commit 2122f095e8

View File

@@ -223,22 +223,10 @@
CSTKPTRL = (LispPTR *)(((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *)CSTKPTR; \
{ \
register int result; \
result = LOCFNCELL->pv; \
if (result >= 0) { \
register LispPTR unboundval; \
unboundval = (LispPTR)0xffffffff; \
for (int pv = LOCFNCELL->pv; pv >= 0; pv--) { \
const LispPTR unboundval = 0xffffffff; \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
if (result > 0) { \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
result -= 1; \
for (; --result >= 0;) { \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
} \
} \
} \
} \
CSTKPTRL += 1; \
@@ -291,22 +279,10 @@
CSTKPTRL = (LispPTR *)(((DLword *)CSTKPTR) + FRAMESIZE); \
PVARL = (DLword *)CSTKPTR; \
{ \
register int result; \
result = LOCFNCELL->pv; \
if (result >= 0) { \
register LispPTR unboundval; \
unboundval = (LispPTR)0xffffffff; \
for (int pv = LOCFNCELL->pv; pv >= 0; pv--) { \
const LispPTR unboundval = 0xffffffff; \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
if (result > 0) { \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
result -= 1; \
for (; --result >= 0;) { \
HARD_PUSH(unboundval); \
HARD_PUSH(unboundval); \
} \
} \
} \
} \
CSTKPTRL += 1; \