Java Code Examples for jdk.internal.org.objectweb.asm.Opcodes#INVOKESTATIC
The following examples show how to use
jdk.internal.org.objectweb.asm.Opcodes#INVOKESTATIC .
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 File: JIMethodCallInliner.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { // Now we are looking at method call in the source method if (!shouldBeInlined(owner, name, desc)) { // If this method call should not be inlined, just keep it mv.visitMethodInsn(opcode, owner, name, desc, itf); return; } // If the call should be inlined, we create a MethodInliningAdapter // The MIA will walk the instructions in the inlineTarget and add them // to the current method, doing the necessary name remappings. Logger.log(LogTag.JFR_SYSTEM_BYTECODE, LogLevel.DEBUG, "Inlining call to " + name + desc); Remapper remapper = new SimpleRemapper(oldClass, newClass); Label end = new Label(); inlining = true; inlineTarget.instructions.resetLabels(); JIMethodInliningAdapter mia = new JIMethodInliningAdapter(this, end, opcode == Opcodes.INVOKESTATIC ? Opcodes.ACC_STATIC : 0, desc, remapper); inlineTarget.accept(mia); inlining = false; super.visitLabel(end); }
Example 2
Source File: InstructionAdapter.java From nashorn with GNU General Public License v2.0 | 6 votes |
@Override public void visitMethodInsn( final int opcode, final String owner, final String name, final String desc) { switch (opcode) { case Opcodes.INVOKESPECIAL: invokespecial(owner, name, desc); break; case Opcodes.INVOKEVIRTUAL: invokevirtual(owner, name, desc); break; case Opcodes.INVOKESTATIC: invokestatic(owner, name, desc); break; case Opcodes.INVOKEINTERFACE: invokeinterface(owner, name, desc); break; default: throw new IllegalArgumentException(); } }
Example 3
Source File: InstructionAdapter.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private void doVisitMethodInsn(int opcode, final String owner, final String name, final String desc, final boolean itf) { switch (opcode) { case Opcodes.INVOKESPECIAL: invokespecial(owner, name, desc, itf); break; case Opcodes.INVOKEVIRTUAL: invokevirtual(owner, name, desc, itf); break; case Opcodes.INVOKESTATIC: invokestatic(owner, name, desc, itf); break; case Opcodes.INVOKEINTERFACE: invokeinterface(owner, name, desc); break; default: throw new IllegalArgumentException(); } }
Example 4
Source File: InstructionAdapter.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private void doVisitMethodInsn(int opcode, final String owner, final String name, final String desc, final boolean itf) { switch (opcode) { case Opcodes.INVOKESPECIAL: invokespecial(owner, name, desc, itf); break; case Opcodes.INVOKEVIRTUAL: invokevirtual(owner, name, desc, itf); break; case Opcodes.INVOKESTATIC: invokestatic(owner, name, desc, itf); break; case Opcodes.INVOKEINTERFACE: invokeinterface(owner, name, desc); break; default: throw new IllegalArgumentException(); } }
Example 5
Source File: JIMethodCallInliner.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { // Now we are looking at method call in the source method if (!shouldBeInlined(owner, name, desc)) { // If this method call should not be inlined, just keep it mv.visitMethodInsn(opcode, owner, name, desc, itf); return; } // If the call should be inlined, we create a MethodInliningAdapter // The MIA will walk the instructions in the inlineTarget and add them // to the current method, doing the necessary name remappings. Logger.log(LogTag.JFR_SYSTEM_BYTECODE, LogLevel.DEBUG, "Inlining call to " + name + desc); Remapper remapper = new SimpleRemapper(oldClass, newClass); Label end = new Label(); inlining = true; inlineTarget.instructions.resetLabels(); JIMethodInliningAdapter mia = new JIMethodInliningAdapter(this, end, opcode == Opcodes.INVOKESTATIC ? Opcodes.ACC_STATIC : 0, desc, remapper); inlineTarget.accept(mia); inlining = false; super.visitLabel(end); }
Example 6
Source File: InstructionAdapter.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private void doVisitMethodInsn(int opcode, final String owner, final String name, final String desc, final boolean itf) { switch (opcode) { case Opcodes.INVOKESPECIAL: invokespecial(owner, name, desc, itf); break; case Opcodes.INVOKEVIRTUAL: invokevirtual(owner, name, desc, itf); break; case Opcodes.INVOKESTATIC: invokestatic(owner, name, desc, itf); break; case Opcodes.INVOKEINTERFACE: invokeinterface(owner, name, desc); break; default: throw new IllegalArgumentException(); } }
Example 7
Source File: InstructionAdapter.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private void doVisitMethodInsn(int opcode, final String owner, final String name, final String desc, final boolean itf) { switch (opcode) { case Opcodes.INVOKESPECIAL: invokespecial(owner, name, desc, itf); break; case Opcodes.INVOKEVIRTUAL: invokevirtual(owner, name, desc, itf); break; case Opcodes.INVOKESTATIC: invokestatic(owner, name, desc, itf); break; case Opcodes.INVOKEINTERFACE: invokeinterface(owner, name, desc); break; default: throw new IllegalArgumentException(); } }
Example 8
Source File: InstructionAdapter.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
private void doVisitMethodInsn(int opcode, final String owner, final String name, final String desc, final boolean itf) { switch (opcode) { case Opcodes.INVOKESPECIAL: invokespecial(owner, name, desc, itf); break; case Opcodes.INVOKEVIRTUAL: invokevirtual(owner, name, desc, itf); break; case Opcodes.INVOKESTATIC: invokestatic(owner, name, desc, itf); break; case Opcodes.INVOKEINTERFACE: invokeinterface(owner, name, desc); break; default: throw new IllegalArgumentException(); } }
Example 9
Source File: AnalyzerAdapter.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private void doVisitMethodInsn(int opcode, final String owner, final String name, final String desc, final boolean itf) { if (mv != null) { mv.visitMethodInsn(opcode, owner, name, desc, itf); } if (this.locals == null) { labels = null; return; } pop(desc); if (opcode != Opcodes.INVOKESTATIC) { Object t = pop(); if (opcode == Opcodes.INVOKESPECIAL && name.charAt(0) == '<') { Object u; if (t == Opcodes.UNINITIALIZED_THIS) { u = this.owner; } else { u = uninitializedTypes.get(t); } for (int i = 0; i < locals.size(); ++i) { if (locals.get(i) == t) { locals.set(i, u); } } for (int i = 0; i < stack.size(); ++i) { if (stack.get(i) == t) { stack.set(i, u); } } } } pushDesc(desc); labels = null; }
Example 10
Source File: AnalyzerAdapter.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private void doVisitMethodInsn(int opcode, final String owner, final String name, final String desc, final boolean itf) { if (mv != null) { mv.visitMethodInsn(opcode, owner, name, desc, itf); } if (this.locals == null) { labels = null; return; } pop(desc); if (opcode != Opcodes.INVOKESTATIC) { Object t = pop(); if (opcode == Opcodes.INVOKESPECIAL && name.charAt(0) == '<') { Object u; if (t == Opcodes.UNINITIALIZED_THIS) { u = this.owner; } else { u = uninitializedTypes.get(t); } for (int i = 0; i < locals.size(); ++i) { if (locals.get(i) == t) { locals.set(i, u); } } for (int i = 0; i < stack.size(); ++i) { if (stack.get(i) == t) { stack.set(i, u); } } } } pushDesc(desc); labels = null; }
Example 11
Source File: InvokerBytecodeGenerator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
int refKindOpcode(byte refKind) { switch (refKind) { case REF_invokeVirtual: return Opcodes.INVOKEVIRTUAL; case REF_invokeStatic: return Opcodes.INVOKESTATIC; case REF_invokeSpecial: return Opcodes.INVOKESPECIAL; case REF_invokeInterface: return Opcodes.INVOKEINTERFACE; case REF_getField: return Opcodes.GETFIELD; case REF_putField: return Opcodes.PUTFIELD; case REF_getStatic: return Opcodes.GETSTATIC; case REF_putStatic: return Opcodes.PUTSTATIC; } throw new InternalError("refKind="+refKind); }
Example 12
Source File: ByteCodeVisitor.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public byte[] visit(Function node) { FunctionInfo info = node.getValue(); boolean needInstance = !info.isStatic() && !info.isConstructor(); if (needInstance) { node.getChild(0).accept(this); // placing instance on stack } // call itself with specific invoke* String signature = info.argTypes.stream() .skip(!needInstance ? 0 : 1) .map(vi -> new String(vi.type.accept(this))) .collect(Collectors.joining("", "(", ")")) + (info.isConstructor() ? "V" : new String(node.getResultType().accept(this))); int invokeCode = Opcodes.INVOKEVIRTUAL; if (info.isStatic()) { invokeCode = Opcodes.INVOKESTATIC; } else if (info.isConstructor() || info.isPrivate()) { // TODO : superclass method invocation? invokeCode = Opcodes.INVOKESPECIAL; } else { if (info.owner.isInterface()) { invokeCode = Opcodes.INVOKEINTERFACE; } } if (info.isConstructor()) { currentMV.visitTypeInsn(Opcodes.NEW, asInternalName(info.owner.getName())); currentMV.visitInsn(Opcodes.DUP); } // calculating parameters node.getChildren().stream() .skip(!needInstance ? 0 : 1) .forEachOrdered(c -> c.accept(this)); currentMV.visitMethodInsn(invokeCode, asInternalName(info.owner.getName()), info.isConstructor() ? "<init>" : info.name, signature, invokeCode == Opcodes.INVOKEINTERFACE); return EMPTY_BYTE_ARRAY; }
Example 13
Source File: TestBuilder.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static int getInvokeInstruction(SelectionResolutionTestCase.InvokeInstruction instr) { switch (instr) { case INVOKESTATIC: return Opcodes.INVOKESTATIC; case INVOKESPECIAL: return Opcodes.INVOKESPECIAL; case INVOKEINTERFACE: return Opcodes.INVOKEINTERFACE; case INVOKEVIRTUAL: return Opcodes.INVOKEVIRTUAL; default: throw new AssertionError(instr.name()); } }
Example 14
Source File: InvokerBytecodeGenerator.java From Bytecoder with Apache License 2.0 | 5 votes |
int refKindOpcode(byte refKind) { switch (refKind) { case REF_invokeVirtual: return Opcodes.INVOKEVIRTUAL; case REF_invokeStatic: return Opcodes.INVOKESTATIC; case REF_invokeSpecial: return Opcodes.INVOKESPECIAL; case REF_invokeInterface: return Opcodes.INVOKEINTERFACE; case REF_getField: return Opcodes.GETFIELD; case REF_putField: return Opcodes.PUTFIELD; case REF_getStatic: return Opcodes.GETSTATIC; case REF_putStatic: return Opcodes.PUTSTATIC; } throw new InternalError("refKind="+refKind); }
Example 15
Source File: AnalyzerAdapter.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private void doVisitMethodInsn(int opcode, final String owner, final String name, final String desc, final boolean itf) { if (mv != null) { mv.visitMethodInsn(opcode, owner, name, desc, itf); } if (this.locals == null) { labels = null; return; } pop(desc); if (opcode != Opcodes.INVOKESTATIC) { Object t = pop(); if (opcode == Opcodes.INVOKESPECIAL && name.charAt(0) == '<') { Object u; if (t == Opcodes.UNINITIALIZED_THIS) { u = this.owner; } else { u = uninitializedTypes.get(t); } for (int i = 0; i < locals.size(); ++i) { if (locals.get(i) == t) { locals.set(i, u); } } for (int i = 0; i < stack.size(); ++i) { if (stack.get(i) == t) { stack.set(i, u); } } } } pushDesc(desc); labels = null; }
Example 16
Source File: AnalyzerAdapter.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private void doVisitMethodInsn(int opcode, final String owner, final String name, final String desc, final boolean itf) { if (mv != null) { mv.visitMethodInsn(opcode, owner, name, desc, itf); } if (this.locals == null) { labels = null; return; } pop(desc); if (opcode != Opcodes.INVOKESTATIC) { Object t = pop(); if (opcode == Opcodes.INVOKESPECIAL && name.charAt(0) == '<') { Object u; if (t == Opcodes.UNINITIALIZED_THIS) { u = this.owner; } else { u = uninitializedTypes.get(t); } for (int i = 0; i < locals.size(); ++i) { if (locals.get(i) == t) { locals.set(i, u); } } for (int i = 0; i < stack.size(); ++i) { if (stack.get(i) == t) { stack.set(i, u); } } } } pushDesc(desc); labels = null; }
Example 17
Source File: AnalyzerAdapter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private void doVisitMethodInsn(int opcode, final String owner, final String name, final String desc, final boolean itf) { if (mv != null) { mv.visitMethodInsn(opcode, owner, name, desc, itf); } if (this.locals == null) { labels = null; return; } pop(desc); if (opcode != Opcodes.INVOKESTATIC) { Object t = pop(); if (opcode == Opcodes.INVOKESPECIAL && name.charAt(0) == '<') { Object u; if (t == Opcodes.UNINITIALIZED_THIS) { u = this.owner; } else { u = uninitializedTypes.get(t); } for (int i = 0; i < locals.size(); ++i) { if (locals.get(i) == t) { locals.set(i, u); } } for (int i = 0; i < stack.size(); ++i) { if (stack.get(i) == t) { stack.set(i, u); } } } } pushDesc(desc); labels = null; }
Example 18
Source File: AnalyzerAdapter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private void doVisitMethodInsn(int opcode, final String owner, final String name, final String desc, final boolean itf) { if (mv != null) { mv.visitMethodInsn(opcode, owner, name, desc, itf); } if (this.locals == null) { labels = null; return; } pop(desc); if (opcode != Opcodes.INVOKESTATIC) { Object t = pop(); if (opcode == Opcodes.INVOKESPECIAL && name.charAt(0) == '<') { Object u; if (t == Opcodes.UNINITIALIZED_THIS) { u = this.owner; } else { u = uninitializedTypes.get(t); } for (int i = 0; i < locals.size(); ++i) { if (locals.get(i) == t) { locals.set(i, u); } } for (int i = 0; i < stack.size(); ++i) { if (stack.get(i) == t) { stack.set(i, u); } } } } pushDesc(desc); labels = null; }
Example 19
Source File: AnalyzerAdapter.java From nashorn with GNU General Public License v2.0 | 5 votes |
@Override public void visitMethodInsn( final int opcode, final String owner, final String name, final String desc) { if (mv != null) { mv.visitMethodInsn(opcode, owner, name, desc); } if (this.locals == null) { labels = null; return; } pop(desc); if (opcode != Opcodes.INVOKESTATIC) { Object t = pop(); if (opcode == Opcodes.INVOKESPECIAL && name.charAt(0) == '<') { Object u; if (t == Opcodes.UNINITIALIZED_THIS) { u = this.owner; } else { u = uninitializedTypes.get(t); } for (int i = 0; i < locals.size(); ++i) { if (locals.get(i) == t) { locals.set(i, u); } } for (int i = 0; i < stack.size(); ++i) { if (stack.get(i) == t) { stack.set(i, u); } } } } pushDesc(desc); labels = null; }
Example 20
Source File: AnalyzerAdapter.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private void doVisitMethodInsn(int opcode, final String owner, final String name, final String desc, final boolean itf) { if (mv != null) { mv.visitMethodInsn(opcode, owner, name, desc, itf); } if (this.locals == null) { labels = null; return; } pop(desc); if (opcode != Opcodes.INVOKESTATIC) { Object t = pop(); if (opcode == Opcodes.INVOKESPECIAL && name.charAt(0) == '<') { Object u; if (t == Opcodes.UNINITIALIZED_THIS) { u = this.owner; } else { u = uninitializedTypes.get(t); } for (int i = 0; i < locals.size(); ++i) { if (locals.get(i) == t) { locals.set(i, u); } } for (int i = 0; i < stack.size(); ++i) { if (stack.get(i) == t) { stack.set(i, u); } } } } pushDesc(desc); labels = null; }