mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-05 22:38:44 +00:00
parent
67d1a3c135
commit
3dfefdb2ca
6 changed files with 3 additions and 61 deletions
|
|
@ -8,7 +8,7 @@ license: "GPL-3.0-only"
|
||||||
homepage: "https://github.com/PLTools/Lama"
|
homepage: "https://github.com/PLTools/Lama"
|
||||||
bug-reports: "https://github.com/PLTools/Lama/issues"
|
bug-reports: "https://github.com/PLTools/Lama/issues"
|
||||||
depends: [
|
depends: [
|
||||||
"dune" {>= "3.11"}
|
"dune" {>= "3.3"}
|
||||||
"posix-uname"
|
"posix-uname"
|
||||||
"GT"
|
"GT"
|
||||||
"ostap" {>= "0.6"}
|
"ostap" {>= "0.6"}
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,6 @@ void handler (int sig) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void *alloc (size_t size) {
|
void *alloc (size_t size) {
|
||||||
// return malloc(size);
|
|
||||||
// FIXME, disable gc
|
|
||||||
#ifdef DEBUG_VERSION
|
#ifdef DEBUG_VERSION
|
||||||
++cur_id;
|
++cur_id;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -249,7 +247,6 @@ static void gc_root_scan_stack () {
|
||||||
}
|
}
|
||||||
|
|
||||||
void mark_phase (void) {
|
void mark_phase (void) {
|
||||||
// FIXME, disable gc
|
|
||||||
#if defined(DEBUG_VERSION) && defined(DEBUG_PRINT)
|
#if defined(DEBUG_VERSION) && defined(DEBUG_PRINT)
|
||||||
fprintf(stderr, "marking has started\n");
|
fprintf(stderr, "marking has started\n");
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
|
@ -623,8 +620,7 @@ extern void __shutdown (void) {
|
||||||
void clear_extra_roots (void) { extra_roots.current_free = 0; }
|
void clear_extra_roots (void) { extra_roots.current_free = 0; }
|
||||||
|
|
||||||
void push_extra_root (void **p) {
|
void push_extra_root (void **p) {
|
||||||
// FIXME, disable gc
|
if (extra_roots.current_free >= MAX_EXTRA_ROOTS_NUMBER) {
|
||||||
if (extra_roots.current_free > MAX_EXTRA_ROOTS_NUMBER) {
|
|
||||||
perror("ERROR: push_extra_roots: extra_roots_pool overflow\n");
|
perror("ERROR: push_extra_roots: extra_roots_pool overflow\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
@ -634,7 +630,6 @@ void push_extra_root (void **p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void pop_extra_root (void **p) {
|
void pop_extra_root (void **p) {
|
||||||
// FIXME, disable gc
|
|
||||||
if (extra_roots.current_free == 0) {
|
if (extra_roots.current_free == 0) {
|
||||||
perror("ERROR: pop_extra_root: extra_roots are empty\n");
|
perror("ERROR: pop_extra_root: extra_roots are empty\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
#define SET_FORWARD_ADDRESS(x, addr) (x = ((x & 3) | ((ptrt)(addr))))
|
#define SET_FORWARD_ADDRESS(x, addr) (x = ((x & 3) | ((ptrt)(addr))))
|
||||||
// if heap is full after gc shows in how many times it has to be extended
|
// if heap is full after gc shows in how many times it has to be extended
|
||||||
#define EXTRA_ROOM_HEAP_COEFFICIENT 2
|
#define EXTRA_ROOM_HEAP_COEFFICIENT 2
|
||||||
#define MINIMUM_HEAP_CAPACITY (64000000)
|
#define MINIMUM_HEAP_CAPACITY (64)
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
|
||||||
|
|
@ -845,30 +845,6 @@ extern void *Barray (aint* args, aint bn) {
|
||||||
return r->contents;
|
return r->contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void *Barray_rev (aint* args, aint bn) {
|
|
||||||
data *r;
|
|
||||||
aint n = UNBOX(bn);
|
|
||||||
|
|
||||||
PRE_GC();
|
|
||||||
|
|
||||||
for (aint i = 0; i < n; i++) {
|
|
||||||
push_extra_root((void**)&args[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
r = (data *)alloc_array(n);
|
|
||||||
|
|
||||||
for (int i = 0; i < n; i++) {
|
|
||||||
((aint *)r->contents)[i] = args[n - i - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (aint i = n - 1; i >= 0; --i) {
|
|
||||||
pop_extra_root((void**)&args[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
POST_GC();
|
|
||||||
return r->contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG_VERSION
|
#ifdef DEBUG_VERSION
|
||||||
extern memory_chunk heap;
|
extern memory_chunk heap;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -902,35 +878,6 @@ extern void *Bsexp (aint* args, aint bn) {
|
||||||
return (void *)((data *)r)->contents;
|
return (void *)((data *)r)->contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void *Bsexp_rev (aint* args, aint bn) {
|
|
||||||
sexp *r;
|
|
||||||
aint n = UNBOX(bn);
|
|
||||||
|
|
||||||
PRE_GC();
|
|
||||||
|
|
||||||
aint fields_cnt = n - 1;
|
|
||||||
|
|
||||||
for (aint i = 0; i < fields_cnt; i++) {
|
|
||||||
push_extra_root((void**)&args[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
r = alloc_sexp(fields_cnt);
|
|
||||||
r->tag = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < fields_cnt; i++) {
|
|
||||||
((auint *)r->contents)[i] = args[fields_cnt - i];
|
|
||||||
}
|
|
||||||
|
|
||||||
r->tag = UNBOX(args[0]);
|
|
||||||
|
|
||||||
for (aint i = fields_cnt - 1; i >= 0; --i) {
|
|
||||||
pop_extra_root((void**)&args[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
POST_GC();
|
|
||||||
return (void *)((data *)r)->contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern aint Btag (void *d, aint t, aint n) {
|
extern aint Btag (void *d, aint t, aint n) {
|
||||||
data *r;
|
data *r;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue