From 2fc1837fcc41be01f0f5e7507e23a8ab83a9ab1c Mon Sep 17 00:00:00 2001 From: paltherr Date: Wed, 11 Jun 2003 12:38:13 +0000 Subject: - Removed opcode Box and corresponding boxing c... - Removed opcode Box and corresponding boxing code in Evaluator. --- sources/scala/tools/scalai/Code.java | 5 --- sources/scala/tools/scalai/Evaluator.java | 62 ------------------------------- 2 files changed, 67 deletions(-) (limited to 'sources') diff --git a/sources/scala/tools/scalai/Code.java b/sources/scala/tools/scalai/Code.java index 44ae45d8c3..69d68de2a1 100644 --- a/sources/scala/tools/scalai/Code.java +++ b/sources/scala/tools/scalai/Code.java @@ -26,8 +26,6 @@ public class Code { public case Load(Code target, Variable variable); public case Store(Code target, Variable variable, Code expression); - public case Box(Code value); - public case If(Code cond, Code thenp, Code elsep); public case Or(Code lf, Code rg); public case And(Code lf, Code rg); @@ -84,9 +82,6 @@ public class Code { case Store(Code target, Variable variable, Code expression): return "Store(" + target + "," + variable + "," + expression + ")"; - case Box(Code value): - return "Box(" + value + ")"; - case If(Code cond, Code thenp, Code elsep): return "If(" + cond + "," + thenp + "," + elsep + ")"; diff --git a/sources/scala/tools/scalai/Evaluator.java b/sources/scala/tools/scalai/Evaluator.java index d4fc6577e7..f9f6530af1 100644 --- a/sources/scala/tools/scalai/Evaluator.java +++ b/sources/scala/tools/scalai/Evaluator.java @@ -164,9 +164,6 @@ public class Evaluator { return invoke(null, template.getConstructor(), new Object[] {template.getHandler()}); - case Box(Code value): - return box(evaluate(value)); - case IsScala(Code target, Symbol symbol): Object object = evaluate(target); if (object == null) return Boolean.FALSE; @@ -448,65 +445,6 @@ public class Evaluator { throw trace; } - //######################################################################## - // Private Methods - box - - // !!! - private final Class Boolean_class = Boolean.class; - private final Class Byte_class = Byte.class; - private final Class Short_class = Short.class; - private final Class Character_class = Character.class; - private final Class Integer_class = Integer.class; - private final Class Long_class = Long.class; - private final Class Float_class = Float.class; - private final Class Double_class = Double.class; - - // !!! - private final Class boolean_class = Boolean.TYPE; - private final Class byte_class = Byte.TYPE; - private final Class short_class = Short.TYPE; - private final Class char_class = Character.TYPE; - private final Class int_class = Integer.TYPE; - private final Class long_class = Long.TYPE; - private final Class float_class = Float.TYPE; - private final Class double_class = Double.TYPE; - - private Object box(Object value) { - // !!! check - // !!! System.out.println("!!! box: "); - if (value == null) return null; - Class type = value.getClass(); - if (type == Boolean_class) - return RunTime.box(((Boolean)value).booleanValue()); - if (type == Byte_class) - return RunTime.box(((Byte)value).byteValue()); - if (type == Short_class) - return RunTime.box(((Short)value).shortValue()); - if (type == Character_class) - return RunTime.box(((Character)value).charValue()); - if (type == Integer_class) - return RunTime.box(((Integer)value).intValue()); - if (type == Long_class) - return RunTime.box(((Long)value).longValue()); - if (type == Float_class) - return RunTime.box(((Float)value).floatValue()); - if (type == Double_class) - return RunTime.box(((Double)value).doubleValue()); - if (type.isArray()) { - type = type.getComponentType(); - if (type == boolean_class) return RunTime.box((boolean[])value); - if (type == byte_class) return RunTime.box((byte[])value); - if (type == short_class) return RunTime.box((short[])value); - if (type == char_class) return RunTime.box((char[])value); - if (type == int_class) return RunTime.box((int[])value); - if (type == long_class) return RunTime.box((long[])value); - if (type == float_class) return RunTime.box((float[])value); - if (type == double_class) return RunTime.box((double[])value); - return RunTime.box((Object[])value); - } - return value; - } - //######################################################################## // Private Methods - !!! -- cgit v1.2.3