Skip to content

Commit

Permalink
thirdparty: update the Boehm GC libs/headers to version 8.3.0 (commit…
Browse files Browse the repository at this point in the history
… #f7e513a) (#20772)
  • Loading branch information
joe-conigliaro committed Feb 10, 2024
1 parent 3f1b3d2 commit 215ab13
Show file tree
Hide file tree
Showing 19 changed files with 28,106 additions and 16,661 deletions.
42,508 changes: 26,485 additions & 16,023 deletions thirdparty/libgc/gc.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion thirdparty/libgc/include/gc.h
@@ -1,2 +1,2 @@
/* This file is installed for backward compatibility. */
#include <gc/gc.h>
#include "gc/gc.h"
206 changes: 106 additions & 100 deletions thirdparty/libgc/include/gc/cord.h

Large diffs are not rendered by default.

84 changes: 44 additions & 40 deletions thirdparty/libgc/include/gc/cord_pos.h
Expand Up @@ -5,7 +5,7 @@
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
Expand All @@ -24,9 +24,9 @@
/* the implementation of some exported macros relies on it. */
/* Don't use anything defined here and not in cord.h. */

# define MAX_DEPTH 48
#define CORD_MAX_DEPTH 48
/* The maximum depth of a balanced cord + 1. */
/* We don't let cords get deeper than MAX_DEPTH. */
/* We do not let cords get deeper than this maximum. */

struct CORD_pe {
CORD pe_cord;
Expand All @@ -37,71 +37,74 @@ struct CORD_pe {
/* to current position. */
typedef struct CORD_Pos {
size_t cur_pos;

int path_len;
# define CORD_POS_INVALID (0x55555555)
/* path_len == INVALID <==> position invalid */
# define CORD_POS_INVALID 0x55555555
/* path_len == CORD_POS_INVALID <==> position invalid */

const char *cur_leaf; /* Current leaf, if it is a string. */
/* If the current leaf is a function, */
/* then this may point to function_buf */
/* containing the next few characters. */
/* Always points to a valid string */
/* containing the current character */
/* unless cur_end is 0. */
size_t cur_start; /* Start position of cur_leaf */
size_t cur_end; /* Ending position of cur_leaf */
size_t cur_start; /* Start position of cur_leaf. */
size_t cur_end; /* Ending position of cur_leaf; */
/* 0 if cur_leaf is invalid. */
struct CORD_pe path[MAX_DEPTH + 1];
struct CORD_pe path[CORD_MAX_DEPTH + 1];
/* path[path_len] is the leaf corresponding to cur_pos */
/* path[0].pe_cord is the cord we point to. */
# define FUNCTION_BUF_SZ 8
char function_buf[FUNCTION_BUF_SZ]; /* Space for next few chars */
/* from function node. */
# define CORD_FUNCTION_BUF_SZ 8
char function_buf[CORD_FUNCTION_BUF_SZ];
/* Space for next few chars */
/* from function node. */
} CORD_pos[1];

/* Extract the cord from a position: */
CORD_API CORD CORD_pos_to_cord(CORD_pos p);
/* Extract the cord from a position. */
CORD_API CORD CORD_pos_to_cord(CORD_pos);

/* Extract the current index from a position: */
CORD_API size_t CORD_pos_to_index(CORD_pos p);
/* Extract the current index from a position. */
CORD_API size_t CORD_pos_to_index(CORD_pos);

/* Fetch the character located at the given position: */
CORD_API char CORD_pos_fetch(CORD_pos p);
/* Fetch the character located at the given position. */
CORD_API char CORD_pos_fetch(CORD_pos);

/* Initialize the position to refer to the give cord and index. */
/* Note that this is the most expensive function on positions: */
CORD_API void CORD_set_pos(CORD_pos p, CORD x, size_t i);
/* Initialize the position to refer to the given cord and index. */
/* Note that this is the most expensive function on positions. */
CORD_API void CORD_set_pos(CORD_pos, CORD, size_t /* index */);

/* Advance the position to the next character. */
/* P must be initialized and valid. */
/* Invalidates p if past end: */
CORD_API void CORD_next(CORD_pos p);
/* p must be initialized and valid. */
/* Invalidates p if past end. */
CORD_API void CORD_next(CORD_pos /* p */);

/* Move the position to the preceding character. */
/* P must be initialized and valid. */
/* Invalidates p if past beginning: */
CORD_API void CORD_prev(CORD_pos p);
/* p must be initialized and valid. */
/* Invalidates p if past beginning. */
CORD_API void CORD_prev(CORD_pos /* p */);

/* Is the position valid, i.e. inside the cord? */
CORD_API int CORD_pos_valid(CORD_pos p);
CORD_API int CORD_pos_valid(CORD_pos);

CORD_API char CORD__pos_fetch(CORD_pos);
CORD_API void CORD__next(CORD_pos);
CORD_API void CORD__prev(CORD_pos);

#define CORD_pos_fetch(p) \
(((p)[0].cur_end != 0)? \
#define CORD_pos_fetch(p) \
((p)[0].cur_end != 0 ? \
(p)[0].cur_leaf[(p)[0].cur_pos - (p)[0].cur_start] \
: CORD__pos_fetch(p))

#define CORD_next(p) \
(((p)[0].cur_pos + 1 < (p)[0].cur_end)? \
#define CORD_next(p) \
((p)[0].cur_pos + 1 < (p)[0].cur_end ? \
(p)[0].cur_pos++ \
: (CORD__next(p), 0))
: (CORD__next(p), 0U))

#define CORD_prev(p) \
(((p)[0].cur_end != 0 && (p)[0].cur_pos > (p)[0].cur_start)? \
#define CORD_prev(p) \
((p)[0].cur_end != 0 && (p)[0].cur_pos > (p)[0].cur_start ? \
(p)[0].cur_pos-- \
: (CORD__prev(p), 0))
: (CORD__prev(p), 0U))

#define CORD_pos_to_index(p) ((p)[0].cur_pos)

Expand All @@ -110,16 +113,17 @@ CORD_API void CORD__prev(CORD_pos);
#define CORD_pos_valid(p) ((p)[0].path_len != CORD_POS_INVALID)

/* Some grubby stuff for performance-critical friends: */
#define CORD_pos_chars_left(p) ((long)((p)[0].cur_end) - (long)((p)[0].cur_pos))

#define CORD_pos_chars_left(p) ((long)(p)[0].cur_end - (long)(p)[0].cur_pos)
/* Number of characters in cache. <= 0 ==> none */

#define CORD_pos_advance(p,n) ((p)[0].cur_pos += (n) - 1, CORD_next(p))
/* Advance position by n characters */
/* 0 < n < CORD_pos_chars_left(p) */
/* Advance position by n characters; */
/* 0 < n < CORD_pos_chars_left(p). */

#define CORD_pos_cur_char_addr(p) \
(p)[0].cur_leaf + ((p)[0].cur_pos - (p)[0].cur_start)
/* address of current character in cache. */
((p)[0].cur_leaf + ((p)[0].cur_pos - (p)[0].cur_start))
/* Address of the current character in cache. */

#ifdef __cplusplus
} /* extern "C" */
Expand Down
27 changes: 12 additions & 15 deletions thirdparty/libgc/include/gc/ec.h
Expand Up @@ -5,7 +5,7 @@
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
Expand All @@ -14,9 +14,9 @@
#ifndef EC_H
#define EC_H

# ifndef CORD_H
# include "cord.h"
# endif
#ifndef CORD_H
# include "cord.h"
#endif

#ifdef __cplusplus
extern "C" {
Expand All @@ -36,7 +36,7 @@
*
* ...
* CORD_ec_init(x);
* while(...) {
* while (...) {
* c = getc(f);
* ...
* CORD_ec_append(x, c);
Expand All @@ -47,26 +47,23 @@
* may be replaced by a call to CORD_to_char_star.
*/

# ifndef CORD_BUFSZ
#ifndef CORD_BUFSZ
# define CORD_BUFSZ 128
# endif
#endif

/* This structure represents the concatenation of ec_cord with */
/* ec_buf[0 .. ec_bufptr-ec_buf-1]. */
typedef struct CORD_ec_struct {
CORD ec_cord;
char * ec_bufptr;
char ec_buf[CORD_BUFSZ+1];
} CORD_ec[1];

/* This structure represents the concatenation of ec_cord with */
/* ec_buf[0 ... (ec_bufptr-ec_buf-1)] */

/* Flush the buffer part of the extended cord into ec_cord. */
/* Note that this is almost the only real function, and it is */
/* implemented in 6 lines in cordxtra.c */
void CORD_ec_flush_buf(CORD_ec x);
CORD_API void CORD_ec_flush_buf(CORD_ec);

/* Convert an extensible cord to a cord. */
# define CORD_ec_to_cord(x) (CORD_ec_flush_buf(x), (x)[0].ec_cord)
#define CORD_ec_to_cord(x) (CORD_ec_flush_buf(x), (x)[0].ec_cord)

/* Initialize an extensible cord. */
#define CORD_ec_init(x) \
Expand All @@ -80,7 +77,7 @@ void CORD_ec_flush_buf(CORD_ec x);

/* Append a cord to an extensible cord. Structure remains shared with */
/* original. */
void CORD_ec_append_cord(CORD_ec x, CORD s);
CORD_API void CORD_ec_append_cord(CORD_ec, CORD);

#ifdef __cplusplus
} /* extern "C" */
Expand Down

0 comments on commit 215ab13

Please sign in to comment.