Squashed 'lispBM/lispBM/' changes from 9d85c18f..2b5f30cd

2b5f30cd version 0.25.0
f68282ee exposed the lbm_request_gc_ function in the eval_cps interface
bcde5f97 adding profiling script to repl directory

git-subtree-dir: lispBM/lispBM
git-subtree-split: 2b5f30cdbe94c7ef48798dc7382f87578c7fe76e
This commit is contained in:
Benjamin Vedder 2024-07-26 11:58:45 +02:00
parent f004fddcac
commit 1ce9df6ad6
32 changed files with 115699 additions and 3 deletions

View File

@ -371,7 +371,10 @@ lbm_value lbm_find_receiver_and_send(lbm_cid cid, lbm_value msg);
* \return 1 on success * \return 1 on success
*/ */
int lbm_perform_gc(void); int lbm_perform_gc(void);
/** Request that the runtime system performs a garbage collection on its earliers convenience.
* Can be called from any thread and does NOT require that the evaluator is paused.
*/
void lbm_request_gc(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -27,14 +27,21 @@ extern "C" {
/** LBM major version */ /** LBM major version */
#define LBM_MAJOR_VERSION 0 #define LBM_MAJOR_VERSION 0
/** LBM minor version */ /** LBM minor version */
#define LBM_MINOR_VERSION 24 #define LBM_MINOR_VERSION 25
/** LBM patch revision */ /** LBM patch revision */
#define LBM_PATCH_VERSION 0 #define LBM_PATCH_VERSION 0
#define LBM_VERSION_STRING "0.24.0" #define LBM_VERSION_STRING "0.25.0"
/*! \page changelog Changelog /*! \page changelog Changelog
JUL 23 2024: Version 0.25.0
- Multiple bugfixes.
- Trap function on expressions.
- Reference manual updates.
- New String operations (Thanks Rasmus S)
- Order of writes changed when writing to flash.
APR 28 2024: Version 0.24.0 APR 28 2024: Version 0.24.0
- Cleaning of lispbm repository. less to maintain. - Cleaning of lispbm repository. less to maintain.
- Lots of improvements to documentation. - Lots of improvements to documentation.

12
repl/profile.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
src=$1
valgrind --toggle-collect=lbm_run_eval --tool=callgrind --callgrind-out-file=cg.out ./repl --terminate -s $src
gprof2dot -f callgrind cg.out -o cg.dot
dot -Tpdf cg.dot -o cg.pdf
rm cg.out
rm cg.dot

View File

@ -0,0 +1,616 @@
------------------------------------------------------------
Heap size: 1024
Streaming source: no
Incremental read: no
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: take
*** After: 100
In context: 497
Current intermediate result: 100
Current local environment:
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
CONT[0]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
100
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 25 seconds
------------------------------------------------------------
Heap size: 1024
Streaming source: no
Incremental read: yes
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: take
*** After: 100
In context: 497
Current intermediate result: 100
Current local environment:
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
0u
~CHANNEL~
CONT[20]
~CHANNEL~
nil
CONT[17]
~CHANNEL~
1u
CONT[15]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
100
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 25 seconds
------------------------------------------------------------
Heap size: 1024
Streaming source: yes
Incremental read: no
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: take
*** After: 100
In context: 497
Current intermediate result: 100
Current local environment:
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
CONT[0]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
100
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 25 seconds
------------------------------------------------------------
Heap size: 1024
Streaming source: yes
Incremental read: yes
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: take
*** After: 100
In context: 497
Current intermediate result: 100
Current local environment:
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
0u
~CHANNEL~
CONT[20]
~CHANNEL~
nil
CONT[17]
~CHANNEL~
1u
CONT[15]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
100
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 25 seconds
------------------------------------------------------------
Heap size: 512
Streaming source: no
Incremental read: no
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: range
*** After: n
In context: 497
Current intermediate result: n
Current local environment:
n = 1000
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
CONT[0]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
nil
(100)
1u
CONT[5]
range
0
1000
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 25 seconds
------------------------------------------------------------
Heap size: 512
Streaming source: no
Incremental read: yes
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: range
*** After: n
In context: 497
Current intermediate result: n
Current local environment:
n = 1000
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
0u
~CHANNEL~
CONT[20]
~CHANNEL~
nil
CONT[17]
~CHANNEL~
1u
CONT[15]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
nil
(100)
1u
CONT[5]
range
0
1000
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 25 seconds
------------------------------------------------------------
Heap size: 512
Streaming source: yes
Incremental read: no
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: range
*** After: n
In context: 497
Current intermediate result: n
Current local environment:
n = 1000
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
CONT[0]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
nil
(100)
1u
CONT[5]
range
0
1000
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 25 seconds
------------------------------------------------------------
Heap size: 512
Streaming source: yes
Incremental read: yes
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: range
*** After: n
In context: 497
Current intermediate result: n
Current local environment:
n = 1000
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
0u
~CHANNEL~
CONT[20]
~CHANNEL~
nil
CONT[17]
~CHANNEL~
1u
CONT[15]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
nil
(100)
1u
CONT[5]
range
0
1000
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 25 seconds

View File

@ -0,0 +1,616 @@
------------------------------------------------------------
Heap size: 1024
Streaming source: no
Incremental read: no
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: take
*** After: 100
In context: 497
Current intermediate result: 100
Current local environment:
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
CONT[0]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
100
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 10 seconds
------------------------------------------------------------
Heap size: 1024
Streaming source: no
Incremental read: yes
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: take
*** After: 100
In context: 497
Current intermediate result: 100
Current local environment:
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
0u
~CHANNEL~
CONT[20]
~CHANNEL~
nil
CONT[17]
~CHANNEL~
1u
CONT[15]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
100
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 10 seconds
------------------------------------------------------------
Heap size: 1024
Streaming source: yes
Incremental read: no
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: take
*** After: 100
In context: 497
Current intermediate result: 100
Current local environment:
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
CONT[0]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
100
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 10 seconds
------------------------------------------------------------
Heap size: 1024
Streaming source: yes
Incremental read: yes
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: take
*** After: 100
In context: 497
Current intermediate result: 100
Current local environment:
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
0u
~CHANNEL~
CONT[20]
~CHANNEL~
nil
CONT[17]
~CHANNEL~
1u
CONT[15]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
100
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 10 seconds
------------------------------------------------------------
Heap size: 512
Streaming source: no
Incremental read: no
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: range
*** After: n
In context: 497
Current intermediate result: n
Current local environment:
n = 1000
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
CONT[0]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
nil
(100)
1u
CONT[5]
range
0
1000
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 10 seconds
------------------------------------------------------------
Heap size: 512
Streaming source: no
Incremental read: yes
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: range
*** After: n
In context: 497
Current intermediate result: n
Current local environment:
n = 1000
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
0u
~CHANNEL~
CONT[20]
~CHANNEL~
nil
CONT[17]
~CHANNEL~
1u
CONT[15]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
nil
(100)
1u
CONT[5]
range
0
1000
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 10 seconds
------------------------------------------------------------
Heap size: 512
Streaming source: yes
Incremental read: no
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: range
*** After: n
In context: 497
Current intermediate result: n
Current local environment:
n = 1000
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
CONT[0]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
nil
(100)
1u
CONT[5]
range
0
1000
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 10 seconds
------------------------------------------------------------
Heap size: 512
Streaming source: yes
Incremental read: yes
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: range
*** After: n
In context: 497
Current intermediate result: n
Current local environment:
n = 1000
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
0u
~CHANNEL~
CONT[20]
~CHANNEL~
nil
CONT[17]
~CHANNEL~
1u
CONT[15]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
nil
(100)
1u
CONT[5]
range
0
1000
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 10 seconds

View File

@ -0,0 +1,616 @@
------------------------------------------------------------
Heap size: 1024
Streaming source: no
Incremental read: no
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: take
*** After: 100
In context: 497
Current intermediate result: 100
Current local environment:
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
CONT[0]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
100
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 10 seconds
------------------------------------------------------------
Heap size: 1024
Streaming source: no
Incremental read: yes
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: take
*** After: 100
In context: 497
Current intermediate result: 100
Current local environment:
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
0u
~CHANNEL~
CONT[20]
~CHANNEL~
nil
CONT[17]
~CHANNEL~
1u
CONT[15]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
100
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 10 seconds
------------------------------------------------------------
Heap size: 1024
Streaming source: yes
Incremental read: no
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: take
*** After: 100
In context: 497
Current intermediate result: 100
Current local environment:
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
CONT[0]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
100
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 10 seconds
------------------------------------------------------------
Heap size: 1024
Streaming source: yes
Incremental read: yes
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: take
*** After: 100
In context: 497
Current intermediate result: 100
Current local environment:
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
0u
~CHANNEL~
CONT[20]
~CHANNEL~
nil
CONT[17]
~CHANNEL~
1u
CONT[15]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
100
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 10 seconds
------------------------------------------------------------
Heap size: 512
Streaming source: no
Incremental read: no
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: range
*** After: n
In context: 497
Current intermediate result: n
Current local environment:
n = 1000
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
CONT[0]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
nil
(100)
1u
CONT[5]
range
0
1000
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 10 seconds
------------------------------------------------------------
Heap size: 512
Streaming source: no
Incremental read: yes
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: range
*** After: n
In context: 497
Current intermediate result: n
Current local environment:
n = 1000
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
0u
~CHANNEL~
CONT[20]
~CHANNEL~
nil
CONT[17]
~CHANNEL~
1u
CONT[15]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
nil
(100)
1u
CONT[5]
range
0
1000
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 10 seconds
------------------------------------------------------------
Heap size: 512
Streaming source: yes
Incremental read: no
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: range
*** After: n
In context: 497
Current intermediate result: n
Current local environment:
n = 1000
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
CONT[0]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
nil
(100)
1u
CONT[5]
range
0
1000
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 10 seconds
------------------------------------------------------------
Heap size: 512
Streaming source: yes
Incremental read: yes
------------------------------------------------------------
Opening file: tests/test_take_iota_0.lisp
Memory initialized.
LBM Initialized
Constants memory initialized
Events initialized.
Array extensions initialized.
Math extensions initialized.
String extensions initialized.
Runtime extensions initialized.
Matvec extensions initialized.
Random extensions initialized.
Loop extensions initialized.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Extension added.
Result check extension added.
extension load extension added.
LBM memory free: 3599 words, 14396 bytes
Wait for pause init
Wait for pause init
test_cid = 497
Program loaded
*** Error: out_of_memory
*** In: range
*** After: n
In context: 497
Current intermediate result: n
Current local environment:
n = 1000
Current global environment:
iota = (closure (n) (range 0 n) nil)
Stack:
CONT[0]
0u
~CHANNEL~
CONT[20]
~CHANNEL~
nil
CONT[17]
~CHANNEL~
1u
CONT[15]
check
nil
nil
1u
CONT[5]
eq
nil
((iota 100))
1u
CONT[5]
take
nil
(100)
1u
CONT[5]
range
0
1000
Thread 497 finished: out_of_memory
experiment failed due to taking longer than 10 seconds

View File

@ -0,0 +1,82 @@
BUILDING
rm *.exe
rm test_lisp_code_cps
gcc -g -O2 -Wall -Wextra -Wshadow -Wconversion -Wclobbered -pedantic -std=c99 -m32 ..//src/env.c ..//src/fundamental.c ..//src/heap.c ..//src/lbm_memory.c ..//src/print.c ..//src/stack.c ..//src/symrepr.c ..//src/tokpar.c ..//src/extensions.c ..//src/lispbm.c ..//src/eval_cps.c ..//src/lbm_c_interop.c ..//src/lbm_custom_type.c ..//src/lbm_channel.c ..//src/lbm_flat_value.c ..//src/lbm_flags.c ..//src/lbm_prof.c ..//src/extensions/array_extensions.c ..//src/extensions/string_extensions.c ..//src/extensions/math_extensions.c ..//src/extensions/runtime_extensions.c ..//src/extensions/matvec_extensions.c ..//src/extensions/random_extensions.c ..//src/extensions/loop_extensions.c ..//src/extensions/set_extensions.c ..//platform/linux/src/platform_mutex.c -lm test_lisp_code_cps.c -o test_lisp_code_cps.exe -I../include -I..//platform/linux/include -lpthread -lm
gcc -g -O2 -Wall -Wextra -Wshadow -Wconversion -Wclobbered -pedantic -std=c99 -m32 ..//src/env.c ..//src/fundamental.c ..//src/heap.c ..//src/lbm_memory.c ..//src/print.c ..//src/stack.c ..//src/symrepr.c ..//src/tokpar.c ..//src/extensions.c ..//src/lispbm.c ..//src/eval_cps.c ..//src/lbm_c_interop.c ..//src/lbm_custom_type.c ..//src/lbm_channel.c ..//src/lbm_flat_value.c ..//src/lbm_flags.c ..//src/lbm_prof.c ..//src/extensions/array_extensions.c ..//src/extensions/string_extensions.c ..//src/extensions/math_extensions.c ..//src/extensions/runtime_extensions.c ..//src/extensions/matvec_extensions.c ..//src/extensions/random_extensions.c ..//src/extensions/loop_extensions.c ..//src/extensions/set_extensions.c ..//platform/linux/src/platform_mutex.c -lm test_enc_dec.c -o test_enc_dec.exe -I../include -I..//platform/linux/include -lpthread -lm
gcc -g -O2 -Wall -Wextra -Wshadow -Wconversion -Wclobbered -pedantic -std=c99 -m32 ..//src/env.c ..//src/fundamental.c ..//src/heap.c ..//src/lbm_memory.c ..//src/print.c ..//src/stack.c ..//src/symrepr.c ..//src/tokpar.c ..//src/extensions.c ..//src/lispbm.c ..//src/eval_cps.c ..//src/lbm_c_interop.c ..//src/lbm_custom_type.c ..//src/lbm_channel.c ..//src/lbm_flat_value.c ..//src/lbm_flags.c ..//src/lbm_prof.c ..//src/extensions/array_extensions.c ..//src/extensions/string_extensions.c ..//src/extensions/math_extensions.c ..//src/extensions/runtime_extensions.c ..//src/extensions/matvec_extensions.c ..//src/extensions/random_extensions.c ..//src/extensions/loop_extensions.c ..//src/extensions/set_extensions.c ..//platform/linux/src/platform_mutex.c -lm test_heap_alloc.c -o test_heap_alloc.exe -I../include -I..//platform/linux/include -lpthread -lm
mv test_lisp_code_cps.exe test_lisp_code_cps
PERFORMING TESTS: 2024-07-23_15-17
DEC/ENC 0: ok
DEC/ENC 1: ok
DEC/ENC 2: ok
DEC/ENC 3: ok
DEC/ENC 4: ok
DEC/ENC 5: ok
DEC/ENC 6: ok
DEC/ENC 7: ok
DEC/ENC 8: ok
DEC/ENC 9: ok
DEC/ENC 10: ok
DEC/ENC 11: ok
DEC/ENC 12: ok
DEC/ENC 13: ok
DEC/ENC 14: ok
DEC/ENC 15: ok
------------------------------------------------------------
test_enc_dec.exe SUCCESS
------------------------------------------------------------
Initialized symrepr: OK
Initialized heap: OK
Allocated 1048576 heap cells: OK
HEAP allocation when full test: OK
------------------------------------------------------------
test_heap_alloc.exe SUCCESS
------------------------------------------------------------
Configuration: -t 25 -h 32768
Configuration: -t 25 -i -h 32768
Configuration: -t 25 -s -h 32768
Configuration: -t 25 -i -s -h 32768
Configuration: -t 25 -h 16384
Configuration: -t 25 -i -h 16384
Configuration: -t 25 -s -h 16384
Configuration: -t 25 -i -s -h 16384
Configuration: -t 25 -h 8192
Configuration: -t 25 -i -h 8192
Configuration: -t 25 -s -h 8192
Configuration: -t 25 -i -s -h 8192
Configuration: -t 25 -h 4096
Configuration: -t 25 -i -h 4096
Configuration: -t 25 -s -h 4096
Configuration: -t 25 -i -s -h 4096
Configuration: -t 25 -h 2048
Configuration: -t 25 -i -h 2048
Configuration: -t 25 -s -h 2048
Configuration: -t 25 -i -s -h 2048
Configuration: -t 25 -h 1024
tests/test_take_iota_0.lisp FAILED
Configuration: -t 25 -i -h 1024
tests/test_take_iota_0.lisp FAILED
Configuration: -t 25 -s -h 1024
tests/test_take_iota_0.lisp FAILED
Configuration: -t 25 -i -s -h 1024
tests/test_take_iota_0.lisp FAILED
Configuration: -t 25 -h 512
tests/test_take_iota_0.lisp FAILED
Configuration: -t 25 -i -h 512
tests/test_take_iota_0.lisp FAILED
Configuration: -t 25 -s -h 512
tests/test_take_iota_0.lisp FAILED
Configuration: -t 25 -i -s -h 512
tests/test_take_iota_0.lisp FAILED
(OK - expected to fail) test_lisp_code_cps -t 25 -h 1024 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -t 25 -i -h 1024 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -t 25 -s -h 1024 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -t 25 -i -s -h 1024 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -t 25 -h 512 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -t 25 -i -h 512 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -t 25 -s -h 512 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -t 25 -i -s -h 512 tests/test_take_iota_0.lisp
Tests passed: 17410
Tests failed: 8
Expected fails: 8
Actual fails: 0

View File

@ -0,0 +1,984 @@
#0
src/print.c:67: error: Null Dereference
pointer `array` last assigned on line 61 could be null and is dereferenced at line 67, column 28.
65. // Highly unlikely that array is a recognizable NULL though.
66. // If it is incorrect, it is most likely arbitrary.
67. char *c_data = (char *)array->data;
^
68. if (array->size == 1) {
69. *str = c_data;
#1
include/lbm_custom_type.h:69: error: Null Dereference
pointer `m` last assigned on line 68 could be null and is dereferenced at line 69, column 25.
67. if (lbm_type_of(value) == LBM_TYPE_CUSTOM) {
68. lbm_uint *m = (lbm_uint*)lbm_dec_custom(value);
69. return (const char*)m[CUSTOM_TYPE_DESCRIPTOR];
^
70. }
71. return NULL;
#2
include/lbm_custom_type.h:76: error: Null Dereference
pointer `m` last assigned on line 75 could be null and is dereferenced at line 76, column 10.
74. static inline lbm_uint lbm_get_custom_value(lbm_value value) {
75. lbm_uint *m = (lbm_uint*)lbm_dec_custom(value);
76. return m[CUSTOM_TYPE_VALUE];
^
77. }
78.
#3
src/extensions/array_extensions.c:105: error: Null Dereference
pointer `array` last assigned on line 104 could be null and is dereferenced at line 105, column 29.
103. }
104. lbm_array_header_t *array = (lbm_array_header_t *)lbm_car(args[0]);
105. if (lbm_memory_ptr_inside(array->data)) {
^
106. lbm_memory_free((lbm_uint *)array->data);
107. lbm_uint ptr = lbm_dec_ptr(args[0]);
#4
src/extensions/array_extensions.c:131: error: Null Dereference
pointer `array` last assigned on line 127 could be null and is dereferenced at line 131, column 18.
129. lbm_int value = lbm_dec_as_i32(args[2]);
130.
131. if (index >= array->size) {
^
132. return res;
133. }
#5
src/heap.c:128: error: Dead Store
The value written to `&res` (type `unsigned int`) is never used.
126.
127. static lbm_value enc_64_on_32(uint8_t *source, lbm_uint type_qual, lbm_uint type) {
128. lbm_value res = ENC_SYM_MERROR;
^
129. res = lbm_cons(ENC_SYM_NIL,ENC_SYM_NIL);
130. if (lbm_type_of(res) != LBM_TYPE_SYMBOL) {
#6
src/heap.c:197: error: Null Dereference
pointer `data` last assigned on line 196 could be null and is dereferenced by call to `memcpy()` at line 197, column 3.
195. double d;
196. uint32_t *data = (uint32_t*)lbm_car(x);
197. memcpy(&d, data, sizeof(double));
^
198. return d;
199. #else
#7
src/heap.c:211: error: Null Dereference
pointer `data` last assigned on line 210 could be null and is dereferenced by call to `memcpy()` at line 211, column 3.
209. uint64_t u;
210. uint32_t *data = (uint32_t*)lbm_car(x);
211. memcpy(&u, data, 8);
^
212. return u;
213. #else
#8
src/heap.c:222: error: Null Dereference
pointer `data` last assigned on line 221 could be null and is dereferenced by call to `memcpy()` at line 222, column 3.
220. int64_t i;
221. uint32_t *data = (uint32_t*)lbm_car(x);
222. memcpy(&i, data, 8);
^
223. return i;
224. #else
#9
src/heap.c:234: error: Null Dereference
pointer `array` last assigned on line 233 could be null and is dereferenced at line 234, column 19.
232. if (lbm_is_array_r(val)) {
233. lbm_array_header_t *array = (lbm_array_header_t *)lbm_car(val);
234. res = (char *)array->data;
^
235. }
236. return res;
#10
src/lbm_flat_value.c:277: error: Null Dereference
pointer `header` last assigned on line 276 could be null and is dereferenced at line 277, column 38.
275. int sum = 4 + 1; // sizeof(uint32_t) + 1;
276. lbm_array_header_t *header = (lbm_array_header_t*)lbm_car(v);
277. lbm_value *arrdata = (lbm_value*)header->data;
^
278. lbm_uint size = header->size / sizeof(lbm_value);
279. for (lbm_uint i = 0; i < size; i ++ ) {
#11
src/fundamental.c:263: error: Null Dereference
pointer `a_` last assigned on line 255 could be null and is dereferenced at line 263, column 9.
261. // if (a_ == NULL || b_ == NULL) return false; // Not possible to properly report error from here.
262.
263. if (a_->size == b_->size) {
^
264. return (memcmp((char*)a_->data, (char*)b_->data, a_->size) == 0);
265. }
#12
src/fundamental.c:263: error: Null Dereference
pointer `b_` last assigned on line 256 could be null and is dereferenced at line 263, column 21.
261. // if (a_ == NULL || b_ == NULL) return false; // Not possible to properly report error from here.
262.
263. if (a_->size == b_->size) {
^
264. return (memcmp((char*)a_->data, (char*)b_->data, a_->size) == 0);
265. }
#13
src/print.c:270: error: Null Dereference
pointer `array` last assigned on line 269 could be null and is dereferenced by call to `print_emit_array_data()` at line 270, column 10.
268.
269. lbm_array_header_t *array = (lbm_array_header_t*)lbm_car(v);
270. return print_emit_array_data(chan, array);
^
271. }
272.
#14
src/fundamental.c:274: error: Null Dereference
pointer `a_` last assigned on line 272 could be null and is dereferenced at line 274, column 36.
272. lbm_array_header_t *a_ = (lbm_array_header_t*)lbm_car(a);
273. lbm_array_header_t *b_ = (lbm_array_header_t*)lbm_car(b);
274. lbm_value *adata = (lbm_value*)a_->data;
^
275. lbm_value *bdata = (lbm_value*)b_->data;
276. if ( a_->size == b_->size) {
#15
src/fundamental.c:275: error: Null Dereference
pointer `b_` last assigned on line 273 could be null and is dereferenced at line 275, column 36.
273. lbm_array_header_t *b_ = (lbm_array_header_t*)lbm_car(b);
274. lbm_value *adata = (lbm_value*)a_->data;
275. lbm_value *bdata = (lbm_value*)b_->data;
^
276. if ( a_->size == b_->size) {
277. uint32_t size = a_->size / (sizeof(lbm_value));
#16
src/extensions/array_extensions.c:300: error: Null Dereference
pointer `array` last assigned on line 295 could be null and is dereferenced at line 300, column 18.
298. lbm_uint value = lbm_dec_as_u32(args[2]);
299.
300. if (index >= array->size) {
^
301. return res;
302. }
#17
src/lbm_c_interop.c:292: error: Null Dereference
pointer `array` last assigned on line 291 could be null and is dereferenced at line 292, column 11.
290.
291. lbm_array_header_t *array = (lbm_array_header_t *)lbm_car(fv);
292. *size = array->size;
^
293. *data = array->data;
294. return true;
#18
src/lbm_flat_value.c:350: error: Null Dereference
pointer `header` last assigned on line 349 could be null and is dereferenced at line 350, column 38.
348. case LBM_TYPE_LISPARRAY: {
349. lbm_array_header_t *header = (lbm_array_header_t*)lbm_car(v);
350. lbm_value *arrdata = (lbm_value*)header->data;
^
351. lbm_uint size = header->size / sizeof(lbm_value);
352. if (!f_lisp_array(fv, size)) return FLATTEN_VALUE_ERROR_NOT_ENOUGH_MEMORY;
#19
src/extensions/string_extensions.c:548: error: Null Dereference
pointer `array` last assigned on line 546 could be null and is dereferenced at line 548, column 41.
546. lbm_array_header_t *array = (lbm_array_header_t *)lbm_car(args[0]);
547.
548. return lbm_enc_i((int)strlen_max(str, array->size));
^
549. }
550.
#20
src/extensions/array_extensions.c:565: error: Null Dereference
pointer `array` last assigned on line 560 could be null and is dereferenced at line 565, column 18.
563. lbm_uint value = 0;
564.
565. if (index >= array->size) {
^
566. return res;
567. }
#21
src/extensions/array_extensions.c:598: error: Null Dereference
pointer `array` last assigned on line 593 could be null and is dereferenced at line 598, column 20.
596. lbm_uint value = 0;
597.
598. if (index+1 >= array->size) {
^
599. return res;
600. }
#22
src/extensions/string_extensions.c:630: error: Null Dereference
pointer `header` last assigned on line 627 could be null and is dereferenced at line 630, column 30.
628. (lbm_array_header_t *)lbm_car(lbm_car(current));
629.
630. lbm_int len = (lbm_int)header->size - 1;
^
631. if (len < 0) {
632. // substr is zero length array
#23
src/extensions/string_extensions.c:595: error: Null Dereference
pointer `str_header` last assigned on line 594 could be null and is dereferenced at line 595, column 37.
593.
594. lbm_array_header_t *str_header = (lbm_array_header_t *)lbm_car(args[0]);
595. const char *str = (const char *)str_header->data;
^
596. lbm_int str_size = (lbm_int)str_header->size;
597.
#24
src/extensions/array_extensions.c:643: error: Null Dereference
pointer `array` last assigned on line 638 could be null and is dereferenced at line 643, column 20.
641. uint32_t value = 0;
642.
643. if (index+3 >= array->size) {
^
644. return res;
645. }
#25
src/extensions/array_extensions.c:684: error: Null Dereference
pointer `array` last assigned on line 679 could be null and is dereferenced at line 684, column 18.
682. lbm_int value = 0;
683.
684. if (index >= array->size) {
^
685. return res;
686. }
#26
src/extensions/array_extensions.c:718: error: Null Dereference
pointer `array` last assigned on line 713 could be null and is dereferenced at line 718, column 20.
716. lbm_int value = 0;
717.
718. if (index+1 >= array->size) {
^
719. return res;
720. }
#27
src/extensions/array_extensions.c:763: error: Null Dereference
pointer `array` last assigned on line 758 could be null and is dereferenced at line 763, column 20.
761. lbm_int value = 0;
762.
763. if (index+2 >= array->size) {
^
764. return res;
765. }
#28
src/extensions/array_extensions.c:811: error: Null Dereference
pointer `array` last assigned on line 806 could be null and is dereferenced at line 811, column 20.
809. uint32_t value = 0;
810.
811. if (index+3 >= array->size) {
^
812. return res;
813. }
#29
src/extensions/array_extensions.c:860: error: Null Dereference
pointer `array` last assigned on line 855 could be null and is dereferenced at line 860, column 20.
858. uint32_t value = 0;
859.
860. if (index+3 >= array->size) {
^
861. return res;
862. }
#30
src/fundamental.c:854: error: Null Dereference
pointer `arr` last assigned on line 849 could be null and is dereferenced at line 854, column 25.
852. // Check that array points into lbm_memory.
853. // Additionally check that it is a zero-terminated string.
854. char *str = (char *)arr->data;
^
855. lbm_uint sym;
856. if (lbm_get_symbol_by_name(str, &sym)) {
#31
src/extensions/array_extensions.c:892: error: Null Dereference
pointer `array` last assigned on line 891 could be null and is dereferenced at line 892, column 30.
890. lbm_is_array_r(args[0])) {
891. lbm_array_header_t *array = (lbm_array_header_t *)lbm_car(args[0]);
892. res = lbm_enc_i((lbm_int)array->size);
^
893. }
894. return res;
#32
src/fundamental.c:940: error: Null Dereference
pointer `header` last assigned on line 939 could be null and is dereferenced at line 940, column 40.
938. lbm_value val = args[2];
939. lbm_array_header_t *header = (lbm_array_header_t*)lbm_car(args[0]);
940. lbm_value *arrdata = (lbm_value*)header->data;
^
941. lbm_uint size = header->size / sizeof(lbm_value);
942. if (index < size) {
#33
src/eval_cps.c:1004: error: Null Dereference
pointer `sptr` last assigned on line 1003 could be null and is dereferenced at line 1004, column 21.
1002. if (v == EXCEPTION_HANDLER) {
1003. lbm_value *sptr = get_stack_ptr(ctx_running, 2);
1004. lbm_set_car(sptr[0], ENC_SYM_EXIT_ERROR);
^
1005. stack_reserve(ctx_running, 1)[0] = EXCEPTION_HANDLER;
1006. ctx_running->app_cont = true;
#34
src/heap.c:1259: error: Null Dereference
pointer `header` last assigned on line 1258 could be null and is dereferenced at line 1259, column 19.
1257. if (lbm_is_array_r(arr)) {
1258. lbm_array_header_t *header = (lbm_array_header_t*)lbm_car(arr);
1259. r = (uint8_t*)header->data;
^
1260. }
1261. return r;
#35
src/heap.c:1268: error: Null Dereference
pointer `header` last assigned on line 1267 could be null and is dereferenced at line 1268, column 19.
1266. if (lbm_is_array_rw(arr)) {
1267. lbm_array_header_t *header = (lbm_array_header_t*)lbm_car(arr);
1268. r = (uint8_t*)header->data;
^
1269. }
1270. return r;
#36
src/fundamental.c:1380: error: Null Dereference
pointer `header` last assigned on line 1379 could be null and is dereferenced at line 1380, column 38.
1378. if (nargs == 1 && lbm_is_lisp_array_r(args[0])) {
1379. lbm_array_header_t *header = (lbm_array_header_t*)lbm_car(args[0]);
1380. lbm_value *arrdata = (lbm_value*)header->data;
^
1381. lbm_uint size = (header->size / sizeof(lbm_uint));
1382. res = lbm_heap_allocate_list(size);
#37
src/eval_cps.c:1585: error: Null Dereference
pointer `sptr` last assigned on line 1584 could be null and is dereferenced at line 1585, column 5.
1583. }
1584. lbm_value *sptr = stack_reserve(ctx, 3);
1585. sptr[0] = ctx->curr_exp;
^
1586. sptr[1] = ctx->curr_env;
1587. sptr[2] = RESUME;
#38
src/eval_cps.c:1629: error: Null Dereference
pointer `sptr` last assigned on line 1628 could be null and is dereferenced at line 1629, column 5.
1627. if (lbm_is_cons(exps)) {
1628. lbm_uint *sptr = stack_reserve(ctx, 4);
1629. sptr[0] = ctx->curr_env; // env to restore between expressions in progn
^
1630. sptr[1] = lbm_enc_u(0); // Has env been copied (needed for progn local bindings)
1631. sptr[3] = PROGN_REST;
#39
src/eval_cps.c:1685: error: Null Dereference
pointer `sptr` last assigned on line 1682 could be null and is dereferenced at line 1685, column 5.
1683. if (lbm_is_symbol(parts[KEY]) && lbm_is_symbol_nil(rest)) {
1684. lbm_uint sym_val = lbm_dec_sym(parts[KEY]);
1685. sptr[0] = parts[KEY];
^
1686. if (sym_val >= RUNTIME_SYMBOLS_START) {
1687. sptr[1] = SET_GLOBAL_ENV;
#40
src/eval_cps.c:1744: error: Null Dereference
pointer `sptr` last assigned on line 1743 could be null and is dereferenced at line 1744, column 3.
1742. lbm_value cdr = get_cdr(ctx->curr_exp);
1743. lbm_value *sptr = stack_reserve(ctx, 3);
1744. sptr[0] = get_cdr(cdr);
^
1745. sptr[1] = ctx->curr_env;
1746. sptr[2] = IF;
#41
src/eval_cps.c:1867: error: Null Dereference
pointer `sptr` last assigned on line 1866 could be null and is dereferenced at line 1867, column 3.
1865.
1866. lbm_uint *sptr = stack_reserve(ctx, 5);
1867. sptr[0] = exp;
^
1868. sptr[1] = cdr_binds;
1869. sptr[2] = env;
#42
src/eval_cps.c:1929: error: Null Dereference
pointer `sptr` last assigned on line 1928 could be null and is dereferenced at line 1929, column 3.
1927. extract_n(ctx->curr_exp, parts, 3);
1928. lbm_value *sptr = stack_reserve(ctx, 3);
1929. sptr[0] = ctx->curr_env;
^
1930. sptr[1] = parts[1];
1931. sptr[2] = SETQ;
#43
src/eval_cps.c:1938: error: Null Dereference
pointer `sptr` last assigned on line 1937 could be null and is dereferenced at line 1938, column 3.
1936. lbm_value args = get_cdr(ctx->curr_exp);
1937. lbm_value *sptr = stack_reserve(ctx,2);
1938. sptr[0] = args;
^
1939. sptr[1] = MOVE_TO_FLASH;
1940. ctx->app_cont = true;
#44
src/eval_cps.c:1951: error: Null Dereference
pointer `sptr` last assigned on line 1950 could be null and is dereferenced at line 1951, column 3.
1949. extract_n(get_cdr(ctx->curr_exp), parts, 3);
1950. lbm_value *sptr = stack_reserve(ctx, 3);
1951. sptr[0] = parts[LOOP_BODY];
^
1952. sptr[1] = parts[LOOP_COND];
1953. sptr[2] = LOOP_CONDITION;
#45
src/eval_cps.c:1995: error: Null Dereference
pointer `sptr` last assigned on line 1994 could be null and is dereferenced at line 1995, column 5.
1993. } else {
1994. lbm_value *sptr = stack_reserve(ctx, 3);
1995. sptr[0] = ctx->curr_env;
^
1996. sptr[1] = get_cdr(rest);
1997. sptr[2] = AND;
#46
src/eval_cps.c:2010: error: Null Dereference
pointer `sptr` last assigned on line 2009 could be null and is dereferenced at line 2010, column 5.
2008. } else {
2009. lbm_value *sptr = stack_reserve(ctx, 3);
2010. sptr[0] = ctx->curr_env;
^
2011. sptr[1] = get_cdr(rest);
2012. sptr[2] = OR;
#47
src/eval_cps.c:2042: error: Null Dereference
pointer `sptr` last assigned on line 2041 could be null and is dereferenced at line 2042, column 5.
2040. get_car_and_cdr(rest, &ctx->curr_exp, &cdr_rest);
2041. lbm_value *sptr = stack_reserve(ctx, 3);
2042. sptr[0] = cdr_rest;
^
2043. sptr[1] = ctx->curr_env;
2044. sptr[2] = MATCH;
#48
src/eval_cps.c:2158: error: Null Dereference
pointer `sptr` last assigned on line 2156 could be null and is dereferenced at line 2158, column 20.
2156. lbm_value *sptr = get_stack_ptr(ctx, 3);
2157.
2158. lbm_value rest = sptr[2];
^
2159. lbm_value env = sptr[0];
2160.
#49
src/eval_cps.c:2404: error: Null Dereference
pointer `sptr` last assigned on line 2403 could be null and is dereferenced at line 2404, column 5.
2402. lbm_cid cid = (lbm_cid)lbm_dec_i(args[0]);
2403. lbm_value *sptr = get_stack_ptr(ctx, 2);
2404. sptr[0] = lbm_enc_i(cid);
^
2405. sptr[1] = WAIT;
2406. ctx->r = ENC_SYM_TRUE;
#50
src/eval_cps.c:2592: error: Null Dereference
pointer `array` last assigned on line 2589 could be null and is dereferenced at line 2592, column 24.
2590.
2591. lbm_flat_value_t fv;
2592. fv.buf = (uint8_t*)array->data;
^
2593. fv.buf_size = array->size;
2594. fv.buf_pos = 0;
#51
src/eval_cps.c:2853: error: Dead Store
The value written to `&ls` (type `unsigned int`) is never used.
2851. if (nargs == 2 && lbm_is_list(args[0]) && lbm_is_number(args[1])) {
2852. int len = -1;
2853. lbm_value ls = ENC_SYM_NIL;
^
2854. WITH_GC(ls, lbm_list_copy(&len, args[0]));
2855. int dist = lbm_dec_as_i32(args[1]);
#52
src/eval_cps.c:2979: error: Null Dereference
pointer `sptr` last assigned on line 2977 could be null and is dereferenced at line 2979, column 34.
2977. lbm_uint* sptr = get_stack_ptr(ctx, 5);
2978.
2979. lbm_value arg_env = (lbm_value)sptr[0];
^
2980. lbm_value exp = (lbm_value)sptr[1];
2981. lbm_value clo_env = (lbm_value)sptr[2];
#53
src/eval_cps.c:3024: error: Null Dereference
pointer `sptr` last assigned on line 3023 could be null and is dereferenced at line 3024, column 34.
3022. static void cont_closure_args_rest(eval_context_t *ctx) {
3023. lbm_uint* sptr = get_stack_ptr(ctx, 5);
3024. lbm_value arg_env = (lbm_value)sptr[0];
^
3025. lbm_value exp = (lbm_value)sptr[1];
3026. lbm_value clo_env = (lbm_value)sptr[2];
#54
src/eval_cps.c:3073: error: Null Dereference
pointer `rptr` last assigned on line 3072 could be null and is dereferenced at line 3073, column 5.
3071. sptr[2] = cell->cdr;
3072. lbm_value *rptr = stack_reserve(ctx,2);
3073. rptr[0] = count + (1 << LBM_VAL_SHIFT);
^
3074. rptr[1] = APPLICATION_ARGS;
3075. ctx->curr_exp = cell->car;
#55
src/eval_cps.c:3062: error: Null Dereference
pointer `sptr` last assigned on line 3060 could be null and is dereferenced at line 3062, column 19.
3060. lbm_uint *sptr = get_stack_ptr(ctx, 3);
3061.
3062. lbm_value env = sptr[0];
^
3063. lbm_value rest = sptr[1];
3064. lbm_value count = sptr[2];
#56
src/eval_cps.c:3097: error: Null Dereference
pointer `sptr` last assigned on line 3096 could be null and is dereferenced at line 3097, column 5.
3095. } else {
3096. lbm_value *sptr = stack_reserve(ctx, 3);
3097. sptr[0] = env;
^
3098. sptr[1] = get_cdr(rest);
3099. sptr[2] = AND;
#57
src/eval_cps.c:3117: error: Null Dereference
pointer `sptr` last assigned on line 3116 could be null and is dereferenced at line 3117, column 5.
3115. } else {
3116. lbm_value *sptr = stack_reserve(ctx, 3);
3117. sptr[0] = env;
^
3118. sptr[1] = get_cdr(rest);
3119. sptr[2] = OR;
#58
src/eval_cps.c:3145: error: Null Dereference
pointer `sptr` last assigned on line 3143 could be null and is dereferenced at line 3145, column 20.
3143. lbm_value *sptr = get_stack_ptr(ctx, 4);
3144.
3145. lbm_value rest = sptr[1];
^
3146. lbm_value env = sptr[2];
3147. lbm_value key = sptr[3];
#59
src/eval_cps.c:3178: error: Null Dereference
pointer `sptr` last assigned on line 3176 could be null and is dereferenced at line 3178, column 19.
3176. lbm_value *sptr = pop_stack_ptr(ctx, 2);
3177.
3178. ctx->curr_env = sptr[1];
^
3179. if (lbm_is_symbol_nil(arg)) {
3180. ctx->curr_exp = get_cadr(sptr[0]); // else branch
#60
src/eval_cps.c:3191: error: Null Dereference
pointer `sptr` last assigned on line 3190 could be null and is dereferenced at line 3191, column 35.
3189.
3190. lbm_uint *sptr = get_stack_ptr(ctx, 2);
3191. lbm_value patterns = (lbm_value)sptr[0];
^
3192. lbm_value orig_env = (lbm_value)sptr[1]; // restore enclosing environment.
3193. lbm_value new_env = orig_env;
#61
src/eval_cps.c:3262: error: Null Dereference
pointer `sptr` last assigned on line 3260 could be null and is dereferenced at line 3262, column 19.
3260. lbm_value *sptr = get_stack_ptr(ctx, 6);
3261.
3262. lbm_value ls = sptr[0];
^
3263. lbm_value env = sptr[1];
3264. lbm_value t = sptr[3];
#62
src/eval_cps.c:3311: error: Null Dereference
pointer `sptr` last assigned on line 3309 could be null and is dereferenced at line 3311, column 19.
3309. lbm_value *sptr = get_stack_ptr(ctx, 2);
3310. stack_reserve(ctx,1)[0] = LOOP_CONDITION;
3311. ctx->curr_exp = sptr[1];
^
3312. }
3313.
#63
src/eval_cps.c:3322: error: Null Dereference
pointer `sptr` last assigned on line 3320 could be null and is dereferenced at line 3322, column 19.
3320. lbm_value *sptr = get_stack_ptr(ctx, 2);
3321. stack_reserve(ctx,1)[0] = LOOP;
3322. ctx->curr_exp = sptr[0];
^
3323. }
3324.
#64
src/eval_cps.c:3340: error: Null Dereference
pointer `sptr` last assigned on line 3326 could be null and is dereferenced at line 3340, column 17.
3338. // else
3339. // Set up for a new comparator evaluation and recurse.
3340. lbm_value a = sptr[2];
^
3341. lbm_value b = lbm_cdr(a);
3342. lbm_set_cdr(a, ENC_SYM_NIL); // terminate 1 element list
#65
src/eval_cps.c:3422: error: Null Dereference
pointer `sptr` last assigned on line 3421 could be null and is dereferenced at line 3422, column 29.
3420. static void cont_merge_layer(eval_context_t *ctx) {
3421. lbm_uint *sptr = get_stack_ptr(ctx, 9);
3422. lbm_int layer = lbm_dec_i(sptr[7]);
^
3423. lbm_int len = lbm_dec_i(sptr[8]);
3424.
#66
src/eval_cps.c:3610: error: Null Dereference
pointer `chan` last assigned on line 3605 could be null and is dereferenced by call to `lbm_channel_more()` at line 3610, column 8.
3608. }
3609.
3610. if (!lbm_channel_more(chan) && lbm_channel_is_empty(chan)) {
^
3611. lbm_stack_drop(&ctx->K, 2);
3612. read_finish(chan, ctx);
#67
src/eval_cps.c:3602: error: Null Dereference
pointer `sptr` last assigned on line 3601 could be null and is dereferenced at line 3602, column 22.
3600. static void cont_read_next_token(eval_context_t *ctx) {
3601. lbm_value *sptr = get_stack_ptr(ctx, 2);
3602. lbm_value stream = sptr[0];
^
3603. lbm_value grab_row0 = sptr[1];
3604.
#68
src/eval_cps.c:3920: error: Null Dereference
pointer `sptr` last assigned on line 3919 could be null and is dereferenced at line 3920, column 22.
3918. static void cont_read_start_array(eval_context_t *ctx) {
3919. lbm_value *sptr = get_stack_ptr(ctx, 1);
3920. lbm_value stream = sptr[0];
^
3921.
3922. lbm_char_channel_t *str = lbm_dec_channel(stream);
#69
src/eval_cps.c:3934: error: Null Dereference
pointer `str` last assigned on line 3922 could be null and is dereferenced by call to `lbm_channel_reader_close()` at line 3934, column 7.
3932. initial_size = (lbm_uint)((float)num_free * 0.9);
3933. if (initial_size == 0) {
3934. lbm_channel_reader_close(str);
^
3935. error_ctx(ENC_SYM_MERROR);
3936. }
#70
src/eval_cps.c:3959: error: Null Dereference
pointer `str` last assigned on line 3922 could be null and is dereferenced by call to `lbm_channel_reader_close()` at line 3959, column 5.
3957. ctx->app_cont = true;
3958. } else {
3959. lbm_channel_reader_close(str);
^
3960. read_error_ctx(lbm_channel_row(str), lbm_channel_column(str));
3961. }
#71
src/eval_cps.c:3967: error: Null Dereference
pointer `sptr` last assigned on line 3965 could be null and is dereferenced at line 3967, column 22.
3965. lbm_uint *sptr = get_stack_ptr(ctx, 4);
3966.
3967. lbm_value array = sptr[0];
^
3968. lbm_value size = lbm_dec_as_u32(sptr[1]);
3969. lbm_value ix = lbm_dec_as_u32(sptr[2]);
#72
src/eval_cps.c:4036: error: Null Dereference
pointer `rptr` last assigned on line 4035 could be null and is dereferenced at line 4036, column 7.
4034. case ENC_SYM_DOT: {
4035. lbm_value *rptr = stack_reserve(ctx, 4);
4036. rptr[0] = READ_DOT_TERMINATE;
^
4037. rptr[1] = stream;
4038. rptr[2] = lbm_enc_u(0);
#73
src/eval_cps.c:4060: error: Null Dereference
pointer `rptr` last assigned on line 4059 could be null and is dereferenced at line 4060, column 3.
4058. sptr[2] = stream; // unchanged.
4059. lbm_value *rptr = stack_reserve(ctx, 4);
4060. rptr[0] = READ_APPEND_CONTINUE;
^
4061. rptr[1] = stream;
4062. rptr[2] = lbm_enc_u(0);
#74
src/eval_cps.c:4011: error: Null Dereference
pointer `sptr` last assigned on line 4009 could be null and is dereferenced at line 4011, column 26.
4009. lbm_value *sptr = get_stack_ptr(ctx, 3);
4010.
4011. lbm_value first_cell = sptr[0];
^
4012. lbm_value last_cell = sptr[1];
4013. lbm_value stream = sptr[2];
#75
src/eval_cps.c:4046: error: Null Dereference
pointer `str` last assigned on line 4015 could be null and is dereferenced by call to `lbm_channel_reader_close()` at line 4046, column 5.
4044. lbm_value new_cell = cons_with_gc(ctx->r, ENC_SYM_NIL, ENC_SYM_NIL);
4045. if (lbm_is_symbol_merror(new_cell)) {
4046. lbm_channel_reader_close(str);
^
4047. read_error_ctx(lbm_channel_row(str), lbm_channel_column(str));
4048. return;
#76
src/eval_cps.c:4089: error: Null Dereference
pointer `rptr` last assigned on line 4088 could be null and is dereferenced at line 4089, column 7.
4087. // A dot, may in reality be an error in this location.
4088. lbm_value *rptr = stack_reserve(ctx, 4);
4089. rptr[0] = READ_DOT_TERMINATE;
^
4090. rptr[1] = stream;
4091. rptr[2] = lbm_enc_u(0);
#77
src/eval_cps.c:4099: error: Null Dereference
pointer `rptr` last assigned on line 4098 could be null and is dereferenced at line 4099, column 3.
4097.
4098. lbm_value *rptr = stack_reserve(ctx, 6);
4099. rptr[0] = stream;
^
4100. rptr[1] = env;
4101. rptr[2] = READ_EVAL_CONTINUE;
#78
src/eval_cps.c:4077: error: Null Dereference
pointer `str` last assigned on line 4072 could be null and is dereferenced at line 4077, column 24.
4075. }
4076.
4077. ctx->row1 = (lbm_int)str->row(str);
^
4078.
4079. if (lbm_type_of(ctx->r) == LBM_TYPE_SYMBOL) {
#79
src/eval_cps.c:4127: error: Null Dereference
pointer `str` last assigned on line 4117 could be null and is dereferenced by call to `lbm_channel_reader_close()` at line 4127, column 5.
4125. ctx->app_cont = true;
4126. } else {
4127. lbm_channel_reader_close(str);
^
4128. lbm_set_error_reason((char*)lbm_error_str_parse_close);
4129. read_error_ctx(lbm_channel_row(str), lbm_channel_column(str));
#80
src/eval_cps.c:4158: error: Null Dereference
pointer `rptr` last assigned on line 4157 could be null and is dereferenced at line 4158, column 7.
4156. ctx->r = first_cell;
4157. lbm_value *rptr = stack_reserve(ctx, 6);
4158. rptr[0] = stream;
^
4159. rptr[1] = ctx->r;
4160. rptr[2] = READ_EXPECT_CLOSEPAR;
#81
src/eval_cps.c:4136: error: Null Dereference
pointer `sptr` last assigned on line 4134 could be null and is dereferenced at line 4136, column 26.
4134. lbm_value *sptr = get_stack_ptr(ctx, 3);
4135.
4136. lbm_value first_cell = sptr[0];
^
4137. lbm_value last_cell = sptr[1];
4138. lbm_value stream = sptr[2];
#82
src/eval_cps.c:4150: error: Null Dereference
pointer `str` last assigned on line 4140 could be null and is dereferenced by call to `lbm_channel_reader_close()` at line 4150, column 5.
4148. (ctx->r == ENC_SYM_CLOSEPAR ||
4149. ctx->r == ENC_SYM_DOT)) {
4150. lbm_channel_reader_close(str);
^
4151. lbm_set_error_reason((char*)lbm_error_str_parse_dot);
4152. read_error_ctx(lbm_channel_row(str), lbm_channel_column(str));
#83
src/eval_cps.c:4166: error: Null Dereference
pointer `str` last assigned on line 4140 could be null and is dereferenced by call to `lbm_channel_reader_close()` at line 4166, column 7.
4164. ctx->app_cont = true;
4165. } else {
4166. lbm_channel_reader_close(str);
^
4167. lbm_set_error_reason((char*)lbm_error_str_parse_dot);
4168. read_error_ctx(lbm_channel_row(str), lbm_channel_column(str));
#84
src/eval_cps.c:4187: error: Null Dereference
pointer `str` last assigned on line 4182 could be null and is dereferenced by call to `lbm_channel_reader_close()` at line 4187, column 3.
4185. }
4186.
4187. lbm_channel_reader_close(str);
^
4188. if (lbm_is_symbol(ctx->r)) {
4189. lbm_uint sym_val = lbm_dec_sym(ctx->r);
#85
src/eval_cps.c:4236: error: Null Dereference
pointer `sptr` last assigned on line 4235 could be null and is dereferenced at line 4236, column 33.
4234. } else if (lbm_is_cons(ctx->r)) {
4235. lbm_uint *sptr = get_stack_ptr(ctx, 2);
4236. lbm_value args = (lbm_value)sptr[1];
^
4237. switch (get_car(ctx->r)) {
4238. case ENC_SYM_CLOSURE: {
#86
src/eval_cps.c:4420: error: Null Dereference
pointer `rptr1` last assigned on line 4419 could be null and is dereferenced at line 4420, column 7.
4418. (!(val & LBM_PTR_TO_CONSTANT_BIT))) {
4419. lbm_value * rptr1 = stack_reserve(ctx, 3);
4420. rptr1[0] = first_arg;
^
4421. rptr1[1] = SET_GLOBAL_ENV;
4422. rptr1[2] = MOVE_VAL_TO_FLASH_DISPATCH;
#87
src/eval_cps.c:4415: error: Null Dereference
pointer `rptr` last assigned on line 4414 could be null and is dereferenced at line 4415, column 5.
4413. // Prepare to copy the rest of the arguments when done with first.
4414. lbm_value *rptr = stack_reserve(ctx, 2);
4415. rptr[0] = rest;
^
4416. rptr[1] = MOVE_TO_FLASH;
4417. if (lbm_is_ptr(val) &&
#88
src/eval_cps.c:4437: error: Null Dereference
pointer `rptr` last assigned on line 4436 could be null and is dereferenced at line 4437, column 5.
4435. if (lbm_is_cons(val)) {
4436. lbm_value *rptr = stack_reserve(ctx, 5);
4437. rptr[0] = ENC_SYM_NIL; // fst cell of list
^
4438. rptr[1] = ENC_SYM_NIL; // last cell of list
4439. rptr[2] = get_cdr(val);
#89
src/eval_cps.c:4542: error: Null Dereference
pointer `sptr` last assigned on line 4540 could be null and is dereferenced at line 4542, column 19.
4540. lbm_value *sptr = get_stack_ptr(ctx, 3);
4541.
4542. lbm_value fst = sptr[0];
^
4543. lbm_value lst = sptr[1];
4544. lbm_value val = sptr[2];
#90
src/eval_cps.c:4594: error: Null Dereference
pointer `sptr` last assigned on line 4590 could be null and is dereferenced at line 4594, column 62.
4592. // sptr[1] = current index
4593. // sptr[0] = target array in flash
4594. lbm_array_header_t *src_arr = (lbm_array_header_t*)get_car(sptr[2]);
^
4595. lbm_uint size = src_arr->size / sizeof(lbm_uint);
4596. lbm_value *srcdata = (lbm_value *)src_arr->data;
#91
src/eval_cps.c:4595: error: Null Dereference
pointer `src_arr` last assigned on line 4594 could be null and is dereferenced at line 4595, column 19.
4593. // sptr[0] = target array in flash
4594. lbm_array_header_t *src_arr = (lbm_array_header_t*)get_car(sptr[2]);
4595. lbm_uint size = src_arr->size / sizeof(lbm_uint);
^
4596. lbm_value *srcdata = (lbm_value *)src_arr->data;
4597.
#92
src/eval_cps.c:4599: error: Null Dereference
pointer `tgt_arr` last assigned on line 4598 could be null and is dereferenced at line 4599, column 36.
4597.
4598. lbm_array_header_t *tgt_arr = (lbm_array_header_t*)get_car(sptr[0]);
4599. lbm_uint *tgtdata = (lbm_value *)tgt_arr->data;
^
4600. lbm_uint ix = lbm_dec_as_u32(sptr[1]);
4601. handle_flash_status(lbm_const_write(&tgtdata[ix], ctx->r));
#93
src/eval_cps.c:4619: error: Null Dereference
pointer `rptr` last assigned on line 4618 could be null and is dereferenced at line 4619, column 3.
4617. static void cont_qq_expand_start(eval_context_t *ctx) {
4618. lbm_value *rptr = stack_reserve(ctx, 2);
4619. rptr[0] = ctx->r;
^
4620. rptr[1] = QQ_EXPAND;
4621. ctx->r = ENC_SYM_NIL;
#94
src/eval_cps.c:4707: error: Null Dereference
pointer `rptr` last assigned on line 4706 could be null and is dereferenced at line 4707, column 7.
4705. } else {
4706. lbm_value *rptr = stack_reserve(ctx, 6);
4707. rptr[0] = ctx->r;
^
4708. rptr[1] = QQ_APPEND;
4709. rptr[2] = cdr_val;
#95
src/eval_cps.c:4771: error: Null Dereference
pointer `rptr` last assigned on line 4770 could be null and is dereferenced at line 4771, column 7.
4769. } else {
4770. lbm_value *rptr = stack_reserve(ctx, 7);
4771. rptr[0] = QQ_LIST;
^
4772. rptr[1] = ctx->r;
4773. rptr[2] = QQ_APPEND;
#96
src/eval_cps.c:4815: error: Null Dereference
pointer `sptr` last assigned on line 4814 could be null and is dereferenced at line 4815, column 22.
4813. static void cont_exception_handler(eval_context_t *ctx) {
4814. lbm_value *sptr = pop_stack_ptr(ctx, 2);
4815. lbm_value retval = sptr[0];
^
4816. lbm_value flags = sptr[1];
4817. lbm_set_car(get_cdr(retval), ctx->r);
#97
src/eval_cps.c:4952: error: Null Dereference
pointer `reserved` last assigned on line 4951 could be null and is dereferenced at line 4952, column 5.
4950. */
4951. lbm_value *reserved = stack_reserve(ctx, 3);
4952. reserved[0] = ctx->curr_env;
^
4953. reserved[1] = cell->cdr;
4954. reserved[2] = APPLICATION_START;
Found 98 issues
Issue Type(ISSUED_TYPE_ID): #
Null Dereference(NULL_DEREFERENCE): 96
Dead Store(DEAD_STORE): 2

View File

@ -0,0 +1,150 @@
<html>
<head>
<title>lispbm - scan-build results</title>
<link type="text/css" rel="stylesheet" href="scanview.css"/>
<script src="sorttable.js"></script>
<script language='javascript' type="text/javascript">
function SetDisplay(RowClass, DisplayVal)
{
var Rows = document.getElementsByTagName("tr");
for ( var i = 0 ; i < Rows.length; ++i ) {
if (Rows[i].className == RowClass) {
Rows[i].style.display = DisplayVal;
}
}
}
function CopyCheckedStateToCheckButtons(SummaryCheckButton) {
var Inputs = document.getElementsByTagName("input");
for ( var i = 0 ; i < Inputs.length; ++i ) {
if (Inputs[i].type == "checkbox") {
if(Inputs[i] != SummaryCheckButton) {
Inputs[i].checked = SummaryCheckButton.checked;
Inputs[i].onclick();
}
}
}
}
function returnObjById( id ) {
if (document.getElementById)
var returnVar = document.getElementById(id);
else if (document.all)
var returnVar = document.all[id];
else if (document.layers)
var returnVar = document.layers[id];
return returnVar;
}
var NumUnchecked = 0;
function ToggleDisplay(CheckButton, ClassName) {
if (CheckButton.checked) {
SetDisplay(ClassName, "");
if (--NumUnchecked == 0) {
returnObjById("AllBugsCheck").checked = true;
}
}
else {
SetDisplay(ClassName, "none");
NumUnchecked++;
returnObjById("AllBugsCheck").checked = false;
}
}
</script>
<!-- SUMMARYENDHEAD -->
</head>
<body>
<h1>lispbm - scan-build results</h1>
<table>
<tr><th>User:</th><td>joels@joels-ThinkStation-P340</td></tr>
<tr><th>Working Directory:</th><td>/home/joels/Current/lispbm</td></tr>
<tr><th>Command Line:</th><td>make -j4</td></tr>
<tr><th>Clang Version:</th><td>clang version 10.0.0-4ubuntu1
</td></tr>
<tr><th>Date:</th><td>Tue Jul 23 15:23:44 2024</td></tr>
</table>
<h2>Bug Summary</h2><table>
<thead><tr><td>Bug Type</td><td>Quantity</td><td class="sorttable_nosort">Display?</td></tr></thead>
<tr style="font-weight:bold"><td class="SUMM_DESC">All Bugs</td><td class="Q">19</td><td><center><input type="checkbox" id="AllBugsCheck" onClick="CopyCheckedStateToCheckButtons(this);" checked/></center></td></tr>
<tr><th>Logic error</th><th colspan=2></th></tr>
<tr><td class="SUMM_DESC">Assigned value is garbage or undefined</td><td class="Q">6</td><td><center><input type="checkbox" onClick="ToggleDisplay(this,'bt_logic_error_assigned_value_is_garbage_or_undefined');" checked/></center></td></tr>
<tr><td class="SUMM_DESC">Dereference of null pointer</td><td class="Q">10</td><td><center><input type="checkbox" onClick="ToggleDisplay(this,'bt_logic_error_dereference_of_null_pointer');" checked/></center></td></tr>
<tr><td class="SUMM_DESC">Uninitialized argument value</td><td class="Q">3</td><td><center><input type="checkbox" onClick="ToggleDisplay(this,'bt_logic_error_uninitialized_argument_value');" checked/></center></td></tr>
</table>
<h2>Reports</h2>
<table class="sortable" style="table-layout:automatic">
<thead><tr>
<td>Bug Group</td>
<td class="sorttable_sorted">Bug Type<span id="sorttable_sortfwdind">&nbsp;&#x25BE;</span></td>
<td>File</td>
<td>Function/Method</td>
<td class="Q">Line</td>
<td class="Q">Path Length</td>
<td class="sorttable_nosort"></td>
<!-- REPORTBUGCOL -->
</tr></thead>
<tbody>
<tr class="bt_logic_error_assigned_value_is_garbage_or_undefined"><td class="DESC">Logic error</td><td class="DESC">Assigned value is garbage or undefined</td><td>eval_cps.c</td><td class="DESC">cont_application_start</td><td class="Q">4252</td><td class="Q">38</td><td><a href="report-9d5914.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-9d5914.html" -->
</tr>
<tr class="bt_logic_error_assigned_value_is_garbage_or_undefined"><td class="DESC">Logic error</td><td class="DESC">Assigned value is garbage or undefined</td><td>eval_cps.c</td><td class="DESC">eval_match</td><td class="Q">2042</td><td class="Q">8</td><td><a href="report-fac31c.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-fac31c.html" -->
</tr>
<tr class="bt_logic_error_assigned_value_is_garbage_or_undefined"><td class="DESC">Logic error</td><td class="DESC">Assigned value is garbage or undefined</td><td>eval_cps.c</td><td class="DESC">cont_closure_application_args</td><td class="Q">3000</td><td class="Q">24</td><td><a href="report-6504f5.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-6504f5.html" -->
</tr>
<tr class="bt_logic_error_assigned_value_is_garbage_or_undefined"><td class="DESC">Logic error</td><td class="DESC">Assigned value is garbage or undefined</td><td>eval_cps.c</td><td class="DESC">cont_closure_application_args</td><td class="Q">2998</td><td class="Q">24</td><td><a href="report-52eee6.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-52eee6.html" -->
</tr>
<tr class="bt_logic_error_assigned_value_is_garbage_or_undefined"><td class="DESC">Logic error</td><td class="DESC">Assigned value is garbage or undefined</td><td>eval_cps.c</td><td class="DESC">cont_application_start</td><td class="Q">4254</td><td class="Q">38</td><td><a href="report-f53f44.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-f53f44.html" -->
</tr>
<tr class="bt_logic_error_assigned_value_is_garbage_or_undefined"><td class="DESC">Logic error</td><td class="DESC">Assigned value is garbage or undefined</td><td>eval_cps.c</td><td class="DESC">cont_progn_rest</td><td class="Q">2163</td><td class="Q">8</td><td><a href="report-a60707.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-a60707.html" -->
</tr>
<tr class="bt_logic_error_dereference_of_null_pointer"><td class="DESC">Logic error</td><td class="DESC">Dereference of null pointer</td><td>eval_cps.c</td><td class="DESC">cont_read_append_array</td><td class="Q">3998</td><td class="Q">32</td><td><a href="report-47103f.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-47103f.html" -->
</tr>
<tr class="bt_logic_error_dereference_of_null_pointer"><td class="DESC">Logic error</td><td class="DESC">Dereference of null pointer</td><td>eval_cps.c</td><td class="DESC">cont_read_eval_continue</td><td class="Q">4077</td><td class="Q">3</td><td><a href="report-49137f.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-49137f.html" -->
</tr>
<tr class="bt_logic_error_dereference_of_null_pointer"><td class="DESC">Logic error</td><td class="DESC">Dereference of null pointer</td><td>eval_cps.c</td><td class="DESC">cont_read_append_array</td><td class="Q">3983</td><td class="Q">24</td><td><a href="report-cb7c37.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-cb7c37.html" -->
</tr>
<tr class="bt_logic_error_dereference_of_null_pointer"><td class="DESC">Logic error</td><td class="DESC">Dereference of null pointer</td><td>eval_cps.c</td><td class="DESC">eval_callcc</td><td class="Q">1664</td><td class="Q">16</td><td><a href="report-79ea5f.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-79ea5f.html" -->
</tr>
<tr class="bt_logic_error_dereference_of_null_pointer"><td class="DESC">Logic error</td><td class="DESC">Dereference of null pointer</td><td>eval_cps.c</td><td class="DESC">cont_move_array_elts_to_flash</td><td class="Q">4595</td><td class="Q">12</td><td><a href="report-f5608d.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-f5608d.html" -->
</tr>
<tr class="bt_logic_error_dereference_of_null_pointer"><td class="DESC">Logic error</td><td class="DESC">Dereference of null pointer</td><td>eval_cps.c</td><td class="DESC">cont_move_array_elts_to_flash</td><td class="Q">4599</td><td class="Q">12</td><td><a href="report-f2a4bc.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-f2a4bc.html" -->
</tr>
<tr class="bt_logic_error_dereference_of_null_pointer"><td class="DESC">Logic error</td><td class="DESC">Dereference of null pointer</td><td>heap.c</td><td class="DESC">lbm_dec_str</td><td class="Q">234</td><td class="Q">14</td><td><a href="report-ce8d59.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-ce8d59.html" -->
</tr>
<tr class="bt_logic_error_dereference_of_null_pointer"><td class="DESC">Logic error</td><td class="DESC">Dereference of null pointer</td><td>heap.c</td><td class="DESC">lbm_heap_array_get_data_ro</td><td class="Q">1259</td><td class="Q">14</td><td><a href="report-ebe0ba.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-ebe0ba.html" -->
</tr>
<tr class="bt_logic_error_dereference_of_null_pointer"><td class="DESC">Logic error</td><td class="DESC">Dereference of null pointer</td><td>eval_cps.c</td><td class="DESC">cont_application_start</td><td class="Q">4301</td><td class="Q">37</td><td><a href="report-0007d3.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-0007d3.html" -->
</tr>
<tr class="bt_logic_error_dereference_of_null_pointer"><td class="DESC">Logic error</td><td class="DESC">Dereference of null pointer</td><td>eval_cps.c</td><td class="DESC">cont_read_next_token</td><td class="Q">3757</td><td class="Q">31</td><td><a href="report-3e0f11.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-3e0f11.html" -->
</tr>
<tr class="bt_logic_error_uninitialized_argument_value"><td class="DESC">Logic error</td><td class="DESC">Uninitialized argument value</td><td>eval_cps.c</td><td class="DESC">cont_move_to_flash</td><td class="Q">4412</td><td class="Q">13</td><td><a href="report-e1a01d.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-e1a01d.html" -->
</tr>
<tr class="bt_logic_error_uninitialized_argument_value"><td class="DESC">Logic error</td><td class="DESC">Uninitialized argument value</td><td>eval_cps.c</td><td class="DESC">cont_closure_application_args</td><td class="Q">2989</td><td class="Q">8</td><td><a href="report-4accd4.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-4accd4.html" -->
</tr>
<tr class="bt_logic_error_uninitialized_argument_value"><td class="DESC">Logic error</td><td class="DESC">Uninitialized argument value</td><td>eval_cps.c</td><td class="DESC">eval_symbol</td><td class="Q">1598</td><td class="Q">36</td><td><a href="report-4a8c88.html#EndPath">View Report</a></td>
<!-- REPORTBUG id="report-4a8c88.html" -->
</tr>
</tbody>
</table>
</body></html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,62 @@
body { color:#000000; background-color:#ffffff }
body { font-family: Helvetica, sans-serif; font-size:9pt }
h1 { font-size: 14pt; }
h2 { font-size: 12pt; }
table { font-size:9pt }
table { border-spacing: 0px; border: 1px solid black }
th, table thead {
background-color:#eee; color:#666666;
font-weight: bold; cursor: default;
text-align:center;
font-weight: bold; font-family: Verdana;
white-space:nowrap;
}
.W { font-size:0px }
th, td { padding:5px; padding-left:8px; text-align:left }
td.SUMM_DESC { padding-left:12px }
td.DESC { white-space:pre }
td.Q { text-align:right }
td { text-align:left }
tbody.scrollContent { overflow:auto }
table.form_group {
background-color: #ccc;
border: 1px solid #333;
padding: 2px;
}
table.form_inner_group {
background-color: #ccc;
border: 1px solid #333;
padding: 0px;
}
table.form {
background-color: #999;
border: 1px solid #333;
padding: 2px;
}
td.form_label {
text-align: right;
vertical-align: top;
}
/* For one line entires */
td.form_clabel {
text-align: right;
vertical-align: center;
}
td.form_value {
text-align: left;
vertical-align: top;
}
td.form_submit {
text-align: right;
vertical-align: top;
}
h1.SubmitFail {
color: #f00;
}
h1.SubmitOk {
}

View File

@ -0,0 +1,492 @@
/*
SortTable
version 2
7th April 2007
Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
Instructions:
Download this file
Add <script src="sorttable.js"></script> to your HTML
Add class="sortable" to any table you'd like to make sortable
Click on the headers to sort
Thanks to many, many people for contributions and suggestions.
Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
This basically means: do what you want with it.
*/
var stIsIE = /*@cc_on!@*/false;
sorttable = {
init: function() {
// quit if this function has already been called
if (arguments.callee.done) return;
// flag this function so we don't do the same thing twice
arguments.callee.done = true;
// kill the timer
if (_timer) clearInterval(_timer);
if (!document.createElement || !document.getElementsByTagName) return;
sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
forEach(document.getElementsByTagName('table'), function(table) {
if (table.className.search(/\bsortable\b/) != -1) {
sorttable.makeSortable(table);
}
});
},
makeSortable: function(table) {
if (table.getElementsByTagName('thead').length == 0) {
// table doesn't have a tHead. Since it should have, create one and
// put the first table row in it.
the = document.createElement('thead');
the.appendChild(table.rows[0]);
table.insertBefore(the,table.firstChild);
}
// Safari doesn't support table.tHead, sigh
if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];
if (table.tHead.rows.length != 1) return; // can't cope with two header rows
// Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
// "total" rows, for example). This is B&R, since what you're supposed
// to do is put them in a tfoot. So, if there are sortbottom rows,
// for backward compatibility, move them to tfoot (creating it if needed).
sortbottomrows = [];
for (var i=0; i<table.rows.length; i++) {
if (table.rows[i].className.search(/\bsortbottom\b/) != -1) {
sortbottomrows[sortbottomrows.length] = table.rows[i];
}
}
if (sortbottomrows) {
if (table.tFoot == null) {
// table doesn't have a tfoot. Create one.
tfo = document.createElement('tfoot');
table.appendChild(tfo);
}
for (var i=0; i<sortbottomrows.length; i++) {
tfo.appendChild(sortbottomrows[i]);
}
delete sortbottomrows;
}
// work through each column and calculate its type
headrow = table.tHead.rows[0].cells;
for (var i=0; i<headrow.length; i++) {
// manually override the type with a sorttable_type attribute
if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col
mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
if (mtch) { override = mtch[1]; }
if (mtch && typeof sorttable["sort_"+override] == 'function') {
headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
} else {
headrow[i].sorttable_sortfunction = sorttable.guessType(table,i);
}
// make it clickable to sort
headrow[i].sorttable_columnindex = i;
headrow[i].sorttable_tbody = table.tBodies[0];
dean_addEvent(headrow[i],"click", function(e) {
if (this.className.search(/\bsorttable_sorted\b/) != -1) {
// if we're already sorted by this column, just
// reverse the table, which is quicker
sorttable.reverse(this.sorttable_tbody);
this.className = this.className.replace('sorttable_sorted',
'sorttable_sorted_reverse');
this.removeChild(document.getElementById('sorttable_sortfwdind'));
sortrevind = document.createElement('span');
sortrevind.id = "sorttable_sortrevind";
sortrevind.innerHTML = stIsIE ? '&nbsp<font face="webdings">5</font>' : '&nbsp;&#x25B4;';
this.appendChild(sortrevind);
return;
}
if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
// if we're already sorted by this column in reverse, just
// re-reverse the table, which is quicker
sorttable.reverse(this.sorttable_tbody);
this.className = this.className.replace('sorttable_sorted_reverse',
'sorttable_sorted');
this.removeChild(document.getElementById('sorttable_sortrevind'));
sortfwdind = document.createElement('span');
sortfwdind.id = "sorttable_sortfwdind";
sortfwdind.innerHTML = stIsIE ? '&nbsp<font face="webdings">6</font>' : '&nbsp;&#x25BE;';
this.appendChild(sortfwdind);
return;
}
// remove sorttable_sorted classes
theadrow = this.parentNode;
forEach(theadrow.childNodes, function(cell) {
if (cell.nodeType == 1) { // an element
cell.className = cell.className.replace('sorttable_sorted_reverse','');
cell.className = cell.className.replace('sorttable_sorted','');
}
});
sortfwdind = document.getElementById('sorttable_sortfwdind');
if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
sortrevind = document.getElementById('sorttable_sortrevind');
if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
this.className += ' sorttable_sorted';
sortfwdind = document.createElement('span');
sortfwdind.id = "sorttable_sortfwdind";
sortfwdind.innerHTML = stIsIE ? '&nbsp<font face="webdings">6</font>' : '&nbsp;&#x25BE;';
this.appendChild(sortfwdind);
// build an array to sort. This is a Schwartzian transform thing,
// i.e., we "decorate" each row with the actual sort key,
// sort based on the sort keys, and then put the rows back in order
// which is a lot faster because you only do getInnerText once per row
row_array = [];
col = this.sorttable_columnindex;
rows = this.sorttable_tbody.rows;
for (var j=0; j<rows.length; j++) {
row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
}
/* If you want a stable sort, uncomment the following line */
sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
/* and comment out this one */
//row_array.sort(this.sorttable_sortfunction);
tb = this.sorttable_tbody;
for (var j=0; j<row_array.length; j++) {
tb.appendChild(row_array[j][1]);
}
delete row_array;
});
}
}
},
guessType: function(table, column) {
// guess the type of a column based on its first non-blank row
sortfn = sorttable.sort_alpha;
for (var i=0; i<table.tBodies[0].rows.length; i++) {
text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
if (text != '') {
if (text.match(/^-?[£$¤]?[\d,.]+%?$/)) {
return sorttable.sort_numeric;
}
// check for a date: dd/mm/yyyy or dd/mm/yy
// can have / or . or - as separator
// can be mm/dd as well
possdate = text.match(sorttable.DATE_RE)
if (possdate) {
// looks like a date
first = parseInt(possdate[1]);
second = parseInt(possdate[2]);
if (first > 12) {
// definitely dd/mm
return sorttable.sort_ddmm;
} else if (second > 12) {
return sorttable.sort_mmdd;
} else {
// looks like a date, but we can't tell which, so assume
// that it's dd/mm (English imperialism!) and keep looking
sortfn = sorttable.sort_ddmm;
}
}
}
}
return sortfn;
},
getInnerText: function(node) {
// gets the text we want to use for sorting for a cell.
// strips leading and trailing whitespace.
// this is *not* a generic getInnerText function; it's special to sorttable.
// for example, you can override the cell text with a customkey attribute.
// it also gets .value for <input> fields.
hasInputs = (typeof node.getElementsByTagName == 'function') &&
node.getElementsByTagName('input').length;
if (node.getAttribute("sorttable_customkey") != null) {
return node.getAttribute("sorttable_customkey");
}
else if (typeof node.textContent != 'undefined' && !hasInputs) {
return node.textContent.replace(/^\s+|\s+$/g, '');
}
else if (typeof node.innerText != 'undefined' && !hasInputs) {
return node.innerText.replace(/^\s+|\s+$/g, '');
}
else if (typeof node.text != 'undefined' && !hasInputs) {
return node.text.replace(/^\s+|\s+$/g, '');
}
else {
switch (node.nodeType) {
case 3:
if (node.nodeName.toLowerCase() == 'input') {
return node.value.replace(/^\s+|\s+$/g, '');
}
case 4:
return node.nodeValue.replace(/^\s+|\s+$/g, '');
break;
case 1:
case 11:
var innerText = '';
for (var i = 0; i < node.childNodes.length; i++) {
innerText += sorttable.getInnerText(node.childNodes[i]);
}
return innerText.replace(/^\s+|\s+$/g, '');
break;
default:
return '';
}
}
},
reverse: function(tbody) {
// reverse the rows in a tbody
newrows = [];
for (var i=0; i<tbody.rows.length; i++) {
newrows[newrows.length] = tbody.rows[i];
}
for (var i=newrows.length-1; i>=0; i--) {
tbody.appendChild(newrows[i]);
}
delete newrows;
},
/* sort functions
each sort function takes two parameters, a and b
you are comparing a[0] and b[0] */
sort_numeric: function(a,b) {
aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
if (isNaN(aa)) aa = 0;
bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
if (isNaN(bb)) bb = 0;
return aa-bb;
},
sort_alpha: function(a,b) {
if (a[0]==b[0]) return 0;
if (a[0]<b[0]) return -1;
return 1;
},
sort_ddmm: function(a,b) {
mtch = a[0].match(sorttable.DATE_RE);
y = mtch[3]; m = mtch[2]; d = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt1 = y+m+d;
mtch = b[0].match(sorttable.DATE_RE);
y = mtch[3]; m = mtch[2]; d = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt2 = y+m+d;
if (dt1==dt2) return 0;
if (dt1<dt2) return -1;
return 1;
},
sort_mmdd: function(a,b) {
mtch = a[0].match(sorttable.DATE_RE);
y = mtch[3]; d = mtch[2]; m = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt1 = y+m+d;
mtch = b[0].match(sorttable.DATE_RE);
y = mtch[3]; d = mtch[2]; m = mtch[1];
if (m.length == 1) m = '0'+m;
if (d.length == 1) d = '0'+d;
dt2 = y+m+d;
if (dt1==dt2) return 0;
if (dt1<dt2) return -1;
return 1;
},
shaker_sort: function(list, comp_func) {
// A stable sort function to allow multi-level sorting of data
// see: http://en.wikipedia.org/wiki/Cocktail_sort
// thanks to Joseph Nahmias
var b = 0;
var t = list.length - 1;
var swap = true;
while(swap) {
swap = false;
for(var i = b; i < t; ++i) {
if ( comp_func(list[i], list[i+1]) > 0 ) {
var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
swap = true;
}
} // for
t--;
if (!swap) break;
for(var i = t; i > b; --i) {
if ( comp_func(list[i], list[i-1]) < 0 ) {
var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
swap = true;
}
} // for
b++;
} // while(swap)
}
}
/* ******************************************************************
Supporting functions: bundled here to avoid depending on a library
****************************************************************** */
// Dean Edwards/Matthias Miller/John Resig
/* for Mozilla/Opera9 */
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", sorttable.init, false);
}
/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() {
if (this.readyState == "complete") {
sorttable.init(); // call the onload handler
}
};
/*@end @*/
/* for Safari */
if (/WebKit/i.test(navigator.userAgent)) { // sniff
var _timer = setInterval(function() {
if (/loaded|complete/.test(document.readyState)) {
sorttable.init(); // call the onload handler
}
}, 10);
}
/* for other browsers */
window.onload = sorttable.init;
// written by Dean Edwards, 2005
// with input from Tino Zijdel, Matthias Miller, Diego Perini
// http://dean.edwards.name/weblog/2005/10/add-event/
function dean_addEvent(element, type, handler) {
if (element.addEventListener) {
element.addEventListener(type, handler, false);
} else {
// assign each event handler a unique ID
if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
// create a hash table of event types for the element
if (!element.events) element.events = {};
// create a hash table of event handlers for each element/event pair
var handlers = element.events[type];
if (!handlers) {
handlers = element.events[type] = {};
// store the existing event handler (if there is one)
if (element["on" + type]) {
handlers[0] = element["on" + type];
}
}
// store the event handler in the hash table
handlers[handler.$$guid] = handler;
// assign a global event handler to do all the work
element["on" + type] = handleEvent;
}
};
// a counter used to create unique IDs
dean_addEvent.guid = 1;
function removeEvent(element, type, handler) {
if (element.removeEventListener) {
element.removeEventListener(type, handler, false);
} else {
// delete the event handler from the hash table
if (element.events && element.events[type]) {
delete element.events[type][handler.$$guid];
}
}
};
function handleEvent(event) {
var returnValue = true;
// grab the event object (IE uses a global event object)
event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
// get a reference to the hash table of event handlers
var handlers = this.events[event.type];
// execute each event handler
for (var i in handlers) {
this.$$handleEvent = handlers[i];
if (this.$$handleEvent(event) === false) {
returnValue = false;
}
}
return returnValue;
};
function fixEvent(event) {
// add W3C standard event methods
event.preventDefault = fixEvent.preventDefault;
event.stopPropagation = fixEvent.stopPropagation;
return event;
};
fixEvent.preventDefault = function() {
this.returnValue = false;
};
fixEvent.stopPropagation = function() {
this.cancelBubble = true;
}
// Dean's forEach: http://dean.edwards.name/base/forEach.js
/*
forEach, version 1.0
Copyright 2006, Dean Edwards
License: http://www.opensource.org/licenses/mit-license.php
*/
// array-like enumeration
if (!Array.forEach) { // mozilla already supports this
Array.forEach = function(array, block, context) {
for (var i = 0; i < array.length; i++) {
block.call(context, array[i], i, array);
}
};
}
// generic enumeration
Function.prototype.forEach = function(object, block, context) {
for (var key in object) {
if (typeof this.prototype[key] == "undefined") {
block.call(context, object[key], key, object);
}
}
};
// character enumeration
String.forEach = function(string, block, context) {
Array.forEach(string.split(""), function(chr, index) {
block.call(context, chr, index, string);
});
};
// globally resolve forEach enumeration
var forEach = function(object, block, context) {
if (object) {
var resolve = Object; // default
if (object instanceof Function) {
// functions have a "length" property
resolve = Function;
} else if (object.forEach instanceof Function) {
// the object implements a custom forEach method so use that
object.forEach(block, context);
return;
} else if (typeof object == "string") {
// the object is a string
resolve = String;
} else if (typeof object.length == "number") {
// the object is array-like
resolve = Array;
}
resolve.forEach(object, block, context);
}
};

