Commit cdbf223a authored by Daniel Agar's avatar Daniel Agar

cmake configure determine sizeof unordered_map

-use pyconfig.h instead of config.h
parent 47461afd
......@@ -159,24 +159,18 @@ add_definitions(${LLVM_DEFINITIONS})
add_definitions(-DDEFAULT_PYTHON_MAJOR_VERSION=2 -DDEFAULT_PYTHON_MINOR_VERSION=7 -DDEFAULT_PYTHON_MICRO_VERSION=6) # Python 2.7.6
add_definitions(-DLLVMREV=${LLVMREV})
include_directories(${CMAKE_BINARY_DIR}/from_cpython/Include)
include_directories(${LLVM_INCLUDE_DIRS})
include_directories(from_cpython/Include)
# generate pyconfig.h
set(CMAKE_EXTRA_INCLUDE_FILES unordered_map)
check_type_sizeof("std::unordered_map<void*, void*>" SIZEOF_UNORDEREDMAP LANGUAGE CXX)
configure_file(from_cpython/Include/pyconfig.h.in from_cpython/Include/pyconfig.h)
find_package(LibLZMA REQUIRED)
link_directories(${CMAKE_BINARY_DIR}/libunwind/lib)
link_directories(${LLVM_LIBRARY_DIRS})
# generate config.h - must be after LLVM is configured
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_SOURCE_DIR}/src/runtime/types.h)
set(CMAKE_REQUIRED_DEFINITIONS "-DNVALGRIND -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS")
set(CMAKE_REQUIRED_INCLUDES ${DEPS_DIR}/llvm-trunk/include
${CMAKE_BINARY_DIR}/llvm/include
${CMAKE_SOURCE_DIR}/from_cpython/Include
${CMAKE_SOURCE_DIR}/src)
check_type_sizeof("pyston::BoxedDict" SIZEOF_BOXEDDICT LANGUAGE CXX)
configure_file(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
add_subdirectory(lib_pyston)
add_subdirectory(from_cpython)
add_subdirectory(src)
......
/*--------------------------------------------------------------------------
* This file is autogenerated from config.h.in
* during the cmake configuration of your project.
* --------------------------------------------------------------------------*/
#ifndef _CONFIG_H_
#define _CONFIG_H_
#define SIZEOF_BOXEDDICT @SIZEOF_BOXEDDICT@
#endif
......@@ -108,3 +108,4 @@ file(GLOB_RECURSE STDPARSER_SRCS Parser
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-field-initializers -Wno-tautological-compare -Wno-type-limits -Wno-unused-result -Wno-strict-aliasing")
add_library(FROM_CPYTHON OBJECT ${STDMODULE_SRCS} ${STDOBJECT_SRCS} ${STDPYTHON_SRCS} ${STDPARSER_SRCS})
add_dependencies(FROM_CPYTHON copy_stdlib)
......@@ -94,7 +94,7 @@ struct _dictobject {
#endif
typedef struct {
PyObject_HEAD;
char _filler[48];
char _filler[SIZEOF_UNORDEREDMAP];
} PyDictObject;
// Pyston change: these are no longer static objects:
......
......@@ -454,7 +454,7 @@ struct _typeobject {
void* _hcls;
void* _hcattrs;
char _dep_getattrs[56]; // FIXME: this is hardcoding the size of this particular implementation of std::unordered_map
char _dep_getattrs[SIZEOF_UNORDEREDMAP + sizeof(void *)];
char _ics[32];
void* _gcvisit_func;
void* _dtor;
......
......@@ -135,4 +135,6 @@
// Added this for some Pyston modifications:
#define MAX_PYSTRING_SIZE (PY_SSIZE_T_MAX/2 - (1<<20))
#define SIZEOF_UNORDEREDMAP @SIZEOF_UNORDEREDMAP@
#endif /*Py_PYCONFIG_H*/
......@@ -107,7 +107,7 @@ add_library(PYSTON_OBJECTS OBJECT ${OPTIONAL_SRCS}
runtime/util.cpp
)
add_dependencies(PYSTON_OBJECTS libunwind pypa ${LLVM_LIBS})
add_dependencies(PYSTON_OBJECTS FROM_CPYTHON libunwind pypa ${LLVM_LIBS})
add_library(PYSTON_MAIN_OBJECT OBJECT jit.cpp)
add_dependencies(PYSTON_MAIN_OBJECT libunwind pypa liblz4 ${LLVM_LIBS})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment