Changeset 13786
- Timestamp:
- Jun 5, 2010, 4:21:06 PM (14 years ago)
- File:
-
- 1 edited
-
branches/arm/lisp-kernel/arm-spentry.s (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/arm/lisp-kernel/arm-spentry.s
r13755 r13786 249 249 __(test_two_fixnums(arg_y,arg_z,imm0)) 250 250 __(bne 1f) 251 __(uuo_suspend_now(al))252 251 __(cmp arg_y,#(nbits_in_word-fixnumshift)<<fixnumshift) 253 252 __(bhs 1f) … … 1911 1910 1912 1911 1913 /* Destructuring-bind, macro-bind. */ 1914 1915 /* OK to use arg_x, arg_y for whatever (tagged) purpose; */ 1916 /* likewise immX regs. */ 1917 /* arg_z preserved, nothing else in particular defined on exit. */ 1918 /* nargs contains req count (0-255) in PPC bits mask_req_start/mask_req_width, */ 1919 /* opt count (0-255) in PPC bits mask_opt_start/mask_opt_width, */ 1920 /* key count (0-255) in PPC bits mask_key_start/mask_key_width, */ 1921 /* opt-supplied-p flag in PPC bit mask_initopt, */ 1922 /* keyp flag in PPC bit mask_keyp, */ 1923 /* &allow-other-keys flag in PPC bit mask_aok, */ 1924 /* &rest flag in PPC bit mask_restp. */ 1925 /* When mask_keyp bit is set, keyvect contains vector of keyword symbols, */ 1926 /* length key count. */ 1927 1928 _spentry(macro_bind) 1929 __(mov whole_reg,arg_reg) 1930 __(extract_lisptag(imm0,arg_reg)) 1931 __(cmp imm0,#tag_list) 1932 __(bne 1f) 1933 __(_cdr(arg_reg,arg_reg)) 1934 __(b C(destbind1)) 1935 1: 1936 __(mov arg_y,#XCALLNOMATCH) 1937 __(mov arg_z,whole_reg) 1938 __(set_nargs(2)) 1939 __(b _SPksignalerr) 1940 1941 _spentry(destructuring_bind) 1942 __(mov whole_reg,arg_reg) 1943 __(b C(destbind1)) 1944 1945 _spentry(destructuring_bind_inner) 1946 __(mov whole_reg,arg_z) 1947 __(b C(destbind1)) 1912 1913 _spentry(unused0) 1914 1915 _spentry(unused1) 1916 1917 _spentry(unused2) 1948 1918 1949 1919 dnl /* vpush the values in the value set atop the vsp, incrementing nargs. */ … … 2971 2941 2972 2942 2973 2974 2943 _spentry(eabi_ff_call) 2944 2945 _spentry(debind) 2946 new_local_labels() 2947 __(mov temp0,vsp) 2948 __(mov temp1,arg_z) 2949 __(ands imm0,nargs,#0xff) 2950 __(mov arg_y,#nil_value) 2951 __(b local_label(req_test)) 2952 local_label(req_loop): 2953 __(cmp arg_reg,#nil_value) 2954 __(extract_lisptag(imm1,arg_reg)) 2955 __(beq local_label(toofew)) 2956 __(cmp imm1,#tag_list) 2957 __(bne local_label(badlist)) 2958 __(subs imm0,imm0,#1) 2959 __(_car(arg_x,arg_reg)) 2960 __(_cdr(arg_reg,arg_reg)) 2961 __(vpush1(arg_x)) 2962 local_label(req_test): 2963 __(bne local_label(req_loop)) 2964 __(mov imm0,#0xff) 2965 __(ands imm0,imm0,nargs,lsr #8) 2966 __(beq local_label(rest_keys)) 2967 __(tst nargs,#mask_initopt) 2968 __(bne local_label(opt_supp)) 2969 /* 'simple' &optionals: no supplied-p, default to nil. */ 2970 local_label(simple_opt_loop): 2971 __(cmp arg_reg,#nil_value) 2972 __(extract_lisptag(imm1,arg_reg)) 2973 __(beq local_label(default_simple_opt)) 2974 __(cmp imm1,#tag_list) 2975 __(bne local_label(badlist)) 2976 __(subs imm0,imm0,#1) 2977 __(_car(arg_x,arg_reg)) 2978 __(_cdr(arg_reg,arg_reg)) 2979 __(vpush1(arg_x)) 2980 __(bne local_label(simple_opt_loop)) 2981 __(b local_label(rest_keys)) 2982 local_label(default_simple_opt): 2983 __(subs imm0,imm0,#1) 2984 __(vpush1(arg_y)) 2985 __(bne local_label(default_simple_opt)) 2986 __(b local_label(rest_keys)) 2987 local_label(opt_supp): 2988 __(cmp arg_reg,#nil_value) 2989 __(extract_lisptag(imm1,arg_reg)) 2990 __(beq local_label(default_hard_opt)) 2991 __(cmp imm1,#tag_list) 2992 __(bne local_label(badlist)) 2993 __(subs imm0,imm0,#1) 2994 __(_car(arg_x,arg_reg)) 2995 __(_cdr(arg_reg,arg_reg)) 2996 __(vpush1(arg_x)) 2997 __(add arg_x,arg_y,#t_offset) 2998 __(vpush1(arg_x)) 2999 __(bne local_label(opt_supp)) 3000 __(b local_label(rest_keys)) 3001 local_label(default_hard_opt): 3002 __(subs imm0,imm0,#1) 3003 __(vpush1(arg_y)) 3004 __(vpush1(arg_y)) 3005 __(bne local_label(default_hard_opt)) 3006 local_label(rest_keys): 3007 __(tst nargs,#mask_restp) 3008 __(bne local_label(have_rest)) 3009 __(tst nargs,#mask_keyp) 3010 __(bne local_label(have_keys)) 3011 __(cmp arg_reg,#nil_value) 3012 __(bne local_label(toomany)) 3013 __(bx lr) 3014 local_label(have_rest): 3015 __(vpush1(arg_reg)) 3016 __(tst nargs,#mask_keyp) 3017 __(bne local_label(have_keys)) 3018 __(bx lr) 3019 local_label(have_keys): 3020 __(mov imm0,#256) 3021 __(mov arg_y,arg_reg) 3022 local_label(count_keys_loop): 3023 __(cmp arg_y,#nil_value) 3024 __(beq local_label(counted_keys)) 3025 __(subs imm0,imm0,#1) 3026 __(bmi local_label(toomany)) 3027 __(extract_lisptag(imm1,arg_y)) 3028 __(cmp imm1,#tag_list) 3029 __(bne local_label(badlist)) 3030 __(_cdr(arg_y,arg_y)) 3031 __(extract_lisptag(imm1,arg_y)) 3032 __(cmp imm1,#tag_list) 3033 __(bne local_label(badlist)) 3034 __(_cdr(arg_y,arg_y)) 3035 __(b local_label(count_keys_loop)) 3036 local_label(counted_keys): 3037 /* We've got a proper, even-length list of key/value pairs in */ 3038 /* arg_reg. For each keyword var in the lambda-list, push a pair */ 3039 /* of NILs on the vstack. (We've also cdred down arg_y until it */ 3040 /* contains NIL.) */ 3041 __(mov imm0,#0xff) 3042 __(ands imm0,imm0,nargs,lsr #16) 3043 __(mov imm1,vsp) 3044 __(b local_label(push_pair_test)) 3045 local_label(push_pair_loop): 3046 __(subs imm0,imm0,#1) 3047 __(vpush1(arg_y)) 3048 __(vpush1(arg_y)) 3049 local_label(push_pair_test): 3050 __(bne local_label(push_pair_loop)) 3051 __(b local_label(provided_key_loop)) 3052 3053 local_label(next_provided_key): 3054 __(_car(arg_x,arg_reg)) 3055 __(ref_nrs_symbol(imm0,kallowotherkeys,imm0)) 3056 __(cmp arg_x,imm0) 3057 __(bne local_label(not_aok)) 3058 __(tst nargs,#mask_aok_seen) 3059 __(beq local_label(not_aok)) 3060 __(_cdr(arg_x,arg_reg)) 3061 __(_car(arg_x,arg_x)) 3062 __(orr nargs,nargs,#mask_aok_seen) 3063 __(cmp arg_x,#nil_value) 3064 __(orrne nargs,nargs,#mask_aok) 3065 __(_car(arg_x,arg_reg)) 3066 local_label(not_aok): 3067 __(getvheader(imm0,keyvect_reg)) 3068 __(header_length(imm0,imm0)) 3069 __(add imm0,imm0,#misc_data_offset) 3070 __(b local_label(match_key_test)) 3071 local_label(match_key_loop): 3072 __(ldr arg_y,[keyvect_reg,imm0]) 3073 __(cmp arg_x,arg_y) 3074 __(bne local_label(match_key_test)) 3075 __(sub imm0,imm0,#misc_data_offset) 3076 __(sub imm0,imm1,imm0,lsl #1) 3077 __(ldr arg_y,[imm0,#-node_size]) 3078 __(cmp arg_y,#nil_value) 3079 __(beq local_label(provided_key_done)) 3080 __(_cdr(arg_x,arg_reg)) 3081 __(_car(arg_x,arg_x)) 3082 __(str arg_x,[imm0,#0]) 3083 __(mov arg_x,#nil_value) 3084 __(add arg_x,arg_x,#t_offset) 3085 __(str arg_x,[imm0,#-node_size]) 3086 __(b local_label(provided_key_done)) 3087 local_label(match_key_test): 3088 __(sub imm0,imm0,#node_size) 3089 __(cmp imm0,#misc_data_offset) 3090 __(bge local_label(match_key_loop)) 3091 __(orr nargs,nargs,#mask_unknown_keyword_seen) 3092 local_label(provided_key_done): 3093 __(_cdr(arg_reg,arg_reg)) 3094 __(_cdr(arg_reg,arg_reg)) 3095 local_label(provided_key_loop): 3096 __(cmp arg_reg,#nil_value) 3097 __(bne local_label(next_provided_key)) 3098 __(tst nargs,#mask_unknown_keyword_seen) 3099 __(bxeq lr) 3100 __(tst nargs,#mask_aok) 3101 __(bxne lr) 3102 local_label(badkeys): 3103 __(mov arg_y,#XBADKEYS) 3104 __(b local_label(destructure_error)) 3105 local_label(toomany): 3106 __(mov arg_y,#XCALLTOOMANY) 3107 __(b local_label(destructure_error)) 3108 local_label(toofew): 3109 __(mov arg_y,#XCALLTOOFEW) 3110 __(b local_label(destructure_error)) 3111 local_label(badlist): 3112 __(mov arg_y,#XCALLNOMATCH) 3113 local_label(destructure_error): 3114 __(mov vsp,temp0) 3115 __(mov arg_z,temp1) 3116 __(set_nargs(2)) 3117 __(b _SPksignalerr) 3118 2975 3119 2976 3120 /* EOF, basically */ … … 3780 3924 __(b _SPksignalerr) 3781 3925 3782 C(destbind1): 3783 dnl /* Extract required arg count. */ 3784 dnl /* A bug in gas: can't handle shift count of "32" (= 0 */ 3785 dnl ifelse(eval(mask_req_width+mask_req_start),eval(32),` 3786 dnl __(clrlwi. imm0,nargs,mask_req_start) 3787 dnl ',` 3788 dnl __(extrwi. imm0,nargs,mask_req_width,mask_req_start) 3789 dnl ') 3790 dnl __(extrwi imm1,nargs,mask_opt_width,mask_opt_start) 3791 dnl __(rlwinm imm2,nargs,0,mask_initopt,mask_initopt) 3792 dnl __(rlwinm imm4,nargs,0,mask_keyp,mask_keyp) 3793 dnl __(cmpri(cr4,imm4,0)) 3794 dnl __(rlwinm imm4,nargs,0,mask_restp,mask_restp) 3795 dnl __(cmpri(cr5,imm4,0)) 3796 dnl __(cmpri(cr1,imm1,0)) 3797 dnl __(cmpri(cr2,imm2,0)) 3798 dnl /* Save entry vsp in case of error. */ 3799 dnl __(mov imm4,vsp) 3800 dnl __(beq 2f) 3801 dnl 1: 3802 dnl __(cmpri(cr7,arg_reg,nil_value)) 3803 dnl __(extract_lisptag(imm3,arg_reg)) 3804 dnl __(cmpri(cr3,imm3,tag_list)) 3805 dnl __(subi imm0,imm0,1) 3806 dnl __(cmpri(imm0,0)) 3807 dnl __(beq cr7,toofew) 3808 dnl __(bne cr3,badlist) 3809 dnl __(ldr arg_x,[arg_reg,#cons.car]) 3810 dnl __(ldr arg_reg,[arg_reg,#cons.cdr]) 3811 dnl __(vpush1(arg_x)) 3812 dnl __(bne 1b) 3813 dnl 2: 3814 dnl __(beq cr1,rest_keys) 3815 dnl __(bne cr2,opt_supp) 3816 dnl /* 'simple' &optionals: no supplied-p, default to nil. */ 3817 dnl simple_opt_loop: 3818 dnl __(cmpri(arg_reg,nil_value)) 3819 dnl __(extract_lisptag(imm3,arg_reg)) 3820 dnl __(cmpri(cr3,imm3,tag_list)) 3821 dnl __(subi imm1,imm1,1) 3822 dnl __(cmpri(cr1,imm1,0)) 3823 dnl __(mov imm5,#nil_value) 3824 dnl __(beq default_simple_opt) 3825 dnl __(bne cr3,badlist) 3826 dnl __(ldr arg_x,[arg_reg,#cons.car]) 3827 dnl __(ldr arg_reg,[arg_reg,#cons.cdr]) 3828 dnl __(vpush1(arg_x)) 3829 dnl __(bne cr1,simple_opt_loop) 3830 dnl __(b rest_keys) 3831 dnl default_simple_opt_loop: 3832 dnl __(subi imm1,imm1,1) 3833 dnl __(cmpri(cr1,imm1,0)) 3834 dnl default_simple_opt: 3835 dnl __(vpush1(imm5)) 3836 dnl __(bne cr1,default_simple_opt_loop) 3837 dnl __(b rest_keys) 3838 dnl /* Provide supplied-p vars for the &optionals. */ 3839 dnl opt_supp: 3840 dnl __(mov arg_y,#t_value) 3841 dnl opt_supp_loop: 3842 dnl __(cmpri(arg_reg,nil_value)) 3843 dnl __(extract_lisptag(imm3,arg_reg)) 3844 dnl __(cmpri(cr3,imm3,tag_list)) 3845 dnl __(subi imm1,imm1,1) 3846 dnl __(cmpri(cr1,imm1,0)) 3847 dnl __(beq default_hard_opt) 3848 dnl __(bne cr3,badlist) 3849 dnl __(ldr arg_x,[arg_reg,#cons.car]) 3850 dnl __(ldr arg_reg,[arg_reg,#cons.cdr]) 3851 dnl __(vpush1(arg_x)) 3852 dnl __(vpush1(arg_y)) 3853 dnl __(bne cr1,opt_supp_loop) 3854 dnl __(b rest_keys) 3855 dnl default_hard_opt_loop: 3856 dnl __(subi imm1,imm1,1) 3857 dnl __(cmpri(cr1,imm1,0)) 3858 dnl default_hard_opt: 3859 dnl __(vpush1(imm5)) 3860 dnl __(vpush1(imm5)) 3861 dnl __(bne cr1,default_hard_opt_loop) 3862 dnl rest_keys: 3863 dnl __(cmpri(arg_reg,nil_value)) 3864 dnl __(bne cr5,have_rest) 3865 dnl __(bne cr4,have_keys) 3866 dnl __(bne toomany) 3867 dnl __(bx lr) 3868 dnl have_rest: 3869 dnl __(vpush1(arg_reg)) 3870 dnl __(beqlr cr4) 3871 dnl have_keys: 3872 dnl /* Ensure that arg_reg contains a proper,even-length list. */ 3873 dnl /* Insist that its length is <= 512 (as a cheap circularity check.) */ 3874 dnl __(mov imm0,#256) 3875 dnl __(mov arg_x,arg_reg) 3876 dnl count_keys_loop: 3877 dnl __(extract_lisptag(imm3,arg_x)) 3878 dnl __(cmpri(cr3,imm3,tag_list)) 3879 dnl __(cmpri(arg_x,nil_value)) 3880 dnl __(subi imm0,imm0,1) 3881 dnl __(cmpri(cr4,imm0,0)) 3882 dnl __(beq counted_keys) 3883 dnl __(bne cr3,badlist) 3884 dnl __(ldr arg_x,[arg_x,#cons.cdr]) 3885 dnl __(extract_lisptag(imm3,arg_x)) 3886 dnl __(cmpri(cr3,imm3,tag_list)) 3887 dnl __(blt cr4,toomany) 3888 dnl __(cmpri(arg_x,nil_value)) 3889 dnl __(beq db_badkeys) 3890 dnl __(bne cr3,badlist) 3891 dnl __(ldr arg_x,[arg_x,#cons.cdr]) 3892 dnl __(b count_keys_loop) 3893 dnl counted_keys: 3894 dnl /* We've got a proper, even-length list of key/value pairs in */ 3895 dnl /* arg_reg. For each keyword var in the lambda-list, push a pair */ 3896 dnl /* of NILs on the vstack. */ 3897 dnl __(extrwi. imm0,nargs,mask_key_width,mask_key_start ) 3898 dnl __(mov imm2,imm0) /* save number of keys */ 3899 dnl __(mov imm5,#nil_value) 3900 dnl __(b push_pair_test) 3901 dnl push_pair_loop: 3902 dnl __(cmpri(imm0,1)) 3903 dnl __(subi imm0,imm0,1) 3904 dnl __(vpush1(imm5)) 3905 dnl __(vpush1(imm5)) 3906 dnl push_pair_test: 3907 dnl __(bne push_pair_loop) 3908 dnl __(slwi imm2,imm2,dnode_shift) /* pairs -> bytes */ 3909 dnl __(add imm2,vsp,imm2) /* imm2 points below pairs */ 3910 dnl __(mov imm0,#0) /* count unknown keywords so far */ 3911 dnl __(extrwi imm1,nargs,1,mask_aok) /* unknown keywords allowed */ 3912 dnl __(extrwi nargs,nargs,mask_key_width,mask_key_start) 3913 dnl /* Now, for each keyword/value pair in the list */ 3914 dnl /* a) if the keyword is found in the keyword vector, set the */ 3915 dnl /* corresponding entry on the vstack to the value and the */ 3916 dnl /* associated supplied-p var to T. */ 3917 dnl /* b) Regardless of whether or not the keyword is found, */ 3918 dnl /* if :ALLOW-OTHER-KEYS is provided with a non-nil value, */ 3919 dnl /* set the low bit of imm1 to indicate that unknown keywords */ 3920 dnl /* are acceptable. (This bit is pre-set above to the value */ 3921 dnl /* the encoded value of &allow_other_keys.) */ 3922 dnl /* c) If the keyword is not found (and isn't :ALLOW-OTHER-KEYS), increment */ 3923 dnl /* the count of unknown keywords in the high bits of imm1*/ 3924 dnl /* At the end of the list, signal an error if any unknown keywords were seen */ 3925 dnl /* but not allowed. Otherwise, return. */ 3926 dnl 3927 dnl match_keys_loop: 3928 dnl __(cmpri(arg_reg,nil_value)) 3929 dnl __(mov imm0,#0) 3930 dnl __(mov imm3,#misc_data_offset) 3931 dnl __(beq matched_keys) 3932 dnl __(ldr arg_x,[arg_reg,#cons.car]) 3933 dnl __(mov arg_y,#nrs.kallowotherkeys) 3934 dnl __(cmpr(cr3,arg_x,arg_y)) /* :ALLOW-OTHER-KEYS ? */ 3935 dnl __(ldr arg_reg,[arg_reg,#cons.cdr]) 3936 dnl __(ldr arg_y,[arg_reg,#cons.car]) 3937 dnl __(cmpr(cr4,imm0,nargs)) 3938 dnl __(ldr arg_reg,[arg_reg,#cons.cdr]) 3939 dnl __(b match_test) 3940 dnl match_loop: 3941 dnl __(ldrx(temp0,keyvect_reg,imm3)) 3942 dnl __(cmpr(arg_x,temp0)) 3943 dnl __(addi imm0,imm0,1) 3944 dnl __(cmpr(cr4,imm0,nargs)) 3945 dnl __(addi imm3,imm3,node_size) 3946 dnl __(bne match_test) 3947 dnl /* Got a hit. Unless this keyword's been seen already, set it. */ 3948 dnl __(slwi imm0,imm0,dnode_shift) 3949 dnl __(subf imm0,imm0,imm2) 3950 dnl __(ldr temp0,[imm0,#0]) 3951 dnl __(cmpri(temp0,nil_value)) 3952 dnl __(mov temp0,#t_value) 3953 dnl __(bne match_keys_loop) /* already saw this */ 3954 dnl __(str(arg_y,node_size*1(imm0))) 3955 dnl __(str(temp0,node_size*0(imm0))) 3956 dnl __(bne cr3,match_keys_loop) 3957 dnl __(b match_keys_check_aok) 3958 dnl match_test: 3959 dnl __(bne cr4,match_loop) 3960 dnl __(beq cr3,match_keys_check_aok) 3961 dnl __(addi imm1,imm1,node_size) 3962 dnl __(b match_keys_loop) 3963 dnl match_keys_check_aok: 3964 dnl __(andi. imm0,imm1,2) /* check "seen-aok" bit in imm1 */ 3965 dnl __(cmpri cr1,arg_y,nil_value) /* check value */ 3966 dnl __(ori imm1,imm1,2) 3967 dnl __(bne match_keys_loop) /* duplicate aok */ 3968 dnl __(beq cr1,match_keys_loop) 3969 dnl __(ori imm1,imm1,1) 3970 dnl __(b match_keys_loop) 3971 dnl matched_keys: 3972 dnl __(clrrwi. imm0,imm1,2) 3973 dnl __(beqlr) 3974 dnl __(andi. imm1,imm1,1) 3975 dnl __(bnelr) 3976 dnl /* Some unrecognized keywords. Complain generically about */ 3977 dnl /* invalid keywords. */ 3978 dnl db_badkeys: 3979 dnl __(mov arg_y,#XBADKEYS) 3980 dnl __(b destructure_error) 3981 dnl toomany: 3982 dnl __(mov arg_y,#XCALLTOOMANY) 3983 dnl __(b destructure_error) 3984 dnl toofew: 3985 dnl __(mov arg_y,#XCALLTOOFEW) 3986 dnl __(b destructure_error) 3987 dnl badlist: 3988 dnl __(mov arg_y,#XCALLNOMATCH) 3989 dnl /* b destructure_error */ 3990 dnl destructure_error: 3991 dnl __(mov vsp,imm4) /* undo everything done to the stack */ 3992 dnl __(mov arg_z,whole_reg) 3993 dnl __(set_nargs(2)) 3994 dnl __(b _SPksignalerr) 3995 3926 3996 3927 /* imm2: (tstack-consed) target catch frame, imm0: count of intervening */ 3997 3928 /* frames. If target isn't a multiple-value receiver, discard extra values */
Note:
See TracChangeset
for help on using the changeset viewer.
