Changeset 5176
- Timestamp:
- Sep 8, 2006, 5:51:18 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ccl/lisp-kernel/x86-gc.c (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/lisp-kernel/x86-gc.c
r4951 r5176 424 424 425 425 426 #ifdef X86 426 427 427 #ifdef X8664 428 428 #define RMARK_PREV_ROOT fulltag_imm_1 /* fulltag of 'undefined' value */ 429 429 #define RMARK_PREV_CAR fulltag_nil /* fulltag_nil + node_size. Coincidence ? I think not. */ 430 430 #else 431 #endif432 431 #endif 433 432 … … 2753 2752 switch(subtag) { 2754 2753 case subtag_simple_base_string: 2755 physbytes = node_size + element_count;2754 physbytes = node_size + (element_count << 2); 2756 2755 break; 2757 2756 … … 2801 2800 #define COPY_STRINGS (1<<1) 2802 2801 2802 2803 /* 2804 This may overestimate a bit, if the same symbol is accessible from multiple 2805 packages. 2806 */ 2807 natural 2808 interned_pname_bytes_in_range(LispObj *start, LispObj *end) 2809 { 2810 lispsymbol *rawsym = (lispsymbol *)(&(nrs_ALL_PACKAGES)); 2811 LispObj pkg_list = rawsym->vcell, htab, obj, pname, pname_header; 2812 package *p; 2813 cons *c; 2814 natural elements, i, nbytes = 0; 2815 2816 while (fulltag_of(pkg_list) == fulltag_cons) { 2817 c = (cons *) ptr_from_lispobj(untag(pkg_list)); 2818 p = (package *) ptr_from_lispobj(untag(c->car)); 2819 pkg_list = c->cdr; 2820 c = (cons *) ptr_from_lispobj(untag(p->itab)); 2821 htab = c->car; 2822 elements = header_element_count(header_of(htab)); 2823 for (i = 1; i<= elements; i++) { 2824 obj = deref(htab,i); 2825 if (fulltag_of(obj) == fulltag_symbol) { 2826 rawsym = (lispsymbol *) ptr_from_lispobj(untag(obj)); 2827 pname = rawsym->pname; 2828 2829 if ((pname >= (LispObj)start) && (pname < (LispObj)end)) { 2830 pname_header = header_of(pname); 2831 nbytes += ((8 + (header_element_count(pname_header)<<2) + 15) &~15); 2832 } 2833 } 2834 } 2835 c = (cons *) ptr_from_lispobj(untag(p->etab)); 2836 htab = c->car; 2837 elements = header_element_count(header_of(htab)); 2838 for (i = 1; i<= elements; i++) { 2839 obj = deref(htab,i); 2840 if (fulltag_of(obj) == fulltag_symbol) { 2841 rawsym = (lispsymbol *) ptr_from_lispobj(untag(obj)); 2842 pname = rawsym->pname; 2843 2844 if ((pname >= (LispObj)start) && (pname < (LispObj)end)) { 2845 pname_header = header_of(pname); 2846 nbytes += ((8 + (header_element_count(pname_header)<<2) + 15) &~15); 2847 } 2848 } 2849 } 2850 } 2851 return nbytes; 2852 } 2853 2803 2854 void 2804 2855 copy_ivector_reference(LispObj *ref, BytePtr low, BytePtr high, area *dest, int what_to_copy) 2805 2856 { 2806 #ifndef X862807 2857 LispObj obj = *ref, header; 2808 2858 natural tag = fulltag_of(obj), header_tag, header_subtag; … … 2818 2868 if (immheader_tag_p(header_tag)) { 2819 2869 header_subtag = header_subtag(header); 2820 if (((header_subtag == subtag_code_vector) && (what_to_copy & COPY_CODE)) || 2821 ((what_to_copy & COPY_STRINGS) && 2822 ((header_subtag == subtag_simple_base_string)))) { 2870 if ((what_to_copy & COPY_STRINGS) && 2871 ((header_subtag == subtag_simple_base_string))) { 2823 2872 *ref = purify_object(obj, dest); 2824 2873 } … … 2826 2875 } 2827 2876 } 2828 #endif 2829 } 2830 2831 void 2832 purify_locref(LispObj *locaddr, BytePtr low, BytePtr high, area *to, int what) 2833 { 2834 #ifdef PPC 2835 LispObj 2836 loc = *locaddr, 2837 *headerP; 2838 opcode 2839 *p, 2840 insn; 2841 natural 2842 tag = fulltag_of(loc); 2843 2844 if (((BytePtr)ptr_from_lispobj(loc) > low) && 2845 2846 ((BytePtr)ptr_from_lispobj(loc) < high)) { 2847 2848 headerP = (LispObj *)ptr_from_lispobj(untag(loc)); 2849 switch (tag) { 2850 case fulltag_even_fixnum: 2851 case fulltag_odd_fixnum: 2852 #ifdef PPC64 2853 case fulltag_cons: 2854 case fulltag_misc: 2855 #endif 2856 if (*headerP == forward_marker) { 2857 *locaddr = (headerP[1]+tag); 2858 } else { 2859 /* Grovel backwards until the header's found; copy 2860 the code vector to to space, then treat it as if it 2861 hasn't already been copied. */ 2862 p = (opcode *)headerP; 2863 do { 2864 p -= 2; 2865 tag += 8; 2866 insn = *p; 2867 #ifdef PPC64 2868 } while (insn != PPC64_CODE_VECTOR_PREFIX); 2869 headerP = ((LispObj*)p)-1; 2870 *locaddr = purify_displaced_object(((LispObj)headerP), to, tag); 2871 #else 2872 } while ((insn & code_header_mask) != subtag_code_vector); 2873 *locaddr = purify_displaced_object(ptr_to_lispobj(p), to, tag); 2874 #endif 2875 } 2876 break; 2877 2878 #ifndef PPC64 2879 case fulltag_misc: 2880 copy_ivector_reference(locaddr, low, high, to, what); 2881 break; 2882 #endif 2883 } 2884 } 2885 #endif 2886 #ifdef X86 2887 #ifdef X8664 2888 #warning Figure out what purify_locref needs to do, if anything, on X8664 2889 #else 2890 #endif 2891 #endif 2892 } 2877 } 2878 2893 2879 2894 2880 void … … 2955 2941 } 2956 2942 2957 #ifdef PPC2958 void2959 purify_cstack_area(area *a, BytePtr low, BytePtr high, area *to, int what)2960 {2961 BytePtr2962 current,2963 next,2964 limit = a->high;2965 2966 for (current = a->active; current != limit; current = next) {2967 next = *((BytePtr *)current);2968 if (next == NULL) break;2969 if (((next - current) == sizeof(lisp_frame)) &&2970 (((((lisp_frame *)current)->savefn) == 0) ||2971 (fulltag_of(((lisp_frame *)current)->savefn) == fulltag_misc))) {2972 purify_locref(&((lisp_frame *) current)->savelr, low, high, to, what);2973 } else {2974 /* Clear low bits of "next", just in case */2975 next = (BytePtr) (((natural)next) & ~(sizeof(natural)-1));2976 }2977 }2978 }2979 #endif2980 2943 2981 2944 void … … 2985 2948 2986 2949 2987 #ifdef X862988 2950 #ifdef X8664 2989 2951 copy_ivector_reference(&(regs[Iarg_z]), low, high, to, what); … … 2999 2961 copy_ivector_reference(&(regs[Itemp1]), low, high, to, what); 3000 2962 copy_ivector_reference(&(regs[Itemp2]), low, high, to, what); 2963 #if 0 3001 2964 purify_locref(&(regs[Iip]), low, high, to, what); 2965 #endif 3002 2966 #else 3003 #endif3004 2967 #endif 3005 2968 } … … 3075 3038 purify(TCR *tcr, signed_natural param) 3076 3039 { 3077 #if 13078 return 0;3079 #else3080 3040 extern area *extend_readonly_area(unsigned); 3081 3041 area … … 3089 3049 3090 3050 3091 max_pure_size = unboxed_bytes_in_range((LispObj *)(a->low + (static_dnodes_for_area(a) << dnode_shift)),3051 max_pure_size = interned_pname_bytes_in_range((LispObj *)(a->low + (static_dnodes_for_area(a) << dnode_shift)), 3092 3052 (LispObj *) a->active); 3093 3053 new_pure_area = extend_readonly_area(max_pure_size); … … 3125 3085 for (i = 1; i<= elements; i++) { 3126 3086 obj = deref(htab,i); 3127 if (fulltag_of(obj) == fulltag_ misc) {3087 if (fulltag_of(obj) == fulltag_symbol) { 3128 3088 rawsym = (lispsymbol *) ptr_from_lispobj(untag(obj)); 3129 3089 copy_ivector_reference(&(rawsym->pname), a->low, a->active, new_pure_area, COPY_STRINGS); … … 3135 3095 for (i = 1; i<= elements; i++) { 3136 3096 obj = deref(htab,i); 3137 if (fulltag_of(obj) == fulltag_ misc) {3097 if (fulltag_of(obj) == fulltag_symbol) { 3138 3098 rawsym = (lispsymbol *) ptr_from_lispobj(untag(obj)); 3139 3099 copy_ivector_reference(&(rawsym->pname), a->low, a->active, new_pure_area, COPY_STRINGS); … … 3143 3103 } 3144 3104 3145 purify_areas(a->low, a->active, new_pure_area, COPY_CODE);3105 purify_areas(a->low, a->active, new_pure_area, FORWARD_ONLY); 3146 3106 3147 3107 other_tcr = tcr; 3148 3108 do { 3149 purify_tcr_xframes(other_tcr, a->low, a->active, new_pure_area, COPY_CODE);3150 purify_tcr_tlb(other_tcr, a->low, a->active, new_pure_area, COPY_CODE);3109 purify_tcr_xframes(other_tcr, a->low, a->active, new_pure_area, FORWARD_ONLY); 3110 purify_tcr_tlb(other_tcr, a->low, a->active, new_pure_area, FORWARD_ONLY); 3151 3111 other_tcr = other_tcr->next; 3152 3112 } while (other_tcr != tcr); … … 3168 3128 } 3169 3129 return -1; 3170 #endif 3171 } 3172 3173 void 3174 impurify_locref(LispObj *p, LispObj low, LispObj high, int delta) 3175 { 3176 LispObj q = *p; 3177 3178 switch (fulltag_of(q)) { 3179 #ifdef PPC64 3180 case fulltag_cons: 3181 #endif 3182 case fulltag_misc: 3183 case fulltag_even_fixnum: 3184 case fulltag_odd_fixnum: 3185 if ((q >= low) && (q < high)) { 3186 *p = (q+delta); 3187 } 3188 } 3189 } 3130 } 3131 3190 3132 3191 3133 … … 3203 3145 3204 3146 3205 #ifdef PPC3206 void3207 impurify_cstack_area(area *a, LispObj low, LispObj high, int delta)3208 {3209 BytePtr3210 current,3211 next,3212 limit = a->high;3213 3214 for (current = a->active; current != limit; current = next) {3215 next = *((BytePtr *)current);3216 if (next == NULL) break;3217 if (((next - current) == sizeof(lisp_frame)) &&3218 (((((lisp_frame *)current)->savefn) == 0) ||3219 (fulltag_of(((lisp_frame *)current)->savefn) == fulltag_misc))) {3220 impurify_locref(&((lisp_frame *) current)->savelr, low, high, delta);3221 } else {3222 /* Clear low bits of "next", just in case */3223 next = (BytePtr) (((natural)next) & ~(sizeof(natural)-1));3224 }3225 }3226 }3227 #endif3228 3147 3229 3148 void … … 3232 3151 natural *regs = (natural *) xpGPRvector(xp); 3233 3152 3234 #ifdef PPC 3235 int r; 3236 /* registers >= fn should be treated as roots. 3237 The PC, LR, loc_pc, and CTR should be treated as "locatives". 3238 */ 3239 3240 for (r = fn; r < 32; r++) { 3241 impurify_noderef((LispObj*) (&(regs[r])), low, high, delta); 3242 }; 3243 3244 impurify_locref((LispObj*) (&(regs[loc_pc])), low, high, delta); 3245 3246 impurify_locref((LispObj*) (&(xpPC(xp))), low, high, delta); 3247 impurify_locref((LispObj*) (&(xpLR(xp))), low, high, delta); 3248 impurify_locref((LispObj*) (&(xpCTR(xp))), low, high, delta); 3249 #endif 3250 3251 #ifdef X86 3153 3252 3154 #ifdef X8664 3253 3155 impurify_noderef(&(regs[Iarg_z]), low, high, delta); … … 3262 3164 impurify_noderef(&(regs[Itemp0]), low, high, delta); 3263 3165 impurify_noderef(&(regs[Itemp1]), low, high, delta); 3166 #if 0 3264 3167 impurify_locref(&(regs[Iip]), low, high, delta); 3168 #endif 3265 3169 #else 3266 3170 #endif 3267 #endif 3171 3268 3172 } 3269 3173
Note:
See TracChangeset
for help on using the changeset viewer.
