cairo-vm-go icon indicating copy to clipboard operation
cairo-vm-go copied to clipboard

Implement `DictSquashCopyDict` hint

Open TAdev0 opened this issue 1 year ago • 1 comments

This PR implements DictSquashCopyDict hint, which prepares arguments for creating a new dictionary with dict_new function. It copies the existing squashed dictionary in the current scope

TAdev0 avatar May 22 '24 12:05 TAdev0

@har777 i'm not 100% sure i'm implementing correctly this python code

dict(__dict_manager.get_dict(ids.dict_accesses_end))

could you check this? I guess this code only retrieves from operanders the address dict_accesses_end , uses GetDictionary to retrieve the dictionary (a copy) and assign it in scope?

TAdev0 avatar May 22 '24 13:05 TAdev0

could you resolve conflits? It will be easier to review ✅

MaksymMalicki avatar Jun 13 '24 10:06 MaksymMalicki

@har777 @MaksymMalicki just updated, now making a deep copy of the ZeroDict before assign it in the new scope. I added only one test for now with an empty dictionaryManager, will add other tests tomorrow

TAdev0 avatar Jun 13 '24 23:06 TAdev0

currently FreeOffset field of the ZeroDict struct is of type *uint64 , any reason?

TAdev0 avatar Jun 13 '24 23:06 TAdev0

@har777 ready for review, i think this is the last dict hint

TAdev0 avatar Jun 17 '24 14:06 TAdev0

i guess we should use FreeOffset uint64 in ZeroDictionary, there is no benefit of using a pointer here, we can modify this later

TAdev0 avatar Jun 17 '24 14:06 TAdev0

@har777 now only the dict Data is copied and I inlined the copy

TAdev0 avatar Jun 20 '24 10:06 TAdev0