Skip to content

Commit 3fea36d

Browse files
committed
[MERGE #1445 @Cellule] Wasm: master integration
Merge pull request #1445 from Cellule:wasm_integrate Wasm: master integration
2 parents 371a592 + 8fd6bdd commit 3fea36d

File tree

234 files changed

+8758
-7336
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

234 files changed

+8758
-7336
lines changed

Build/Common.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<RuntimeTypeInfo>false</RuntimeTypeInfo>
2121
<!-- /Zi -->
2222
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
23+
<DebugInformationFormat Condition="'$(MultiProcessorCompilation)' == 'true'">OldStyle</DebugInformationFormat>
2324
<!-- /EHsc- -->
2425
<ExceptionHandling>SyncCThrow</ExceptionHandling>
2526
<!-- /Gz -->

CMakeLists.txt

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,26 @@ function(clr_unknown_arch)
1010
endif()
1111
endfunction()
1212

13+
if(ICU_INCLUDE_PATH)
14+
set(ICU_CC_PATH "${ICU_INCLUDE_PATH}/../lib/")
15+
find_library(ICUUC icuuc PATHS ${ICU_CC_PATH} NO_DEFAULT_PATH)
16+
find_library(ICU18 icui18n PATHS ${ICU_CC_PATH} NO_DEFAULT_PATH)
17+
find_library(ICUDATA icudata PATHS ${ICU_CC_PATH} NO_DEFAULT_PATH)
18+
if(ICUUC)
19+
message("found libraries on ${ICU_CC_PATH}")
20+
set(ICULIB
21+
${ICUUC}
22+
${ICU18}
23+
${ICUDATA}
24+
)
25+
endif()
26+
endif()
27+
1328
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
29+
if(NOT ICULIB)
30+
set(ICULIB "icuuc")
31+
endif()
32+
1433
set(CLR_CMAKE_PLATFORM_UNIX 1)
1534
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
1635
set(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64 1)
@@ -21,9 +40,16 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
2140
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
2241
add_definitions(
2342
-DPLATFORM_UNIX
24-
-DU_DISABLE_RENAMING=1 #in case we link against to an older binary of icu
2543
)
2644

45+
if(NOT ICULIB)
46+
set(ICULIB "icucore")
47+
add_definitions(
48+
-DU_DISABLE_RENAMING=1 #in case we link against to an older binary of icu
49+
)
50+
message("using ICU from system default: ${ICULIB}")
51+
endif()
52+
2753
set(CLR_CMAKE_PLATFORM_UNIX 1)
2854
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
2955
set(CLR_CMAKE_PLATFORM_UNIX_TARGET_AMD64 1)
@@ -193,6 +219,12 @@ include_directories(
193219
${ICU_INCLUDE_PATH}
194220
)
195221

222+
if(ICU_INCLUDE_PATH)
223+
if(NOT HAVE_LIBICU_UCHAR_H)
224+
set(HAVE_LIBICU_UCHAR_H "1")
225+
endif()
226+
endif()
227+
196228
add_subdirectory (pal)
197229

198230
# build the rest with NO_PAL_MINMAX and PAL_STDCPP_COMPAT

README.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,31 @@ You can stay up-to-date on progress by following the [MSEdge developer blog](htt
88

99
## [Build Status](https://github.com/Microsoft/ChakraCore/wiki/Build-Status)
1010

11-
| | __Debug__ | __Test__ | __Release__ |
12-
|:-------:|:---------:|:--------:|:-----------:|
13-
| __x86__ | [![x86debug][x86dbgicon]][x86dbglink] | [![x86test][x86testicon]][x86testlink] | [![x86release][x86relicon]][x86rellink] |
14-
| __x64__ | [![x64debug][x64dbgicon]][x64dbglink] | [![x64test][x64testicon]][x64testlink] | [![x64release][x64relicon]][x64rellink] |
15-
| __arm__ | [![armdebug][armdbgicon]][armdbglink] | [![armtest][armtesticon]][armtestlink] | [![armrelease][armrelicon]][armrellink] |
16-
| __linux__ | [![linuxdebug][linuxdbgicon]][linuxdbglink] | [![linuxtest][linuxtesticon]][linuxtestlink] | [![linuxrelease][linuxrelicon]][linuxrellink] |
17-
| __linux (static)__ | [![linuxsdebug][linuxsdbgicon]][linuxsdbglink] | [![linuxstest][linuxstesticon]][linuxstestlink] | [![linuxsrelease][linuxsrelicon]][linuxsrellink] |
11+
| | __Debug__ | __Test__ | __Release__ |
12+
|:-----------------------------:|:---------:|:--------:|:-----------:|
13+
| __Windows (x64)__ | [![x64debug][x64dbgicon]][x64dbglink] | [![x64test][x64testicon]][x64testlink] | [![x64release][x64relicon]][x64rellink] |
14+
| __Windows (x86)__ | [![x86debug][x86dbgicon]][x86dbglink] | [![x86test][x86testicon]][x86testlink] | [![x86release][x86relicon]][x86rellink] |
15+
| __Windows (ARM)__ | [![armdebug][armdbgicon]][armdbglink] | [![armtest][armtesticon]][armtestlink] | [![armrelease][armrelicon]][armrellink] |
16+
| __Ubuntu 16.04 (x64)__ | [![linuxdebug][linuxdbgicon]][linuxdbglink] | [![linuxtest][linuxtesticon]][linuxtestlink] | [![linuxrelease][linuxrelicon]][linuxrellink] |
17+
| __Ubuntu 16.04 (x64 static)__ | [![linuxsdebug][linuxsdbgicon]][linuxsdbglink] | [![linuxstest][linuxstesticon]][linuxstestlink] | [![linuxsrelease][linuxsrelicon]][linuxsrellink] |
18+
| __OS X 10.9 (x64 static)__ | [![osxsdebug][osxsdbgicon]][osxsdbglink] | [![osxstest][osxstesticon]][osxstestlink] | [![osxsrelease][osxsrelicon]][osxsrellink] |
1819

1920
*If you see badges reading "Build: Unknown" it is likely because a build was skipped due to changes being only in files known not to affect the health of the build.*
2021

21-
[x86dbgicon]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x86_debug/badge/icon
22-
[x86dbglink]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x86_debug/
23-
[x86testicon]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x86_test/badge/icon
24-
[x86testlink]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x86_test/
25-
[x86relicon]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x86_release/badge/icon
26-
[x86rellink]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x86_release/
27-
2822
[x64dbgicon]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x64_debug/badge/icon
2923
[x64dbglink]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x64_debug/
3024
[x64testicon]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x64_test/badge/icon
3125
[x64testlink]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x64_test/
3226
[x64relicon]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x64_release/badge/icon
3327
[x64rellink]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x64_release/
3428

29+
[x86dbgicon]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x86_debug/badge/icon
30+
[x86dbglink]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x86_debug/
31+
[x86testicon]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x86_test/badge/icon
32+
[x86testlink]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x86_test/
33+
[x86relicon]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x86_release/badge/icon
34+
[x86rellink]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/x86_release/
35+
3536
[armdbgicon]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/arm_debug/badge/icon
3637
[armdbglink]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/arm_debug/
3738
[armtesticon]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/arm_test/badge/icon
@@ -53,6 +54,13 @@ You can stay up-to-date on progress by following the [MSEdge developer blog](htt
5354
[linuxsrelicon]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/ubuntu_linux_release_static/badge/icon
5455
[linuxsrellink]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/ubuntu_linux_release_static/
5556

57+
[osxsdbgicon]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/osx_osx_debug_static/badge/icon
58+
[osxsdbglink]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/osx_osx_debug_static/
59+
[osxstesticon]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/osx_osx_test_static/badge/icon
60+
[osxstestlink]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/osx_osx_test_static/
61+
[osxsrelicon]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/osx_osx_release_static/badge/icon
62+
[osxsrellink]: http://dotnet-ci.cloudapp.net/job/Microsoft_ChakraCore/job/master/job/osx_osx_release_static/
63+
5664
Above is a table of our rolling build status. We run additional builds on a daily basis. See [Build Status](https://github.com/Microsoft/ChakraCore/wiki/Build-Status) for the status of all builds.
5765

5866
## Security

bin/ChakraCore/CMakeLists.txt

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ add_library (ChakraCore SHARED
33
ConfigParserExternals.cpp
44
TestHooks.cpp
55
)
6-
6+
77
target_include_directories (
88
ChakraCore PUBLIC
99
${CMAKE_CURRENT_SOURCE_DIR}
@@ -45,18 +45,9 @@ set(lib_target "${lib_target}"
4545
pthread
4646
stdc++
4747
dl
48+
${ICULIB}
4849
)
4950

50-
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
51-
set(lib_target "${lib_target}"
52-
icuuc
53-
)
54-
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
55-
set(lib_target "${lib_target}"
56-
icucore
57-
)
58-
endif() # Linux ?
59-
6051
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
6152
set(lib_target "${lib_target}"
6253
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libChakraCoreLib.version
@@ -72,7 +63,7 @@ if(NOT CC_XCODE_PROJECT)
7263
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
7364
set(CC_LIB_EXT "dylib")
7465
endif()
75-
66+
7667
add_custom_command(TARGET ChakraCore POST_BUILD
7768
COMMAND ${CMAKE_COMMAND} -E copy_if_different
7869
"${CHAKRACORE_BINARY_DIR}/bin/ChakraCore/libChakraCore.${CC_LIB_EXT}"

bin/GCStress/StubExternalApi.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,6 @@
77

88
#include "Core/ConfigParser.h"
99

10-
// TODO: REMOVE
11-
void js_memcpy_s(__bcount(sizeInBytes) void *dst, size_t sizeInBytes, __in_bcount(count) const void *src, size_t count)
12-
{
13-
Assert((count) <= (sizeInBytes));
14-
if ((count) <= (sizeInBytes))
15-
memcpy((dst), (src), (count));
16-
else
17-
ReportFatalException(NULL, E_FAIL, Fatal_Internal_Error, 2);
18-
}
19-
20-
void js_wmemcpy_s(__ecount(sizeInWords) char16 *dst, size_t sizeInWords, __in_ecount(count) const char16 *src, size_t count)
21-
{
22-
//Multiplication Overflow check
23-
Assert(count <= sizeInWords && count <= SIZE_MAX/sizeof(char16));
24-
if(!(count <= sizeInWords && count <= SIZE_MAX/sizeof(char16)))
25-
{
26-
ReportFatalException((ULONG_PTR) NULL, E_FAIL, Fatal_Internal_Error, 2);
27-
}
28-
else
29-
{
30-
memcpy(dst, src, count * sizeof(char16));
31-
}
32-
}
33-
3410
bool ConfigParserAPI::FillConsoleTitle(__ecount(cchBufferSize) LPWSTR buffer, size_t cchBufferSize, __in LPWSTR moduleName)
3511
{
3612
swprintf_s(buffer, cchBufferSize, _u("Chakra GC: %d - %s"), GetCurrentProcessId(), moduleName);

bin/NativeTests/NativeTests.vcxproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
$(ChakraCoreRootDirectory)bin\External;
2828
%(AdditionalIncludeDirectories)
2929
</AdditionalIncludeDirectories>
30-
<RuntimeLibrary Condition="'$(Configuration)'=='Debug'">MultiThreadedDebugDLL</RuntimeLibrary>
3130
<MultiProcessorCompilation>true</MultiProcessorCompilation>
3231
<SmallerTypeCheck>false</SmallerTypeCheck>
3332
<MinimalRebuild>false</MinimalRebuild>

bin/ch/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set(ch_source_files
1+
set(ch_source_files
22
ch.cpp
33
ChakraRtInterface.cpp
44
CodexAssert.cpp
@@ -59,12 +59,12 @@ if(STATIC_LIBRARY)
5959

6060
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
6161
set(lib_target "${lib_target}"
62-
icuuc
62+
${ICULIB}
6363
unwind-x86_64
6464
)
6565
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
6666
set(lib_target "${lib_target}"
67-
icucore
67+
${ICULIB}
6868
"-framework CoreFoundation"
6969
"-framework Security"
7070
)
@@ -78,7 +78,7 @@ else() # // !from shared library
7878
endif()
7979

8080
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
81-
set(lib_target "${lib_target}"
81+
set(lib_target "${lib_target}"
8282
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/ch.version
8383
)
8484
endif()

bin/ch/ch.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,12 @@ HRESULT RunScript(const char* fileName, LPCSTR fileContents, BYTE *bcBuffer, cha
310310
}
311311

312312
runScript = ChakraRTInterface::JsTTDRunScript(-1, fileContents, WScriptJsrt::GetNextSourceContext(), fullPath, nullptr /*result*/);
313+
314+
if (runScript == JsErrorCategoryUsage)
315+
{
316+
wprintf(_u("FATAL ERROR: Core was compiled without ENABLE_TTD is defined. CH is trying to use TTD interface\n"));
317+
abort();
318+
}
313319
#else
314320
runScript = ChakraRTInterface::JsRunScriptUtf8(fileContents, WScriptJsrt::GetNextSourceContext(), fullPath, nullptr /*result*/);
315321
#endif

bin/ch/stdafx.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
#define WIN32_LEAN_AND_MEAN 1
2525

26-
#define ENABLE_TEST_HOOKS 1
2726
#include "CommonDefines.h"
2827
#include <map>
2928
#include <string>
@@ -137,6 +136,9 @@ do { \
137136
} \
138137
} while (0)
139138

139+
#ifndef ENABLE_TEST_HOOKS
140+
#define ENABLE_TEST_HOOKS
141+
#endif
140142
#include "TestHooks.h"
141143
#include "ChakraRtInterface.h"
142144
#include "HostConfigFlags.h"

build.sh

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/bin/bash
12
#-------------------------------------------------------------------------------------------------------
23
# Copyright (C) Microsoft. All rights reserved.
34
# Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
@@ -20,20 +21,21 @@ PRINT_USAGE() {
2021
echo "build.sh [options]"
2122
echo ""
2223
echo "options:"
23-
echo " --cxx=PATH Path to Clang++ (see example below)"
24-
echo " --cc=PATH Path to Clang (see example below)"
25-
echo " -d, --debug Debug build (by default Release build)"
26-
echo " -h, --help Show help"
27-
echo " --icu=PATH Path to ICU include folder (see example below)"
28-
echo " -j [N], --jobs[=N] Multicore build, allow N jobs at once"
29-
echo " -n, --ninja Build with ninja instead of make"
30-
echo " --xcode Generate XCode project"
31-
echo " -t, --test-build Test build (by default Release build)"
32-
echo " --static Build as static library (by default shared library)"
33-
echo " -v, --verbose Display verbose output including all options"
24+
echo " --cxx=PATH Path to Clang++ (see example below)"
25+
echo " --cc=PATH Path to Clang (see example below)"
26+
echo " -d, --debug Debug build (by default Release build)"
27+
echo " -h, --help Show help"
28+
echo " --icu=PATH Path to ICU include folder (see example below)"
29+
echo " -j [N], --jobs[=N] Multicore build, allow N jobs at once"
30+
echo " -n, --ninja Build with ninja instead of make"
31+
echo " --xcode Generate XCode project"
32+
echo " -t, --test-build Test build (by default Release build)"
33+
echo " --static Build as static library (by default shared library)"
34+
echo " -v, --verbose Display verbose output including all options"
35+
echo " --create-deb=V Create .deb package with given V version"
3436
echo " --without=FEATURE,FEATURE,..."
35-
echo " Disable FEATUREs from JSRT experimental"
36-
echo " features."
37+
echo " Disable FEATUREs from JSRT experimental"
38+
echo " features."
3739
echo ""
3840
echo "example:"
3941
echo " ./build.sh --cxx=/path/to/clang++ --cc=/path/to/clang -j"
@@ -53,6 +55,7 @@ MULTICORE_BUILD=""
5355
ICU_PATH=""
5456
STATIC_LIBRARY=""
5557
WITHOUT_FEATURES=""
58+
CREATE_DEB=0
5659

5760
while [[ $# -gt 0 ]]; do
5861
case "$1" in
@@ -111,11 +114,16 @@ while [[ $# -gt 0 ]]; do
111114
MAKE=ninja
112115
;;
113116

114-
--xcode)
117+
--xcode)
115118
CMAKE_GEN="-G Xcode -DCC_XCODE_PROJECT=1"
116119
MAKE=0
117120
;;
118121

122+
--create-deb=*)
123+
CREATE_DEB=$1
124+
CREATE_DEB="${CREATE_DEB:13}"
125+
;;
126+
119127
--static)
120128
STATIC_LIBRARY="-DSTATIC_LIBRARY=1"
121129
;;
@@ -228,6 +236,34 @@ fi
228236

229237
if [[ $_RET != 0 ]]; then
230238
echo "See error details above. Exit code was $_RET"
239+
else
240+
if [[ $CREATE_DEB != 0 ]]; then
241+
DEB_FOLDER=`realpath .`
242+
DEB_FOLDER="${DEB_FOLDER}/chakracore_${CREATE_DEB}"
243+
244+
mkdir -p $DEB_FOLDER/usr/local/bin
245+
mkdir -p $DEB_FOLDER/DEBIAN
246+
cp $DEB_FOLDER/../ch $DEB_FOLDER/usr/local/bin/
247+
if [[ $STATIC_LIBRARY == "" ]]; then
248+
cp $DEB_FOLDER/../*.so $DEB_FOLDER/usr/local/bin/
249+
fi
250+
echo -e "Package: ChakraCore"\
251+
"\nVersion: ${CREATE_DEB}"\
252+
"\nSection: base"\
253+
"\nPriority: optional"\
254+
"\nArchitecture: amd64"\
255+
"\nDepends: libc6 (>= 2.19), uuid-dev (>> 0), libunwind-dev (>> 0), libicu-dev (>> 0)"\
256+
"\nMaintainer: ChakraCore <chakracore@microsoft.com>"\
257+
"\nDescription: Chakra Core"\
258+
"\n Open source Core of Chakra Javascript Engine"\
259+
> $DEB_FOLDER/DEBIAN/control
260+
261+
dpkg-deb --build $DEB_FOLDER
262+
_RET=$?
263+
if [[ $_RET == 0 ]]; then
264+
echo ".deb package is available under $build_directory"
265+
fi
266+
fi
231267
fi
232268

233269
popd > /dev/null

0 commit comments

Comments
 (0)