~ chicken-core (chicken-5) 1a6a9481f1d6d3d7bc582d5838b3a22ad7e8dec0
commit 1a6a9481f1d6d3d7bc582d5838b3a22ad7e8dec0 Author: Peter Bex <peter@more-magic.net> AuthorDate: Thu Oct 12 16:35:14 2017 +0200 Commit: Evan Hanson <evhan@foldling.org> CommitDate: Mon Oct 16 09:40:45 2017 +1300 Replace all uses of C_mutate2() with C_mutate() C_mutate2 has been deprecated for a long time (it has been in core since 6c90c4a1a89 in 2012, as a temporary compatibility workaround), but calls to it were *still* being generated by the compiler. In order to get rid of the definition, we first need to ensure we don't generate any calls to it ourselves. This means that after the next snapshot we can finally and completely remove C_mutate2(). Signed-off-by: Evan Hanson <evhan@foldling.org> diff --git a/NEWS b/NEWS index d9f194c0..9f945c4c 100644 --- a/NEWS +++ b/NEWS @@ -15,7 +15,7 @@ - Continuations which discard additional values beyond the first now also accept multiple values via direct invocation after being captured through `call/cc`, not just via `values` (#1390) - - Removed the deprecated C_locative_ref C function. + - Removed the deprecated C_locative_ref and C_mutate2 C functions. - Compiler - Fixed an off by one allocation problem in generated C code for (list ...). diff --git a/c-backend.scm b/c-backend.scm index f1328c42..c8b48335 100644 --- a/c-backend.scm +++ b/c-backend.scm @@ -156,7 +156,7 @@ (gen #\)) ) ((##core#update) - (gen "C_mutate2(((C_word *)") + (gen "C_mutate(((C_word *)") (expr (car subs) i) (gen ")+" (+ (first params) 1) ",") (expr (cadr subs) i) @@ -170,7 +170,7 @@ (gen #\)) ) ((##core#updatebox) - (gen "C_mutate2(((C_word *)") + (gen "C_mutate(((C_word *)") (expr (car subs) i) (gen ")+1,") (expr (cadr subs) i) @@ -216,8 +216,8 @@ (block (second params)) (var (third params))) (if block - (gen "C_mutate2(&lf[" index "]") - (gen "C_mutate2((C_word*)lf[" index "]+1") ) + (gen "C_mutate(&lf[" index "]") + (gen "C_mutate((C_word*)lf[" index "]+1")) (gen " /* (set! " (uncommentify (##sys#symbol->qualified-string var)) " ...) */,") (expr (car subs) i) (gen #\)) ) ) diff --git a/chicken.h b/chicken.h index b08f0de2..9e2af974 100644 --- a/chicken.h +++ b/chicken.h @@ -800,10 +800,10 @@ typedef void (C_ccall *C_proc)(C_word, C_word *) C_noret; #define C_cpsproc(name) C_ccall void name(C_word c, C_word *av) C_noret #define CHICKEN_gc_root_ref(root) (((C_GC_ROOT *)(root))->value) -#define CHICKEN_gc_root_set(root, x) C_mutate2(&((C_GC_ROOT *)(root))->value, (x)) +#define CHICKEN_gc_root_set(root, x) C_mutate(&((C_GC_ROOT *)(root))->value, (x)) #define CHICKEN_global_ref(root) C_u_i_car(((C_GC_ROOT *)(root))->value) -#define CHICKEN_global_set(root, x) C_mutate2(&C_u_i_car(((C_GC_ROOT *)(root))->value), (x)) +#define CHICKEN_global_set(root, x) C_mutate(&C_u_i_car(((C_GC_ROOT *)(root))->value), (x)) #define CHICKEN_default_toplevel ((void *)C_default_5fstub_toplevel) @@ -1352,10 +1352,10 @@ typedef void (C_ccall *C_proc)(C_word, C_word *) C_noret; #define C_a_unsigned_int_to_num(ptr, n, i) C_unsigned_int_to_num(ptr, i) #define C_a_i_vector C_vector #define C_list C_a_i_list -#define C_i_setslot(x, i, y) (C_mutate2(&C_block_item(x, C_unfix(i)), y), C_SCHEME_UNDEFINED) +#define C_i_setslot(x, i, y) (C_mutate(&C_block_item(x, C_unfix(i)), y), C_SCHEME_UNDEFINED) #define C_i_set_i_slot(x, i, y) (C_set_block_item(x, C_unfix(i), y), C_SCHEME_UNDEFINED) -#define C_u_i_set_car(p, x) (C_mutate2(&C_u_i_car(p), x), C_SCHEME_UNDEFINED) -#define C_u_i_set_cdr(p, x) (C_mutate2(&C_u_i_cdr(p), x), C_SCHEME_UNDEFINED) +#define C_u_i_set_car(p, x) (C_mutate(&C_u_i_car(p), x), C_SCHEME_UNDEFINED) +#define C_u_i_set_cdr(p, x) (C_mutate(&C_u_i_cdr(p), x), C_SCHEME_UNDEFINED) #define C_a_i_putprop(p, c, x, y, z) C_putprop(p, x, y, z) #define C_i_not(x) (C_truep(x) ? C_SCHEME_FALSE : C_SCHEME_TRUE) diff --git a/runtime.c b/runtime.c index 260e660d..e1970cd6 100644 --- a/runtime.c +++ b/runtime.c @@ -2052,7 +2052,7 @@ C_word C_fcall C_restore_callback_continuation(void) assert(!C_immediatep(p) && C_block_header(p) == C_PAIR_TAG); k = C_u_i_car(p); - C_mutate2(&C_block_item(callback_continuation_stack_symbol, 0), C_u_i_cdr(p)); + C_mutate(&C_block_item(callback_continuation_stack_symbol, 0), C_u_i_cdr(p)); --callback_continuation_level; return k; } @@ -2068,7 +2068,7 @@ C_word C_fcall C_restore_callback_continuation2(int level) k = C_u_i_car(p); - C_mutate2(&C_block_item(callback_continuation_stack_symbol, 0), C_u_i_cdr(p)); + C_mutate(&C_block_item(callback_continuation_stack_symbol, 0), C_u_i_cdr(p)); --callback_continuation_level; return k; } @@ -2340,7 +2340,7 @@ C_regparm C_word C_fcall C_intern3(C_word **ptr, C_char *str, C_word value) { C_word s = C_intern_in(ptr, C_strlen(str), str, symbol_table); - C_mutate2(&C_block_item(s,0), value); + C_mutate(&C_block_item(s,0), value); C_i_persist_symbol(s); /* Symbol has a value now; persist it */ return s; } @@ -2491,7 +2491,7 @@ C_word add_symbol(C_word **ptr, C_word key, C_word string, C_SYMBOL_TABLE *stabl heap-top (say, in a toplevel literal frame allocation) then we have to inform the memory manager that a 2nd gen. block points to a 1st gen. block, hence the mutation: */ - C_mutate2(&C_block_item(bucket,1), b2); + C_mutate(&C_block_item(bucket,1), b2); stable->table[ key ] = bucket; } @@ -4566,12 +4566,12 @@ C_word C_fetch_trace(C_word starti, C_word buffer) if(ptr >= trace_buffer_limit) ptr = trace_buffer; /* outside-pointer, will be ignored by GC */ - C_mutate2(&C_block_item(buffer, p++), (C_word)ptr->raw); + C_mutate(&C_block_item(buffer, p++), (C_word)ptr->raw); /* subject to GC */ - C_mutate2(&C_block_item(buffer, p++), ptr->cooked1); - C_mutate2(&C_block_item(buffer, p++), ptr->cooked2); - C_mutate2(&C_block_item(buffer, p++), ptr->thread); + C_mutate(&C_block_item(buffer, p++), ptr->cooked1); + C_mutate(&C_block_item(buffer, p++), ptr->cooked2); + C_mutate(&C_block_item(buffer, p++), ptr->thread); } } @@ -5782,7 +5782,7 @@ C_regparm C_word C_fcall C_i_set_car(C_word x, C_word val) if(C_immediatep(x) || C_block_header(x) != C_PAIR_TAG) barf(C_BAD_ARGUMENT_TYPE_ERROR, "set-car!", x); - C_mutate2(&C_u_i_car(x), val); + C_mutate(&C_u_i_car(x), val); return C_SCHEME_UNDEFINED; } @@ -5792,7 +5792,7 @@ C_regparm C_word C_fcall C_i_set_cdr(C_word x, C_word val) if(C_immediatep(x) || C_block_header(x) != C_PAIR_TAG) barf(C_BAD_ARGUMENT_TYPE_ERROR, "set-cdr!", x); - C_mutate2(&C_u_i_cdr(x), val); + C_mutate(&C_u_i_cdr(x), val); return C_SCHEME_UNDEFINED; } @@ -5809,7 +5809,7 @@ C_regparm C_word C_fcall C_i_vector_set(C_word v, C_word i, C_word x) if(j < 0 || j >= C_header_size(v)) barf(C_OUT_OF_RANGE_ERROR, "vector-set!", v, i); - C_mutate2(&C_block_item(v, j), x); + C_mutate(&C_block_item(v, j), x); } else barf(C_BAD_ARGUMENT_TYPE_ERROR, "vector-set!", i); @@ -11434,7 +11434,7 @@ C_regparm C_word C_fcall C_i_locative_set(C_word loc, C_word x) barf(C_LOST_LOCATIVE_ERROR, "locative-set!", loc); switch(C_unfix(C_block_item(loc, 2))) { - case C_SLOT_LOCATIVE: C_mutate2(ptr, x); break; + case C_SLOT_LOCATIVE: C_mutate(ptr, x); break; case C_CHAR_LOCATIVE: if((x & C_IMMEDIATE_TYPE_BITS) != C_CHARACTER_BITS) @@ -12138,7 +12138,7 @@ C_putprop(C_word **ptr, C_word sym, C_word prop, C_word val) while(pl != C_SCHEME_END_OF_LIST) { if(C_block_item(pl, 0) == prop) { - C_mutate2(&C_u_i_car(C_u_i_cdr(pl)), val); + C_mutate(&C_u_i_car(C_u_i_cdr(pl)), val); return val; } else pl = C_u_i_cdr(C_u_i_cdr(pl));Trap