Skip to content
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

Variable size field descriptors #13147

Merged
merged 5 commits into from
Sep 16, 2015
Merged

Variable size field descriptors #13147

merged 5 commits into from
Sep 16, 2015

Conversation

yuyichao
Copy link
Contributor

This is the part of #11888 that breaks the C api (but not julia API). We need this (or maybe part of this) before 0.4 final if we want any part of #11888 to be backported to the 0.4 series.

_jl_field_accessors(size)
_jl_field_accessors(isptr)

static inline uint32_t _jl_fielddesc_size(int8_t fielddesc_type)
Copy link
Member

Choose a reason for hiding this comment

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

We should only use jl_ as a prefix, not _jl_.

@JeffBezanson
Copy link
Member

This is great, I think it's better to start with this more minimal subset of the change. The size estimation code is pretty complex and I hadn't finished reviewing it.

@yuyichao
Copy link
Contributor Author

Done.

The size estimation code is pretty complex

Totally agree.

@@ -274,13 +283,18 @@ typedef struct _jl_datatype_t {
uint8_t pointerfree;
int32_t ninitialized;
// hidden fields:
uint8_t fielddesc_type : 2; // 0 -> 8, 1 -> 16, 2 -> 32
Copy link
Member

Choose a reason for hiding this comment

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

maybe steal a few bits from the alignment field (which should never need to be larger than a byte) instead of adding another 32-bit word here?

Copy link
Member

Choose a reason for hiding this comment

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

Good idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll do this after waiting to see if the AppVeyor failure is repeatable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

JeffBezanson added a commit that referenced this pull request Sep 16, 2015
@JeffBezanson JeffBezanson merged commit 0e5784b into master Sep 16, 2015
@yuyichao yuyichao deleted the yyc/type_size-api branch September 16, 2015 18:46
uint32_t uid;
void *struct_decl; //llvm::Value*
void *ditype; // llvm::MDNode* to be used as llvm::DIType(ditype)
jl_fielddesc_t fields[];
union {
Copy link
Member

Choose a reason for hiding this comment

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

C++ doesn't like this unknown union

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess this union can just be removed since the members are all zero sized.

Copy link
Member

Choose a reason for hiding this comment

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

it's not valid to have an unsized field that is not at the end of the struct, if that's what you are thinking

Copy link
Member

Choose a reason for hiding this comment

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

zero-sized arrays are a GCC-extension anyways (https://msdn.microsoft.com/en-us/library/79wf64bc.aspx). ISO C99 requires that you don't specify the size (https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html)

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