Mercurial > hg > truffle
diff graal/GraalCompiler/src/com/sun/c1x/ir/Constant.java @ 2709:7b7dbe19fafb
Remove all unresolved cases from HotspotXirGenerator, use more explicit Deopt, Deopt to lastState instead of stateBefore
author | Gilles Duboscq <gilles.duboscq@oracle.com> |
---|---|
date | Thu, 19 May 2011 11:36:41 +0200 |
parents | 4a6518c4d17d |
children | c3f64b66fc78 |
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/Constant.java Wed May 18 11:53:06 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/Constant.java Thu May 19 11:36:41 2011 +0200 @@ -129,6 +129,30 @@ return new Constant(CiConstant.forWord(val), graph); } + public static Constant defaultForKind(CiKind kind, Graph graph) { + switch(kind) { + case Boolean: + return Constant.forBoolean(false, graph); + case Byte: + case Char: + case Short: + case Int: + return Constant.forInt(0, graph); + case Double: + return Constant.forDouble(0.0, graph); + case Float: + return Constant.forFloat(0.0f, graph); + case Long: + return Constant.forLong(0L, graph); + case Object: + return Constant.forObject(null, graph); + case Word: + return Constant.forWord(0L, graph); + default: + return null; + } + } + @Override public String toString() { return super.toString() + "(" + value + ")";