United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-5053217 : VM segv's running jvmti/jvmpi profiler

Details
Type:
Bug
Submit Date:
2004-05-26
Status:
Resolved
Updated Date:
2004-06-25
Project Name:
JDK
Resolved Date:
2004-06-15
Component:
hotspot
OS:
generic
Sub-Component:
compiler
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.4.2
Fixed Versions:
1.4.2_06 (06)

Related Reports
Backport:

Sub Tasks

Description
This test case came from escalation 1-728488 and was seen with 1.4.2.
It is similar to bug 4614956 which was a crash caused by the interpreter. This
bug is -server only. Run the attached test case with

java -server -XX:+ShowMessageBoxOnError -Xrunmyprofiler LargeHeapTest 100000

and hit <return> whenever the program stops. It should segv. quickly.


                                    

Comments
EVALUATION


This is a bug in passing the receiver to the jvmti/jvmpi agent when calling
a native method. We pass a handle instead of an oop.


###@###.### 2004-05-26
                                     
2004-05-26
SUGGESTED FIX

- #pragma ident "@(#)generateOptoStub.cpp       1.84 04/02/04 17:34:30 JVM"
+ #pragma ident "@(#)generateOptoStub.cpp       1.85 04/06/08 13:02:38 JVM"
  #endif
  //
  // Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  // SUN PROPRIETARY/CONFIDENTIAL.  Use is subject to license terms.
  // 
  
  #include "incls/_precompiled.incl"
  #include "incls/_generateOptoStub.cpp.incl"
  
  //-----------------------plus_adr----------------------------------------------

*** 93,112 ****
--- 93,119 ----
      static_klass = method->holder();
      ciInstance* mirror = static_klass->java_mirror();
      mirror_node = makecon(TypeInstPtr::make(mirror));
      assert(jni_sig, "sanity");
      // Static JNI calls pass the static_klass mirror.  They need it
      // boxed.  The box has to update the stack prior to setting
      // thread_in_native in order to be GC safe.
      mirror_box = _gvn.transform( new (2) BoxNode(mirror_node) );
    }
  
+   // Call jvmpi before we wrap incoming arguments so we can
+   // pass the receiver as an oop and not a handle.
+ 
+   if (C->need_jvmpi_method_event()) {
+     make_jvmpi_method_entry();
+   }
+ 
    // Do we need to wrap incoming arguments in handles?
    // Generate code to put the oop on the stack and return its address.
    Node *unwrapped_this = map()->in(TypeFunc::Parms+0);
    Node** parm_boxes = NULL;
    uint num_parm_boxes = 0;
    if( wrap_oops ) {
      parm_boxes = NEW_RESOURCE_ARRAY(Node*, parm_cnt);  // generous, OK!
      for( i = TypeFunc::Parms; i < parm_cnt; i++ ) {
        if (jdomain->field_at(i)->isa_oop_ptr()) {
          // Replace parameter with handle

*** 129,151 ****
--- 136,155 ----
          // with a conditional-move, the c-mov represents a normal use
          // along the main path and so unavoidably hoists the BoxNode.
          Node* cmp = _gvn.transform( new (3) CmpPNode(map()->in(i), null()) );
          Node* b = _gvn.transform( new (2) BoolNode(cmp, BoolTest::eq) );
          Node* cmov = _gvn.transform( CMoveNode::make(NULL, b, box, map()->in(i), TypeRawPtr::BOTTOM) );
          map()->set_req( i, cmov );
        }
      }
    }
  
    if (C->need_jvmpi_method_event()) {
      make_jvmpi_method_entry();
    }
  
    Node* flock_obj = NULL;
    Node* flock_obj_box = NULL;
    FastLockNode* flock = NULL;
    // Do we need to lock argument 0?  Is this a synchronized native call?
    if (method != NULL && method->flags().is_synchronized()) {
      // Lock either the class-mirror or the regular 'this' pointer
      flock_obj = static_klass ? mirror_node : unwrapped_this;
      flock_obj_box = static_klass ? mirror_box : parm_boxes[0];
      flock = shared_lock(flock_obj);
                                     
2004-07-08
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
1.4.2_06
generic
tiger-rc

FIXED IN:
1.4.2_06
tiger-rc

INTEGRATED IN:
1.4.2_06
tiger-b56
tiger-rc


                                     
2004-07-08



Hardware and Software, Engineered to Work Together