270
271 _fast_iload ,
272 _fast_iload2 ,
273 _fast_icaload ,
274
275 _fast_invokevfinal ,
276 _fast_linearswitch ,
277 _fast_binaryswitch ,
278
279 // special handling of oop constants:
280 _fast_aldc ,
281 _fast_aldc_w ,
282
283 _return_register_finalizer ,
284
285 // special handling of signature-polymorphic methods:
286 _invokehandle ,
287
288 _shouldnotreachhere, // For debugging
289
290 // Platform specific JVM bytecodes
291 #ifdef TARGET_ARCH_x86
292 # include "bytecodes_x86.hpp"
293 #endif
294 #ifdef TARGET_ARCH_sparc
295 # include "bytecodes_sparc.hpp"
296 #endif
297 #ifdef TARGET_ARCH_zero
298 # include "bytecodes_zero.hpp"
299 #endif
300 #ifdef TARGET_ARCH_arm
301 # include "bytecodes_arm.hpp"
302 #endif
303 #ifdef TARGET_ARCH_ppc
304 # include "bytecodes_ppc.hpp"
305 #endif
306
307
308 number_of_codes
309 };
310
311 // Flag bits derived from format strings, can_trap, can_rewrite, etc.:
312 enum Flags {
313 // semantic flags:
314 _bc_can_trap = 1<<0, // bytecode execution can trap or block
315 _bc_can_rewrite = 1<<1, // bytecode execution has an alternate form
316
317 // format bits (determined only by the format string):
318 _fmt_has_c = 1<<2, // constant, such as sipush "bcc"
319 _fmt_has_j = 1<<3, // constant pool cache index, such as getfield "bjj"
320 _fmt_has_k = 1<<4, // constant pool index, such as ldc "bk"
321 _fmt_has_i = 1<<5, // local index, such as iload
322 _fmt_has_o = 1<<6, // offset, such as ifeq
323 _fmt_has_nbo = 1<<7, // contains native-order field(s)
324 _fmt_has_u2 = 1<<8, // contains double-byte field(s)
325 _fmt_has_u4 = 1<<9, // contains quad-byte field
326 _fmt_not_variable = 1<<10, // not of variable length (simple or wide)
331 _fmt_b = _fmt_not_variable,
332 _fmt_bc = _fmt_b | _fmt_has_c,
333 _fmt_bi = _fmt_b | _fmt_has_i,
334 _fmt_bkk = _fmt_b | _fmt_has_k | _fmt_has_u2,
335 _fmt_bJJ = _fmt_b | _fmt_has_j | _fmt_has_u2 | _fmt_has_nbo,
336 _fmt_bo2 = _fmt_b | _fmt_has_o | _fmt_has_u2,
337 _fmt_bo4 = _fmt_b | _fmt_has_o | _fmt_has_u4
338 };
339
340 private:
341 static bool _is_initialized;
342 static const char* _name [number_of_codes];
343 static BasicType _result_type [number_of_codes];
344 static s_char _depth [number_of_codes];
345 static u_char _lengths [number_of_codes];
346 static Code _java_code [number_of_codes];
347 static jchar _flags [(1<<BitsPerByte)*2]; // all second page for wide formats
348
349 static void def(Code code, const char* name, const char* format, const char* wide_format, BasicType result_type, int depth, bool can_trap);
350 static void def(Code code, const char* name, const char* format, const char* wide_format, BasicType result_type, int depth, bool can_trap, Code java_code);
351 static void pd_initialize(); // platform specific initialization
352 static Code pd_base_code_for(Code code); // platform specific base_code_for implementation
353
354 // Verify that bcp points into method
355 #ifdef ASSERT
356 static bool check_method(const Method* method, address bcp);
357 #endif
358 static bool check_must_rewrite(Bytecodes::Code bc);
359
360 public:
361 // Conversion
362 static void check (Code code) { assert(is_defined(code), err_msg("illegal code: %d", (int)code)); }
363 static void wide_check (Code code) { assert(wide_is_defined(code), err_msg("illegal code: %d", (int)code)); }
364 static Code cast (int code) { return (Code)code; }
365
366
367 // Fetch a bytecode, hiding breakpoints as necessary. The method
368 // argument is used for conversion of breakpoints into the original
369 // bytecode. The CI uses these methods but guarantees that
370 // breakpoints are hidden so the method argument should be passed as
371 // NULL since in that case the bcp and Method* are unrelated
372 // memory.
|
270
271 _fast_iload ,
272 _fast_iload2 ,
273 _fast_icaload ,
274
275 _fast_invokevfinal ,
276 _fast_linearswitch ,
277 _fast_binaryswitch ,
278
279 // special handling of oop constants:
280 _fast_aldc ,
281 _fast_aldc_w ,
282
283 _return_register_finalizer ,
284
285 // special handling of signature-polymorphic methods:
286 _invokehandle ,
287
288 _shouldnotreachhere, // For debugging
289
290
291 number_of_codes
292 };
293
294 // Flag bits derived from format strings, can_trap, can_rewrite, etc.:
295 enum Flags {
296 // semantic flags:
297 _bc_can_trap = 1<<0, // bytecode execution can trap or block
298 _bc_can_rewrite = 1<<1, // bytecode execution has an alternate form
299
300 // format bits (determined only by the format string):
301 _fmt_has_c = 1<<2, // constant, such as sipush "bcc"
302 _fmt_has_j = 1<<3, // constant pool cache index, such as getfield "bjj"
303 _fmt_has_k = 1<<4, // constant pool index, such as ldc "bk"
304 _fmt_has_i = 1<<5, // local index, such as iload
305 _fmt_has_o = 1<<6, // offset, such as ifeq
306 _fmt_has_nbo = 1<<7, // contains native-order field(s)
307 _fmt_has_u2 = 1<<8, // contains double-byte field(s)
308 _fmt_has_u4 = 1<<9, // contains quad-byte field
309 _fmt_not_variable = 1<<10, // not of variable length (simple or wide)
314 _fmt_b = _fmt_not_variable,
315 _fmt_bc = _fmt_b | _fmt_has_c,
316 _fmt_bi = _fmt_b | _fmt_has_i,
317 _fmt_bkk = _fmt_b | _fmt_has_k | _fmt_has_u2,
318 _fmt_bJJ = _fmt_b | _fmt_has_j | _fmt_has_u2 | _fmt_has_nbo,
319 _fmt_bo2 = _fmt_b | _fmt_has_o | _fmt_has_u2,
320 _fmt_bo4 = _fmt_b | _fmt_has_o | _fmt_has_u4
321 };
322
323 private:
324 static bool _is_initialized;
325 static const char* _name [number_of_codes];
326 static BasicType _result_type [number_of_codes];
327 static s_char _depth [number_of_codes];
328 static u_char _lengths [number_of_codes];
329 static Code _java_code [number_of_codes];
330 static jchar _flags [(1<<BitsPerByte)*2]; // all second page for wide formats
331
332 static void def(Code code, const char* name, const char* format, const char* wide_format, BasicType result_type, int depth, bool can_trap);
333 static void def(Code code, const char* name, const char* format, const char* wide_format, BasicType result_type, int depth, bool can_trap, Code java_code);
334
335 // Verify that bcp points into method
336 #ifdef ASSERT
337 static bool check_method(const Method* method, address bcp);
338 #endif
339 static bool check_must_rewrite(Bytecodes::Code bc);
340
341 public:
342 // Conversion
343 static void check (Code code) { assert(is_defined(code), err_msg("illegal code: %d", (int)code)); }
344 static void wide_check (Code code) { assert(wide_is_defined(code), err_msg("illegal code: %d", (int)code)); }
345 static Code cast (int code) { return (Code)code; }
346
347
348 // Fetch a bytecode, hiding breakpoints as necessary. The method
349 // argument is used for conversion of breakpoints into the original
350 // bytecode. The CI uses these methods but guarantees that
351 // breakpoints are hidden so the method argument should be passed as
352 // NULL since in that case the bcp and Method* are unrelated
353 // memory.
|