diff --git a/thirdparty/dill/dill/.github/workflows/build-and-test.yml b/thirdparty/dill/dill/.github/workflows/build-and-test.yml index b05345f552..ce9fd1cd3e 100644 --- a/thirdparty/dill/dill/.github/workflows/build-and-test.yml +++ b/thirdparty/dill/dill/.github/workflows/build-and-test.yml @@ -1,31 +1,115 @@ -on: - push: - branches: - - master - pull_request: - branches: - - master +name: Build and Test + +on: + push: + branches: + - master + pull_request: + branches: + - master jobs: - ci: - runs-on: ${{ matrix.os-image }} + linux: + # The jobs should run pretty quick; anything over 30m essentially means + # someting is stuck somewhere + timeout-minutes: 30 + runs-on: ubuntu-latest + container: ${{ matrix.container }} + env: + GH_YML_JOBNAME: ${{ matrix.os }}-${{ matrix.compiler }} + GH_YML_BUILDTYPE: ${{ matrix.buildtype }} + GH_YML_SHA: ${{ github.event.pull_request.head.sha || github.sha }} strategy: fail-fast: false matrix: - os-image: [ubuntu-latest, macos-latest] + buildtype: [ release, debug ] + os: [ centos7, centos8, ubuntu1604, ubuntu1804, ubuntu2004 ] + compiler: [ clang, gcc, nvhpc ] + exclude: + - { os: centos8, compiler: nvhpc } + - { os: ubuntu1604, compiler: nvhpc } + - { os: ubuntu1804, compiler: nvhpc } + include: + - os: centos7 + container: centos:7 + - os: centos8 + container: centos:8 + - os: ubuntu1604 + container: ubuntu:16.04 + - os: ubuntu1804 + container: ubuntu:18.04 + - os: ubuntu2004 + container: ubuntu:20.04 + - os: centos7 + compiler: nvhpc + container: nvcr.io/nvidia/nvhpc:21.2-devel-cuda11.2-centos7 + - os: ubuntu2004 + compiler: nvhpc + container: nvcr.io/nvidia/nvhpc:21.2-devel-cuda11.2-ubuntu20.04 steps: - uses: actions/checkout@v2 with: ref: ${{ github.event.pull_request.head.sha }} + path: source + - name: Setup + run: source/scripts/ci/setup/linux.sh + - name: Update + run: source/scripts/ci/gh-actions/run.sh update + - name: Configure + run: source/scripts/ci/gh-actions/run.sh configure + - name: Build + run: source/scripts/ci/gh-actions/run.sh build + - name: Test + run: source/scripts/ci/gh-actions/run.sh test + + mac_and_windows: + # The jobs should run pretty quick; anything over 30m essentially means + # someting is stuck somewhere + timeout-minutes: 30 + runs-on: ${{ matrix.vm }} + env: + GH_YML_JOBNAME: ${{ matrix.jobname }} + GH_YML_BUILDTYPE: ${{ matrix.buildtype }} + GH_YML_SHA: ${{ github.event.pull_request.head.sha || github.sha }} + + strategy: + fail-fast: false + matrix: + buildtype: [ release, debug ] + jobname: [ + # windows-vs2019-msvc, + windows-vs2019-clang, + macos-clang ] + include: + #- jobname: windows-vs2019-msvc + # vm: windows-latest + - jobname: windows-vs2019-clang + vm: windows-latest + - jobname: macos-clang + vm: macos-latest + + defaults: + run: + shell: bash + + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + path: source + - name: Setup + if: ${{ runner.os == 'Windows' }} + run: source/scripts/ci/setup/windows.sh - name: Setup - run: ci/gh-actions/setup.sh + if: ${{ runner.os == 'macOS' }} + run: source/scripts/ci/setup/macos.sh + - name: Update + run: source/scripts/ci/gh-actions/run.sh update - name: Configure - run: ci/gh-actions/run.sh configure + run: source/scripts/ci/gh-actions/run.sh configure - name: Build - run: ci/gh-actions/run.sh build + run: source/scripts/ci/gh-actions/run.sh build - name: Test - run: ci/gh-actions/run.sh test - - name: Install - run: ci/gh-actions/run.sh install + run: source/scripts/ci/gh-actions/run.sh test diff --git a/thirdparty/dill/dill/.github/workflows/triggers.yml b/thirdparty/dill/dill/.github/workflows/triggers.yml new file mode 100644 index 0000000000..3ee5556d9e --- /dev/null +++ b/thirdparty/dill/dill/.github/workflows/triggers.yml @@ -0,0 +1,15 @@ +name: Triggers + +on: + workflow_run: + workflows: ["Build and Test"] + types: [requested] + +jobs: + all_triggers: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Post CDash Status + run: scripts/ci/scripts/post-cdash-status.sh ${{ github.event.repository.full_name }} ${{ github.event.workflow_run.head_sha }} ${{ secrets.GITHUB_TOKEN }} diff --git a/thirdparty/dill/dill/CMakeLists.txt b/thirdparty/dill/dill/CMakeLists.txt index 7350196dd3..db81834392 100644 --- a/thirdparty/dill/dill/CMakeLists.txt +++ b/thirdparty/dill/dill/CMakeLists.txt @@ -1,5 +1,8 @@ cmake_minimum_required(VERSION 3.0) +# The directory label is used for CDash to treat DILL as a subproject of GTKorvo +set(CMAKE_DIRECTORY_LABELS DILL) + project(DILL VERSION 2.4.1 LANGUAGES C CXX) # Some boilerplate to setup nice output directories @@ -36,6 +39,23 @@ if(NOT DEFINED DILL_HEADER_COMPONENT) set(DILL_HEADER_COMPONENT dev) endif() +if(WIN32) + # Automagic to do the DLL / LIB song and dance + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + + # Silence MSVC warnings + if(CMAKE_C_COMPILER_ID MATCHES "MSVC" OR + CMAKE_C_SIMULATE_ID MATCHES "MSVC") + add_definitions( + -D_CRT_SECURE_NO_DEPRECATE + -D_CRT_SECURE_NO_WARNINGS + -D_SCL_SECURE_NO_DEPRECATE + -D_WINSOCK_DEPRECATED_NO_WARNINGS + -D_CRT_NONSTDC_NO_DEPRECATE) + set (MSVC_PERL_FLAGS "-msvc-long") + endif() +endif() + # Setup shared library defaults. If explicitly specified somehow, then default # to that. Otherwise base the default on whether or not shared libs are even # supported. @@ -84,6 +104,9 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "i.86|x86_64|AMD64") set(TEST_PERL_FLAGS -no_float -max_arg=2) set(ARCH_FILE x86) endif() + if(NOT (CMAKE_SIZEOF_VOID_P EQUAL SIZEOF_LONG)) + set(BASE_OPS_ARG "-msvc_long") + endif() elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm.5.*") set(NATIVE_ARCH arm5) set(HOST_ARM5 1) @@ -119,6 +142,8 @@ endif() if(CMAKE_SYSTEM_NAME MATCHES "Darwin|Linux") set(USE_MMAP_CODE_SEG 1) +elseif(CMAKE_SYSTEM_NAME MATCHES "Windows") + set(USE_VIRTUAL_PROTECT 1) endif() include(TestBigEndian) @@ -221,6 +246,8 @@ else() set(EMULATION_POSSIBLE FALSE) endif() +find_package(Perl REQUIRED) + option(DILL_ENABLE_DISASSEMBLY "enable binutils-based disassembly (default is OFF)" OFF) @@ -228,7 +255,7 @@ set(ARCHITECTURES sparc ppc64le virtual x86 x86_64 ia64 arm5 arm6 arm8) foreach(_arch ${ARCHITECTURES}) add_custom_command( OUTPUT dill_${_arch}.c - COMMAND perl ${CMAKE_CURRENT_SOURCE_DIR}/${_arch}.ops + COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${_arch}.ops DEPENDS ${_arch}.ops ) list(APPEND arch_files dill_${_arch}.c ${_arch}.c) @@ -239,7 +266,7 @@ endforeach() add_custom_command( OUTPUT dill.h dill.c - COMMAND perl ${CMAKE_CURRENT_SOURCE_DIR}/base.ops + COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/base.ops ${BASE_OPS_ARG} DEPENDS base.ops ) @@ -293,6 +320,7 @@ check_include_files(unistd.h HAVE_UNISTD_H) check_include_files(stdarg.h STDC_HEADERS) check_include_files(malloc.h HAVE_MALLOC_H) check_include_files(memory.h HAVE_MEMORY_H) +check_include_files(sys/mman.h HAVE_SYS_MMAN_H) include(CheckSymbolExists) check_symbol_exists(__clear_cache "" CLEAR_CACHE_DEFINED) message(STATUS "Clear cache defined is ${CLEAR_CACHE_DEFINED}") @@ -473,6 +501,12 @@ if(BUILD_TESTING) add_subdirectory(vtests) endif() +configure_file( + ${PROJECT_SOURCE_DIR}/CTestCustom.cmake.in + ${PROJECT_BINARY_DIR}/CTestCustom.cmake + @ONLY +) + option(DILL_QUIET "Suppress summary output" OFF) if(NOT DILL_QUIET) message(STATUS) diff --git a/thirdparty/dill/dill/CTestConfig.cmake b/thirdparty/dill/dill/CTestConfig.cmake new file mode 100644 index 0000000000..3416157733 --- /dev/null +++ b/thirdparty/dill/dill/CTestConfig.cmake @@ -0,0 +1,9 @@ +set(CTEST_PROJECT_NAME "GTKorvo") +set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") + +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "open.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=GTKorvo") +set(CTEST_DROP_SITE_CDASH TRUE) + +set(CTEST_LABELS_FOR_SUBPROJECTS DILL) diff --git a/thirdparty/dill/dill/CTestCustom.cmake.in b/thirdparty/dill/dill/CTestCustom.cmake.in new file mode 100644 index 0000000000..dc8ba0c5a5 --- /dev/null +++ b/thirdparty/dill/dill/CTestCustom.cmake.in @@ -0,0 +1,13 @@ +set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 1000) +set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 1000) +set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 1048576) +set(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 1048576) + +list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION +) + +list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE +) + +list(APPEND CTEST_CUSTOM_TESTS_IGNORE +) diff --git a/thirdparty/dill/dill/CTestCustom.ctest.in b/thirdparty/dill/dill/CTestCustom.ctest.in deleted file mode 100644 index fbdf009495..0000000000 --- a/thirdparty/dill/dill/CTestCustom.ctest.in +++ /dev/null @@ -1,6 +0,0 @@ -set (CTEST_CUSTOM_MEMCHECK_IGNORE) -set (CTEST_SVN_UPDATE_OPTIONS --password anon --username anon) -set (CTEST_SVN_OPTIONS --password anon --username anon) -set (SVN_UPDATE_OPTIONS --password anon --username anon) -set (SVN_OPTIONS --password anon --username anon) - diff --git a/thirdparty/dill/dill/base.ops b/thirdparty/dill/dill/base.ops index b806575df8..a31e033429 100755 --- a/thirdparty/dill/dill/base.ops +++ b/thirdparty/dill/dill/base.ops @@ -1,5 +1,14 @@ #!perl + +$MSVC_LONG = 0; + +while ($_ = $ARGV[0]) { + shift; + last if /^--$/; + if (/^-msvc_long/) {$MSVC_LONG = 1;} +} + sub upperc { local($_) = pop(@_); tr/[a-z]/[A-Z]/; @@ -85,62 +94,62 @@ print HOUT<j->ret)(s, DILL_" . &upperc($dill_type) . ", 0, src)\n"; if ($_ eq 'p') { - print HOUT "#define dill_ret${type}i(s, imm) (s->j->reti)(s, DILL_" . &upperc($type) . ", 0, (unsigned long) imm)\n"; + print HOUT "#define dill_ret${type}i(s, imm) (s->j->reti)(s, DILL_" . &upperc($type) . ", 0, (IMM_TYPE) imm)\n"; } elsif (($_ eq 'f') || ($_ eq 'd')) { print HOUT "#define dill_ret${type}i(s, imm) (s->j->retf)(s, DILL_" . &upperc($type) . ", 0, imm)\n"; } else { @@ -443,6 +452,17 @@ extern "C" { #endif +EOF +if ($MSVC_LONG) { +print HOUT "#include \n"; +print HOUT "#define IMM_TYPE intptr_t\n"; +print HOUT "#define UIMM_TYPE uintptr_t\n"; +} else { +print HOUT "#define IMM_TYPE long\n"; +print HOUT "#define UIMM_TYPE unsigned long\n"; +} +print HOUT<j->type_align[t] #define dill_type_size(s, t) s->j->type_size[t] @@ -731,8 +741,8 @@ enum { DILL_US, /* unsigned short */ DILL_I, /* int */ DILL_U, /* unsigned */ - DILL_L, /* long */ - DILL_UL, /* unsigned long */ + DILL_L, /* long (full register size */ + DILL_UL, /* unsigned long (full register size) */ DILL_P, /* pointer */ DILL_F, /* floating */ DILL_D, /* double */ diff --git a/thirdparty/dill/dill/ci/gh-actions/run.sh b/thirdparty/dill/dill/ci/gh-actions/run.sh deleted file mode 100755 index a02a085ee6..0000000000 --- a/thirdparty/dill/dill/ci/gh-actions/run.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -export CI_ROOT_DIR="${GITHUB_WORKSPACE//\\//}/.." -export CI_SOURCE_DIR="${GITHUB_WORKSPACE//\\//}" -export CI_DEP_DIR="${CI_ROOT_DIR}/dependencies" -export CI_BIN_DIR="${CI_ROOT_DIR}/build" - -export CMAKE_PREFIX_PATH=${CI_DEP_DIR}/install -export PATH=${CI_DEP_DIR}/tools/bin:${CI_DEP_DIR}/install/bin:${PATH} -case "$(uname -s)" in - Linux) - export LD_LIBRARY_PATH=${CI_DEP_DIR}/install/lib:${LD_LIBRARY_PATH} - ;; - Darwin) - export DYLD_LIBRARY_PATH=${CI_DEP_DIR}/install/lib:${DYLD_LIBRARY_PATH} - ;; -esac - - -mkdir -p ${CI_BIN_DIR} -cd ${CI_BIN_DIR} - -case "$1" in - configure) - cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CI_ROOT_DIR}/install ${CI_SOURCE_DIR} - ;; - build) - ninja - ;; - test) - if [ "$(uname -s)" = "Darwin" ] - then - # Disable the firewall - sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off - - # Force the use of the loopback interface - #export CM_IP="127.0.0.1" - export CM_HOSTNAME="localhost" - CTEST_EXCLUDES="mtests_non_blocking_bulk" - fi - ctest --timeout 300 -j2 -VV -E "${CTEST_EXCLUDES}" - ;; - install) - ninja install - ;; -esac diff --git a/thirdparty/dill/dill/ci/gh-actions/setup-linux.sh b/thirdparty/dill/dill/ci/gh-actions/setup-linux.sh deleted file mode 100755 index 7f2323a6cc..0000000000 --- a/thirdparty/dill/dill/ci/gh-actions/setup-linux.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -echo -echo "Installing ninja" -mkdir -p ${CI_DEP_DIR}/tools/bin -cd ${CI_DEP_DIR}/tools/bin -curl -O -L https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-linux.zip -unzip ninja-linux.zip - -# Install cmake -echo -echo "Installing CMake" -mkdir -p ${CI_DEP_DIR}/tools -cd ${CI_DEP_DIR}/tools -curl -L https://github.com/Kitware/CMake/releases/download/v3.3.2/cmake-3.3.2-Linux-x86_64.tar.gz | tar --strip-components=1 -xz - -export PATH=${CI_DEP_DIR}/tools/bin:${PATH} diff --git a/thirdparty/dill/dill/ci/gh-actions/setup-macos.sh b/thirdparty/dill/dill/ci/gh-actions/setup-macos.sh deleted file mode 100755 index f38950185f..0000000000 --- a/thirdparty/dill/dill/ci/gh-actions/setup-macos.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -echo -echo "Installing ninja" -brew install ninja - -# Install cmake -echo -echo "Installing CMake" -mkdir -p ${CI_DEP_DIR}/tools -cd ${CI_DEP_DIR}/tools -curl -L https://github.com/Kitware/CMake/releases/download/v3.3.2/cmake-3.3.2-Darwin-x86_64.tar.gz | tar --strip-components=3 -xz - -export PATH=${CI_DEP_DIR}/tools/bin:${PATH} diff --git a/thirdparty/dill/dill/ci/gh-actions/setup.sh b/thirdparty/dill/dill/ci/gh-actions/setup.sh deleted file mode 100755 index 04699eee36..0000000000 --- a/thirdparty/dill/dill/ci/gh-actions/setup.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -export CI_ROOT_DIR="${GITHUB_WORKSPACE//\\//}/.." -export CI_SOURCE_DIR="${GITHUB_WORKSPACE//\\//}" -export CI_DEP_DIR="${CI_ROOT_DIR}/dependencies" - -# Install ninja, pkgconfig, and libfabric -case "$(uname -s)" in - Linux) - . $(dirname ${BASH_SOURCE[0]})/setup-linux.sh - ;; - Darwin) - . $(dirname ${BASH_SOURCE[0]})/setup-macos.sh - ;; -esac - -export CMAKE_PREFIX_PATH=${CI_DEP_DIR}/install - diff --git a/thirdparty/dill/dill/config.h.cmake b/thirdparty/dill/dill/config.h.cmake index a9622f565d..f04719721b 100644 --- a/thirdparty/dill/dill/config.h.cmake +++ b/thirdparty/dill/dill/config.h.cmake @@ -1,6 +1,6 @@ /* config.h.in. Generated from configure.ac by autoheader. */ -/* Define with the build version of atl */ +/* Define with the build version of dill */ #cmakedefine DILL_VERSION "@DILL_VERSION@" /* Define if bfd functions use bfd_byte arguments. */ @@ -27,6 +27,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_MALLOC_H +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_MMAN_H + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_MEMORY_H @@ -143,6 +146,9 @@ /* Define this is mmap should be used instead of malloc() for code memory */ #cmakedefine USE_MMAP_CODE_SEG +/* Define this is VirtualProtect should be used to change memory protections */ +#cmakedefine USE_VIRTUAL_PROTECT + /* Define if byteorder is bigendian */ #cmakedefine WORDS_BIGENDIAN diff --git a/thirdparty/dill/dill/dill_internal.h b/thirdparty/dill/dill/dill_internal.h index 205c77c368..effb408911 100644 --- a/thirdparty/dill/dill/dill_internal.h +++ b/thirdparty/dill/dill/dill_internal.h @@ -8,8 +8,8 @@ typedef struct arg_info { char type; char is_register; /* true if parameter is in register */ char is_immediate; /* true if actual is an immediate */ - unsigned in_reg; /* callee register it's in */ - unsigned out_reg; /* caller register it's in */ + int in_reg; /* callee register it's in */ + int out_reg; /* caller register it's in */ int offset; /* otherwise at this offset from v_pp */ int used; } *arg_info_list; @@ -242,7 +242,7 @@ extern void dill_mark_call_location(dill_stream s, const char *xfer_name, void *xfer_address); extern void dill_mark_ret_location(dill_stream s); extern void dill_end_vararg_push(dill_stream s); -EXTERN void dill_dump_reg(dill_stream s, int typ, int reg); +extern void dill_dump_reg(dill_stream s, int typ, int reg); extern void setup_VM_proc(dill_stream s); typedef struct dill_pkg_1 { diff --git a/thirdparty/dill/dill/dill_pkg.c b/thirdparty/dill/dill/dill_pkg.c index 38edda1b26..63bffa0010 100644 --- a/thirdparty/dill/dill/dill_pkg.c +++ b/thirdparty/dill/dill/dill_pkg.c @@ -29,17 +29,17 @@ unpack_package(char *package, call_t *t, char **code_p) t->call_locs = malloc(sizeof(t->call_locs[0]) * pkg->symbol_count); memset(t->call_locs, 0, sizeof(t->call_locs[0]) * pkg->symbol_count); for (count = 0; countsymbol_count; count++) { - int call_len; + size_t call_len; t->call_locs[count].loc = *((int*)p); t->call_locs[count].xfer_name = (p + sizeof(int)); call_len = sizeof(int) + strlen(t->call_locs[count].xfer_name) + 1; - call_len = (call_len + 7) & -8; /* round up to mod 8 */ + call_len = (call_len + 7) & (size_t)-8; /* round up to mod 8 */ p += call_len; } *code_p = p; } -EXTERN void* +extern void* dill_package_entry(char* package) { struct dill_pkg_1 *pkg = (struct dill_pkg_1 *) package; @@ -71,7 +71,7 @@ dill_lookup_xfer_addrs(call_t *t, xfer_entry *x) } } -EXTERN dill_exec_handle +extern dill_exec_handle dill_package_stitch(char *pkg, dill_extern_entry* extra_externs) { dill_exec_handle handle = malloc(sizeof(*handle)); diff --git a/thirdparty/dill/dill/dill_util.c b/thirdparty/dill/dill/dill_util.c index 07186e7fe2..e50c302fa0 100644 --- a/thirdparty/dill/dill/dill_util.c +++ b/thirdparty/dill/dill/dill_util.c @@ -24,6 +24,7 @@ #include #endif #include +#include #ifdef HAVE_UNISTD_H #include #endif @@ -218,7 +219,7 @@ set_mach_reset(dill_stream s, char *arch) return 0; } -EXTERN void +extern void dill_free_stream(dill_stream s) { if (s->p->branch_table.label_locs) free(s->p->branch_table.label_locs); @@ -256,7 +257,7 @@ dill_free_stream(dill_stream s) extern void DILLprint_version(); -EXTERN dill_stream +extern dill_stream dill_cross_init(char *arch) { dill_stream s = (dill_stream) malloc(sizeof(struct dill_stream_s)); @@ -325,7 +326,7 @@ extern void dill_virtual_init(dill_stream s); -EXTERN dill_stream +extern dill_stream dill_create_stream() { dill_stream s; @@ -350,11 +351,11 @@ dill_create_stream() #ifndef EMULATION_ONLY -EXTERN void +extern void dill_native_dcg(){} #endif -EXTERN dill_stream +extern dill_stream dill_create_raw_stream() { return dill_cross_init(NATIVE_ARCH); @@ -389,13 +390,13 @@ extend_params(dill_stream s, int argno) s->p->c_param_count = (argno + 1); } -EXTERN dill_reg +extern dill_reg dill_vparam(dill_stream s, int param_no) { return param_no; } -EXTERN int +extern int dill_param_reg(dill_stream s, int argno) { if (argno >= s->p->c_param_count) { @@ -406,7 +407,7 @@ dill_param_reg(dill_stream s, int argno) return s->p->c_param_args[argno].in_reg; } -EXTERN void +extern void dill_param_alloc(dill_stream s, int argno, int type, dill_reg *reg_p) { extend_params(s, argno); @@ -414,7 +415,7 @@ dill_param_alloc(dill_stream s, int argno, int type, dill_reg *reg_p) s->p->c_param_args[argno].type = type; } -EXTERN void +extern void dill_param_struct_alloc(dill_stream s, int argno, int type, dill_parameter_type *struct_p) { @@ -423,7 +424,7 @@ dill_param_struct_alloc(dill_stream s, int argno, int type, s->p->c_param_args[argno].type = type; } -EXTERN void +extern void dill_start_simple_proc(dill_stream s, const char *subr_name, int ret_type) { int i; @@ -458,14 +459,14 @@ dill_start_simple_proc(dill_stream s, const char *subr_name, int ret_type) } } -EXTERN void * +extern void * dill_get_fp(dill_exec_handle h) { return (void *) h->fp; } -EXTERN dill_exec_handle +extern dill_exec_handle dill_finalize(dill_stream s) { dill_exec_handle handle = malloc(sizeof(*handle)); @@ -479,16 +480,16 @@ dill_finalize(dill_stream s) return handle; } -EXTERN dill_exec_handle +extern dill_exec_handle dill_get_handle(dill_stream s) { char* native_base = s->p->native.code_base; dill_exec_handle handle = malloc(sizeof(*handle)); - int size = (long)s->p->native.code_limit - (long)s->p->native.code_base + END_OF_CODE_BUFFER; + intptr_t size = (intptr_t)s->p->native.code_limit - (intptr_t)s->p->native.code_base + END_OF_CODE_BUFFER; s->p->native.code_base = NULL; if (native_base == 0) { native_base = s->p->code_base; - size = (long)s->p->code_limit - (long)s->p->code_base + END_OF_CODE_BUFFER; + size = (intptr_t)s->p->code_limit - (intptr_t)s->p->code_base + END_OF_CODE_BUFFER; s->p->code_base = NULL; } handle->fp = (void(*)())s->p->fp; @@ -505,7 +506,7 @@ dill_get_handle(dill_stream s) return handle; } -EXTERN void +extern void dill_free_handle(dill_exec_handle handle) { handle->ref_count--; @@ -527,7 +528,7 @@ dill_free_handle(dill_exec_handle handle) free(handle); } -EXTERN void +extern void dill_ref_handle(dill_exec_handle handle) { handle->ref_count++; @@ -565,11 +566,11 @@ dill_build_package(dill_stream s, int *pkg_len) memcpy(pkg + pkg_size, s->p->code_base, dill_code_size(s)); pkg_size += dill_code_size(s); *pkg_len = pkg_size; - ((struct dill_pkg_1 *)pkg)->entry_offset = (char*)s->p->fp - (char*)s->p->code_base; + ((struct dill_pkg_1 *)pkg)->entry_offset = (short)( (char*)s->p->fp - (char*)s->p->code_base); return pkg; } -EXTERN char * +extern char * dill_finalize_package(dill_stream s, int *pkg_len) { (s->j->package_end)(s); @@ -579,7 +580,7 @@ dill_finalize_package(dill_stream s, int *pkg_len) return p; } -EXTERN int +extern int dill_code_size(dill_stream s) { char* native_base = s->p->native.code_base; @@ -589,13 +590,13 @@ dill_code_size(dill_stream s) return (int) ((char*)s->p->cur_ip - native_base); } -EXTERN void * +extern void * dill_clone_code(dill_stream s, void *new_base, int size) { return (s->j->clone_code)(s, new_base, size); } -EXTERN void * +extern void * dill_take_code(dill_stream s) { void *ret = s->p->code_base; @@ -604,7 +605,7 @@ dill_take_code(dill_stream s) return ret; } -EXTERN int +extern int dill_alloc_label(dill_stream s, char *name) { struct branch_table *t = &s->p->branch_table; @@ -619,7 +620,7 @@ dill_alloc_label(dill_stream s, char *name) return t->next_label++; } -EXTERN void dill_mark_label(dill_stream s, int label) +extern void dill_mark_label(dill_stream s, int label) { struct branch_table *t = &s->p->branch_table; int label_loc = (int) ((char*)s->p->cur_ip - (char*)s->p->code_base); @@ -634,7 +635,7 @@ EXTERN void dill_mark_label(dill_stream s, int label) } } -EXTERN int dill_is_label_mark(dill_stream s) +extern int dill_is_label_mark(dill_stream s) { struct branch_table *t = &s->p->branch_table; int i; @@ -691,7 +692,7 @@ extern void dill_mark_call_location(dill_stream s, const char *xfer_name, t->call_count++; } -EXTERN int +extern int dill_add_const(dill_stream s, void *addr, int size) { struct branch_table *t = &s->p->branch_table; @@ -767,7 +768,7 @@ translate_arg_str(const char *string, int *count) return list; } -EXTERN void +extern void dill_start_proc(dill_stream s, char *name, int ret_type, char *arg_str) { int arg_count = 0; @@ -792,7 +793,7 @@ init_code_block(dill_stream s) #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON #endif - static unsigned long ps = -1; + static long ps = -1; if (ps == -1) { ps = (getpagesize ()); } @@ -908,7 +909,7 @@ reg_alloc(reg_set *regs) return reg; } -EXTERN void +extern void dill_alloc_specific(dill_stream s, dill_reg reg, int type, int class) { switch(type) { @@ -931,7 +932,7 @@ dill_alloc_specific(dill_stream s, dill_reg reg, int type, int class) } } -EXTERN void +extern void dill_dealloc_specific(dill_stream s, dill_reg reg, int type, int class) { switch(type) { @@ -954,7 +955,7 @@ dill_dealloc_specific(dill_stream s, dill_reg reg, int type, int class) } } -EXTERN void +extern void dill_raw_unavailreg(dill_stream s, int type, dill_reg reg) { if (s->p->unavail_called == 0) { @@ -973,7 +974,7 @@ dill_raw_unavailreg(dill_stream s, int type, dill_reg reg) } } -EXTERN void +extern void dill_raw_availreg(dill_stream s, int type, dill_reg reg) { switch(type) { @@ -998,7 +999,7 @@ dill_raw_availreg(dill_stream s, int type, dill_reg reg) } } -EXTERN int +extern int dill_getreg(dill_stream s, int typ) { s->p->vregs = realloc(s->p->vregs, @@ -1010,7 +1011,7 @@ dill_getreg(dill_stream s, int typ) return ((s->p->vreg_count++) + 100); } -EXTERN int +extern int dill_getvblock(dill_stream s, int size) { s->p->vregs = realloc(s->p->vregs, @@ -1022,7 +1023,7 @@ dill_getvblock(dill_stream s, int size) return ((s->p->vreg_count++) + 100); } -EXTERN int +extern int dill_raw_getreg(dill_stream s, dill_reg *reg_p, int type, int class) { int reg = -1; @@ -1048,7 +1049,6 @@ dill_raw_getreg(dill_stream s, dill_reg *reg_p, int type, int class) *reg_p = reg; return (reg != -1); } - break; default: if (class == DILL_VAR) { if ((reg = reg_alloc(&s->p->var_i)) == -1) { @@ -1072,11 +1072,10 @@ dill_raw_getreg(dill_stream s, dill_reg *reg_p, int type, int class) *reg_p = reg; return (reg != -1); } - break; } } -EXTERN void +extern void dill_raw_putreg(dill_stream s, dill_reg reg, int type) { switch (type) { @@ -1107,7 +1106,7 @@ dill_raw_putreg(dill_stream s, dill_reg reg, int type) } } -EXTERN int +extern int dill_do_reverse_vararg_push(dill_stream s) { if (s->j->do_reverse_push) { @@ -1342,7 +1341,7 @@ dill_pcompare(dill_stream s, int op_type, int data_type, dill_reg dest, dill_reg s->j->c_data[index].data2, dest, src1, src2); } -EXTERN void +extern void dill_dump_reg(dill_stream s, int typ, int reg) { s->j->print_reg(s, typ, reg); @@ -1493,7 +1492,7 @@ dump_cur_dill_insn(dill_stream s) } #endif -EXTERN void +extern void dill_dump(dill_stream s) { struct disassemble_info info; @@ -1513,7 +1512,7 @@ dill_dump(dill_stream s) int insn_count = 0; printf("\nDILL virtual instruction stream\n\n"); for (p =base; p < code_limit;) { - printf("%lx - %x - ", (unsigned long)p, (unsigned)*(int*)p); + printf("%p - %x - ", p, (unsigned)*(int*)p); l = s->p->virtual.mach_jump->print_insn(s, &info, (void *)p); printf("\n"); if (l == -1) return; @@ -1557,7 +1556,7 @@ dill_dump(dill_stream s) if (p == s->p->fp) { printf("Function entry point:\n"); } - printf("%lx - %x - ", (unsigned long)p, (unsigned)*(int*)p); + printf("%p - %x - ", p, (unsigned)*(int*)p); l = s->j->print_insn(s, &info, (void *)p); printf("\n"); if (l <= 0) return; diff --git a/thirdparty/dill/dill/scripts/ci/cmake/centos7-clang.cmake b/thirdparty/dill/dill/scripts/ci/cmake/centos7-clang.cmake new file mode 100644 index 0000000000..6f6f2e2d40 --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/centos7-clang.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(ENV{CC} clang) +set(ENV{CXX} clang++) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/centos7-gcc.cmake b/thirdparty/dill/dill/scripts/ci/cmake/centos7-gcc.cmake new file mode 100644 index 0000000000..8a1c976d8f --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/centos7-gcc.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(ENV{CC} gcc) +set(ENV{CXX} g++) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/centos7-nvhpc.cmake b/thirdparty/dill/dill/scripts/ci/cmake/centos7-nvhpc.cmake new file mode 100644 index 0000000000..30e1f6cd58 --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/centos7-nvhpc.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(ENV{CC} nvc) +set(ENV{CXX} nvc++) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/centos8-clang.cmake b/thirdparty/dill/dill/scripts/ci/cmake/centos8-clang.cmake new file mode 100644 index 0000000000..6f6f2e2d40 --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/centos8-clang.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(ENV{CC} clang) +set(ENV{CXX} clang++) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/centos8-gcc.cmake b/thirdparty/dill/dill/scripts/ci/cmake/centos8-gcc.cmake new file mode 100644 index 0000000000..8a1c976d8f --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/centos8-gcc.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(ENV{CC} gcc) +set(ENV{CXX} g++) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/centos8-intel.cmake b/thirdparty/dill/dill/scripts/ci/cmake/centos8-intel.cmake new file mode 100644 index 0000000000..b173d984ec --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/centos8-intel.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(ENV{CC} icc) +set(ENV{CXX} icpc) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/centos8-inteloneapi.cmake b/thirdparty/dill/dill/scripts/ci/cmake/centos8-inteloneapi.cmake new file mode 100644 index 0000000000..09ca1203cd --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/centos8-inteloneapi.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(ENV{CC} icx) +set(ENV{CXX} icpx) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/common.cmake b/thirdparty/dill/dill/scripts/ci/cmake/common.cmake new file mode 100644 index 0000000000..f0e57e6c7a --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/common.cmake @@ -0,0 +1,62 @@ +if(POLICY CMP0057) + cmake_policy(SET CMP0057 NEW) +endif() + +if(NOT CTEST_BUILD_CONFIGURATION) + set(CTEST_BUILD_CONFIGURATION Debug) +endif() + +if(NOT DEFINED NCPUS) + include(ProcessorCount) + ProcessorCount(NCPUS) +endif() +math(EXPR N2CPUS "${NCPUS}*2") +if(NOT CTEST_BUILD_FLAGS) + if(CTEST_CMAKE_GENERATOR STREQUAL "Unix Makefiles") + set(CTEST_BUILD_FLAGS "-k -j${N2CPUS}") + elseif(CTEST_CMAKE_GENERATOR STREQUAL "Ninja") + set(CTEST_BUILD_FLAGS "-k0 -j${N2CPUS}") + endif() +endif() +if(NOT PARALLEL_LEVEL IN_LIST CTEST_TEST_ARGS) + list(APPEND CTEST_TEST_ARGS PARALLEL_LEVEL ${N2CPUS}) +endif() + +if(NOT dashboard_model) + set(dashboard_model Experimental) +endif() +if(NOT dashboard_binary_name) + set(dashboard_binary_name "build") +endif() +if(NOT dashboard_track) + set(dashboard_track "Continuous Integration") +endif() +if(NOT "$ENV{CI_COMMIT_SHA}" STREQUAL "") + set(CTEST_UPDATE_VERSION_OVERRIDE "$ENV{CI_COMMIT_SHA}") + set(CTEST_UPDATE_VERSION_ONLY ON) +endif() +if(NOT "$ENV{CI_SITE_NAME}" STREQUAL "") + set(CTEST_SITE "$ENV{CI_SITE_NAME}") +endif() +if(NOT "$ENV{CI_BUILD_NAME}" STREQUAL "") + set(CTEST_BUILD_NAME "$ENV{CI_BUILD_NAME}") +endif() +if(NOT "$ENV{CI_ROOT_DIR}" STREQUAL "") + set(CTEST_DASHBOARD_ROOT "$ENV{CI_ROOT_DIR}") +endif() +if(NOT "$ENV{CI_SOURCE_DIR}" STREQUAL "") + set(CTEST_SOURCE_DIRECTORY "$ENV{CI_SOURCE_DIR}") +endif() +if(NOT "$ENV{CI_BIN_DIR}" STREQUAL "") + set(CTEST_BINARY_DIRECTORY "$ENV{CI_BIN_DIR}") +endif() + +find_program(CTEST_GIT_COMMAND git) +set(CTEST_UPDATE_COMMAND ${CTEST_GIT_COMMAND}) +set(CTEST_UPDATE_TYPE git) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/../../dashboard/dill_common.cmake) +if(ctest_build_num_warnings GREATER 0) + message(FATAL_ERROR "Found ${ctest_build_num_warnings} warnings.") +endif() diff --git a/thirdparty/dill/dill/scripts/ci/cmake/macos-clang.cmake b/thirdparty/dill/dill/scripts/ci/cmake/macos-clang.cmake new file mode 100644 index 0000000000..868b8b44b7 --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/macos-clang.cmake @@ -0,0 +1,6 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(ENV{CC} clang) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1604-clang.cmake b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1604-clang.cmake new file mode 100644 index 0000000000..6f6f2e2d40 --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1604-clang.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(ENV{CC} clang) +set(ENV{CXX} clang++) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1604-gcc.cmake b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1604-gcc.cmake new file mode 100644 index 0000000000..8a1c976d8f --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1604-gcc.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(ENV{CC} gcc) +set(ENV{CXX} g++) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1804-clang.cmake b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1804-clang.cmake new file mode 100644 index 0000000000..6f6f2e2d40 --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1804-clang.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(ENV{CC} clang) +set(ENV{CXX} clang++) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1804-gcc.cmake b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1804-gcc.cmake new file mode 100644 index 0000000000..8a1c976d8f --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1804-gcc.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(ENV{CC} gcc) +set(ENV{CXX} g++) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1804-intel.cmake b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1804-intel.cmake new file mode 100644 index 0000000000..b173d984ec --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1804-intel.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(ENV{CC} icc) +set(ENV{CXX} icpc) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1804-inteloneapi.cmake b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1804-inteloneapi.cmake new file mode 100644 index 0000000000..09ca1203cd --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu1804-inteloneapi.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(ENV{CC} icx) +set(ENV{CXX} icpx) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/ubuntu2004-clang.cmake b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu2004-clang.cmake new file mode 100644 index 0000000000..6f6f2e2d40 --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu2004-clang.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(ENV{CC} clang) +set(ENV{CXX} clang++) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/ubuntu2004-gcc.cmake b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu2004-gcc.cmake new file mode 100644 index 0000000000..8a1c976d8f --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu2004-gcc.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(ENV{CC} gcc) +set(ENV{CXX} g++) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/ubuntu2004-nvhpc.cmake b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu2004-nvhpc.cmake new file mode 100644 index 0000000000..30e1f6cd58 --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/ubuntu2004-nvhpc.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(ENV{CC} nvc) +set(ENV{CXX} nvc++) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/unix-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/unix-common.cmake b/thirdparty/dill/dill/scripts/ci/cmake/unix-common.cmake new file mode 100644 index 0000000000..93631c10cd --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/unix-common.cmake @@ -0,0 +1,11 @@ +# Client maintainer: chuck.atkins@kitware.com + +string(APPEND dashboard_cache " +") + +if(NOT CTEST_CMAKE_GENERATOR) + set(CTEST_CMAKE_GENERATOR "Unix Makefiles") +endif() + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/windows-common.cmake b/thirdparty/dill/dill/scripts/ci/cmake/windows-common.cmake new file mode 100644 index 0000000000..1b227e5395 --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/windows-common.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +string(APPEND dashboard_cache " +") + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/windows-vs2019-clang.cmake b/thirdparty/dill/dill/scripts/ci/cmake/windows-vs2019-clang.cmake new file mode 100644 index 0000000000..3667faf3c1 --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/windows-vs2019-clang.cmake @@ -0,0 +1,8 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(CTEST_CMAKE_GENERATOR "Visual Studio 16") +set(CTEST_CMAKE_GENERATOR_PLATFORM x64) +set(CTEST_CMAKE_GENERATOR_TOOLSET ClangCL) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/windows-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/cmake/windows-vs2019-msvc.cmake b/thirdparty/dill/dill/scripts/ci/cmake/windows-vs2019-msvc.cmake new file mode 100644 index 0000000000..c21aff334b --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/cmake/windows-vs2019-msvc.cmake @@ -0,0 +1,7 @@ +# Client maintainer: chuck.atkins@kitware.com + +set(CTEST_CMAKE_GENERATOR "Visual Studio 16") +set(CTEST_CMAKE_GENERATOR_PLATFORM x64) + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/windows-common.cmake) diff --git a/thirdparty/dill/dill/scripts/ci/gh-actions/run.sh b/thirdparty/dill/dill/scripts/ci/gh-actions/run.sh new file mode 100755 index 0000000000..fdc910dddd --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/gh-actions/run.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +readlinkf() { perl -MCwd -e 'print Cwd::abs_path shift' "$1"; } + +set -e + +STEP=$1 +shift + +export CI_SITE_NAME="GitHub Actions" +if [ "${GITHUB_EVENT_NAME}" = "pull_request" ] +then + GH_PR_NUMBER=$(expr "${GITHUB_REF}" : 'refs/pull/\([^/]*\)') + export CI_BUILD_NAME="pr${GH_PR_NUMBER}_${GITHUB_HEAD_REF}_${GH_YML_JOBNAME}_${GH_YML_BUILDTYPE}" +else + export CI_BUILD_NAME="${GITHUB_REF#refs/heads/}_${GH_YML_JOBNAME}_${GH_YML_BUILDTYPE}" +fi +if [[ "${RUNNER_OS}" =~ "Windows" ]] +then + export CI_ROOT_DIR="${GITHUB_WORKSPACE//\\//}" + export CI_SOURCE_DIR="${GITHUB_WORKSPACE//\\//}/source" +else + export CI_ROOT_DIR="${GITHUB_WORKSPACE}" + export CI_SOURCE_DIR="${GITHUB_WORKSPACE}/source" +fi +export CI_BIN_DIR="${CI_ROOT_DIR}/build" + +export CI_COMMIT_SHA=${GH_YML_SHA} + +if command -v ctest3 >/dev/null +then + CTEST=ctest3 +else + CTEST=ctest +fi + +# Update and Test steps enable an extra step +CTEST_STEP_ARGS="" +case ${STEP} in + test) CTEST_STEP_ARGS="${CTEST_STEP_ARGS} -Ddashboard_do_end=ON" ;; +esac +CTEST_STEP_ARGS="${CTEST_STEP_ARGS} -Ddashboard_do_${STEP}=ON" + +echo "********** Environment **********" + +env | sort + +echo "********** Running CTest **********" + +${CTEST} -VV \ + -S ${CI_SOURCE_DIR}/scripts/ci/cmake/${GH_YML_JOBNAME}.cmake \ + -DCTEST_BUILD_CONFIGURATION=${GH_YML_BUILDTYPE} \ + -Ddashboard_do_submit=ON \ + -Ddashboard_full=OFF \ + ${CTEST_STEP_ARGS} \ + "$@" + diff --git a/thirdparty/dill/dill/scripts/ci/scripts/post-cdash-status.sh b/thirdparty/dill/dill/scripts/ci/scripts/post-cdash-status.sh new file mode 100755 index 0000000000..766ea9a90b --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/scripts/post-cdash-status.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +if [ $# -eq 0 ] +then + echo "$0 org/repo [SHA [TOKEN]]" + exit 1 +fi + +GH_REPO=$1 +if [ $# -gt 1 ] +then + GH_SHA=$2 + if [ $# -gt 2 ] + then + GH_TOKEN=$3 + if [ $# -gt 3 ] + then + echo "$0 org/repo [SHA [TOKEN]]" + exit 1 + fi + fi +fi + +if [ -z "${GH_SHA}" ] +then + echo "Error: GH_SHA is undefined" + exit 2 +fi +if [ -z "${GH_TOKEN}" ] +then + echo "Error: GH_TOKEN is undefined" + exit 3 +fi + +cdash_url() { + printf 'https://open.cdash.org/index.php?project=%s&subproject=%s&filtercount=1&showfilters=1&field1=revision&compare1=61&value1=%s' $1 $2 $3 +} + +build_status_body() { +cat < /etc/yum.repos.d/group_git-maint-git-epel-7.repo + ;; + centos8*) + curl -L https://copr.fedorainfracloud.org/coprs/g/git-maint/git/repo/epel-8/group_git-maint-git-epel-8.repo > /etc/yum.repos.d/group_git-maint-git-epel-8.repo + ;; + ubuntu*) + export DEBIAN_FRONTEND=noninteractive + add-apt-repository ppa:git-core/ppa -y + apt-get update + ;; +esac +${PKG_CMD} install -y git + +######################################## +# Compilers +######################################## +case ${GH_YML_JOBNAME} in + centos*-clang) PKGS="clang gcc gcc-c++" ;; + centos*-gcc) PKGS="gcc gcc-c++" ;; + centos*-nvhpc) PKGS="gcc gcc-c++" ;; + ubuntu*-clang) PKGS="clang gcc g++" ;; + ubuntu*-gcc) PKGS="gcc g++" ;; + ubuntu*-nvhpc) PKGS="gcc g++" ;; +esac +${PKG_CMD} install -y ${PKGS} + + +case ${GH_YML_JOBNAME} in + *-clang) export CC=clang CXX=clang++ ;; + *-gcc) export CC=gcc CXX=g++ ;; + *-nvhpc) export CC=nvc CXX=nvc++ ;; +esac + +######################################## +# CMake +######################################## +FILENAME=$(curl https://cmake.org/files/LatestRelease/cmake-latest-files-v1.json 2>/dev/null | grep 'cmake.*sh' | sed -n 's|.*"\(cmake.*x86_64.sh\).*|\1|p') +VERSION=$(echo ${FILENAME} | sed 's|cmake-\([^\-]*\).*|\1|') +curl -L https://github.com/Kitware/CMake/releases/download/v${VERSION}/${FILENAME} > cmake.sh +chmod +x cmake.sh +./cmake.sh --skip-license --exclude-subdir --prefix=/usr/local +rm -f cmake.sh diff --git a/thirdparty/dill/dill/scripts/ci/setup/macos.sh b/thirdparty/dill/dill/scripts/ci/setup/macos.sh new file mode 100755 index 0000000000..a9bf588e2f --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/setup/macos.sh @@ -0,0 +1 @@ +#!/bin/bash diff --git a/thirdparty/dill/dill/scripts/ci/setup/windows.sh b/thirdparty/dill/dill/scripts/ci/setup/windows.sh new file mode 100755 index 0000000000..a9bf588e2f --- /dev/null +++ b/thirdparty/dill/dill/scripts/ci/setup/windows.sh @@ -0,0 +1 @@ +#!/bin/bash diff --git a/thirdparty/dill/dill/scripts/dashboard/common.cmake b/thirdparty/dill/dill/scripts/dashboard/common.cmake new file mode 100644 index 0000000000..4b50bf291e --- /dev/null +++ b/thirdparty/dill/dill/scripts/dashboard/common.cmake @@ -0,0 +1,515 @@ +#------------------------------------------------------------------------------# +# Distributed under the OSI-approved Apache License, Version 2.0. See +# accompanying file Copyright.txt for details. +#------------------------------------------------------------------------------# +# +# "Universal" Dashboard Script +# +# This script contains basic dashboard driver code common to all +# clients and projects. It is a combination of the universal.cmake script in +# the Kitware DashboardScriptsNG repo and cmake_common.cmake used by CMake +# dashboards. +# +# Create a project-specific common script with code of the following form, +# where the final line includes this script. +# +# set(CTEST_PROJECT_NAME "OpenChemistry") +# set(CTEST_DROP_SITE "cdash.openchemistry.org") +# +# set(dashboard_git_url "git://source.openchemistry.org/openchemistry.git") +# set(dashboard_root_name "MyTests") +# set(dashboard_source_name "openchemistry") +# +# get_filename_component(dir ${CMAKE_CURRENT_LIST_FILE} PATH) +# include(${dir}/universal.cmake) +# +# The following variables may be set before including this script +# to configure it: +# +# dashboard_model = Nightly | Experimental +# dashboard_root_name = Change name of "My Tests" directory +# dashboard_source_name = Name of source directory (CMake) +# dashboard_binary_name = Name of binary directory (CMake-build) +# dashboard_cache = Initial CMakeCache.txt file content +# dashboard_track = The name of the CDash "Track" to submit to + +# dashboard_do_checkout = True to enable source checkout via git +# dashboard_do_update = True to enable the Update step +# dashboard_do_configure = True to enable the Configure step +# dashboard_do_build = True to enable the Build step +# dashboard_do_test = True to enable the Test step +# dashboard_do_coverage = True to enable coverage (ex: gcov) +# dashboard_do_memcheck = True to enable memcheck (ex: valgrind) +# dashboard_do_submit = Submit each step (ON) +# dashboard_do_submit_only = Only submit step results, do nto run them (OFF) + +# CTEST_GIT_COMMAND = path to git command-line client +# CTEST_BUILD_FLAGS = build tool arguments (ex: -j2) +# CTEST_DASHBOARD_ROOT = Where to put source and build trees +# CTEST_TEST_CTEST = Whether to run long CTestTest* tests +# CTEST_TEST_TIMEOUT = Per-test timeout length +# CTEST_TEST_ARGS = ctest_test args (ex: PARALLEL_LEVEL 4) +# CMAKE_MAKE_PROGRAM = Path to "make" tool to use +# +# Options to configure Git: +# dashboard_git_url = Custom git clone url +# dashboard_git_branch = Custom remote branch to track +# dashboard_git_crlf = Value of core.autocrlf for repository +# +# For Makefile generators the script may be executed from an +# environment already configured to use the desired compilers. +# Alternatively the environment may be set at the top of the script: +# +# set(ENV{CC} /path/to/cc) # C compiler +# set(ENV{CXX} /path/to/cxx) # C++ compiler +# set(ENV{FC} /path/to/fc) # Fortran compiler (optional) +# set(ENV{LD_LIBRARY_PATH} /path/to/vendor/lib) # (if necessary) + +cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) + +if(NOT DEFINED dashboard_full) + set(dashboard_full TRUE) +endif() + +# Initialize all build steps to "ON" +if(NOT DEFINED dashboard_do_update) + set(dashboard_do_update ${dashboard_full}) +endif() + +if(NOT DEFINED dashboard_do_checkout) + set(dashboard_do_checkout ${dashboard_full}) +endif() + +if(NOT DEFINED dashboard_do_configure) + set(dashboard_do_configure ${dashboard_full}) +endif() + +if(NOT DEFINED dashboard_do_build) + set(dashboard_do_build ${dashboard_full}) +endif() + +if(NOT DEFINED dashboard_do_test) + set(dashboard_do_test ${dashboard_full}) +endif() + +# Default code coverage and memtesting to off +if(NOT DEFINED dashboard_do_coverage) + set(dashboard_do_coverage FALSE) +endif() + +if(NOT DEFINED dashboard_do_memcheck) + set(dashboard_do_memcheck FALSE) +endif() + +if(NOT DEFINED dashboard_fresh) + if(dashboard_full OR dashboard_do_update) + set(dashboard_fresh TRUE) + else() + set(dashboard_fresh FALSE) + endif() +endif() + +if(NOT DEFINED dashboard_do_submit_only) + set(dashboard_do_submit_only FALSE) +endif() + +if(NOT DEFINED dashboard_do_submit) + set(dashboard_do_submit TRUE) +endif() + +if(NOT DEFINED CTEST_PROJECT_NAME) + message(FATAL_ERROR "project-specific script including 'universal.cmake' should set CTEST_PROJECT_NAME") +endif() + +if(NOT DEFINED dashboard_user_home) + set(dashboard_user_home "$ENV{HOME}") +endif() + +# Select the top dashboard directory. +if(NOT DEFINED dashboard_root_name) + set(dashboard_root_name "My Tests") +endif() +if(NOT DEFINED CTEST_DASHBOARD_ROOT) + get_filename_component(CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}/../${dashboard_root_name}" ABSOLUTE) +endif() + +# Select the model (Nightly, Experimental, Continuous). +if(NOT DEFINED dashboard_model) + set(dashboard_model Nightly) +endif() +if(NOT "${dashboard_model}" MATCHES "^(Nightly|Experimental)$") + message(FATAL_ERROR "dashboard_model must be Nightly or Experimental") +endif() + +# Default to a Debug build. +if(NOT DEFINED CTEST_BUILD_CONFIGURATION) + set(CTEST_BUILD_CONFIGURATION Debug) +endif() + +if(NOT DEFINED CTEST_CONFIGURATION_TYPE) + set(CTEST_CONFIGURATION_TYPE ${CTEST_BUILD_CONFIGURATION}) +endif() + +# Choose CTest reporting mode. +if(NOT "${CTEST_CMAKE_GENERATOR}" MATCHES "Make|Ninja") + # Launchers work only with Makefile and Ninja generators. + set(CTEST_USE_LAUNCHERS 0) +elseif(NOT DEFINED CTEST_USE_LAUNCHERS) + # The setting is ignored by CTest < 2.8 so we need no version test. + set(CTEST_USE_LAUNCHERS 1) +endif() + +# Configure testing. +if(NOT DEFINED CTEST_TEST_CTEST) + set(CTEST_TEST_CTEST 1) +endif() +if(NOT CTEST_TEST_TIMEOUT) + set(CTEST_TEST_TIMEOUT 1500) +endif() + +# Select Git source to use. +if(dashboard_do_checkout) + if(NOT DEFINED dashboard_git_url) + message(FATAL_ERROR "project-specific script including 'universal.cmake' should set dashboard_git_url") + endif() + if(NOT DEFINED dashboard_git_branch) + set(dashboard_git_branch master) + endif() + if(NOT DEFINED dashboard_git_crlf) + if(UNIX) + set(dashboard_git_crlf false) + else() + set(dashboard_git_crlf true) + endif() + endif() + + # Look for a GIT command-line client. + if(NOT DEFINED CTEST_GIT_COMMAND) + find_program(CTEST_GIT_COMMAND + NAMES git git.cmd + PATH_SUFFIXES Git/cmd Git/bin + ) + endif() + if(NOT CTEST_GIT_COMMAND) + message(FATAL_ERROR "CTEST_GIT_COMMAND not available!") + endif() +endif() + +# Select a source directory name. +if(NOT DEFINED CTEST_SOURCE_DIRECTORY) + if(DEFINED dashboard_source_name) + set(CTEST_SOURCE_DIRECTORY ${CTEST_DASHBOARD_ROOT}/${dashboard_source_name}) + else() + set(CTEST_SOURCE_DIRECTORY ${CTEST_DASHBOARD_ROOT}/${CTEST_PROJECT_NAME}) + endif() +endif() + +# Select a build directory name. +if(NOT DEFINED CTEST_BINARY_DIRECTORY) + if(DEFINED dashboard_binary_name) + set(CTEST_BINARY_DIRECTORY ${CTEST_DASHBOARD_ROOT}/${dashboard_binary_name}) + else() + set(CTEST_BINARY_DIRECTORY ${CTEST_SOURCE_DIRECTORY}-build) + endif() +endif() + +macro(dashboard_git) + execute_process( + COMMAND ${CTEST_GIT_COMMAND} ${ARGN} + WORKING_DIRECTORY "${CTEST_SOURCE_DIRECTORY}" + OUTPUT_VARIABLE dashboard_git_output + ERROR_VARIABLE dashboard_git_output + RESULT_VARIABLE dashboard_git_failed + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_STRIP_TRAILING_WHITESPACE + ) +endmacro() + +if(dashboard_do_checkout) + # Delete source tree if it is incompatible with current VCS. + if(EXISTS ${CTEST_SOURCE_DIRECTORY}) + if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}/.git") + set(vcs_refresh "because it is not managed by git.") + else() + execute_process( + COMMAND ${CTEST_GIT_COMMAND} reset --hard + WORKING_DIRECTORY "${CTEST_SOURCE_DIRECTORY}" + OUTPUT_VARIABLE output + ERROR_VARIABLE output + RESULT_VARIABLE failed + ) + if(failed) + set(vcs_refresh "because its .git may be corrupted.") + endif() + endif() + if(vcs_refresh AND "${CTEST_SOURCE_DIRECTORY}" MATCHES "/CMake[^/]*") + message("Deleting source tree\n") + message(" ${CTEST_SOURCE_DIRECTORY}\n${vcs_refresh}") + file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") + endif() + endif() + + # Support initial checkout if necessary. + if(NOT EXISTS "${CTEST_SOURCE_DIRECTORY}" + AND NOT DEFINED CTEST_CHECKOUT_COMMAND) + # Generate an initial checkout script. + get_filename_component(_name "${CTEST_SOURCE_DIRECTORY}" NAME) + set(ctest_checkout_script ${CTEST_DASHBOARD_ROOT}/${_name}-init.cmake) + file(WRITE ${ctest_checkout_script} "# git repo init script for ${_name} +execute_process( + COMMAND \"${CTEST_GIT_COMMAND}\" clone -n -- \"${dashboard_git_url}\" + \"${CTEST_SOURCE_DIRECTORY}\" + ) +if(EXISTS \"${CTEST_SOURCE_DIRECTORY}/.git\") + execute_process( + COMMAND \"${CTEST_GIT_COMMAND}\" config core.autocrlf ${dashboard_git_crlf} + WORKING_DIRECTORY \"${CTEST_SOURCE_DIRECTORY}\" + ) + execute_process( + COMMAND \"${CTEST_GIT_COMMAND}\" fetch + WORKING_DIRECTORY \"${CTEST_SOURCE_DIRECTORY}\" + ) + execute_process( + COMMAND \"${CTEST_GIT_COMMAND}\" checkout ${dashboard_git_branch} + WORKING_DIRECTORY \"${CTEST_SOURCE_DIRECTORY}\" + ) +endif()" + ) + set(CTEST_CHECKOUT_COMMAND "\"${CMAKE_COMMAND}\" -P \"${ctest_checkout_script}\"") + elseif(EXISTS "${CTEST_SOURCE_DIRECTORY}/.git") + # Upstream URL. + dashboard_git(config --get remote.origin.url) + if(NOT dashboard_git_output STREQUAL "${dashboard_git_url}") + dashboard_git(config remote.origin.url "${dashboard_git_url}") + endif() + + # Local checkout. + dashboard_git(symbolic-ref HEAD) + if(NOT dashboard_git_output STREQUAL "${dashboard_git_branch}") + dashboard_git(checkout ${dashboard_git_branch}) + if(dashboard_git_failed) + message(FATAL_ERROR "Failed to checkout branch ${dashboard_git_branch}:\n${dashboard_git_output}") + endif() + endif() + endif() +endif() + +#----------------------------------------------------------------------------- + +# Check for required variables. +foreach(req + CTEST_CMAKE_GENERATOR + CTEST_SITE + CTEST_BUILD_NAME + ) + if(NOT DEFINED ${req}) + message(FATAL_ERROR "The containing script must set ${req}") + endif() +endforeach(req) + +# Print summary information. +set(vars "") +foreach(v + CTEST_SITE + CTEST_BUILD_NAME + CTEST_SOURCE_DIRECTORY + CTEST_BINARY_DIRECTORY + CTEST_CMAKE_GENERATOR + CTEST_BUILD_CONFIGURATION + CTEST_GIT_COMMAND + CTEST_CHECKOUT_COMMAND + CTEST_CONFIGURE_COMMAND + CTEST_SCRIPT_DIRECTORY + CTEST_USE_LAUNCHERS + ) + set(vars "${vars} ${v}=[${${v}}]\n") +endforeach(v) +message("Dashboard script configuration:\n${vars}\n") + +# Avoid non-ascii characters in tool output. +set(ENV{LC_ALL} C) + +# Helper macro to write the initial cache. +macro(write_cache) + set(cache_build_type "") + set(cache_make_program "") + if(CTEST_CMAKE_GENERATOR MATCHES "Make|Ninja") + set(cache_build_type CMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION}) + if(CMAKE_MAKE_PROGRAM) + set(cache_make_program CMAKE_MAKE_PROGRAM:FILEPATH=${CMAKE_MAKE_PROGRAM}) + endif() + endif() + file(WRITE ${CTEST_BINARY_DIRECTORY}/CMakeCache.txt " +SITE:STRING=${CTEST_SITE} +BUILDNAME:STRING=${CTEST_BUILD_NAME} +CTEST_TEST_CTEST:BOOL=${CTEST_TEST_CTEST} +CTEST_USE_LAUNCHERS:BOOL=${CTEST_USE_LAUNCHERS} +DART_TESTING_TIMEOUT:STRING=${CTEST_TEST_TIMEOUT} +GIT_EXECUTABLE:FILEPATH=${CTEST_GIT_COMMAND} +${cache_build_type} +${cache_make_program} +${dashboard_cache} +") +endmacro(write_cache) + +if(COMMAND dashboard_hook_init) + dashboard_hook_init() +endif() + +if(dashboard_fresh) + if(EXISTS "${CTEST_BINARY_DIRECTORY}") + message("Clearing build tree...") + ctest_empty_binary_directory("${CTEST_BINARY_DIRECTORY}") + else() + file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") + endif() + message("Starting fresh build...") + write_cache() +endif() + +# Start a new submission. +if(dashboard_track) + set(dashboard_track_arg TRACK "${dashboard_track}") +endif() +if(dashboard_fresh) + if(COMMAND dashboard_hook_start) + dashboard_hook_start() + endif() + message("Calling ctest_start") + ctest_start(${dashboard_model} ${dashboard_track_arg}) + if(dashboard_do_submit) + message("Calling ctest_submit") + ctest_submit(PARTS Start) + endif() + if(COMMAND dashboard_hook_started) + dashboard_hook_started() + endif() +else() + message("Calling ctest_start(APPEND)") + ctest_start(${dashboard_model} ${dashboard_track_arg} APPEND) +endif() + +# Look for updates. +if(dashboard_do_update) + if(NOT dashboard_do_submit_only) + if(COMMAND dashboard_hook_update) + dashboard_hook_update() + endif() + message("Calling ctest_update") + ctest_update(RETURN_VALUE count) + set(CTEST_CHECKOUT_COMMAND) # checkout on first iteration only + message("Found ${count} changed files") + endif() + + if(dashboard_do_submit) + if(CTEST_SUBMIT_NOTES) + message("Submitting dashboard scripts as Notes") + # Send the main script as a note while submitting the Update part + set(CTEST_NOTES_FILES + ${CTEST_UPDATE_NOTES_FILES} + "${CMAKE_CURRENT_LIST_FILE}") + message("Calling ctest_submit") + ctest_submit(PARTS Update Notes) + unset(CTEST_NOTES_FILES) + else() + message("Skipping notes submission for Update step") + message("Calling ctest_submit") + ctest_submit(PARTS Update) + endif() + endif() +endif() + +if(dashboard_do_configure) + if(NOT dashboard_do_submit_only) + if(COMMAND dashboard_hook_configure) + dashboard_hook_configure() + endif() + message("Calling ctest_configure") + ctest_configure(${dashboard_configure_args}) + endif() + if(dashboard_do_submit) + if(CTEST_SUBMIT_NOTES) + message("Submitting CMakeCache.txt as Notes") + set(CTEST_NOTES_FILES "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt") + message("Calling ctest_submit") + ctest_submit(PARTS Configure Notes) + unset(CTEST_NOTES_FILES) + else() + message("Skipping notes submission for Configure step") + message("Calling ctest_submit") + ctest_submit(PARTS Configure) + endif() + endif() +endif() + +ctest_read_custom_files(${CTEST_BINARY_DIRECTORY}) + +if(dashboard_do_build) + if(NOT dashboard_do_submit_only) + if(COMMAND dashboard_hook_build) + dashboard_hook_build() + endif() + message("Calling ctest_build") + ctest_build( + NUMBER_WARNINGS ctest_build_num_warnings + ) + endif() + if(dashboard_do_submit) + message("Calling ctest_submit") + ctest_submit(PARTS Build) + endif() +endif() + +if(dashboard_do_test) + if(NOT dashboard_do_submit_only) + if(COMMAND dashboard_hook_test) + dashboard_hook_test() + endif() + message("Calling ctest_test") + ctest_test(${CTEST_TEST_ARGS} RETURN_VALUE TEST_RESULTS) + if(${TEST_RESULTS} EQUAL 0) + message("ctest test results return value: ${TEST_RESULTS}") + else() + message(SEND_ERROR "Some tests failed") + endif() + endif() + if(dashboard_do_submit) + message("Calling ctest_submit") + ctest_submit(PARTS Test) + endif() +endif() + +if(dashboard_do_coverage) + if(NOT dashboard_do_submit_only) + if(COMMAND dashboard_hook_coverage) + dashboard_hook_coverage() + endif() + message("Calling ctest_coverage") + ctest_coverage() + endif() + if(dashboard_do_submit) + message("Calling ctest_submit") + ctest_submit(PARTS Coverage) + endif() +endif() + +if(dashboard_do_memcheck) + if(NOT dashboard_do_submit_only) + if(COMMAND dashboard_hook_memcheck) + dashboard_hook_memcheck() + endif() + message("Calling ctest_memcheck") + ctest_memcheck(RETURN_VALUE MEMCHECK_RETURN DEFECT_COUNT MEMCHECK_DEFECTS) + if(NOT (MEMCHECK_DEFECTS EQUAL 0)) + message(SEND_ERROR "ctest memcheck defects found: ${MEMCHECK_DEFECTS}") + endif() + endif() + if(dashboard_do_submit) + message("Calling ctest_submit") + ctest_submit(PARTS MemCheck) + endif() +endif() + +if(COMMAND dashboard_hook_end) + dashboard_hook_end() +endif() diff --git a/thirdparty/dill/dill/scripts/dashboard/dill_common.cmake b/thirdparty/dill/dill/scripts/dashboard/dill_common.cmake new file mode 100644 index 0000000000..1d6294b9f2 --- /dev/null +++ b/thirdparty/dill/dill/scripts/dashboard/dill_common.cmake @@ -0,0 +1,111 @@ +#------------------------------------------------------------------------------# +# Distributed under the OSI-approved Apache License, Version 2.0. See +# accompanying file Copyright.txt for details. +#------------------------------------------------------------------------------# +# +# DILL Common Dashboard Script +# +# This script contains basic dashboard driver code common to all +# clients. +# +# # Client maintainer: me@mydomain.net +# set(CTEST_SITE "machine.site") +# set(CTEST_BUILD_NAME "Platform-Compiler") +# set(CTEST_CONFIGURATION_TYPE Debug) +# set(CTEST_CMAKE_GENERATOR "Unix Makefiles") +# include(${CTEST_SCRIPT_DIRECTORY}/dill_common.cmake) +# +# Then run a scheduled task (cron job) with a command line such as +# +# ctest -S ~/Dashboards/Scripts/my_dashboard.cmake -V +# +# By default the source and build trees will be placed in the path +# "../My Tests/" relative to your script location. +# +# The following variables may be set before including this script +# to configure it: +# +# dashboard_model = Nightly | Experimental +# dashboard_root_name = Change name of "MyTests" directory +# dashboard_source_name = Name of source directory (dill) +# dashboard_binary_name = Name of binary directory (dill-build) +# dashboard_cache = Initial CMakeCache.txt file content + +# dashboard_do_checkout = True to enable source checkout via git +# dashboard_do_update = True to enable source update +# dashboard_do_configure = True to enable the Configure step +# dashboard_do_build = True to enable the Build step +# dashboard_do_test = True to enable the Test step +# dashboard_do_coverage = True to enable coverage (ex: gcov) +# dashboard_do_memcheck = True to enable memcheck (ex: valgrind) + +# CTEST_GIT_COMMAND = path to git command-line client +# CTEST_BUILD_FLAGS = build tool arguments (ex: -j2) +# CTEST_DASHBOARD_ROOT = Where to put source and build trees +# CTEST_TEST_CTEST = Whether to run long CTestTest* tests +# CTEST_TEST_TIMEOUT = Per-test timeout length +# CTEST_TEST_ARGS = ctest_test args (ex: PARALLEL_LEVEL 4) +# CMAKE_MAKE_PROGRAM = Path to "make" tool to use +# +# Options to configure Git: +# dashboard_git_url = Custom git clone url +# dashboard_git_branch = Custom remote branch to track +# dashboard_git_crlf = Value of core.autocrlf for repository +# + +# For Makefile generators the script may be executed from an +# environment already configured to use the desired compilers. +# Alternatively the environment may be set at the top of the script: +# +# set(ENV{CC} /path/to/cc) # C compiler +# set(ENV{CXX} /path/to/cxx) # C++ compiler +# set(ENV{FC} /path/to/fc) # Fortran compiler (optional) +# set(ENV{LD_LIBRARY_PATH} /path/to/vendor/lib) # (if necessary) + +set(CTEST_PROJECT_NAME "DILL") +set(CTEST_DROP_SITE "open.cdash.org") +if(NOT dashboard_git_url) + set(dashboard_git_url "https://github.com/GTkorvo/dill.git") +endif() + +if(NOT DEFINED CTEST_TEST_TIMEOUT) + set(CTEST_TEST_TIMEOUT 120) +endif() +if(NOT DEFINED CTEST_SUBMIT_NOTES) + set(CTEST_SUBMIT_NOTES TRUE) +endif() +if(NOT DEFINED dashboard_source_name) + set(dashboard_source_name "dill") +endif() +if(NOT DEFINED dashboard_model) + set(dashboard_model Experimental) +endif() +if(NOT DEFINED dashboard_do_submit) + set(dashboard_do_submit FALSE) +endif() + +# Setup defaults for various CTEST settings +if(NOT DEFINED CTEST_SITE) + cmake_host_system_information(RESULT CTEST_SITE QUERY FQDN) +endif() +if(NOT DEFINED CTEST_BUILD_NAME) + set(CTEST_BUILD_NAME "generic-build") +endif() +if(NOT DEFINED CTEST_SOURCE_DIRECTORY) + set(CTEST_SOURCE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../..) +endif() +if(NOT DEFINED CTEST_BINARY_DIRECTORY) + set(CTEST_BINARY_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CTEST_BUILD_NAME}") +endif() +if(NOT DEFINED CTEST_CMAKE_GENERATOR) + set(CTEST_CMAKE_GENERATOR "Unix Makefiles") +endif() + +list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}") +include(${CMAKE_CURRENT_LIST_DIR}/common.cmake) + +if(CTEST_BUILD_WARNINGS_AS_ERRORS) + if(ctest_build_num_warnings GREATER 0) + message(FATAL_ERROR "Found ${ctest_build_num_warnings} build warnings.") + endif() +endif() diff --git a/thirdparty/dill/dill/tests/CMakeLists.txt b/thirdparty/dill/dill/tests/CMakeLists.txt index 32678ff4ed..8662e65a31 100644 --- a/thirdparty/dill/dill/tests/CMakeLists.txt +++ b/thirdparty/dill/dill/tests/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.8) set(TESTS regress ctest call-test t1 pkg_test) @@ -11,7 +10,7 @@ include_directories(BEFORE add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/regress.c - COMMAND perl -w + COMMAND ${PERL_EXECUTABLE} -w ${CMAKE_CURRENT_SOURCE_DIR}/test-gen ${TEST_PERL_FLAGS} > regress.c MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/test-gen @@ -19,7 +18,7 @@ add_custom_command( add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/call-test.c - COMMAND perl -w + COMMAND ${PERL_EXECUTABLE} -w ${CMAKE_CURRENT_SOURCE_DIR}/call-gen ${TEST_PERL_FLAGS} > call-test.c MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/call-gen ) @@ -29,8 +28,11 @@ foreach(TEST ${TESTS}) add_test(NAME dill_${TEST} COMMAND dill_${TEST} ${TEST_PERL_FLAGS}) endforeach() -target_link_libraries(dill_regress m) -set_target_properties(dill_regress PROPERTIES COMPILE_FLAGS "-O0") +if(NOT (CMAKE_C_COMPILER_ID MATCHES "MSVC" OR + CMAKE_C_SIMULATE_ID MATCHES "MSVC")) + target_link_libraries(dill_regress m) + set_target_properties(dill_regress PROPERTIES COMPILE_FLAGS "-O0") +endif() add_executable(cplus cplus.cc) target_link_libraries(cplus dill ${DIS_LIBS}) diff --git a/thirdparty/dill/dill/tests/call-gen b/thirdparty/dill/dill/tests/call-gen index 89b0df7029..0c8d5da4ed 100644 --- a/thirdparty/dill/dill/tests/call-gen +++ b/thirdparty/dill/dill/tests/call-gen @@ -168,21 +168,15 @@ int main(int argc, char *argv[]) { long s1l, s2l; float s1f, s2f; double s1d, s2d; - char *s1p, *s2p; - int i, max_iters = 10; + int i; int verbose = 0; for (i=1; i < argc; i++) { if (strcmp(argv[i], "-v") == 0) { verbose++; - } else { - max_iters = atoi(argv[i]); } } - s1p = (void *)(long)rand(); - s2p = (void *)(long)rand(); - s1i = rand() - rand(); s2i = rand() - rand(); if(!(s2i = rand() - rand())) diff --git a/thirdparty/dill/dill/tests/stest.c b/thirdparty/dill/dill/tests/stest.c index e4697d34e2..db89d57c2b 100644 --- a/thirdparty/dill/dill/tests/stest.c +++ b/thirdparty/dill/dill/tests/stest.c @@ -6,9 +6,11 @@ #include #endif #ifdef STDC_HEADERS -#include #include #endif +#ifdef HAVE_UNISTD_H +#include +#endif #include "../config.h" #include "dill.h" @@ -120,7 +122,7 @@ int main() { #endif { int size = dill_code_size(s); - static unsigned long ps = -1; + static long ps = -1; if (ps == -1) { ps = (getpagesize ()); } diff --git a/thirdparty/dill/dill/tests/t1.c b/thirdparty/dill/dill/tests/t1.c index 61cb83c24c..ee57b7a3bd 100644 --- a/thirdparty/dill/dill/tests/t1.c +++ b/thirdparty/dill/dill/tests/t1.c @@ -19,6 +19,7 @@ int main(int argc, char **argv) h = dill_finalize(s); func = (int (*)())dill_get_fp(h); if (verbose) dill_dump(s); + fprintf(stderr, "T1, func is %p\n", (void*) func); result = func(); dill_free_handle(h); diff --git a/thirdparty/dill/dill/tests/test-gen b/thirdparty/dill/dill/tests/test-gen index e95f140f19..22c2a134de 100644 --- a/thirdparty/dill/dill/tests/test-gen +++ b/thirdparty/dill/dill/tests/test-gen @@ -1,10 +1,12 @@ $FT = "f"; $DT = "d"; +$MSVC_LONG = 0; while ($_ = $ARGV[0]) { shift; last if /^--$/; if (/^-no_float/) {$FT=""; $DT="";} + if (/^-msvc_long/) {$MSVC_LONG = 1;} } ### BEGIN ### @@ -661,7 +663,7 @@ sub emit_branch { $insn = "$name$t"; $insni = "$insn" . "i"; if ($t eq "p") { - $cast = "(long)"; + $cast = "(IMM_TYPE)"; } else { $cast = ""; } @@ -744,7 +746,7 @@ sub emit_load { $upt = "\U$t\E"; print<= (sizeof(intregs) / sizeof(struct regset))) return 0; if ((type1 == DILL_F) || (type1 == DILL_D)) { *reg1p = floatregs[regpairid].reg1; @@ -1070,8 +1075,8 @@ sub initialize { 'us', '%u', 'i', '%d', 'u', '%u', - 'l', '%ld', - 'ul', '%lu', + 'l', '%zx', + 'ul', '%zx', 'p', '%p', 'f', '%g', 'd', '%g' @@ -1084,8 +1089,8 @@ sub initialize { 'us', '%x', 'i', '%x', 'u', '%x', - 'l', '%lx', - 'ul', '%lx', + 'l', '%zx', + 'ul', '%zu', 'p', '%p', 'f', '%g', 'd', '%g' @@ -1098,8 +1103,8 @@ sub initialize { "s", "short", "u", "unsigned", "i", "int", - "l", "long", - "ul", "unsigned long", + "l", "IMM_TYPE", + "ul", "UIMM_TYPE", "p", "void *", "f", "float", "d", "double", diff --git a/thirdparty/dill/dill/virtual.c b/thirdparty/dill/dill/virtual.c index b0316b13cf..312799e61a 100644 --- a/thirdparty/dill/dill/virtual.c +++ b/thirdparty/dill/dill/virtual.c @@ -7,6 +7,7 @@ #ifndef LINUX_KERNEL_MODULE #include #include +#include #include #ifdef HAVE_MALLOC_H #include @@ -62,7 +63,7 @@ virtual_print_insn(dill_stream c, void *info_ptr, void *i) OPND(insn->opnds.a3.src2)); break; case iclass_arith3i: - printf("%si %c%d, %c%d, %ld", arith3_name[insn_code], + printf("%si %c%d, %c%d, %zu", arith3_name[insn_code], OPND(insn->opnds.a3i.dest), OPND(insn->opnds.a3i.src), insn->opnds.a3i.u.imm); break; @@ -95,7 +96,7 @@ virtual_print_insn(dill_stream c, void *info_ptr, void *i) int typ = insn->insn_code & 0xf; int store = (insn->insn_code & 0x10) == 0x10; int bswap = (insn->insn_code & 0x20) == 0x20; - printf("%s%s%si %c%d, %c%d, %ld", bswap ? "bs" : "", + printf("%s%s%si %c%d, %c%d, %zu", bswap ? "bs" : "", store == 0 ? "ld" : "st", dill_type_names[typ], OPND(insn->opnds.a3i.dest), OPND(insn->opnds.a3i.src), insn->opnds.a3i.u.imm); @@ -103,14 +104,14 @@ virtual_print_insn(dill_stream c, void *info_ptr, void *i) } case iclass_lea: { - printf("lea %c%d, %c%d, %ld", OPND(insn->opnds.a3i.dest), + printf("lea %c%d, %c%d, %zx", OPND(insn->opnds.a3i.dest), OPND(insn->opnds.a3i.src), insn->opnds.a3i.u.imm); break; } case iclass_set: { int typ = insn->insn_code & 0xf; - printf("set%s %c%d, %ld", + printf("set%s %c%d, %zx", dill_type_names[typ], OPND(insn->opnds.a3i.dest), insn->opnds.a3i.u.imm); break; @@ -139,7 +140,7 @@ virtual_print_insn(dill_stream c, void *info_ptr, void *i) case iclass_reti: { int typ = insn->insn_code & 0xf; - printf("ret%si %ld", + printf("ret%si %zu", dill_type_names[typ], insn->opnds.a3i.u.imm); break; } @@ -175,9 +176,9 @@ virtual_print_insn(dill_stream c, void *info_ptr, void *i) { int br_op = insn->insn_code; struct branch_table *t = &c->p->branch_table; - printf("b%si %c%d, %ld, L%d", branch_op_names[br_op], + printf("b%si %c%d, %p, L%d", branch_op_names[br_op], OPND(insn->opnds.bri.src), - insn->opnds.bri.imm_l, insn->opnds.bri.label); + (void*)insn->opnds.bri.imm_l, insn->opnds.bri.label); if (t->label_name[insn->opnds.bri.label] != NULL) { printf("<%s>", t->label_name[insn->opnds.bri.label]); } @@ -230,8 +231,8 @@ virtual_print_insn(dill_stream c, void *info_ptr, void *i) int reg = insn->insn_code & 0x10; if (typ != DILL_V) { if (reg != 0) { - printf("call%s R%ld, %c%d", dill_type_names[typ], - insn->opnds.calli.imm_l, OPND(insn->opnds.calli.src)); + printf("call%s R%p, %c%d", dill_type_names[typ], + (void*)insn->opnds.calli.imm_l, OPND(insn->opnds.calli.src)); } else { const char *call_name = insn->opnds.calli.xfer_name; if (call_name) { @@ -245,8 +246,8 @@ virtual_print_insn(dill_stream c, void *info_ptr, void *i) } } else { if (reg != 0) { - printf("call%s R%ld", dill_type_names[typ], - insn->opnds.calli.imm_l); + printf("call%s R%p", dill_type_names[typ], + (void*)insn->opnds.calli.imm_l); } else { const char *call_name = insn->opnds.calli.xfer_name; if (call_name) { @@ -282,7 +283,7 @@ virtual_print_insn(dill_stream c, void *info_ptr, void *i) if (typ == DILL_P) { printf("push%si 0x%p", dill_type_names[typ], insn->opnds.a3i.u.imm_a); } else { - printf("push%si 0x%lx", dill_type_names[typ], insn->opnds.a3i.u.imm); + printf("push%si 0x%zx", dill_type_names[typ], insn->opnds.a3i.u.imm); } break; } @@ -310,17 +311,13 @@ insn_same_except_dest(virtual_insn *i, virtual_insn *j) case iclass_compare: return ((icode == jcode) && (i->opnds.a3.src1 == j->opnds.a3.src1) && (i->opnds.a3.src2 == j->opnds.a3.src2)); - break; case iclass_arith3i: return ((icode == jcode) && (i->opnds.a3i.src == j->opnds.a3i.src) && (i->opnds.a3i.u.imm == j->opnds.a3i.u.imm)); - break; case iclass_arith2: return ((icode == jcode) && (i->opnds.a2.src == j->opnds.a2.src)); - break; case iclass_convert: return ((icode == jcode) && (i->opnds.a2.src == j->opnds.a2.src)); - break; case iclass_loadstore: return ((icode == jcode) && (i->opnds.a3.src1 == j->opnds.a3.src1) && (i->opnds.a3.src2 == j->opnds.a3.src2)); @@ -827,7 +824,7 @@ insn_uses(virtual_insn *insn, int *used) case iclass_call: { int reg = insn->insn_code & 0x10; if (reg != 0) { - long imm = insn->opnds.calli.imm_l; + long imm = (long) insn->opnds.calli.imm_l; int src1_vreg = imm; used[0] = src1_vreg; } @@ -1009,7 +1006,7 @@ insn_use_test(virtual_insn *insn, int vreg) case iclass_call:{ int reg = insn->insn_code & 0x10; if (reg != 0) { - long imm = insn->opnds.calli.imm_l; + long imm = (long) insn->opnds.calli.imm_l; int src1_vreg = imm; if (vreg == src1_vreg) return 1; } @@ -1179,12 +1176,11 @@ build_bbs(dill_stream c, void *vinsns, void *prefix_begin, void *code_end) { virtual_mach_info vmi = (virtual_mach_info)c->p->mach_info; basic_block bb; - int i; virtual_insn *insn, *insns = vinsns; vmi->bbcount = 0; vmi->bblist = malloc(sizeof(struct basic_block)); - i = 0; + size_t i = 0; bb = vmi->bblist; bb->start = 0; bb->label = -1; @@ -1359,7 +1355,7 @@ do_use_def_count(dill_stream c, basic_block bb, virtual_insn *insns, int loc) set_defined(c, insn->opnds.calli.src); } if (reg != 0) { - long imm = insn->opnds.calli.imm_l; + long imm = (long)insn->opnds.calli.imm_l; int src1_vreg = imm; set_used(c, src1_vreg); } @@ -1950,7 +1946,7 @@ emit_insns(dill_stream c, void *insns, label_translation_table ltable, /* arith 3 immediate operand integer insns */ int dest_vreg = ip->opnds.a3i.dest; int src_vreg = ip->opnds.a3i.src; - long imm = ip->opnds.a3i.u.imm; + intptr_t imm = ip->opnds.a3i.u.imm; int dest_preg = preg_of(c, bb, dest_vreg); int src_preg = preg_of(c, bb, src_vreg); int insn_code = ip->insn_code; @@ -2117,7 +2113,7 @@ emit_insns(dill_stream c, void *insns, label_translation_table ltable, /* load effective address */ int dest_vreg = ip->opnds.a3i.dest; int src_vreg = ip->opnds.a3i.src; - long imm = ip->opnds.a3i.u.imm; + intptr_t imm = ip->opnds.a3i.u.imm; int dest_preg = preg_of(c, bb, dest_vreg); int src_preg = preg_of(c, bb, src_vreg); if (src_preg == -1) { @@ -2154,7 +2150,7 @@ emit_insns(dill_stream c, void *insns, label_translation_table ltable, /* load store immediate operand integer insns */ int dest_vreg = ip->opnds.a3i.dest; int src_vreg = ip->opnds.a3i.src; - long imm = ip->opnds.a3i.u.imm; + intptr_t imm = ip->opnds.a3i.u.imm; int dest_preg = preg_of(c, bb, dest_vreg); int src_preg = preg_of(c, bb, src_vreg); int store = ((ip->insn_code & 0x10) == 0x10); @@ -2206,7 +2202,7 @@ emit_insns(dill_stream c, void *insns, label_translation_table ltable, { /* load store immediate operand integer insns */ int dest_vreg = ip->opnds.a3i.dest; - long imm = ip->opnds.a3i.u.imm; + intptr_t imm = ip->opnds.a3i.u.imm; int dest_preg = preg_of(c, bb, dest_vreg); int typ = ip->insn_code & 0xf; if (dest_preg == -1) { @@ -2283,7 +2279,7 @@ emit_insns(dill_stream c, void *insns, label_translation_table ltable, case iclass_reti: { /* return immediate integer insns */ - long imm = ip->opnds.a3i.u.imm; + intptr_t imm = ip->opnds.a3i.u.imm; int typ = ip->insn_code & 0xf; ( c->j->reti)(c, typ, 0, imm); last_dest_vreg = -1; @@ -2337,7 +2333,7 @@ emit_insns(dill_stream c, void *insns, label_translation_table ltable, int br_op = ip->insn_code; int label = get_new_label(ip->opnds.bri.label, ltable); int src1_vreg = ip->opnds.bri.src; - long imm = ip->opnds.bri.imm_l; + intptr_t imm = ip->opnds.bri.imm_l; int src1_preg = preg_of(c, bb, src1_vreg); if (src1_preg == -1) { /* load src1 */ @@ -2415,7 +2411,7 @@ emit_insns(dill_stream c, void *insns, label_translation_table ltable, if (typ != DILL_V) dest_preg = preg_of(c, next_bb, dest_vreg); if (reg != 0) { - int src1_vreg = ip->opnds.calli.imm_l; + intptr_t src1_vreg = ip->opnds.calli.imm_l; int src1_preg = preg_of(c, bb, src1_vreg); if (src1_preg == -1) { /* load src1 */ @@ -2495,7 +2491,7 @@ emit_insns(dill_stream c, void *insns, label_translation_table ltable, void *imm = ip->opnds.a3i.u.imm_a; dill_push_argpi(c, imm); } else { - long imm = ip->opnds.a3i.u.imm; + intptr_t imm = ip->opnds.a3i.u.imm; dill_push_argii(c, imm); } last_dest_vreg = -1; @@ -2563,7 +2559,7 @@ static void put_tentative_assigns(dill_stream c, int preg_assigned, bit_vec vec, int typ) { foreach_bit(vec, (bv_func) put_unless, c, - (void*)(long)((preg_assigned&0xffffff) | (long)typ<<24)); + (void*)(intptr_t)((preg_assigned&0xffffff) | (intptr_t)typ<<24)); } typedef struct reg_state { @@ -3180,7 +3176,7 @@ new_emit_insns(dill_stream c, void *insns, label_translation_table ltable, } break; case iclass_lea: { - int offset = ip->opnds.a3i.u.imm + offset_of(c, vused[0]); + int offset = (int) ip->opnds.a3i.u.imm + offset_of(c, vused[0]); int add_code = dill_jmp_addp; if (offset == 0) { c->j->mov(c, DILL_P, 0, pdest, dill_lp(c)); @@ -3242,7 +3238,7 @@ new_emit_insns(dill_stream c, void *insns, label_translation_table ltable, /* branch immediate */ int br_op = ip->insn_code; int label = get_new_label(ip->opnds.bri.label, ltable); - long imm = ip->opnds.bri.imm_l; + intptr_t imm = ip->opnds.bri.imm_l; ( c->j->jmp_bi)[br_op](c, c->j->b_data[br_op].data1, c->j->b_data[br_op].data2, pused[0], imm, label); @@ -3297,7 +3293,7 @@ new_emit_insns(dill_stream c, void *insns, label_translation_table ltable, void *imm = ip->opnds.a3i.u.imm_a; dill_push_argpi(c, imm); } else { - long imm = ip->opnds.a3i.u.imm; + intptr_t imm = ip->opnds.a3i.u.imm; dill_push_argii(c, imm); } break; @@ -3378,7 +3374,7 @@ const_prop_ip(dill_stream c, basic_block bb, virtual_insn *ip, virtual_insn *set int set_typ = set_ip->insn_code & 0xf; int found = 0; union { - long imm; + intptr_t imm; char *imm_a; } set; set.imm = set_ip->opnds.a3i.u.imm; @@ -3471,7 +3467,7 @@ const_prop_ip(dill_stream c, basic_block bb, virtual_insn *ip, virtual_insn *set int src_vreg = ip->opnds.a3i.src; int insn_code = ip->insn_code; union { - long imm; + intptr_t imm; char *imm_a; } u; u.imm = ip->opnds.a3i.u.imm; @@ -3806,14 +3802,17 @@ is_convert_noop(int insn_code) int to_type = insn_code & 0xf; /* GSE -bug This test should be for *generated* target, not host */ - if (sizeof(long) != sizeof(int)) return 0; - switch(from_type) { - case DILL_I: case DILL_U: - case DILL_L: case DILL_UL: - switch(to_type) { + if (sizeof(long) != sizeof(int)) { + return 0; + } else { + switch(from_type) { case DILL_I: case DILL_U: case DILL_L: case DILL_UL: - return 1; + switch(to_type) { + case DILL_I: case DILL_U: + case DILL_L: case DILL_UL: + return 1; + } } } return 0; @@ -4311,7 +4310,7 @@ extern void dill_begin_prefix_code(dill_stream s) assert(s->j->proc_start == (dill_mach_proc_start)virtual_proc_start); /* insert a return, so we don't fall into prefix code */ virtual_reti(s, DILL_I, 0, 0); - vmi->prefix_code_start = (s->p->cur_ip - s->p->code_base) / sizeof(virtual_insn); + vmi->prefix_code_start = (int) (s->p->cur_ip - s->p->code_base) / sizeof(virtual_insn); } static dill_foreign_cg_func dill_foreign_cg = NULL; @@ -4445,20 +4444,20 @@ virtual_do_end(dill_stream s, int package) } } -EXTERN void +extern void virtual_end(dill_stream c) { virtual_do_end(c, 0 /* package */); } -EXTERN void +extern void virtual_package_end(dill_stream c) { virtual_do_end(c, 1 /* package */); } -EXTERN dill_exec_ctx +extern dill_exec_ctx dill_get_exec_context(dill_stream c) { dill_exec_ctx ec = malloc(sizeof(struct dec)); @@ -4489,7 +4488,7 @@ dill_get_exec_context(dill_stream c) return ec; } -EXTERN void +extern void dill_free_exec_context(dill_exec_ctx ec) { if (ec->r) free(ec->r); @@ -4499,8 +4498,8 @@ dill_free_exec_context(dill_exec_ctx ec) free(ec); } -EXTERN void -dill_assoc_client_data(dill_exec_ctx ec, int key, long value) +extern void +dill_assoc_client_data(dill_exec_ctx ec, int key, IMM_TYPE value) { int i = 0; for (i=0; i < ec->client_data_count; i++) { @@ -4519,7 +4518,7 @@ dill_assoc_client_data(dill_exec_ctx ec, int key, long value) ec->client_data[ec->client_data_count++].value = value; } -EXTERN long +extern IMM_TYPE dill_get_client_data(dill_exec_ctx ec, int key) { int i = 0; diff --git a/thirdparty/dill/dill/virtual.h b/thirdparty/dill/dill/virtual.h index bc75e264be..910b4b3c94 100644 --- a/thirdparty/dill/dill/virtual.h +++ b/thirdparty/dill/dill/virtual.h @@ -5,7 +5,7 @@ if ((((char*)c->p->cur_ip) + sizeof(virtual_insn)) >= (char*)c->p->code_limit) { }\ *(virtual_insn*)c->p->cur_ip = i;\ if (c->dill_debug) {\ -printf("%lx -- ", (unsigned long)c->p->cur_ip);\ +printf("%p -- ", c->p->cur_ip);\ virtual_print_insn(c, NULL, c->p->cur_ip);\ printf("\n");}\ c->p->cur_ip = ((char*)c->p->cur_ip)+ sizeof(virtual_insn) diff --git a/thirdparty/dill/dill/virtual.ops b/thirdparty/dill/dill/virtual.ops index 987451ab50..bdac2355f3 100644 --- a/thirdparty/dill/dill/virtual.ops +++ b/thirdparty/dill/dill/virtual.ops @@ -33,7 +33,7 @@ sub upperc { print VMOUT "void emulate_arith3(int code, struct reg_type *dest, struct reg_type *src1, struct reg_type *src2)\n"; print VMOUT "{\n switch(code) {\n$vm_a3_code }\n}\n"; -print VMOUT "void emulate_arith3i(int code, struct reg_type *dest, struct reg_type *src1, long imm)\n"; +print VMOUT "void emulate_arith3i(int code, struct reg_type *dest, struct reg_type *src1, IMM_TYPE imm)\n"; print VMOUT "{\n switch(code) {\n$vm_a3i_code }\n}\n"; print VMOUT "void emulate_arith2(int code, struct reg_type *dest, struct reg_type *src)\n"; print VMOUT "{\n switch(code) {\n$vm_a2_code }\n}\n"; @@ -41,16 +41,16 @@ print VMOUT "int emulate_branch(int code, struct reg_type *src1, struct reg_type print VMOUT "{\n switch(code) {\n$vm_br_code }return 0;\n}\n"; print VMOUT "int emulate_compare(int code, struct reg_type *src1, struct reg_type *src2)\n"; print VMOUT "{\n switch(code) {\n$vm_c_code }return 0;\n}\n"; -print VMOUT "int emulate_branchi(int code, struct reg_type *src1, long imm)\n"; +print VMOUT "int emulate_branchi(int code, struct reg_type *src1, IMM_TYPE imm)\n"; print VMOUT "{\n switch(code) {\n$vm_bri_code }return 0;\n}\n"; print VMOUT "#define CONV(x,y) ((x<<4)+y)\n"; print VMOUT "void emulate_convert(int code, struct reg_type *dest, struct reg_type *src)\n"; print VMOUT "{\n switch(code) {\n$vm_cvt_code default: printf(\"convert missed case %x \\n\", code); break;}\n}\n"; -print VMOUT "int emulate_loadi(int code, struct reg_type *dest, struct reg_type *src, long imm)\n"; +print VMOUT "int emulate_loadi(int code, struct reg_type *dest, struct reg_type *src, IMM_TYPE imm)\n"; print VMOUT "{\n switch(code) {\n$vm_loadi_code default: printf(\"loadi missed case %x \\n\", code); break;}return 0;\n}\n"; -print VMOUT "int emulate_storei(int code, struct reg_type *dest, struct reg_type *src, long imm)\n"; +print VMOUT "int emulate_storei(int code, struct reg_type *dest, struct reg_type *src, IMM_TYPE imm)\n"; print VMOUT "{\n switch(code) {\n$vm_storei_code }return 0;\n}\n"; print COUT "DECLARE_JUMP_TABLE(${mach});\n"; @@ -147,7 +147,7 @@ EOF sub arith_insn { %src1_cast = ('p', '(char*)'); -%src2_cast = ('p', '(long)'); +%src2_cast = ('p', '(IMM_TYPE)'); local ($ops, $type_list, $subr) = @_; foreach(split(' ', $ops)) { $op = $_; @@ -214,7 +214,7 @@ sub branchi_insn { $c_op = $c_operations{$op}; foreach (split(' ', $types)) { $jmp_b_assigns = $jmp_b_assigns . "\t ${mach}_jump_table->jmp_bi[dill_jmp_b${op}${_}] = $subr;\n"; - $vm_bri_code .= "\t case dill_jmp_b${op}${_}: return ($src1_cast{$_} src1->u.${_}.${_}) $c_op $src1_cast{$_} imm; break;\n"; + $vm_bri_code .= "\t case dill_jmp_b${op}${_}: return ($src1_cast{$_} src1->u.${_}.${_}) $c_op $src1_cast{$_} imm;\n"; } } } @@ -236,8 +236,8 @@ sub compare_insn { sub convert { local($from_types, $to_types) = @_; - %src_cast = ('pul', '(long)', 'ulp', '(void*)'); - %convert_right = ('c', 'src->u.c.c', 's', '((short)(0xffff & src->u.s.s))', 'i', '((int)(0xffffffff & src->u.i.i))', 'uc', '((unsigned char)(0xff & src->u.uc.uc))', 'us', '((unsigned short)(0xffff & src->u.us.us))', 'u', '((unsigned int)(0xffffffff & src->u.u.u))', 'l', 'src->u.l.l', 'ul', '(unsigned long)src->u.ul.ul', 'd', 'src->u.d.d', 'f', 'src->u.f.f', 'p', 'src->u.l.l'); + %src_cast = ('pul', '(IMM_TYPE)', 'ulp', '(void*)'); + %convert_right = ('c', 'src->u.c.c', 's', '((short)(0xffff & src->u.s.s))', 'i', '((int)(0xffffffff & src->u.i.i))', 'uc', '((unsigned char)(0xff & src->u.uc.uc))', 'us', '((unsigned short)(0xffff & src->u.us.us))', 'u', '((unsigned int)(0xffffffff & src->u.u.u))', 'l', 'src->u.l.l', 'ul', '(UIMM_TYPE)src->u.ul.ul', 'd', 'src->u.d.d', 'f', 'src->u.f.f', 'p', 'src->u.l.l'); foreach (split(' ', $from_types)) { $from = $_; foreach (split(' ', $to_types)) { @@ -253,12 +253,12 @@ sub convert { sub load_store { local($types) = @_; - %load_store = ('c', '*((char*)(src->u.l.l + imm))', 's', '*((short*)(src->u.l.l + imm))', 'i', '*((int*)(src->u.l.l + imm))', 'uc', '*((unsigned char*)(src->u.l.l + imm))', 'us', '*((unsigned short *)(src->u.l.l + imm))', 'u', '*((unsigned int *)(src->u.l.l + imm))', 'l', '*((long*)(src->u.l.l + imm))', 'ul', '*((unsigned long *)(src->u.l.l + imm))', 'd', '*((double*)(src->u.l.l + imm))', 'f', '*((float*)(src->u.l.l + imm))', 'p', '*((void**)(src->u.l.l + imm))'); + %load_store = ('c', '*((char*)(src->u.l.l + imm))', 's', '*((short*)(src->u.l.l + imm))', 'i', '*((int*)(src->u.l.l + imm))', 'uc', '*((unsigned char*)(src->u.l.l + imm))', 'us', '*((unsigned short *)(src->u.l.l + imm))', 'u', '*((unsigned int *)(src->u.l.l + imm))', 'l', '*((IMM_TYPE*)(src->u.l.l + imm))', 'ul', '*((UIMM_TYPE *)(src->u.l.l + imm))', 'd', '*((double*)(src->u.l.l + imm))', 'f', '*((float*)(src->u.l.l + imm))', 'p', '*((void**)((char*)src->u.p.p + imm))'); foreach (split(' ', $types)) { if (($_ eq 'f') || ($_ eq 'd')) { $vm_loadi_code .= "\tcase DILL_" . &upperc(${_}). ": dest->u.${_}.${_} = $load_store{$_}; break;\n"; } else { - $vm_loadi_code .= "\tcase DILL_" . &upperc(${_}). ": dest->u.l.l = (long) $load_store{$_}; break;\n"; + $vm_loadi_code .= "\tcase DILL_" . &upperc(${_}). ": dest->u.l.l = (IMM_TYPE) $load_store{$_}; break;\n"; } $vm_storei_code .= "\tcase DILL_" . &upperc(${_}). ": $load_store{$_} = dest->u.${_}.${_}; break;\n"; } @@ -283,6 +283,7 @@ print COUT< #include +#include #include #ifdef HAVE_MALLOC_H #include @@ -333,7 +334,7 @@ virtual_compare(dill_stream s, int op, int junk, int dest, int src1, int src2) } static void -dill_varith3i(dill_stream s, int op3, int op, int dest, int src1, long imm) +dill_varith3i(dill_stream s, int op3, int op, int dest, int src1, IMM_TYPE imm) { virtual_insn i; i.class_code = iclass_arith3i; @@ -390,7 +391,7 @@ virtual_load(dill_stream s, int type, int junk, int dest, int src1, int src2) } extern void -virtual_loadi(dill_stream s, int type, int junk, int dest, int src1, long imm) +virtual_loadi(dill_stream s, int type, int junk, int dest, int src1, IMM_TYPE imm) { virtual_insn i; i.class_code = iclass_loadstorei; @@ -414,7 +415,7 @@ virtual_pbsload(dill_stream s, int type, int junk, int dest, int src1, int src2) } extern void -virtual_pbsloadi(dill_stream s, int type, int junk, int dest, int src1, long imm) +virtual_pbsloadi(dill_stream s, int type, int junk, int dest, int src1, IMM_TYPE imm) { virtual_insn i; i.class_code = iclass_loadstorei; @@ -438,7 +439,7 @@ virtual_store(dill_stream s, int type, int junk, int dest, int src1, int src2) } extern void -virtual_storei(dill_stream s, int type, int junk, int dest, int src1, long imm) +virtual_storei(dill_stream s, int type, int junk, int dest, int src1, IMM_TYPE imm) { virtual_insn i; i.class_code = iclass_loadstorei; @@ -461,7 +462,7 @@ virtual_mov(dill_stream s, int type, int junk, int dest, int src) } extern void -virtual_pset(dill_stream s, int type, int junk, int dest, long imm) +virtual_pset(dill_stream s, int type, int junk, int dest, IMM_TYPE imm) { virtual_insn i; i.class_code = iclass_set; @@ -494,7 +495,7 @@ virtual_setf(dill_stream s, int type, int junk, int dest, double imm) } extern void -virtual_reti(dill_stream s, int type, int junk, long imm) +virtual_reti(dill_stream s, int type, int junk, IMM_TYPE imm) { virtual_insn i; i.class_code = iclass_reti; @@ -527,7 +528,7 @@ virtual_mark_label(dill_stream s, int op, int type, int src1, int src2, int labe } static void -virtual_branchi(dill_stream s, int op, int type, int src, long imm, int label) +virtual_branchi(dill_stream s, int op, int type, int src, IMM_TYPE imm, int label) { virtual_insn i; i.class_code = iclass_branchi; @@ -600,7 +601,7 @@ extern void virtual_push(dill_stream s, int type, int reg) INSN_OUT(s, i); } -extern void virtual_pushi(dill_stream s, int type, long value) +extern void virtual_pushi(dill_stream s, int type, IMM_TYPE value) { virtual_insn i; i.class_code = iclass_pushi; @@ -628,7 +629,7 @@ extern void virtual_pushfi(dill_stream s, int type, double value) } extern void virtual_lea(dill_stream s, int junk1, int junk2, int dest, int src, - long imm) + IMM_TYPE imm) { virtual_insn i; i.class_code = iclass_lea; @@ -639,7 +640,7 @@ extern void virtual_lea(dill_stream s, int junk1, int junk2, int dest, int src, INSN_OUT(s, i); } -extern void virtual_special(dill_stream s, special_operations type, long param) +extern void virtual_special(dill_stream s, special_operations type, IMM_TYPE param) { virtual_insn i; i.class_code = iclass_special; @@ -662,8 +663,8 @@ int virtual_type_align[] = { 2, /* US */ 4, /* I */ 4, /* U */ - sizeof(unsigned long), /* UL */ - sizeof(long), /* L */ + sizeof(uintptr_t), /* UL */ + sizeof(intptr_t), /* L */ sizeof(char*), /* P */ 4, /* F */ 8, /* D */ @@ -679,8 +680,8 @@ int virtual_type_size[] = { 2, /* US */ 4, /* I */ 4, /* U */ - sizeof(unsigned long), /* UL */ - sizeof(long), /* L */ + sizeof(uintptr_t), /* UL */ + sizeof(intptr_t), /* L */ sizeof(char*), /* P */ sizeof(float), /* F */ sizeof(double), /* D */ diff --git a/thirdparty/dill/dill/vm.c b/thirdparty/dill/dill/vm.c index fa8a9f8fd6..a16bf4e543 100644 --- a/thirdparty/dill/dill/vm.c +++ b/thirdparty/dill/dill/vm.c @@ -4,6 +4,7 @@ #include "virtual.h" #undef NDEBUG #include "assert.h" +#include #include #ifdef HAVE_MALLOC_H #include diff --git a/thirdparty/dill/dill/vtests/CMakeLists.txt b/thirdparty/dill/dill/vtests/CMakeLists.txt index 1724f4be2a..fc3b74d67e 100644 --- a/thirdparty/dill/dill/vtests/CMakeLists.txt +++ b/thirdparty/dill/dill/vtests/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.8) set(TESTS basic_call general t1 opt branch prefix_test) @@ -14,7 +13,7 @@ include_directories(BEFORE add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/general.c - COMMAND perl ${CMAKE_CURRENT_SOURCE_DIR}/general.ops + COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/general.ops MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/general.ops ) @@ -24,7 +23,10 @@ foreach(TEST ${TESTS}) add_test(NAME vtest_${TEST} COMMAND v${TEST}) endforeach() -set_target_properties(vgeneral PROPERTIES LINKER_LANGUAGE C COMPILE_FLAGS "-O0") +if(NOT (CMAKE_C_COMPILER_ID MATCHES "MSVC" OR + CMAKE_C_SIMULATE_ID MATCHES "MSVC")) + set_target_properties(vgeneral PROPERTIES LINKER_LANGUAGE C COMPILE_FLAGS "-O0") +ENDIF() set_tests_properties(vtest_basic_call PROPERTIES PASS_REGULAR_EXPRESSION "########## A diff --git a/thirdparty/dill/dill/vtests/basic_call.c b/thirdparty/dill/dill/vtests/basic_call.c index c3d2a44cac..124b8d2198 100644 --- a/thirdparty/dill/dill/vtests/basic_call.c +++ b/thirdparty/dill/dill/vtests/basic_call.c @@ -117,7 +117,7 @@ void b () { if (verbose) dill_dump(s); - printf("**3=%d\n", (*(int (*)(int, int))(long)((*pp)()))(1,2)); + printf("**3=%d\n", (*(int (*)(int, int))(IMM_TYPE)((*pp)()))(1,2)); dill_free_handle(h); dill_free_stream(s); } diff --git a/thirdparty/dill/dill/vtests/general.ops b/thirdparty/dill/dill/vtests/general.ops index 2359f944dc..e7e6713762 100644 --- a/thirdparty/dill/dill/vtests/general.ops +++ b/thirdparty/dill/dill/vtests/general.ops @@ -5,12 +5,13 @@ sub upperc { return $_; } -%c_types = ('c', 'signed char', 'uc', 'unsigned char', 's', 'short', 'us', 'unsigned short', 'i', 'int', 'u', 'unsigned int', 'l', 'long', 'ul', 'unsigned long', 'p', 'char*', 'f', 'float', 'd', 'double'); +%c_types = ('c', 'signed char', 'uc', 'unsigned char', 's', 'short', 'us', 'unsigned short', 'i', 'int', 'u', 'unsigned int', 'l', 'IMM_TYPE', 'ul', 'UIMM_TYPE', 'p', 'char*', 'f', 'float', 'd', 'double'); +%c_arg_types = ('c', 'signed int', 'uc', 'unsigned int', 's', 'signed int', 'us', 'unsigned int', 'i', 'int', 'u', 'unsigned int', 'l', 'IMM_TYPE', 'ul', 'UIMM_TYPE', 'p', 'char*', 'f', 'float', 'd', 'double'); %rand_types = ('c', 'l', 'uc', 'l', 's', 'l', 'us', 'l', 'i', 'l', 'u', 'l', 'l', 'l', 'ul', 'l', 'p', '(char *)l', 'f', 'd', 'd', 'd'); -%c_print_formats = ('c', '%d', 'uc', '%u', 's', '%d', 'us', '%u', 'i', '%d', 'u', '%u', 'l', '%ld', 'ul', '%lu', 'p', '%lx', 'f', '%g', 'd', '%g'); +%c_print_formats = ('c', '%d', 'uc', '%u', 's', '%d', 'us', '%u', 'i', '%d', 'u', '%u', 'l', '%zx', 'ul', '%zu', 'p', '%p', 'f', '%g', 'd', '%g'); %drisc_arg_formats = ('c', '%i', 'uc', '%u', 's', '%i', 'us', '%u', 'i', '%i', 'u', '%u', 'l', '%l', 'ul', '%ul', 'p', '%p', 'f', '%f', 'd', '%d'); -%print_cast = ('p', '(long)'); +%print_cast = ('p', '(void*)'); $FT = "f"; $DT = "d"; @@ -88,7 +89,7 @@ sub arith_insn { $div_label = "skip$skip_count: ;\n"; $skip_count++; } elsif (($dill_op eq "rsh") || ($dill_op eq "lsh")) { - $div_continue = "if (source2_$_ >= sizeof(long)) goto skip$skip_count;"; + $div_continue = "if (source2_$_ >= sizeof(IMM_TYPE)) goto skip$skip_count;"; $div_label = "skip$skip_count: ;\n"; $skip_count++; } else { @@ -183,10 +184,10 @@ sub arithp_insn { if (defined($c_src2_values{"addl"})) { $vals = $c_src2_values{'addl'}; print COUT " for (j=0 ; j < sizeof($vals)/sizeof($vals\[0\]) ; j++) {\n"; - print COUT " long source2_l = $vals\[j\];\n"; + print COUT " IMM_TYPE source2_l = $vals\[j\];\n"; } else { print COUT " {\n"; - print COUT " long source2_l = rand2_$_;\n"; + print COUT " IMM_TYPE source2_l = rand2_$_;\n"; } # print COUT "# line ". (__LINE__ + 2) . " \"general.ops\"\n"; print COUT< +#endif -#ifdef HAVE_WINDOWS_H +#ifdef _MSC_VER +#include #define srand48(s) srand(s) -#define drand48() (((double)rand())/((double)RAND_MAX)) -#define lrand48() rand() +#define drand48() (rand()*(1./RAND_MAX)) +#define lrand48() ((long long)rand() << 32 | rand()) #define kill(x,y) #else extern double drand48(); -extern long lrand48(); -void srand48(long seedval); +extern IMM_TYPE lrand48(); +void srand48(IMM_TYPE seedval); #endif int @@ -1088,7 +1097,7 @@ EOF } print COUT " 63};\n\n"; - print COUT " unsigned long bit_pattern_vals[] = {"; + print COUT " UIMM_TYPE bit_pattern_vals[] = {"; for (0..31) { printf COUT " 0x%x, 0x%x, ",(1<<$_), ((1<<$_) - 1); } @@ -1130,6 +1139,13 @@ EOF print COUT< 1) verbose++; EOF %c_src2_values = ("rshi", "sh_src2_vals", "rshl", "sh_src2_vals", diff --git a/thirdparty/dill/dill/vtests/multi_test.c b/thirdparty/dill/dill/vtests/multi_test.c index ebdecb36ef..b8d6071cbc 100644 --- a/thirdparty/dill/dill/vtests/multi_test.c +++ b/thirdparty/dill/dill/vtests/multi_test.c @@ -1,9 +1,10 @@ -#include #include #include "dill.h" #include #include +#define assert(EX) ((EX) ? (void)0 : (fprintf(stderr, "\"%s\" failed, file %s, line %d\n", #EX, __FILE__, __LINE__), exit(1))) + int main(int argc, char **argv) { int verbose = 0; diff --git a/thirdparty/dill/dill/vtests/opt.c b/thirdparty/dill/dill/vtests/opt.c index c1c0cd51e6..ea781dabba 100644 --- a/thirdparty/dill/dill/vtests/opt.c +++ b/thirdparty/dill/dill/vtests/opt.c @@ -4,7 +4,9 @@ #include "malloc.h" #endif #include +#ifdef HAVE_UNISTD_H #include "unistd.h" +#endif #include "dill.h" #ifdef USE_MMAP_CODE_SEG diff --git a/thirdparty/dill/dill/vtests/pkg_test.c b/thirdparty/dill/dill/vtests/pkg_test.c index 6976bde94b..09912ce1f5 100644 --- a/thirdparty/dill/dill/vtests/pkg_test.c +++ b/thirdparty/dill/dill/vtests/pkg_test.c @@ -1,4 +1,3 @@ -#include #include #include "dill.h" #include diff --git a/thirdparty/dill/dill/vtests/t1.c b/thirdparty/dill/dill/vtests/t1.c index 0fa6a960a0..fb329d0b3f 100644 --- a/thirdparty/dill/dill/vtests/t1.c +++ b/thirdparty/dill/dill/vtests/t1.c @@ -4,7 +4,9 @@ #include "malloc.h" #endif #include +#ifdef HAVE_UNISTD_H #include "unistd.h" +#endif #include "dill.h" #ifdef USE_MMAP_CODE_SEG @@ -16,7 +18,7 @@ static int verbose = 0; void a () { dill_stream s = dill_create_stream(); char *target; - dill_reg a,b,p3,d,e,f,g,h,i,j,w,z; + dill_reg a,b,p3,d,e,f; dill_exec_ctx ec; dill_exec_handle handle; int (*ip)(); @@ -29,12 +31,6 @@ void a () { d = dill_getreg(s, DILL_I); e = dill_getreg(s, DILL_I); f = dill_getreg(s, DILL_I); - g = dill_getreg(s, DILL_I); - h = dill_getreg(s, DILL_I); - i = dill_getreg(s, DILL_I); - j = dill_getreg(s, DILL_I); - z = dill_getreg(s, DILL_I); - w = dill_getreg(s, DILL_I); dill_addii(s, p3, a, 5); dill_addi(s, d, a, b); @@ -59,7 +55,7 @@ void a () { #endif { int size = dill_code_size(s); - static unsigned long ps = -1; + static long ps = -1; if (ps == -1) { ps = (getpagesize ()); } diff --git a/thirdparty/dill/dill/x86_64.c b/thirdparty/dill/dill/x86_64.c index fab8cbc070..2ab77affa3 100644 --- a/thirdparty/dill/dill/x86_64.c +++ b/thirdparty/dill/dill/x86_64.c @@ -17,6 +17,7 @@ #ifndef LINUX_KERNEL_MODULE #include #include +#include #ifdef HAVE_MALLOC_H #include #endif @@ -79,14 +80,14 @@ struct basic_type_info { 2, 2, IREG}, /* US */ { 4, 4, IREG}, /* I */ { 4, 4, IREG}, /* U */ - { sizeof(long), sizeof(long), IREG}, /* UL */ - { sizeof(long), sizeof(long), IREG}, /* L */ + { sizeof(uintptr_t), sizeof(uintptr_t), IREG}, /* UL */ + { sizeof(intptr_t), sizeof(intptr_t), IREG}, /* L */ { sizeof(char*), sizeof(char*), IREG}, /* P */ { sizeof(float), sizeof(float), FREG}, /* F */ { sizeof(double), sizeof(double), FREG}, /* D */ { 0, 8, IREG}, /* V */ { -1, 8, IREG}, /* B */ - { sizeof(long), sizeof(long), IREG}, /* EC */ + { sizeof(void*), sizeof(void*), IREG}, /* EC */ }; int x86_64_type_align[] = { @@ -96,8 +97,8 @@ int x86_64_type_align[] = { 2, /* US */ 4, /* I */ 4, /* U */ - sizeof(unsigned long), /* UL */ - sizeof(long), /* L */ + sizeof(uintptr_t), /* UL */ + sizeof(intptr_t), /* L */ sizeof(char*), /* P */ 4, /* F */ 4, /* D */ @@ -113,8 +114,8 @@ int x86_64_type_size[] = { 2, /* US */ 4, /* I */ 4, /* U */ - sizeof(unsigned long), /* UL */ - sizeof(long), /* L */ + sizeof(uintptr_t), /* UL */ + sizeof(intptr_t), /* L */ sizeof(char*), /* P */ 4, /* F */ 8, /* D */ @@ -239,7 +240,7 @@ BYTE_OUT1IR(dill_stream s, int rex, int insn1, int imm32) } static void -BYTE_OUT1LR(dill_stream s, int rex, int insn1, long imm64) +BYTE_OUT1LR(dill_stream s, int rex, int insn1, intptr_t imm64) { unsigned char *tmp_ip; if (s->p->cur_ip >= s->p->code_limit) { @@ -247,12 +248,12 @@ BYTE_OUT1LR(dill_stream s, int rex, int insn1, long imm64) } tmp_ip = (unsigned char *) s->p->cur_ip; if (rex != 0) { - long tmp = imm64; + intptr_t tmp = imm64; *tmp_ip = (unsigned char)rex|0x40; *(tmp_ip + 1) = (unsigned char)insn1; memcpy(tmp_ip + 2, &tmp, 8); } else { - long tmp = imm64; + intptr_t tmp = imm64; *(tmp_ip) = (unsigned char)insn1; memcpy(tmp_ip + 1, &tmp, 8); } @@ -567,7 +568,7 @@ int src; { int rex1 = 0; if (dest > XMM7) rex1 = REX_R|REX_B; - BYTE_OUT3R(s, rex, 0x0f, 0x57, ModRM(0x3, dest, dest)); + BYTE_OUT3R(s, rex1, 0x0f, 0x57, ModRM(0x3, dest, dest)); // GSE really rex1? Late fix. } if (typ == DILL_D) op = 0xf2; BYTE_OUT1R3(s, op, rex, 0x0f, 0x5c, ModRM(0x3, dest, src)); @@ -605,7 +606,7 @@ x86_64_seti(dill_stream s, int r, int val) } static void -x86_64_setl(dill_stream s, int r, long val) +x86_64_setl(dill_stream s, int r, IMM_TYPE val) { int rex = REX_W; if (r > RDI) rex |= REX_B; @@ -617,7 +618,7 @@ x86_64_setp(dill_stream s, int type, int junk, int r, void *val) { int rex = REX_W; union { - long l; + intptr_t l; void *a; } a; a.a = val; @@ -976,7 +977,7 @@ int dest; } extern void -x86_64_ploadi(dill_stream s, int type, int junk, int dest, int src, long offset) +x86_64_ploadi(dill_stream s, int type, int junk, int dest, int src, IMM_TYPE offset) { unsigned char opcode = ld_opcodes[type]; int tmp_dest = dest; @@ -1040,7 +1041,7 @@ x86_64_ploadi(dill_stream s, int type, int junk, int dest, int src, long offset) } else { BYTE_OUT3R(s, rex, opcode, ModRM(0x0, tmp_dest, 0x4),SIB(0,4,src)); } - } else if (((long)offset <= 127) && ((long)offset > -128)) { + } else if (((intptr_t)offset <= 127) && ((intptr_t)offset > -128)) { if (float_op != 0) { BYTE_OUT1R5(s, float_op, rex, 0x0f, 0x10, ModRM(0x1, tmp_dest, src), SIB(0,ESP,0x4),offset & 0xff); } else { @@ -1060,7 +1061,7 @@ x86_64_ploadi(dill_stream s, int type, int junk, int dest, int src, long offset) } else { BYTE_OUT2R(s, rex, opcode, ModRM(0x0, tmp_dest, src)); } - } else if (((long)offset <= 127) && ((long)offset > -128)) { + } else if (((intptr_t)offset <= 127) && ((intptr_t)offset > -128)) { if (float_op != 0) { BYTE_OUT1R4(s, float_op, rex, 0x0f, 0x10, ModRM(0x1, tmp_dest, src), offset & 0xff); } else { @@ -1203,7 +1204,7 @@ x86_64_pload(dill_stream s, int type, int junk, int dest, int src1, int src2) } extern void -x86_64_pbsloadi(dill_stream s, int type, int junk, int dest, int src, long offset) +x86_64_pbsloadi(dill_stream s, int type, int junk, int dest, int src, IMM_TYPE offset) { int rex = 0; int fdest = dest; @@ -1317,7 +1318,7 @@ static unsigned char st_opcodes[] = { 0x89, /* DILL_EC */ }; extern void -x86_64_pstorei(dill_stream s, int type, int junk, int dest, int src, long offset) +x86_64_pstorei(dill_stream s, int type, int junk, int dest, int src, IMM_TYPE offset) { x86_64_mach_info smi = (x86_64_mach_info) s->p->mach_info; int rex = 0, float_op = 0; @@ -1355,7 +1356,7 @@ x86_64_pstorei(dill_stream s, int type, int junk, int dest, int src, long offset if (((src&0x7) == ESP) && (((offset & 0xffffffff80000000) == 0) || ((offset & 0xffffffff80000000) == 0xffffffff80000000))) { - if (((long)offset <= 127) && ((long)offset > -128)) { + if (((intptr_t)offset <= 127) && ((intptr_t)offset > -128)) { if (float_op != 0) { BYTE_OUT1R5(s, float_op, rex, 0x0f, 0x11, ModRM(0x1, dest, src), SIB(0x0,ESP,0x4), offset & 0xff); } else { @@ -1375,7 +1376,7 @@ x86_64_pstorei(dill_stream s, int type, int junk, int dest, int src, long offset } else { BYTE_OUT2R(s, rex, st_opcodes[type], ModRM(0x0, dest, src)); } - } else if (((long)offset <= 127) && ((long)offset > -128)) { + } else if (((intptr_t)offset <= 127) && ((intptr_t)offset > -128)) { if (float_op != 0) { BYTE_OUT1R4(s, float_op, rex, 0x0f, 0x11, ModRM(0x1, dest, src), offset & 0xff); } else { @@ -1447,7 +1448,7 @@ extern void x86_64_div(dill_stream s, int op3, int op, int dest, int src1, } extern void x86_64_divi(dill_stream s, int op3, int op, int dest, int src, - long imm) + IMM_TYPE imm) { } @@ -1586,7 +1587,7 @@ int sign; int imm; int dest; int src1; -long src2; +IMM_TYPE src2; { int rex = REX_W; /* make src1 be EAX */ @@ -1632,7 +1633,7 @@ int div; int type; int dest; int src1; -long imm; +IMM_TYPE imm; { x86_64_push_reg(s, EBP); x86_64_setl(s, EBP, imm); @@ -1719,7 +1720,7 @@ int op; int typ; int dest; int src; -long imm; +IMM_TYPE imm; { int rex = 0; if ((typ == DILL_L) || (typ == DILL_UL) || (typ == DILL_P)) { @@ -1813,7 +1814,7 @@ int op; int type; int dest; int src; -long imm; +IMM_TYPE imm; { int rex = 0; if ((type == DILL_L) || (type == DILL_UL) || (type == DILL_P)) { @@ -2125,7 +2126,7 @@ x86_64_compare(dill_stream s, int op, int type, int dest, int src1, int src2) } extern void -x86_64_comparei(dill_stream s, int op, int type, int dest, int src, long imm) +x86_64_comparei(dill_stream s, int op, int type, int dest, int src, IMM_TYPE imm) { int rex = 0; if ((type == DILL_L) || (type == DILL_UL) || (type == DILL_P)) rex |= REX_W; @@ -2172,7 +2173,7 @@ extern void x86_64_jump_to_reg(dill_stream s, unsigned long reg) extern void x86_64_jump_to_imm(dill_stream s, void *imm) { - x86_64_seti(s, EAX, (unsigned long) imm); + x86_64_seti(s, EAX, (intptr_t) imm); BYTE_OUT2(s, 0xff, ModRM(0x3, 0x4, EAX)); } @@ -2183,7 +2184,7 @@ x86_64_jal(dill_stream s, int return_addr_reg, int target) } extern void -x86_64_special(dill_stream s, special_operations type, long param) +x86_64_special(dill_stream s, special_operations type, intptr_t param) { x86_64_mach_info smi = (x86_64_mach_info) s->p->mach_info; @@ -2289,7 +2290,7 @@ static void internal_push(dill_stream s, int type, int immediate, x86_64_setl(s, EAX, a.i); arg_type = DILL_I; } else { - x86_64_setl(s, EAX, *(long*)value_ptr); + x86_64_setl(s, EAX, *(intptr_t*)value_ptr); arg_type = DILL_L; } x86_64_pstorei(s, arg_type, 0, EAX, ESP, arg.offset); @@ -2301,7 +2302,7 @@ static void internal_push(dill_stream s, int type, int immediate, } else { if ((type != DILL_F) && (type != DILL_D)) { if (arg.is_immediate) { - x86_64_setl(s, arg.out_reg, *(long*)value_ptr); + x86_64_setl(s, arg.out_reg, *(intptr_t*)value_ptr); } else { x86_64_pmov(s, arg.type, arg.out_reg, *(int*) value_ptr); } @@ -2313,7 +2314,7 @@ static void internal_push(dill_stream s, int type, int immediate, x86_64_setf(s, type, 0, arg.out_reg, *(double*)value_ptr); } else { - x86_64_setl(s, arg.out_reg, *(long*)value_ptr); + x86_64_setl(s, arg.out_reg, *(intptr_t*)value_ptr); } } else { /* move to the appropriate float reg */ @@ -2354,7 +2355,7 @@ extern void x86_64_push(dill_stream s, int type, int reg) } } -extern void x86_64_pushi(dill_stream s, int type, long value) +extern void x86_64_pushi(dill_stream s, int type, IMM_TYPE value) { internal_push(s, type, 1, &value); } @@ -2412,7 +2413,7 @@ extern int x86_64_callr(dill_stream s, int type, int src) } extern void -x86_64_branchi(dill_stream s, int op, int type, int src, long imm, int label) +x86_64_branchi(dill_stream s, int op, int type, int src, IMM_TYPE imm, int label) { int rex = 0; if ((type == DILL_L) || (type == DILL_UL) || (type == DILL_P)) rex |= REX_W; @@ -2492,7 +2493,7 @@ extern void x86_64_retf(dill_stream s, int data1, int data2, double imm) } } -extern void x86_64_reti(dill_stream s, int data1, int data2, long imm) +extern void x86_64_reti(dill_stream s, int data1, int data2, IMM_TYPE imm) { switch (data1) { case DILL_C: @@ -2583,6 +2584,12 @@ x86_64_emit_save(dill_stream s) s->p->cur_ip = save_ip; } +#ifdef USE_VIRTUAL_PROTECT +#include +#include +#include +#endif + static void x86_64_flush(void *base, void *limit) { @@ -2592,16 +2599,30 @@ x86_64_flush(void *base, void *limit) /* flush every 8 bytes of preallocated insn stream. */ while((char*)ptr < (char*) limit) { +#ifndef _MSC_VER +#ifdef __x86_64__ asm volatile ("clflush (%0)" : /* */ : "r" (ptr)); +#endif +#else + _mm_clflush(ptr); +#endif ptr = (char *)ptr + 8; } +#ifndef _MSC_VER asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); +#endif } #endif +#ifdef USE_VIRTUAL_PROTECT + int result; + DWORD dummy; + size_t size = ((intptr_t)limit - (intptr_t)base); + result = VirtualProtect(base, size, PAGE_EXECUTE_READWRITE, &dummy); +#endif } extern void x86_64_end(s) @@ -2652,7 +2673,7 @@ int available_size; } extern void -x86_64_pset(dill_stream s, int type, int junk, int dest, long imm) +x86_64_pset(dill_stream s, int type, int junk, int dest, IMM_TYPE imm) { switch(type) { case DILL_L: case DILL_UL: case DILL_P: @@ -2675,7 +2696,7 @@ x86_64_setf(dill_stream s, int type, int junk, int dest, double imm) union { double d; int i[2]; - long l; + intptr_t l; } b; if (type == DILL_F) { int rex = 0; @@ -2816,7 +2837,7 @@ x86_64_count_insn(dill_stream s, int start, int end) i.buffer_length = MAXLENGTH; count = 0; insn_ptr = (char*) (i.buffer + start); - while((long)insn_ptr < (long)i.buffer + end) { + while((intptr_t)insn_ptr < (intptr_t)i.buffer + end) { insn_ptr += print_insn_i386((bfd_vma)insn_ptr, &i); count++; } diff --git a/thirdparty/dill/dill/x86_64.h b/thirdparty/dill/dill/x86_64.h index fb8da738f3..048143512b 100644 --- a/thirdparty/dill/dill/x86_64.h +++ b/thirdparty/dill/dill/x86_64.h @@ -190,53 +190,53 @@ extern int x86_64_type_size[]; extern void *gen_x86_64_mach_info(); extern void x86_64_arith3(dill_stream c, int op, int commut, int dest, int src1, int src2); extern void x86_64_arith2(dill_stream c, int op, int subop, int dest, int src); -extern void x86_64_mul(dill_stream c, int signed, int imm, int dest, int src1, long src2); +extern void x86_64_mul(dill_stream c, int signed, int imm, int dest, int src1, IMM_TYPE src2); extern void x86_64_div_mod(dill_stream c, int sign, int div, int dest, int src1, int src2); -extern void x86_64_div_modi(dill_stream c, int sign, int div, int dest, int src1, long imm); -extern void x86_64_arith3i(dill_stream c, int op, int commut, int dest, int src1, long src2); +extern void x86_64_div_modi(dill_stream c, int sign, int div, int dest, int src1, IMM_TYPE imm); +extern void x86_64_arith3i(dill_stream c, int op, int commut, int dest, int src1, IMM_TYPE src2); extern void x86_64_shift(dill_stream c, int op, int junk, int dest, int src1, int src2); -extern void x86_64_shifti(dill_stream c, int op, int junk, int dest, int src, long imm); -extern void x86_64_special(dill_stream c, special_operations type, long param); -extern void x86_64_set(dill_stream c, int r, long imm); +extern void x86_64_shifti(dill_stream c, int op, int junk, int dest, int src, IMM_TYPE imm); +extern void x86_64_special(dill_stream c, special_operations type, IMM_TYPE param); +extern void x86_64_set(dill_stream c, int r, IMM_TYPE imm); extern void x86_64_proc_start(dill_stream c, char *subr_name, int arg_count, arg_info_list args, dill_reg *arglist); extern void x86_64_end(dill_stream c); extern void x86_64_package_end(dill_stream c); extern void *x86_64_clone_code(dill_stream c, void *base, int size); extern void x86_64_ret(dill_stream c, int data1, int data2, int src); -extern void x86_64_reti(dill_stream c, int data1, int data2, long imm); +extern void x86_64_reti(dill_stream c, int data1, int data2, IMM_TYPE imm); extern void x86_64_retf(dill_stream c, int data1, int data2, double imm); extern int x86_64_getreg(dill_stream c, dill_reg *reg_p, int type, int class); extern int x86_64_putreg(dill_stream c, dill_reg reg, int type); extern void -x86_64_ploadi(dill_stream c, int type, int junk, int dest, int src, long offset); +x86_64_ploadi(dill_stream c, int type, int junk, int dest, int src, IMM_TYPE offset); extern void x86_64_pload(dill_stream c, int type, int junk, int dest, int src1, int src2); extern void -x86_64_pbsloadi(dill_stream c, int type, int junk, int dest, int src, long offset); +x86_64_pbsloadi(dill_stream c, int type, int junk, int dest, int src, IMM_TYPE offset); extern void x86_64_pbsload(dill_stream c, int type, int junk, int dest, int src1, int src2); extern void -x86_64_pstorei(dill_stream c, int type, int junk, int dest, int src, long offset); +x86_64_pstorei(dill_stream c, int type, int junk, int dest, int src, IMM_TYPE offset); extern void x86_64_pstore(dill_stream c, int type, int junk, int dest, int src1, int src2); extern void -x86_64_modi(dill_stream c, int type, int junk, int dest, int src, long offset); +x86_64_modi(dill_stream c, int type, int junk, int dest, int src, IMM_TYPE offset); extern void x86_64_mod(dill_stream c, int type, int junk, int dest, int src1, int src2); extern void -x86_64_divi(dill_stream c, int type, int junk, int dest, int src, long offset); +x86_64_divi(dill_stream c, int type, int junk, int dest, int src, IMM_TYPE offset); extern void x86_64_div(dill_stream c, int type, int junk, int dest, int src1, int src2); extern void -x86_64_converti(dill_stream c, int from_type, int to_type, int dest, long src); +x86_64_converti(dill_stream c, int from_type, int to_type, int dest, IMM_TYPE src); extern void x86_64_convert(dill_stream c, int from_type, int to_type, int dest, int src); extern void x86_64_mov(dill_stream c, int type, int junk, int dest, int src); extern void -x86_64_pset(dill_stream c, int type, int junk, int dest, long imm); +x86_64_pset(dill_stream c, int type, int junk, int dest, IMM_TYPE imm); extern void x86_64_setf(dill_stream c, int type, int junk, int dest, double imm); extern void @@ -244,13 +244,13 @@ x86_64_setp(dill_stream c, int type, int junk, int dest, void *imm); extern void x86_64_branch(dill_stream c, int op, int type, int src1, int src2, int label); extern void -x86_64_branchi(dill_stream c, int op, int type, int src, long imm, int label); +x86_64_branchi(dill_stream c, int op, int type, int src, IMM_TYPE imm, int label); extern void x86_64_compare(dill_stream s, int op, int type, int dest, int src1, int src2); extern void -x86_64_comparei(dill_stream s, int op, int type, int dest, int src, long imm); +x86_64_comparei(dill_stream s, int op, int type, int dest, int src, IMM_TYPE imm); extern void -x86_64_lea(dill_stream c, int junk, int junk1, int dest, int src, long imm); +x86_64_lea(dill_stream c, int junk, int junk1, int dest, int src, IMM_TYPE imm); extern void x86_64_farith(dill_stream c, int op, int typ, int dest, int src1, int src2); extern void @@ -263,7 +263,7 @@ extern void x86_64_jal(dill_stream c, int return_addr_reg, int target); extern int x86_64_calli(dill_stream c, int type, void *xfer_address, const char *name); extern int x86_64_callr(dill_stream c, int type, int src); extern void x86_64_push(dill_stream c, int type, int reg); -extern void x86_64_pushi(dill_stream c, int type, long value); +extern void x86_64_pushi(dill_stream c, int type, IMM_TYPE value); extern void x86_64_pushpi(dill_stream c, int type, void *value); extern void x86_64_pushfi(dill_stream c, int type, double value); extern int x86_64_local_op(dill_stream c, int flag, int val); diff --git a/thirdparty/dill/dill/x86_64_rt.c b/thirdparty/dill/dill/x86_64_rt.c index 852a407b49..9373abcba5 100644 --- a/thirdparty/dill/dill/x86_64_rt.c +++ b/thirdparty/dill/dill/x86_64_rt.c @@ -1,10 +1,19 @@ #include "config.h" +#include +#include #include "dill.h" #include "dill_internal.h" +#ifdef HAVE_SYS_MMAN_H #include "sys/mman.h" +#endif #ifdef HAVE_MEMORY_H #include "memory.h" #endif +#ifdef USE_VIRTUAL_PROTECT +#include +#include +#include +#endif #include "x86.h" extern double dill_x86_64_hidden_ULtoD(unsigned long a) @@ -23,7 +32,7 @@ x86_64_rt_call_link(char *code, call_t *t) int i; for(i=0; i< t->call_count; i++) { - unsigned long tmp = (unsigned long) t->call_locs[i].xfer_addr; + uintptr_t tmp = (uintptr_t) t->call_locs[i].xfer_addr; long *call_addr = (long *) (code + t->call_locs[i].loc + 2); memcpy(call_addr, &tmp, 8); } @@ -38,14 +47,22 @@ x86_64_flush(void *base, void *limit) /* flush every 8 bytes of preallocated insn stream. */ while((char*)ptr < (char*) limit) { +#ifndef _MSC_VER +#ifdef __x86_64__ asm volatile ("clflush (%0)" : /* */ : "r" (ptr)); +#endif +#else + _mm_clflush(ptr); +#endif ptr = (char *)ptr + 8; } +#ifndef _MSC_VER asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); +#endif } #endif } @@ -65,6 +82,11 @@ x86_64_package_stitch(char *code, call_t *t, dill_pkg pkg) PROT_EXEC | PROT_READ | PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0); memcpy(tmp, code, pkg->code_size); +#endif +#ifdef USE_VIRTUAL_PROTECT + int result; + DWORD dummy; + result = VirtualProtect(tmp, pkg->code_size, PAGE_EXECUTE_READWRITE, &dummy); #endif return tmp + pkg->entry_offset; }