1 /*
2 * Copyright (c) 2000, 2010, 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 *
1624
1625 void LIR_Assembler::emit_alloc_obj(LIR_OpAllocObj* op) {
1626 if (op->init_check()) {
1627 __ cmpl(Address(op->klass()->as_register(),
1628 instanceKlass::init_state_offset_in_bytes() + sizeof(oopDesc)),
1629 instanceKlass::fully_initialized);
1630 add_debug_info_for_null_check_here(op->stub()->info());
1631 __ jcc(Assembler::notEqual, *op->stub()->entry());
1632 }
1633 __ allocate_object(op->obj()->as_register(),
1634 op->tmp1()->as_register(),
1635 op->tmp2()->as_register(),
1636 op->header_size(),
1637 op->object_size(),
1638 op->klass()->as_register(),
1639 *op->stub()->entry());
1640 __ bind(*op->stub()->continuation());
1641 }
1642
1643 void LIR_Assembler::emit_alloc_array(LIR_OpAllocArray* op) {
1644 if (UseSlowPath ||
1645 (!UseFastNewObjectArray && (op->type() == T_OBJECT || op->type() == T_ARRAY)) ||
1646 (!UseFastNewTypeArray && (op->type() != T_OBJECT && op->type() != T_ARRAY))) {
1647 __ jmp(*op->stub()->entry());
1648 } else {
1649 Register len = op->len()->as_register();
1650 Register tmp1 = op->tmp1()->as_register();
1651 Register tmp2 = op->tmp2()->as_register();
1652 Register tmp3 = op->tmp3()->as_register();
1653 if (len == tmp1) {
1654 tmp1 = tmp3;
1655 } else if (len == tmp2) {
1656 tmp2 = tmp3;
1657 } else if (len == tmp3) {
1658 // everything is ok
1659 } else {
1660 __ mov(tmp3, len);
1661 }
1662 __ allocate_array(op->obj()->as_register(),
1663 len,
1664 tmp1,
1665 tmp2,
1666 arrayOopDesc::header_size(op->type()),
1667 array_element_size(op->type()),
1668 op->klass()->as_register(),
1669 *op->stub()->entry());
|
1 /*
2 * Copyright (c) 2000, 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 *
1624
1625 void LIR_Assembler::emit_alloc_obj(LIR_OpAllocObj* op) {
1626 if (op->init_check()) {
1627 __ cmpl(Address(op->klass()->as_register(),
1628 instanceKlass::init_state_offset_in_bytes() + sizeof(oopDesc)),
1629 instanceKlass::fully_initialized);
1630 add_debug_info_for_null_check_here(op->stub()->info());
1631 __ jcc(Assembler::notEqual, *op->stub()->entry());
1632 }
1633 __ allocate_object(op->obj()->as_register(),
1634 op->tmp1()->as_register(),
1635 op->tmp2()->as_register(),
1636 op->header_size(),
1637 op->object_size(),
1638 op->klass()->as_register(),
1639 *op->stub()->entry());
1640 __ bind(*op->stub()->continuation());
1641 }
1642
1643 void LIR_Assembler::emit_alloc_array(LIR_OpAllocArray* op) {
1644 Register len = op->len()->as_register();
1645 LP64_ONLY( __ movslq(len, len); )
1646
1647 if (UseSlowPath ||
1648 (!UseFastNewObjectArray && (op->type() == T_OBJECT || op->type() == T_ARRAY)) ||
1649 (!UseFastNewTypeArray && (op->type() != T_OBJECT && op->type() != T_ARRAY))) {
1650 __ jmp(*op->stub()->entry());
1651 } else {
1652 Register tmp1 = op->tmp1()->as_register();
1653 Register tmp2 = op->tmp2()->as_register();
1654 Register tmp3 = op->tmp3()->as_register();
1655 if (len == tmp1) {
1656 tmp1 = tmp3;
1657 } else if (len == tmp2) {
1658 tmp2 = tmp3;
1659 } else if (len == tmp3) {
1660 // everything is ok
1661 } else {
1662 __ mov(tmp3, len);
1663 }
1664 __ allocate_array(op->obj()->as_register(),
1665 len,
1666 tmp1,
1667 tmp2,
1668 arrayOopDesc::header_size(op->type()),
1669 array_element_size(op->type()),
1670 op->klass()->as_register(),
1671 *op->stub()->entry());
|