Lines Matching refs:memo
128 GET = 'g' # push item from memo on stack; index is string arg
131 LONG_BINGET = 'j' # push item from memo on stack; index is 4-byte arg
135 PUT = 'p' # store stack top in memo; index is string arg
204 self.memo = {}
210 """Clears the pickler's "memo".
212 The memo is the data structure that remembers which objects the
218 self.memo.clear()
228 """Store an object in the memo."""
230 # The Pickler memo is a dictionary mapping object ids to 2-tuples
231 # that contain the Unpickler memo key and the object being memoized.
232 # The memo key is written to the pickle and will become
233 # the key in the Unpickler's memo. The object is stored in the
234 # Pickler memo so that transient objects are kept alive during
237 # The use of the Unpickler memo length as the memo key is just a
238 # convention. The only requirement is that the memo values be unique.
240 # scheme allows the Unpickler memo to be implemented as a plain (but
241 # growable) array, indexed by memo key.
244 assert id(obj) not in self.memo
245 memo_len = len(self.memo)
247 self.memo[id(obj)] = memo_len, obj
276 # Check the memo
277 x = self.memo.get(id(obj))
405 # If the object is already in the memo, this means it is
407 # stack, and fetch the object back from the memo.
408 if id(obj) in self.memo:
409 write(POP + self.get(self.memo[id(obj)][0]))
551 memo = self.memo
556 if id(obj) in memo:
557 get = self.get(memo[id(obj)][0])
570 if id(obj) in memo:
571 # Subtle. d was not in memo when we entered save_tuple(), so
578 get = self.get(memo[id(obj)][0])
699 memo = self.memo
706 _keep_alive(args, memo)
730 _keep_alive(stuff, memo)
738 memo = self.memo
783 def _keep_alive(x, memo):
784 """Keeps a reference to the object x in the memo.
789 We store a reference at the id of the memo, which should
791 the memo itself...
794 memo[id(memo)].append(x)
797 memo[id(memo)]=[x]
849 self.memo = {}
1157 self.append(self.memo[self.readline()[:-1]])
1162 self.append(self.memo[repr(i)])
1167 self.append(self.memo[repr(i)])
1171 self.memo[self.readline()[:-1]] = self.stack[-1]
1176 self.memo[repr(i)] = self.stack[-1]
1181 self.memo[repr(i)] = self.stack[-1]