Mercurial > hg > graal-compiler
comparison src/cpu/sparc/vm/assembler_sparc.hpp @ 665:c89f86385056
6814659: separable cleanups and subroutines for 6655638
Summary: preparatory but separable changes for method handles
Reviewed-by: kvn, never
author | jrose |
---|---|
date | Fri, 20 Mar 2009 23:19:36 -0700 |
parents | c517646eef23 |
children | e5b0439ef4ae |
comparison
equal
deleted
inserted
replaced
647:bd441136a5ce | 665:c89f86385056 |
---|---|
1 /* | 1 /* |
2 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. | 2 * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
1086 // pp 135 (addc was addx in v8) | 1086 // pp 135 (addc was addx in v8) |
1087 | 1087 |
1088 inline void add( Register s1, Register s2, Register d ); | 1088 inline void add( Register s1, Register s2, Register d ); |
1089 inline void add( Register s1, int simm13a, Register d, relocInfo::relocType rtype = relocInfo::none); | 1089 inline void add( Register s1, int simm13a, Register d, relocInfo::relocType rtype = relocInfo::none); |
1090 inline void add( Register s1, int simm13a, Register d, RelocationHolder const& rspec); | 1090 inline void add( Register s1, int simm13a, Register d, RelocationHolder const& rspec); |
1091 inline void add( Register s1, RegisterConstant s2, Register d, int offset = 0); | 1091 inline void add( Register s1, RegisterOrConstant s2, Register d, int offset = 0); |
1092 inline void add( const Address& a, Register d, int offset = 0); | 1092 inline void add( const Address& a, Register d, int offset = 0); |
1093 | 1093 |
1094 void addcc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); } | 1094 void addcc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); } |
1095 void addcc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); } | 1095 void addcc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); } |
1096 void addc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(addc_op3 ) | rs1(s1) | rs2(s2) ); } | 1096 void addc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(addc_op3 ) | rs1(s1) | rs2(s2) ); } |
1097 void addc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(addc_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); } | 1097 void addc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(addc_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); } |
1303 inline void lduw( const Address& a, Register d, int offset = 0 ); | 1303 inline void lduw( const Address& a, Register d, int offset = 0 ); |
1304 inline void ldx( const Address& a, Register d, int offset = 0 ); | 1304 inline void ldx( const Address& a, Register d, int offset = 0 ); |
1305 inline void ld( const Address& a, Register d, int offset = 0 ); | 1305 inline void ld( const Address& a, Register d, int offset = 0 ); |
1306 inline void ldd( const Address& a, Register d, int offset = 0 ); | 1306 inline void ldd( const Address& a, Register d, int offset = 0 ); |
1307 | 1307 |
1308 inline void ldub( Register s1, RegisterConstant s2, Register d ); | 1308 inline void ldub( Register s1, RegisterOrConstant s2, Register d ); |
1309 inline void ldsb( Register s1, RegisterConstant s2, Register d ); | 1309 inline void ldsb( Register s1, RegisterOrConstant s2, Register d ); |
1310 inline void lduh( Register s1, RegisterConstant s2, Register d ); | 1310 inline void lduh( Register s1, RegisterOrConstant s2, Register d ); |
1311 inline void ldsh( Register s1, RegisterConstant s2, Register d ); | 1311 inline void ldsh( Register s1, RegisterOrConstant s2, Register d ); |
1312 inline void lduw( Register s1, RegisterConstant s2, Register d ); | 1312 inline void lduw( Register s1, RegisterOrConstant s2, Register d ); |
1313 inline void ldsw( Register s1, RegisterConstant s2, Register d ); | 1313 inline void ldsw( Register s1, RegisterOrConstant s2, Register d ); |
1314 inline void ldx( Register s1, RegisterConstant s2, Register d ); | 1314 inline void ldx( Register s1, RegisterOrConstant s2, Register d ); |
1315 inline void ld( Register s1, RegisterConstant s2, Register d ); | 1315 inline void ld( Register s1, RegisterOrConstant s2, Register d ); |
1316 inline void ldd( Register s1, RegisterConstant s2, Register d ); | 1316 inline void ldd( Register s1, RegisterOrConstant s2, Register d ); |
1317 | 1317 |
1318 // pp 177 | 1318 // pp 177 |
1319 | 1319 |
1320 void ldsba( Register s1, Register s2, int ia, Register d ) { emit_long( op(ldst_op) | rd(d) | op3(ldsb_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); } | 1320 void ldsba( Register s1, Register s2, int ia, Register d ) { emit_long( op(ldst_op) | rd(d) | op3(ldsb_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); } |
1321 void ldsba( Register s1, int simm13a, Register d ) { emit_long( op(ldst_op) | rd(d) | op3(ldsb_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); } | 1321 void ldsba( Register s1, int simm13a, Register d ) { emit_long( op(ldst_op) | rd(d) | op3(ldsb_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); } |
1533 inline void stw( Register d, const Address& a, int offset = 0 ); | 1533 inline void stw( Register d, const Address& a, int offset = 0 ); |
1534 inline void stx( Register d, const Address& a, int offset = 0 ); | 1534 inline void stx( Register d, const Address& a, int offset = 0 ); |
1535 inline void st( Register d, const Address& a, int offset = 0 ); | 1535 inline void st( Register d, const Address& a, int offset = 0 ); |
1536 inline void std( Register d, const Address& a, int offset = 0 ); | 1536 inline void std( Register d, const Address& a, int offset = 0 ); |
1537 | 1537 |
1538 inline void stb( Register d, Register s1, RegisterConstant s2 ); | 1538 inline void stb( Register d, Register s1, RegisterOrConstant s2 ); |
1539 inline void sth( Register d, Register s1, RegisterConstant s2 ); | 1539 inline void sth( Register d, Register s1, RegisterOrConstant s2 ); |
1540 inline void stw( Register d, Register s1, RegisterConstant s2 ); | 1540 inline void stw( Register d, Register s1, RegisterOrConstant s2 ); |
1541 inline void stx( Register d, Register s1, RegisterConstant s2 ); | 1541 inline void stx( Register d, Register s1, RegisterOrConstant s2 ); |
1542 inline void std( Register d, Register s1, RegisterConstant s2 ); | 1542 inline void std( Register d, Register s1, RegisterOrConstant s2 ); |
1543 inline void st( Register d, Register s1, RegisterConstant s2 ); | 1543 inline void st( Register d, Register s1, RegisterOrConstant s2 ); |
1544 | 1544 |
1545 // pp 177 | 1545 // pp 177 |
1546 | 1546 |
1547 void stba( Register d, Register s1, Register s2, int ia ) { emit_long( op(ldst_op) | rd(d) | op3(stb_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); } | 1547 void stba( Register d, Register s1, Register s2, int ia ) { emit_long( op(ldst_op) | rd(d) | op3(stb_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); } |
1548 void stba( Register d, Register s1, int simm13a ) { emit_long( op(ldst_op) | rd(d) | op3(stb_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); } | 1548 void stba( Register d, Register s1, int simm13a ) { emit_long( op(ldst_op) | rd(d) | op3(stb_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); } |
1857 } | 1857 } |
1858 | 1858 |
1859 // Functions for isolating 64 bit shifts for LP64 | 1859 // Functions for isolating 64 bit shifts for LP64 |
1860 inline void sll_ptr( Register s1, Register s2, Register d ); | 1860 inline void sll_ptr( Register s1, Register s2, Register d ); |
1861 inline void sll_ptr( Register s1, int imm6a, Register d ); | 1861 inline void sll_ptr( Register s1, int imm6a, Register d ); |
1862 inline void sll_ptr( Register s1, RegisterConstant s2, Register d ); | 1862 inline void sll_ptr( Register s1, RegisterOrConstant s2, Register d ); |
1863 inline void srl_ptr( Register s1, Register s2, Register d ); | 1863 inline void srl_ptr( Register s1, Register s2, Register d ); |
1864 inline void srl_ptr( Register s1, int imm6a, Register d ); | 1864 inline void srl_ptr( Register s1, int imm6a, Register d ); |
1865 | 1865 |
1866 // little-endian | 1866 // little-endian |
1867 inline void casl( Register s1, Register s2, Register d) { casa( s1, s2, d, ASI_PRIMARY_LITTLE); } | 1867 inline void casl( Register s1, Register s2, Register d) { casa( s1, s2, d, ASI_PRIMARY_LITTLE); } |
1963 // Functions for isolating 64 bit loads for LP64 | 1963 // Functions for isolating 64 bit loads for LP64 |
1964 // ld_ptr will perform ld for 32 bit VM's and ldx for 64 bit VM's | 1964 // ld_ptr will perform ld for 32 bit VM's and ldx for 64 bit VM's |
1965 // st_ptr will perform st for 32 bit VM's and stx for 64 bit VM's | 1965 // st_ptr will perform st for 32 bit VM's and stx for 64 bit VM's |
1966 inline void ld_ptr( Register s1, Register s2, Register d ); | 1966 inline void ld_ptr( Register s1, Register s2, Register d ); |
1967 inline void ld_ptr( Register s1, int simm13a, Register d); | 1967 inline void ld_ptr( Register s1, int simm13a, Register d); |
1968 inline void ld_ptr( Register s1, RegisterConstant s2, Register d ); | 1968 inline void ld_ptr( Register s1, RegisterOrConstant s2, Register d ); |
1969 inline void ld_ptr( const Address& a, Register d, int offset = 0 ); | 1969 inline void ld_ptr( const Address& a, Register d, int offset = 0 ); |
1970 inline void st_ptr( Register d, Register s1, Register s2 ); | 1970 inline void st_ptr( Register d, Register s1, Register s2 ); |
1971 inline void st_ptr( Register d, Register s1, int simm13a); | 1971 inline void st_ptr( Register d, Register s1, int simm13a); |
1972 inline void st_ptr( Register d, Register s1, RegisterConstant s2 ); | 1972 inline void st_ptr( Register d, Register s1, RegisterOrConstant s2 ); |
1973 inline void st_ptr( Register d, const Address& a, int offset = 0 ); | 1973 inline void st_ptr( Register d, const Address& a, int offset = 0 ); |
1974 | 1974 |
1975 // ld_long will perform ld for 32 bit VM's and ldx for 64 bit VM's | 1975 // ld_long will perform ld for 32 bit VM's and ldx for 64 bit VM's |
1976 // st_long will perform st for 32 bit VM's and stx for 64 bit VM's | 1976 // st_long will perform st for 32 bit VM's and stx for 64 bit VM's |
1977 inline void ld_long( Register s1, Register s2, Register d ); | 1977 inline void ld_long( Register s1, Register s2, Register d ); |
1978 inline void ld_long( Register s1, int simm13a, Register d ); | 1978 inline void ld_long( Register s1, int simm13a, Register d ); |
1979 inline void ld_long( Register s1, RegisterConstant s2, Register d ); | 1979 inline void ld_long( Register s1, RegisterOrConstant s2, Register d ); |
1980 inline void ld_long( const Address& a, Register d, int offset = 0 ); | 1980 inline void ld_long( const Address& a, Register d, int offset = 0 ); |
1981 inline void st_long( Register d, Register s1, Register s2 ); | 1981 inline void st_long( Register d, Register s1, Register s2 ); |
1982 inline void st_long( Register d, Register s1, int simm13a ); | 1982 inline void st_long( Register d, Register s1, int simm13a ); |
1983 inline void st_long( Register d, Register s1, RegisterConstant s2 ); | 1983 inline void st_long( Register d, Register s1, RegisterOrConstant s2 ); |
1984 inline void st_long( Register d, const Address& a, int offset = 0 ); | 1984 inline void st_long( Register d, const Address& a, int offset = 0 ); |
1985 | 1985 |
1986 // Loading values by size and signed-ness | 1986 // Loading values by size and signed-ness |
1987 void load_sized_value(Register s1, RegisterConstant s2, Register d, | 1987 void load_sized_value(Register s1, RegisterOrConstant s2, Register d, |
1988 int size_in_bytes, bool is_signed); | 1988 int size_in_bytes, bool is_signed); |
1989 | 1989 |
1990 // Helpers for address formation. | 1990 // Helpers for address formation. |
1991 // They update the dest in place, whether it is a register or constant. | 1991 // They update the dest in place, whether it is a register or constant. |
1992 // They emit no code at all if src is a constant zero. | 1992 // They emit no code at all if src is a constant zero. |
1993 // If dest is a constant and src is a register, the temp argument | 1993 // If dest is a constant and src is a register, the temp argument |
1994 // is required, and becomes the result. | 1994 // is required, and becomes the result. |
1995 // If dest is a register and src is a non-simm13 constant, | 1995 // If dest is a register and src is a non-simm13 constant, |
1996 // the temp argument is required, and is used to materialize the constant. | 1996 // the temp argument is required, and is used to materialize the constant. |
1997 void regcon_inc_ptr( RegisterConstant& dest, RegisterConstant src, | 1997 void regcon_inc_ptr( RegisterOrConstant& dest, RegisterOrConstant src, |
1998 Register temp = noreg ); | 1998 Register temp = noreg ); |
1999 void regcon_sll_ptr( RegisterConstant& dest, RegisterConstant src, | 1999 void regcon_sll_ptr( RegisterOrConstant& dest, RegisterOrConstant src, |
2000 Register temp = noreg ); | 2000 Register temp = noreg ); |
2001 RegisterConstant ensure_rs2(RegisterConstant rs2, Register sethi_temp) { | 2001 RegisterOrConstant ensure_rs2(RegisterOrConstant rs2, Register sethi_temp) { |
2002 guarantee(sethi_temp != noreg, "constant offset overflow"); | 2002 guarantee(sethi_temp != noreg, "constant offset overflow"); |
2003 if (is_simm13(rs2.constant_or_zero())) | 2003 if (is_simm13(rs2.constant_or_zero())) |
2004 return rs2; // register or short constant | 2004 return rs2; // register or short constant |
2005 set(rs2.as_constant(), sethi_temp); | 2005 set(rs2.as_constant(), sethi_temp); |
2006 return sethi_temp; | 2006 return sethi_temp; |
2320 void tlab_refill(Label& retry_tlab, Label& try_eden, Label& slow_case); | 2320 void tlab_refill(Label& retry_tlab, Label& try_eden, Label& slow_case); |
2321 | 2321 |
2322 // interface method calling | 2322 // interface method calling |
2323 void lookup_interface_method(Register recv_klass, | 2323 void lookup_interface_method(Register recv_klass, |
2324 Register intf_klass, | 2324 Register intf_klass, |
2325 RegisterConstant itable_index, | 2325 RegisterOrConstant itable_index, |
2326 Register method_result, | 2326 Register method_result, |
2327 Register temp_reg, Register temp2_reg, | 2327 Register temp_reg, Register temp2_reg, |
2328 Label& no_such_interface); | 2328 Label& no_such_interface); |
2329 | 2329 |
2330 // Test sub_klass against super_klass, with fast and slow paths. | 2330 // Test sub_klass against super_klass, with fast and slow paths. |
2339 Register temp_reg, | 2339 Register temp_reg, |
2340 Register temp2_reg, | 2340 Register temp2_reg, |
2341 Label* L_success, | 2341 Label* L_success, |
2342 Label* L_failure, | 2342 Label* L_failure, |
2343 Label* L_slow_path, | 2343 Label* L_slow_path, |
2344 RegisterConstant super_check_offset = RegisterConstant(-1), | 2344 RegisterOrConstant super_check_offset = RegisterOrConstant(-1), |
2345 Register instanceof_hack = noreg); | 2345 Register instanceof_hack = noreg); |
2346 | 2346 |
2347 // The rest of the type check; must be wired to a corresponding fast path. | 2347 // The rest of the type check; must be wired to a corresponding fast path. |
2348 // It does not repeat the fast path logic, so don't use it standalone. | 2348 // It does not repeat the fast path logic, so don't use it standalone. |
2349 // The temp_reg can be noreg, if no temps are available. | 2349 // The temp_reg can be noreg, if no temps are available. |
2379 | 2379 |
2380 // Writes to stack successive pages until offset reached to check for | 2380 // Writes to stack successive pages until offset reached to check for |
2381 // stack overflow + shadow pages. Clobbers tsp and scratch registers. | 2381 // stack overflow + shadow pages. Clobbers tsp and scratch registers. |
2382 void bang_stack_size(Register Rsize, Register Rtsp, Register Rscratch); | 2382 void bang_stack_size(Register Rsize, Register Rtsp, Register Rscratch); |
2383 | 2383 |
2384 virtual RegisterConstant delayed_value(intptr_t* delayed_value_addr, Register tmp, int offset); | 2384 virtual RegisterOrConstant delayed_value_impl(intptr_t* delayed_value_addr, Register tmp, int offset); |
2385 | 2385 |
2386 void verify_tlab(); | 2386 void verify_tlab(); |
2387 | 2387 |
2388 Condition negate_condition(Condition cond); | 2388 Condition negate_condition(Condition cond); |
2389 | 2389 |