mv.visitMaxs(20, scratch_reg + 3);
// mark this function to be called "on load"
if (funInfo.call_on_load) {
AnnotationVisitor an = mv.visitAnnotation(
ONLOAD_ANN_TYPE.getDescriptor(), true);
an.visitEnd();
}
mv.visitEnd();
int arity_plus = arity;
Lambda lambda = get_lambda_freevars(fun_name, arity_plus);
final int freevars = lambda == null ? 0 : lambda.freevars;
int real_arity = arity_plus - freevars;
String mname = EUtil.getJavaName(fun_name, real_arity);
String outer_name = self_type.getInternalName();
String inner_name = "FN_" + mname;
String full_inner_name = outer_name + "$" + inner_name;
boolean make_fun = false;
boolean is_exported = isExported(fun_name, arity);
if (lambda != null) {
CompilerVisitor.this.module_md5 = lambda.uniq;
make_fun = true;
} else {
String fun_type;
if (uses_on_load) {
fun_type = EFUN_NAME + arity;
} else {
fun_type = full_inner_name;
}
if (!Boolean.getBoolean("erjang.inline_calls")
&& funInfo.is_called_locally_in_nontail_position)
generate_invoke_call_self();
if (funInfo.is_called_locally_in_tail_position)
generate_tail_call_self(fun_type);
if (funInfo.mustHaveFun() || uses_on_load) {
FieldVisitor fv = cv.visitField(ACC_STATIC | (uses_on_load ? 0 : ACC_FINAL),
mname, "L" + fun_type + ";", null, null);
EFunCG.ensure(arity);
if (is_exported) {
if (ModuleAnalyzer.log.isLoggable(Level.FINE))
ModuleAnalyzer.log.fine("export " + module_name
+ ":" + fun_name + "/" + arity);
AnnotationVisitor an = fv.visitAnnotation(
EXPORT_ANN_TYPE.getDescriptor(), true);
an.visit("module", module_name.getName());
an.visit("fun", fun_name.getName());
an.visit("arity", new Integer(arity));
an.visitEnd();
} else if (uses_on_load) {
AnnotationVisitor an = fv.visitAnnotation(
INTERNAL_ANN_TYPE.getDescriptor(), true);
an.visit("module", module_name.getName());
an.visit("fun", fun_name.getName());
an.visit("arity", new Integer(arity));
an.visitEnd();
}
fv.visitEnd();
funs.put(mname, full_inner_name);