Skip to content

Commit ab68379

Browse files
authored
Merge pull request #31 from bcardiff/update-crystal-0.28
Update for crystal 0.28 release
2 parents 793eac3 + 179846f commit ab68379

File tree

10 files changed

+180
-51
lines changed

10 files changed

+180
-51
lines changed

linux/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ ENV CFLAGS="-fPIC -pipe ${release:+-O2}"
2424
# Build libgc
2525
ARG gc_version
2626
ARG libatomic_ops_version
27-
COPY files/fix-gcf-memory-allocation.patch /tmp/
27+
COPY files/feature-thread-stackbottom.patch /tmp/
2828
RUN git clone https://github.com/ivmai/bdwgc \
2929
&& cd bdwgc \
3030
&& git checkout ${gc_version} \
3131
&& git clone https://github.com/ivmai/libatomic_ops \
3232
&& (cd libatomic_ops && git checkout ${libatomic_ops_version}) \
3333
\
34-
&& patch -p1 < /tmp/fix-gcf-memory-allocation.patch \
34+
&& patch -p1 < /tmp/feature-thread-stackbottom.patch \
3535
\
3636
&& ./autogen.sh \
3737
&& ./configure --disable-debug --disable-shared --enable-large-config \

linux/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ PREVIOUS_CRYSTAL_RELEASE_LINUX64_TARGZ ?= ## url to crystal-{version}-{package}
2020
PREVIOUS_CRYSTAL_RELEASE_LINUX32_TARGZ ?= ## url to crystal-{version}-{package}-linux-i686.tar.gz
2121

2222
SHARDS_VERSION = v0.8.1
23-
GC_VERSION = v7.6.8
24-
LIBATOMIC_OPS_VERSION = v7.6.6
23+
GC_VERSION = v7.6.12
24+
LIBATOMIC_OPS_VERSION = v7.6.10
2525

2626
OUTPUT_DIR = build
2727
OUTPUT_BASENAME64 = $(OUTPUT_DIR)/crystal-$(CRYSTAL_VERSION)-$(PACKAGE_ITERATION)-linux-x86_64

linux/files/crystal-wrapper

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,6 @@ ROOT_DIR="$SCRIPT_DIR/.."
100100
export CRYSTAL_PATH="${CRYSTAL_PATH:-"$ROOT_DIR/share/crystal/src:lib"}"
101101
export PATH="$ROOT_DIR/lib/crystal/bin:$PATH"
102102
export LIBRARY_PATH="$ROOT_DIR/lib/crystal/lib${LIBRARY_PATH:+:$LIBRARY_PATH}"
103+
export CRYSTAL_LIBRARY_PATH="${CRYSTAL_LIBRARY_PATH:+$CRYSTAL_LIBRARY_PATH:}$ROOT_DIR/lib/crystal/lib"
103104

