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

Method emitBoxReturn

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

Source from the content-addressed store, hash-verified

843
844 //*
845 public static void emitBoxReturn(ObjExpr objx, GeneratorAdapter gen, Class returnType){
846 if(returnType.isPrimitive())
847 {
848 if(returnType == boolean.class)
849 {
850 Label falseLabel = gen.newLabel();
851 Label endLabel = gen.newLabel();
852 gen.ifZCmp(GeneratorAdapter.EQ, falseLabel);
853 gen.getStatic(BOOLEAN_OBJECT_TYPE, "TRUE", BOOLEAN_OBJECT_TYPE);
854 gen.goTo(endLabel);
855 gen.mark(falseLabel);
856 gen.getStatic(BOOLEAN_OBJECT_TYPE, "FALSE", BOOLEAN_OBJECT_TYPE);
857// NIL_EXPR.emit(C.EXPRESSION, fn, gen);
858 gen.mark(endLabel);
859 }
860 else if(returnType == void.class)
861 {
862 NIL_EXPR.emit(C.EXPRESSION, objx, gen);
863 }
864 else if(returnType == char.class)
865 {
866 gen.invokeStatic(CHAR_TYPE, charValueOfMethod);
867 }
868 else
869 {
870 if(returnType == int.class)
871 {
872 gen.invokeStatic(INTEGER_TYPE, intValueOfMethod);
873// gen.visitInsn(I2L);
874// gen.invokeStatic(NUMBERS_TYPE, Method.getMethod("Number num(long)"));
875 }
876 else if(returnType == float.class)
877 {
878 gen.invokeStatic(FLOAT_TYPE, floatValueOfMethod);
879
880// gen.visitInsn(F2D);
881// gen.invokeStatic(DOUBLE_TYPE, doubleValueOfMethod);
882 }
883 else if(returnType == double.class)
884 gen.invokeStatic(DOUBLE_TYPE, doubleValueOfMethod);
885 else if(returnType == long.class)
886 gen.invokeStatic(NUMBERS_TYPE, Method.getMethod("Number num(long)"));
887 else if(returnType == byte.class)
888 gen.invokeStatic(BYTE_TYPE, byteValueOfMethod);
889 else if(returnType == short.class)
890 gen.invokeStatic(SHORT_TYPE, shortValueOfMethod);
891 }
892 }
893 }
894
895 //*/
896 public static void emitUnboxArg(ObjExpr objx, GeneratorAdapter gen, Class paramType){

Callers 8

emitMethod · 0.95
emitMethod · 0.95
emitMethod · 0.95
emitMethod · 0.95
emitMethod · 0.95
emitMethod · 0.95
emitProtoMethod · 0.95
emitLocalMethod · 0.95

Calls 9

getMethodMethod · 0.95
isPrimitiveMethod · 0.80
newLabelMethod · 0.80
ifZCmpMethod · 0.80
getStaticMethod · 0.80
goToMethod · 0.80
markMethod · 0.80
emitMethod · 0.65
invokeStaticMethod · 0.45

Tested by

no test coverage detected