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

types as C-structs [rebased] #10579

Merged
merged 2 commits into from
Mar 20, 2015
Merged

types as C-structs [rebased] #10579

merged 2 commits into from
Mar 20, 2015

Conversation

Keno
Copy link
Member

@Keno Keno commented Mar 19, 2015

@JeffBezanson and I are in the process of looking at and hopefully merging #2818. This rebases that PR (with some unrelated changes already cherry-picked to master) hopefully to be merged soon.

vtjnash and others added 2 commits March 19, 2015 20:16
this makes references to types allocated in Julia recursively forward compatible with C structs
rename jl_typetag_t => jl_taggedvalue_t
rename jl_typetagof => jl_astaggedvalue
JeffBezanson added a commit that referenced this pull request Mar 20, 2015
@JeffBezanson JeffBezanson merged commit 175d732 into master Mar 20, 2015
@kmsquire
Copy link
Member

Does this deserve a NEWS entry?

@kmsquire
Copy link
Member

Also need to remove the reference to #2818 from the "Calling C and Fortran" docs.

@tkelman
Copy link
Contributor

tkelman commented Mar 20, 2015

This utterly broke the windows build. Can we please let CI do its job?

@StefanKarpinski
Copy link
Sponsor Member

True – there's not much point in paying AppVeyor for CI as a service if we're going to ignore it.

@tkelman
Copy link
Contributor

tkelman commented Mar 20, 2015

@vtjnash or @Keno, how do we deal with this

