Skip to content

Commit a8ba987

Browse files
authored
Sync to version 3.20.7
2 parents dac31b7 + dc04222 commit a8ba987

92 files changed

Lines changed: 24196 additions & 1089 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGES.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,57 @@
33
This is just generated output from commits in [this repository](https://github.com/Oldes/Rebol3). For full log use [GitHub commits](https://github.com/Oldes/Rebol3/commits/master).
44

55

6+
## 2025 December
7+
8+
### Features:
9+
10+
* [`7df1d4`](https://github.com/Oldes/Rebol3/commit/7df1d445e4e73591f16b4f1720d6a38649f97c24) Add `recycle/pool` to free empty memory pool segments
11+
* [`80a468`](https://github.com/Oldes/Rebol3/commit/80a4683c10306245314d1c0cf961ea5b8d95d508) Add optional LZ4 de/compression
12+
13+
### Changes:
14+
15+
* [`bc42bf`](https://github.com/Oldes/Rebol3/commit/bc42bfc0f35f56209ade1a77d8b4fb10eb1132ad) Refactoring of SYS-LOAD and SYS-BASE (#153)
16+
17+
No substantive changes—intent is to better elucidate the LOAD and DO processes with an eye to review and modification. Where possible, word names are expanded and reflect what each value represents, not what they are.
18+
* [`ce497a`](https://github.com/Oldes/Rebol3/commit/ce497af725f018b6ea5e2ca439d9def16b69218d) Update link to the latest MiniAudio extension (version 0.11.23)
19+
* [`bf8dbc`](https://github.com/Oldes/Rebol3/commit/bf8dbcbdf685d3cd0654d868fe9d269f5812f314) Using `libdeflate` sources for `deflate`, `zlib` and `gzip` compressions
20+
21+
Here are test results from my notebook:
22+
```
23+
c:\Dev\Builder\tree\rebol\Rebol\src\tests>rebol_3.20.7 -s test-deflate.r3
24+
Rebol/version: 3.20.7
25+
Data length: 1039872
26+
Test: [checksum data 'crc32]
27+
Time: 0.000112
28+
Test: [checksum data 'adler32]
29+
Time: 0.000077
30+
Test: [compress/level data 'deflate 9]
31+
Time: 0.028716
32+
33+
c:\Dev\Builder\tree\rebol\Rebol\src\tests>rebol_3.20.0 -s test-deflate.r3
34+
Rebol/version: 3.20.0
35+
Data length: 1039872
36+
Test: [checksum data 'crc32]
37+
Time: 0.003945
38+
Test: [checksum data 'adler32]
39+
Time: 0.000667
40+
Test: [compress/level data 'deflate 9]
41+
Time: 0.076221
42+
```
43+
* [`f14224`](https://github.com/Oldes/Rebol3/commit/f14224009b0cc7313f2f99444a4e9aabc525b34f) Gracefully release memory in debug builds to help detect leaks
44+
45+
- Gracefully disposes all memory only when `quit` is used, and only in builds compiled with the `DEBUG` define.
46+
- Some guru meditation `evoke` chants are available only in `DEBUG` builds.
47+
- `recycle` now returns the number of bytes released from the heap (memory released to pools is not reported).
48+
- `stats` returns the total number of bytes currently allocated from the heap.
49+
- In debug builds, it is possible to monitor memory allocations using `evoke 'watch-alloc`
50+
51+
### Fixes:
52+
53+
* [`07bfe8`](https://github.com/Oldes/Rebol3/commit/07bfe85740b43f44e55fc2715a7d73f2e43bd79b) Properly parse double quotes in Unicode escape sequences (#154)
54+
* [`25ba57`](https://github.com/Oldes/Rebol3/commit/25ba5731cef1bb8b96c8f073f8e13563f7de7e6d) Do not dispose cryptography when it is not included
55+
56+
657

758
## 2025 November
859

@@ -14,12 +65,16 @@ This is just generated output from commits in [this repository](https://github.c
1465

1566
### Changes:
1667

68+
* [`d34ea4`](https://github.com/Oldes/Rebol3/commit/d34ea4d317bc87f5a388a64daae9f5c3edf3dfc5) Update xxhash source to version 0.8.3
69+
* [`a7d7e3`](https://github.com/Oldes/Rebol3/commit/a7d7e304c41ef6ea1e5577b34ca9a48165b346f3) Additional fixes related to Register_Compress_Method integration
1770
* [`e349a7`](https://github.com/Oldes/Rebol3/commit/e349a7e29136db1e1300944762e4b5b0b5a837ec) Initialize optional compression methods using Register_Compress_Method
1871
* [`57b590`](https://github.com/Oldes/Rebol3/commit/57b590799344f467abea5ca69491131ca7a70e29) Update Brotli source to version 1.2.0
1972
* [`76425d`](https://github.com/Oldes/Rebol3/commit/76425d1e31d776162741e8e81c39da584ad6e84c) Unify definitions of endianness-related macros
2073

2174
### Fixes:
2275

76+
* [`683095`](https://github.com/Oldes/Rebol3/commit/683095bc2e86a77bb17dd2742e368b4c5b77f971) Handle TLS handshake record received in multiple chunks
77+
* [`da4162`](https://github.com/Oldes/Rebol3/commit/da416289d1322082e607265c541470caf79d6f98) Pass none as the error argument when an extension returns an error without a message
2378
* [`47fd36`](https://github.com/Oldes/Rebol3/commit/47fd3671a61a11c4975cbff6dabfdc79e1134eaa) Validate handle data is not NULL before releasing
2479
* [`c8397b`](https://github.com/Oldes/Rebol3/commit/c8397b8b8755e52281142c2daf0a3820c4416f5f) Missing argument for throw-http-error in the HTTP scheme
2580
* [`67f5da`](https://github.com/Oldes/Rebol3/commit/67f5da5d8d730b442a058daccdb6d242d55cc3aa) TLS protocol: handle site using TLS1.2 with rss_pss signature algorithm

NOTICE

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
REBOL [R3] Language Interpreter and Run-time Environment
22
Copyright 2012 REBOL Technologies
3-
Copyright 2012-2021 Rebol Open Source Developers
3+
Copyright 2012-2025 Rebol Open Source Developers
44
REBOL is a trademark of REBOL Technologies
55
Licensed under the Apache License, Version 2.0
66
See included LICENSE file for details
@@ -16,10 +16,19 @@ Credits for Non-REBOL orginated C files and modules
1616
* Unicode encoding/decoding functions:
1717
Copyright 2001-2004 Unicode, Inc.
1818

19-
* ZLIB general purpose compression library:
19+
* libdeflate:
20+
Copyright 2016 Eric Biggers
21+
Copyright 2024 Google LLC
22+
MIT - https://github.com/ebiggers/libdeflate
23+
24+
* ZLIB general purpose compression library (optional):
2025
Version 1.3.1.1, 1-Apr-2025
2126
Copyright 1995-2024 Jean-loup Gailly and Mark Adler
2227

28+
* LZ4 (optional):
29+
Copyright (c) Yann Collet
30+
BSD - https://github.com/lz4/lz4
31+
2332
* LZAV (optional):
2433
Copyright (C) 2023-2025, Aleksey Vaneev
2534
MIT - https://github.com/avaneev/lzav

make/rebol3.nest

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ temp: %make/tmp/
1818
stack-size: 4194304 ;= 4MB (4 * 1024 * 1024)
1919
optimize: 2
2020

21-
version: 3.20.5
21+
version: 3.20.7
22+
23+
;flags: "-ggdb3"
24+
;define: DEBUG
2225

2326
#if Linux? [ defines: TO_LINUX ]
2427
#if macOS? [ defines: TO_MACOS ]
@@ -270,7 +273,6 @@ core-files: [
270273
; %core/u-rc4.c ;optional, use: include-cryptography
271274
; %core/u-rsa.c ;optional, use: include-cryptography
272275
; %core/u-uECC.c ;optional, use: include-cryptography
273-
%core/u-zlib.c
274276
; %core/u-wav.c ;optional, use: include-native-wav-codec
275277

276278
%core/u-mbedtls.c
@@ -451,7 +453,7 @@ include-image-natives: [
451453
]
452454

453455
include-native-bmp-codec: [config: INCLUDE_BMP_CODEC core-files: %core/u-bmp.c]
454-
include-native-png-codec: [config: INCLUDE_PNG_CODEC core-files: %core/u-png.c]
456+
include-native-png-codec: [config: INCLUDE_PNG_CODEC core-files: %core/u-png.c core-files: %core/u-zlib.c]
455457
include-native-qoi-codec: [config: INCLUDE_QOI_CODEC core-files: %core/u-qoi.c]
456458
include-native-jpg-codec: [config: INCLUDE_JPG_CODEC core-files: %core/u-jpg.c]
457459
include-native-gif-codec: [config: INCLUDE_GIF_CODEC core-files: %core/u-gif.c]
@@ -786,6 +788,15 @@ include-lzma-compression: [
786788
core-files: %core/u-lzma.c
787789
]
788790

791+
include-lz4-compression: [
792+
config: INCLUDE_LZ4
793+
include: %src/core/lz4/
794+
files: [
795+
%core/lz4/lz4.c
796+
%core/lz4/lz4hc.c
797+
]
798+
]
799+
789800
include-lzav-compression: [
790801
config: INCLUDE_LZAV
791802
]
@@ -841,6 +852,28 @@ include-brotli-compression: [
841852
]
842853
]
843854

855+
include-zlib-compression: [
856+
;= Original but slower Adler's implementation.
857+
config: INCLUDE_DEPRECATED_ZLIB
858+
core-files: %core/u-zlib.c
859+
]
860+
include-deflate-compression: [
861+
config: INCLUDE_DEFLATE
862+
core-files: [
863+
%core/deflate/lib/adler32.c
864+
%core/deflate/lib/crc32.c
865+
%core/deflate/lib/deflate_compress.c
866+
%core/deflate/lib/deflate_decompress.c
867+
%core/deflate/lib/gzip_compress.c
868+
%core/deflate/lib/gzip_decompress.c
869+
%core/deflate/lib/utils.c
870+
%core/deflate/lib/zlib_compress.c
871+
%core/deflate/lib/zlib_decompress.c
872+
%core/deflate/lib/x86/cpu_features.c
873+
%core/deflate/lib/arm/cpu_features_arm.c
874+
]
875+
]
876+
844877
include-png-filter-native: [
845878
config: INCLUDE_PNG_FILTER
846879
core-files: %core/u-png-filter.c
@@ -944,6 +977,11 @@ include-prebol: [mezz-lib-files: %modules/prebol.reb ]
944977
include-native-oid: [core-files: %core/n-oid.c] ; `form-oid` native (used in DER codec)
945978

946979

980+
;- Deflate is part of the Base!
981+
982+
;:include-zlib-compression ;= Original Adler's implementation
983+
:include-deflate-compression ;= libdeflate's zlib, gzip and deflate
984+
947985
;- Product specifications
948986

949987
include-rebol-core: [
@@ -977,6 +1015,7 @@ include-rebol-bulk: [
9771015
:include-rebol-core
9781016
:include-optional-checksums
9791017
:include-image-natives
1018+
:include-lz4-compression
9801019
:include-lzav-compression
9811020
:include-lzma-compression ;= cca 17kB
9821021
:include-lzw-compression ;= cca 2kB

src/boot/natives.reb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ recycle: native [
250250
/ballast {Trigger for auto-recycle (memory used)}
251251
size [integer!]
252252
/torture {Constant recycle (for internal debugging)}
253+
/pools {Release empty memory pool segments}
253254
]
254255

255256
release: native [

src/boot/strings.reb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,14 @@ errs:
133133
"** Near: "
134134

135135
watch:
136+
;; Used with: evoke 'watch-recycle
136137
"RECYCLING: "
137138
"%d series"
138139
"obj-copy: %d %m"
140+
"EMPTY(pool=%d, seg=%x, size=%d)"
141+
;; Used with: evoke 'watch-alloc (only in debug builds)
142+
"ALLOC: %d"
143+
"FREE: %d"
139144

140145
extension:
141146
"RX_Init"

src/boot/sysobj.reb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,12 @@ catalog: object [
120120
quoted-printable: #(bitset! #{FFFFFFFFFFFFFFFBFFFFFFFFFFFFFFFF})
121121
]
122122
structs: make map! [] ;; filled using `register` native function
123+
compressions: [
124+
; will be filled on boot from `Init_Compression` in `u-compress.c`
125+
]
123126
checksums: [
124127
; will be filled on boot from `Init_Crypt` in `n-crypt.c
125128
]
126-
compressions: [deflate zlib gzip] ;; these are always available
127129
elliptic-curves: [
128130
; will be filled on boot from `Init_Crypt` in `n-crypt.c`
129131
]
@@ -266,7 +268,7 @@ modules: object [
266268
blurhash: https://github.com/Siskin-framework/Rebol-BlurHash/releases/download/1.0.0/
267269
easing: https://github.com/Siskin-framework/Rebol-Easing/releases/download/1.0.0/
268270
mathpresso: https://github.com/Siskin-framework/Rebol-MathPresso/releases/download/0.1.0/
269-
miniaudio: https://github.com/Oldes/Rebol-MiniAudio/releases/download/0.11.18.0/
271+
miniaudio: https://github.com/Oldes/Rebol-MiniAudio/releases/download/0.11.23.0/
270272
speak: https://github.com/Oldes/Rebol-Speak/releases/download/0.0.1/
271273
sqlite: https://github.com/Siskin-framework/Rebol-SQLite/releases/download/3.46.0.0/
272274
triangulate: https://github.com/Siskin-framework/Rebol-Triangulate/releases/download/1.6.0.0/

src/boot/words.reb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,9 @@ bits
288288
crash
289289
crash-dump
290290
watch-recycle
291+
watch-expand
291292
watch-obj-copy
293+
watch-alloc
292294
stack-size
293295

294296
;call/info

src/core/a-lib.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,16 @@ extern int Do_Callback(REBSER *obj, u32 name, RXIARG *args, RXIARG *result);
172172
REBSER *ser;
173173

174174
if (bin) {
175+
#ifdef INCLUDE_DEPRECATED_ZLIB
175176
spec.data = bin;
176177
spec.tail = len;
177-
ser = DecompressZlib(&spec, 0, -1, 0, 0);
178+
ser = DecompressZlibDeprecated(&spec, 0, -1, 0, 0);
179+
#else
180+
REBINT err = 0;
181+
DecompressZlib(bin, len, -1, &ser, &err);
182+
if (err) return 1;
183+
#endif
178184
if (!ser) return 1;
179-
180185
val = BLK_SKIP(Sys_Context, SYS_CTX_BOOT_HOST);
181186
Set_Binary(val, ser);
182187
}
@@ -322,12 +327,19 @@ extern int Do_Callback(REBSER *obj, u32 name, RXIARG *args, RXIARG *result);
322327
#endif
323328

324329
//Cloak(TRUE, code, NAT_SPEC_SIZE, &key[0], 20, TRUE);
330+
#ifdef INCLUDE_DEPRECATED_ZLIB
325331
spec.data = bin;
326332
spec.tail = length;
327-
text = DecompressZlib(&spec, 0, -1, 0, 0);
333+
text = DecompressZlibDeprecated(&spec, 0, -1, 0, 0);
334+
#else
335+
REBINT err = 0;
336+
DecompressZlib(bin, length, -1, &text, &err);
337+
if (err) return FALSE;
338+
#endif
328339
if (!text) return FALSE;
329340
Append_Byte(text, 0);
330341

342+
331343
#ifdef DUMP_INIT_SCRIPT
332344
f = _open("host-boot.reb", _O_CREAT | _O_RDWR, _S_IREAD | _S_IWRITE );
333345
_write(f, STR_HEAD(text), LEN_BYTES(STR_HEAD(text)));

src/core/b-init.c

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ extern const REBYTE Str_Banner[];
123123
if (rargs->options & RO_VERS) {
124124
Out_Str(cb_cast(REBOL_VERSION), 0, FALSE);
125125
Out_Str(cb_cast("\n"), 0, FALSE);
126-
OS_Exit(0);
126+
OS_Exit(0, 0);
127127
}
128128
}
129129

@@ -169,18 +169,21 @@ extern const REBYTE Str_Banner[];
169169
// first four bytes of Native_Specs is a little-endian 32-bit
170170
// length of the uncompressed spec data.
171171
{
172-
REBSER spec;
173-
REBSER *text;
174-
REBCNT textlen;
172+
REBSER* text;
173+
REBCNT textlen = Bytes_To_REBCNT(Native_Specs);
175174

175+
#ifdef INCLUDE_DEPRECATED_ZLIB
176+
REBSER spec;
176177
// REVIEW: This is a nasty casting away of a const. But there's
177178
// nothing that can be done about it as long as Decompress takes
178179
// a REBSER, as the data field is not const
179180
spec.data = ((REBYTE*)Native_Specs) + 4;
180181
spec.tail = NAT_SPEC_SIZE;
181-
182-
textlen = Bytes_To_REBCNT(Native_Specs);
183-
text = DecompressZlib(&spec, 0, -1, textlen, 0);
182+
text = DecompressZlibDeprecated(&spec, 0, -1, textlen, 0);
183+
#else
184+
REBINT err = 0;
185+
DecompressZlib(((REBYTE*)Native_Specs) + 4, NAT_SPEC_SIZE, textlen, &text, &err);
186+
#endif
184187
if (!text || (STR_LEN(text) != textlen)) Crash(RP_BOOT_DATA);
185188
boot = Scan_Source(STR_HEAD(text), textlen);
186189
//Dump_Block_Raw(boot, 0, 2);
@@ -1009,6 +1012,10 @@ static void Set_Option_File(REBCNT field, REBYTE* src, REBOOL dir )
10091012
PG_Boot_Level = BOOT_LEVEL_FULL;
10101013
PG_Mem_Usage = 0;
10111014
PG_Mem_Limit = 0;
1015+
#ifdef DEBUG
1016+
PG_Mem_Make = 0;
1017+
PG_Mem_Free = 0;
1018+
#endif
10121019
PG_Reb_Stats = Make_CMem(sizeof(*PG_Reb_Stats));
10131020
Halt_State = 0;
10141021
Reb_Opts = Make_CMem(sizeof(*Reb_Opts));
@@ -1115,6 +1122,11 @@ static void Set_Option_File(REBCNT field, REBYTE* src, REBOOL dir )
11151122
if(!Task_Series)
11161123
return; // can happen when close button, shutdown, etc.
11171124

1125+
#ifdef DEBUG
1126+
// Turn off watching memory (not possible after releasing output buffers)
1127+
Reb_Opts->watch_alloc = 0;
1128+
#endif
1129+
11181130
Free_Series(Task_Series);
11191131
if (PG_Boot_Phase > BOOT_START) {
11201132
Free_Series(Bind_Table);
@@ -1147,9 +1159,20 @@ static void Set_Option_File(REBCNT field, REBYTE* src, REBOOL dir )
11471159
Dispose_Ports();
11481160
Dispose_Mold();
11491161
Dispose_CRC();
1150-
Free_Mem(PG_Boot_Strs, 0);
1162+
#ifdef INCLUDE_CRYPTOGRAPHY
1163+
Dispose_Crypt();
1164+
#endif
1165+
Dispose_Compression();
1166+
Dispose_Handles();
1167+
Free_Mem(PG_Boot_Strs, RS_MAX * sizeof(REBYTE*));
11511168
}
11521169
Dispose_StdIO();
1153-
Free_Mem(PG_Reb_Stats, 0);
1154-
Free_Mem(Reb_Opts, 0);
1170+
Dispose_Pools();
1171+
Free_Mem(PG_Reb_Stats, sizeof(*PG_Reb_Stats));
1172+
Free_Mem(Reb_Opts, sizeof(*Reb_Opts));
1173+
#ifdef DEBUG
1174+
if (PG_Mem_Make != PG_Mem_Free || PG_Mem_Usage > 0)
1175+
printf("PG_Mem_Make: %llu free: %llu used: %llu\n", PG_Mem_Make, PG_Mem_Free, PG_Mem_Usage);
1176+
#endif
1177+
ASSERT1(PG_Mem_Free == PG_Mem_Make, RP_MISC);
11551178
}

0 commit comments

Comments
 (0)