[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, feature/pma, updated. gawk-4.1.0-4739-ga0df079b
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, feature/pma, updated. gawk-4.1.0-4739-ga0df079b |
Date: |
Thu, 2 Jun 2022 08:53:14 -0400 (EDT) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, feature/pma has been updated
via a0df079b4a4f620f5830cbe7136e420c141e6531 (commit)
from 7606256d57b64245530612399ff95202bd1df1e0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=a0df079b4a4f620f5830cbe7136e420c141e6531
commit a0df079b4a4f620f5830cbe7136e420c141e6531
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Thu Jun 2 15:52:50 2022 +0300
Finish initial (pass through) integration of pma.
diff --git a/ChangeLog b/ChangeLog
index bbb70ea8..86da8af2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-06-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * custom.h: Deal with use/non-use of persistent malloc.
+ * main.c (persist_file, do_persist): New variables.
+ (optab): Add entry for -T / --persist.
+ (main): Bracket mtrace call in #ifndef. Do argument parsing
+ earlier in the flow.
+ (usage): Updated with new options.
+ (parse_args): Handle new options.
+
2022-05-26 Arnold D. Robbins <arnold@skeeve.com>
* configure.ac (GAWK_USE_PERSISTENT_MALLOC): Add call.
diff --git a/awklib/ChangeLog b/awklib/ChangeLog
index da14522c..bd02ef8c 100644
--- a/awklib/ChangeLog
+++ b/awklib/ChangeLog
@@ -1,3 +1,8 @@
+2022-06-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (AM_CPPFLAGS): Add -I.../support for inclusion
+ of pma.h.
+
2021-10-27 Arnold D. Robbins <arnold@skeeve.com>
* 5.1.1: Release tar ball made.
diff --git a/awklib/Makefile.am b/awklib/Makefile.am
index 20e9edba..c00990ef 100644
--- a/awklib/Makefile.am
+++ b/awklib/Makefile.am
@@ -35,7 +35,7 @@ AWKPROG = LC_ALL=C LANG=C "$(abs_top_builddir)/gawk$(EXEEXT)"
endif
# Get config.h from the build directory and custom.h from the source directory.
-AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
+AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/support
pkgdatadir = $(datadir)/awk
pkglibexecdir = $(libexecdir)/awk
diff --git a/awklib/Makefile.in b/awklib/Makefile.in
index 21187926..b72210c2 100644
--- a/awklib/Makefile.in
+++ b/awklib/Makefile.in
@@ -342,7 +342,7 @@ EXTRA_DIST = ChangeLog ChangeLog.0 ChangeLog.1 \
@TEST_CROSS_COMPILE_TRUE@AWKPROG = LC_ALL=C LANG=C awk$(EXEEXT)
# Get config.h from the build directory and custom.h from the source directory.
-AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
+AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/support
AUXAWK = passwd.awk group.awk
nodist_grcat_SOURCES = grcat.c
nodist_pwcat_SOURCES = pwcat.c
diff --git a/configure b/configure
index be36b330..e37a108e 100755
--- a/configure
+++ b/configure
@@ -661,6 +661,8 @@ LIBREADLINE
SOCKET_LIBS
ENABLE_EXTENSIONS_FALSE
ENABLE_EXTENSIONS_TRUE
+USE_PERSISTENT_MALLOC_FALSE
+USE_PERSISTENT_MALLOC_TRUE
LIBSIGSEGV_PREFIX
LTLIBSIGSEGV
LIBSIGSEGV
@@ -12536,7 +12538,18 @@ fi
printf "%s\n" "#define USE_PERSISTENT_MALLOC 1" >>confdefs.h
+ use_persistent_malloc=yes
+ else
+ use_persistent_malloc=no
fi
+ if test "$use_persistent_malloc" = "yes"; then
+ USE_PERSISTENT_MALLOC_TRUE=
+ USE_PERSISTENT_MALLOC_FALSE='#'
+else
+ USE_PERSISTENT_MALLOC_TRUE='#'
+ USE_PERSISTENT_MALLOC_FALSE=
+fi
+
# Check whether --enable-extensions was given.
@@ -13853,6 +13866,10 @@ if test -z "${TEST_CROSS_COMPILE_TRUE}" && test -z
"${TEST_CROSS_COMPILE_FALSE}"
as_fn_error $? "conditional \"TEST_CROSS_COMPILE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${USE_PERSISTENT_MALLOC_TRUE}" && test -z
"${USE_PERSISTENT_MALLOC_FALSE}"; then
+ as_fn_error $? "conditional \"USE_PERSISTENT_MALLOC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${ENABLE_EXTENSIONS_TRUE}" && test -z
"${ENABLE_EXTENSIONS_FALSE}"; then
as_fn_error $? "conditional \"ENABLE_EXTENSIONS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/custom.h b/custom.h
index afd323b9..0ca53222 100644
--- a/custom.h
+++ b/custom.h
@@ -113,3 +113,16 @@ typedef unsigned long long uint_fast64_t;
#define ximalloc xmalloc
#include "mbsupport.h" /* defines stuff for DJGPP to fake MBS */
+
+#ifdef USE_PERSISTENT_MALLOC
+#include <stdlib.h>
+#include "pma.h"
+#define malloc pma_malloc
+#define calloc pma_calloc
+#define realloc pma_realloc
+#define free pma_free
+#else /* ! USE_PERSISTENT_MALLOC */
+#define pma_init(verbose, file) /* nothing */
+#define pma_get_root() NULL
+#define pma_set_root(rootptr) /* nothing */
+#endif /* ! USE_PERSISTENT_MALLOC */
diff --git a/m4/ChangeLog b/m4/ChangeLog
index 234dd111..53877585 100644
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,8 @@
+2022-06-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * pma.m4: Set shell variable use_persistent_malloc so that
+ we can test it from a Makefile.am.
+
2022-05-26 Arnold D. Robbins <arnold@skeeve.com>
* pma.m4: New file.
diff --git a/m4/pma.m4 b/m4/pma.m4
index a9fcd79e..388808ea 100644
--- a/m4/pma.m4
+++ b/m4/pma.m4
@@ -12,5 +12,9 @@ AC_DEFUN([GAWK_USE_PERSISTENT_MALLOC],
if test $ac_cv_func_mmap = yes && test $ac_cv_func_munmap = yes
then
AC_DEFINE(USE_PERSISTENT_MALLOC, 1, [Define to 1 if we can use the pma
allocator])
+ use_persistent_malloc=yes
+ else
+ use_persistent_malloc=no
fi
+ AM_CONDITIONAL([USE_PERSISTENT_MALLOC], [test "$use_persistent_malloc" =
"yes"])
])
diff --git a/main.c b/main.c
index 2cdd1e2d..da0aafe0 100644
--- a/main.c
+++ b/main.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2021,
+ * Copyright (C) 1986, 1988, 1989, 1991-2022,
* the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
@@ -51,6 +51,7 @@ typedef void *stackoverflow_context_t;
static const char *varfile = DEFAULT_VARFILE;
const char *command_file = NULL; /* debugger commands */
+const char *persist_file = NULL; /* backing file for PMA */
static void usage(int exitval, FILE *fp) ATTRIBUTE_NORETURN;
static void copyleft(void) ATTRIBUTE_NORETURN;
@@ -152,6 +153,7 @@ bool do_itrace = false; /* provide
simple instruction trace */
bool do_optimize = true; /* apply default optimizations */
static int do_nostalgia = false; /* provide a blast from the past */
static int do_binary = false; /* hands off my data! */
+static int do_persist = false; /* use persistent memory */
static int do_version = false; /* print version info */
static const char *locale = ""; /* default value to setlocale */
static const char *locale_dir = LOCALEDIR; /* default locale dir */
@@ -203,6 +205,7 @@ static const struct option optab[] = {
{ "parsedebug", no_argument, NULL, 'Y' },
#endif
{ "posix", no_argument, NULL, 'P' },
+ { "persist", required_argument, NULL, 'T' },
{ "pretty-print", optional_argument, NULL, 'o' },
{ "profile", optional_argument, NULL, 'p' },
{ "re-interval", no_argument, NULL, 'r' },
@@ -233,12 +236,14 @@ main(int argc, char **argv)
if (getenv("TIDYMEM") != NULL)
do_flags |= DO_TIDY_MEM;
+#ifndef USE_PERSISTENT_MALLOC
#ifdef HAVE_MCHECK_H
#ifdef HAVE_MTRACE
if (do_tidy_mem)
mtrace();
#endif /* HAVE_MTRACE */
#endif /* HAVE_MCHECK_H */
+#endif /* !USE_PERSISTENT_MALLOC */
myname = gawk_name(argv[0]);
os_arg_fixup(&argc, &argv); /* emulate redirection, expand wildcards */
@@ -291,6 +296,19 @@ main(int argc, char **argv)
(void) stackoverflow_install_handler(catchstackoverflow, extra_stack,
STACK_SIZE);
#undef STACK_SIZE
+ /* initialize global (main) execution context */
+ push_context(new_context());
+
+ /* must be done after init context */
+ parse_args(argc, argv);
+
+ /*
+ * Init the pma allocator. If persist_file is NULL it falls
+ * back to malloc(3) and friends. Do this after parsing
+ * arguments.
+ */
+ pma_init(0, persist_file);
+
/* initialize the null string */
Nnull_string = make_string("", 0);
@@ -305,11 +323,6 @@ main(int argc, char **argv)
output_fp = stdout;
- /* initialize global (main) execution context */
- push_context(new_context());
-
- parse_args(argc, argv);
-
#if defined(LOCALEDEBUG)
if (locale != initial_locale)
set_locale_stuff();
@@ -628,6 +641,7 @@ usage(int exitval, FILE *fp)
fputs(_("\t-s\t\t\t--no-optimize\n"), fp);
fputs(_("\t-S\t\t\t--sandbox\n"), fp);
fputs(_("\t-t\t\t\t--lint-old\n"), fp);
+ fputs(_("\t-T file\t\t\t--persist file\n"), fp);
fputs(_("\t-V\t\t\t--version\n"), fp);
#ifdef NOSTALGIA
fputs(_("\t-W nostalgia\t\t--nostalgia\n"), fp);
@@ -1526,7 +1540,7 @@ parse_args(int argc, char **argv)
/*
* The + on the front tells GNU getopt not to rearrange argv.
*/
- const char *optlist =
"+F:f:v:W;bcCd::D::e:E:ghi:Il:L::nNo::Op::MPrSstVYZ:";
+ const char *optlist =
"+F:f:v:W;bcCd::D::e:E:ghi:Il:L::nNo::Op::MPrSstT:VYZ:";
int old_optind;
int c;
char *scan;
@@ -1648,6 +1662,15 @@ parse_args(int argc, char **argv)
case 't':
do_flags |= DO_LINT_OLD;
break;
+
+ case 'T':
+#ifdef USE_PERSISTENT_MALLOC
+ do_persist = true;
+ persist_file = optarg;
+#else
+ warning(_("gawk was not compiled with persistent memory
support"));
+#endif
+ break;
#else
case 'L':
case 't':
diff --git a/support/ChangeLog b/support/ChangeLog
index be52a7f4..63b5eb81 100644
--- a/support/ChangeLog
+++ b/support/ChangeLog
@@ -1,3 +1,13 @@
+2022-06-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (libsupport_a_SOURCES): Add pma.c if we
+ have USE_PERSISTENT_MALLOC defined.
+ * pma.c (state): Init state to 2 so that malloc will be
+ used before calls to pma_init(). (Why can't the code use
+ enums?!?)
+ (pma_init): Allow state.init to be 0 or 2.
+ (NDEBUG): #undef before including <assert.h>.
+
2022-05-27 Arnold D. Robbins <arnold@skeeve.com>
* pma.c: Updated from Terrence Kelley to compile on
diff --git a/support/Makefile.am b/support/Makefile.am
index f209092a..16778052 100644
--- a/support/Makefile.am
+++ b/support/Makefile.am
@@ -71,6 +71,10 @@ libsupport_a_SOURCES = \
malloc/dynarray_resize.c \
malloc/dynarray_resize_clear.c
+if USE_PERSISTENT_MALLOC
+libsupport_a_SOURCES += pma.c
+endif
+
# For some make's, e.g. OpenBSD, that don't define this
RM = rm -f
diff --git a/support/Makefile.in b/support/Makefile.in
index ed05e03c..a2aee611 100644
--- a/support/Makefile.in
+++ b/support/Makefile.in
@@ -111,6 +111,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
+@USE_PERSISTENT_MALLOC_TRUE@am__append_1 = pma.c
subdir = support
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/arch.m4 \
@@ -141,14 +142,22 @@ am__v_AR_0 = @echo " AR " $@;
am__v_AR_1 =
libsupport_a_AR = $(AR) $(ARFLAGS)
libsupport_a_LIBADD =
+am__libsupport_a_SOURCES_DIST = attribute.h cdefs.h dfa.c dfa.h \
+ dynarray.h flexmember.h getopt.c getopt.h getopt1.c \
+ getopt_int.h idx.h intprops.h libc-config.h localeinfo.c \
+ localeinfo.h random.c random.h regex.c regex.h verify.h \
+ xalloc.h malloc/dynarray.h malloc/dynarray_at_failure.c \
+ malloc/dynarray_emplace_enlarge.c malloc/dynarray_finalize.c \
+ malloc/dynarray_resize.c malloc/dynarray_resize_clear.c pma.c
am__dirstamp = $(am__leading_dot)dirstamp
+@USE_PERSISTENT_MALLOC_TRUE@am__objects_1 = pma.$(OBJEXT)
am_libsupport_a_OBJECTS = dfa.$(OBJEXT) getopt.$(OBJEXT) \
getopt1.$(OBJEXT) localeinfo.$(OBJEXT) random.$(OBJEXT) \
regex.$(OBJEXT) malloc/dynarray_at_failure.$(OBJEXT) \
malloc/dynarray_emplace_enlarge.$(OBJEXT) \
malloc/dynarray_finalize.$(OBJEXT) \
malloc/dynarray_resize.$(OBJEXT) \
- malloc/dynarray_resize_clear.$(OBJEXT)
+ malloc/dynarray_resize_clear.$(OBJEXT) $(am__objects_1)
libsupport_a_OBJECTS = $(am_libsupport_a_OBJECTS)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -167,7 +176,7 @@ depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/dfa.Po ./$(DEPDIR)/getopt.Po \
./$(DEPDIR)/getopt1.Po ./$(DEPDIR)/localeinfo.Po \
- ./$(DEPDIR)/random.Po ./$(DEPDIR)/regex.Po \
+ ./$(DEPDIR)/pma.Po ./$(DEPDIR)/random.Po ./$(DEPDIR)/regex.Po \
malloc/$(DEPDIR)/dynarray_at_failure.Po \
malloc/$(DEPDIR)/dynarray_emplace_enlarge.Po \
malloc/$(DEPDIR)/dynarray_finalize.Po \
@@ -187,7 +196,7 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libsupport_a_SOURCES)
-DIST_SOURCES = $(libsupport_a_SOURCES)
+DIST_SOURCES = $(am__libsupport_a_SOURCES_DIST)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -366,35 +375,13 @@ EXTRA_DIST = \
# what to make and install
noinst_LIBRARIES = libsupport.a
-libsupport_a_SOURCES = \
- attribute.h \
- cdefs.h \
- dfa.c \
- dfa.h \
- dynarray.h \
- flexmember.h \
- getopt.c \
- getopt.h \
- getopt1.c \
- getopt_int.h \
- idx.h \
- intprops.h \
- libc-config.h \
- localeinfo.c \
- localeinfo.h \
- random.c \
- random.h \
- regex.c \
- regex.h \
- verify.h \
- xalloc.h \
- malloc/dynarray.h \
- malloc/dynarray_at_failure.c \
- malloc/dynarray_emplace_enlarge.c \
- malloc/dynarray_finalize.c \
- malloc/dynarray_resize.c \
- malloc/dynarray_resize_clear.c
-
+libsupport_a_SOURCES = attribute.h cdefs.h dfa.c dfa.h dynarray.h \
+ flexmember.h getopt.c getopt.h getopt1.c getopt_int.h idx.h \
+ intprops.h libc-config.h localeinfo.c localeinfo.h random.c \
+ random.h regex.c regex.h verify.h xalloc.h malloc/dynarray.h \
+ malloc/dynarray_at_failure.c malloc/dynarray_emplace_enlarge.c \
+ malloc/dynarray_finalize.c malloc/dynarray_resize.c \
+ malloc/dynarray_resize_clear.c $(am__append_1)
# For some make's, e.g. OpenBSD, that don't define this
RM = rm -f
@@ -467,6 +454,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ #
am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ #
am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/localeinfo.Po@am__quote@ #
am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pma.Po@am__quote@ #
am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/random.Po@am__quote@ #
am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex.Po@am__quote@ #
am--include-marker
@AMDEP_TRUE@@am__include@
@am__quote@malloc/$(DEPDIR)/dynarray_at_failure.Po@am__quote@ #
am--include-marker
@@ -626,6 +614,7 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/getopt.Po
-rm -f ./$(DEPDIR)/getopt1.Po
-rm -f ./$(DEPDIR)/localeinfo.Po
+ -rm -f ./$(DEPDIR)/pma.Po
-rm -f ./$(DEPDIR)/random.Po
-rm -f ./$(DEPDIR)/regex.Po
-rm -f malloc/$(DEPDIR)/dynarray_at_failure.Po
@@ -682,6 +671,7 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/getopt.Po
-rm -f ./$(DEPDIR)/getopt1.Po
-rm -f ./$(DEPDIR)/localeinfo.Po
+ -rm -f ./$(DEPDIR)/pma.Po
-rm -f ./$(DEPDIR)/random.Po
-rm -f ./$(DEPDIR)/regex.Po
-rm -f malloc/$(DEPDIR)/dynarray_at_failure.Po
diff --git a/support/pma.c b/support/pma.c
index d769bb0e..139402f9 100644
--- a/support/pma.c
+++ b/support/pma.c
@@ -24,6 +24,7 @@
*/
#define _DEFAULT_SOURCE // for MAP_ANONYMOUS
+#undef NDEBUG
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
@@ -131,7 +132,7 @@ static struct {
vrb; // verbsity level
const char * file; // name of backing file
pma_hdr_t * hdr; // addr where backing file is mapped
-} state;
+} state = { 2 }; // default to using malloc until inited
#define ASI assert(1 == state.init || 2 == state.init)
@@ -371,7 +372,8 @@ int pma_init(int verbose, const char *file) {
pma_hdr_t *h;
assert(0 <= verbose && 3 >= verbose);
state.vrb = verbose;
- if (state.init) { ERR("already initialized\n"); assert(0); SERL; }
+ // allow pass through to malloc before init
+ if (0 != state.init && 2 != state.init) { ERR("already initialized\n");
assert(0); SERL; }
FYI("pma software version \"%s\" header version \"%s\", expects backing file
format version %d\n",
pma_version, PMA_H_VERSION, VERS);
assert(0 == strcmp(pma_version, PMA_H_VERSION));
diff --git a/test/ChangeLog b/test/ChangeLog
index 3f263224..b40d5bd6 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
+2022-06-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * badargs.ok: Updated after code change.
+
2022-05-24 Adam Van Scyoc <avanscy@g.clemson.edu>
* Makefile.am (EXTRA_DIST): getlnfa, new test.
diff --git a/test/badargs.ok b/test/badargs.ok
index ea022461..6dada17b 100644
--- a/test/badargs.ok
+++ b/test/badargs.ok
@@ -30,6 +30,7 @@ Short options: GNU long options: (extensions)
-s --no-optimize
-S --sandbox
-t --lint-old
+ -T file --persist file
-V --version
To report bugs, use the `gawkbug' program.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 10 ++++++++++
awklib/ChangeLog | 5 +++++
awklib/Makefile.am | 2 +-
awklib/Makefile.in | 2 +-
configure | 17 +++++++++++++++++
custom.h | 13 +++++++++++++
m4/ChangeLog | 5 +++++
m4/pma.m4 | 4 ++++
main.c | 37 +++++++++++++++++++++++++++++-------
support/ChangeLog | 10 ++++++++++
support/Makefile.am | 4 ++++
support/Makefile.in | 54 ++++++++++++++++++++++-------------------------------
support/pma.c | 6 ++++--
test/ChangeLog | 4 ++++
test/badargs.ok | 1 +
15 files changed, 131 insertions(+), 43 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, feature/pma, updated. gawk-4.1.0-4739-ga0df079b,
Arnold Robbins <=