104105
exec "$ROOT_DIR/lib/crystal/bin/crystal" "${@}"
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
From 4ee871c7812c84631e2e8127302f76df190ffe18 Mon Sep 17 00:00:00 2001
2+
From: "Brian J. Cardiff" <[email protected]>
3+
Date: Mon, 7 Jan 2019 17:41:35 -0300
4+
Subject: [PATCH] Added functions to get and set the stackbottom of each thread
5+
6+
---
7+
include/gc.h | 10 ++++++++++
8+
pthread_support.c | 38 ++++++++++++++++++++++++++++++++++++++
9+
2 files changed, 48 insertions(+)
10+
11+
diff --git a/include/gc.h b/include/gc.h
12+
index d6fec2b5..1a80154d 100644
13+
--- a/include/gc.h
14+
+++ b/include/gc.h
15+
@@ -362,6 +362,16 @@ GC_API GC_ATTR_DEPRECATED char *GC_stackbottom;
16+
/* GC_call_with_gc_active() and */
17+
/* GC_register_my_thread() instead. */
18+
19+
+/* Sets the cool end of user stack in the specified thread. */
20+
+/* MUST be called with the GC disabled. */
21+
+GC_API void GC_CALL GC_set_stackbottom(void * thread, char * stackbottom);
22+
+
23+
+/* Returns the cool end of user stack of the current thread/coroutine. */
24+
+/* When a thread starts it will be computed upon creation. */
25+
+/* If GC_switch_to_coroutine() is called, the returned value will match */
26+
+/* the specified value in that function. */
27+
+GC_API char * GC_CALL GC_get_stackbottom();
28+
+
29+
GC_API GC_ATTR_DEPRECATED int GC_dont_precollect;
30+
/* Do not collect as part of GC */
31+
/* initialization. Should be set only */
32+
diff --git a/pthread_support.c b/pthread_support.c
33+
index 78e5d35a..e99c4b81 100644
34+
--- a/pthread_support.c
35+
+++ b/pthread_support.c
36+
@@ -1369,6 +1369,44 @@ GC_INNER void GC_do_blocking_inner(ptr_t data, void * context GC_ATTR_UNUSED)
37+
UNLOCK();
38+
}
39+
40+
+/* Sets the cool end of user stack in the specified thread. */
41+
+/* MUST be called with the GC disabled. */
42+
+GC_API void GC_CALL GC_set_stackbottom(void * thread, char * stackbottom)
43+
+{
44+
+ GC_thread me;
45+
+
46+
+ me = GC_lookup_thread((pthread_t) thread);
47+
+
48+
+ if ((me -> flags & MAIN_THREAD) == 0) {
49+
+ me -> stack_end = stackbottom;
50+
+ } else {
51+
+ GC_stackbottom = stackbottom;
52+
+ }
53+
+}
54+
+
55+
+/* Returns the cool end of user stack of the current thread/corutine. */
56+
+/* When a thread starts it will be computed upon creation. */
57+
+/* If GC_switch_to_coroutine() is called, the returned value will match */
58+
+/* the specified value in that function. */
59+
+GC_API char * GC_CALL GC_get_stackbottom()
60+
+{
61+
+ pthread_t self = pthread_self();
62+
+ GC_thread me;
63+
+ char * ret;
64+
+
65+
+ LOCK();
66+
+ me = GC_lookup_thread(self);
67+
+
68+
+ if ((me -> flags & MAIN_THREAD) == 0) {
69+
+ ret = me -> stack_end;
70+
+ } else {
71+
+ ret = GC_stackbottom;
72+
+ }
73+
+ UNLOCK();
74+
+
75+
+ return ret;
76+
+}
77+
+
78+
/* GC_call_with_gc_active() has the opposite to GC_do_blocking() */
79+
/* functionality. It might be called from a user function invoked by */
80+
/* GC_do_blocking() to temporarily back allow calling any GC function */

linux/files/fix-gcf-memory-allocation.patch

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
From 4ee871c7812c84631e2e8127302f76df190ffe18 Mon Sep 17 00:00:00 2001
2+
From: "Brian J. Cardiff" <[email protected]>
3+
Date: Mon, 7 Jan 2019 17:41:35 -0300
4+
Subject: [PATCH] Added functions to get and set the stackbottom of each thread
5+
6+
---
7+
include/gc.h | 10 ++++++++++
8+
pthread_support.c | 38 ++++++++++++++++++++++++++++++++++++++
9+
2 files changed, 48 insertions(+)
10+
11+
diff --git a/include/gc.h b/include/gc.h
12+
index d6fec2b5..1a80154d 100644
13+
--- a/include/gc.h
14+
+++ b/include/gc.h
15+
@@ -362,6 +362,16 @@ GC_API GC_ATTR_DEPRECATED char *GC_stackbottom;
16+
/* GC_call_with_gc_active() and */
17+
/* GC_register_my_thread() instead. */
18+
19+
+/* Sets the cool end of user stack in the specified thread. */
20+
+/* MUST be called with the GC disabled. */
21+
+GC_API void GC_CALL GC_set_stackbottom(void * thread, char * stackbottom);
22+
+
23+
+/* Returns the cool end of user stack of the current thread/coroutine. */
24+
+/* When a thread starts it will be computed upon creation. */
25+
+/* If GC_switch_to_coroutine() is called, the returned value will match */
26+
+/* the specified value in that function. */
27+
+GC_API char * GC_CALL GC_get_stackbottom();
28+
+
29+
GC_API GC_ATTR_DEPRECATED int GC_dont_precollect;
30+
/* Do not collect as part of GC */
31+
/* initialization. Should be set only */
32+
diff --git a/pthread_support.c b/pthread_support.c
33+
index 78e5d35a..e99c4b81 100644
34+
--- a/pthread_support.c
35+
+++ b/pthread_support.c
36+
@@ -1369,6 +1369,44 @@ GC_INNER void GC_do_blocking_inner(ptr_t data, void * context GC_ATTR_UNUSED)
37+
UNLOCK();
38+
}
39+
40+
+/* Sets the cool end of user stack in the specified thread. */
41+
+/* MUST be called with the GC disabled. */
42+
+GC_API void GC_CALL GC_set_stackbottom(void * thread, char * stackbottom)
43+
+{
44+
+ GC_thread me;
45+
+
46+
+ me = GC_lookup_thread((pthread_t) thread);
47+
+
48+
+ if ((me -> flags & MAIN_THREAD) == 0) {
49+
+ me -> stack_end = stackbottom;
50+
+ } else {
51+
+ GC_stackbottom = stackbottom;
52+
+ }
53+
+}
54+
+
55+
+/* Returns the cool end of user stack of the current thread/corutine. */
56+
+/* When a thread starts it will be computed upon creation. */
57+
+/* If GC_switch_to_coroutine() is called, the returned value will match */
58+
+/* the specified value in that function. */
59+
+GC_API char * GC_CALL GC_get_stackbottom()
60+
+{
61+
+ pthread_t self = pthread_self();
62+
+ GC_thread me;
63+
+ char * ret;
64+
+
65+
+ LOCK();
66+
+ me = GC_lookup_thread(self);
67+
+
68+
+ if ((me -> flags & MAIN_THREAD) == 0) {
69+
+ ret = me -> stack_end;
70+
+ } else {
71+
+ ret = GC_stackbottom;
72+
+ }
73+
+ UNLOCK();
74+
+
75+
+ return ret;
76+
+}
77+
+
78+
/* GC_call_with_gc_active() has the opposite to GC_do_blocking() */
79+
/* functionality. It might be called from a user function invoked by */
80+
/* GC_do_blocking() to temporarily back allow calling any GC function */

