1 /* -*-C-*- 2 3 Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 4 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 5 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Massachusetts 6 Institute of Technology 7 8 This file is part of MIT/GNU Scheme. 9 10 MIT/GNU Scheme is free software; you can redistribute it and/or modify 11 it under the terms of the GNU General Public License as published by 12 the Free Software Foundation; either version 2 of the License, or (at 13 your option) any later version. 14 15 MIT/GNU Scheme is distributed in the hope that it will be useful, but 16 WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 General Public License for more details. 19 20 You should have received a copy of the GNU General Public License 21 along with MIT/GNU Scheme; if not, write to the Free Software 22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 23 USA. 24 25 */ 26 27 /* Compiled code interface macros for SVM v1. */ 28 29 #ifndef SCM_CMPINTMD_H_INCLUDED 30 #define SCM_CMPINTMD_H_INCLUDED 1 31 32 #define ASM_RESET_HOOK initialize_svm1 33 34 #define COMPILER_REGBLOCK_N_TEMPS 256 35 #define COMPILER_REGBLOCK_N_FIXED 14 36 #define COMPILER_TEMP_SIZE 2 37 /* COMPILER_TEMP_SIZE is NOT ((sizeof (double)) / (sizeof (SCHEME_OBJECT))). 38 It must not vary e.g. from 1 on x86-64 to 2 on i386. */ 39 40 typedef byte_t insn_t; 41 42 /* Number of insn_t units preceding entry address in which header 43 (type and offset info) is stored. */ 44 #define CC_ENTRY_HEADER_SIZE (CC_ENTRY_TYPE_SIZE + CC_ENTRY_OFFSET_SIZE) 45 #define CC_ENTRY_TYPE_SIZE 2 46 #define CC_ENTRY_OFFSET_SIZE 2 47 48 /* Number of insn_t units preceding entry header in which GC trap 49 instructions are stored. */ 50 #define CC_ENTRY_GC_TRAP_SIZE 0 51 52 /* Size of closure count in insn_t units. */ 53 #define CLOSURE_COUNT_SIZE 2 54 55 /* Offset of first (canonical) closure entry point in insn_t units. */ 56 #define CLOSURE_ENTRY_OFFSET SIZEOF_SCHEME_OBJECT 57 58 /* Offset to start of first closure entry -- the entry type (format) word. */ 59 #define CLOSURE_ENTRY_START (CLOSURE_ENTRY_OFFSET - CC_ENTRY_TYPE_SIZE) 60 61 /* Size of closure entry in insn_t units. */ 62 #define CLOSURE_ENTRY_SIZE 5 63 64 /* Size of execution cache in SCHEME_OBJECTS. */ 65 #define UUO_LINK_SIZE 2 66 #define READ_UUO_TARGET(a, r) read_uuo_target (a) 67 68 #define UTILITY_RESULT_DEFINED 1 69 70 typedef struct 71 { 72 bool scheme_p; 73 union { long interpreter_code; insn_t * new_pc; } arg; 74 } utility_result_t; 75 76 #define RETURN_TO_C(code) do \ 77 { \ 78 (DSU_result->scheme_p) = false; \ 79 ((DSU_result->arg) . interpreter_code) = (code); \ 80 return; \ 81 } while (false) 82 83 #define RETURN_TO_SCHEME(ep) do \ 84 { \ 85 (DSU_result->scheme_p) = true; \ 86 ((DSU_result->arg) . new_pc) = (ep); \ 87 return; \ 88 } while (false) 89 90 #define ENTER_SCHEME(ep) return (C_to_interface (ep)) 91 92 extern long C_to_interface (void *); 93 extern void initialize_svm1 (void); 94 extern insn_t * read_uuo_target (SCHEME_OBJECT *); 95 extern unsigned int read_u16 (insn_t *); 96 97 #endif /* !SCM_CMPINTMD_H_INCLUDED */ 98