View File

@ -0,0 +1,78 @@
BUILDING
gcc -g -O2 -Wall -Wextra -Wshadow -Wconversion -Wclobbered -pedantic -std=c99 -m32 ..//src/env.c ..//src/fundamental.c ..//src/heap.c ..//src/lbm_memory.c ..//src/print.c ..//src/stack.c ..//src/symrepr.c ..//src/tokpar.c ..//src/extensions.c ..//src/lispbm.c ..//src/eval_cps.c ..//src/lbm_c_interop.c ..//src/lbm_custom_type.c ..//src/lbm_channel.c ..//src/lbm_flat_value.c ..//src/lbm_flags.c ..//src/lbm_prof.c ..//src/extensions/array_extensions.c ..//src/extensions/string_extensions.c ..//src/extensions/math_extensions.c ..//src/extensions/runtime_extensions.c ..//src/extensions/matvec_extensions.c ..//src/extensions/random_extensions.c ..//src/extensions/loop_extensions.c ..//src/extensions/set_extensions.c ..//platform/linux/src/platform_mutex.c -lm test_lisp_code_cps.c -o test_lisp_code_cps.exe -I../include -I..//platform/linux/include -lpthread -lm
mv test_lisp_code_cps.exe test_lisp_code_cps
PERFORMING TESTS: 2024-07-23_15-09
DEC/ENC 0: ok
DEC/ENC 1: ok
DEC/ENC 2: ok
DEC/ENC 3: ok
DEC/ENC 4: ok
DEC/ENC 5: ok
DEC/ENC 6: ok
DEC/ENC 7: ok
DEC/ENC 8: ok
DEC/ENC 9: ok
DEC/ENC 10: ok
DEC/ENC 11: ok
DEC/ENC 12: ok
DEC/ENC 13: ok
DEC/ENC 14: ok
DEC/ENC 15: ok
------------------------------------------------------------
test_enc_dec.exe SUCCESS
------------------------------------------------------------
Initialized symrepr: OK
Initialized heap: OK
Allocated 1048576 heap cells: OK
HEAP allocation when full test: OK
------------------------------------------------------------
test_heap_alloc.exe SUCCESS
------------------------------------------------------------
Configuration: -h 32768
Configuration: -i -h 32768
Configuration: -s -h 32768
Configuration: -i -s -h 32768
Configuration: -h 16384
Configuration: -i -h 16384
Configuration: -s -h 16384
Configuration: -i -s -h 16384
Configuration: -h 8192
Configuration: -i -h 8192
Configuration: -s -h 8192
Configuration: -i -s -h 8192
Configuration: -h 4096
Configuration: -i -h 4096
Configuration: -s -h 4096
Configuration: -i -s -h 4096
Configuration: -h 2048
Configuration: -i -h 2048
Configuration: -s -h 2048
Configuration: -i -s -h 2048
Configuration: -h 1024
tests/test_take_iota_0.lisp FAILED
Configuration: -i -h 1024
tests/test_take_iota_0.lisp FAILED
Configuration: -s -h 1024
tests/test_take_iota_0.lisp FAILED
Configuration: -i -s -h 1024
tests/test_take_iota_0.lisp FAILED
Configuration: -h 512
tests/test_take_iota_0.lisp FAILED
Configuration: -i -h 512
tests/test_take_iota_0.lisp FAILED
Configuration: -s -h 512
tests/test_take_iota_0.lisp FAILED
Configuration: -i -s -h 512
tests/test_take_iota_0.lisp FAILED
(OK - expected to fail) test_lisp_code_cps -h 1024 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -i -h 1024 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -s -h 1024 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -i -s -h 1024 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -h 512 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -i -h 512 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -s -h 512 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -i -s -h 512 tests/test_take_iota_0.lisp
Tests passed: 17410
Tests failed: 8
Expected fails: 8
Actual fails: 0

