1 /* jit/i386/asmpart.S - Java-C interface functions for i386
3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
4 Institut f. Computersprachen, TU Wien
5 R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
6 S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
9 This file is part of CACAO.
11 This program is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License as
13 published by the Free Software Foundation; either version 2, or (at
14 your option) any later version.
16 This program is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26 Contact: cacao@complang.tuwien.ac.at
28 Authors: Andreas Krall
32 $Id: asmpart.S 963 2004-03-15 07:37:49Z jowenn $
39 /* data segment offsets */
41 #define MethodPointer -4
47 #define LineNumberTableSize -28
48 #define LineNumberTableStart -32
49 #define ExTableSize -36
50 #define ExTableStart -36
52 #define ExEntrySize -16
55 #define ExHandlerPC -12
56 #define ExCatchType -16
59 #define LineEntrySize -8
66 /********************* exported functions and variables ***********************/
68 .globl has_no_x_instr_set
69 .globl asm_calljavafunction
70 .globl asm_calljavafunction2
71 .globl asm_calljavafunction2long
72 .globl asm_calljavafunction2double
74 .globl asm_call_jit_compiler
75 .globl asm_dumpregistersandcall
76 .globl asm_handle_builtin_exception
77 .globl asm_handle_nat_exception
78 .globl asm_handle_exception
79 .globl asm_check_clinit
80 .globl asm_builtin_checkcast
81 .globl asm_builtin_checkarraycast
82 .globl asm_builtin_newarray
83 .globl asm_builtin_anewarray
84 .globl asm_builtin_newarray_array
85 .globl asm_builtin_aastore
86 .globl asm_builtin_monitorenter
87 .globl asm_builtin_monitorexit
88 .globl asm_builtin_ldiv
89 .globl asm_builtin_lrem
90 .globl asm_builtin_f2i
91 .globl asm_builtin_f2l
92 .globl asm_builtin_d2i
93 .globl asm_builtin_d2l
94 .globl asm_builtin_arrayinstanceof
95 .globl asm_perform_threadswitch
96 .globl asm_initialize_thread_stack
97 .globl asm_switchstackandcall
98 .globl asm_getcallingmethod
99 .globl Java_java_lang_VMSecurityManager_getClassContext
100 .globl Java_java_lang_VMSecurityManager_currentClassLoader
101 .globl asm_builtin_new
102 .globl asm_get_stackTrace
104 /*************************** imported functions *******************************/
107 .globl builtin_monitorexit
108 .globl builtin_throw_exception
109 .globl builtin_trace_exception
110 .globl class_java_lang_Object
112 .globl builtin_asm_createclasscontextarray
113 .globl builtin_asm_getclassloader
114 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
120 /*********************** function has_no_x_instr_set ***************************
122 * determines if the byte support instruction set (21164a and higher) *
125 * Use it on i386 architecture to init the fpu. *
127 *******************************************************************************/
130 finit /* intitialize the fpu */
132 pushl $0x027f /* Round to nearest, 53-bit mode, exceptions masked */
136 xor %eax,%eax /* result code 0 (not used for i386) */
140 /********************* function asm_calljavafunction ***************************
142 * This function calls a Java-method (which possibly needs compilation) *
143 * with up to 4 address parameters. *
145 * This functions calls the JIT-compiler which eventually translates the *
146 * method into machine code. *
149 * javaobject_header *asm_calljavamethod (methodinfo *m, *
150 * void *arg1, void *arg2, void *arg3, void *arg4); *
152 *******************************************************************************/
155 .ascii "calljavafunction\0\0"
158 .long 0 /* catch type all */
159 .long calljava_xhandler /* handler pc */
160 .long calljava_xhandler /* end pc */
161 .long asm_calljavafunction /* start pc */
162 .long 1 /* extable size */
163 .long 0 /* line number table start */
164 .long 0 /* line number table size */
165 .long 0 /* fltsave */
166 .long 0 /* intsave */
169 .long 32 /* frame size */
170 .long 0 /* method pointer (pointer to name) */
172 asm_calljavafunction:
173 push %ebp /* allocate stack space */
176 push %ebx /* save registers */
180 sub $32,%esp /* pass the remaining parameters */
183 mov %edx,28(%esp) /* convert parms to 8 byte */
199 mov 8(%ebp),%eax /* move function pointer to %eax */
201 lea asm_call_jit_compiler,%edx
202 call *%edx /* call JIT compiler */
206 pop %edi /* restore registers */
213 push %eax /* pass exception pointer */
214 call builtin_throw_exception
218 pop %edi /* restore registers */
226 /********************* function asm_calljavafunction ***************************
228 * This function calls a Java-method (which possibly needs compilation) *
229 * with up to 4 address parameters. *
231 * This functions calls the JIT-compiler which eventually translates the *
232 * method into machine code. *
235 * javaobject_header *asm_calljavamethod (methodinfo *m, *
236 * void *arg1, void *arg2, void *arg3, void *arg4); *
238 *******************************************************************************/
241 .ascii "calljavafunction2\0\0"
244 .long 0 /* catch type all */
245 .long calljava_xhandler2 /* handler pc */
246 .long calljava_xhandler2 /* end pc */
247 .long asm_calljavafunction2 /* start pc */
248 .long 1 /* extable size */
249 .long 0 /* line number table start */
250 .long 0 /* line number table size */
251 .long 0 /* fltsave */
252 .long 0 /* intsave */
255 .long 32 /* frame size */
256 .long 0 /* method pointer (pointer to name) */
258 asm_calljavafunction2:
259 asm_calljavafunction2double:
260 asm_calljavafunction2long:
261 push %ebp /* save ebp */
263 mov %esp,%eax /* save stackptr */
266 push %ebx /* save registers */
272 mov sizejniblock*3+offjniitem+4(%ebp),%ebx
274 mov sizejniblock*3+offjniitem(%ebp),%ebx
277 mov sizejniblock*2+offjniitem+4(%ebp),%ebx
279 mov sizejniblock*2+offjniitem(%ebp),%ebx
283 mov sizejniblock+offjniitem+4(%ebp),%ebx
285 mov sizejniblock+offjniitem(%ebp),%ebx
288 mov offjniitem+4(%ebp),%ebx
290 mov offjniitem(%ebp),%ebx
294 mov 8(%ebp),%eax /* move function pointer to %eax */
296 lea asm_call_jit_compiler,%edx
297 call *%edx /* call JIT compiler */
301 pop %edi /* restore registers */
308 push %eax /* pass exception pointer */
309 call builtin_throw_exception
313 pop %edi /* restore registers */
320 /****************** function asm_call_jit_compiler *****************************
322 * invokes the compiler for untranslated JavaVM methods. *
324 * Register R0 contains a pointer to the method info structure (prepared *
325 * by createcompilerstub). Using the return address in R26 and the *
326 * offset in the LDA instruction or using the value in methodptr R28 the *
327 * patching address for storing the method address can be computed: *
329 * method address was either loaded using *
331 * i386_mov_imm_reg(a, REG_ITMP2) ; invokestatic/special *
332 * i386_call_reg(REG_ITMP2) *
336 * i386_mov_membase_reg(REG_SP, 0, REG_ITMP1) ; invokevirtual/interface *
337 * i386_mov_membase_reg(REG_ITMP1, OFFSET(, vftbl), REG_ITMP2) *
338 * i386_mov_membase_reg(REG_ITMP2, OFFSET(vftbl, table[0]) + \ *
339 * sizeof(methodptr) * m->vftblindex, REG_ITMP1) *
340 * i386_call_reg(REG_ITMP1) *
342 * in the static case the method pointer can be computed using the *
343 * return address and the lda function following the jmp instruction *
345 *******************************************************************************/
348 asm_call_jit_compiler:
349 push %ebx /* save register */
352 mov 8(%esp),%ebp /* get return address (2 push) */
353 mov -1(%ebp),%bl /* get function code */
354 cmp $0xd1,%bl /* called with `call *REG_ITMP2' (%ecx)? */
355 jne L_not_static_special
357 sub $6,%ebp /* calculate address of immediate */
358 jmp L_call_jit_compile
360 L_not_static_special:
361 cmp $0xd0,%bl /* called with `call *REG_ITMP1' (%eax) */
362 jne L_not_virtual_interface
364 sub $6,%ebp /* calculate address of offset */
365 mov (%ebp),%ebp /* get offset */
366 add %ecx,%ebp /* add base address to get method address */
367 jmp L_call_jit_compile
369 L_not_virtual_interface: /* a call from asm_calljavafunction */
373 push %ebp /* save address for method pointer */
375 push %eax /* push methodpointer on stack */
379 pop %ebp /* restore address for method pointer */
380 test %ebp,%ebp /* is address == 0 (asm_calljavafunction) */
383 mov %eax,(%ebp) /* and now save the new pointer */
386 pop %ebp /* restore registers */
389 jmp *%eax /* ...and now call the new method */
393 /****************** function asm_dumpregistersandcall **************************
395 * This funtion saves all callee saved registers and calls the function *
396 * which is passed as parameter. *
398 * This function is needed by the garbage collector, which needs to access *
399 * all registers which are stored on the stack. Unused registers are *
400 * cleared to avoid interferances with the GC. *
402 * void asm_dumpregistersandcall (functionptr f); *
404 *******************************************************************************/
406 asm_dumpregistersandcall:
417 mov 4(%ebp),%eax /* load function pointer */
418 call *%eax /* call function */
430 /********************* function asm_handle_exception ***************************
432 * This function handles an exception. It does not use the usual calling *
433 * conventions. The exception pointer is passed in REG_ITMP1 and the *
434 * pc from the exception raising position is passed in REG_ITMP2. It searches *
435 * the local exception table for a handler. If no one is found, it unwinds *
436 * stacks and continues searching the callers. *
438 * void asm_handle_exception (exceptionptr, exceptionpc); *
440 *******************************************************************************/
442 asm_handle_builtin_exception:
443 add $4,%esp /* clear return address of this call */
444 mov (%esp),%eax /* get exceptionptr */
445 leave /* leave builtin function */
446 mov (%esp),%edx /* get exceptionpc */
447 sub $2,%edx /* size of builtin call */
448 jmp asm_handle_exception
450 asm_handle_nat_exception:
451 add $4,%esp /* clear return address of native stub */
453 asm_handle_exception:
457 push %eax /* exception pointer */
458 push %ecx /* excepiton pc */
460 call asm_get_stackTrace
466 asm_handle_exception_loop:
470 push %eax /* save exception pointer */
471 push %ecx /* save exception pc */
473 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
477 call findmethod /* get the data segment ptr */
481 mov -8(%ebp),%ecx /* could be changed in findmethod */
483 push %edx /* save data segment pointer */
490 mov %eax,(%esp) /* exception pointer */
491 mov MethodPointer(%edx),%eax /* method pointer */
493 mov %ecx,8(%esp) /* exception pc */
495 movl $0,12(%esp) /* line number */
497 movl $1,16(%esp) /* set no unwind flag */
498 call builtin_trace_exception
500 mov -12(%ebp),%esi /* %esi = data segment pointer */
501 mov ExTableSize(%esi),%ecx /* %ecx = exception table size */
502 test %ecx,%ecx /* if empty table skip */
505 lea ExTableStart(%esi),%edi /* %edi = start of exception table*/
506 mov -4(%ebp),%eax /* get xptr */
509 mov -8(%ebp),%edx /* get xpc */
511 mov ExStartPC(%edi),%ebx /* %ebx = exception start pc */
512 cmp %edx,%ebx /* %ebx = (startpc <= xpc) */
513 jg ex_table_cont /* if (false) continue */
514 mov ExEndPC(%edi),%ebx /* %ebx = exception end pc */
515 cmp %ebx,%edx /* %ebx = (xpc < endpc) */
516 jge ex_table_cont /* if (false) continue */
517 mov ExCatchType(%edi),%ebx /* arg1 = exception catch type */
518 test %ebx,%ebx /* NULL catches everything */
521 mov offobjvftbl(%eax),%esi /* %esi = vftblptr(xptr) */
522 mov offclassvftbl(%ebx),%ebx /* %ebx = vftblptr(catchtype) class (not obj) */
523 mov offbaseval(%esi),%esi /* %esi = baseval(xptr) */
524 mov offbaseval(%ebx),%edx /* %edx = baseval(catchtype) */
525 mov offdiffval(%ebx),%ebx /* %ebx = diffval(catchtype) */
526 sub %edx,%esi /* %esi = baseval(xptr) - baseval(catchtype) */
527 cmp %ebx,%esi /* xptr is instanceof catchtype */
531 mov ExHandlerPC(%edi),%edx
533 pop %edi /* restore registers */
536 add $8,%esp /* suck %ecx, %edx */
537 pop %eax /* restore xptr */
539 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
544 jmp *%edx /* jump to exception handler */
547 lea ExEntrySize(%edi),%edi
556 pop %edx /* restore data segment pointer */
561 push %eax /* save exception pointer */
564 mov IsSync(%edx),%eax /* %eax = SyncOffset */
565 test %eax,%eax /* if zero no monitorexit */
569 mov -4(%eax),%eax /* we have the xptr on the stack */
570 push %edx /* save regs */
572 call builtin_monitorexit
574 pop %edx /* restore regs */
578 add FrameSize(%edx),%eax /* %eax = frame size */
579 add $4,%eax /* we have the xptr on the stack */
581 mov IntSave(%edx),%ecx /* %ecx = saved int register count*/
603 shl $3,%ecx /* multiply by 8 bytes */
607 mov FltSave(%edx),%ecx /* %ecx = saved flt register count */
634 pop %eax /* restore exception pointer */
636 mov FrameSize(%edx),%ecx /* %ecx = frame size */
637 add %ecx,%esp /* unwind stack */
639 pop %ecx /* the new xpc is return address */
642 jmp asm_handle_exception_loop
645 /********************* function asm_check_clinit *******************************
647 * Does null check and calls monitorenter or throws an exception *
649 *******************************************************************************/
652 mov offclassinit(%eax),%ecx /* get initialized flag */
656 push %eax /* pass classinfo pointer */
657 call class_init /* call class_init function */
661 mov (%esp),%eax /* get return address */
662 sub $12,%eax /* asm_putstatic call code size */
663 movb $0xeb,(%eax) /* jmp rel8 */
664 movl $10,1(%eax) /* 32-bit offset */
668 /********************* function asm_builtin_monitorenter ***********************
670 * Does null check and calls monitorenter or throws an exception *
672 *******************************************************************************/
674 asm_builtin_monitorenter:
676 je nb_monitorenter /* if (null) throw exception */
677 jmp builtin_monitorenter /* else call builtin_monitorenter */
680 popl %ecx /* delete return address */
681 subl $2,%ecx /* faulting address is return adress - 2 */
682 movl proto_java_lang_NullPointerException,%eax
683 jmp asm_handle_exception
686 /********************* function asm_builtin_monitorexit ************************
688 * Does null check and calls monitorexit or throws an exception *
690 *******************************************************************************/
692 asm_builtin_monitorexit:
695 je nb_monitorexit /* if (null) throw exception */
696 push %ecx /* save registers which could be used */
699 call builtin_monitorexit /* else call builtin_monitorenter */
701 pop %edx /* restore registers which could be used */
706 popl %ecx /* delete return address */
707 subl $2,%ecx /* faulting address is return adress - 2 */
708 movl proto_java_lang_NullPointerException,%eax
709 jmp asm_handle_exception
712 /************************ function asm_builtin_ldiv ****************************
714 * Does null check and calls ldiv or throws an exception *
716 *******************************************************************************/
721 test %eax,%eax /* if (null) throw exception */
727 pop %ecx /* delete return address */
728 sub $2,%ecx /* faulting address is return adress - 2 */
729 mov proto_java_lang_ArithmeticException,%eax
730 jmp asm_handle_exception
733 /************************ function asm_builtin_lrem ****************************
735 * Does null check and calls lrem or throws an exception *
737 *******************************************************************************/
742 test %eax,%eax /* if (null) throw exception */
748 pop %ecx /* delete return address */
749 sub $2,%ecx /* faulting address is return adress - 2 */
750 mov proto_java_lang_ArithmeticException,%eax
751 jmp asm_handle_exception
754 /************************ function asm_builtin_x2x *****************************
756 * Wrapper functions for corner cases *
758 *******************************************************************************/
789 /*********************** function new_builtin_checkcast ************************
791 * Does the cast check and eventually throws an exception *
793 *******************************************************************************/
795 asm_builtin_checkcast:
801 /******************* function asm_builtin_checkarraycast ***********************
803 * Does the cast check and eventually throws an exception *
805 *******************************************************************************/
807 asm_builtin_checkarraycast:
808 sub $8,%esp /* build stack frame (2 * 4 bytes) */
810 mov 12(%esp),%eax /* 8 (frame) + 4 (return) */
811 mov %eax,(%esp) /* save object pointer */
816 call builtin_checkarraycast /* builtin_checkarraycast */
818 test %eax,%eax /* if (false) throw exception */
821 mov 12(%esp),%eax /* return object pointer */
828 pop %ecx /* delete return address */
829 sub $2,%ecx /* faulting address is return adress - 2 */
830 mov proto_java_lang_ClassCastException,%eax
831 jmp asm_handle_exception
834 /******************* function asm_builtin_newarray *****************************
836 * Does the cast check and eventually throws an exception *
838 *******************************************************************************/
840 asm_builtin_newarray:
841 sub $8,%esp /* build stack frame (2 * 4 bytes) */
849 call builtin_newarray
855 /******************* function asm_builtin_aastore ******************************
857 * Does the cast check and eventually throws an exception *
859 *******************************************************************************/
862 subl $12,%esp /* build stack frame (3 * 4 bytes) */
864 movl 16(%esp),%eax /* 12 (frame) + 4 (return) */
865 test %eax,%eax /* if null pointer throw exception */
868 movl offarraysize(%eax),%edx /* load size */
869 movl 24(%esp),%ecx /* index */
870 cmpl %edx,%ecx /* do bound check */
871 ja nb_aastore_bound /* if out of bounds throw exception */
873 shll $2,%ecx /* index * 4 */
874 addl %eax,%ecx /* add index * 4 to arrayref */
876 movl %ecx,8(%esp) /* save store position */
878 movl 16(%esp),%eax /* 12 (frame) + 4 (return) */
881 movl 32(%esp),%eax /* object is second argument */
884 call builtin_canstore /* builtin_canstore(arrayref,object) */
886 test %eax,%eax /* if (false) throw exception */
891 movl %eax,offobjarrdata(%ecx)/* store objectptr in array */
898 popl %ecx /* delete return address */
899 subl $2,%ecx /* faulting address is return adress - 2 */
900 movl proto_java_lang_NullPointerException,%eax
901 jmp asm_handle_exception
905 popl %ecx /* delete return address */
906 subl $2,%ecx /* faulting address is return adress - 2 */
907 movl proto_java_lang_ArrayIndexOutOfBoundsException,%eax
908 jmp asm_handle_exception
912 popl %ecx /* delete return address */
913 subl $2,%ecx /* faulting address is return adress - 2 */
914 movl proto_java_lang_ArrayStoreException,%eax
915 jmp asm_handle_exception
918 /******************* function asm_builtin_arrayinstanceof **********************
920 * Does the instanceof check of arrays *
922 *******************************************************************************/
924 asm_builtin_arrayinstanceof:
925 subl $8,%esp /* build stack frame (2 * 4 bytes) */
933 call builtin_arrayinstanceof
939 /******************* function asm_initialize_thread_stack **********************
941 * initialized a thread stack *
942 * (to)->restorePoint = asm_initialize_thread_stack((u1*)(func), (to)->stackEnd)*
944 *******************************************************************************/
946 asm_initialize_thread_stack:
947 movl 8(%esp),%eax /* (to)->stackEnd */
948 subl $36,%eax /* 4 bytes * 8 regs + 4 bytes func */
960 movl 4(%esp),%edx /* save (u1*) (func) */
963 ret /* return restorepoint in %eax */
966 /******************* function asm_perform_threadswitch *************************
968 * void asm_perform_threadswitch (u1 **from, u1 **to, u1 **stackTop); *
970 * performs a threadswitch *
972 *******************************************************************************/
974 asm_perform_threadswitch:
986 movl 36(%esp),%eax /* save current return address */
989 movl 40(%esp),%eax /* first argument **from */
992 movl 48(%esp),%eax /* third argument **stackTop */
995 movl 44(%esp),%eax /* second argument **to */
996 movl 0(%eax),%esp /* load new stack pointer */
1002 /* skip stack pointer */
1007 addl $32,%esp /* leave return address on stack */
1011 /********************* function asm_switchstackandcall *************************
1013 * int asm_switchstackandcall (void *stack, void *func, void **stacktopsave, *
1016 * Switches to a new stack, calls a function and switches back. *
1017 * a0 new stack pointer *
1018 * a1 function pointer *
1019 * a2 pointer to variable where stack top should be stored *
1020 * a3 pointer to user data, is passed to the function *
1022 *******************************************************************************/
1024 asm_switchstackandcall:
1025 movl 4(%esp),%edx /* first argument *stack */
1026 subl $8,%edx /* allocate new stack */
1028 movl (%esp),%eax /* save return address on new stack */
1031 movl %esp,4(%edx) /* save old stack pointer on new stack*/
1033 movl 12(%esp),%eax /* third argument **stacktopsave */
1034 movl %esp,(%eax) /* save old stack pointer to variable */
1036 movl 8(%esp),%eax /* load function pointer */
1037 movl 16(%esp),%ecx /* fourth argument *p */
1039 movl %edx,%esp /* switch to new stack */
1042 movl %ecx,0(%esp) /* pass pointer */
1043 call *%eax /* and call function */
1046 movl (%esp),%edx /* load return address */
1047 movl 4(%esp),%esp /* switch to old stack */
1052 /********************* function asm_getcallingmethod ***************************
1054 * classinfo *asm_getcallingmethod (); *
1056 * goes back stack frames to get the calling method *
1062 *******************************************************************************/
1064 asm_getcallingmethod:
1066 /* movl $0,(%eax) */
1069 Java_java_lang_VMSecurityManager_currentClassLoader:
1070 lea builtin_asm_getclassloader,%eax
1071 push %eax /*store collector function pointer*/
1072 jmp getClassContext_begin
1073 Java_java_lang_VMSecurityManager_getClassContext:
1074 lea builtin_asm_createclasscontextarray,%eax
1075 push %eax /*store collector function pointer*/
1076 getClassContext_begin: /*start the real work*/
1080 sub $68,%esp /*64 memory location without overwriting return adress and collector function adress*/
1081 mov %esp,%ebx /*end of allocated memory block for classpointers is the adress of the working data block +4 */
1082 push $0 /*%esp+32 was native*/
1083 push %eax /*%esp+24 blkbegin*/
1084 push %eax /*%esp+20 currentpos*/
1085 push %ebx /*%esp+16 blkend*/
1087 call builtin_asm_get_threadrootmethod
1088 push %eax /*%esp+12*/
1089 movl 104(%esp),%eax /*(stack contains: threadRootMethod,blkend,blkpos,blkbegin,was native, data(64kB),collector,ret,env,class,frame stack info of stub, we want the frame stack info of thestub*/
1092 push %edx /*esp+8*/ /*position of return address of native stub*/
1093 call builtin_asm_get_stackframeinfo
1094 movl (%eax),%eax /*comment ??*/
1095 push 0(%eax) /*esp+4*/ /*address of frame info block*/
1102 call i386_native_stub_debug
1105 push %edx /*esp+0*/ /*return adress out of native stub*/
1106 call findmethod /*find calling java method, this one is still to be skipped (==SecurityManager.getClassContext (or .currentClassLoader)*/
1110 movl MethodPointer(%eax),%eax
1112 call temporaryGetClassContextHelper
1114 call traverseStackInfo
1119 movl MethodPointer(%eax),%ebx
1120 movl offclassmethodinfo(%ebx),%ecx
1125 mov 8(%esp),%ebx /*pos of return adress */
1126 add FrameSize(%eax),%ebx
1127 add $4,%ebx /*adress of new return adress (out of Securitymanager.*/
1131 /* by now we have skipped this method call*/
1133 getClassContext_next:
1136 movl %eax,(%esp) /*return adress*/
1142 add FrameSize(%eax),%ebx
1144 mov %ebx,8(%esp) /*store adress of next return adress*/
1145 getClassContext_nextRetStored:
1147 mov MethodPointer(%eax),%ecx /*get struct methodinfo*/
1150 je getClassContext_nativeCall
1151 /*save class pointer*/
1153 getClassContext_saveClassPointer:
1154 movl 20(%esp),%ebx /*get temporary memory adress in stack*/
1155 movl offclassmethodinfo(%ecx),%edx /* get class pointer of method*/
1156 movl %edx,(%ebx) /*save */
1157 sub $4,%ebx /*calculate next position */
1158 movl %ebx,20(%esp) /* check if the new adress would overwrite our working data */
1160 je getClassContext_incStack
1161 getClassContext_checkLeave:
1163 cmp 12(%esp),%ecx /*check if we reached the toplevel method of our thread*/
1164 je getClassContext_leave /*yes ->leave*/
1168 call temporaryGetClassContextHelper
1172 jmp getClassContext_next /*continue*/
1175 getClassContext_nativeCall:
1177 movl 4(%esp),%eax /*get top most element on stackframe help information stack*/
1186 je getClassContext_checkLeave
1187 jmp getClassContext_saveClassPointer
1189 getClassContext_incStack:
1190 /*make another 64 in our temporary storage free and store the workingdata */
1192 subl $40,%esp /*should be 32*/
1204 jmp getClassContext_checkLeave /* continue */
1206 getClassContext_leave:
1209 call temporaryGetClassContextHelper*/
1211 /*call collector function with begin/end of temporary classarray*/
1220 /* free stack memory of this function*/
1227 /*optimize a littlebit */
1231 call i386_native_stub_debug
1234 sub $16,%esp /* build stack frame (4 * 4 bytes) */
1239 call builtin_asm_get_stackframeinfo
1269 push %ebp /*(%ebp-4)*/
1272 push %edi /*(%ebp-8)*/
1273 push %esi /*(%ebp-12)*/
1274 push %ebx /*(%ebp-16)*/
1275 call builtin_asm_get_stackframeinfo
1277 pushl 0(%eax) /*(%ebp-20)*/
1279 call builtin_asm_get_threadrootmethod
1280 pushl %eax /*(%ebp-24)*/
1283 asm_get_stackTraceLoop:
1287 pushl $1 /*no indent*/
1292 get_stackTrace_line:
1293 movl LineNumberTableSize(%esi),%ecx
1294 test %ecx,%ecx /* skip if empty line table */
1295 je get_stackTrace_noLineInfo
1297 movl LineNumberTableStart(%esi),%ebx
1299 get_stackTrace_lineLoop:
1300 cmp %edx,LinePC(%ebx)
1301 jg get_stackTrace_nextLineInfo
1303 pushl LineLine(%ebx)
1304 jmp get_stackTrace_cont
1306 get_stackTrace_nextLineInfo:
1307 lea LineEntrySize(%ebx),%ebx
1311 jne get_stackTrace_lineLoop
1313 get_stackTrace_noLineInfo:
1317 get_stackTrace_cont:
1319 pushl MethodPointer(%esi)
1320 pushl $0 /*8(%ebp)*/ /*exception ptr*/
1321 call builtin_trace_exception
1324 movl MethodPointer(%esi),%eax
1327 je get_stackTrace_nat
1330 je get_stackTrace_leave
1332 mov FrameSize(%esi),%eax
1336 jmp asm_get_stackTraceLoop
1342 je get_stackTrace_leave
1349 jmp asm_get_stackTraceLoop
1351 get_stackTrace_leave:
1357 call builtin_stacktrace_copy
1367 * These are local overrides for various environment variables in Emacs.
1368 * Please do not remove this and leave it at the end of the file, where
1369 * Emacs will automagically detect them.
1370 * ---------------------------------------------------------------------
1373 * indent-tabs-mode: t