equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
28 import com.apple.jobjc.Coder.NSClassCoder; |
28 import com.apple.jobjc.Coder.NSClassCoder; |
29 import com.apple.jobjc.Coder.PrimitivePointerCoder; |
29 import com.apple.jobjc.Coder.PrimitivePointerCoder; |
30 import com.apple.jobjc.Coder.SELCoder; |
30 import com.apple.jobjc.Coder.SELCoder; |
31 import com.apple.jobjc.Coder.StructCoder; |
31 import com.apple.jobjc.Coder.StructCoder; |
32 |
32 |
33 import javax.tools.annotation.GenerateNativeHeader; |
33 |
34 |
|
35 /* No native methods here, but the constants are needed in the supporting JNI code */ |
|
36 @GenerateNativeHeader |
|
37 public abstract class Invoke { |
34 public abstract class Invoke { |
38 public abstract void invoke(NativeArgumentBuffer argBuf); |
35 public abstract void invoke(NativeArgumentBuffer argBuf); |
39 public abstract void invoke(NativeArgumentBuffer buffer, Struct retvalStruct); |
36 public abstract void invoke(NativeArgumentBuffer buffer, Struct retvalStruct); |
40 |
37 |
41 // |
38 // |
42 |
39 |
43 /* No native methods here, but the constants are needed in the supporting JNI code */ |
|
44 @GenerateNativeHeader |
|
45 public static final class FunCall extends Invoke{ |
40 public static final class FunCall extends Invoke{ |
46 static native void invoke(long cifPtr, long fxnPtr, long retValPtr, long argsPtr); |
41 static native void invoke(long cifPtr, long fxnPtr, long retValPtr, long argsPtr); |
47 |
42 |
48 final long fxnPtr; |
43 final long fxnPtr; |
49 final CIF cif; |
44 final CIF cif; |
76 void invoke(final NativeArgumentBuffer argBuf, final long retValPtr) { |
71 void invoke(final NativeArgumentBuffer argBuf, final long retValPtr) { |
77 invoke(cif.cif.bufferPtr, fxnPtr, retValPtr, argBuf.buffer.bufferPtr); |
72 invoke(cif.cif.bufferPtr, fxnPtr, retValPtr, argBuf.buffer.bufferPtr); |
78 } |
73 } |
79 } |
74 } |
80 |
75 |
81 /* No native methods here, but the constants are needed in the supporting JNI code */ |
|
82 @GenerateNativeHeader |
|
83 public static final class MsgSend extends Invoke{ |
76 public static final class MsgSend extends Invoke{ |
84 static{ System.load("/usr/lib/libobjc.dylib"); } |
77 static{ System.load("/usr/lib/libobjc.dylib"); } |
85 |
78 |
86 private static final long OBJC_MSG_SEND_FXN_PTR = new Function("objc_msgSend").fxnPtr; |
79 private static final long OBJC_MSG_SEND_FXN_PTR = new Function("objc_msgSend").fxnPtr; |
87 private static final long OBJC_MSG_SEND_FPRET_FXN_PTR = new Function("objc_msgSend_fpret").fxnPtr; |
80 private static final long OBJC_MSG_SEND_FPRET_FXN_PTR = new Function("objc_msgSend_fpret").fxnPtr; |
163 throw new RuntimeException(); |
156 throw new RuntimeException(); |
164 } |
157 } |
165 } |
158 } |
166 } |
159 } |
167 |
160 |
168 /* No native methods here, but the constants are needed in the supporting JNI code */ |
|
169 @GenerateNativeHeader |
|
170 public static final class MsgSendSuper extends Invoke{ |
161 public static final class MsgSendSuper extends Invoke{ |
171 static{ System.load("/usr/lib/libobjc.dylib"); } |
162 static{ System.load("/usr/lib/libobjc.dylib"); } |
172 |
163 |
173 private static final long OBJC_MSG_SEND_SUPER_FXN_PTR = new Function("objc_msgSendSuper").fxnPtr; |
164 private static final long OBJC_MSG_SEND_SUPER_FXN_PTR = new Function("objc_msgSendSuper").fxnPtr; |
174 private static final long OBJC_MSG_SEND_SUPER_STRET_FXN_PTR = new Function("objc_msgSendSuper_stret").fxnPtr; |
165 private static final long OBJC_MSG_SEND_SUPER_STRET_FXN_PTR = new Function("objc_msgSendSuper_stret").fxnPtr; |