src/hotspot/share/interpreter/bytecodeInterpreter.cpp
changeset 48826 c4d9d1b08e2e
parent 47906 0ad8a90268a7
child 48835 62004f705d27
equal deleted inserted replaced
48825:ef8a98bc71f8 48826:c4d9d1b08e2e
  2366             CALL_VM(InterpreterRuntime::ldc(THREAD, wide), handle_exception);
  2366             CALL_VM(InterpreterRuntime::ldc(THREAD, wide), handle_exception);
  2367             SET_STACK_OBJECT(THREAD->vm_result(), 0);
  2367             SET_STACK_OBJECT(THREAD->vm_result(), 0);
  2368             THREAD->set_vm_result(NULL);
  2368             THREAD->set_vm_result(NULL);
  2369             break;
  2369             break;
  2370 
  2370 
       
  2371           case JVM_CONSTANT_Dynamic:
       
  2372             {
       
  2373               oop result = constants->resolved_references()->obj_at(index);
       
  2374               if (result == NULL) {
       
  2375                 CALL_VM(InterpreterRuntime::resolve_ldc(THREAD, (Bytecodes::Code) opcode), handle_exception);
       
  2376                 result = THREAD->vm_result();
       
  2377               }
       
  2378               VERIFY_OOP(result);
       
  2379 
       
  2380               jvalue value;
       
  2381               BasicType type = java_lang_boxing_object::get_value(result, &value);
       
  2382               switch (type) {
       
  2383               case T_FLOAT:   SET_STACK_FLOAT(value.f, 0); break;
       
  2384               case T_INT:     SET_STACK_INT(value.i, 0); break;
       
  2385               case T_SHORT:   SET_STACK_INT(value.s, 0); break;
       
  2386               case T_BYTE:    SET_STACK_INT(value.b, 0); break;
       
  2387               case T_CHAR:    SET_STACK_INT(value.c, 0); break;
       
  2388               case T_BOOLEAN: SET_STACK_INT(value.z, 0); break;
       
  2389               default:  ShouldNotReachHere();
       
  2390               }
       
  2391 
       
  2392               break;
       
  2393             }
       
  2394 
  2371           default:  ShouldNotReachHere();
  2395           default:  ShouldNotReachHere();
  2372           }
  2396           }
  2373           UPDATE_PC_AND_TOS_AND_CONTINUE(incr, 1);
  2397           UPDATE_PC_AND_TOS_AND_CONTINUE(incr, 1);
  2374         }
  2398         }
  2375 
  2399 
  2385             break;
  2409             break;
  2386 
  2410 
  2387           case JVM_CONSTANT_Double:
  2411           case JVM_CONSTANT_Double:
  2388              SET_STACK_DOUBLE(constants->double_at(index), 1);
  2412              SET_STACK_DOUBLE(constants->double_at(index), 1);
  2389             break;
  2413             break;
       
  2414 
       
  2415           case JVM_CONSTANT_Dynamic:
       
  2416             {
       
  2417               oop result = constants->resolved_references()->obj_at(index);
       
  2418               if (result == NULL) {
       
  2419                 CALL_VM(InterpreterRuntime::resolve_ldc(THREAD, (Bytecodes::Code) opcode), handle_exception);
       
  2420                 result = THREAD->vm_result();
       
  2421               }
       
  2422               VERIFY_OOP(result);
       
  2423 
       
  2424               jvalue value;
       
  2425               BasicType type = java_lang_boxing_object::get_value(result, &value);
       
  2426               switch (type) {
       
  2427               case T_DOUBLE: SET_STACK_DOUBLE(value.d, 1); break;
       
  2428               case T_LONG:   SET_STACK_LONG(value.j, 1); break;
       
  2429               default:  ShouldNotReachHere();
       
  2430               }
       
  2431 
       
  2432               break;
       
  2433             }
       
  2434 
  2390           default:  ShouldNotReachHere();
  2435           default:  ShouldNotReachHere();
  2391           }
  2436           }
  2392           UPDATE_PC_AND_TOS_AND_CONTINUE(3, 2);
  2437           UPDATE_PC_AND_TOS_AND_CONTINUE(3, 2);
  2393         }
  2438         }
  2394 
  2439 
  2402         } else {
  2447         } else {
  2403           index = Bytes::get_native_u2(pc+1);
  2448           index = Bytes::get_native_u2(pc+1);
  2404           incr = 3;
  2449           incr = 3;
  2405         }
  2450         }
  2406 
  2451 
  2407         // We are resolved if the f1 field contains a non-null object (CallSite, etc.)
  2452         // We are resolved if the resolved_references array contains a non-null object (CallSite, etc.)
  2408         // This kind of CP cache entry does not need to match the flags byte, because
  2453         // This kind of CP cache entry does not need to match the flags byte, because
  2409         // there is a 1-1 relation between bytecode type and CP entry type.
  2454         // there is a 1-1 relation between bytecode type and CP entry type.
  2410         ConstantPool* constants = METHOD->constants();
  2455         ConstantPool* constants = METHOD->constants();
  2411         oop result = constants->resolved_references()->obj_at(index);
  2456         oop result = constants->resolved_references()->obj_at(index);
  2412         if (result == NULL) {
  2457         if (result == NULL) {
  2413           CALL_VM(InterpreterRuntime::resolve_ldc(THREAD, (Bytecodes::Code) opcode),
  2458           CALL_VM(InterpreterRuntime::resolve_ldc(THREAD, (Bytecodes::Code) opcode),
  2414                   handle_exception);
  2459                   handle_exception);
  2415           result = THREAD->vm_result();
  2460           result = THREAD->vm_result();
  2416         }
  2461         }
       
  2462         if (result == Universe::the_null_sentinel())
       
  2463           result = NULL;
  2417 
  2464 
  2418         VERIFY_OOP(result);
  2465         VERIFY_OOP(result);
  2419         SET_STACK_OBJECT(result, 0);
  2466         SET_STACK_OBJECT(result, 0);
  2420         UPDATE_PC_AND_TOS_AND_CONTINUE(incr, 1);
  2467         UPDATE_PC_AND_TOS_AND_CONTINUE(incr, 1);
  2421       }
  2468       }
  2423       CASE(_invokedynamic): {
  2470       CASE(_invokedynamic): {
  2424 
  2471 
  2425         u4 index = Bytes::get_native_u4(pc+1);
  2472         u4 index = Bytes::get_native_u4(pc+1);
  2426         ConstantPoolCacheEntry* cache = cp->constant_pool()->invokedynamic_cp_cache_entry_at(index);
  2473         ConstantPoolCacheEntry* cache = cp->constant_pool()->invokedynamic_cp_cache_entry_at(index);
  2427 
  2474 
  2428         // We are resolved if the resolved_references field contains a non-null object (CallSite, etc.)
  2475         // We are resolved if the resolved_references array contains a non-null object (CallSite, etc.)
  2429         // This kind of CP cache entry does not need to match the flags byte, because
  2476         // This kind of CP cache entry does not need to match the flags byte, because
  2430         // there is a 1-1 relation between bytecode type and CP entry type.
  2477         // there is a 1-1 relation between bytecode type and CP entry type.
  2431         if (! cache->is_resolved((Bytecodes::Code) opcode)) {
  2478         if (! cache->is_resolved((Bytecodes::Code) opcode)) {
  2432           CALL_VM(InterpreterRuntime::resolve_from_cache(THREAD, (Bytecodes::Code)opcode),
  2479           CALL_VM(InterpreterRuntime::resolve_from_cache(THREAD, (Bytecodes::Code)opcode),
  2433                   handle_exception);
  2480                   handle_exception);