-
Notifications
You must be signed in to change notification settings - Fork 4
Update struct definitions #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
cd0d207
7ac7f5c
630b7ac
db8f5a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,14 +6,37 @@ | |
#define OGAttributeType_h | ||
|
||
#include "OGBase.h" | ||
#include "OGAttributeTypeFlags.h" | ||
#include "OGClosure.h" | ||
#include "OGTypeID.h" | ||
|
||
OG_ASSUME_NONNULL_BEGIN | ||
|
||
typedef struct OGAttributeType { | ||
OGTypeID typeID; | ||
OGTypeID valueTypeID; | ||
// TODO | ||
typedef struct OGAttributeType OGAttributeType; | ||
|
||
typedef struct OGAttributeVTable { | ||
unsigned long version; | ||
void (*_Nullable type_destroy)(OGAttributeType *); | ||
void (*_Nullable self_destroy)(const OGAttributeType *, void *); | ||
CFStringRef _Nullable (*_Nullable self_description)(const OGAttributeType *, const void *); | ||
CFStringRef _Nullable (*_Nullable value_description)(const OGAttributeType *, const void *); | ||
void (*_Nullable update_default)(const OGAttributeType *, void *); | ||
} OGAttributeVTable OG_SWIFT_NAME(_AttributeVTable); | ||
|
||
typedef struct OG_SWIFT_NAME(AttributeType) OGAttributeType { | ||
OGTypeID self_id; | ||
OGTypeID value_id; | ||
OGClosureStorage update; | ||
const OGAttributeVTable *vtable; | ||
OGAttributeTypeFlags flags; | ||
|
||
uint32_t internal_offset; | ||
const unsigned char *_Nullable value_layout; | ||
|
||
struct { | ||
OGTypeID type_id; | ||
const void *witness_table; | ||
} body_conformance; | ||
Comment on lines
+36
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Kyle-Ye This doesn't appear in the swift section dump you provided, but I can see it being set in Ghidra's disassembly. I'm not sure if there is a difference in behaviour depending on version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we miss something in swift section? Maybe we can try to use Ghidra and align those logic. cc @Mx-Iris There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm now on macOS Sequoia and the Swift section is reporting the structure is 56 bytes, which would exclude this field. But compatibility tests are confirming that it is definitely set. It's possible that it's not included in the attribute type struct, but instead part of a wrapper struct returned from the closure passed to AGGraphInternAttributeType. |
||
} OGAttributeType; | ||
|
||
OG_ASSUME_NONNULL_END | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// OGClosure.h | ||
// OpenGraph_SPI | ||
|
||
#ifndef OGClosure_h | ||
#define OGClosure_h | ||
|
||
#include "OGBase.h" | ||
|
||
OG_ASSUME_NONNULL_BEGIN | ||
|
||
OG_EXTERN_C_BEGIN | ||
|
||
typedef struct OGClosureStorage { | ||
const void *thunk; | ||
const void *_Nullable context; | ||
} OGClosureStorage; | ||
|
||
OG_EXPORT | ||
OG_REFINED_FOR_SWIFT | ||
OGClosureStorage OGRetainClosure(void (*thunk)(void *_Nullable context OG_SWIFT_CONTEXT) OG_SWIFT_CC(swift), | ||
void *_Nullable context); | ||
|
||
OG_EXPORT | ||
OG_REFINED_FOR_SWIFT | ||
void OGReleaseClosure(OGClosureStorage closure); | ||
|
||
OG_EXTERN_C_END | ||
|
||
OG_ASSUME_NONNULL_END | ||
|
||
#endif /* OGClosure_h */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets stored as an 8-bit field in
AG::Node
.