Hi Przemek and All,
It's common practice in Clipper/Harbour to use arrays to "emulate" structures:
---
#define _STRU_xVAR1 1
#define _STRU_xVAR2 2
#define _STRU_MAX_
LOCAL stru[ _STRU_MAX_ ]
stru[ _STRU_xVAR1 ] := 100
? stru[ _STRU_xVAR1 ]
---
In these scenarios, the array is indexed with a constant
in almost all cases.
This, currently, generates this pcode:
---
HB_P_PUSHBYTE, 100, /* 100 */
HB_P_PUSHLOCALNEAR, 1, /* STRU */
HB_P_ONE,
HB_P_ARRAYPOP,
HB_P_PUSHFUNCSYM, 1, 0, /* QOUT */
HB_P_PUSHLOCALNEAR, 1, /* STRU */
HB_P_ONE,
HB_P_ARRAYPUSH,
---
I wonder if we could optimize it by using one indexed
array pop opcode:
---
HB_P_PUSHBYTE, 100, /* 100 */
HB_P_ARRAYPOPINDEX, 1,
HB_P_PUSHFUNCSYM, 1, 0, /* QOUT */
HB_P_ARRAYPUSHINDEX, 1,
---
Since these kind of lines may appear in mass, such optimization
may result in code size reduction and speed increase.
Any opinion?
Brgds,
Viktor
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour