Changeset 13645
- Timestamp:
- Apr 19, 2010, 4:36:19 AM (15 years ago)
- Location:
- branches/arm/lisp-kernel
- Files:
-
- 3 added
- 2 edited
-
arm-constants.h (modified) (8 diffs)
-
arm-constants.s (added)
-
arm-macros.s (modified) (13 diffs)
-
linuxarm (added)
-
linuxarm/Makefile (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/arm/lisp-kernel/arm-constants.h
r13630 r13645 24 24 #define temp1 4 25 25 #define temp2 5 26 #define temp3627 #define fn728 #define rcontext829 #define imm 0930 #define imm 11026 #define fn 6 27 #define rcontext 7 28 #define imm0 8 29 #define imm1 9 30 #define imm2 10 31 31 #define allocptr 11 32 32 #define vsp 12 … … 35 35 #define pc 15 36 36 37 #define fname temp 337 #define fname temp1 38 38 #define nfn temp2 39 39 #define next_method_context temp1 40 #define nargs imm 140 #define nargs imm2 41 41 #define allocbase temp0 /* while consing */ 42 42 … … 59 59 #define node_shift 2 60 60 61 #define TCR_FLAG_BIT_FOREIGN fixnumshift62 #define TCR_FLAG_BIT_AWAITING_PRESET (fixnumshift+1)63 #define TCR_FLAG_BIT_ALT_SUSPEND (fixnumshift+2)64 #define TCR_FLAG_BIT_PROPAGATE_EXCEPTION (fixnumshift+3)65 #define TCR_FLAG_BIT_SUSPEND_ACK_PENDING (fixnumshift+4)66 #define TCR_FLAG_BIT_PENDING_EXCEPTION (fixnumshift+5)67 #define TCR_FLAG_BIT_FOREIGN_EXCEPTION (fixnumshift+6)68 #define TCR_FLAG_BIT_PENDING_SUSPEND (fixnumshift+7)69 70 #define TCR_STATE_FOREIGN (1)71 #define TCR_STATE_LISP (0)72 #define TCR_STATE_EXCEPTION_WAIT (2)73 #define TCR_STATE_EXCEPTION_RETURN (4)74 61 75 62 /* Tags. */ … … 107 94 108 95 109 /* Order of CAR and CDR doesn't seem to matter much - there aren't */110 /* too many tricks to be played with predecrement/preincrement addressing. */111 /* Keep them in the confusing MCL 3.0 order, to avoid confusion. */112 113 typedef struct cons {114 LispObj cdr;115 LispObj car;116 } cons;117 96 118 97 … … 227 206 #define max_non_array_node_subtag ((19<<ntagbits)|fulltag_immheader) 228 207 229 /* The objects themselves look something like this: */230 231 typedef struct lispsymbol {232 LispObj header;233 LispObj pname;234 LispObj vcell;235 LispObj fcell;236 LispObj package_predicate;237 LispObj flags;238 LispObj plist;239 LispObj binding_index;240 } lispsymbol;241 242 typedef struct ratio {243 LispObj header;244 LispObj numer;245 LispObj denom;246 } ratio;247 208 248 209 typedef struct double_float { … … 258 219 } single_float; 259 220 260 typedef struct macptr {261 LispObj header;262 LispObj address;263 LispObj class;264 LispObj type;265 } macptr;266 267 typedef struct xmacptr {268 LispObj header;269 LispObj address;270 LispObj class;271 LispObj type;272 LispObj flags;273 LispObj link;274 } xmacptr;275 276 277 typedef struct eabi_c_frame {278 struct eabi_c_frame *backlink;279 unsigned savelr;280 unsigned params[8];281 } eabi_c_frame;282 283 /* PowerOpen ABI C frame */284 285 typedef struct c_frame {286 struct c_frame *backlink;287 unsigned crsave;288 unsigned savelr;289 unsigned unused[2];290 unsigned savetoc; /* Used with CFM */291 unsigned params[8]; /* Space for callee to save r3-r10 */292 } c_frame;293 294 typedef struct lisp_frame {295 struct lisp_frame *backlink;296 LispObj savefn;297 LispObj savelr;298 LispObj savevsp;299 } lisp_frame;300 301 typedef struct special_binding {302 struct special_binding *link;303 struct lispsymbol *sym;304 LispObj value;305 } special_binding;306 307 /* The GC (at least) needs to know what a308 package looks like, so that it can do GCTWA. */309 typedef struct package {310 LispObj header;311 LispObj itab; /* itab and etab look like (vector (fixnum . fixnum) */312 LispObj etab;313 LispObj used;314 LispObj used_by;315 LispObj names;316 LispObj shadowed;317 } package;318 221 319 222 /* … … 352 255 } xframe_list; 353 256 354 #define fixnum_bitmask(n) (1<<((n)+fixnumshift))355 356 /*357 The GC (at least) needs to know about hash-table-vectors and their flag bits.358 */359 360 typedef struct hash_table_vector_header {361 LispObj header;362 LispObj link; /* If weak */363 LispObj flags; /* a fixnum; see below */364 LispObj gc_count; /* gc-count kernel global */365 LispObj free_alist; /* preallocated conses for finalization_alist */366 LispObj finalization_alist; /* key/value alist for finalization */367 LispObj weak_deletions_count; /* incremented when GC deletes weak pair */368 LispObj hash; /* backpointer to hash-table */369 LispObj deleted_count; /* number of deleted entries [not maintained if lock-free] */370 LispObj count; /* number of valid entries [not maintained if lock-free] */371 LispObj cache_idx; /* index of last cached pair */372 LispObj cache_key; /* value of last cached key */373 LispObj cache_value; /* last cached value */374 LispObj size; /* number of entries in table */375 LispObj size_reciprocal; /* shifted reciprocal of size */376 } hash_table_vector_header;377 378 /*379 Bits (masks) in hash_table_vector.flags:380 */381 382 /* GC should track keys when addresses change */383 #define nhash_track_keys_mask fixnum_bitmask(28)384 385 /* GC should set when nhash_track_keys_bit & addresses change */386 #define nhash_key_moved_mask fixnum_bitmask(27)387 388 /* weak on key or value (need new "weak both" encoding.) */389 #define nhash_weak_mask fixnum_bitmask(12)390 391 /* weak on value */392 #define nhash_weak_value_mask fixnum_bitmask(11)393 394 /* finalizable */395 #define nhash_finalizable_mask fixnum_bitmask(10)396 397 /* keys frozen, i.e. don't clobber keys, only values */398 #define nhash_keys_frozen_mask fixnum_bitmask(9)399 400 /* Lfun bits */401 402 #define lfbits_nonnullenv_mask fixnum_bitmask(0)403 #define lfbits_keys_mask fixnum_bitmask(1)404 #define lfbits_restv_mask fixnum_bitmask(7)405 #define lfbits_optinit_mask fixnum_bitmask(14)406 #define lfbits_rest_mask fixnum_bitmask(15)407 #define lfbits_aok_mask fixnum_bitmask(16)408 #define lfbits_lap_mask fixnum_bitmask(23)409 #define lfbits_trampoline_mask fixnum_bitmask(24)410 #define lfbits_evaluated_mask fixnum_bitmask(25)411 #define lfbits_cm_mask fixnum_bitmask(26) /* combined_method */412 #define lfbits_nextmeth_mask fixnum_bitmask(26) /* or call_next_method with method_mask */413 #define lfbits_gfn_mask fixnum_bitmask(27) /* generic_function */414 #define lfbits_nextmeth_with_args_mask fixnum_bitmask(27) /* or call_next_method_with_args with method_mask */415 #define lfbits_method_mask fixnum_bitmask(28) /* method function */416 /* PPC only but want it defined for xcompile */417 #define lfbits_noname_mask fixnum_bitmask(29)418 419 420 /* Creole */421 422 #define doh_quantum 400423 #define doh_block_slots ((doh_quantum >> 2) - 3)424 425 typedef struct doh_block {426 struct doh_block *link;427 unsigned size;428 unsigned free;429 LispObj data[doh_block_slots];430 } doh_block, *doh_block_ptr;431 432 433 #define population_weak_list (0<<fixnum_shift)434 #define population_weak_alist (1<<fixnum_shift)435 #define population_termination_bit (16+fixnum_shift)436 #define population_type_mask ((1<<population_termination_bit)-1)437 438 #define gc_retain_pages_bit fixnum_bitmask(0)439 #define gc_integrity_check_bit fixnum_bitmask(2)440 #define egc_verbose_bit fixnum_bitmask(3)441 #define gc_verbose_bit fixnum_bitmask(4)442 #define gc_allow_stack_overflows_bit fixnum_bitmask(5)443 #define gc_postgc_pending fixnum_bitmask(26)444 445 257 #include "lisp-errors.h" 446 258 … … 448 260 449 261 450 #define nil_value (0x 00003015+(LOWMEM_BIAS))262 #define nil_value (0x10000000+fulltag_nil) 451 263 452 264 #define TCR_BIAS (0) -
branches/arm/lisp-kernel/arm-macros.s
r13632 r13645 58 58 59 59 define(`box_fixnum',` 60 __(mov #1,$2 lsl #fixnumshift)60 __(mov #1,$2, lsl #fixnumshift) 61 61 ') 62 62 63 63 define(`unbox_fixnum',` 64 __(mov $1,$2 asr #fixnumshift)64 __(mov $1,$2, asr #fixnumshift) 65 65 ') 66 66 … … 72 72 ') 73 73 74 define(`push ',`75 __(stru($1,-node_size($2)))74 define(`push1',` 75 __(str $1,[$2,#-node_size]!) 76 76 ') 77 77 78 78 /* Generally not a great idea. */ 79 define(`pop',` 80 __(ldr($1,0($2))) 81 __(la $2,node_size($2)) 82 ') 83 84 define(`vpush',` 85 __(push($1,vsp)) 86 ') 87 88 define(`vpop',` 89 __(pop($1,vsp)) 79 define(`pop1',` 80 __(ldr $1,[$2],#node_size) 81 ') 82 83 define(`vpush1',` 84 __(push1($1,vsp)) 85 ') 86 87 define(`vpop1',` 88 __(pop1($1,vsp)) 90 89 ') 91 90 … … 106 105 107 106 define(`vref32',` 108 __(lwz $1,misc_data_offset+(($3)<<2)($2))107 __(ldr #1,[$2,#misc_data_offset+(($3)<<2)]) 109 108 ') 110 109 … … 113 112 ') 114 113 115 ifdef(`PPC64',` 116 define(`vref64',` 117 __(ld $1,misc_data_offset+(($3)<<3)($2)) 118 ') 119 120 define(`vrefr',` 121 __(vref64($1,$2,$3)) 122 ') 123 ',` 124 define(`vrefr',` 114 define(`vrefr',` 125 115 __(vref32($1,$2,$3)) 126 116 ') 127 ') 117 118 128 119 129 120 … … 132 123 ') 133 124 134 /* Size is unboxed element count */135 define(`header_size',`136 __(srri($1,$2,num_subtag_bits))137 ')138 125 139 126 /* "Length" is fixnum element count */ 140 127 define(`header_length',` 141 ifdef(`PPC64',` 142 __(rldicr $1,$2,nbits_in_word-(num_subtag_bits-nfixnumtagbits),63-nfixnumtagbits) 143 __(clrldi $1,$1,(num_subtag_bits-nfixnumtagbits)) 144 ',` 145 __(rlwinm $1,$2,nbits_in_word-(num_subtag_bits-nfixnumtagbits),(num_subtag_bits-nfixnumtagbits),31-nfixnumtagbits) 128 mov $1,#-1<<fixnumshift 129 and $1,$1,$2,lsr #num_subtag_bits-fixnumshift 146 130 ') 147 131 ') 148 132 149 133 150 define(`vector_size',`151 __(getvheader(ifelse($3.`',$1,$3),$2))152 __(header_size($1,ifelse($3.`',$1,$3)))153 ')154 155 134 define(`vector_length',` 156 135 __(getvheader($3,$2)) … … 193 172 /* vpop argregs - nargs is known to be non-zero */ 194 173 define(`vpop_argregs_nz',` 195 new_macro_labels() 196 __(cmplri(cr1,nargs,node_size*2)) 197 __(vpop(arg_z)) 198 __(blt cr1,macro_label(l0)) 199 __(vpop(arg_y)) 200 __(bne cr1,macro_label(l0)) 201 __(vpop(arg_x)) 202 macro_label(l0):') 174 __(cmp nargs,#node_size*2) 175 __(vpop1(arg_z)) 176 __(ldrhs arg_y,[vsp],#node_size) 177 __(ldrhi arg_x,[vsp],#node_size) 178 ') 203 179 204 180 … … 238 214 239 215 define(`_car',` 240 __(ldr($1,cons.car($2)))216 __(ldr $1,[$2,#cons.car]) 241 217 ') 242 218 243 219 define(`_cdr',` 244 __(ldr($1,cons.cdr($2)))220 __(ldr $1,[$2,#cons.cdr]) 245 221 ') 246 222 247 223 define(`_rplaca',` 248 __(str($2,cons.car($1)))224 __(str $2,[$1,#cons.car]) 249 225 ') 250 226 251 227 define(`_rplacd',` 252 __(str($2,cons.cdr($1))) 253 ') 254 255 define(`vpush_saveregs',` 256 __(vpush(save7)) 257 __(vpush(save6)) 258 __(vpush(save5)) 259 __(vpush(save4)) 260 __(vpush(save3)) 261 __(vpush(save2)) 262 __(vpush(save1)) 263 __(vpush(save0)) 264 ') 265 266 define(`restore_saveregs',` 267 __(ldr(save0,node_size*0($1))) 268 __(ldr(save1,node_size*1($1))) 269 __(ldr(save2,node_size*2($1))) 270 __(ldr(save3,node_size*3($1))) 271 __(ldr(save4,node_size*4($1))) 272 __(ldr(save5,node_size*5($1))) 273 __(ldr(save6,node_size*6($1))) 274 __(ldr(save7,node_size*7($1))) 275 ') 276 277 define(`vpop_saveregs',` 278 __(restore_saveregs(vsp)) 279 __(la vsp,node_size*8(vsp)) 280 ') 228 __(str $2,[$1,#cons.cdr]) 229 ') 230 281 231 282 232 define(`trap_unless_lisptag_equal',` … … 285 235 ') 286 236 287 ifdef(`PPC64',`288 define(`trap_unless_list',`289 new_macro_labels()290 __(cmpdi ifelse($3,$3,cr0),$1,nil_value)291 __(extract_fulltag($2,$1))292 __(beq ifelse($3,$3,cr0),macro_label(is_list))293 __(tdnei $2,fulltag_cons)294 macro_label(is_list):295 296 ')',`297 237 define(`trap_unless_list',` 298 238 __(trap_unless_lisptag_equal($1,tag_list,$2)) 299 ')300 239 ') 301 240 … … 312 251 /* "jump" to the code-vector of the function in nfn. */ 313 252 define(`jump_nfn',` 314 __(ldr(temp0,_function.codevector(nfn))) 315 __(mtctr temp0) 316 __(bctr) 253 __(ldr pc,[nfn,#_function.codevector]) 317 254 ') 318 255 319 256 /* "call the code-vector of the function in nfn. */ 320 257 define(`call_nfn',` 321 __(ldr(temp0,_function.codevector(nfn))) 322 __(mtctr temp0) 323 __(bctrl) 258 __(ldr lr,[nfn,#_function.codevector]) 259 __(blx lr) 324 260 ') 325 261 … … 327 263 /* "jump" to the function in fnames function cell. */ 328 264 define(`jump_fname',` 329 __(ldr (nfn,symbol.fcell(fname)))265 __(ldr nfn,[fname,#symbol.fcell]) 330 266 __(jump_nfn()) 331 267 ') … … 333 269 /* call the function in fnames function cell. */ 334 270 define(`call_fname',` 335 __(ldr (nfn,symbol.fcell(fname)))271 __(ldr nfn,[fname,#symbol.fcell]) 336 272 __(call_nfn()) 337 273 ') 338 274 339 define(`do_funcall',` 340 new_macro_labels() 341 __(extract_fulltag(imm0,temp0)) 342 __(cmpri(imm0,fulltag_misc)) 343 __(mr nfn,temp0) 344 __(bne- macro_label(bad)) 345 __(extract_subtag(imm0,temp0)) 346 __(cmpri(imm0,subtag_function)) 347 __(cmpri(cr1,imm0,subtag_symbol)) 348 __(bne cr0,macro_label(_sym)) 349 __(jump_nfn()) 350 macro_label(_sym): 351 __(mr fname,temp0) 352 __(bne cr1,macro_label(bad)) 353 __(jump_fname()) 354 macro_label(bad): 355 __(uuo_interr(error_cant_call,temp0)) 275 define(`funcall_nfn',` 276 __(extract_typecode(imm0,nfn)) 277 __(cmp imm0,#subtag_symbol) 278 __(moveq fname,nfn) 279 __(ldreq nfn,[fname,#symbol.fcell]) 280 __(cmpne imm0,#subtag_function) 281 __(ldreq pc,[nfn,#_function.entrypoint]) 282 __(uuo_error_cant_call(nfn,al)) 283 356 284 ') 357 285 … … 393 321 ') 394 322 395 define(`restore_catch_nvrs',` 396 __(ldr(first_nvr,catch_frame.regs+(node_size*0)($1))) 397 __(ldr(second_nvr,catch_frame.regs+(node_size*1)($1))) 398 __(ldr(third_nvr,catch_frame.regs+(node_size*2)($1))) 399 __(ldr(fourth_nvr,catch_frame.regs+(node_size*3)($1))) 400 __(ldr(fifth_nvr,catch_frame.regs+(node_size*4)($1))) 401 __(ldr(sixth_nvr,catch_frame.regs+(node_size*5)($1))) 402 __(ldr(seventh_nvr,catch_frame.regs+(node_size*6)($1))) 403 __(ldr(eighth_nvr,catch_frame.regs+(node_size*7)($1))) 404 ') 405 406 define(`DCBZL',` 407 __(.long (31<<26)+(1<<21)+($1<<16)+($2<<11)+(1014<<1)) 408 ') 323 409 324 410 325 define(`check_stack_alignment',` … … 419 334 420 335 define(`clear_alloc_tag',` 421 __(clrrri(allocptr,allocptr,ntagbits)) 422 ') 423 424 /* If the GC interrupts the current thread (after the trap), it needs */ 425 /* to ensure that the cons cell that's been "reserved" stays reserved */ 426 /* (e.g. the tagged allocptr has to be treated as a node.) If that */ 427 /* reserved cons cell gets tenured, the car and cdr are of a generation */ 428 /* that's at least as old (so memoization isn't an issue.) */ 429 430 /* More generally, if the GC interrupts a thread when allocptr is */ 431 /* tagged as a cons: */ 432 433 /* a) if the trap hasn't been taken (yet), the GC should force the */ 434 /* thread to resume in such a way that the trap will be taken ; */ 435 /* the segment allocator should worry about allocating the object. */ 436 437 /* b) If the trap has been taken, allocptr is treated as a node as */ 438 /* described above. Allocbase is made to point to the base of the */ 439 /* cons cell, so that the thread's next allocation attempt will */ 440 /* invoke the segment allocator. */ 441 336 __(bic allocptr,allocptr,#fulltagmask) 337 ') 338 442 339 define(`Cons',` 443 __(la allocptr,(-cons.size+fulltag_cons)(allocptr)) 444 __(alloc_trap()) 445 __(str($3,cons.cdr(allocptr))) 446 __(str($2,cons.car(allocptr))) 447 __(mr $1,allocptr) 340 __(ldr allocbase,[rcontext,#tcr.save_allocbase]) 341 __(add allocptr,allocptr,#-cons.size+fulltag_cons) 342 __(cmp allocptr,allocbase) 343 __(uuo_alloc_trap(lo)) 344 __(str $3,[allocptr,#cons.cdr]) 345 __(str $2,[allocptr,#cons.car]) 346 __(mov $1,allocptr) 448 347 __(clear_alloc_tag()) 449 348 ')
Note:
See TracChangeset
for help on using the changeset viewer.
