Top


定義場所(file name)

hotspot/src/cpu/x86/vm/jniFastGetField_x86_64.cpp

名前(function name)

address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) {

本体部(body)

  {- -------------------------------------------
  (1) JNI_FastGetField::generate_fast_get_int_field0() とほぼ同様.
      ---------------------------------------- -}

      const char *name;
      switch (type) {
        case T_FLOAT:     name = "jni_fast_GetFloatField";     break;
        case T_DOUBLE:    name = "jni_fast_GetDoubleField";    break;
        default:          ShouldNotReachHere();
      }
      ResourceMark rm;
      BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE);
      CodeBuffer cbuf(blob);
      MacroAssembler* masm = new MacroAssembler(&cbuf);
      address fast_entry = __ pc();

      Label slow;

      ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr());
      __ mov32 (rcounter, counter);
      __ mov   (robj, c_rarg1);
      __ testb (rcounter, 1);
      __ jcc (Assembler::notZero, slow);
      if (os::is_MP()) {
        __ xorptr(robj, rcounter);
        __ xorptr(robj, rcounter);                   // obj, since
                                                    // robj ^ rcounter ^ rcounter == robj
                                                    // robj is data dependent on rcounter.
      }
      __ movptr(robj, Address(robj, 0));             // *obj
      __ mov   (roffset, c_rarg2);
      __ shrptr(roffset, 2);                         // offset

      assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
      speculative_load_pclist[count] = __ pc();
      switch (type) {
        case T_FLOAT:  __ movflt (xmm0, Address(robj, roffset, Address::times_1)); break;
        case T_DOUBLE: __ movdbl (xmm0, Address(robj, roffset, Address::times_1)); break;
        default:        ShouldNotReachHere();
      }

      if (os::is_MP()) {
        __ lea(rcounter_addr, counter);
        __ movdq (rax, xmm0);
        // counter address is data dependent on xmm0.
        __ xorptr(rcounter_addr, rax);
        __ xorptr(rcounter_addr, rax);
        __ cmpl (rcounter, Address(rcounter_addr, 0));
      } else {
        __ cmp32 (rcounter, counter);
      }
      __ jcc (Assembler::notEqual, slow);

      __ ret (0);

      slowcase_entry_pclist[count++] = __ pc();
      __ bind (slow);
      address slow_case_addr;
      switch (type) {
        case T_FLOAT:     slow_case_addr = jni_GetFloatField_addr();  break;
        case T_DOUBLE:    slow_case_addr = jni_GetDoubleField_addr();
      }
      // tail call
      __ jump (ExternalAddress(slow_case_addr));

      __ flush ();

      return fast_entry;
    }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.