Lines Matching refs:memo
631 PyMemoTable *memo; /* Memo table, keep track of the seen
656 The fast mode disable the usage of memo,
672 /* The unpickler memo is just an array of PyObject *s. Using a dict
674 PyObject **memo;
675 size_t memo_size; /* Capacity of the memo array */
676 size_t memo_len; /* Number of objects in the memo */
712 PicklerObject *pickler; /* Pickler whose memo table we're proxying. */
741 PyMemoTable *memo = PyMem_Malloc(sizeof(PyMemoTable));
742 if (memo == NULL) {
747 memo->mt_used = 0;
748 memo->mt_allocated = MT_MINSIZE;
749 memo->mt_mask = MT_MINSIZE - 1;
750 memo->mt_table = PyMem_Malloc(MT_MINSIZE * sizeof(PyMemoEntry));
751 if (memo->mt_table == NULL) {
752 PyMem_Free(memo);
756 memset(memo->mt_table, 0, MT_MINSIZE * sizeof(PyMemoEntry));
758 return memo;
932 * the number of expensive resize operations in a growing memo table.
934 * Very large memo tables (over 50K items) use doubling instead.
1141 self->memo = PyMemoTable_New();
1145 if (self->memo == NULL || self->output_buffer == NULL) {
1514 /* Returns -1 (with an exception set) on failure, 0 on success. The memo array
1523 PyObject **memo_new = self->memo;
1529 self->memo = memo_new;
1531 self->memo[i] = NULL;
1543 return self->memo[idx];
1559 old_item = self->memo[idx];
1560 self->memo[idx] = value;
1573 PyObject **memo = PyMem_NEW(PyObject *, new_size);
1574 if (memo == NULL) {
1578 memset(memo, 0, new_size * sizeof(PyObject *));
1579 return memo;
1582 /* Free the unpickler's memo, taking care to decref any items left in it. */
1587 PyObject **memo = self->memo;
1589 if (self->memo == NULL)
1591 self->memo = NULL;
1594 Py_XDECREF(memo[i]);
1596 PyMem_Free(memo);
1629 self->memo = _Unpickler_NewMemo(self->memo_size);
1632 if (self->memo == NULL || self->stack == NULL) {
1707 /* Generate a GET opcode for an object stored in the memo. */
1715 value = PyMemoTable_Get(self->memo, key);
1744 "memo id too large for LONG_BINGET");
1755 /* Store an object in the memo, assign it a new unique ID based on the number
1756 of objects currently stored in the memo and generate a PUT opcode. */
1769 idx = PyMemoTable_Size(self->memo);
1770 if (PyMemoTable_Set(self->memo, obj, idx) < 0)
1801 "memo id too large for LONG_BINPUT");
2802 /* The tuple isn't in the memo now. If it shows up there after
2805 * its value from the memo.
2812 if (PyMemoTable_Get(self->memo, obj)) {
2817 /* fetch from memo */
2839 if (PyMemoTable_Get(self->memo, obj)) {
2853 /* fetch from memo */
3514 /* If the object is already in the memo, this means it is
3516 stack, and fetch the object back from the memo. */
3517 if (PyMemoTable_Get(self->memo, obj)) {
4217 /* If the object is already in the memo, this means it is
4219 stack, and fetch the object back from the memo. */
4220 if (PyMemoTable_Get(self->memo, obj)) {
4300 /* Atom types; these aren't memoized, so don't check the memo. */
4315 /* Check the memo to see if it has the object. If so, generate
4318 if (PyMemoTable_Get(self->memo, obj)) {
4542 * memo): thus, these objects won't be garbage-collected as long as the
4552 Clears the pickler's "memo".
4554 The memo is the data structure that remembers which objects the
4564 if (self->memo)
4565 PyMemoTable_Clear(self->memo);
4621 if (self->memo != NULL) {
4623 res += self->memo->mt_allocated * sizeof(PyMemoEntry);
4654 PyMemoTable_Del(self->memo);
4682 if (self->memo != NULL) {
4683 PyMemoTable *memo = self->memo;
4684 self->memo = NULL;
4685 PyMemoTable_Del(memo);
4752 /* memo and output_buffer may have already been created in _Pickler_New */
4753 if (self->memo == NULL) {
4754 self->memo = PyMemoTable_New();
4755 if (self->memo == NULL)
4788 /* Define a proxy object for the Pickler's internal memo object. This is to
4790 * pickler.memo.clear()
4792 * pickler.memo = saved_memo
4801 Remove all items from memo.
4808 if (self->pickler->memo)
4809 PyMemoTable_Clear(self->pickler->memo);
4816 Copy the memo to a new object.
4823 PyMemoTable *memo;
4828 memo = self->pickler->memo;
4829 for (size_t i = 0; i < memo->mt_allocated; ++i) {
4830 PyMemoEntry entry = memo->mt_table[i];
4988 new_memo = PyMemoTable_Copy(pickler->memo);
5006 "'memo' values must be 2-item tuples");
5019 "'memo' attribute must be a PicklerMemoProxy object "
5024 PyMemoTable_Del(self->memo);
5025 self->memo = new_memo;
5074 {"memo", (getter)Pickler_get_memo,
7128 if (self->memo != NULL)
7279 self->memo = _Unpickler_NewMemo(self->memo_size);
7280 if (self->memo == NULL)
7289 /* Define a proxy object for the Unpickler's internal memo object. This is to
7291 * unpickler.memo.clear()
7293 * unpickler.memo = saved_memo
7305 Remove all items from memo.
7313 self->unpickler->memo = _Unpickler_NewMemo(self->unpickler->memo_size);
7314 if (self->unpickler->memo == NULL)
7322 Copy the memo to a new object.
7338 value = self->unpickler->memo[i];
7498 Py_XINCREF(unpickler->memo[i]);
7499 new_memo[i] = unpickler->memo[i];
7515 "memo key must be integers");
7523 "memo key must be positive integers.");
7532 "'memo' attribute must be an UnpicklerMemoProxy object "
7539 self->memo = new_memo;
7586 {"memo", (getter)Unpickler_get_memo, (setter)Unpickler_set_memo},