omnibus/config/software/bdw-gc.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name "bdw-gc"
2-
default_version "7.6.8"
2+
default_version "7.6.12"
33

44
source :url => "https://github.com/ivmai/bdwgc/releases/download/v#{version}/gc-#{version}.tar.gz"
55

@@ -11,6 +11,10 @@
1111
source md5: "9ae6251493ead5d0d13b044954cec7d7"
1212
end
1313

14+
version "7.6.12" do
15+
source md5: "8175e1be00c6cd6eac2e8d67bdf451df"
16+
end
17+
1418
dependency "libatomic_ops"
1519

1620
relative_path "gc-#{version}"
@@ -19,6 +23,8 @@
1923
env["CFLAGS"] << " -fPIC"
2024

2125
build do
26+
patch source: 'feature-thread-stackbottom.patch', plevel: 1
27+
2228
command "./configure" \
2329
" --disable-debug" \
2430
" --disable-dependency-tracking" \

omnibus/config/software/crystal.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
dependency "libevent"
1919

2020
env = with_standard_compiler_flags(with_embedded_path(
21-
"LIBRARY_PATH" => "#{install_dir}/embedded/lib"
21+
"LIBRARY_PATH" => "#{install_dir}/embedded/lib",
22+
"CRYSTAL_LIBRARY_PATH" => "#{install_dir}/embedded/lib"
2223
))
2324
env["CFLAGS"] << " -fPIC"
2425

omnibus/config/software/libatomic_ops.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name "libatomic_ops"
2-
default_version "7.6.6"
2+
default_version "7.6.10"
33

44
source :url => "https://github.com/ivmai/libatomic_ops/releases/download/v#{version}/libatomic_ops-#{version}.tar.gz"
55

@@ -11,6 +11,10 @@
1111
source md5: "4514d85d14e21af05d59877c9ded5abc"
1212
end
1313

14+
version "7.6.10" do
15+
source md5: "90a78a84d9c28ce11f331c25289bfbd0"
16+
end
17+
1418
relative_path "libatomic_ops-#{version}"
1519

1620
env = with_standard_compiler_flags

omnibus/config/templates/crystal/crystal.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,5 @@ INSTALL_DIR="$(realpath "$SCRIPT_PATH/..")"
9999
export CRYSTAL_PATH=${CRYSTAL_PATH:-"lib:$INSTALL_DIR/src"}
100100
export PATH="$INSTALL_DIR/embedded/bin:$PATH"
101101
export LIBRARY_PATH="$INSTALL_DIR/embedded/lib${LIBRARY_PATH:+:$LIBRARY_PATH}"
102+
export CRYSTAL_LIBRARY_PATH="${CRYSTAL_LIBRARY_PATH:+$CRYSTAL_LIBRARY_PATH:}$INSTALL_DIR/embedded/lib"
102103
"$INSTALL_DIR/embedded/bin/crystal" "$@"

0 commit comments

Comments
 (0)