1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. 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. |
1049 |
1049 |
1050 //============================================================================= |
1050 //============================================================================= |
1051 //------------------------------Value------------------------------------------ |
1051 //------------------------------Value------------------------------------------ |
1052 const Type *CastX2PNode::Value( PhaseTransform *phase ) const { |
1052 const Type *CastX2PNode::Value( PhaseTransform *phase ) const { |
1053 const Type* t = phase->type(in(1)); |
1053 const Type* t = phase->type(in(1)); |
|
1054 if (t == Type::TOP) return Type::TOP; |
1054 if (t->base() == Type_X && t->singleton()) { |
1055 if (t->base() == Type_X && t->singleton()) { |
1055 uintptr_t bits = (uintptr_t) t->is_intptr_t()->get_con(); |
1056 uintptr_t bits = (uintptr_t) t->is_intptr_t()->get_con(); |
1056 if (bits == 0) return TypePtr::NULL_PTR; |
1057 if (bits == 0) return TypePtr::NULL_PTR; |
1057 return TypeRawPtr::make((address) bits); |
1058 return TypeRawPtr::make((address) bits); |
1058 } |
1059 } |
1119 |
1120 |
1120 //============================================================================= |
1121 //============================================================================= |
1121 //------------------------------Value------------------------------------------ |
1122 //------------------------------Value------------------------------------------ |
1122 const Type *CastP2XNode::Value( PhaseTransform *phase ) const { |
1123 const Type *CastP2XNode::Value( PhaseTransform *phase ) const { |
1123 const Type* t = phase->type(in(1)); |
1124 const Type* t = phase->type(in(1)); |
|
1125 if (t == Type::TOP) return Type::TOP; |
1124 if (t->base() == Type::RawPtr && t->singleton()) { |
1126 if (t->base() == Type::RawPtr && t->singleton()) { |
1125 uintptr_t bits = (uintptr_t) t->is_rawptr()->get_con(); |
1127 uintptr_t bits = (uintptr_t) t->is_rawptr()->get_con(); |
1126 return TypeX::make(bits); |
1128 return TypeX::make(bits); |
1127 } |
1129 } |
1128 return CastP2XNode::bottom_type(); |
1130 return CastP2XNode::bottom_type(); |