Update to 0.29.

Sponsored by:	Absolight
This commit is contained in:
Mathieu Arnold 2016-06-21 15:08:16 +00:00
parent 22ca346c8a
commit 54e20c1a7e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=417244
14 changed files with 5 additions and 2898 deletions

View file

@ -2,8 +2,7 @@
# $FreeBSD$
PORTNAME= Scope-Upper
PORTVERSION= 0.28
PORTREVISION= 1
PORTVERSION= 0.29
CATEGORIES= devel perl5
MASTER_SITES= CPAN
MASTER_SITE_SUBDIR= CPAN:VPIT
@ -21,10 +20,4 @@ USE_PERL5= configure
post-install:
${STRIP_CMD} ${STAGEDIR}${PREFIX}/${SITE_ARCH_REL}/auto/Scope/Upper/Upper.so
.include <bsd.port.pre.mk>
.if ${PERL_LEVEL} >= 502308
BROKEN= Fails to build after argarray removal
.endif
.include <bsd.port.post.mk>
.include <bsd.port.mk>

View file

@ -1,2 +1,3 @@
SHA256 (Scope-Upper-0.28.tar.gz) = a0da8103debe014410fc6718fe3275db2713be95c235f18c4592cd4148e82137
SIZE (Scope-Upper-0.28.tar.gz) = 86754
TIMESTAMP = 1466515981
SHA256 (Scope-Upper-0.29.tar.gz) = 4b07360a243ce0ccaacfdfa98ae38ef2686aa908fcf4ef3d669105ac36759e0a
SIZE (Scope-Upper-0.29.tar.gz) = 93763

View file

@ -1,10 +0,0 @@
--- MANIFEST.orig 2015-03-23 19:15:17 UTC
+++ MANIFEST
@@ -66,3 +66,7 @@ t/87-stress-uid.t
t/lib/Scope/Upper/TestGenerator.pm
t/lib/Test/Leaner.pm
t/lib/VPIT/TestHelpers.pm
+xsh/caps.h
+xsh/debug.h
+xsh/threads.h
+xsh/util.h

View file

@ -1,11 +0,0 @@
--- Makefile.PL.orig 2015-03-27 19:07:42 UTC
+++ Makefile.PL
@@ -51,7 +51,7 @@ print $is_gcc_34 ? "yes\n" : "no\n";
# Threads, Windows and 5.8.x don't seem to be best friends
if ($^O eq 'MSWin32' && "$]" < 5.009) {
- push @DEFINES, '-DSU_MULTIPLICITY=0';
+ push @DEFINES, '-DXSH_MULTIPLICITY=0';
}
@DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES;

File diff suppressed because it is too large Load diff

View file

@ -1,18 +0,0 @@
--- t/13-reap-ctl.t.orig 2015-08-18 13:44:19 UTC
+++ t/13-reap-ctl.t
@@ -302,10 +302,12 @@ $y = undef;
reap { ++$y; die "reaped\n" } => HERE;
is $x, 3, 'die in reap at eval [not yet - x]';
is $y, undef, 'die in reap at eval [not yet - y]';
- }; # should trigger here, but the die isn't catched by this eval
- die "failed\n";
+ }; # should trigger here, but the die isn't catched by this eval in
+ # ealier perls
+ die "inner\n";
};
- is $@, "reaped\n", 'die in reap at eval [ok - $@]';
+ is $@, ($] >= 5.023008 ? "inner\n" : "reaped\n"),
+ 'die in reap at eval [ok - $@]';
is $x, 1, 'die in reap at eval [ok - x]';
is $y, 1, 'die in reap at eval [ok - y]';
}

View file

@ -1,16 +0,0 @@
--- t/91-pod.t.orig 2016-06-04 20:01:09 UTC
+++ t/91-pod.t
@@ -0,0 +1,13 @@
+#!perl -T
+
+use strict;
+use warnings;
+
+use Test::More;
+
+use lib 't/lib';
+use VPIT::TestHelpers;
+
+load_or_skip_all('Test::Pod', '1.22', [ ]);
+
+all_pod_files_ok();

