| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
package org.apache.commons.nabla.automatic.functions; |
| 18 | |
|
| 19 | |
import org.apache.commons.nabla.automatic.analysis.MethodDifferentiator; |
| 20 | |
import org.objectweb.asm.Opcodes; |
| 21 | |
import org.objectweb.asm.tree.InsnList; |
| 22 | |
import org.objectweb.asm.tree.InsnNode; |
| 23 | |
import org.objectweb.asm.tree.MethodInsnNode; |
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | 1 | public class AcosTransformer implements MathInvocationTransformer { |
| 29 | |
|
| 30 | |
|
| 31 | |
public InsnList getReplacementList(final String owner, final MethodDifferentiator methodDifferentiator) { |
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | 3 | final InsnList list = new InsnList(); |
| 36 | 3 | list.add(new InsnNode(Opcodes.DUP2_X2)); |
| 37 | 3 | list.add(new InsnNode(Opcodes.POP2)); |
| 38 | 3 | list.add(new InsnNode(Opcodes.DUP2_X2)); |
| 39 | 3 | list.add(new InsnNode(Opcodes.DUP2)); |
| 40 | 3 | list.add(new InsnNode(Opcodes.DMUL)); |
| 41 | 3 | list.add(new InsnNode(Opcodes.DCONST_1)); |
| 42 | 3 | list.add(new InsnNode(Opcodes.DSUB)); |
| 43 | 3 | list.add(new InsnNode(Opcodes.DNEG)); |
| 44 | 3 | list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, owner, "sqrt", D_RETURN_D_DESCRIPTOR)); |
| 45 | 3 | list.add(new InsnNode(Opcodes.DDIV)); |
| 46 | 3 | list.add(new InsnNode(Opcodes.DNEG)); |
| 47 | 3 | list.add(new InsnNode(Opcodes.DUP2_X2)); |
| 48 | 3 | list.add(new InsnNode(Opcodes.POP2)); |
| 49 | 3 | list.add(new MethodInsnNode(Opcodes.INVOKESTATIC, owner, "acos", D_RETURN_D_DESCRIPTOR)); |
| 50 | 3 | list.add(new InsnNode(Opcodes.DUP2_X2)); |
| 51 | 3 | list.add(new InsnNode(Opcodes.POP2)); |
| 52 | 3 | return list; |
| 53 | |
|
| 54 | |
} |
| 55 | |
|
| 56 | |
} |