org.springframework.cglib.core.Local Java Examples

The following examples show how to use org.springframework.cglib.core.Local. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: spring-analysis-note   Author: Vip-Augus   File: Enhancer.java    License: MIT License 4 votes vote down vote up
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();
}
 
Example #2
Source Project: java-technology-stack   Author: codeEngraver   File: Enhancer.java    License: MIT License 4 votes vote down vote up
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();
}