Ver a proveniência

Add flags to Map with MAP_ENCLOSED bit; add pool pointer to Map for scope free list

master
Ian Piumarta há 4 anos
ascendente
cometimento
1cee17ea17
1 ficheiros alterados com 10 adições e 2 eliminações
  1. +10
    -2
      object.c

+ 10
- 2
object.c Ver ficheiro

@ -121,11 +121,19 @@ struct Pair {
oop value;
};
enum {
MAP_ENCLOSED = 1 << 0, // set when map is used as a scope and closed over by a function
};
struct Map {
type_t type;
int flags;
struct Pair *elements; // even are keys, odd are values [ key val key val key val ]
size_t size;
size_t capacity;
union {
size_t size; // free Maps will be reset to 0 size on allocation
oop pool; // free list of Map objects
};
};
union object {
@ -294,7 +302,7 @@ oop makeFunction(primitive_t primitive, oop name, oop param, oop body, oop paren
oop makeMap()
{
oop newMap = malloc(sizeof(union object));
oop newMap = malloc(sizeof(union object)); assert(0 == newMap->Map.flags);
newMap->type = Map;
return newMap;
}

Carregando…
Cancelar
Guardar