src/cpu/sparc/vm/c1_MacroAssembler_sparc.hpp

Thu, 07 Apr 2011 09:53:20 -0700

author
johnc
date
Thu, 07 Apr 2011 09:53:20 -0700
changeset 2781
e1162778c1c8
parent 2423
b1a2afa37ec4
child 6876
710a3c8b516e
permissions
-rw-r--r--

7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
Summary: A referent object that is only weakly reachable at the start of concurrent marking but is re-attached to the strongly reachable object graph during marking may not be marked as live. This can cause the reference object to be processed prematurely and leave dangling pointers to the referent object. Implement a read barrier for the java.lang.ref.Reference::referent field by intrinsifying the Reference.get() method, and intercepting accesses though JNI, reflection, and Unsafe, so that when a non-null referent object is read it is also logged in an SATB buffer.
Reviewed-by: kvn, iveresov, never, tonyp, dholmes

     1 /*
     2  * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    22  *
    23  */
    25 #ifndef CPU_SPARC_VM_C1_MACROASSEMBLER_SPARC_HPP
    26 #define CPU_SPARC_VM_C1_MACROASSEMBLER_SPARC_HPP
    28   void pd_init() { /* nothing to do */ }
    30  public:
    31    void try_allocate(
    32     Register obj,                      // result: pointer to object after successful allocation
    33     Register var_size_in_bytes,        // object size in bytes if unknown at compile time; invalid otherwise
    34     int      con_size_in_bytes,        // object size in bytes if   known at compile time
    35     Register t1,                       // temp register
    36     Register t2,                       // temp register
    37     Label&   slow_case                 // continuation point if fast allocation fails
    38   );
    40   void initialize_header(Register obj, Register klass, Register len, Register t1, Register t2);
    41   void initialize_body(Register base, Register index);
    43   // locking/unlocking
    44   void lock_object  (Register Rmark, Register Roop, Register Rbox, Register Rscratch, Label& slow_case);
    45   void unlock_object(Register Rmark, Register Roop, Register Rbox,                    Label& slow_case);
    47   void initialize_object(
    48     Register obj,                      // result: pointer to object after successful allocation
    49     Register klass,                    // object klass
    50     Register var_size_in_bytes,        // object size in bytes if unknown at compile time; invalid otherwise
    51     int      con_size_in_bytes,        // object size in bytes if   known at compile time
    52     Register t1,                       // temp register
    53     Register t2                        // temp register
    54   );
    56   // allocation of fixed-size objects
    57   // (can also be used to allocate fixed-size arrays, by setting
    58   // hdr_size correctly and storing the array length afterwards)
    59   void allocate_object(
    60     Register obj,                      // result: pointer to object after successful allocation
    61     Register t1,                       // temp register
    62     Register t2,                       // temp register
    63     Register t3,                       // temp register
    64     int      hdr_size,                 // object header size in words
    65     int      obj_size,                 // object size in words
    66     Register klass,                    // object klass
    67     Label&   slow_case                 // continuation point if fast allocation fails
    68   );
    70   enum {
    71     max_array_allocation_length = 0x01000000 // sparc friendly value, requires sethi only
    72   };
    74   // allocation of arrays
    75   void allocate_array(
    76     Register obj,                      // result: pointer to array after successful allocation
    77     Register len,                      // array length
    78     Register t1,                       // temp register
    79     Register t2,                       // temp register
    80     Register t3,                       // temp register
    81     int      hdr_size,                 // object header size in words
    82     int      elt_size,                 // element size in bytes
    83     Register klass,                    // object klass
    84     Label&   slow_case                 // continuation point if fast allocation fails
    85   );
    87   // invalidates registers in this window
    88   void invalidate_registers(bool iregisters, bool lregisters, bool oregisters,
    89                             Register preserve1 = noreg, Register preserve2 = noreg);
    91 #endif // CPU_SPARC_VM_C1_MACROASSEMBLER_SPARC_HPP

mercurial