$ usr/bin/julia-debug
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.0-dev+3939 (2015-03-20 12:38 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit b43f0b0* (0 days old master)
|__/                   |  x86_64-w64-mingw32


Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0xe08aab -- jl_setjmp at D:\cygwin64\home\Tony\julia\usr\bin\libjulia-debug.dll (unknown line)
jl_setjmp at D:\cygwin64\home\Tony\julia\usr\bin\libjulia-debug.dll (unknown line)
julia_init at D:\cygwin64\home\Tony\julia\usr\bin\libjulia-debug.dll (unknown line)
jl_f_yieldto at D:\cygwin64\home\Tony\julia\usr\bin\libjulia-debug.dll (unknown line)
wait at task.jl:305
stream_wait at stream.jl:271
uv_write at stream.jl:751
buffer_or_write at stream.jl:764
write at stream.jl:826
print at string.jl:68
jlcall_print_664 at  (unknown line)
jl_operator_precedence at D:\cygwin64\home\Tony\julia\usr\bin\libjulia-debug.dll (unknown line)
jl_trampoline at D:\cygwin64\home\Tony\julia\usr\bin\libjulia-debug.dll (unknown line)
jl_init_types at D:\cygwin64\home\Tony\julia\usr\bin\libjulia-debug.dll (unknown line)
jl_apply_generic at D:\cygwin64\home\Tony\julia\usr\bin\libjulia-debug.dll (unknown line)
banner at version.jl:232
_start at client.jl:415
jlcall__start_589 at  (unknown line)
jl_operator_precedence at D:\cygwin64\home\Tony\julia\usr\bin\libjulia-debug.dll (unknown line)
jl_trampoline at D:\cygwin64\home\Tony\julia\usr\bin\libjulia-debug.dll (unknown line)
jl_init_types at D:\cygwin64\home\Tony\julia\usr\bin\libjulia-debug.dll (unknown line)
jl_apply_generic at D:\cygwin64\home\Tony\julia\usr\bin\libjulia-debug.dll (unknown line)
unknown function (ip: 4199740)
unknown function (ip: 4203441)
unknown function (ip: 4204232)
unknown function (ip: 4199370)
unknown function (ip: 4199672)
BaseThreadInitThunk at C:\Windows\system32\kernel32.dll (unknown line)
RtlUserThreadStart at C:\Windows\SYSTEM32\ntdll.dll (unknown line)

Tony@TK-samsung ~/julia
$ gdb -q usr/bin/julia-debug
Reading symbols from usr/bin/julia-debug...done.
(gdb) r
Starting program: /home/Tony/julia/usr/bin/julia-debug
[New Thread 9584.0x1e30]
[New Thread 9584.0x11bc]
[New Thread 9584.0x3180]
[New Thread 9584.0x5d34]
[New Thread 9584.0x47d4]
[New Thread 9584.0x2440]
[New Thread 9584.0x4c28]
[New Thread 9584.0x4444]
[New Thread 9584.0x56d4]
[New Thread 9584.0x5b84]
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.0-dev+3939 (2015-03-20 12:38 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit b43f0b0* (0 days old master)
|__/                   |  x86_64-w64-mingw32

[New Thread 9584.0x2b34]

Program received signal SIGSEGV, Segmentation fault.
jl_setjmp () at _setjmp.win64.S:23
23          movaps XMMWORD PTR [rcx+96],xmm6
(gdb) bt
#0  jl_setjmp () at _setjmp.win64.S:23
#1  0x0000000000dc6ce0 in ctx_switch (t=0x8170f0c8, where=0x8170f118) at task.c:296
#2  0x0000000000dc6ebb in switchto (t=0x8170f0c8) at task.c:371
#3  0x0000000000dc7dd4 in jl_f_yieldto (F=0x80020728, args=0xd5ece0, nargs=2) at task.c:887
#4  0x0000000010aa799e in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

@vtjnash
Copy link
Sponsor Member

vtjnash commented Mar 20, 2015

Ah, I was considering fixing that, but couldn't come up with a test case originally.

On my phone now, but if someone wants to take a shot at this -- every pool we allocate in the gc should be shifted by (sizeof(jl_typetag_t)%16 bytes) before slicing it up

@tkelman
Copy link
Contributor

tkelman commented Mar 20, 2015

AppVeyor's also idle right now so if someone can translate that into a patch it shouldn't take long to check.

@JeffBezanson
Copy link
Sponsor Member

@StefanKarpinski is it possible to change some permissions to let more people cancel appveyor builds? I don't think I can.

@tkelman
Copy link
Contributor

tkelman commented Mar 20, 2015

@JeffBezanson you have to log out then log back in as StefanKarpinski. Everyone with commit access should be allowed to do that.

@tkelman
Copy link
Contributor

tkelman commented Mar 20, 2015

It's a really odd UI (cc @FeodorFitsner this should probably be made simpler / more obvious) - you log in with your own Github credentials, but then you should see a screen that looks like this:
image
You have to select the StefanKarpinski entry there to be able to cancel / restart Julia builds.

@Keno
Copy link
Member Author

Keno commented Mar 20, 2015

I don't have that option, I presume because my GitHub account was renamed and AppVeyor got confused.

@FeodorFitsner
Copy link

Sure, this will be changed though it's non-trivial change (API is affected) that requires careful planning. Perhaps, will be a good chance to re-write UI on Angular 2.0 and TypeScript :)

@tkelman
Copy link
Contributor

tkelman commented Mar 21, 2015

So, aside from the MinGW failure which I was hoping someone could translate from Jameson English into commit-worthy code (I can't...), there's also this: https://msdn.microsoft.com/en-us/library/0scy7z2d.aspx

@vtjnash
Copy link
Sponsor Member

vtjnash commented Mar 21, 2015

there's also this: https://msdn.microsoft.com/en-us/library/0scy7z2d.aspx

i assume you mean that issue comes up when you try to do a msvc compile? you could probably just make this macro define empty:

struct _jl_value_t *fieldptr0[0];

it seems that may be a C99 feature

@tkelman
Copy link
Contributor

tkelman commented Mar 22, 2015

Will try that. Thanks for fixing the alignment issue.

@tkelman tkelman deleted the jbkf/hidetypetag branch March 22, 2015 05:18
@tkelman
Copy link
Contributor

tkelman commented Mar 22, 2015

That helps a bit. How about this line

jl_value_t value[0];
giving https://msdn.microsoft.com/en-us/library/81zca88z.aspx ?

I've also been trying with the VS 2015 rc's that are available on AppVeyor, and it doesn't help fix these.

@tkelman
Copy link
Contributor

tkelman commented Mar 22, 2015

I don't think the size-zero array is a C99 thing, it looks from https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html like it's a GNU extension and the MSVC error is strictly speaking true according to the C standard.

Someone should check whether ICC allows this construct.

@nalimilan
Copy link
Member

If the intent is to have a variable-length array, then you should be able to replace value[0] with value[], right? That's how it's done here:

julia/src/gc.c

Line 49 in e1f0310

char data[];

@tkelman
Copy link
Contributor

tkelman commented Mar 22, 2015

No, that doesn't work https://ci.appveyor.com/project/tkelman/julia/build/1.0.644

The other struct types with C99 flexible array members aren't causing problems because there don't appear to be any arrays of them anywhere. value is an array of jl_value_t, which violates "A structure containing a flexible array member, or a union containing such a structure (possibly recursively), may not be a member of a structure or an element of an array." - since jl_value_t itself has a flexible array member in it for fieldptr.

@nalimilan
Copy link
Member

Ah, got it, that's the recursive nature of these that's the problem.

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.

8 participants