Search in sources :

Example 1 with Local

use of org.springframework.cglib.core.Local in project spring-framework by spring-projects.

the class Enhancer method emitBindCallbacks.

private void emitBindCallbacks(ClassEmitter ce) {
    CodeEmitter e = ce.begin_method(Constants.PRIVATE_FINAL_STATIC, BIND_CALLBACKS, null);
    Local me = e.make_local();
    e.load_arg(0);
    e.checkcast_this();
    e.store_local(me);
    Label end = e.make_label();
    e.load_local(me);
    e.getfield(BOUND_FIELD);
    e.if_jump(CodeEmitter.NE, end);
    e.load_local(me);
    e.push(1);
    e.putfield(BOUND_FIELD);
    e.getfield(THREAD_CALLBACKS_FIELD);
    e.invoke_virtual(THREAD_LOCAL, THREAD_LOCAL_GET);
    e.dup();
    Label found_callback = e.make_label();
    e.ifnonnull(found_callback);
    e.pop();
    e.getfield(STATIC_CALLBACKS_FIELD);
    e.dup();
    e.ifnonnull(found_callback);
    e.pop();
    e.goTo(end);
    e.mark(found_callback);
    e.checkcast(CALLBACK_ARRAY);
    e.load_local(me);
    e.swap();
    for (int i = callbackTypes.length - 1; i >= 0; i--) {
        if (i != 0) {
            e.dup2();
        }
        e.aaload(i);
        e.checkcast(callbackTypes[i]);
        e.putfield(getCallbackField(i));
    }
    e.mark(end);
    e.return_value();
    e.end_method();
}
Also used : CodeEmitter(org.springframework.cglib.core.CodeEmitter) Label(org.springframework.asm.Label) Local(org.springframework.cglib.core.Local)

Aggregations

Label (org.springframework.asm.Label)1 CodeEmitter (org.springframework.cglib.core.CodeEmitter)1 Local (org.springframework.cglib.core.Local)1