Branch: Tag:

2022-06-11

2022-06-11 08:51:08 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Add support for a mapping to the call_state.

10:   #include "svalue.h"   #include "stralloc.h"   #include "string_builder.h" + #include "mapping.h"      #define PIKE_TYPE_STACK_SIZE 100000   
192:      struct call_state   { +  struct mapping *m;    INT32 argno;   };    - #define LOW_INIT_CALL_STATE(CS, ARGNO) do { \ + #define LOW_INIT_CALL_STATE(CS, ARGNO, MAP) do { \ +  if (((CS).m = (MAP))) { \ +  add_ref((CS).m); \ +  } \    (CS).argno = (ARGNO); \    } while (0)    - #define INIT_CALL_STATE(CS) LOW_INIT_CALL_STATE(CS, 0) + #define INIT_CALL_STATE(CS) LOW_INIT_CALL_STATE(CS, 0, NULL)    - #define FREE_CALL_STATE(CS) + #define FREE_CALL_STATE(CS) free_call_state(&(CS))    -  + static inline void free_call_state(struct call_state *cs) + { +  if (cs->m) { +  free_mapping(cs->m); +  cs->m = NULL; +  } +  cs->argno = 0; + } +    /*    * soft_cast() flags    */