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