1 /* src/vm/jit/i386/patcher.c - i386 code patching functions
3 Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4 R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5 C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6 Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25 Contact: cacao@complang.tuwien.ac.at
27 Authors: Christian Thalinger
31 $Id: patcher.c 2536 2005-05-31 15:53:36Z twisti $
36 #include "vm/jit/i386/types.h"
37 #include "vm/builtin.h"
39 #include "vm/initialize.h"
40 #include "vm/options.h"
41 #include "vm/references.h"
42 #include "vm/jit/helper.h"
43 #include "vm/jit/patcher.h"
46 /* patcher_get_putstatic *******************************************************
50 <patched call position>
51 b8 00 00 00 00 mov $0x00000000,%eax
53 *******************************************************************************/
55 bool patcher_get_putstatic(u1 *sp)
63 /* get stuff from the stack */
65 ra = (u1 *) *((ptrint *) (sp + 4 * 4));
66 o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
67 mcode = *((u8 *) (sp + 1 * 4));
68 uf = (unresolved_field *) *((ptrint *) (sp + 0 * 4));
70 /* calculate and set the new return address */
73 *((ptrint *) (sp + 4 * 4)) = (ptrint) ra;
77 /* get the fieldinfo */
79 if (!(fi = helper_resolve_fieldinfo(uf))) {
85 /* check if the field's class is initialized */
87 if (!fi->class->initialized) {
88 if (!initialize_class(fi->class)) {
95 /* patch back original code */
99 /* if we show disassembly, we have to skip the nop's */
104 /* patch the field value's address */
106 *((ptrint *) (ra + 1)) = (ptrint) &(fi->value);
108 PATCHER_MARK_PATCHED_MONITOREXIT;
114 /* patcher_getfield ************************************************************
118 <patched call position>
119 8b 88 00 00 00 00 mov 0x00000000(%eax),%ecx
121 *******************************************************************************/
123 bool patcher_getfield(u1 *sp)
126 java_objectheader *o;
128 unresolved_field *uf;
131 /* get stuff from the stack */
133 ra = (u1 *) *((ptrint *) (sp + 4 * 4));
134 o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
135 mcode = *((u8 *) (sp + 1 * 4));
136 uf = (unresolved_field *) *((ptrint *) (sp + 0 * 4));
138 /* calculate and set the new return address */
141 *((ptrint *) (sp + 4 * 4)) = (ptrint) ra;
143 PATCHER_MONITORENTER;
145 /* get the fieldinfo */
147 if (!(fi = helper_resolve_fieldinfo(uf))) {
153 /* patch back original code */
155 *((u8 *) ra) = mcode;
157 /* if we show disassembly, we have to skip the nop's */
162 /* patch the field's offset */
164 *((u4 *) (ra + 2)) = (u4) (fi->offset);
166 /* if the field has type long, we need to patch the second move too */
168 if (fi->type == TYPE_LNG)
169 *((u4 *) (ra + 6 + 2)) = (u4) (fi->offset + 4);
171 PATCHER_MARK_PATCHED_MONITOREXIT;
177 /* patcher_putfield ************************************************************
181 <patched call position>
182 8b 88 00 00 00 00 mov 0x00000000(%eax),%ecx
184 *******************************************************************************/
186 bool patcher_putfield(u1 *sp)
189 java_objectheader *o;
191 unresolved_field *uf;
194 /* get stuff from the stack */
196 ra = (u1 *) *((ptrint *) (sp + 4 * 4));
197 o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
198 mcode = *((u8 *) (sp + 1 * 4));
199 uf = (unresolved_field *) *((ptrint *) (sp + 0 * 4));
201 /* calculate and set the new return address */
204 *((ptrint *) (sp + 4 * 4)) = (ptrint) ra;
206 PATCHER_MONITORENTER;
208 /* get the fieldinfo */
210 if (!(fi = helper_resolve_fieldinfo(uf))) {
216 /* patch back original code */
218 *((u8 *) ra) = mcode;
220 /* if we show disassembly, we have to skip the nop's */
225 /* patch the field's offset */
227 if (fi->type != TYPE_LNG) {
228 *((u4 *) (ra + 2)) = (u4) (fi->offset);
231 /* long code is very special:
233 * 8b 8c 24 00 00 00 00 mov 0x00000000(%esp),%ecx
234 * 8b 94 24 00 00 00 00 mov 0x00000000(%esp),%edx
235 * 89 8d 00 00 00 00 mov %ecx,0x00000000(%ebp)
236 * 89 95 00 00 00 00 mov %edx,0x00000000(%ebp)
239 *((u4 *) (ra + 7 + 7 + 2)) = (u4) (fi->offset);
240 *((u4 *) (ra + 7 + 7 + 6 + 2)) = (u4) (fi->offset + 4);
243 PATCHER_MARK_PATCHED_MONITOREXIT;
249 /* patcher_putfieldconst *******************************************************
253 <patched call position>
254 c7 85 00 00 00 00 7b 00 00 00 movl $0x7b,0x0(%ebp)
256 *******************************************************************************/
258 bool patcher_putfieldconst(u1 *sp)
261 java_objectheader *o;
263 unresolved_field *uf;
266 /* get stuff from the stack */
268 ra = (u1 *) *((ptrint *) (sp + 4 * 4));
269 o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
270 mcode = *((u8 *) (sp + 1 * 4));
271 uf = (unresolved_field *) *((ptrint *) (sp + 0 * 4));
273 /* calculate and set the new return address */
276 *((ptrint *) (sp + 4 * 4)) = (ptrint) ra;
278 PATCHER_MONITORENTER;
280 /* get the fieldinfo */
282 if (!(fi = helper_resolve_fieldinfo(uf))) {
288 /* patch back original code */
290 *((u8 *) ra) = mcode;
292 /* if we show disassembly, we have to skip the nop's */
297 /* patch the field's offset */
299 if (!IS_2_WORD_TYPE(fi->type)) {
300 *((u4 *) (ra + 2)) = (u4) (fi->offset);
303 /* long/double code is different:
305 * c7 80 00 00 00 00 c8 01 00 00 movl $0x1c8,0x0(%eax)
306 * c7 80 04 00 00 00 00 00 00 00 movl $0x0,0x4(%eax)
309 *((u4 *) (ra + 2)) = (u4) (fi->offset);
310 *((u4 *) (ra + 10 + 2)) = (u4) (fi->offset + 4);
313 PATCHER_MARK_PATCHED_MONITOREXIT;
319 /* patcher_builtin_new *********************************************************
323 c7 04 24 00 00 00 00 movl $0x0000000,(%esp)
324 <patched call postition>
325 b8 00 00 00 00 mov $0x0000000,%eax
328 *******************************************************************************/
330 bool patcher_builtin_new(u1 *sp)
333 java_objectheader *o;
335 constant_classref *cr;
338 /* get stuff from the stack */
340 ra = (u1 *) *((ptrint *) (sp + 4 * 4));
341 o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
342 mcode = *((u8 *) (sp + 1 * 4));
343 cr = (constant_classref *) *((ptrint *) (sp + 0 * 4));
345 /* calculate and set the new return address */
348 *((ptrint *) (sp + 4 * 4)) = (ptrint) ra;
350 PATCHER_MONITORENTER;
352 /* get the classinfo */
354 if (!(c = helper_resolve_classinfo(cr))) {
360 /* patch back original code */
362 *((u8 *) (ra + 7)) = mcode;
364 /* patch the classinfo pointer */
366 *((ptrint *) (ra + 3)) = (ptrint) c;
368 /* if we show disassembly, we have to skip the nop's */
373 /* patch new function address */
375 *((ptrint *) (ra + 7 + 1)) = (ptrint) BUILTIN_new;
377 PATCHER_MARK_PATCHED_MONITOREXIT;
383 /* patcher_builtin_newarray ****************************************************
387 c7 44 24 08 00 00 00 00 movl $0x00000000,0x8(%esp)
388 <patched call position>
389 b8 00 00 00 00 mov $0x00000000,%eax
392 *******************************************************************************/
394 bool patcher_builtin_newarray(u1 *sp)
397 java_objectheader *o;
399 constant_classref *cr;
402 /* get stuff from the stack */
404 ra = (u1 *) *((ptrint *) (sp + 4 * 4));
405 o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
406 mcode = *((u8 *) (sp + 1 * 4));
407 cr = (constant_classref *) *((ptrint *) (sp + 0 * 4));
409 /* calculate and set the new return address */
412 *((ptrint *) (sp + 4 * 4)) = (ptrint) ra;
414 PATCHER_MONITORENTER;
416 /* get the classinfo */
418 if (!(c = helper_resolve_classinfo(cr))) {
424 /* patch back original code */
426 *((u8 *) (ra + 8)) = mcode;
428 /* patch the class' vftbl pointer */
430 *((ptrint *) (ra + 4)) = (ptrint) c->vftbl;
432 /* if we show disassembly, we have to skip the nop's */
437 /* patch new function address */
439 *((ptrint *) (ra + 8 + 1)) = (ptrint) BUILTIN_newarray;
441 PATCHER_MARK_PATCHED_MONITOREXIT;
447 /* patcher_builtin_multianewarray **********************************************
451 <patched call position>
452 c7 04 24 02 00 00 00 movl $0x2,(%esp)
453 c7 44 24 04 00 00 00 00 movl $0x00000000,0x4(%esp)
455 83 c0 0c add $0xc,%eax
456 89 44 24 08 mov %eax,0x8(%esp)
457 b8 00 00 00 00 mov $0x00000000,%eax
460 *******************************************************************************/
462 bool patcher_builtin_multianewarray(u1 *sp)
465 java_objectheader *o;
467 constant_classref *cr;
470 /* get stuff from the stack */
472 ra = (u1 *) *((ptrint *) (sp + 4 * 4));
473 o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
474 mcode = *((u8 *) (sp + 1 * 4));
475 cr = (constant_classref *) *((ptrint *) (sp + 0 * 4));
477 /* calculate and set the new return address */
480 *((ptrint *) (sp + 4 * 4)) = (ptrint) ra;
482 PATCHER_MONITORENTER;
484 /* get the classinfo */
486 if (!(c = helper_resolve_classinfo(cr))) {
492 /* patch back original code */
494 *((u8 *) ra) = mcode;
496 /* if we show disassembly, we have to skip the nop's */
501 /* patch the class' vftbl pointer */
503 *((ptrint *) (ra + 7 + 4)) = (ptrint) c->vftbl;
505 /* patch new function address */
507 *((ptrint *) (ra + 7 + 8 + 2 + 3 + 4 + 1)) = (ptrint) BUILTIN_multianewarray;
509 PATCHER_MARK_PATCHED_MONITOREXIT;
515 /* patcher_builtin_arraycheckcast **********************************************
519 c7 44 24 08 00 00 00 00 movl $0x00000000,0x8(%esp)
520 <patched call position>
521 b8 00 00 00 00 mov $0x00000000,%eax
524 *******************************************************************************/
526 bool patcher_builtin_arraycheckcast(u1 *sp)
529 java_objectheader *o;
531 constant_classref *cr;
534 /* get stuff from the stack */
536 ra = (u1 *) *((ptrint *) (sp + 4 * 4));
537 o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
538 mcode = *((u8 *) (sp + 1 * 4));
539 cr = (constant_classref *) *((ptrint *) (sp + 0 * 4));
541 /* calculate and set the new return address */
544 *((ptrint *) (sp + 4 * 4)) = (ptrint) ra;
546 PATCHER_MONITORENTER;
548 /* get the classinfo */
550 if (!(c = helper_resolve_classinfo(cr))) {
556 /* patch back original code */
558 *((u8 *) (ra + 8)) = mcode;
560 /* patch the class' vftbl pointer */
562 *((ptrint *) (ra + 4)) = (ptrint) c->vftbl;
564 /* if we show disassembly, we have to skip the nop's */
569 /* patch new function address */
571 *((ptrint *) (ra + 8 + 1)) = (ptrint) BUILTIN_arraycheckcast;
573 PATCHER_MARK_PATCHED_MONITOREXIT;
579 /* patcher_builtin_arrayinstanceof *********************************************
583 c7 44 24 08 00 00 00 00 movl $0x00000000,0x8(%esp)
584 <patched call position>
585 b8 00 00 00 00 mov $0x00000000,%eax
588 *******************************************************************************/
590 bool patcher_builtin_arrayinstanceof(u1 *sp)
593 java_objectheader *o;
595 constant_classref *cr;
598 /* get stuff from the stack */
600 ra = (u1 *) *((ptrint *) (sp + 4 * 4));
601 o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
602 mcode = *((u8 *) (sp + 1 * 4));
603 cr = (constant_classref *) *((ptrint *) (sp + 0 * 4));
605 /* calculate and set the new return address */
608 *((ptrint *) (sp + 4 * 4)) = (ptrint) ra;
610 PATCHER_MONITORENTER;
612 /* get the classinfo */
614 if (!(c = helper_resolve_classinfo(cr))) {
620 /* patch back original code */
622 *((u8 *) (ra + 8)) = mcode;
624 /* patch the class' vftbl pointer */
626 *((ptrint *) (ra + 4)) = (ptrint) c->vftbl;
628 /* if we show disassembly, we have to skip the nop's */
633 /* patch new function address */
635 *((ptrint *) (ra + 8 + 1)) = (ptrint) BUILTIN_arrayinstanceof;
637 PATCHER_MARK_PATCHED_MONITOREXIT;
643 /* patcher_invokestatic_special ************************************************
647 <patched call position>
648 b9 00 00 00 00 mov $0x00000000,%ecx
651 *******************************************************************************/
653 bool patcher_invokestatic_special(u1 *sp)
656 java_objectheader *o;
658 unresolved_method *um;
661 /* get stuff from the stack */
663 ra = (u1 *) *((ptrint *) (sp + 4 * 4));
664 o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
665 mcode = *((u8 *) (sp + 1 * 4));
666 um = (unresolved_method *) *((ptrint *) (sp + 0 * 4));
668 /* calculate and set the new return address */
671 *((ptrint *) (sp + 4 * 4)) = (ptrint) ra;
673 PATCHER_MONITORENTER;
675 /* get the fieldinfo */
677 if (!(m = helper_resolve_methodinfo(um))) {
683 /* patch back original code */
685 *((u8 *) ra) = mcode;
687 /* if we show disassembly, we have to skip the nop's */
692 /* patch stubroutine */
694 *((ptrint *) (ra + 1)) = (ptrint) m->stubroutine;
696 PATCHER_MARK_PATCHED_MONITOREXIT;
702 /* patcher_invokevirtual *******************************************************
706 <patched call position>
707 8b 08 mov (%eax),%ecx
708 8b 81 00 00 00 00 mov 0x00000000(%ecx),%eax
711 *******************************************************************************/
713 bool patcher_invokevirtual(u1 *sp)
716 java_objectheader *o;
718 unresolved_method *um;
721 /* get stuff from the stack */
723 ra = (u1 *) *((ptrint *) (sp + 4 * 4));
724 o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
725 mcode = *((u8 *) (sp + 1 * 4));
726 um = (unresolved_method *) *((ptrint *) (sp + 0 * 4));
728 /* calculate and set the new return address */
731 *((ptrint *) (sp + 4 * 4)) = (ptrint) ra;
733 PATCHER_MONITORENTER;
735 /* get the fieldinfo */
737 if (!(m = helper_resolve_methodinfo(um))) {
743 /* patch back original code */
745 *((u8 *) ra) = mcode;
747 /* if we show disassembly, we have to skip the nop's */
752 /* patch vftbl index */
754 *((s4 *) (ra + 2 + 2)) = (s4) (OFFSET(vftbl_t, table[0]) +
755 sizeof(methodptr) * m->vftblindex);
757 PATCHER_MARK_PATCHED_MONITOREXIT;
763 /* patcher_invokeinterface *****************************************************
767 <patched call position>
768 8b 00 mov (%eax),%eax
769 8b 88 00 00 00 00 mov 0x00000000(%eax),%ecx
770 8b 81 00 00 00 00 mov 0x00000000(%ecx),%eax
773 *******************************************************************************/
775 bool patcher_invokeinterface(u1 *sp)
778 java_objectheader *o;
780 unresolved_method *um;
783 /* get stuff from the stack */
785 ra = (u1 *) *((ptrint *) (sp + 4 * 4));
786 o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
787 mcode = *((u8 *) (sp + 1 * 4));
788 um = (unresolved_method *) *((ptrint *) (sp + 0 * 4));
790 /* calculate and set the new return address */
793 *((ptrint *) (sp + 4 * 4)) = (ptrint) ra;
795 PATCHER_MONITORENTER;
797 /* get the fieldinfo */
799 if (!(m = helper_resolve_methodinfo(um))) {
805 /* patch back original code */
807 *((u8 *) ra) = mcode;
809 /* if we show disassembly, we have to skip the nop's */
814 /* patch interfacetable index */
816 *((s4 *) (ra + 2 + 2)) = (s4) (OFFSET(vftbl_t, interfacetable[0]) -
817 sizeof(methodptr) * m->class->index);
819 /* patch method offset */
821 *((s4 *) (ra + 2 + 6 + 2)) =
822 (s4) (sizeof(methodptr) * (m - m->class->methods));
824 PATCHER_MARK_PATCHED_MONITOREXIT;
830 /* patcher_checkcast_instanceof_flags ******************************************
834 <patched call position>
835 b9 00 00 00 00 mov $0x00000000,%ecx
837 *******************************************************************************/
839 bool patcher_checkcast_instanceof_flags(u1 *sp)
842 java_objectheader *o;
844 constant_classref *cr;
847 /* get stuff from the stack */
849 ra = (u1 *) *((ptrint *) (sp + 4 * 4));
850 o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
851 mcode = *((u8 *) (sp + 1 * 4));
852 cr = (constant_classref *) *((ptrint *) (sp + 0 * 4));
854 /* calculate and set the new return address */
857 *((ptrint *) (sp + 4 * 4)) = (ptrint) ra;
859 PATCHER_MONITORENTER;
861 /* get the fieldinfo */
863 if (!(c = helper_resolve_classinfo(cr))) {
869 /* patch back original code */
871 *((u8 *) ra) = mcode;
873 /* if we show disassembly, we have to skip the nop's */
878 /* patch class flags */
880 *((s4 *) (ra + 1)) = (s4) c->flags;
882 PATCHER_MARK_PATCHED_MONITOREXIT;
888 /* patcher_checkcast_instanceof_interface **************************************
892 <patched call position>
893 8b 91 00 00 00 00 mov 0x00000000(%ecx),%edx
894 81 ea 00 00 00 00 sub $0x00000000,%edx
896 0f 8e 00 00 00 00 jle 0x00000000
897 8b 91 00 00 00 00 mov 0x00000000(%ecx),%edx
899 *******************************************************************************/
901 bool patcher_checkcast_instanceof_interface(u1 *sp)
904 java_objectheader *o;
906 constant_classref *cr;
909 /* get stuff from the stack */
911 ra = (u1 *) *((ptrint *) (sp + 4 * 4));
912 o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
913 mcode = *((u8 *) (sp + 1 * 4));
914 cr = (constant_classref *) *((ptrint *) (sp + 0 * 4));
916 /* calculate and set the new return address */
919 *((ptrint *) (sp + 4 * 4)) = (ptrint) ra;
921 PATCHER_MONITORENTER;
923 /* get the fieldinfo */
925 if (!(c = helper_resolve_classinfo(cr))) {
931 /* patch back original code */
933 *((u8 *) ra) = mcode;
935 /* if we show disassembly, we have to skip the nop's */
940 /* patch super class index */
942 *((s4 *) (ra + 6 + 2)) = (s4) c->index;
944 *((s4 *) (ra + 6 + 6 + 2 + 6 + 2)) =
945 (s4) (OFFSET(vftbl_t, interfacetable[0]) -
946 c->index * sizeof(methodptr*));
948 PATCHER_MARK_PATCHED_MONITOREXIT;
954 /* patcher_checkcast_class *****************************************************
958 <patched call position>
959 ba 00 00 00 00 mov $0x00000000,%edx
960 8b 89 00 00 00 00 mov 0x00000000(%ecx),%ecx
961 8b 92 00 00 00 00 mov 0x00000000(%edx),%edx
963 ba 00 00 00 00 mov $0x00000000,%edx
965 *******************************************************************************/
967 bool patcher_checkcast_class(u1 *sp)
970 java_objectheader *o;
972 constant_classref *cr;
975 /* get stuff from the stack */
977 ra = (u1 *) *((ptrint *) (sp + 4 * 4));
978 o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
979 mcode = *((u8 *) (sp + 1 * 4));
980 cr = (constant_classref *) *((ptrint *) (sp + 0 * 4));
982 /* calculate and set the new return address */
985 *((ptrint *) (sp + 4 * 4)) = (ptrint) ra;
987 PATCHER_MONITORENTER;
989 /* get the fieldinfo */
991 if (!(c = helper_resolve_classinfo(cr))) {
997 /* patch back original code */
999 *((u8 *) ra) = mcode;
1001 /* if we show disassembly, we have to skip the nop's */
1003 if (showdisassemble)
1006 /* patch super class' vftbl */
1008 *((ptrint *) (ra + 1)) = (ptrint) c->vftbl;
1009 *((ptrint *) (ra + 5 + 6 + 6 + 2 + 1)) = (ptrint) c->vftbl;
1011 PATCHER_MARK_PATCHED_MONITOREXIT;
1017 /* patcher_instanceof_class ****************************************************
1021 *******************************************************************************/
1023 bool patcher_instanceof_class(u1 *sp)
1026 java_objectheader *o;
1028 constant_classref *cr;
1031 /* get stuff from the stack */
1033 ra = (u1 *) *((ptrint *) (sp + 4 * 4));
1034 o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
1035 mcode = *((u8 *) (sp + 1 * 4));
1036 cr = (constant_classref *) *((ptrint *) (sp + 0 * 4));
1038 /* calculate and set the new return address */
1041 *((ptrint *) (sp + 4 * 4)) = (ptrint) ra;
1043 PATCHER_MONITORENTER;
1045 /* get the fieldinfo */
1047 if (!(c = helper_resolve_classinfo(cr))) {
1048 PATCHER_MONITOREXIT;
1053 /* patch back original code */
1055 *((u8 *) ra) = mcode;
1057 /* if we show disassembly, we have to skip the nop's */
1059 if (showdisassemble)
1062 /* patch super class' vftbl */
1064 *((ptrint *) (ra + 1)) = (ptrint) c->vftbl;
1066 PATCHER_MARK_PATCHED_MONITOREXIT;
1072 /* patcher_clinit **************************************************************
1076 *******************************************************************************/
1078 bool patcher_clinit(u1 *sp)
1081 java_objectheader *o;
1085 /* get stuff from the stack */
1087 ra = (u1 *) *((ptrint *) (sp + 4 * 4));
1088 o = (java_objectheader *) *((ptrint *) (sp + 3 * 4));
1089 mcode = *((u8 *) (sp + 1 * 4));
1090 c = (classinfo *) *((ptrint *) (sp + 0 * 4));
1092 /* calculate and set the new return address */
1095 *((ptrint *) (sp + 4 * 4)) = (ptrint) ra;
1097 PATCHER_MONITORENTER;
1099 /* check if the class is initialized */
1101 if (!c->initialized) {
1102 if (!initialize_class(c)) {
1103 PATCHER_MONITOREXIT;
1109 /* patch back original code */
1111 *((u8 *) ra) = mcode;
1113 PATCHER_MARK_PATCHED_MONITOREXIT;
1120 * These are local overrides for various environment variables in Emacs.
1121 * Please do not remove this and leave it at the end of the file, where
1122 * Emacs will automagically detect them.
1123 * ---------------------------------------------------------------------
1126 * indent-tabs-mode: t
1130 * vim:noexpandtab:sw=4:ts=4: