mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Store JSWAT_EXECUTE_IMMEDIATELY in a way that will fit in 16 bit function decls
This commit is contained in:
parent
b7e330060a
commit
6123df4f36
@ -14,6 +14,7 @@
|
||||
Switch native function decls from 32 bits to 16
|
||||
Swap HY2.4 board to software LCD driver as well, work out pin mappings from PY file
|
||||
Fix inaccuracy in setInterval, which had started since 32 bit switch in 1v65
|
||||
Store JSWAT_EXECUTE_IMMEDIATELY in a way that will fit in 16 bit function decls
|
||||
|
||||
1v67 : Lower size of timer task array of devices with little RAM (fix #401)
|
||||
Move hidden lists out of the root scope (fix #357)
|
||||
|
||||
@ -241,7 +241,7 @@ JsVar *jswBinarySearch(const JswSymList *symbolsPtr, JsVar *parent, const char *
|
||||
const JswSymPtr *sym = &symbolsPtr->symbols[idx];
|
||||
int cmp = strcmp(name, &symbolsPtr->symbolChars[sym->strOffset]);
|
||||
if (cmp==0) {
|
||||
if (sym->functionSpec & JSWAT_EXECUTE_IMMEDIATELY)
|
||||
if ((sym->functionSpec & JSWAT_EXECUTE_IMMEDIATELY_MASK) == JSWAT_EXECUTE_IMMEDIATELY)
|
||||
return jsnCallFunction(sym->functionPtr, sym->functionSpec, parent, 0, 0);
|
||||
return jsvNewNativeFunction(sym->functionPtr, sym->functionSpec);
|
||||
} else {
|
||||
|
||||
@ -39,7 +39,7 @@ JsVar *jsnCallFunction(void *function, JsnArgumentType argumentSpecifier, JsVar
|
||||
|
||||
|
||||
// run through all arguments
|
||||
while (argumentSpecifier) {
|
||||
while (argumentSpecifier & JSWAT_MASK) {
|
||||
// Get the parameter data
|
||||
JsVar *param = (paramNumber<paramCount) ? paramData[paramNumber] : (JsVar *)0;
|
||||
paramNumber++;
|
||||
|
||||
@ -30,9 +30,13 @@ typedef enum {
|
||||
JSWAT__LAST = JSWAT_JSVARFLOAT,
|
||||
JSWAT_MASK = NEXT_POWER_2(JSWAT__LAST)-1,
|
||||
|
||||
JSWAT_EXECUTE_IMMEDIATELY = 0x4000, // should this just be executed right away and the value returned? Used to encode constants in the symbol table
|
||||
// should this just be executed right away and the value returned? Used to encode constants in the symbol table
|
||||
// We encode this by setting all bits in the last argument, but leaving the second-last argument as zero
|
||||
JSWAT_EXECUTE_IMMEDIATELY = 0x7000,
|
||||
JSWAT_EXECUTE_IMMEDIATELY_MASK = 0x7E00,
|
||||
|
||||
JSWAT_THIS_ARG = 0x8000, // whether a 'this' argument should be tacked onto the start
|
||||
JSWAT_ARGUMENTS_MASK = ~(JSWAT_MASK | JSWAT_EXECUTE_IMMEDIATELY | JSWAT_THIS_ARG)
|
||||
JSWAT_ARGUMENTS_MASK = ~(JSWAT_MASK | JSWAT_THIS_ARG)
|
||||
} JsnArgumentType;
|
||||
// number of bits needed for each argument bit
|
||||
#define JSWAT_BITS GET_BIT_NUMBER(JSWAT_MASK+1)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user