Skip to content

Commit

Permalink
Merge pull request #1539 from finos/emscripten-2-0-29
Browse files Browse the repository at this point in the history
Upgrade emscripten to 2.0.29
  • Loading branch information
texodus authored Sep 15, 2021
2 parents fc6a821 + 8aa688f commit cba03fe
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 27 deletions.
35 changes: 17 additions & 18 deletions cpp/perspective/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,7 @@ if (PSP_WASM_BUILD)
--source-map-base ./build/ \
--memory-init-file 0 \
-Wall \
-s NO_EXIT_RUNTIME=1 \
-fcolor-diagnostics \
-s NO_FILESYSTEM=1 \
-s ALLOW_MEMORY_GROWTH=1 \
-s MODULARIZE=1 \
-s EXPORT_NAME=\"load_perspective\" \
-s EXPORT_ES6=1 \
-s MAXIMUM_MEMORY=4gb \
-s WASM_BIGINT=1 \
-s USE_ES6_IMPORT_META=0 \
-s EXPORTED_FUNCTIONS=\"['_main']\" \
")

if(CMAKE_BUILD_TYPE_LOWER STREQUAL debug)
Expand All @@ -247,15 +237,11 @@ if (PSP_WASM_BUILD)
-s WARN_UNALIGNED=1 \
-Wcast-align \
-Wover-aligned \
-s DISABLE_EXCEPTION_CATCHING=0 \
-s ASSERTIONS=2 \
-s DEMANGLE_SUPPORT=1 \
")
else()
set(OPT_FLAGS " \
-O3 \
-g0 \
-s AGGRESSIVE_VARIABLE_ELIMINATION=1 \
")

# TODO: -flto
Expand Down Expand Up @@ -579,24 +565,37 @@ endif()
message("${BUILD_MESSAGE}\n")

if (PSP_WASM_BUILD)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \
-s EXPORT_ES6=1 \
-s NO_EXIT_RUNTIME=1 \
-s NO_FILESYSTEM=1 \
-s ALLOW_MEMORY_GROWTH=1 \
-s MODULARIZE=1 \
-s EXPORT_NAME=\"load_perspective\" \
-s MAXIMUM_MEMORY=4gb \
-s WASM_BIGINT=1 \
-s USE_ES6_IMPORT_META=0 \
-s EXPORTED_FUNCTIONS=\"['_main']\" \
")

add_library(psp ${WASM_SOURCE_FILES})
target_compile_definitions(psp PRIVATE PSP_ENABLE_WASM=1)
set_target_properties(psp PROPERTIES COMPILE_FLAGS "")
target_link_libraries(psp arrow)

# "esm/erspective.cpp.js" from CMAKE_EXECUTABLE_SYNTAX
add_executable(perspective_esm src/cpp/emscripten.cpp)
target_link_libraries(perspective_esm psp "-s ENVIRONMENT=worker -s EXPORT_ES6=1")
target_link_libraries(perspective_esm psp)
target_link_options(perspective_esm PRIVATE -s ENVIRONMENT=worker)
target_compile_definitions(perspective_esm PRIVATE PSP_ENABLE_WASM=1)
set_target_properties(perspective_esm PROPERTIES COMPILE_FLAGS "-s ENVIRONMENT=worker -s EXPORT_ES6=1")
set_target_properties(perspective_esm PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./esm/")
set_target_properties(perspective_esm PROPERTIES OUTPUT_NAME "perspective.cpp")

# "cjs/perspective.cpp.js" from CMAKE_EXECUTABLE_SYNTAX
add_executable(perspective_cjs src/cpp/emscripten.cpp)
target_link_libraries(perspective_cjs psp "-s ENVIRONMENT=node")
target_link_libraries(perspective_cjs psp)
target_link_options(perspective_cjs PRIVATE -s ENVIRONMENT=node)
target_compile_definitions(perspective_cjs PRIVATE PSP_ENABLE_WASM=1)
set_target_properties(perspective_cjs PROPERTIES COMPILE_FLAGS "-s ENVIRONMENT=node")
set_target_properties(perspective_cjs PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./cjs/")
set_target_properties(perspective_cjs PROPERTIES OUTPUT_NAME "perspective.cpp")
elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
Expand Down
2 changes: 2 additions & 0 deletions cpp/perspective/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const stdio = "inherit";
const env = process.PSP_DEBUG ? "debug" : "release";
const cwd = path.join(process.cwd(), "dist", env);

delete process.env.NODE;

try {
execSync(`mkdirp ${cwd}`, {stdio});
process.env.CLICOLOR_FORCE = 1;
Expand Down
5 changes: 3 additions & 2 deletions cpp/perspective/src/cpp/computed_expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,15 +384,16 @@ t_computed_expression_parser::get_dtype(
}

t_tscalar v = expr_definition.value();
t_dtype dtype = v.get_dtype();

if (v.m_status == STATUS_CLEAR) {
if (v.m_status == STATUS_CLEAR || dtype == DTYPE_NONE) {
error.m_error_message = "Type Error - inputs do not resolve to a valid expression.";
error.m_line = 0;
error.m_column = 0;
return DTYPE_NONE;
}

return v.get_dtype();
return dtype;
}

t_validated_expression_map::t_validated_expression_map() {}
Expand Down
3 changes: 3 additions & 0 deletions cpp/perspective/src/cpp/table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ Table::validate_expressions(
const std::string& expression_alias = std::get<0>(expr);
const std::string& expression_string = std::get<1>(expr);
const std::string& parsed_expression_string = std::get<2>(expr);

t_expression_error error;
error.m_line = -1;
error.m_column = -1;

// Cannot overwrite a "real" column with an expression column
if (gnode_schema.has_column(expression_alias)) {
Expand Down
4 changes: 2 additions & 2 deletions cpp/perspective/src/include/perspective/computed_expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ namespace perspective {
*/
struct PERSPECTIVE_EXPORT t_expression_error {
std::string m_error_message;
t_uindex m_line;
t_uindex m_column;
t_index m_line;
t_index m_column;
};

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"internal": "Internal"
}
},
"emscripten": "2.0.6",
"emscripten": "2.0.29",
"engines": {
"node": ">=8.12.0"
},
Expand Down
10 changes: 6 additions & 4 deletions packages/perspective/test/js/expressions/functionality.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ module.exports = (perspective) => {
expect(validate.errors).toEqual({
'if ("w" > 1) 5': {
column: 0,
error_message: "",
line: 8,
error_message:
"Type Error - inputs do not resolve to a valid expression.",
line: 0,
},
'if ("w" > 1) 5;': {
column: 0,
error_message: "",
line: 8,
error_message:
"Type Error - inputs do not resolve to a valid expression.",
line: 0,
},
});

Expand Down

0 comments on commit cba03fe

Please sign in to comment.