Skip to content

Reorganize shims by platform #1167

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

Merged
merged 17 commits into from
Feb 23, 2020
Merged

Reorganize shims by platform #1167

merged 17 commits into from
Feb 23, 2020

Conversation

pvdrz
Copy link
Contributor

@pvdrz pvdrz commented Feb 2, 2020

Fixes #1161. I am currently testing which shims belong to which platform. If you are reading this and know the answer for any of those please write me :P

Edit: this is a list of the shims I haven't been able to figure out to which platform they belong:
-malloc
-calloc
-posix_memalign
-free
-realloc
-__rust_alloc
-__rust_alloc_zeroed
-__rust_dealloc
-__rust_realloc
-__rust_maybe_catch_panic
-syscall
-getrandom
-dlsym
-memcmp
-memrchr
-memchr
-strlen
-signal
-sigaction
-sigaltstack
-sysconf
-sched_getaffinity
-isatty
-pthread_key_create
-pthread_key_delete
-pthread_getspecific
-pthread_setspecific
-pthread_attr_init
-pthread_attr_destroy
-pthread_self
-pthread_attr_setstacksize
-pthread_attr_getstack
-pthread_create
-pthread_mutexattr_init
-pthread_mutexattr_settype
-pthread_mutex_init
-pthread_mutexattr_destroy
-pthread_mutex_lock
-pthread_mutex_unlock
-pthread_mutex_destroy
-pthread_rwlock_rdlock
-pthread_rwlock_unlock
-pthread_rwlock_wrlock
-pthread_rwlock_destroy
-pthread_condattr_init
-pthread_condattr_setclock
-pthread_cond_init
-pthread_condattr_destroy
-pthread_cond_destroy
-pthread_atfork
-posix_fadvise
-mmap
-mprotect

@pvdrz pvdrz force-pushed the shims-refactor branch 2 times, most recently from 08afbf1 to eb86c57 Compare February 2, 2020 21:43
@RalfJung
Copy link
Member

RalfJung commented Feb 5, 2020

This is still marked as WIP... are there still questions about which platform some shims belong to?

@pvdrz
Copy link
Contributor Author

pvdrz commented Feb 6, 2020

This is still marked as WIP... are there still questions about which platform some shims belong to?

Yes, I'll do a list in the first comment to track them

@pvdrz
Copy link
Contributor Author

pvdrz commented Feb 6, 2020

Also I'm not sure what to do with the math functions where ldexp is the posix shim and _ldexp is the windows one, because the implementation is identical. Maybe we should add a shims/math.rs submodule?

@bors
Copy link
Contributor

bors commented Feb 8, 2020

☔ The latest upstream changes (presumably #1159) made this pull request unmergeable. Please resolve the merge conflicts.

@RalfJung
Copy link
Member

Also I'm not sure what to do with the math functions where ldexp is the posix shim and _ldexp is the windows one, because the implementation is identical. Maybe we should add a shims/math.rs submodule?

Seems fine to me to just have both of them on all platforms, TBH.

@RalfJung
Copy link
Member

this is a list of the shims I haven't been able to figure out to which platform they belong:

All the pthreads ones are POSIX.The rest are weird ones I mostly had to add to get the stack guard page setup to go through; you can grep for them in libstd to see on which platforms they get used.

@pvdrz
Copy link
Contributor Author

pvdrz commented Feb 12, 2020

OK, this is no longer a draft :P

@pvdrz pvdrz marked this pull request as ready for review February 12, 2020 00:01
@bors
Copy link
Contributor

bors commented Feb 14, 2020

☔ The latest upstream changes (presumably #1158) made this pull request unmergeable. Please resolve the merge conflicts.

@RalfJung
Copy link
Member

Let's see if this works on Windows.

@bors try

@RalfJung
Copy link
Member

@bors try

@bors
Copy link
Contributor

bors commented Feb 20, 2020

⌛ Trying commit bb3a711 with merge a3020ae...

bors added a commit that referenced this pull request Feb 20, 2020
Reorganize shims by platform

Fixes #1161. I am currently testing which shims belong to which platform. If you are reading this and know the answer for any of those please write me :P

Edit: this is a list of the shims I haven't been able to figure out to which platform they belong:
 -~~`malloc`~~
 -~~`calloc`~~
 -~~`posix_memalign`~~
 -~~`free`~~
 -~~`realloc`~~
 -~~`__rust_alloc`~~
 -~~`__rust_alloc_zeroed`~~
 -~~`__rust_dealloc`~~
 -~~`__rust_realloc`~~
 -~~`__rust_maybe_catch_panic`~~
 -~~`syscall`~~
 -~~`getrandom`~~
 -~~`dlsym`~~
 -~~`memcmp`~~
 -~~`memrchr`~~
 -~~`memchr`~~
 -~~`strlen`~~
 -~~`signal`~~
 -~~`sigaction`~~
 -~~`sigaltstack`~~
 -~~`sysconf`~~
 -~~`sched_getaffinity`~~
 -~~`isatty`~~
 -~~`pthread_key_create`~~
 -~~`pthread_key_delete`~~
 -~~`pthread_getspecific`~~
 -~~`pthread_setspecific`~~
 -~~`pthread_attr_init`~~
 -~~`pthread_attr_destroy`~~
 -~~`pthread_self`~~
 -~~`pthread_attr_setstacksize`~~
 -~~`pthread_attr_getstack`~~
 -~~`pthread_create`~~
 -~~`pthread_mutexattr_init`~~
 -~~`pthread_mutexattr_settype`~~
 -~~`pthread_mutex_init`~~
 -~~`pthread_mutexattr_destroy`~~
 -~~`pthread_mutex_lock`~~
 -~~`pthread_mutex_unlock`~~
 -~~`pthread_mutex_destroy`~~
 -~~`pthread_rwlock_rdlock`~~
 -~~`pthread_rwlock_unlock`~~
 -~~`pthread_rwlock_wrlock`~~
 -~~`pthread_rwlock_destroy`~~
 -~~`pthread_condattr_init`~~
 -~~`pthread_condattr_setclock`~~
 -~~`pthread_cond_init`~~
 -~~`pthread_condattr_destroy`~~
 -~~`pthread_cond_destroy`~~
 -~~`pthread_atfork`~~
 -~~`posix_fadvise`~~
 -~~`mmap`~~
 -~~`mprotect`~~
@bors
Copy link
Contributor

bors commented Feb 20, 2020

☀️ Try build successful - checks-travis, status-appveyor
Build commit: a3020ae (a3020ae75a46a3607a5dca67f6b45cef998e1ded)

@RalfJung
Copy link
Member

Awesome, thanks a lot!
I have some ideas for a bit f followup cleanup, but no reason for that to block this PR...

@bors r+

@bors
Copy link
Contributor

bors commented Feb 23, 2020

📌 Commit 2086658 has been approved by RalfJung

@bors
Copy link
Contributor

bors commented Feb 23, 2020

⌛ Testing commit 2086658 with merge 2752d1b...

@bors
Copy link
Contributor

bors commented Feb 23, 2020

☀️ Test successful - checks-travis, status-appveyor
Approved by: RalfJung
Pushing 2752d1b to master...

@bors bors merged commit 2752d1b into rust-lang:master Feb 23, 2020
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.

Refactor shim module by platform
4 participants