diff --git a/vm/src/sparc/lookup/search_sparc.S b/vm/src/sparc/lookup/search_sparc.S index 4cfe64c4..33cac294 100644 --- a/vm/src/sparc/lookup/search_sparc.S +++ b/vm/src/sparc/lookup/search_sparc.S @@ -3,27 +3,51 @@ /* Copyright 1992-2012 AUTHORS. See the LICENSE file for license information. */ - .globl Vectorfind_max_targets -Vectorfind_max_targets: .word 15 +/* sic. this used to be in enum_sparc.S, so pretend it still is. */ +# include "_enum_sparc.S.incl" - .globl Vectorfind_max_chunk_size -Vectorfind_max_chunk_size: .word 8192 +ASMOBJ(Vectorfind_max_targets) + .word 15 + ASMEND(Vectorfind_max_targets) +ASMOBJ(Vectorfind_max_chunk_size) + .word 8192 + ASMEND(Vectorfind_max_chunk_size) - .globl vectorfind_next_match -vectorfind_next_match: - cmp %o2,0 - bg,a 1f; cmp %o2,15 - retl; mov -1,%o0 -1: ble,a 1f; sll %o2, 2, %o2 - retl; mov -1,%o0 -1: set vectorfind_next_match_table, %o4 + + +/* + int32* vectorfind_next_match(int32* start, + int32* targets, int32 num_targets, + int32* hit_num) + { + for ( ; ; ++start) { + for (int32 index = 0; index < num_targets; ++index) { + if (*start == targets[index]) { *hit_num = index; return start; } + } + } + } + */ + +ASMFUNC(vectorfind_next_match) + cmp %o2, 0 + bg,a 0f + cmp %o2, 15 ! Vectorfind_max_targets + retl + mov -1, %o0 +0: ble,a 1f + sll %o2, 2, %o2 + retl + mov -1, %o0 + +1: set .Lvectorfind_next_match_table, %o4 add %o2, %o4, %o2 - ld [%o2-4],%o2 - jmp %o2; ;nop + ld [%o2 - 4], %o2 + jmp %o2 + nop -vectorfind_next_match_table: +.Lvectorfind_next_match_table: .word vectorfind_next_match_1 .word vectorfind_next_match_2 .word vectorfind_next_match_3 @@ -40,1368 +64,1383 @@ vectorfind_next_match_table: .word vectorfind_next_match_14 .word vectorfind_next_match_15 -vectorfind_next_match_1: + ASMEND(vectorfind_next_match) + + + +#define RET_START_0_IS_TARGET_(_N) \ + /* found targets[_N] at start[0] */ \ + mov _N, %l0 ; /* *hit_num = _N; */ \ + st %l0, [%i3] ; \ + ret ; \ + restore + +#define RET_START_1_IS_TARGET_(_N) \ + /* found targets[_N] at haystack1 */ \ + inc 4, %i0 ; /* advance start to haystack1 */ \ + mov _N, %l0 ; /* *hit_num = _N; */ \ + st %l0, [%i3] ; \ + ret ; \ + restore + + +LFUNC(vectorfind_next_match_1) save %sp, -112, %sp - ld [%i1 + 0], %l2 - btst 4, %i0 - bne,a 1f; ld [%i0], %l1 + ld [%i1 + 0], %l2 ! targets[0] + + btst 4, %i0 ! start is 8-aligned? + bnz,a 1f ! if not + ld [%i0], %l1 ! fetch haystack1 from start[0] + + !! start is 8-aligned, we can fetch doublewords + !! %l0: haystack0 = start[0] + !! %l1: haystack1 = start[1] ldd [%i0], %l0 - ba,a 3f; nop -1: sub %i0, 4, %i0 - cmp %l1, %l2 -2: bne,a 1f; ldd [%i0+8], %l0 - add %i0, 4, %i0 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: add %i0, 8, %i0 -3: cmp %l0, %l2 -1: bne,a 2b; cmp %l1, %l2 - mov 0, %l0 - st %l0, [%i3] - ret; restore - -vectorfind_next_match_2: + ba,a 3f ! enter loop (haystack0 checks) + nop ! don't need to advance start + + !! start is not 8-aligned, readjust +1: dec 4, %i0 + cmp %l1, %l2 ! checks haystack1 vs targets[0] + !! fallthrough to the ... + + !! tail part of the loop that checks haystack1 +2: bne,a 1f ! if haystack1 != targets[0] + ldd [%i0 + 8], %l0 ! fetch and check the next haystack pair + RET_START_1_IS_TARGET_(0) + + ! ldd is hoisted into the dealay slot above +1: inc 8, %i0 ! start += 2 + + !! the real start of the loop from start by doublewords + !! %l0: haystack0 = start[0] + !! %l1: haystack1 = start[1] +3: cmp %l0, %l2 ! check haystack0 vs targets[0] +1: bne,a 2b ! if haystack0 != targets[0] check haystack1 + cmp %l1, %l2 ! check haystack1 vs targets[0] + RET_START_0_IS_TARGET_(0) + + ASMEND(vectorfind_next_match_1) + + +LFUNC(vectorfind_next_match_2) save %sp, -112, %sp - ld [%i1 + 0], %l2 - ld [%i1 + 4], %l3 + ld [%i1 + 0], %l2 ! targets[0] + ld [%i1 + 4], %l3 ! targets[1] + btst 4, %i0 - bne,a 1f; ld [%i0], %l1 + bnz,a 1f + ld [%i0], %l1 + ldd [%i0], %l0 - ba,a 3f; nop -1: sub %i0, 4, %i0 - cmp %l1, %l2 -2: bne,a 1f; cmp %l1, %l3 - add %i0, 4, %i0 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; ldd [%i0+8], %l0 - add %i0, 4, %i0 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: add %i0, 8, %i0 -3: cmp %l0, %l2 - bne,a 1f; cmp %l0, %l3 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 2b; cmp %l1, %l2 - mov 1, %l0 - st %l0, [%i3] - ret; restore - -vectorfind_next_match_3: + ba,a 3f + nop + +1: dec 4, %i0 + cmp %l1, %l2 ! source[1] == targets[0] +2: bne,a 1f + cmp %l1, %l3 ! source[1] == targets[1] + RET_START_1_IS_TARGET_(0) + +1: bne,a 1f + ldd [%i0 + 8], %l0 + RET_START_1_IS_TARGET_(1) + +1: inc 8, %i0 +3: cmp %l0, %l2 ! source[0] == targets[0] + bne,a 1f + cmp %l0, %l3 ! source[0] == targets[1] + RET_START_0_IS_TARGET_(0) + +1: bne,a 2b + cmp %l1, %l2 ! source[1] == targets[0] + RET_START_0_IS_TARGET_(1) + + ASMEND(vectorfind_next_match_2) + + +LFUNC(vectorfind_next_match_3) save %sp, -112, %sp - ld [%i1 + 0], %l2 - ld [%i1 + 4], %l3 - ld [%i1 + 8], %l4 + ld [%i1 + 0], %l2 ! targets[0] + ld [%i1 + 4], %l3 ! targets[1] + ld [%i1 + 8], %l4 ! targets[2] + btst 4, %i0 - bne,a 1f; ld [%i0], %l1 + bnz,a 1f + ld [%i0], %l1 + ldd [%i0], %l0 - ba,a 3f; nop -1: sub %i0, 4, %i0 - cmp %l1, %l2 -2: bne,a 1f; cmp %l1, %l3 - add %i0, 4, %i0 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l4 - add %i0, 4, %i0 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; ldd [%i0+8], %l0 - add %i0, 4, %i0 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: add %i0, 8, %i0 -3: cmp %l0, %l2 - bne,a 1f; cmp %l0, %l3 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l4 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 2b; cmp %l1, %l2 - mov 2, %l0 - st %l0, [%i3] - ret; restore - -vectorfind_next_match_4: + ba,a 3f + nop + +1: dec 4, %i0 + cmp %l1, %l2 ! source[1] == targets[0] +2: bne,a 1f + cmp %l1, %l3 ! source[1] == targets[1] + RET_START_1_IS_TARGET_(0) + +1: bne,a 1f + cmp %l1, %l4 ! source[1] == targets[2] + RET_START_1_IS_TARGET_(1) + +1: bne,a 1f + ldd [%i0 + 8], %l0 + RET_START_1_IS_TARGET_(2) + +1: inc 8, %i0 +3: cmp %l0, %l2 ! source[0] == targets[0] + bne,a 1f + cmp %l0, %l3 ! source[0] == targets[1] + RET_START_0_IS_TARGET_(0) + +1: bne,a 1f + cmp %l0, %l4 ! source[0] == targets[2] + RET_START_0_IS_TARGET_(1) + +1: bne,a 2b + cmp %l1, %l2 ! source[1] == targets[0] + RET_START_0_IS_TARGET_(2) + + ASMEND(vectorfind_next_match_3) + + +LFUNC(vectorfind_next_match_4) save %sp, -112, %sp - ld [%i1 + 0], %l2 - ld [%i1 + 4], %l3 - ld [%i1 + 8], %l4 - ld [%i1 + 12], %l5 + ld [%i1 + 0], %l2 ! targets[0] + ld [%i1 + 4], %l3 ! targets[1] + ld [%i1 + 8], %l4 ! targets[2] + ld [%i1 + 12], %l5 ! targets[3] + btst 4, %i0 - bne,a 1f; ld [%i0], %l1 + bnz,a 1f + ld [%i0], %l1 + ldd [%i0], %l0 - ba,a 3f; nop -1: sub %i0, 4, %i0 - cmp %l1, %l2 -2: bne,a 1f; cmp %l1, %l3 - add %i0, 4, %i0 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l4 - add %i0, 4, %i0 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l5 - add %i0, 4, %i0 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; ldd [%i0+8], %l0 - add %i0, 4, %i0 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: add %i0, 8, %i0 -3: cmp %l0, %l2 - bne,a 1f; cmp %l0, %l3 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l4 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l5 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 2b; cmp %l1, %l2 - mov 3, %l0 - st %l0, [%i3] - ret; restore - -vectorfind_next_match_5: + ba,a 3f + nop + +1: dec 4, %i0 + cmp %l1, %l2 ! source[1] == targets[0] +2: bne,a 1f + cmp %l1, %l3 ! source[1] == targets[1] + RET_START_1_IS_TARGET_(0) + +1: bne,a 1f + cmp %l1, %l4 ! source[1] == targets[2] + RET_START_1_IS_TARGET_(1) + +1: bne,a 1f + cmp %l1, %l5 ! source[1] == targets[3] + RET_START_1_IS_TARGET_(2) + +1: bne,a 1f + ldd [%i0 + 8], %l0 + RET_START_1_IS_TARGET_(3) + +1: inc 8, %i0 +3: cmp %l0, %l2 ! source[0] == targets[0] + bne,a 1f + cmp %l0, %l3 ! source[0] == targets[1] + RET_START_0_IS_TARGET_(0) + +1: bne,a 1f + cmp %l0, %l4 ! source[0] == targets[2] + RET_START_0_IS_TARGET_(1) + +1: bne,a 1f + cmp %l0, %l5 ! source[0] == targets[3] + RET_START_0_IS_TARGET_(2) + +1: bne,a 2b + cmp %l1, %l2 ! source[1] == targets[0] + RET_START_0_IS_TARGET_(3) + + ASMEND(vectorfind_next_match_4) + + +LFUNC(vectorfind_next_match_5) save %sp, -112, %sp - ld [%i1 + 0], %l2 - ld [%i1 + 4], %l3 - ld [%i1 + 8], %l4 - ld [%i1 + 12], %l5 - ld [%i1 + 16], %l6 + ld [%i1 + 0], %l2 ! targets[0] + ld [%i1 + 4], %l3 ! targets[1] + ld [%i1 + 8], %l4 ! targets[2] + ld [%i1 + 12], %l5 ! targets[3] + ld [%i1 + 16], %l6 ! targets[4] + btst 4, %i0 - bne,a 1f; ld [%i0], %l1 + bnz,a 1f + ld [%i0], %l1 + ldd [%i0], %l0 - ba,a 3f; nop -1: sub %i0, 4, %i0 - cmp %l1, %l2 -2: bne,a 1f; cmp %l1, %l3 - add %i0, 4, %i0 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l4 - add %i0, 4, %i0 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l5 - add %i0, 4, %i0 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l6 - add %i0, 4, %i0 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; ldd [%i0+8], %l0 - add %i0, 4, %i0 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: add %i0, 8, %i0 -3: cmp %l0, %l2 - bne,a 1f; cmp %l0, %l3 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l4 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l5 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l6 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 2b; cmp %l1, %l2 - mov 4, %l0 - st %l0, [%i3] - ret; restore - -vectorfind_next_match_6: + ba,a 3f + nop + +1: dec 4, %i0 + cmp %l1, %l2 ! source[1] == targets[0] +2: bne,a 1f + cmp %l1, %l3 ! source[1] == targets[1] + RET_START_1_IS_TARGET_(0) + +1: bne,a 1f + cmp %l1, %l4 ! source[1] == targets[2] + RET_START_1_IS_TARGET_(1) + +1: bne,a 1f + cmp %l1, %l5 ! source[1] == targets[3] + RET_START_1_IS_TARGET_(2) + +1: bne,a 1f + cmp %l1, %l6 ! source[1] == targets[4] + RET_START_1_IS_TARGET_(3) + +1: bne,a 1f + ldd [%i0 + 8], %l0 + RET_START_1_IS_TARGET_(4) + +1: inc 8, %i0 +3: cmp %l0, %l2 ! source[0] == targets[0] + bne,a 1f + cmp %l0, %l3 ! source[0] == targets[1] + RET_START_0_IS_TARGET_(0) + +1: bne,a 1f + cmp %l0, %l4 ! source[0] == targets[2] + RET_START_0_IS_TARGET_(1) + +1: bne,a 1f + cmp %l0, %l5 ! source[0] == targets[3] + RET_START_0_IS_TARGET_(2) + +1: bne,a 1f + cmp %l0, %l6 ! source[0] == targets[4] + RET_START_0_IS_TARGET_(3) + +1: bne,a 2b + cmp %l1, %l2 ! source[1] == targets[0] + RET_START_0_IS_TARGET_(4) + + ASMEND(vectorfind_next_match_5) + + +LFUNC(vectorfind_next_match_6) save %sp, -112, %sp - ld [%i1 + 0], %l2 - ld [%i1 + 4], %l3 - ld [%i1 + 8], %l4 - ld [%i1 + 12], %l5 - ld [%i1 + 16], %l6 - ld [%i1 + 20], %l7 + ld [%i1 + 0], %l2 ! targets[0] + ld [%i1 + 4], %l3 ! targets[1] + ld [%i1 + 8], %l4 ! targets[2] + ld [%i1 + 12], %l5 ! targets[3] + ld [%i1 + 16], %l6 ! targets[4] + ld [%i1 + 20], %l7 ! targets[5] + btst 4, %i0 - bne,a 1f; ld [%i0], %l1 + bnz,a 1f + ld [%i0], %l1 + ldd [%i0], %l0 - ba,a 3f; nop -1: sub %i0, 4, %i0 - cmp %l1, %l2 -2: bne,a 1f; cmp %l1, %l3 - add %i0, 4, %i0 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l4 - add %i0, 4, %i0 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l5 - add %i0, 4, %i0 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l6 - add %i0, 4, %i0 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l7 - add %i0, 4, %i0 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; ldd [%i0+8], %l0 - add %i0, 4, %i0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: add %i0, 8, %i0 -3: cmp %l0, %l2 - bne,a 1f; cmp %l0, %l3 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l4 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l5 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l6 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l7 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 2b; cmp %l1, %l2 - mov 5, %l0 - st %l0, [%i3] - ret; restore - -vectorfind_next_match_7: + ba,a 3f + nop + +1: dec 4, %i0 + cmp %l1, %l2 ! source[1] == targets[0] +2: bne,a 1f + cmp %l1, %l3 ! source[1] == targets[1] + RET_START_1_IS_TARGET_(0) + +1: bne,a 1f + cmp %l1, %l4 ! source[1] == targets[2] + RET_START_1_IS_TARGET_(1) + +1: bne,a 1f + cmp %l1, %l5 ! source[1] == targets[3] + RET_START_1_IS_TARGET_(2) + +1: bne,a 1f + cmp %l1, %l6 ! source[1] == targets[4] + RET_START_1_IS_TARGET_(3) + +1: bne,a 1f + cmp %l1, %l7 ! source[1] == targets[5] + RET_START_1_IS_TARGET_(4) + +1: bne,a 1f + ldd [%i0 + 8], %l0 + RET_START_1_IS_TARGET_(5) + +1: inc 8, %i0 +3: cmp %l0, %l2 ! source[0] == targets[0] + bne,a 1f + cmp %l0, %l3 ! source[0] == targets[1] + RET_START_0_IS_TARGET_(0) + +1: bne,a 1f + cmp %l0, %l4 ! source[0] == targets[2] + RET_START_0_IS_TARGET_(1) + +1: bne,a 1f + cmp %l0, %l5 ! source[0] == targets[3] + RET_START_0_IS_TARGET_(2) + +1: bne,a 1f + cmp %l0, %l6 ! source[0] == targets[4] + RET_START_0_IS_TARGET_(3) + +1: bne,a 1f + cmp %l0, %l7 ! source[0] == targets[5] + RET_START_0_IS_TARGET_(4) + +1: bne,a 2b + cmp %l1, %l2 ! source[1] == targets[0] + RET_START_0_IS_TARGET_(5) + + ASMEND(vectorfind_next_match_6) + + +LFUNC(vectorfind_next_match_7) save %sp, -112, %sp - ld [%i1 + 0], %l2 - ld [%i1 + 4], %l3 - ld [%i1 + 8], %l4 - ld [%i1 + 12], %l5 - ld [%i1 + 16], %l6 - ld [%i1 + 20], %l7 - ld [%i1 + 24], %o0 + ld [%i1 + 0], %l2 ! targets[0] + ld [%i1 + 4], %l3 ! targets[1] + ld [%i1 + 8], %l4 ! targets[2] + ld [%i1 + 12], %l5 ! targets[3] + ld [%i1 + 16], %l6 ! targets[4] + ld [%i1 + 20], %l7 ! targets[5] + ld [%i1 + 24], %o0 ! targets[6] + btst 4, %i0 - bne,a 1f; ld [%i0], %l1 + bnz,a 1f + ld [%i0], %l1 + ldd [%i0], %l0 - ba,a 3f; nop -1: sub %i0, 4, %i0 - cmp %l1, %l2 -2: bne,a 1f; cmp %l1, %l3 - add %i0, 4, %i0 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l4 - add %i0, 4, %i0 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l5 - add %i0, 4, %i0 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l6 - add %i0, 4, %i0 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l7 - add %i0, 4, %i0 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o0 - add %i0, 4, %i0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; ldd [%i0+8], %l0 - add %i0, 4, %i0 - mov 6, %l0 - st %l0, [%i3] - ret; restore -1: add %i0, 8, %i0 -3: cmp %l0, %l2 - bne,a 1f; cmp %l0, %l3 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l4 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l5 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l6 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l7 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 2b; cmp %l1, %l2 - mov 6, %l0 - st %l0, [%i3] - ret; restore - -vectorfind_next_match_8: + ba,a 3f + nop + +1: dec 4, %i0 + cmp %l1, %l2 ! source[1] == targets[0] +2: bne,a 1f + cmp %l1, %l3 ! source[1] == targets[1] + RET_START_1_IS_TARGET_(0) + +1: bne,a 1f + cmp %l1, %l4 ! source[1] == targets[2] + RET_START_1_IS_TARGET_(1) + +1: bne,a 1f + cmp %l1, %l5 ! source[1] == targets[3] + RET_START_1_IS_TARGET_(2) + +1: bne,a 1f + cmp %l1, %l6 ! source[1] == targets[4] + RET_START_1_IS_TARGET_(3) + +1: bne,a 1f + cmp %l1, %l7 ! source[1] == targets[5] + RET_START_1_IS_TARGET_(4) + +1: bne,a 1f + cmp %l1, %o0 ! source[1] == targets[6] + RET_START_1_IS_TARGET_(5) + +1: bne,a 1f + ldd [%i0 + 8], %l0 + RET_START_1_IS_TARGET_(6) + +1: inc 8, %i0 +3: cmp %l0, %l2 ! source[0] == targets[0] + bne,a 1f + cmp %l0, %l3 ! source[0] == targets[1] + RET_START_0_IS_TARGET_(0) + +1: bne,a 1f + cmp %l0, %l4 ! source[0] == targets[2] + RET_START_0_IS_TARGET_(1) + +1: bne,a 1f + cmp %l0, %l5 ! source[0] == targets[3] + RET_START_0_IS_TARGET_(2) + +1: bne,a 1f + cmp %l0, %l6 ! source[0] == targets[4] + RET_START_0_IS_TARGET_(3) + +1: bne,a 1f + cmp %l0, %l7 ! source[0] == targets[5] + RET_START_0_IS_TARGET_(4) + +1: bne,a 1f + cmp %l0, %o0 ! source[0] == targets[6] + RET_START_0_IS_TARGET_(5) + +1: bne,a 2b + cmp %l1, %l2 ! source[1] == targets[0] + RET_START_0_IS_TARGET_(6) + + ASMEND(vectorfind_next_match_7) + + +LFUNC(vectorfind_next_match_8) save %sp, -112, %sp - ld [%i1 + 0], %l2 - ld [%i1 + 4], %l3 - ld [%i1 + 8], %l4 - ld [%i1 + 12], %l5 - ld [%i1 + 16], %l6 - ld [%i1 + 20], %l7 - ld [%i1 + 24], %o0 - ld [%i1 + 28], %o1 + ld [%i1 + 0], %l2 ! targets[0] + ld [%i1 + 4], %l3 ! targets[1] + ld [%i1 + 8], %l4 ! targets[2] + ld [%i1 + 12], %l5 ! targets[3] + ld [%i1 + 16], %l6 ! targets[4] + ld [%i1 + 20], %l7 ! targets[5] + ld [%i1 + 24], %o0 ! targets[6] + ld [%i1 + 28], %o1 ! targets[7] + btst 4, %i0 - bne,a 1f; ld [%i0], %l1 + bnz,a 1f + ld [%i0], %l1 + ldd [%i0], %l0 - ba,a 3f; nop -1: sub %i0, 4, %i0 - cmp %l1, %l2 -2: bne,a 1f; cmp %l1, %l3 - add %i0, 4, %i0 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l4 - add %i0, 4, %i0 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l5 - add %i0, 4, %i0 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l6 - add %i0, 4, %i0 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l7 - add %i0, 4, %i0 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o0 - add %i0, 4, %i0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o1 - add %i0, 4, %i0 - mov 6, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; ldd [%i0+8], %l0 - add %i0, 4, %i0 - mov 7, %l0 - st %l0, [%i3] - ret; restore -1: add %i0, 8, %i0 -3: cmp %l0, %l2 - bne,a 1f; cmp %l0, %l3 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l4 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l5 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l6 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l7 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o1 - mov 6, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 2b; cmp %l1, %l2 - mov 7, %l0 - st %l0, [%i3] - ret; restore - -vectorfind_next_match_9: + ba,a 3f + nop + +1: dec 4, %i0 + cmp %l1, %l2 ! source[1] == targets[0] +2: bne,a 1f + cmp %l1, %l3 ! source[1] == targets[1] + RET_START_1_IS_TARGET_(0) + +1: bne,a 1f + cmp %l1, %l4 ! source[1] == targets[2] + RET_START_1_IS_TARGET_(1) + +1: bne,a 1f + cmp %l1, %l5 ! source[1] == targets[3] + RET_START_1_IS_TARGET_(2) + +1: bne,a 1f + cmp %l1, %l6 ! source[1] == targets[4] + RET_START_1_IS_TARGET_(3) + +1: bne,a 1f + cmp %l1, %l7 ! source[1] == targets[5] + RET_START_1_IS_TARGET_(4) + +1: bne,a 1f + cmp %l1, %o0 ! source[1] == targets[6] + RET_START_1_IS_TARGET_(5) + +1: bne,a 1f + cmp %l1, %o1 ! source[1] == targets[7] + RET_START_1_IS_TARGET_(6) + +1: bne,a 1f + ldd [%i0 + 8], %l0 + RET_START_1_IS_TARGET_(7) + +1: inc 8, %i0 +3: cmp %l0, %l2 ! source[0] == targets[0] + bne,a 1f + cmp %l0, %l3 ! source[0] == targets[1] + RET_START_0_IS_TARGET_(0) + +1: bne,a 1f + cmp %l0, %l4 ! source[0] == targets[2] + RET_START_0_IS_TARGET_(1) + +1: bne,a 1f + cmp %l0, %l5 ! source[0] == targets[3] + RET_START_0_IS_TARGET_(2) + +1: bne,a 1f + cmp %l0, %l6 ! source[0] == targets[4] + RET_START_0_IS_TARGET_(3) + +1: bne,a 1f + cmp %l0, %l7 ! source[0] == targets[5] + RET_START_0_IS_TARGET_(4) + +1: bne,a 1f + cmp %l0, %o0 ! source[0] == targets[6] + RET_START_0_IS_TARGET_(5) + +1: bne,a 1f + cmp %l0, %o1 ! source[0] == targets[7] + RET_START_0_IS_TARGET_(6) + +1: bne,a 2b + cmp %l1, %l2 ! source[1] == targets[0] + RET_START_0_IS_TARGET_(7) + + ASMEND(vectorfind_next_match_8) + + +LFUNC(vectorfind_next_match_9) save %sp, -112, %sp - ld [%i1 + 0], %l2 - ld [%i1 + 4], %l3 - ld [%i1 + 8], %l4 - ld [%i1 + 12], %l5 - ld [%i1 + 16], %l6 - ld [%i1 + 20], %l7 - ld [%i1 + 24], %o0 - ld [%i1 + 28], %o1 - ld [%i1 + 32], %o2 + ld [%i1 + 0], %l2 ! targets[0] + ld [%i1 + 4], %l3 ! targets[1] + ld [%i1 + 8], %l4 ! targets[2] + ld [%i1 + 12], %l5 ! targets[3] + ld [%i1 + 16], %l6 ! targets[4] + ld [%i1 + 20], %l7 ! targets[5] + ld [%i1 + 24], %o0 ! targets[6] + ld [%i1 + 28], %o1 ! targets[7] + ld [%i1 + 32], %o2 ! targets[8] + btst 4, %i0 - bne,a 1f; ld [%i0], %l1 + bnz,a 1f + ld [%i0], %l1 + ldd [%i0], %l0 - ba,a 3f; nop -1: sub %i0, 4, %i0 - cmp %l1, %l2 -2: bne,a 1f; cmp %l1, %l3 - add %i0, 4, %i0 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l4 - add %i0, 4, %i0 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l5 - add %i0, 4, %i0 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l6 - add %i0, 4, %i0 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l7 - add %i0, 4, %i0 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o0 - add %i0, 4, %i0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o1 - add %i0, 4, %i0 - mov 6, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o2 - add %i0, 4, %i0 - mov 7, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; ldd [%i0+8], %l0 - add %i0, 4, %i0 - mov 8, %l0 - st %l0, [%i3] - ret; restore -1: add %i0, 8, %i0 -3: cmp %l0, %l2 - bne,a 1f; cmp %l0, %l3 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l4 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l5 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l6 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l7 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o1 - mov 6, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o2 - mov 7, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 2b; cmp %l1, %l2 - mov 8, %l0 - st %l0, [%i3] - ret; restore - -vectorfind_next_match_10: + ba,a 3f + nop + +1: dec 4, %i0 + cmp %l1, %l2 ! source[1] == targets[0] +2: bne,a 1f + cmp %l1, %l3 ! source[1] == targets[1] + RET_START_1_IS_TARGET_(0) + +1: bne,a 1f + cmp %l1, %l4 ! source[1] == targets[2] + RET_START_1_IS_TARGET_(1) + +1: bne,a 1f + cmp %l1, %l5 ! source[1] == targets[3] + RET_START_1_IS_TARGET_(2) + +1: bne,a 1f + cmp %l1, %l6 ! source[1] == targets[4] + RET_START_1_IS_TARGET_(3) + +1: bne,a 1f + cmp %l1, %l7 ! source[1] == targets[5] + RET_START_1_IS_TARGET_(4) + +1: bne,a 1f + cmp %l1, %o0 ! source[1] == targets[6] + RET_START_1_IS_TARGET_(5) + +1: bne,a 1f + cmp %l1, %o1 ! source[1] == targets[7] + RET_START_1_IS_TARGET_(6) + +1: bne,a 1f + cmp %l1, %o2 ! source[1] == targets[8] + RET_START_1_IS_TARGET_(7) + +1: bne,a 1f + ldd [%i0 + 8], %l0 + RET_START_1_IS_TARGET_(8) + +1: inc 8, %i0 +3: cmp %l0, %l2 ! source[0] == targets[0] + bne,a 1f + cmp %l0, %l3 ! source[0] == targets[1] + RET_START_0_IS_TARGET_(0) + +1: bne,a 1f + cmp %l0, %l4 ! source[0] == targets[2] + RET_START_0_IS_TARGET_(1) + +1: bne,a 1f + cmp %l0, %l5 ! source[0] == targets[3] + RET_START_0_IS_TARGET_(2) + +1: bne,a 1f + cmp %l0, %l6 ! source[0] == targets[4] + RET_START_0_IS_TARGET_(3) + +1: bne,a 1f + cmp %l0, %l7 ! source[0] == targets[5] + RET_START_0_IS_TARGET_(4) + +1: bne,a 1f + cmp %l0, %o0 ! source[0] == targets[6] + RET_START_0_IS_TARGET_(5) + +1: bne,a 1f + cmp %l0, %o1 ! source[0] == targets[7] + RET_START_0_IS_TARGET_(6) + +1: bne,a 1f + cmp %l0, %o2 ! source[0] == targets[8] + RET_START_0_IS_TARGET_(7) + +1: bne,a 2b + cmp %l1, %l2 ! source[1] == targets[0] + RET_START_0_IS_TARGET_(8) + + ASMEND(vectorfind_next_match_9) + + +LFUNC(vectorfind_next_match_10) save %sp, -112, %sp - ld [%i1 + 0], %l2 - ld [%i1 + 4], %l3 - ld [%i1 + 8], %l4 - ld [%i1 + 12], %l5 - ld [%i1 + 16], %l6 - ld [%i1 + 20], %l7 - ld [%i1 + 24], %o0 - ld [%i1 + 28], %o1 - ld [%i1 + 32], %o2 - ld [%i1 + 36], %o3 + ld [%i1 + 0], %l2 ! targets[0] + ld [%i1 + 4], %l3 ! targets[1] + ld [%i1 + 8], %l4 ! targets[2] + ld [%i1 + 12], %l5 ! targets[3] + ld [%i1 + 16], %l6 ! targets[4] + ld [%i1 + 20], %l7 ! targets[5] + ld [%i1 + 24], %o0 ! targets[6] + ld [%i1 + 28], %o1 ! targets[7] + ld [%i1 + 32], %o2 ! targets[8] + ld [%i1 + 36], %o3 ! targets[9] + btst 4, %i0 - bne,a 1f; ld [%i0], %l1 + bnz,a 1f + ld [%i0], %l1 + ldd [%i0], %l0 - ba,a 3f; nop -1: sub %i0, 4, %i0 - cmp %l1, %l2 -2: bne,a 1f; cmp %l1, %l3 - add %i0, 4, %i0 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l4 - add %i0, 4, %i0 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l5 - add %i0, 4, %i0 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l6 - add %i0, 4, %i0 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l7 - add %i0, 4, %i0 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o0 - add %i0, 4, %i0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o1 - add %i0, 4, %i0 - mov 6, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o2 - add %i0, 4, %i0 - mov 7, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o3 - add %i0, 4, %i0 - mov 8, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; ldd [%i0+8], %l0 - add %i0, 4, %i0 - mov 9, %l0 - st %l0, [%i3] - ret; restore -1: add %i0, 8, %i0 -3: cmp %l0, %l2 - bne,a 1f; cmp %l0, %l3 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l4 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l5 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l6 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l7 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o1 - mov 6, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o2 - mov 7, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o3 - mov 8, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 2b; cmp %l1, %l2 - mov 9, %l0 - st %l0, [%i3] - ret; restore - -vectorfind_next_match_11: + ba,a 3f + nop + +1: dec 4, %i0 + cmp %l1, %l2 ! source[1] == targets[0] +2: bne,a 1f + cmp %l1, %l3 ! source[1] == targets[1] + RET_START_1_IS_TARGET_(0) + +1: bne,a 1f + cmp %l1, %l4 ! source[1] == targets[2] + RET_START_1_IS_TARGET_(1) + +1: bne,a 1f + cmp %l1, %l5 ! source[1] == targets[3] + RET_START_1_IS_TARGET_(2) + +1: bne,a 1f + cmp %l1, %l6 ! source[1] == targets[4] + RET_START_1_IS_TARGET_(3) + +1: bne,a 1f + cmp %l1, %l7 ! source[1] == targets[5] + RET_START_1_IS_TARGET_(4) + +1: bne,a 1f + cmp %l1, %o0 ! source[1] == targets[6] + RET_START_1_IS_TARGET_(5) + +1: bne,a 1f + cmp %l1, %o1 ! source[1] == targets[7] + RET_START_1_IS_TARGET_(6) + +1: bne,a 1f + cmp %l1, %o2 ! source[1] == targets[8] + RET_START_1_IS_TARGET_(7) + +1: bne,a 1f + cmp %l1, %o3 ! source[1] == targets[9] + RET_START_1_IS_TARGET_(8) + +1: bne,a 1f + ldd [%i0 + 8], %l0 + RET_START_1_IS_TARGET_(9) + +1: inc 8, %i0 +3: cmp %l0, %l2 ! source[0] == targets[0] + bne,a 1f + cmp %l0, %l3 ! source[0] == targets[1] + RET_START_0_IS_TARGET_(0) + +1: bne,a 1f + cmp %l0, %l4 ! source[0] == targets[2] + RET_START_0_IS_TARGET_(1) + +1: bne,a 1f + cmp %l0, %l5 ! source[0] == targets[3] + RET_START_0_IS_TARGET_(2) + +1: bne,a 1f + cmp %l0, %l6 ! source[0] == targets[4] + RET_START_0_IS_TARGET_(3) + +1: bne,a 1f + cmp %l0, %l7 ! source[0] == targets[5] + RET_START_0_IS_TARGET_(4) + +1: bne,a 1f + cmp %l0, %o0 ! source[0] == targets[6] + RET_START_0_IS_TARGET_(5) + +1: bne,a 1f + cmp %l0, %o1 ! source[0] == targets[7] + RET_START_0_IS_TARGET_(6) + +1: bne,a 1f + cmp %l0, %o2 ! source[0] == targets[8] + RET_START_0_IS_TARGET_(7) + +1: bne,a 1f + cmp %l0, %o3 ! source[0] == targets[9] + RET_START_0_IS_TARGET_(8) + +1: bne,a 2b + cmp %l1, %l2 ! source[1] == targets[0] + RET_START_0_IS_TARGET_(9) + + ASMEND(vectorfind_next_match_10) + + +LFUNC(vectorfind_next_match_11) save %sp, -112, %sp - ld [%i1 + 0], %l2 - ld [%i1 + 4], %l3 - ld [%i1 + 8], %l4 - ld [%i1 + 12], %l5 - ld [%i1 + 16], %l6 - ld [%i1 + 20], %l7 - ld [%i1 + 24], %o0 - ld [%i1 + 28], %o1 - ld [%i1 + 32], %o2 - ld [%i1 + 36], %o3 - ld [%i1 + 40], %o4 + ld [%i1 + 0], %l2 ! targets[0] + ld [%i1 + 4], %l3 ! targets[1] + ld [%i1 + 8], %l4 ! targets[2] + ld [%i1 + 12], %l5 ! targets[3] + ld [%i1 + 16], %l6 ! targets[4] + ld [%i1 + 20], %l7 ! targets[5] + ld [%i1 + 24], %o0 ! targets[6] + ld [%i1 + 28], %o1 ! targets[7] + ld [%i1 + 32], %o2 ! targets[8] + ld [%i1 + 36], %o3 ! targets[9] + ld [%i1 + 40], %o4 ! targets[10] + btst 4, %i0 - bne,a 1f; ld [%i0], %l1 + bnz,a 1f + ld [%i0], %l1 + ldd [%i0], %l0 - ba,a 3f; nop -1: sub %i0, 4, %i0 - cmp %l1, %l2 -2: bne,a 1f; cmp %l1, %l3 - add %i0, 4, %i0 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l4 - add %i0, 4, %i0 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l5 - add %i0, 4, %i0 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l6 - add %i0, 4, %i0 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l7 - add %i0, 4, %i0 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o0 - add %i0, 4, %i0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o1 - add %i0, 4, %i0 - mov 6, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o2 - add %i0, 4, %i0 - mov 7, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o3 - add %i0, 4, %i0 - mov 8, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o4 - add %i0, 4, %i0 - mov 9, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; ldd [%i0+8], %l0 - add %i0, 4, %i0 - mov 10, %l0 - st %l0, [%i3] - ret; restore -1: add %i0, 8, %i0 -3: cmp %l0, %l2 - bne,a 1f; cmp %l0, %l3 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l4 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l5 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l6 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l7 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o1 - mov 6, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o2 - mov 7, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o3 - mov 8, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o4 - mov 9, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 2b; cmp %l1, %l2 - mov 10, %l0 - st %l0, [%i3] - ret; restore - -vectorfind_next_match_12: + ba,a 3f + nop + +1: dec 4, %i0 + cmp %l1, %l2 ! source[1] == targets[0] +2: bne,a 1f + cmp %l1, %l3 ! source[1] == targets[1] + RET_START_1_IS_TARGET_(0) + +1: bne,a 1f + cmp %l1, %l4 ! source[1] == targets[2] + RET_START_1_IS_TARGET_(1) + +1: bne,a 1f + cmp %l1, %l5 ! source[1] == targets[3] + RET_START_1_IS_TARGET_(2) + +1: bne,a 1f + cmp %l1, %l6 ! source[1] == targets[4] + RET_START_1_IS_TARGET_(3) + +1: bne,a 1f + cmp %l1, %l7 ! source[1] == targets[5] + RET_START_1_IS_TARGET_(4) + +1: bne,a 1f + cmp %l1, %o0 ! source[1] == targets[6] + RET_START_1_IS_TARGET_(5) + +1: bne,a 1f + cmp %l1, %o1 ! source[1] == targets[7] + RET_START_1_IS_TARGET_(6) + +1: bne,a 1f + cmp %l1, %o2 ! source[1] == targets[8] + RET_START_1_IS_TARGET_(7) + +1: bne,a 1f + cmp %l1, %o3 ! source[1] == targets[9] + RET_START_1_IS_TARGET_(8) + +1: bne,a 1f + cmp %l1, %o4 ! source[1] == targets[10] + RET_START_1_IS_TARGET_(9) + +1: bne,a 1f + ldd [%i0 + 8], %l0 + RET_START_1_IS_TARGET_(10) + +1: inc 8, %i0 +3: cmp %l0, %l2 ! source[0] == targets[0] + bne,a 1f + cmp %l0, %l3 ! source[0] == targets[1] + RET_START_0_IS_TARGET_(0) + +1: bne,a 1f + cmp %l0, %l4 ! source[0] == targets[2] + RET_START_0_IS_TARGET_(1) + +1: bne,a 1f + cmp %l0, %l5 ! source[0] == targets[3] + RET_START_0_IS_TARGET_(2) + +1: bne,a 1f + cmp %l0, %l6 ! source[0] == targets[4] + RET_START_0_IS_TARGET_(3) + +1: bne,a 1f + cmp %l0, %l7 ! source[0] == targets[5] + RET_START_0_IS_TARGET_(4) + +1: bne,a 1f + cmp %l0, %o0 ! source[0] == targets[6] + RET_START_0_IS_TARGET_(5) + +1: bne,a 1f + cmp %l0, %o1 ! source[0] == targets[7] + RET_START_0_IS_TARGET_(6) + +1: bne,a 1f + cmp %l0, %o2 ! source[0] == targets[8] + RET_START_0_IS_TARGET_(7) + +1: bne,a 1f + cmp %l0, %o3 ! source[0] == targets[9] + RET_START_0_IS_TARGET_(8) + +1: bne,a 1f + cmp %l0, %o4 ! source[0] == targets[10] + RET_START_0_IS_TARGET_(9) + +1: bne,a 2b + cmp %l1, %l2 ! source[1] == targets[0] + RET_START_0_IS_TARGET_(10) + + ASMEND(vectorfind_next_match_11) + + +LFUNC(vectorfind_next_match_12) save %sp, -112, %sp - ld [%i1 + 0], %l2 - ld [%i1 + 4], %l3 - ld [%i1 + 8], %l4 - ld [%i1 + 12], %l5 - ld [%i1 + 16], %l6 - ld [%i1 + 20], %l7 - ld [%i1 + 24], %o0 - ld [%i1 + 28], %o1 - ld [%i1 + 32], %o2 - ld [%i1 + 36], %o3 - ld [%i1 + 40], %o4 - ld [%i1 + 44], %o5 + ld [%i1 + 0], %l2 ! targets[0] + ld [%i1 + 4], %l3 ! targets[1] + ld [%i1 + 8], %l4 ! targets[2] + ld [%i1 + 12], %l5 ! targets[3] + ld [%i1 + 16], %l6 ! targets[4] + ld [%i1 + 20], %l7 ! targets[5] + ld [%i1 + 24], %o0 ! targets[6] + ld [%i1 + 28], %o1 ! targets[7] + ld [%i1 + 32], %o2 ! targets[8] + ld [%i1 + 36], %o3 ! targets[9] + ld [%i1 + 40], %o4 ! targets[10] + ld [%i1 + 44], %o5 ! targets[11] + btst 4, %i0 - bne,a 1f; ld [%i0], %l1 + bnz,a 1f + ld [%i0], %l1 + ldd [%i0], %l0 - ba,a 3f; nop -1: sub %i0, 4, %i0 - cmp %l1, %l2 -2: bne,a 1f; cmp %l1, %l3 - add %i0, 4, %i0 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l4 - add %i0, 4, %i0 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l5 - add %i0, 4, %i0 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l6 - add %i0, 4, %i0 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l7 - add %i0, 4, %i0 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o0 - add %i0, 4, %i0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o1 - add %i0, 4, %i0 - mov 6, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o2 - add %i0, 4, %i0 - mov 7, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o3 - add %i0, 4, %i0 - mov 8, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o4 - add %i0, 4, %i0 - mov 9, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o5 - add %i0, 4, %i0 - mov 10, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; ldd [%i0+8], %l0 - add %i0, 4, %i0 - mov 11, %l0 - st %l0, [%i3] - ret; restore -1: add %i0, 8, %i0 -3: cmp %l0, %l2 - bne,a 1f; cmp %l0, %l3 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l4 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l5 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l6 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l7 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o1 - mov 6, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o2 - mov 7, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o3 - mov 8, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o4 - mov 9, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o5 - mov 10, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 2b; cmp %l1, %l2 - mov 11, %l0 - st %l0, [%i3] - ret; restore - -vectorfind_next_match_13: + ba,a 3f + nop + +1: dec 4, %i0 + cmp %l1, %l2 ! source[1] == targets[0] +2: bne,a 1f + cmp %l1, %l3 ! source[1] == targets[1] + RET_START_1_IS_TARGET_(0) + +1: bne,a 1f + cmp %l1, %l4 ! source[1] == targets[2] + RET_START_1_IS_TARGET_(1) + +1: bne,a 1f + cmp %l1, %l5 ! source[1] == targets[3] + RET_START_1_IS_TARGET_(2) + +1: bne,a 1f + cmp %l1, %l6 ! source[1] == targets[4] + RET_START_1_IS_TARGET_(3) + +1: bne,a 1f + cmp %l1, %l7 ! source[1] == targets[5] + RET_START_1_IS_TARGET_(4) + +1: bne,a 1f + cmp %l1, %o0 ! source[1] == targets[6] + RET_START_1_IS_TARGET_(5) + +1: bne,a 1f + cmp %l1, %o1 ! source[1] == targets[7] + RET_START_1_IS_TARGET_(6) + +1: bne,a 1f + cmp %l1, %o2 ! source[1] == targets[8] + RET_START_1_IS_TARGET_(7) + +1: bne,a 1f + cmp %l1, %o3 ! source[1] == targets[9] + RET_START_1_IS_TARGET_(8) + +1: bne,a 1f + cmp %l1, %o4 ! source[1] == targets[10] + RET_START_1_IS_TARGET_(9) + +1: bne,a 1f + cmp %l1, %o5 ! source[1] == targets[11] + RET_START_1_IS_TARGET_(10) + +1: bne,a 1f + ldd [%i0 + 8], %l0 + RET_START_1_IS_TARGET_(11) + +1: inc 8, %i0 +3: cmp %l0, %l2 ! source[0] == targets[0] + bne,a 1f + cmp %l0, %l3 ! source[0] == targets[1] + RET_START_0_IS_TARGET_(0) + +1: bne,a 1f + cmp %l0, %l4 ! source[0] == targets[2] + RET_START_0_IS_TARGET_(1) + +1: bne,a 1f + cmp %l0, %l5 ! source[0] == targets[3] + RET_START_0_IS_TARGET_(2) + +1: bne,a 1f + cmp %l0, %l6 ! source[0] == targets[4] + RET_START_0_IS_TARGET_(3) + +1: bne,a 1f + cmp %l0, %l7 ! source[0] == targets[5] + RET_START_0_IS_TARGET_(4) + +1: bne,a 1f + cmp %l0, %o0 ! source[0] == targets[6] + RET_START_0_IS_TARGET_(5) + +1: bne,a 1f + cmp %l0, %o1 ! source[0] == targets[7] + RET_START_0_IS_TARGET_(6) + +1: bne,a 1f + cmp %l0, %o2 ! source[0] == targets[8] + RET_START_0_IS_TARGET_(7) + +1: bne,a 1f + cmp %l0, %o3 ! source[0] == targets[9] + RET_START_0_IS_TARGET_(8) + +1: bne,a 1f + cmp %l0, %o4 ! source[0] == targets[10] + RET_START_0_IS_TARGET_(9) + +1: bne,a 1f + cmp %l0, %o5 ! source[0] == targets[11] + RET_START_0_IS_TARGET_(10) + +1: bne,a 2b + cmp %l1, %l2 ! source[1] == targets[0] + RET_START_0_IS_TARGET_(11) + + ASMEND(vectorfind_next_match_12) + + +LFUNC(vectorfind_next_match_13) save %sp, -112, %sp - ld [%i1 + 0], %l2 - ld [%i1 + 4], %l3 - ld [%i1 + 8], %l4 - ld [%i1 + 12], %l5 - ld [%i1 + 16], %l6 - ld [%i1 + 20], %l7 - ld [%i1 + 24], %o0 - ld [%i1 + 28], %o1 - ld [%i1 + 32], %o2 - ld [%i1 + 36], %o3 - ld [%i1 + 40], %o4 - ld [%i1 + 44], %o5 - ld [%i1 + 48], %i2 + ld [%i1 + 0], %l2 ! targets[0] + ld [%i1 + 4], %l3 ! targets[1] + ld [%i1 + 8], %l4 ! targets[2] + ld [%i1 + 12], %l5 ! targets[3] + ld [%i1 + 16], %l6 ! targets[4] + ld [%i1 + 20], %l7 ! targets[5] + ld [%i1 + 24], %o0 ! targets[6] + ld [%i1 + 28], %o1 ! targets[7] + ld [%i1 + 32], %o2 ! targets[8] + ld [%i1 + 36], %o3 ! targets[9] + ld [%i1 + 40], %o4 ! targets[10] + ld [%i1 + 44], %o5 ! targets[11] + ld [%i1 + 48], %i2 ! targets[12] + btst 4, %i0 - bne,a 1f; ld [%i0], %l1 + bnz,a 1f + ld [%i0], %l1 + ldd [%i0], %l0 - ba,a 3f; nop -1: sub %i0, 4, %i0 - cmp %l1, %l2 -2: bne,a 1f; cmp %l1, %l3 - add %i0, 4, %i0 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l4 - add %i0, 4, %i0 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l5 - add %i0, 4, %i0 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l6 - add %i0, 4, %i0 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l7 - add %i0, 4, %i0 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o0 - add %i0, 4, %i0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o1 - add %i0, 4, %i0 - mov 6, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o2 - add %i0, 4, %i0 - mov 7, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o3 - add %i0, 4, %i0 - mov 8, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o4 - add %i0, 4, %i0 - mov 9, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o5 - add %i0, 4, %i0 - mov 10, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %i2 - add %i0, 4, %i0 - mov 11, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; ldd [%i0+8], %l0 - add %i0, 4, %i0 - mov 12, %l0 - st %l0, [%i3] - ret; restore -1: add %i0, 8, %i0 -3: cmp %l0, %l2 - bne,a 1f; cmp %l0, %l3 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l4 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l5 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l6 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l7 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o1 - mov 6, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o2 - mov 7, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o3 - mov 8, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o4 - mov 9, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o5 - mov 10, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %i2 - mov 11, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 2b; cmp %l1, %l2 - mov 12, %l0 - st %l0, [%i3] - ret; restore - -vectorfind_next_match_14: + ba,a 3f + nop + +1: dec 4, %i0 + cmp %l1, %l2 ! source[1] == targets[0] +2: bne,a 1f + cmp %l1, %l3 ! source[1] == targets[1] + RET_START_1_IS_TARGET_(0) + +1: bne,a 1f + cmp %l1, %l4 ! source[1] == targets[2] + RET_START_1_IS_TARGET_(1) + +1: bne,a 1f + cmp %l1, %l5 ! source[1] == targets[3] + RET_START_1_IS_TARGET_(2) + +1: bne,a 1f + cmp %l1, %l6 ! source[1] == targets[4] + RET_START_1_IS_TARGET_(3) + +1: bne,a 1f + cmp %l1, %l7 ! source[1] == targets[5] + RET_START_1_IS_TARGET_(4) + +1: bne,a 1f + cmp %l1, %o0 ! source[1] == targets[6] + RET_START_1_IS_TARGET_(5) + +1: bne,a 1f + cmp %l1, %o1 ! source[1] == targets[7] + RET_START_1_IS_TARGET_(6) + +1: bne,a 1f + cmp %l1, %o2 ! source[1] == targets[8] + RET_START_1_IS_TARGET_(7) + +1: bne,a 1f + cmp %l1, %o3 ! source[1] == targets[9] + RET_START_1_IS_TARGET_(8) + +1: bne,a 1f + cmp %l1, %o4 ! source[1] == targets[10] + RET_START_1_IS_TARGET_(9) + +1: bne,a 1f + cmp %l1, %o5 ! source[1] == targets[11] + RET_START_1_IS_TARGET_(10) + +1: bne,a 1f + cmp %l1, %i2 ! source[1] == targets[12] + RET_START_1_IS_TARGET_(11) + +1: bne,a 1f + ldd [%i0 + 8], %l0 + RET_START_1_IS_TARGET_(12) + +1: inc 8, %i0 +3: cmp %l0, %l2 ! source[0] == targets[0] + bne,a 1f + cmp %l0, %l3 ! source[0] == targets[1] + RET_START_0_IS_TARGET_(0) + +1: bne,a 1f + cmp %l0, %l4 ! source[0] == targets[2] + RET_START_0_IS_TARGET_(1) + +1: bne,a 1f + cmp %l0, %l5 ! source[0] == targets[3] + RET_START_0_IS_TARGET_(2) + +1: bne,a 1f + cmp %l0, %l6 ! source[0] == targets[4] + RET_START_0_IS_TARGET_(3) + +1: bne,a 1f + cmp %l0, %l7 ! source[0] == targets[5] + RET_START_0_IS_TARGET_(4) + +1: bne,a 1f + cmp %l0, %o0 ! source[0] == targets[6] + RET_START_0_IS_TARGET_(5) + +1: bne,a 1f + cmp %l0, %o1 ! source[0] == targets[7] + RET_START_0_IS_TARGET_(6) + +1: bne,a 1f + cmp %l0, %o2 ! source[0] == targets[8] + RET_START_0_IS_TARGET_(7) + +1: bne,a 1f + cmp %l0, %o3 ! source[0] == targets[9] + RET_START_0_IS_TARGET_(8) + +1: bne,a 1f + cmp %l0, %o4 ! source[0] == targets[10] + RET_START_0_IS_TARGET_(9) + +1: bne,a 1f + cmp %l0, %o5 ! source[0] == targets[11] + RET_START_0_IS_TARGET_(10) + +1: bne,a 1f + cmp %l0, %i2 ! source[0] == targets[12] + RET_START_0_IS_TARGET_(11) + +1: bne,a 2b + cmp %l1, %l2 ! source[1] == targets[0] + RET_START_0_IS_TARGET_(12) + + ASMEND(vectorfind_next_match_13) + + +LFUNC(vectorfind_next_match_14) save %sp, -112, %sp - ld [%i1 + 0], %l2 - ld [%i1 + 4], %l3 - ld [%i1 + 8], %l4 - ld [%i1 + 12], %l5 - ld [%i1 + 16], %l6 - ld [%i1 + 20], %l7 - ld [%i1 + 24], %o0 - ld [%i1 + 28], %o1 - ld [%i1 + 32], %o2 - ld [%i1 + 36], %o3 - ld [%i1 + 40], %o4 - ld [%i1 + 44], %o5 - ld [%i1 + 48], %i2 - ld [%i1 + 52], %i4 + ld [%i1 + 0], %l2 ! targets[0] + ld [%i1 + 4], %l3 ! targets[1] + ld [%i1 + 8], %l4 ! targets[2] + ld [%i1 + 12], %l5 ! targets[3] + ld [%i1 + 16], %l6 ! targets[4] + ld [%i1 + 20], %l7 ! targets[5] + ld [%i1 + 24], %o0 ! targets[6] + ld [%i1 + 28], %o1 ! targets[7] + ld [%i1 + 32], %o2 ! targets[8] + ld [%i1 + 36], %o3 ! targets[9] + ld [%i1 + 40], %o4 ! targets[10] + ld [%i1 + 44], %o5 ! targets[11] + ld [%i1 + 48], %i2 ! targets[12] + ld [%i1 + 52], %i4 ! targets[13] + btst 4, %i0 - bne,a 1f; ld [%i0], %l1 + bnz,a 1f + ld [%i0], %l1 + ldd [%i0], %l0 - ba,a 3f; nop -1: sub %i0, 4, %i0 - cmp %l1, %l2 -2: bne,a 1f; cmp %l1, %l3 - add %i0, 4, %i0 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l4 - add %i0, 4, %i0 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l5 - add %i0, 4, %i0 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l6 - add %i0, 4, %i0 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l7 - add %i0, 4, %i0 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o0 - add %i0, 4, %i0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o1 - add %i0, 4, %i0 - mov 6, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o2 - add %i0, 4, %i0 - mov 7, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o3 - add %i0, 4, %i0 - mov 8, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o4 - add %i0, 4, %i0 - mov 9, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o5 - add %i0, 4, %i0 - mov 10, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %i2 - add %i0, 4, %i0 - mov 11, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %i4 - add %i0, 4, %i0 - mov 12, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; ldd [%i0+8], %l0 - add %i0, 4, %i0 - mov 13, %l0 - st %l0, [%i3] - ret; restore -1: add %i0, 8, %i0 -3: cmp %l0, %l2 - bne,a 1f; cmp %l0, %l3 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l4 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l5 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l6 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l7 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o1 - mov 6, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o2 - mov 7, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o3 - mov 8, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o4 - mov 9, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o5 - mov 10, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %i2 - mov 11, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %i4 - mov 12, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 2b; cmp %l1, %l2 - mov 13, %l0 - st %l0, [%i3] - ret; restore - -vectorfind_next_match_15: + ba,a 3f + nop + +1: dec 4, %i0 + cmp %l1, %l2 ! source[1] == targets[0] +2: bne,a 1f + cmp %l1, %l3 ! source[1] == targets[1] + RET_START_1_IS_TARGET_(0) + +1: bne,a 1f + cmp %l1, %l4 ! source[1] == targets[2] + RET_START_1_IS_TARGET_(1) + +1: bne,a 1f + cmp %l1, %l5 ! source[1] == targets[3] + RET_START_1_IS_TARGET_(2) + +1: bne,a 1f + cmp %l1, %l6 ! source[1] == targets[4] + RET_START_1_IS_TARGET_(3) + +1: bne,a 1f + cmp %l1, %l7 ! source[1] == targets[5] + RET_START_1_IS_TARGET_(4) + +1: bne,a 1f + cmp %l1, %o0 ! source[1] == targets[6] + RET_START_1_IS_TARGET_(5) + +1: bne,a 1f + cmp %l1, %o1 ! source[1] == targets[7] + RET_START_1_IS_TARGET_(6) + +1: bne,a 1f + cmp %l1, %o2 ! source[1] == targets[8] + RET_START_1_IS_TARGET_(7) + +1: bne,a 1f + cmp %l1, %o3 ! source[1] == targets[9] + RET_START_1_IS_TARGET_(8) + +1: bne,a 1f + cmp %l1, %o4 ! source[1] == targets[10] + RET_START_1_IS_TARGET_(9) + +1: bne,a 1f + cmp %l1, %o5 ! source[1] == targets[11] + RET_START_1_IS_TARGET_(10) + +1: bne,a 1f + cmp %l1, %i2 ! source[1] == targets[12] + RET_START_1_IS_TARGET_(11) + +1: bne,a 1f + cmp %l1, %i4 ! source[1] == targets[13] + RET_START_1_IS_TARGET_(12) + +1: bne,a 1f + ldd [%i0 + 8], %l0 + RET_START_1_IS_TARGET_(13) + +1: inc 8, %i0 +3: cmp %l0, %l2 ! source[0] == targets[0] + bne,a 1f + cmp %l0, %l3 ! source[0] == targets[1] + RET_START_0_IS_TARGET_(0) + +1: bne,a 1f + cmp %l0, %l4 ! source[0] == targets[2] + RET_START_0_IS_TARGET_(1) + +1: bne,a 1f + cmp %l0, %l5 ! source[0] == targets[3] + RET_START_0_IS_TARGET_(2) + +1: bne,a 1f + cmp %l0, %l6 ! source[0] == targets[4] + RET_START_0_IS_TARGET_(3) + +1: bne,a 1f + cmp %l0, %l7 ! source[0] == targets[5] + RET_START_0_IS_TARGET_(4) + +1: bne,a 1f + cmp %l0, %o0 ! source[0] == targets[6] + RET_START_0_IS_TARGET_(5) + +1: bne,a 1f + cmp %l0, %o1 ! source[0] == targets[7] + RET_START_0_IS_TARGET_(6) + +1: bne,a 1f + cmp %l0, %o2 ! source[0] == targets[8] + RET_START_0_IS_TARGET_(7) + +1: bne,a 1f + cmp %l0, %o3 ! source[0] == targets[9] + RET_START_0_IS_TARGET_(8) + +1: bne,a 1f + cmp %l0, %o4 ! source[0] == targets[10] + RET_START_0_IS_TARGET_(9) + +1: bne,a 1f + cmp %l0, %o5 ! source[0] == targets[11] + RET_START_0_IS_TARGET_(10) + +1: bne,a 1f + cmp %l0, %i2 ! source[0] == targets[12] + RET_START_0_IS_TARGET_(11) + +1: bne,a 1f + cmp %l0, %i4 ! source[0] == targets[13] + RET_START_0_IS_TARGET_(12) + +1: bne,a 2b + cmp %l1, %l2 ! source[1] == targets[0] + RET_START_0_IS_TARGET_(13) + + ASMEND(vectorfind_next_match_14) + + +LFUNC(vectorfind_next_match_15) save %sp, -112, %sp - ld [%i1 + 0], %l2 - ld [%i1 + 4], %l3 - ld [%i1 + 8], %l4 - ld [%i1 + 12], %l5 - ld [%i1 + 16], %l6 - ld [%i1 + 20], %l7 - ld [%i1 + 24], %o0 - ld [%i1 + 28], %o1 - ld [%i1 + 32], %o2 - ld [%i1 + 36], %o3 - ld [%i1 + 40], %o4 - ld [%i1 + 44], %o5 - ld [%i1 + 48], %i2 - ld [%i1 + 52], %i4 - ld [%i1 + 56], %i5 + ld [%i1 + 0], %l2 ! targets[0] + ld [%i1 + 4], %l3 ! targets[1] + ld [%i1 + 8], %l4 ! targets[2] + ld [%i1 + 12], %l5 ! targets[3] + ld [%i1 + 16], %l6 ! targets[4] + ld [%i1 + 20], %l7 ! targets[5] + ld [%i1 + 24], %o0 ! targets[6] + ld [%i1 + 28], %o1 ! targets[7] + ld [%i1 + 32], %o2 ! targets[8] + ld [%i1 + 36], %o3 ! targets[9] + ld [%i1 + 40], %o4 ! targets[10] + ld [%i1 + 44], %o5 ! targets[11] + ld [%i1 + 48], %i2 ! targets[12] + ld [%i1 + 52], %i4 ! targets[13] + ld [%i1 + 56], %i5 ! targets[14] + btst 4, %i0 - bne,a 1f; ld [%i0], %l1 + bnz,a 1f + ld [%i0], %l1 + ldd [%i0], %l0 - ba,a 3f; nop -1: sub %i0, 4, %i0 - cmp %l1, %l2 -2: bne,a 1f; cmp %l1, %l3 - add %i0, 4, %i0 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l4 - add %i0, 4, %i0 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l5 - add %i0, 4, %i0 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l6 - add %i0, 4, %i0 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %l7 - add %i0, 4, %i0 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o0 - add %i0, 4, %i0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o1 - add %i0, 4, %i0 - mov 6, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o2 - add %i0, 4, %i0 - mov 7, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o3 - add %i0, 4, %i0 - mov 8, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o4 - add %i0, 4, %i0 - mov 9, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %o5 - add %i0, 4, %i0 - mov 10, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %i2 - add %i0, 4, %i0 - mov 11, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %i4 - add %i0, 4, %i0 - mov 12, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l1, %i5 - add %i0, 4, %i0 - mov 13, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; ldd [%i0+8], %l0 - add %i0, 4, %i0 - mov 14, %l0 - st %l0, [%i3] - ret; restore -1: add %i0, 8, %i0 -3: cmp %l0, %l2 - bne,a 1f; cmp %l0, %l3 - mov 0, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l4 - mov 1, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l5 - mov 2, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l6 - mov 3, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %l7 - mov 4, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o0 - mov 5, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o1 - mov 6, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o2 - mov 7, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o3 - mov 8, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o4 - mov 9, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %o5 - mov 10, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %i2 - mov 11, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %i4 - mov 12, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 1f; cmp %l0, %i5 - mov 13, %l0 - st %l0, [%i3] - ret; restore -1: bne,a 2b; cmp %l1, %l2 - mov 14, %l0 - st %l0, [%i3] - ret; restore + ba,a 3f + nop + +1: dec 4, %i0 + cmp %l1, %l2 ! source[1] == targets[0] +2: bne,a 1f + cmp %l1, %l3 ! source[1] == targets[1] + RET_START_1_IS_TARGET_(0) + +1: bne,a 1f + cmp %l1, %l4 ! source[1] == targets[2] + RET_START_1_IS_TARGET_(1) + +1: bne,a 1f + cmp %l1, %l5 ! source[1] == targets[3] + RET_START_1_IS_TARGET_(2) + +1: bne,a 1f + cmp %l1, %l6 ! source[1] == targets[4] + RET_START_1_IS_TARGET_(3) + +1: bne,a 1f + cmp %l1, %l7 ! source[1] == targets[5] + RET_START_1_IS_TARGET_(4) + +1: bne,a 1f + cmp %l1, %o0 ! source[1] == targets[6] + RET_START_1_IS_TARGET_(5) + +1: bne,a 1f + cmp %l1, %o1 ! source[1] == targets[7] + RET_START_1_IS_TARGET_(6) + +1: bne,a 1f + cmp %l1, %o2 ! source[1] == targets[8] + RET_START_1_IS_TARGET_(7) + +1: bne,a 1f + cmp %l1, %o3 ! source[1] == targets[9] + RET_START_1_IS_TARGET_(8) + +1: bne,a 1f + cmp %l1, %o4 ! source[1] == targets[10] + RET_START_1_IS_TARGET_(9) + +1: bne,a 1f + cmp %l1, %o5 ! source[1] == targets[11] + RET_START_1_IS_TARGET_(10) + +1: bne,a 1f + cmp %l1, %i2 ! source[1] == targets[12] + RET_START_1_IS_TARGET_(11) + +1: bne,a 1f + cmp %l1, %i4 ! source[1] == targets[13] + RET_START_1_IS_TARGET_(12) + +1: bne,a 1f + cmp %l1, %i5 ! source[1] == targets[14] + RET_START_1_IS_TARGET_(13) + +1: bne,a 1f + ldd [%i0 + 8], %l0 + RET_START_1_IS_TARGET_(14) + +1: inc 8, %i0 +3: cmp %l0, %l2 ! source[0] == targets[0] + bne,a 1f + cmp %l0, %l3 ! source[0] == targets[1] + RET_START_0_IS_TARGET_(0) + +1: bne,a 1f + cmp %l0, %l4 ! source[0] == targets[2] + RET_START_0_IS_TARGET_(1) + +1: bne,a 1f + cmp %l0, %l5 ! source[0] == targets[3] + RET_START_0_IS_TARGET_(2) + +1: bne,a 1f + cmp %l0, %l6 ! source[0] == targets[4] + RET_START_0_IS_TARGET_(3) + +1: bne,a 1f + cmp %l0, %l7 ! source[0] == targets[5] + RET_START_0_IS_TARGET_(4) + +1: bne,a 1f + cmp %l0, %o0 ! source[0] == targets[6] + RET_START_0_IS_TARGET_(5) + +1: bne,a 1f + cmp %l0, %o1 ! source[0] == targets[7] + RET_START_0_IS_TARGET_(6) + +1: bne,a 1f + cmp %l0, %o2 ! source[0] == targets[8] + RET_START_0_IS_TARGET_(7) + +1: bne,a 1f + cmp %l0, %o3 ! source[0] == targets[9] + RET_START_0_IS_TARGET_(8) + +1: bne,a 1f + cmp %l0, %o4 ! source[0] == targets[10] + RET_START_0_IS_TARGET_(9) + +1: bne,a 1f + cmp %l0, %o5 ! source[0] == targets[11] + RET_START_0_IS_TARGET_(10) + +1: bne,a 1f + cmp %l0, %i2 ! source[0] == targets[12] + RET_START_0_IS_TARGET_(11) + +1: bne,a 1f + cmp %l0, %i4 ! source[0] == targets[13] + RET_START_0_IS_TARGET_(12) + +1: bne,a 1f + cmp %l0, %i5 ! source[0] == targets[14] + RET_START_0_IS_TARGET_(13) + +1: bne,a 2b + cmp %l1, %l2 ! source[1] == targets[0] + RET_START_0_IS_TARGET_(14) + ASMEND(vectorfind_next_match_15) diff --git a/vm/src/sparc/memory/enum_sparc.S b/vm/src/sparc/memory/enum_sparc.S index f01e88f1..0bf3b346 100644 --- a/vm/src/sparc/memory/enum_sparc.S +++ b/vm/src/sparc/memory/enum_sparc.S @@ -5,116 +5,174 @@ /* this file contains fast search routines - It attempts to software pipeline to avoid sparc interlocks and - also assumes it can use g2 and g3. + It attempts to software pipeline to avoid sparc interlocks -- dmu */ # include "_enum_sparc.S.incl" -.globl find_prior_reference, find_this_object, find_next_object +# define p %o0 +# define target %o1 /* - oop* find_prior_reference(oop* p, oop target); - oop* find_this_object(oop* p); - oop* find_next_object(oop* p); -*/ + oop* find_prior_reference(oop* middle, oop target) { + for ( ; *middle != target; --middle) continue; + return middle; + } + */ +ASMFUNC(find_prior_reference) + btst 4, p ! 8-aligned? + bnz,a 1f ! if not + dec 4, p ! make it + + ! 8-aligned, must _not_ check p[1] + ld [p], %o4 + cmp %o4, target ! check p[0] + bne,a 1f ! p[0] != target? + dec 8, p ! p -= 2; // previous group of 4 pointers + retl + nop ! found at p[0] + + 1: ! start loop + ldd [p], %o4 + cmp %o5, target ! check p[1] (NB: original middle if unaligned) + + 2: ! loop in groups of 4 pointers + bne,a 1f ! p[1] != target? + cmp %o4, target ! check p[0] + retl + inc 4, p ! found at p[1] -# define p %o0 -# define target %o1 + 1: ldd [p - 8], %o2; + bne,a 1f ! p[0] != target? + cmp %o3, target ! check p[-1] + retl + inc 0, p ! found at p[0] -find_prior_reference: - btst 4, p - bnz,a 1f; sub p, 4, p - ld [p], %o4 - cmp %o4, target - bne,a 1f; sub p, 8, p - retl; nop + 1: bne,a 1f ! p[-1] != target? + dec 16, p ! p -= 4; // previous group of 4 pointers + retl + inc -4, p ! found at p[-1] - 1: ! start loop - ldd [p], %o4 - cmp %o5, target - 2: ! loop - bne,a 1f; cmp %o4, target - retl; add p, 4, p + 1: ldd [p], %o4 ! NB: new p + cmp %o2, target ! check (old) p[-2] + bne,a 2b ! p[-2] != target? + cmp %o5, target ! check (new) p[1] + retl ! found at p[-2] + inc 8, p ! +8 not -8 cause p already decremented - 1: ldd [p - 8], %o2; - bne,a 1f; cmp %o3, target - retl; add p, 0, p + ASMEND(find_prior_reference) - 1: bne,a 1f; sub p, 16, p - retl; add p, -4, p - 1: ldd [p], %o4 - cmp %o2, target - bne,a 2b; cmp %o5, target - retl; add p, 8, p - ! + 8 not -8 cause p already decremented -find_this_object: - btst 4, p - bnz,a 1f; sub p, 4, p +/* + oop* find_this_object(oop* middle) { + for ( ; !(*middle)->is_mark(); --middle) continue; + return middle; + } + */ +ASMFUNC(find_this_object) + btst 4, p ! 8-aligned? + bnz,a 1f ! if not + dec 4, p ! make it + + ! 8-aligned, must _not_ check p[1] ld [p], %o4 - and %o4, Tag_Mask, %o1 + and %o4, Tag_Mask, %o1 ! check p[0] cmp %o1, Mark_Tag - bne,a 1f; sub p, 8, p - retl; nop + bne,a 1f ! not p[0]->is_mark()? + dec 8, p ! p -= 2; // previous group of 4 + retl + nop ! found at p[0] - 1: ! start loop + 1: ! start loop ldd [p], %o4 - and %o5, Tag_Mask, %o1 - 2: ! loop + and %o5, Tag_Mask, %o1 ! check p[1] (NB: original middle) + + 2: ! loop in groups of 4 pointers cmp %o1, Mark_Tag - bne,a 1f; and %o4, Tag_Mask, %o1 - retl; add p, 4, p + bne,a 1f ! not p[1]->is_mark()? + and %o4, Tag_Mask, %o1 ! check p[0] + retl + inc 4, p ! found at p[1] 1: cmp %o1, Mark_Tag ldd [p - 8], %o2 - bne,a 1f; and %o3, Tag_Mask, %o1 - retl; add p, 0, p + bne,a 1f ! not p[0]->is_mark()? + and %o3, Tag_Mask, %o1 ! check p[-1] + retl + inc 0, p ! found at p[0] 1: cmp %o1, Mark_Tag - bne,a 1f; sub p, 16, p - retl; add p, -4, p + bne,a 1f ! not p[-1]->is_mark()? + dec 16, p ! p -= 4; // previous groups of 4 + retl + inc -4, p ! found at p[-1] - 1: ldd [p], %o4 - and %o2, Tag_Mask, %o1 + 1: ldd [p], %o4 ! NB: new p + and %o2, Tag_Mask, %o1 ! check (old) p[-2] cmp %o1, Mark_Tag - bne,a 2b; and %o5, Tag_Mask, %o1 - retl; add p, 8, p - ! + 8 not -8 cause p already decremented - -find_next_object: - add p,4,p ! Find next object ++p - btst 4, p - be,a 1f; nop + bne,a 2b ! not p[-2]->is_mark()? + and %o5, Tag_Mask, %o1 ! check (new) p[1] + retl ! found at p[-2] + inc 8, p ! +8 not -8 cause p already decremented + + ASMEND(find_this_object) + + + +/* + oop* find_next_object(oop* middle) { + for ( ++middle; !(*middle)->is_mark(); ++middle) continue; + return middle; + } + */ +ASMFUNC(find_next_object) + inc 4, p ! Find next object ++p + btst 4, p ! 8-aligned? + bz,a 1f ! go to the unrolled loop + nop + + ! not 8-aligned ld [p], %o4 - and %o4, Tag_Mask, %o1 + and %o4, Tag_Mask, %o1 ! check p[0] cmp %o1, Mark_Tag - bne,a 1f; add p, 4, p - retl; nop + bne,a 1f ! not p[0]->is_mark()? + inc 4, p ! ++p; // next group of 4 + retl + nop ! found at p[0] - 1: ! start loop double word aligned. + 1: ! start loop ldd [p], %o4 - and %o4, Tag_Mask, %o1 - 2: ! loop + and %o4, Tag_Mask, %o1 ! check p[0] + + 2: ! loop in groups of 4 pointers cmp %o1, Mark_Tag - bne,a 1f; and %o5, Tag_Mask, %o1 - retl; nop + bne,a 1f ! not p[0]->is_mark()? + and %o5, Tag_Mask, %o1 ! check p[1] + retl + nop ! found at p[0] 1: cmp %o1, Mark_Tag ldd [p + 8], %o2 - bne,a 1f; and %o2, Tag_Mask, %o1 - retl; add p, 4, p + bne,a 1f ! not p[1]->is_mark()? + and %o2, Tag_Mask, %o1 ! check p[2] + retl + inc 4, p ! found at p[1] 1: cmp %o1, Mark_Tag - bne,a 1f; add p, 16, p - retl; add p, 8, p + bne,a 1f ! not p[2]->is_mark()? + inc 16, p ! p += 4; // next group of 4 + retl + inc 8, p ! found at p[2] - 1: ldd [p], %o4 - and %o3, Tag_Mask, %o1 + 1: ldd [p], %o4 ! NB: new p + and %o3, Tag_Mask, %o1 ! check (old) p[3] cmp %o1, Mark_Tag - bne,a 2b; and %o4, Tag_Mask, %o1 - retl; sub p, 4, p - ! - 4 not + 12 cause p already incremented + bne,a 2b ! not p[3]->is_mark()? + and %o4, Tag_Mask, %o1 ! check (new) p[0] + retl ! found at p[3] + dec 4, p ! -4 not +12 cause p already incremented + + ASMEND(find_next_object) diff --git a/vm/src/sparc/runtime/asmDefs_gcc_sparc.hh b/vm/src/sparc/runtime/asmDefs_gcc_sparc.hh index a338c3f8..32faf072 100644 --- a/vm/src/sparc/runtime/asmDefs_gcc_sparc.hh +++ b/vm/src/sparc/runtime/asmDefs_gcc_sparc.hh @@ -4,7 +4,32 @@ See the LICENSE file for license information. */ # ifdef sparc - + +/* + * C Compiler Frame SiZe: 16 words to flush a window (ins, locals), + * one word hidden parameter to return aggregates, 6 words for callee + * to store register arguments. Rounded up to doubleword boundary to + * maintain stack alignment. (16 + 1 + 6 + 1) * 4 = 96 + */ +#define CCFSZ 96 + +#define ASMSYM(_Sym, _Type) \ + .globl _Sym; \ + .type _Sym, _Type; \ + _Sym: + +#define ASMFUNC(_Sym) ASMSYM(_Sym, STT_FUNC) +#define ASMOBJ(_Sym) ASMSYM(_Sym, STT_OBJECT) +#define ASMLABEL(_Sym) ASMSYM(_Sym, STT_NOTYPE) + +#define LFUNC(_Sym) \ + .local _Sym; \ + .type _Sym, STT_FUNC; \ + _Sym: + +#define ASMEND(_Sym) .size _Sym, (. - _Sym) + + # define arg0 %o0 # define arg1 %o1 # define arg2 %o2 @@ -13,7 +38,7 @@ # define arg5 %o5 # define receiver arg0 # define result receiver - + # define iarg0 %i0 # define iarg1 %i1 # define iarg2 %i2 @@ -22,7 +47,7 @@ # define iarg5 %i5 # define ireceiver iarg0 # define iresult ireceiver - + # define t %g1 # define t1 %g2 # define t2 %g3 @@ -40,19 +65,17 @@ # define diVerified %g2 # define diRecompileLink %g3 # define recompileLinkReg %g5 - + # define NLRResultReg %g1 # define NLRHomeReg %g2 # define NLRHomeIDReg %g3 # define NLRTempReg %g4 - + /* WARNING THIS IS DUPLICATED IN sendDesc_sparc.h */ # define primitive_end_offset 20 # define non_local_return_offset 12 /* WARNING THIS IS DUPLICATED IN format_sparc.h */ # define current_pc_offset -8 - -# endif - +# endif diff --git a/vm/src/sparc/runtime/runtime_asm_gcc_sparc.S b/vm/src/sparc/runtime/runtime_asm_gcc_sparc.S index a666f131..ebf95f2c 100644 --- a/vm/src/sparc/runtime/runtime_asm_gcc_sparc.S +++ b/vm/src/sparc/runtime/runtime_asm_gcc_sparc.S @@ -6,69 +6,112 @@ # include "_runtime_asm_gcc_sparc.S.incl" // XXX: can't include config.hh here, so FOO_VERSION are not defined -# if defined(__NetBSD__) // TARGET_OS_VERSION == NETBSD_VERSION +# if defined(__NetBSD__) // TARGET_OS_VERSION == NETBSD_VERSION # include # define ST_FLUSH_WINDOWS ST_FLUSHWIN -# elif defined(__svr4__) // TARGET_OS_VERSION == SOLARIS_VERSION +# elif defined(__svr4__) // TARGET_OS_VERSION == SOLARIS_VERSION # undef __cplusplus # include -# else // TARGET_OS_VERSION == SUNOS_VERSION +# else // TARGET_OS_VERSION == SUNOS_VERSION # include # endif -! runtime routines -.global SendMessage_stub, SendMessage_stub_returnPC -.global SendDIMessage_stub -.global ReturnResult_stub -.global ReturnResult_stub_result - -#ifdef SIC_COMPILER -.global HandleUncommonTrap -#endif -.global DIRecompile_stub, DIRecompile_stub_returnPC, Recompile_stub, Recompile_stub_returnPC -.global MakeOld_stub, MakeOld_stub_returnPC, saved_globals, saved_outregs - -.global ReturnTrap, ReturnTrap2, PrimCallReturnTrap, ReturnTrap_returnPC, ReturnTrapNLR_returnPC +!! void HandleReturnTrap(oop result, char* sp, bool nlr, frame* home, int32 homeID); .global HandleReturnTrap -.global ProfilerTrap + #if defined(FAST_COMPILER) || defined(SIC_COMPILER) +!! char* HandleProfilerTrap(char* return_address) .global HandleProfilerTrap #endif -.global ContinueAfterReturnTrap, ContinueNLRAfterReturnTrap -.global ContinueAfterProfilerInterrupt -.global setSPLimitAndContinue, setSPLimitAndContinueEnd, newSPLimit, continuePC -.global processSemaphore -.global EnterSelf, ContinueNLRFromC, DiscardStack, firstSelfFrame_returnPC -.global firstSelfFrameSendDescEnd -.global NLRResultFromC, NLRHomeFromC, NLRHomeIDFromC, capture_NLR_parameters_from_registers -.global Set_Byte_Map_Base, Byte_Map_Base, FlushRegisterWindows_stub -.global FlushInstruction +.global continuePC ! extern char* continuePC; // runtime.cpp +.global newSPLimit ! extern char* newSPLimit; // process.cpp +.global processSemaphore ! extern bool8 processSemaphore; // process.cpp + +/* + * As we are returning up Self stack (NLR returns) + * we might return into C++ (via firstSelfFrame_returnPC in runtime.s). + * Before returning to C++, asm code calls this function, + * which also sets NLRSupport::_have_NLR_through_C flag. + */ +!! oop capture_NLR_parameters_from_registers(oop result, int32 target_frame, int32 target_ID); +.global capture_NLR_parameters_from_registers -.global LowReturnAddress, HighReturnAddress +/* + * These are used for communication with the assembly routine because + * there aren't enough temporary registers to hold all this stuff. + * Don't access these this way from C++; + */ +!! params for ContinueNLRFromC +.global NLRResultFromC ! extern oop NLRResultFromC; +.global NLRHomeFromC ! extern int32 NLRHomeFromC; +.global NLRHomeIDFromC ! extern int32 NLRHomeIDFromC; -.global CallPrimitiveFromInterpreter -.global currentFP, currentFrame, currentReturnAddr -.global SwitchStack0, SwitchStack1, SwitchStack2, SwitchStack3 -.global SwitchStack4 -.global setSPLimit, currentSPLimit, SetSPAndCall - .seg "data" + .data + + !! buffer for saving global regs .align 8 -saved_globals: ! buffer for saving global regs +ASMOBJ(saved_globals) .word 0, 0, 0, 0, 0, 0, 0, 0 -saved_outregs: ! buffer for saving o0..o7 + ASMEND(saved_globals) + +#define SAVE_GLOBALS(_TMP) \ + set saved_globals, _TMP ; \ + std %g0, [_TMP ] ; \ + std %g2, [_TMP + 8] ; \ + std %g4, [_TMP + 16] ; \ + std %g6, [_TMP + 24] + +#define RESTORE_GLOBALS(_TMP) \ + set saved_globals, _TMP ; \ + ldd [_TMP ], %g0 ; \ + ldd [_TMP + 8], %g2 ; \ + ldd [_TMP + 16], %g4 ; \ + ldd [_TMP + 24], %g6 + + + !! buffer for saving o0..o7 + .align 8 +ASMOBJ(saved_outregs) .word 0, 0, 0, 0, 0, 0, 0, 0 - .seg "text" + ASMEND(saved_outregs) + +#define SAVE_OUTS(_TMP) \ + set saved_outregs, _TMP ; \ + std %i0, [_TMP ] ; \ + std %i2, [_TMP + 8] ; \ + std %i4, [_TMP + 16] ; \ + std %i6, [_TMP + 24] + +#define RESTORE_OUTS(_TMP) \ + set saved_outregs, _TMP ; \ + ldd [_TMP ], %i0 ; \ + ldd [_TMP + 8], %i2 ; \ + ldd [_TMP + 16], %i4 + /* don't restore %i6 (FP) and %i7 (retPC) */ + + +/* this choice of temps just matches the existing usage */ +#define SAVE_REGISTERS SAVE_GLOBALS(%l0); SAVE_OUTS(%l1) +#define RESTORE_REGISTERS RESTORE_GLOBALS(%l0); RESTORE_OUTS(%l1) -! arrive here upon inline cache miss -LowReturnAddress: -SendMessage_stub: + .text + +ASMLABEL(LowReturnAddress) + !! SPARC VM uses different calling conventions for primitive + !! (and C) calls as for Self calls, so VM needs to know if a + !! return address is in this zone of [LowReturnAddress, + !! HighReturnAddress] + + + !! arrive here upon inline cache miss +ASMFUNC(SendMessage_stub) #if defined(FAST_COMPILER) || defined(SIC_COMPILER) - save %sp, (16 + 8) * -4, %sp ! make new register window + save %sp, -CCFSZ, %sp ! make new register window mov selector_for_performs, nonvolatile_selector_for_performs ! save sel, next 2 are globals mov delegatee_for_performs, nonvolatile_delegatee_for_performs ! save delegatee mov %sp, arg1 ! lookup frame pointer @@ -76,620 +119,645 @@ SendMessage_stub: mov selector_for_performs, arg3 ! save these mov delegatee_for_performs, arg4 ! two mov iarg1, arg5 ! pass in arg1 to interp assignments -SendMessage_stub_returnPC: - call SendMessage ! call routine to lookup & send message - mov %i7, arg0 ! inline cache addr -! return here + ASMLABEL(SendMessage_stub_returnPC) + call SendMessage ! call routine to lookup & send message + mov %i7, arg0 ! inline cache addr + !! return here mov nonvolatile_selector_for_performs, selector_for_performs ! restore selector_for_performs mov nonvolatile_delegatee_for_performs, delegatee_for_performs ! restore delegatee_for_performs jmp result ! jump to the found method - restore ! pop off frame - + restore #endif + ASMEND(SendMessage_stub) + -! arrive here upon DI parent check failure - -SendDIMessage_stub: + !! arrive here upon DI parent check failure +ASMFUNC(SendDIMessage_stub) #if defined(FAST_COMPILER) || defined(SIC_COMPILER) - save %sp, (16 + 8) * -4, %sp ! make new register window + save %sp, -CCFSZ, %sp ! make new register window mov %sp, arg1 ! lookup frame pointer mov diCache, arg2 ! di cache address mov diVerified, arg3 ! verified parents count mov ireceiver, arg4 ! receiver mov iarg1, arg5 ! arg1 for interp assignments - call SendDIMessage ! call special di lookup routine - mov %i7, arg0 ! inline cache addr + call SendDIMessage ! call special di lookup routine + mov %i7, arg0 ! inline cache addr jmp result ! jump to the found method - restore ! pop off frame + restore #endif + ASMEND(SendDIMessage_stub) - .seg "data" -! a place to hold the result of an access or assignment for the interpreter -! should be a register, but dont have any -- dmu -ReturnResult_stub_result: + + + .data +/* + * a place to hold the result of an access or assignment for the + * interpreter. should be a register, but dont have any -- dmu + */ +ASMOBJ(ReturnResult_stub_result) .word 0 - .seg "text" + ASMEND(ReturnResult_stub_result) -ReturnResult_stub: ! called instead of a real Self method to return a result + .text +ASMFUNC(ReturnResult_stub) ! called instead of a real Self method to return a result sethi %hi(ReturnResult_stub_result), %l0 retl - ld [%l0+%lo(ReturnResult_stub_result)], result - + ld [%l0 + %lo(ReturnResult_stub_result)], result + ASMEND(ReturnResult_stub) #ifdef SIC_COMPILER -HandleUncommonTrap: +ASMFUNC(HandleUncommonTrap) ! save all registers (including outs/globals) and call C handler - save %sp, (16 + 8) * -4, %sp - set saved_globals, %l0 - std %g0, [%l0] ! save global regs - std %g2, [%l0 + 8] - std %g4, [%l0 + 16] - std %g6, [%l0 + 24] - set saved_outregs, %l1 - std %i0, [%l1] ! save out regs - std %i2, [%l1 + 8] - std %i4, [%l1 + 16] - std %i6, [%l1 + 24] - ! make it look as if we were called by Self + save %sp, -CCFSZ, %sp + SAVE_REGISTERS + !! make it look as if we were called by Self sethi %hi(continuePC), %l1 ld [%l1 + %lo(continuePC)], %i7 - st %g0, [%l1 + %lo(continuePC)] ! clear continuePC + clr [%l1 + %lo(continuePC)] sethi %hi(processSemaphore), %o1 mov %i7, %o0 call recompileUncommon - stb %g0, [%o1 + %lo(processSemaphore)] ! clear semaphore - set saved_globals, %l0 ! reload addr just to be sure - ldd [%l0] , %g0 ! restore global regs - ldd [%l0 + 8], %g2 - ldd [%l0 + 16], %g4 - ldd [%l0 + 24], %g6 - set saved_outregs, %l1 ! reload addr just to be sure - ldd [%l1] , %i0 ! restore out regs - ldd [%l1 + 8], %i2 - ldd [%l1 + 16], %i4 - ! dont reload i6/7 = FP/retPC + clrb [%o1 + %lo(processSemaphore)] + RESTORE_REGISTERS jmp result - restore %g0, %g0, %g0 + restore + ASMEND(HandleUncommonTrap) #endif -Recompile_stub: + +ASMFUNC(Recompile_stub) #if defined(FAST_COMPILER) || defined(SIC_COMPILER) - ! called when a normal method''s counter overflows + ! called when a normal method's counter overflows ! called by a count stub or NIC nmethod ! do not overwrite the incoming args! - save %sp, (16 + 8) * -4, %sp ! create temporary frame to save regs - set saved_globals, %l0 - std %g0, [%l0] ! save global regs - std %g2, [%l0 + 8] - std %g4, [%l0 + 16] - std %g6, [%l0 + 24] - set saved_outregs, %l1 - std %i0, [%l1] ! save incoming args - std %i2, [%l1 + 8] - std %i4, [%l1 + 16] - std %i6, [%l1 + 24] + save %sp, -CCFSZ, %sp ! create temporary frame to save regs + SAVE_REGISTERS mov %sp, arg1 ! lookup frame pointer mov ireceiver, arg2 ! receiver - mov %g0, arg3 ! no DI + clr arg3 ! no DI mov recompileLinkReg, arg4 ! nmethod/stub calling us -Recompile_stub_returnPC: - call Recompile ! do the recompilation - mov %i7, arg0 ! inline cache addr - - ! we will only get here if recompilation didn''t replace on stack - set saved_globals, %l0 ! reload addr just to be sure - ldd [%l0] , %g0 ! restore global regs - ldd [%l0 + 8], %g2 - ldd [%l0 + 16], %g4 - ldd [%l0 + 24], %g6 - set saved_outregs, %l1 ! reload addr just to be sure - ldd [%l1] , %i0 ! restore out regs - ldd [%l1 + 8], %i2 - ldd [%l1 + 16], %i4 - ! dont reload i6/7 = FP/retPC + ASMLABEL(Recompile_stub_returnPC) + call Recompile ! do the recompilation + mov %i7, arg0 ! inline cache addr + + ! we will only get here if recompilation didn't replace on stack + RESTORE_REGISTERS jmp result ! jump to the recompiled method - restore %g0, %g0, %g0 ! pop off frame + restore #endif + ASMEND(Recompile_stub) -DIRecompile_stub: + +ASMFUNC(DIRecompile_stub) #if defined(FAST_COMPILER) || defined(SIC_COMPILER) - ! called when a DI method''s counter overflows + ! called when a DI method's counter overflows mov diCache, %l0 ! save DI link mov diVerified, %l1 ! save DI count mov %sp, arg1 ! lookup frame pointer mov ireceiver, arg2 ! receiver mov diRecompileLink, arg3 ! DI method to recompile ! arg4 is ignored for DI recompiles -DIRecompile_stub_returnPC: + ASMLABEL(DIRecompile_stub_returnPC) call Recompile ! do the recompilation - mov %i7, arg0 ! inline cache addr + mov %i7, arg0 ! inline cache addr mov %l0, diCache ! restore DI link mov %l1, diVerified ! restore DI count jmp result ! jump to the recompiled method - restore ! pop off frame + restore #endif + ASMEND(DIRecompile_stub) + -MakeOld_stub: + !! called when a young nmethod's counter overflows + !! called by a count stub + !! do not overwrite the incoming args! +ASMFUNC(MakeOld_stub) #if defined(FAST_COMPILER) || defined(SIC_COMPILER) - ! called when a young nmethod''s counter overflows - ! called by a count stub - ! do not overwrite the incoming args! - save %sp, (16 + 8) * -4, %sp ! create temporary frame to save regs - set saved_globals, %l0 - std %g0, [%l0] ! save global regs - std %g2, [%l0 + 8] - std %g4, [%l0 + 16] - std %g6, [%l0 + 24] - set saved_outregs, %l1 - std %i0, [%l1] ! save incoming args - std %i2, [%l1 + 8] - std %i4, [%l1 + 16] - std %i6, [%l1 + 24] + save %sp, -CCFSZ, %sp ! create temporary frame to save regs + SAVE_REGISTERS mov %sp, arg1 ! lookup frame pointer mov ireceiver, arg2 ! receiver - mov %g0, arg3 ! no DI + clr arg3 ! no DI mov recompileLinkReg, arg4 ! nmethod/stub calling us -MakeOld_stub_returnPC: - call MakeOld ! clear nmethod flag etc. - mov %i7, arg0 ! inline cache addr - - ! just continue - set saved_globals, %l0 ! reload addr just to be sure - ldd [%l0] , %g0 ! restore global regs - ldd [%l0 + 8], %g2 - ldd [%l0 + 16], %g4 - ldd [%l0 + 24], %g6 - set saved_outregs, %l1 ! reload addr just to be sure - ldd [%l1] , %i0 ! restore out regs - ldd [%l1 + 8], %i2 - ldd [%l1 + 16], %i4 - ! dont reload i6/7 = FP/retPC + ASMLABEL(MakeOld_stub_returnPC) + call MakeOld ! clear nmethod flag etc. + mov %i7, arg0 ! inline cache addr + !! just continue + RESTORE_REGISTERS jmp result ! jump to the nmethod - restore %g0, %g0, %g0 ! pop off frame + restore #endif + ASMEND(MakeOld_stub) -EnterSelf: - ! gets receiver, entry point, arg1 in i0, i1, i2 - save %sp, (16 + 8) * -4, %sp ! make new register window - mov %i2, arg1 -firstSelfFrame_returnPC: ! never branch to here, just need to mark this pc for testing - call %i1 - mov %i0, receiver + !! oop EnterSelf(oop recv, char* entryPoint, oop arg1); +ASMFUNC(EnterSelf) + save %sp, -CCFSZ, %sp ! make new register window + mov iarg2, arg1 - ! inline cache + !! never branch to here, just need to mark this pc for testing + ASMLABEL(firstSelfFrame_returnPC) + call iarg1 ! call instruction + mov ireceiver, receiver ! delay slot + !! inline cache .word 0 ! allocated registers - ba,a contNLR - nop + ba,a .LcontNLR ! NLR code, word 1 + nop ! NLR code, word 2 .word 0, 0 ! placeholder for nmlns .word 0 ! placeholder for selector .word 20 ! lookup type = StaticNormalLookupType -firstSelfFrameSendDescEnd: - ret - restore result, %g0, result + ASMLABEL(firstSelfFrameSendDescEnd) ! end of sendDesc + ret + restore result, %g0, result .word 0, 0 ! good bug-catcher -contNLR: - mov NLRHomeReg, arg1 - mov NLRHomeIDReg, arg2 +.LcontNLR: + mov NLRHomeReg, arg1 ! target_frame + mov NLRHomeIDReg, arg2 ! target_ID call capture_NLR_parameters_from_registers - mov NLRResultReg, receiver + mov NLRResultReg, receiver ! result ret ! return to C++ - restore result, %g0, result - -ContinueNLRFromC: ! called by VM - mov receiver, NLRTempReg ! return address + restore result, %g0, result + ASMEND(EnterSelf) + + + + !! oop ContinueNLRFromC(char* addr, bool isInterpreted, bool isSelfIC); +ASMFUNC(ContinueNLRFromC) ! called by VM + mov arg0, NLRTempReg ! return address mov arg1, NLRResultReg ! borrow this global to save interp flag mov arg2, NLRHomeReg ! called from Self ic? (must save) - ! pop VM frames -1: cmp %i7, NLRTempReg ! test ret pc - bne 1b ! loop if not found - restore ! pop another frame + !! pop VM frames +0: cmp %i7, NLRTempReg ! test ret pc + bne 0b ! loop if not found + restore ! pop another frame - tst NLRResultReg ! interp? - beq cont ! no, goto compiled variant - nop + tst NLRResultReg ! isInterpreted? + bz .Lcont ! no, goto compiled variant + nop + !! interpreted, so just return sethi %hi(processSemaphore), NLRTempReg - retl ! interp, so just return - stb %g0, [NLRTempReg + %lo(processSemaphore)] ! clear semaphore + retl + clrb [NLRTempReg + %lo(processSemaphore)] -cont: tst NLRHomeReg ! find out how to return - ! now load NLR params from globals + !! compiled +.Lcont: + tst NLRHomeReg ! isSelfIC? + !! now load NLR params from globals sethi %hi(NLRResultFromC), NLRHomeReg - ld [NLRHomeReg+%lo(NLRResultFromC)], NLRResultReg + ld [NLRHomeReg + %lo(NLRResultFromC)], NLRResultReg sethi %hi(NLRHomeIDFromC), NLRHomeReg - ld [NLRHomeReg+%lo(NLRHomeIDFromC)], NLRHomeIDReg + ld [NLRHomeReg + %lo(NLRHomeIDFromC)], NLRHomeIDReg sethi %hi(NLRHomeFromC), NLRHomeReg - bne contIC - ld [NLRHomeReg+%lo(NLRHomeFromC)], NLRHomeReg + bnz .LcontIC + ld [NLRHomeReg + %lo(NLRHomeFromC)], NLRHomeReg + + !! return thru inline cache of primitive sethi %hi(processSemaphore), NLRTempReg - jmp %o7+8 + non_local_return_offset-primitive_end_offset - stb %g0, [NLRTempReg + %lo(processSemaphore)] ! clear semaphore - ! return thru inline cache of primitive + jmp %o7 + (8 + non_local_return_offset - primitive_end_offset) + clrb [NLRTempReg + %lo(processSemaphore)] nop -contIC: sethi %hi(processSemaphore), NLRTempReg + +.LcontIC: + !! return thru normal inline cache + sethi %hi(processSemaphore), NLRTempReg jmp %o7 + non_local_return_offset - ! return thru normal inline cache - stb %g0, [NLRTempReg + %lo(processSemaphore)] ! clear semaphore + clrb [NLRTempReg + %lo(processSemaphore)] nop + ASMEND(ContinueNLRFromC) -DiscardStack: ! discard entire Self stack (no zapping) -HighReturnAddress: - restore ! pop caller''s frame - sethi %hi(firstSelfFrame_returnPC), NLRTempReg - add NLRTempReg, %lo(firstSelfFrame_returnPC), NLRTempReg -3: cmp %o7, NLRTempReg ! test ret pc - bne 3b ! loop if not found - restore ! pop another frame + !! cf. LowReturnAddress above +ASMLABEL(HighReturnAddress) + !! SPARC VM uses different calling conventions for primitive + !! (and C) calls as for Self calls, so VM needs to know if a + !! return address is in this zone of [LowReturnAddress, + !! HighReturnAddress] - sethi %hi(continue_discard_stack), NLRTempReg ! don''t use call! - jmp NLRTempReg + %lo(continue_discard_stack) ! (it destroys o7) - mov %g0, receiver - .word 0,0 ! should never get here -currentFP: - retl - mov %fp, result - -currentFrame: + !! discard entire Self stack (no zapping) +ASMFUNC(DiscardStack) + restore ! pop caller's frame + set firstSelfFrame_returnPC, NLRTempReg +0: cmp %o7, NLRTempReg ! test ret pc + bne 0b ! loop if not found + restore ! pop another frame + + !! Discarded stack up to and including EnterSelf. The current + !! frame is the one that made the call to EnterSelf, but that + !! might have been not the topmost Self call. Make a trip to + !! C++ to check nesting. + + !! NB: must jump (tail call) to preserve return address in %o7 + sethi %hi(continue_discard_stack), NLRTempReg + jmp NLRTempReg + %lo(continue_discard_stack) + clr result ! XXX??? + .word 0, 0 ! should never get here + ASMEND(DiscardStack) + + +ASMFUNC(currentFP) retl - mov %sp, result + mov %fp, result + ASMEND(currentFP) + -currentReturnAddr: +ASMFUNC(currentFrame) retl - mov %i7, result + mov %sp, result + ASMEND(currentFrame) + -SwitchStack0: ! switch to vm stack -SwitchStack1: -SwitchStack2: -SwitchStack3: -SwitchStack4: +ASMFUNC(currentReturnAddr) + retl + mov %i7, result + ASMEND(currentReturnAddr) + + + +/* + * Switch to VM stack, and call a function with arguments: + * + * char* SwitchStack(char* fn_start, char* newSP, + * void* arg1, ..., void* argN); + * + * Since args are in registers, just use SwitchStack4 that + * passes 4 for all of them. + */ +ASMFUNC(SwitchStack0) +ASMFUNC(SwitchStack1) +ASMFUNC(SwitchStack2) +ASMFUNC(SwitchStack3) +ASMFUNC(SwitchStack4) mov arg1, %sp ! set SP mov arg0, t ! save function pointer mov arg2, arg0 ! copy arguments mov arg3, arg1 mov arg4, arg2 jmp t ! jump to continuation - mov arg5, arg3 + mov arg5, arg3 retl ! return result - nop + nop + ASMEND(SwitchStack4) + ASMEND(SwitchStack3) + ASMEND(SwitchStack2) + ASMEND(SwitchStack1) + ASMEND(SwitchStack0) + -setSPLimit: - mov receiver, splimit +ASMFUNC(setSPLimit) + mov arg0, splimit set saved_globals, %o1 retl - st splimit, [%o1 + splimit_offset] + st splimit, [%o1 + splimit_offset] + ASMEND(setSPLimit) -setSPLimitAndContinue: - ! caution: this is executed in the context of the running - ! program --> don''t touch registers or condition codes - save %sp, (16 + 8) * -4, %sp ! get a new window + +ASMFUNC(setSPLimitAndContinue) + !! caution: this is executed in the context of the running + !! program --> don't touch registers or condition codes + save %sp, -CCFSZ, %sp ! get a new window sethi %hi(continuePC), %l0 - ld [%l0 + %lo(continuePC)], %l1 ! %l1 = continuePC - st %g0, [%l0 + %lo(continuePC)] ! clear continuePC + ld [%l0 + %lo(continuePC)], %l1 ! %l1 = continuePC + clr [%l0 + %lo(continuePC)] sethi %hi(newSPLimit), %l2 ld [%l2 + %lo(newSPLimit)], splimit ! splimit = newSPLimit - st %g0, [%l2 + %lo(newSPLimit)] ! clear newSPLimit + clr [%l2 + %lo(newSPLimit)] set saved_globals, %l3 st splimit, [%l3 + splimit_offset] sethi %hi(processSemaphore), %l3 - stb %g0, [%l3 + %lo(processSemaphore)] ! clear semaphore + clrb [%l3 + %lo(processSemaphore)] jmp %l1 - restore -setSPLimitAndContinueEnd: + restore + ASMLABEL(setSPLimitAndContinueEnd) + ASMEND(setSPLimitAndContinue) + -currentSPLimit: +ASMFUNC(currentSPLimit) retl - mov splimit, %o0 + mov splimit, %o0 + ASMEND(currentSPLimit) -Byte_Map_Base: + +ASMFUNC(Byte_Map_Base) retl - mov byte_map_base, %o0 + mov byte_map_base, %o0 + ASMEND(Byte_Map_Base) + -Set_Byte_Map_Base: - mov receiver, byte_map_base +ASMFUNC(Set_Byte_Map_Base) + mov arg0, byte_map_base set saved_globals, %o1 retl - st byte_map_base, [%o1 + byte_map_base_offset] + st byte_map_base, [%o1 + byte_map_base_offset] + ASMEND(Set_Byte_Map_Base) + -FlushRegisterWindows_stub: +ASMFUNC(FlushRegisterWindows_stub) ta ST_FLUSH_WINDOWS retl - nop + nop + ASMEND(FlushRegisterWindows_stub) -FlushInstruction: - retl - iflush %o0 -SetSPAndCall: - save %sp, (16 + 8) * -4, %sp ! make new register window +ASMFUNC(FlushInstruction) + retl + iflush %o0 + ASMEND(FlushInstruction) + + +/* + * void SetSPAndCall(char** callerSaveAddr, char** calleeSaveAddr, + * bool init, bool8* semaphore, bool8 pcWasSet); + * + * 1. make new stack frame & save all registers in it + * 2. if (callerSaveAddr) store fp, return addr into callerSaveAddr[0], [1]; + * 3. if (!init) restore fp, return addr from calleeSaveAddr[0], [1] + * clear semaphore, restore regs & return to return addr; + * 4. else setup new stack fp,sp starting at calleeSaveAddr[0] + * (ensure trap if return past top) + * clear semaphore, jump to calleeSaveAddr[1]. + */ +ASMFUNC(SetSPAndCall) + save %sp, -CCFSZ, %sp ! make new register window ta ST_FLUSH_WINDOWS ! save registers - tst iarg0 ! save process status? - beq dontSave - mov iarg3, t1 ! save semaphore address + tst iarg0 ! save process status? + bz 0f + mov iarg3, t1 ! get semaphore address st %fp, [iarg0] ! save sp and ret addr of curr proc - add %i7, 8, %i7 - st %i7, [iarg0+4] -dontSave: - tst iarg2 ! init ? - bne initProcess ! yes, initial transfer - mov iarg1, t2 ! get callee save address - - ld [t2+0], %fp ! switch to new stack - ld [t2+4], t ! get pc + inc 8, %i7 ! move past the call's delay slot + st %i7, [iarg0 + 4] +0: + tst iarg2 ! init? + bnz .LinitProcess ! yes, initial transfer + mov iarg1, t2 ! get callee save address + + ld [t2 + 0], %fp ! switch to new stack + ld [t2 + 4], t ! get pc restore ! restore context jmp t ! jump to code of new process - stb %g0, [t1] ! clear semaphore + clrb [t1] ! clear semaphore -initProcess: - ld [t2+0], %sp ! switch to new stack - ld [t2+4], t ! get pc +.LinitProcess: + ld [t2 + 0], %sp ! switch to new stack + ld [t2 + 4], t ! get pc add %sp, 64, %fp ! set up fp - mov %g0, %o7 ! so that ret addr is not random + clr %o7 ! so that ret addr is not random jmp t ! and jump to code of new process - stb %g0, [t1] ! clear semaphore + clrb [t1] ! clear semaphore + ASMEND(SetSPAndCall) -ReturnTrap: - ! this code must look like an inline cache + +ASMFUNC(ReturnTrap) + !! this code must look like an inline cache .word 0 ! call instruction .word 0 ! delay slot .word 0 ! allocated registers - ba convNLR ! NLR code, word 1 - save %sp, (16 + 8) * -4, %sp ! NLR code, word 2 + ba convNLR ! NLR code, word 1 + save %sp, -CCFSZ, %sp ! NLR code, word 2 .word 0, 0 ! nmlns .word 0 ! selector .word 0 ! lookupType nop ! could be delegatee - ! fall through - -ReturnTrap2: ! called via uncommon trap - save %sp, (16 + 8) * -4, %sp ! make new register window - set saved_globals, %l0 - std %g0, [%l0] ! save global regs - std %g2, [%l0 + 8] - std %g4, [%l0 + 16] - std %g6, [%l0 + 24] - set saved_outregs, %l1 - std %i0, [%l1] ! save incoming args - std %i2, [%l1 + 8] - std %i4, [%l1 + 16] - std %i6, [%l1 + 24] -conv: mov %fp, arg1 - mov 0, arg2 ! not a NLR - mov 0, arg3 - mov 0, arg4 -ReturnTrap_returnPC: + !! end of sendDesc + !! fall through + ASMLABEL(ReturnTrap2) ! called via uncommon trap + save %sp, -CCFSZ, %sp ! make new register window + SAVE_REGISTERS +conv: + !! HandleReturnTrap(result, %fp, false, NULL, 0) + mov %fp, arg1 ! sp + mov 0, arg2 ! NLR = false + mov 0, arg3 ! home = NULL + mov 0, arg4 ! homeID = 0 + ASMLABEL(ReturnTrap_returnPC) call HandleReturnTrap - mov iresult, arg0 ! result of returning method + mov iresult, arg0 ! result of returning method .word 0,0 ! should never return convNLR: - set saved_globals, %l0 - std %g0, [%l0] ! save global regs - std %g2, [%l0 + 8] - std %g4, [%l0 + 16] - std %g6, [%l0 + 24] - set saved_outregs, %l1 - std %i0, [%l1] ! save incoming args - std %i2, [%l1 + 8] - std %i4, [%l1 + 16] - std %i6, [%l1 + 24] - mov %fp, arg1 - mov 1, arg2 ! is a NLR - mov NLRHomeReg, arg3 - mov NLRHomeIDReg, arg4 -ReturnTrapNLR_returnPC: + !! HandleReturnTrap(result, %fp, true, NLRHomeReg, NLRHomeIDReg) + SAVE_REGISTERS + mov %fp, arg1 ! sp + mov 1, arg2 ! NLR = true + mov NLRHomeReg, arg3 ! home + mov NLRHomeIDReg, arg4 ! homeID + ASMLABEL(ReturnTrapNLR_returnPC) call HandleReturnTrap - mov NLRResultReg, receiver + mov NLRResultReg, receiver ! result .word 0,0 ! should never return + ASMEND(ReturnTrap) + -ProfilerTrap: +ASMLABEL(ProfilerTrap) #if defined(FAST_COMPILER) || defined(SIC_COMPILER) - ! this code must look like an inline cache + !! this code must look like an inline cache .word 0 ! call instruction .word 0 ! delay slot .word 0 ! allocated registers - ba returnProfilerNLR ! NLR code, word 1 - nop ! NLR code, word 2 + ba returnProfilerNLR ! NLR code, word 1 + nop ! NLR code, word 2 .word 0, 0 ! nmlns .word 0 ! selector .word 0 ! lookupType nop ! could be delegatee - ! end of sendDesc - ! Call char* HandleProfilerTrap(char* return_address) in frame.c - ld [%fp+current_pc_offset], t1 - save %sp, (16 + 8) * -4, %sp ! make new register window + !! end of sendDesc + !! Call char* HandleProfilerTrap(char* return_address) in frame.cpp + ld [%fp + current_pc_offset], t1 + save %sp, -CCFSZ, %sp ! make new register window mov t1, arg0 call HandleProfilerTrap - nop - mov arg0, t2 + nop + !! jump to the result of C call + mov result, t2 mov t1, arg0 - ! jump to the result of C call jmp t2 - restore + restore nop .word 0,0 ! should never return sethi %hi(processSemaphore), %g1 - stb %g0, [%g1 + %lo(processSemaphore)] ! clear semaphore + clrb [%g1 + %lo(processSemaphore)] #endif - returnProfilerNLR: - ! Retrieve the real return address from the frame and - ! return to the non local return point - ld [%fp+current_pc_offset], %o7 - jmp %o7+non_local_return_offset - nop + !! Retrieve the real return address from the frame and + !! return to the non local return point + ld [%fp + current_pc_offset], %o7 + jmp %o7 + non_local_return_offset + nop .word 0,0 + ASMEND(ProfilerTrap) - -PrimCallReturnTrap: ! normal return point for prims - ! this code must look like a primitive call - ! better to keep this separate because of different NLR offset - ba convNLR ! NLR code, word 1 - save %sp, (16 + 8) * -4, %sp ! NLR code, word 2 + !! normal return point for prims +ASMFUNC(PrimCallReturnTrap) + !! this code must look like a primitive call + !! better to keep this separate because of different NLR offset + ba convNLR ! NLR code, word 1 + save %sp, -CCFSZ, %sp ! NLR code, word 2 ba conv - save %sp, (16 + 8) * -4, %sp + save %sp, -CCFSZ, %sp + ASMEND(PrimCallReturnTrap) + -ContinueNLRAfterReturnTrap: +ASMFUNC(ContinueNLRAfterReturnTrap) mov arg2, NLRResultReg ! set up NLR registers mov arg3, NLRHomeReg mov arg4, NLRHomeIDReg - save %sp, (16 + 8) * -4, %sp ! make new register window + save %sp, -CCFSZ, %sp ! make new register window ta ST_FLUSH_WINDOWS ! flush all reg windows mov iarg1, %fp ! set fp (= sp of Self frame above) sub %fp, 64, %sp ! set sp sethi %hi(processSemaphore), %l2 - stb %g0, [%l2 + %lo(processSemaphore)] ! clear semaphore + clrb [%l2 + %lo(processSemaphore)] jmp iarg0 - restore iarg2, %g0, result ! set result + restore iarg2, %g0, result ! set result + ASMEND(ContinueNLRAfterReturnTrap) -ContinueAfterReturnTrap: - save %sp, (16 + 8) * -4, %sp ! make new register window + +ASMFUNC(ContinueAfterReturnTrap) + save %sp, -CCFSZ, %sp ! make new register window ta ST_FLUSH_WINDOWS ! flush all reg windows mov iarg0, %l1 ! save 1st arg (return PC) mov iarg1, %l2 ! save 2nd arg (FP) - set saved_globals, %l0 - ldd [%l0] , %g0 ! restore global regs - ldd [%l0 + 8], %g2 - ldd [%l0 + 16], %g4 - ldd [%l0 + 24], %g6 - set saved_outregs, %l0 - ldd [%l0] , %i0 ! restore o0-o5 of caller - ldd [%l0 + 8], %i2 - ldd [%l0 + 16], %i4 + RESTORE_GLOBALS(%l0) + RESTORE_OUTS(%l0) ! NB: not the usual %l1 like elsewhere mov %l2, %fp ! set fp (= sp of Self frame above) sub %fp, 64, %sp ! set sp sethi %hi(processSemaphore), %l2 - stb %g0, [%l2 + %lo(processSemaphore)] ! clear semaphore + clrb [%l2 + %lo(processSemaphore)] jmp %l1 - restore %g0, %g0, %g0 ! pop stack frame + restore + ASMEND(ContinueAfterReturnTrap) -ContinueAfterProfilerInterrupt: -#if defined(FAST_COMPILER) || defined(SIC_COMPILER) - ! caution: this is executed in the context of the running - ! program --> don''t touch registers or condition codes - save %sp, (16 + 8) * -4, %sp ! get a new window +ASMFUNC(ContinueAfterProfilerInterrupt) +#if defined(FAST_COMPILER) || defined(SIC_COMPILER) + !! caution: this is executed in the context of the running + !! program --> don't touch registers or condition codes + save %sp, -CCFSZ, %sp ! get a new window ta ST_FLUSH_WINDOWS ! flush register windows - ! load continue pc. + !! load continue pc. sethi %hi(continuePC), %l0 - ld [%l0 + %lo(continuePC)], %l1 ! %l1 = continuePC - st %g0, [%l0 + %lo(continuePC)] ! clear continuePC + ld [%l0 + %lo(continuePC)], %l1 ! %l1 = continuePC + clr [%l0 + %lo(continuePC)] - ! load the address of profiler_return_addr (def in nprofiler.c) + !! load the address of profiler_return_addr (def in nprofiler.c) sethi %hi(profiler_return_addr), %l0 - ld [%l0 + %lo(profiler_return_addr)], %l2 ! + ld [%l0 + %lo(profiler_return_addr)], %l2 - ! store the continue pc - st %l1, [%l2+0] + !! store the continue pc + st %l1, [%l2 + 0] - ! store %o7 from previous frame which is %i7 in this frame - st %i7, [%l2+8] + !! store %o7 from previous frame which is %i7 in this frame + st %i7, [%l2 + 8] - ! store %i7 from the previous frame - ld [%fp+60], %l3 - st %l3, [%l2+16] + !! store %i7 from the previous frame + ld [%fp + 15 * 4], %l3 + st %l3, [%l2 + 16] - ! store %fp - st %fp, [%l2+24] + !! store %fp + st %fp, [%l2 + 24] sethi %hi(processSemaphore), %l3 - stb %g0, [%l3 + %lo(processSemaphore)] ! clear semaphore + clrb [%l3 + %lo(processSemaphore)] - jmp %l1 - restore + jmp %l1 ! continuePC + restore #endif - - -! called with entry point, rcv, argp, arg_count + ASMEND(ContinueAfterProfilerInterrupt) + -CallPrimitiveFromInterpreter: +!! called with entry point, rcv, argp, arg_count +ASMFUNC(CallPrimitiveFromInterpreter) + !! compute the frame size we need subcc %o3, 5, %o4 ! will pass five non-rcv args in reg - blt,a 1f ! if o4 < 0, make it be 0 - clr %o4 ! clear if branch taken - -1: add %o4, (16 + 1 + 6), %o4 ! add extra words for frame - add %o4, 1, %o4 ! round up to even + blt,a 0f ! if o4 < 0, make it be 0 + clr %o4 ! clear if branch taken +0: inc (16 + 1 + 6), %o4 ! add extra words for frame + inc 1, %o4 ! round up to even and %o4, 0xfffffffe, %o4 sll %o4, 2, %o4 ! in bytes - sub %g0, %o4, %o4 ! negative + neg %o4 save %sp, %o4, %sp ! get new window mov %i0, %l0 ! save entry_point mov %i2, %l1 ! save argp mov %i3, %l2 ! save arg count -! setup register args + + !! setup register args mov %i1, %o0 ! setup rcv -! setup args from mem to regs - tst %l2; ble 2f; nop; ld [%l1], %o1; add %l1, 4, %l1; subcc %l2, 1, %l2; - tst %l2; ble 2f; nop; ld [%l1], %o2; add %l1, 4, %l1; subcc %l2, 1, %l2; - tst %l2; ble 2f; nop; ld [%l1], %o3; add %l1, 4, %l1; subcc %l2, 1, %l2; - tst %l2; ble 2f; nop; ld [%l1], %o4; add %l1, 4, %l1; subcc %l2, 1, %l2; - tst %l2; ble 2f; nop; ld [%l1], %o5; add %l1, 4, %l1; subcc %l2, 1, %l2; - tst %l2; ble 2f; - -! setup mem->stack args + !! setup args from mem to regs + tst %l2; ble 2f; nop; ld [%l1], %o1; inc 4, %l1; deccc %l2; + tst %l2; ble 2f; nop; ld [%l1], %o2; inc 4, %l1; deccc %l2; + tst %l2; ble 2f; nop; ld [%l1], %o3; inc 4, %l1; deccc %l2; + tst %l2; ble 2f; nop; ld [%l1], %o4; inc 4, %l1; deccc %l2; + tst %l2; ble 2f; nop; ld [%l1], %o5; inc 4, %l1; deccc %l2; + tst %l2; ble 2f; + + !! setup mem->stack args sll %l2, 2, %l3 ! arg size in bytes add %sp, (16 + 6 + 1) * 4, %l4 ! compute addr of first stack arg ! 16 for regs, 1 for aggr ptr, 6 for reg args into mem - subcc %l3, 4, %l3 -1: ld [%l1+%l3], %l5 ! get arg - st %l5, [%l4+%l3] ! store arg + deccc 4, %l3 +1: ld [%l1 + %l3], %l5 ! get arg from argp[] + st %l5, [%l4 + %l3] ! store arg in our frame bgt,a 1b - subcc %l3, 4, %l3 - -2: call %l0 ! call the prim - nop - mov %o0, %i0 ! return result - ret ! return to interp - restore ! restore frame + deccc 4, %l3 + !! our frame is set up, call the primitive +2: call %l0 + nop + mov result, iresult + ret + restore + ASMEND(CallPrimitiveFromInterpreter) -# ifdef OLD_GCC /* see prim.c */ -.global initializePrimDesc -initializePrimDesc: - save %sp, (16 + 8) * -4, %sp ! get a new window + +# ifdef OLD_GCC /* see prim.c */ +ASMFUNC(initializePrimDesc) + save %sp, -CCFSZ, %sp ! get a new window nop call _GLOBAL_$I$name__8PrimDesc - nop + nop ret - restore + restore + ASMEND(initializePrimDesc) # endif -#if !(defined(__NetBSD__) || defined(__svr4__)) // TARGET_OS_VERSION == SUNOS_VERSION +#if !(defined(__NetBSD__) || defined(__svr4__)) // TARGET_OS_VERSION == SUNOS_VERSION # error wrong. -.global mapToLoad - -#define mapLoad(reg, body) \ -.global CONC(reg,mapLoadHandler); \ -CONC(reg,mapLoadHandler): \ - body \ - -#define doLoad(reg) \ - /* load mapToLoad into reg, then continue at continuePC */ \ - /* CAUTION: do not change any other register! */ \ - save %sp, (16 + 8) * -4, %sp; /* get a new window */ \ - sethi %hi(mapToLoad), %l0; \ - ld [%l0 + %lo(mapToLoad)], %l0;/* load map temporarily into l0 */ \ - sethi %hi(continuePC), %l1; \ - ld [%l1 + %lo(continuePC)], %l2; \ - st %g0, [%l1 + %lo(continuePC)]; \ - sethi %hi(processSemaphore), %l1; \ - stb %g0, [%l1 + %lo(processSemaphore)]; \ - jmpl %l2 + 0, %g0; /* return to normal program */ \ - restore %l0, %g0, reg; /* and set result (map) reg */ \ + +.global mapToLoad ! extern oop mapToLoad; // uncommonBranch_sparc.cpp + +#define mapLoad(_REG, _BODY) \ + ASMFUNC(CONC(_REG,mapLoadHandler)) \ + _BODY + +/* + * load mapToLoad into _REG, then continue at continuePC + * CAUTION: do not change any other register! + */ +#define doLoad(_REG) \ + save %sp, -CCFSZ, %sp ; \ + sethi %hi(mapToLoad), %l0 ; \ + ld [%l0 + %lo(mapToLoad)], %l0 ; \ + sethi %hi(continuePC), %l1 ; \ + ld [%l1 + %lo(continuePC)], %l2 ; \ + clr [%l1 + %lo(continuePC)] ; \ + sethi %hi(processSemaphore), %l1 ; \ + clrb [%l1 + %lo(processSemaphore)] ; \ + jmp %l2 ; \ + restore %l0, %g0, _REG /* set result (map) reg */ mapLoad(G1, doLoad(%g1)) mapLoad(G2, doLoad(%g2)) @@ -720,4 +788,3 @@ mapLoad(I4, doLoad(%i4)) mapLoad(I5, doLoad(%i5)) #endif // SUNOS_VERSION -