internal static void OnStart(GlobalRef interopProc, IBinaryStream stream) { try { // 1. Read data and leave critical state ASAP. BinaryReader reader = BinaryUtils.Marshaller.StartUnmarshal(stream); // ReSharper disable once PossibleInvalidOperationException var name = reader.ReadString(); // 2. Set ID and name so that Start() method can use them later. _startup.Name = name; if (Nodes.ContainsKey(new NodeKey(name))) { throw new IgniteException("Ignite with the same name already started: " + name); } _startup.Ignite = new Ignite(_startup.Configuration, _startup.Name, new PlatformJniTarget(interopProc, _startup.Marshaller), _startup.Marshaller, _startup.LifecycleHandlers, _startup.Callbacks); } catch (Exception e) { // 5. Preserve exception to throw it later in the "Start" method and throw it further // to abort startup in Java. _startup.Error = e; throw; } }
static HasherProxy() { JniEnvWrapper env = JvmManager.INSTANCE.GetEnv(); classRef = env.FindClass("ru/gnkoshelev/j4net/sample/hash/lib/Hasher"); methodRef = env.GetStaticMethodId(classRef.Ptr, "compute", "(Ljava/lang/String;[B)Ljava/lang/String;"); }
/// <summary> /// Constructor. /// </summary> /// <param name="target">Target.</param> /// <param name="marsh">Marshaller.</param> public PlatformJniTarget(GlobalRef target, Marshaller marsh) { Debug.Assert(target != null); Debug.Assert(marsh != null); _target = target; _marsh = marsh; }
internal static GlobalRef TargetOutObject(GlobalRef target, int opType) { var jvm = target.Jvm; long opType0 = opType; return(jvm.AttachCurrentThread().CallObjectMethod( target, jvm.MethodId.TargetOutObject, &opType0)); }
internal static void TargetInStreamAsync(GlobalRef target, int opType, long memPtr) { var jvm = target.Jvm; long *args = stackalloc long[4]; args[0] = opType; args[1] = memPtr; jvm.AttachCurrentThread().CallVoidMethod(target, jvm.MethodId.TargetInStreamAsync, args); }
void Start() { if (!GlobalRef.Init()) { return; } CreateCommonUI(); StartCoroutine(GlobalRef.AssetMgr.GetAB(AppConst.AB_MAIN, CreateMainUI)); }
internal static long TargetInStreamOutLong(GlobalRef target, int opType, long memPtr) { var jvm = target.Jvm; long *args = stackalloc long[2]; args[0] = opType; args[1] = memPtr; return(jvm.AttachCurrentThread().CallLongMethod(target, jvm.MethodId.TargetInStreamOutLong, args)); }
internal static GlobalRef TargetInStreamOutObjectAsync(GlobalRef target, int opType, long memPtr) { var jvm = target.Jvm; long *args = stackalloc long[4]; args[0] = opType; args[1] = memPtr; return(jvm.AttachCurrentThread().CallObjectMethod( target, jvm.MethodId.TargetInStreamOutObjectAsync, args)); }
void Start() { AppConst.PrintPath(); if (!GlobalRef.Init()) { Utility.LogError("Globalref init failed"); return; } StartCoroutine(GlobalRef.AssetMgr.GetAB(AppConst.AB_COMMON, CreateCommonUI)); }
void Start() { if (!GlobalRef.Init()) { return; } CreateCommonUI(); // string[] abList = new string[]{"sprite_battle", AppConst.AB_BATTLE }; string[] abList = { "sprite_battle", AppConst.AB_BATTLE }; StartCoroutine(GlobalRef.AssetMgr.GetABList(abList, CreateBattleUI)); }
internal static void TargetInStreamOutStream(GlobalRef target, int opType, long inMemPtr, long outMemPtr) { var jvm = target.Jvm; long *args = stackalloc long[3]; args[0] = opType; args[1] = inMemPtr; args[2] = outMemPtr; jvm.AttachCurrentThread().CallVoidMethod(target, jvm.MethodId.TargetInStreamOutStream, args); }
internal static GlobalRef TargetInObjectStreamOutObjectStream(GlobalRef target, int opType, GlobalRef arg, long inMemPtr, long outMemPtr) { var jvm = target.Jvm; long *args = stackalloc long[4]; args[0] = opType; args[1] = (long)arg.Target; args[2] = inMemPtr; args[3] = outMemPtr; return(jvm.AttachCurrentThread().CallObjectMethod( target, jvm.MethodId.TargetInObjectStreamOutObjectStream, args)); }
/*public static RoleInfo s_ri = new RoleInfo(); */ void Start() { GameObject NetLogic = GameObject.Find("NetLogic"); if (NetLogic) { s_gr = NetLogic.GetComponent <GlobalRef>(); //Object.DontDestroyOnLoad(NetLogic); } else { Debug.Log("There is no NetLogic object, please check!"); Application.Quit(); } //InitRoleData(); }
// Statement visitors. public void Visit(Assign s) { if (s.Target is GlobalRef) { // Assign to global. GlobalRef global = (GlobalRef)s.Target; int constant = function.Constant(global.Name); Allocation value = R(s.Value); function.InstructionABx(s.SourceSpan, Opcode.SetGlobal, value, constant); value.Release(); } else if (s.Target is Index) { // Assign to table index. Index index = (Index)s.Target; Allocation table = R(index.Table); Allocation key = RK(index.Key); Allocation value = RK(s.Value); function.InstructionABC(s.SourceSpan, Opcode.SetTable, table, key, value); value.Release(); key.Release(); table.Release(); } else if (s.Target is LocalRef) { // Assign to local. LocalRef local = (LocalRef)s.Target; Allocation target = function.Local(local.Variable); Move(target, s.Value); target.Release(); } else if (s.Target is UpValRef) { // Assign to upval. UpValRef upval = (UpValRef)s.Target; int index = function.UpVal(upval.Variable); Allocation value = R(s.Value); function.InstructionABC(s.SourceSpan, Opcode.SetUpVal, value, index, 0); value.Release(); } else { throw new InvalidOperationException(); } }
public Sample(int x, int y, string str) { using (var strUtf = Env.NewStringUtf(str)) { jObject = Env.NewObject(ClassPtr.Ptr, Constructor.Ptr, new JValue { IntegerValue = x }, new JValue { IntegerValue = y }, new JValue { PointerValue = strUtf.Ptr } ); HandleException(); } }
public void Visit(GlobalRef e) { o.Write(e.Name); }
public void Visit(GlobalRef e) { function.InstructionABx(e.SourceSpan, Opcode.GetGlobal, target, function.Constant(e.Name)); }
public void Visit(AssignList s) { // Evaluate subexpressions for index targets. Allocation allocTargets = function.Top(); Expression[] targets = new Expression[s.Targets.Count]; for (int target = 0; target < s.Targets.Count; ++target) { Expression e = s.Targets[target]; Index index = e as Index; if (index != null) { Allocation table = R(index.Table); Allocation key = RK(index.Key); targets[target] = new IndexRef(index.SourceSpan, table, key); key.Release(); table.Release(); allocTargets.Allocate(2); } else { targets[target] = e; } } // Evaluate all values. Allocation allocValues = function.Top(); for (int value = 0; value < s.Values.Count; ++value) { Allocation allocValue = Push(s.Values[value]); allocValue.Release(); allocValues.Allocate(); } if (s.ValueList != null) { if (s.Targets.Count <= s.Values.Count) { throw new ArgumentException(); } Allocation allocValueList = PushList(s.ValueList, s.Targets.Count - s.Values.Count); allocValueList.Release(); allocValues.Allocate(s.Targets.Count - s.Values.Count); } // Assign each value. for (int target = 0; target < targets.Length; ++target) { if (targets[target] is GlobalRef) { GlobalRef global = (GlobalRef)targets[target]; function.InstructionABx(s.SourceSpan, Opcode.SetGlobal, allocValues + target, function.Constant(global.Name)); } else if (targets[target] is IndexRef) { IndexRef index = (IndexRef)targets[target]; function.InstructionABC(s.SourceSpan, Opcode.SetTable, index.Table, index.Key, allocValues + target); } else if (targets[target] is LocalRef) { LocalRef local = (LocalRef)targets[target]; function.InstructionABC(s.SourceSpan, Opcode.Move, function.Local(local.Variable), allocValues + target, 0); } else if (targets[target] is UpValRef) { UpValRef upval = (UpValRef)targets[target]; function.InstructionABC(s.SourceSpan, Opcode.SetUpVal, allocValues + target, function.UpVal(upval.Variable), 0); } else { throw new InvalidOperationException(); } } // Release. allocValues.Release(); allocTargets.Release(); }
public Sample(GlobalRef jObject) { this.jObject = jObject; }
/// <summary> /// Gets the platform target. /// </summary> private IPlatformTargetInternal GetPlatformTarget(GlobalRef target) { return(target == null ? null : new PlatformJniTarget(target, _marsh)); }
public virtual void Visit(GlobalRef e) { result = e; }