Skip to content

Add option to enable all-in-one build mode #729

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

Merged
merged 2 commits into from
Nov 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ project (Jerry CXX C ASM)
option(ENABLE_VALGRIND_FREYA "Enable valgrind-freya helpers in memory allocators" OFF)
option(ENABLE_LTO "Enable LTO build" ON)
option(ENABLE_LOG "Enable LOG build" OFF)
option(ENABLE_ALL_IN_ONE "Enable ALL_IN_ONE build" OFF)

if("${PLATFORM}" STREQUAL "LINUX")
set(PLATFORM_EXT "LINUX")
Expand Down
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@
LOG := OFF
endif

# All-in-one build
ALL_IN_ONE ?= OFF
ifneq ($(ALL_IN_ONE),ON)
ALL_IN_ONE := OFF
endif

# Verbosity
ifdef VERBOSE
Q :=
Expand Down Expand Up @@ -141,9 +147,10 @@ export SHELL=/bin/bash
OPTIONS_COMBINATIONS := $(foreach __OPTION,ON OFF,$(__COMBINATION)-VALGRIND-$(__OPTION))
OPTIONS_COMBINATIONS := $(foreach __COMBINATION,$(OPTIONS_COMBINATIONS),$(foreach __OPTION,ON OFF,$(__COMBINATION)-VALGRIND_FREYA-$(__OPTION)))
OPTIONS_COMBINATIONS := $(foreach __COMBINATION,$(OPTIONS_COMBINATIONS),$(foreach __OPTION,ON OFF,$(__COMBINATION)-LTO-$(__OPTION)))
OPTIONS_COMBINATIONS := $(foreach __COMBINATION,$(OPTIONS_COMBINATIONS),$(foreach __OPTION,ON OFF,$(__COMBINATION)-ALL_IN_ONE-$(__OPTION)))

# Building current options string
OPTIONS_STRING := -VALGRIND-$(VALGRIND)-VALGRIND_FREYA-$(VALGRIND_FREYA)-LTO-$(LTO)
OPTIONS_STRING := -VALGRIND-$(VALGRIND)-VALGRIND_FREYA-$(VALGRIND_FREYA)-LTO-$(LTO)-ALL_IN_ONE-$(ALL_IN_ONE)

