Ticket #860: inlined-checks.patch
File inlined-checks.patch, 4.8 KB (added by , 9 years ago) |
---|
-
chicken.h
diff --git a/chicken.h b/chicken.h index 4b57313..0e536c0 100644
a b typedef void (C_ccall *C_proc)(C_word, C_word *) C_noret; 1061 1061 #else 1062 1062 # define C_stack_pointer ((C_word *)C_alloca(0)) 1063 1063 #endif 1064 #define C_stack_pointer_test ((C_word *)C_alloca(1))1065 1064 #define C_demand_2(n) (((C_word *)C_fromspace_top + (n)) < (C_word *)C_fromspace_limit) 1066 1065 #define C_fix(n) ((C_word)((C_uword)(n) << C_FIXNUM_SHIFT) | C_FIXNUM_BIT) 1067 1066 #define C_unfix(x) C_CHECKp(x,C_fixnump(C_VAL1(x)),((C_VAL1(x)) >> C_FIXNUM_SHIFT)) … … C_fctexport void C_fcall C_rereclaim2(C_uword size, int double_plus) C_regparm; 1823 1822 C_fctexport void C_unbound_variable(C_word sym); 1824 1823 C_fctexport C_word C_fcall C_retrieve2(C_word val, char *name) C_regparm; 1825 1824 C_fctexport void *C_fcall C_retrieve2_symbol_proc(C_word val, char *name) C_regparm; 1826 C_fctexport int C_in_stackp(C_word x) C_regparm; 1827 C_fctexport int C_fcall C_in_heapp(C_word x) C_regparm; 1828 C_fctexport int C_fcall C_in_fromspacep(C_word x) C_regparm; 1829 C_fctexport int C_fcall C_in_scratchspacep(C_word x) C_regparm; 1825 C_fctexport C_word C_permanentp(C_word x) C_regparm; 1830 1826 C_fctexport void C_fcall C_trace(C_char *name) C_regparm; 1831 1827 C_fctexport C_word C_fcall C_emit_trace_info2(char *raw, C_word x, C_word y, C_word t) C_regparm; 1832 1828 C_fctexport C_word C_fcall C_u_i_string_hash(C_word str, C_word rnd) C_regparm; … … C_mutate2(C_word *slot, C_word val) /* OBSOLETE */ 2192 2188 else return *slot = val; 2193 2189 } 2194 2190 2195 C_inline C_word C_permanentp(C_word x)2196 {2197 return C_mk_bool(!C_immediatep(x) && !C_in_stackp(x) && !C_in_heapp(x));2198 }2199 2200 2201 2191 C_inline C_word C_flonum(C_word **ptr, double n) 2202 2192 { 2203 2193 C_word -
runtime.c
diff --git a/runtime.c b/runtime.c index c9c9d94..2f5bb71 100644
a b static void C_fcall really_mark(C_word *x) C_regparm; 506 506 static WEAK_TABLE_ENTRY *C_fcall lookup_weak_table_entry(C_word item, C_word container) C_regparm; 507 507 static C_cpsproc(values_continuation) C_noret; 508 508 static C_word add_symbol(C_word **ptr, C_word key, C_word string, C_SYMBOL_TABLE *stable); 509 static C_regparm int C_fcall C_in_new_heapp(C_word x);510 509 static C_regparm C_word bignum_times_bignum_unsigned(C_word **ptr, C_word x, C_word y, C_word negp); 511 510 static C_regparm C_word bignum_extract_digits(C_word **ptr, C_word n, C_word x, C_word start, C_word end); 512 511 … … C_word C_dbg_hook(C_word dummy) 1940 1939 return dummy; 1941 1940 } 1942 1941 1942 /* Inlineable memory region predicates */ 1943 1944 C_inline int C_in_stackp(C_word x) 1945 { 1946 C_word *ptr = (C_word *)(C_uword)x; 1947 1948 #if C_STACK_GROWS_DOWNWARD 1949 return ptr >= C_stack_pointer && ptr <= stack_bottom; 1950 #else 1951 return ptr < C_stack_pointer && ptr >= stack_bottom; 1952 #endif 1953 } 1954 1955 C_inline int C_fcall C_in_heapp(C_word x) 1956 { 1957 C_byte *ptr = (C_byte *)(C_uword)x; 1958 return (ptr >= fromspace_start && ptr < C_fromspace_limit) || 1959 (ptr >= tospace_start && ptr < tospace_limit); 1960 } 1961 1962 /* Only used during major GC (heap realloc) */ 1963 C_inline int C_fcall C_in_new_heapp(C_word x) 1964 { 1965 C_byte *ptr = (C_byte *)(C_uword)x; 1966 return (ptr >= new_tospace_start && ptr < new_tospace_limit); 1967 } 1968 1969 C_inline int C_fcall C_in_fromspacep(C_word x) 1970 { 1971 C_byte *ptr = (C_byte *)(C_uword)x; 1972 return (ptr >= fromspace_start && ptr < C_fromspace_limit); 1973 } 1974 1975 C_inline int C_fcall C_in_scratchspacep(C_word x) 1976 { 1977 C_word *ptr = (C_word *)(C_uword)x; 1978 return (ptr >= C_scratchspace_start && ptr < C_scratchspace_limit); 1979 } 1980 1981 C_regparm C_word C_permanentp(C_word x) 1982 { 1983 return C_mk_bool(!C_immediatep(x) && !C_in_stackp(x) && !C_in_heapp(x)); 1984 } 1943 1985 1944 1986 /* Timing routines: */ 1945 1987 … … C_word add_symbol(C_word **ptr, C_word key, C_word string, C_SYMBOL_TABLE *stabl 2385 2427 return sym; 2386 2428 } 2387 2429 2388 2389 C_regparm int C_in_stackp(C_word x)2390 {2391 C_word *ptr = (C_word *)(C_uword)x;2392 2393 #if C_STACK_GROWS_DOWNWARD2394 return ptr >= C_stack_pointer_test && ptr <= stack_bottom;2395 #else2396 return ptr < C_stack_pointer_test && ptr >= stack_bottom;2397 #endif2398 }2399 2400 2401 C_regparm int C_fcall C_in_heapp(C_word x)2402 {2403 C_byte *ptr = (C_byte *)(C_uword)x;2404 return (ptr >= fromspace_start && ptr < C_fromspace_limit) ||2405 (ptr >= tospace_start && ptr < tospace_limit);2406 }2407 2408 /* Only used during major GC (heap realloc) */2409 static C_regparm int C_fcall C_in_new_heapp(C_word x)2410 {2411 C_byte *ptr = (C_byte *)(C_uword)x;2412 return (ptr >= new_tospace_start && ptr < new_tospace_limit);2413 }2414 2415 C_regparm int C_fcall C_in_fromspacep(C_word x)2416 {2417 C_byte *ptr = (C_byte *)(C_uword)x;2418 return (ptr >= fromspace_start && ptr < C_fromspace_limit);2419 }2420 2421 C_regparm int C_fcall C_in_scratchspacep(C_word x)2422 {2423 C_word *ptr = (C_word *)(C_uword)x;2424 return (ptr >= C_scratchspace_start && ptr < C_scratchspace_limit);2425 }2426 2427 2430 /* Cons the rest-aguments together: */ 2428 2431 2429 2432 C_regparm C_word C_fcall C_build_rest(C_word **ptr, C_word c, C_word n, C_word *av)