Merge
This commit is contained in:
commit
78e6939c37
@ -127,6 +127,9 @@ $(GENERATEDFILES): refresh_adfiles
|
||||
# Note that product files are updated via "mv", which is atomic.
|
||||
TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)
|
||||
|
||||
# Debuggable by default
|
||||
CFLAGS += -g
|
||||
|
||||
# Pass -D flags into ADLC.
|
||||
ADLCFLAGS += $(SYSDEFS)
|
||||
|
||||
@ -135,7 +138,7 @@ ADLCFLAGS += -q -T
|
||||
|
||||
# Normally, debugging is done directly on the ad_<arch>*.cpp files.
|
||||
# But -g will put #line directives in those files pointing back to <arch>.ad.
|
||||
#ADLCFLAGS += -g
|
||||
ADLCFLAGS += -g
|
||||
|
||||
ifdef LP64
|
||||
ADLCFLAGS += -D_LP64
|
||||
|
@ -147,6 +147,9 @@ $(GENERATEDFILES): refresh_adfiles
|
||||
# Note that product files are updated via "mv", which is atomic.
|
||||
TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$)
|
||||
|
||||
# Debuggable by default
|
||||
CFLAGS += -g
|
||||
|
||||
# Pass -D flags into ADLC.
|
||||
ADLCFLAGS += $(SYSDEFS)
|
||||
|
||||
@ -155,7 +158,7 @@ ADLCFLAGS += -q -T
|
||||
|
||||
# Normally, debugging is done directly on the ad_<arch>*.cpp files.
|
||||
# But -g will put #line directives in those files pointing back to <arch>.ad.
|
||||
#ADLCFLAGS += -g
|
||||
ADLCFLAGS += -g
|
||||
|
||||
ifdef LP64
|
||||
ADLCFLAGS += -D_LP64
|
||||
|
@ -661,9 +661,6 @@ class Assembler : public AbstractAssembler {
|
||||
stx_op3 = 0x0e,
|
||||
swap_op3 = 0x0f,
|
||||
|
||||
lduwa_op3 = 0x10,
|
||||
ldxa_op3 = 0x1b,
|
||||
|
||||
stwa_op3 = 0x14,
|
||||
stxa_op3 = 0x1e,
|
||||
|
||||
|
@ -923,38 +923,6 @@ void emit_form3_mem_reg(CodeBuffer &cbuf, const MachNode* n, int primary, int te
|
||||
#endif
|
||||
}
|
||||
|
||||
void emit_form3_mem_reg_asi(CodeBuffer &cbuf, const MachNode* n, int primary, int tertiary,
|
||||
int src1_enc, int disp32, int src2_enc, int dst_enc, int asi) {
|
||||
|
||||
uint instr;
|
||||
instr = (Assembler::ldst_op << 30)
|
||||
| (dst_enc << 25)
|
||||
| (primary << 19)
|
||||
| (src1_enc << 14);
|
||||
|
||||
int disp = disp32;
|
||||
int index = src2_enc;
|
||||
|
||||
if (src1_enc == R_SP_enc || src1_enc == R_FP_enc)
|
||||
disp += STACK_BIAS;
|
||||
|
||||
// We should have a compiler bailout here rather than a guarantee.
|
||||
// Better yet would be some mechanism to handle variable-size matches correctly.
|
||||
guarantee(Assembler::is_simm13(disp), "Do not match large constant offsets" );
|
||||
|
||||
if( disp != 0 ) {
|
||||
// use reg-reg form
|
||||
// set src2=R_O7 contains offset
|
||||
index = R_O7_enc;
|
||||
emit3_simm13( cbuf, Assembler::arith_op, index, Assembler::or_op3, 0, disp);
|
||||
}
|
||||
instr |= (asi << 5);
|
||||
instr |= index;
|
||||
uint *code = (uint*)cbuf.code_end();
|
||||
*code = instr;
|
||||
cbuf.set_code_end(cbuf.code_end() + BytesPerInstWord);
|
||||
}
|
||||
|
||||
void emit_call_reloc(CodeBuffer &cbuf, intptr_t entry_point, relocInfo::relocType rtype, bool preserve_g2 = false, bool force_far_call = false) {
|
||||
// The method which records debug information at every safepoint
|
||||
// expects the call to be the first instruction in the snippet as
|
||||
@ -1954,11 +1922,6 @@ encode %{
|
||||
$mem$$base, $mem$$disp, $mem$$index, $dst$$reg);
|
||||
%}
|
||||
|
||||
enc_class form3_mem_reg_little( memory mem, iRegI dst) %{
|
||||
emit_form3_mem_reg_asi(cbuf, this, $primary, -1,
|
||||
$mem$$base, $mem$$disp, $mem$$index, $dst$$reg, Assembler::ASI_PRIMARY_LITTLE);
|
||||
%}
|
||||
|
||||
enc_class form3_mem_prefetch_read( memory mem ) %{
|
||||
emit_form3_mem_reg(cbuf, this, $primary, -1,
|
||||
$mem$$base, $mem$$disp, $mem$$index, 0/*prefetch function many-reads*/);
|
||||
@ -4311,8 +4274,8 @@ operand cmpOp_commute() %{
|
||||
// instructions for every form of operand when the instruction accepts
|
||||
// multiple operand types with the same basic encoding and format. The classic
|
||||
// case of this is memory operands.
|
||||
// Indirect is not included since its use is limited to Compare & Swap
|
||||
opclass memory( indirect, indOffset13, indIndex );
|
||||
opclass indIndexMemory( indIndex );
|
||||
|
||||
//----------PIPELINE-----------------------------------------------------------
|
||||
pipeline %{
|
||||
@ -9666,84 +9629,179 @@ instruct popCountL(iRegI dst, iRegL src) %{
|
||||
|
||||
instruct bytes_reverse_int(iRegI dst, stackSlotI src) %{
|
||||
match(Set dst (ReverseBytesI src));
|
||||
effect(DEF dst, USE src);
|
||||
|
||||
// Op cost is artificially doubled to make sure that load or store
|
||||
// instructions are preferred over this one which requires a spill
|
||||
// onto a stack slot.
|
||||
ins_cost(2*DEFAULT_COST + MEMORY_REF_COST);
|
||||
size(8);
|
||||
format %{ "LDUWA $src, $dst\t!asi=primary_little" %}
|
||||
opcode(Assembler::lduwa_op3);
|
||||
ins_encode( form3_mem_reg_little(src, dst) );
|
||||
|
||||
ins_encode %{
|
||||
__ set($src$$disp + STACK_BIAS, O7);
|
||||
__ lduwa($src$$base$$Register, O7, Assembler::ASI_PRIMARY_LITTLE, $dst$$Register);
|
||||
%}
|
||||
ins_pipe( iload_mem );
|
||||
%}
|
||||
|
||||
instruct bytes_reverse_long(iRegL dst, stackSlotL src) %{
|
||||
match(Set dst (ReverseBytesL src));
|
||||
effect(DEF dst, USE src);
|
||||
|
||||
// Op cost is artificially doubled to make sure that load or store
|
||||
// instructions are preferred over this one which requires a spill
|
||||
// onto a stack slot.
|
||||
ins_cost(2*DEFAULT_COST + MEMORY_REF_COST);
|
||||
size(8);
|
||||
format %{ "LDXA $src, $dst\t!asi=primary_little" %}
|
||||
|
||||
opcode(Assembler::ldxa_op3);
|
||||
ins_encode( form3_mem_reg_little(src, dst) );
|
||||
ins_encode %{
|
||||
__ set($src$$disp + STACK_BIAS, O7);
|
||||
__ ldxa($src$$base$$Register, O7, Assembler::ASI_PRIMARY_LITTLE, $dst$$Register);
|
||||
%}
|
||||
ins_pipe( iload_mem );
|
||||
%}
|
||||
|
||||
instruct bytes_reverse_unsigned_short(iRegI dst, stackSlotI src) %{
|
||||
match(Set dst (ReverseBytesUS src));
|
||||
|
||||
// Op cost is artificially doubled to make sure that load or store
|
||||
// instructions are preferred over this one which requires a spill
|
||||
// onto a stack slot.
|
||||
ins_cost(2*DEFAULT_COST + MEMORY_REF_COST);
|
||||
format %{ "LDUHA $src, $dst\t!asi=primary_little\n\t" %}
|
||||
|
||||
ins_encode %{
|
||||
// the value was spilled as an int so bias the load
|
||||
__ set($src$$disp + STACK_BIAS + 2, O7);
|
||||
__ lduha($src$$base$$Register, O7, Assembler::ASI_PRIMARY_LITTLE, $dst$$Register);
|
||||
%}
|
||||
ins_pipe( iload_mem );
|
||||
%}
|
||||
|
||||
instruct bytes_reverse_short(iRegI dst, stackSlotI src) %{
|
||||
match(Set dst (ReverseBytesS src));
|
||||
|
||||
// Op cost is artificially doubled to make sure that load or store
|
||||
// instructions are preferred over this one which requires a spill
|
||||
// onto a stack slot.
|
||||
ins_cost(2*DEFAULT_COST + MEMORY_REF_COST);
|
||||
format %{ "LDSHA $src, $dst\t!asi=primary_little\n\t" %}
|
||||
|
||||
ins_encode %{
|
||||
// the value was spilled as an int so bias the load
|
||||
__ set($src$$disp + STACK_BIAS + 2, O7);
|
||||
__ ldsha($src$$base$$Register, O7, Assembler::ASI_PRIMARY_LITTLE, $dst$$Register);
|
||||
%}
|
||||
ins_pipe( iload_mem );
|
||||
%}
|
||||
|
||||
// Load Integer reversed byte order
|
||||
instruct loadI_reversed(iRegI dst, memory src) %{
|
||||
instruct loadI_reversed(iRegI dst, indIndexMemory src) %{
|
||||
match(Set dst (ReverseBytesI (LoadI src)));
|
||||
|
||||
ins_cost(DEFAULT_COST + MEMORY_REF_COST);
|
||||
size(8);
|
||||
size(4);
|
||||
format %{ "LDUWA $src, $dst\t!asi=primary_little" %}
|
||||
|
||||
opcode(Assembler::lduwa_op3);
|
||||
ins_encode( form3_mem_reg_little( src, dst) );
|
||||
ins_encode %{
|
||||
__ lduwa($src$$base$$Register, $src$$index$$Register, Assembler::ASI_PRIMARY_LITTLE, $dst$$Register);
|
||||
%}
|
||||
ins_pipe(iload_mem);
|
||||
%}
|
||||
|
||||
// Load Long - aligned and reversed
|
||||
instruct loadL_reversed(iRegL dst, memory src) %{
|
||||
instruct loadL_reversed(iRegL dst, indIndexMemory src) %{
|
||||
match(Set dst (ReverseBytesL (LoadL src)));
|
||||
|
||||
ins_cost(DEFAULT_COST + MEMORY_REF_COST);
|
||||
size(8);
|
||||
ins_cost(MEMORY_REF_COST);
|
||||
size(4);
|
||||
format %{ "LDXA $src, $dst\t!asi=primary_little" %}
|
||||
|
||||
opcode(Assembler::ldxa_op3);
|
||||
ins_encode( form3_mem_reg_little( src, dst ) );
|
||||
ins_encode %{
|
||||
__ ldxa($src$$base$$Register, $src$$index$$Register, Assembler::ASI_PRIMARY_LITTLE, $dst$$Register);
|
||||
%}
|
||||
ins_pipe(iload_mem);
|
||||
%}
|
||||
|
||||
// Load unsigned short / char reversed byte order
|
||||
instruct loadUS_reversed(iRegI dst, indIndexMemory src) %{
|
||||
match(Set dst (ReverseBytesUS (LoadUS src)));
|
||||
|
||||
ins_cost(MEMORY_REF_COST);
|
||||
size(4);
|
||||
format %{ "LDUHA $src, $dst\t!asi=primary_little" %}
|
||||
|
||||
ins_encode %{
|
||||
__ lduha($src$$base$$Register, $src$$index$$Register, Assembler::ASI_PRIMARY_LITTLE, $dst$$Register);
|
||||
%}
|
||||
ins_pipe(iload_mem);
|
||||
%}
|
||||
|
||||
// Load short reversed byte order
|
||||
instruct loadS_reversed(iRegI dst, indIndexMemory src) %{
|
||||
match(Set dst (ReverseBytesS (LoadS src)));
|
||||
|
||||
ins_cost(MEMORY_REF_COST);
|
||||
size(4);
|
||||
format %{ "LDSHA $src, $dst\t!asi=primary_little" %}
|
||||
|
||||
ins_encode %{
|
||||
__ ldsha($src$$base$$Register, $src$$index$$Register, Assembler::ASI_PRIMARY_LITTLE, $dst$$Register);
|
||||
%}
|
||||
ins_pipe(iload_mem);
|
||||
%}
|
||||
|
||||
// Store Integer reversed byte order
|
||||
instruct storeI_reversed(memory dst, iRegI src) %{
|
||||
instruct storeI_reversed(indIndexMemory dst, iRegI src) %{
|
||||
match(Set dst (StoreI dst (ReverseBytesI src)));
|
||||
|
||||
ins_cost(MEMORY_REF_COST);
|
||||
size(8);
|
||||
size(4);
|
||||
format %{ "STWA $src, $dst\t!asi=primary_little" %}
|
||||
|
||||
opcode(Assembler::stwa_op3);
|
||||
ins_encode( form3_mem_reg_little( dst, src) );
|
||||
ins_encode %{
|
||||
__ stwa($src$$Register, $dst$$base$$Register, $dst$$index$$Register, Assembler::ASI_PRIMARY_LITTLE);
|
||||
%}
|
||||
ins_pipe(istore_mem_reg);
|
||||
%}
|
||||
|
||||
// Store Long reversed byte order
|
||||
instruct storeL_reversed(memory dst, iRegL src) %{
|
||||
instruct storeL_reversed(indIndexMemory dst, iRegL src) %{
|
||||
match(Set dst (StoreL dst (ReverseBytesL src)));
|
||||
|
||||
ins_cost(MEMORY_REF_COST);
|
||||
size(8);
|
||||
size(4);
|
||||
format %{ "STXA $src, $dst\t!asi=primary_little" %}
|
||||
|
||||
opcode(Assembler::stxa_op3);
|
||||
ins_encode( form3_mem_reg_little( dst, src) );
|
||||
ins_encode %{
|
||||
__ stxa($src$$Register, $dst$$base$$Register, $dst$$index$$Register, Assembler::ASI_PRIMARY_LITTLE);
|
||||
%}
|
||||
ins_pipe(istore_mem_reg);
|
||||
%}
|
||||
|
||||
// Store unsighed short/char reversed byte order
|
||||
instruct storeUS_reversed(indIndexMemory dst, iRegI src) %{
|
||||
match(Set dst (StoreC dst (ReverseBytesUS src)));
|
||||
|
||||
ins_cost(MEMORY_REF_COST);
|
||||
size(4);
|
||||
format %{ "STHA $src, $dst\t!asi=primary_little" %}
|
||||
|
||||
ins_encode %{
|
||||
__ stha($src$$Register, $dst$$base$$Register, $dst$$index$$Register, Assembler::ASI_PRIMARY_LITTLE);
|
||||
%}
|
||||
ins_pipe(istore_mem_reg);
|
||||
%}
|
||||
|
||||
// Store short reversed byte order
|
||||
instruct storeS_reversed(indIndexMemory dst, iRegI src) %{
|
||||
match(Set dst (StoreC dst (ReverseBytesS src)));
|
||||
|
||||
ins_cost(MEMORY_REF_COST);
|
||||
size(4);
|
||||
format %{ "STHA $src, $dst\t!asi=primary_little" %}
|
||||
|
||||
ins_encode %{
|
||||
__ stha($src$$Register, $dst$$base$$Register, $dst$$index$$Register, Assembler::ASI_PRIMARY_LITTLE);
|
||||
%}
|
||||
ins_pipe(istore_mem_reg);
|
||||
%}
|
||||
|
||||
|
@ -1244,8 +1244,7 @@ void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch
|
||||
break;
|
||||
#endif // _L64
|
||||
case T_INT:
|
||||
// %%% could this be a movl? this is safer but longer instruction
|
||||
__ movl2ptr(dest->as_register(), from_addr);
|
||||
__ movl(dest->as_register(), from_addr);
|
||||
break;
|
||||
|
||||
case T_LONG: {
|
||||
@ -1303,7 +1302,6 @@ void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch
|
||||
__ shll(dest_reg, 24);
|
||||
__ sarl(dest_reg, 24);
|
||||
}
|
||||
// These are unsigned so the zero extension on 64bit is just what we need
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1315,8 +1313,6 @@ void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch
|
||||
} else {
|
||||
__ movw(dest_reg, from_addr);
|
||||
}
|
||||
// This is unsigned so the zero extension on 64bit is just what we need
|
||||
// __ movl2ptr(dest_reg, dest_reg);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1329,8 +1325,6 @@ void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch
|
||||
__ shll(dest_reg, 16);
|
||||
__ sarl(dest_reg, 16);
|
||||
}
|
||||
// Might not be needed in 64bit but certainly doesn't hurt (except for code size)
|
||||
__ movl2ptr(dest_reg, dest_reg);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
// Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
//
|
||||
// This code is free software; you can redistribute it and/or modify it
|
||||
@ -6272,6 +6272,30 @@ instruct bytes_reverse_long(eRegL dst) %{
|
||||
ins_pipe( ialu_reg_reg);
|
||||
%}
|
||||
|
||||
instruct bytes_reverse_unsigned_short(eRegI dst) %{
|
||||
match(Set dst (ReverseBytesUS dst));
|
||||
|
||||
format %{ "BSWAP $dst\n\t"
|
||||
"SHR $dst,16\n\t" %}
|
||||
ins_encode %{
|
||||
__ bswapl($dst$$Register);
|
||||
__ shrl($dst$$Register, 16);
|
||||
%}
|
||||
ins_pipe( ialu_reg );
|
||||
%}
|
||||
|
||||
instruct bytes_reverse_short(eRegI dst) %{
|
||||
match(Set dst (ReverseBytesS dst));
|
||||
|
||||
format %{ "BSWAP $dst\n\t"
|
||||
"SAR $dst,16\n\t" %}
|
||||
ins_encode %{
|
||||
__ bswapl($dst$$Register);
|
||||
__ sarl($dst$$Register, 16);
|
||||
%}
|
||||
ins_pipe( ialu_reg );
|
||||
%}
|
||||
|
||||
|
||||
//---------- Zeros Count Instructions ------------------------------------------
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
// Copyright 2003-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
//
|
||||
// This code is free software; you can redistribute it and/or modify it
|
||||
@ -7371,6 +7371,30 @@ instruct bytes_reverse_long(rRegL dst) %{
|
||||
ins_pipe( ialu_reg);
|
||||
%}
|
||||
|
||||
instruct bytes_reverse_unsigned_short(rRegI dst) %{
|
||||
match(Set dst (ReverseBytesUS dst));
|
||||
|
||||
format %{ "bswapl $dst\n\t"
|
||||
"shrl $dst,16\n\t" %}
|
||||
ins_encode %{
|
||||
__ bswapl($dst$$Register);
|
||||
__ shrl($dst$$Register, 16);
|
||||
%}
|
||||
ins_pipe( ialu_reg );
|
||||
%}
|
||||
|
||||
instruct bytes_reverse_short(rRegI dst) %{
|
||||
match(Set dst (ReverseBytesS dst));
|
||||
|
||||
format %{ "bswapl $dst\n\t"
|
||||
"sar $dst,16\n\t" %}
|
||||
ins_encode %{
|
||||
__ bswapl($dst$$Register);
|
||||
__ sarl($dst$$Register, 16);
|
||||
%}
|
||||
ins_pipe( ialu_reg );
|
||||
%}
|
||||
|
||||
instruct loadI_reversed(rRegI dst, memory src) %{
|
||||
match(Set dst (ReverseBytesI (LoadI src)));
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1998-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1998-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -3861,6 +3861,8 @@ int MatchRule::is_expensive() const {
|
||||
strcmp(opType,"RoundFloat")==0 ||
|
||||
strcmp(opType,"ReverseBytesI")==0 ||
|
||||
strcmp(opType,"ReverseBytesL")==0 ||
|
||||
strcmp(opType,"ReverseBytesUS")==0 ||
|
||||
strcmp(opType,"ReverseBytesS")==0 ||
|
||||
strcmp(opType,"Replicate16B")==0 ||
|
||||
strcmp(opType,"Replicate8B")==0 ||
|
||||
strcmp(opType,"Replicate4B")==0 ||
|
||||
|
@ -316,7 +316,7 @@ void Compilation::install_code(int frame_size) {
|
||||
implicit_exception_table(),
|
||||
compiler(),
|
||||
_env->comp_level(),
|
||||
needs_debug_information(),
|
||||
true,
|
||||
has_unsafe_access()
|
||||
);
|
||||
}
|
||||
@ -449,8 +449,6 @@ Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* metho
|
||||
assert(_arena == NULL, "shouldn't only one instance of Compilation in existence at a time");
|
||||
_arena = Thread::current()->resource_area();
|
||||
_compilation = this;
|
||||
_needs_debug_information = _env->jvmti_can_examine_or_deopt_anywhere() ||
|
||||
JavaMonitorsInStackTrace || AlwaysEmitDebugInfo || DeoptimizeALot;
|
||||
_exception_info_list = new ExceptionInfoList();
|
||||
_implicit_exception_table.set_size(0);
|
||||
compile_method();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1999-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -70,7 +70,6 @@ class Compilation: public StackObj {
|
||||
int _max_spills;
|
||||
FrameMap* _frame_map;
|
||||
C1_MacroAssembler* _masm;
|
||||
bool _needs_debug_information;
|
||||
bool _has_exception_handlers;
|
||||
bool _has_fpu_code;
|
||||
bool _has_unsafe_access;
|
||||
@ -117,7 +116,6 @@ class Compilation: public StackObj {
|
||||
// accessors
|
||||
ciEnv* env() const { return _env; }
|
||||
AbstractCompiler* compiler() const { return _compiler; }
|
||||
bool needs_debug_information() const { return _needs_debug_information; }
|
||||
bool has_exception_handlers() const { return _has_exception_handlers; }
|
||||
bool has_fpu_code() const { return _has_fpu_code; }
|
||||
bool has_unsafe_access() const { return _has_unsafe_access; }
|
||||
@ -132,7 +130,6 @@ class Compilation: public StackObj {
|
||||
CodeOffsets* offsets() { return &_offsets; }
|
||||
|
||||
// setters
|
||||
void set_needs_debug_information(bool f) { _needs_debug_information = f; }
|
||||
void set_has_exception_handlers(bool f) { _has_exception_handlers = f; }
|
||||
void set_has_fpu_code(bool f) { _has_fpu_code = f; }
|
||||
void set_has_unsafe_access(bool f) { _has_unsafe_access = f; }
|
||||
|
@ -1493,7 +1493,6 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
|
||||
|
||||
Dependencies* GraphBuilder::dependency_recorder() const {
|
||||
assert(DeoptC1, "need debug information");
|
||||
compilation()->set_needs_debug_information(true);
|
||||
return compilation()->dependency_recorder();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 2005-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -2814,9 +2814,6 @@ IRScopeDebugInfo* LinearScan::compute_debug_info_for_scope(int op_id, IRScope* c
|
||||
|
||||
|
||||
void LinearScan::compute_debug_info(CodeEmitInfo* info, int op_id) {
|
||||
if (!compilation()->needs_debug_information()) {
|
||||
return;
|
||||
}
|
||||
TRACE_LINEAR_SCAN(3, tty->print_cr("creating debug information at op_id %d", op_id));
|
||||
|
||||
IRScope* innermost_scope = info->scope();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 2000-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -252,9 +252,6 @@
|
||||
develop(bool, BailoutOnExceptionHandlers, false, \
|
||||
"bailout of compilation for methods with exception handlers") \
|
||||
\
|
||||
develop(bool, AlwaysEmitDebugInfo, false, \
|
||||
"always emit debug info") \
|
||||
\
|
||||
develop(bool, InstallMethods, true, \
|
||||
"Install methods at the end of successful compilations") \
|
||||
\
|
||||
|
@ -1408,8 +1408,11 @@ BCEscapeAnalyzer::BCEscapeAnalyzer(ciMethod* method, BCEscapeAnalyzer* parent)
|
||||
}
|
||||
|
||||
void BCEscapeAnalyzer::copy_dependencies(Dependencies *deps) {
|
||||
if(!has_dependencies())
|
||||
return;
|
||||
if (ciEnv::current()->jvmti_can_hotswap_or_post_breakpoint()) {
|
||||
// Also record evol dependencies so redefinition of the
|
||||
// callee will trigger recompilation.
|
||||
deps->assert_evol_method(method());
|
||||
}
|
||||
for (int i = 0; i < _dependencies.length(); i+=2) {
|
||||
ciKlass *k = _dependencies[i]->as_klass();
|
||||
ciMethod *m = _dependencies[i+1]->as_method();
|
||||
|
@ -176,7 +176,6 @@ void ciEnv::cache_jvmti_state() {
|
||||
// Get Jvmti capabilities under lock to get consistant values.
|
||||
MutexLocker mu(JvmtiThreadState_lock);
|
||||
_jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint();
|
||||
_jvmti_can_examine_or_deopt_anywhere = JvmtiExport::can_examine_or_deopt_anywhere();
|
||||
_jvmti_can_access_local_variables = JvmtiExport::can_access_local_variables();
|
||||
_jvmti_can_post_on_exceptions = JvmtiExport::can_post_on_exceptions();
|
||||
}
|
||||
@ -887,8 +886,6 @@ void ciEnv::register_method(ciMethod* target,
|
||||
if (!failing() &&
|
||||
( (!jvmti_can_hotswap_or_post_breakpoint() &&
|
||||
JvmtiExport::can_hotswap_or_post_breakpoint()) ||
|
||||
(!jvmti_can_examine_or_deopt_anywhere() &&
|
||||
JvmtiExport::can_examine_or_deopt_anywhere()) ||
|
||||
(!jvmti_can_access_local_variables() &&
|
||||
JvmtiExport::can_access_local_variables()) ||
|
||||
(!jvmti_can_post_on_exceptions() &&
|
||||
|
@ -55,7 +55,6 @@ private:
|
||||
|
||||
// Cache Jvmti state
|
||||
bool _jvmti_can_hotswap_or_post_breakpoint;
|
||||
bool _jvmti_can_examine_or_deopt_anywhere;
|
||||
bool _jvmti_can_access_local_variables;
|
||||
bool _jvmti_can_post_on_exceptions;
|
||||
|
||||
@ -257,7 +256,6 @@ public:
|
||||
// Cache Jvmti state
|
||||
void cache_jvmti_state();
|
||||
bool jvmti_can_hotswap_or_post_breakpoint() const { return _jvmti_can_hotswap_or_post_breakpoint; }
|
||||
bool jvmti_can_examine_or_deopt_anywhere() const { return _jvmti_can_examine_or_deopt_anywhere; }
|
||||
bool jvmti_can_access_local_variables() const { return _jvmti_can_access_local_variables; }
|
||||
bool jvmti_can_post_on_exceptions() const { return _jvmti_can_post_on_exceptions; }
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -357,6 +357,8 @@
|
||||
template(void_double_signature, "()D") \
|
||||
template(int_void_signature, "(I)V") \
|
||||
template(int_int_signature, "(I)I") \
|
||||
template(char_char_signature, "(C)C") \
|
||||
template(short_short_signature, "(S)S") \
|
||||
template(int_bool_signature, "(I)Z") \
|
||||
template(float_int_signature, "(F)I") \
|
||||
template(double_long_signature, "(D)J") \
|
||||
@ -584,6 +586,10 @@
|
||||
do_intrinsic(_reverseBytes_i, java_lang_Integer, reverseBytes_name, int_int_signature, F_S) \
|
||||
do_name( reverseBytes_name, "reverseBytes") \
|
||||
do_intrinsic(_reverseBytes_l, java_lang_Long, reverseBytes_name, long_long_signature, F_S) \
|
||||
/* (symbol reverseBytes_name defined above) */ \
|
||||
do_intrinsic(_reverseBytes_c, java_lang_Character, reverseBytes_name, char_char_signature, F_S) \
|
||||
/* (symbol reverseBytes_name defined above) */ \
|
||||
do_intrinsic(_reverseBytes_s, java_lang_Short, reverseBytes_name, short_short_signature, F_S) \
|
||||
/* (symbol reverseBytes_name defined above) */ \
|
||||
\
|
||||
do_intrinsic(_identityHashCode, java_lang_System, identityHashCode_name, object_int_signature, F_S) \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1999-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -105,8 +105,7 @@ void C2Compiler::compile_method(ciEnv* env,
|
||||
}
|
||||
bool subsume_loads = true;
|
||||
bool do_escape_analysis = DoEscapeAnalysis &&
|
||||
!(env->jvmti_can_hotswap_or_post_breakpoint() ||
|
||||
env->jvmti_can_examine_or_deopt_anywhere());
|
||||
!env->jvmti_can_access_local_variables();
|
||||
while (!env->failing()) {
|
||||
// Attempt to compile while subsuming loads into machine instructions.
|
||||
Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -44,6 +44,8 @@ macro(Bool)
|
||||
macro(BoxLock)
|
||||
macro(ReverseBytesI)
|
||||
macro(ReverseBytesL)
|
||||
macro(ReverseBytesUS)
|
||||
macro(ReverseBytesS)
|
||||
macro(CProj)
|
||||
macro(CallDynamicJava)
|
||||
macro(CallJava)
|
||||
|
@ -871,7 +871,6 @@ void Compile::Init(int aliaslevel) {
|
||||
set_has_split_ifs(false);
|
||||
set_has_loops(has_method() && method()->has_loops()); // first approximation
|
||||
set_has_stringbuilder(false);
|
||||
_deopt_happens = true; // start out assuming the worst
|
||||
_trap_can_recompile = false; // no traps emitted yet
|
||||
_major_progress = true; // start out assuming good things will happen
|
||||
set_has_unsafe_access(false);
|
||||
|
@ -146,7 +146,6 @@ class Compile : public Phase {
|
||||
int _orig_pc_slot_offset_in_bytes;
|
||||
|
||||
int _major_progress; // Count of something big happening
|
||||
bool _deopt_happens; // TRUE if de-optimization CAN happen
|
||||
bool _has_loops; // True if the method _may_ have some loops
|
||||
bool _has_split_ifs; // True if the method _may_ have some split-if
|
||||
bool _has_unsafe_access; // True if the method _may_ produce faults in unsafe loads or stores.
|
||||
@ -300,7 +299,6 @@ class Compile : public Phase {
|
||||
void set_freq_inline_size(int n) { _freq_inline_size = n; }
|
||||
int freq_inline_size() const { return _freq_inline_size; }
|
||||
void set_max_inline_size(int n) { _max_inline_size = n; }
|
||||
bool deopt_happens() const { return _deopt_happens; }
|
||||
bool has_loops() const { return _has_loops; }
|
||||
void set_has_loops(bool z) { _has_loops = z; }
|
||||
bool has_split_ifs() const { return _has_split_ifs; }
|
||||
|
@ -812,10 +812,6 @@ void GraphKit::add_safepoint_edges(SafePointNode* call, bool must_throw) {
|
||||
|
||||
JVMState* youngest_jvms = sync_jvms();
|
||||
|
||||
// Do we need debug info here? If it is a SafePoint and this method
|
||||
// cannot de-opt, then we do NOT need any debug info.
|
||||
bool full_info = (C->deopt_happens() || call->Opcode() != Op_SafePoint);
|
||||
|
||||
// If we are guaranteed to throw, we can prune everything but the
|
||||
// input to the current bytecode.
|
||||
bool can_prune_locals = false;
|
||||
@ -829,10 +825,9 @@ void GraphKit::add_safepoint_edges(SafePointNode* call, bool must_throw) {
|
||||
}
|
||||
}
|
||||
|
||||
if (env()->jvmti_can_examine_or_deopt_anywhere()) {
|
||||
if (env()->jvmti_can_access_local_variables()) {
|
||||
// At any safepoint, this method can get breakpointed, which would
|
||||
// then require an immediate deoptimization.
|
||||
full_info = true;
|
||||
can_prune_locals = false; // do not prune locals
|
||||
stack_slots_not_pruned = 0;
|
||||
}
|
||||
@ -890,7 +885,7 @@ void GraphKit::add_safepoint_edges(SafePointNode* call, bool must_throw) {
|
||||
k = in_jvms->locoff();
|
||||
l = in_jvms->loc_size();
|
||||
out_jvms->set_locoff(p);
|
||||
if (full_info && !can_prune_locals) {
|
||||
if (!can_prune_locals) {
|
||||
for (j = 0; j < l; j++)
|
||||
call->set_req(p++, in_map->in(k+j));
|
||||
} else {
|
||||
@ -901,7 +896,7 @@ void GraphKit::add_safepoint_edges(SafePointNode* call, bool must_throw) {
|
||||
k = in_jvms->stkoff();
|
||||
l = in_jvms->sp();
|
||||
out_jvms->set_stkoff(p);
|
||||
if (full_info && !can_prune_locals) {
|
||||
if (!can_prune_locals) {
|
||||
for (j = 0; j < l; j++)
|
||||
call->set_req(p++, in_map->in(k+j));
|
||||
} else if (can_prune_locals && stack_slots_not_pruned != 0) {
|
||||
|
@ -636,6 +636,8 @@ bool LibraryCallKit::try_to_inline() {
|
||||
|
||||
case vmIntrinsics::_reverseBytes_i:
|
||||
case vmIntrinsics::_reverseBytes_l:
|
||||
case vmIntrinsics::_reverseBytes_s:
|
||||
case vmIntrinsics::_reverseBytes_c:
|
||||
return inline_reverseBytes((vmIntrinsics::ID) intrinsic_id());
|
||||
|
||||
case vmIntrinsics::_get_AtomicLong:
|
||||
@ -2010,13 +2012,19 @@ bool LibraryCallKit::inline_bitCount(vmIntrinsics::ID id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//----------------------------inline_reverseBytes_int/long-------------------
|
||||
//----------------------------inline_reverseBytes_int/long/char/short-------------------
|
||||
// inline Integer.reverseBytes(int)
|
||||
// inline Long.reverseBytes(long)
|
||||
// inline Character.reverseBytes(char)
|
||||
// inline Short.reverseBytes(short)
|
||||
bool LibraryCallKit::inline_reverseBytes(vmIntrinsics::ID id) {
|
||||
assert(id == vmIntrinsics::_reverseBytes_i || id == vmIntrinsics::_reverseBytes_l, "not reverse Bytes");
|
||||
if (id == vmIntrinsics::_reverseBytes_i && !Matcher::has_match_rule(Op_ReverseBytesI)) return false;
|
||||
if (id == vmIntrinsics::_reverseBytes_l && !Matcher::has_match_rule(Op_ReverseBytesL)) return false;
|
||||
assert(id == vmIntrinsics::_reverseBytes_i || id == vmIntrinsics::_reverseBytes_l ||
|
||||
id == vmIntrinsics::_reverseBytes_c || id == vmIntrinsics::_reverseBytes_s,
|
||||
"not reverse Bytes");
|
||||
if (id == vmIntrinsics::_reverseBytes_i && !Matcher::has_match_rule(Op_ReverseBytesI)) return false;
|
||||
if (id == vmIntrinsics::_reverseBytes_l && !Matcher::has_match_rule(Op_ReverseBytesL)) return false;
|
||||
if (id == vmIntrinsics::_reverseBytes_c && !Matcher::has_match_rule(Op_ReverseBytesUS)) return false;
|
||||
if (id == vmIntrinsics::_reverseBytes_s && !Matcher::has_match_rule(Op_ReverseBytesS)) return false;
|
||||
_sp += arg_size(); // restore stack pointer
|
||||
switch (id) {
|
||||
case vmIntrinsics::_reverseBytes_i:
|
||||
@ -2025,6 +2033,12 @@ bool LibraryCallKit::inline_reverseBytes(vmIntrinsics::ID id) {
|
||||
case vmIntrinsics::_reverseBytes_l:
|
||||
push_pair(_gvn.transform(new (C, 2) ReverseBytesLNode(0, pop_pair())));
|
||||
break;
|
||||
case vmIntrinsics::_reverseBytes_c:
|
||||
push(_gvn.transform(new (C, 2) ReverseBytesUSNode(0, pop())));
|
||||
break;
|
||||
case vmIntrinsics::_reverseBytes_s:
|
||||
push(_gvn.transform(new (C, 2) ReverseBytesSNode(0, pop())));
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* Copyright 1997-2010 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -509,3 +509,23 @@ public:
|
||||
const Type *bottom_type() const { return TypeLong::LONG; }
|
||||
virtual uint ideal_reg() const { return Op_RegL; }
|
||||
};
|
||||
|
||||
//-------------------------------ReverseBytesUSNode--------------------------------
|
||||
// reverse bytes of an unsigned short / char
|
||||
class ReverseBytesUSNode : public Node {
|
||||
public:
|
||||
ReverseBytesUSNode(Node *c, Node *in1) : Node(c, in1) {}
|
||||
virtual int Opcode() const;
|
||||
const Type *bottom_type() const { return TypeInt::CHAR; }
|
||||
virtual uint ideal_reg() const { return Op_RegI; }
|
||||
};
|
||||
|
||||
//-------------------------------ReverseBytesSNode--------------------------------
|
||||
// reverse bytes of a short
|
||||
class ReverseBytesSNode : public Node {
|
||||
public:
|
||||
ReverseBytesSNode(Node *c, Node *in1) : Node(c, in1) {}
|
||||
virtual int Opcode() const;
|
||||
const Type *bottom_type() const { return TypeInt::SHORT; }
|
||||
virtual uint ideal_reg() const { return Op_RegI; }
|
||||
};
|
||||
|
@ -270,7 +270,6 @@ int JvmtiExport::_field_access_count = 0;
|
||||
int JvmtiExport::_field_modification_count = 0;
|
||||
|
||||
bool JvmtiExport::_can_access_local_variables = false;
|
||||
bool JvmtiExport::_can_examine_or_deopt_anywhere = false;
|
||||
bool JvmtiExport::_can_hotswap_or_post_breakpoint = false;
|
||||
bool JvmtiExport::_can_modify_any_class = false;
|
||||
bool JvmtiExport::_can_walk_any_space = false;
|
||||
|
@ -58,7 +58,6 @@ class JvmtiExport : public AllStatic {
|
||||
static int _field_modification_count;
|
||||
|
||||
static bool _can_access_local_variables;
|
||||
static bool _can_examine_or_deopt_anywhere;
|
||||
static bool _can_hotswap_or_post_breakpoint;
|
||||
static bool _can_modify_any_class;
|
||||
static bool _can_walk_any_space;
|
||||
@ -112,7 +111,6 @@ class JvmtiExport : public AllStatic {
|
||||
|
||||
// these should only be called by the friend class
|
||||
friend class JvmtiManageCapabilities;
|
||||
inline static void set_can_examine_or_deopt_anywhere(bool on) { _can_examine_or_deopt_anywhere = (on != 0); }
|
||||
inline static void set_can_modify_any_class(bool on) { _can_modify_any_class = (on != 0); }
|
||||
inline static void set_can_access_local_variables(bool on) { _can_access_local_variables = (on != 0); }
|
||||
inline static void set_can_hotswap_or_post_breakpoint(bool on) { _can_hotswap_or_post_breakpoint = (on != 0); }
|
||||
@ -220,7 +218,6 @@ class JvmtiExport : public AllStatic {
|
||||
static void enter_live_phase();
|
||||
|
||||
// ------ can_* conditions (below) are set at OnLoad and never changed ------------
|
||||
inline static bool can_examine_or_deopt_anywhere() { return _can_examine_or_deopt_anywhere; }
|
||||
inline static bool can_modify_any_class() { return _can_modify_any_class; }
|
||||
inline static bool can_access_local_variables() { return _can_access_local_variables; }
|
||||
inline static bool can_hotswap_or_post_breakpoint() { return _can_hotswap_or_post_breakpoint; }
|
||||
|
@ -332,16 +332,6 @@ void JvmtiManageCapabilities::update() {
|
||||
}
|
||||
|
||||
JvmtiExport::set_can_get_source_debug_extension(avail.can_get_source_debug_extension);
|
||||
JvmtiExport::set_can_examine_or_deopt_anywhere(
|
||||
avail.can_generate_breakpoint_events ||
|
||||
interp_events ||
|
||||
avail.can_redefine_classes ||
|
||||
avail.can_retransform_classes ||
|
||||
avail.can_access_local_variables ||
|
||||
avail.can_get_owned_monitor_info ||
|
||||
avail.can_get_current_contended_monitor ||
|
||||
avail.can_get_monitor_info ||
|
||||
avail.can_get_owned_monitor_stack_depth_info);
|
||||
JvmtiExport::set_can_maintain_original_method_order(avail.can_maintain_original_method_order);
|
||||
JvmtiExport::set_can_post_interpreter_events(interp_events);
|
||||
JvmtiExport::set_can_hotswap_or_post_breakpoint(
|
||||
@ -353,10 +343,13 @@ void JvmtiManageCapabilities::update() {
|
||||
avail.can_generate_all_class_hook_events);
|
||||
JvmtiExport::set_can_walk_any_space(
|
||||
avail.can_tag_objects); // disable sharing in onload phase
|
||||
// This controls whether the compilers keep extra locals live to
|
||||
// improve the debugging experience so only set them if the selected
|
||||
// capabilities look like a debugger.
|
||||
JvmtiExport::set_can_access_local_variables(
|
||||
avail.can_access_local_variables ||
|
||||
avail.can_redefine_classes ||
|
||||
avail.can_retransform_classes);
|
||||
avail.can_access_local_variables ||
|
||||
avail.can_generate_breakpoint_events ||
|
||||
avail.can_generate_frame_pop_events);
|
||||
JvmtiExport::set_can_post_on_exceptions(
|
||||
avail.can_generate_exception_events ||
|
||||
avail.can_generate_frame_pop_events ||
|
||||
|
176
hotspot/test/compiler/6431242/Test.java
Normal file
176
hotspot/test/compiler/6431242/Test.java
Normal file
@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6431242
|
||||
* @run main/othervm -server -XX:+PrintCompilation Test
|
||||
*/
|
||||
|
||||
public class Test{
|
||||
|
||||
int _len = 8;
|
||||
int[] _arr_i = new int[_len];
|
||||
long[] _arr_l = new long[_len];
|
||||
|
||||
int[] _arr_i_cp = new int [_len];
|
||||
long[] _arr_l_cp = new long [_len];
|
||||
|
||||
int _k = 0x12345678;
|
||||
int _j = 0;
|
||||
int _ir = 0x78563412;
|
||||
int _ir1 = 0x78563413;
|
||||
int _ir2 = 0x79563412;
|
||||
|
||||
long _m = 0x123456789abcdef0L;
|
||||
long _l = 0L;
|
||||
long _lr = 0xf0debc9a78563412L;
|
||||
long _lr1 = 0xf0debc9a78563413L;
|
||||
long _lr2 = 0xf1debc9a78563412L;
|
||||
|
||||
void init() {
|
||||
for (int i=0; i<_arr_i.length; i++) {
|
||||
_arr_i[i] = _k;
|
||||
_arr_l[i] = _m;
|
||||
}
|
||||
}
|
||||
|
||||
public int test_int_reversed(int i) {
|
||||
return Integer.reverseBytes(i);
|
||||
}
|
||||
|
||||
public long test_long_reversed(long i) {
|
||||
return Long.reverseBytes(i);
|
||||
}
|
||||
|
||||
public void test_copy_ints(int[] dst, int[] src) {
|
||||
for(int i=0; i<src.length; i++) {
|
||||
dst[i] = Integer.reverseBytes(src[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void test_copy_ints_reversed(int[] dst, int[] src) {
|
||||
for (int i=0; i<src.length; i++) {
|
||||
dst[i] = 1 + Integer.reverseBytes(src[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void test_copy_ints_store_reversed(int[] dst, int[] src) {
|
||||
for(int i=0; i<src.length; i++) {
|
||||
dst[i] = Integer.reverseBytes(1 + src[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void test_copy_longs(long[] dst, long[] src) {
|
||||
for(int i=0; i<src.length; i++) {
|
||||
dst[i] = Long.reverseBytes(src[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void test_copy_longs_reversed(long[] dst, long[] src) {
|
||||
for (int i=0; i<src.length; i++) {
|
||||
dst[i] = 1 + Long.reverseBytes(src[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void test_copy_longs_store_reversed(long[] dst, long[] src) {
|
||||
for(int i=0; i<src.length; i++) {
|
||||
dst[i] = Long.reverseBytes(1 + src[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public void test() throws Exception {
|
||||
int up_limit=90000;
|
||||
|
||||
|
||||
//test single
|
||||
|
||||
for (int loop=0; loop<up_limit; loop++) {
|
||||
_j = test_int_reversed(_k);
|
||||
if (_j != _ir ) {
|
||||
throw new Exception("Interger.reverseBytes failed " + _j + " iter " + loop);
|
||||
}
|
||||
_l = test_long_reversed(_m);
|
||||
if (_l != _lr ) {
|
||||
throw new Exception("Long.reverseBytes failed " + _l + " iter " + loop);
|
||||
}
|
||||
}
|
||||
|
||||
// test scalar load/store
|
||||
for (int loop=0; loop<up_limit; loop++) {
|
||||
|
||||
test_copy_ints(_arr_i_cp, _arr_i);
|
||||
for (int j=0; j< _arr_i.length; j++) {
|
||||
if (_arr_i_cp[j] != _ir) {
|
||||
throw new Exception("Interger.reverseBytes failed test_copy_ints iter " + loop);
|
||||
}
|
||||
}
|
||||
|
||||
test_copy_ints_reversed(_arr_i_cp, _arr_i);
|
||||
for (int j=0; j< _arr_i.length; j++) {
|
||||
if (_arr_i_cp[j] != _ir1) {
|
||||
throw new Exception("Interger.reverseBytes failed test_copy_ints_reversed iter " + loop);
|
||||
}
|
||||
}
|
||||
test_copy_ints_store_reversed(_arr_i_cp, _arr_i);
|
||||
for (int j=0; j< _arr_i.length; j++) {
|
||||
if (_arr_i_cp[j] != _ir2) {
|
||||
throw new Exception("Interger.reverseBytes failed test_copy_ints_store_reversed iter " + loop);
|
||||
}
|
||||
}
|
||||
|
||||
test_copy_longs(_arr_l_cp, _arr_l);
|
||||
for (int j=0; j< _arr_i.length; j++) {
|
||||
if (_arr_l_cp[j] != _lr) {
|
||||
throw new Exception("Long.reverseBytes failed test_copy_longs iter " + loop);
|
||||
}
|
||||
}
|
||||
test_copy_longs_reversed(_arr_l_cp, _arr_l);
|
||||
for (int j=0; j< _arr_i.length; j++) {
|
||||
if (_arr_l_cp[j] != _lr1) {
|
||||
throw new Exception("Long.reverseBytes failed test_copy_longs_reversed iter " + loop);
|
||||
}
|
||||
}
|
||||
test_copy_longs_store_reversed(_arr_l_cp, _arr_l);
|
||||
for (int j=0; j< _arr_i.length; j++) {
|
||||
if (_arr_l_cp[j] != _lr2) {
|
||||
throw new Exception("Long.reverseBytes failed test_copy_longs_store_reversed iter " + loop);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
try {
|
||||
Test t = new Test();
|
||||
t.init();
|
||||
t.test();
|
||||
System.out.println("Passed");
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out.println("Failed");
|
||||
}
|
||||
}
|
||||
}
|
88
hotspot/test/compiler/6946040/TestCharShortByteSwap.java
Normal file
88
hotspot/test/compiler/6946040/TestCharShortByteSwap.java
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright 2010 Google, Inc. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||
* have any questions.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6946040
|
||||
* @summary Tests Character/Short.reverseBytes and their intrinsics implementation in the server compiler
|
||||
* @run main/othervm -Xbatch -server -XX:CompileOnly=.testChar,.testShort TestCharShortByteSwap
|
||||
*/
|
||||
|
||||
// This test must run without any command line arguments.
|
||||
|
||||
public class TestCharShortByteSwap {
|
||||
|
||||
private static short initShort(String[] args, short v) {
|
||||
if (args.length > 0) {
|
||||
try {
|
||||
return (short) Integer.valueOf(args[0]).intValue();
|
||||
} catch (NumberFormatException e) { }
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
private static char initChar(String[] args, char v) {
|
||||
if (args.length > 0) {
|
||||
try {
|
||||
return (char) Integer.valueOf(args[0]).intValue();
|
||||
} catch (NumberFormatException e) { }
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
private static void testChar(char a, char b) {
|
||||
if (a != Character.reverseBytes(b)) {
|
||||
throw new RuntimeException("FAIL: " + (int)a + " != Character.reverseBytes(" + (int)b + ")");
|
||||
}
|
||||
if (b != Character.reverseBytes(a)) {
|
||||
throw new RuntimeException("FAIL: " + (int)b + " != Character.reverseBytes(" + (int)a + ")");
|
||||
}
|
||||
}
|
||||
|
||||
private static void testShort(short a, short b) {
|
||||
if (a != Short.reverseBytes(b)) {
|
||||
throw new RuntimeException("FAIL: " + (int)a + " != Short.reverseBytes(" + (int)b + ")");
|
||||
}
|
||||
if (b != Short.reverseBytes(a)) {
|
||||
throw new RuntimeException("FAIL: " + (int)b + " != Short.reverseBytes(" + (int)a + ")");
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
for (int i = 0; i < 100000; ++i) { // Trigger compilation
|
||||
char c1 = initChar(args, (char) 0x0123);
|
||||
char c2 = initChar(args, (char) 0x2301);
|
||||
char c3 = initChar(args, (char) 0xaabb);
|
||||
char c4 = initChar(args, (char) 0xbbaa);
|
||||
short s1 = initShort(args, (short) 0x0123);
|
||||
short s2 = initShort(args, (short) 0x2301);
|
||||
short s3 = initShort(args, (short) 0xaabb);
|
||||
short s4 = initShort(args, (short) 0xbbaa);
|
||||
testChar(c1, c2);
|
||||
testChar(c3, c4);
|
||||
testShort(s1, s2);
|
||||
testShort(s3, s4);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user