# Build directories
BUILD_DIR_PREFIX := ./build/obj
Expand Down Expand Up @@ -190,6 +197,7 @@ $(BUILD_DIRS_NATIVE):
-DENABLE_VALGRIND_FREYA=$(VALGRIND_FREYA) \
-DENABLE_LOG=$(LOG) \
-DENABLE_LTO=$(LTO) \
-DENABLE_ALL_IN_ONE=$(ALL_IN_ONE) \
-DUSE_COMPILER_DEFAULT_LIBC=$(USE_COMPILER_DEFAULT_LIBC) \
-DCMAKE_TOOLCHAIN_FILE=`cat toolchain.config` ../../.. 2>&1 | tee cmake.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
(echo "CMake run failed. See "`pwd`"/cmake.log for details."; exit 1;); \
Expand All @@ -198,14 +206,14 @@ $(BUILD_DIRS_NATIVE):
$(BUILD_DIRS_STM32F3): prerequisites
$(Q) mkdir -p $@
$(Q) cd $@ && \
(cmake -DENABLE_VALGRIND=$(VALGRIND) -DENABLE_VALGRIND_FREYA=$(VALGRIND_FREYA) -DENABLE_LTO=$(LTO) -DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_mcu_stm32f3.cmake ../../.. 2>&1 | tee cmake.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
(cmake -DENABLE_VALGRIND=$(VALGRIND) -DENABLE_VALGRIND_FREYA=$(VALGRIND_FREYA) -DENABLE_LTO=$(LTO) -DENABLE_ALL_IN_ONE=$(ALL_IN_ONE) -DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_mcu_stm32f3.cmake ../../.. 2>&1 | tee cmake.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
(echo "CMake run failed. See "`pwd`"/cmake.log for details."; exit 1;)

.PHONY: $(BUILD_DIRS_STM32F4)
$(BUILD_DIRS_STM32F4): prerequisites
$(Q) mkdir -p $@
$(Q) cd $@ && \
(cmake -DENABLE_VALGRIND=$(VALGRIND) -DENABLE_VALGRIND_FREYA=$(VALGRIND_FREYA) -DENABLE_LTO=$(LTO) -DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_mcu_stm32f4.cmake ../../.. 2>&1 | tee cmake.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
(cmake -DENABLE_VALGRIND=$(VALGRIND) -DENABLE_VALGRIND_FREYA=$(VALGRIND_FREYA) -DENABLE_LTO=$(LTO) -DENABLE_ALL_IN_ONE=$(ALL_IN_ONE) -DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_mcu_stm32f4.cmake ../../.. 2>&1 | tee cmake.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
(echo "CMake run failed. See "`pwd`"/cmake.log for details."; exit 1;)

.PHONY: $(JERRY_NATIVE_TARGETS)
Expand Down
18 changes: 16 additions & 2 deletions jerry-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ project (JerryCore CXX C ASM)
file(GLOB SOURCE_CORE_PARSER_REGEXP parser/regexp/*.cpp)
file(GLOB SOURCE_CORE_JRT jrt/*.cpp)

set(SOURCE_CORE
jerry.cpp
set(SOURCE_CORE_FILES
${SOURCE_CORE_API}
${SOURCE_CORE_LIT}
${SOURCE_CORE_RCS}
Expand All @@ -150,6 +149,21 @@ project (JerryCore CXX C ASM)
${SOURCE_CORE_PARSER_REGEXP}
${SOURCE_CORE_JRT})

# All-in-one build
if("${ENABLE_ALL_IN_ONE}" STREQUAL "ON")
set(ALL_IN_FILE "${CMAKE_BINARY_DIR}/jerry-all-in.cpp")
list(SORT SOURCE_CORE_FILES)
file(REMOVE ${ALL_IN_FILE})

foreach(FILE ${SOURCE_CORE_FILES})
file(APPEND ${ALL_IN_FILE} "#include \"${FILE}\"\n")
endforeach()

set(SOURCE_CORE ${ALL_IN_FILE})
else()
set(SOURCE_CORE ${SOURCE_CORE_FILES})
endif()

# Per-option configuration
# Valgrind
if("${ENABLE_VALGRIND}" STREQUAL "ON")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@
#undef ROUTINE_ARG_LIST_0
#undef ROUTINE_ARG

static lit_magic_string_id_t ecma_builtin_property_names[] =
#define ECMA_BUILTIN_PROPERTY_NAMES \
PASTE (PASTE (ecma_builtin_property_names, _), BUILTIN_UNDERSCORED_ID)

static lit_magic_string_id_t ECMA_BUILTIN_PROPERTY_NAMES[] =
{
#define SIMPLE_VALUE(name, obj_getter, prop_writable, prop_enumerable, prop_configurable) name,
#define NUMBER_VALUE(name, obj_getter, prop_writable, prop_enumerable, prop_configurable) name,
Expand All @@ -77,14 +80,14 @@ SORT_PROPERTY_NAMES_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (void)
swapped = false;

for (ecma_length_t i = 1;
i < (sizeof (ecma_builtin_property_names) / sizeof (ecma_builtin_property_names[0]));
i < (sizeof (ECMA_BUILTIN_PROPERTY_NAMES) / sizeof (ECMA_BUILTIN_PROPERTY_NAMES[0]));
i++)
{
if (ecma_builtin_property_names[i] < ecma_builtin_property_names[i - 1])
if (ECMA_BUILTIN_PROPERTY_NAMES[i] < ECMA_BUILTIN_PROPERTY_NAMES[i - 1])
{
lit_magic_string_id_t id_temp = ecma_builtin_property_names[i - 1];
ecma_builtin_property_names[i - 1] = ecma_builtin_property_names[i];
ecma_builtin_property_names[i] = id_temp;
lit_magic_string_id_t id_temp = ECMA_BUILTIN_PROPERTY_NAMES[i - 1];
ECMA_BUILTIN_PROPERTY_NAMES[i - 1] = ECMA_BUILTIN_PROPERTY_NAMES[i];
ECMA_BUILTIN_PROPERTY_NAMES[i] = id_temp;

swapped = true;
}
Expand Down Expand Up @@ -118,10 +121,10 @@ TRY_TO_INSTANTIATE_PROPERTY_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (ecma_object_t
return NULL;
}

const ecma_length_t property_numbers = (ecma_length_t) (sizeof (ecma_builtin_property_names) /
sizeof (ecma_builtin_property_names[0]));
const ecma_length_t property_numbers = (ecma_length_t) (sizeof (ECMA_BUILTIN_PROPERTY_NAMES) /
sizeof (ECMA_BUILTIN_PROPERTY_NAMES[0]));
int32_t index;
index = ecma_builtin_bin_search_for_magic_string_id_in_array (ecma_builtin_property_names,
index = ecma_builtin_bin_search_for_magic_string_id_in_array (ECMA_BUILTIN_PROPERTY_NAMES,
property_numbers,
id);

Expand Down Expand Up @@ -307,17 +310,17 @@ LIST_LAZY_PROPERTY_NAMES_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (ecma_object_t *o

JERRY_ASSERT (ecma_builtin_is (object_p, builtin_object_id));

const ecma_length_t properties_number = (ecma_length_t) (sizeof (ecma_builtin_property_names) /
sizeof (ecma_builtin_property_names[0]));
const ecma_length_t properties_number = (ecma_length_t) (sizeof (ECMA_BUILTIN_PROPERTY_NAMES) /
sizeof (ECMA_BUILTIN_PROPERTY_NAMES[0]));

for (ecma_length_t i = 0;
i < properties_number;
i++)
{
lit_magic_string_id_t name = ecma_builtin_property_names[i];
lit_magic_string_id_t name = ECMA_BUILTIN_PROPERTY_NAMES[i];

int32_t index;
index = ecma_builtin_bin_search_for_magic_string_id_in_array (ecma_builtin_property_names,
index = ecma_builtin_bin_search_for_magic_string_id_in_array (ECMA_BUILTIN_PROPERTY_NAMES,
properties_number,
name);

Expand Down Expand Up @@ -424,6 +427,7 @@ DISPATCH_ROUTINE_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (uint16_t builtin_routine
return c_function_name (this_arg_value ROUTINE_ARG_LIST_ ## args_number); \
}
#include BUILTIN_INC_HEADER_NAME
#undef ROUTINE_ARG
#undef ROUTINE_ARG_LIST_0
#undef ROUTINE_ARG_LIST_1
#undef ROUTINE_ARG_LIST_2
Expand All @@ -445,4 +449,5 @@ DISPATCH_ROUTINE_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (uint16_t builtin_routine
#undef TRY_TO_INSTANTIATE_PROPERTY_ROUTINE_NAME
#undef BUILTIN_UNDERSCORED_ID
#undef BUILTIN_INC_HEADER_NAME
#undef ECMA_BUILTIN_PROPERTY_NAMES

19 changes: 0 additions & 19 deletions jerry-core/ecma/operations/ecma-array-object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,6 @@
* @{
*/

/**
* Reject sequence
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
static ecma_completion_value_t
ecma_reject (bool is_throw) /**< Throw flag */
{
if (is_throw)
{
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
}
else
{
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_FALSE);
}
} /* ecma_reject */

/**
* Array object creation operation.
*
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/ecma/operations/ecma-objects-general.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
static ecma_completion_value_t
ecma_completion_value_t
ecma_reject (bool is_throw) /**< Throw flag */
{
if (is_throw)
Expand Down
1 change: 1 addition & 0 deletions jerry-core/ecma/operations/ecma-objects-general.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* @{
*/

extern ecma_completion_value_t ecma_reject (bool);
extern ecma_object_t *ecma_op_create_object_object_noarg (void);
extern ecma_completion_value_t ecma_op_create_object_object_arg (ecma_value_t);
extern ecma_object_t *ecma_op_create_object_object_noarg_and_set_prototype (ecma_object_t *);
Expand Down