View file

@ -1,17 +0,0 @@
--- t/92-pod-coverage.t.orig 2016-06-04 20:01:09 UTC
+++ t/92-pod-coverage.t
@@ -0,0 +1,14 @@
+#!perl -T
+
+use strict;
+use warnings;
+
+use Test::More;
+
+use lib 't/lib';
+use VPIT::TestHelpers;
+
+load_or_skip_all('Test::Pod::Coverage', '1.08', [ ]);
+load_or_skip_all('Pod::Coverage', '0.18' );
+
+all_pod_coverage_ok( { also_private => [ qr/^_/, qr/^CLONE(_SKIP)?$/ ] } );

View file

@ -1,16 +0,0 @@
--- t/93-pod-spelling.t.orig 2016-06-04 20:01:09 UTC
+++ t/93-pod-spelling.t
@@ -0,0 +1,13 @@
+#!perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+use lib 't/lib';
+use VPIT::TestHelpers;
+
+load_or_skip_all('Test::Pod::Spelling::CommonMistakes', '1.0', [ ]);
+
+all_pod_files_ok();

View file

@ -1,16 +0,0 @@
--- t/95-portability-files.t.orig 2016-06-04 20:01:09 UTC
+++ t/95-portability-files.t
@@ -0,0 +1,13 @@
+#!perl -T
+
+use strict;
+use warnings;
+
+use Test::More;
+
+use lib 't/lib';
+use VPIT::TestHelpers;
+
+load_or_skip_all('Test::Portability::Files', undef, [ ]);
+
+run_tests();

View file

@ -1,50 +0,0 @@
--- xsh/caps.h.orig 2016-06-04 20:01:09 UTC
+++ xsh/caps.h
@@ -0,0 +1,47 @@
+#ifndef XSH_CAPS_H
+#define XSH_CAPS_H 1
+
+#define XSH_HAS_PERL(R, V, S) (PERL_REVISION > (R) || (PERL_REVISION == (R) && (PERL_VERSION > (V) || (PERL_VERSION == (V) && (PERL_SUBVERSION >= (S))))))
+
+#define XSH_HAS_PERL_BRANCH(R, V, S) (PERL_REVISION == (R) && PERL_VERSION == (V) && PERL_SUBVERSION >= (S))
+
+#define XSH_HAS_PERL_EXACT(R, V, S) ((PERL_REVISION == (R)) && (PERL_VERSION == (V)) && (PERL_SUBVERSION == (S)))
+
+#ifndef XSH_PERL_PATCHLEVEL
+# ifdef PERL_PATCHNUM
+# define XSH_PERL_PATCHLEVEL PERL_PATCHNUM
+# else
+# define XSH_PERL_PATCHLEVEL 0
+# endif
+#endif
+
+#define XSH_HAS_PERL_MAINT(R, V, S, P) (PERL_REVISION == (R) && PERL_VERSION == (V) && (XSH_PERL_PATCHLEVEL >= (P) || (!XSH_PERL_PATCHLEVEL && PERL_SUBVERSION >= (S))))
+
+#ifndef XSH_MULTIPLICITY
+# if defined(MULTIPLICITY)
+# define XSH_MULTIPLICITY 1
+# else
+# define XSH_MULTIPLICITY 0
+# endif
+#endif
+#if XSH_MULTIPLICITY
+# ifndef PERL_IMPLICIT_CONTEXT
+# error MULTIPLICITY builds must set PERL_IMPLICIT_CONTEXT
+# endif
+# ifndef tTHX
+# define tTHX PerlInterpreter*
+# endif
+#endif
+
+#if XSH_MULTIPLICITY && defined(USE_ITHREADS) && defined(dMY_CXT) && defined(MY_CXT) && defined(START_MY_CXT) && defined(MY_CXT_INIT) && (defined(MY_CXT_CLONE) || defined(dMY_CXT_SV))
+# define XSH_THREADSAFE 1
+#else
+# define XSH_THREADSAFE 0
+#endif
+
+/* Safe unless stated otherwise in Makefile.PL */
+#ifndef XSH_FORKSAFE
+# define XSH_FORKSAFE 1
+#endif
+
+#endif /* XSH_CAPS_H */

