Skip to content

Commit

Permalink
fix version_101 for kagome
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Krutikov committed Jul 29, 2021
1 parent 423cf0b commit 94aeb7c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 16 deletions.
38 changes: 27 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,27 @@ else()
message(STATUS "Building libbinaryen as shared library.")
add_library(binaryen SHARED ${binaryen_SOURCES} ${binaryen_objs})
endif()
target_include_directories(binaryen INTERFACE
$<INSTALL_INTERFACE:include/binaryen>
)
if(NOT (BUILD_STATIC_LIB AND BYN_INSTALL_TOOLS_ONLY))
install(TARGETS binaryen
EXPORT binaryenConfig
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(
EXPORT binaryenConfig
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/binaryen
NAMESPACE binaryen::
)
endif()
if(NOT BYN_INSTALL_TOOLS_ONLY)
install(FILES src/binaryen-c.h src/wasm-delegations.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES src/binaryen-c.h src/wasm-delegations.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/binaryen)
install(DIRECTORY src/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/binaryen # set scoping for headers
FILES_MATCHING PATTERN "*.h"
)
endif()

function(binaryen_add_executable name sources)
Expand All @@ -347,16 +360,19 @@ function(binaryen_add_executable name sources)
install(TARGETS ${name} DESTINATION ${CMAKE_INSTALL_BINDIR})
endfunction()

binaryen_add_executable(wasm-opt src/tools/wasm-opt.cpp)
binaryen_add_executable(wasm-shell src/tools/wasm-shell.cpp)
binaryen_add_executable(wasm-metadce src/tools/wasm-metadce.cpp)
binaryen_add_executable(wasm2js src/tools/wasm2js.cpp)
binaryen_add_executable(wasm-emscripten-finalize src/tools/wasm-emscripten-finalize.cpp)
binaryen_add_executable(wasm-as src/tools/wasm-as.cpp)
binaryen_add_executable(wasm-dis src/tools/wasm-dis.cpp)
binaryen_add_executable(wasm-ctor-eval src/tools/wasm-ctor-eval.cpp)
binaryen_add_executable(wasm-reduce src/tools/wasm-reduce.cpp)
binaryen_add_executable(wasm-split src/tools/wasm-split.cpp)
OPTION(BUILD_TOOLS "Build tools" OFF)
if(BUILD_TOOLS)
binaryen_add_executable(wasm-opt src/tools/wasm-opt.cpp)
binaryen_add_executable(wasm-shell src/tools/wasm-shell.cpp)
binaryen_add_executable(wasm-metadce src/tools/wasm-metadce.cpp)
binaryen_add_executable(wasm2js src/tools/wasm2js.cpp)
binaryen_add_executable(wasm-emscripten-finalize src/tools/wasm-emscripten-finalize.cpp)
binaryen_add_executable(wasm-as src/tools/wasm-as.cpp)
binaryen_add_executable(wasm-dis src/tools/wasm-dis.cpp)
binaryen_add_executable(wasm-ctor-eval src/tools/wasm-ctor-eval.cpp)
binaryen_add_executable(wasm-reduce src/tools/wasm-reduce.cpp)
binaryen_add_executable(wasm-split src/tools/wasm-split.cpp)
endif()


# binaryen.js
Expand Down
2 changes: 1 addition & 1 deletion src/wasm-features.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ struct FeatureSet {
operator uint32_t() const { return features; }

bool isMVP() const { return features == MVP; }
bool has(FeatureSet f) { return (features & f) == f; }
bool has(FeatureSet f) { return (features & f) == static_cast<uint32_t>(f); }
bool hasAtomics() const { return (features & Atomics) != 0; }
bool hasMutableGlobals() const { return (features & MutableGlobals) != 0; }
bool hasTruncSat() const { return (features & TruncSat) != 0; }
Expand Down
8 changes: 4 additions & 4 deletions src/wasm-interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -2422,11 +2422,11 @@ template<typename GlobalManager, typename SubType> class ModuleInstanceBase {
protected:
// Returns the instance that defines the memory used by this one.
SubType* getMemoryInstance() {
if (instance.wasm.memory.imported()) {
return instance.linkedInstances.at(instance.wasm.memory.module).get();
} else {
// if (instance.wasm.memory.imported()) {
// return instance.linkedInstances.at(instance.wasm.memory.module).get();
// } else {
return static_cast<SubType*>(&instance);
}
// }
}

// Returns a reference to the current value of a potentially imported global
Expand Down

0 comments on commit 94aeb7c

Please sign in to comment.