Lines Matching refs:memo
137 GET = b'g' # push item from memo on stack; index is string arg
140 LONG_BINGET = b'j' # push item from memo on stack; index is 4-byte arg
144 PUT = b'p' # store stack top in memo; index is string arg
188 MEMOIZE = b'\x94' # store top of the stack in memo
460 self.memo = {}
467 """Clears the pickler's "memo".
469 The memo is the data structure that remembers which objects the
474 self.memo.clear()
492 """Store an object in the memo."""
494 # The Pickler memo is a dictionary mapping object ids to 2-tuples
495 # that contain the Unpickler memo key and the object being memoized.
496 # The memo key is written to the pickle and will become
497 # the key in the Unpickler's memo. The object is stored in the
498 # Pickler memo so that transient objects are kept alive during
501 # The use of the Unpickler memo length as the memo key is just a
502 # convention. The only requirement is that the memo values be unique.
504 # scheme allows the Unpickler memo to be implemented as a plain (but
505 # growable) array, indexed by memo key.
508 assert id(obj) not in self.memo
509 idx = len(self.memo)
511 self.memo[id(obj)] = idx, obj
544 # Check the memo
545 x = self.memo.get(id(obj))
696 # If the object is already in the memo, this means it is
698 # stack, and fetch the object back from the memo.
699 if id(obj) in self.memo:
700 write(POP + self.get(self.memo[id(obj)][0]))
884 memo = self.memo
889 if id(obj) in memo:
890 get = self.get(memo[id(obj)][0])
904 if id(obj) in memo:
905 # Subtle. d was not in memo when we entered save_tuple(), so
912 get = self.get(memo[id(obj)][0])
1045 if id(obj) in self.memo:
1046 # If the object is already in the memo, this means it is
1048 # stack, and fetch the object back from the memo.
1049 write(POP_MARK + self.get(self.memo[id(obj)][0]))
1058 memo = self.memo
1181 self.memo = {}
1611 self.append(self.memo[i])
1620 self.append(self.memo[i])
1629 self.append(self.memo[i])
1639 self.memo[i] = self.stack[-1]
1646 self.memo[i] = self.stack[-1]
1653 self.memo[i] = self.stack[-1]
1657 memo = self.memo
1658 memo[len(memo)] = self.stack[-1]