- pop %ecx
- pop %eax
- pop %ebp
-#endif
-asm_handle_exception_loop:
- push %ebp
- mov %esp,%ebp
-
- push %eax /* save exception pointer */
- push %ecx /* save exception pc */
-
- call codegen_findmethod /* get the data segment ptr */
- mov %eax,%edx
-
- mov -4(%ebp),%eax
- mov -8(%ebp),%ecx /* could be changed in findmethod */
-
- push %edx /* save data segment pointer */
- push %ebx
- push %esi
- push %edi
-
-ex_stack_loop:
- sub $20,%esp
- mov %eax,(%esp) /* exception pointer */
- mov MethodPointer(%edx),%eax /* method pointer */
- mov %eax,4(%esp)
- mov %ecx,8(%esp) /* exception pc */
- movl $0,12(%esp) /* line number */
- movl $1,16(%esp) /* set no unwind flag */
- call builtin_trace_exception
- add $20,%esp
- mov -12(%ebp),%esi /* %esi = data segment pointer */
- mov ExTableSize(%esi),%ecx /* %ecx = exception table size */
- test %ecx,%ecx /* if empty table skip */
- je empty_table
-
- lea ExTableStart(%esi),%edi /* %edi = start of exception table*/
- mov -4(%ebp),%eax /* get xptr */
-
-ex_table_loop:
- mov -8(%ebp),%edx /* get xpc */
-
- mov ExStartPC(%edi),%ebx /* %ebx = exception start pc */
- cmp %edx,%ebx /* %ebx = (startpc <= xpc) */
- jg ex_table_cont /* if (false) continue */
- mov ExEndPC(%edi),%ebx /* %ebx = exception end pc */
- cmp %ebx,%edx /* %ebx = (xpc < endpc) */
- jge ex_table_cont /* if (false) continue */
- mov ExCatchType(%edi),%ebx /* arg1 = exception catch type */
- test %ebx,%ebx /* NULL catches everything */
- je ex_handle_it
-
- cmpl $0,offclassloaded(%ebx) /* check if class is loaded */
- jne L_class_loaded
-
- sub $3*4,%esp
- mov %eax,1*4(%esp) /* save not callee saved regs */
- mov %ecx,2*4(%esp)
-
- mov %ebx,0*4(%esp) /* exception class is argument */
- call class_load
-
- mov 1*4(%esp),%eax
- mov 2*4(%esp),%ecx
- add $3*4,%esp
-
-L_class_loaded:
- cmpl $0,offclasslinked(%ebx)
- jne L_class_linked
-
- sub $3*4,%esp
- mov %eax,1*4(%esp) /* save not callee saved regs */
- mov %ecx,2*4(%esp)
-
- mov %ebx,0*4(%esp) /* exception class is argument */
- call class_link
-
- mov 1*4(%esp),%eax
- mov 2*4(%esp),%ecx
- add $3*4,%esp
-
-L_class_linked:
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
- push %ebx
-
-_crit_restart1:
- mov 0(%esp),%ebx
-#endif
-
-_crit_begin1:
- mov offobjvftbl(%eax),%esi /* %esi = vftblptr(xptr) */
- mov offclassvftbl(%ebx),%ebx /* %ebx = vftblptr(catchtype) class (not obj) */
- mov offbaseval(%esi),%esi /* %esi = baseval(xptr) */
- mov offbaseval(%ebx),%edx /* %edx = baseval(catchtype) */
- mov offdiffval(%ebx),%ebx /* %ebx = diffval(catchtype) */
-_crit_end1:
- sub %edx,%esi /* %esi = baseval(xptr) - baseval(catchtype) */
-
-#if defined(USE_THREADS) && defined(NATIVE_THREADS)
- add $4,%esp
-#endif
-
- cmp %ebx,%esi /* xptr is instanceof catchtype */
- ja ex_table_cont
-
-ex_handle_it:
- mov ExHandlerPC(%edi),%edx
-
- pop %edi /* restore registers */
- pop %esi
- pop %ebx
- add $8,%esp /* suck %ecx, %edx */
- pop %eax /* restore xptr */
-
- leave
- jmp *%edx /* jump to exception handler */
-
-ex_table_cont:
- lea ExEntrySize(%edi),%edi
- dec %ecx
- test %ecx,%ecx
- jg ex_table_loop
-
-empty_table:
- pop %edi
- pop %esi
- pop %ebx
- pop %edx /* restore data segment pointer */
- pop %ecx
- pop %eax
- pop %ebp
-
- push %eax /* save exception pointer */
-
-ex_already_cleared:
- mov IsSync(%edx),%eax /* %eax = SyncOffset */
- test %eax,%eax /* if zero no monitorexit */
- je no_monitor_exit
-
- add %esp,%eax
- mov -4(%eax),%eax /* we have the xptr on the stack */
- push %edx /* save regs */
- push %eax
- call builtin_monitorexit
- add $4,%esp
- pop %edx /* restore regs */
-
-no_monitor_exit:
- mov %esp,%eax
- add FrameSize(%edx),%eax /* %eax = frame size */
- add $4,%eax /* we have the xptr on the stack */
-
- mov IntSave(%edx),%ecx /* %ecx = saved int register count*/
- test %ecx,%ecx
- je noint
- cmp $1,%ecx
- je int1
- cmp $2,%ecx
- je int2
- cmp $3,%ecx
- je int3
-
-int4:
- mov -32(%eax),%ebx
-
-int3:
- mov -24(%eax),%ebp