View File

@ -0,0 +1,78 @@
BUILDING
gcc -g -O2 -Wall -Wextra -Wshadow -Wconversion -Wclobbered -pedantic -std=c99 -m32 ..//src/env.c ..//src/fundamental.c ..//src/heap.c ..//src/lbm_memory.c ..//src/print.c ..//src/stack.c ..//src/symrepr.c ..//src/tokpar.c ..//src/extensions.c ..//src/lispbm.c ..//src/eval_cps.c ..//src/lbm_c_interop.c ..//src/lbm_custom_type.c ..//src/lbm_channel.c ..//src/lbm_flat_value.c ..//src/lbm_flags.c ..//src/lbm_prof.c ..//src/extensions/array_extensions.c ..//src/extensions/string_extensions.c ..//src/extensions/math_extensions.c ..//src/extensions/runtime_extensions.c ..//src/extensions/matvec_extensions.c ..//src/extensions/random_extensions.c ..//src/extensions/loop_extensions.c ..//src/extensions/set_extensions.c ..//platform/linux/src/platform_mutex.c -lm test_lisp_code_cps.c -o test_lisp_code_cps.exe -I../include -I..//platform/linux/include -lpthread -lm
mv test_lisp_code_cps.exe test_lisp_code_cps
PERFORMING TESTS: 2024-07-23_15-13
DEC/ENC 0: ok
DEC/ENC 1: ok
DEC/ENC 2: ok
DEC/ENC 3: ok
DEC/ENC 4: ok
DEC/ENC 5: ok
DEC/ENC 6: ok
DEC/ENC 7: ok
DEC/ENC 8: ok
DEC/ENC 9: ok
DEC/ENC 10: ok
DEC/ENC 11: ok
DEC/ENC 12: ok
DEC/ENC 13: ok
DEC/ENC 14: ok
DEC/ENC 15: ok
------------------------------------------------------------
test_enc_dec.exe SUCCESS
------------------------------------------------------------
Initialized symrepr: OK
Initialized heap: OK
Allocated 1048576 heap cells: OK
HEAP allocation when full test: OK
------------------------------------------------------------
test_heap_alloc.exe SUCCESS
------------------------------------------------------------
Configuration: -h 32768
Configuration: -i -h 32768
Configuration: -s -h 32768
Configuration: -i -s -h 32768
Configuration: -h 16384
Configuration: -i -h 16384
Configuration: -s -h 16384
Configuration: -i -s -h 16384
Configuration: -h 8192
Configuration: -i -h 8192
Configuration: -s -h 8192
Configuration: -i -s -h 8192
Configuration: -h 4096
Configuration: -i -h 4096
Configuration: -s -h 4096
Configuration: -i -s -h 4096
Configuration: -h 2048
Configuration: -i -h 2048
Configuration: -s -h 2048
Configuration: -i -s -h 2048
Configuration: -h 1024
tests/test_take_iota_0.lisp FAILED
Configuration: -i -h 1024
tests/test_take_iota_0.lisp FAILED
Configuration: -s -h 1024
tests/test_take_iota_0.lisp FAILED
Configuration: -i -s -h 1024
tests/test_take_iota_0.lisp FAILED
Configuration: -h 512
tests/test_take_iota_0.lisp FAILED
Configuration: -i -h 512
tests/test_take_iota_0.lisp FAILED
Configuration: -s -h 512
tests/test_take_iota_0.lisp FAILED
Configuration: -i -s -h 512
tests/test_take_iota_0.lisp FAILED
(OK - expected to fail) test_lisp_code_cps -h 1024 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -i -h 1024 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -s -h 1024 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -i -s -h 1024 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -h 512 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -i -h 512 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -s -h 512 tests/test_take_iota_0.lisp
(OK - expected to fail) test_lisp_code_cps -i -s -h 512 tests/test_take_iota_0.lisp
Tests passed: 17410
Tests failed: 8
Expected fails: 8
Actual fails: 0