Bugfix in runtime and documentation

This commit is contained in:
Dmitry Boulytchev 2020-03-21 13:05:14 +03:00
parent c084e57b27
commit e4b34a3ec1
5 changed files with 18 additions and 13 deletions

Binary file not shown.

View file

@ -555,13 +555,15 @@ extern void* Lsubstring (void *subj, int p, int l) {
}
extern struct re_pattern_buffer *Lregexp (char *regexp) {
struct re_pattern_buffer *b =
(struct re_pattern_buffer*) malloc (sizeof (struct re_pattern_buffer));
regex_t *b = (regex_t*) malloc (sizeof (regex_t));
b->translate = 0;
b->fastmap = 0;
b->buffer = 0;
b->allocated = 0;
b->fastmap = 0;
// A weird workaround: should be 0/0 in theory,
// but is does not work sometimes. The exact number is
// determined experimentally :((
b->buffer = malloc (256);
b->allocated = 256;
int n = (int) re_compile_pattern (regexp, strlen (regexp), b);
@ -1426,7 +1428,7 @@ extern void __gc_root_scan_stack ();
/* ======================================== */
//static size_t SPACE_SIZE = 16;
static size_t SPACE_SIZE = 16 * 1024 * 1024;
static size_t SPACE_SIZE = 32 * 1024 * 1024;
// static size_t SPACE_SIZE = 128;
// static size_t SPACE_SIZE = 1024 * 1024;
@ -1728,7 +1730,7 @@ static inline void init_extra_roots (void) {
extern void init_pool (void) {
size_t space_size = SPACE_SIZE * sizeof(size_t);
from_space.begin = mmap (NULL, space_size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT, -1, 0);
MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT, -1, 0);
to_space.begin = NULL;
if (to_space.begin == MAP_FAILED) {
perror ("EROOR: init_pool: mmap failed\n");
@ -1922,6 +1924,7 @@ extern void * alloc (size_t size) {
#endif
return p;
}
init_to_space (0);
#ifdef DEBUG_PRINT
print_indent ();

View file

@ -104,10 +104,10 @@ The following symbols are treated as delimiters:
\begin{lstlisting}
. , ( ) { }
; # ->
; # -> |
\end{lstlisting}
Despite custom infix operators can coincide with delimiters "\lstinline|#|" and "\lstinline|->|" they can
never clash as neither of these delimiters can be encountered in expressions in infix operator position.
Note, custom infix operators can coincide with delimiters "\lstinline|#|", "\lstinline!|!", and "\lstinline|->|", which can
sometimes be misleading.

View file

@ -1 +1 @@
let version = "Version 1.00, 5db12d76, Fri Mar 13 19:41:14 2020 +0300"
let version = "Version 1.00, c084e57b2, Sun Mar 15 12:41:31 2020 +0300"

View file

@ -8,7 +8,9 @@
-- (e.g. "identifier", "string constant", etc.), used for error
-- reporting
public fun createRegexp (r, name) {
[regexp (r), name]
local l = [regexp (r), name];
--printf ("Created regexp %s: %x, %x\n", name, l, l[0]);
l
}
-- Create an immutable matcher.