mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 21:59:16 +02:00
Unsafe cell functions
This commit is contained in:
parent
facaf608ae
commit
fa24f4db37
3 changed files with 12 additions and 1 deletions
|
@ -161,6 +161,7 @@ object Cyc_num_cmp_va_list(void *data, int argc,
|
||||||
int (fn_op(void *, object, object)), object n,
|
int (fn_op(void *, object, object)), object n,
|
||||||
va_list ns);
|
va_list ns);
|
||||||
object Cyc_eq(object x, object y);
|
object Cyc_eq(object x, object y);
|
||||||
|
object Cyc_set_cell(void *, object l, object val);
|
||||||
object Cyc_set_car(void *, object l, object val);
|
object Cyc_set_car(void *, object l, object val);
|
||||||
object Cyc_set_cdr(void *, object l, object val);
|
object Cyc_set_cdr(void *, object l, object val);
|
||||||
object Cyc_length(void *d, object l);
|
object Cyc_length(void *d, object l);
|
||||||
|
|
10
runtime.c
10
runtime.c
|
@ -235,6 +235,7 @@ gc_heap_root *gc_get_heap()
|
||||||
|
|
||||||
object cell_get(object cell)
|
object cell_get(object cell)
|
||||||
{
|
{
|
||||||
|
// FUTURE: always use unsafe car here, since computed by compiler
|
||||||
return car(cell);
|
return car(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1225,6 +1226,15 @@ object Cyc_eq(object x, object y)
|
||||||
return boolean_f;
|
return boolean_f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
object Cyc_set_cell(void *data, object l, object val)
|
||||||
|
{
|
||||||
|
// FUTURE: always use "unsafe" car here, since set-cell is added by cyclone
|
||||||
|
gc_mut_update((gc_thread_data *) data, car(l), val);
|
||||||
|
car(l) = val;
|
||||||
|
add_mutation(data, l, -1, val);
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
object Cyc_set_car(void *data, object l, object val)
|
object Cyc_set_car(void *data, object l, object val)
|
||||||
{
|
{
|
||||||
if (Cyc_is_pair(l) == boolean_f)
|
if (Cyc_is_pair(l) == boolean_f)
|
||||||
|
|
|
@ -518,7 +518,7 @@
|
||||||
((eq? p 'cons) "make_pair")
|
((eq? p 'cons) "make_pair")
|
||||||
((eq? p 'cell) "make_cell")
|
((eq? p 'cell) "make_cell")
|
||||||
((eq? p 'cell-get) "cell_get")
|
((eq? p 'cell-get) "cell_get")
|
||||||
((eq? p 'set-cell!) "Cyc_set_car")
|
((eq? p 'set-cell!) "Cyc_set_cell")
|
||||||
((eq? p 'set-global!) "global_set")
|
((eq? p 'set-global!) "global_set")
|
||||||
(else
|
(else
|
||||||
(error "unhandled primitive: " p))))
|
(error "unhandled primitive: " p))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue