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

Method doEmit

src/jvm/clojure/lang/Compiler.java:7058–7120  ·  view source on GitHub ↗
(C context, ObjExpr objx, GeneratorAdapter gen, boolean emitUnboxed)

Source from the content-addressed store, hash-verified

7056
7057
7058 public void doEmit(C context, ObjExpr objx, GeneratorAdapter gen, boolean emitUnboxed){
7059 HashMap<BindingInit, Label> bindingLabels = new HashMap();
7060 for(int i = 0; i < bindingInits.count(); i++)
7061 {
7062 BindingInit bi = (BindingInit) bindingInits.nth(i);
7063 Class primc = maybePrimitiveType(bi.init);
7064 if(primc != null)
7065 {
7066 ((MaybePrimitiveExpr) bi.init).emitUnboxed(C.EXPRESSION, objx, gen);
7067 gen.visitVarInsn(Type.getType(primc).getOpcode(Opcodes.ISTORE), bi.binding.idx);
7068 }
7069 else
7070 {
7071 Class bindingClass = HostExpr.maybeClass(bi.binding.tag, true);
7072 if(!FISupport.maybeEmitFIAdapter(objx, gen, bi.init, bindingClass))
7073 bi.init.emit(C.EXPRESSION, objx, gen);
7074
7075 if (!bi.binding.used && bi.binding.canBeCleared)
7076 gen.pop();
7077 else
7078 gen.visitVarInsn(OBJECT_TYPE.getOpcode(Opcodes.ISTORE), bi.binding.idx);
7079 }
7080 bindingLabels.put(bi, gen.mark());
7081 }
7082 Label loopLabel = gen.mark();
7083 if(isLoop)
7084 {
7085 try
7086 {
7087 Var.pushThreadBindings(RT.map(LOOP_LABEL, loopLabel));
7088 if(emitUnboxed)
7089 ((MaybePrimitiveExpr)body).emitUnboxed(context, objx, gen);
7090 else
7091 body.emit(context, objx, gen);
7092 }
7093 finally
7094 {
7095 Var.popThreadBindings();
7096 }
7097 }
7098 else
7099 {
7100 if(emitUnboxed)
7101 ((MaybePrimitiveExpr)body).emitUnboxed(context, objx, gen);
7102 else
7103 body.emit(context, objx, gen);
7104 }
7105 Label end = gen.mark();
7106// gen.visitLocalVariable("this", "Ljava/lang/Object;", null, loopLabel, end, 0);
7107 for(ISeq bis = bindingInits.seq(); bis != null; bis = bis.next())
7108 {
7109 BindingInit bi = (BindingInit) bis.first();
7110 String lname = bi.binding.name;
7111 if(lname.endsWith("__auto__"))
7112 lname += RT.nextID();
7113 Class primc = maybePrimitiveType(bi.init);
7114 if(primc != null)
7115 gen.visitLocalVariable(lname, Type.getDescriptor(primc), null, bindingLabels.get(bi), end,

Callers 2

emitMethod · 0.95
emitUnboxedMethod · 0.95

Calls 15

getTypeMethod · 0.95
maybeClassMethod · 0.95
maybeEmitFIAdapterMethod · 0.95
pushThreadBindingsMethod · 0.95
mapMethod · 0.95
popThreadBindingsMethod · 0.95
nextMethod · 0.95
firstMethod · 0.95
nextIDMethod · 0.95
getDescriptorMethod · 0.95
maybePrimitiveTypeMethod · 0.80
getOpcodeMethod · 0.80

Tested by

no test coverage detected