View file

@ -1,30 +0,0 @@
--- xsh/debug.h.orig 2016-06-04 20:01:09 UTC
+++ xsh/debug.h
@@ -0,0 +1,27 @@
+#ifndef XSH_DEBUG_H
+#define XSH_DEBUG_H 1
+
+#include "util.h" /* XSH_PACKAGE, STMT_* */
+
+#ifndef XSH_DEBUG
+# define XSH_DEBUG 0
+#endif
+
+#if XSH_DEBUG
+# define XSH_D(X) STMT_START X STMT_END
+static void su_debug_log(const char *fmt, ...) {
+ va_list va;
+ SV *sv;
+ dTHX;
+ va_start(va, fmt);
+ sv = get_sv(XSH_PACKAGE "::DEBUG", 0);
+ if (sv && SvTRUE(sv))
+ PerlIO_vprintf(Perl_debug_log, fmt, va);
+ va_end(va);
+ return;
+}
+#else
+# define XSH_D(X)
+#endif
+
+#endif /* XSH_DEBUG_H */

View file

@ -1,504 +0,0 @@
--- xsh/threads.h.orig 2016-06-04 20:01:09 UTC
+++ xsh/threads.h
@@ -0,0 +1,501 @@
+#ifndef XSH_THREADS_H
+#define XSH_THREADS_H 1
+
+#include "caps.h" /* XSH_HAS_PERL(), XSH_THREADSAFE */
+#include "util.h" /* XSH_PACKAGE, dNOOP, NOOP */
+
+#ifndef XSH_THREADS_COMPILE_TIME_PROTECTION
+# define XSH_THREADS_COMPILE_TIME_PROTECTION 0
+#endif
+
+#ifndef XSH_THREADS_USER_CONTEXT
+# define XSH_THREADS_USER_CONTEXT 1
+#endif
+
+#ifndef XSH_THREADS_USER_GLOBAL_SETUP
+# define XSH_THREADS_USER_GLOBAL_SETUP 1
+#endif
+
+#ifndef XSH_THREADS_USER_LOCAL_SETUP
+# define XSH_THREADS_USER_LOCAL_SETUP 1
+#endif
+
+#ifndef XSH_THREADS_USER_LOCAL_TEARDOWN
+# define XSH_THREADS_USER_LOCAL_TEARDOWN 1
+#endif
+
+#ifndef XSH_THREADS_USER_GLOBAL_TEARDOWN
+# define XSH_THREADS_USER_GLOBAL_TEARDOWN 1
+#endif
+
+#ifndef XSH_THREADS_PEEP_CONTEXT
+# define XSH_THREADS_PEEP_CONTEXT 0
+#endif
+
+#ifndef XSH_THREADS_HINTS_CONTEXT
+# define XSH_THREADS_HINTS_CONTEXT 0
+#endif
+
+#ifndef XSH_THREADS_USER_CLONE_NEEDS_DUP
+# define XSH_THREADS_USER_CLONE_NEEDS_DUP 0
+#endif
+
+#if XSH_THREADSAFE && (XSH_THREADS_HINTS_CONTEXT || XSH_THREADS_USER_CLONE_NEEDS_DUP)
+# define XSH_THREADS_CLONE_NEEDS_DUP 1
+#else
+# define XSH_THREADS_CLONE_NEEDS_DUP 0
+#endif
+
+#if defined(XSH_OPS_H) && (!XSH_THREADS_GLOBAL_SETUP || !XSH_THREADS_GLOBAL_TEARDOWN)
+# error settting up hook check functions require global setup/teardown
+#endif
+
+#ifndef XSH_THREADS_NEED_TEARDOWN_LATE
+# define XSH_THREADS_NEED_TEARDOWN_LATE 0
+#endif
+
+#if XSH_THREADS_NEED_TEARDOWN_LATE && (!XSH_THREADS_USER_LOCAL_TEARDOWN || !XSH_THREADS_USER_GLOBAL_TEARDOWN)
+# error you need to declare local or global teardown handlers to use the late teardown feature
+#endif
+
+#if XSH_THREADSAFE
+# ifndef MY_CXT_CLONE
+# define MY_CXT_CLONE \
+ dMY_CXT_SV; \
+ my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1)); \
+ Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t); \
+ sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
+# endif
+#else
+# undef dMY_CXT
+# define dMY_CXT dNOOP
+# undef MY_CXT
+# define MY_CXT xsh_globaldata
+# undef START_MY_CXT
+# define START_MY_CXT static my_cxt_t MY_CXT;
+# undef MY_CXT_INIT
+# define MY_CXT_INIT NOOP
+# undef MY_CXT_CLONE
+# define MY_CXT_CLONE NOOP
+#endif
+
+#if XSH_THREADSAFE
+/* We must use preexistent global mutexes or we will never be able to destroy
+ * them. */
+# if XSH_HAS_PERL(5, 9, 3)
+# define XSH_LOADED_LOCK MUTEX_LOCK(&PL_my_ctx_mutex)
+# define XSH_LOADED_UNLOCK MUTEX_UNLOCK(&PL_my_ctx_mutex)
+# else
+# define XSH_LOADED_LOCK OP_REFCNT_LOCK
+# define XSH_LOADED_UNLOCK OP_REFCNT_UNLOCK
+# endif
+#else
+# define XSH_LOADED_LOCK NOOP
+# define XSH_LOADED_UNLOCK NOOP
+#endif
+
+static I32 xsh_loaded = 0;
+
+#if XSH_THREADSAFE && XSH_THREADS_COMPILE_TIME_PROTECTION
+
+#define PTABLE_USE_DEFAULT 1
+
+#include "ptable.h"
+
+#define ptable_loaded_store(T, K, V) ptable_default_store(aPTBL_ (T), (K), (V))
+#define ptable_loaded_delete(T, K) ptable_default_delete(aPTBL_ (T), (K))
+#define ptable_loaded_free(T) ptable_default_free(aPTBL_ (T))
+
+static ptable *xsh_loaded_cxts = NULL;
+
+static int xsh_is_loaded(pTHX_ void *cxt) {
+#define xsh_is_loaded(C) xsh_is_loaded(aTHX_ (C))
+ int res = 0;
+
+ XSH_LOADED_LOCK;
+ if (xsh_loaded_cxts && ptable_fetch(xsh_loaded_cxts, cxt))
+ res = 1;
+ XSH_LOADED_UNLOCK;
+
+ return res;
+}
+
+static int xsh_set_loaded_locked(pTHX_ void *cxt) {
+#define xsh_set_loaded_locked(C) xsh_set_loaded_locked(aTHX_ (C))
+ int global_setup = 0;
+
+ if (xsh_loaded <= 0) {
+ XSH_ASSERT(xsh_loaded == 0);
+ XSH_ASSERT(!xsh_loaded_cxts);
+ xsh_loaded_cxts = ptable_new(4);
+ global_setup = 1;
+ }
+ ++xsh_loaded;
+ XSH_ASSERT(xsh_loaded_cxts);
+ ptable_loaded_store(xsh_loaded_cxts, cxt, cxt);
+
+ return global_setup;
+}
+
+static int xsh_clear_loaded_locked(pTHX_ void *cxt) {
+#define xsh_clear_loaded_locked(C) xsh_clear_loaded_locked(aTHX_ (C))
+ int global_teardown = 0;
+
+ if (xsh_loaded > 1) {
+ XSH_ASSERT(xsh_loaded_cxts);
+ ptable_loaded_delete(xsh_loaded_cxts, cxt);
+ --xsh_loaded;
+ } else if (xsh_loaded_cxts) {
+ XSH_ASSERT(xsh_loaded == 1);
+ ptable_loaded_free(xsh_loaded_cxts);
+ xsh_loaded_cxts = NULL;
+ xsh_loaded = 0;
+ global_teardown = 1;
+ }
+
+ return global_teardown;
+}
+
+#else /* XSH_THREADS_COMPILE_TIME_PROTECTION */
+
+#define xsh_is_loaded_locked(C) (xsh_loaded > 0)
+#define xsh_set_loaded_locked(C) ((xsh_loaded++ <= 0) ? 1 : 0)
+#define xsh_clear_loaded_locked(C) ((--xsh_loaded <= 0) ? 1 : 0)
+
+#if XSH_THREADSAFE
+
+static int xsh_is_loaded(pTHX_ void *cxt) {
+#define xsh_is_loaded(C) xsh_is_loaded(aTHX_ (C))
+ int res = 0;
+
+ XSH_LOADED_LOCK;
+ res = xsh_is_loaded_locked(cxt);
+ XSH_LOADED_UNLOCK;
+
+ return res;
+}
+
+#else
+
+#define xsh_is_loaded(C) xsh_is_loaded_locked(C)
+
+#endif
+
+#endif /* !XSH_THREADS_COMPILE_TIME_PROTECTION */
+
+#define MY_CXT_KEY XSH_PACKAGE "::_guts" XS_VERSION
+
+typedef struct {
+#if XSH_THREADS_USER_CONTEXT
+ xsh_user_cxt_t cxt_user;
+#endif
+#if XSH_THREADS_PEEP_CONTEXT
+ xsh_peep_cxt_t cxt_peep;
+#endif
+#if XSH_THREADS_HINTS_CONTEXT
+ xsh_hints_cxt_t cxt_hints;
+#endif
+#if XSH_THREADS_CLONE_NEEDS_DUP
+ tTHX owner;
+#endif
+#if !(XSH_THREADS_USER_CONTEXT || XSH_THREADS_PEEP_CONTEXT || XSH_THREADS_HINTS_CONTEXT || XSH_THREADS_CLONE_NEEDS_DUP)
+ int dummy;
+#endif
+} my_cxt_t;
+
+START_MY_CXT
+
+#if XSH_THREADS_USER_CONTEXT
+# define dXSH_CXT dMY_CXT
+# define XSH_CXT (MY_CXT.cxt_user)
+#endif
+
+#if XSH_THREADS_USER_GLOBAL_SETUP
+static void xsh_user_global_setup(pTHX);
+#endif
+
+#if XSH_THREADS_USER_LOCAL_SETUP
+# if XSH_THREADS_USER_CONTEXT
+static void xsh_user_local_setup(pTHX_ xsh_user_cxt_t *cxt);
+# else
+static void xsh_user_local_setup(pTHX);
+# endif
+#endif
+
+#if XSH_THREADS_USER_LOCAL_TEARDOWN
+# if XSH_THREADS_USER_CONTEXT
+static void xsh_user_local_teardown(pTHX_ xsh_user_cxt_t *cxt);
+# else
+static void xsh_user_local_teardown(pTHX);
+# endif
+#endif
+
+#if XSH_THREADS_USER_GLOBAL_TEARDOWN
+static void xsh_user_global_teardown(pTHX);
+#endif
+
+#if XSH_THREADSAFE && XSH_THREADS_USER_CONTEXT
+# if XSH_THREADS_USER_CLONE_NEEDS_DUP
+static void xsh_user_clone(pTHX_ const xsh_user_cxt_t *old_cxt, xsh_user_cxt_t *new_cxt, CLONE_PARAMS *params);
+# else
+static void xsh_user_clone(pTHX_ const xsh_user_cxt_t *old_cxt, xsh_user_cxt_t *new_cxt);
+# endif
+#endif
+
+#if XSH_THREADS_PEEP_CONTEXT
+static xsh_peep_cxt_t *xsh_peep_get_cxt(pTHX) {
+ dMY_CXT;
+ XSH_ASSERT(xsh_is_loaded(&MY_CXT));
+ return &MY_CXT.cxt_peep;
+}
+#endif
+
+#if XSH_THREADS_HINTS_CONTEXT
+static xsh_hints_cxt_t *xsh_hints_get_cxt(pTHX) {
+ dMY_CXT;
+ XSH_ASSERT(xsh_is_loaded(&MY_CXT));
+ return &MY_CXT.cxt_hints;
+}
+#endif
+
+#if XSH_THREADS_NEED_TEARDOWN_LATE
+
+typedef void (*xsh_teardown_late_cb)(pTHX_ void *ud);
+
+static int xsh_teardown_late_simple_free(pTHX_ SV *sv, MAGIC *mg) {
+ xsh_teardown_late_cb cb;
+
+ cb = DPTR2FPTR(xsh_teardown_late_cb, mg->mg_ptr);
+
+ XSH_LOADED_LOCK;
+ if (xsh_loaded == 0)
+ cb(aTHX_ NULL);
+ XSH_LOADED_UNLOCK;
+
+ return 0;
+}
+
+static MGVTBL xsh_teardown_late_simple_vtbl = {
+ 0,
+ 0,
+ 0,
+ 0,
+ xsh_teardown_late_simple_free
+#if MGf_COPY
+ , 0
+#endif
+#if MGf_DUP
+ , 0
+#endif
+#if MGf_LOCAL
+ , 0
+#endif
+};
+
+typedef struct {
+ xsh_teardown_late_cb cb;
+ void *ud;
+} xsh_teardown_late_token;
+
+static int xsh_teardown_late_arg_free(pTHX_ SV *sv, MAGIC *mg) {
+ xsh_teardown_late_token *tok;
+
+ tok = (xsh_teardown_late_token *) mg->mg_ptr;
+
+ XSH_LOADED_LOCK;
+ if (xsh_loaded == 0)
+ tok->cb(aTHX_ tok->ud);
+ XSH_LOADED_UNLOCK;
+
+ PerlMemShared_free(tok);
+
+ return 0;
+}
+
+static MGVTBL xsh_teardown_late_arg_vtbl = {
+ 0,
+ 0,
+ 0,
+ 0,
+ xsh_teardown_late_arg_free
+#if MGf_COPY
+ , 0
+#endif
+#if MGf_DUP
+ , 0
+#endif
+#if MGf_LOCAL
+ , 0
+#endif
+};
+
+static void xsh_teardown_late_register(pTHX_ xsh_teardown_late_cb cb, void *ud){
+#define xsh_teardown_late_register(CB, UD) xsh_teardown_late_register(aTHX_ (CB), (UD))
+ void *ptr;
+
+ if (!ud) {
+ ptr = FPTR2DPTR(void *, cb);
+ } else {
+ xsh_teardown_late_token *tok;
+
+ tok = PerlMemShared_malloc(sizeof *tok);
+ tok->cb = cb;
+ tok->ud = ud;
+
+ ptr = tok;
+ }
+
+ if (!PL_strtab)
+ PL_strtab = newHV();
+
+ sv_magicext((SV *) PL_strtab, NULL, PERL_MAGIC_ext,
+ ud ? &xsh_teardown_late_arg_vtbl : &xsh_teardown_late_simple_vtbl,
+ ptr, 0);
+
+ return;
+}
+
+#endif /* XSH_THREADS_NEED_TEARDOWN_LATE */
+
+static void xsh_teardown(pTHX_ void *root) {
+ dMY_CXT;
+
+#if XSH_THREADS_USER_LOCAL_TEARDOWN
+# if XSH_THREADS_USER_CONTEXT
+ xsh_user_local_teardown(aTHX_ &XSH_CXT);
+# else
+ xsh_user_local_teardown(aTHX);
+# endif
+#endif
+
+#if XSH_THREADS_PEEP_CONTEXT
+ xsh_peep_local_teardown(aTHX_ &MY_CXT.cxt_peep);
+#endif
+
+#if XSH_THREADS_HINTS_CONTEXT
+ xsh_hints_local_teardown(aTHX_ &MY_CXT.cxt_hints);
+#endif
+
+ XSH_LOADED_LOCK;
+
+ if (xsh_clear_loaded_locked(&MY_CXT)) {
+#if XSH_THREADS_USER_GLOBAL_TEARDOWN
+ xsh_user_global_teardown(aTHX);
+#endif
+
+#if XSH_THREADS_HINTS_CONTEXT
+ xsh_hints_global_teardown(aTHX);
+#endif
+ }
+
+ XSH_LOADED_UNLOCK;
+
+ return;
+}
+
+static void xsh_setup(pTHX) {
+#define xsh_setup() xsh_setup(aTHX)
+ MY_CXT_INIT; /* Takes/release PL_my_ctx_mutex */
+
+ XSH_LOADED_LOCK;
+
+ if (xsh_set_loaded_locked(&MY_CXT)) {
+#if XSH_THREADS_HINTS_CONTEXT
+ xsh_hints_global_setup(aTHX);
+#endif
+
+#if XSH_THREADS_USER_GLOBAL_SETUP
+ xsh_user_global_setup(aTHX);
+#endif
+ }
+
+ XSH_LOADED_UNLOCK;
+
+#if XSH_THREADS_CLONE_NEEDS_DUP
+ MY_CXT.owner = aTHX;
+#endif
+
+#if XSH_THREADS_HINTS_CONTEXT
+ xsh_hints_local_setup(aTHX_ &MY_CXT.cxt_hints);
+#endif
+
+#if XSH_THREADS_PEEP_CONTEXT
+ xsh_peep_local_setup(aTHX_ &MY_CXT.cxt_peep);
+#endif
+
+#if XSH_THREADS_USER_LOCAL_SETUP
+# if XSH_THREADS_USER_CONTEXT
+ xsh_user_local_setup(aTHX_ &XSH_CXT);
+# else
+ xsh_user_local_setup(aTHX);
+# endif
+#endif
+
+ call_atexit(xsh_teardown, NULL);
+
+ return;
+}
+
+#if XSH_THREADSAFE
+
+static void xsh_clone(pTHX) {
+#define xsh_clone() xsh_clone(aTHX)
+ const my_cxt_t *old_cxt;
+ my_cxt_t *new_cxt;
+
+ {
+ dMY_CXT;
+ old_cxt = &MY_CXT;
+ }
+
+ {
+ int global_setup;
+
+ MY_CXT_CLONE;
+ new_cxt = &MY_CXT;
+
+ XSH_LOADED_LOCK;
+ global_setup = xsh_set_loaded_locked(new_cxt);
+ XSH_ASSERT(!global_setup);
+ XSH_LOADED_UNLOCK;
+
+#if XSH_THREADS_CLONE_NEEDS_DUP
+ new_cxt->owner = aTHX;
+#endif
+ }
+
+ {
+#if XSH_THREADS_CLONE_NEEDS_DUP
+ XSH_DUP_PARAMS_TYPE params;
+ xsh_dup_params_init(params, old_cxt->owner);
+#endif
+
+#if XSH_THREADS_PEEP_CONTEXT
+ xsh_peep_clone(aTHX_ &old_cxt->cxt_peep, &new_cxt->cxt_peep);
+#endif
+
+#if XSH_THREADS_HINTS_CONTEXT
+ xsh_hints_clone(aTHX_ &old_cxt->cxt_hints, &new_cxt->cxt_hints,
+ xsh_dup_params_ptr(params));
+#endif
+
+#if XSH_THREADS_USER_CONTEXT
+# if XSH_THREADS_USER_CLONE_NEEDS_DUP
+ xsh_user_clone(aTHX_ &old_cxt->cxt_user, &new_cxt->cxt_user,
+ xsh_dup_params_ptr(params));
+# else
+ xsh_user_clone(aTHX_ &old_cxt->cxt_user, &new_cxt->cxt_user);
+# endif
+#endif
+
+#if XSH_THREADS_CLONE_NEEDS_DUP
+ xsh_dup_params_deinit(params);
+#endif
+ }
+
+ return;
+}
+
+#endif /* XSH_THREADSAFE */
+
+#endif /* XSH_THREADS_H */

