private void emitNewInstanceCallbacks(ClassEmitter ce) { CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC, NEW_INSTANCE, null); Type thisType = getThisType(e); e.load_arg(0); e.invoke_static(thisType, SET_THREAD_CALLBACKS); emitCommonNewInstance(e); }
private void emitNewInstanceCallbacks(ClassEmitter ce) { CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC, NEW_INSTANCE, null); Type thisType = getThisType(e); e.load_arg(0); e.invoke_static(thisType, SET_THREAD_CALLBACKS); emitCommonNewInstance(e); }
private void emitCommonNewInstance(CodeEmitter e) { Type thisType = getThisType(e); e.new_instance(thisType); e.dup(); e.invoke_constructor(thisType); e.aconst_null(); e.invoke_static(thisType, SET_THREAD_CALLBACKS); e.return_value(); e.end_method(); }
private void emitNewInstanceMultiarg(ClassEmitter ce, List constructors) { final CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC, MULTIARG_NEW_INSTANCE, null); final Type thisType = getThisType(e); e.load_arg(2); e.invoke_static(thisType, SET_THREAD_CALLBACKS); e.new_instance(thisType); e.dup(); e.load_arg(0); EmitUtils.constructor_switch(e, constructors, new ObjectSwitchCallback() { public void processCase(Object key, Label end) { MethodInfo constructor = (MethodInfo) key; Type types[] = constructor.getSignature().getArgumentTypes(); for (int i = 0; i < types.length; i++) { e.load_arg(1); e.push(i); e.aaload(); e.unbox(types[i]); } e.invoke_constructor(thisType, constructor.getSignature()); e.goTo(end); } public void processDefault() { e.throw_exception(ILLEGAL_ARGUMENT_EXCEPTION, "Constructor not found"); } }); e.aconst_null(); e.invoke_static(thisType, SET_THREAD_CALLBACKS); e.return_value(); e.end_method(); }
private void emitCommonNewInstance(CodeEmitter e) { Type thisType = getThisType(e); e.new_instance(thisType); e.dup(); e.invoke_constructor(thisType); e.aconst_null(); e.invoke_static(thisType, SET_THREAD_CALLBACKS); e.return_value(); e.end_method(); }
private void emitNewInstanceMultiarg(ClassEmitter ce, List constructors) { final CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC, MULTIARG_NEW_INSTANCE, null); final Type thisType = getThisType(e); e.load_arg(2); e.invoke_static(thisType, SET_THREAD_CALLBACKS); e.new_instance(thisType); e.dup(); e.load_arg(0); EmitUtils.constructor_switch(e, constructors, new ObjectSwitchCallback() { public void processCase(Object key, Label end) { MethodInfo constructor = (MethodInfo) key; Type types[] = constructor.getSignature().getArgumentTypes(); for (int i = 0; i < types.length; i++) { e.load_arg(1); e.push(i); e.aaload(); e.unbox(types[i]); } e.invoke_constructor(thisType, constructor.getSignature()); e.goTo(end); } public void processDefault() { e.throw_exception(ILLEGAL_ARGUMENT_EXCEPTION, "Constructor not found"); } }); e.aconst_null(); e.invoke_static(thisType, SET_THREAD_CALLBACKS); e.return_value(); e.end_method(); }
private void emitNewInstanceCallback(ClassEmitter ce) { CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC, SINGLE_NEW_INSTANCE, null); switch (callbackTypes.length) { case 0: // TODO: make sure Callback is null break; case 1: // for now just make a new array; TODO: optimize e.push(1); e.newarray(CALLBACK); e.dup(); e.push(0); e.load_arg(0); e.aastore(); e.invoke_static(getThisType(e), SET_THREAD_CALLBACKS); break; default: e.throw_exception(ILLEGAL_STATE_EXCEPTION, "More than one callback object required"); } emitCommonNewInstance(e); }
private void emitNewInstanceCallback(ClassEmitter ce) { CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC, SINGLE_NEW_INSTANCE, null); switch (callbackTypes.length) { case 0: // TODO: make sure Callback is null break; case 1: // for now just make a new array; TODO: optimize e.push(1); e.newarray(CALLBACK); e.dup(); e.push(0); e.load_arg(0); e.aastore(); e.invoke_static(getThisType(e), SET_THREAD_CALLBACKS); break; default: e.throw_exception(ILLEGAL_STATE_EXCEPTION, "More than one callback object required"); } emitCommonNewInstance(e); }
private void emitNewInstanceCallbacks(ClassEmitter ce) { CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC, NEW_INSTANCE, null); Type thisType = getThisType(e); e.load_arg(0); e.invoke_static(thisType, SET_THREAD_CALLBACKS); emitCommonNewInstance(e); }
private void emitCommonNewInstance(CodeEmitter e) { Type thisType = getThisType(e); e.new_instance(thisType); e.dup(); e.invoke_constructor(thisType); e.aconst_null(); e.invoke_static(thisType, SET_THREAD_CALLBACKS); e.return_value(); e.end_method(); }
private void emitNewInstanceMultiarg(ClassEmitter ce, List constructors) { final CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC, MULTIARG_NEW_INSTANCE, null); final Type thisType = getThisType(e); e.load_arg(2); e.invoke_static(thisType, SET_THREAD_CALLBACKS); e.new_instance(thisType); e.dup(); e.load_arg(0); EmitUtils.constructor_switch(e, constructors, new ObjectSwitchCallback() { public void processCase(Object key, Label end) { MethodInfo constructor = (MethodInfo) key; Type types[] = constructor.getSignature().getArgumentTypes(); for (int i = 0; i < types.length; i++) { e.load_arg(1); e.push(i); e.aaload(); e.unbox(types[i]); } e.invoke_constructor(thisType, constructor.getSignature()); e.goTo(end); } public void processDefault() { e.throw_exception(ILLEGAL_ARGUMENT_EXCEPTION, "Constructor not found"); } }); e.aconst_null(); e.invoke_static(thisType, SET_THREAD_CALLBACKS); e.return_value(); e.end_method(); }
private void emitNewInstanceCallback(ClassEmitter ce) { CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC, SINGLE_NEW_INSTANCE, null); switch (callbackTypes.length) { case 0: // TODO: make sure Callback is null break; case 1: // for now just make a new array; TODO: optimize e.push(1); e.newarray(CALLBACK); e.dup(); e.push(0); e.load_arg(0); e.aastore(); e.invoke_static(getThisType(e), SET_THREAD_CALLBACKS); break; default: e.throw_exception(ILLEGAL_STATE_EXCEPTION, "More than one callback object required"); } emitCommonNewInstance(e); }