1 // interpret.cc - Code for the interpreter
3 /* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 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
11 /* Author: Kresten Krab Thorup <krab@gnu.org> */
16 // Define this to get the direct-threaded interpreter. If undefined,
17 // we revert to a basic bytecode interpreter. The former is faster
18 // but uses more memory.
19 #define DIRECT_THREADED
21 #pragma implementation "java-interp.h"
24 #include <java-cpool.h>
25 #include <java-interp.h>
26 #include <java/lang/System.h>
27 #include <java/lang/String.h>
28 #include <java/lang/Integer.h>
29 #include <java/lang/Long.h>
30 #include <java/lang/StringBuffer.h>
31 #include <java/lang/Class.h>
32 #include <java/lang/reflect/Modifier.h>
33 #include <java/lang/ClassCastException.h>
34 #include <java/lang/VirtualMachineError.h>
35 #include <java/lang/InternalError.h>
36 #include <java/lang/NullPointerException.h>
37 #include <java/lang/ArithmeticException.h>
38 #include <java/lang/IncompatibleClassChangeError.h>
39 #include <java/lang/InstantiationException.h>
40 #include <java/lang/Thread.h>
41 #include <java-insns.h>
42 #include <java-signal.h>
43 #include <java/lang/ClassFormatError.h>
44 #include <execution.h>
45 #include <java/lang/reflect/Modifier.h>
49 // Execution engine for interpreted code.
50 _Jv_InterpreterEngine _Jv_soleInterpreterEngine
;
56 static void throw_internal_error (char *msg
)
57 __attribute__ ((__noreturn__
));
58 static void throw_incompatible_class_change_error (jstring msg
)
59 __attribute__ ((__noreturn__
));
61 static void throw_null_pointer_exception ()
62 __attribute__ ((__noreturn__
));
65 static void throw_class_format_error (jstring msg
)
66 __attribute__ ((__noreturn__
));
67 static void throw_class_format_error (char *msg
)
68 __attribute__ ((__noreturn__
));
70 #ifdef DIRECT_THREADED
71 // Lock to ensure that methods are not compiled concurrently.
72 // We could use a finer-grained lock here, however it is not safe to use
73 // the Class monitor as user code in another thread could hold it.
74 static _Jv_Mutex_t compile_mutex
;
79 _Jv_MutexInit (&compile_mutex
);
82 void _Jv_InitInterpreter() {}
85 extern "C" double __ieee754_fmod (double,double);
87 // This represents a single slot in the "compiled" form of the
93 // An integer value used by an instruction.
95 // A pointer value used by an instruction.
99 // The type of the PC depends on whether we're doing direct threading
100 // or a more ordinary bytecode interpreter.
101 #ifdef DIRECT_THREADED
102 typedef insn_slot
*pc_t
;
104 typedef unsigned char *pc_t
;
107 static inline void dupx (_Jv_word
*sp
, int n
, int x
)
109 // first "slide" n+x elements n to the right
111 for (int i
= 0; i
< n
+x
; i
++)
113 sp
[(top
-i
)] = sp
[(top
-i
)-n
];
116 // next, copy the n top elements, n+x down
117 for (int i
= 0; i
< n
; i
++)
119 sp
[top
-(n
+x
)-i
] = sp
[top
-i
];
124 // Used to convert from floating types to integral types.
125 template<typename TO
, typename FROM
>
127 convert (FROM val
, TO min
, TO max
)
130 if (val
>= (FROM
) max
)
132 else if (val
<= (FROM
) min
)
141 #define PUSHA(V) (sp++)->o = (V)
142 #define PUSHI(V) (sp++)->i = (V)
143 #define PUSHF(V) (sp++)->f = (V)
144 #if SIZEOF_VOID_P == 8
145 # define PUSHL(V) (sp->l = (V), sp += 2)
146 # define PUSHD(V) (sp->d = (V), sp += 2)
148 # define PUSHL(V) do { _Jv_word2 w2; w2.l=(V); \
149 (sp++)->ia[0] = w2.ia[0]; \
150 (sp++)->ia[0] = w2.ia[1]; } while (0)
151 # define PUSHD(V) do { _Jv_word2 w2; w2.d=(V); \
152 (sp++)->ia[0] = w2.ia[0]; \
153 (sp++)->ia[0] = w2.ia[1]; } while (0)
156 #define POPA() ((--sp)->o)
157 #define POPI() ((jint) (--sp)->i) // cast since it may be promoted
158 #define POPF() ((jfloat) (--sp)->f)
159 #if SIZEOF_VOID_P == 8
160 # define POPL() (sp -= 2, (jlong) sp->l)
161 # define POPD() (sp -= 2, (jdouble) sp->d)
163 # define POPL() ({ _Jv_word2 w2; \
164 w2.ia[1] = (--sp)->ia[0]; \
165 w2.ia[0] = (--sp)->ia[0]; w2.l; })
166 # define POPD() ({ _Jv_word2 w2; \
167 w2.ia[1] = (--sp)->ia[0]; \
168 w2.ia[0] = (--sp)->ia[0]; w2.d; })
171 #define LOADA(I) (sp++)->o = locals[I].o
172 #define LOADI(I) (sp++)->i = locals[I].i
173 #define LOADF(I) (sp++)->f = locals[I].f
174 #if SIZEOF_VOID_P == 8
175 # define LOADL(I) (sp->l = locals[I].l, sp += 2)
176 # define LOADD(I) (sp->d = locals[I].d, sp += 2)
178 # define LOADL(I) do { jint __idx = (I); \
179 (sp++)->ia[0] = locals[__idx].ia[0]; \
180 (sp++)->ia[0] = locals[__idx+1].ia[0]; \
182 # define LOADD(I) LOADL(I)
185 #define STOREA(I) locals[I].o = (--sp)->o
186 #define STOREI(I) locals[I].i = (--sp)->i
187 #define STOREF(I) locals[I].f = (--sp)->f
188 #if SIZEOF_VOID_P == 8
189 # define STOREL(I) (sp -= 2, locals[I].l = sp->l)
190 # define STORED(I) (sp -= 2, locals[I].d = sp->d)
192 # define STOREL(I) do { jint __idx = (I); \
193 locals[__idx+1].ia[0] = (--sp)->ia[0]; \
194 locals[__idx].ia[0] = (--sp)->ia[0]; \
196 # define STORED(I) STOREL(I)
199 #define PEEKI(I) (locals+(I))->i
200 #define PEEKA(I) (locals+(I))->o
202 #define POKEI(I,V) ((locals+(I))->i = (V))
205 #define BINOPI(OP) { \
206 jint value2 = POPI(); \
207 jint value1 = POPI(); \
208 PUSHI(value1 OP value2); \
211 #define BINOPF(OP) { \
212 jfloat value2 = POPF(); \
213 jfloat value1 = POPF(); \
214 PUSHF(value1 OP value2); \
217 #define BINOPL(OP) { \
218 jlong value2 = POPL(); \
219 jlong value1 = POPL(); \
220 PUSHL(value1 OP value2); \
223 #define BINOPD(OP) { \
224 jdouble value2 = POPD(); \
225 jdouble value1 = POPD(); \
226 PUSHD(value1 OP value2); \
229 static inline jint
get1s(unsigned char* loc
) {
230 return *(signed char*)loc
;
233 static inline jint
get1u(unsigned char* loc
) {
237 static inline jint
get2s(unsigned char* loc
) {
238 return (((jint
)*(signed char*)loc
) << 8) | ((jint
)*(loc
+1));
241 static inline jint
get2u(unsigned char* loc
) {
242 return (((jint
)(*loc
)) << 8) | ((jint
)*(loc
+1));
245 static jint
get4(unsigned char* loc
) {
246 return (((jint
)(loc
[0])) << 24)
247 | (((jint
)(loc
[1])) << 16)
248 | (((jint
)(loc
[2])) << 8)
249 | (((jint
)(loc
[3])) << 0);
255 #define NULLARRAYCHECK(X)
257 #define NULLCHECK(X) \
258 do { if ((X)==NULL) throw_null_pointer_exception (); } while (0)
259 #define NULLARRAYCHECK(X) \
260 do { if ((X)==NULL) { throw_null_pointer_exception (); } } while (0)
263 #define ARRAYBOUNDSCHECK(array, index) \
266 if (((unsigned) index) >= (unsigned) (array->length)) \
267 _Jv_ThrowBadArrayIndex (index); \
272 _Jv_InterpMethod::run_normal (ffi_cif
*,
277 _Jv_InterpMethod
*_this
= (_Jv_InterpMethod
*) __this
;
278 _this
->run (ret
, args
);
282 _Jv_InterpMethod::run_synch_object (ffi_cif
*,
287 _Jv_InterpMethod
*_this
= (_Jv_InterpMethod
*) __this
;
289 jobject rcv
= (jobject
) args
[0].ptr
;
290 JvSynchronize
mutex (rcv
);
292 _this
->run (ret
, args
);
296 _Jv_InterpMethod::run_class (ffi_cif
*,
301 _Jv_InterpMethod
*_this
= (_Jv_InterpMethod
*) __this
;
302 _Jv_InitClass (_this
->defining_class
);
303 _this
->run (ret
, args
);
307 _Jv_InterpMethod::run_synch_class (ffi_cif
*,
312 _Jv_InterpMethod
*_this
= (_Jv_InterpMethod
*) __this
;
314 jclass sync
= _this
->defining_class
;
315 _Jv_InitClass (sync
);
316 JvSynchronize
mutex (sync
);
318 _this
->run (ret
, args
);
321 #ifdef DIRECT_THREADED
322 // "Compile" a method by turning it from bytecode to direct-threaded
325 _Jv_InterpMethod::compile (const void * const *insn_targets
)
327 insn_slot
*insns
= NULL
;
329 unsigned char *codestart
= bytecode ();
330 unsigned char *end
= codestart
+ code_length
;
331 _Jv_word
*pool_data
= defining_class
->constants
.data
;
333 #define SET_ONE(Field, Value) \
339 insns[next++].Field = Value; \
343 #define SET_INSN(Value) SET_ONE (insn, (void *) Value)
344 #define SET_INT(Value) SET_ONE (int_val, Value)
345 #define SET_DATUM(Value) SET_ONE (datum, Value)
347 // Map from bytecode PC to slot in INSNS.
348 int *pc_mapping
= (int *) __builtin_alloca (sizeof (int) * code_length
);
349 for (int i
= 0; i
< code_length
; ++i
)
352 for (int i
= 0; i
< 2; ++i
)
354 jboolean first_pass
= i
== 0;
358 insns
= (insn_slot
*) _Jv_AllocBytes (sizeof (insn_slot
) * next
);
362 unsigned char *pc
= codestart
;
365 int base_pc_val
= pc
- codestart
;
367 pc_mapping
[base_pc_val
] = next
;
369 java_opcode opcode
= (java_opcode
) *pc
++;
371 if (opcode
== op_nop
)
373 SET_INSN (insn_targets
[opcode
]);
514 case op_monitorenter
:
524 // No argument, nothing else to do.
528 SET_INT (get1s (pc
));
534 int index
= get1u (pc
);
536 SET_DATUM (pool_data
[index
].o
);
552 SET_INT (get1u (pc
));
557 SET_INT (get1u (pc
));
558 SET_INT (get1s (pc
+ 1));
564 int index
= get2u (pc
);
566 SET_DATUM (pool_data
[index
].o
);
572 int index
= get2u (pc
);
574 SET_DATUM (&pool_data
[index
]);
579 SET_INT (get2s (pc
));
591 case op_invokespecial
:
592 case op_invokestatic
:
593 case op_invokevirtual
:
594 SET_INT (get2u (pc
));
598 case op_multianewarray
:
599 SET_INT (get2u (pc
));
600 SET_INT (get1u (pc
+ 2));
623 int offset
= get2s (pc
);
626 int new_pc
= base_pc_val
+ offset
;
628 bool orig_was_goto
= opcode
== op_goto
;
630 // Thread jumps. We limit the loop count; this lets
631 // us avoid infinite loops if the bytecode contains
632 // such. `10' is arbitrary.
634 while (codestart
[new_pc
] == op_goto
&& count
-- > 0)
635 new_pc
+= get2s (&codestart
[new_pc
+ 1]);
637 // If the jump takes us to a `return' instruction and
638 // the original branch was an unconditional goto, then
639 // we hoist the return.
640 opcode
= (java_opcode
) codestart
[new_pc
];
642 && (opcode
== op_ireturn
|| opcode
== op_lreturn
643 || opcode
== op_freturn
|| opcode
== op_dreturn
644 || opcode
== op_areturn
|| opcode
== op_return
))
647 SET_INSN (insn_targets
[opcode
]);
650 SET_DATUM (&insns
[pc_mapping
[new_pc
]]);
656 while ((pc
- codestart
) % 4 != 0)
659 jint def
= get4 (pc
);
660 SET_DATUM (&insns
[pc_mapping
[base_pc_val
+ def
]]);
666 int high
= get4 (pc
);
670 for (int i
= low
; i
<= high
; ++i
)
672 SET_DATUM (&insns
[pc_mapping
[base_pc_val
+ get4 (pc
)]]);
678 case op_lookupswitch
:
680 while ((pc
- codestart
) % 4 != 0)
683 jint def
= get4 (pc
);
684 SET_DATUM (&insns
[pc_mapping
[base_pc_val
+ def
]]);
687 jint npairs
= get4 (pc
);
693 jint match
= get4 (pc
);
694 jint offset
= get4 (pc
+ 4);
696 SET_DATUM (&insns
[pc_mapping
[base_pc_val
+ offset
]]);
702 case op_invokeinterface
:
704 jint index
= get2u (pc
);
706 // We ignore the next two bytes.
714 opcode
= (java_opcode
) get1u (pc
);
716 jint val
= get2u (pc
);
719 // We implement narrow and wide instructions using the
720 // same code in the interpreter. So we rewrite the
721 // instruction slot here.
723 insns
[next
- 1].insn
= (void *) insn_targets
[opcode
];
726 if (opcode
== op_iinc
)
728 SET_INT (get2s (pc
));
737 jint offset
= get4 (pc
);
739 SET_DATUM (&insns
[pc_mapping
[base_pc_val
+ offset
]]);
743 // Some "can't happen" cases that we include for
744 // error-checking purposes.
762 case op_getstatic_2s
:
763 case op_getstatic_2u
:
774 // Now update exceptions.
775 _Jv_InterpException
*exc
= exceptions ();
776 for (int i
= 0; i
< exc_count
; ++i
)
778 exc
[i
].start_pc
.p
= &insns
[pc_mapping
[exc
[i
].start_pc
.i
]];
779 exc
[i
].end_pc
.p
= &insns
[pc_mapping
[exc
[i
].end_pc
.i
]];
780 exc
[i
].handler_pc
.p
= &insns
[pc_mapping
[exc
[i
].handler_pc
.i
]];
782 = (_Jv_Linker::resolve_pool_entry (defining_class
,
783 exc
[i
].handler_type
.i
)).clazz
;
784 exc
[i
].handler_type
.p
= handler
;
789 #endif /* DIRECT_THREADED */
791 // These exist so that the stack-tracing code can find the boundaries
792 // of the interpreter.
793 void *_Jv_StartOfInterpreter
;
794 void *_Jv_EndOfInterpreter
;
795 extern "C" void *_Unwind_FindEnclosingFunction (void *pc
);
798 _Jv_InterpMethod::run (void *retp
, ffi_raw
*args
)
800 using namespace java::lang::reflect
;
802 // Record the address of the start of this member function in
803 // _Jv_StartOfInterpreter. Such a write to a global variable
804 // without acquiring a lock is correct iff reads and writes of words
805 // in memory are atomic, but Java requires that anyway.
807 if (_Jv_StartOfInterpreter
== NULL
)
808 _Jv_StartOfInterpreter
= _Unwind_FindEnclosingFunction (&&foo
);
810 // FRAME_DESC registers this particular invocation as the top-most
811 // interpreter frame. This lets the stack tracing code (for
812 // Throwable) print information about the method being interpreted
813 // rather than about the interpreter itself. FRAME_DESC has a
814 // destructor so it cleans up automatically when the interpreter
816 java::lang::Thread
*thread
= java::lang::Thread::currentThread();
817 _Jv_MethodChain
frame_desc (this,
818 (_Jv_MethodChain
**) &thread
->interp_frame
);
820 _Jv_word stack
[max_stack
];
821 _Jv_word
*sp
= stack
;
823 _Jv_word locals
[max_locals
];
825 /* Go straight at it! the ffi raw format matches the internal
826 stack representation exactly. At least, that's the idea.
828 memcpy ((void*) locals
, (void*) args
, args_raw_size
);
830 _Jv_word
*pool_data
= defining_class
->constants
.data
;
832 /* These three are temporaries for common code used by several
835 _Jv_ResolvedMethod
* rmeth
;
838 #define INSN_LABEL(op) &&insn_##op
840 static const void *const insn_target
[] =
843 INSN_LABEL(aconst_null
),
844 INSN_LABEL(iconst_m1
),
845 INSN_LABEL(iconst_0
),
846 INSN_LABEL(iconst_1
),
847 INSN_LABEL(iconst_2
),
848 INSN_LABEL(iconst_3
),
849 INSN_LABEL(iconst_4
),
850 INSN_LABEL(iconst_5
),
851 INSN_LABEL(lconst_0
),
852 INSN_LABEL(lconst_1
),
853 INSN_LABEL(fconst_0
),
854 INSN_LABEL(fconst_1
),
855 INSN_LABEL(fconst_2
),
856 INSN_LABEL(dconst_0
),
857 INSN_LABEL(dconst_1
),
901 INSN_LABEL(istore_0
),
902 INSN_LABEL(istore_1
),
903 INSN_LABEL(istore_2
),
904 INSN_LABEL(istore_3
),
905 INSN_LABEL(lstore_0
),
906 INSN_LABEL(lstore_1
),
907 INSN_LABEL(lstore_2
),
908 INSN_LABEL(lstore_3
),
909 INSN_LABEL(fstore_0
),
910 INSN_LABEL(fstore_1
),
911 INSN_LABEL(fstore_2
),
912 INSN_LABEL(fstore_3
),
913 INSN_LABEL(dstore_0
),
914 INSN_LABEL(dstore_1
),
915 INSN_LABEL(dstore_2
),
916 INSN_LABEL(dstore_3
),
917 INSN_LABEL(astore_0
),
918 INSN_LABEL(astore_1
),
919 INSN_LABEL(astore_2
),
920 INSN_LABEL(astore_3
),
1001 INSN_LABEL(if_icmpeq
),
1002 INSN_LABEL(if_icmpne
),
1003 INSN_LABEL(if_icmplt
),
1004 INSN_LABEL(if_icmpge
),
1005 INSN_LABEL(if_icmpgt
),
1006 INSN_LABEL(if_icmple
),
1007 INSN_LABEL(if_acmpeq
),
1008 INSN_LABEL(if_acmpne
),
1012 INSN_LABEL(tableswitch
),
1013 INSN_LABEL(lookupswitch
),
1014 INSN_LABEL(ireturn
),
1015 INSN_LABEL(lreturn
),
1016 INSN_LABEL(freturn
),
1017 INSN_LABEL(dreturn
),
1018 INSN_LABEL(areturn
),
1020 INSN_LABEL(getstatic
),
1021 INSN_LABEL(putstatic
),
1022 INSN_LABEL(getfield
),
1023 INSN_LABEL(putfield
),
1024 INSN_LABEL(invokevirtual
),
1025 INSN_LABEL(invokespecial
),
1026 INSN_LABEL(invokestatic
),
1027 INSN_LABEL(invokeinterface
),
1030 INSN_LABEL(newarray
),
1031 INSN_LABEL(anewarray
),
1032 INSN_LABEL(arraylength
),
1034 INSN_LABEL(checkcast
),
1035 INSN_LABEL(instanceof
),
1036 INSN_LABEL(monitorenter
),
1037 INSN_LABEL(monitorexit
),
1038 #ifdef DIRECT_THREADED
1043 INSN_LABEL(multianewarray
),
1045 INSN_LABEL(ifnonnull
),
1053 #ifdef DIRECT_THREADED
1055 #define NEXT_INSN goto *((pc++)->insn)
1056 #define INTVAL() ((pc++)->int_val)
1057 #define AVAL() ((pc++)->datum)
1059 #define GET1S() INTVAL ()
1060 #define GET2S() INTVAL ()
1061 #define GET1U() INTVAL ()
1062 #define GET2U() INTVAL ()
1063 #define AVAL1U() AVAL ()
1064 #define AVAL2U() AVAL ()
1065 #define AVAL2UP() AVAL ()
1066 #define SKIP_GOTO ++pc
1067 #define GOTO_VAL() (insn_slot *) pc->datum
1068 #define PCVAL(unionval) unionval.p
1069 #define AMPAMP(label) &&label
1071 // Compile if we must. NOTE: Double-check locking.
1072 if (prepared
== NULL
)
1074 _Jv_MutexLock (&compile_mutex
);
1075 if (prepared
== NULL
)
1076 compile (insn_target
);
1077 _Jv_MutexUnlock (&compile_mutex
);
1079 pc
= (insn_slot
*) prepared
;
1083 #define NEXT_INSN goto *(insn_target[*pc++])
1085 #define GET1S() get1s (pc++)
1086 #define GET2S() (pc += 2, get2s (pc- 2))
1087 #define GET1U() get1u (pc++)
1088 #define GET2U() (pc += 2, get2u (pc - 2))
1089 #define AVAL1U() ({ int index = get1u (pc++); pool_data[index].o; })
1090 #define AVAL2U() ({ int index = get2u (pc); pc += 2; pool_data[index].o; })
1091 #define AVAL2UP() ({ int index = get2u (pc); pc += 2; &pool_data[index]; })
1092 #define SKIP_GOTO pc += 2
1093 #define GOTO_VAL() pc - 1 + get2s (pc)
1094 #define PCVAL(unionval) unionval.i
1095 #define AMPAMP(label) NULL
1099 #endif /* DIRECT_THREADED */
1101 #define TAKE_GOTO pc = GOTO_VAL ()
1105 // We keep nop around. It is used if we're interpreting the
1106 // bytecodes and not doing direct threading.
1110 /* The first few instructions here are ordered according to their
1111 frequency, in the hope that this will improve code locality a
1114 insn_aload_0
: // 0x2a
1122 insn_iload_1
: // 0x1b
1126 insn_invokevirtual
: // 0xb6
1128 int index
= GET2U ();
1130 /* _Jv_Linker::resolve_pool_entry returns immediately if the
1131 * value already is resolved. If we want to clutter up the
1132 * code here to gain a little performance, then we can check
1133 * the corresponding bit JV_CONSTANT_ResolvedFlag in the tag
1134 * directly. For now, I don't think it is worth it. */
1136 rmeth
= (_Jv_Linker::resolve_pool_entry (defining_class
,
1139 sp
-= rmeth
->stack_item_count
;
1140 // We don't use NULLCHECK here because we can't rely on that
1141 // working if the method is final. So instead we do an
1144 throw new java::lang::NullPointerException
;
1146 if (rmeth
->vtable_index
== -1)
1148 // final methods do not appear in the vtable,
1149 // if it does not appear in the superclass.
1150 fun
= (void (*)()) rmeth
->method
->ncode
;
1154 jobject rcv
= sp
[0].o
;
1155 _Jv_VTable
*table
= *(_Jv_VTable
**) rcv
;
1156 fun
= (void (*)()) table
->get_method (rmeth
->vtable_index
);
1159 #ifdef DIRECT_THREADED
1160 // Rewrite instruction so that we use a faster pre-resolved
1162 pc
[-2].insn
= &&invokevirtual_resolved
;
1163 pc
[-1].datum
= rmeth
;
1164 #endif /* DIRECT_THREADED */
1166 goto perform_invoke
;
1168 #ifdef DIRECT_THREADED
1169 invokevirtual_resolved
:
1171 rmeth
= (_Jv_ResolvedMethod
*) AVAL ();
1172 sp
-= rmeth
->stack_item_count
;
1173 // We don't use NULLCHECK here because we can't rely on that
1174 // working if the method is final. So instead we do an
1177 throw new java::lang::NullPointerException
;
1179 if (rmeth
->vtable_index
== -1)
1181 // final methods do not appear in the vtable,
1182 // if it does not appear in the superclass.
1183 fun
= (void (*)()) rmeth
->method
->ncode
;
1187 jobject rcv
= sp
[0].o
;
1188 _Jv_VTable
*table
= *(_Jv_VTable
**) rcv
;
1189 fun
= (void (*)()) table
->get_method (rmeth
->vtable_index
);
1192 goto perform_invoke
;
1193 #endif /* DIRECT_THREADED */
1197 /* here goes the magic again... */
1198 ffi_cif
*cif
= &rmeth
->cif
;
1199 ffi_raw
*raw
= (ffi_raw
*) sp
;
1203 #if FFI_NATIVE_RAW_API
1204 /* We assume that this is only implemented if it's correct */
1205 /* to use it here. On a 64 bit machine, it never is. */
1206 ffi_raw_call (cif
, fun
, (void*)&rvalue
, raw
);
1208 ffi_java_raw_call (cif
, fun
, (void*)&rvalue
, raw
);
1211 int rtype
= cif
->rtype
->type
;
1213 /* the likelyhood of object, int, or void return is very high,
1214 * so those are checked before the switch */
1215 if (rtype
== FFI_TYPE_POINTER
)
1217 PUSHA (rvalue
.object_value
);
1219 else if (rtype
== FFI_TYPE_SINT32
)
1221 PUSHI (rvalue
.int_value
);
1223 else if (rtype
== FFI_TYPE_VOID
)
1231 case FFI_TYPE_SINT8
:
1232 PUSHI ((jbyte
)(rvalue
.int_value
& 0xff));
1235 case FFI_TYPE_SINT16
:
1236 PUSHI ((jshort
)(rvalue
.int_value
& 0xffff));
1239 case FFI_TYPE_UINT16
:
1240 PUSHI (rvalue
.int_value
& 0xffff);
1243 case FFI_TYPE_FLOAT
:
1244 PUSHF (rvalue
.float_value
);
1247 case FFI_TYPE_DOUBLE
:
1248 PUSHD (rvalue
.double_value
);
1251 case FFI_TYPE_SINT64
:
1252 PUSHL (rvalue
.long_value
);
1256 throw_internal_error ("unknown return type in invokeXXX");
1323 // For direct threaded, bipush and sipush are the same.
1324 #ifndef DIRECT_THREADED
1327 #endif /* DIRECT_THREADED */
1333 // For direct threaded, ldc and ldc_w are the same.
1334 #ifndef DIRECT_THREADED
1335 PUSHA ((jobject
) AVAL1U ());
1337 #endif /* DIRECT_THREADED */
1339 PUSHA ((jobject
) AVAL2U ());
1344 void *where
= AVAL2UP ();
1345 memcpy (sp
, where
, 2*sizeof (_Jv_word
));
1440 jint index
= POPI();
1441 jintArray arr
= (jintArray
) POPA();
1442 NULLARRAYCHECK (arr
);
1443 ARRAYBOUNDSCHECK (arr
, index
);
1444 PUSHI( elements(arr
)[index
] );
1450 jint index
= POPI();
1451 jlongArray arr
= (jlongArray
) POPA();
1452 NULLARRAYCHECK (arr
);
1453 ARRAYBOUNDSCHECK (arr
, index
);
1454 PUSHL( elements(arr
)[index
] );
1460 jint index
= POPI();
1461 jfloatArray arr
= (jfloatArray
) POPA();
1462 NULLARRAYCHECK (arr
);
1463 ARRAYBOUNDSCHECK (arr
, index
);
1464 PUSHF( elements(arr
)[index
] );
1470 jint index
= POPI();
1471 jdoubleArray arr
= (jdoubleArray
) POPA();
1472 NULLARRAYCHECK (arr
);
1473 ARRAYBOUNDSCHECK (arr
, index
);
1474 PUSHD( elements(arr
)[index
] );
1480 jint index
= POPI();
1481 jobjectArray arr
= (jobjectArray
) POPA();
1482 NULLARRAYCHECK (arr
);
1483 ARRAYBOUNDSCHECK (arr
, index
);
1484 PUSHA( elements(arr
)[index
] );
1490 jint index
= POPI();
1491 jbyteArray arr
= (jbyteArray
) POPA();
1492 NULLARRAYCHECK (arr
);
1493 ARRAYBOUNDSCHECK (arr
, index
);
1494 PUSHI( elements(arr
)[index
] );
1500 jint index
= POPI();
1501 jcharArray arr
= (jcharArray
) POPA();
1502 NULLARRAYCHECK (arr
);
1503 ARRAYBOUNDSCHECK (arr
, index
);
1504 PUSHI( elements(arr
)[index
] );
1510 jint index
= POPI();
1511 jshortArray arr
= (jshortArray
) POPA();
1512 NULLARRAYCHECK (arr
);
1513 ARRAYBOUNDSCHECK (arr
, index
);
1514 PUSHI( elements(arr
)[index
] );
1620 jint value
= POPI();
1621 jint index
= POPI();
1622 jintArray arr
= (jintArray
) POPA();
1623 NULLARRAYCHECK (arr
);
1624 ARRAYBOUNDSCHECK (arr
, index
);
1625 elements(arr
)[index
] = value
;
1631 jlong value
= POPL();
1632 jint index
= POPI();
1633 jlongArray arr
= (jlongArray
) POPA();
1634 NULLARRAYCHECK (arr
);
1635 ARRAYBOUNDSCHECK (arr
, index
);
1636 elements(arr
)[index
] = value
;
1642 jfloat value
= POPF();
1643 jint index
= POPI();
1644 jfloatArray arr
= (jfloatArray
) POPA();
1645 NULLARRAYCHECK (arr
);
1646 ARRAYBOUNDSCHECK (arr
, index
);
1647 elements(arr
)[index
] = value
;
1653 jdouble value
= POPD();
1654 jint index
= POPI();
1655 jdoubleArray arr
= (jdoubleArray
) POPA();
1656 NULLARRAYCHECK (arr
);
1657 ARRAYBOUNDSCHECK (arr
, index
);
1658 elements(arr
)[index
] = value
;
1664 jobject value
= POPA();
1665 jint index
= POPI();
1666 jobjectArray arr
= (jobjectArray
) POPA();
1667 NULLARRAYCHECK (arr
);
1668 ARRAYBOUNDSCHECK (arr
, index
);
1669 _Jv_CheckArrayStore (arr
, value
);
1670 elements(arr
)[index
] = value
;
1676 jbyte value
= (jbyte
) POPI();
1677 jint index
= POPI();
1678 jbyteArray arr
= (jbyteArray
) POPA();
1679 NULLARRAYCHECK (arr
);
1680 ARRAYBOUNDSCHECK (arr
, index
);
1681 elements(arr
)[index
] = value
;
1687 jchar value
= (jchar
) POPI();
1688 jint index
= POPI();
1689 jcharArray arr
= (jcharArray
) POPA();
1690 NULLARRAYCHECK (arr
);
1691 ARRAYBOUNDSCHECK (arr
, index
);
1692 elements(arr
)[index
] = value
;
1698 jshort value
= (jshort
) POPI();
1699 jint index
= POPI();
1700 jshortArray arr
= (jshortArray
) POPA();
1701 NULLARRAYCHECK (arr
);
1702 ARRAYBOUNDSCHECK (arr
, index
);
1703 elements(arr
)[index
] = value
;
1721 dupx (sp
, 1, 1); sp
+=1;
1725 dupx (sp
, 1, 2); sp
+=1;
1735 dupx (sp
, 2, 1); sp
+=2;
1739 dupx (sp
, 2, 2); sp
+=2;
1744 jobject tmp1
= POPA();
1745 jobject tmp2
= POPA();
1801 jint value2
= POPI();
1802 jint value1
= POPI();
1803 jint res
= _Jv_divI (value1
, value2
);
1810 jlong value2
= POPL();
1811 jlong value1
= POPL();
1812 jlong res
= _Jv_divJ (value1
, value2
);
1819 jfloat value2
= POPF();
1820 jfloat value1
= POPF();
1821 jfloat res
= value1
/ value2
;
1828 jdouble value2
= POPD();
1829 jdouble value1
= POPD();
1830 jdouble res
= value1
/ value2
;
1837 jint value2
= POPI();
1838 jint value1
= POPI();
1839 jint res
= _Jv_remI (value1
, value2
);
1846 jlong value2
= POPL();
1847 jlong value1
= POPL();
1848 jlong res
= _Jv_remJ (value1
, value2
);
1855 jfloat value2
= POPF();
1856 jfloat value1
= POPF();
1857 jfloat res
= __ieee754_fmod (value1
, value2
);
1864 jdouble value2
= POPD();
1865 jdouble value1
= POPD();
1866 jdouble res
= __ieee754_fmod (value1
, value2
);
1873 jint value
= POPI();
1880 jlong value
= POPL();
1887 jfloat value
= POPF();
1894 jdouble value
= POPD();
1901 jint shift
= (POPI() & 0x1f);
1902 jint value
= POPI();
1903 PUSHI (value
<< shift
);
1909 jint shift
= (POPI() & 0x3f);
1910 jlong value
= POPL();
1911 PUSHL (value
<< shift
);
1917 jint shift
= (POPI() & 0x1f);
1918 jint value
= POPI();
1919 PUSHI (value
>> shift
);
1925 jint shift
= (POPI() & 0x3f);
1926 jlong value
= POPL();
1927 PUSHL (value
>> shift
);
1933 jint shift
= (POPI() & 0x1f);
1934 _Jv_uint value
= (_Jv_uint
) POPI();
1935 PUSHI ((jint
) (value
>> shift
));
1941 jint shift
= (POPI() & 0x3f);
1942 _Jv_ulong value
= (_Jv_ulong
) POPL();
1943 PUSHL ((jlong
) (value
>> shift
));
1973 jint index
= GET1U ();
1974 jint amount
= GET1S ();
1975 locals
[index
].i
+= amount
;
1980 {jlong value
= POPI(); PUSHL (value
);}
1984 {jfloat value
= POPI(); PUSHF (value
);}
1988 {jdouble value
= POPI(); PUSHD (value
);}
1992 {jint value
= POPL(); PUSHI (value
);}
1996 {jfloat value
= POPL(); PUSHF (value
);}
2000 {jdouble value
= POPL(); PUSHD (value
);}
2005 using namespace java::lang
;
2006 jint value
= convert (POPF (), Integer::MIN_VALUE
, Integer::MAX_VALUE
);
2013 using namespace java::lang
;
2014 jlong value
= convert (POPF (), Long::MIN_VALUE
, Long::MAX_VALUE
);
2020 { jdouble value
= POPF (); PUSHD(value
); }
2025 using namespace java::lang
;
2026 jint value
= convert (POPD (), Integer::MIN_VALUE
, Integer::MAX_VALUE
);
2033 using namespace java::lang
;
2034 jlong value
= convert (POPD (), Long::MIN_VALUE
, Long::MAX_VALUE
);
2040 { jfloat value
= POPD (); PUSHF(value
); }
2044 { jbyte value
= POPI (); PUSHI(value
); }
2048 { jchar value
= POPI (); PUSHI(value
); }
2052 { jshort value
= POPI (); PUSHI(value
); }
2057 jlong value2
= POPL ();
2058 jlong value1
= POPL ();
2059 if (value1
> value2
)
2061 else if (value1
== value2
)
2077 jfloat value2
= POPF ();
2078 jfloat value1
= POPF ();
2079 if (value1
> value2
)
2081 else if (value1
== value2
)
2083 else if (value1
< value2
)
2099 jdouble value2
= POPD ();
2100 jdouble value1
= POPD ();
2101 if (value1
> value2
)
2103 else if (value1
== value2
)
2105 else if (value1
< value2
)
2168 jint value2
= POPI();
2169 jint value1
= POPI();
2170 if (value1
== value2
)
2179 jint value2
= POPI();
2180 jint value1
= POPI();
2181 if (value1
!= value2
)
2190 jint value2
= POPI();
2191 jint value1
= POPI();
2192 if (value1
< value2
)
2201 jint value2
= POPI();
2202 jint value1
= POPI();
2203 if (value1
>= value2
)
2212 jint value2
= POPI();
2213 jint value1
= POPI();
2214 if (value1
> value2
)
2223 jint value2
= POPI();
2224 jint value1
= POPI();
2225 if (value1
<= value2
)
2234 jobject value2
= POPA();
2235 jobject value1
= POPA();
2236 if (value1
== value2
)
2245 jobject value2
= POPA();
2246 jobject value1
= POPA();
2247 if (value1
!= value2
)
2255 #ifndef DIRECT_THREADED
2256 // For direct threaded, goto and goto_w are the same.
2257 pc
= pc
- 1 + get4 (pc
);
2259 #endif /* DIRECT_THREADED */
2265 #ifndef DIRECT_THREADED
2266 // For direct threaded, jsr and jsr_w are the same.
2268 pc_t next
= pc
- 1 + get4 (pc
);
2270 PUSHA ((jobject
) pc
);
2274 #endif /* DIRECT_THREADED */
2277 pc_t next
= GOTO_VAL();
2279 PUSHA ((jobject
) pc
);
2286 jint index
= GET1U ();
2287 pc
= (pc_t
) PEEKA (index
);
2293 #ifdef DIRECT_THREADED
2294 void *def
= (pc
++)->datum
;
2298 jint low
= INTVAL ();
2299 jint high
= INTVAL ();
2301 if (index
< low
|| index
> high
)
2302 pc
= (insn_slot
*) def
;
2304 pc
= (insn_slot
*) ((pc
+ index
- low
)->datum
);
2306 pc_t base_pc
= pc
- 1;
2307 int index
= POPI ();
2309 pc_t base
= (pc_t
) bytecode ();
2310 while ((pc
- base
) % 4 != 0)
2313 jint def
= get4 (pc
);
2314 jint low
= get4 (pc
+ 4);
2315 jint high
= get4 (pc
+ 8);
2316 if (index
< low
|| index
> high
)
2319 pc
= base_pc
+ get4 (pc
+ 4 * (index
- low
+ 3));
2320 #endif /* DIRECT_THREADED */
2326 #ifdef DIRECT_THREADED
2327 void *def
= (pc
++)->insn
;
2331 jint npairs
= INTVAL ();
2333 int max
= npairs
- 1;
2336 // Simple binary search...
2339 int half
= (min
+ max
) / 2;
2340 int match
= pc
[2 * half
].int_val
;
2345 pc
= (insn_slot
*) pc
[2 * half
+ 1].datum
;
2348 else if (index
< match
)
2349 // We can use HALF - 1 here because we check again on
2353 // We can use HALF + 1 here because we check again on
2357 if (index
== pc
[2 * min
].int_val
)
2358 pc
= (insn_slot
*) pc
[2 * min
+ 1].datum
;
2360 pc
= (insn_slot
*) def
;
2362 unsigned char *base_pc
= pc
-1;
2365 unsigned char* base
= bytecode ();
2366 while ((pc
-base
) % 4 != 0)
2369 jint def
= get4 (pc
);
2370 jint npairs
= get4 (pc
+4);
2375 // Simple binary search...
2378 int half
= (min
+max
)/2;
2379 int match
= get4 (pc
+ 4*(2 + 2*half
));
2383 else if (index
< match
)
2384 // We can use HALF - 1 here because we check again on
2388 // We can use HALF + 1 here because we check again on
2393 if (index
== get4 (pc
+ 4*(2 + 2*min
)))
2394 pc
= base_pc
+ get4 (pc
+ 4*(2 + 2*min
+ 1));
2397 #endif /* DIRECT_THREADED */
2402 *(jobject
*) retp
= POPA ();
2406 *(jlong
*) retp
= POPL ();
2410 *(jfloat
*) retp
= POPF ();
2414 *(jdouble
*) retp
= POPD ();
2418 *(jint
*) retp
= POPI ();
2426 jint fieldref_index
= GET2U ();
2427 _Jv_Linker::resolve_pool_entry (defining_class
, fieldref_index
);
2428 _Jv_Field
*field
= pool_data
[fieldref_index
].field
;
2430 if ((field
->flags
& Modifier::STATIC
) == 0)
2431 throw_incompatible_class_change_error
2432 (JvNewStringLatin1 ("field no longer static"));
2434 jclass type
= field
->type
;
2436 // We rewrite the instruction once we discover what it refers
2438 void *newinsn
= NULL
;
2439 if (type
->isPrimitive ())
2441 switch (type
->size_in_bytes
)
2444 PUSHI (*field
->u
.byte_addr
);
2445 newinsn
= AMPAMP (getstatic_resolved_1
);
2449 if (type
== JvPrimClass (char))
2451 PUSHI (*field
->u
.char_addr
);
2452 newinsn
= AMPAMP (getstatic_resolved_char
);
2456 PUSHI (*field
->u
.short_addr
);
2457 newinsn
= AMPAMP (getstatic_resolved_short
);
2462 PUSHI(*field
->u
.int_addr
);
2463 newinsn
= AMPAMP (getstatic_resolved_4
);
2467 PUSHL(*field
->u
.long_addr
);
2468 newinsn
= AMPAMP (getstatic_resolved_8
);
2474 PUSHA(*field
->u
.object_addr
);
2475 newinsn
= AMPAMP (getstatic_resolved_obj
);
2478 #ifdef DIRECT_THREADED
2479 pc
[-2].insn
= newinsn
;
2480 pc
[-1].datum
= field
->u
.addr
;
2481 #endif /* DIRECT_THREADED */
2485 #ifdef DIRECT_THREADED
2486 getstatic_resolved_1
:
2487 PUSHI (*(jbyte
*) AVAL ());
2490 getstatic_resolved_char
:
2491 PUSHI (*(jchar
*) AVAL ());
2494 getstatic_resolved_short
:
2495 PUSHI (*(jshort
*) AVAL ());
2498 getstatic_resolved_4
:
2499 PUSHI (*(jint
*) AVAL ());
2502 getstatic_resolved_8
:
2503 PUSHL (*(jlong
*) AVAL ());
2506 getstatic_resolved_obj
:
2507 PUSHA (*(jobject
*) AVAL ());
2509 #endif /* DIRECT_THREADED */
2513 jint fieldref_index
= GET2U ();
2514 _Jv_Linker::resolve_pool_entry (defining_class
, fieldref_index
);
2515 _Jv_Field
*field
= pool_data
[fieldref_index
].field
;
2517 if ((field
->flags
& Modifier::STATIC
) != 0)
2518 throw_incompatible_class_change_error
2519 (JvNewStringLatin1 ("field is static"));
2521 jclass type
= field
->type
;
2522 jint field_offset
= field
->u
.boffset
;
2523 if (field_offset
> 0xffff)
2524 throw new java::lang::VirtualMachineError
;
2526 jobject obj
= POPA();
2529 void *newinsn
= NULL
;
2530 _Jv_value
*val
= (_Jv_value
*) ((char *)obj
+ field_offset
);
2531 if (type
->isPrimitive ())
2533 switch (type
->size_in_bytes
)
2536 PUSHI (val
->byte_value
);
2537 newinsn
= AMPAMP (getfield_resolved_1
);
2541 if (type
== JvPrimClass (char))
2543 PUSHI (val
->char_value
);
2544 newinsn
= AMPAMP (getfield_resolved_char
);
2548 PUSHI (val
->short_value
);
2549 newinsn
= AMPAMP (getfield_resolved_short
);
2554 PUSHI (val
->int_value
);
2555 newinsn
= AMPAMP (getfield_resolved_4
);
2559 PUSHL (val
->long_value
);
2560 newinsn
= AMPAMP (getfield_resolved_8
);
2566 PUSHA (val
->object_value
);
2567 newinsn
= AMPAMP (getfield_resolved_obj
);
2570 #ifdef DIRECT_THREADED
2571 pc
[-2].insn
= newinsn
;
2572 pc
[-1].int_val
= field_offset
;
2573 #endif /* DIRECT_THREADED */
2577 #ifdef DIRECT_THREADED
2578 getfield_resolved_1
:
2580 char *obj
= (char *) POPA ();
2582 PUSHI (*(jbyte
*) (obj
+ INTVAL ()));
2586 getfield_resolved_char
:
2588 char *obj
= (char *) POPA ();
2590 PUSHI (*(jchar
*) (obj
+ INTVAL ()));
2594 getfield_resolved_short
:
2596 char *obj
= (char *) POPA ();
2598 PUSHI (*(jshort
*) (obj
+ INTVAL ()));
2602 getfield_resolved_4
:
2604 char *obj
= (char *) POPA ();
2606 PUSHI (*(jint
*) (obj
+ INTVAL ()));
2610 getfield_resolved_8
:
2612 char *obj
= (char *) POPA ();
2614 PUSHL (*(jlong
*) (obj
+ INTVAL ()));
2618 getfield_resolved_obj
:
2620 char *obj
= (char *) POPA ();
2622 PUSHA (*(jobject
*) (obj
+ INTVAL ()));
2625 #endif /* DIRECT_THREADED */
2629 jint fieldref_index
= GET2U ();
2630 _Jv_Linker::resolve_pool_entry (defining_class
, fieldref_index
);
2631 _Jv_Field
*field
= pool_data
[fieldref_index
].field
;
2633 jclass type
= field
->type
;
2635 // ResolvePoolEntry cannot check this
2636 if ((field
->flags
& Modifier::STATIC
) == 0)
2637 throw_incompatible_class_change_error
2638 (JvNewStringLatin1 ("field no longer static"));
2640 void *newinsn
= NULL
;
2641 if (type
->isPrimitive ())
2643 switch (type
->size_in_bytes
)
2647 jint value
= POPI();
2648 *field
->u
.byte_addr
= value
;
2649 newinsn
= AMPAMP (putstatic_resolved_1
);
2655 jint value
= POPI();
2656 *field
->u
.char_addr
= value
;
2657 newinsn
= AMPAMP (putstatic_resolved_2
);
2663 jint value
= POPI();
2664 *field
->u
.int_addr
= value
;
2665 newinsn
= AMPAMP (putstatic_resolved_4
);
2671 jlong value
= POPL();
2672 *field
->u
.long_addr
= value
;
2673 newinsn
= AMPAMP (putstatic_resolved_8
);
2680 jobject value
= POPA();
2681 *field
->u
.object_addr
= value
;
2682 newinsn
= AMPAMP (putstatic_resolved_obj
);
2685 #ifdef DIRECT_THREADED
2686 pc
[-2].insn
= newinsn
;
2687 pc
[-1].datum
= field
->u
.addr
;
2688 #endif /* DIRECT_THREADED */
2692 #ifdef DIRECT_THREADED
2693 putstatic_resolved_1
:
2694 *(jbyte
*) AVAL () = POPI ();
2697 putstatic_resolved_2
:
2698 *(jchar
*) AVAL () = POPI ();
2701 putstatic_resolved_4
:
2702 *(jint
*) AVAL () = POPI ();
2705 putstatic_resolved_8
:
2706 *(jlong
*) AVAL () = POPL ();
2709 putstatic_resolved_obj
:
2710 *(jobject
*) AVAL () = POPA ();
2712 #endif /* DIRECT_THREADED */
2716 jint fieldref_index
= GET2U ();
2717 _Jv_Linker::resolve_pool_entry (defining_class
, fieldref_index
);
2718 _Jv_Field
*field
= pool_data
[fieldref_index
].field
;
2720 jclass type
= field
->type
;
2722 if ((field
->flags
& Modifier::STATIC
) != 0)
2723 throw_incompatible_class_change_error
2724 (JvNewStringLatin1 ("field is static"));
2726 jint field_offset
= field
->u
.boffset
;
2727 if (field_offset
> 0xffff)
2728 throw new java::lang::VirtualMachineError
;
2730 void *newinsn
= NULL
;
2731 if (type
->isPrimitive ())
2733 switch (type
->size_in_bytes
)
2737 jint value
= POPI();
2738 jobject obj
= POPA();
2740 *(jbyte
*) ((char*)obj
+ field_offset
) = value
;
2741 newinsn
= AMPAMP (putfield_resolved_1
);
2747 jint value
= POPI();
2748 jobject obj
= POPA();
2750 *(jchar
*) ((char*)obj
+ field_offset
) = value
;
2751 newinsn
= AMPAMP (putfield_resolved_2
);
2757 jint value
= POPI();
2758 jobject obj
= POPA();
2760 *(jint
*) ((char*)obj
+ field_offset
) = value
;
2761 newinsn
= AMPAMP (putfield_resolved_4
);
2767 jlong value
= POPL();
2768 jobject obj
= POPA();
2770 *(jlong
*) ((char*)obj
+ field_offset
) = value
;
2771 newinsn
= AMPAMP (putfield_resolved_8
);
2778 jobject value
= POPA();
2779 jobject obj
= POPA();
2781 *(jobject
*) ((char*)obj
+ field_offset
) = value
;
2782 newinsn
= AMPAMP (putfield_resolved_obj
);
2785 #ifdef DIRECT_THREADED
2786 pc
[-2].insn
= newinsn
;
2787 pc
[-1].int_val
= field_offset
;
2788 #endif /* DIRECT_THREADED */
2792 #ifdef DIRECT_THREADED
2793 putfield_resolved_1
:
2796 char *obj
= (char *) POPA ();
2798 *(jbyte
*) (obj
+ INTVAL ()) = val
;
2802 putfield_resolved_2
:
2805 char *obj
= (char *) POPA ();
2807 *(jchar
*) (obj
+ INTVAL ()) = val
;
2811 putfield_resolved_4
:
2814 char *obj
= (char *) POPA ();
2816 *(jint
*) (obj
+ INTVAL ()) = val
;
2820 putfield_resolved_8
:
2822 jlong val
= POPL ();
2823 char *obj
= (char *) POPA ();
2825 *(jlong
*) (obj
+ INTVAL ()) = val
;
2829 putfield_resolved_obj
:
2831 jobject val
= POPA ();
2832 char *obj
= (char *) POPA ();
2834 *(jobject
*) (obj
+ INTVAL ()) = val
;
2837 #endif /* DIRECT_THREADED */
2841 int index
= GET2U ();
2843 rmeth
= (_Jv_Linker::resolve_pool_entry (defining_class
,
2846 sp
-= rmeth
->stack_item_count
;
2848 // We don't use NULLCHECK here because we can't rely on that
2849 // working for <init>. So instead we do an explicit test.
2851 throw new java::lang::NullPointerException
;
2853 fun
= (void (*)()) rmeth
->method
->ncode
;
2855 #ifdef DIRECT_THREADED
2856 // Rewrite instruction so that we use a faster pre-resolved
2858 pc
[-2].insn
= &&invokespecial_resolved
;
2859 pc
[-1].datum
= rmeth
;
2860 #endif /* DIRECT_THREADED */
2862 goto perform_invoke
;
2864 #ifdef DIRECT_THREADED
2865 invokespecial_resolved
:
2867 rmeth
= (_Jv_ResolvedMethod
*) AVAL ();
2868 sp
-= rmeth
->stack_item_count
;
2869 // We don't use NULLCHECK here because we can't rely on that
2870 // working for <init>. So instead we do an explicit test.
2872 throw new java::lang::NullPointerException
;
2873 fun
= (void (*)()) rmeth
->method
->ncode
;
2875 goto perform_invoke
;
2876 #endif /* DIRECT_THREADED */
2880 int index
= GET2U ();
2882 rmeth
= (_Jv_Linker::resolve_pool_entry (defining_class
,
2885 sp
-= rmeth
->stack_item_count
;
2887 fun
= (void (*)()) rmeth
->method
->ncode
;
2889 #ifdef DIRECT_THREADED
2890 // Rewrite instruction so that we use a faster pre-resolved
2892 pc
[-2].insn
= &&invokestatic_resolved
;
2893 pc
[-1].datum
= rmeth
;
2894 #endif /* DIRECT_THREADED */
2896 goto perform_invoke
;
2898 #ifdef DIRECT_THREADED
2899 invokestatic_resolved
:
2901 rmeth
= (_Jv_ResolvedMethod
*) AVAL ();
2902 sp
-= rmeth
->stack_item_count
;
2903 fun
= (void (*)()) rmeth
->method
->ncode
;
2905 goto perform_invoke
;
2906 #endif /* DIRECT_THREADED */
2908 insn_invokeinterface
:
2910 int index
= GET2U ();
2912 rmeth
= (_Jv_Linker::resolve_pool_entry (defining_class
,
2915 sp
-= rmeth
->stack_item_count
;
2917 jobject rcv
= sp
[0].o
;
2922 _Jv_LookupInterfaceMethod (rcv
->getClass (),
2923 rmeth
->method
->name
,
2924 rmeth
->method
->signature
);
2926 #ifdef DIRECT_THREADED
2927 // Rewrite instruction so that we use a faster pre-resolved
2929 pc
[-2].insn
= &&invokeinterface_resolved
;
2930 pc
[-1].datum
= rmeth
;
2932 // Skip dummy bytes.
2934 #endif /* DIRECT_THREADED */
2936 goto perform_invoke
;
2938 #ifdef DIRECT_THREADED
2939 invokeinterface_resolved
:
2941 rmeth
= (_Jv_ResolvedMethod
*) AVAL ();
2942 sp
-= rmeth
->stack_item_count
;
2943 jobject rcv
= sp
[0].o
;
2946 _Jv_LookupInterfaceMethod (rcv
->getClass (),
2947 rmeth
->method
->name
,
2948 rmeth
->method
->signature
);
2950 goto perform_invoke
;
2951 #endif /* DIRECT_THREADED */
2955 int index
= GET2U ();
2956 jclass klass
= (_Jv_Linker::resolve_pool_entry (defining_class
,
2958 /* VM spec, section 3.11.5 */
2959 if ((klass
->getModifiers() & Modifier::ABSTRACT
)
2960 || klass
->isInterface())
2961 throw new java::lang::InstantiationException
;
2962 jobject res
= _Jv_AllocObject (klass
);
2965 #ifdef DIRECT_THREADED
2966 pc
[-2].insn
= &&new_resolved
;
2967 pc
[-1].datum
= klass
;
2968 #endif /* DIRECT_THREADED */
2972 #ifdef DIRECT_THREADED
2975 jclass klass
= (jclass
) AVAL ();
2976 jobject res
= _Jv_AllocObject (klass
);
2980 #endif /* DIRECT_THREADED */
2984 int atype
= GET1U ();
2986 jobject result
= _Jv_NewArray (atype
, size
);
2993 int index
= GET2U ();
2994 jclass klass
= (_Jv_Linker::resolve_pool_entry (defining_class
,
2997 jobject result
= _Jv_NewObjectArray (size
, klass
, 0);
3000 #ifdef DIRECT_THREADED
3001 pc
[-2].insn
= &&anewarray_resolved
;
3002 pc
[-1].datum
= klass
;
3003 #endif /* DIRECT_THREADED */
3007 #ifdef DIRECT_THREADED
3010 jclass klass
= (jclass
) AVAL ();
3012 jobject result
= _Jv_NewObjectArray (size
, klass
, 0);
3016 #endif /* DIRECT_THREADED */
3020 __JArray
*arr
= (__JArray
*)POPA();
3021 NULLARRAYCHECK (arr
);
3022 PUSHI (arr
->length
);
3028 jobject value
= POPA();
3029 throw static_cast<jthrowable
>(value
);
3035 jobject value
= POPA();
3036 jint index
= GET2U ();
3037 jclass to
= (_Jv_Linker::resolve_pool_entry (defining_class
,
3040 if (value
!= NULL
&& ! to
->isInstance (value
))
3041 throw new java::lang::ClassCastException (to
->getName());
3045 #ifdef DIRECT_THREADED
3046 pc
[-2].insn
= &&checkcast_resolved
;
3048 #endif /* DIRECT_THREADED */
3052 #ifdef DIRECT_THREADED
3055 jobject value
= POPA ();
3056 jclass to
= (jclass
) AVAL ();
3057 if (value
!= NULL
&& ! to
->isInstance (value
))
3058 throw new java::lang::ClassCastException (to
->getName());
3062 #endif /* DIRECT_THREADED */
3066 jobject value
= POPA();
3067 jint index
= GET2U ();
3068 jclass to
= (_Jv_Linker::resolve_pool_entry (defining_class
,
3070 PUSHI (to
->isInstance (value
));
3072 #ifdef DIRECT_THREADED
3073 pc
[-2].insn
= &&instanceof_resolved
;
3075 #endif /* DIRECT_THREADED */
3079 #ifdef DIRECT_THREADED
3080 instanceof_resolved
:
3082 jobject value
= POPA ();
3083 jclass to
= (jclass
) AVAL ();
3084 PUSHI (to
->isInstance (value
));
3087 #endif /* DIRECT_THREADED */
3091 jobject value
= POPA();
3093 _Jv_MonitorEnter (value
);
3099 jobject value
= POPA();
3101 _Jv_MonitorExit (value
);
3107 jobject val
= POPA();
3117 jobject val
= POPA();
3125 insn_multianewarray
:
3127 int kind_index
= GET2U ();
3131 = (_Jv_Linker::resolve_pool_entry (defining_class
,
3133 jint
*sizes
= (jint
*) __builtin_alloca (sizeof (jint
)*dim
);
3135 for (int i
= dim
- 1; i
>= 0; i
--)
3140 jobject res
= _Jv_NewMultiArray (type
,dim
, sizes
);
3146 #ifndef DIRECT_THREADED
3149 jint the_mod_op
= get1u (pc
++);
3150 jint wide
= get2u (pc
); pc
+= 2;
3195 pc
= (unsigned char*) PEEKA (wide
);
3200 jint amount
= get2s (pc
); pc
+= 2;
3201 jint value
= PEEKI (wide
);
3202 POKEI (wide
, value
+amount
);
3207 throw_internal_error ("illegal bytecode modified by wide");
3211 #endif /* DIRECT_THREADED */
3213 catch (java::lang::Throwable
*ex
)
3215 #ifdef DIRECT_THREADED
3216 void *logical_pc
= (void *) ((insn_slot
*) pc
- 1);
3218 int logical_pc
= pc
- 1 - bytecode ();
3220 _Jv_InterpException
*exc
= exceptions ();
3221 jclass exc_class
= ex
->getClass ();
3223 for (int i
= 0; i
< exc_count
; i
++)
3225 if (PCVAL (exc
[i
].start_pc
) <= logical_pc
3226 && logical_pc
< PCVAL (exc
[i
].end_pc
))
3228 #ifdef DIRECT_THREADED
3229 jclass handler
= (jclass
) exc
[i
].handler_type
.p
;
3231 jclass handler
= NULL
;
3232 if (exc
[i
].handler_type
.i
!= 0)
3233 handler
= (_Jv_Linker::resolve_pool_entry (defining_class
,
3234 exc
[i
].handler_type
.i
)).clazz
;
3235 #endif /* DIRECT_THREADED */
3237 if (handler
== NULL
|| handler
->isAssignableFrom (exc_class
))
3239 #ifdef DIRECT_THREADED
3240 pc
= (insn_slot
*) exc
[i
].handler_pc
.p
;
3242 pc
= bytecode () + exc
[i
].handler_pc
.i
;
3243 #endif /* DIRECT_THREADED */
3245 sp
++->o
= ex
; // Push exception.
3251 // No handler, so re-throw.
3257 throw_internal_error (char *msg
)
3259 throw new java::lang::InternalError (JvNewStringLatin1 (msg
));
3263 throw_incompatible_class_change_error (jstring msg
)
3265 throw new java::lang::IncompatibleClassChangeError (msg
);
3269 static java::lang::NullPointerException
*null_pointer_exc
;
3271 throw_null_pointer_exception ()
3273 if (null_pointer_exc
== NULL
)
3274 null_pointer_exc
= new java::lang::NullPointerException
;
3276 throw null_pointer_exc
;
3280 /** Do static initialization for fields with a constant initializer */
3282 _Jv_InitField (jobject obj
, jclass klass
, int index
)
3284 using namespace java::lang::reflect
;
3286 if (obj
!= 0 && klass
== 0)
3287 klass
= obj
->getClass ();
3289 if (!_Jv_IsInterpretedClass (klass
))
3292 _Jv_InterpClass
*iclass
= (_Jv_InterpClass
*)klass
->aux_info
;
3294 _Jv_Field
* field
= (&klass
->fields
[0]) + index
;
3296 if (index
> klass
->field_count
)
3297 throw_internal_error ("field out of range");
3299 int init
= iclass
->field_initializers
[index
];
3303 _Jv_Constants
*pool
= &klass
->constants
;
3304 int tag
= pool
->tags
[init
];
3306 if (! field
->isResolved ())
3307 throw_internal_error ("initializing unresolved field");
3309 if (obj
==0 && ((field
->flags
& Modifier::STATIC
) == 0))
3310 throw_internal_error ("initializing non-static field with no object");
3314 if ((field
->flags
& Modifier::STATIC
) != 0)
3315 addr
= (void*) field
->u
.addr
;
3317 addr
= (void*) (((char*)obj
) + field
->u
.boffset
);
3321 case JV_CONSTANT_String
:
3324 str
= _Jv_NewStringUtf8Const (pool
->data
[init
].utf8
);
3325 pool
->data
[init
].string
= str
;
3326 pool
->tags
[init
] = JV_CONSTANT_ResolvedString
;
3330 case JV_CONSTANT_ResolvedString
:
3331 if (! (field
->type
== &java::lang::String::class$
3332 || field
->type
== &java::lang::Class::class$
))
3333 throw_class_format_error ("string initialiser to non-string field");
3335 *(jstring
*)addr
= pool
->data
[init
].string
;
3338 case JV_CONSTANT_Integer
:
3340 int value
= pool
->data
[init
].i
;
3342 if (field
->type
== JvPrimClass (boolean
))
3343 *(jboolean
*)addr
= (jboolean
)value
;
3345 else if (field
->type
== JvPrimClass (byte
))
3346 *(jbyte
*)addr
= (jbyte
)value
;
3348 else if (field
->type
== JvPrimClass (char))
3349 *(jchar
*)addr
= (jchar
)value
;
3351 else if (field
->type
== JvPrimClass (short))
3352 *(jshort
*)addr
= (jshort
)value
;
3354 else if (field
->type
== JvPrimClass (int))
3355 *(jint
*)addr
= (jint
)value
;
3358 throw_class_format_error ("erroneous field initializer");
3362 case JV_CONSTANT_Long
:
3363 if (field
->type
!= JvPrimClass (long))
3364 throw_class_format_error ("erroneous field initializer");
3366 *(jlong
*)addr
= _Jv_loadLong (&pool
->data
[init
]);
3369 case JV_CONSTANT_Float
:
3370 if (field
->type
!= JvPrimClass (float))
3371 throw_class_format_error ("erroneous field initializer");
3373 *(jfloat
*)addr
= pool
->data
[init
].f
;
3376 case JV_CONSTANT_Double
:
3377 if (field
->type
!= JvPrimClass (double))
3378 throw_class_format_error ("erroneous field initializer");
3380 *(jdouble
*)addr
= _Jv_loadDouble (&pool
->data
[init
]);
3384 throw_class_format_error ("erroneous field initializer");
3388 inline static unsigned char*
3389 skip_one_type (unsigned char* ptr
)
3400 do { ch
= *ptr
++; } while (ch
!= ';');
3407 get_ffi_type_from_signature (unsigned char* ptr
)
3413 return &ffi_type_pointer
;
3417 // On some platforms a bool is a byte, on others an int.
3418 if (sizeof (jboolean
) == sizeof (jbyte
))
3419 return &ffi_type_sint8
;
3422 JvAssert (sizeof (jbyte
) == sizeof (jint
));
3423 return &ffi_type_sint32
;
3428 return &ffi_type_sint8
;
3432 return &ffi_type_uint16
;
3436 return &ffi_type_sint16
;
3440 return &ffi_type_sint32
;
3444 return &ffi_type_sint64
;
3448 return &ffi_type_float
;
3452 return &ffi_type_double
;
3456 return &ffi_type_void
;
3460 throw_internal_error ("unknown type in signature");
3463 /* this function yields the number of actual arguments, that is, if the
3464 * function is non-static, then one is added to the number of elements
3465 * found in the signature */
3468 _Jv_count_arguments (_Jv_Utf8Const
*signature
,
3471 unsigned char *ptr
= (unsigned char*) signature
->chars();
3472 int arg_count
= staticp
? 0 : 1;
3474 /* first, count number of arguments */
3482 ptr
= skip_one_type (ptr
);
3489 /* This beast will build a cif, given the signature. Memory for
3490 * the cif itself and for the argument types must be allocated by the
3495 init_cif (_Jv_Utf8Const
* signature
,
3499 ffi_type
**arg_types
,
3502 unsigned char *ptr
= (unsigned char*) signature
->chars();
3504 int arg_index
= 0; // arg number
3505 int item_count
= 0; // stack-item count
3510 arg_types
[arg_index
++] = &ffi_type_pointer
;
3520 arg_types
[arg_index
++] = get_ffi_type_from_signature (ptr
);
3522 if (*ptr
== 'J' || *ptr
== 'D')
3527 ptr
= skip_one_type (ptr
);
3532 ffi_type
*rtype
= get_ffi_type_from_signature (ptr
);
3534 ptr
= skip_one_type (ptr
);
3535 if (ptr
!= (unsigned char*)signature
->chars() + signature
->len())
3536 throw_internal_error ("did not find end of signature");
3538 if (ffi_prep_cif (cif
, FFI_DEFAULT_ABI
,
3539 arg_count
, rtype
, arg_types
) != FFI_OK
)
3540 throw_internal_error ("ffi_prep_cif failed");
3542 if (rtype_p
!= NULL
)
3548 #if FFI_NATIVE_RAW_API
3549 # define FFI_PREP_RAW_CLOSURE ffi_prep_raw_closure
3550 # define FFI_RAW_SIZE ffi_raw_size
3552 # define FFI_PREP_RAW_CLOSURE ffi_prep_java_raw_closure
3553 # define FFI_RAW_SIZE ffi_java_raw_size
3556 /* we put this one here, and not in interpret.cc because it
3557 * calls the utility routines _Jv_count_arguments
3558 * which are static to this module. The following struct defines the
3559 * layout we use for the stubs, it's only used in the ncode method. */
3562 ffi_raw_closure closure
;
3564 ffi_type
*arg_types
[0];
3567 typedef void (*ffi_closure_fun
) (ffi_cif
*,void*,ffi_raw
*,void*);
3570 _Jv_InterpMethod::ncode ()
3572 using namespace java::lang::reflect
;
3574 if (self
->ncode
!= 0)
3577 jboolean staticp
= (self
->accflags
& Modifier::STATIC
) != 0;
3578 int arg_count
= _Jv_count_arguments (self
->signature
, staticp
);
3580 ncode_closure
*closure
=
3581 (ncode_closure
*)_Jv_AllocBytes (sizeof (ncode_closure
)
3582 + arg_count
* sizeof (ffi_type
*));
3584 init_cif (self
->signature
,
3588 &closure
->arg_types
[0],
3591 ffi_closure_fun fun
;
3593 args_raw_size
= FFI_RAW_SIZE (&closure
->cif
);
3595 JvAssert ((self
->accflags
& Modifier::NATIVE
) == 0);
3597 if ((self
->accflags
& Modifier::SYNCHRONIZED
) != 0)
3600 fun
= (ffi_closure_fun
)&_Jv_InterpMethod::run_synch_class
;
3602 fun
= (ffi_closure_fun
)&_Jv_InterpMethod::run_synch_object
;
3607 fun
= (ffi_closure_fun
)&_Jv_InterpMethod::run_class
;
3609 fun
= (ffi_closure_fun
)&_Jv_InterpMethod::run_normal
;
3612 FFI_PREP_RAW_CLOSURE (&closure
->closure
,
3617 self
->ncode
= (void*)closure
;
3622 _Jv_JNIMethod::ncode ()
3624 using namespace java::lang::reflect
;
3626 if (self
->ncode
!= 0)
3629 jboolean staticp
= (self
->accflags
& Modifier::STATIC
) != 0;
3630 int arg_count
= _Jv_count_arguments (self
->signature
, staticp
);
3632 ncode_closure
*closure
=
3633 (ncode_closure
*)_Jv_AllocBytes (sizeof (ncode_closure
)
3634 + arg_count
* sizeof (ffi_type
*));
3637 init_cif (self
->signature
,
3641 &closure
->arg_types
[0],
3644 ffi_closure_fun fun
;
3646 args_raw_size
= FFI_RAW_SIZE (&closure
->cif
);
3648 // Initialize the argument types and CIF that represent the actual
3649 // underlying JNI function.
3651 if ((self
->accflags
& Modifier::STATIC
))
3653 jni_arg_types
= (ffi_type
**) _Jv_AllocBytes ((extra_args
+ arg_count
)
3654 * sizeof (ffi_type
*));
3656 jni_arg_types
[offset
++] = &ffi_type_pointer
;
3657 if ((self
->accflags
& Modifier::STATIC
))
3658 jni_arg_types
[offset
++] = &ffi_type_pointer
;
3659 memcpy (&jni_arg_types
[offset
], &closure
->arg_types
[0],
3660 arg_count
* sizeof (ffi_type
*));
3662 if (ffi_prep_cif (&jni_cif
, _Jv_platform_ffi_abi
,
3663 extra_args
+ arg_count
, rtype
,
3664 jni_arg_types
) != FFI_OK
)
3665 throw_internal_error ("ffi_prep_cif failed for JNI function");
3667 JvAssert ((self
->accflags
& Modifier::NATIVE
) != 0);
3669 // FIXME: for now we assume that all native methods for
3670 // interpreted code use JNI.
3671 fun
= (ffi_closure_fun
) &_Jv_JNIMethod::call
;
3673 FFI_PREP_RAW_CLOSURE (&closure
->closure
,
3678 self
->ncode
= (void *) closure
;
3683 throw_class_format_error (jstring msg
)
3686 ? new java::lang::ClassFormatError (msg
)
3687 : new java::lang::ClassFormatError
);
3691 throw_class_format_error (char *msg
)
3693 throw_class_format_error (JvNewStringLatin1 (msg
));
3699 _Jv_InterpreterEngine::do_verify (jclass klass
)
3701 _Jv_InterpClass
*iclass
= (_Jv_InterpClass
*) klass
->aux_info
;
3702 for (int i
= 0; i
< klass
->method_count
; i
++)
3704 using namespace java::lang::reflect
;
3705 _Jv_MethodBase
*imeth
= iclass
->interpreted_methods
[i
];
3706 _Jv_ushort accflags
= klass
->methods
[i
].accflags
;
3707 if ((accflags
& (Modifier::NATIVE
| Modifier::ABSTRACT
)) == 0)
3709 _Jv_InterpMethod
*im
= reinterpret_cast<_Jv_InterpMethod
*> (imeth
);
3710 _Jv_VerifyMethod (im
);
3716 _Jv_InterpreterEngine::do_create_ncode (jclass klass
)
3718 _Jv_InterpClass
*iclass
= (_Jv_InterpClass
*) klass
->aux_info
;
3719 for (int i
= 0; i
< klass
->method_count
; i
++)
3721 // Just skip abstract methods. This is particularly important
3722 // because we don't resize the interpreted_methods array when
3723 // miranda methods are added to it.
3724 if ((klass
->methods
[i
].accflags
3725 & java::lang::reflect::Modifier::ABSTRACT
)
3729 _Jv_MethodBase
*imeth
= iclass
->interpreted_methods
[i
];
3731 if ((klass
->methods
[i
].accflags
& java::lang::reflect::Modifier::NATIVE
)
3734 // You might think we could use a virtual `ncode' method in
3735 // the _Jv_MethodBase and unify the native and non-native
3736 // cases. Well, we can't, because we don't allocate these
3737 // objects using `new', and thus they don't get a vtable.
3738 _Jv_JNIMethod
*jnim
= reinterpret_cast<_Jv_JNIMethod
*> (imeth
);
3739 klass
->methods
[i
].ncode
= jnim
->ncode ();
3741 else if (imeth
!= 0) // it could be abstract
3743 _Jv_InterpMethod
*im
= reinterpret_cast<_Jv_InterpMethod
*> (imeth
);
3744 klass
->methods
[i
].ncode
= im
->ncode ();
3750 _Jv_InterpreterEngine::do_allocate_static_fields (jclass klass
,
3753 _Jv_InterpClass
*iclass
= (_Jv_InterpClass
*) klass
->aux_info
;
3755 char *static_data
= (char *) _Jv_AllocBytes (static_size
);
3756 memset (static_data
, 0, static_size
);
3758 for (int i
= 0; i
< klass
->field_count
; i
++)
3760 _Jv_Field
*field
= &klass
->fields
[i
];
3762 if ((field
->flags
& java::lang::reflect::Modifier::STATIC
) != 0)
3764 field
->u
.addr
= static_data
+ field
->u
.boffset
;
3766 if (iclass
->field_initializers
[i
] != 0)
3768 _Jv_Linker::resolve_field (field
, klass
->loader
);
3769 _Jv_InitField (0, klass
, i
);
3774 // Now we don't need the field_initializers anymore, so let the
3775 // collector get rid of it.
3776 iclass
->field_initializers
= 0;
3779 _Jv_ResolvedMethod
*
3780 _Jv_InterpreterEngine::do_resolve_method (_Jv_Method
*method
, jclass klass
,
3781 jboolean staticp
, jint vtable_index
)
3783 int arg_count
= _Jv_count_arguments (method
->signature
, staticp
);
3785 _Jv_ResolvedMethod
* result
= (_Jv_ResolvedMethod
*)
3786 _Jv_AllocBytes (sizeof (_Jv_ResolvedMethod
)
3787 + arg_count
*sizeof (ffi_type
*));
3789 result
->stack_item_count
3790 = init_cif (method
->signature
,
3794 &result
->arg_types
[0],
3797 result
->vtable_index
= vtable_index
;
3798 result
->method
= method
;
3799 result
->klass
= klass
;
3805 _Jv_InterpreterEngine::do_post_miranda_hook (jclass klass
)
3807 _Jv_InterpClass
*iclass
= (_Jv_InterpClass
*) klass
->aux_info
;
3808 for (int i
= 0; i
< klass
->method_count
; i
++)
3810 // Just skip abstract methods. This is particularly important
3811 // because we don't resize the interpreted_methods array when
3812 // miranda methods are added to it.
3813 if ((klass
->methods
[i
].accflags
3814 & java::lang::reflect::Modifier::ABSTRACT
)
3817 // Miranda method additions mean that the `methods' array moves.
3818 // We cache a pointer into this array, so we have to update.
3819 iclass
->interpreted_methods
[i
]->self
= &klass
->methods
[i
];
3823 #endif // INTERPRETER