Skip to content

Conversation

@mjp41
Copy link
Owner

@mjp41 mjp41 commented Jan 8, 2025

This implements the addreference and remove reference logic for the dictionary.

This adds a Py_CLEAR like thing to remove the reference in the correct point.
Copy link
Collaborator

@xFrednet xFrednet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two hight level comments

@TobiasWrigstad
Copy link
Collaborator

@mjp41 Is this PR still draft or is that a stale label?

@mjp41
Copy link
Owner Author

mjp41 commented Jan 15, 2025

@mjp41 Is this PR still draft or is that a stale label?

Yes. There is a test failing I fixed locally, but need to tidy the change.

xFrednet added a commit that referenced this pull request Jan 15, 2025
xFrednet added a commit that referenced this pull request Jan 15, 2025
@mjp41 mjp41 marked this pull request as ready for review January 15, 2025 17:48
@xFrednet xFrednet mentioned this pull request Jan 15, 2025
3 tasks
Copy link
Collaborator

@xFrednet xFrednet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, mostly superficial comments and questions

@mjp41
Copy link
Owner Author

mjp41 commented Jan 20, 2025

Is it okay to merge this?

Copy link
Collaborator

@TobiasWrigstad TobiasWrigstad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @mjp41 !

bool _Pyrona_AddReference(PyObject* target, PyObject* new_ref);
#define Pyrona_ADDREFERENCE(a, b) _Pyrona_AddReference(a, b)
#define Pyrona_REMOVEREFERENCE(a, b) // TODO
bool _Py_RegionAddReference(PyObject* src, PyObject* new_tgt);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the renaming! 🙏

uint64_t new_version = _PyDict_NotifyEvent(
interp, PyDict_EVENT_CLONED, mp, b, NULL);
PyDictKeysObject *keys = clone_combined_dict_keys(other);
PyDictKeysObject *keys = clone_combined_dict_keys(other, a); // Need to say what owns the keys?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ? at the end of this comment suggests we need a FIXME or TODO label added!

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one the comment is stale, and needs removing. a owns the keys.

// The keys PyDictKeysObject, might already have the key. Note that
// the keys PyDictKeysObject is not a PyObject. So it is unclear where
// this edge is created.
// The keys is coming from ht_cached_keys on the type object.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// The keys is coming from ht_cached_keys on the type object.
// The key is coming from ht_cached_keys on the type object.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually meant the plural, as it is the "keys object/structure". But I can see why it is confusing and the addition of object/structure would make it clearer.

return -1;
}

//TODO: PYRONA: The addition of the key is complex here.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good with the labelling. We should go through all our phase3 code and make sure our TODOs and FIXMEs are all labelled thus.

@TobiasWrigstad
Copy link
Collaborator

Yes, please go ahead!

@mjp41 mjp41 merged commit 01a2586 into phase3 Jan 20, 2025
9 checks passed
@xFrednet xFrednet deleted the phase3dict branch January 21, 2025 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants