Changeset 13270 for branches/purify
 Timestamp:
 Dec 9, 2009, 12:38:07 AM (10 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/purify/source/lispkernel/x86gc.c
r13260 r13270 2456 2456 2457 2457 void 2458 purify_xp(ExceptionInformation *xp, BytePtr low, BytePtr high, area *to, int what) 2458 purify_xp(ExceptionInformation *xp, BytePtr low, BytePtr high, area *to, int what 2459 #ifdef X8632 2460 ,natural node_regs_mask 2461 #endif 2462 ) 2459 2463 { 2460 2464 natural *regs = (natural *) xpGPRvector(xp); … … 2477 2481 2478 2482 #else 2483 if (node_regs_mask & (1<<0)) { 2484 copy_reference(&(regs[REG_EAX]), low, high, to, what); 2485 } 2486 if (node_regs_mask & (1<<1)) { 2487 copy_reference(&(regs[REG_ECX]), low, high, to, what); 2488 } 2489 if (! (regs[REG_EFL] & EFL_DF)) { 2490 if (node_regs_mask & (1<<2)) { 2491 copy_reference(&(regs[REG_EDX]), low, high, to, what); 2492 } 2493 } 2494 if (node_regs_mask & (1<<3)) { 2495 copy_reference(&(regs[REG_EBX]), low, high, to, what); 2496 } 2497 if (node_regs_mask & (1<<4)) { 2498 copy_reference(&(regs[REG_ESP]), low, high, to, what); 2499 } 2500 if (node_regs_mask & (1<<5)) { 2501 copy_reference(&(regs[REG_EBP]), low, high, to, what); 2502 } 2503 if (node_regs_mask & (1<<6)) { 2504 copy_reference(&(regs[REG_ESI]), low, high, to, what); 2505 } 2506 if (node_regs_mask & (1<<7)) { 2507 copy_reference(&(regs[REG_EDI]), low, high, to, what); 2508 } 2509 purify_locref(®s[REG_EIP], low, high, to, what); 2479 2510 #endif 2480 2511 } … … 2497 2528 xp = tcr>gc_context; 2498 2529 if (xp) { 2530 #ifdef X8632 2531 purify_xp(xp, low, high, to, what, tcr>node_regs_mask); 2532 #else 2499 2533 purify_xp(xp, low, high, to, what); 2500 } 2534 #endif 2535 } 2536 #ifdef X8632 2537 copy_reference(&tcr>save0, low, high, to, what); 2538 copy_reference(&tcr>save1, low, high, to, what); 2539 copy_reference(&tcr>save2, low, high, to, what); 2540 copy_reference(&tcr>save3, low, high, to, what); 2541 copy_reference(&tcr>next_method_context, low, high, to, what); 2542 #endif 2501 2543 2502 2544 for (xframes = tcr>xframe; xframes; xframes = xframes>prev) { 2503 purify_xp(xframes>curr, low, high, to, what); 2545 purify_xp(xframes>curr, low, high, to, what 2546 #ifdef X8632 2547 , xframes>node_regs_mask 2548 #endif 2549 ); 2504 2550 } 2505 2551 } … … 2706 2752 } 2707 2753 2708 2754 Boolean 2755 impurify_locref(LispObj *p, LispObj low, LispObj high, signed_natural delta) 2756 { 2757 LispObj q = *p; 2758 2759 if ((q >= low) && 2760 (q < high)) { 2761 *p = (q+delta); 2762 return true; 2763 } 2764 return false; 2765 } 2709 2766 2710 2767 Boolean 2711 impurify_noderef(LispObj *p, LispObj low, LispObj high, intdelta)2768 impurify_noderef(LispObj *p, LispObj low, LispObj high, signed_natural delta) 2712 2769 { 2713 2770 LispObj q = *p; … … 2737 2794 2738 2795 void 2739 impurify_xp(ExceptionInformation *xp, LispObj low, LispObj high, signed_natural delta) 2796 impurify_xp(ExceptionInformation *xp, LispObj low, LispObj high, signed_natural delta 2797 #ifdef X8632 2798 ,natural node_regs_mask 2799 #endif 2800 ) 2740 2801 { 2741 2802 natural *regs = (natural *) xpGPRvector(xp); … … 2746 2807 impurify_noderef(&(regs[Iarg_y]), low, high, delta); 2747 2808 impurify_noderef(&(regs[Iarg_x]), low, high, delta); 2748 #ifndef WINDOWS2809 #ifndef TCR_IN_GPR 2749 2810 impurify_noderef(&(regs[Isave3]), low, high, delta); 2750 2811 #endif … … 2755 2816 impurify_noderef(&(regs[Itemp0]), low, high, delta); 2756 2817 impurify_noderef(&(regs[Itemp1]), low, high, delta); 2757 #if 0 2818 2758 2819 impurify_locref(&(regs[Iip]), low, high, delta); 2759 #endif2760 2820 #else 2821 if (node_regs_mask & (1<<0)) { 2822 impurify_noderef(&(regs[REG_EAX]), low, high, delta); 2823 } 2824 if (node_regs_mask & (1<<1)) { 2825 impurify_noderef(&(regs[REG_ECX]), low, high, delta); 2826 } 2827 if (! (regs[REG_EFL] & EFL_DF)) { 2828 if (node_regs_mask & (1<<2)) { 2829 impurify_noderef(&(regs[REG_EDX]), low, high, delta); 2830 } 2831 } 2832 if (node_regs_mask & (1<<3)) { 2833 impurify_noderef(&(regs[REG_EBX]), low, high, delta); 2834 } 2835 if (node_regs_mask & (1<<4)) { 2836 impurify_noderef(&(regs[REG_ESP]), low, high, delta); 2837 } 2838 if (node_regs_mask & (1<<5)) { 2839 impurify_noderef(&(regs[REG_EBP]), low, high, delta); 2840 } 2841 if (node_regs_mask & (1<<6)) { 2842 impurify_noderef(&(regs[REG_ESI]), low, high, delta); 2843 } 2844 if (node_regs_mask & (1<<7)) { 2845 impurify_noderef(&(regs[REG_EDI]), low, high, delta); 2846 } 2847 impurify_locref(&(regs[REG_EIP]), low, high, delta); 2848 2761 2849 #endif 2762 2850 … … 2866 2954 xp = tcr>gc_context; 2867 2955 if (xp) { 2956 #ifdef X8632 2957 impurify_xp(xp, low, high, delta, tcr>node_regs_mask); 2958 #else 2868 2959 impurify_xp(xp, low, high, delta); 2869 } 2960 #endif 2961 } 2962 2963 #ifdef X8632 2964 impurify_noderef(&tcr>save0, low, high, delta); 2965 impurify_noderef(&tcr>save1, low, high, delta); 2966 impurify_noderef(&tcr>save2, low, high, delta); 2967 impurify_noderef(&tcr>save3, low, high, delta); 2968 impurify_noderef(&tcr>next_method_context, low, high, delta); 2969 #endif 2870 2970 2871 2971 for (xframes = tcr>xframe; xframes; xframes = xframes>prev) { 2872 impurify_xp(xframes>curr, low, high, delta); 2972 impurify_xp(xframes>curr, low, high, delta 2973 #ifdef X8632 2974 ,xframes>node_regs_mask 2975 #endif 2976 ); 2873 2977 } 2874 2978 } … … 2889 2993 next = (LispObj *) ptr_from_lispobj(*current); 2890 2994 end = ((next >= start) && (next < limit)) ? next : limit; 2891 if (current[1] == 0) { 2892 impurify_range(current+2, end, low, high, delta); 2893 } 2995 impurify_range(current+2, end, low, high, delta); 2894 2996 } 2895 2997 } … … 2926 3028 case AREA_STATIC: 2927 3029 case AREA_DYNAMIC: 3030 case AREA_MANAGED_STATIC: 2928 3031 impurify_range((LispObj *) next_area>low, (LispObj *) next_area>active, low, high, delta); 2929 3032 break; … … 2935 3038 } 2936 3039 3040 void 3041 impurify_from_area(TCR *tcr, area *src) 3042 { 3043 area *a = active_dynamic_area; 3044 BytePtr base = src>low, limit = src>active, oldfree = a>active, 3045 oldhigh = a>high, newhigh; 3046 natural n = limitbase; 3047 signed_natural delta = oldfreebase; 3048 TCR *other_tcr; 3049 3050 newhigh = (BytePtr) (align_to_power_of_2(oldfree+n, 3051 log2_heap_segment_size)); 3052 if (newhigh > oldhigh) { 3053 grow_dynamic_area(newhigholdhigh); 3054 } 3055 a>active += n; 3056 memmove(oldfree, base, n); 3057 UnCommitMemory((void *)base, n); 3058 a>ndnodes = area_dnode(a, a>active); 3059 src>active = src>low; 3060 if (src == readonly_area) { 3061 pure_space_active = src>low; 3062 } 3063 src>ndnodes = 0; 3064 3065 impurify_areas(ptr_to_lispobj(base), ptr_to_lispobj(limit), delta); 3066 3067 other_tcr = tcr; 3068 do { 3069 impurify_tcr_xframes(other_tcr, ptr_to_lispobj(base), ptr_to_lispobj(limit), delta); 3070 impurify_tcr_tlb(other_tcr, ptr_to_lispobj(base), ptr_to_lispobj(limit), delta); 3071 other_tcr = other_tcr>next; 3072 } while (other_tcr != tcr); 3073 3074 impurify_gcable_ptrs(ptr_to_lispobj(base), ptr_to_lispobj(limit), delta); 3075 } 3076 2937 3077 signed_natural 2938 3078 impurify(TCR *tcr, signed_natural param) 2939 3079 { 2940 area *r = find_readonly_area(); 2941 2942 if (r) { 2943 area *a = active_dynamic_area; 2944 BytePtr ro_base = r>low, ro_limit = r>active, oldfree = a>active, 2945 oldhigh = a>high, newhigh; 2946 unsigned n = ro_limit  ro_base; 2947 signed_natural delta = oldfreero_base; 2948 TCR *other_tcr; 2949 2950 if (n) { 2951 lisp_global(IN_GC) = 1; 2952 newhigh = (BytePtr) (align_to_power_of_2(oldfree+n, 2953 log2_heap_segment_size)); 2954 if (newhigh > oldhigh) { 2955 grow_dynamic_area(newhigholdhigh); 2956 } 2957 a>active += n; 2958 memmove(oldfree, ro_base, n); 2959 UnMapMemory((void *)ro_base, n); 2960 a>ndnodes = area_dnode(a, a>active); 2961 pure_space_active = r>active = r>low; 2962 r>ndnodes = 0; 2963 2964 impurify_areas(ptr_to_lispobj(ro_base), ptr_to_lispobj(ro_limit), delta); 2965 2966 other_tcr = tcr; 2967 do { 2968 impurify_tcr_xframes(other_tcr, ptr_to_lispobj(ro_base), ptr_to_lispobj(ro_limit), delta); 2969 impurify_tcr_tlb(other_tcr, ptr_to_lispobj(ro_base), ptr_to_lispobj(ro_limit), delta); 2970 other_tcr = other_tcr>next; 2971 } while (other_tcr != tcr); 2972 2973 impurify_gcable_ptrs(ptr_to_lispobj(ro_base), ptr_to_lispobj(ro_limit), delta); 2974 lisp_global(IN_GC) = 0; 2975 } 2976 return 0; 2977 } 2978 return 1; 3080 lisp_global(IN_GC)=1; 3081 impurify_from_area(tcr, readonly_area); 3082 impurify_from_area(tcr, managed_static_area); 3083 lisp_global(IN_GC)=0; 3084 return 0; 2979 3085 } 2980 3086
Note: See TracChangeset
for help on using the changeset viewer.