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

alloca & callconv fixes #11644

Merged
merged 4 commits into from
Jun 16, 2015
Merged

alloca & callconv fixes #11644

merged 4 commits into from
Jun 16, 2015

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Jun 10, 2015

@Keno and @JeffBezanson for your awareness, see the commit description for all of the things that this modifies

(i couldn't get the Vector case working -- it corrupts the functional test if you are interested in trying to find the alignment bug yourself -- so i turned it back off)

@Keno
Copy link
Member

Keno commented Jun 10, 2015

This is fantastic. Great work, Jameson!

@vtjnash vtjnash force-pushed the jn/fix_alloca_callconv branch 4 times, most recently from 9aa838f to 3add3c5 Compare June 12, 2015 21:43
@vtjnash
Copy link
Member Author

vtjnash commented Jun 16, 2015

the win32 test was broken because llvm33 incorrectly orders a WIN_ALLOCA and a libcall (to floor) during the machine code instruction selection pass (conversion from IR). i'm just going to just turn off the emission of _chkstk on llvm33, since it doesn't work that well there anyways (fixed in llvm 3.6.1).

fix #11187 (pass struct and tuple objects by stack pointer)
fix #11450 (ccall emission was frobbing the stack)
likely may fix #11026 and may fix #11003 (ref #10525) invalid stack-read on 32-bit

this additionally changes the julia specSig calling convention to pass
non-primitive types by pointer instead of by-value

this additionally fixes a bug in gen_cfunction that could be exposed by
turning off specSig

this additionally moves the alloca calls in ccall (and other places) to
the entry BasicBlock in the function, ensuring that llvm detects them as
static allocations and moves them into the function prologue

this additionally fixes some undefined behavior from changing
a variable's size through a alloca-cast instead of zext/sext/trunc

this additionally prepares for turning back on allocating tuples as vectors,
since the gc now guarantees 16-byte alignment

future work this makes possible:
 - create a function to replace the jlallocobj_func+init_bits_value call pair (to reduce codegen pressure)
 - allow moving pointers sometimes rather than always copying immutable data
 - teach the GC how it can re-use an existing pointer as a box
@vtjnash
Copy link
Member Author

vtjnash commented Jun 16, 2015

CI seems (mostly) happy now, so I'll merge this in the morning. then we can start to check whether it has successfully taken care of all of the invalid stack reads or if any still remain.

@JeffBezanson
Copy link
Member

Looks like the ccall test failed on 32-bit travis?

@vtjnash
Copy link
Member Author

vtjnash commented Jun 16, 2015

fooey, i think i merged the wrong version of this branch

@vtjnash vtjnash merged commit 754bad4 into master Jun 16, 2015
@vtjnash vtjnash deleted the jn/fix_alloca_callconv branch June 16, 2015 16:05
tkelman referenced this pull request Jun 16, 2015
@mbauman mbauman mentioned this pull request Jun 20, 2015
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