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

LLVM backend enabled for Windows #598

Merged
merged 8 commits into from
Jul 31, 2019
Merged

LLVM backend enabled for Windows #598

merged 8 commits into from
Jul 31, 2019

Conversation

syrusakbary
Copy link
Member

@syrusakbary syrusakbary commented Jul 30, 2019

This PR:

  • Enables LLVM for Windows
  • Fixes Appveyor, using a customized build of LLVM 8
  • Refactors the memory usage of LLVM

Note: this PR is based on the previous effort done by: #259

@syrusakbary
Copy link
Member Author

bors try

bors bot added a commit that referenced this pull request Jul 30, 2019
lib/llvm-backend/cpp/object_loader.cpp Outdated Show resolved Hide resolved
@@ -0,0 +1,3 @@
pub fn round_up_to_page_size(size: usize) -> usize {
Copy link
Contributor

Choose a reason for hiding this comment

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

Page size is not always 4kib on any given system. Windows and Linux both support different sized pages in the same running system.

On unix, it's libc::sysconf(_SC_PAGESIZE) but not on Windows, which suggests maybe this isn't really platform common.

Copy link
Member Author

Choose a reason for hiding this comment

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

This was same code as before, just moved into a new file.
Perhaps we can address this in a separate PR?

ptr_out: &mut *mut u8,
size_out: &mut usize,
) -> LLVMResult {
let size = round_up_to_page_size(size);
Copy link
Contributor

Choose a reason for hiding this comment

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

Assuming the rust mmap follows POSIX mmap, neither the addr nor length arguments need to be page size aligned.

Copy link
Member Author

@syrusakbary syrusakbary Jul 30, 2019

Choose a reason for hiding this comment

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

Referring to previous comment:

This was same code as before, just moved into a new file.
Perhaps we can address this in a separate PR?

}

pub unsafe fn dealloc_memory(ptr: *mut u8, size: usize) -> LLVMResult {
let res = munmap(ptr as _, round_up_to_page_size(size));
Copy link
Contributor

Choose a reason for hiding this comment

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

You shouldn't need round_up_to_page_size here either (though it helps to keep the sizes to mmap and munmap the same).

Copy link
Member Author

@syrusakbary syrusakbary Jul 30, 2019

Choose a reason for hiding this comment

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

Referring to previous comment:

This was same code as before, just moved into a new file.
Perhaps we can address this in a separate PR?

lib/llvm-backend/src/platform/win.rs Show resolved Hide resolved
@syrusakbary
Copy link
Member Author

bors try

bors bot added a commit that referenced this pull request Jul 30, 2019
@wasmerio wasmerio deleted a comment from bors bot Jul 30, 2019
@syrusakbary syrusakbary merged commit 99ecfaa into master Jul 31, 2019
@bors bors bot deleted the features/llvm-windows branch July 31, 2019 00:38
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.

2 participants