src/share/vm/opto/type.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7119644 Cdiff src/share/vm/opto/type.cpp

src/share/vm/opto/type.cpp

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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. --- 1,7 ---- /* ! * Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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.
*** 58,67 **** --- 58,71 ---- T_VOID, // Half T_NARROWOOP, // NarrowOop T_ILLEGAL, // Tuple T_ARRAY, // Array + T_ILLEGAL, // VectorS + T_ILLEGAL, // VectorD + T_ILLEGAL, // VectorX + T_ILLEGAL, // VectorY T_ADDRESS, // AnyPtr // shows up in factory methods for NULL_PTR T_ADDRESS, // RawPtr T_OBJECT, // OopPtr T_OBJECT, // InstPtr
*** 412,421 **** --- 416,443 ---- _zero_type[T_VOID] = Type::TOP; // the only void value is no value at all // get_zero_type() should not happen for T_CONFLICT _zero_type[T_CONFLICT]= NULL; + // Vector predefined types, it needs initialized _const_basic_type[]. + if (Matcher::vector_size_supported(T_BYTE,4)) { + TypeVect::VECTS = TypeVect::make(T_BYTE,4); + } + if (Matcher::vector_size_supported(T_FLOAT,2)) { + TypeVect::VECTD = TypeVect::make(T_FLOAT,2); + } + if (Matcher::vector_size_supported(T_FLOAT,4)) { + TypeVect::VECTX = TypeVect::make(T_FLOAT,4); + } + if (Matcher::vector_size_supported(T_FLOAT,8)) { + TypeVect::VECTY = TypeVect::make(T_FLOAT,8); + } + mreg2type[Op_VecS] = TypeVect::VECTS; + mreg2type[Op_VecD] = TypeVect::VECTD; + mreg2type[Op_VecX] = TypeVect::VECTX; + mreg2type[Op_VecY] = TypeVect::VECTY; + // Restore working type arena. current->set_type_arena(save); current->set_type_dict(NULL); }
*** 666,675 **** --- 688,701 ---- Half, // Half Bad, // NarrowOop - handled in v-call Bad, // Tuple - handled in v-call Bad, // Array - handled in v-call + Bad, // VectorS - handled in v-call + Bad, // VectorD - handled in v-call + Bad, // VectorX - handled in v-call + Bad, // VectorY - handled in v-call Bad, // AnyPtr - handled in v-call Bad, // RawPtr - handled in v-call Bad, // OopPtr - handled in v-call Bad, // InstPtr - handled in v-call
*** 726,737 **** } //------------------------------data------------------------------------------- const char * const Type::msg[Type::lastype] = { "bad","control","top","int:","long:","half", "narrowoop:", ! "tuple:", "aryptr", ! "anyptr:", "rawptr:", "java:", "inst:", "ary:", "klass:", "func", "abIO", "return_address", "memory", "float_top", "ftcon:", "float", "double_top", "dblcon:", "double", "bottom" }; --- 752,763 ---- } //------------------------------data------------------------------------------- const char * const Type::msg[Type::lastype] = { "bad","control","top","int:","long:","half", "narrowoop:", ! "tuple:", "array:", "vectors:", "vectord:", "vectorx:", "vectory:", ! "anyptr:", "rawptr:", "java:", "inst:", "aryptr:", "klass:", "func", "abIO", "return_address", "memory", "float_top", "ftcon:", "float", "double_top", "dblcon:", "double", "bottom" };
*** 788,798 **** } //------------------------------isa_oop_ptr------------------------------------ // Return true if type is an oop pointer type. False for raw pointers. static char isa_oop_ptr_tbl[Type::lastype] = { ! 0,0,0,0,0,0,0/*narrowoop*/,0/*tuple*/, 0/*ary*/, 0/*anyptr*/,0/*rawptr*/,1/*OopPtr*/,1/*InstPtr*/,1/*AryPtr*/,1/*KlassPtr*/, 0/*func*/,0,0/*return_address*/,0, /*floats*/0,0,0, /*doubles*/0,0,0, 0 }; --- 814,824 ---- } //------------------------------isa_oop_ptr------------------------------------ // Return true if type is an oop pointer type. False for raw pointers. static char isa_oop_ptr_tbl[Type::lastype] = { ! 0,0,0,0,0,0,0/*narrowoop*/,0/*tuple*/, 0/*array*/, 0, 0, 0, 0/*vector*/, 0/*anyptr*/,0/*rawptr*/,1/*OopPtr*/,1/*InstPtr*/,1/*AryPtr*/,1/*KlassPtr*/, 0/*func*/,0,0/*return_address*/,0, /*floats*/0,0,0, /*doubles*/0,0,0, 0 };
*** 1924,1933 **** --- 1950,2074 ---- if (tap) return tap->ary()->ary_must_be_exact(); return false; } + //==============================TypeVect======================================= + // Convenience common pre-built types. + const TypeVect *TypeVect::VECTS = NULL; // 32-bit vectors + const TypeVect *TypeVect::VECTD = NULL; // 64-bit vectors + const TypeVect *TypeVect::VECTX = NULL; // 128-bit vectors + const TypeVect *TypeVect::VECTY = NULL; // 256-bit vectors + + //------------------------------make------------------------------------------- + const TypeVect* TypeVect::make(const Type *elem, uint length) { + BasicType elem_bt = elem->array_element_basic_type(); + assert(is_java_primitive(elem_bt), "only primitive types in vector"); + assert(length > 1 && is_power_of_2(length), "vector length is power of 2"); + assert(Matcher::vector_size_supported(elem_bt, length), "length in range"); + int size = length * type2aelembytes(elem_bt); + switch (Matcher::vector_ideal_reg(size)) { + case Op_VecS: + return (TypeVect*)(new TypeVectS(elem, length))->hashcons(); + case Op_VecD: + case Op_RegD: + return (TypeVect*)(new TypeVectD(elem, length))->hashcons(); + case Op_VecX: + return (TypeVect*)(new TypeVectX(elem, length))->hashcons(); + case Op_VecY: + return (TypeVect*)(new TypeVectY(elem, length))->hashcons(); + } + ShouldNotReachHere(); + return NULL; + } + + //------------------------------meet------------------------------------------- + // Compute the MEET of two types. It returns a new Type object. + const Type *TypeVect::xmeet( const Type *t ) const { + // Perform a fast test for common case; meeting the same types together. + if( this == t ) return this; // Meeting same type-rep? + + // Current "this->_base" is Vector + switch (t->base()) { // switch on original type + + case Bottom: // Ye Olde Default + return t; + + default: // All else is a mistake + typerr(t); + + case VectorS: + case VectorD: + case VectorX: + case VectorY: { // Meeting 2 vectors? + const TypeVect* v = t->is_vect(); + assert( base() == v->base(), ""); + assert(length() == v->length(), ""); + assert(element_basic_type() == v->element_basic_type(), ""); + return TypeVect::make(_elem->xmeet(v->_elem), _length); + } + case Top: + break; + } + return this; + } + + //------------------------------xdual------------------------------------------ + // Dual: compute field-by-field dual + const Type *TypeVect::xdual() const { + return new TypeVect(base(), _elem->dual(), _length); + } + + //------------------------------eq--------------------------------------------- + // Structural equality check for Type representations + bool TypeVect::eq(const Type *t) const { + const TypeVect *v = t->is_vect(); + return (_elem == v->_elem) && (_length == v->_length); + } + + //------------------------------hash------------------------------------------- + // Type-specific hashing function. + int TypeVect::hash(void) const { + return (intptr_t)_elem + (intptr_t)_length; + } + + //------------------------------singleton-------------------------------------- + // TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple + // constants (Ldi nodes). Vector is singleton if all elements are the same + // constant value (when vector is created with Replicate code). + bool TypeVect::singleton(void) const { + // There is no Con node for vectors yet. + // return _elem->singleton(); + return false; + } + + bool TypeVect::empty(void) const { + return _elem->empty(); + } + + //------------------------------dump2------------------------------------------ + #ifndef PRODUCT + void TypeVect::dump2(Dict &d, uint depth, outputStream *st) const { + switch (base()) { + case VectorS: + st->print("vectors["); break; + case VectorD: + st->print("vectord["); break; + case VectorX: + st->print("vectorx["); break; + case VectorY: + st->print("vectory["); break; + default: + ShouldNotReachHere(); + } + st->print("%d]:{", _length); + _elem->dump2(d, depth, st); + st->print("}"); + } + #endif + + //============================================================================= // Convenience common pre-built types. const TypePtr *TypePtr::NULL_PTR; const TypePtr *TypePtr::NOTNULL; const TypePtr *TypePtr::BOTTOM;
*** 4138,4148 **** //------------------------------print_flattened-------------------------------- // Print a 'flattened' signature static const char * const flat_type_msg[Type::lastype] = { "bad","control","top","int","long","_", "narrowoop", ! "tuple:", "array:", "ptr", "rawptr", "ptr", "ptr", "ptr", "ptr", "func", "abIO", "return_address", "mem", "float_top", "ftcon:", "flt", "double_top", "dblcon:", "dbl", "bottom" --- 4279,4289 ---- //------------------------------print_flattened-------------------------------- // Print a 'flattened' signature static const char * const flat_type_msg[Type::lastype] = { "bad","control","top","int","long","_", "narrowoop", ! "tuple:", "array:", "vectors:", "vectord:", "vectorx:", "vectory:", "ptr", "rawptr", "ptr", "ptr", "ptr", "ptr", "func", "abIO", "return_address", "mem", "float_top", "ftcon:", "flt", "double_top", "dblcon:", "dbl", "bottom"
src/share/vm/opto/type.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File