View file

@ -1,100 +0,0 @@
--- xsh/util.h.orig 2016-06-04 20:01:09 UTC
+++ xsh/util.h
@@ -0,0 +1,97 @@
+#ifndef XSH_UTIL_H
+#define XSH_UTIL_H 1
+
+#include "caps.h" /* XSH_HAS_PERL() */
+
+#ifndef XSH_PACKAGE
+# error XSH_PACKAGE must be defined
+#endif
+
+#define XSH_PACKAGE_LEN (sizeof(XSH_PACKAGE)-1)
+
+#ifdef DEBUGGING
+# if XSH_HAS_PERL(5, 8, 9) || XSH_HAS_PERL(5, 9, 3)
+# define XSH_ASSERT(C) assert(C)
+# else
+# define XSH_ASSERT(C) PERL_DEB( \
+ ((C) ? ((void) 0) \
+ : (Perl_croak_nocontext("Assertion %s failed: file \"" __FILE__ \
+ "\", line %d", STRINGIFY(C), __LINE__), \
+ (void) 0)))
+# endif
+#else
+# define XSH_ASSERT(C)
+#endif
+
+#undef VOID2
+#ifdef __cplusplus
+# define VOID2(T, P) static_cast<T>(P)
+#else
+# define VOID2(T, P) (P)
+#endif
+
+#ifndef STMT_START
+# define STMT_START do
+#endif
+
+#ifndef STMT_END
+# define STMT_END while (0)
+#endif
+
+#ifndef dNOOP
+# define dNOOP
+#endif
+
+#ifndef NOOP
+# define NOOP
+#endif
+
+#if XSH_HAS_PERL(5, 13, 2)
+# define XSH_DUP_PARAMS_TYPE CLONE_PARAMS *
+# define xsh_dup_params_init(P, O) ((P) = Perl_clone_params_new((O), aTHX))
+# define xsh_dup_params_deinit(P) Perl_clone_params_del(P)
+# define xsh_dup_params_ptr(P) (P)
+#else
+# define XSH_DUP_PARAMS_TYPE CLONE_PARAMS
+# define xsh_dup_params_init(P, O) \
+ ((P).stashes = newAV()); (P).flags = 0; ((P).proto_perl = (O))
+# define xsh_dup_params_deinit(P) SvREFCNT_dec((P).stashes)
+# define xsh_dup_params_ptr(P) &(P)
+#endif
+#define xsh_dup(S, P) sv_dup((S), (P))
+#define xsh_dup_inc(S, P) SvREFCNT_inc(xsh_dup((S), (P)))
+
+/* Context for PerlMemShared_*() functions */
+#ifdef PERL_IMPLICIT_SYS
+# define pPMS pTHX
+# define pPMS_ pTHX_
+# define aPMS aTHX
+# define aPMS_ aTHX_
+#else
+# define pPMS void
+# define pPMS_
+# define aPMS
+# define aPMS_
+#endif
+
+#ifdef USE_ITHREADS
+# define XSH_LOCK(M) MUTEX_LOCK(M)
+# define XSH_UNLOCK(M) MUTEX_UNLOCK(M)
+#else
+# define XSH_LOCK(M) NOOP
+# define XSH_UNLOCK(M) NOOP
+#endif
+
+#ifndef PTR2nat
+# define PTR2nat(p) (PTRV)(p)
+#endif
+
+#ifndef DPTR2FPTR
+# define DPTR2FPTR(t,p) ((t)PTR2nat(p))
+#endif
+
+#ifndef FPTR2DPTR
+# define FPTR2DPTR(t,p) ((t)PTR2nat(p))
+#endif
+
+#endif /* XSH_UTIL_H */