mesh-rb 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.idea/.gitignore +8 -0
- data/.idea/mesh-rb.iml +16 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +9 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +17 -0
- data/Rakefile +16 -0
- data/bin/mesh +30 -0
- data/ext/mesh/extconf.rb +13 -0
- data/ext/mesh/mesh/.bazelrc +20 -0
- data/ext/mesh/mesh/.bazelversion +1 -0
- data/ext/mesh/mesh/.clang-format +15 -0
- data/ext/mesh/mesh/.dockerignore +5 -0
- data/ext/mesh/mesh/.editorconfig +16 -0
- data/ext/mesh/mesh/.gitattributes +4 -0
- data/ext/mesh/mesh/.github/workflows/main.yml +144 -0
- data/ext/mesh/mesh/.gitignore +51 -0
- data/ext/mesh/mesh/AUTHORS +5 -0
- data/ext/mesh/mesh/CMakeLists.txt +270 -0
- data/ext/mesh/mesh/CODE_OF_CONDUCT.md +77 -0
- data/ext/mesh/mesh/Dockerfile +30 -0
- data/ext/mesh/mesh/LICENSE +201 -0
- data/ext/mesh/mesh/Makefile +81 -0
- data/ext/mesh/mesh/README.md +97 -0
- data/ext/mesh/mesh/WORKSPACE +50 -0
- data/ext/mesh/mesh/bazel +350 -0
- data/ext/mesh/mesh/mesh-pldi19-powers.pdf +0 -0
- data/ext/mesh/mesh/src/BUILD +222 -0
- data/ext/mesh/mesh/src/CMakeLists.txt +85 -0
- data/ext/mesh/mesh/src/bitmap.h +590 -0
- data/ext/mesh/mesh/src/cheap_heap.h +170 -0
- data/ext/mesh/mesh/src/common.h +377 -0
- data/ext/mesh/mesh/src/copts.bzl +31 -0
- data/ext/mesh/mesh/src/d_assert.cc +75 -0
- data/ext/mesh/mesh/src/fixed_array.h +124 -0
- data/ext/mesh/mesh/src/global_heap.cc +547 -0
- data/ext/mesh/mesh/src/global_heap.h +569 -0
- data/ext/mesh/mesh/src/gnu_wrapper.cc +75 -0
- data/ext/mesh/mesh/src/internal.h +356 -0
- data/ext/mesh/mesh/src/libmesh.cc +239 -0
- data/ext/mesh/mesh/src/mac_wrapper.cc +528 -0
- data/ext/mesh/mesh/src/measure_rss.cc +44 -0
- data/ext/mesh/mesh/src/measure_rss.h +20 -0
- data/ext/mesh/mesh/src/meshable_arena.cc +776 -0
- data/ext/mesh/mesh/src/meshable_arena.h +309 -0
- data/ext/mesh/mesh/src/meshing.h +60 -0
- data/ext/mesh/mesh/src/mini_heap.h +532 -0
- data/ext/mesh/mesh/src/mmap_heap.h +104 -0
- data/ext/mesh/mesh/src/one_way_mmap_heap.h +77 -0
- data/ext/mesh/mesh/src/partitioned_heap.h +111 -0
- data/ext/mesh/mesh/src/plasma/mesh.h +33 -0
- data/ext/mesh/mesh/src/real.cc +52 -0
- data/ext/mesh/mesh/src/real.h +36 -0
- data/ext/mesh/mesh/src/rng/mwc.h +296 -0
- data/ext/mesh/mesh/src/rng/mwc64.h +58 -0
- data/ext/mesh/mesh/src/rpl_printf.c +1991 -0
- data/ext/mesh/mesh/src/runtime.cc +393 -0
- data/ext/mesh/mesh/src/runtime.h +114 -0
- data/ext/mesh/mesh/src/shuffle_vector.h +287 -0
- data/ext/mesh/mesh/src/size_classes.def +251 -0
- data/ext/mesh/mesh/src/static/if.h +36 -0
- data/ext/mesh/mesh/src/static/log.h +43 -0
- data/ext/mesh/mesh/src/testing/benchmark/local_refill.cc +103 -0
- data/ext/mesh/mesh/src/testing/big-alloc.c +28 -0
- data/ext/mesh/mesh/src/testing/fragmenter.cc +128 -0
- data/ext/mesh/mesh/src/testing/global-large-stress.cc +25 -0
- data/ext/mesh/mesh/src/testing/local-alloc.c +16 -0
- data/ext/mesh/mesh/src/testing/meshing_benchmark.cc +189 -0
- data/ext/mesh/mesh/src/testing/thread.cc +35 -0
- data/ext/mesh/mesh/src/testing/unit/alignment.cc +56 -0
- data/ext/mesh/mesh/src/testing/unit/bitmap_test.cc +274 -0
- data/ext/mesh/mesh/src/testing/unit/concurrent_mesh_test.cc +185 -0
- data/ext/mesh/mesh/src/testing/unit/mesh_test.cc +143 -0
- data/ext/mesh/mesh/src/testing/unit/rng_test.cc +22 -0
- data/ext/mesh/mesh/src/testing/unit/size_class_test.cc +66 -0
- data/ext/mesh/mesh/src/testing/unit/triple_mesh_test.cc +285 -0
- data/ext/mesh/mesh/src/testing/userfaultfd-kernel-copy.cc +164 -0
- data/ext/mesh/mesh/src/thread_local_heap.cc +163 -0
- data/ext/mesh/mesh/src/thread_local_heap.h +268 -0
- data/ext/mesh/mesh/src/wrapper.cc +433 -0
- data/ext/mesh/mesh/support/export_mesh.cmake +28 -0
- data/ext/mesh/mesh/support/gen-size-classes +57 -0
- data/ext/mesh/mesh/support/install_all_configs +33 -0
- data/ext/mesh/mesh/support/remove_export_mesh.cmake +48 -0
- data/ext/mesh/mesh/support/update-bazelisk +8 -0
- data/ext/mesh/mesh/theory/32m80.png +0 -0
- data/ext/mesh/mesh/theory/64m80ind.png +0 -0
- data/ext/mesh/mesh/theory/bound_comparison.py +67 -0
- data/ext/mesh/mesh/theory/bounds/impdeg+1 +135 -0
- data/ext/mesh/mesh/theory/choose.py +43 -0
- data/ext/mesh/mesh/theory/common.py +42 -0
- data/ext/mesh/mesh/theory/compute_exp_Y.py +134 -0
- data/ext/mesh/mesh/theory/createRandomString.py +69 -0
- data/ext/mesh/mesh/theory/deg_bound_check.py +100 -0
- data/ext/mesh/mesh/theory/degcheck.py +47 -0
- data/ext/mesh/mesh/theory/dumps/32,1,80,dumb.txt +81 -0
- data/ext/mesh/mesh/theory/dumps/32,2,80,dumb.txt +81 -0
- data/ext/mesh/mesh/theory/dumps/32,3,80,dumb.txt +81 -0
- data/ext/mesh/mesh/theory/dumps/32,4,80,dumb.txt +81 -0
- data/ext/mesh/mesh/theory/dumps/32,5,80,dumb.txt +81 -0
- data/ext/mesh/mesh/theory/dumps/32,6,80,dumb.txt +81 -0
- data/ext/mesh/mesh/theory/dumps/32,7,80,dumb.txt +81 -0
- data/ext/mesh/mesh/theory/dumps/32,8,80,dumb.txt +81 -0
- data/ext/mesh/mesh/theory/dumps/32,9,80,dumb.txt +81 -0
- data/ext/mesh/mesh/theory/experiment.py +303 -0
- data/ext/mesh/mesh/theory/experiment_raw_results/.gitignore +0 -0
- data/ext/mesh/mesh/theory/greedy_experiment.py +66 -0
- data/ext/mesh/mesh/theory/greedy_experiment_copy.py +46 -0
- data/ext/mesh/mesh/theory/greedy_experiment_q.py +75 -0
- data/ext/mesh/mesh/theory/makeGraph.py +64 -0
- data/ext/mesh/mesh/theory/manyreps.png +0 -0
- data/ext/mesh/mesh/theory/manystrings.png +0 -0
- data/ext/mesh/mesh/theory/match_vs_color_experiment.py +94 -0
- data/ext/mesh/mesh/theory/maxmatch_vs_E[Y].py +162 -0
- data/ext/mesh/mesh/theory/maxmatch_vs_greedymatch.py +96 -0
- data/ext/mesh/mesh/theory/maxvdeg+1imp++32,80.png +0 -0
- data/ext/mesh/mesh/theory/mesh_util.py +322 -0
- data/ext/mesh/mesh/theory/meshers.py +452 -0
- data/ext/mesh/mesh/theory/meshingBenchmark.py +96 -0
- data/ext/mesh/mesh/theory/occupancyComparison.py +133 -0
- data/ext/mesh/mesh/theory/randmatch_vs_greedymatch.py +97 -0
- data/ext/mesh/mesh/theory/randmatch_vs_greedymatch_q.py +103 -0
- data/ext/mesh/mesh/theory/randmatch_vs_greedymatch_time.py +117 -0
- data/ext/mesh/mesh/theory/read_mesh_dump.py +82 -0
- data/ext/mesh/mesh/theory/test.py +70 -0
- data/ext/mesh/mesh/tools/bazel +1 -0
- data/lib/mesh/version.rb +3 -0
- data/mesh.gemspec +14 -0
- metadata +172 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 28524ffb29eeb84c2bf3b64f2368040c14cbca9f7411631ebed9821fb06e20fa
|
4
|
+
data.tar.gz: dc709f8688df2095ffa7dd4f5bd29d21fd05b732db076ecc0b4641d152287fba
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 824ad61e2201035a415449ced1937a46a5d7935161daf7a7b6786ec68c8751a0b668cdf673d4296c3b4e19367cb019bcf87b65d2315c8edfd867b680a7a40d34
|
7
|
+
data.tar.gz: 75fa4f3b846f219da05662f9f70af9dac7e0d13054b1c9ace9b4601ebda6698dfdcab959a05c81ed30e0ddd3ad3f3034118cffa1aaa244eaf12eac57dbbdbb19
|
data/.idea/.gitignore
ADDED
data/.idea/mesh-rb.iml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
4
|
+
<shared />
|
5
|
+
</component>
|
6
|
+
<component name="NewModuleRootManager">
|
7
|
+
<content url="file://$MODULE_DIR$">
|
8
|
+
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
9
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
10
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
11
|
+
</content>
|
12
|
+
<orderEntry type="inheritedJdk" />
|
13
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, ruby-2.7.0-p0) [gem]" level="application" />
|
15
|
+
</component>
|
16
|
+
</module>
|
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
data/.idea/vcs.xml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="VcsDirectoryMappings">
|
4
|
+
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
5
|
+
<mapping directory="$PROJECT_DIR$/ext/mesh" vcs="Git" />
|
6
|
+
<mapping directory="$PROJECT_DIR$/ext/mesh/mesh" vcs="Git" />
|
7
|
+
<mapping directory="$PROJECT_DIR$/ext/meshalloc/mesh" vcs="Git" />
|
8
|
+
</component>
|
9
|
+
</project>
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
|
4
|
+
require 'rake'
|
5
|
+
require 'rake/clean'
|
6
|
+
require 'rake/testtask'
|
7
|
+
require 'rubygems/package_task'
|
8
|
+
|
9
|
+
Bundler::GemHelper.install_tasks
|
10
|
+
|
11
|
+
begin
|
12
|
+
require 'rake/extensiontask'
|
13
|
+
Rake::ExtensionTask.new('mesh')
|
14
|
+
rescue
|
15
|
+
abort 'Please, install a rake-compiler package (gem install rake-compiler)'
|
16
|
+
end
|
data/bin/mesh
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
def usage
|
4
|
+
puts <<END
|
5
|
+
Usage: mesh [ARGS]...
|
6
|
+
|
7
|
+
Options:
|
8
|
+
-v verbose mode
|
9
|
+
--version show version
|
10
|
+
END
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
|
14
|
+
argv = ARGV
|
15
|
+
|
16
|
+
usage if argv.length.zero?
|
17
|
+
if argv[0] == '--version'
|
18
|
+
require 'mesh/version'
|
19
|
+
puts "mesh-rb version #{Mesh.VERSION}"
|
20
|
+
end
|
21
|
+
|
22
|
+
lib_name = 'libmesh.so'
|
23
|
+
|
24
|
+
lib_dir = File.expand_path("../lib/", File.dirname(__FILE__))
|
25
|
+
if File.exist?("#{lib_dir}/#{lib_name}")
|
26
|
+
puts 'Using mesh as an allocator'
|
27
|
+
ENV.store('LD_PRELOAD', "#{lib_dir}/#{lib_name}")
|
28
|
+
end
|
29
|
+
|
30
|
+
Kernel.exec(*argv)
|
data/ext/mesh/extconf.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Copyright 2020 The Mesh Authors. All rights reserved.
|
2
|
+
# Use of this source code is governed by the Apache License,
|
3
|
+
# Version 2.0, that can be found in the LICENSE file.
|
4
|
+
|
5
|
+
build --cxxopt='-std=c++17'
|
6
|
+
#build --crosstool_top=@llvm_toolchain//:toolchain --copt=-D_LIBCPP_ENABLE_NODISCARD
|
7
|
+
build --strip=never
|
8
|
+
|
9
|
+
# largely from sorbet
|
10
|
+
build:debugsymbols --copt=-g3 --copt=-fstandalone-debug --copt=-fno-limit-debug-info
|
11
|
+
build:debugsymbols --linkopt=-g3 --linkopt=-fstandalone-debug --linkopt=-fno-limit-debug-info
|
12
|
+
build:debugsymbols --spawn_strategy=standalone
|
13
|
+
build:debugsymbols --genrule_strategy=standalone
|
14
|
+
|
15
|
+
build:disable-meshing --define disable_meshing=true
|
16
|
+
build:disable-randomization --define disable_randomization=true
|
17
|
+
build:shuffle-on-free --define shuffle_on_free=true
|
18
|
+
|
19
|
+
build:modern-amd64 --copt=-mavx --copt=-march=westmere
|
20
|
+
build:modern-amd64 --linkopt=-mavx --linkopt=-march=westmere
|
@@ -0,0 +1 @@
|
|
1
|
+
4.0.0
|
@@ -0,0 +1,15 @@
|
|
1
|
+
BasedOnStyle: Google
|
2
|
+
ColumnLimit: 120
|
3
|
+
AlignConsecutiveAssignments: false
|
4
|
+
AlignConsecutiveDeclarations: false
|
5
|
+
AllowShortFunctionsOnASingleLine: false
|
6
|
+
AllowShortIfStatementsOnASingleLine: false
|
7
|
+
AllowShortLoopsOnASingleLine: false
|
8
|
+
IndentCaseLabels: false
|
9
|
+
AlwaysBreakTemplateDeclarations: true
|
10
|
+
AccessModifierOffset: -2
|
11
|
+
Standard: Cpp11
|
12
|
+
SortIncludes: false
|
13
|
+
|
14
|
+
DerivePointerAlignment: false
|
15
|
+
PointerAlignment: Right
|
@@ -0,0 +1,16 @@
|
|
1
|
+
root = true
|
2
|
+
|
3
|
+
[*]
|
4
|
+
end_of_line = lf
|
5
|
+
insert_final_newline = true
|
6
|
+
trim_trailing_whitespace = true
|
7
|
+
charset = utf-8
|
8
|
+
indent_style = space
|
9
|
+
indent_size = 4
|
10
|
+
|
11
|
+
[Makefile]
|
12
|
+
indent_style = tab
|
13
|
+
|
14
|
+
[*.{c,cc,cpp,h,hh}]
|
15
|
+
indent_style = space
|
16
|
+
indent_size = 2
|
@@ -0,0 +1,144 @@
|
|
1
|
+
name: CI
|
2
|
+
on: [push]
|
3
|
+
jobs:
|
4
|
+
Ubuntu_cmake:
|
5
|
+
runs-on: ubuntu-latest
|
6
|
+
steps:
|
7
|
+
- uses: actions/checkout@v1
|
8
|
+
- name: Install required packages
|
9
|
+
run: |
|
10
|
+
sudo apt-get update
|
11
|
+
sudo apt-get -y install git gcc g++ make lcov wget libpthread-stubs0-dev
|
12
|
+
- name: Configure CMake
|
13
|
+
run: |
|
14
|
+
mkdir cmake
|
15
|
+
cd cmake
|
16
|
+
wget https://github.com/Kitware/CMake/releases/download/v3.16.5/cmake-3.16.5-Linux-x86_64.sh
|
17
|
+
chmod +x cmake-3.16.5-Linux-x86_64.sh
|
18
|
+
./cmake-3.16.5-Linux-x86_64.sh --skip-license
|
19
|
+
cd ../
|
20
|
+
mkdir cmake-cache
|
21
|
+
cd cmake-cache
|
22
|
+
../cmake/bin/cmake -DGCOV=ON ..
|
23
|
+
- name: Build mesh
|
24
|
+
run: |
|
25
|
+
cd cmake-cache
|
26
|
+
make all
|
27
|
+
- name: Run tests
|
28
|
+
run: |
|
29
|
+
cd cmake-cache
|
30
|
+
make coverage_gcc
|
31
|
+
|
32
|
+
Ubuntu_bazel:
|
33
|
+
runs-on: ubuntu-latest
|
34
|
+
steps:
|
35
|
+
- uses: actions/checkout@v1
|
36
|
+
- name: build in debug mode
|
37
|
+
run: |
|
38
|
+
./bazel test -c dbg //src:unit-tests
|
39
|
+
- name: build tests and binary
|
40
|
+
run: |
|
41
|
+
make -j1
|
42
|
+
|
43
|
+
macOS_bazel:
|
44
|
+
runs-on: macos-latest
|
45
|
+
steps:
|
46
|
+
- uses: actions/checkout@v1
|
47
|
+
- name: build in debug mode
|
48
|
+
run: |
|
49
|
+
./bazel test -c dbg //src:unit-tests --test_output=all --cache_test_results=no --runs_per_test=5
|
50
|
+
- name: build tests and binary
|
51
|
+
run: |
|
52
|
+
make -j1
|
53
|
+
|
54
|
+
#Windows_MinGW:
|
55
|
+
#
|
56
|
+
# runs-on: windows-latest
|
57
|
+
#
|
58
|
+
# steps:
|
59
|
+
# - uses: actions/checkout@v1
|
60
|
+
# - name: Install msys2/mingw64
|
61
|
+
# #steps from https://github.com/msys2/MINGW-packages/blob/master/azure-pipelines.yml
|
62
|
+
# run: |
|
63
|
+
# git clone https://github.com/msys2/msys2-ci-base.git %CD:~0,2%\msys64
|
64
|
+
# %CD:~0,2%\msys64\usr\bin\rm -rf %CD:~0,2%\msys64\.git
|
65
|
+
# set PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
|
66
|
+
# %CD:~0,2%\msys64\usr\bin\pacman --noconfirm -Syyuu
|
67
|
+
# set PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
|
68
|
+
# %CD:~0,2%\msys64\usr\bin\pacman --noconfirm --needed -S git base-devel
|
69
|
+
# %CD:~0,2%\msys64\usr\bin\pacman --noconfirm -Scc
|
70
|
+
# - name: Install required packages
|
71
|
+
# run: |
|
72
|
+
# set PATH=%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
|
73
|
+
# pacman -S --noconfirm mingw-w64-x86_64-binutils
|
74
|
+
# pacman -S --noconfirm mingw-w64-x86_64-cmake
|
75
|
+
# pacman -S --noconfirm mingw-w64-x86_64-gcc
|
76
|
+
# pacman -S --noconfirm mingw-w64-x86_64-gcc-libs
|
77
|
+
# pacman -S --noconfirm mingw-w64-x86_64-gcc-objc
|
78
|
+
# pacman -S --noconfirm mingw-w64-x86_64-gdb
|
79
|
+
# pacman -S --noconfirm mingw-w64-x86_64-ninja
|
80
|
+
# pacman -S --noconfirm mingw-w64-x86_64-lcov
|
81
|
+
# pacman -S --noconfirm mingw-w64-x86_64-winpthreads-git
|
82
|
+
# pacman --noconfirm -Scc
|
83
|
+
# - name: Configure CMake
|
84
|
+
# run: |
|
85
|
+
# set PATH=%CD:~0,2%\msys64\mingw64\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
|
86
|
+
# mkdir cmake-cache
|
87
|
+
# cd cmake-cache
|
88
|
+
# cmake -DGCOV=ON -G"Ninja" ..
|
89
|
+
# - name: Build
|
90
|
+
# run: |
|
91
|
+
# set PATH=%CD:~0,2%\msys64\mingw64\bin;%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
|
92
|
+
# cd cmake-cache
|
93
|
+
# ninja
|
94
|
+
# - name: Run tests
|
95
|
+
# run: |
|
96
|
+
# set PATH=%CD:~0,2%\msys64\mingw64\bin;%CD:~0,2%\msys64\usr\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
|
97
|
+
# cd cmake-cache
|
98
|
+
# ninja coverage
|
99
|
+
# - name: Run big alloc
|
100
|
+
# run: cd cmake-cache && ninja run_big-alloc
|
101
|
+
# - name: Run fork example
|
102
|
+
# run: cd cmake-cache && ninja run_fork-example
|
103
|
+
# - name: Run global-large-stress
|
104
|
+
# run: cd cmake-cache && ninja run_global-large-stress
|
105
|
+
# - name: Run local alloc
|
106
|
+
# run: cd cmake-cache && ninja run_local-alloc
|
107
|
+
# - name: Run thread
|
108
|
+
# run: cd cmake-cache && ninja run_thread
|
109
|
+
|
110
|
+
#Windows_Visual_Studio: #not working
|
111
|
+
#
|
112
|
+
# runs-on: windows-latest
|
113
|
+
#
|
114
|
+
# steps:
|
115
|
+
# - uses: actions/checkout@v1
|
116
|
+
# - name: Install required packages
|
117
|
+
# run: |
|
118
|
+
# ????
|
119
|
+
# - name: Configure CMake
|
120
|
+
# run: |
|
121
|
+
# %comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat"
|
122
|
+
# mkdir cmake-cache
|
123
|
+
# cd cmake-cache
|
124
|
+
# cmake -DGCOV=ON -G"Ninja" ..
|
125
|
+
# - name: Build
|
126
|
+
# run: |
|
127
|
+
# %comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat"
|
128
|
+
# cd cmake-cache
|
129
|
+
# ninja
|
130
|
+
# - name: Run tests
|
131
|
+
# run: |
|
132
|
+
# cd cmake-cache
|
133
|
+
# ninja coverage
|
134
|
+
# - name: Run big alloc
|
135
|
+
# run: cd cmake-cache && ninja run_big-alloc
|
136
|
+
# - name: Run fork example
|
137
|
+
# run: cd cmake-cache && ninja run_fork-example
|
138
|
+
# - name: Run global-large-stress
|
139
|
+
# run: cd cmake-cache && ninja run_global-large-stress
|
140
|
+
# - name: Run local alloc
|
141
|
+
# run: cd cmake-cache && ninja run_local-alloc
|
142
|
+
# - name: Run thread
|
143
|
+
# run: cd cmake-cache && ninja run_thread
|
144
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
*~
|
2
|
+
*.d
|
3
|
+
*.dylib
|
4
|
+
*.o
|
5
|
+
*.so
|
6
|
+
*.pyc
|
7
|
+
TAGS
|
8
|
+
/src/config.h
|
9
|
+
/src/test/fork-example
|
10
|
+
/src/test/thread-example
|
11
|
+
/unit.test
|
12
|
+
/meshing-benchmark
|
13
|
+
config.mk
|
14
|
+
/build
|
15
|
+
/doc
|
16
|
+
/fragmenter
|
17
|
+
/theory/env
|
18
|
+
/frag.pdf
|
19
|
+
/data
|
20
|
+
/paper/latex.out/
|
21
|
+
/paper/mesh.pdf
|
22
|
+
__pycache__
|
23
|
+
/perf.data
|
24
|
+
/perf.data.old
|
25
|
+
/src/test/local-alloc
|
26
|
+
/src/test/local-alloc-glibc
|
27
|
+
/src/test/big-alloc
|
28
|
+
/src/test/big-alloc-glibc
|
29
|
+
/src/test/big-alloc-hoard
|
30
|
+
/src/test/local-alloc-hoard
|
31
|
+
/src/test/local-alloc-tcmalloc
|
32
|
+
/src/test/local-alloc-jemalloc
|
33
|
+
/src/test/local-alloc-mesh
|
34
|
+
/src/test/global-large-stress
|
35
|
+
/test/docker/*/mstatgcc
|
36
|
+
/test/docker/*/mstat
|
37
|
+
/test/spec/data
|
38
|
+
/coverage
|
39
|
+
/src/test/larson-mesh
|
40
|
+
/src/test/larson-glibc
|
41
|
+
/src/test/larson-tcmalloc
|
42
|
+
/src/test/larson-hoard
|
43
|
+
/.idea
|
44
|
+
/.clwb
|
45
|
+
/cmake-build*
|
46
|
+
/cmake-cache/
|
47
|
+
/bazel-bin
|
48
|
+
/bazel-genfiles
|
49
|
+
/bazel-mesh
|
50
|
+
/bazel-out
|
51
|
+
/bazel-testlogs
|
@@ -0,0 +1,270 @@
|
|
1
|
+
cmake_minimum_required(VERSION 3.13.0)
|
2
|
+
|
3
|
+
project(Mesh CXX C)
|
4
|
+
|
5
|
+
|
6
|
+
SET(CMAKE_BUILD_TYPE "" CACHE STRING "Just making sure the default CMAKE_BUILD_TYPE configurations won't interfere" FORCE)
|
7
|
+
|
8
|
+
#Set output folders
|
9
|
+
set(CMAKE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build)
|
10
|
+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_OUTPUT_DIRECTORY}/bin)
|
11
|
+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_OUTPUT_DIRECTORY}/lib)
|
12
|
+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_OUTPUT_DIRECTORY}/lib)
|
13
|
+
set(CMAKE_HEADER_OUTPUT_DIRECTORY ${CMAKE_OUTPUT_DIRECTORY}/include)
|
14
|
+
|
15
|
+
|
16
|
+
include(ExternalProject)
|
17
|
+
|
18
|
+
ExternalProject_Add(googletest
|
19
|
+
GIT_REPOSITORY https://github.com/google/googletest.git
|
20
|
+
GIT_TAG 703bd9caab50b139428cea1aaff9974ebee5742e
|
21
|
+
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
|
22
|
+
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
|
23
|
+
INSTALL_COMMAND ""
|
24
|
+
TEST_COMMAND ""
|
25
|
+
)
|
26
|
+
|
27
|
+
ExternalProject_Add(heap_layers
|
28
|
+
GIT_REPOSITORY https://github.com/emeryberger/Heap-Layers.git
|
29
|
+
GIT_TAG a80041cc15174ab82a39bae1cd750b52955c7eef
|
30
|
+
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/heap_layers-src"
|
31
|
+
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/heap_layers-build"
|
32
|
+
CONFIGURE_COMMAND ""
|
33
|
+
BUILD_COMMAND ""
|
34
|
+
INSTALL_COMMAND ""
|
35
|
+
TEST_COMMAND ""
|
36
|
+
)
|
37
|
+
|
38
|
+
#Create configure options
|
39
|
+
option(DEBUG "Build with debugging symbols" OFF) #replace with CMAKE_BUILD_TYPE?
|
40
|
+
option(OPTIMIZE " Build with optimizations" ON) #replace with CMAKE_BUILD_TYPE?
|
41
|
+
option(GCOV "Build with gcov profiling support" OFF)
|
42
|
+
option(CLANGCOV "Build with clangcov profiling support" OFF)
|
43
|
+
set(RANDOMIZATION "1" CACHE STRING "0: no randomization. 1: freelist init only. 2: freelist init + free fastpath")
|
44
|
+
set_property(CACHE RANDOMIZATION PROPERTY STRINGS "0;1;2")
|
45
|
+
option(DISABLE_MESHING "Disable meshing" OFF)
|
46
|
+
option(SUFFIX "Always suffix the mesh library with randomization + meshing info" OFF)
|
47
|
+
option(CLANG "Build with clang" OFF)
|
48
|
+
option(INSTALL_MESH "Install mesh to the system" OFF)
|
49
|
+
option(SYS_WIDE_INSTALL "Install mesh as a system-wide library" OFF)
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
#Parse options
|
55
|
+
set(CXX_FLAGS )
|
56
|
+
set(ENV{CXX_FLAGS} )
|
57
|
+
|
58
|
+
if (${CLANG})
|
59
|
+
set(CMAKE_CXX_COMPILER clang++)
|
60
|
+
set(CMAKE_C_COMPILER clang)
|
61
|
+
endif()
|
62
|
+
|
63
|
+
#Identify compiler and set specific flag
|
64
|
+
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
|
65
|
+
set(GCC TRUE)
|
66
|
+
set(CLANGC FALSE)
|
67
|
+
set(MSVC FALSE)
|
68
|
+
set(ICC FALSE)
|
69
|
+
endif()
|
70
|
+
|
71
|
+
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
72
|
+
set(GCC FALSE)
|
73
|
+
set(CLANGC TRUE)
|
74
|
+
set(MSVC FALSE)
|
75
|
+
set(ICC FALSE)
|
76
|
+
endif()
|
77
|
+
|
78
|
+
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
|
79
|
+
set(GCC FALSE)
|
80
|
+
set(CLANGC FALSE)
|
81
|
+
set(MSVC TRUE)
|
82
|
+
set(ICC FALSE)
|
83
|
+
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
|
84
|
+
set(BUILD_SHARED_LIBS TRUE)
|
85
|
+
endif()
|
86
|
+
|
87
|
+
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")
|
88
|
+
set(GCC FALSE)
|
89
|
+
set(CLANGC FALSE)
|
90
|
+
set(MSVC FALSE)
|
91
|
+
set(ICC TRUE)
|
92
|
+
endif()
|
93
|
+
|
94
|
+
if (${DEBUG})
|
95
|
+
add_definitions(-g)
|
96
|
+
endif()
|
97
|
+
|
98
|
+
if(${OPTIMIZE})
|
99
|
+
add_definitions(-O3 -flto -D_FORTIFY_SOURCE=2)
|
100
|
+
else()
|
101
|
+
add_definitions(-O0)
|
102
|
+
endif()
|
103
|
+
|
104
|
+
if (${GCOV} AND GCC)
|
105
|
+
find_program(GCOVp gcov)
|
106
|
+
if (GCOVp)
|
107
|
+
add_definitions(--coverage)
|
108
|
+
link_libraries(-lgcov)
|
109
|
+
endif()
|
110
|
+
find_program(LCOVp lcov)
|
111
|
+
if (NOT LCOVp)
|
112
|
+
message(WARNING "LCOV is not installed.")
|
113
|
+
endif()
|
114
|
+
endif()
|
115
|
+
|
116
|
+
if (${CLANGCOV} AND CLANGC)
|
117
|
+
add_definitions(--coverage)#ftest-coverage)
|
118
|
+
link_libraries(--coverage)
|
119
|
+
#todo:
|
120
|
+
#add_definitions(-fprofile-instr-generate -fcoverage-mapping)
|
121
|
+
#c.prefer('cc', 'clang')
|
122
|
+
#c.prefer('cxx', 'clang++')
|
123
|
+
#c.prefer('ar', 'llvm-ar')
|
124
|
+
#c.prefer('ranlib', 'llvm-ranlib')
|
125
|
+
#c.append('ldflags', '-fuse-ld=lld')
|
126
|
+
endif()
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
if (NOT ${DISABLE_MESHING})
|
131
|
+
add_definitions(-DMESHING_ENABLED=1)
|
132
|
+
else()
|
133
|
+
add_definitions(-DMESHING_ENABLED=0)
|
134
|
+
endif()
|
135
|
+
|
136
|
+
if (${RANDOMIZATION} EQUAL 0)
|
137
|
+
add_definitions(-DSHUFFLE_ON_INIT=0)
|
138
|
+
add_definitions(-DSHUFFLE_ON_FREE=0)
|
139
|
+
elseif(${RANDOMIZATION} EQUAL 1)
|
140
|
+
add_definitions(-DSHUFFLE_ON_INIT=1)
|
141
|
+
add_definitions(-DSHUFFLE_ON_FREE=0)
|
142
|
+
elseif(${RANDOMIZATION} EQUAL 2)
|
143
|
+
add_definitions(-DSHUFFLE_ON_INIT=1)
|
144
|
+
add_definitions(-DSHUFFLE_ON_FREE=1)
|
145
|
+
else()
|
146
|
+
message(FATAL_ERROR "Unknown option for Randomization parameter")
|
147
|
+
endif()
|
148
|
+
|
149
|
+
#Additional compile and linking configuration
|
150
|
+
add_definitions(
|
151
|
+
-fPIC
|
152
|
+
-pipe
|
153
|
+
-fno-builtin-malloc
|
154
|
+
-fno-omit-frame-pointer
|
155
|
+
-ffunction-sections
|
156
|
+
-fdata-sections
|
157
|
+
-Werror=pointer-arith
|
158
|
+
-Wall -Wextra -pedantic
|
159
|
+
-Werror=return-type
|
160
|
+
-Wtype-limits
|
161
|
+
-Wempty-body
|
162
|
+
-Wvariadic-macros
|
163
|
+
-Wcast-align
|
164
|
+
)
|
165
|
+
|
166
|
+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${custom_c_flags}")
|
167
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${custom_cxx_flags}")
|
168
|
+
|
169
|
+
if (NOT APPLE AND GCC)
|
170
|
+
add_definitions(
|
171
|
+
-Wno-unused-parameter
|
172
|
+
-D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700
|
173
|
+
-Wundef
|
174
|
+
)
|
175
|
+
add_link_options(
|
176
|
+
-Wl,--no-as-needed
|
177
|
+
-Wl,--no-add-needed
|
178
|
+
-Wl,--sort-common
|
179
|
+
-Wl,--gc-sections
|
180
|
+
-Wl,--hash-style=both
|
181
|
+
-Wl,--no-undefined
|
182
|
+
-Wl,-Bsymbolic-functions
|
183
|
+
-Wl,-z,now,-z,relro
|
184
|
+
-ftls-model=initial-exec
|
185
|
+
-Wl,--exclude-libs,ALL
|
186
|
+
-static-libstdc++ -static-libgcc
|
187
|
+
-lrt
|
188
|
+
)
|
189
|
+
endif()
|
190
|
+
|
191
|
+
set(CMAKE_CXX_STANDARD 14)
|
192
|
+
|
193
|
+
#Create folder for coverage
|
194
|
+
file(MAKE_DIRECTORY ${PROJECT_SOURCE_DIR}/coverage)
|
195
|
+
|
196
|
+
#Go to subdirectory to build libraries
|
197
|
+
add_subdirectory(src)
|
198
|
+
|
199
|
+
#Installation procedures
|
200
|
+
if(INSTALL_MESH)
|
201
|
+
#Check OS and target installation directories
|
202
|
+
if(WIN32)
|
203
|
+
set(system_wide_installation_dir C:\\Program Files\\mesh)
|
204
|
+
set(user_wide_installation_dir C:\\User\\$ENV{USERNAME}\\AppData\\Local\\mesh)
|
205
|
+
set(user $ENV{USERNAME})
|
206
|
+
add_custom_target(delete_local_installation_dir
|
207
|
+
COMMAND ${CMAKE_COMMAND} -E remove_directory ${user_wide_installation_dir})
|
208
|
+
elseif(APPLE)
|
209
|
+
set(system_wide_installation_dir /usr/local)
|
210
|
+
set(user_wide_installation_dir /Users/$ENV{USER}/Library/mesh)
|
211
|
+
set(user $ENV{USER})
|
212
|
+
add_custom_target(delete_local_installation_dir
|
213
|
+
COMMAND ${CMAKE_COMMAND} -E remove_directory ${user_wide_installation_dir})
|
214
|
+
else()
|
215
|
+
#Linux
|
216
|
+
set(system_wide_installation_dir /usr/local)
|
217
|
+
set(user_wide_installation_dir /home/$ENV{USERNAME}/.local)
|
218
|
+
set(user $ENV{USERNAME})
|
219
|
+
add_custom_target(delete_local_installation_dir)
|
220
|
+
endif()
|
221
|
+
|
222
|
+
#This check prevents that running installation as sudo changes the username
|
223
|
+
if(NOT ENV{mesh_install_dir})
|
224
|
+
if(SYS_WIDE_INSTALL)
|
225
|
+
set(ENV{mesh_install_dir} ${system_wide_installation_dir})
|
226
|
+
set(ENV{mesh_syswide} ON)
|
227
|
+
else()
|
228
|
+
set(ENV{mesh_install_dir} ${user_wide_installation_dir})
|
229
|
+
set(ENV{mesh_syswide} OFF)
|
230
|
+
endif()
|
231
|
+
set(ENV{mesh_user} ${user})
|
232
|
+
endif()
|
233
|
+
|
234
|
+
#Create target for copying library and header dir
|
235
|
+
add_custom_target(install_mesh
|
236
|
+
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:mesh> $ENV{mesh_install_dir}/lib/$<TARGET_FILE_NAME:mesh>
|
237
|
+
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/plasma/mesh.h $ENV{mesh_install_dir}/include/plasma/mesh.h
|
238
|
+
)
|
239
|
+
#Create target for deleting library and header dir
|
240
|
+
add_custom_target(uninstall_mesh
|
241
|
+
COMMAND ${CMAKE_COMMAND} -E remove -f $ENV{mesh_install_dir}/lib/$<TARGET_FILE_NAME:mesh>
|
242
|
+
COMMAND ${CMAKE_COMMAND} -E remove -f $ENV{mesh_install_dir}/include/plasma/mesh.h
|
243
|
+
COMMAND ${CMAKE_COMMAND} -E remove_directory $ENV{mesh_install_dir}/include/plasma
|
244
|
+
)
|
245
|
+
|
246
|
+
#Export or remove library paths (you will need to run with sudo/elevated privileges if doing a system wide installation)
|
247
|
+
#I didn't add a DEPENDS clause on purpose, or the mesh and install_mesh targets would run as root
|
248
|
+
add_custom_target(export_mesh
|
249
|
+
COMMAND ${CMAKE_COMMAND} -DINSTALLATION_DIR="$ENV{mesh_install_dir}" -DUSER="$ENV{mesh_user}" -DSYSWIDE="$ENV{mesh_syswide}" -P ${CMAKE_SOURCE_DIR}/support/export_mesh.cmake
|
250
|
+
)
|
251
|
+
add_custom_target(remove_export_mesh
|
252
|
+
COMMAND ${CMAKE_COMMAND} -DINSTALLATION_DIR="$ENV{mesh_install_dir}" -DUSER="$ENV{mesh_user}" -DSYSWIDE="$ENV{mesh_syswide}" -P ${CMAKE_SOURCE_DIR}/support/remove_export_mesh.cmake
|
253
|
+
)
|
254
|
+
|
255
|
+
#Additional glue targets that trigger both install&export or uninstall&remove export
|
256
|
+
add_custom_target(install_and_export
|
257
|
+
DEPENDS install_mesh export_mesh
|
258
|
+
)
|
259
|
+
|
260
|
+
if(SYS_WIDE_INSTALL)
|
261
|
+
add_custom_target(uninstall_and_remove_export
|
262
|
+
DEPENDS uninstall_mesh remove_export_mesh
|
263
|
+
)
|
264
|
+
else()
|
265
|
+
add_custom_target(uninstall_and_remove_export
|
266
|
+
DEPENDS uninstall_mesh remove_export_mesh delete_local_installation_dir
|
267
|
+
)
|
268
|
+
endif()
|
269
|
+
|
270
|
+
endif()
|