MCPcopy Index your code
hub / github.com/clojure/clojure / emitUnboxArg

Method emitUnboxArg

src/jvm/clojure/lang/Compiler.java:896–959  ·  view source on GitHub ↗
(ObjExpr objx, GeneratorAdapter gen, Class paramType)

Source from the content-addressed store, hash-verified

894
895 //*/
896 public static void emitUnboxArg(ObjExpr objx, GeneratorAdapter gen, Class paramType){
897 if(paramType.isPrimitive())
898 {
899 if(paramType == boolean.class)
900 {
901 gen.checkCast(BOOLEAN_TYPE);
902 gen.invokeVirtual(BOOLEAN_TYPE, booleanValueMethod);
903// Label falseLabel = gen.newLabel();
904// Label endLabel = gen.newLabel();
905// gen.ifNull(falseLabel);
906// gen.push(1);
907// gen.goTo(endLabel);
908// gen.mark(falseLabel);
909// gen.push(0);
910// gen.mark(endLabel);
911 }
912 else if(paramType == char.class)
913 {
914 gen.checkCast(CHAR_TYPE);
915 gen.invokeVirtual(CHAR_TYPE, charValueMethod);
916 }
917 else
918 {
919// System.out.println("NOT fnexpr for defn var: " + var + "init: " + init.getClass());
920 Method m = null;
921 gen.checkCast(NUMBER_TYPE);
922 if(RT.booleanCast(RT.UNCHECKED_MATH.deref()))
923 {
924 if(paramType == int.class)
925 m = Method.getMethod("int uncheckedIntCast(Object)");
926 else if(paramType == float.class)
927 m = Method.getMethod("float uncheckedFloatCast(Object)");
928 else if(paramType == double.class)
929 m = Method.getMethod("double uncheckedDoubleCast(Object)");
930 else if(paramType == long.class)
931 m = Method.getMethod("long uncheckedLongCast(Object)");
932 else if(paramType == byte.class)
933 m = Method.getMethod("byte uncheckedByteCast(Object)");
934 else if(paramType == short.class)
935 m = Method.getMethod("short uncheckedShortCast(Object)");
936 }
937 else
938 {
939 if(paramType == int.class)
940 m = Method.getMethod("int intCast(Object)");
941 else if(paramType == float.class)
942 m = Method.getMethod("float floatCast(Object)");
943 else if(paramType == double.class)
944 m = Method.getMethod("double doubleCast(Object)");
945 else if(paramType == long.class)
946 m = Method.getMethod("long longCast(Object)");
947 else if(paramType == byte.class)
948 m = Method.getMethod("byte byteCast(Object)");
949 else if(paramType == short.class)
950 m = Method.getMethod("short shortCast(Object)");
951 }
952 gen.invokeStatic(RT_TYPE, m);
953 }

Callers 6

emitAssignMethod · 0.95
emitAssignMethod · 0.95
emitTypedArgsMethod · 0.95
emitUnboxedMethod · 0.95
doEmitStaticMethod · 0.95
doEmitPrimMethod · 0.95

Calls 8

booleanCastMethod · 0.95
getMethodMethod · 0.95
getTypeMethod · 0.95
isPrimitiveMethod · 0.80
checkCastMethod · 0.80
invokeVirtualMethod · 0.80
derefMethod · 0.65
invokeStaticMethod · 0.45

Tested by

no test coverage detected