1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/c1/c1_Canonicalizer.hpp Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,117 @@ 1.4 +/* 1.5 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +#ifndef SHARE_VM_C1_C1_CANONICALIZER_HPP 1.29 +#define SHARE_VM_C1_C1_CANONICALIZER_HPP 1.30 + 1.31 +#include "c1/c1_Instruction.hpp" 1.32 + 1.33 +class Canonicalizer: InstructionVisitor { 1.34 + private: 1.35 + Compilation *_compilation; 1.36 + Instruction* _canonical; 1.37 + int _bci; 1.38 + 1.39 + Compilation *compilation() { return _compilation; } 1.40 + void set_canonical(Value x); 1.41 + void set_bci(int bci) { _bci = bci; } 1.42 + void set_constant(jint x) { set_canonical(new Constant(new IntConstant(x))); } 1.43 + void set_constant(jlong x) { set_canonical(new Constant(new LongConstant(x))); } 1.44 + void set_constant(jfloat x) { set_canonical(new Constant(new FloatConstant(x))); } 1.45 + void set_constant(jdouble x) { set_canonical(new Constant(new DoubleConstant(x))); } 1.46 + void move_const_to_right(Op2* x); 1.47 + void do_Op2(Op2* x); 1.48 + void do_UnsafeRawOp(UnsafeRawOp* x); 1.49 + 1.50 + void unsafe_raw_match(UnsafeRawOp* x, 1.51 + Instruction** base, 1.52 + Instruction** index, 1.53 + int* scale); 1.54 + 1.55 + public: 1.56 + Canonicalizer(Compilation* c, Value x, int bci) : _compilation(c), _canonical(x), _bci(bci) { 1.57 + NOT_PRODUCT(x->set_printable_bci(bci)); 1.58 + if (CanonicalizeNodes) x->visit(this); 1.59 + } 1.60 + Value canonical() const { return _canonical; } 1.61 + int bci() const { return _bci; } 1.62 + 1.63 + virtual void do_Phi (Phi* x); 1.64 + virtual void do_Constant (Constant* x); 1.65 + virtual void do_Local (Local* x); 1.66 + virtual void do_LoadField (LoadField* x); 1.67 + virtual void do_StoreField (StoreField* x); 1.68 + virtual void do_ArrayLength (ArrayLength* x); 1.69 + virtual void do_LoadIndexed (LoadIndexed* x); 1.70 + virtual void do_StoreIndexed (StoreIndexed* x); 1.71 + virtual void do_NegateOp (NegateOp* x); 1.72 + virtual void do_ArithmeticOp (ArithmeticOp* x); 1.73 + virtual void do_ShiftOp (ShiftOp* x); 1.74 + virtual void do_LogicOp (LogicOp* x); 1.75 + virtual void do_CompareOp (CompareOp* x); 1.76 + virtual void do_IfOp (IfOp* x); 1.77 + virtual void do_IfInstanceOf (IfInstanceOf* x); 1.78 + virtual void do_Convert (Convert* x); 1.79 + virtual void do_NullCheck (NullCheck* x); 1.80 + virtual void do_TypeCast (TypeCast* x); 1.81 + virtual void do_Invoke (Invoke* x); 1.82 + virtual void do_NewInstance (NewInstance* x); 1.83 + virtual void do_NewTypeArray (NewTypeArray* x); 1.84 + virtual void do_NewObjectArray (NewObjectArray* x); 1.85 + virtual void do_NewMultiArray (NewMultiArray* x); 1.86 + virtual void do_CheckCast (CheckCast* x); 1.87 + virtual void do_InstanceOf (InstanceOf* x); 1.88 + virtual void do_MonitorEnter (MonitorEnter* x); 1.89 + virtual void do_MonitorExit (MonitorExit* x); 1.90 + virtual void do_Intrinsic (Intrinsic* x); 1.91 + virtual void do_BlockBegin (BlockBegin* x); 1.92 + virtual void do_Goto (Goto* x); 1.93 + virtual void do_If (If* x); 1.94 + virtual void do_TableSwitch (TableSwitch* x); 1.95 + virtual void do_LookupSwitch (LookupSwitch* x); 1.96 + virtual void do_Return (Return* x); 1.97 + virtual void do_Throw (Throw* x); 1.98 + virtual void do_Base (Base* x); 1.99 + virtual void do_OsrEntry (OsrEntry* x); 1.100 + virtual void do_ExceptionObject(ExceptionObject* x); 1.101 + virtual void do_RoundFP (RoundFP* x); 1.102 + virtual void do_UnsafeGetRaw (UnsafeGetRaw* x); 1.103 + virtual void do_UnsafePutRaw (UnsafePutRaw* x); 1.104 + virtual void do_UnsafeGetObject(UnsafeGetObject* x); 1.105 + virtual void do_UnsafePutObject(UnsafePutObject* x); 1.106 + virtual void do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x); 1.107 + virtual void do_UnsafePrefetchRead (UnsafePrefetchRead* x); 1.108 + virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x); 1.109 + virtual void do_ProfileCall (ProfileCall* x); 1.110 + virtual void do_ProfileReturnType (ProfileReturnType* x); 1.111 + virtual void do_ProfileInvoke (ProfileInvoke* x); 1.112 + virtual void do_RuntimeCall (RuntimeCall* x); 1.113 + virtual void do_MemBar (MemBar* x); 1.114 + virtual void do_RangeCheckPredicate(RangeCheckPredicate* x); 1.115 +#ifdef ASSERT 1.116 + virtual void do_Assert (Assert* x); 1.117 +#endif 1.118 +}; 1.119 + 1.120 +#endif // SHARE_VM_C1_C1_CANONICALIZER_HPP