IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
RuntimeSmartJavaMethod.cs
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2014 Jeroen Frijters
3
4 This software is provided 'as-is', without any express or implied
5 warranty. In no event will the authors be held liable for any damages
6 arising from the use of this software.
7
8 Permission is granted to anyone to use this software for any purpose,
9 including commercial applications, and to alter it and redistribute it
10 freely, subject to the following restrictions:
11
12 1. The origin of this software must not be misrepresented; you must not
13 claim that you wrote the original software. If you use this software
14 in a product, an acknowledgment in the product documentation would be
15 appreciated but is not required.
16 2. Altered source versions must be plainly marked as such, and must not be
17 misrepresented as being the original software.
18 3. This notice may not be removed or altered from any source distribution.
19
20 Jeroen Frijters
21 jeroen@frijters.net
22
23*/
24using System;
25
26using IKVM.Attributes;
27
28#if IMPORTER || EXPORTER
29using IKVM.Reflection;
30#else
31using System.Reflection;
32#endif
33
34namespace IKVM.Runtime
35{
36
38 {
39
51 internal RuntimeSmartJavaMethod(RuntimeJavaType declaringType, string name, string sig, MethodBase method, RuntimeJavaType returnType, RuntimeJavaType[] parameterTypes, Modifiers modifiers, MemberFlags flags) :
52 base(declaringType, name, sig, method, returnType, parameterTypes, modifiers, flags)
53 {
54
55 }
56
57#if EMITTERS
58
59 internal sealed override void EmitCall(CodeEmitter ilgen)
60 {
61 AssertLinked();
62 CallImpl(ilgen);
63 }
64
65 protected virtual void CallImpl(CodeEmitter ilgen)
66 {
67 throw new InvalidOperationException();
68 }
69
70 internal sealed override void EmitCallvirt(CodeEmitter ilgen)
71 {
72 AssertLinked();
73
74 // callvirt isn't allowed on a value type
75 // (we don't need to check for a null reference, because we're always dealing with an unboxed value)
76 if (DeclaringType.IsNonPrimitiveValueType)
77 CallImpl(ilgen);
78 else
79 CallvirtImpl(ilgen);
80 }
81
82 protected virtual void CallvirtImpl(CodeEmitter ilgen)
83 {
84 throw new InvalidOperationException();
85 }
86
87 internal sealed override void EmitNewobj(CodeEmitter ilgen)
88 {
89 AssertLinked();
90 NewobjImpl(ilgen);
91 if (DeclaringType.IsNonPrimitiveValueType)
92 {
93 DeclaringType.EmitBox(ilgen);
94 }
95 }
96
97 protected virtual void NewobjImpl(CodeEmitter ilgen)
98 {
99 throw new InvalidOperationException();
100 }
101
102#endif // EMITTERS
103
104 }
105
106}
IKVM.Reflection.MethodBase MethodBase
MemberFlags
Describes various options applied to a member.