From: Guillermo J. Rozas Date: Mon, 27 Nov 1989 01:03:04 +0000 (+0000) Subject: Clean up the mess with machine_word. X-Git-Tag: 20090517-FFI~11674 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=d9c6347a427fad5add67fcb44bb96ac384fe17d6;p=mit-scheme.git Clean up the mess with machine_word. --- diff --git a/v7/src/microcode/cmpgc.h b/v7/src/microcode/cmpgc.h index 58207deda..1fd7b731e 100644 --- a/v7/src/microcode/cmpgc.h +++ b/v7/src/microcode/cmpgc.h @@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising, promotional, or sales literature without prior written consent from MIT in each case. */ -/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/cmpgc.h,v 1.7 1989/11/06 17:37:30 jinx Exp $ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/cmpgc.h,v 1.8 1989/11/27 01:02:31 jinx Exp $ $MC68020-Header: cmp68kgc.h,v 9.30 89/03/27 23:14:31 GMT jinx Exp $ Utilities to relocate compiled code in garbage collection-like processes. @@ -88,7 +88,7 @@ else #define Get_Compiled_Block(var, address) \ { \ - machine_word offset_word; \ + long offset_word; \ \ var = (address); \ \ @@ -179,24 +179,24 @@ MAKE_POINTER_OBJECT((OBJECT_TYPE(object)), \ */ #define CLOSURE_HEADER_TO_ENTRY \ -((sizeof (SCHEME_OBJECT)) + (2 * (sizeof (machine_word)))) +((sizeof (SCHEME_OBJECT)) + (2 * (sizeof (format_word)))) #define CLOSURE_HEADER_TO_ENTRY_WORD \ -((machine_word) (BYTE_OFFSET_TO_OFFSET_WORD (CLOSURE_HEADER_TO_ENTRY))) +((format_word) (BYTE_OFFSET_TO_OFFSET_WORD (CLOSURE_HEADER_TO_ENTRY))) #define MANIFEST_CLOSURE_COUNT(scan) \ -(((((machine_word *) (scan))[1]) == \ +(((((format_word *) (scan))[1]) == \ CLOSURE_HEADER_TO_ENTRY_WORD) ? \ 1 : \ - ((long) (((machine_word *) (scan))[0]))) + ((long) (((format_word *) (scan))[0]))) #define FIRST_MANIFEST_CLOSURE_ENTRY(scan) \ -(((((machine_word *) (scan))[1]) == CLOSURE_HEADER_TO_ENTRY_WORD) ? \ - (((machine_word *) (scan)) + 2) : \ - (((machine_word *) (scan)) + 4)) +(((((format_word *) (scan))[1]) == CLOSURE_HEADER_TO_ENTRY_WORD) ? \ + (((char *) (scan)) + (2 * (sizeof (format_word)))) : \ + (((char *) (scan)) + (4 * (sizeof (format_word))))) #define NEXT_MANIFEST_CLOSURE_ENTRY(word_ptr) \ - (((machine_word *) (word_ptr)) + (COMPILED_CLOSURE_ENTRY_SIZE)) + (((char *) (word_ptr)) + (COMPILED_CLOSURE_ENTRY_SIZE)) /* Where this closure entry ends with respect to the entry point. Since an entry point is preceded by a format word and a gc offset, @@ -204,7 +204,11 @@ MAKE_POINTER_OBJECT((OBJECT_TYPE(object)), \ */ #define CLOSURE_ENTRY_END(word_ptr) \ - (((machine_word *) (word_ptr)) + ((COMPILED_CLOSURE_ENTRY_SIZE) - 2)) + (((char *) (word_ptr)) + \ + ((COMPILED_CLOSURE_ENTRY_SIZE) - (2 * (sizeof (format_word))))) + +#define CHAR_TO_SCHEME_OBJECT(chars) \ +(((chars) + ((sizeof (SCHEME_OBJECT)) - 1)) / (sizeof (SCHEME_OBJECT))) /* This takes into account the fact that the relocation loop increments by 1 on each major iteration. @@ -214,12 +218,11 @@ MAKE_POINTER_OBJECT((OBJECT_TYPE(object)), \ #define MANIFEST_CLOSURE_END(start, count) \ (((SCHEME_OBJECT *) (start)) + \ - (((((sizeof (machine_word)) * \ - (((count) * COMPILED_CLOSURE_ENTRY_SIZE) + \ - (((count) == 1) ? 0 : 2))) + \ - ((sizeof (SCHEME_OBJECT)) - 1)) / \ - (sizeof (SCHEME_OBJECT)))) \ - - 1) + ((CHAR_TO_SCHEME_OBJECT (((count) * COMPILED_CLOSURE_ENTRY_SIZE) + \ + (((count) == 1) ? \ + 0 : \ + (2 * sizeof(format_word))))) \ + - 1)) /* Linkage sections */ @@ -251,36 +254,34 @@ MAKE_POINTER_OBJECT((OBJECT_TYPE(object)), \ (((SCHEME_OBJECT *) (scan)) + ((count) * EXECUTE_CACHE_ENTRY_SIZE)) #define FIRST_OPERATOR_LINKAGE_ENTRY(scan) \ - ((machine_word *) (((SCHEME_OBJECT *) (scan)) + 1)) + ((char *) (((SCHEME_OBJECT *) (scan)) + 1)) #define NEXT_LINKAGE_OPERATOR_ENTRY(word_ptr) \ - ((machine_word *) (((SCHEME_OBJECT *) (word_ptr)) + \ - EXECUTE_CACHE_ENTRY_SIZE)) + ((char *) (((SCHEME_OBJECT *) (word_ptr)) + \ + EXECUTE_CACHE_ENTRY_SIZE)) #define EXTRACT_OPERATOR_LINKAGE_ADDRESS(target, source) \ { \ - EXTRACT_EXECUTE_CACHE_ADDRESS(target, source); \ + EXTRACT_EXECUTE_CACHE_ADDRESS (target, source); \ } #define STORE_OPERATOR_LINKAGE_ADDRESS(source, target) \ { \ - STORE_EXECUTE_CACHE_ADDRESS(target, source); \ + STORE_EXECUTE_CACHE_ADDRESS (target, source); \ } /* Heuristic recovery aid. See unix.c for details. */ #define CC_BLOCK_FIRST_GC_OFFSET \ - (CC_BLOCK_FIRST_ENTRY_OFFSET - (sizeof (machine_word))) + (CC_BLOCK_FIRST_ENTRY_OFFSET - (sizeof (format_word))) #define PLAUSIBLE_CC_BLOCK_P(block) \ -((*((machine_word *) \ +((*((format_word *) \ (((char *) block) + CC_BLOCK_FIRST_GC_OFFSET))) == \ ((BYTE_OFFSET_TO_OFFSET_WORD(CC_BLOCK_FIRST_ENTRY_OFFSET)))) #else /* not HAS_COMPILER_SUPPORT */ -typedef unsigned long machine_word; - /* Is there anything else that can be done here? */ #define GC_NO_COMPILER_STMT() \ @@ -299,16 +300,16 @@ typedef unsigned long machine_word; #define Get_Compiled_Block(var, address) (GC_NO_COMPILER_STMT ()) #define FIRST_MANIFEST_CLOSURE_ENTRY(scan) \ - (GC_NO_COMPILER_EXPR ((machine_word *))) + (GC_NO_COMPILER_EXPR ((char *))) #define MANIFEST_CLOSURE_COUNT(scan) \ (GC_NO_COMPILER_EXPR ((long))) #define NEXT_MANIFEST_CLOSURE_ENTRY(word_ptr) \ - (GC_NO_COMPILER_EXPR ((machine_word *))) + (GC_NO_COMPILER_EXPR ((char *))) #define CLOSURE_ENTRY_END(word_ptr) \ - (GC_NO_COMPILER_EXPR ((machinw_word *))) + (GC_NO_COMPILER_EXPR ((char *))) #define MANIFEST_CLOSURE_END(end, start) \ (GC_NO_COMPILER_EXPR ((SCHEME_OBJECT *))) @@ -334,10 +335,10 @@ typedef unsigned long machine_word; (GC_NO_COMPILER_EXPR ((SCHEME_OBJECT *))) #define FIRST_OPERATOR_LINKAGE_ENTRY(scan) \ - (GC_NO_COMPILER_EXPR ((machine_word *))) + (GC_NO_COMPILER_EXPR ((char *))) #define NEXT_LINKAGE_OPERATOR_ENTRY(ptr) \ - (GC_NO_COMPILER_EXPR ((machine_word *))) + (GC_NO_COMPILER_EXPR ((char *))) #define EXTRACT_OPERATOR_LINKAGE_ADDRESS(target, source) \ (GC_NO_COMPILER_STMT ()) diff --git a/v7/src/microcode/cmpint.c b/v7/src/microcode/cmpint.c index f837ade35..1d57a040f 100644 --- a/v7/src/microcode/cmpint.c +++ b/v7/src/microcode/cmpint.c @@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising, promotional, or sales literature without prior written consent from MIT in each case. */ -/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/cmpint.c,v 1.17 1989/11/22 16:29:55 jinx Exp $ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/cmpint.c,v 1.18 1989/11/27 01:01:55 jinx Exp $ * * This file corresponds to * $COMPILER-Header: compiler.c,v 9.37 89/10/25 14:55:45 GMT jinx Exp $ @@ -104,6 +104,10 @@ MIT in each case. */ #define C_TO_SCHEME #define SCHEME_UTILITY +/* For clarity */ + +typedef char instruction; + /* Structure returned by SCHEME_UTILITYs */ struct utility_result @@ -396,9 +400,10 @@ struct utility_result C_TO_SCHEME long enter_compiled_expression() { - SCHEME_OBJECT *compiled_entry_address; + instruction *compiled_entry_address; - compiled_entry_address = (OBJECT_ADDRESS (Fetch_Expression ())); + compiled_entry_address = + ((instruction *) (OBJECT_ADDRESS (Fetch_Expression ()))); if ((COMPILED_ENTRY_FORMAT_WORD (compiled_entry_address)) != (FORMAT_WORD_EXPR)) { @@ -406,7 +411,7 @@ enter_compiled_expression() Val = (Fetch_Expression ()); return (C_to_interface ((instruction *) (OBJECT_ADDRESS (STACK_POP ())))); } - return (C_to_interface ((instruction *) compiled_entry_address)); + return (C_to_interface (compiled_entry_address)); } C_TO_SCHEME long @@ -421,7 +426,7 @@ apply_compiled_procedure() procedure = (STACK_POP ()); procedure_entry = ((instruction *) (OBJECT_ADDRESS (procedure))); result = setup_compiled_invocation ((OBJECT_DATUM (nactuals)), - ((machine_word *) procedure_entry)); + procedure_entry); if (result == PRIM_DONE) { /* Go into compiled code. */ @@ -455,7 +460,7 @@ return_to_compiled_code () static long setup_compiled_invocation (nactuals, compiled_entry_address) long nactuals; - machine_word *compiled_entry_address; + instruction *compiled_entry_address; { static long setup_lexpr_invocation(); static SCHEME_OBJECT *open_gap(); @@ -541,7 +546,7 @@ open_gap (nactuals, delta) static long setup_lexpr_invocation (nactuals, nmax, entry_address) register long nactuals, nmax; - machine_word *entry_address; + instruction *entry_address; { register long delta; @@ -726,8 +731,7 @@ comutil_apply (procedure, nactuals, ignore_3, ignore_4) entry_point = ((instruction *) (OBJECT_ADDRESS (procedure))); RETURN_UNLESS_EXCEPTION - ((setup_compiled_invocation (nactuals, - ((machine_word *) entry_point))), + ((setup_compiled_invocation (nactuals, entry_point)), entry_point); } @@ -825,7 +829,7 @@ comutil_lexpr_apply (entry_address, nactuals, ignore_3, ignore_4) ((setup_lexpr_invocation ((nactuals + 1), (COMPILED_ENTRY_MAXIMUM_ARITY (entry_address)), - ((machine_word *) entry_address))), + entry_address)), entry_address); } @@ -1355,12 +1359,11 @@ comutil_interrupt_closure (ignore_1, ignore_2, ignore_3, ignore_4) TEST_GC_NEEDED(); if ((PENDING_INTERRUPTS()) == 0) { - SCHEME_OBJECT *entry_point; + instruction *entry_point; EXTRACT_CLOSURE_ENTRY_ADDRESS(entry_point, (OBJECT_ADDRESS (STACK_REF (0)))); - RETURN_TO_SCHEME(((instruction *) entry_point) + - CLOSURE_SKIPPED_CHECK_OFFSET); + RETURN_TO_SCHEME(entry_point + CLOSURE_SKIPPED_CHECK_OFFSET); } else { @@ -2182,9 +2185,9 @@ store_uuo_link (entry, cache_address) #define TRAMPOLINE_SIZE (TRAMPOLINE_ENTRY_SIZE + 2) static long -make_trampoline (slot, format_word, kind, size, value1, value2, value3) +make_trampoline (slot, fmt_word, kind, size, value1, value2, value3) SCHEME_OBJECT *slot; - machine_word format_word; + format_word fmt_word; long kind, size; SCHEME_OBJECT value1, value2, value3; { @@ -2206,7 +2209,7 @@ make_trampoline (slot, format_word, kind, size, value1, value2, value3) local_free += TRAMPOLINE_BLOCK_TO_ENTRY; entry_point = local_free; local_free = (TRAMPOLINE_STORAGE(entry_point)); - (COMPILED_ENTRY_FORMAT_WORD (entry_point)) = format_word; + (COMPILED_ENTRY_FORMAT_WORD (entry_point)) = fmt_word; (COMPILED_ENTRY_OFFSET_WORD (entry_point)) = (MAKE_OFFSET_WORD (entry_point, block, false)); STORE_TRAMPOLINE_ENTRY (entry_point, kind); @@ -2236,7 +2239,7 @@ make_redirection_trampoline (slot, kind, procedure) SCHEME_OBJECT procedure; { return (make_trampoline (slot, - ((machine_word) FORMAT_WORD_CMPINT), + ((format_word) FORMAT_WORD_CMPINT), kind, 1, procedure, @@ -2251,7 +2254,7 @@ make_apply_trampoline (slot, kind, procedure, nactuals) SCHEME_OBJECT procedure; { return (make_trampoline (slot, - ((machine_word) FORMAT_WORD_CMPINT), + ((format_word) FORMAT_WORD_CMPINT), kind, 2, procedure, @@ -2414,7 +2417,7 @@ make_fake_uuo_link (extension, block, offset) SCHEME_OBJECT trampoline, *cache_address; result = (make_trampoline (&trampoline, - ((machine_word) FORMAT_WORD_CMPINT), + ((format_word) FORMAT_WORD_CMPINT), TRAMPOLINE_K_LOOKUP, 3, extension, @@ -2448,7 +2451,7 @@ coerce_to_compiled (procedure, arity, location) return (ERR_WRONG_NUMBER_OF_ARGUMENTS); } return (make_trampoline (location, - ((machine_word) + ((format_word) (MAKE_FORMAT_WORD (frame_size, frame_size))), TRAMPOLINE_K_APPLY, 2, @@ -2553,7 +2556,7 @@ compiler_initialize (fasl_p) extern SCHEME_OBJECT *copy_to_constant_space(); code = (make_trampoline (&trampoline, - FORMAT_WORD_RETURN, + ((format_word) FORMAT_WORD_RETURN), TRAMPOLINE_K_RETURN, 0, SHARP_F, SHARP_F, SHARP_F)); if (code != PRIM_DONE) diff --git a/v8/src/microcode/cmpint.c b/v8/src/microcode/cmpint.c index b27332d15..c4c9ee8a6 100644 --- a/v8/src/microcode/cmpint.c +++ b/v8/src/microcode/cmpint.c @@ -30,7 +30,7 @@ Technology nor of any adaptation thereof in any advertising, promotional, or sales literature without prior written consent from MIT in each case. */ -/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/cmpint.c,v 1.17 1989/11/22 16:29:55 jinx Exp $ +/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/cmpint.c,v 1.18 1989/11/27 01:01:55 jinx Exp $ * * This file corresponds to * $COMPILER-Header: compiler.c,v 9.37 89/10/25 14:55:45 GMT jinx Exp $ @@ -104,6 +104,10 @@ MIT in each case. */ #define C_TO_SCHEME #define SCHEME_UTILITY +/* For clarity */ + +typedef char instruction; + /* Structure returned by SCHEME_UTILITYs */ struct utility_result @@ -396,9 +400,10 @@ struct utility_result C_TO_SCHEME long enter_compiled_expression() { - SCHEME_OBJECT *compiled_entry_address; + instruction *compiled_entry_address; - compiled_entry_address = (OBJECT_ADDRESS (Fetch_Expression ())); + compiled_entry_address = + ((instruction *) (OBJECT_ADDRESS (Fetch_Expression ()))); if ((COMPILED_ENTRY_FORMAT_WORD (compiled_entry_address)) != (FORMAT_WORD_EXPR)) { @@ -406,7 +411,7 @@ enter_compiled_expression() Val = (Fetch_Expression ()); return (C_to_interface ((instruction *) (OBJECT_ADDRESS (STACK_POP ())))); } - return (C_to_interface ((instruction *) compiled_entry_address)); + return (C_to_interface (compiled_entry_address)); } C_TO_SCHEME long @@ -421,7 +426,7 @@ apply_compiled_procedure() procedure = (STACK_POP ()); procedure_entry = ((instruction *) (OBJECT_ADDRESS (procedure))); result = setup_compiled_invocation ((OBJECT_DATUM (nactuals)), - ((machine_word *) procedure_entry)); + procedure_entry); if (result == PRIM_DONE) { /* Go into compiled code. */ @@ -455,7 +460,7 @@ return_to_compiled_code () static long setup_compiled_invocation (nactuals, compiled_entry_address) long nactuals; - machine_word *compiled_entry_address; + instruction *compiled_entry_address; { static long setup_lexpr_invocation(); static SCHEME_OBJECT *open_gap(); @@ -541,7 +546,7 @@ open_gap (nactuals, delta) static long setup_lexpr_invocation (nactuals, nmax, entry_address) register long nactuals, nmax; - machine_word *entry_address; + instruction *entry_address; { register long delta; @@ -726,8 +731,7 @@ comutil_apply (procedure, nactuals, ignore_3, ignore_4) entry_point = ((instruction *) (OBJECT_ADDRESS (procedure))); RETURN_UNLESS_EXCEPTION - ((setup_compiled_invocation (nactuals, - ((machine_word *) entry_point))), + ((setup_compiled_invocation (nactuals, entry_point)), entry_point); } @@ -825,7 +829,7 @@ comutil_lexpr_apply (entry_address, nactuals, ignore_3, ignore_4) ((setup_lexpr_invocation ((nactuals + 1), (COMPILED_ENTRY_MAXIMUM_ARITY (entry_address)), - ((machine_word *) entry_address))), + entry_address)), entry_address); } @@ -1355,12 +1359,11 @@ comutil_interrupt_closure (ignore_1, ignore_2, ignore_3, ignore_4) TEST_GC_NEEDED(); if ((PENDING_INTERRUPTS()) == 0) { - SCHEME_OBJECT *entry_point; + instruction *entry_point; EXTRACT_CLOSURE_ENTRY_ADDRESS(entry_point, (OBJECT_ADDRESS (STACK_REF (0)))); - RETURN_TO_SCHEME(((instruction *) entry_point) + - CLOSURE_SKIPPED_CHECK_OFFSET); + RETURN_TO_SCHEME(entry_point + CLOSURE_SKIPPED_CHECK_OFFSET); } else { @@ -2182,9 +2185,9 @@ store_uuo_link (entry, cache_address) #define TRAMPOLINE_SIZE (TRAMPOLINE_ENTRY_SIZE + 2) static long -make_trampoline (slot, format_word, kind, size, value1, value2, value3) +make_trampoline (slot, fmt_word, kind, size, value1, value2, value3) SCHEME_OBJECT *slot; - machine_word format_word; + format_word fmt_word; long kind, size; SCHEME_OBJECT value1, value2, value3; { @@ -2206,7 +2209,7 @@ make_trampoline (slot, format_word, kind, size, value1, value2, value3) local_free += TRAMPOLINE_BLOCK_TO_ENTRY; entry_point = local_free; local_free = (TRAMPOLINE_STORAGE(entry_point)); - (COMPILED_ENTRY_FORMAT_WORD (entry_point)) = format_word; + (COMPILED_ENTRY_FORMAT_WORD (entry_point)) = fmt_word; (COMPILED_ENTRY_OFFSET_WORD (entry_point)) = (MAKE_OFFSET_WORD (entry_point, block, false)); STORE_TRAMPOLINE_ENTRY (entry_point, kind); @@ -2236,7 +2239,7 @@ make_redirection_trampoline (slot, kind, procedure) SCHEME_OBJECT procedure; { return (make_trampoline (slot, - ((machine_word) FORMAT_WORD_CMPINT), + ((format_word) FORMAT_WORD_CMPINT), kind, 1, procedure, @@ -2251,7 +2254,7 @@ make_apply_trampoline (slot, kind, procedure, nactuals) SCHEME_OBJECT procedure; { return (make_trampoline (slot, - ((machine_word) FORMAT_WORD_CMPINT), + ((format_word) FORMAT_WORD_CMPINT), kind, 2, procedure, @@ -2414,7 +2417,7 @@ make_fake_uuo_link (extension, block, offset) SCHEME_OBJECT trampoline, *cache_address; result = (make_trampoline (&trampoline, - ((machine_word) FORMAT_WORD_CMPINT), + ((format_word) FORMAT_WORD_CMPINT), TRAMPOLINE_K_LOOKUP, 3, extension, @@ -2448,7 +2451,7 @@ coerce_to_compiled (procedure, arity, location) return (ERR_WRONG_NUMBER_OF_ARGUMENTS); } return (make_trampoline (location, - ((machine_word) + ((format_word) (MAKE_FORMAT_WORD (frame_size, frame_size))), TRAMPOLINE_K_APPLY, 2, @@ -2553,7 +2556,7 @@ compiler_initialize (fasl_p) extern SCHEME_OBJECT *copy_to_constant_space(); code = (make_trampoline (&trampoline, - FORMAT_WORD_RETURN, + ((format_word) FORMAT_WORD_RETURN), TRAMPOLINE_K_RETURN, 0, SHARP_F, SHARP_F, SHARP_F)); if (code != PRIM_DONE)