mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-14 17:31:20 +00:00
fix appveyor installer and build (#224)
* remove exception handler when function returns or throws * revert to only reserving and not committing memory due to issues * appveyor builds for release, caches more, only publish artifact once
This commit is contained in:
@ -14,34 +14,36 @@ environment:
|
||||
|
||||
cache:
|
||||
- 'C:\Users\appveyor\.cargo'
|
||||
- target
|
||||
|
||||
install:
|
||||
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
|
||||
- rustup-init.exe -yv --default-host %target%
|
||||
# uncomment these lines if the cache is cleared, or if we must re-install rust for some reason
|
||||
# - appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
|
||||
# - rustup-init.exe -yv --default-host %target%
|
||||
- set PATH=%PATH%;%USERPROFILE%\.cargo\bin
|
||||
- rustup default stable-%target%
|
||||
- rustup update
|
||||
- rustc -vV
|
||||
- cargo -vV
|
||||
# Install InnoSetup
|
||||
- appveyor-retry appveyor DownloadFile https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror/2017-08-22-is.exe
|
||||
- 2017-08-22-is.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-
|
||||
- set PATH="C:\Program Files (x86)\Inno Setup 5";%PATH%
|
||||
# uncomment to RDP to appveyor
|
||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
|
||||
build_script:
|
||||
- cargo build --verbose
|
||||
- cargo build --release --verbose
|
||||
|
||||
test_script:
|
||||
- set RUST_BACKTRACE=1
|
||||
- cd ./lib/spectests && cargo test -- --test-threads 1 && cd ../..
|
||||
- cargo test --package wasmer-spectests
|
||||
|
||||
before_deploy:
|
||||
after_build:
|
||||
- cd ./src/installer
|
||||
- iscc wasmer.iss
|
||||
- copy /y .\WasmerInstaller.exe ..\..\WasmerInstaller-%APPVEYOR_REPO_TAG_NAME%.exe
|
||||
- appveyor PushArtifact WasmerInstaller-%APPVEYOR_REPO_TAG_NAME%.exe
|
||||
|
||||
artifacts:
|
||||
- path: WasmerInstaller-%APPVEYOR_REPO_TAG_NAME%.exe
|
||||
name: WasmerInstaller.exe
|
||||
- appveyor PushArtifact ..\..\WasmerInstaller-%APPVEYOR_REPO_TAG_NAME%.exe
|
||||
- cd ..\..\
|
||||
|
||||
deploy:
|
||||
description: 'WasmerInstaller'
|
||||
|
@ -33,7 +33,7 @@ impl Memory {
|
||||
|
||||
let protect = protection.to_protect_const();
|
||||
|
||||
let ptr = unsafe { VirtualAlloc(ptr::null_mut(), size, MEM_RESERVE | MEM_COMMIT, protect) };
|
||||
let ptr = unsafe { VirtualAlloc(ptr::null_mut(), size, MEM_RESERVE, protect) };
|
||||
|
||||
if ptr.is_null() {
|
||||
Err("unable to allocate memory".to_string())
|
||||
@ -57,14 +57,7 @@ impl Memory {
|
||||
|
||||
let size = round_up_to_page_size(size, page_size::get());
|
||||
|
||||
let ptr = unsafe {
|
||||
VirtualAlloc(
|
||||
ptr::null_mut(),
|
||||
size,
|
||||
MEM_RESERVE | MEM_COMMIT,
|
||||
PAGE_NOACCESS,
|
||||
)
|
||||
};
|
||||
let ptr = unsafe { VirtualAlloc(ptr::null_mut(), size, MEM_RESERVE, PAGE_NOACCESS) };
|
||||
|
||||
if ptr.is_null() {
|
||||
Err(MemoryCreationError::VirtualMemoryAllocationFailed(
|
||||
|
@ -10,6 +10,7 @@ __declspec(thread) DWORD64 caughtInstructionPointer;
|
||||
__declspec(thread) PVOID savedStackPointer;
|
||||
__declspec(thread) BOOL exceptionHandlerInstalled = FALSE;
|
||||
__declspec(thread) BOOL alreadyHandlingException = FALSE;
|
||||
__declspec(thread) PVOID handle;
|
||||
|
||||
void longjmpOutOfHere() {
|
||||
longjmp(jmpBuf, 1);
|
||||
@ -38,6 +39,14 @@ exceptionHandler(struct _EXCEPTION_POINTERS *ExceptionInfo) {
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
}
|
||||
|
||||
static void removeExceptionHandler() {
|
||||
if (exceptionHandlerInstalled == FALSE) {
|
||||
return;
|
||||
}
|
||||
RemoveVectoredExceptionHandler(handle);
|
||||
exceptionHandlerInstalled = FALSE;
|
||||
}
|
||||
|
||||
uint8_t callProtected(trampoline_t trampoline,
|
||||
const struct wasmer_instance_context_t* ctx,
|
||||
const struct func_t* func,
|
||||
@ -48,7 +57,7 @@ uint8_t callProtected(trampoline_t trampoline,
|
||||
// install exception handler
|
||||
if (exceptionHandlerInstalled == FALSE) {
|
||||
exceptionHandlerInstalled = TRUE;
|
||||
AddVectoredExceptionHandler(CALL_FIRST, exceptionHandler);
|
||||
handle = AddVectoredExceptionHandler(CALL_FIRST, exceptionHandler);
|
||||
}
|
||||
|
||||
// jmp jmp jmp!
|
||||
@ -60,6 +69,8 @@ uint8_t callProtected(trampoline_t trampoline,
|
||||
out_result->code = 0;
|
||||
out_result->exceptionAddress = 0;
|
||||
out_result->instructionPointer = 0;
|
||||
|
||||
removeExceptionHandler();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -70,5 +81,6 @@ uint8_t callProtected(trampoline_t trampoline,
|
||||
caughtExceptionAddress = 0;
|
||||
caughtInstructionPointer = 0;
|
||||
|
||||
removeExceptionHandler();
|
||||
return FALSE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user