Package alt.jiapi.reflect

Examples of alt.jiapi.reflect.InstructionFactory.pushConstant()


            }

            il.add(factory.getField(field));

            if (Modifier.isStatic(currentMethodModifiers)) {
                il.add(factory.pushConstant(clazz.getName()));
            }
            else {
                il.add(factory.pushThis()); // First argument is 'this'
            }
        }
View Full Code Here


            log.debug("Hook is static");
            // On static methods, First argument is name of the current class.
            // This should be Class object.
            // Runtime.forName(clazz.getName())
            // factory.forName(clazz.getName())
            il.add(factory.pushConstant(clazz.getName()));
        }

        // Skip first param (source object made above)
        for (int i = 1; i < hookParams.length; i++) {
            if (hookParams[i].equals(String.class)) {
View Full Code Here

                String targetName = instrumentation.getTargetName();
                if (targetName == null) {
                    targetName = "???";
                }

                il.add(factory.pushConstant(targetName));
            }
            else if (hookParams[i].equals(Object.class)) {
                // ---  target Object  ---
                InstructionList targetCode = instrumentation.getTargetCode();
                if (targetCode != null) {
View Full Code Here

    view.clear();

                // ...then we replace, that call with trigger action
                // instructions.
                if ("getHotSpotName".equals(inv.getMethodName())) {
                    view.add(factory.pushConstant(hs.getName()));
                }
                else if ("getArguments".equals(inv.getMethodName())) {
                    // NOT IMPLEMENTED
                    // This needs some further thinking before implementing
                }
View Full Code Here

        JiapiMethod jm = il.getDeclaringMethod();
        int modifiers = jm.getModifiers();
        if (Modifier.isStatic(modifiers)) {
      // Static methods do not have reference to 'this'
      //view.add(factory.pushNull());
      view.add(factory.pushConstant(jm.getDeclaringClass().getName()));
      view.add(factory.invoke(Modifier.STATIC, "java.lang.Class", "forName", new Signature("java.lang.Class", new String[] {"java.lang.String"})));
        }
        else {
      view.add(factory.aload(0));
        }
View Full Code Here

        // NOTE: We do not create exception handlers for
        //       Class.forName(...) invocation.
        //       However, we use this to get Class of the running object,
        //       so its Class is allways found.
        try {
            nl.add(f.pushConstant(name));
            nl.add(f.invoke(Modifier.STATIC, "java.lang.Class",
                            "forName", new Signature("java.lang.Class",
                                                     new String[] {"java.lang.String"})));
        }
        catch(Exception e) {
View Full Code Here

                    //addClassForNameInstructions(fa.getClassName(), nList);
                    nList.add(hsList.get(0)); // objref
                }

                // Name of the field; 2nd parameter to interceptor
                nList.add(factory.pushConstant(fa.getFieldName()));

                // 3rd parameter; field value
                Instruction pIns = null;
                if (primitive) {
                    // Provide wrapper for primitive types
View Full Code Here

        // NOTE: We do not create exception handlers for
        //       Class.forName(...) invocation.
        //       However, we use this to get Class of the running object,
        //       so its Class is allways found.
        try {
            nl.add(f.pushConstant(name));
            nl.add(f.invoke(Modifier.STATIC, "java.lang.Class",
                            "forName", new Signature("java.lang.Class",
                                                     new String[] {"java.lang.String"})));
            nl.add(f.astore(maxLocals));
        }
View Full Code Here

            else {
                nList.add(il.get(0)); // objref
            }

            // Name of the field; 2nd parameter to interceptor
            nList.add(factory.pushConstant(fa.getClassName() + "." +
                                           fa.getFieldName()));

            // call Interceptor
            if ((fa.getOpcode() == Opcodes.GETSTATIC) ||
                (fa.getOpcode() == Opcodes.GETFIELD)) {
View Full Code Here

        // NOTE: We do not create exception handlers for
        //       Class.forName(...) invocation.
        //       However, we use this to get Class of the running object,
        //       so its Class is allways found.
        try {
            nl.add(f.pushConstant(name));
            nl.add(f.invoke(Modifier.STATIC, "java.lang.Class",
                            "forName", new Signature("java.lang.Class",
                                                     new String[] {"java.lang.String"})));
        }
        catch(Exception e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.