* trans-intrinsic.c (gfc_conv_intrinsic_sign): New branchless
[official-gcc.git] / libjava / interpret.cc
blobdc63cc868e7a5c227bec27d08c487bfe3125ce71
1 // interpret.cc - Code for the interpreter
3 /* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9 details. */
11 /* Author: Kresten Krab Thorup <krab@gnu.org> */
13 #include <config.h>
14 #include <platform.h>
16 #pragma implementation "java-interp.h"
18 #include <jvm.h>
19 #include <java-cpool.h>
20 #include <java-interp.h>
21 #include <java/lang/System.h>
22 #include <java/lang/String.h>
23 #include <java/lang/Integer.h>
24 #include <java/lang/Long.h>
25 #include <java/lang/StringBuffer.h>
26 #include <java/lang/Class.h>
27 #include <java/lang/reflect/Modifier.h>
28 #include <java/lang/InternalError.h>
29 #include <java/lang/NullPointerException.h>
30 #include <java/lang/ArithmeticException.h>
31 #include <java/lang/IncompatibleClassChangeError.h>
32 #include <java/lang/InstantiationException.h>
33 #include <java/lang/Thread.h>
34 #include <java-insns.h>
35 #include <java-signal.h>
36 #include <java/lang/ClassFormatError.h>
37 #include <execution.h>
38 #include <java/lang/reflect/Modifier.h>
40 #include <gnu/classpath/jdwp/Jdwp.h>
42 #ifdef INTERPRETER
44 // Execution engine for interpreted code.
45 _Jv_InterpreterEngine _Jv_soleInterpreterEngine;
47 #include <stdlib.h>
49 using namespace gcj;
51 static void throw_internal_error (const char *msg)
52 __attribute__ ((__noreturn__));
53 static void throw_incompatible_class_change_error (jstring msg)
54 __attribute__ ((__noreturn__));
55 static void throw_null_pointer_exception ()
56 __attribute__ ((__noreturn__));
58 static void throw_class_format_error (jstring msg)
59 __attribute__ ((__noreturn__));
60 static void throw_class_format_error (const char *msg)
61 __attribute__ ((__noreturn__));
63 #ifdef DIRECT_THREADED
64 // Lock to ensure that methods are not compiled concurrently.
65 // We could use a finer-grained lock here, however it is not safe to use
66 // the Class monitor as user code in another thread could hold it.
67 static _Jv_Mutex_t compile_mutex;
69 void
70 _Jv_InitInterpreter()
72 _Jv_MutexInit (&compile_mutex);
74 #else
75 void _Jv_InitInterpreter() {}
76 #endif
78 // The breakpoint instruction. For the direct threaded case,
79 // _Jv_InterpMethod::compile will initialize breakpoint_insn
80 // the first time it is called.
81 #ifdef DIRECT_THREADED
82 insn_slot _Jv_InterpMethod::bp_insn_slot;
83 pc_t _Jv_InterpMethod::breakpoint_insn = NULL;
84 #else
85 unsigned char _Jv_InterpMethod::bp_insn_opcode
86 = static_cast<unsigned char> (op_breakpoint);
87 pc_t _Jv_InterpMethod::breakpoint_insn = &_Jv_InterpMethod::bp_insn_opcode;
88 #endif
90 extern "C" double __ieee754_fmod (double,double);
92 static inline void dupx (_Jv_word *sp, int n, int x)
94 // first "slide" n+x elements n to the right
95 int top = n-1;
96 for (int i = 0; i < n+x; i++)
98 sp[(top-i)] = sp[(top-i)-n];
101 // next, copy the n top elements, n+x down
102 for (int i = 0; i < n; i++)
104 sp[top-(n+x)-i] = sp[top-i];
108 // Used to convert from floating types to integral types.
109 template<typename TO, typename FROM>
110 static inline TO
111 convert (FROM val, TO min, TO max)
113 TO ret;
114 if (val >= (FROM) max)
115 ret = max;
116 else if (val <= (FROM) min)
117 ret = min;
118 else if (val != val)
119 ret = 0;
120 else
121 ret = (TO) val;
122 return ret;
125 #define PUSHA(V) (sp++)->o = (V)
126 #define PUSHI(V) (sp++)->i = (V)
127 #define PUSHF(V) (sp++)->f = (V)
128 #if SIZEOF_VOID_P == 8
129 # define PUSHL(V) (sp->l = (V), sp += 2)
130 # define PUSHD(V) (sp->d = (V), sp += 2)
131 #else
132 # define PUSHL(V) do { _Jv_word2 w2; w2.l=(V); \
133 (sp++)->ia[0] = w2.ia[0]; \
134 (sp++)->ia[0] = w2.ia[1]; } while (0)
135 # define PUSHD(V) do { _Jv_word2 w2; w2.d=(V); \
136 (sp++)->ia[0] = w2.ia[0]; \
137 (sp++)->ia[0] = w2.ia[1]; } while (0)
138 #endif
140 #define POPA() ((--sp)->o)
141 #define POPI() ((jint) (--sp)->i) // cast since it may be promoted
142 #define POPF() ((jfloat) (--sp)->f)
143 #if SIZEOF_VOID_P == 8
144 # define POPL() (sp -= 2, (jlong) sp->l)
145 # define POPD() (sp -= 2, (jdouble) sp->d)
146 #else
147 # define POPL() ({ _Jv_word2 w2; \
148 w2.ia[1] = (--sp)->ia[0]; \
149 w2.ia[0] = (--sp)->ia[0]; w2.l; })
150 # define POPD() ({ _Jv_word2 w2; \
151 w2.ia[1] = (--sp)->ia[0]; \
152 w2.ia[0] = (--sp)->ia[0]; w2.d; })
153 #endif
155 #define LOADA(I) (sp++)->o = locals[I].o
156 #define LOADI(I) (sp++)->i = locals[I].i
157 #define LOADF(I) (sp++)->f = locals[I].f
158 #if SIZEOF_VOID_P == 8
159 # define LOADL(I) (sp->l = locals[I].l, sp += 2)
160 # define LOADD(I) (sp->d = locals[I].d, sp += 2)
161 #else
162 # define LOADL(I) do { jint __idx = (I); \
163 (sp++)->ia[0] = locals[__idx].ia[0]; \
164 (sp++)->ia[0] = locals[__idx+1].ia[0]; \
165 } while (0)
166 # define LOADD(I) LOADL(I)
167 #endif
169 #define STOREA(I) \
170 do { \
171 DEBUG_LOCALS_INSN(I, 'o'); \
172 locals[I].o = (--sp)->o; \
173 } while(0)
174 #define STOREI(I) \
175 do { \
176 DEBUG_LOCALS_INSN (I, 'i'); \
177 locals[I].i = (--sp)->i; \
178 } while(0)
179 #define STOREF(I) \
180 do { \
181 DEBUG_LOCALS_INSN (I, 'f'); \
182 locals[I].f = (--sp)->f; \
183 } while(0)
184 #if SIZEOF_VOID_P == 8
185 # define STOREL(I) \
186 do { \
187 DEBUG_LOCALS_INSN (I, 'l'); \
188 (sp -= 2, locals[I].l = sp->l); \
189 } while(0)
190 # define STORED(I) \
191 do { \
192 DEBUG_LOCALS_INSN (I, 'd'); \
193 (sp -= 2, locals[I].d = sp->d); \
194 } while(0)
196 #else
197 # define STOREL(I) \
198 do { DEBUG_LOCALS_INSN(I, 'l'); \
199 jint __idx = (I); \
200 locals[__idx+1].ia[0] = (--sp)->ia[0]; \
201 locals[__idx].ia[0] = (--sp)->ia[0]; \
202 } while (0)
203 # define STORED(I) \
204 do { DEBUG_LOCALS_INSN(I, 'd'); \
205 jint __idx = (I); \
206 locals[__idx+1].ia[0] = (--sp)->ia[0]; \
207 locals[__idx].ia[0] = (--sp)->ia[0]; \
208 } while (0)
209 #endif
211 #define PEEKI(I) (locals+(I))->i
212 #define PEEKA(I) (locals+(I))->o
214 #define POKEI(I,V) \
215 DEBUG_LOCALS_INSN(I,'i'); \
216 ((locals+(I))->i = (V))
219 #define BINOPI(OP) { \
220 jint value2 = POPI(); \
221 jint value1 = POPI(); \
222 PUSHI(value1 OP value2); \
225 #define BINOPF(OP) { \
226 jfloat value2 = POPF(); \
227 jfloat value1 = POPF(); \
228 PUSHF(value1 OP value2); \
231 #define BINOPL(OP) { \
232 jlong value2 = POPL(); \
233 jlong value1 = POPL(); \
234 PUSHL(value1 OP value2); \
237 #define BINOPD(OP) { \
238 jdouble value2 = POPD(); \
239 jdouble value1 = POPD(); \
240 PUSHD(value1 OP value2); \
243 static inline jint get1s(unsigned char* loc) {
244 return *(signed char*)loc;
247 static inline jint get1u(unsigned char* loc) {
248 return *loc;
251 static inline jint get2s(unsigned char* loc) {
252 return (((jint)*(signed char*)loc) << 8) | ((jint)*(loc+1));
255 static inline jint get2u(unsigned char* loc) {
256 return (((jint)(*loc)) << 8) | ((jint)*(loc+1));
259 static jint get4(unsigned char* loc) {
260 return (((jint)(loc[0])) << 24)
261 | (((jint)(loc[1])) << 16)
262 | (((jint)(loc[2])) << 8)
263 | (((jint)(loc[3])) << 0);
266 #define SAVE_PC() frame_desc.pc = pc
268 // We used to define this conditionally, depending on HANDLE_SEGV.
269 // However, that runs into a problem if a chunk in low memory is
270 // mapped and we try to look at a field near the end of a large
271 // object. See PR 26858 for details. It is, most likely, relatively
272 // inexpensive to simply do this check always.
273 #define NULLCHECK(X) \
274 do { SAVE_PC(); if ((X)==NULL) throw_null_pointer_exception (); } while (0)
276 // Note that we can still conditionally define NULLARRAYCHECK, since
277 // we know that all uses of an array will first reference the length
278 // field, which is first -- and thus will trigger a SEGV.
279 #ifdef HANDLE_SEGV
280 #define NULLARRAYCHECK(X) SAVE_PC()
281 #else
282 #define NULLARRAYCHECK(X) \
283 do { SAVE_PC(); if ((X)==NULL) { throw_null_pointer_exception (); } } while (0)
284 #endif
286 #define ARRAYBOUNDSCHECK(array, index) \
287 do \
289 if (((unsigned) index) >= (unsigned) (array->length)) \
290 _Jv_ThrowBadArrayIndex (index); \
292 while (0)
294 void
295 _Jv_InterpMethod::run_normal (ffi_cif *,
296 void* ret,
297 ffi_raw * args,
298 void* __this)
300 _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
301 run (ret, args, _this);
304 void
305 _Jv_InterpMethod::run_normal_debug (ffi_cif *,
306 void* ret,
307 ffi_raw * args,
308 void* __this)
310 _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
311 run_debug (ret, args, _this);
314 void
315 _Jv_InterpMethod::run_synch_object (ffi_cif *,
316 void* ret,
317 ffi_raw * args,
318 void* __this)
320 _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
322 jobject rcv = (jobject) args[0].ptr;
323 JvSynchronize mutex (rcv);
325 run (ret, args, _this);
328 void
329 _Jv_InterpMethod::run_synch_object_debug (ffi_cif *,
330 void* ret,
331 ffi_raw * args,
332 void* __this)
334 _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
336 jobject rcv = (jobject) args[0].ptr;
337 JvSynchronize mutex (rcv);
339 run_debug (ret, args, _this);
342 void
343 _Jv_InterpMethod::run_class (ffi_cif *,
344 void* ret,
345 ffi_raw * args,
346 void* __this)
348 _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
349 _Jv_InitClass (_this->defining_class);
350 run (ret, args, _this);
353 void
354 _Jv_InterpMethod::run_class_debug (ffi_cif *,
355 void* ret,
356 ffi_raw * args,
357 void* __this)
359 _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
360 _Jv_InitClass (_this->defining_class);
361 run_debug (ret, args, _this);
364 void
365 _Jv_InterpMethod::run_synch_class (ffi_cif *,
366 void* ret,
367 ffi_raw * args,
368 void* __this)
370 _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
372 jclass sync = _this->defining_class;
373 _Jv_InitClass (sync);
374 JvSynchronize mutex (sync);
376 run (ret, args, _this);
379 void
380 _Jv_InterpMethod::run_synch_class_debug (ffi_cif *,
381 void* ret,
382 ffi_raw * args,
383 void* __this)
385 _Jv_InterpMethod *_this = (_Jv_InterpMethod *) __this;
387 jclass sync = _this->defining_class;
388 _Jv_InitClass (sync);
389 JvSynchronize mutex (sync);
391 run_debug (ret, args, _this);
394 #ifdef DIRECT_THREADED
395 // "Compile" a method by turning it from bytecode to direct-threaded
396 // code.
397 void
398 _Jv_InterpMethod::compile (const void * const *insn_targets)
400 insn_slot *insns = NULL;
401 int next = 0;
402 unsigned char *codestart = bytecode ();
403 unsigned char *end = codestart + code_length;
404 _Jv_word *pool_data = defining_class->constants.data;
406 #define SET_ONE(Field, Value) \
407 do \
409 if (first_pass) \
410 ++next; \
411 else \
412 insns[next++].Field = Value; \
414 while (0)
416 #define SET_INSN(Value) SET_ONE (insn, (void *) Value)
417 #define SET_INT(Value) SET_ONE (int_val, Value)
418 #define SET_DATUM(Value) SET_ONE (datum, Value)
420 // Map from bytecode PC to slot in INSNS.
421 int *pc_mapping = (int *) __builtin_alloca (sizeof (int) * code_length);
422 for (int i = 0; i < code_length; ++i)
423 pc_mapping[i] = -1;
425 for (int i = 0; i < 2; ++i)
427 jboolean first_pass = i == 0;
429 if (! first_pass)
431 insns = (insn_slot *) _Jv_AllocBytes (sizeof (insn_slot) * next);
432 number_insn_slots = next;
433 next = 0;
436 unsigned char *pc = codestart;
437 while (pc < end)
439 int base_pc_val = pc - codestart;
440 if (first_pass)
441 pc_mapping[base_pc_val] = next;
443 java_opcode opcode = (java_opcode) *pc++;
444 // Just elide NOPs.
445 if (opcode == op_nop)
446 continue;
447 SET_INSN (insn_targets[opcode]);
449 switch (opcode)
451 case op_nop:
452 case op_aconst_null:
453 case op_iconst_m1:
454 case op_iconst_0:
455 case op_iconst_1:
456 case op_iconst_2:
457 case op_iconst_3:
458 case op_iconst_4:
459 case op_iconst_5:
460 case op_lconst_0:
461 case op_lconst_1:
462 case op_fconst_0:
463 case op_fconst_1:
464 case op_fconst_2:
465 case op_dconst_0:
466 case op_dconst_1:
467 case op_iload_0:
468 case op_iload_1:
469 case op_iload_2:
470 case op_iload_3:
471 case op_lload_0:
472 case op_lload_1:
473 case op_lload_2:
474 case op_lload_3:
475 case op_fload_0:
476 case op_fload_1:
477 case op_fload_2:
478 case op_fload_3:
479 case op_dload_0:
480 case op_dload_1:
481 case op_dload_2:
482 case op_dload_3:
483 case op_aload_0:
484 case op_aload_1:
485 case op_aload_2:
486 case op_aload_3:
487 case op_iaload:
488 case op_laload:
489 case op_faload:
490 case op_daload:
491 case op_aaload:
492 case op_baload:
493 case op_caload:
494 case op_saload:
495 case op_istore_0:
496 case op_istore_1:
497 case op_istore_2:
498 case op_istore_3:
499 case op_lstore_0:
500 case op_lstore_1:
501 case op_lstore_2:
502 case op_lstore_3:
503 case op_fstore_0:
504 case op_fstore_1:
505 case op_fstore_2:
506 case op_fstore_3:
507 case op_dstore_0:
508 case op_dstore_1:
509 case op_dstore_2:
510 case op_dstore_3:
511 case op_astore_0:
512 case op_astore_1:
513 case op_astore_2:
514 case op_astore_3:
515 case op_iastore:
516 case op_lastore:
517 case op_fastore:
518 case op_dastore:
519 case op_aastore:
520 case op_bastore:
521 case op_castore:
522 case op_sastore:
523 case op_pop:
524 case op_pop2:
525 case op_dup:
526 case op_dup_x1:
527 case op_dup_x2:
528 case op_dup2:
529 case op_dup2_x1:
530 case op_dup2_x2:
531 case op_swap:
532 case op_iadd:
533 case op_isub:
534 case op_imul:
535 case op_idiv:
536 case op_irem:
537 case op_ishl:
538 case op_ishr:
539 case op_iushr:
540 case op_iand:
541 case op_ior:
542 case op_ixor:
543 case op_ladd:
544 case op_lsub:
545 case op_lmul:
546 case op_ldiv:
547 case op_lrem:
548 case op_lshl:
549 case op_lshr:
550 case op_lushr:
551 case op_land:
552 case op_lor:
553 case op_lxor:
554 case op_fadd:
555 case op_fsub:
556 case op_fmul:
557 case op_fdiv:
558 case op_frem:
559 case op_dadd:
560 case op_dsub:
561 case op_dmul:
562 case op_ddiv:
563 case op_drem:
564 case op_ineg:
565 case op_i2b:
566 case op_i2c:
567 case op_i2s:
568 case op_lneg:
569 case op_fneg:
570 case op_dneg:
571 case op_i2l:
572 case op_i2f:
573 case op_i2d:
574 case op_l2i:
575 case op_l2f:
576 case op_l2d:
577 case op_f2i:
578 case op_f2l:
579 case op_f2d:
580 case op_d2i:
581 case op_d2l:
582 case op_d2f:
583 case op_lcmp:
584 case op_fcmpl:
585 case op_fcmpg:
586 case op_dcmpl:
587 case op_dcmpg:
588 case op_monitorenter:
589 case op_monitorexit:
590 case op_ireturn:
591 case op_lreturn:
592 case op_freturn:
593 case op_dreturn:
594 case op_areturn:
595 case op_return:
596 case op_athrow:
597 case op_arraylength:
598 // No argument, nothing else to do.
599 break;
601 case op_bipush:
602 SET_INT (get1s (pc));
603 ++pc;
604 break;
606 case op_ldc:
608 int index = get1u (pc);
609 ++pc;
610 // For an unresolved class we want to delay resolution
611 // until execution.
612 if (defining_class->constants.tags[index] == JV_CONSTANT_Class)
614 --next;
615 SET_INSN (insn_targets[int (op_jsr_w) + 1]);
616 SET_INT (index);
618 else
619 SET_DATUM (pool_data[index].o);
621 break;
623 case op_ret:
624 case op_iload:
625 case op_lload:
626 case op_fload:
627 case op_dload:
628 case op_aload:
629 case op_istore:
630 case op_lstore:
631 case op_fstore:
632 case op_dstore:
633 case op_astore:
634 case op_newarray:
635 SET_INT (get1u (pc));
636 ++pc;
637 break;
639 case op_iinc:
640 SET_INT (get1u (pc));
641 SET_INT (get1s (pc + 1));
642 pc += 2;
643 break;
645 case op_ldc_w:
647 int index = get2u (pc);
648 pc += 2;
649 // For an unresolved class we want to delay resolution
650 // until execution.
651 if (defining_class->constants.tags[index] == JV_CONSTANT_Class)
653 --next;
654 SET_INSN (insn_targets[int (op_jsr_w) + 1]);
655 SET_INT (index);
657 else
658 SET_DATUM (pool_data[index].o);
660 break;
662 case op_ldc2_w:
664 int index = get2u (pc);
665 pc += 2;
666 SET_DATUM (&pool_data[index]);
668 break;
670 case op_sipush:
671 SET_INT (get2s (pc));
672 pc += 2;
673 break;
675 case op_new:
676 case op_getstatic:
677 case op_getfield:
678 case op_putfield:
679 case op_putstatic:
680 case op_anewarray:
681 case op_instanceof:
682 case op_checkcast:
683 case op_invokespecial:
684 case op_invokestatic:
685 case op_invokevirtual:
686 SET_INT (get2u (pc));
687 pc += 2;
688 break;
690 case op_multianewarray:
691 SET_INT (get2u (pc));
692 SET_INT (get1u (pc + 2));
693 pc += 3;
694 break;
696 case op_jsr:
697 case op_ifeq:
698 case op_ifne:
699 case op_iflt:
700 case op_ifge:
701 case op_ifgt:
702 case op_ifle:
703 case op_if_icmpeq:
704 case op_if_icmpne:
705 case op_if_icmplt:
706 case op_if_icmpge:
707 case op_if_icmpgt:
708 case op_if_icmple:
709 case op_if_acmpeq:
710 case op_if_acmpne:
711 case op_ifnull:
712 case op_ifnonnull:
713 case op_goto:
715 int offset = get2s (pc);
716 pc += 2;
718 int new_pc = base_pc_val + offset;
720 bool orig_was_goto = opcode == op_goto;
722 // Thread jumps. We limit the loop count; this lets
723 // us avoid infinite loops if the bytecode contains
724 // such. `10' is arbitrary.
725 int count = 10;
726 while (codestart[new_pc] == op_goto && count-- > 0)
727 new_pc += get2s (&codestart[new_pc + 1]);
729 // If the jump takes us to a `return' instruction and
730 // the original branch was an unconditional goto, then
731 // we hoist the return.
732 opcode = (java_opcode) codestart[new_pc];
733 if (orig_was_goto
734 && (opcode == op_ireturn || opcode == op_lreturn
735 || opcode == op_freturn || opcode == op_dreturn
736 || opcode == op_areturn || opcode == op_return))
738 --next;
739 SET_INSN (insn_targets[opcode]);
741 else
742 SET_DATUM (&insns[pc_mapping[new_pc]]);
744 break;
746 case op_tableswitch:
748 while ((pc - codestart) % 4 != 0)
749 ++pc;
751 jint def = get4 (pc);
752 SET_DATUM (&insns[pc_mapping[base_pc_val + def]]);
753 pc += 4;
755 int low = get4 (pc);
756 SET_INT (low);
757 pc += 4;
758 int high = get4 (pc);
759 SET_INT (high);
760 pc += 4;
762 for (int i = low; i <= high; ++i)
764 SET_DATUM (&insns[pc_mapping[base_pc_val + get4 (pc)]]);
765 pc += 4;
768 break;
770 case op_lookupswitch:
772 while ((pc - codestart) % 4 != 0)
773 ++pc;
775 jint def = get4 (pc);
776 SET_DATUM (&insns[pc_mapping[base_pc_val + def]]);
777 pc += 4;
779 jint npairs = get4 (pc);
780 pc += 4;
781 SET_INT (npairs);
783 while (npairs-- > 0)
785 jint match = get4 (pc);
786 jint offset = get4 (pc + 4);
787 SET_INT (match);
788 SET_DATUM (&insns[pc_mapping[base_pc_val + offset]]);
789 pc += 8;
792 break;
794 case op_invokeinterface:
796 jint index = get2u (pc);
797 pc += 2;
798 // We ignore the next two bytes.
799 pc += 2;
800 SET_INT (index);
802 break;
804 case op_wide:
806 opcode = (java_opcode) get1u (pc);
807 pc += 1;
808 jint val = get2u (pc);
809 pc += 2;
811 // We implement narrow and wide instructions using the
812 // same code in the interpreter. So we rewrite the
813 // instruction slot here.
814 if (! first_pass)
815 insns[next - 1].insn = (void *) insn_targets[opcode];
816 SET_INT (val);
818 if (opcode == op_iinc)
820 SET_INT (get2s (pc));
821 pc += 2;
824 break;
826 case op_jsr_w:
827 case op_goto_w:
829 jint offset = get4 (pc);
830 pc += 4;
831 SET_DATUM (&insns[pc_mapping[base_pc_val + offset]]);
833 break;
835 // Some "can't happen" cases that we include for
836 // error-checking purposes.
837 case op_putfield_1:
838 case op_putfield_2:
839 case op_putfield_4:
840 case op_putfield_8:
841 case op_putfield_a:
842 case op_putstatic_1:
843 case op_putstatic_2:
844 case op_putstatic_4:
845 case op_putstatic_8:
846 case op_putstatic_a:
847 case op_getfield_1:
848 case op_getfield_2s:
849 case op_getfield_2u:
850 case op_getfield_4:
851 case op_getfield_8:
852 case op_getfield_a:
853 case op_getstatic_1:
854 case op_getstatic_2s:
855 case op_getstatic_2u:
856 case op_getstatic_4:
857 case op_getstatic_8:
858 case op_getstatic_a:
859 case op_breakpoint:
860 default:
861 // Fail somehow.
862 break;
867 // Now update exceptions.
868 _Jv_InterpException *exc = exceptions ();
869 for (int i = 0; i < exc_count; ++i)
871 exc[i].start_pc.p = &insns[pc_mapping[exc[i].start_pc.i]];
872 exc[i].end_pc.p = &insns[pc_mapping[exc[i].end_pc.i]];
873 exc[i].handler_pc.p = &insns[pc_mapping[exc[i].handler_pc.i]];
874 // FIXME: resolve_pool_entry can throw - we shouldn't be doing this
875 // during compilation.
876 jclass handler
877 = (_Jv_Linker::resolve_pool_entry (defining_class,
878 exc[i].handler_type.i)).clazz;
879 exc[i].handler_type.p = handler;
882 // Translate entries in the LineNumberTable from bytecode PC's to direct
883 // threaded interpreter instruction values.
884 for (int i = 0; i < line_table_len; i++)
886 int byte_pc = line_table[i].bytecode_pc;
887 // It isn't worth throwing an exception if this table is
888 // corrupted, but at the same time we don't want a crash.
889 if (byte_pc < 0 || byte_pc >= code_length)
890 byte_pc = 0;
891 line_table[i].pc = &insns[pc_mapping[byte_pc]];
894 prepared = insns;
896 if (breakpoint_insn == NULL)
898 bp_insn_slot.insn = const_cast<void *> (insn_targets[op_breakpoint]);
899 breakpoint_insn = &bp_insn_slot;
902 #endif /* DIRECT_THREADED */
904 /* Run the given method.
905 When args is NULL, don't run anything -- just compile it. */
906 void
907 _Jv_InterpMethod::run (void *retp, ffi_raw *args, _Jv_InterpMethod *meth)
909 #undef DEBUG
910 #undef DEBUG_LOCALS_INSN
911 #define DEBUG_LOCALS_INSN(s, t) do {} while(0)
913 #include "interpret-run.cc"
916 void
917 _Jv_InterpMethod::run_debug (void *retp, ffi_raw *args, _Jv_InterpMethod *meth)
919 /* Used to keep track of local variable type
921 * Possible Types:
922 * o object
923 * i integer
924 * f float
925 * l long
926 * d double
928 #define DEBUG
929 #undef DEBUG_LOCALS_INSN
930 #define DEBUG_LOCALS_INSN(s, t) do {} while(0)
932 #include "interpret-run.cc"
935 static void
936 throw_internal_error (const char *msg)
938 throw new java::lang::InternalError (JvNewStringLatin1 (msg));
941 static void
942 throw_incompatible_class_change_error (jstring msg)
944 throw new java::lang::IncompatibleClassChangeError (msg);
947 static void
948 throw_null_pointer_exception ()
950 throw new java::lang::NullPointerException;
953 /* Look up source code line number for given bytecode (or direct threaded
954 interpreter) PC. */
956 _Jv_InterpMethod::get_source_line(pc_t mpc)
958 int line = line_table_len > 0 ? line_table[0].line : -1;
959 for (int i = 1; i < line_table_len; i++)
960 if (line_table[i].pc > mpc)
961 break;
962 else
963 line = line_table[i].line;
965 return line;
968 /** Do static initialization for fields with a constant initializer */
969 void
970 _Jv_InitField (jobject obj, jclass klass, int index)
972 using namespace java::lang::reflect;
974 if (obj != 0 && klass == 0)
975 klass = obj->getClass ();
977 if (!_Jv_IsInterpretedClass (klass))
978 return;
980 _Jv_InterpClass *iclass = (_Jv_InterpClass*)klass->aux_info;
982 _Jv_Field * field = (&klass->fields[0]) + index;
984 if (index > klass->field_count)
985 throw_internal_error ("field out of range");
987 int init = iclass->field_initializers[index];
988 if (init == 0)
989 return;
991 _Jv_Constants *pool = &klass->constants;
992 int tag = pool->tags[init];
994 if (! field->isResolved ())
995 throw_internal_error ("initializing unresolved field");
997 if (obj==0 && ((field->flags & Modifier::STATIC) == 0))
998 throw_internal_error ("initializing non-static field with no object");
1000 void *addr = 0;
1002 if ((field->flags & Modifier::STATIC) != 0)
1003 addr = (void*) field->u.addr;
1004 else
1005 addr = (void*) (((char*)obj) + field->u.boffset);
1007 switch (tag)
1009 case JV_CONSTANT_String:
1011 jstring str;
1012 str = _Jv_NewStringUtf8Const (pool->data[init].utf8);
1013 pool->data[init].string = str;
1014 pool->tags[init] = JV_CONSTANT_ResolvedString;
1016 /* fall through */
1018 case JV_CONSTANT_ResolvedString:
1019 if (! (field->type == &java::lang::String::class$
1020 || field->type == &java::lang::Class::class$))
1021 throw_class_format_error ("string initialiser to non-string field");
1023 *(jstring*)addr = pool->data[init].string;
1024 break;
1026 case JV_CONSTANT_Integer:
1028 int value = pool->data[init].i;
1030 if (field->type == JvPrimClass (boolean))
1031 *(jboolean*)addr = (jboolean)value;
1033 else if (field->type == JvPrimClass (byte))
1034 *(jbyte*)addr = (jbyte)value;
1036 else if (field->type == JvPrimClass (char))
1037 *(jchar*)addr = (jchar)value;
1039 else if (field->type == JvPrimClass (short))
1040 *(jshort*)addr = (jshort)value;
1042 else if (field->type == JvPrimClass (int))
1043 *(jint*)addr = (jint)value;
1045 else
1046 throw_class_format_error ("erroneous field initializer");
1048 break;
1050 case JV_CONSTANT_Long:
1051 if (field->type != JvPrimClass (long))
1052 throw_class_format_error ("erroneous field initializer");
1054 *(jlong*)addr = _Jv_loadLong (&pool->data[init]);
1055 break;
1057 case JV_CONSTANT_Float:
1058 if (field->type != JvPrimClass (float))
1059 throw_class_format_error ("erroneous field initializer");
1061 *(jfloat*)addr = pool->data[init].f;
1062 break;
1064 case JV_CONSTANT_Double:
1065 if (field->type != JvPrimClass (double))
1066 throw_class_format_error ("erroneous field initializer");
1068 *(jdouble*)addr = _Jv_loadDouble (&pool->data[init]);
1069 break;
1071 default:
1072 throw_class_format_error ("erroneous field initializer");
1076 inline static unsigned char*
1077 skip_one_type (unsigned char* ptr)
1079 int ch = *ptr++;
1081 while (ch == '[')
1083 ch = *ptr++;
1086 if (ch == 'L')
1088 do { ch = *ptr++; } while (ch != ';');
1091 return ptr;
1094 static ffi_type*
1095 get_ffi_type_from_signature (unsigned char* ptr)
1097 switch (*ptr)
1099 case 'L':
1100 case '[':
1101 return &ffi_type_pointer;
1102 break;
1104 case 'Z':
1105 // On some platforms a bool is a byte, on others an int.
1106 if (sizeof (jboolean) == sizeof (jbyte))
1107 return &ffi_type_sint8;
1108 else
1110 JvAssert (sizeof (jbyte) == sizeof (jint));
1111 return &ffi_type_sint32;
1113 break;
1115 case 'B':
1116 return &ffi_type_sint8;
1117 break;
1119 case 'C':
1120 return &ffi_type_uint16;
1121 break;
1123 case 'S':
1124 return &ffi_type_sint16;
1125 break;
1127 case 'I':
1128 return &ffi_type_sint32;
1129 break;
1131 case 'J':
1132 return &ffi_type_sint64;
1133 break;
1135 case 'F':
1136 return &ffi_type_float;
1137 break;
1139 case 'D':
1140 return &ffi_type_double;
1141 break;
1143 case 'V':
1144 return &ffi_type_void;
1145 break;
1148 throw_internal_error ("unknown type in signature");
1151 /* this function yields the number of actual arguments, that is, if the
1152 * function is non-static, then one is added to the number of elements
1153 * found in the signature */
1155 int
1156 _Jv_count_arguments (_Jv_Utf8Const *signature,
1157 jboolean staticp)
1159 unsigned char *ptr = (unsigned char*) signature->chars();
1160 int arg_count = staticp ? 0 : 1;
1162 /* first, count number of arguments */
1164 // skip '('
1165 ptr++;
1167 // count args
1168 while (*ptr != ')')
1170 ptr = skip_one_type (ptr);
1171 arg_count += 1;
1174 return arg_count;
1177 /* This beast will build a cif, given the signature. Memory for
1178 * the cif itself and for the argument types must be allocated by the
1179 * caller.
1182 int
1183 _Jv_init_cif (_Jv_Utf8Const* signature,
1184 int arg_count,
1185 jboolean staticp,
1186 ffi_cif *cif,
1187 ffi_type **arg_types,
1188 ffi_type **rtype_p)
1190 unsigned char *ptr = (unsigned char*) signature->chars();
1192 int arg_index = 0; // arg number
1193 int item_count = 0; // stack-item count
1195 // setup receiver
1196 if (!staticp)
1198 arg_types[arg_index++] = &ffi_type_pointer;
1199 item_count += 1;
1202 // skip '('
1203 ptr++;
1205 // assign arg types
1206 while (*ptr != ')')
1208 arg_types[arg_index++] = get_ffi_type_from_signature (ptr);
1210 if (*ptr == 'J' || *ptr == 'D')
1211 item_count += 2;
1212 else
1213 item_count += 1;
1215 ptr = skip_one_type (ptr);
1218 // skip ')'
1219 ptr++;
1220 ffi_type *rtype = get_ffi_type_from_signature (ptr);
1222 ptr = skip_one_type (ptr);
1223 if (ptr != (unsigned char*)signature->chars() + signature->len())
1224 throw_internal_error ("did not find end of signature");
1226 if (ffi_prep_cif (cif, FFI_DEFAULT_ABI,
1227 arg_count, rtype, arg_types) != FFI_OK)
1228 throw_internal_error ("ffi_prep_cif failed");
1230 if (rtype_p != NULL)
1231 *rtype_p = rtype;
1233 return item_count;
1236 #if FFI_NATIVE_RAW_API
1237 # define FFI_PREP_RAW_CLOSURE ffi_prep_raw_closure
1238 # define FFI_RAW_SIZE ffi_raw_size
1239 #else
1240 # define FFI_PREP_RAW_CLOSURE ffi_prep_java_raw_closure
1241 # define FFI_RAW_SIZE ffi_java_raw_size
1242 #endif
1244 /* we put this one here, and not in interpret.cc because it
1245 * calls the utility routines _Jv_count_arguments
1246 * which are static to this module. The following struct defines the
1247 * layout we use for the stubs, it's only used in the ncode method. */
1249 typedef struct {
1250 ffi_raw_closure closure;
1251 ffi_cif cif;
1252 ffi_type *arg_types[0];
1253 } ncode_closure;
1255 typedef void (*ffi_closure_fun) (ffi_cif*,void*,ffi_raw*,void*);
1257 void *
1258 _Jv_InterpMethod::ncode ()
1260 using namespace java::lang::reflect;
1262 if (self->ncode != 0)
1263 return self->ncode;
1265 jboolean staticp = (self->accflags & Modifier::STATIC) != 0;
1266 int arg_count = _Jv_count_arguments (self->signature, staticp);
1268 ncode_closure *closure =
1269 (ncode_closure*)_Jv_AllocBytes (sizeof (ncode_closure)
1270 + arg_count * sizeof (ffi_type*));
1272 _Jv_init_cif (self->signature,
1273 arg_count,
1274 staticp,
1275 &closure->cif,
1276 &closure->arg_types[0],
1277 NULL);
1279 ffi_closure_fun fun;
1281 args_raw_size = FFI_RAW_SIZE (&closure->cif);
1283 JvAssert ((self->accflags & Modifier::NATIVE) == 0);
1285 if ((self->accflags & Modifier::SYNCHRONIZED) != 0)
1287 if (staticp)
1289 if (::gnu::classpath::jdwp::Jdwp::isDebugging)
1290 fun = (ffi_closure_fun)&_Jv_InterpMethod::run_synch_class_debug;
1291 else
1292 fun = (ffi_closure_fun)&_Jv_InterpMethod::run_synch_class;
1294 else
1296 if (::gnu::classpath::jdwp::Jdwp::isDebugging)
1297 fun = (ffi_closure_fun)&_Jv_InterpMethod::run_synch_object_debug;
1298 else
1299 fun = (ffi_closure_fun)&_Jv_InterpMethod::run_synch_object;
1302 else
1304 if (staticp)
1306 if (::gnu::classpath::jdwp::Jdwp::isDebugging)
1307 fun = (ffi_closure_fun)&_Jv_InterpMethod::run_class_debug;
1308 else
1309 fun = (ffi_closure_fun)&_Jv_InterpMethod::run_class;
1311 else
1313 if (::gnu::classpath::jdwp::Jdwp::isDebugging)
1314 fun = (ffi_closure_fun)&_Jv_InterpMethod::run_normal_debug;
1315 else
1316 fun = (ffi_closure_fun)&_Jv_InterpMethod::run_normal;
1320 FFI_PREP_RAW_CLOSURE (&closure->closure,
1321 &closure->cif,
1322 fun,
1323 (void*)this);
1325 self->ncode = (void*)closure;
1326 return self->ncode;
1329 /* Find the index of the given insn in the array of insn slots
1330 for this method. Returns -1 if not found. */
1331 jlong
1332 _Jv_InterpMethod::insn_index (pc_t pc)
1334 jlong left = 0;
1335 #ifdef DIRECT_THREADED
1336 jlong right = number_insn_slots;
1337 pc_t insns = prepared;
1338 #else
1339 jlong right = code_length;
1340 pc_t insns = bytecode ();
1341 #endif
1343 while (right >= 0)
1345 jlong mid = (left + right) / 2;
1346 if (&insns[mid] == pc)
1347 return mid;
1349 if (pc < &insns[mid])
1350 right = mid - 1;
1351 else
1352 left = mid + 1;
1355 return -1;
1358 void
1359 _Jv_InterpMethod::get_line_table (jlong& start, jlong& end,
1360 jintArray& line_numbers,
1361 jlongArray& code_indices)
1363 #ifdef DIRECT_THREADED
1364 /* For the DIRECT_THREADED case, if the method has not yet been
1365 * compiled, the linetable will change to insn slots instead of
1366 * bytecode PCs. It is probably easiest, in this case, to simply
1367 * compile the method and guarantee that we are using insn
1368 * slots.
1370 _Jv_CompileMethod (this);
1372 if (line_table_len > 0)
1374 start = 0;
1375 end = number_insn_slots;
1376 line_numbers = JvNewIntArray (line_table_len);
1377 code_indices = JvNewLongArray (line_table_len);
1379 jint* lines = elements (line_numbers);
1380 jlong* indices = elements (code_indices);
1381 for (int i = 0; i < line_table_len; ++i)
1383 lines[i] = line_table[i].line;
1384 indices[i] = insn_index (line_table[i].pc);
1387 #else // !DIRECT_THREADED
1388 if (line_table_len > 0)
1390 start = 0;
1391 end = code_length;
1392 line_numbers = JvNewIntArray (line_table_len);
1393 code_indices = JvNewLongArray (line_table_len);
1395 jint* lines = elements (line_numbers);
1396 jlong* indices = elements (code_indices);
1397 for (int i = 0; i < line_table_len; ++i)
1399 lines[i] = line_table[i].line;
1400 indices[i] = (jlong) line_table[i].bytecode_pc;
1403 #endif // !DIRECT_THREADED
1406 pc_t
1407 _Jv_InterpMethod::install_break (jlong index)
1409 return set_insn (index, breakpoint_insn);
1412 pc_t
1413 _Jv_InterpMethod::get_insn (jlong index)
1415 pc_t code;
1417 #ifdef DIRECT_THREADED
1418 if (index >= number_insn_slots || index < 0)
1419 return NULL;
1421 code = prepared;
1422 #else // !DIRECT_THREADED
1423 if (index >= code_length || index < 0)
1424 return NULL;
1426 code = reinterpret_cast<pc_t> (bytecode ());
1427 #endif // !DIRECT_THREADED
1429 return &code[index];
1432 pc_t
1433 _Jv_InterpMethod::set_insn (jlong index, pc_t insn)
1435 #ifdef DIRECT_THREADED
1436 if (index >= number_insn_slots || index < 0)
1437 return NULL;
1439 pc_t code = prepared;
1440 code[index].insn = insn->insn;
1441 #else // !DIRECT_THREADED
1442 if (index >= code_length || index < 0)
1443 return NULL;
1445 pc_t code = reinterpret_cast<pc_t> (bytecode ());
1446 code[index] = *insn;
1447 #endif // !DIRECT_THREADED
1449 return &code[index];
1452 void *
1453 _Jv_JNIMethod::ncode ()
1455 using namespace java::lang::reflect;
1457 if (self->ncode != 0)
1458 return self->ncode;
1460 jboolean staticp = (self->accflags & Modifier::STATIC) != 0;
1461 int arg_count = _Jv_count_arguments (self->signature, staticp);
1463 ncode_closure *closure =
1464 (ncode_closure*)_Jv_AllocBytes (sizeof (ncode_closure)
1465 + arg_count * sizeof (ffi_type*));
1467 ffi_type *rtype;
1468 _Jv_init_cif (self->signature,
1469 arg_count,
1470 staticp,
1471 &closure->cif,
1472 &closure->arg_types[0],
1473 &rtype);
1475 ffi_closure_fun fun;
1477 args_raw_size = FFI_RAW_SIZE (&closure->cif);
1479 // Initialize the argument types and CIF that represent the actual
1480 // underlying JNI function.
1481 int extra_args = 1;
1482 if ((self->accflags & Modifier::STATIC))
1483 ++extra_args;
1484 jni_arg_types = (ffi_type **) _Jv_AllocBytes ((extra_args + arg_count)
1485 * sizeof (ffi_type *));
1486 int offset = 0;
1487 jni_arg_types[offset++] = &ffi_type_pointer;
1488 if ((self->accflags & Modifier::STATIC))
1489 jni_arg_types[offset++] = &ffi_type_pointer;
1490 memcpy (&jni_arg_types[offset], &closure->arg_types[0],
1491 arg_count * sizeof (ffi_type *));
1493 if (ffi_prep_cif (&jni_cif, _Jv_platform_ffi_abi,
1494 extra_args + arg_count, rtype,
1495 jni_arg_types) != FFI_OK)
1496 throw_internal_error ("ffi_prep_cif failed for JNI function");
1498 JvAssert ((self->accflags & Modifier::NATIVE) != 0);
1500 // FIXME: for now we assume that all native methods for
1501 // interpreted code use JNI.
1502 fun = (ffi_closure_fun) &_Jv_JNIMethod::call;
1504 FFI_PREP_RAW_CLOSURE (&closure->closure,
1505 &closure->cif,
1506 fun,
1507 (void*) this);
1509 self->ncode = (void *) closure;
1510 return self->ncode;
1513 static void
1514 throw_class_format_error (jstring msg)
1516 throw (msg
1517 ? new java::lang::ClassFormatError (msg)
1518 : new java::lang::ClassFormatError);
1521 static void
1522 throw_class_format_error (const char *msg)
1524 throw_class_format_error (JvNewStringLatin1 (msg));
1529 void
1530 _Jv_InterpreterEngine::do_verify (jclass klass)
1532 _Jv_InterpClass *iclass = (_Jv_InterpClass *) klass->aux_info;
1533 for (int i = 0; i < klass->method_count; i++)
1535 using namespace java::lang::reflect;
1536 _Jv_MethodBase *imeth = iclass->interpreted_methods[i];
1537 _Jv_ushort accflags = klass->methods[i].accflags;
1538 if ((accflags & (Modifier::NATIVE | Modifier::ABSTRACT)) == 0)
1540 _Jv_InterpMethod *im = reinterpret_cast<_Jv_InterpMethod *> (imeth);
1541 _Jv_VerifyMethod (im);
1546 void
1547 _Jv_InterpreterEngine::do_create_ncode (jclass klass)
1549 _Jv_InterpClass *iclass = (_Jv_InterpClass *) klass->aux_info;
1550 for (int i = 0; i < klass->method_count; i++)
1552 // Just skip abstract methods. This is particularly important
1553 // because we don't resize the interpreted_methods array when
1554 // miranda methods are added to it.
1555 if ((klass->methods[i].accflags
1556 & java::lang::reflect::Modifier::ABSTRACT)
1557 != 0)
1558 continue;
1560 _Jv_MethodBase *imeth = iclass->interpreted_methods[i];
1562 if ((klass->methods[i].accflags & java::lang::reflect::Modifier::NATIVE)
1563 != 0)
1565 // You might think we could use a virtual `ncode' method in
1566 // the _Jv_MethodBase and unify the native and non-native
1567 // cases. Well, we can't, because we don't allocate these
1568 // objects using `new', and thus they don't get a vtable.
1569 _Jv_JNIMethod *jnim = reinterpret_cast<_Jv_JNIMethod *> (imeth);
1570 klass->methods[i].ncode = jnim->ncode ();
1572 else if (imeth != 0) // it could be abstract
1574 _Jv_InterpMethod *im = reinterpret_cast<_Jv_InterpMethod *> (imeth);
1575 klass->methods[i].ncode = im->ncode ();
1580 void
1581 _Jv_InterpreterEngine::do_allocate_static_fields (jclass klass,
1582 int pointer_size,
1583 int other_size)
1585 _Jv_InterpClass *iclass = (_Jv_InterpClass *) klass->aux_info;
1587 // Splitting the allocations here lets us scan reference fields and
1588 // avoid scanning non-reference fields. How reference fields are
1589 // scanned is a bit tricky: we allocate using _Jv_AllocRawObj, which
1590 // means that this memory will be scanned conservatively (same
1591 // difference, since we know all the contents here are pointers).
1592 // Then we put pointers into this memory into the 'fields'
1593 // structure. Most of these are interior pointers, which is ok (but
1594 // even so the pointer to the first reference field will be used and
1595 // that is not an interior pointer). The 'fields' array is also
1596 // allocated with _Jv_AllocRawObj (see defineclass.cc), so it will
1597 // be scanned. A pointer to this array is held by Class and thus
1598 // seen by the collector.
1599 char *reference_fields = (char *) _Jv_AllocRawObj (pointer_size);
1600 char *non_reference_fields = (char *) _Jv_AllocBytes (other_size);
1602 for (int i = 0; i < klass->field_count; i++)
1604 _Jv_Field *field = &klass->fields[i];
1606 if ((field->flags & java::lang::reflect::Modifier::STATIC) == 0)
1607 continue;
1609 char *base = field->isRef() ? reference_fields : non_reference_fields;
1610 field->u.addr = base + field->u.boffset;
1612 if (iclass->field_initializers[i] != 0)
1614 _Jv_Linker::resolve_field (field, klass->loader);
1615 _Jv_InitField (0, klass, i);
1619 // Now we don't need the field_initializers anymore, so let the
1620 // collector get rid of it.
1621 iclass->field_initializers = 0;
1624 _Jv_ResolvedMethod *
1625 _Jv_InterpreterEngine::do_resolve_method (_Jv_Method *method, jclass klass,
1626 jboolean staticp)
1628 int arg_count = _Jv_count_arguments (method->signature, staticp);
1630 _Jv_ResolvedMethod* result = (_Jv_ResolvedMethod*)
1631 _Jv_AllocBytes (sizeof (_Jv_ResolvedMethod)
1632 + arg_count*sizeof (ffi_type*));
1634 result->stack_item_count
1635 = _Jv_init_cif (method->signature,
1636 arg_count,
1637 staticp,
1638 &result->cif,
1639 &result->arg_types[0],
1640 NULL);
1642 result->method = method;
1643 result->klass = klass;
1645 return result;
1648 void
1649 _Jv_InterpreterEngine::do_post_miranda_hook (jclass klass)
1651 _Jv_InterpClass *iclass = (_Jv_InterpClass *) klass->aux_info;
1652 for (int i = 0; i < klass->method_count; i++)
1654 // Just skip abstract methods. This is particularly important
1655 // because we don't resize the interpreted_methods array when
1656 // miranda methods are added to it.
1657 if ((klass->methods[i].accflags
1658 & java::lang::reflect::Modifier::ABSTRACT)
1659 != 0)
1660 continue;
1661 // Miranda method additions mean that the `methods' array moves.
1662 // We cache a pointer into this array, so we have to update.
1663 iclass->interpreted_methods[i]->self = &klass->methods[i];
1667 #ifdef DIRECT_THREADED
1668 void
1669 _Jv_CompileMethod (_Jv_InterpMethod* method)
1671 if (method->prepared == NULL)
1672 _Jv_InterpMethod::run (NULL, NULL, method);
1674 #endif // DIRECT_THREADED
1676 #endif // INTERPRETER