Fix warnings/issues reported in Windows and by CodeQL/Coverity (#3275)

Fix the warnings and issues reported:
- in Windows platform
- by CodeQL static code analyzing
- by Coverity static code analyzing

And update CodeQL script to build exception handling and memory features.
This commit is contained in:
Wenyong Huang
2024-04-07 11:57:31 +08:00
committed by GitHub
parent 53f0941ffa
commit 2013f1f7d7
26 changed files with 202 additions and 118 deletions

View File

@ -114,8 +114,8 @@ sweep_instance_heap(gc_heap_t *heap)
else {
/* current block is still live */
if (last) {
tot_free += (char *)cur - (char *)last;
gci_add_fc(heap, last, (char *)cur - (char *)last);
tot_free += (gc_size_t)((char *)cur - (char *)last);
gci_add_fc(heap, last, (gc_size_t)((char *)cur - (char *)last));
hmu_mark_pinuse(last);
last = NULL;
}
@ -132,8 +132,8 @@ sweep_instance_heap(gc_heap_t *heap)
bh_assert(cur == end);
if (last) {
tot_free += (char *)cur - (char *)last;
gci_add_fc(heap, last, (char *)cur - (char *)last);
tot_free += (gc_size_t)((char *)cur - (char *)last);
gci_add_fc(heap, last, (gc_size_t)((char *)cur - (char *)last));
hmu_mark_pinuse(last);
}
@ -449,7 +449,9 @@ gci_gc_heap(void *h)
LOG_VERBOSE("#reclaim instance heap %p", heap);
gct_vm_gc_prepare();
/* TODO: get exec_env of current thread when GC multi-threading
is enabled, and pass it to runtime */
gct_vm_gc_prepare(NULL);
gct_vm_mutex_lock(&heap->lock);
heap->is_doing_reclaim = 1;
@ -459,7 +461,9 @@ gci_gc_heap(void *h)
heap->is_doing_reclaim = 0;
gct_vm_mutex_unlock(&heap->lock);
gct_vm_gc_finished();
/* TODO: get exec_env of current thread when GC multi-threading
is enabled, and pass it to runtime */
gct_vm_gc_finished(NULL);
LOG_VERBOSE("#reclaim instance heap %p done", heap);