src/cpu/mips/vm/c1_MacroAssembler_mips.hpp

Tue, 26 Jul 2016 17:06:17 +0800

author
fujie
date
Tue, 26 Jul 2016 17:06:17 +0800
changeset 41
d885f8d65c58
parent 1
2d8a650513c2
child 6880
52ea28d233d2
permissions
-rw-r--r--

Add multiply word to GPR instruction (mul) in MIPS assembler.

     1 /*
     2  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     3  * Copyright (c) 2015, 2016, Loongson Technology. 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  */
    27 #ifndef CPU_MIPS_VM_C1_MACROASSEMBLER_MIPS_HPP
    28 #define CPU_MIPS_VM_C1_MACROASSEMBLER_MIPS_HPP
    30 // C1_MacroAssembler contains high-level macros for C1
    32 private:
    33 int _sp_offset;    // track sp changes
    34 // initialization
    35 void pd_init() { _sp_offset = 0; }
    37 public:
    38 void try_allocate(
    39 		Register obj,                      // result: pointer to object after successful allocation
    40 		Register var_size_in_bytes,        // object size in bytes if unknown at compile time; invalid otherwise
    41 		int      con_size_in_bytes,        // object size in bytes if   known at compile time
    42 		Register t1,                       // temp register
    43 		Register t2,                       // temp register
    44 		Label&   slow_case                 // continuation point if fast allocation fails
    45 		);
    47 void initialize_header(Register obj, Register klass, Register len, Register t1, Register t2);
    48 void initialize_body(Register obj, Register len_in_bytes, int hdr_size_in_bytes, Register t1);
    50 // locking
    51 // hdr     : must be rax, contents destroyed
    52 // obj     : must point to the object to lock, contents preserved
    53 // disp_hdr: must point to the displaced header location, contents preserved
    54 // scratch : scratch register, contents destroyed
    55 // returns code offset at which to add null check debug information
    56 int lock_object  (Register swap, Register obj, Register disp_hdr, Register scratch, Label& slow_case);
    58 // unlocking
    59 // hdr     : contents destroyed
    60 // obj     : must point to the object to lock, contents preserved
    61 // disp_hdr: must be eax & must point to the displaced header location, contents destroyed
    62 void unlock_object(Register swap, Register obj, Register lock, Label& slow_case);
    64 void initialize_object(
    65 		Register obj,                      // result: pointer to object after successful allocation
    66 		Register klass,                    // object klass
    67 		Register var_size_in_bytes,        // object size in bytes if unknown at compile time; invalid otherwise
    68 		int      con_size_in_bytes,        // object size in bytes if   known at compile time
    69 		Register t1,                       // temp register
    70 		Register t2                        // temp register
    71 		);
    73 // allocation of fixed-size objects
    74 // (can also be used to allocate fixed-size arrays, by setting
    75 // hdr_size correctly and storing the array length afterwards)
    76 // obj        : must be rax, will contain pointer to allocated object
    77 // t1, t2     : scratch registers - contents destroyed
    78 // header_size: size of object header in words
    79 // object_size: total size of object in words
    80 // slow_case  : exit to slow case implementation if fast allocation fails
    81 void allocate_object(Register obj, Register t1, Register t2, int header_size, int object_size, Register klass, Label& slow_case);
    83 enum {
    84 	max_array_allocation_length = 0x00FFFFFF
    85 };
    87 // allocation of arrays
    88 // obj        : must be rax, will contain pointer to allocated object
    89 // len        : array length in number of elements
    90 // t          : scratch register - contents destroyed
    91 // header_size: size of object header in words
    92 // f          : element scale factor
    93 // slow_case  : exit to slow case implementation if fast allocation fails
    94 void allocate_array(Register obj, Register len, Register t1, Register t2, Register t3, int header_size, int scale, Register klass, Label& slow_case);
    96 int  sp_offset() const { return _sp_offset; }
    97 void set_sp_offset(int n) { _sp_offset = n; }
    99 // Note: NEVER push values directly, but only through following push_xxx functions;
   100 //       This helps us to track the rsp changes compared to the entry rsp (->_sp_offset)
   102 void push_jint (jint i)     { _sp_offset++; move(AT, (int)i); push(AT); }
   103 #ifdef _LP64
   104 void push_oop  (jobject o)  { ShouldNotReachHere(); _sp_offset++; li(AT, (long)o); push(AT);}
   105 #else
   106 void push_oop  (jobject o)  { ShouldNotReachHere(); _sp_offset++; move(AT, (int)o); push(AT);}
   107 #endif
   108 // Seems to always be in wordSize
   109 void push_addr (Address a)  { _sp_offset++; addi(AT, a.base(), a.disp()); push(AT);}
   110 void push_reg  (Register r) { _sp_offset++; push(r); }
   111 void pop_reg   (Register r) { _sp_offset--; pop(r); assert(_sp_offset >= 0, "stack offset underflow"); }
   112 void super_pop(Register r) {MacroAssembler::pop(r);}
   114 void dec_stack (int nof_words) {
   115 	_sp_offset -= nof_words;
   116 	assert(_sp_offset >= 0, "stack offset underflow");
   117 	//addptr(rsp, wordSize * nof_words);
   118 	addi(SP, SP, wordSize * nof_words);
   119 }
   121 void dec_stack_after_call (int nof_words) {
   122 	_sp_offset -= nof_words;
   123 	assert(_sp_offset >= 0, "stack offset underflow");
   124 }
   126 void invalidate_registers(bool inv_rax, bool inv_rbx, bool inv_rcx, bool inv_rdx, bool inv_rsi, bool inv_rdi) PRODUCT_RETURN;
   128 #endif // CPU_MIPS_VM_C1_MACROASSEMBLER_MIPS_HPP

mercurial