repo_name
stringclasses 6
values | pr_number
int64 512
78.9k
| pr_title
stringlengths 3
144
| pr_description
stringlengths 0
30.3k
| author
stringlengths 2
21
| date_created
timestamp[ns, tz=UTC] | date_merged
timestamp[ns, tz=UTC] | previous_commit
stringlengths 40
40
| pr_commit
stringlengths 40
40
| query
stringlengths 17
30.4k
| filepath
stringlengths 9
210
| before_content
stringlengths 0
112M
| after_content
stringlengths 0
112M
| label
int64 -1
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/coreclr/pal/src/libunwind/src/dwarf/Gexpr.c
|
/* libunwind - a platform-independent unwind library
Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P.
Contributed by David Mosberger-Tang <[email protected]>
This file is part of libunwind.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h"
#include "libunwind_i.h"
/* The "pick" operator provides an index range of 0..255 indicating
that the stack could at least have a depth of up to 256 elements,
but the GCC unwinder restricts the depth to 64, which seems
reasonable so we use the same value here. */
#define MAX_EXPR_STACK_SIZE 64
#define NUM_OPERANDS(signature) (((signature) >> 6) & 0x3)
#define OPND1_TYPE(signature) (((signature) >> 3) & 0x7)
#define OPND2_TYPE(signature) (((signature) >> 0) & 0x7)
#define OPND_SIGNATURE(n, t1, t2) (((n) << 6) | ((t1) << 3) | ((t2) << 0))
#define OPND1(t1) OPND_SIGNATURE(1, t1, 0)
#define OPND2(t1, t2) OPND_SIGNATURE(2, t1, t2)
#define VAL8 0x0
#define VAL16 0x1
#define VAL32 0x2
#define VAL64 0x3
#define ULEB128 0x4
#define SLEB128 0x5
#define OFFSET 0x6 /* 32-bit offset for 32-bit DWARF, 64-bit otherwise */
#define ADDR 0x7 /* Machine address. */
static const uint8_t operands[256] =
{
[DW_OP_addr] = OPND1 (ADDR),
[DW_OP_const1u] = OPND1 (VAL8),
[DW_OP_const1s] = OPND1 (VAL8),
[DW_OP_const2u] = OPND1 (VAL16),
[DW_OP_const2s] = OPND1 (VAL16),
[DW_OP_const4u] = OPND1 (VAL32),
[DW_OP_const4s] = OPND1 (VAL32),
[DW_OP_const8u] = OPND1 (VAL64),
[DW_OP_const8s] = OPND1 (VAL64),
[DW_OP_constu] = OPND1 (ULEB128),
[DW_OP_consts] = OPND1 (SLEB128),
[DW_OP_pick] = OPND1 (VAL8),
[DW_OP_plus_uconst] = OPND1 (ULEB128),
[DW_OP_skip] = OPND1 (VAL16),
[DW_OP_bra] = OPND1 (VAL16),
[DW_OP_breg0 + 0] = OPND1 (SLEB128),
[DW_OP_breg0 + 1] = OPND1 (SLEB128),
[DW_OP_breg0 + 2] = OPND1 (SLEB128),
[DW_OP_breg0 + 3] = OPND1 (SLEB128),
[DW_OP_breg0 + 4] = OPND1 (SLEB128),
[DW_OP_breg0 + 5] = OPND1 (SLEB128),
[DW_OP_breg0 + 6] = OPND1 (SLEB128),
[DW_OP_breg0 + 7] = OPND1 (SLEB128),
[DW_OP_breg0 + 8] = OPND1 (SLEB128),
[DW_OP_breg0 + 9] = OPND1 (SLEB128),
[DW_OP_breg0 + 10] = OPND1 (SLEB128),
[DW_OP_breg0 + 11] = OPND1 (SLEB128),
[DW_OP_breg0 + 12] = OPND1 (SLEB128),
[DW_OP_breg0 + 13] = OPND1 (SLEB128),
[DW_OP_breg0 + 14] = OPND1 (SLEB128),
[DW_OP_breg0 + 15] = OPND1 (SLEB128),
[DW_OP_breg0 + 16] = OPND1 (SLEB128),
[DW_OP_breg0 + 17] = OPND1 (SLEB128),
[DW_OP_breg0 + 18] = OPND1 (SLEB128),
[DW_OP_breg0 + 19] = OPND1 (SLEB128),
[DW_OP_breg0 + 20] = OPND1 (SLEB128),
[DW_OP_breg0 + 21] = OPND1 (SLEB128),
[DW_OP_breg0 + 22] = OPND1 (SLEB128),
[DW_OP_breg0 + 23] = OPND1 (SLEB128),
[DW_OP_breg0 + 24] = OPND1 (SLEB128),
[DW_OP_breg0 + 25] = OPND1 (SLEB128),
[DW_OP_breg0 + 26] = OPND1 (SLEB128),
[DW_OP_breg0 + 27] = OPND1 (SLEB128),
[DW_OP_breg0 + 28] = OPND1 (SLEB128),
[DW_OP_breg0 + 29] = OPND1 (SLEB128),
[DW_OP_breg0 + 30] = OPND1 (SLEB128),
[DW_OP_breg0 + 31] = OPND1 (SLEB128),
[DW_OP_regx] = OPND1 (ULEB128),
[DW_OP_fbreg] = OPND1 (SLEB128),
[DW_OP_bregx] = OPND2 (ULEB128, SLEB128),
[DW_OP_piece] = OPND1 (ULEB128),
[DW_OP_deref_size] = OPND1 (VAL8),
[DW_OP_xderef_size] = OPND1 (VAL8),
[DW_OP_call2] = OPND1 (VAL16),
[DW_OP_call4] = OPND1 (VAL32),
[DW_OP_call_ref] = OPND1 (OFFSET)
};
static inline unw_sword_t
sword (unw_addr_space_t as, unw_word_t val)
{
switch (dwarf_addr_size (as))
{
case 1: return (int8_t) val;
case 2: return (int16_t) val;
case 4: return (int32_t) val;
case 8: return (int64_t) val;
default: abort ();
}
}
static inline unw_word_t
read_operand (unw_addr_space_t as, unw_accessors_t *a,
unw_word_t *addr, int operand_type, unw_word_t *val, void *arg)
{
uint8_t u8;
uint16_t u16;
uint32_t u32;
uint64_t u64;
int ret;
if (operand_type == ADDR)
switch (dwarf_addr_size (as))
{
case 1: operand_type = VAL8; break;
case 2: operand_type = VAL16; break;
case 4: operand_type = VAL32; break;
case 8: operand_type = VAL64; break;
default: abort ();
}
switch (operand_type)
{
case VAL8:
ret = dwarf_readu8 (as, a, addr, &u8, arg);
if (ret < 0)
return ret;
*val = u8;
break;
case VAL16:
ret = dwarf_readu16 (as, a, addr, &u16, arg);
if (ret < 0)
return ret;
*val = u16;
break;
case VAL32:
ret = dwarf_readu32 (as, a, addr, &u32, arg);
if (ret < 0)
return ret;
*val = u32;
break;
case VAL64:
ret = dwarf_readu64 (as, a, addr, &u64, arg);
if (ret < 0)
return ret;
*val = u64;
break;
case ULEB128:
ret = dwarf_read_uleb128 (as, a, addr, val, arg);
break;
case SLEB128:
ret = dwarf_read_sleb128 (as, a, addr, val, arg);
break;
case OFFSET: /* only used by DW_OP_call_ref, which we don't implement */
default:
Debug (1, "Unexpected operand type %d\n", operand_type);
ret = -UNW_EINVAL;
}
return ret;
}
HIDDEN int
dwarf_stack_aligned(struct dwarf_cursor *c, unw_word_t cfa_addr,
unw_word_t rbp_addr, unw_word_t *cfa_offset) {
unw_accessors_t *a;
int ret;
void *arg;
unw_word_t len;
uint8_t opcode;
unw_word_t operand1;
a = unw_get_accessors_int (c->as);
arg = c->as_arg;
ret = dwarf_read_uleb128(c->as, a, &rbp_addr, &len, arg);
if (len != 2 || ret < 0)
return 0;
ret = dwarf_readu8(c->as, a, &rbp_addr, &opcode, arg);
if (ret < 0 || opcode != DW_OP_breg6)
return 0;
ret = read_operand(c->as, a, &rbp_addr,
OPND1_TYPE(operands[opcode]), &operand1, arg);
if (ret < 0 || operand1 != 0)
return 0;
ret = dwarf_read_uleb128(c->as, a, &cfa_addr, &len, arg);
if (ret < 0 || len != 3)
return 0;
ret = dwarf_readu8(c->as, a, &cfa_addr, &opcode, arg);
if (ret < 0 || opcode != DW_OP_breg6)
return 0;
ret = read_operand(c->as, a, &cfa_addr,
OPND1_TYPE(operands[opcode]), &operand1, arg);
if (ret < 0)
return 0;
ret = dwarf_readu8(c->as, a, &cfa_addr, &opcode, arg);
if (ret < 0 || opcode != DW_OP_deref)
return 0;
*cfa_offset = operand1;
return 1;
}
HIDDEN int
dwarf_eval_expr (struct dwarf_cursor *c, unw_word_t stack_val, unw_word_t *addr,
unw_word_t len, unw_word_t *valp, int *is_register)
{
unw_word_t operand1 = 0, operand2 = 0, tmp1, tmp2 = 0, tmp3, end_addr;
uint8_t opcode, operands_signature, u8;
unw_addr_space_t as;
unw_accessors_t *a;
void *arg;
unw_word_t stack[MAX_EXPR_STACK_SIZE];
unsigned int tos = 0;
uint16_t u16;
uint32_t u32;
uint64_t u64;
int ret;
unw_word_t stackerror = 0;
// pop() is either followed by a semicolon or
// used in a push() macro
// In either case we can sneak in an extra statement
# define pop() \
(((tos - 1) >= MAX_EXPR_STACK_SIZE) ? \
stackerror++ : stack[--tos]); \
if (stackerror) \
{ \
Debug (1, "Stack underflow\n"); \
return -UNW_EINVAL; \
}
// Removed the parentheses on the asignment
// to allow the extra stack error check
// when x is evaluated
# define push(x) \
do { \
unw_word_t _x = x; \
if (tos >= MAX_EXPR_STACK_SIZE) \
{ \
Debug (1, "Stack overflow\n"); \
return -UNW_EINVAL; \
} \
stack[tos++] = _x; \
} while (0)
// Pick is always used in a push() macro
// In either case we can sneak in an extra statement
# define pick(n) \
(((tos - 1 - (n)) >= MAX_EXPR_STACK_SIZE) ? \
stackerror++ : stack[tos - 1 - (n)]); \
if (stackerror) \
{ \
Debug (1, "Out-of-stack pick\n"); \
return -UNW_EINVAL; \
}
as = c->as;
arg = c->as_arg;
a = unw_get_accessors_int (as);
end_addr = *addr + len;
*is_register = 0;
Debug (14, "len=%lu, pushing initial value=0x%lx\n",
(unsigned long) len, (unsigned long) stack_val);
/* The DWARF standard requires the current CFA to be pushed onto the stack */
/* before evaluating DW_CFA_expression and DW_CFA_val_expression programs. */
/* DW_CFA_def_cfa_expressions do not take an initial value, but we push on */
/* a dummy value to keep this logic consistent. */
push (stack_val);
while (*addr < end_addr)
{
if ((ret = dwarf_readu8 (as, a, addr, &opcode, arg)) < 0)
return ret;
operands_signature = operands[opcode];
if (unlikely (NUM_OPERANDS (operands_signature) > 0))
{
if ((ret = read_operand (as, a, addr,
OPND1_TYPE (operands_signature),
&operand1, arg)) < 0)
return ret;
if (NUM_OPERANDS (operands_signature) > 1)
if ((ret = read_operand (as, a, addr,
OPND2_TYPE (operands_signature),
&operand2, arg)) < 0)
return ret;
}
switch ((dwarf_expr_op_t) opcode)
{
case DW_OP_lit0: case DW_OP_lit1: case DW_OP_lit2:
case DW_OP_lit3: case DW_OP_lit4: case DW_OP_lit5:
case DW_OP_lit6: case DW_OP_lit7: case DW_OP_lit8:
case DW_OP_lit9: case DW_OP_lit10: case DW_OP_lit11:
case DW_OP_lit12: case DW_OP_lit13: case DW_OP_lit14:
case DW_OP_lit15: case DW_OP_lit16: case DW_OP_lit17:
case DW_OP_lit18: case DW_OP_lit19: case DW_OP_lit20:
case DW_OP_lit21: case DW_OP_lit22: case DW_OP_lit23:
case DW_OP_lit24: case DW_OP_lit25: case DW_OP_lit26:
case DW_OP_lit27: case DW_OP_lit28: case DW_OP_lit29:
case DW_OP_lit30: case DW_OP_lit31:
Debug (15, "OP_lit(%d)\n", (int) opcode - DW_OP_lit0);
push (opcode - DW_OP_lit0);
break;
case DW_OP_breg0: case DW_OP_breg1: case DW_OP_breg2:
case DW_OP_breg3: case DW_OP_breg4: case DW_OP_breg5:
case DW_OP_breg6: case DW_OP_breg7: case DW_OP_breg8:
case DW_OP_breg9: case DW_OP_breg10: case DW_OP_breg11:
case DW_OP_breg12: case DW_OP_breg13: case DW_OP_breg14:
case DW_OP_breg15: case DW_OP_breg16: case DW_OP_breg17:
case DW_OP_breg18: case DW_OP_breg19: case DW_OP_breg20:
case DW_OP_breg21: case DW_OP_breg22: case DW_OP_breg23:
case DW_OP_breg24: case DW_OP_breg25: case DW_OP_breg26:
case DW_OP_breg27: case DW_OP_breg28: case DW_OP_breg29:
case DW_OP_breg30: case DW_OP_breg31:
Debug (15, "OP_breg(r%d,0x%lx)\n",
(int) opcode - DW_OP_breg0, (unsigned long) operand1);
if ((ret = unw_get_reg (dwarf_to_cursor (c),
dwarf_to_unw_regnum (opcode - DW_OP_breg0),
&tmp1)) < 0)
return ret;
push (tmp1 + operand1);
break;
case DW_OP_bregx:
Debug (15, "OP_bregx(r%d,0x%lx)\n",
(int) operand1, (unsigned long) operand2);
if ((ret = unw_get_reg (dwarf_to_cursor (c),
dwarf_to_unw_regnum (operand1), &tmp1)) < 0)
return ret;
push (tmp1 + operand2);
break;
case DW_OP_reg0: case DW_OP_reg1: case DW_OP_reg2:
case DW_OP_reg3: case DW_OP_reg4: case DW_OP_reg5:
case DW_OP_reg6: case DW_OP_reg7: case DW_OP_reg8:
case DW_OP_reg9: case DW_OP_reg10: case DW_OP_reg11:
case DW_OP_reg12: case DW_OP_reg13: case DW_OP_reg14:
case DW_OP_reg15: case DW_OP_reg16: case DW_OP_reg17:
case DW_OP_reg18: case DW_OP_reg19: case DW_OP_reg20:
case DW_OP_reg21: case DW_OP_reg22: case DW_OP_reg23:
case DW_OP_reg24: case DW_OP_reg25: case DW_OP_reg26:
case DW_OP_reg27: case DW_OP_reg28: case DW_OP_reg29:
case DW_OP_reg30: case DW_OP_reg31:
Debug (15, "OP_reg(r%d)\n", (int) opcode - DW_OP_reg0);
*valp = dwarf_to_unw_regnum (opcode - DW_OP_reg0);
*is_register = 1;
return 0;
case DW_OP_regx:
Debug (15, "OP_regx(r%d)\n", (int) operand1);
*valp = dwarf_to_unw_regnum (operand1);
*is_register = 1;
return 0;
case DW_OP_addr:
case DW_OP_const1u:
case DW_OP_const2u:
case DW_OP_const4u:
case DW_OP_const8u:
case DW_OP_constu:
case DW_OP_const8s:
case DW_OP_consts:
Debug (15, "OP_const(0x%lx)\n", (unsigned long) operand1);
push (operand1);
break;
case DW_OP_const1s:
if (operand1 & 0x80)
operand1 |= ((unw_word_t) -1) << 8;
Debug (15, "OP_const1s(%ld)\n", (long) operand1);
push (operand1);
break;
case DW_OP_const2s:
if (operand1 & 0x8000)
operand1 |= ((unw_word_t) -1) << 16;
Debug (15, "OP_const2s(%ld)\n", (long) operand1);
push (operand1);
break;
case DW_OP_const4s:
if (operand1 & 0x80000000)
operand1 |= (((unw_word_t) -1) << 16) << 16;
Debug (15, "OP_const4s(%ld)\n", (long) operand1);
push (operand1);
break;
case DW_OP_deref:
Debug (15, "OP_deref\n");
tmp1 = pop ();
if ((ret = dwarf_readw (as, a, &tmp1, &tmp2, arg)) < 0)
return ret;
push (tmp2);
break;
case DW_OP_deref_size:
Debug (15, "OP_deref_size(%d)\n", (int) operand1);
tmp1 = pop ();
switch (operand1)
{
default:
Debug (1, "Unexpected DW_OP_deref_size size %d\n",
(int) operand1);
return -UNW_EINVAL;
case 1:
if ((ret = dwarf_readu8 (as, a, &tmp1, &u8, arg)) < 0)
return ret;
tmp2 = u8;
break;
case 2:
if ((ret = dwarf_readu16 (as, a, &tmp1, &u16, arg)) < 0)
return ret;
tmp2 = u16;
break;
case 3:
case 4:
if ((ret = dwarf_readu32 (as, a, &tmp1, &u32, arg)) < 0)
return ret;
tmp2 = u32;
if (operand1 == 3)
{
if (dwarf_is_big_endian (as))
tmp2 >>= 8;
else
tmp2 &= 0xffffff;
}
break;
case 5:
case 6:
case 7:
case 8:
if ((ret = dwarf_readu64 (as, a, &tmp1, &u64, arg)) < 0)
return ret;
tmp2 = u64;
if (operand1 != 8)
{
if (dwarf_is_big_endian (as))
tmp2 >>= 64 - 8 * operand1;
else
tmp2 &= (~ (unw_word_t) 0) << (8 * operand1);
}
break;
}
push (tmp2);
break;
case DW_OP_dup:
Debug (15, "OP_dup\n");
push (pick (0));
break;
case DW_OP_drop:
Debug (15, "OP_drop\n");
(void) pop ();
break;
case DW_OP_pick:
Debug (15, "OP_pick(%d)\n", (int) operand1);
push (pick (operand1));
break;
case DW_OP_over:
Debug (15, "OP_over\n");
push (pick (1));
break;
case DW_OP_swap:
Debug (15, "OP_swap\n");
tmp1 = pop ();
tmp2 = pop ();
push (tmp1);
push (tmp2);
break;
case DW_OP_rot:
Debug (15, "OP_rot\n");
tmp1 = pop ();
tmp2 = pop ();
tmp3 = pop ();
push (tmp1);
push (tmp3);
push (tmp2);
break;
case DW_OP_abs:
Debug (15, "OP_abs\n");
tmp1 = pop ();
if (tmp1 & ((unw_word_t) 1 << (8 * dwarf_addr_size (as) - 1)))
tmp1 = -tmp1;
push (tmp1);
break;
case DW_OP_and:
Debug (15, "OP_and\n");
tmp1 = pop ();
tmp2 = pop ();
push (tmp1 & tmp2);
break;
case DW_OP_div:
Debug (15, "OP_div\n");
tmp1 = pop ();
tmp2 = pop ();
if (tmp1)
tmp1 = sword (as, tmp2) / sword (as, tmp1);
push (tmp1);
break;
case DW_OP_minus:
Debug (15, "OP_minus\n");
tmp1 = pop ();
tmp2 = pop ();
tmp1 = tmp2 - tmp1;
push (tmp1);
break;
case DW_OP_mod:
Debug (15, "OP_mod\n");
tmp1 = pop ();
tmp2 = pop ();
if (tmp1)
tmp1 = tmp2 % tmp1;
push (tmp1);
break;
case DW_OP_mul:
Debug (15, "OP_mul\n");
tmp1 = pop ();
tmp2 = pop ();
if (tmp1)
tmp1 = tmp2 * tmp1;
push (tmp1);
break;
case DW_OP_neg:
Debug (15, "OP_neg\n");
push (-pop ());
break;
case DW_OP_not:
Debug (15, "OP_not\n");
push (~pop ());
break;
case DW_OP_or:
Debug (15, "OP_or\n");
tmp1 = pop ();
tmp2 = pop ();
push (tmp1 | tmp2);
break;
case DW_OP_plus:
Debug (15, "OP_plus\n");
tmp1 = pop ();
tmp2 = pop ();
push (tmp1 + tmp2);
break;
case DW_OP_plus_uconst:
Debug (15, "OP_plus_uconst(%lu)\n", (unsigned long) operand1);
tmp1 = pop ();
push (tmp1 + operand1);
break;
case DW_OP_shl:
Debug (15, "OP_shl\n");
tmp1 = pop ();
tmp2 = pop ();
push (tmp2 << tmp1);
break;
case DW_OP_shr:
Debug (15, "OP_shr\n");
tmp1 = pop ();
tmp2 = pop ();
push (tmp2 >> tmp1);
break;
case DW_OP_shra:
Debug (15, "OP_shra\n");
tmp1 = pop ();
tmp2 = pop ();
push (sword (as, tmp2) >> tmp1);
break;
case DW_OP_xor:
Debug (15, "OP_xor\n");
tmp1 = pop ();
tmp2 = pop ();
push (tmp1 ^ tmp2);
break;
case DW_OP_le:
Debug (15, "OP_le\n");
tmp1 = pop ();
tmp2 = pop ();
push (sword (as, tmp2) <= sword (as, tmp1));
break;
case DW_OP_ge:
Debug (15, "OP_ge\n");
tmp1 = pop ();
tmp2 = pop ();
push (sword (as, tmp2) >= sword (as, tmp1));
break;
case DW_OP_eq:
Debug (15, "OP_eq\n");
tmp1 = pop ();
tmp2 = pop ();
push (sword (as, tmp2) == sword (as, tmp1));
break;
case DW_OP_lt:
Debug (15, "OP_lt\n");
tmp1 = pop ();
tmp2 = pop ();
push (sword (as, tmp2) < sword (as, tmp1));
break;
case DW_OP_gt:
Debug (15, "OP_gt\n");
tmp1 = pop ();
tmp2 = pop ();
push (sword (as, tmp2) > sword (as, tmp1));
break;
case DW_OP_ne:
Debug (15, "OP_ne\n");
tmp1 = pop ();
tmp2 = pop ();
push (sword (as, tmp2) != sword (as, tmp1));
break;
case DW_OP_skip:
Debug (15, "OP_skip(%d)\n", (int16_t) operand1);
*addr += (int16_t) operand1;
break;
case DW_OP_bra:
Debug (15, "OP_skip(%d)\n", (int16_t) operand1);
tmp1 = pop ();
if (tmp1)
*addr += (int16_t) operand1;
break;
case DW_OP_nop:
Debug (15, "OP_nop\n");
break;
case DW_OP_call2:
case DW_OP_call4:
case DW_OP_call_ref:
case DW_OP_fbreg:
case DW_OP_piece:
case DW_OP_push_object_address:
case DW_OP_xderef:
case DW_OP_xderef_size:
default:
Debug (1, "Unexpected opcode 0x%x\n", opcode);
return -UNW_EINVAL;
}
}
*valp = pop ();
Debug (14, "final value = 0x%lx\n", (unsigned long) *valp);
return 0;
}
|
/* libunwind - a platform-independent unwind library
Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P.
Contributed by David Mosberger-Tang <[email protected]>
This file is part of libunwind.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h"
#include "libunwind_i.h"
/* The "pick" operator provides an index range of 0..255 indicating
that the stack could at least have a depth of up to 256 elements,
but the GCC unwinder restricts the depth to 64, which seems
reasonable so we use the same value here. */
#define MAX_EXPR_STACK_SIZE 64
#define NUM_OPERANDS(signature) (((signature) >> 6) & 0x3)
#define OPND1_TYPE(signature) (((signature) >> 3) & 0x7)
#define OPND2_TYPE(signature) (((signature) >> 0) & 0x7)
#define OPND_SIGNATURE(n, t1, t2) (((n) << 6) | ((t1) << 3) | ((t2) << 0))
#define OPND1(t1) OPND_SIGNATURE(1, t1, 0)
#define OPND2(t1, t2) OPND_SIGNATURE(2, t1, t2)
#define VAL8 0x0
#define VAL16 0x1
#define VAL32 0x2
#define VAL64 0x3
#define ULEB128 0x4
#define SLEB128 0x5
#define OFFSET 0x6 /* 32-bit offset for 32-bit DWARF, 64-bit otherwise */
#define ADDR 0x7 /* Machine address. */
static const uint8_t operands[256] =
{
[DW_OP_addr] = OPND1 (ADDR),
[DW_OP_const1u] = OPND1 (VAL8),
[DW_OP_const1s] = OPND1 (VAL8),
[DW_OP_const2u] = OPND1 (VAL16),
[DW_OP_const2s] = OPND1 (VAL16),
[DW_OP_const4u] = OPND1 (VAL32),
[DW_OP_const4s] = OPND1 (VAL32),
[DW_OP_const8u] = OPND1 (VAL64),
[DW_OP_const8s] = OPND1 (VAL64),
[DW_OP_constu] = OPND1 (ULEB128),
[DW_OP_consts] = OPND1 (SLEB128),
[DW_OP_pick] = OPND1 (VAL8),
[DW_OP_plus_uconst] = OPND1 (ULEB128),
[DW_OP_skip] = OPND1 (VAL16),
[DW_OP_bra] = OPND1 (VAL16),
[DW_OP_breg0 + 0] = OPND1 (SLEB128),
[DW_OP_breg0 + 1] = OPND1 (SLEB128),
[DW_OP_breg0 + 2] = OPND1 (SLEB128),
[DW_OP_breg0 + 3] = OPND1 (SLEB128),
[DW_OP_breg0 + 4] = OPND1 (SLEB128),
[DW_OP_breg0 + 5] = OPND1 (SLEB128),
[DW_OP_breg0 + 6] = OPND1 (SLEB128),
[DW_OP_breg0 + 7] = OPND1 (SLEB128),
[DW_OP_breg0 + 8] = OPND1 (SLEB128),
[DW_OP_breg0 + 9] = OPND1 (SLEB128),
[DW_OP_breg0 + 10] = OPND1 (SLEB128),
[DW_OP_breg0 + 11] = OPND1 (SLEB128),
[DW_OP_breg0 + 12] = OPND1 (SLEB128),
[DW_OP_breg0 + 13] = OPND1 (SLEB128),
[DW_OP_breg0 + 14] = OPND1 (SLEB128),
[DW_OP_breg0 + 15] = OPND1 (SLEB128),
[DW_OP_breg0 + 16] = OPND1 (SLEB128),
[DW_OP_breg0 + 17] = OPND1 (SLEB128),
[DW_OP_breg0 + 18] = OPND1 (SLEB128),
[DW_OP_breg0 + 19] = OPND1 (SLEB128),
[DW_OP_breg0 + 20] = OPND1 (SLEB128),
[DW_OP_breg0 + 21] = OPND1 (SLEB128),
[DW_OP_breg0 + 22] = OPND1 (SLEB128),
[DW_OP_breg0 + 23] = OPND1 (SLEB128),
[DW_OP_breg0 + 24] = OPND1 (SLEB128),
[DW_OP_breg0 + 25] = OPND1 (SLEB128),
[DW_OP_breg0 + 26] = OPND1 (SLEB128),
[DW_OP_breg0 + 27] = OPND1 (SLEB128),
[DW_OP_breg0 + 28] = OPND1 (SLEB128),
[DW_OP_breg0 + 29] = OPND1 (SLEB128),
[DW_OP_breg0 + 30] = OPND1 (SLEB128),
[DW_OP_breg0 + 31] = OPND1 (SLEB128),
[DW_OP_regx] = OPND1 (ULEB128),
[DW_OP_fbreg] = OPND1 (SLEB128),
[DW_OP_bregx] = OPND2 (ULEB128, SLEB128),
[DW_OP_piece] = OPND1 (ULEB128),
[DW_OP_deref_size] = OPND1 (VAL8),
[DW_OP_xderef_size] = OPND1 (VAL8),
[DW_OP_call2] = OPND1 (VAL16),
[DW_OP_call4] = OPND1 (VAL32),
[DW_OP_call_ref] = OPND1 (OFFSET)
};
static inline unw_sword_t
sword (unw_addr_space_t as, unw_word_t val)
{
switch (dwarf_addr_size (as))
{
case 1: return (int8_t) val;
case 2: return (int16_t) val;
case 4: return (int32_t) val;
case 8: return (int64_t) val;
default: abort ();
}
}
static inline unw_word_t
read_operand (unw_addr_space_t as, unw_accessors_t *a,
unw_word_t *addr, int operand_type, unw_word_t *val, void *arg)
{
uint8_t u8;
uint16_t u16;
uint32_t u32;
uint64_t u64;
int ret;
if (operand_type == ADDR)
switch (dwarf_addr_size (as))
{
case 1: operand_type = VAL8; break;
case 2: operand_type = VAL16; break;
case 4: operand_type = VAL32; break;
case 8: operand_type = VAL64; break;
default: abort ();
}
switch (operand_type)
{
case VAL8:
ret = dwarf_readu8 (as, a, addr, &u8, arg);
if (ret < 0)
return ret;
*val = u8;
break;
case VAL16:
ret = dwarf_readu16 (as, a, addr, &u16, arg);
if (ret < 0)
return ret;
*val = u16;
break;
case VAL32:
ret = dwarf_readu32 (as, a, addr, &u32, arg);
if (ret < 0)
return ret;
*val = u32;
break;
case VAL64:
ret = dwarf_readu64 (as, a, addr, &u64, arg);
if (ret < 0)
return ret;
*val = u64;
break;
case ULEB128:
ret = dwarf_read_uleb128 (as, a, addr, val, arg);
break;
case SLEB128:
ret = dwarf_read_sleb128 (as, a, addr, val, arg);
break;
case OFFSET: /* only used by DW_OP_call_ref, which we don't implement */
default:
Debug (1, "Unexpected operand type %d\n", operand_type);
ret = -UNW_EINVAL;
}
return ret;
}
HIDDEN int
dwarf_stack_aligned(struct dwarf_cursor *c, unw_word_t cfa_addr,
unw_word_t rbp_addr, unw_word_t *cfa_offset) {
unw_accessors_t *a;
int ret;
void *arg;
unw_word_t len;
uint8_t opcode;
unw_word_t operand1;
a = unw_get_accessors_int (c->as);
arg = c->as_arg;
ret = dwarf_read_uleb128(c->as, a, &rbp_addr, &len, arg);
if (len != 2 || ret < 0)
return 0;
ret = dwarf_readu8(c->as, a, &rbp_addr, &opcode, arg);
if (ret < 0 || opcode != DW_OP_breg6)
return 0;
ret = read_operand(c->as, a, &rbp_addr,
OPND1_TYPE(operands[opcode]), &operand1, arg);
if (ret < 0 || operand1 != 0)
return 0;
ret = dwarf_read_uleb128(c->as, a, &cfa_addr, &len, arg);
if (ret < 0 || len != 3)
return 0;
ret = dwarf_readu8(c->as, a, &cfa_addr, &opcode, arg);
if (ret < 0 || opcode != DW_OP_breg6)
return 0;
ret = read_operand(c->as, a, &cfa_addr,
OPND1_TYPE(operands[opcode]), &operand1, arg);
if (ret < 0)
return 0;
ret = dwarf_readu8(c->as, a, &cfa_addr, &opcode, arg);
if (ret < 0 || opcode != DW_OP_deref)
return 0;
*cfa_offset = operand1;
return 1;
}
HIDDEN int
dwarf_eval_expr (struct dwarf_cursor *c, unw_word_t stack_val, unw_word_t *addr,
unw_word_t len, unw_word_t *valp, int *is_register)
{
unw_word_t operand1 = 0, operand2 = 0, tmp1, tmp2 = 0, tmp3, end_addr;
uint8_t opcode, operands_signature, u8;
unw_addr_space_t as;
unw_accessors_t *a;
void *arg;
unw_word_t stack[MAX_EXPR_STACK_SIZE];
unsigned int tos = 0;
uint16_t u16;
uint32_t u32;
uint64_t u64;
int ret;
unw_word_t stackerror = 0;
// pop() is either followed by a semicolon or
// used in a push() macro
// In either case we can sneak in an extra statement
# define pop() \
(((tos - 1) >= MAX_EXPR_STACK_SIZE) ? \
stackerror++ : stack[--tos]); \
if (stackerror) \
{ \
Debug (1, "Stack underflow\n"); \
return -UNW_EINVAL; \
}
// Removed the parentheses on the asignment
// to allow the extra stack error check
// when x is evaluated
# define push(x) \
do { \
unw_word_t _x = x; \
if (tos >= MAX_EXPR_STACK_SIZE) \
{ \
Debug (1, "Stack overflow\n"); \
return -UNW_EINVAL; \
} \
stack[tos++] = _x; \
} while (0)
// Pick is always used in a push() macro
// In either case we can sneak in an extra statement
# define pick(n) \
(((tos - 1 - (n)) >= MAX_EXPR_STACK_SIZE) ? \
stackerror++ : stack[tos - 1 - (n)]); \
if (stackerror) \
{ \
Debug (1, "Out-of-stack pick\n"); \
return -UNW_EINVAL; \
}
as = c->as;
arg = c->as_arg;
a = unw_get_accessors_int (as);
end_addr = *addr + len;
*is_register = 0;
Debug (14, "len=%lu, pushing initial value=0x%lx\n",
(unsigned long) len, (unsigned long) stack_val);
/* The DWARF standard requires the current CFA to be pushed onto the stack */
/* before evaluating DW_CFA_expression and DW_CFA_val_expression programs. */
/* DW_CFA_def_cfa_expressions do not take an initial value, but we push on */
/* a dummy value to keep this logic consistent. */
push (stack_val);
while (*addr < end_addr)
{
if ((ret = dwarf_readu8 (as, a, addr, &opcode, arg)) < 0)
return ret;
operands_signature = operands[opcode];
if (unlikely (NUM_OPERANDS (operands_signature) > 0))
{
if ((ret = read_operand (as, a, addr,
OPND1_TYPE (operands_signature),
&operand1, arg)) < 0)
return ret;
if (NUM_OPERANDS (operands_signature) > 1)
if ((ret = read_operand (as, a, addr,
OPND2_TYPE (operands_signature),
&operand2, arg)) < 0)
return ret;
}
switch ((dwarf_expr_op_t) opcode)
{
case DW_OP_lit0: case DW_OP_lit1: case DW_OP_lit2:
case DW_OP_lit3: case DW_OP_lit4: case DW_OP_lit5:
case DW_OP_lit6: case DW_OP_lit7: case DW_OP_lit8:
case DW_OP_lit9: case DW_OP_lit10: case DW_OP_lit11:
case DW_OP_lit12: case DW_OP_lit13: case DW_OP_lit14:
case DW_OP_lit15: case DW_OP_lit16: case DW_OP_lit17:
case DW_OP_lit18: case DW_OP_lit19: case DW_OP_lit20:
case DW_OP_lit21: case DW_OP_lit22: case DW_OP_lit23:
case DW_OP_lit24: case DW_OP_lit25: case DW_OP_lit26:
case DW_OP_lit27: case DW_OP_lit28: case DW_OP_lit29:
case DW_OP_lit30: case DW_OP_lit31:
Debug (15, "OP_lit(%d)\n", (int) opcode - DW_OP_lit0);
push (opcode - DW_OP_lit0);
break;
case DW_OP_breg0: case DW_OP_breg1: case DW_OP_breg2:
case DW_OP_breg3: case DW_OP_breg4: case DW_OP_breg5:
case DW_OP_breg6: case DW_OP_breg7: case DW_OP_breg8:
case DW_OP_breg9: case DW_OP_breg10: case DW_OP_breg11:
case DW_OP_breg12: case DW_OP_breg13: case DW_OP_breg14:
case DW_OP_breg15: case DW_OP_breg16: case DW_OP_breg17:
case DW_OP_breg18: case DW_OP_breg19: case DW_OP_breg20:
case DW_OP_breg21: case DW_OP_breg22: case DW_OP_breg23:
case DW_OP_breg24: case DW_OP_breg25: case DW_OP_breg26:
case DW_OP_breg27: case DW_OP_breg28: case DW_OP_breg29:
case DW_OP_breg30: case DW_OP_breg31:
Debug (15, "OP_breg(r%d,0x%lx)\n",
(int) opcode - DW_OP_breg0, (unsigned long) operand1);
if ((ret = unw_get_reg (dwarf_to_cursor (c),
dwarf_to_unw_regnum (opcode - DW_OP_breg0),
&tmp1)) < 0)
return ret;
push (tmp1 + operand1);
break;
case DW_OP_bregx:
Debug (15, "OP_bregx(r%d,0x%lx)\n",
(int) operand1, (unsigned long) operand2);
if ((ret = unw_get_reg (dwarf_to_cursor (c),
dwarf_to_unw_regnum (operand1), &tmp1)) < 0)
return ret;
push (tmp1 + operand2);
break;
case DW_OP_reg0: case DW_OP_reg1: case DW_OP_reg2:
case DW_OP_reg3: case DW_OP_reg4: case DW_OP_reg5:
case DW_OP_reg6: case DW_OP_reg7: case DW_OP_reg8:
case DW_OP_reg9: case DW_OP_reg10: case DW_OP_reg11:
case DW_OP_reg12: case DW_OP_reg13: case DW_OP_reg14:
case DW_OP_reg15: case DW_OP_reg16: case DW_OP_reg17:
case DW_OP_reg18: case DW_OP_reg19: case DW_OP_reg20:
case DW_OP_reg21: case DW_OP_reg22: case DW_OP_reg23:
case DW_OP_reg24: case DW_OP_reg25: case DW_OP_reg26:
case DW_OP_reg27: case DW_OP_reg28: case DW_OP_reg29:
case DW_OP_reg30: case DW_OP_reg31:
Debug (15, "OP_reg(r%d)\n", (int) opcode - DW_OP_reg0);
*valp = dwarf_to_unw_regnum (opcode - DW_OP_reg0);
*is_register = 1;
return 0;
case DW_OP_regx:
Debug (15, "OP_regx(r%d)\n", (int) operand1);
*valp = dwarf_to_unw_regnum (operand1);
*is_register = 1;
return 0;
case DW_OP_addr:
case DW_OP_const1u:
case DW_OP_const2u:
case DW_OP_const4u:
case DW_OP_const8u:
case DW_OP_constu:
case DW_OP_const8s:
case DW_OP_consts:
Debug (15, "OP_const(0x%lx)\n", (unsigned long) operand1);
push (operand1);
break;
case DW_OP_const1s:
if (operand1 & 0x80)
operand1 |= ((unw_word_t) -1) << 8;
Debug (15, "OP_const1s(%ld)\n", (long) operand1);
push (operand1);
break;
case DW_OP_const2s:
if (operand1 & 0x8000)
operand1 |= ((unw_word_t) -1) << 16;
Debug (15, "OP_const2s(%ld)\n", (long) operand1);
push (operand1);
break;
case DW_OP_const4s:
if (operand1 & 0x80000000)
operand1 |= (((unw_word_t) -1) << 16) << 16;
Debug (15, "OP_const4s(%ld)\n", (long) operand1);
push (operand1);
break;
case DW_OP_deref:
Debug (15, "OP_deref\n");
tmp1 = pop ();
if ((ret = dwarf_readw (as, a, &tmp1, &tmp2, arg)) < 0)
return ret;
push (tmp2);
break;
case DW_OP_deref_size:
Debug (15, "OP_deref_size(%d)\n", (int) operand1);
tmp1 = pop ();
switch (operand1)
{
default:
Debug (1, "Unexpected DW_OP_deref_size size %d\n",
(int) operand1);
return -UNW_EINVAL;
case 1:
if ((ret = dwarf_readu8 (as, a, &tmp1, &u8, arg)) < 0)
return ret;
tmp2 = u8;
break;
case 2:
if ((ret = dwarf_readu16 (as, a, &tmp1, &u16, arg)) < 0)
return ret;
tmp2 = u16;
break;
case 3:
case 4:
if ((ret = dwarf_readu32 (as, a, &tmp1, &u32, arg)) < 0)
return ret;
tmp2 = u32;
if (operand1 == 3)
{
if (dwarf_is_big_endian (as))
tmp2 >>= 8;
else
tmp2 &= 0xffffff;
}
break;
case 5:
case 6:
case 7:
case 8:
if ((ret = dwarf_readu64 (as, a, &tmp1, &u64, arg)) < 0)
return ret;
tmp2 = u64;
if (operand1 != 8)
{
if (dwarf_is_big_endian (as))
tmp2 >>= 64 - 8 * operand1;
else
tmp2 &= (~ (unw_word_t) 0) << (8 * operand1);
}
break;
}
push (tmp2);
break;
case DW_OP_dup:
Debug (15, "OP_dup\n");
push (pick (0));
break;
case DW_OP_drop:
Debug (15, "OP_drop\n");
(void) pop ();
break;
case DW_OP_pick:
Debug (15, "OP_pick(%d)\n", (int) operand1);
push (pick (operand1));
break;
case DW_OP_over:
Debug (15, "OP_over\n");
push (pick (1));
break;
case DW_OP_swap:
Debug (15, "OP_swap\n");
tmp1 = pop ();
tmp2 = pop ();
push (tmp1);
push (tmp2);
break;
case DW_OP_rot:
Debug (15, "OP_rot\n");
tmp1 = pop ();
tmp2 = pop ();
tmp3 = pop ();
push (tmp1);
push (tmp3);
push (tmp2);
break;
case DW_OP_abs:
Debug (15, "OP_abs\n");
tmp1 = pop ();
if (tmp1 & ((unw_word_t) 1 << (8 * dwarf_addr_size (as) - 1)))
tmp1 = (unw_word_t)(-(unw_sword_t)tmp1);
push (tmp1);
break;
case DW_OP_and:
Debug (15, "OP_and\n");
tmp1 = pop ();
tmp2 = pop ();
push (tmp1 & tmp2);
break;
case DW_OP_div:
Debug (15, "OP_div\n");
tmp1 = pop ();
tmp2 = pop ();
if (tmp1)
tmp1 = sword (as, tmp2) / sword (as, tmp1);
push (tmp1);
break;
case DW_OP_minus:
Debug (15, "OP_minus\n");
tmp1 = pop ();
tmp2 = pop ();
tmp1 = tmp2 - tmp1;
push (tmp1);
break;
case DW_OP_mod:
Debug (15, "OP_mod\n");
tmp1 = pop ();
tmp2 = pop ();
if (tmp1)
tmp1 = tmp2 % tmp1;
push (tmp1);
break;
case DW_OP_mul:
Debug (15, "OP_mul\n");
tmp1 = pop ();
tmp2 = pop ();
if (tmp1)
tmp1 = tmp2 * tmp1;
push (tmp1);
break;
case DW_OP_neg:
Debug (15, "OP_neg\n");
push (-(unw_sword_t)pop ());
break;
case DW_OP_not:
Debug (15, "OP_not\n");
push (~pop ());
break;
case DW_OP_or:
Debug (15, "OP_or\n");
tmp1 = pop ();
tmp2 = pop ();
push (tmp1 | tmp2);
break;
case DW_OP_plus:
Debug (15, "OP_plus\n");
tmp1 = pop ();
tmp2 = pop ();
push (tmp1 + tmp2);
break;
case DW_OP_plus_uconst:
Debug (15, "OP_plus_uconst(%lu)\n", (unsigned long) operand1);
tmp1 = pop ();
push (tmp1 + operand1);
break;
case DW_OP_shl:
Debug (15, "OP_shl\n");
tmp1 = pop ();
tmp2 = pop ();
push (tmp2 << tmp1);
break;
case DW_OP_shr:
Debug (15, "OP_shr\n");
tmp1 = pop ();
tmp2 = pop ();
push (tmp2 >> tmp1);
break;
case DW_OP_shra:
Debug (15, "OP_shra\n");
tmp1 = pop ();
tmp2 = pop ();
push (sword (as, tmp2) >> tmp1);
break;
case DW_OP_xor:
Debug (15, "OP_xor\n");
tmp1 = pop ();
tmp2 = pop ();
push (tmp1 ^ tmp2);
break;
case DW_OP_le:
Debug (15, "OP_le\n");
tmp1 = pop ();
tmp2 = pop ();
push (sword (as, tmp2) <= sword (as, tmp1));
break;
case DW_OP_ge:
Debug (15, "OP_ge\n");
tmp1 = pop ();
tmp2 = pop ();
push (sword (as, tmp2) >= sword (as, tmp1));
break;
case DW_OP_eq:
Debug (15, "OP_eq\n");
tmp1 = pop ();
tmp2 = pop ();
push (sword (as, tmp2) == sword (as, tmp1));
break;
case DW_OP_lt:
Debug (15, "OP_lt\n");
tmp1 = pop ();
tmp2 = pop ();
push (sword (as, tmp2) < sword (as, tmp1));
break;
case DW_OP_gt:
Debug (15, "OP_gt\n");
tmp1 = pop ();
tmp2 = pop ();
push (sword (as, tmp2) > sword (as, tmp1));
break;
case DW_OP_ne:
Debug (15, "OP_ne\n");
tmp1 = pop ();
tmp2 = pop ();
push (sword (as, tmp2) != sword (as, tmp1));
break;
case DW_OP_skip:
Debug (15, "OP_skip(%d)\n", (int16_t) operand1);
*addr += (int16_t) operand1;
break;
case DW_OP_bra:
Debug (15, "OP_skip(%d)\n", (int16_t) operand1);
tmp1 = pop ();
if (tmp1)
*addr += (int16_t) operand1;
break;
case DW_OP_nop:
Debug (15, "OP_nop\n");
break;
case DW_OP_call2:
case DW_OP_call4:
case DW_OP_call_ref:
case DW_OP_fbreg:
case DW_OP_piece:
case DW_OP_push_object_address:
case DW_OP_xderef:
case DW_OP_xderef_size:
default:
Debug (1, "Unexpected opcode 0x%x\n", opcode);
return -UNW_EINVAL;
}
}
*valp = pop ();
Debug (14, "final value = 0x%lx\n", (unsigned long) *valp);
return 0;
}
| 1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/coreclr/pal/src/libunwind/src/dwarf/Gparser.c
|
/* libunwind - a platform-independent unwind library
Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P.
Contributed by David Mosberger-Tang <[email protected]>
This file is part of libunwind.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h"
#include "libunwind_i.h"
#include <stddef.h>
#include <limits.h>
#define alloc_reg_state() (mempool_alloc (&dwarf_reg_state_pool))
#define free_reg_state(rs) (mempool_free (&dwarf_reg_state_pool, rs))
#define DWARF_UNW_CACHE_SIZE(log_size) (1 << log_size)
#define DWARF_UNW_HASH_SIZE(log_size) (1 << (log_size + 1))
static inline int
read_regnum (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
unw_word_t *valp, void *arg)
{
int ret;
if ((ret = dwarf_read_uleb128 (as, a, addr, valp, arg)) < 0)
return ret;
if (*valp >= DWARF_NUM_PRESERVED_REGS)
{
Debug (1, "Invalid register number %u\n", (unsigned int) *valp);
return -UNW_EBADREG;
}
return 0;
}
static inline void
set_reg (dwarf_state_record_t *sr, unw_word_t regnum, dwarf_where_t where,
unw_word_t val)
{
sr->rs_current.reg.where[regnum] = where;
sr->rs_current.reg.val[regnum] = val;
}
static inline int
push_rstate_stack(dwarf_stackable_reg_state_t **rs_stack)
{
dwarf_stackable_reg_state_t *old_rs = *rs_stack;
if (NULL == (*rs_stack = alloc_reg_state ()))
{
*rs_stack = old_rs;
return -1;
}
(*rs_stack)->next = old_rs;
return 0;
}
static inline void
pop_rstate_stack(dwarf_stackable_reg_state_t **rs_stack)
{
dwarf_stackable_reg_state_t *old_rs = *rs_stack;
*rs_stack = old_rs->next;
free_reg_state (old_rs);
}
static inline void
empty_rstate_stack(dwarf_stackable_reg_state_t **rs_stack)
{
while (*rs_stack)
pop_rstate_stack(rs_stack);
}
/* Run a CFI program to update the register state. */
static int
run_cfi_program (struct dwarf_cursor *c, dwarf_state_record_t *sr,
unw_word_t *ip, unw_word_t end_ip,
unw_word_t *addr, unw_word_t end_addr,
dwarf_stackable_reg_state_t **rs_stack,
struct dwarf_cie_info *dci)
{
unw_addr_space_t as;
void *arg;
if (c->pi.flags & UNW_PI_FLAG_DEBUG_FRAME)
{
/* .debug_frame CFI is stored in local address space. */
as = unw_local_addr_space;
arg = NULL;
}
else
{
as = c->as;
arg = c->as_arg;
}
unw_accessors_t *a = unw_get_accessors_int (as);
int ret = 0;
while (*ip <= end_ip && *addr < end_addr && ret >= 0)
{
unw_word_t operand = 0, regnum, val, len;
uint8_t u8, op;
uint16_t u16;
uint32_t u32;
if ((ret = dwarf_readu8 (as, a, addr, &op, arg)) < 0)
break;
if (op & DWARF_CFA_OPCODE_MASK)
{
operand = op & DWARF_CFA_OPERAND_MASK;
op &= ~DWARF_CFA_OPERAND_MASK;
}
switch ((dwarf_cfa_t) op)
{
case DW_CFA_advance_loc:
*ip += operand * dci->code_align;
Debug (15, "CFA_advance_loc to 0x%lx\n", (long) *ip);
break;
case DW_CFA_advance_loc1:
if ((ret = dwarf_readu8 (as, a, addr, &u8, arg)) < 0)
break;
*ip += u8 * dci->code_align;
Debug (15, "CFA_advance_loc1 to 0x%lx\n", (long) *ip);
break;
case DW_CFA_advance_loc2:
if ((ret = dwarf_readu16 (as, a, addr, &u16, arg)) < 0)
break;
*ip += u16 * dci->code_align;
Debug (15, "CFA_advance_loc2 to 0x%lx\n", (long) *ip);
break;
case DW_CFA_advance_loc4:
if ((ret = dwarf_readu32 (as, a, addr, &u32, arg)) < 0)
break;
*ip += u32 * dci->code_align;
Debug (15, "CFA_advance_loc4 to 0x%lx\n", (long) *ip);
break;
case DW_CFA_MIPS_advance_loc8:
#ifdef UNW_TARGET_MIPS
{
uint64_t u64 = 0;
if ((ret = dwarf_readu64 (as, a, addr, &u64, arg)) < 0)
break;
*ip += u64 * dci->code_align;
Debug (15, "CFA_MIPS_advance_loc8\n");
break;
}
#else
Debug (1, "DW_CFA_MIPS_advance_loc8 on non-MIPS target\n");
ret = -UNW_EINVAL;
break;
#endif
case DW_CFA_offset:
regnum = operand;
if (regnum >= DWARF_NUM_PRESERVED_REGS)
{
Debug (1, "Invalid register number %u in DW_cfa_OFFSET\n",
(unsigned int) regnum);
ret = -UNW_EBADREG;
break;
}
if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)
break;
set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align);
Debug (15, "CFA_offset r%lu at cfa+0x%lx\n",
(long) regnum, (long) (val * dci->data_align));
break;
case DW_CFA_offset_extended:
if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
|| ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0))
break;
set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align);
Debug (15, "CFA_offset_extended r%lu at cf+0x%lx\n",
(long) regnum, (long) (val * dci->data_align));
break;
case DW_CFA_offset_extended_sf:
if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
|| ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0))
break;
set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align);
Debug (15, "CFA_offset_extended_sf r%lu at cf+0x%lx\n",
(long) regnum, (long) (val * dci->data_align));
break;
case DW_CFA_restore:
regnum = operand;
if (regnum >= DWARF_NUM_PRESERVED_REGS)
{
Debug (1, "Invalid register number %u in DW_CFA_restore\n",
(unsigned int) regnum);
ret = -UNW_EINVAL;
break;
}
sr->rs_current.reg.where[regnum] = sr->rs_initial.reg.where[regnum];
sr->rs_current.reg.val[regnum] = sr->rs_initial.reg.val[regnum];
Debug (15, "CFA_restore r%lu\n", (long) regnum);
break;
case DW_CFA_restore_extended:
if ((ret = dwarf_read_uleb128 (as, a, addr, ®num, arg)) < 0)
break;
if (regnum >= DWARF_NUM_PRESERVED_REGS)
{
Debug (1, "Invalid register number %u in "
"DW_CFA_restore_extended\n", (unsigned int) regnum);
ret = -UNW_EINVAL;
break;
}
sr->rs_current.reg.where[regnum] = sr->rs_initial.reg.where[regnum];
sr->rs_current.reg.val[regnum] = sr->rs_initial.reg.val[regnum];
Debug (15, "CFA_restore_extended r%lu\n", (long) regnum);
break;
case DW_CFA_nop:
break;
case DW_CFA_set_loc:
if ((ret = dwarf_read_encoded_pointer (as, a, addr, dci->fde_encoding,
&c->pi, ip,
arg)) < 0)
break;
Debug (15, "CFA_set_loc to 0x%lx\n", (long) *ip);
break;
case DW_CFA_undefined:
if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
break;
set_reg (sr, regnum, DWARF_WHERE_UNDEF, 0);
Debug (15, "CFA_undefined r%lu\n", (long) regnum);
break;
case DW_CFA_same_value:
if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
break;
set_reg (sr, regnum, DWARF_WHERE_SAME, 0);
Debug (15, "CFA_same_value r%lu\n", (long) regnum);
break;
case DW_CFA_register:
if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
|| ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0))
break;
set_reg (sr, regnum, DWARF_WHERE_REG, val);
Debug (15, "CFA_register r%lu to r%lu\n", (long) regnum, (long) val);
break;
case DW_CFA_remember_state:
if (push_rstate_stack(rs_stack) < 0)
{
Debug (1, "Out of memory in DW_CFA_remember_state\n");
ret = -UNW_ENOMEM;
break;
}
(*rs_stack)->state = sr->rs_current;
Debug (15, "CFA_remember_state\n");
break;
case DW_CFA_restore_state:
if (!*rs_stack)
{
Debug (1, "register-state stack underflow\n");
ret = -UNW_EINVAL;
break;
}
sr->rs_current = (*rs_stack)->state;
pop_rstate_stack(rs_stack);
Debug (15, "CFA_restore_state\n");
break;
case DW_CFA_def_cfa:
if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
|| ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0))
break;
set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum);
set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, val); /* NOT factored! */
Debug (15, "CFA_def_cfa r%lu+0x%lx\n", (long) regnum, (long) val);
break;
case DW_CFA_def_cfa_sf:
if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
|| ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0))
break;
set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum);
set_reg (sr, DWARF_CFA_OFF_COLUMN, 0,
val * dci->data_align); /* factored! */
Debug (15, "CFA_def_cfa_sf r%lu+0x%lx\n",
(long) regnum, (long) (val * dci->data_align));
break;
case DW_CFA_def_cfa_register:
if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
break;
set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum);
Debug (15, "CFA_def_cfa_register r%lu\n", (long) regnum);
break;
case DW_CFA_def_cfa_offset:
if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)
break;
set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, val); /* NOT factored! */
Debug (15, "CFA_def_cfa_offset 0x%lx\n", (long) val);
break;
case DW_CFA_def_cfa_offset_sf:
if ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0)
break;
set_reg (sr, DWARF_CFA_OFF_COLUMN, 0,
val * dci->data_align); /* factored! */
Debug (15, "CFA_def_cfa_offset_sf 0x%lx\n",
(long) (val * dci->data_align));
break;
case DW_CFA_def_cfa_expression:
/* Save the address of the DW_FORM_block for later evaluation. */
set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_EXPR, *addr);
if ((ret = dwarf_read_uleb128 (as, a, addr, &len, arg)) < 0)
break;
Debug (15, "CFA_def_cfa_expr @ 0x%lx [%lu bytes]\n",
(long) *addr, (long) len);
*addr += len;
break;
case DW_CFA_expression:
if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
break;
/* Save the address of the DW_FORM_block for later evaluation. */
set_reg (sr, regnum, DWARF_WHERE_EXPR, *addr);
if ((ret = dwarf_read_uleb128 (as, a, addr, &len, arg)) < 0)
break;
Debug (15, "CFA_expression r%lu @ 0x%lx [%lu bytes]\n",
(long) regnum, (long) addr, (long) len);
*addr += len;
break;
case DW_CFA_val_expression:
if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
break;
/* Save the address of the DW_FORM_block for later evaluation. */
set_reg (sr, regnum, DWARF_WHERE_VAL_EXPR, *addr);
if ((ret = dwarf_read_uleb128 (as, a, addr, &len, arg)) < 0)
break;
Debug (15, "CFA_val_expression r%lu @ 0x%lx [%lu bytes]\n",
(long) regnum, (long) addr, (long) len);
*addr += len;
break;
case DW_CFA_GNU_args_size:
if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)
break;
sr->args_size = val;
Debug (15, "CFA_GNU_args_size %lu\n", (long) val);
break;
case DW_CFA_GNU_negative_offset_extended:
/* A comment in GCC says that this is obsoleted by
DW_CFA_offset_extended_sf, but that it's used by older
PowerPC code. */
if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
|| ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0))
break;
set_reg (sr, regnum, DWARF_WHERE_CFAREL, -(val * dci->data_align));
Debug (15, "CFA_GNU_negative_offset_extended cfa+0x%lx\n",
(long) -(val * dci->data_align));
break;
case DW_CFA_GNU_window_save:
#ifdef UNW_TARGET_SPARC
/* This is a special CFA to handle all 16 windowed registers
on SPARC. */
for (regnum = 16; regnum < 32; ++regnum)
set_reg (sr, regnum, DWARF_WHERE_CFAREL,
(regnum - 16) * sizeof (unw_word_t));
Debug (15, "CFA_GNU_window_save\n");
break;
#else
/* FALL THROUGH */
#endif
case DW_CFA_lo_user:
case DW_CFA_hi_user:
Debug (1, "Unexpected CFA opcode 0x%x\n", op);
ret = -UNW_EINVAL;
break;
}
}
if (ret > 0)
ret = 0;
return ret;
}
static int
fetch_proc_info (struct dwarf_cursor *c, unw_word_t ip)
{
int ret, dynamic = 1;
/* The 'ip' can point either to the previous or next instruction
depending on what type of frame we have: normal call or a place
to resume execution (e.g. after signal frame).
For a normal call frame we need to back up so we point within the
call itself; this is important because a) the call might be the
very last instruction of the function and the edge of the FDE,
and b) so that run_cfi_program() runs locations up to the call
but not more.
For signal frame, we need to do the exact opposite and look
up using the current 'ip' value. That is where execution will
continue, and it's important we get this right, as 'ip' could be
right at the function entry and hence FDE edge, or at instruction
that manipulates CFA (push/pop). */
if (c->use_prev_instr)
{
#if defined(__arm__)
/* On arm, the least bit denotes thumb/arm mode, clear it. */
ip &= ~(unw_word_t)0x1;
#endif
--ip;
}
memset (&c->pi, 0, sizeof (c->pi));
/* check dynamic info first --- it overrides everything else */
ret = unwi_find_dynamic_proc_info (c->as, ip, &c->pi, 1,
c->as_arg);
if (ret == -UNW_ENOINFO)
{
dynamic = 0;
if ((ret = tdep_find_proc_info (c, ip, 1)) < 0)
return ret;
}
if (c->pi.format != UNW_INFO_FORMAT_DYNAMIC
&& c->pi.format != UNW_INFO_FORMAT_TABLE
&& c->pi.format != UNW_INFO_FORMAT_REMOTE_TABLE)
return -UNW_ENOINFO;
c->pi_valid = 1;
c->pi_is_dynamic = dynamic;
/* Let system/machine-dependent code determine frame-specific attributes. */
if (ret >= 0)
tdep_fetch_frame (c, ip, 1);
return ret;
}
static int
parse_dynamic (struct dwarf_cursor *c, unw_word_t ip, dwarf_state_record_t *sr)
{
Debug (1, "Not yet implemented\n");
return -UNW_ENOINFO;
}
static inline void
put_unwind_info (struct dwarf_cursor *c, unw_proc_info_t *pi)
{
if (c->pi_is_dynamic)
unwi_put_dynamic_unwind_info (c->as, pi, c->as_arg);
else if (pi->unwind_info && pi->format == UNW_INFO_FORMAT_TABLE)
{
mempool_free (&dwarf_cie_info_pool, pi->unwind_info);
pi->unwind_info = NULL;
}
c->pi_valid = 0;
}
static inline int
setup_fde (struct dwarf_cursor *c, dwarf_state_record_t *sr)
{
int i, ret;
assert (c->pi_valid);
memset (sr, 0, sizeof (*sr));
for (i = 0; i < DWARF_NUM_PRESERVED_REGS + 2; ++i)
set_reg (sr, i, DWARF_WHERE_SAME, 0);
struct dwarf_cie_info *dci = c->pi.unwind_info;
sr->rs_current.ret_addr_column = dci->ret_addr_column;
unw_word_t addr = dci->cie_instr_start;
unw_word_t curr_ip = 0;
dwarf_stackable_reg_state_t *rs_stack = NULL;
ret = run_cfi_program (c, sr, &curr_ip, ~(unw_word_t) 0, &addr,
dci->cie_instr_end,
&rs_stack, dci);
empty_rstate_stack(&rs_stack);
if (ret < 0)
return ret;
memcpy (&sr->rs_initial, &sr->rs_current, sizeof (sr->rs_initial));
return 0;
}
static inline int
parse_fde (struct dwarf_cursor *c, unw_word_t ip, dwarf_state_record_t *sr)
{
int ret;
struct dwarf_cie_info *dci = c->pi.unwind_info;
unw_word_t addr = dci->fde_instr_start;
unw_word_t curr_ip = c->pi.start_ip;
dwarf_stackable_reg_state_t *rs_stack = NULL;
/* Process up to current `ip` for signal frame and `ip - 1` for normal call frame
See `c->use_prev_instr` use in `fetch_proc_info` for details. */
ret = run_cfi_program (c, sr, &curr_ip, ip - c->use_prev_instr, &addr, dci->fde_instr_end,
&rs_stack, dci);
empty_rstate_stack(&rs_stack);
if (ret < 0)
return ret;
return 0;
}
HIDDEN int
dwarf_flush_rs_cache (struct dwarf_rs_cache *cache)
{
int i;
if (cache->log_size == DWARF_DEFAULT_LOG_UNW_CACHE_SIZE
|| !cache->hash) {
cache->hash = cache->default_hash;
cache->buckets = cache->default_buckets;
cache->links = cache->default_links;
cache->log_size = DWARF_DEFAULT_LOG_UNW_CACHE_SIZE;
} else {
if (cache->hash && cache->hash != cache->default_hash)
munmap(cache->hash, DWARF_UNW_HASH_SIZE(cache->prev_log_size)
* sizeof (cache->hash[0]));
if (cache->buckets && cache->buckets != cache->default_buckets)
munmap(cache->buckets, DWARF_UNW_CACHE_SIZE(cache->prev_log_size)
* sizeof (cache->buckets[0]));
if (cache->links && cache->links != cache->default_links)
munmap(cache->links, DWARF_UNW_CACHE_SIZE(cache->prev_log_size)
* sizeof (cache->links[0]));
GET_MEMORY(cache->hash, DWARF_UNW_HASH_SIZE(cache->log_size)
* sizeof (cache->hash[0]));
GET_MEMORY(cache->buckets, DWARF_UNW_CACHE_SIZE(cache->log_size)
* sizeof (cache->buckets[0]));
GET_MEMORY(cache->links, DWARF_UNW_CACHE_SIZE(cache->log_size)
* sizeof (cache->links[0]));
if (!cache->hash || !cache->buckets || !cache->links)
{
Debug (1, "Unable to allocate cache memory");
return -UNW_ENOMEM;
}
cache->prev_log_size = cache->log_size;
}
cache->rr_head = 0;
for (i = 0; i < DWARF_UNW_CACHE_SIZE(cache->log_size); ++i)
{
cache->links[i].coll_chain = -1;
cache->links[i].ip = 0;
cache->links[i].valid = 0;
}
for (i = 0; i< DWARF_UNW_HASH_SIZE(cache->log_size); ++i)
cache->hash[i] = -1;
return 0;
}
static inline struct dwarf_rs_cache *
get_rs_cache (unw_addr_space_t as, intrmask_t *saved_maskp)
{
struct dwarf_rs_cache *cache = &as->global_cache;
unw_caching_policy_t caching = as->caching_policy;
if (caching == UNW_CACHE_NONE)
return NULL;
#if defined(HAVE___CACHE_PER_THREAD) && HAVE___CACHE_PER_THREAD
if (likely (caching == UNW_CACHE_PER_THREAD))
{
static _Thread_local struct dwarf_rs_cache tls_cache __attribute__((tls_model("initial-exec")));
Debug (16, "using TLS cache\n");
cache = &tls_cache;
}
else
#else
if (likely (caching == UNW_CACHE_GLOBAL))
#endif
{
Debug (16, "acquiring lock\n");
lock_acquire (&cache->lock, *saved_maskp);
}
if ((atomic_load (&as->cache_generation) != atomic_load (&cache->generation))
|| !cache->hash)
{
/* cache_size is only set in the global_cache, copy it over before flushing */
cache->log_size = as->global_cache.log_size;
if (dwarf_flush_rs_cache (cache) < 0)
return NULL;
atomic_store (&cache->generation, atomic_load (&as->cache_generation));
}
return cache;
}
static inline void
put_rs_cache (unw_addr_space_t as, struct dwarf_rs_cache *cache,
intrmask_t *saved_maskp)
{
assert (as->caching_policy != UNW_CACHE_NONE);
Debug (16, "unmasking signals/interrupts and releasing lock\n");
if (likely (as->caching_policy == UNW_CACHE_GLOBAL))
lock_release (&cache->lock, *saved_maskp);
}
static inline unw_hash_index_t CONST_ATTR
hash (unw_word_t ip, unsigned short log_size)
{
/* based on (sqrt(5)/2-1)*2^64 */
# define magic ((unw_word_t) 0x9e3779b97f4a7c16ULL)
return ip * magic >> ((sizeof(unw_word_t) * 8) - (log_size + 1));
}
static inline long
cache_match (struct dwarf_rs_cache *cache, unsigned short index, unw_word_t ip)
{
return (cache->links[index].valid && (ip == cache->links[index].ip));
}
static dwarf_reg_state_t *
rs_lookup (struct dwarf_rs_cache *cache, struct dwarf_cursor *c)
{
unsigned short index;
unw_word_t ip = c->ip;
if (c->hint > 0)
{
index = c->hint - 1;
if (cache_match (cache, index, ip))
return &cache->buckets[index];
}
for (index = cache->hash[hash (ip, cache->log_size)];
index < DWARF_UNW_CACHE_SIZE(cache->log_size);
index = cache->links[index].coll_chain)
{
if (cache_match (cache, index, ip))
return &cache->buckets[index];
}
return NULL;
}
static inline dwarf_reg_state_t *
rs_new (struct dwarf_rs_cache *cache, struct dwarf_cursor * c)
{
unw_hash_index_t index;
unsigned short head;
head = cache->rr_head;
cache->rr_head = (head + 1) & (DWARF_UNW_CACHE_SIZE(cache->log_size) - 1);
/* remove the old rs from the hash table (if it's there): */
if (cache->links[head].ip)
{
unsigned short *pindex;
for (pindex = &cache->hash[hash (cache->links[head].ip, cache->log_size)];
*pindex < DWARF_UNW_CACHE_SIZE(cache->log_size);
pindex = &cache->links[*pindex].coll_chain)
{
if (*pindex == head)
{
*pindex = cache->links[*pindex].coll_chain;
break;
}
}
}
/* enter new rs in the hash table */
index = hash (c->ip, cache->log_size);
cache->links[head].coll_chain = cache->hash[index];
cache->hash[index] = head;
cache->links[head].ip = c->ip;
cache->links[head].valid = 1;
cache->links[head].signal_frame = tdep_cache_frame(c);
return cache->buckets + head;
}
static int
create_state_record_for (struct dwarf_cursor *c, dwarf_state_record_t *sr,
unw_word_t ip)
{
int ret;
switch (c->pi.format)
{
case UNW_INFO_FORMAT_TABLE:
case UNW_INFO_FORMAT_REMOTE_TABLE:
if ((ret = setup_fde(c, sr)) < 0)
return ret;
ret = parse_fde (c, ip, sr);
break;
case UNW_INFO_FORMAT_DYNAMIC:
ret = parse_dynamic (c, ip, sr);
break;
default:
Debug (1, "Unexpected unwind-info format %d\n", c->pi.format);
ret = -UNW_EINVAL;
}
return ret;
}
static inline int
eval_location_expr (struct dwarf_cursor *c, unw_word_t stack_val, unw_addr_space_t as,
unw_accessors_t *a, unw_word_t addr,
dwarf_loc_t *locp, void *arg)
{
int ret, is_register;
unw_word_t len, val;
/* read the length of the expression: */
if ((ret = dwarf_read_uleb128 (as, a, &addr, &len, arg)) < 0)
return ret;
/* evaluate the expression: */
if ((ret = dwarf_eval_expr (c, stack_val, &addr, len, &val, &is_register)) < 0)
return ret;
if (is_register)
*locp = DWARF_REG_LOC (c, dwarf_to_unw_regnum (val));
else
*locp = DWARF_MEM_LOC (c, val);
return 0;
}
static int
apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs)
{
unw_word_t regnum, addr, cfa, ip;
unw_word_t prev_ip, prev_cfa;
unw_addr_space_t as;
dwarf_loc_t cfa_loc;
unw_accessors_t *a;
int i, ret;
void *arg;
prev_ip = c->ip;
prev_cfa = c->cfa;
as = c->as;
arg = c->as_arg;
a = unw_get_accessors_int (as);
/* Evaluate the CFA first, because it may be referred to by other
expressions. */
if (rs->reg.where[DWARF_CFA_REG_COLUMN] == DWARF_WHERE_REG)
{
/* CFA is equal to [reg] + offset: */
/* As a special-case, if the stack-pointer is the CFA and the
stack-pointer wasn't saved, popping the CFA implicitly pops
the stack-pointer as well. */
if ((rs->reg.val[DWARF_CFA_REG_COLUMN] == UNW_TDEP_SP)
&& (UNW_TDEP_SP < ARRAY_SIZE(rs->reg.val))
&& (rs->reg.where[UNW_TDEP_SP] == DWARF_WHERE_SAME))
cfa = c->cfa;
else
{
regnum = dwarf_to_unw_regnum (rs->reg.val[DWARF_CFA_REG_COLUMN]);
if ((ret = unw_get_reg ((unw_cursor_t *) c, regnum, &cfa)) < 0)
return ret;
}
cfa += rs->reg.val[DWARF_CFA_OFF_COLUMN];
}
else
{
/* CFA is equal to EXPR: */
assert (rs->reg.where[DWARF_CFA_REG_COLUMN] == DWARF_WHERE_EXPR);
addr = rs->reg.val[DWARF_CFA_REG_COLUMN];
/* The dwarf standard doesn't specify an initial value to be pushed on */
/* the stack before DW_CFA_def_cfa_expression evaluation. We push on a */
/* dummy value (0) to keep the eval_location_expr function consistent. */
if ((ret = eval_location_expr (c, 0, as, a, addr, &cfa_loc, arg)) < 0)
return ret;
/* the returned location better be a memory location... */
if (DWARF_IS_REG_LOC (cfa_loc))
return -UNW_EBADFRAME;
cfa = DWARF_GET_LOC (cfa_loc);
}
dwarf_loc_t new_loc[DWARF_NUM_PRESERVED_REGS];
memcpy(new_loc, c->loc, sizeof(new_loc));
for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i)
{
switch ((dwarf_where_t) rs->reg.where[i])
{
case DWARF_WHERE_UNDEF:
new_loc[i] = DWARF_NULL_LOC;
break;
case DWARF_WHERE_SAME:
break;
case DWARF_WHERE_CFAREL:
new_loc[i] = DWARF_MEM_LOC (c, cfa + rs->reg.val[i]);
break;
case DWARF_WHERE_REG:
#ifdef __s390x__
/* GPRs can be saved in FPRs on s390x */
if (unw_is_fpreg (dwarf_to_unw_regnum (rs->reg.val[i])))
{
new_loc[i] = DWARF_FPREG_LOC (c, dwarf_to_unw_regnum (rs->reg.val[i]));
break;
}
#endif
new_loc[i] = new_loc[rs->reg.val[i]];
break;
case DWARF_WHERE_EXPR:
addr = rs->reg.val[i];
/* The dwarf standard requires the current CFA to be pushed on the */
/* stack before DW_CFA_expression evaluation. */
if ((ret = eval_location_expr (c, cfa, as, a, addr, new_loc + i, arg)) < 0)
return ret;
break;
case DWARF_WHERE_VAL_EXPR:
addr = rs->reg.val[i];
/* The dwarf standard requires the current CFA to be pushed on the */
/* stack before DW_CFA_val_expression evaluation. */
if ((ret = eval_location_expr (c, cfa, as, a, addr, new_loc + i, arg)) < 0)
return ret;
new_loc[i] = DWARF_VAL_LOC (c, DWARF_GET_LOC (new_loc[i]));
break;
}
}
memcpy(c->loc, new_loc, sizeof(new_loc));
c->cfa = cfa;
/* DWARF spec says undefined return address location means end of stack. */
if (DWARF_IS_NULL_LOC (c->loc[rs->ret_addr_column]))
{
c->ip = 0;
ret = 0;
}
else
{
ret = dwarf_get (c, c->loc[rs->ret_addr_column], &ip);
if (ret < 0)
return ret;
c->ip = ip;
ret = 1;
}
/* XXX: check for ip to be code_aligned */
if (c->ip == prev_ip && c->cfa == prev_cfa)
{
Dprintf ("%s: ip and cfa unchanged; stopping here (ip=0x%lx)\n",
__FUNCTION__, (long) c->ip);
return -UNW_EBADFRAME;
}
if (c->stash_frames)
tdep_stash_frame (c, rs);
return ret;
}
/* Find the saved locations. */
static int
find_reg_state (struct dwarf_cursor *c, dwarf_state_record_t *sr)
{
dwarf_reg_state_t *rs;
struct dwarf_rs_cache *cache;
int ret = 0;
intrmask_t saved_mask;
if ((cache = get_rs_cache(c->as, &saved_mask)) &&
(rs = rs_lookup(cache, c)))
{
/* update hint; no locking needed: single-word writes are atomic */
unsigned short index = rs - cache->buckets;
c->use_prev_instr = ! cache->links[index].signal_frame;
memcpy (&sr->rs_current, rs, sizeof (*rs));
}
else
{
ret = fetch_proc_info (c, c->ip);
int next_use_prev_instr = c->use_prev_instr;
if (ret >= 0)
{
/* Update use_prev_instr for the next frame. */
assert(c->pi.unwind_info);
struct dwarf_cie_info *dci = c->pi.unwind_info;
next_use_prev_instr = ! dci->signal_frame;
ret = create_state_record_for (c, sr, c->ip);
}
put_unwind_info (c, &c->pi);
c->use_prev_instr = next_use_prev_instr;
if (cache && ret >= 0)
{
rs = rs_new (cache, c);
cache->links[rs - cache->buckets].hint = 0;
memcpy(rs, &sr->rs_current, sizeof(*rs));
}
}
unsigned short index = -1;
if (cache)
{
if (rs)
{
index = rs - cache->buckets;
c->hint = cache->links[index].hint;
cache->links[c->prev_rs].hint = index + 1;
c->prev_rs = index;
}
put_rs_cache (c->as, cache, &saved_mask);
}
if (ret < 0)
return ret;
if (cache)
tdep_reuse_frame (c, cache->links[index].signal_frame);
return 0;
}
/* The function finds the saved locations and applies the register
state as well. */
HIDDEN int
dwarf_step (struct dwarf_cursor *c)
{
int ret;
dwarf_state_record_t sr;
if ((ret = find_reg_state (c, &sr)) < 0)
return ret;
return apply_reg_state (c, &sr.rs_current);
}
HIDDEN int
dwarf_make_proc_info (struct dwarf_cursor *c)
{
#if 0
if (c->as->caching_policy == UNW_CACHE_NONE
|| get_cached_proc_info (c) < 0)
#endif
/* Need to check if current frame contains
args_size, and set cursor appropriately. Only
needed for unw_resume */
dwarf_state_record_t sr;
int ret;
/* Lookup it up the slow way... */
ret = fetch_proc_info (c, c->ip);
if (ret >= 0)
ret = create_state_record_for (c, &sr, c->ip);
put_unwind_info (c, &c->pi);
if (ret < 0)
return ret;
c->args_size = sr.args_size;
return 0;
}
static int
dwarf_reg_states_dynamic_iterate(struct dwarf_cursor *c,
unw_reg_states_callback cb,
void *token)
{
Debug (1, "Not yet implemented\n");
return -UNW_ENOINFO;
}
static int
dwarf_reg_states_table_iterate(struct dwarf_cursor *c,
unw_reg_states_callback cb,
void *token)
{
dwarf_state_record_t sr;
int ret = setup_fde(c, &sr);
struct dwarf_cie_info *dci = c->pi.unwind_info;
unw_word_t addr = dci->fde_instr_start;
unw_word_t curr_ip = c->pi.start_ip;
dwarf_stackable_reg_state_t *rs_stack = NULL;
while (ret >= 0 && curr_ip < c->pi.end_ip && addr < dci->fde_instr_end)
{
unw_word_t prev_ip = curr_ip;
ret = run_cfi_program (c, &sr, &curr_ip, prev_ip, &addr, dci->fde_instr_end,
&rs_stack, dci);
if (ret >= 0 && prev_ip < curr_ip)
ret = cb(token, &sr.rs_current, sizeof(sr.rs_current), prev_ip, curr_ip);
}
empty_rstate_stack(&rs_stack);
#if defined(NEED_LAST_IP)
if (ret >= 0 && curr_ip < c->pi.last_ip)
/* report the dead zone after the procedure ends */
ret = cb(token, &sr.rs_current, sizeof(sr.rs_current), curr_ip, c->pi.last_ip);
#else
if (ret >= 0 && curr_ip < c->pi.end_ip)
/* report for whatever is left before procedure end */
ret = cb(token, &sr.rs_current, sizeof(sr.rs_current), curr_ip, c->pi.end_ip);
#endif
return ret;
}
HIDDEN int
dwarf_reg_states_iterate(struct dwarf_cursor *c,
unw_reg_states_callback cb,
void *token)
{
int ret = fetch_proc_info (c, c->ip);
int next_use_prev_instr = c->use_prev_instr;
if (ret >= 0)
{
/* Update use_prev_instr for the next frame. */
assert(c->pi.unwind_info);
struct dwarf_cie_info *dci = c->pi.unwind_info;
next_use_prev_instr = ! dci->signal_frame;
switch (c->pi.format)
{
case UNW_INFO_FORMAT_TABLE:
case UNW_INFO_FORMAT_REMOTE_TABLE:
ret = dwarf_reg_states_table_iterate(c, cb, token);
break;
case UNW_INFO_FORMAT_DYNAMIC:
ret = dwarf_reg_states_dynamic_iterate (c, cb, token);
break;
default:
Debug (1, "Unexpected unwind-info format %d\n", c->pi.format);
ret = -UNW_EINVAL;
}
}
put_unwind_info (c, &c->pi);
c->use_prev_instr = next_use_prev_instr;
return ret;
}
HIDDEN int
dwarf_apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs)
{
return apply_reg_state(c, rs);
}
|
/* libunwind - a platform-independent unwind library
Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P.
Contributed by David Mosberger-Tang <[email protected]>
This file is part of libunwind.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include "dwarf_i.h"
#include "libunwind_i.h"
#include <stddef.h>
#include <limits.h>
#define alloc_reg_state() (mempool_alloc (&dwarf_reg_state_pool))
#define free_reg_state(rs) (mempool_free (&dwarf_reg_state_pool, rs))
#define DWARF_UNW_CACHE_SIZE(log_size) (1 << log_size)
#define DWARF_UNW_HASH_SIZE(log_size) (1 << (log_size + 1))
static inline int
read_regnum (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr,
unw_word_t *valp, void *arg)
{
int ret;
if ((ret = dwarf_read_uleb128 (as, a, addr, valp, arg)) < 0)
return ret;
if (*valp >= DWARF_NUM_PRESERVED_REGS)
{
Debug (1, "Invalid register number %u\n", (unsigned int) *valp);
return -UNW_EBADREG;
}
return 0;
}
static inline void
set_reg (dwarf_state_record_t *sr, unw_word_t regnum, dwarf_where_t where,
unw_word_t val)
{
sr->rs_current.reg.where[regnum] = where;
sr->rs_current.reg.val[regnum] = val;
}
static inline int
push_rstate_stack(dwarf_stackable_reg_state_t **rs_stack)
{
dwarf_stackable_reg_state_t *old_rs = *rs_stack;
if (NULL == (*rs_stack = alloc_reg_state ()))
{
*rs_stack = old_rs;
return -1;
}
(*rs_stack)->next = old_rs;
return 0;
}
static inline void
pop_rstate_stack(dwarf_stackable_reg_state_t **rs_stack)
{
dwarf_stackable_reg_state_t *old_rs = *rs_stack;
*rs_stack = old_rs->next;
free_reg_state (old_rs);
}
static inline void
empty_rstate_stack(dwarf_stackable_reg_state_t **rs_stack)
{
while (*rs_stack)
pop_rstate_stack(rs_stack);
}
/* Run a CFI program to update the register state. */
static int
run_cfi_program (struct dwarf_cursor *c, dwarf_state_record_t *sr,
unw_word_t *ip, unw_word_t end_ip,
unw_word_t *addr, unw_word_t end_addr,
dwarf_stackable_reg_state_t **rs_stack,
struct dwarf_cie_info *dci)
{
unw_addr_space_t as;
void *arg;
if (c->pi.flags & UNW_PI_FLAG_DEBUG_FRAME)
{
/* .debug_frame CFI is stored in local address space. */
as = unw_local_addr_space;
arg = NULL;
}
else
{
as = c->as;
arg = c->as_arg;
}
unw_accessors_t *a = unw_get_accessors_int (as);
int ret = 0;
while (*ip <= end_ip && *addr < end_addr && ret >= 0)
{
unw_word_t operand = 0, regnum, val, len;
uint8_t u8, op;
uint16_t u16;
uint32_t u32;
if ((ret = dwarf_readu8 (as, a, addr, &op, arg)) < 0)
break;
if (op & DWARF_CFA_OPCODE_MASK)
{
operand = op & DWARF_CFA_OPERAND_MASK;
op &= ~DWARF_CFA_OPERAND_MASK;
}
switch ((dwarf_cfa_t) op)
{
case DW_CFA_advance_loc:
*ip += operand * dci->code_align;
Debug (15, "CFA_advance_loc to 0x%lx\n", (long) *ip);
break;
case DW_CFA_advance_loc1:
if ((ret = dwarf_readu8 (as, a, addr, &u8, arg)) < 0)
break;
*ip += u8 * dci->code_align;
Debug (15, "CFA_advance_loc1 to 0x%lx\n", (long) *ip);
break;
case DW_CFA_advance_loc2:
if ((ret = dwarf_readu16 (as, a, addr, &u16, arg)) < 0)
break;
*ip += u16 * dci->code_align;
Debug (15, "CFA_advance_loc2 to 0x%lx\n", (long) *ip);
break;
case DW_CFA_advance_loc4:
if ((ret = dwarf_readu32 (as, a, addr, &u32, arg)) < 0)
break;
*ip += u32 * dci->code_align;
Debug (15, "CFA_advance_loc4 to 0x%lx\n", (long) *ip);
break;
case DW_CFA_MIPS_advance_loc8:
#ifdef UNW_TARGET_MIPS
{
uint64_t u64 = 0;
if ((ret = dwarf_readu64 (as, a, addr, &u64, arg)) < 0)
break;
*ip += u64 * dci->code_align;
Debug (15, "CFA_MIPS_advance_loc8\n");
break;
}
#else
Debug (1, "DW_CFA_MIPS_advance_loc8 on non-MIPS target\n");
ret = -UNW_EINVAL;
break;
#endif
case DW_CFA_offset:
regnum = operand;
if (regnum >= DWARF_NUM_PRESERVED_REGS)
{
Debug (1, "Invalid register number %u in DW_cfa_OFFSET\n",
(unsigned int) regnum);
ret = -UNW_EBADREG;
break;
}
if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)
break;
set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align);
Debug (15, "CFA_offset r%lu at cfa+0x%lx\n",
(long) regnum, (long) (val * dci->data_align));
break;
case DW_CFA_offset_extended:
if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
|| ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0))
break;
set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align);
Debug (15, "CFA_offset_extended r%lu at cf+0x%lx\n",
(long) regnum, (long) (val * dci->data_align));
break;
case DW_CFA_offset_extended_sf:
if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
|| ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0))
break;
set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align);
Debug (15, "CFA_offset_extended_sf r%lu at cf+0x%lx\n",
(long) regnum, (long) (val * dci->data_align));
break;
case DW_CFA_restore:
regnum = operand;
if (regnum >= DWARF_NUM_PRESERVED_REGS)
{
Debug (1, "Invalid register number %u in DW_CFA_restore\n",
(unsigned int) regnum);
ret = -UNW_EINVAL;
break;
}
sr->rs_current.reg.where[regnum] = sr->rs_initial.reg.where[regnum];
sr->rs_current.reg.val[regnum] = sr->rs_initial.reg.val[regnum];
Debug (15, "CFA_restore r%lu\n", (long) regnum);
break;
case DW_CFA_restore_extended:
if ((ret = dwarf_read_uleb128 (as, a, addr, ®num, arg)) < 0)
break;
if (regnum >= DWARF_NUM_PRESERVED_REGS)
{
Debug (1, "Invalid register number %u in "
"DW_CFA_restore_extended\n", (unsigned int) regnum);
ret = -UNW_EINVAL;
break;
}
sr->rs_current.reg.where[regnum] = sr->rs_initial.reg.where[regnum];
sr->rs_current.reg.val[regnum] = sr->rs_initial.reg.val[regnum];
Debug (15, "CFA_restore_extended r%lu\n", (long) regnum);
break;
case DW_CFA_nop:
break;
case DW_CFA_set_loc:
if ((ret = dwarf_read_encoded_pointer (as, a, addr, dci->fde_encoding,
&c->pi, ip,
arg)) < 0)
break;
Debug (15, "CFA_set_loc to 0x%lx\n", (long) *ip);
break;
case DW_CFA_undefined:
if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
break;
set_reg (sr, regnum, DWARF_WHERE_UNDEF, 0);
Debug (15, "CFA_undefined r%lu\n", (long) regnum);
break;
case DW_CFA_same_value:
if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
break;
set_reg (sr, regnum, DWARF_WHERE_SAME, 0);
Debug (15, "CFA_same_value r%lu\n", (long) regnum);
break;
case DW_CFA_register:
if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
|| ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0))
break;
set_reg (sr, regnum, DWARF_WHERE_REG, val);
Debug (15, "CFA_register r%lu to r%lu\n", (long) regnum, (long) val);
break;
case DW_CFA_remember_state:
if (push_rstate_stack(rs_stack) < 0)
{
Debug (1, "Out of memory in DW_CFA_remember_state\n");
ret = -UNW_ENOMEM;
break;
}
(*rs_stack)->state = sr->rs_current;
Debug (15, "CFA_remember_state\n");
break;
case DW_CFA_restore_state:
if (!*rs_stack)
{
Debug (1, "register-state stack underflow\n");
ret = -UNW_EINVAL;
break;
}
sr->rs_current = (*rs_stack)->state;
pop_rstate_stack(rs_stack);
Debug (15, "CFA_restore_state\n");
break;
case DW_CFA_def_cfa:
if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
|| ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0))
break;
set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum);
set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, val); /* NOT factored! */
Debug (15, "CFA_def_cfa r%lu+0x%lx\n", (long) regnum, (long) val);
break;
case DW_CFA_def_cfa_sf:
if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
|| ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0))
break;
set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum);
set_reg (sr, DWARF_CFA_OFF_COLUMN, 0,
val * dci->data_align); /* factored! */
Debug (15, "CFA_def_cfa_sf r%lu+0x%lx\n",
(long) regnum, (long) (val * dci->data_align));
break;
case DW_CFA_def_cfa_register:
if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
break;
set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum);
Debug (15, "CFA_def_cfa_register r%lu\n", (long) regnum);
break;
case DW_CFA_def_cfa_offset:
if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)
break;
set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, val); /* NOT factored! */
Debug (15, "CFA_def_cfa_offset 0x%lx\n", (long) val);
break;
case DW_CFA_def_cfa_offset_sf:
if ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0)
break;
set_reg (sr, DWARF_CFA_OFF_COLUMN, 0,
val * dci->data_align); /* factored! */
Debug (15, "CFA_def_cfa_offset_sf 0x%lx\n",
(long) (val * dci->data_align));
break;
case DW_CFA_def_cfa_expression:
/* Save the address of the DW_FORM_block for later evaluation. */
set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_EXPR, *addr);
if ((ret = dwarf_read_uleb128 (as, a, addr, &len, arg)) < 0)
break;
Debug (15, "CFA_def_cfa_expr @ 0x%lx [%lu bytes]\n",
(long) *addr, (long) len);
*addr += len;
break;
case DW_CFA_expression:
if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
break;
/* Save the address of the DW_FORM_block for later evaluation. */
set_reg (sr, regnum, DWARF_WHERE_EXPR, *addr);
if ((ret = dwarf_read_uleb128 (as, a, addr, &len, arg)) < 0)
break;
Debug (15, "CFA_expression r%lu @ 0x%lx [%lu bytes]\n",
(long) regnum, (long) addr, (long) len);
*addr += len;
break;
case DW_CFA_val_expression:
if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
break;
/* Save the address of the DW_FORM_block for later evaluation. */
set_reg (sr, regnum, DWARF_WHERE_VAL_EXPR, *addr);
if ((ret = dwarf_read_uleb128 (as, a, addr, &len, arg)) < 0)
break;
Debug (15, "CFA_val_expression r%lu @ 0x%lx [%lu bytes]\n",
(long) regnum, (long) addr, (long) len);
*addr += len;
break;
case DW_CFA_GNU_args_size:
if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)
break;
sr->args_size = val;
Debug (15, "CFA_GNU_args_size %lu\n", (long) val);
break;
case DW_CFA_GNU_negative_offset_extended:
/* A comment in GCC says that this is obsoleted by
DW_CFA_offset_extended_sf, but that it's used by older
PowerPC code. */
if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0)
|| ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0))
break;
set_reg (sr, regnum, DWARF_WHERE_CFAREL, (unw_word_t)(-(unw_sword_t)val));
Debug (15, "CFA_GNU_negative_offset_extended cfa+0x%lx\n",
(long)(unw_word_t)(-(unw_sword_t)val));
break;
case DW_CFA_GNU_window_save:
#ifdef UNW_TARGET_SPARC
/* This is a special CFA to handle all 16 windowed registers
on SPARC. */
for (regnum = 16; regnum < 32; ++regnum)
set_reg (sr, regnum, DWARF_WHERE_CFAREL,
(regnum - 16) * sizeof (unw_word_t));
Debug (15, "CFA_GNU_window_save\n");
break;
#else
/* FALL THROUGH */
#endif
case DW_CFA_lo_user:
case DW_CFA_hi_user:
Debug (1, "Unexpected CFA opcode 0x%x\n", op);
ret = -UNW_EINVAL;
break;
}
}
if (ret > 0)
ret = 0;
return ret;
}
static int
fetch_proc_info (struct dwarf_cursor *c, unw_word_t ip)
{
int ret, dynamic = 1;
/* The 'ip' can point either to the previous or next instruction
depending on what type of frame we have: normal call or a place
to resume execution (e.g. after signal frame).
For a normal call frame we need to back up so we point within the
call itself; this is important because a) the call might be the
very last instruction of the function and the edge of the FDE,
and b) so that run_cfi_program() runs locations up to the call
but not more.
For signal frame, we need to do the exact opposite and look
up using the current 'ip' value. That is where execution will
continue, and it's important we get this right, as 'ip' could be
right at the function entry and hence FDE edge, or at instruction
that manipulates CFA (push/pop). */
if (c->use_prev_instr)
{
#if defined(__arm__)
/* On arm, the least bit denotes thumb/arm mode, clear it. */
ip &= ~(unw_word_t)0x1;
#endif
--ip;
}
memset (&c->pi, 0, sizeof (c->pi));
/* check dynamic info first --- it overrides everything else */
ret = unwi_find_dynamic_proc_info (c->as, ip, &c->pi, 1,
c->as_arg);
if (ret == -UNW_ENOINFO)
{
dynamic = 0;
if ((ret = tdep_find_proc_info (c, ip, 1)) < 0)
return ret;
}
if (c->pi.format != UNW_INFO_FORMAT_DYNAMIC
&& c->pi.format != UNW_INFO_FORMAT_TABLE
&& c->pi.format != UNW_INFO_FORMAT_REMOTE_TABLE)
return -UNW_ENOINFO;
c->pi_valid = 1;
c->pi_is_dynamic = dynamic;
/* Let system/machine-dependent code determine frame-specific attributes. */
if (ret >= 0)
tdep_fetch_frame (c, ip, 1);
return ret;
}
static int
parse_dynamic (struct dwarf_cursor *c, unw_word_t ip, dwarf_state_record_t *sr)
{
Debug (1, "Not yet implemented\n");
return -UNW_ENOINFO;
}
static inline void
put_unwind_info (struct dwarf_cursor *c, unw_proc_info_t *pi)
{
if (c->pi_is_dynamic)
unwi_put_dynamic_unwind_info (c->as, pi, c->as_arg);
else if (pi->unwind_info && pi->format == UNW_INFO_FORMAT_TABLE)
{
mempool_free (&dwarf_cie_info_pool, pi->unwind_info);
pi->unwind_info = NULL;
}
c->pi_valid = 0;
}
static inline int
setup_fde (struct dwarf_cursor *c, dwarf_state_record_t *sr)
{
int i, ret;
assert (c->pi_valid);
memset (sr, 0, sizeof (*sr));
for (i = 0; i < DWARF_NUM_PRESERVED_REGS + 2; ++i)
set_reg (sr, i, DWARF_WHERE_SAME, 0);
struct dwarf_cie_info *dci = c->pi.unwind_info;
sr->rs_current.ret_addr_column = dci->ret_addr_column;
unw_word_t addr = dci->cie_instr_start;
unw_word_t curr_ip = 0;
dwarf_stackable_reg_state_t *rs_stack = NULL;
ret = run_cfi_program (c, sr, &curr_ip, ~(unw_word_t) 0, &addr,
dci->cie_instr_end,
&rs_stack, dci);
empty_rstate_stack(&rs_stack);
if (ret < 0)
return ret;
memcpy (&sr->rs_initial, &sr->rs_current, sizeof (sr->rs_initial));
return 0;
}
static inline int
parse_fde (struct dwarf_cursor *c, unw_word_t ip, dwarf_state_record_t *sr)
{
int ret;
struct dwarf_cie_info *dci = c->pi.unwind_info;
unw_word_t addr = dci->fde_instr_start;
unw_word_t curr_ip = c->pi.start_ip;
dwarf_stackable_reg_state_t *rs_stack = NULL;
/* Process up to current `ip` for signal frame and `ip - 1` for normal call frame
See `c->use_prev_instr` use in `fetch_proc_info` for details. */
ret = run_cfi_program (c, sr, &curr_ip, ip - c->use_prev_instr, &addr, dci->fde_instr_end,
&rs_stack, dci);
empty_rstate_stack(&rs_stack);
if (ret < 0)
return ret;
return 0;
}
HIDDEN int
dwarf_flush_rs_cache (struct dwarf_rs_cache *cache)
{
int i;
if (cache->log_size == DWARF_DEFAULT_LOG_UNW_CACHE_SIZE
|| !cache->hash) {
cache->hash = cache->default_hash;
cache->buckets = cache->default_buckets;
cache->links = cache->default_links;
cache->log_size = DWARF_DEFAULT_LOG_UNW_CACHE_SIZE;
} else {
if (cache->hash && cache->hash != cache->default_hash)
munmap(cache->hash, DWARF_UNW_HASH_SIZE(cache->prev_log_size)
* sizeof (cache->hash[0]));
if (cache->buckets && cache->buckets != cache->default_buckets)
munmap(cache->buckets, DWARF_UNW_CACHE_SIZE(cache->prev_log_size)
* sizeof (cache->buckets[0]));
if (cache->links && cache->links != cache->default_links)
munmap(cache->links, DWARF_UNW_CACHE_SIZE(cache->prev_log_size)
* sizeof (cache->links[0]));
GET_MEMORY(cache->hash, DWARF_UNW_HASH_SIZE(cache->log_size)
* sizeof (cache->hash[0]));
GET_MEMORY(cache->buckets, DWARF_UNW_CACHE_SIZE(cache->log_size)
* sizeof (cache->buckets[0]));
GET_MEMORY(cache->links, DWARF_UNW_CACHE_SIZE(cache->log_size)
* sizeof (cache->links[0]));
if (!cache->hash || !cache->buckets || !cache->links)
{
Debug (1, "Unable to allocate cache memory");
return -UNW_ENOMEM;
}
cache->prev_log_size = cache->log_size;
}
cache->rr_head = 0;
for (i = 0; i < DWARF_UNW_CACHE_SIZE(cache->log_size); ++i)
{
cache->links[i].coll_chain = -1;
cache->links[i].ip = 0;
cache->links[i].valid = 0;
}
for (i = 0; i< DWARF_UNW_HASH_SIZE(cache->log_size); ++i)
cache->hash[i] = -1;
return 0;
}
static inline struct dwarf_rs_cache *
get_rs_cache (unw_addr_space_t as, intrmask_t *saved_maskp)
{
struct dwarf_rs_cache *cache = &as->global_cache;
unw_caching_policy_t caching = as->caching_policy;
if (caching == UNW_CACHE_NONE)
return NULL;
#if defined(HAVE___CACHE_PER_THREAD) && HAVE___CACHE_PER_THREAD
if (likely (caching == UNW_CACHE_PER_THREAD))
{
static _Thread_local struct dwarf_rs_cache tls_cache __attribute__((tls_model("initial-exec")));
Debug (16, "using TLS cache\n");
cache = &tls_cache;
}
else
#else
if (likely (caching == UNW_CACHE_GLOBAL))
#endif
{
Debug (16, "acquiring lock\n");
lock_acquire (&cache->lock, *saved_maskp);
}
if ((atomic_load (&as->cache_generation) != atomic_load (&cache->generation))
|| !cache->hash)
{
/* cache_size is only set in the global_cache, copy it over before flushing */
cache->log_size = as->global_cache.log_size;
if (dwarf_flush_rs_cache (cache) < 0)
return NULL;
atomic_store (&cache->generation, atomic_load (&as->cache_generation));
}
return cache;
}
static inline void
put_rs_cache (unw_addr_space_t as, struct dwarf_rs_cache *cache,
intrmask_t *saved_maskp)
{
assert (as->caching_policy != UNW_CACHE_NONE);
Debug (16, "unmasking signals/interrupts and releasing lock\n");
if (likely (as->caching_policy == UNW_CACHE_GLOBAL))
lock_release (&cache->lock, *saved_maskp);
}
static inline unw_hash_index_t CONST_ATTR
hash (unw_word_t ip, unsigned short log_size)
{
/* based on (sqrt(5)/2-1)*2^64 */
# define magic ((unw_word_t) 0x9e3779b97f4a7c16ULL)
return ip * magic >> ((sizeof(unw_word_t) * 8) - (log_size + 1));
}
static inline long
cache_match (struct dwarf_rs_cache *cache, unsigned short index, unw_word_t ip)
{
return (cache->links[index].valid && (ip == cache->links[index].ip));
}
static dwarf_reg_state_t *
rs_lookup (struct dwarf_rs_cache *cache, struct dwarf_cursor *c)
{
unsigned short index;
unw_word_t ip = c->ip;
if (c->hint > 0)
{
index = c->hint - 1;
if (cache_match (cache, index, ip))
return &cache->buckets[index];
}
for (index = cache->hash[hash (ip, cache->log_size)];
index < DWARF_UNW_CACHE_SIZE(cache->log_size);
index = cache->links[index].coll_chain)
{
if (cache_match (cache, index, ip))
return &cache->buckets[index];
}
return NULL;
}
static inline dwarf_reg_state_t *
rs_new (struct dwarf_rs_cache *cache, struct dwarf_cursor * c)
{
unw_hash_index_t index;
unsigned short head;
head = cache->rr_head;
cache->rr_head = (head + 1) & (DWARF_UNW_CACHE_SIZE(cache->log_size) - 1);
/* remove the old rs from the hash table (if it's there): */
if (cache->links[head].ip)
{
unsigned short *pindex;
for (pindex = &cache->hash[hash (cache->links[head].ip, cache->log_size)];
*pindex < DWARF_UNW_CACHE_SIZE(cache->log_size);
pindex = &cache->links[*pindex].coll_chain)
{
if (*pindex == head)
{
*pindex = cache->links[*pindex].coll_chain;
break;
}
}
}
/* enter new rs in the hash table */
index = hash (c->ip, cache->log_size);
cache->links[head].coll_chain = cache->hash[index];
cache->hash[index] = head;
cache->links[head].ip = c->ip;
cache->links[head].valid = 1;
cache->links[head].signal_frame = tdep_cache_frame(c);
return cache->buckets + head;
}
static int
create_state_record_for (struct dwarf_cursor *c, dwarf_state_record_t *sr,
unw_word_t ip)
{
int ret;
switch (c->pi.format)
{
case UNW_INFO_FORMAT_TABLE:
case UNW_INFO_FORMAT_REMOTE_TABLE:
if ((ret = setup_fde(c, sr)) < 0)
return ret;
ret = parse_fde (c, ip, sr);
break;
case UNW_INFO_FORMAT_DYNAMIC:
ret = parse_dynamic (c, ip, sr);
break;
default:
Debug (1, "Unexpected unwind-info format %d\n", c->pi.format);
ret = -UNW_EINVAL;
}
return ret;
}
static inline int
eval_location_expr (struct dwarf_cursor *c, unw_word_t stack_val, unw_addr_space_t as,
unw_accessors_t *a, unw_word_t addr,
dwarf_loc_t *locp, void *arg)
{
int ret, is_register;
unw_word_t len, val;
/* read the length of the expression: */
if ((ret = dwarf_read_uleb128 (as, a, &addr, &len, arg)) < 0)
return ret;
/* evaluate the expression: */
if ((ret = dwarf_eval_expr (c, stack_val, &addr, len, &val, &is_register)) < 0)
return ret;
if (is_register)
*locp = DWARF_REG_LOC (c, dwarf_to_unw_regnum (val));
else
*locp = DWARF_MEM_LOC (c, val);
return 0;
}
static int
apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs)
{
unw_word_t regnum, addr, cfa, ip;
unw_word_t prev_ip, prev_cfa;
unw_addr_space_t as;
dwarf_loc_t cfa_loc;
unw_accessors_t *a;
int i, ret;
void *arg;
prev_ip = c->ip;
prev_cfa = c->cfa;
as = c->as;
arg = c->as_arg;
a = unw_get_accessors_int (as);
/* Evaluate the CFA first, because it may be referred to by other
expressions. */
if (rs->reg.where[DWARF_CFA_REG_COLUMN] == DWARF_WHERE_REG)
{
/* CFA is equal to [reg] + offset: */
/* As a special-case, if the stack-pointer is the CFA and the
stack-pointer wasn't saved, popping the CFA implicitly pops
the stack-pointer as well. */
if ((rs->reg.val[DWARF_CFA_REG_COLUMN] == UNW_TDEP_SP)
&& (UNW_TDEP_SP < ARRAY_SIZE(rs->reg.val))
&& (rs->reg.where[UNW_TDEP_SP] == DWARF_WHERE_SAME))
cfa = c->cfa;
else
{
regnum = dwarf_to_unw_regnum (rs->reg.val[DWARF_CFA_REG_COLUMN]);
if ((ret = unw_get_reg ((unw_cursor_t *) c, regnum, &cfa)) < 0)
return ret;
}
cfa += rs->reg.val[DWARF_CFA_OFF_COLUMN];
}
else
{
/* CFA is equal to EXPR: */
assert (rs->reg.where[DWARF_CFA_REG_COLUMN] == DWARF_WHERE_EXPR);
addr = rs->reg.val[DWARF_CFA_REG_COLUMN];
/* The dwarf standard doesn't specify an initial value to be pushed on */
/* the stack before DW_CFA_def_cfa_expression evaluation. We push on a */
/* dummy value (0) to keep the eval_location_expr function consistent. */
if ((ret = eval_location_expr (c, 0, as, a, addr, &cfa_loc, arg)) < 0)
return ret;
/* the returned location better be a memory location... */
if (DWARF_IS_REG_LOC (cfa_loc))
return -UNW_EBADFRAME;
cfa = DWARF_GET_LOC (cfa_loc);
}
dwarf_loc_t new_loc[DWARF_NUM_PRESERVED_REGS];
memcpy(new_loc, c->loc, sizeof(new_loc));
for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i)
{
switch ((dwarf_where_t) rs->reg.where[i])
{
case DWARF_WHERE_UNDEF:
new_loc[i] = DWARF_NULL_LOC;
break;
case DWARF_WHERE_SAME:
break;
case DWARF_WHERE_CFAREL:
new_loc[i] = DWARF_MEM_LOC (c, cfa + rs->reg.val[i]);
break;
case DWARF_WHERE_REG:
#ifdef __s390x__
/* GPRs can be saved in FPRs on s390x */
if (unw_is_fpreg (dwarf_to_unw_regnum (rs->reg.val[i])))
{
new_loc[i] = DWARF_FPREG_LOC (c, dwarf_to_unw_regnum (rs->reg.val[i]));
break;
}
#endif
new_loc[i] = new_loc[rs->reg.val[i]];
break;
case DWARF_WHERE_EXPR:
addr = rs->reg.val[i];
/* The dwarf standard requires the current CFA to be pushed on the */
/* stack before DW_CFA_expression evaluation. */
if ((ret = eval_location_expr (c, cfa, as, a, addr, new_loc + i, arg)) < 0)
return ret;
break;
case DWARF_WHERE_VAL_EXPR:
addr = rs->reg.val[i];
/* The dwarf standard requires the current CFA to be pushed on the */
/* stack before DW_CFA_val_expression evaluation. */
if ((ret = eval_location_expr (c, cfa, as, a, addr, new_loc + i, arg)) < 0)
return ret;
new_loc[i] = DWARF_VAL_LOC (c, DWARF_GET_LOC (new_loc[i]));
break;
}
}
memcpy(c->loc, new_loc, sizeof(new_loc));
c->cfa = cfa;
/* DWARF spec says undefined return address location means end of stack. */
if (DWARF_IS_NULL_LOC (c->loc[rs->ret_addr_column]))
{
c->ip = 0;
ret = 0;
}
else
{
ret = dwarf_get (c, c->loc[rs->ret_addr_column], &ip);
if (ret < 0)
return ret;
c->ip = ip;
ret = 1;
}
/* XXX: check for ip to be code_aligned */
if (c->ip == prev_ip && c->cfa == prev_cfa)
{
Dprintf ("%s: ip and cfa unchanged; stopping here (ip=0x%lx)\n",
__FUNCTION__, (long) c->ip);
return -UNW_EBADFRAME;
}
if (c->stash_frames)
tdep_stash_frame (c, rs);
return ret;
}
/* Find the saved locations. */
static int
find_reg_state (struct dwarf_cursor *c, dwarf_state_record_t *sr)
{
dwarf_reg_state_t *rs;
struct dwarf_rs_cache *cache;
int ret = 0;
intrmask_t saved_mask;
if ((cache = get_rs_cache(c->as, &saved_mask)) &&
(rs = rs_lookup(cache, c)))
{
/* update hint; no locking needed: single-word writes are atomic */
unsigned short index = rs - cache->buckets;
c->use_prev_instr = ! cache->links[index].signal_frame;
memcpy (&sr->rs_current, rs, sizeof (*rs));
}
else
{
ret = fetch_proc_info (c, c->ip);
int next_use_prev_instr = c->use_prev_instr;
if (ret >= 0)
{
/* Update use_prev_instr for the next frame. */
assert(c->pi.unwind_info);
struct dwarf_cie_info *dci = c->pi.unwind_info;
next_use_prev_instr = ! dci->signal_frame;
ret = create_state_record_for (c, sr, c->ip);
}
put_unwind_info (c, &c->pi);
c->use_prev_instr = next_use_prev_instr;
if (cache && ret >= 0)
{
rs = rs_new (cache, c);
cache->links[rs - cache->buckets].hint = 0;
memcpy(rs, &sr->rs_current, sizeof(*rs));
}
}
unsigned short index = -1;
if (cache)
{
if (rs)
{
index = rs - cache->buckets;
c->hint = cache->links[index].hint;
cache->links[c->prev_rs].hint = index + 1;
c->prev_rs = index;
}
put_rs_cache (c->as, cache, &saved_mask);
}
if (ret < 0)
return ret;
if (cache)
tdep_reuse_frame (c, cache->links[index].signal_frame);
return 0;
}
/* The function finds the saved locations and applies the register
state as well. */
HIDDEN int
dwarf_step (struct dwarf_cursor *c)
{
int ret;
dwarf_state_record_t sr;
if ((ret = find_reg_state (c, &sr)) < 0)
return ret;
return apply_reg_state (c, &sr.rs_current);
}
HIDDEN int
dwarf_make_proc_info (struct dwarf_cursor *c)
{
#if 0
if (c->as->caching_policy == UNW_CACHE_NONE
|| get_cached_proc_info (c) < 0)
#endif
/* Need to check if current frame contains
args_size, and set cursor appropriately. Only
needed for unw_resume */
dwarf_state_record_t sr;
int ret;
/* Lookup it up the slow way... */
ret = fetch_proc_info (c, c->ip);
if (ret >= 0)
ret = create_state_record_for (c, &sr, c->ip);
put_unwind_info (c, &c->pi);
if (ret < 0)
return ret;
c->args_size = sr.args_size;
return 0;
}
static int
dwarf_reg_states_dynamic_iterate(struct dwarf_cursor *c,
unw_reg_states_callback cb,
void *token)
{
Debug (1, "Not yet implemented\n");
return -UNW_ENOINFO;
}
static int
dwarf_reg_states_table_iterate(struct dwarf_cursor *c,
unw_reg_states_callback cb,
void *token)
{
dwarf_state_record_t sr;
int ret = setup_fde(c, &sr);
struct dwarf_cie_info *dci = c->pi.unwind_info;
unw_word_t addr = dci->fde_instr_start;
unw_word_t curr_ip = c->pi.start_ip;
dwarf_stackable_reg_state_t *rs_stack = NULL;
while (ret >= 0 && curr_ip < c->pi.end_ip && addr < dci->fde_instr_end)
{
unw_word_t prev_ip = curr_ip;
ret = run_cfi_program (c, &sr, &curr_ip, prev_ip, &addr, dci->fde_instr_end,
&rs_stack, dci);
if (ret >= 0 && prev_ip < curr_ip)
ret = cb(token, &sr.rs_current, sizeof(sr.rs_current), prev_ip, curr_ip);
}
empty_rstate_stack(&rs_stack);
#if defined(NEED_LAST_IP)
if (ret >= 0 && curr_ip < c->pi.last_ip)
/* report the dead zone after the procedure ends */
ret = cb(token, &sr.rs_current, sizeof(sr.rs_current), curr_ip, c->pi.last_ip);
#else
if (ret >= 0 && curr_ip < c->pi.end_ip)
/* report for whatever is left before procedure end */
ret = cb(token, &sr.rs_current, sizeof(sr.rs_current), curr_ip, c->pi.end_ip);
#endif
return ret;
}
HIDDEN int
dwarf_reg_states_iterate(struct dwarf_cursor *c,
unw_reg_states_callback cb,
void *token)
{
int ret = fetch_proc_info (c, c->ip);
int next_use_prev_instr = c->use_prev_instr;
if (ret >= 0)
{
/* Update use_prev_instr for the next frame. */
assert(c->pi.unwind_info);
struct dwarf_cie_info *dci = c->pi.unwind_info;
next_use_prev_instr = ! dci->signal_frame;
switch (c->pi.format)
{
case UNW_INFO_FORMAT_TABLE:
case UNW_INFO_FORMAT_REMOTE_TABLE:
ret = dwarf_reg_states_table_iterate(c, cb, token);
break;
case UNW_INFO_FORMAT_DYNAMIC:
ret = dwarf_reg_states_dynamic_iterate (c, cb, token);
break;
default:
Debug (1, "Unexpected unwind-info format %d\n", c->pi.format);
ret = -UNW_EINVAL;
}
}
put_unwind_info (c, &c->pi);
c->use_prev_instr = next_use_prev_instr;
return ret;
}
HIDDEN int
dwarf_apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs)
{
return apply_reg_state(c, rs);
}
| 1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/mono/mono/arch/ppc/ppc-codegen.h
|
/*
Authors:
Radek Doulik
Christopher Taylor <ct_AT_clemson_DOT_edu>
Andreas Faerber <[email protected]>
Copyright (C) 2001 Radek Doulik
Copyright (C) 2007-2008 Andreas Faerber
for testing do the following: ./test | as -o test.o
Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#ifndef __MONO_PPC_CODEGEN_H__
#define __MONO_PPC_CODEGEN_H__
#include <glib.h>
#include <assert.h>
typedef enum {
ppc_r0 = 0,
ppc_r1,
ppc_sp = ppc_r1,
ppc_r2,
ppc_r3,
ppc_r4,
ppc_r5,
ppc_r6,
ppc_r7,
ppc_r8,
ppc_r9,
ppc_r10,
ppc_r11,
ppc_r12,
ppc_r13,
ppc_r14,
ppc_r15,
ppc_r16,
ppc_r17,
ppc_r18,
ppc_r19,
ppc_r20,
ppc_r21,
ppc_r22,
ppc_r23,
ppc_r24,
ppc_r25,
ppc_r26,
ppc_r27,
ppc_r28,
ppc_r29,
ppc_r30,
ppc_r31
} PPCIntRegister;
typedef enum {
ppc_f0 = 0,
ppc_f1,
ppc_f2,
ppc_f3,
ppc_f4,
ppc_f5,
ppc_f6,
ppc_f7,
ppc_f8,
ppc_f9,
ppc_f10,
ppc_f11,
ppc_f12,
ppc_f13,
ppc_f14,
ppc_f15,
ppc_f16,
ppc_f17,
ppc_f18,
ppc_f19,
ppc_f20,
ppc_f21,
ppc_f22,
ppc_f23,
ppc_f24,
ppc_f25,
ppc_f26,
ppc_f27,
ppc_f28,
ppc_f29,
ppc_f30,
ppc_f31
} PPCFloatRegister;
typedef enum {
ppc_lr = 256,
ppc_ctr = 256 + 32,
ppc_xer = 32
} PPCSpecialRegister;
enum {
/* B0 operand for branches */
PPC_BR_DEC_CTR_NONZERO_FALSE = 0,
PPC_BR_LIKELY = 1, /* can be or'ed with the conditional variants */
PPC_BR_DEC_CTR_ZERO_FALSE = 2,
PPC_BR_FALSE = 4,
PPC_BR_DEC_CTR_NONZERO_TRUE = 8,
PPC_BR_DEC_CTR_ZERO_TRUE = 10,
PPC_BR_TRUE = 12,
PPC_BR_DEC_CTR_NONZERO = 16,
PPC_BR_DEC_CTR_ZERO = 18,
PPC_BR_ALWAYS = 20,
/* B1 operand for branches */
PPC_BR_LT = 0,
PPC_BR_GT = 1,
PPC_BR_EQ = 2,
PPC_BR_SO = 3
};
enum {
PPC_TRAP_LT = 1,
PPC_TRAP_GT = 2,
PPC_TRAP_EQ = 4,
PPC_TRAP_LT_UN = 8,
PPC_TRAP_GT_UN = 16,
PPC_TRAP_LE = 1 + PPC_TRAP_EQ,
PPC_TRAP_GE = 2 + PPC_TRAP_EQ,
PPC_TRAP_LE_UN = 8 + PPC_TRAP_EQ,
PPC_TRAP_GE_UN = 16 + PPC_TRAP_EQ
};
#define ppc_emit32(c,x) do { *((guint32 *) (c)) = (guint32) (x); (c) = ((guint8 *)(c) + sizeof (guint32));} while (0)
#define ppc_is_imm16(val) ((((val)>> 15) == 0) || (((val)>> 15) == -1))
#define ppc_is_uimm16(val) ((glong)(val) >= 0L && (glong)(val) <= 65535L)
#define ppc_ha(val) (((val >> 16) + ((val & 0x8000) ? 1 : 0)) & 0xffff)
#define ppc_load32(c,D,v) G_STMT_START { \
ppc_lis ((c), (D), (guint32)(v) >> 16); \
ppc_ori ((c), (D), (D), (guint32)(v) & 0xffff); \
} G_STMT_END
/* Macros to load/store pointer sized quantities */
#if defined(__mono_ppc64__) && !defined(MONO_ARCH_ILP32)
#define ppc_ldptr(c,D,d,A) ppc_ld ((c), (D), (d), (A))
#define ppc_ldptr_update(c,D,d,A) ppc_ldu ((c), (D), (d), (A))
#define ppc_ldptr_indexed(c,D,A,B) ppc_ldx ((c), (D), (A), (B))
#define ppc_ldptr_update_indexed(c,D,A,B) ppc_ldux ((c), (D), (A), (B))
#define ppc_stptr(c,S,d,A) ppc_std ((c), (S), (d), (A))
#define ppc_stptr_update(c,S,d,A) ppc_stdu ((c), (S), (d), (A))
#define ppc_stptr_indexed(c,S,A,B) ppc_stdx ((c), (S), (A), (B))
#define ppc_stptr_update_indexed(c,S,A,B) ppc_stdux ((c), (S), (A), (B))
#else
/* Same as ppc32 */
#define ppc_ldptr(c,D,d,A) ppc_lwz ((c), (D), (d), (A))
#define ppc_ldptr_update(c,D,d,A) ppc_lwzu ((c), (D), (d), (A))
#define ppc_ldptr_indexed(c,D,A,B) ppc_lwzx ((c), (D), (A), (B))
#define ppc_ldptr_update_indexed(c,D,A,B) ppc_lwzux ((c), (D), (A), (B))
#define ppc_stptr(c,S,d,A) ppc_stw ((c), (S), (d), (A))
#define ppc_stptr_update(c,S,d,A) ppc_stwu ((c), (S), (d), (A))
#define ppc_stptr_indexed(c,S,A,B) ppc_stwx ((c), (S), (A), (B))
#define ppc_stptr_update_indexed(c,S,A,B) ppc_stwux ((c), (S), (A), (B))
#endif
/* Macros to load pointer sized immediates */
#define ppc_load_ptr(c,D,v) ppc_load ((c),(D),(gsize)(v))
#define ppc_load_ptr_sequence(c,D,v) ppc_load_sequence ((c),(D),(gsize)(v))
/* Macros to load/store regsize quantities */
#ifdef __mono_ppc64__
#define ppc_ldr(c,D,d,A) ppc_ld ((c), (D), (d), (A))
#define ppc_ldr_indexed(c,D,A,B) ppc_ldx ((c), (D), (A), (B))
#define ppc_str(c,S,d,A) ppc_std ((c), (S), (d), (A))
#define ppc_str_update(c,S,d,A) ppc_stdu ((c), (S), (d), (A))
#define ppc_str_indexed(c,S,A,B) ppc_stdx ((c), (S), (A), (B))
#define ppc_str_update_indexed(c,S,A,B) ppc_stdux ((c), (S), (A), (B))
#else
#define ppc_ldr(c,D,d,A) ppc_lwz ((c), (D), (d), (A))
#define ppc_ldr_indexed(c,D,A,B) ppc_lwzx ((c), (D), (A), (B))
#define ppc_str(c,S,d,A) ppc_stw ((c), (S), (d), (A))
#define ppc_str_update(c,S,d,A) ppc_stwu ((c), (S), (d), (A))
#define ppc_str_indexed(c,S,A,B) ppc_stwx ((c), (S), (A), (B))
#define ppc_str_update_indexed(c,S,A,B) ppc_stwux ((c), (S), (A), (B))
#endif
#define ppc_str_multiple(c,S,d,A) ppc_store_multiple_regs((c),(S),(d),(A))
#define ppc_ldr_multiple(c,D,d,A) ppc_load_multiple_regs((c),(D),(d),(A))
/* PPC32 macros */
#ifndef __mono_ppc64__
#define ppc_load_sequence(c,D,v) ppc_load32 ((c), (D), (guint32)(v))
#define PPC_LOAD_SEQUENCE_LENGTH 8
#define ppc_load(c,D,v) G_STMT_START { \
if (ppc_is_imm16 ((guint32)(v))) { \
ppc_li ((c), (D), (guint16)(guint32)(v)); \
} else { \
ppc_load32 ((c), (D), (guint32)(v)); \
} \
} G_STMT_END
#define ppc_load_func(c,D,V) ppc_load_sequence ((c), (D), (V))
#define ppc_load_multiple_regs(c,D,d,A) ppc_lmw ((c), (D), (d), (A))
#define ppc_store_multiple_regs(c,S,d,A) ppc_stmw ((c), (S), (d), (A))
#define ppc_compare(c,cfrD,A,B) ppc_cmp((c), (cfrD), 0, (A), (B))
#define ppc_compare_reg_imm(c,cfrD,A,B) ppc_cmpi((c), (cfrD), 0, (A), (B))
#define ppc_compare_log(c,cfrD,A,B) ppc_cmpl((c), (cfrD), 0, (A), (B))
#define ppc_shift_left(c,A,S,B) ppc_slw((c), (S), (A), (B))
#define ppc_shift_left_imm(c,A,S,n) ppc_slwi((c), (A), (S), (n))
#define ppc_shift_right_imm(c,A,S,B) ppc_srwi((c), (A), (S), (B))
#define ppc_shift_right_arith_imm(c,A,S,B) ppc_srawi((c), (A), (S), (B))
#define ppc_multiply(c,D,A,B) ppc_mullw((c), (D), (A), (B))
#define ppc_clear_right_imm(c,A,S,n) ppc_clrrwi((c), (A), (S), (n))
#endif
#define ppc_opcode(c) ((c) >> 26)
#define ppc_split_5_1_1(x) (((x) >> 5) & 0x1)
#define ppc_split_5_1_5(x) ((x) & 0x1F)
#define ppc_split_5_1(x) ((ppc_split_5_1_5(x) << 1) | ppc_split_5_1_1(x))
#define ppc_break(c) ppc_tw((c),31,0,0)
#define ppc_addi(c,D,A,i) ppc_emit32 (c, (14 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(i))
#define ppc_addis(c,D,A,i) ppc_emit32 (c, (15 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(i))
#define ppc_li(c,D,v) ppc_addi (c, D, 0, (guint16)(v))
#define ppc_lis(c,D,v) ppc_addis (c, D, 0, (guint16)(v))
#define ppc_lwz(c,D,d,A) ppc_emit32 (c, (32 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_lhz(c,D,d,A) ppc_emit32 (c, (40 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_lbz(c,D,d,A) ppc_emit32 (c, (34 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_stw(c,S,d,A) ppc_emit32 (c, (36 << 26) | ((S) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_sth(c,S,d,A) ppc_emit32 (c, (44 << 26) | ((S) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_stb(c,S,d,A) ppc_emit32 (c, (38 << 26) | ((S) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_stwu(c,s,d,A) ppc_emit32 (c, (37 << 26) | ((s) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_or(c,a,s,b) ppc_emit32 (c, (31 << 26) | ((s) << 21) | ((a) << 16) | ((b) << 11) | 888)
#define ppc_mr(c,a,s) ppc_or (c, a, s, s)
#define ppc_ori(c,S,A,ui) ppc_emit32 (c, (24 << 26) | ((S) << 21) | ((A) << 16) | (guint16)(ui))
#define ppc_nop(c) ppc_ori (c, 0, 0, 0)
#define ppc_mfspr(c,D,spr) ppc_emit32 (c, (31 << 26) | ((D) << 21) | ((spr) << 11) | (339 << 1))
#define ppc_mflr(c,D) ppc_mfspr (c, D, ppc_lr)
#define ppc_mtspr(c,spr,S) ppc_emit32 (c, (31 << 26) | ((S) << 21) | ((spr) << 11) | (467 << 1))
#define ppc_mtlr(c,S) ppc_mtspr (c, ppc_lr, S)
#define ppc_mtctr(c,S) ppc_mtspr (c, ppc_ctr, S)
#define ppc_mtxer(c,S) ppc_mtspr (c, ppc_xer, S)
#define ppc_b(c,li) ppc_emit32 (c, (18 << 26) | ((li) << 2))
#define ppc_bl(c,li) ppc_emit32 (c, (18 << 26) | ((li) << 2) | 1)
#define ppc_ba(c,li) ppc_emit32 (c, (18 << 26) | ((li) << 2) | 2)
#define ppc_bla(c,li) ppc_emit32 (c, (18 << 26) | ((li) << 2) | 3)
#define ppc_blrl(c) ppc_emit32 (c, 0x4e800021)
#define ppc_blr(c) ppc_emit32 (c, 0x4e800020)
#define ppc_lfs(c,D,d,A) ppc_emit32 (c, (48 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_lfd(c,D,d,A) ppc_emit32 (c, (50 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_stfs(c,S,d,a) ppc_emit32 (c, (52 << 26) | ((S) << 21) | ((a) << 16) | (guint16)(d))
#define ppc_stfd(c,S,d,a) ppc_emit32 (c, (54 << 26) | ((S) << 21) | ((a) << 16) | (guint16)(d))
/***********************************************************************
The macros below were tapped out by Christopher Taylor <ct_AT_clemson_DOT_edu>
from 18 November 2002 to 19 December 2002.
Special thanks to rodo, lupus, dietmar, miguel, and duncan for patience,
and motivation.
The macros found in this file are based on the assembler instructions found
in Motorola and Digital DNA's:
"Programming Enviornments Manual For 32-bit Implementations of the PowerPC Architecture"
MPCFPE32B/AD
12/2001
REV2
see pages 326 - 524 for detailed information regarding each instruction
Also see the "Ximian Copyright Agreement, 2002" for more information regarding
my and Ximian's copyright to this code. ;)
*************************************************************************/
#define ppc_addx(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (OE << 10) | (266 << 1) | Rc)
#define ppc_add(c,D,A,B) ppc_addx(c,D,A,B,0,0)
#define ppc_addd(c,D,A,B) ppc_addx(c,D,A,B,0,1)
#define ppc_addo(c,D,A,B) ppc_addx(c,D,A,B,1,0)
#define ppc_addod(c,D,A,B) ppc_addx(c,D,A,B,1,1)
#define ppc_addcx(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (OE << 10) | (10 << 1) | Rc)
#define ppc_addc(c,D,A,B) ppc_addcx(c,D,A,B,0,0)
#define ppc_addcd(c,D,A,B) ppc_addcx(c,D,A,B,0,1)
#define ppc_addco(c,D,A,B) ppc_addcx(c,D,A,B,1,0)
#define ppc_addcod(c,D,A,B) ppc_addcx(c,D,A,B,1,1)
#define ppc_addex(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (OE << 10) | (138 << 1) | Rc)
#define ppc_adde(c,D,A,B) ppc_addex(c,D,A,B,0,0)
#define ppc_added(c,D,A,B) ppc_addex(c,D,A,B,0,1)
#define ppc_addeo(c,D,A,B) ppc_addex(c,D,A,B,1,0)
#define ppc_addeod(c,D,A,B) ppc_addex(c,D,A,B,1,1)
#define ppc_addic(c,D,A,i) ppc_emit32(c, (12 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(i))
#define ppc_addicd(c,D,A,i) ppc_emit32(c, (13 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(i))
#define ppc_addmex(c,D,A,OE,RC) ppc_emit32(c, (31 << 26) | ((D) << 21 ) | ((A) << 16) | (0 << 11) | ((OE) << 10) | (234 << 1) | RC)
#define ppc_addme(c,D,A) ppc_addmex(c,D,A,0,0)
#define ppc_addmed(c,D,A) ppc_addmex(c,D,A,0,1)
#define ppc_addmeo(c,D,A) ppc_addmex(c,D,A,1,0)
#define ppc_addmeod(c,D,A) ppc_addmex(c,D,A,1,1)
#define ppc_addzex(c,D,A,OE,RC) ppc_emit32(c, (31 << 26) | ((D) << 21 ) | ((A) << 16) | (0 << 11) | ((OE) << 10) | (202 << 1) | RC)
#define ppc_addze(c,D,A) ppc_addzex(c,D,A,0,0)
#define ppc_addzed(c,D,A) ppc_addzex(c,D,A,0,1)
#define ppc_addzeo(c,D,A) ppc_addzex(c,D,A,1,0)
#define ppc_addzeod(c,D,A) ppc_addzex(c,D,A,1,1)
#define ppc_andx(c,S,A,B,RC) ppc_emit32(c, (31 << 26) | ((S) << 21 ) | ((A) << 16) | ((B) << 11) | (28 << 1) | RC)
#define ppc_and(c,S,A,B) ppc_andx(c,S,A,B,0)
#define ppc_andd(c,S,A,B) ppc_andx(c,S,A,B,1)
#define ppc_andcx(c,S,A,B,RC) ppc_emit32(c, (31 << 26) | ((S) << 21 ) | ((A) << 16) | ((B) << 11) | (60 << 1) | RC)
#define ppc_andc(c,S,A,B) ppc_andcx(c,S,A,B,0)
#define ppc_andcd(c,S,A,B) ppc_andcx(c,S,A,B,1)
#define ppc_andid(c,S,A,ui) ppc_emit32(c, (28 << 26) | ((S) << 21 ) | ((A) << 16) | ((guint16)(ui)))
#define ppc_andisd(c,S,A,ui) ppc_emit32(c, (29 << 26) | ((S) << 21 ) | ((A) << 16) | ((guint16)(ui)))
#define ppc_bcx(c,BO,BI,BD,AA,LK) ppc_emit32(c, (16 << 26) | ((BO) << 21 )| ((BI) << 16) | (BD << 2) | ((AA) << 1) | LK)
#define ppc_bc(c,BO,BI,BD) ppc_bcx(c,BO,BI,BD,0,0)
#define ppc_bca(c,BO,BI,BD) ppc_bcx(c,BO,BI,BD,1,0)
#define ppc_bcl(c,BO,BI,BD) ppc_bcx(c,BO,BI,BD,0,1)
#define ppc_bcla(c,BO,BI,BD) ppc_bcx(c,BO,BI,BD,1,1)
#define ppc_bcctrx(c,BO,BI,LK) ppc_emit32(c, (19 << 26) | (BO << 21 )| (BI << 16) | (0 << 11) | (528 << 1) | LK)
#define ppc_bcctr(c,BO,BI) ppc_bcctrx(c,BO,BI,0)
#define ppc_bcctrl(c,BO,BI) ppc_bcctrx(c,BO,BI,1)
#define ppc_bnectrp(c,BO,BI) ppc_bcctr(c,BO,BI)
#define ppc_bnectrlp(c,BO,BI) ppc_bcctr(c,BO,BI)
#define ppc_bclrx(c,BO,BI,BH,LK) ppc_emit32(c, (19 << 26) | ((BO) << 21 )| ((BI) << 16) | (0 << 13) | ((BH) << 11) | (16 << 1) | (LK))
#define ppc_bclr(c,BO,BI,BH) ppc_bclrx(c,BO,BI,BH,0)
#define ppc_bclrl(c,BO,BI,BH) ppc_bclrx(c,BO,BI,BH,1)
#define ppc_bnelrp(c,BO,BI) ppc_bclr(c,BO,BI,0)
#define ppc_bnelrlp(c,BO,BI) ppc_bclr(c,BO,BI,0)
#define ppc_cmp(c,cfrD,L,A,B) ppc_emit32(c, (31 << 26) | ((cfrD) << 23) | (0 << 22) | ((L) << 21) | ((A) << 16) | ((B) << 11) | (0 << 1) | 0)
#define ppc_cmpi(c,cfrD,L,A,B) ppc_emit32(c, (11 << 26) | (cfrD << 23) | (0 << 22) | (L << 21) | (A << 16) | (guint16)(B))
#define ppc_cmpl(c,cfrD,L,A,B) ppc_emit32(c, (31 << 26) | ((cfrD) << 23) | (0 << 22) | ((L) << 21) | ((A) << 16) | ((B) << 11) | (32 << 1) | 0)
#define ppc_cmpli(c,cfrD,L,A,B) ppc_emit32(c, (10 << 26) | (cfrD << 23) | (0 << 22) | (L << 21) | (A << 16) | (guint16)(B))
#define ppc_cmpw(c,cfrD,A,B) ppc_cmp(c, (cfrD), 0, (A), (B))
#define ppc_cntlzwx(c,S,A,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (0 << 11) | (26 << 1) | Rc)
#define ppc_cntlzw(c,S,A) ppc_cntlzwx(c,S,A,0)
#define ppc_cntlzwd(c,S,A) ppc_cntlzwx(c,S,A,1)
#define ppc_crand(c,D,A,B) ppc_emit32(c, (19 << 26) | (D << 21) | (A << 16) | (B << 11) | (257 << 1) | 0)
#define ppc_crandc(c,D,A,B) ppc_emit32(c, (19 << 26) | (D << 21) | (A << 16) | (B << 11) | (129 << 1) | 0)
#define ppc_creqv(c,D,A,B) ppc_emit32(c, (19 << 26) | (D << 21) | (A << 16) | (B << 11) | (289 << 1) | 0)
#define ppc_crnand(c,D,A,B) ppc_emit32(c, (19 << 26) | (D << 21) | (A << 16) | (B << 11) | (225 << 1) | 0)
#define ppc_crnor(c,D,A,B) ppc_emit32(c, (19 << 26) | (D << 21) | (A << 16) | (B << 11) | (33 << 1) | 0)
#define ppc_cror(c,D,A,B) ppc_emit32(c, (19 << 26) | (D << 21) | (A << 16) | (B << 11) | (449 << 1) | 0)
#define ppc_crorc(c,D,A,B) ppc_emit32(c, (19 << 26) | (D << 21) | (A << 16) | (B << 11) | (417 << 1) | 0)
#define ppc_crxor(c,D,A,B) ppc_emit32(c, (19 << 26) | (D << 21) | (A << 16) | (B << 11) | (193 << 1) | 0)
#define ppc_dcba(c,A,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (A << 16) | (B << 11) | (758 << 1) | 0)
#define ppc_dcbf(c,A,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (A << 16) | (B << 11) | (86 << 1) | 0)
#define ppc_dcbi(c,A,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (A << 16) | (B << 11) | (470 << 1) | 0)
#define ppc_dcbst(c,A,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (A << 16) | (B << 11) | (54 << 1) | 0)
#define ppc_dcbt(c,A,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (A << 16) | (B << 11) | (278 << 1) | 0)
#define ppc_dcbtst(c,A,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (A << 16) | (B << 11) | (246 << 1) | 0)
#define ppc_dcbz(c,A,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (A << 16) | (B << 11) | (1014 << 1) | 0)
#define ppc_divwx(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (OE << 10) | (491 << 1) | Rc)
#define ppc_divw(c,D,A,B) ppc_divwx(c,D,A,B,0,0)
#define ppc_divwd(c,D,A,B) ppc_divwx(c,D,A,B,0,1)
#define ppc_divwo(c,D,A,B) ppc_divwx(c,D,A,B,1,0)
#define ppc_divwod(c,D,A,B) ppc_divwx(c,D,A,B,1,1)
#define ppc_divwux(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (OE << 10) | (459 << 1) | Rc)
#define ppc_divwu(c,D,A,B) ppc_divwux(c,D,A,B,0,0)
#define ppc_divwud(c,D,A,B) ppc_divwux(c,D,A,B,0,1)
#define ppc_divwuo(c,D,A,B) ppc_divwux(c,D,A,B,1,0)
#define ppc_divwuod(c,D,A,B) ppc_divwux(c,D,A,B,1,1)
#define ppc_eciwx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (310 << 1) | 0)
#define ppc_ecowx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (438 << 1) | 0)
#define ppc_eieio(c) ppc_emit32(c, (31 << 26) | (0 << 21) | (0 << 16) | (0 << 11) | (854 << 1) | 0)
#define ppc_eqvx(c,A,S,B,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (284 << 1) | Rc)
#define ppc_eqv(c,A,S,B) ppc_eqvx(c,A,S,B,0)
#define ppc_eqvd(c,A,S,B) ppc_eqvx(c,A,S,B,1)
#define ppc_extsbx(c,A,S,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (0 << 11) | (954 << 1) | Rc)
#define ppc_extsb(c,A,S) ppc_extsbx(c,A,S,0)
#define ppc_extsbd(c,A,S) ppc_extsbx(c,A,S,1)
#define ppc_extshx(c,A,S,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (0 << 11) | (922 << 1) | Rc)
#define ppc_extsh(c,A,S) ppc_extshx(c,A,S,0)
#define ppc_extshd(c,A,S) ppc_extshx(c,A,S,1)
#define ppc_fabsx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (264 << 1) | Rc)
#define ppc_fabs(c,D,B) ppc_fabsx(c,D,B,0)
#define ppc_fabsd(c,D,B) ppc_fabsx(c,D,B,1)
#define ppc_faddx(c,D,A,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (B << 11) | (0 << 6) | (21 << 1) | Rc)
#define ppc_fadd(c,D,A,B) ppc_faddx(c,D,A,B,0)
#define ppc_faddd(c,D,A,B) ppc_faddx(c,D,A,B,1)
#define ppc_faddsx(c,D,A,B,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (A << 16) | (B << 11) | (0 << 6) | (21 << 1) | Rc)
#define ppc_fadds(c,D,A,B) ppc_faddsx(c,D,A,B,0)
#define ppc_faddsd(c,D,A,B) ppc_faddsx(c,D,A,B,1)
#define ppc_fcmpo(c,crfD,A,B) ppc_emit32(c, (63 << 26) | (crfD << 23) | (0 << 21) | (A << 16) | (B << 11) | (32 << 1) | 0)
#define ppc_fcmpu(c,crfD,A,B) ppc_emit32(c, (63 << 26) | (crfD << 23) | (0 << 21) | (A << 16) | (B << 11) | (0 << 1) | 0)
#define ppc_fctiwx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (14 << 1) | Rc)
#define ppc_fctiw(c,D,B) ppc_fctiwx(c,D,B,0)
#define ppc_fctiwd(c,D,B) ppc_fctiwx(c,D,B,1)
#define ppc_fctiwzx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (15 << 1) | Rc)
#define ppc_fctiwz(c,D,B) ppc_fctiwzx(c,D,B,0)
#define ppc_fctiwzd(c,D,B) ppc_fctiwzx(c,D,B,1)
#define ppc_fdivx(c,D,A,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (B << 11) | (0 << 6) | (18 << 1) | Rc)
#define ppc_fdiv(c,D,A,B) ppc_fdivx(c,D,A,B,0)
#define ppc_fdivd(c,D,A,B) ppc_fdivx(c,D,A,B,1)
#define ppc_fdivsx(c,D,A,B,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (A << 16) | (B << 11) | (0 << 6) | (18 << 1) | Rc)
#define ppc_fdivs(c,D,A,B) ppc_fdivsx(c,D,A,B,0)
#define ppc_fdivsd(c,D,A,B) ppc_fdivsx(c,D,A,B,1)
#define ppc_fmaddx(c,D,A,B,C,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (29 << 1) | Rc)
#define ppc_fmadd(c,D,A,B,C) ppc_fmaddx(c,D,A,B,C,0)
#define ppc_fmaddd(c,D,A,B,C) ppc_fmaddx(c,D,A,B,C,1)
#define ppc_fmaddsx(c,D,A,B,C,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (29 << 1) | Rc)
#define ppc_fmadds(c,D,A,B,C) ppc_fmaddsx(c,D,A,B,C,0)
#define ppc_fmaddsd(c,D,A,B,C) ppc_fmaddsx(c,D,A,B,C,1)
#define ppc_fmrx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (72 << 1) | Rc)
#define ppc_fmr(c,D,B) ppc_fmrx(c,D,B,0)
#define ppc_fmrd(c,D,B) ppc_fmrx(c,D,B,1)
#define ppc_fmsubx(c,D,A,C,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (28 << 1) | Rc)
#define ppc_fmsub(c,D,A,C,B) ppc_fmsubx(c,D,A,C,B,0)
#define ppc_fmsubd(c,D,A,C,B) ppc_fmsubx(c,D,A,C,B,1)
#define ppc_fmsubsx(c,D,A,C,B,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (28 << 1) | Rc)
#define ppc_fmsubs(c,D,A,C,B) ppc_fmsubsx(c,D,A,C,B,0)
#define ppc_fmsubsd(c,D,A,C,B) ppc_fmsubsx(c,D,A,C,B,1)
#define ppc_fmulx(c,D,A,C,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (0 << 11) | (C << 6) | (25 << 1) | Rc)
#define ppc_fmul(c,D,A,C) ppc_fmulx(c,D,A,C,0)
#define ppc_fmuld(c,D,A,C) ppc_fmulx(c,D,A,C,1)
#define ppc_fmulsx(c,D,A,C,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (A << 16) | (0 << 11) | (C << 6) | (25 << 1) | Rc)
#define ppc_fmuls(c,D,A,C) ppc_fmulsx(c,D,A,C,0)
#define ppc_fmulsd(c,D,A,C) ppc_fmulsx(c,D,A,C,1)
#define ppc_fnabsx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (136 << 1) | Rc)
#define ppc_fnabs(c,D,B) ppc_fnabsx(c,D,B,0)
#define ppc_fnabsd(c,D,B) ppc_fnabsx(c,D,B,1)
#define ppc_fnegx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (40 << 1) | Rc)
#define ppc_fneg(c,D,B) ppc_fnegx(c,D,B,0)
#define ppc_fnegd(c,D,B) ppc_fnegx(c,D,B,1)
#define ppc_fnmaddx(c,D,A,C,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (31 << 1) | Rc)
#define ppc_fnmadd(c,D,A,C,B) ppc_fnmaddx(c,D,A,C,B,0)
#define ppc_fnmaddd(c,D,A,C,B) ppc_fnmaddx(c,D,A,C,B,1)
#define ppc_fnmaddsx(c,D,A,C,B,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (31 << 1) | Rc)
#define ppc_fnmadds(c,D,A,C,B) ppc_fnmaddsx(c,D,A,C,B,0)
#define ppc_fnmaddsd(c,D,A,C,B) ppc_fnmaddsx(c,D,A,C,B,1)
#define ppc_fnmsubx(c,D,A,C,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (30 << 1) | Rc)
#define ppc_fnmsub(c,D,A,C,B) ppc_fnmsubx(c,D,A,C,B,0)
#define ppc_fnmsubd(c,D,A,C,B) ppc_fnmsubx(c,D,A,C,B,1)
#define ppc_fnmsubsx(c,D,A,C,B,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (30 << 1) | Rc)
#define ppc_fnmsubs(c,D,A,C,B) ppc_fnmsubsx(c,D,A,C,B,0)
#define ppc_fnmsubsd(c,D,A,C,B) ppc_fnmsubsx(c,D,A,C,B,1)
#define ppc_fresx(c,D,B,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (0 << 16) | (B << 11) | (0 << 6) | (24 << 1) | Rc)
#define ppc_fres(c,D,B) ppc_fresx(c,D,B,0)
#define ppc_fresd(c,D,B) ppc_fresx(c,D,B,1)
#define ppc_frspx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (12 << 1) | Rc)
#define ppc_frsp(c,D,B) ppc_frspx(c,D,B,0)
#define ppc_frspd(c,D,B) ppc_frspx(c,D,B,1)
#define ppc_frsqrtex(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (0 << 6) | (26 << 1) | Rc)
#define ppc_frsqrte(c,D,B) ppc_frsqrtex(c,D,B,0)
#define ppc_frsqrted(c,D,B) ppc_frsqrtex(c,D,B,1)
#define ppc_fselx(c,D,A,C,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (23 << 1) | Rc)
#define ppc_fsel(c,D,A,C,B) ppc_fselx(c,D,A,C,B,0)
#define ppc_fseld(c,D,A,C,B) ppc_fselx(c,D,A,C,B,1)
#define ppc_fsqrtx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (0 << 6) | (22 << 1) | Rc)
#define ppc_fsqrt(c,D,B) ppc_fsqrtx(c,D,B,0)
#define ppc_fsqrtd(c,D,B) ppc_fsqrtx(c,D,B,1)
#define ppc_fsqrtsx(c,D,B,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (0 << 16) | (B << 11) | (0 << 6) | (22 << 1) | Rc)
#define ppc_fsqrts(c,D,B) ppc_fsqrtsx(c,D,B,0)
#define ppc_fsqrtsd(c,D,B) ppc_fsqrtsx(c,D,B,1)
#define ppc_fsubx(c,D,A,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (B << 11) | (0 << 6) | (20 << 1) | Rc)
#define ppc_fsub(c,D,A,B) ppc_fsubx(c,D,A,B,0)
#define ppc_fsubd(c,D,A,B) ppc_fsubx(c,D,A,B,1)
#define ppc_fsubsx(c,D,A,B,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (A << 16) | (B << 11) | (0 << 6) | (20 << 1) | Rc)
#define ppc_fsubs(c,D,A,B) ppc_fsubsx(c,D,A,B,0)
#define ppc_fsubsd(c,D,A,B) ppc_fsubsx(c,D,A,B,1)
#define ppc_icbi(c,A,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (A << 16) | (B << 11) | (982 << 1) | 0)
#define ppc_isync(c) ppc_emit32(c, (19 << 26) | (0 << 11) | (150 << 1) | 0)
#define ppc_lbzu(c,D,d,A) ppc_emit32(c, (35 << 26) | (D << 21) | (A << 16) | (guint16)d)
#define ppc_lbzux(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (119 << 1) | 0)
#define ppc_lbzx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (87 << 1) | 0)
#define ppc_lfdu(c,D,d,A) ppc_emit32(c, (51 << 26) | (D << 21) | (A << 16) | (guint16)d)
#define ppc_lfdux(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (631 << 1) | 0)
#define ppc_lfdx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (599 << 1) | 0)
#define ppc_lfsu(c,D,d,A) ppc_emit32(c, (49 << 26) | (D << 21) | (A << 16) | (guint16)d)
#define ppc_lfsux(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (567 << 1) | 0)
#define ppc_lfsx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (535 << 1) | 0)
#define ppc_lha(c,D,d,A) ppc_emit32(c, (42 << 26) | (D << 21) | (A << 16) | (guint16)d)
#define ppc_lhau(c,D,d,A) ppc_emit32(c, (43 << 26) | (D << 21) | (A << 16) | (guint16)d)
#define ppc_lhaux(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (375 << 1) | 0)
#define ppc_lhax(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (343 << 1) | 0)
#define ppc_lhbrx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (790 << 1) | 0)
#define ppc_lhzu(c,D,d,A) ppc_emit32(c, (41 << 26) | (D << 21) | (A << 16) | (guint16)d)
#define ppc_lhzux(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (311 << 1) | 0)
#define ppc_lhzx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (279 << 1) | 0)
#define ppc_lmw(c,D,d,A) ppc_emit32(c, (46 << 26) | (D << 21) | (A << 16) | (guint16)d)
#define ppc_lswi(c,D,A,NB) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (NB << 11) | (597 << 1) | 0)
#define ppc_lswx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (533 << 1) | 0)
#define ppc_lwarx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (20 << 1) | 0)
#define ppc_lwbrx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (534 << 1) | 0)
#define ppc_lwzu(c,D,d,A) ppc_emit32(c, (33 << 26) | (D << 21) | (A << 16) | (guint16)d)
#define ppc_lwzux(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (55 << 1) | 0)
#define ppc_lwzx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (23 << 1) | 0)
#define ppc_mcrf(c,crfD,crfS) ppc_emit32(c, (19 << 26) | (crfD << 23) | (0 << 21) | (crfS << 18) | 0)
#define ppc_mcrfs(c,crfD,crfS) ppc_emit32(c, (63 << 26) | (crfD << 23) | (0 << 21) | (crfS << 18) | (0 << 16) | (64 << 1) | 0)
#define ppc_mcrxr(c,crfD) ppc_emit32(c, (31 << 26) | (crfD << 23) | (0 << 16) | (512 << 1) | 0)
#define ppc_mfcr(c,D) ppc_emit32(c, (31 << 26) | (D << 21) | (0 << 16) | (19 << 1) | 0)
#define ppc_mffsx(c,D,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (583 << 1) | Rc)
#define ppc_mffs(c,D) ppc_mffsx(c,D,0)
#define ppc_mffsd(c,D) ppc_mffsx(c,D,1)
#define ppc_mfmsr(c,D) ppc_emit32(c, (31 << 26) | (D << 21) | (0 << 16) | (83 << 1) | 0)
#define ppc_mfsr(c,D,SR) ppc_emit32(c, (31 << 26) | (D << 21) | (0 << 20) | (SR << 16) | (0 << 11) | (595 << 1) | 0)
#define ppc_mfsrin(c,D,B) ppc_emit32(c, (31 << 26) | (D << 21) | (0 << 16) | (B << 11) | (659 << 1) | 0)
#define ppc_mftb(c,D,TBR) ppc_emit32(c, (31 << 26) | (D << 21) | (TBR << 11) | (371 << 1) | 0)
#define ppc_mtcrf(c,CRM,S) ppc_emit32(c, (31 << 26) | (S << 21) | (0 << 20) | (CRM << 12) | (0 << 11) | (144 << 1) | 0)
#define ppc_mtfsb0x(c,CRB,Rc) ppc_emit32(c, (63 << 26) | (CRB << 21) | (0 << 11) | (70 << 1) | Rc)
#define ppc_mtfsb0(c,CRB) ppc_mtfsb0x(c,CRB,0)
#define ppc_mtfsb0d(c,CRB) ppc_mtfsb0x(c,CRB,1)
#define ppc_mtfsb1x(c,CRB,Rc) ppc_emit32(c, (63 << 26) | (CRB << 21) | (0 << 11) | (38 << 1) | Rc)
#define ppc_mtfsb1(c,CRB) ppc_mtfsb1x(c,CRB,0)
#define ppc_mtfsb1d(c,CRB) ppc_mtfsb1x(c,CRB,1)
#define ppc_mtfsfx(c,FM,B,Rc) ppc_emit32(c, (63 << 26) | (0 << 25) | (FM << 22) | (0 << 21) | (B << 11) | (711 << 1) | Rc)
#define ppc_mtfsf(c,FM,B) ppc_mtfsfx(c,FM,B,0)
#define ppc_mtfsfd(c,FM,B) ppc_mtfsfx(c,FM,B,1)
#define ppc_mtfsfix(c,crfD,IMM,Rc) ppc_emit32(c, (63 << 26) | (crfD << 23) | (0 << 16) | (IMM << 12) | (0 << 11) | (134 << 1) | Rc)
#define ppc_mtfsfi(c,crfD,IMM) ppc_mtfsfix(c,crfD,IMM,0)
#define ppc_mtfsfid(c,crfD,IMM) ppc_mtfsfix(c,crfD,IMM,1)
#define ppc_mtmsr(c, S) ppc_emit32(c, (31 << 26) | (S << 21) | (0 << 11) | (146 << 1) | 0)
#define ppc_mtsr(c,SR,S) ppc_emit32(c, (31 << 26) | (S << 21) | (0 << 20) | (SR << 16) | (0 << 11) | (210 << 1) | 0)
#define ppc_mtsrin(c,S,B) ppc_emit32(c, (31 << 26) | (S << 21) | (0 << 16) | (B << 11) | (242 << 1) | 0)
#define ppc_mulhwx(c,D,A,B,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (0 << 10) | (75 << 1) | Rc)
#define ppc_mulhw(c,D,A,B) ppc_mulhwx(c,D,A,B,0)
#define ppc_mulhwd(c,D,A,B) ppc_mulhwx(c,D,A,B,1)
#define ppc_mulhwux(c,D,A,B,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (0 << 10) | (11 << 1) | Rc)
#define ppc_mulhwu(c,D,A,B) ppc_mulhwux(c,D,A,B,0)
#define ppc_mulhwud(c,D,A,B) ppc_mulhwux(c,D,A,B,1)
#define ppc_mulli(c,D,A,SIMM) ppc_emit32(c, ((07) << 26) | (D << 21) | (A << 16) | (guint16)(SIMM))
#define ppc_mullwx(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (OE << 10) | (235 << 1) | Rc)
#define ppc_mullw(c,D,A,B) ppc_mullwx(c,D,A,B,0,0)
#define ppc_mullwd(c,D,A,B) ppc_mullwx(c,D,A,B,0,1)
#define ppc_mullwo(c,D,A,B) ppc_mullwx(c,D,A,B,1,0)
#define ppc_mullwod(c,D,A,B) ppc_mullwx(c,D,A,B,1,1)
#define ppc_nandx(c,A,S,B,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (476 << 1) | Rc)
#define ppc_nand(c,A,S,B) ppc_nandx(c,A,S,B,0)
#define ppc_nandd(c,A,S,B) ppc_nandx(c,A,S,B,1)
#define ppc_negx(c,D,A,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (0 << 11) | (OE << 10) | (104 << 1) | Rc)
#define ppc_neg(c,D,A) ppc_negx(c,D,A,0,0)
#define ppc_negd(c,D,A) ppc_negx(c,D,A,0,1)
#define ppc_nego(c,D,A) ppc_negx(c,D,A,1,0)
#define ppc_negod(c,D,A) ppc_negx(c,D,A,1,1)
#define ppc_norx(c,A,S,B,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (124 << 1) | Rc)
#define ppc_nor(c,A,S,B) ppc_norx(c,A,S,B,0)
#define ppc_nord(c,A,S,B) ppc_norx(c,A,S,B,1)
#define ppc_not(c,A,S) ppc_norx(c,A,S,S,0)
#define ppc_orx(c,A,S,B,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (444 << 1) | Rc)
#define ppc_ord(c,A,S,B) ppc_orx(c,A,S,B,1)
#define ppc_orcx(c,A,S,B,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (412 << 1) | Rc)
#define ppc_orc(c,A,S,B) ppc_orcx(c,A,S,B,0)
#define ppc_orcd(c,A,S,B) ppc_orcx(c,A,S,B,1)
#define ppc_oris(c,A,S,UIMM) ppc_emit32(c, (25 << 26) | (S << 21) | (A << 16) | (guint16)(UIMM))
#define ppc_rfi(c) ppc_emit32(c, (19 << 26) | (0 << 11) | (50 << 1) | 0)
#define ppc_rlwimix(c,A,S,SH,MB,ME,Rc) ppc_emit32(c, (20 << 26) | (S << 21) | (A << 16) | (SH << 11) | (MB << 6) | (ME << 1) | Rc)
#define ppc_rlwimi(c,A,S,SH,MB,ME) ppc_rlwimix(c,A,S,SH,MB,ME,0)
#define ppc_rlwimid(c,A,S,SH,MB,ME) ppc_rlwimix(c,A,S,SH,MB,ME,1)
#define ppc_rlwinmx(c,A,S,SH,MB,ME,Rc) ppc_emit32(c, (21 << 26) | ((S) << 21) | ((A) << 16) | ((SH) << 11) | ((MB) << 6) | ((ME) << 1) | (Rc))
#define ppc_rlwinm(c,A,S,SH,MB,ME) ppc_rlwinmx(c,A,S,SH,MB,ME,0)
#define ppc_rlwinmd(c,A,S,SH,MB,ME) ppc_rlwinmx(c,A,S,SH,MB,ME,1)
#define ppc_extlwi(c,A,S,n,b) ppc_rlwinm(c,A,S, b, 0, (n) - 1)
#define ppc_extrwi(c,A,S,n,b) ppc_rlwinm(c,A,S, (b) + (n), 32 - (n), 31)
#define ppc_rotlwi(c,A,S,n) ppc_rlwinm(c,A,S, n, 0, 31)
#define ppc_rotrwi(c,A,S,n) ppc_rlwinm(c,A,S, 32 - (n), 0, 31)
#define ppc_slwi(c,A,S,n) ppc_rlwinm(c,A,S, n, 0, 31 - (n))
#define ppc_srwi(c,A,S,n) ppc_rlwinm(c,A,S, 32 - (n), n, 31)
#define ppc_clrlwi(c,A,S,n) ppc_rlwinm(c,A,S, 0, n, 31)
#define ppc_clrrwi(c,A,S,n) ppc_rlwinm(c,A,S, 0, 0, 31 - (n))
#define ppc_clrlslwi(c,A,S,b,n) ppc_rlwinm(c,A,S, n, (b) - (n), 31 - (n))
#define ppc_rlwnmx(c,A,S,SH,MB,ME,Rc) ppc_emit32(c, (23 << 26) | (S << 21) | (A << 16) | (SH << 11) | (MB << 6) | (ME << 1) | Rc)
#define ppc_rlwnm(c,A,S,SH,MB,ME) ppc_rlwnmx(c,A,S,SH,MB,ME,0)
#define ppc_rlwnmd(c,A,S,SH,MB,ME) ppc_rlwnmx(c,A,S,SH,MB,ME,1)
#define ppc_sc(c) ppc_emit32(c, (17 << 26) | (0 << 2) | (1 << 1) | 0)
#define ppc_slwx(c,S,A,B,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (24 << 1) | Rc)
#define ppc_slw(c,S,A,B) ppc_slwx(c,S,A,B,0)
#define ppc_slwd(c,S,A,B) ppc_slwx(c,S,A,B,1)
#define ppc_srawx(c,A,S,B,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (792 << 1) | Rc)
#define ppc_sraw(c,A,S,B) ppc_srawx(c,A,S,B,0)
#define ppc_srawd(c,A,S,B) ppc_srawx(c,A,S,B,1)
#define ppc_srawix(c,A,S,SH,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (SH << 11) | (824 << 1) | Rc)
#define ppc_srawi(c,A,S,B) ppc_srawix(c,A,S,B,0)
#define ppc_srawid(c,A,S,B) ppc_srawix(c,A,S,B,1)
#define ppc_srwx(c,A,S,SH,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (SH << 11) | (536 << 1) | Rc)
#define ppc_srw(c,A,S,B) ppc_srwx(c,A,S,B,0)
#define ppc_srwd(c,A,S,B) ppc_srwx(c,A,S,B,1)
#define ppc_stbu(c,S,d,A) ppc_emit32(c, (39 << 26) | (S << 21) | (A << 16) | (guint16)(d))
#define ppc_stbux(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (247 << 1) | 0)
#define ppc_stbx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (215 << 1) | 0)
#define ppc_stfdu(c,S,d,A) ppc_emit32(c, (55 << 26) | (S << 21) | (A << 16) | (guint16)(d))
#define ppc_stfdx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (727 << 1) | 0)
#define ppc_stfiwx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (983 << 1) | 0)
#define ppc_stfsu(c,S,d,A) ppc_emit32(c, (53 << 26) | (S << 21) | (A << 16) | (guint16)(d))
#define ppc_stfsux(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (695 << 1) | 0)
#define ppc_stfsx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (663 << 1) | 0)
#define ppc_sthbrx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (918 << 1) | 0)
#define ppc_sthu(c,S,d,A) ppc_emit32(c, (45 << 26) | (S << 21) | (A << 16) | (guint16)(d))
#define ppc_sthux(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (439 << 1) | 0)
#define ppc_sthx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (407 << 1) | 0)
#define ppc_stmw(c,S,d,A) ppc_emit32(c, (47 << 26) | (S << 21) | (A << 16) | (guint16)d)
#define ppc_stswi(c,S,A,NB) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (NB << 11) | (725 << 1) | 0)
#define ppc_stswx(c,S,A,NB) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (NB << 11) | (661 << 1) | 0)
#define ppc_stwbrx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (662 << 1) | 0)
#define ppc_stwcxd(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (150 << 1) | 1)
#define ppc_stwux(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (183 << 1) | 0)
#define ppc_stwx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (151 << 1) | 0)
#define ppc_subfx(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (OE << 10) | (40 << 1) | Rc)
#define ppc_subf(c,D,A,B) ppc_subfx(c,D,A,B,0,0)
#define ppc_subfd(c,D,A,B) ppc_subfx(c,D,A,B,0,1)
#define ppc_subfo(c,D,A,B) ppc_subfx(c,D,A,B,1,0)
#define ppc_subfod(c,D,A,B) ppc_subfx(c,D,A,B,1,1)
#define ppc_sub(c,D,A,B) ppc_subf(c,D,B,A)
#define ppc_subfcx(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (OE << 10) | (8 << 1) | Rc)
#define ppc_subfc(c,D,A,B) ppc_subfcx(c,D,A,B,0,0)
#define ppc_subfcd(c,D,A,B) ppc_subfcx(c,D,A,B,0,1)
#define ppc_subfco(c,D,A,B) ppc_subfcx(c,D,A,B,1,0)
#define ppc_subfcod(c,D,A,B) ppc_subfcx(c,D,A,B,1,1)
#define ppc_subfex(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (OE << 10) | (136 << 1) | Rc)
#define ppc_subfe(c,D,A,B) ppc_subfex(c,D,A,B,0,0)
#define ppc_subfed(c,D,A,B) ppc_subfex(c,D,A,B,0,1)
#define ppc_subfeo(c,D,A,B) ppc_subfex(c,D,A,B,1,0)
#define ppc_subfeod(c,D,A,B) ppc_subfex(c,D,A,B,1,1)
#define ppc_subfic(c,D,A,SIMM) ppc_emit32(c, (8 << 26) | (D << 21) | (A << 16) | (guint16)(SIMM))
#define ppc_subfmex(c,D,A,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (0 << 11) | (OE << 10) | (232 << 1) | Rc)
#define ppc_subfme(c,D,A) ppc_subfmex(c,D,A,0,0)
#define ppc_subfmed(c,D,A) ppc_subfmex(c,D,A,0,1)
#define ppc_subfmeo(c,D,A) ppc_subfmex(c,D,A,1,0)
#define ppc_subfmeod(c,D,A) ppc_subfmex(c,D,A,1,1)
#define ppc_subfzex(c,D,A,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (0 << 11) | (OE << 10) | (200 << 1) | Rc)
#define ppc_subfze(c,D,A) ppc_subfzex(c,D,A,0,0)
#define ppc_subfzed(c,D,A) ppc_subfzex(c,D,A,0,1)
#define ppc_subfzeo(c,D,A) ppc_subfzex(c,D,A,1,0)
#define ppc_subfzeod(c,D,A) ppc_subfzex(c,D,A,1,1)
#define ppc_sync(c) ppc_emit32(c, (31 << 26) | (0 << 11) | (598 << 1) | 0)
#define ppc_tlbia(c) ppc_emit32(c, (31 << 26) | (0 << 11) | (370 << 1) | 0)
#define ppc_tlbie(c,B) ppc_emit32(c, (31 << 26) | (0 << 16) | (B << 11) | (306 << 1) | 0)
#define ppc_tlbsync(c) ppc_emit32(c, (31 << 26) | (0 << 11) | (566 << 1) | 0)
#define ppc_tw(c,TO,A,B) ppc_emit32(c, (31 << 26) | (TO << 21) | (A << 16) | (B << 11) | (4 << 1) | 0)
#define ppc_twi(c,TO,A,SIMM) ppc_emit32(c, (3 << 26) | (TO << 21) | (A << 16) | (guint16)(SIMM))
#define ppc_xorx(c,A,S,B,RC) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (316 << 1) | RC)
#define ppc_xor(c,A,S,B) ppc_xorx(c,A,S,B,0)
#define ppc_xord(c,A,S,B) ppc_xorx(c,A,S,B,1)
#define ppc_xori(c,S,A,UIMM) ppc_emit32(c, (26 << 26) | (S << 21) | (A << 16) | (guint16)(UIMM))
#define ppc_xoris(c,S,A,UIMM) ppc_emit32(c, (27 << 26) | (S << 21) | (A << 16) | (guint16)(UIMM))
/* this marks the end of my work, ct */
/* Introduced in Power ISA 2.02 (P4?) */
#define ppc_frinx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (392 << 1) | Rc)
#define ppc_frin(c,D,B) ppc_frinx(c,D,B,0)
#define ppc_frind(c,D,B) ppc_frinx(c,D,B,1)
#define ppc_fripx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (456 << 1) | Rc)
#define ppc_frip(c,D,B) ppc_fripx(c,D,B,0)
#define ppc_fripd(c,D,B) ppc_fripx(c,D,B,1)
#define ppc_frizx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (424 << 1) | Rc)
#define ppc_friz(c,D,B) ppc_frizx(c,D,B,0)
#define ppc_frizd(c,D,B) ppc_frizx(c,D,B,1)
#define ppc_frimx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (488 << 1) | Rc)
#define ppc_frim(c,D,B) ppc_frimx(c,D,B,0)
#define ppc_frimd(c,D,B) ppc_frimx(c,D,B,1)
/*
* Introduced in Power ISA 2.03 (P5)
* This is an A-form instruction like many of the FP arith ops,
* but arranged slightly differently (swap record and reserved area)
*/
#define ppc_isel(c,D,A,B,C) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (15 << 1) | 0)
#define ppc_isellt(c,D,A,B) ppc_isel(c,D,A,B,0)
#define ppc_iselgt(c,D,A,B) ppc_isel(c,D,A,B,1)
#define ppc_iseleq(c,D,A,B) ppc_isel(c,D,A,B,2)
/* PPC64 */
/* The following FP instructions are not are available to 32-bit
implementations (prior to PowerISA-V2.01 but are available to
32-bit mode programs on 64-bit PowerPC implementations and all
processors compliant with PowerISA-2.01 or later. */
#define ppc_fcfidx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | ((D) << 21) | (0 << 16) | ((B) << 11) | (846 << 1) | (Rc))
#define ppc_fcfid(c,D,B) ppc_fcfidx(c,D,B,0)
#define ppc_fcfidd(c,D,B) ppc_fcfidx(c,D,B,1)
#define ppc_fctidx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | ((D) << 21) | (0 << 16) | ((B) << 11) | (814 << 1) | (Rc))
#define ppc_fctid(c,D,B) ppc_fctidx(c,D,B,0)
#define ppc_fctidd(c,D,B) ppc_fctidx(c,D,B,1)
#define ppc_fctidzx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | ((D) << 21) | (0 << 16) | ((B) << 11) | (815 << 1) | (Rc))
#define ppc_fctidz(c,D,B) ppc_fctidzx(c,D,B,0)
#define ppc_fctidzd(c,D,B) ppc_fctidzx(c,D,B,1)
#ifdef __mono_ppc64__
#define ppc_load_sequence(c,D,v) G_STMT_START { \
ppc_lis ((c), (D), ((guint64)(v) >> 48) & 0xffff); \
ppc_ori ((c), (D), (D), ((guint64)(v) >> 32) & 0xffff); \
ppc_sldi ((c), (D), (D), 32); \
ppc_oris ((c), (D), (D), ((guint64)(v) >> 16) & 0xffff); \
ppc_ori ((c), (D), (D), (guint64)(v) & 0xffff); \
} G_STMT_END
#define PPC_LOAD_SEQUENCE_LENGTH 20
#define ppc_is_imm32(val) (((((gint64)val)>> 31) == 0) || ((((gint64)val)>> 31) == -1))
#define ppc_is_imm48(val) (((((gint64)val)>> 47) == 0) || ((((gint64)val)>> 47) == -1))
#define ppc_load48(c,D,v) G_STMT_START { \
ppc_li ((c), (D), ((gint64)(v) >> 32) & 0xffff); \
ppc_sldi ((c), (D), (D), 32); \
ppc_oris ((c), (D), (D), ((guint64)(v) >> 16) & 0xffff); \
ppc_ori ((c), (D), (D), (guint64)(v) & 0xffff); \
} G_STMT_END
#define ppc_load(c,D,v) G_STMT_START { \
if (ppc_is_imm16 ((guint64)(v))) { \
ppc_li ((c), (D), (guint16)(guint64)(v)); \
} else if (ppc_is_imm32 ((guint64)(v))) { \
ppc_load32 ((c), (D), (guint32)(guint64)(v)); \
} else if (ppc_is_imm48 ((guint64)(v))) { \
ppc_load48 ((c), (D), (guint64)(v)); \
} else { \
ppc_load_sequence ((c), (D), (guint64)(v)); \
} \
} G_STMT_END
#if _CALL_ELF == 2
#define ppc_load_func(c,D,V) ppc_load_sequence ((c), (D), (V))
#else
#define ppc_load_func(c,D,v) G_STMT_START { \
ppc_load_sequence ((c), ppc_r12, (guint64)(gsize)(v)); \
ppc_ldptr ((c), ppc_r2, sizeof (gpointer), ppc_r12); \
ppc_ldptr ((c), (D), 0, ppc_r12); \
} G_STMT_END
#endif
#define ppc_load_multiple_regs(c,D,d,A) G_STMT_START { \
int __i, __o = (d); \
for (__i = (D); __i <= 31; ++__i) { \
ppc_ldr ((c), __i, __o, (A)); \
__o += sizeof (guint64); \
} \
} G_STMT_END
#define ppc_store_multiple_regs(c,S,d,A) G_STMT_START { \
int __i, __o = (d); \
for (__i = (S); __i <= 31; ++__i) { \
ppc_str ((c), __i, __o, (A)); \
__o += sizeof (guint64); \
} \
} G_STMT_END
#define ppc_compare(c,cfrD,A,B) ppc_cmp((c), (cfrD), 1, (A), (B))
#define ppc_compare_reg_imm(c,cfrD,A,B) ppc_cmpi((c), (cfrD), 1, (A), (B))
#define ppc_compare_log(c,cfrD,A,B) ppc_cmpl((c), (cfrD), 1, (A), (B))
#define ppc_shift_left(c,A,S,B) ppc_sld((c), (A), (S), (B))
#define ppc_shift_left_imm(c,A,S,n) ppc_sldi((c), (A), (S), (n))
#define ppc_shift_right_imm(c,A,S,B) ppc_srdi((c), (A), (S), (B))
#define ppc_shift_right_arith_imm(c,A,S,B) ppc_sradi((c), (A), (S), (B))
#define ppc_multiply(c,D,A,B) ppc_mulld((c), (D), (A), (B))
#define ppc_clear_right_imm(c,A,S,n) ppc_clrrdi((c), (A), (S), (n))
#define ppc_divdx(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | ((OE) << 10) | (489 << 1) | (Rc))
#define ppc_divd(c,D,A,B) ppc_divdx(c,D,A,B,0,0)
#define ppc_divdd(c,D,A,B) ppc_divdx(c,D,A,B,0,1)
#define ppc_divdo(c,D,A,B) ppc_divdx(c,D,A,B,1,0)
#define ppc_divdod(c,D,A,B) ppc_divdx(c,D,A,B,1,1)
#define ppc_divdux(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | ((OE) << 10) | (457 << 1) | (Rc))
#define ppc_divdu(c,D,A,B) ppc_divdux(c,D,A,B,0,0)
#define ppc_divdud(c,D,A,B) ppc_divdux(c,D,A,B,0,1)
#define ppc_divduo(c,D,A,B) ppc_divdux(c,D,A,B,1,0)
#define ppc_divduod(c,D,A,B) ppc_divdux(c,D,A,B,1,1)
#define ppc_extswx(c,S,A,Rc) ppc_emit32(c, (31 << 26) | ((S) << 21) | ((A) << 16) | (0 << 11) | (986 << 1) | (Rc))
#define ppc_extsw(c,A,S) ppc_extswx(c,S,A,0)
#define ppc_extswd(c,A,S) ppc_extswx(c,S,A,1)
/* These move float to/from instuctions are only available on POWER6 in
native mode. These instruction are faster then the equivalent
store/load because they avoid the store queue and associated delays.
These instructions should only be used in 64-bit mode unless the
kernel preserves the 64-bit GPR on signals and dispatch in 32-bit
mode. The Linux kernel does not. */
#define ppc_mftgpr(c,T,B) ppc_emit32(c, (31 << 26) | ((T) << 21) | (0 << 16) | ((B) << 11) | (735 << 1) | 0)
#define ppc_mffgpr(c,T,B) ppc_emit32(c, (31 << 26) | ((T) << 21) | (0 << 16) | ((B) << 11) | (607 << 1) | 0)
#define ppc_ld(c,D,ds,A) ppc_emit32(c, (58 << 26) | ((D) << 21) | ((A) << 16) | ((guint32)(ds) & 0xfffc) | 0)
#define ppc_lwa(c,D,ds,A) ppc_emit32(c, (58 << 26) | ((D) << 21) | ((A) << 16) | ((ds) & 0xfffc) | 2)
#define ppc_ldarx(c,D,A,B) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (84 << 1) | 0)
#define ppc_ldu(c,D,ds,A) ppc_emit32(c, (58 << 26) | ((D) << 21) | ((A) << 16) | ((guint32)(ds) & 0xfffc) | 1)
#define ppc_ldux(c,D,A,B) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (53 << 1) | 0)
#define ppc_lwaux(c,D,A,B) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (373 << 1) | 0)
#define ppc_ldx(c,D,A,B) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (21 << 1) | 0)
#define ppc_lwax(c,D,A,B) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (341 << 1) | 0)
#define ppc_mulhdx(c,D,A,B,Rc) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (0 << 10) | (73 << 1) | (Rc))
#define ppc_mulhd(c,D,A,B) ppc_mulhdx(c,D,A,B,0)
#define ppc_mulhdd(c,D,A,B) ppc_mulhdx(c,D,A,B,1)
#define ppc_mulhdux(c,D,A,B,Rc) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (0 << 10) | (9 << 1) | (Rc))
#define ppc_mulhdu(c,D,A,B) ppc_mulhdux(c,D,A,B,0)
#define ppc_mulhdud(c,D,A,B) ppc_mulhdux(c,D,A,B,1)
#define ppc_mulldx(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | ((OE) << 10) | (233 << 1) | (Rc))
#define ppc_mulld(c,D,A,B) ppc_mulldx(c,D,A,B,0,0)
#define ppc_mulldd(c,D,A,B) ppc_mulldx(c,D,A,B,0,1)
#define ppc_mulldo(c,D,A,B) ppc_mulldx(c,D,A,B,1,0)
#define ppc_mulldod(c,D,A,B) ppc_mulldx(c,D,A,B,1,1)
#define ppc_rldclx(c,A,S,B,MB,Rc) ppc_emit32(c, (30 << 26) | ((S) << 21) | ((A) << 16) | ((B) << 11) | (ppc_split_5_1(MB) << 5) | (8 << 1) | (Rc))
#define ppc_rldcl(c,A,S,B,MB) ppc_rldclx(c,A,S,B,MB,0)
#define ppc_rldcld(c,A,S,B,MB) ppc_rldclx(c,A,S,B,MB,1)
#define ppc_rotld(c,A,S,B) ppc_rldcl(c, A, S, B, 0)
#define ppc_rldcrx(c,A,S,B,ME,Rc) ppc_emit32(c, (30 << 26) | ((S) << 21) | ((A) << 16) | ((B) << 11) | (ppc_split_5_1(ME) << 5) | (9 << 1) | (Rc))
#define ppc_rldcr(c,A,S,B,ME) ppc_rldcrx(c,A,S,B,ME,0)
#define ppc_rldcrd(c,A,S,B,ME) ppc_rldcrx(c,A,S,B,ME,1)
#define ppc_rldicx(c,S,A,SH,MB,Rc) ppc_emit32(c, (30 << 26) | ((S) << 21) | ((A) << 16) | (ppc_split_5_1_5(SH) << 11) | (ppc_split_5_1(MB) << 5) | (2 << 2) | (ppc_split_5_1_1(SH) << 1) | (Rc))
#define ppc_rldic(c,A,S,SH,MB) ppc_rldicx(c,S,A,SH,MB,0)
#define ppc_rldicd(c,A,S,SH,MB) ppc_rldicx(c,S,A,SH,MB,1)
#define ppc_rldiclx(c,S,A,SH,MB,Rc) ppc_emit32(c, (30 << 26) | ((S) << 21) | ((A) << 16) | (ppc_split_5_1_5(SH) << 11) | (ppc_split_5_1(MB) << 5) | (0 << 2) | (ppc_split_5_1_1(SH) << 1) | (Rc))
#define ppc_rldicl(c,A,S,SH,MB) ppc_rldiclx(c,S,A,SH,MB,0)
#define ppc_rldicld(c,A,S,SH,MB) ppc_rldiclx(c,S,A,SH,MB,1)
#define ppc_extrdi(c,A,S,n,b) ppc_rldicl(c,A,S, (b) + (n), 64 - (n))
#define ppc_rotldi(c,A,S,n) ppc_rldicl(c,A,S, n, 0)
#define ppc_rotrdi(c,A,S,n) ppc_rldicl(c,A,S, 64 - (n), 0)
#define ppc_srdi(c,A,S,n) ppc_rldicl(c,A,S, 64 - (n), n)
#define ppc_clrldi(c,A,S,n) ppc_rldicl(c,A,S, 0, n)
#define ppc_rldicrx(c,A,S,SH,ME,Rc) ppc_emit32(c, (30 << 26) | ((S) << 21) | ((A) << 16) | (ppc_split_5_1_5(SH) << 11) | (ppc_split_5_1(ME) << 5) | (1 << 2) | (ppc_split_5_1_1(SH) << 1) | (Rc))
#define ppc_rldicr(c,A,S,SH,ME) ppc_rldicrx(c,A,S,SH,ME,0)
#define ppc_rldicrd(c,A,S,SH,ME) ppc_rldicrx(c,A,S,SH,ME,1)
#define ppc_extldi(c,A,S,n,b) ppc_rldicr(c, A, S, b, (n) - 1)
#define ppc_sldi(c,A,S,n) ppc_rldicr(c, A, S, n, 63 - (n))
#define ppc_clrrdi(c,A,S,n) ppc_rldicr(c, A, S, 0, 63 - (n))
#define ppc_rldimix(c,S,A,SH,MB,Rc) ppc_emit32(c, (30 << 26) | ((S) << 21) | ((A) << 16) | (ppc_split_5_1_5(SH) << 11) | (ppc_split_5_1(MB) << 5) | (3 << 2) | (ppc_split_5_1_1(SH) << 1) | (Rc))
#define ppc_rldimi(c,A,S,SH,MB) ppc_rldimix(c,S,A,SH,MB,0)
#define ppc_rldimid(c,A,S,SH,MB) ppc_rldimix(c,S,A,SH,MB,1)
#define ppc_slbia(c) ppc_emit32(c, (31 << 26) | (0 << 21) | (0 << 16) | (0 << 11) | (498 << 1) | 0)
#define ppc_slbie(c,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (0 << 16) | ((B) << 11) | (434 << 1) | 0)
#define ppc_sldx(c,S,A,B,Rc) ppc_emit32(c, (31 << 26) | ((S) << 21) | ((A) << 16) | ((B) << 11) | (27 << 1) | (Rc))
#define ppc_sld(c,A,S,B) ppc_sldx(c,S,A,B,0)
#define ppc_sldd(c,A,S,B) ppc_sldx(c,S,A,B,1)
#define ppc_sradx(c,S,A,B,Rc) ppc_emit32(c, (31 << 26) | ((S) << 21) | ((A) << 16) | ((B) << 11) | (794 << 1) | (Rc))
#define ppc_srad(c,A,S,B) ppc_sradx(c,S,A,B,0)
#define ppc_sradd(c,A,S,B) ppc_sradx(c,S,A,B,1)
#define ppc_sradix(c,S,A,SH,Rc) ppc_emit32(c, (31 << 26) | ((S) << 21) | ((A) << 16) | (((SH) & 31) << 11) | (413 << 2) | (((SH) >> 5) << 1) | (Rc))
#define ppc_sradi(c,A,S,SH) ppc_sradix(c,S,A,SH,0)
#define ppc_sradid(c,A,S,SH) ppc_sradix(c,S,A,SH,1)
#define ppc_srdx(c,S,A,B,Rc) ppc_emit32(c, (31 << 26) | ((S) << 21) | ((A) << 16) | ((B) << 11) | (539 << 1) | (Rc))
#define ppc_srd(c,A,S,B) ppc_srdx(c,S,A,B,0)
#define ppc_srdd(c,A,S,B) ppc_srdx(c,S,A,B,1)
#define ppc_std(c,S,ds,A) ppc_emit32(c, (62 << 26) | ((S) << 21) | ((A) << 16) | ((guint32)(ds) & 0xfffc) | 0)
#define ppc_stdcxd(c,S,A,B) ppc_emit32(c, (31 << 26) | ((S) << 21) | ((A) << 16) | ((B) << 11) | (214 << 1) | 1)
#define ppc_stdu(c,S,ds,A) ppc_emit32(c, (62 << 26) | ((S) << 21) | ((A) << 16) | ((guint32)(ds) & 0xfffc) | 1)
#define ppc_stdux(c,S,A,B) ppc_emit32(c, (31 << 26) | ((S) << 21) | ((A) << 16) | ((B) << 11) | (181 << 1) | 0)
#define ppc_stdx(c,S,A,B) ppc_emit32(c, (31 << 26) | ((S) << 21) | ((A) << 16) | ((B) << 11) | (149 << 1) | 0)
#else
/* Always true for 32-bit */
#define ppc_is_imm32(val) (1)
#endif
#endif
|
/*
Authors:
Radek Doulik
Christopher Taylor <ct_AT_clemson_DOT_edu>
Andreas Faerber <[email protected]>
Copyright (C) 2001 Radek Doulik
Copyright (C) 2007-2008 Andreas Faerber
for testing do the following: ./test | as -o test.o
Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#ifndef __MONO_PPC_CODEGEN_H__
#define __MONO_PPC_CODEGEN_H__
#include <glib.h>
#include <assert.h>
typedef enum {
ppc_r0 = 0,
ppc_r1,
ppc_sp = ppc_r1,
ppc_r2,
ppc_r3,
ppc_r4,
ppc_r5,
ppc_r6,
ppc_r7,
ppc_r8,
ppc_r9,
ppc_r10,
ppc_r11,
ppc_r12,
ppc_r13,
ppc_r14,
ppc_r15,
ppc_r16,
ppc_r17,
ppc_r18,
ppc_r19,
ppc_r20,
ppc_r21,
ppc_r22,
ppc_r23,
ppc_r24,
ppc_r25,
ppc_r26,
ppc_r27,
ppc_r28,
ppc_r29,
ppc_r30,
ppc_r31
} PPCIntRegister;
typedef enum {
ppc_f0 = 0,
ppc_f1,
ppc_f2,
ppc_f3,
ppc_f4,
ppc_f5,
ppc_f6,
ppc_f7,
ppc_f8,
ppc_f9,
ppc_f10,
ppc_f11,
ppc_f12,
ppc_f13,
ppc_f14,
ppc_f15,
ppc_f16,
ppc_f17,
ppc_f18,
ppc_f19,
ppc_f20,
ppc_f21,
ppc_f22,
ppc_f23,
ppc_f24,
ppc_f25,
ppc_f26,
ppc_f27,
ppc_f28,
ppc_f29,
ppc_f30,
ppc_f31
} PPCFloatRegister;
typedef enum {
ppc_lr = 256,
ppc_ctr = 256 + 32,
ppc_xer = 32
} PPCSpecialRegister;
enum {
/* B0 operand for branches */
PPC_BR_DEC_CTR_NONZERO_FALSE = 0,
PPC_BR_LIKELY = 1, /* can be or'ed with the conditional variants */
PPC_BR_DEC_CTR_ZERO_FALSE = 2,
PPC_BR_FALSE = 4,
PPC_BR_DEC_CTR_NONZERO_TRUE = 8,
PPC_BR_DEC_CTR_ZERO_TRUE = 10,
PPC_BR_TRUE = 12,
PPC_BR_DEC_CTR_NONZERO = 16,
PPC_BR_DEC_CTR_ZERO = 18,
PPC_BR_ALWAYS = 20,
/* B1 operand for branches */
PPC_BR_LT = 0,
PPC_BR_GT = 1,
PPC_BR_EQ = 2,
PPC_BR_SO = 3
};
enum {
PPC_TRAP_LT = 1,
PPC_TRAP_GT = 2,
PPC_TRAP_EQ = 4,
PPC_TRAP_LT_UN = 8,
PPC_TRAP_GT_UN = 16,
PPC_TRAP_LE = 1 + PPC_TRAP_EQ,
PPC_TRAP_GE = 2 + PPC_TRAP_EQ,
PPC_TRAP_LE_UN = 8 + PPC_TRAP_EQ,
PPC_TRAP_GE_UN = 16 + PPC_TRAP_EQ
};
#define ppc_emit32(c,x) do { *((guint32 *) (c)) = (guint32) (x); (c) = ((guint8 *)(c) + sizeof (guint32));} while (0)
#define ppc_is_imm16(val) ((((val)>> 15) == 0) || (((val)>> 15) == -1))
#define ppc_is_uimm16(val) ((glong)(val) >= 0L && (glong)(val) <= 65535L)
#define ppc_ha(val) (((val >> 16) + ((val & 0x8000) ? 1 : 0)) & 0xffff)
#define ppc_load32(c,D,v) G_STMT_START { \
ppc_lis ((c), (D), (guint32)(v) >> 16); \
ppc_ori ((c), (D), (D), (guint32)(v) & 0xffff); \
} G_STMT_END
/* Macros to load/store pointer sized quantities */
#if defined(__mono_ppc64__) && !defined(MONO_ARCH_ILP32)
#define ppc_ldptr(c,D,d,A) ppc_ld ((c), (D), (d), (A))
#define ppc_ldptr_update(c,D,d,A) ppc_ldu ((c), (D), (d), (A))
#define ppc_ldptr_indexed(c,D,A,B) ppc_ldx ((c), (D), (A), (B))
#define ppc_ldptr_update_indexed(c,D,A,B) ppc_ldux ((c), (D), (A), (B))
#define ppc_stptr(c,S,d,A) ppc_std ((c), (S), (d), (A))
#define ppc_stptr_update(c,S,d,A) ppc_stdu ((c), (S), (d), (A))
#define ppc_stptr_indexed(c,S,A,B) ppc_stdx ((c), (S), (A), (B))
#define ppc_stptr_update_indexed(c,S,A,B) ppc_stdux ((c), (S), (A), (B))
#else
/* Same as ppc32 */
#define ppc_ldptr(c,D,d,A) ppc_lwz ((c), (D), (d), (A))
#define ppc_ldptr_update(c,D,d,A) ppc_lwzu ((c), (D), (d), (A))
#define ppc_ldptr_indexed(c,D,A,B) ppc_lwzx ((c), (D), (A), (B))
#define ppc_ldptr_update_indexed(c,D,A,B) ppc_lwzux ((c), (D), (A), (B))
#define ppc_stptr(c,S,d,A) ppc_stw ((c), (S), (d), (A))
#define ppc_stptr_update(c,S,d,A) ppc_stwu ((c), (S), (d), (A))
#define ppc_stptr_indexed(c,S,A,B) ppc_stwx ((c), (S), (A), (B))
#define ppc_stptr_update_indexed(c,S,A,B) ppc_stwux ((c), (S), (A), (B))
#endif
/* Macros to load pointer sized immediates */
#define ppc_load_ptr(c,D,v) ppc_load ((c),(D),(gsize)(v))
#define ppc_load_ptr_sequence(c,D,v) ppc_load_sequence ((c),(D),(gsize)(v))
/* Macros to load/store regsize quantities */
#ifdef __mono_ppc64__
#define ppc_ldr(c,D,d,A) ppc_ld ((c), (D), (d), (A))
#define ppc_ldr_indexed(c,D,A,B) ppc_ldx ((c), (D), (A), (B))
#define ppc_str(c,S,d,A) ppc_std ((c), (S), (d), (A))
#define ppc_str_update(c,S,d,A) ppc_stdu ((c), (S), (d), (A))
#define ppc_str_indexed(c,S,A,B) ppc_stdx ((c), (S), (A), (B))
#define ppc_str_update_indexed(c,S,A,B) ppc_stdux ((c), (S), (A), (B))
#else
#define ppc_ldr(c,D,d,A) ppc_lwz ((c), (D), (d), (A))
#define ppc_ldr_indexed(c,D,A,B) ppc_lwzx ((c), (D), (A), (B))
#define ppc_str(c,S,d,A) ppc_stw ((c), (S), (d), (A))
#define ppc_str_update(c,S,d,A) ppc_stwu ((c), (S), (d), (A))
#define ppc_str_indexed(c,S,A,B) ppc_stwx ((c), (S), (A), (B))
#define ppc_str_update_indexed(c,S,A,B) ppc_stwux ((c), (S), (A), (B))
#endif
#define ppc_str_multiple(c,S,d,A) ppc_store_multiple_regs((c),(S),(d),(A))
#define ppc_ldr_multiple(c,D,d,A) ppc_load_multiple_regs((c),(D),(d),(A))
/* PPC32 macros */
#ifndef __mono_ppc64__
#define ppc_load_sequence(c,D,v) ppc_load32 ((c), (D), (guint32)(v))
#define PPC_LOAD_SEQUENCE_LENGTH 8
#define ppc_load(c,D,v) G_STMT_START { \
if (ppc_is_imm16 ((guint32)(v))) { \
ppc_li ((c), (D), (guint16)(guint32)(v)); \
} else { \
ppc_load32 ((c), (D), (guint32)(v)); \
} \
} G_STMT_END
#define ppc_load_func(c,D,V) ppc_load_sequence ((c), (D), (V))
#define ppc_load_multiple_regs(c,D,d,A) ppc_lmw ((c), (D), (d), (A))
#define ppc_store_multiple_regs(c,S,d,A) ppc_stmw ((c), (S), (d), (A))
#define ppc_compare(c,cfrD,A,B) ppc_cmp((c), (cfrD), 0, (A), (B))
#define ppc_compare_reg_imm(c,cfrD,A,B) ppc_cmpi((c), (cfrD), 0, (A), (B))
#define ppc_compare_log(c,cfrD,A,B) ppc_cmpl((c), (cfrD), 0, (A), (B))
#define ppc_shift_left(c,A,S,B) ppc_slw((c), (S), (A), (B))
#define ppc_shift_left_imm(c,A,S,n) ppc_slwi((c), (A), (S), (n))
#define ppc_shift_right_imm(c,A,S,B) ppc_srwi((c), (A), (S), (B))
#define ppc_shift_right_arith_imm(c,A,S,B) ppc_srawi((c), (A), (S), (B))
#define ppc_multiply(c,D,A,B) ppc_mullw((c), (D), (A), (B))
#define ppc_clear_right_imm(c,A,S,n) ppc_clrrwi((c), (A), (S), (n))
#endif
#define ppc_opcode(c) ((c) >> 26)
#define ppc_split_5_1_1(x) (((x) >> 5) & 0x1)
#define ppc_split_5_1_5(x) ((x) & 0x1F)
#define ppc_split_5_1(x) ((ppc_split_5_1_5(x) << 1) | ppc_split_5_1_1(x))
#define ppc_break(c) ppc_tw((c),31,0,0)
#define ppc_addi(c,D,A,i) ppc_emit32 (c, (14 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(i))
#define ppc_addis(c,D,A,i) ppc_emit32 (c, (15 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(i))
#define ppc_li(c,D,v) ppc_addi (c, D, 0, (guint16)(v))
#define ppc_lis(c,D,v) ppc_addis (c, D, 0, (guint16)(v))
#define ppc_lwz(c,D,d,A) ppc_emit32 (c, (32 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_lhz(c,D,d,A) ppc_emit32 (c, (40 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_lbz(c,D,d,A) ppc_emit32 (c, (34 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_stw(c,S,d,A) ppc_emit32 (c, (36 << 26) | ((S) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_sth(c,S,d,A) ppc_emit32 (c, (44 << 26) | ((S) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_stb(c,S,d,A) ppc_emit32 (c, (38 << 26) | ((S) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_stwu(c,s,d,A) ppc_emit32 (c, (37 << 26) | ((s) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_or(c,a,s,b) ppc_emit32 (c, (31 << 26) | ((s) << 21) | ((a) << 16) | ((b) << 11) | 888)
#define ppc_mr(c,a,s) ppc_or (c, a, s, s)
#define ppc_ori(c,S,A,ui) ppc_emit32 (c, (24 << 26) | ((S) << 21) | ((A) << 16) | (guint16)(ui))
#define ppc_nop(c) ppc_ori (c, 0, 0, 0)
#define ppc_mfspr(c,D,spr) ppc_emit32 (c, (31 << 26) | ((D) << 21) | ((spr) << 11) | (339 << 1))
#define ppc_mflr(c,D) ppc_mfspr (c, D, ppc_lr)
#define ppc_mtspr(c,spr,S) ppc_emit32 (c, (31 << 26) | ((S) << 21) | ((spr) << 11) | (467 << 1))
#define ppc_mtlr(c,S) ppc_mtspr (c, ppc_lr, S)
#define ppc_mtctr(c,S) ppc_mtspr (c, ppc_ctr, S)
#define ppc_mtxer(c,S) ppc_mtspr (c, ppc_xer, S)
#define ppc_b(c,li) ppc_emit32 (c, (18 << 26) | ((li) << 2))
#define ppc_bl(c,li) ppc_emit32 (c, (18 << 26) | ((li) << 2) | 1)
#define ppc_ba(c,li) ppc_emit32 (c, (18 << 26) | ((li) << 2) | 2)
#define ppc_bla(c,li) ppc_emit32 (c, (18 << 26) | ((li) << 2) | 3)
#define ppc_blrl(c) ppc_emit32 (c, 0x4e800021)
#define ppc_blr(c) ppc_emit32 (c, 0x4e800020)
#define ppc_lfs(c,D,d,A) ppc_emit32 (c, (48 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_lfd(c,D,d,A) ppc_emit32 (c, (50 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(d))
#define ppc_stfs(c,S,d,a) ppc_emit32 (c, (52 << 26) | ((S) << 21) | ((a) << 16) | (guint16)(d))
#define ppc_stfd(c,S,d,a) ppc_emit32 (c, (54 << 26) | ((S) << 21) | ((a) << 16) | (guint16)(d))
/***********************************************************************
The macros below were tapped out by Christopher Taylor <ct_AT_clemson_DOT_edu>
from 18 November 2002 to 19 December 2002.
Special thanks to rodo, lupus, dietmar, miguel, and duncan for patience,
and motivation.
The macros found in this file are based on the assembler instructions found
in Motorola and Digital DNA's:
"Programming Enviornments Manual For 32-bit Implementations of the PowerPC Architecture"
MPCFPE32B/AD
12/2001
REV2
see pages 326 - 524 for detailed information regarding each instruction
Also see the "Ximian Copyright Agreement, 2002" for more information regarding
my and Ximian's copyright to this code. ;)
*************************************************************************/
#define ppc_addx(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (OE << 10) | (266 << 1) | Rc)
#define ppc_add(c,D,A,B) ppc_addx(c,D,A,B,0,0)
#define ppc_addd(c,D,A,B) ppc_addx(c,D,A,B,0,1)
#define ppc_addo(c,D,A,B) ppc_addx(c,D,A,B,1,0)
#define ppc_addod(c,D,A,B) ppc_addx(c,D,A,B,1,1)
#define ppc_addcx(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (OE << 10) | (10 << 1) | Rc)
#define ppc_addc(c,D,A,B) ppc_addcx(c,D,A,B,0,0)
#define ppc_addcd(c,D,A,B) ppc_addcx(c,D,A,B,0,1)
#define ppc_addco(c,D,A,B) ppc_addcx(c,D,A,B,1,0)
#define ppc_addcod(c,D,A,B) ppc_addcx(c,D,A,B,1,1)
#define ppc_addex(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (OE << 10) | (138 << 1) | Rc)
#define ppc_adde(c,D,A,B) ppc_addex(c,D,A,B,0,0)
#define ppc_added(c,D,A,B) ppc_addex(c,D,A,B,0,1)
#define ppc_addeo(c,D,A,B) ppc_addex(c,D,A,B,1,0)
#define ppc_addeod(c,D,A,B) ppc_addex(c,D,A,B,1,1)
#define ppc_addic(c,D,A,i) ppc_emit32(c, (12 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(i))
#define ppc_addicd(c,D,A,i) ppc_emit32(c, (13 << 26) | ((D) << 21) | ((A) << 16) | (guint16)(i))
#define ppc_addmex(c,D,A,OE,RC) ppc_emit32(c, (31 << 26) | ((D) << 21 ) | ((A) << 16) | (0 << 11) | ((OE) << 10) | (234 << 1) | RC)
#define ppc_addme(c,D,A) ppc_addmex(c,D,A,0,0)
#define ppc_addmed(c,D,A) ppc_addmex(c,D,A,0,1)
#define ppc_addmeo(c,D,A) ppc_addmex(c,D,A,1,0)
#define ppc_addmeod(c,D,A) ppc_addmex(c,D,A,1,1)
#define ppc_addzex(c,D,A,OE,RC) ppc_emit32(c, (31 << 26) | ((D) << 21 ) | ((A) << 16) | (0 << 11) | ((OE) << 10) | (202 << 1) | RC)
#define ppc_addze(c,D,A) ppc_addzex(c,D,A,0,0)
#define ppc_addzed(c,D,A) ppc_addzex(c,D,A,0,1)
#define ppc_addzeo(c,D,A) ppc_addzex(c,D,A,1,0)
#define ppc_addzeod(c,D,A) ppc_addzex(c,D,A,1,1)
#define ppc_andx(c,S,A,B,RC) ppc_emit32(c, (31 << 26) | ((S) << 21 ) | ((A) << 16) | ((B) << 11) | (28 << 1) | RC)
#define ppc_and(c,S,A,B) ppc_andx(c,S,A,B,0)
#define ppc_andd(c,S,A,B) ppc_andx(c,S,A,B,1)
#define ppc_andcx(c,S,A,B,RC) ppc_emit32(c, (31 << 26) | ((S) << 21 ) | ((A) << 16) | ((B) << 11) | (60 << 1) | RC)
#define ppc_andc(c,S,A,B) ppc_andcx(c,S,A,B,0)
#define ppc_andcd(c,S,A,B) ppc_andcx(c,S,A,B,1)
#define ppc_andid(c,S,A,ui) ppc_emit32(c, (28 << 26) | ((S) << 21 ) | ((A) << 16) | ((guint16)(ui)))
#define ppc_andisd(c,S,A,ui) ppc_emit32(c, (29 << 26) | ((S) << 21 ) | ((A) << 16) | ((guint16)(ui)))
#define ppc_bcx(c,BO,BI,BD,AA,LK) ppc_emit32(c, (16 << 26) | ((BO) << 21 )| ((BI) << 16) | (BD << 2) | ((AA) << 1) | LK)
#define ppc_bc(c,BO,BI,BD) ppc_bcx(c,BO,BI,BD,0,0)
#define ppc_bca(c,BO,BI,BD) ppc_bcx(c,BO,BI,BD,1,0)
#define ppc_bcl(c,BO,BI,BD) ppc_bcx(c,BO,BI,BD,0,1)
#define ppc_bcla(c,BO,BI,BD) ppc_bcx(c,BO,BI,BD,1,1)
#define ppc_bcctrx(c,BO,BI,LK) ppc_emit32(c, (19 << 26) | (BO << 21 )| (BI << 16) | (0 << 11) | (528 << 1) | LK)
#define ppc_bcctr(c,BO,BI) ppc_bcctrx(c,BO,BI,0)
#define ppc_bcctrl(c,BO,BI) ppc_bcctrx(c,BO,BI,1)
#define ppc_bnectrp(c,BO,BI) ppc_bcctr(c,BO,BI)
#define ppc_bnectrlp(c,BO,BI) ppc_bcctr(c,BO,BI)
#define ppc_bclrx(c,BO,BI,BH,LK) ppc_emit32(c, (19 << 26) | ((BO) << 21 )| ((BI) << 16) | (0 << 13) | ((BH) << 11) | (16 << 1) | (LK))
#define ppc_bclr(c,BO,BI,BH) ppc_bclrx(c,BO,BI,BH,0)
#define ppc_bclrl(c,BO,BI,BH) ppc_bclrx(c,BO,BI,BH,1)
#define ppc_bnelrp(c,BO,BI) ppc_bclr(c,BO,BI,0)
#define ppc_bnelrlp(c,BO,BI) ppc_bclr(c,BO,BI,0)
#define ppc_cmp(c,cfrD,L,A,B) ppc_emit32(c, (31 << 26) | ((cfrD) << 23) | (0 << 22) | ((L) << 21) | ((A) << 16) | ((B) << 11) | (0 << 1) | 0)
#define ppc_cmpi(c,cfrD,L,A,B) ppc_emit32(c, (11 << 26) | (cfrD << 23) | (0 << 22) | (L << 21) | (A << 16) | (guint16)(B))
#define ppc_cmpl(c,cfrD,L,A,B) ppc_emit32(c, (31 << 26) | ((cfrD) << 23) | (0 << 22) | ((L) << 21) | ((A) << 16) | ((B) << 11) | (32 << 1) | 0)
#define ppc_cmpli(c,cfrD,L,A,B) ppc_emit32(c, (10 << 26) | (cfrD << 23) | (0 << 22) | (L << 21) | (A << 16) | (guint16)(B))
#define ppc_cmpw(c,cfrD,A,B) ppc_cmp(c, (cfrD), 0, (A), (B))
#define ppc_cntlzwx(c,S,A,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (0 << 11) | (26 << 1) | Rc)
#define ppc_cntlzw(c,S,A) ppc_cntlzwx(c,S,A,0)
#define ppc_cntlzwd(c,S,A) ppc_cntlzwx(c,S,A,1)
#define ppc_crand(c,D,A,B) ppc_emit32(c, (19 << 26) | (D << 21) | (A << 16) | (B << 11) | (257 << 1) | 0)
#define ppc_crandc(c,D,A,B) ppc_emit32(c, (19 << 26) | (D << 21) | (A << 16) | (B << 11) | (129 << 1) | 0)
#define ppc_creqv(c,D,A,B) ppc_emit32(c, (19 << 26) | (D << 21) | (A << 16) | (B << 11) | (289 << 1) | 0)
#define ppc_crnand(c,D,A,B) ppc_emit32(c, (19 << 26) | (D << 21) | (A << 16) | (B << 11) | (225 << 1) | 0)
#define ppc_crnor(c,D,A,B) ppc_emit32(c, (19 << 26) | (D << 21) | (A << 16) | (B << 11) | (33 << 1) | 0)
#define ppc_cror(c,D,A,B) ppc_emit32(c, (19 << 26) | (D << 21) | (A << 16) | (B << 11) | (449 << 1) | 0)
#define ppc_crorc(c,D,A,B) ppc_emit32(c, (19 << 26) | (D << 21) | (A << 16) | (B << 11) | (417 << 1) | 0)
#define ppc_crxor(c,D,A,B) ppc_emit32(c, (19 << 26) | (D << 21) | (A << 16) | (B << 11) | (193 << 1) | 0)
#define ppc_dcba(c,A,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (A << 16) | (B << 11) | (758 << 1) | 0)
#define ppc_dcbf(c,A,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (A << 16) | (B << 11) | (86 << 1) | 0)
#define ppc_dcbi(c,A,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (A << 16) | (B << 11) | (470 << 1) | 0)
#define ppc_dcbst(c,A,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (A << 16) | (B << 11) | (54 << 1) | 0)
#define ppc_dcbt(c,A,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (A << 16) | (B << 11) | (278 << 1) | 0)
#define ppc_dcbtst(c,A,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (A << 16) | (B << 11) | (246 << 1) | 0)
#define ppc_dcbz(c,A,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (A << 16) | (B << 11) | (1014 << 1) | 0)
#define ppc_divwx(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (OE << 10) | (491 << 1) | Rc)
#define ppc_divw(c,D,A,B) ppc_divwx(c,D,A,B,0,0)
#define ppc_divwd(c,D,A,B) ppc_divwx(c,D,A,B,0,1)
#define ppc_divwo(c,D,A,B) ppc_divwx(c,D,A,B,1,0)
#define ppc_divwod(c,D,A,B) ppc_divwx(c,D,A,B,1,1)
#define ppc_divwux(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (OE << 10) | (459 << 1) | Rc)
#define ppc_divwu(c,D,A,B) ppc_divwux(c,D,A,B,0,0)
#define ppc_divwud(c,D,A,B) ppc_divwux(c,D,A,B,0,1)
#define ppc_divwuo(c,D,A,B) ppc_divwux(c,D,A,B,1,0)
#define ppc_divwuod(c,D,A,B) ppc_divwux(c,D,A,B,1,1)
#define ppc_eciwx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (310 << 1) | 0)
#define ppc_ecowx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (438 << 1) | 0)
#define ppc_eieio(c) ppc_emit32(c, (31 << 26) | (0 << 21) | (0 << 16) | (0 << 11) | (854 << 1) | 0)
#define ppc_eqvx(c,A,S,B,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (284 << 1) | Rc)
#define ppc_eqv(c,A,S,B) ppc_eqvx(c,A,S,B,0)
#define ppc_eqvd(c,A,S,B) ppc_eqvx(c,A,S,B,1)
#define ppc_extsbx(c,A,S,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (0 << 11) | (954 << 1) | Rc)
#define ppc_extsb(c,A,S) ppc_extsbx(c,A,S,0)
#define ppc_extsbd(c,A,S) ppc_extsbx(c,A,S,1)
#define ppc_extshx(c,A,S,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (0 << 11) | (922 << 1) | Rc)
#define ppc_extsh(c,A,S) ppc_extshx(c,A,S,0)
#define ppc_extshd(c,A,S) ppc_extshx(c,A,S,1)
#define ppc_fabsx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (264 << 1) | Rc)
#define ppc_fabs(c,D,B) ppc_fabsx(c,D,B,0)
#define ppc_fabsd(c,D,B) ppc_fabsx(c,D,B,1)
#define ppc_faddx(c,D,A,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (B << 11) | (0 << 6) | (21 << 1) | Rc)
#define ppc_fadd(c,D,A,B) ppc_faddx(c,D,A,B,0)
#define ppc_faddd(c,D,A,B) ppc_faddx(c,D,A,B,1)
#define ppc_faddsx(c,D,A,B,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (A << 16) | (B << 11) | (0 << 6) | (21 << 1) | Rc)
#define ppc_fadds(c,D,A,B) ppc_faddsx(c,D,A,B,0)
#define ppc_faddsd(c,D,A,B) ppc_faddsx(c,D,A,B,1)
#define ppc_fcmpo(c,crfD,A,B) ppc_emit32(c, (63 << 26) | (crfD << 23) | (0 << 21) | (A << 16) | (B << 11) | (32 << 1) | 0)
#define ppc_fcmpu(c,crfD,A,B) ppc_emit32(c, (63 << 26) | (crfD << 23) | (0 << 21) | (A << 16) | (B << 11) | (0 << 1) | 0)
#define ppc_fctiwx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (14 << 1) | Rc)
#define ppc_fctiw(c,D,B) ppc_fctiwx(c,D,B,0)
#define ppc_fctiwd(c,D,B) ppc_fctiwx(c,D,B,1)
#define ppc_fctiwzx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (15 << 1) | Rc)
#define ppc_fctiwz(c,D,B) ppc_fctiwzx(c,D,B,0)
#define ppc_fctiwzd(c,D,B) ppc_fctiwzx(c,D,B,1)
#define ppc_fdivx(c,D,A,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (B << 11) | (0 << 6) | (18 << 1) | Rc)
#define ppc_fdiv(c,D,A,B) ppc_fdivx(c,D,A,B,0)
#define ppc_fdivd(c,D,A,B) ppc_fdivx(c,D,A,B,1)
#define ppc_fdivsx(c,D,A,B,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (A << 16) | (B << 11) | (0 << 6) | (18 << 1) | Rc)
#define ppc_fdivs(c,D,A,B) ppc_fdivsx(c,D,A,B,0)
#define ppc_fdivsd(c,D,A,B) ppc_fdivsx(c,D,A,B,1)
#define ppc_fmaddx(c,D,A,B,C,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (29 << 1) | Rc)
#define ppc_fmadd(c,D,A,B,C) ppc_fmaddx(c,D,A,B,C,0)
#define ppc_fmaddd(c,D,A,B,C) ppc_fmaddx(c,D,A,B,C,1)
#define ppc_fmaddsx(c,D,A,B,C,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (29 << 1) | Rc)
#define ppc_fmadds(c,D,A,B,C) ppc_fmaddsx(c,D,A,B,C,0)
#define ppc_fmaddsd(c,D,A,B,C) ppc_fmaddsx(c,D,A,B,C,1)
#define ppc_fmrx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (72 << 1) | Rc)
#define ppc_fmr(c,D,B) ppc_fmrx(c,D,B,0)
#define ppc_fmrd(c,D,B) ppc_fmrx(c,D,B,1)
#define ppc_fmsubx(c,D,A,C,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (28 << 1) | Rc)
#define ppc_fmsub(c,D,A,C,B) ppc_fmsubx(c,D,A,C,B,0)
#define ppc_fmsubd(c,D,A,C,B) ppc_fmsubx(c,D,A,C,B,1)
#define ppc_fmsubsx(c,D,A,C,B,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (28 << 1) | Rc)
#define ppc_fmsubs(c,D,A,C,B) ppc_fmsubsx(c,D,A,C,B,0)
#define ppc_fmsubsd(c,D,A,C,B) ppc_fmsubsx(c,D,A,C,B,1)
#define ppc_fmulx(c,D,A,C,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (0 << 11) | (C << 6) | (25 << 1) | Rc)
#define ppc_fmul(c,D,A,C) ppc_fmulx(c,D,A,C,0)
#define ppc_fmuld(c,D,A,C) ppc_fmulx(c,D,A,C,1)
#define ppc_fmulsx(c,D,A,C,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (A << 16) | (0 << 11) | (C << 6) | (25 << 1) | Rc)
#define ppc_fmuls(c,D,A,C) ppc_fmulsx(c,D,A,C,0)
#define ppc_fmulsd(c,D,A,C) ppc_fmulsx(c,D,A,C,1)
#define ppc_fnabsx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (136 << 1) | Rc)
#define ppc_fnabs(c,D,B) ppc_fnabsx(c,D,B,0)
#define ppc_fnabsd(c,D,B) ppc_fnabsx(c,D,B,1)
#define ppc_fnegx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (40 << 1) | Rc)
#define ppc_fneg(c,D,B) ppc_fnegx(c,D,B,0)
#define ppc_fnegd(c,D,B) ppc_fnegx(c,D,B,1)
#define ppc_fnmaddx(c,D,A,C,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (31 << 1) | Rc)
#define ppc_fnmadd(c,D,A,C,B) ppc_fnmaddx(c,D,A,C,B,0)
#define ppc_fnmaddd(c,D,A,C,B) ppc_fnmaddx(c,D,A,C,B,1)
#define ppc_fnmaddsx(c,D,A,C,B,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (31 << 1) | Rc)
#define ppc_fnmadds(c,D,A,C,B) ppc_fnmaddsx(c,D,A,C,B,0)
#define ppc_fnmaddsd(c,D,A,C,B) ppc_fnmaddsx(c,D,A,C,B,1)
#define ppc_fnmsubx(c,D,A,C,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (30 << 1) | Rc)
#define ppc_fnmsub(c,D,A,C,B) ppc_fnmsubx(c,D,A,C,B,0)
#define ppc_fnmsubd(c,D,A,C,B) ppc_fnmsubx(c,D,A,C,B,1)
#define ppc_fnmsubsx(c,D,A,C,B,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (30 << 1) | Rc)
#define ppc_fnmsubs(c,D,A,C,B) ppc_fnmsubsx(c,D,A,C,B,0)
#define ppc_fnmsubsd(c,D,A,C,B) ppc_fnmsubsx(c,D,A,C,B,1)
#define ppc_fresx(c,D,B,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (0 << 16) | (B << 11) | (0 << 6) | (24 << 1) | Rc)
#define ppc_fres(c,D,B) ppc_fresx(c,D,B,0)
#define ppc_fresd(c,D,B) ppc_fresx(c,D,B,1)
#define ppc_frspx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (12 << 1) | Rc)
#define ppc_frsp(c,D,B) ppc_frspx(c,D,B,0)
#define ppc_frspd(c,D,B) ppc_frspx(c,D,B,1)
#define ppc_frsqrtex(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (0 << 6) | (26 << 1) | Rc)
#define ppc_frsqrte(c,D,B) ppc_frsqrtex(c,D,B,0)
#define ppc_frsqrted(c,D,B) ppc_frsqrtex(c,D,B,1)
#define ppc_fselx(c,D,A,C,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (23 << 1) | Rc)
#define ppc_fsel(c,D,A,C,B) ppc_fselx(c,D,A,C,B,0)
#define ppc_fseld(c,D,A,C,B) ppc_fselx(c,D,A,C,B,1)
#define ppc_fsqrtx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (0 << 6) | (22 << 1) | Rc)
#define ppc_fsqrt(c,D,B) ppc_fsqrtx(c,D,B,0)
#define ppc_fsqrtd(c,D,B) ppc_fsqrtx(c,D,B,1)
#define ppc_fsqrtsx(c,D,B,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (0 << 16) | (B << 11) | (0 << 6) | (22 << 1) | Rc)
#define ppc_fsqrts(c,D,B) ppc_fsqrtsx(c,D,B,0)
#define ppc_fsqrtsd(c,D,B) ppc_fsqrtsx(c,D,B,1)
#define ppc_fsubx(c,D,A,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (A << 16) | (B << 11) | (0 << 6) | (20 << 1) | Rc)
#define ppc_fsub(c,D,A,B) ppc_fsubx(c,D,A,B,0)
#define ppc_fsubd(c,D,A,B) ppc_fsubx(c,D,A,B,1)
#define ppc_fsubsx(c,D,A,B,Rc) ppc_emit32(c, (59 << 26) | (D << 21) | (A << 16) | (B << 11) | (0 << 6) | (20 << 1) | Rc)
#define ppc_fsubs(c,D,A,B) ppc_fsubsx(c,D,A,B,0)
#define ppc_fsubsd(c,D,A,B) ppc_fsubsx(c,D,A,B,1)
#define ppc_icbi(c,A,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (A << 16) | (B << 11) | (982 << 1) | 0)
#define ppc_isync(c) ppc_emit32(c, (19 << 26) | (0 << 11) | (150 << 1) | 0)
#define ppc_lbzu(c,D,d,A) ppc_emit32(c, (35 << 26) | (D << 21) | (A << 16) | (guint16)d)
#define ppc_lbzux(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (119 << 1) | 0)
#define ppc_lbzx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (87 << 1) | 0)
#define ppc_lfdu(c,D,d,A) ppc_emit32(c, (51 << 26) | (D << 21) | (A << 16) | (guint16)d)
#define ppc_lfdux(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (631 << 1) | 0)
#define ppc_lfdx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (599 << 1) | 0)
#define ppc_lfsu(c,D,d,A) ppc_emit32(c, (49 << 26) | (D << 21) | (A << 16) | (guint16)d)
#define ppc_lfsux(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (567 << 1) | 0)
#define ppc_lfsx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (535 << 1) | 0)
#define ppc_lha(c,D,d,A) ppc_emit32(c, (42 << 26) | (D << 21) | (A << 16) | (guint16)d)
#define ppc_lhau(c,D,d,A) ppc_emit32(c, (43 << 26) | (D << 21) | (A << 16) | (guint16)d)
#define ppc_lhaux(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (375 << 1) | 0)
#define ppc_lhax(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (343 << 1) | 0)
#define ppc_lhbrx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (790 << 1) | 0)
#define ppc_lhzu(c,D,d,A) ppc_emit32(c, (41 << 26) | (D << 21) | (A << 16) | (guint16)d)
#define ppc_lhzux(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (311 << 1) | 0)
#define ppc_lhzx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (279 << 1) | 0)
#define ppc_lmw(c,D,d,A) ppc_emit32(c, (46 << 26) | (D << 21) | (A << 16) | (guint16)d)
#define ppc_lswi(c,D,A,NB) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (NB << 11) | (597 << 1) | 0)
#define ppc_lswx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (533 << 1) | 0)
#define ppc_lwarx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (20 << 1) | 0)
#define ppc_lwbrx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (534 << 1) | 0)
#define ppc_lwzu(c,D,d,A) ppc_emit32(c, (33 << 26) | (D << 21) | (A << 16) | (guint16)d)
#define ppc_lwzux(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (55 << 1) | 0)
#define ppc_lwzx(c,D,A,B) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (23 << 1) | 0)
#define ppc_mcrf(c,crfD,crfS) ppc_emit32(c, (19 << 26) | (crfD << 23) | (0 << 21) | (crfS << 18) | 0)
#define ppc_mcrfs(c,crfD,crfS) ppc_emit32(c, (63 << 26) | (crfD << 23) | (0 << 21) | (crfS << 18) | (0 << 16) | (64 << 1) | 0)
#define ppc_mcrxr(c,crfD) ppc_emit32(c, (31 << 26) | (crfD << 23) | (0 << 16) | (512 << 1) | 0)
#define ppc_mfcr(c,D) ppc_emit32(c, (31 << 26) | (D << 21) | (0 << 16) | (19 << 1) | 0)
#define ppc_mffsx(c,D,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (583 << 1) | Rc)
#define ppc_mffs(c,D) ppc_mffsx(c,D,0)
#define ppc_mffsd(c,D) ppc_mffsx(c,D,1)
#define ppc_mfmsr(c,D) ppc_emit32(c, (31 << 26) | (D << 21) | (0 << 16) | (83 << 1) | 0)
#define ppc_mfsr(c,D,SR) ppc_emit32(c, (31 << 26) | (D << 21) | (0 << 20) | (SR << 16) | (0 << 11) | (595 << 1) | 0)
#define ppc_mfsrin(c,D,B) ppc_emit32(c, (31 << 26) | (D << 21) | (0 << 16) | (B << 11) | (659 << 1) | 0)
#define ppc_mftb(c,D,TBR) ppc_emit32(c, (31 << 26) | (D << 21) | (TBR << 11) | (371 << 1) | 0)
#define ppc_mtcrf(c,CRM,S) ppc_emit32(c, (31 << 26) | (S << 21) | (0 << 20) | (CRM << 12) | (0 << 11) | (144 << 1) | 0)
#define ppc_mtfsb0x(c,CRB,Rc) ppc_emit32(c, (63 << 26) | (CRB << 21) | (0 << 11) | (70 << 1) | Rc)
#define ppc_mtfsb0(c,CRB) ppc_mtfsb0x(c,CRB,0)
#define ppc_mtfsb0d(c,CRB) ppc_mtfsb0x(c,CRB,1)
#define ppc_mtfsb1x(c,CRB,Rc) ppc_emit32(c, (63 << 26) | (CRB << 21) | (0 << 11) | (38 << 1) | Rc)
#define ppc_mtfsb1(c,CRB) ppc_mtfsb1x(c,CRB,0)
#define ppc_mtfsb1d(c,CRB) ppc_mtfsb1x(c,CRB,1)
#define ppc_mtfsfx(c,FM,B,Rc) ppc_emit32(c, (63 << 26) | (0 << 25) | (FM << 22) | (0 << 21) | (B << 11) | (711 << 1) | Rc)
#define ppc_mtfsf(c,FM,B) ppc_mtfsfx(c,FM,B,0)
#define ppc_mtfsfd(c,FM,B) ppc_mtfsfx(c,FM,B,1)
#define ppc_mtfsfix(c,crfD,IMM,Rc) ppc_emit32(c, (63 << 26) | (crfD << 23) | (0 << 16) | (IMM << 12) | (0 << 11) | (134 << 1) | Rc)
#define ppc_mtfsfi(c,crfD,IMM) ppc_mtfsfix(c,crfD,IMM,0)
#define ppc_mtfsfid(c,crfD,IMM) ppc_mtfsfix(c,crfD,IMM,1)
#define ppc_mtmsr(c, S) ppc_emit32(c, (31 << 26) | (S << 21) | (0 << 11) | (146 << 1) | 0)
#define ppc_mtsr(c,SR,S) ppc_emit32(c, (31 << 26) | (S << 21) | (0 << 20) | (SR << 16) | (0 << 11) | (210 << 1) | 0)
#define ppc_mtsrin(c,S,B) ppc_emit32(c, (31 << 26) | (S << 21) | (0 << 16) | (B << 11) | (242 << 1) | 0)
#define ppc_mulhwx(c,D,A,B,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (0 << 10) | (75 << 1) | Rc)
#define ppc_mulhw(c,D,A,B) ppc_mulhwx(c,D,A,B,0)
#define ppc_mulhwd(c,D,A,B) ppc_mulhwx(c,D,A,B,1)
#define ppc_mulhwux(c,D,A,B,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (0 << 10) | (11 << 1) | Rc)
#define ppc_mulhwu(c,D,A,B) ppc_mulhwux(c,D,A,B,0)
#define ppc_mulhwud(c,D,A,B) ppc_mulhwux(c,D,A,B,1)
#define ppc_mulli(c,D,A,SIMM) ppc_emit32(c, ((07) << 26) | (D << 21) | (A << 16) | (guint16)(SIMM))
#define ppc_mullwx(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (OE << 10) | (235 << 1) | Rc)
#define ppc_mullw(c,D,A,B) ppc_mullwx(c,D,A,B,0,0)
#define ppc_mullwd(c,D,A,B) ppc_mullwx(c,D,A,B,0,1)
#define ppc_mullwo(c,D,A,B) ppc_mullwx(c,D,A,B,1,0)
#define ppc_mullwod(c,D,A,B) ppc_mullwx(c,D,A,B,1,1)
#define ppc_nandx(c,A,S,B,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (476 << 1) | Rc)
#define ppc_nand(c,A,S,B) ppc_nandx(c,A,S,B,0)
#define ppc_nandd(c,A,S,B) ppc_nandx(c,A,S,B,1)
#define ppc_negx(c,D,A,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (0 << 11) | (OE << 10) | (104 << 1) | Rc)
#define ppc_neg(c,D,A) ppc_negx(c,D,A,0,0)
#define ppc_negd(c,D,A) ppc_negx(c,D,A,0,1)
#define ppc_nego(c,D,A) ppc_negx(c,D,A,1,0)
#define ppc_negod(c,D,A) ppc_negx(c,D,A,1,1)
#define ppc_norx(c,A,S,B,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (124 << 1) | Rc)
#define ppc_nor(c,A,S,B) ppc_norx(c,A,S,B,0)
#define ppc_nord(c,A,S,B) ppc_norx(c,A,S,B,1)
#define ppc_not(c,A,S) ppc_norx(c,A,S,S,0)
#define ppc_orx(c,A,S,B,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (444 << 1) | Rc)
#define ppc_ord(c,A,S,B) ppc_orx(c,A,S,B,1)
#define ppc_orcx(c,A,S,B,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (412 << 1) | Rc)
#define ppc_orc(c,A,S,B) ppc_orcx(c,A,S,B,0)
#define ppc_orcd(c,A,S,B) ppc_orcx(c,A,S,B,1)
#define ppc_oris(c,A,S,UIMM) ppc_emit32(c, (25 << 26) | (S << 21) | (A << 16) | (guint16)(UIMM))
#define ppc_rfi(c) ppc_emit32(c, (19 << 26) | (0 << 11) | (50 << 1) | 0)
#define ppc_rlwimix(c,A,S,SH,MB,ME,Rc) ppc_emit32(c, (20 << 26) | (S << 21) | (A << 16) | (SH << 11) | (MB << 6) | (ME << 1) | Rc)
#define ppc_rlwimi(c,A,S,SH,MB,ME) ppc_rlwimix(c,A,S,SH,MB,ME,0)
#define ppc_rlwimid(c,A,S,SH,MB,ME) ppc_rlwimix(c,A,S,SH,MB,ME,1)
#define ppc_rlwinmx(c,A,S,SH,MB,ME,Rc) ppc_emit32(c, (21 << 26) | ((S) << 21) | ((A) << 16) | ((SH) << 11) | ((MB) << 6) | ((ME) << 1) | (Rc))
#define ppc_rlwinm(c,A,S,SH,MB,ME) ppc_rlwinmx(c,A,S,SH,MB,ME,0)
#define ppc_rlwinmd(c,A,S,SH,MB,ME) ppc_rlwinmx(c,A,S,SH,MB,ME,1)
#define ppc_extlwi(c,A,S,n,b) ppc_rlwinm(c,A,S, b, 0, (n) - 1)
#define ppc_extrwi(c,A,S,n,b) ppc_rlwinm(c,A,S, (b) + (n), 32 - (n), 31)
#define ppc_rotlwi(c,A,S,n) ppc_rlwinm(c,A,S, n, 0, 31)
#define ppc_rotrwi(c,A,S,n) ppc_rlwinm(c,A,S, 32 - (n), 0, 31)
#define ppc_slwi(c,A,S,n) ppc_rlwinm(c,A,S, n, 0, 31 - (n))
#define ppc_srwi(c,A,S,n) ppc_rlwinm(c,A,S, 32 - (n), n, 31)
#define ppc_clrlwi(c,A,S,n) ppc_rlwinm(c,A,S, 0, n, 31)
#define ppc_clrrwi(c,A,S,n) ppc_rlwinm(c,A,S, 0, 0, 31 - (n))
#define ppc_clrlslwi(c,A,S,b,n) ppc_rlwinm(c,A,S, n, (b) - (n), 31 - (n))
#define ppc_rlwnmx(c,A,S,SH,MB,ME,Rc) ppc_emit32(c, (23 << 26) | (S << 21) | (A << 16) | (SH << 11) | (MB << 6) | (ME << 1) | Rc)
#define ppc_rlwnm(c,A,S,SH,MB,ME) ppc_rlwnmx(c,A,S,SH,MB,ME,0)
#define ppc_rlwnmd(c,A,S,SH,MB,ME) ppc_rlwnmx(c,A,S,SH,MB,ME,1)
#define ppc_sc(c) ppc_emit32(c, (17 << 26) | (0 << 2) | (1 << 1) | 0)
#define ppc_slwx(c,S,A,B,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (24 << 1) | Rc)
#define ppc_slw(c,S,A,B) ppc_slwx(c,S,A,B,0)
#define ppc_slwd(c,S,A,B) ppc_slwx(c,S,A,B,1)
#define ppc_srawx(c,A,S,B,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (792 << 1) | Rc)
#define ppc_sraw(c,A,S,B) ppc_srawx(c,A,S,B,0)
#define ppc_srawd(c,A,S,B) ppc_srawx(c,A,S,B,1)
#define ppc_srawix(c,A,S,SH,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (SH << 11) | (824 << 1) | Rc)
#define ppc_srawi(c,A,S,B) ppc_srawix(c,A,S,B,0)
#define ppc_srawid(c,A,S,B) ppc_srawix(c,A,S,B,1)
#define ppc_srwx(c,A,S,SH,Rc) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (SH << 11) | (536 << 1) | Rc)
#define ppc_srw(c,A,S,B) ppc_srwx(c,A,S,B,0)
#define ppc_srwd(c,A,S,B) ppc_srwx(c,A,S,B,1)
#define ppc_stbu(c,S,d,A) ppc_emit32(c, (39 << 26) | (S << 21) | (A << 16) | (guint16)(d))
#define ppc_stbux(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (247 << 1) | 0)
#define ppc_stbx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (215 << 1) | 0)
#define ppc_stfdu(c,S,d,A) ppc_emit32(c, (55 << 26) | (S << 21) | (A << 16) | (guint16)(d))
#define ppc_stfdx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (727 << 1) | 0)
#define ppc_stfiwx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (983 << 1) | 0)
#define ppc_stfsu(c,S,d,A) ppc_emit32(c, (53 << 26) | (S << 21) | (A << 16) | (guint16)(d))
#define ppc_stfsux(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (695 << 1) | 0)
#define ppc_stfsx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (663 << 1) | 0)
#define ppc_sthbrx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (918 << 1) | 0)
#define ppc_sthu(c,S,d,A) ppc_emit32(c, (45 << 26) | (S << 21) | (A << 16) | (guint16)(d))
#define ppc_sthux(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (439 << 1) | 0)
#define ppc_sthx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (407 << 1) | 0)
#define ppc_stmw(c,S,d,A) ppc_emit32(c, (47 << 26) | (S << 21) | (A << 16) | (guint16)d)
#define ppc_stswi(c,S,A,NB) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (NB << 11) | (725 << 1) | 0)
#define ppc_stswx(c,S,A,NB) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (NB << 11) | (661 << 1) | 0)
#define ppc_stwbrx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (662 << 1) | 0)
#define ppc_stwcxd(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (150 << 1) | 1)
#define ppc_stwux(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (183 << 1) | 0)
#define ppc_stwx(c,S,A,B) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (151 << 1) | 0)
#define ppc_subfx(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (OE << 10) | (40 << 1) | Rc)
#define ppc_subf(c,D,A,B) ppc_subfx(c,D,A,B,0,0)
#define ppc_subfd(c,D,A,B) ppc_subfx(c,D,A,B,0,1)
#define ppc_subfo(c,D,A,B) ppc_subfx(c,D,A,B,1,0)
#define ppc_subfod(c,D,A,B) ppc_subfx(c,D,A,B,1,1)
#define ppc_sub(c,D,A,B) ppc_subf(c,D,B,A)
#define ppc_subfcx(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (OE << 10) | (8 << 1) | Rc)
#define ppc_subfc(c,D,A,B) ppc_subfcx(c,D,A,B,0,0)
#define ppc_subfcd(c,D,A,B) ppc_subfcx(c,D,A,B,0,1)
#define ppc_subfco(c,D,A,B) ppc_subfcx(c,D,A,B,1,0)
#define ppc_subfcod(c,D,A,B) ppc_subfcx(c,D,A,B,1,1)
#define ppc_subfex(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (OE << 10) | (136 << 1) | Rc)
#define ppc_subfe(c,D,A,B) ppc_subfex(c,D,A,B,0,0)
#define ppc_subfed(c,D,A,B) ppc_subfex(c,D,A,B,0,1)
#define ppc_subfeo(c,D,A,B) ppc_subfex(c,D,A,B,1,0)
#define ppc_subfeod(c,D,A,B) ppc_subfex(c,D,A,B,1,1)
#define ppc_subfic(c,D,A,SIMM) ppc_emit32(c, (8 << 26) | (D << 21) | (A << 16) | (guint16)(SIMM))
#define ppc_subfmex(c,D,A,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (0 << 11) | (OE << 10) | (232 << 1) | Rc)
#define ppc_subfme(c,D,A) ppc_subfmex(c,D,A,0,0)
#define ppc_subfmed(c,D,A) ppc_subfmex(c,D,A,0,1)
#define ppc_subfmeo(c,D,A) ppc_subfmex(c,D,A,1,0)
#define ppc_subfmeod(c,D,A) ppc_subfmex(c,D,A,1,1)
#define ppc_subfzex(c,D,A,OE,Rc) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (0 << 11) | (OE << 10) | (200 << 1) | Rc)
#define ppc_subfze(c,D,A) ppc_subfzex(c,D,A,0,0)
#define ppc_subfzed(c,D,A) ppc_subfzex(c,D,A,0,1)
#define ppc_subfzeo(c,D,A) ppc_subfzex(c,D,A,1,0)
#define ppc_subfzeod(c,D,A) ppc_subfzex(c,D,A,1,1)
#define ppc_sync(c) ppc_emit32(c, (31 << 26) | (0 << 11) | (598 << 1) | 0)
#define ppc_tlbia(c) ppc_emit32(c, (31 << 26) | (0 << 11) | (370 << 1) | 0)
#define ppc_tlbie(c,B) ppc_emit32(c, (31 << 26) | (0 << 16) | (B << 11) | (306 << 1) | 0)
#define ppc_tlbsync(c) ppc_emit32(c, (31 << 26) | (0 << 11) | (566 << 1) | 0)
#define ppc_tw(c,TO,A,B) ppc_emit32(c, (31 << 26) | (TO << 21) | (A << 16) | (B << 11) | (4 << 1) | 0)
#define ppc_twi(c,TO,A,SIMM) ppc_emit32(c, (3 << 26) | (TO << 21) | (A << 16) | (guint16)(SIMM))
#define ppc_xorx(c,A,S,B,RC) ppc_emit32(c, (31 << 26) | (S << 21) | (A << 16) | (B << 11) | (316 << 1) | RC)
#define ppc_xor(c,A,S,B) ppc_xorx(c,A,S,B,0)
#define ppc_xord(c,A,S,B) ppc_xorx(c,A,S,B,1)
#define ppc_xori(c,S,A,UIMM) ppc_emit32(c, (26 << 26) | (S << 21) | (A << 16) | (guint16)(UIMM))
#define ppc_xoris(c,S,A,UIMM) ppc_emit32(c, (27 << 26) | (S << 21) | (A << 16) | (guint16)(UIMM))
/* this marks the end of my work, ct */
/* Introduced in Power ISA 2.02 (P4?) */
#define ppc_frinx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (392 << 1) | Rc)
#define ppc_frin(c,D,B) ppc_frinx(c,D,B,0)
#define ppc_frind(c,D,B) ppc_frinx(c,D,B,1)
#define ppc_fripx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (456 << 1) | Rc)
#define ppc_frip(c,D,B) ppc_fripx(c,D,B,0)
#define ppc_fripd(c,D,B) ppc_fripx(c,D,B,1)
#define ppc_frizx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (424 << 1) | Rc)
#define ppc_friz(c,D,B) ppc_frizx(c,D,B,0)
#define ppc_frizd(c,D,B) ppc_frizx(c,D,B,1)
#define ppc_frimx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | (D << 21) | (0 << 16) | (B << 11) | (488 << 1) | Rc)
#define ppc_frim(c,D,B) ppc_frimx(c,D,B,0)
#define ppc_frimd(c,D,B) ppc_frimx(c,D,B,1)
/*
* Introduced in Power ISA 2.03 (P5)
* This is an A-form instruction like many of the FP arith ops,
* but arranged slightly differently (swap record and reserved area)
*/
#define ppc_isel(c,D,A,B,C) ppc_emit32(c, (31 << 26) | (D << 21) | (A << 16) | (B << 11) | (C << 6) | (15 << 1) | 0)
#define ppc_isellt(c,D,A,B) ppc_isel(c,D,A,B,0)
#define ppc_iselgt(c,D,A,B) ppc_isel(c,D,A,B,1)
#define ppc_iseleq(c,D,A,B) ppc_isel(c,D,A,B,2)
/* PPC64 */
/* The following FP instructions are not are available to 32-bit
implementations (prior to PowerISA-V2.01 but are available to
32-bit mode programs on 64-bit PowerPC implementations and all
processors compliant with PowerISA-2.01 or later. */
#define ppc_fcfidx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | ((D) << 21) | (0 << 16) | ((B) << 11) | (846 << 1) | (Rc))
#define ppc_fcfid(c,D,B) ppc_fcfidx(c,D,B,0)
#define ppc_fcfidd(c,D,B) ppc_fcfidx(c,D,B,1)
#define ppc_fctidx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | ((D) << 21) | (0 << 16) | ((B) << 11) | (814 << 1) | (Rc))
#define ppc_fctid(c,D,B) ppc_fctidx(c,D,B,0)
#define ppc_fctidd(c,D,B) ppc_fctidx(c,D,B,1)
#define ppc_fctidzx(c,D,B,Rc) ppc_emit32(c, (63 << 26) | ((D) << 21) | (0 << 16) | ((B) << 11) | (815 << 1) | (Rc))
#define ppc_fctidz(c,D,B) ppc_fctidzx(c,D,B,0)
#define ppc_fctidzd(c,D,B) ppc_fctidzx(c,D,B,1)
#ifdef __mono_ppc64__
#define ppc_load_sequence(c,D,v) G_STMT_START { \
ppc_lis ((c), (D), ((guint64)(v) >> 48) & 0xffff); \
ppc_ori ((c), (D), (D), ((guint64)(v) >> 32) & 0xffff); \
ppc_sldi ((c), (D), (D), 32); \
ppc_oris ((c), (D), (D), ((guint64)(v) >> 16) & 0xffff); \
ppc_ori ((c), (D), (D), (guint64)(v) & 0xffff); \
} G_STMT_END
#define PPC_LOAD_SEQUENCE_LENGTH 20
#define ppc_is_imm32(val) (((((gint64)val)>> 31) == 0) || ((((gint64)val)>> 31) == -1))
#define ppc_is_imm48(val) (((((gint64)val)>> 47) == 0) || ((((gint64)val)>> 47) == -1))
#define ppc_load48(c,D,v) G_STMT_START { \
ppc_li ((c), (D), ((gint64)(v) >> 32) & 0xffff); \
ppc_sldi ((c), (D), (D), 32); \
ppc_oris ((c), (D), (D), ((guint64)(v) >> 16) & 0xffff); \
ppc_ori ((c), (D), (D), (guint64)(v) & 0xffff); \
} G_STMT_END
#define ppc_load(c,D,v) G_STMT_START { \
if (ppc_is_imm16 ((guint64)(v))) { \
ppc_li ((c), (D), (guint16)(guint64)(v)); \
} else if (ppc_is_imm32 ((guint64)(v))) { \
ppc_load32 ((c), (D), (guint32)(guint64)(v)); \
} else if (ppc_is_imm48 ((guint64)(v))) { \
ppc_load48 ((c), (D), (guint64)(v)); \
} else { \
ppc_load_sequence ((c), (D), (guint64)(v)); \
} \
} G_STMT_END
#if _CALL_ELF == 2
#define ppc_load_func(c,D,V) ppc_load_sequence ((c), (D), (V))
#else
#define ppc_load_func(c,D,v) G_STMT_START { \
ppc_load_sequence ((c), ppc_r12, (guint64)(gsize)(v)); \
ppc_ldptr ((c), ppc_r2, sizeof (gpointer), ppc_r12); \
ppc_ldptr ((c), (D), 0, ppc_r12); \
} G_STMT_END
#endif
#define ppc_load_multiple_regs(c,D,d,A) G_STMT_START { \
int __i, __o = (d); \
for (__i = (D); __i <= 31; ++__i) { \
ppc_ldr ((c), __i, __o, (A)); \
__o += sizeof (guint64); \
} \
} G_STMT_END
#define ppc_store_multiple_regs(c,S,d,A) G_STMT_START { \
int __i, __o = (d); \
for (__i = (S); __i <= 31; ++__i) { \
ppc_str ((c), __i, __o, (A)); \
__o += sizeof (guint64); \
} \
} G_STMT_END
#define ppc_compare(c,cfrD,A,B) ppc_cmp((c), (cfrD), 1, (A), (B))
#define ppc_compare_reg_imm(c,cfrD,A,B) ppc_cmpi((c), (cfrD), 1, (A), (B))
#define ppc_compare_log(c,cfrD,A,B) ppc_cmpl((c), (cfrD), 1, (A), (B))
#define ppc_shift_left(c,A,S,B) ppc_sld((c), (A), (S), (B))
#define ppc_shift_left_imm(c,A,S,n) ppc_sldi((c), (A), (S), (n))
#define ppc_shift_right_imm(c,A,S,B) ppc_srdi((c), (A), (S), (B))
#define ppc_shift_right_arith_imm(c,A,S,B) ppc_sradi((c), (A), (S), (B))
#define ppc_multiply(c,D,A,B) ppc_mulld((c), (D), (A), (B))
#define ppc_clear_right_imm(c,A,S,n) ppc_clrrdi((c), (A), (S), (n))
#define ppc_divdx(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | ((OE) << 10) | (489 << 1) | (Rc))
#define ppc_divd(c,D,A,B) ppc_divdx(c,D,A,B,0,0)
#define ppc_divdd(c,D,A,B) ppc_divdx(c,D,A,B,0,1)
#define ppc_divdo(c,D,A,B) ppc_divdx(c,D,A,B,1,0)
#define ppc_divdod(c,D,A,B) ppc_divdx(c,D,A,B,1,1)
#define ppc_divdux(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | ((OE) << 10) | (457 << 1) | (Rc))
#define ppc_divdu(c,D,A,B) ppc_divdux(c,D,A,B,0,0)
#define ppc_divdud(c,D,A,B) ppc_divdux(c,D,A,B,0,1)
#define ppc_divduo(c,D,A,B) ppc_divdux(c,D,A,B,1,0)
#define ppc_divduod(c,D,A,B) ppc_divdux(c,D,A,B,1,1)
#define ppc_extswx(c,S,A,Rc) ppc_emit32(c, (31 << 26) | ((S) << 21) | ((A) << 16) | (0 << 11) | (986 << 1) | (Rc))
#define ppc_extsw(c,A,S) ppc_extswx(c,S,A,0)
#define ppc_extswd(c,A,S) ppc_extswx(c,S,A,1)
/* These move float to/from instuctions are only available on POWER6 in
native mode. These instruction are faster then the equivalent
store/load because they avoid the store queue and associated delays.
These instructions should only be used in 64-bit mode unless the
kernel preserves the 64-bit GPR on signals and dispatch in 32-bit
mode. The Linux kernel does not. */
#define ppc_mftgpr(c,T,B) ppc_emit32(c, (31 << 26) | ((T) << 21) | (0 << 16) | ((B) << 11) | (735 << 1) | 0)
#define ppc_mffgpr(c,T,B) ppc_emit32(c, (31 << 26) | ((T) << 21) | (0 << 16) | ((B) << 11) | (607 << 1) | 0)
#define ppc_ld(c,D,ds,A) ppc_emit32(c, (58 << 26) | ((D) << 21) | ((A) << 16) | ((guint32)(ds) & 0xfffc) | 0)
#define ppc_lwa(c,D,ds,A) ppc_emit32(c, (58 << 26) | ((D) << 21) | ((A) << 16) | ((ds) & 0xfffc) | 2)
#define ppc_ldarx(c,D,A,B) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (84 << 1) | 0)
#define ppc_ldu(c,D,ds,A) ppc_emit32(c, (58 << 26) | ((D) << 21) | ((A) << 16) | ((guint32)(ds) & 0xfffc) | 1)
#define ppc_ldux(c,D,A,B) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (53 << 1) | 0)
#define ppc_lwaux(c,D,A,B) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (373 << 1) | 0)
#define ppc_ldx(c,D,A,B) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (21 << 1) | 0)
#define ppc_lwax(c,D,A,B) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (341 << 1) | 0)
#define ppc_mulhdx(c,D,A,B,Rc) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (0 << 10) | (73 << 1) | (Rc))
#define ppc_mulhd(c,D,A,B) ppc_mulhdx(c,D,A,B,0)
#define ppc_mulhdd(c,D,A,B) ppc_mulhdx(c,D,A,B,1)
#define ppc_mulhdux(c,D,A,B,Rc) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | (0 << 10) | (9 << 1) | (Rc))
#define ppc_mulhdu(c,D,A,B) ppc_mulhdux(c,D,A,B,0)
#define ppc_mulhdud(c,D,A,B) ppc_mulhdux(c,D,A,B,1)
#define ppc_mulldx(c,D,A,B,OE,Rc) ppc_emit32(c, (31 << 26) | ((D) << 21) | ((A) << 16) | ((B) << 11) | ((OE) << 10) | (233 << 1) | (Rc))
#define ppc_mulld(c,D,A,B) ppc_mulldx(c,D,A,B,0,0)
#define ppc_mulldd(c,D,A,B) ppc_mulldx(c,D,A,B,0,1)
#define ppc_mulldo(c,D,A,B) ppc_mulldx(c,D,A,B,1,0)
#define ppc_mulldod(c,D,A,B) ppc_mulldx(c,D,A,B,1,1)
#define ppc_rldclx(c,A,S,B,MB,Rc) ppc_emit32(c, (30 << 26) | ((S) << 21) | ((A) << 16) | ((B) << 11) | (ppc_split_5_1(MB) << 5) | (8 << 1) | (Rc))
#define ppc_rldcl(c,A,S,B,MB) ppc_rldclx(c,A,S,B,MB,0)
#define ppc_rldcld(c,A,S,B,MB) ppc_rldclx(c,A,S,B,MB,1)
#define ppc_rotld(c,A,S,B) ppc_rldcl(c, A, S, B, 0)
#define ppc_rldcrx(c,A,S,B,ME,Rc) ppc_emit32(c, (30 << 26) | ((S) << 21) | ((A) << 16) | ((B) << 11) | (ppc_split_5_1(ME) << 5) | (9 << 1) | (Rc))
#define ppc_rldcr(c,A,S,B,ME) ppc_rldcrx(c,A,S,B,ME,0)
#define ppc_rldcrd(c,A,S,B,ME) ppc_rldcrx(c,A,S,B,ME,1)
#define ppc_rldicx(c,S,A,SH,MB,Rc) ppc_emit32(c, (30 << 26) | ((S) << 21) | ((A) << 16) | (ppc_split_5_1_5(SH) << 11) | (ppc_split_5_1(MB) << 5) | (2 << 2) | (ppc_split_5_1_1(SH) << 1) | (Rc))
#define ppc_rldic(c,A,S,SH,MB) ppc_rldicx(c,S,A,SH,MB,0)
#define ppc_rldicd(c,A,S,SH,MB) ppc_rldicx(c,S,A,SH,MB,1)
#define ppc_rldiclx(c,S,A,SH,MB,Rc) ppc_emit32(c, (30 << 26) | ((S) << 21) | ((A) << 16) | (ppc_split_5_1_5(SH) << 11) | (ppc_split_5_1(MB) << 5) | (0 << 2) | (ppc_split_5_1_1(SH) << 1) | (Rc))
#define ppc_rldicl(c,A,S,SH,MB) ppc_rldiclx(c,S,A,SH,MB,0)
#define ppc_rldicld(c,A,S,SH,MB) ppc_rldiclx(c,S,A,SH,MB,1)
#define ppc_extrdi(c,A,S,n,b) ppc_rldicl(c,A,S, (b) + (n), 64 - (n))
#define ppc_rotldi(c,A,S,n) ppc_rldicl(c,A,S, n, 0)
#define ppc_rotrdi(c,A,S,n) ppc_rldicl(c,A,S, 64 - (n), 0)
#define ppc_srdi(c,A,S,n) ppc_rldicl(c,A,S, 64 - (n), n)
#define ppc_clrldi(c,A,S,n) ppc_rldicl(c,A,S, 0, n)
#define ppc_rldicrx(c,A,S,SH,ME,Rc) ppc_emit32(c, (30 << 26) | ((S) << 21) | ((A) << 16) | (ppc_split_5_1_5(SH) << 11) | (ppc_split_5_1(ME) << 5) | (1 << 2) | (ppc_split_5_1_1(SH) << 1) | (Rc))
#define ppc_rldicr(c,A,S,SH,ME) ppc_rldicrx(c,A,S,SH,ME,0)
#define ppc_rldicrd(c,A,S,SH,ME) ppc_rldicrx(c,A,S,SH,ME,1)
#define ppc_extldi(c,A,S,n,b) ppc_rldicr(c, A, S, b, (n) - 1)
#define ppc_sldi(c,A,S,n) ppc_rldicr(c, A, S, n, 63 - (n))
#define ppc_clrrdi(c,A,S,n) ppc_rldicr(c, A, S, 0, 63 - (n))
#define ppc_rldimix(c,S,A,SH,MB,Rc) ppc_emit32(c, (30 << 26) | ((S) << 21) | ((A) << 16) | (ppc_split_5_1_5(SH) << 11) | (ppc_split_5_1(MB) << 5) | (3 << 2) | (ppc_split_5_1_1(SH) << 1) | (Rc))
#define ppc_rldimi(c,A,S,SH,MB) ppc_rldimix(c,S,A,SH,MB,0)
#define ppc_rldimid(c,A,S,SH,MB) ppc_rldimix(c,S,A,SH,MB,1)
#define ppc_slbia(c) ppc_emit32(c, (31 << 26) | (0 << 21) | (0 << 16) | (0 << 11) | (498 << 1) | 0)
#define ppc_slbie(c,B) ppc_emit32(c, (31 << 26) | (0 << 21) | (0 << 16) | ((B) << 11) | (434 << 1) | 0)
#define ppc_sldx(c,S,A,B,Rc) ppc_emit32(c, (31 << 26) | ((S) << 21) | ((A) << 16) | ((B) << 11) | (27 << 1) | (Rc))
#define ppc_sld(c,A,S,B) ppc_sldx(c,S,A,B,0)
#define ppc_sldd(c,A,S,B) ppc_sldx(c,S,A,B,1)
#define ppc_sradx(c,S,A,B,Rc) ppc_emit32(c, (31 << 26) | ((S) << 21) | ((A) << 16) | ((B) << 11) | (794 << 1) | (Rc))
#define ppc_srad(c,A,S,B) ppc_sradx(c,S,A,B,0)
#define ppc_sradd(c,A,S,B) ppc_sradx(c,S,A,B,1)
#define ppc_sradix(c,S,A,SH,Rc) ppc_emit32(c, (31 << 26) | ((S) << 21) | ((A) << 16) | (((SH) & 31) << 11) | (413 << 2) | (((SH) >> 5) << 1) | (Rc))
#define ppc_sradi(c,A,S,SH) ppc_sradix(c,S,A,SH,0)
#define ppc_sradid(c,A,S,SH) ppc_sradix(c,S,A,SH,1)
#define ppc_srdx(c,S,A,B,Rc) ppc_emit32(c, (31 << 26) | ((S) << 21) | ((A) << 16) | ((B) << 11) | (539 << 1) | (Rc))
#define ppc_srd(c,A,S,B) ppc_srdx(c,S,A,B,0)
#define ppc_srdd(c,A,S,B) ppc_srdx(c,S,A,B,1)
#define ppc_std(c,S,ds,A) ppc_emit32(c, (62 << 26) | ((S) << 21) | ((A) << 16) | ((guint32)(ds) & 0xfffc) | 0)
#define ppc_stdcxd(c,S,A,B) ppc_emit32(c, (31 << 26) | ((S) << 21) | ((A) << 16) | ((B) << 11) | (214 << 1) | 1)
#define ppc_stdu(c,S,ds,A) ppc_emit32(c, (62 << 26) | ((S) << 21) | ((A) << 16) | ((guint32)(ds) & 0xfffc) | 1)
#define ppc_stdux(c,S,A,B) ppc_emit32(c, (31 << 26) | ((S) << 21) | ((A) << 16) | ((B) << 11) | (181 << 1) | 0)
#define ppc_stdx(c,S,A,B) ppc_emit32(c, (31 << 26) | ((S) << 21) | ((A) << 16) | ((B) << 11) | (149 << 1) | 0)
#else
/* Always true for 32-bit */
#define ppc_is_imm32(val) (1)
#endif
#endif
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/native/public/mono/metadata/debug-helpers.h
|
/**
* \file
*/
#ifndef __MONO_DEBUG_HELPERS_H__
#define __MONO_DEBUG_HELPERS_H__
#include <mono/metadata/details/debug-helpers-types.h>
MONO_BEGIN_DECLS
#define MONO_API_FUNCTION(ret,name,args) MONO_API ret name args;
#include <mono/metadata/details/debug-helpers-functions.h>
#undef MONO_API_FUNCTION
MONO_END_DECLS
#endif /* __MONO_DEBUG_HELPERS_H__ */
|
/**
* \file
*/
#ifndef __MONO_DEBUG_HELPERS_H__
#define __MONO_DEBUG_HELPERS_H__
#include <mono/metadata/details/debug-helpers-types.h>
MONO_BEGIN_DECLS
#define MONO_API_FUNCTION(ret,name,args) MONO_API ret name args;
#include <mono/metadata/details/debug-helpers-functions.h>
#undef MONO_API_FUNCTION
MONO_END_DECLS
#endif /* __MONO_DEBUG_HELPERS_H__ */
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/mono/mono/metadata/fdhandle.c
|
#include "fdhandle.h"
#include "utils/mono-lazy-init.h"
#include "utils/mono-coop-mutex.h"
static GHashTable *fds;
static MonoCoopMutex fds_mutex;
static MonoFDHandleCallback fds_callback[MONO_FDTYPE_COUNT];
static mono_lazy_init_t fds_init = MONO_LAZY_INIT_STATUS_NOT_INITIALIZED;
#ifndef DISABLE_ASSERT_MESSAGES
static const gchar *types_str[] = {
"File",
"Console",
"Pipe",
"Socket",
NULL
};
#endif
static void
fds_remove (gpointer data)
{
MonoFDHandle* fdhandle;
fdhandle = (MonoFDHandle*) data;
g_assert (fdhandle);
g_assert (fds_callback [fdhandle->type].close);
fds_callback [fdhandle->type].close (fdhandle);
mono_refcount_dec (fdhandle);
}
static void
initialize (void)
{
fds = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, fds_remove);
mono_coop_mutex_init (&fds_mutex);
}
void
mono_fdhandle_register (MonoFDType type, MonoFDHandleCallback *callback)
{
mono_lazy_initialize (&fds_init, initialize);
memcpy (&fds_callback [type], callback, sizeof (MonoFDHandleCallback));
}
static void
fdhandle_destroy (gpointer data)
{
MonoFDHandle* fdhandle;
fdhandle = (MonoFDHandle*) data;
g_assert (fdhandle);
g_assert (fds_callback [fdhandle->type].destroy);
fds_callback [fdhandle->type].destroy (fdhandle);
}
void
mono_fdhandle_init (MonoFDHandle *fdhandle, MonoFDType type, gint fd)
{
mono_refcount_init (fdhandle, fdhandle_destroy);
fdhandle->type = type;
fdhandle->fd = fd;
}
void
mono_fdhandle_insert (MonoFDHandle *fdhandle)
{
mono_coop_mutex_lock (&fds_mutex);
if (g_hash_table_lookup_extended (fds, GINT_TO_POINTER(fdhandle->fd), NULL, NULL))
g_error("%s: duplicate %s fd %d", __func__, types_str [fdhandle->type], fdhandle->fd);
g_hash_table_insert (fds, GINT_TO_POINTER(fdhandle->fd), fdhandle);
mono_coop_mutex_unlock (&fds_mutex);
}
gboolean
mono_fdhandle_try_insert (MonoFDHandle *fdhandle)
{
mono_coop_mutex_lock (&fds_mutex);
if (g_hash_table_lookup_extended (fds, GINT_TO_POINTER(fdhandle->fd), NULL, NULL)) {
/* we raced between 2 invocations of mono_fdhandle_try_insert */
mono_coop_mutex_unlock (&fds_mutex);
return FALSE;
}
g_hash_table_insert (fds, GINT_TO_POINTER(fdhandle->fd), fdhandle);
mono_coop_mutex_unlock (&fds_mutex);
return TRUE;
}
gboolean
mono_fdhandle_lookup_and_ref (gint fd, MonoFDHandle **fdhandle)
{
mono_coop_mutex_lock (&fds_mutex);
if (!g_hash_table_lookup_extended (fds, GINT_TO_POINTER(fd), NULL, (gpointer*) fdhandle)) {
mono_coop_mutex_unlock (&fds_mutex);
return FALSE;
}
mono_refcount_inc (*fdhandle);
mono_coop_mutex_unlock (&fds_mutex);
return TRUE;
}
void
mono_fdhandle_unref (MonoFDHandle *fdhandle)
{
mono_refcount_dec (fdhandle);
}
gboolean
mono_fdhandle_close (gint fd)
{
MonoFDHandle *fdhandle;
gboolean removed;
mono_coop_mutex_lock (&fds_mutex);
if (!g_hash_table_lookup_extended (fds, GINT_TO_POINTER(fd), NULL, (gpointer*) &fdhandle)) {
mono_coop_mutex_unlock (&fds_mutex);
return FALSE;
}
removed = g_hash_table_remove (fds, GINT_TO_POINTER(fdhandle->fd));
g_assert (removed);
mono_coop_mutex_unlock (&fds_mutex);
return TRUE;
}
|
#include "fdhandle.h"
#include "utils/mono-lazy-init.h"
#include "utils/mono-coop-mutex.h"
static GHashTable *fds;
static MonoCoopMutex fds_mutex;
static MonoFDHandleCallback fds_callback[MONO_FDTYPE_COUNT];
static mono_lazy_init_t fds_init = MONO_LAZY_INIT_STATUS_NOT_INITIALIZED;
#ifndef DISABLE_ASSERT_MESSAGES
static const gchar *types_str[] = {
"File",
"Console",
"Pipe",
"Socket",
NULL
};
#endif
static void
fds_remove (gpointer data)
{
MonoFDHandle* fdhandle;
fdhandle = (MonoFDHandle*) data;
g_assert (fdhandle);
g_assert (fds_callback [fdhandle->type].close);
fds_callback [fdhandle->type].close (fdhandle);
mono_refcount_dec (fdhandle);
}
static void
initialize (void)
{
fds = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, fds_remove);
mono_coop_mutex_init (&fds_mutex);
}
void
mono_fdhandle_register (MonoFDType type, MonoFDHandleCallback *callback)
{
mono_lazy_initialize (&fds_init, initialize);
memcpy (&fds_callback [type], callback, sizeof (MonoFDHandleCallback));
}
static void
fdhandle_destroy (gpointer data)
{
MonoFDHandle* fdhandle;
fdhandle = (MonoFDHandle*) data;
g_assert (fdhandle);
g_assert (fds_callback [fdhandle->type].destroy);
fds_callback [fdhandle->type].destroy (fdhandle);
}
void
mono_fdhandle_init (MonoFDHandle *fdhandle, MonoFDType type, gint fd)
{
mono_refcount_init (fdhandle, fdhandle_destroy);
fdhandle->type = type;
fdhandle->fd = fd;
}
void
mono_fdhandle_insert (MonoFDHandle *fdhandle)
{
mono_coop_mutex_lock (&fds_mutex);
if (g_hash_table_lookup_extended (fds, GINT_TO_POINTER(fdhandle->fd), NULL, NULL))
g_error("%s: duplicate %s fd %d", __func__, types_str [fdhandle->type], fdhandle->fd);
g_hash_table_insert (fds, GINT_TO_POINTER(fdhandle->fd), fdhandle);
mono_coop_mutex_unlock (&fds_mutex);
}
gboolean
mono_fdhandle_try_insert (MonoFDHandle *fdhandle)
{
mono_coop_mutex_lock (&fds_mutex);
if (g_hash_table_lookup_extended (fds, GINT_TO_POINTER(fdhandle->fd), NULL, NULL)) {
/* we raced between 2 invocations of mono_fdhandle_try_insert */
mono_coop_mutex_unlock (&fds_mutex);
return FALSE;
}
g_hash_table_insert (fds, GINT_TO_POINTER(fdhandle->fd), fdhandle);
mono_coop_mutex_unlock (&fds_mutex);
return TRUE;
}
gboolean
mono_fdhandle_lookup_and_ref (gint fd, MonoFDHandle **fdhandle)
{
mono_coop_mutex_lock (&fds_mutex);
if (!g_hash_table_lookup_extended (fds, GINT_TO_POINTER(fd), NULL, (gpointer*) fdhandle)) {
mono_coop_mutex_unlock (&fds_mutex);
return FALSE;
}
mono_refcount_inc (*fdhandle);
mono_coop_mutex_unlock (&fds_mutex);
return TRUE;
}
void
mono_fdhandle_unref (MonoFDHandle *fdhandle)
{
mono_refcount_dec (fdhandle);
}
gboolean
mono_fdhandle_close (gint fd)
{
MonoFDHandle *fdhandle;
gboolean removed;
mono_coop_mutex_lock (&fds_mutex);
if (!g_hash_table_lookup_extended (fds, GINT_TO_POINTER(fd), NULL, (gpointer*) &fdhandle)) {
mono_coop_mutex_unlock (&fds_mutex);
return FALSE;
}
removed = g_hash_table_remove (fds, GINT_TO_POINTER(fdhandle->fd));
g_assert (removed);
mono_coop_mutex_unlock (&fds_mutex);
return TRUE;
}
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/coreclr/vm/stubmgr.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// StubMgr.h
//
//
// The stub manager exists so that the debugger can accurately step through
// the myriad stubs & wrappers which exist in the EE, without imposing undue
// overhead on the stubs themselves.
//
// Each type of stub (except those which the debugger can treat as atomic operations)
// needs to have a stub manager to represent it. The stub manager is responsible for
// (a) identifying the stub as such, and
// (b) tracing into the stub & reporting what the stub will call. This
// report can consist of
// (i) a managed code address
// (ii) an unmanaged code address
// (iii) another stub address
// (iv) a "frame patch" address - that is, an address in the stub,
// which the debugger can patch. When the patch is hit, the debugger
// will query the topmost frame to trace itself. (Thus this is
// a way of deferring the trace logic to the frame which the stub
// will push.)
//
// The set of stub managers is extensible, but should be kept to a reasonable number
// as they are currently linearly searched & queried for each stub.
//
//
// IMPORTANT IMPLEMENTATION NOTE: Due to code versioning, tracing through a jitted code
// call is a speculative exercise. A trace could predict that calling method Foo would run
// jitted code at address 0x1234, however afterwards code versioning redirects Foo to call
// an alternate jitted code body at address 0x5678. To handle this stub managers should
// either:
// a) stop tracing at offset zero of the newly called jitted code. The debugger knows
// to treat offset 0 in jitted code as potentially being any jitted code instance
// b) trace all the way through the jitted method such that regardless of which jitted
// code instance gets called the trace will still end at the predicted location.
//
// If we wanted to be more rigorous about this we should probably have different trace
// results for intra-jitted and inter-jitted trace results but given the relative
// stability of this part of the code I haven't attacked that problem right now. It does
// work as-is.
//
#ifndef __stubmgr_h__
#define __stubmgr_h__
#include "simplerwlock.hpp"
#include "lockedrangelist.h"
// When 'TraceStub' returns, it gives the address of where the 'target' is for a stub'
// TraceType indicates what this 'target' is
enum TraceType
{
TRACE_ENTRY_STUB, // Stub goes to an unmanaged entry stub
TRACE_STUB, // Stub goes to another stub
TRACE_UNMANAGED, // Stub goes to unmanaged code
TRACE_MANAGED, // Stub goes to Jitted code
TRACE_UNJITTED_METHOD, // Is the prestub, since there is no code, the address will actually be a MethodDesc*
TRACE_FRAME_PUSH, // Don't know where stub goes, stop at address, and then ask the frame that is on the stack
TRACE_MGR_PUSH, // Don't know where stub goes, stop at address then call TraceManager() below to find out
TRACE_OTHER // We are going somewhere you can't step into (eg. ee helper function)
};
class StubManager;
class SString;
class DebuggerRCThread;
enum StubCodeBlockKind : int;
// A TraceDestination describes where code is going to call. This can be used by the Debugger's Step-In functionality
// to skip through stubs and place a patch directly at a call's target.
// TD are supplied by the stubmanagers.
class TraceDestination
{
public:
friend class DebuggerRCThread;
TraceDestination() { }
#ifdef _DEBUG
// Get a string representation of this TraceDestination
// Uses the supplied buffer to store the memory (or may return a string literal).
// This will also print the TD's arguments.
const WCHAR * DbgToString(SString &buffer);
#endif
// Initialize for unmanaged code.
// The addr is in unmanaged code. Used for Step-in from managed to native.
void InitForUnmanaged(PCODE addr)
{
this->type = TRACE_UNMANAGED;
this->address = addr;
this->stubManager = NULL;
}
// The addr is inside jitted code (eg, there's a JitManaged that will claim it)
void InitForManaged(PCODE addr)
{
this->type = TRACE_MANAGED;
this->address = addr;
this->stubManager = NULL;
}
// Initialize for an unmanaged entry stub.
void InitForUnmanagedStub(PCODE addr)
{
this->type = TRACE_ENTRY_STUB;
this->address = addr;
this->stubManager = NULL;
}
// Initialize for a stub.
void InitForStub(PCODE addr)
{
this->type = TRACE_STUB;
this->address = addr;
this->stubManager = NULL;
}
// Init for a managed unjitted method.
// This will place an IL patch that will get bound when the debugger gets a Jit complete
// notification for this method.
// If pDesc is a wrapper methoddesc, we will unwrap it.
void InitForUnjittedMethod(MethodDesc * pDesc);
// Place a patch at the given addr, and then when it's hit,
// call pStubManager->TraceManager() to get the next TraceDestination.
void InitForManagerPush(PCODE addr, StubManager * pStubManager)
{
this->type = TRACE_MGR_PUSH;
this->address = addr;
this->stubManager = pStubManager;
}
// Place a patch at the given addr, and then when it's hit
// call GetThread()->GetFrame()->TraceFrame() to get the next TraceDestination.
// This address must be safe to run a callstack at.
void InitForFramePush(PCODE addr)
{
this->type = TRACE_FRAME_PUSH;
this->address = addr;
this->stubManager = NULL;
}
// Nobody recognized the target address. We will not be able to step-in to it.
// This is ok if the target just calls into mscorwks (such as an Fcall) because
// there's no managed code to step in to, and we don't support debugging the CLR
// itself, so there's no native code to step into either.
void InitForOther(PCODE addr)
{
this->type = TRACE_OTHER;
this->address = addr;
this->stubManager = NULL;
}
// Accessors
TraceType GetTraceType() { return type; }
PCODE GetAddress()
{
LIMITED_METHOD_CONTRACT;
_ASSERTE(type != TRACE_UNJITTED_METHOD);
return address;
}
MethodDesc* GetMethodDesc()
{
LIMITED_METHOD_CONTRACT;
_ASSERTE(type == TRACE_UNJITTED_METHOD);
return pDesc;
}
StubManager * GetStubManager()
{
return stubManager;
}
// Expose this b/c DebuggerPatchTable::AddPatchForAddress() needs it.
// Ideally we'd get rid of this.
void Bad_SetTraceType(TraceType t)
{
this->type = t;
}
private:
TraceType type; // The kind of code the stub is going to
PCODE address; // Where the stub is going
StubManager *stubManager; // The manager that claims this stub
MethodDesc *pDesc;
};
// For logging
#ifdef LOGGING
void LogTraceDestination(const char * szHint, PCODE stubAddr, TraceDestination * pTrace);
#define LOG_TRACE_DESTINATION(_tracedestination, stubAddr, _stHint) LogTraceDestination(_stHint, stubAddr, _tracedestination)
#else
#define LOG_TRACE_DESTINATION(_tracedestination, stubAddr, _stHint)
#endif
typedef VPTR(class StubManager) PTR_StubManager;
class StubManager
{
friend class StubManagerIterator;
VPTR_BASE_VTABLE_CLASS(StubManager)
public:
// Startup and shutdown the global stubmanager service.
static void InitializeStubManagers();
static void TerminateStubManagers();
// Does any sub manager recognise this EIP?
static BOOL IsStub(PCODE stubAddress)
{
WRAPPER_NO_CONTRACT;
return FindStubManager(stubAddress) != NULL;
}
// Find stub manager for given code address
static PTR_StubManager FindStubManager(PCODE stubAddress);
// Look for stubAddress, if found return TRUE, and set 'trace' to
static BOOL TraceStub(PCODE stubAddress, TraceDestination *trace);
// if 'trace' indicates TRACE_STUB, keep calling TraceStub on 'trace', until you get out of all stubs
// returns true if successful
static BOOL FollowTrace(TraceDestination *trace);
#ifdef DACCESS_COMPILE
static void EnumMemoryRegions(CLRDataEnumMemoryFlags flags);
#endif
static void AddStubManager(StubManager *mgr);
// NOTE: Very important when using this. It is not thread safe, except in this very
// limited scenario: the thread must have the runtime suspended.
static void UnlinkStubManager(StubManager *mgr);
#ifndef DACCESS_COMPILE
StubManager();
virtual ~StubManager();
#endif
#ifdef _DEBUG
// Debug helper to help identify stub-managers. Make it pure to force stub managers to implement it.
virtual const char * DbgGetName() = 0;
#endif
// Only Stubmanagers that return 'TRACE_MGR_PUSH' as a trace type need to implement this function
// Fills in 'trace' (the target), and 'pRetAddr' (the method that called the stub) (this is needed
// as a 'fall back' so that the debugger can at least stop when the stub returns.
virtual BOOL TraceManager(Thread *thread, TraceDestination *trace,
T_CONTEXT *pContext, BYTE **pRetAddr)
{
LIMITED_METHOD_CONTRACT;
_ASSERTE(!"Default impl of TraceManager should never be called!");
return FALSE;
}
// The worker for IsStub. This calls CheckIsStub_Internal, but wraps it w/
// a try-catch.
BOOL CheckIsStub_Worker(PCODE stubStartAddress);
#ifdef _DEBUG
public:
//-----------------------------------------------------------------------------
// Debugging Stubmanager bugs is very painful. You need to figure out
// how you go to where you got and which stub-manager is at fault.
// To help with this, we track a rolling log so that we can give very
// informative asserts. this log is not thread-safe, but we really only expect
// a single stub-manager usage at a time.
//
// A stub manager for a step-in operation may be used across
// both the helper thread and then the managed thread doing the step-in.
// These threads will coordinate to have exclusive access (helper will only access
// when stopped; and managed thread will only access when running).
//
// It's also possible (but rare) for a single thread to have multiple step-in operations.
// Since that's so rare, no present need to expand our logging to support it.
//-----------------------------------------------------------------------------
static bool IsStubLoggingEnabled();
// Call to reset the log. This is used at the start of a new step-operation.
static void DbgBeginLog(TADDR addrCallInstruction, TADDR addrCallTarget);
static void DbgFinishLog();
// Log arbitrary string. This is a nop if it's outside the Begin/Finish window.
// We could consider making each log entry type-safe (and thus avoid the string operations).
static void DbgWriteLog(const CHAR *format, ...);
// Get the log as a string.
static void DbgGetLog(SString * pStringOut);
protected:
// Implement log as a SString.
static SString * s_pDbgStubManagerLog;
static CrstStatic s_DbgLogCrst;
#endif
protected:
// Each stubmanaged implements this.
// This may throw, AV, etc depending on the implementation. This should not
// be called directly unless you know exactly what you're doing.
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress) = 0;
// The worker for TraceStub
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace) = 0;
#ifdef _DEBUG_IMPL
static BOOL IsSingleOwner(PCODE stubAddress, StubManager * pOwner);
#endif
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
public:
// This is used by DAC to provide more information on who owns a stub.
virtual LPCWSTR GetStubManagerName(PCODE addr) = 0;
#endif
private:
SPTR_DECL(StubManager, g_pFirstManager);
PTR_StubManager m_pNextManager;
static CrstStatic s_StubManagerListCrst;
};
//-----------------------------------------------------------
// Stub manager for the prestub. Although there is just one, it has
// unique behavior so it gets its own stub manager.
//-----------------------------------------------------------
class ThePreStubManager : public StubManager
{
VPTR_VTABLE_CLASS(ThePreStubManager, StubManager)
public:
#ifndef DACCESS_COMPILE
ThePreStubManager() { LIMITED_METHOD_CONTRACT; }
#endif
#ifdef _DEBUG
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "ThePreStubManager"; }
#endif
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
#ifndef DACCESS_COMPILE
static void Init(void);
#endif
#ifdef DACCESS_COMPILE
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr)
{ LIMITED_METHOD_CONTRACT; return W("ThePreStub"); }
#endif
};
// -------------------------------------------------------
// Stub manager classes for method desc prestubs & normal
// frame-pushing, StubLinker created stubs
// -------------------------------------------------------
typedef VPTR(class PrecodeStubManager) PTR_PrecodeStubManager;
class PrecodeStubManager : public StubManager
{
VPTR_VTABLE_CLASS(PrecodeStubManager, StubManager)
public:
SPTR_DECL(PrecodeStubManager, g_pManager);
#ifdef _DEBUG
// Debug helper to help identify stub-managers.
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "PrecodeStubManager"; }
#endif
static void Init();
#ifndef DACCESS_COMPILE
PrecodeStubManager() {LIMITED_METHOD_CONTRACT;}
~PrecodeStubManager() {WRAPPER_NO_CONTRACT;}
#endif
public:
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
#ifndef DACCESS_COMPILE
virtual BOOL TraceManager(Thread *thread,
TraceDestination *trace,
T_CONTEXT *pContext,
BYTE **pRetAddr);
#endif
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr)
{ LIMITED_METHOD_CONTRACT; return W("MethodDescPrestub"); }
#endif
};
// Note that this stub was written by a debugger guy, and thus when he refers to 'multicast'
// stub, he really means multi or single cast stub. This was done b/c the same stub
// services both types of stub.
// Note from the debugger guy: the way to understand what this manager does is to
// first grok EmitMulticastInvoke for the platform you're working on (right now, just x86).
// Then return here, and understand that (for x86) the only way we know which method
// we're going to invoke next is by inspecting EDI when we've got the debuggee stopped
// in the stub, and so our trace frame will either (FRAME_PUSH) put a breakpoint
// in the stub, or (if we hit the BP) examine EDI, etc, & figure out where we're going next.
typedef VPTR(class StubLinkStubManager) PTR_StubLinkStubManager;
class StubLinkStubManager : public StubManager
{
VPTR_VTABLE_CLASS(StubLinkStubManager, StubManager)
public:
#ifdef _DEBUG
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "StubLinkStubManager"; }
#endif
SPTR_DECL(StubLinkStubManager, g_pManager);
static void Init();
#ifndef DACCESS_COMPILE
StubLinkStubManager() : StubManager(), m_rangeList() {LIMITED_METHOD_CONTRACT;}
~StubLinkStubManager() {WRAPPER_NO_CONTRACT;}
#endif
protected:
LockedRangeList m_rangeList;
public:
// Get dac-ized pointer to rangelist.
PTR_RangeList GetRangeList()
{
SUPPORTS_DAC;
TADDR addr = PTR_HOST_MEMBER_TADDR(StubLinkStubManager, this, m_rangeList);
return PTR_RangeList(addr);
}
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
#ifndef DACCESS_COMPILE
virtual BOOL TraceManager(Thread *thread,
TraceDestination *trace,
T_CONTEXT *pContext,
BYTE **pRetAddr);
#endif
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr)
{ LIMITED_METHOD_CONTRACT; return W("StubLinkStub"); }
#endif
} ;
// Stub manager for thunks.
typedef VPTR(class ThunkHeapStubManager) PTR_ThunkHeapStubManager;
class ThunkHeapStubManager : public StubManager
{
VPTR_VTABLE_CLASS(ThunkHeapStubManager, StubManager)
public:
SPTR_DECL(ThunkHeapStubManager, g_pManager);
static void Init();
#ifndef DACCESS_COMPILE
ThunkHeapStubManager() : StubManager(), m_rangeList() { LIMITED_METHOD_CONTRACT; }
~ThunkHeapStubManager() {WRAPPER_NO_CONTRACT;}
#endif
#ifdef _DEBUG
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "ThunkHeapStubManager"; }
#endif
protected:
LockedRangeList m_rangeList;
public:
// Get dac-ized pointer to rangelist.
PTR_RangeList GetRangeList()
{
SUPPORTS_DAC;
TADDR addr = PTR_HOST_MEMBER_TADDR(ThunkHeapStubManager, this, m_rangeList);
return PTR_RangeList(addr);
}
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
private:
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr)
{ LIMITED_METHOD_CONTRACT; return W("ThunkHeapStub"); }
#endif
};
//
// Stub manager for jump stubs created by ExecutionManager::jumpStub()
// These are currently used only on the 64-bit targets IA64 and AMD64
//
typedef VPTR(class JumpStubStubManager) PTR_JumpStubStubManager;
class JumpStubStubManager : public StubManager
{
VPTR_VTABLE_CLASS(JumpStubStubManager, StubManager)
public:
SPTR_DECL(JumpStubStubManager, g_pManager);
static void Init();
#ifndef DACCESS_COMPILE
JumpStubStubManager() {LIMITED_METHOD_CONTRACT;}
~JumpStubStubManager() {WRAPPER_NO_CONTRACT;}
#endif
#ifdef _DEBUG
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "JumpStubStubManager"; }
#endif
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr)
{ LIMITED_METHOD_CONTRACT; return W("JumpStub"); }
#endif
};
//
// Stub manager for code sections. It forwards the query to the more appropriate
// stub manager, or handles the query itself.
//
typedef VPTR(class RangeSectionStubManager) PTR_RangeSectionStubManager;
class RangeSectionStubManager : public StubManager
{
VPTR_VTABLE_CLASS(RangeSectionStubManager, StubManager)
public:
SPTR_DECL(RangeSectionStubManager, g_pManager);
static void Init();
#ifndef DACCESS_COMPILE
RangeSectionStubManager() {LIMITED_METHOD_CONTRACT;}
~RangeSectionStubManager() {WRAPPER_NO_CONTRACT;}
#endif
static StubCodeBlockKind GetStubKind(PCODE stubStartAddress);
static PCODE GetMethodThunkTarget(PCODE stubStartAddress);
public:
#ifdef _DEBUG
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "RangeSectionStubManager"; }
#endif
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
private:
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
#ifndef DACCESS_COMPILE
virtual BOOL TraceManager(Thread *thread,
TraceDestination *trace,
T_CONTEXT *pContext,
BYTE **pRetAddr);
#endif
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr);
#endif
};
//
// This is the stub manager for IL stubs.
//
typedef VPTR(class ILStubManager) PTR_ILStubManager;
#ifdef FEATURE_COMINTEROP
struct ComPlusCallInfo;
#endif // FEATURE_COMINTEROP
class ILStubManager : public StubManager
{
VPTR_VTABLE_CLASS(ILStubManager, StubManager)
public:
static void Init();
#ifndef DACCESS_COMPILE
ILStubManager() : StubManager() {WRAPPER_NO_CONTRACT;}
~ILStubManager()
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
CAN_TAKE_LOCK; // StubManager::UnlinkStubManager uses a crst
}
CONTRACTL_END;
}
#endif
public:
#ifdef _DEBUG
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "ILStubManager"; }
#endif
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
private:
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
#ifndef DACCESS_COMPILE
virtual BOOL TraceManager(Thread *thread,
TraceDestination *trace,
T_CONTEXT *pContext,
BYTE **pRetAddr);
#endif
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr)
{ LIMITED_METHOD_CONTRACT; return W("ILStub"); }
#endif
};
// This is used to recognize
// GenericComPlusCallStub()
// VarargPInvokeStub()
// GenericPInvokeCalliHelper()
typedef VPTR(class InteropDispatchStubManager) PTR_InteropDispatchStubManager;
class InteropDispatchStubManager : public StubManager
{
VPTR_VTABLE_CLASS(InteropDispatchStubManager, StubManager)
public:
static void Init();
#ifndef DACCESS_COMPILE
InteropDispatchStubManager() : StubManager() {WRAPPER_NO_CONTRACT;}
~InteropDispatchStubManager() {WRAPPER_NO_CONTRACT;}
#endif
#ifdef _DEBUG
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "InteropDispatchStubManager"; }
#endif
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
private:
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
#ifndef DACCESS_COMPILE
virtual BOOL TraceManager(Thread *thread,
TraceDestination *trace,
T_CONTEXT *pContext,
BYTE **pRetAddr);
#endif
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr)
{ LIMITED_METHOD_CONTRACT; return W("InteropDispatchStub"); }
#endif
};
//
// Since we don't generate delegate invoke stubs at runtime on WIN64, we
// can't use the StubLinkStubManager for these stubs. Instead, we create
// an additional DelegateInvokeStubManager instead.
//
typedef VPTR(class DelegateInvokeStubManager) PTR_DelegateInvokeStubManager;
class DelegateInvokeStubManager : public StubManager
{
VPTR_VTABLE_CLASS(DelegateInvokeStubManager, StubManager)
public:
SPTR_DECL(DelegateInvokeStubManager, g_pManager);
static void Init();
#if !defined(DACCESS_COMPILE)
DelegateInvokeStubManager() : StubManager(), m_rangeList() {LIMITED_METHOD_CONTRACT;}
~DelegateInvokeStubManager() {WRAPPER_NO_CONTRACT;}
#endif // DACCESS_COMPILE
BOOL AddStub(Stub* pStub);
void RemoveStub(Stub* pStub);
#ifdef _DEBUG
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "DelegateInvokeStubManager"; }
#endif
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
#if !defined(DACCESS_COMPILE)
virtual BOOL TraceManager(Thread *thread, TraceDestination *trace, T_CONTEXT *pContext, BYTE **pRetAddr);
static BOOL TraceDelegateObject(BYTE *orDel, TraceDestination *trace);
#endif // DACCESS_COMPILE
private:
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
protected:
LockedRangeList m_rangeList;
public:
// Get dac-ized pointer to rangelist.
PTR_RangeList GetRangeList()
{
SUPPORTS_DAC;
TADDR addr = PTR_HOST_MEMBER_TADDR(DelegateInvokeStubManager, this, m_rangeList);
return PTR_RangeList(addr);
}
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr)
{ LIMITED_METHOD_CONTRACT; return W("DelegateInvokeStub"); }
#endif
};
#if defined(TARGET_X86) && !defined(UNIX_X86_ABI)
//---------------------------------------------------------------------------------------
//
// This is the stub manager to help the managed debugger step into a tail call.
// It helps the debugger trace through JIT_TailCall().
//
typedef VPTR(class TailCallStubManager) PTR_TailCallStubManager;
class TailCallStubManager : public StubManager
{
VPTR_VTABLE_CLASS(TailCallStubManager, StubManager)
public:
static void Init();
#if !defined(DACCESS_COMPILE)
TailCallStubManager() : StubManager() {WRAPPER_NO_CONTRACT;}
~TailCallStubManager() {WRAPPER_NO_CONTRACT;}
virtual BOOL TraceManager(Thread * pThread, TraceDestination * pTrace, T_CONTEXT * pContext, BYTE ** ppRetAddr);
static bool IsTailCallJitHelper(PCODE code);
#endif // DACCESS_COMPILE
#if defined(_DEBUG)
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "TailCallStubManager"; }
#endif // _DEBUG
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
private:
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination * pTrace);
#if defined(DACCESS_COMPILE)
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr) {LIMITED_METHOD_CONTRACT; return W("TailCallStub");}
#endif // !DACCESS_COMPILE
};
#else // TARGET_X86 && UNIX_X86_ABI
class TailCallStubManager
{
public:
static void Init()
{
}
static bool IsTailCallJitHelper(PCODE code)
{
return false;
}
};
#endif // TARGET_X86 && UNIX_X86_ABI
//
// Helpers for common value locations in stubs to make stub managers more portable
//
class StubManagerHelpers
{
public:
static PCODE GetReturnAddress(T_CONTEXT * pContext)
{
#if defined(TARGET_X86)
return *dac_cast<PTR_PCODE>(pContext->Esp);
#elif defined(TARGET_AMD64)
return *dac_cast<PTR_PCODE>(pContext->Rsp);
#elif defined(TARGET_ARM)
return pContext->Lr;
#elif defined(TARGET_ARM64)
return pContext->Lr;
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetReturnAddress");
return NULL;
#endif
}
static PTR_Object GetThisPtr(T_CONTEXT * pContext)
{
#if defined(TARGET_X86)
return dac_cast<PTR_Object>(pContext->Ecx);
#elif defined(TARGET_AMD64)
#ifdef UNIX_AMD64_ABI
return dac_cast<PTR_Object>(pContext->Rdi);
#else
return dac_cast<PTR_Object>(pContext->Rcx);
#endif
#elif defined(TARGET_ARM)
return dac_cast<PTR_Object>((TADDR)pContext->R0);
#elif defined(TARGET_ARM64)
return dac_cast<PTR_Object>(pContext->X0);
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetThisPtr");
return NULL;
#endif
}
static PCODE GetTailCallTarget(T_CONTEXT * pContext)
{
#if defined(TARGET_X86)
return pContext->Eax;
#elif defined(TARGET_AMD64)
return pContext->Rax;
#elif defined(TARGET_ARM)
return pContext->R12;
#elif defined(TARGET_ARM64)
return pContext->X12;
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetTailCallTarget");
return NULL;
#endif
}
static TADDR GetHiddenArg(T_CONTEXT * pContext)
{
#if defined(TARGET_X86)
return pContext->Eax;
#elif defined(TARGET_AMD64)
return pContext->R10;
#elif defined(TARGET_ARM)
return pContext->R12;
#elif defined(TARGET_ARM64)
return pContext->X12;
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetHiddenArg");
return NULL;
#endif
}
static PCODE GetRetAddrFromMulticastILStubFrame(T_CONTEXT * pContext)
{
/*
Following is the callstack corresponding to context received by ILStubManager::TraceManager.
This function returns the return address (user code address) where control should return after all
delegates in multicast delegate have been executed.
StubHelpers::MulticastDebuggerTraceHelper
IL_STUB_MulticastDelegate_Invoke
UserCode which invokes multicast delegate <---
*/
#if defined(TARGET_X86)
return *((PCODE *)pContext->Ebp + 1);
#elif defined(TARGET_AMD64)
T_CONTEXT context(*pContext);
Thread::VirtualUnwindCallFrame(&context);
Thread::VirtualUnwindCallFrame(&context);
return context.Rip;
#elif defined(TARGET_ARM)
return *((PCODE *)((TADDR)pContext->R11) + 1);
#elif defined(TARGET_ARM64)
return *((PCODE *)pContext->Fp + 1);
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetRetAddrFromMulticastILStubFrame");
return NULL;
#endif
}
static TADDR GetSecondArg(T_CONTEXT * pContext)
{
#if defined(TARGET_X86)
return pContext->Edx;
#elif defined(TARGET_AMD64)
#ifdef UNIX_AMD64_ABI
return pContext->Rsi;
#else
return pContext->Rdx;
#endif
#elif defined(TARGET_ARM)
return pContext->R1;
#elif defined(TARGET_ARM64)
return pContext->X1;
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetSecondArg");
return NULL;
#endif
}
};
#endif // !__stubmgr_h__
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// StubMgr.h
//
//
// The stub manager exists so that the debugger can accurately step through
// the myriad stubs & wrappers which exist in the EE, without imposing undue
// overhead on the stubs themselves.
//
// Each type of stub (except those which the debugger can treat as atomic operations)
// needs to have a stub manager to represent it. The stub manager is responsible for
// (a) identifying the stub as such, and
// (b) tracing into the stub & reporting what the stub will call. This
// report can consist of
// (i) a managed code address
// (ii) an unmanaged code address
// (iii) another stub address
// (iv) a "frame patch" address - that is, an address in the stub,
// which the debugger can patch. When the patch is hit, the debugger
// will query the topmost frame to trace itself. (Thus this is
// a way of deferring the trace logic to the frame which the stub
// will push.)
//
// The set of stub managers is extensible, but should be kept to a reasonable number
// as they are currently linearly searched & queried for each stub.
//
//
// IMPORTANT IMPLEMENTATION NOTE: Due to code versioning, tracing through a jitted code
// call is a speculative exercise. A trace could predict that calling method Foo would run
// jitted code at address 0x1234, however afterwards code versioning redirects Foo to call
// an alternate jitted code body at address 0x5678. To handle this stub managers should
// either:
// a) stop tracing at offset zero of the newly called jitted code. The debugger knows
// to treat offset 0 in jitted code as potentially being any jitted code instance
// b) trace all the way through the jitted method such that regardless of which jitted
// code instance gets called the trace will still end at the predicted location.
//
// If we wanted to be more rigorous about this we should probably have different trace
// results for intra-jitted and inter-jitted trace results but given the relative
// stability of this part of the code I haven't attacked that problem right now. It does
// work as-is.
//
#ifndef __stubmgr_h__
#define __stubmgr_h__
#include "simplerwlock.hpp"
#include "lockedrangelist.h"
// When 'TraceStub' returns, it gives the address of where the 'target' is for a stub'
// TraceType indicates what this 'target' is
enum TraceType
{
TRACE_ENTRY_STUB, // Stub goes to an unmanaged entry stub
TRACE_STUB, // Stub goes to another stub
TRACE_UNMANAGED, // Stub goes to unmanaged code
TRACE_MANAGED, // Stub goes to Jitted code
TRACE_UNJITTED_METHOD, // Is the prestub, since there is no code, the address will actually be a MethodDesc*
TRACE_FRAME_PUSH, // Don't know where stub goes, stop at address, and then ask the frame that is on the stack
TRACE_MGR_PUSH, // Don't know where stub goes, stop at address then call TraceManager() below to find out
TRACE_OTHER // We are going somewhere you can't step into (eg. ee helper function)
};
class StubManager;
class SString;
class DebuggerRCThread;
enum StubCodeBlockKind : int;
// A TraceDestination describes where code is going to call. This can be used by the Debugger's Step-In functionality
// to skip through stubs and place a patch directly at a call's target.
// TD are supplied by the stubmanagers.
class TraceDestination
{
public:
friend class DebuggerRCThread;
TraceDestination() { }
#ifdef _DEBUG
// Get a string representation of this TraceDestination
// Uses the supplied buffer to store the memory (or may return a string literal).
// This will also print the TD's arguments.
const WCHAR * DbgToString(SString &buffer);
#endif
// Initialize for unmanaged code.
// The addr is in unmanaged code. Used for Step-in from managed to native.
void InitForUnmanaged(PCODE addr)
{
this->type = TRACE_UNMANAGED;
this->address = addr;
this->stubManager = NULL;
}
// The addr is inside jitted code (eg, there's a JitManaged that will claim it)
void InitForManaged(PCODE addr)
{
this->type = TRACE_MANAGED;
this->address = addr;
this->stubManager = NULL;
}
// Initialize for an unmanaged entry stub.
void InitForUnmanagedStub(PCODE addr)
{
this->type = TRACE_ENTRY_STUB;
this->address = addr;
this->stubManager = NULL;
}
// Initialize for a stub.
void InitForStub(PCODE addr)
{
this->type = TRACE_STUB;
this->address = addr;
this->stubManager = NULL;
}
// Init for a managed unjitted method.
// This will place an IL patch that will get bound when the debugger gets a Jit complete
// notification for this method.
// If pDesc is a wrapper methoddesc, we will unwrap it.
void InitForUnjittedMethod(MethodDesc * pDesc);
// Place a patch at the given addr, and then when it's hit,
// call pStubManager->TraceManager() to get the next TraceDestination.
void InitForManagerPush(PCODE addr, StubManager * pStubManager)
{
this->type = TRACE_MGR_PUSH;
this->address = addr;
this->stubManager = pStubManager;
}
// Place a patch at the given addr, and then when it's hit
// call GetThread()->GetFrame()->TraceFrame() to get the next TraceDestination.
// This address must be safe to run a callstack at.
void InitForFramePush(PCODE addr)
{
this->type = TRACE_FRAME_PUSH;
this->address = addr;
this->stubManager = NULL;
}
// Nobody recognized the target address. We will not be able to step-in to it.
// This is ok if the target just calls into mscorwks (such as an Fcall) because
// there's no managed code to step in to, and we don't support debugging the CLR
// itself, so there's no native code to step into either.
void InitForOther(PCODE addr)
{
this->type = TRACE_OTHER;
this->address = addr;
this->stubManager = NULL;
}
// Accessors
TraceType GetTraceType() { return type; }
PCODE GetAddress()
{
LIMITED_METHOD_CONTRACT;
_ASSERTE(type != TRACE_UNJITTED_METHOD);
return address;
}
MethodDesc* GetMethodDesc()
{
LIMITED_METHOD_CONTRACT;
_ASSERTE(type == TRACE_UNJITTED_METHOD);
return pDesc;
}
StubManager * GetStubManager()
{
return stubManager;
}
// Expose this b/c DebuggerPatchTable::AddPatchForAddress() needs it.
// Ideally we'd get rid of this.
void Bad_SetTraceType(TraceType t)
{
this->type = t;
}
private:
TraceType type; // The kind of code the stub is going to
PCODE address; // Where the stub is going
StubManager *stubManager; // The manager that claims this stub
MethodDesc *pDesc;
};
// For logging
#ifdef LOGGING
void LogTraceDestination(const char * szHint, PCODE stubAddr, TraceDestination * pTrace);
#define LOG_TRACE_DESTINATION(_tracedestination, stubAddr, _stHint) LogTraceDestination(_stHint, stubAddr, _tracedestination)
#else
#define LOG_TRACE_DESTINATION(_tracedestination, stubAddr, _stHint)
#endif
typedef VPTR(class StubManager) PTR_StubManager;
class StubManager
{
friend class StubManagerIterator;
VPTR_BASE_VTABLE_CLASS(StubManager)
public:
// Startup and shutdown the global stubmanager service.
static void InitializeStubManagers();
static void TerminateStubManagers();
// Does any sub manager recognise this EIP?
static BOOL IsStub(PCODE stubAddress)
{
WRAPPER_NO_CONTRACT;
return FindStubManager(stubAddress) != NULL;
}
// Find stub manager for given code address
static PTR_StubManager FindStubManager(PCODE stubAddress);
// Look for stubAddress, if found return TRUE, and set 'trace' to
static BOOL TraceStub(PCODE stubAddress, TraceDestination *trace);
// if 'trace' indicates TRACE_STUB, keep calling TraceStub on 'trace', until you get out of all stubs
// returns true if successful
static BOOL FollowTrace(TraceDestination *trace);
#ifdef DACCESS_COMPILE
static void EnumMemoryRegions(CLRDataEnumMemoryFlags flags);
#endif
static void AddStubManager(StubManager *mgr);
// NOTE: Very important when using this. It is not thread safe, except in this very
// limited scenario: the thread must have the runtime suspended.
static void UnlinkStubManager(StubManager *mgr);
#ifndef DACCESS_COMPILE
StubManager();
virtual ~StubManager();
#endif
#ifdef _DEBUG
// Debug helper to help identify stub-managers. Make it pure to force stub managers to implement it.
virtual const char * DbgGetName() = 0;
#endif
// Only Stubmanagers that return 'TRACE_MGR_PUSH' as a trace type need to implement this function
// Fills in 'trace' (the target), and 'pRetAddr' (the method that called the stub) (this is needed
// as a 'fall back' so that the debugger can at least stop when the stub returns.
virtual BOOL TraceManager(Thread *thread, TraceDestination *trace,
T_CONTEXT *pContext, BYTE **pRetAddr)
{
LIMITED_METHOD_CONTRACT;
_ASSERTE(!"Default impl of TraceManager should never be called!");
return FALSE;
}
// The worker for IsStub. This calls CheckIsStub_Internal, but wraps it w/
// a try-catch.
BOOL CheckIsStub_Worker(PCODE stubStartAddress);
#ifdef _DEBUG
public:
//-----------------------------------------------------------------------------
// Debugging Stubmanager bugs is very painful. You need to figure out
// how you go to where you got and which stub-manager is at fault.
// To help with this, we track a rolling log so that we can give very
// informative asserts. this log is not thread-safe, but we really only expect
// a single stub-manager usage at a time.
//
// A stub manager for a step-in operation may be used across
// both the helper thread and then the managed thread doing the step-in.
// These threads will coordinate to have exclusive access (helper will only access
// when stopped; and managed thread will only access when running).
//
// It's also possible (but rare) for a single thread to have multiple step-in operations.
// Since that's so rare, no present need to expand our logging to support it.
//-----------------------------------------------------------------------------
static bool IsStubLoggingEnabled();
// Call to reset the log. This is used at the start of a new step-operation.
static void DbgBeginLog(TADDR addrCallInstruction, TADDR addrCallTarget);
static void DbgFinishLog();
// Log arbitrary string. This is a nop if it's outside the Begin/Finish window.
// We could consider making each log entry type-safe (and thus avoid the string operations).
static void DbgWriteLog(const CHAR *format, ...);
// Get the log as a string.
static void DbgGetLog(SString * pStringOut);
protected:
// Implement log as a SString.
static SString * s_pDbgStubManagerLog;
static CrstStatic s_DbgLogCrst;
#endif
protected:
// Each stubmanaged implements this.
// This may throw, AV, etc depending on the implementation. This should not
// be called directly unless you know exactly what you're doing.
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress) = 0;
// The worker for TraceStub
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace) = 0;
#ifdef _DEBUG_IMPL
static BOOL IsSingleOwner(PCODE stubAddress, StubManager * pOwner);
#endif
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
public:
// This is used by DAC to provide more information on who owns a stub.
virtual LPCWSTR GetStubManagerName(PCODE addr) = 0;
#endif
private:
SPTR_DECL(StubManager, g_pFirstManager);
PTR_StubManager m_pNextManager;
static CrstStatic s_StubManagerListCrst;
};
//-----------------------------------------------------------
// Stub manager for the prestub. Although there is just one, it has
// unique behavior so it gets its own stub manager.
//-----------------------------------------------------------
class ThePreStubManager : public StubManager
{
VPTR_VTABLE_CLASS(ThePreStubManager, StubManager)
public:
#ifndef DACCESS_COMPILE
ThePreStubManager() { LIMITED_METHOD_CONTRACT; }
#endif
#ifdef _DEBUG
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "ThePreStubManager"; }
#endif
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
#ifndef DACCESS_COMPILE
static void Init(void);
#endif
#ifdef DACCESS_COMPILE
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr)
{ LIMITED_METHOD_CONTRACT; return W("ThePreStub"); }
#endif
};
// -------------------------------------------------------
// Stub manager classes for method desc prestubs & normal
// frame-pushing, StubLinker created stubs
// -------------------------------------------------------
typedef VPTR(class PrecodeStubManager) PTR_PrecodeStubManager;
class PrecodeStubManager : public StubManager
{
VPTR_VTABLE_CLASS(PrecodeStubManager, StubManager)
public:
SPTR_DECL(PrecodeStubManager, g_pManager);
#ifdef _DEBUG
// Debug helper to help identify stub-managers.
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "PrecodeStubManager"; }
#endif
static void Init();
#ifndef DACCESS_COMPILE
PrecodeStubManager() {LIMITED_METHOD_CONTRACT;}
~PrecodeStubManager() {WRAPPER_NO_CONTRACT;}
#endif
public:
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
#ifndef DACCESS_COMPILE
virtual BOOL TraceManager(Thread *thread,
TraceDestination *trace,
T_CONTEXT *pContext,
BYTE **pRetAddr);
#endif
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr)
{ LIMITED_METHOD_CONTRACT; return W("MethodDescPrestub"); }
#endif
};
// Note that this stub was written by a debugger guy, and thus when he refers to 'multicast'
// stub, he really means multi or single cast stub. This was done b/c the same stub
// services both types of stub.
// Note from the debugger guy: the way to understand what this manager does is to
// first grok EmitMulticastInvoke for the platform you're working on (right now, just x86).
// Then return here, and understand that (for x86) the only way we know which method
// we're going to invoke next is by inspecting EDI when we've got the debuggee stopped
// in the stub, and so our trace frame will either (FRAME_PUSH) put a breakpoint
// in the stub, or (if we hit the BP) examine EDI, etc, & figure out where we're going next.
typedef VPTR(class StubLinkStubManager) PTR_StubLinkStubManager;
class StubLinkStubManager : public StubManager
{
VPTR_VTABLE_CLASS(StubLinkStubManager, StubManager)
public:
#ifdef _DEBUG
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "StubLinkStubManager"; }
#endif
SPTR_DECL(StubLinkStubManager, g_pManager);
static void Init();
#ifndef DACCESS_COMPILE
StubLinkStubManager() : StubManager(), m_rangeList() {LIMITED_METHOD_CONTRACT;}
~StubLinkStubManager() {WRAPPER_NO_CONTRACT;}
#endif
protected:
LockedRangeList m_rangeList;
public:
// Get dac-ized pointer to rangelist.
PTR_RangeList GetRangeList()
{
SUPPORTS_DAC;
TADDR addr = PTR_HOST_MEMBER_TADDR(StubLinkStubManager, this, m_rangeList);
return PTR_RangeList(addr);
}
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
#ifndef DACCESS_COMPILE
virtual BOOL TraceManager(Thread *thread,
TraceDestination *trace,
T_CONTEXT *pContext,
BYTE **pRetAddr);
#endif
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr)
{ LIMITED_METHOD_CONTRACT; return W("StubLinkStub"); }
#endif
} ;
// Stub manager for thunks.
typedef VPTR(class ThunkHeapStubManager) PTR_ThunkHeapStubManager;
class ThunkHeapStubManager : public StubManager
{
VPTR_VTABLE_CLASS(ThunkHeapStubManager, StubManager)
public:
SPTR_DECL(ThunkHeapStubManager, g_pManager);
static void Init();
#ifndef DACCESS_COMPILE
ThunkHeapStubManager() : StubManager(), m_rangeList() { LIMITED_METHOD_CONTRACT; }
~ThunkHeapStubManager() {WRAPPER_NO_CONTRACT;}
#endif
#ifdef _DEBUG
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "ThunkHeapStubManager"; }
#endif
protected:
LockedRangeList m_rangeList;
public:
// Get dac-ized pointer to rangelist.
PTR_RangeList GetRangeList()
{
SUPPORTS_DAC;
TADDR addr = PTR_HOST_MEMBER_TADDR(ThunkHeapStubManager, this, m_rangeList);
return PTR_RangeList(addr);
}
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
private:
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr)
{ LIMITED_METHOD_CONTRACT; return W("ThunkHeapStub"); }
#endif
};
//
// Stub manager for jump stubs created by ExecutionManager::jumpStub()
// These are currently used only on the 64-bit targets IA64 and AMD64
//
typedef VPTR(class JumpStubStubManager) PTR_JumpStubStubManager;
class JumpStubStubManager : public StubManager
{
VPTR_VTABLE_CLASS(JumpStubStubManager, StubManager)
public:
SPTR_DECL(JumpStubStubManager, g_pManager);
static void Init();
#ifndef DACCESS_COMPILE
JumpStubStubManager() {LIMITED_METHOD_CONTRACT;}
~JumpStubStubManager() {WRAPPER_NO_CONTRACT;}
#endif
#ifdef _DEBUG
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "JumpStubStubManager"; }
#endif
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr)
{ LIMITED_METHOD_CONTRACT; return W("JumpStub"); }
#endif
};
//
// Stub manager for code sections. It forwards the query to the more appropriate
// stub manager, or handles the query itself.
//
typedef VPTR(class RangeSectionStubManager) PTR_RangeSectionStubManager;
class RangeSectionStubManager : public StubManager
{
VPTR_VTABLE_CLASS(RangeSectionStubManager, StubManager)
public:
SPTR_DECL(RangeSectionStubManager, g_pManager);
static void Init();
#ifndef DACCESS_COMPILE
RangeSectionStubManager() {LIMITED_METHOD_CONTRACT;}
~RangeSectionStubManager() {WRAPPER_NO_CONTRACT;}
#endif
static StubCodeBlockKind GetStubKind(PCODE stubStartAddress);
static PCODE GetMethodThunkTarget(PCODE stubStartAddress);
public:
#ifdef _DEBUG
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "RangeSectionStubManager"; }
#endif
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
private:
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
#ifndef DACCESS_COMPILE
virtual BOOL TraceManager(Thread *thread,
TraceDestination *trace,
T_CONTEXT *pContext,
BYTE **pRetAddr);
#endif
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr);
#endif
};
//
// This is the stub manager for IL stubs.
//
typedef VPTR(class ILStubManager) PTR_ILStubManager;
#ifdef FEATURE_COMINTEROP
struct ComPlusCallInfo;
#endif // FEATURE_COMINTEROP
class ILStubManager : public StubManager
{
VPTR_VTABLE_CLASS(ILStubManager, StubManager)
public:
static void Init();
#ifndef DACCESS_COMPILE
ILStubManager() : StubManager() {WRAPPER_NO_CONTRACT;}
~ILStubManager()
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
CAN_TAKE_LOCK; // StubManager::UnlinkStubManager uses a crst
}
CONTRACTL_END;
}
#endif
public:
#ifdef _DEBUG
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "ILStubManager"; }
#endif
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
private:
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
#ifndef DACCESS_COMPILE
virtual BOOL TraceManager(Thread *thread,
TraceDestination *trace,
T_CONTEXT *pContext,
BYTE **pRetAddr);
#endif
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr)
{ LIMITED_METHOD_CONTRACT; return W("ILStub"); }
#endif
};
// This is used to recognize
// GenericComPlusCallStub()
// VarargPInvokeStub()
// GenericPInvokeCalliHelper()
typedef VPTR(class InteropDispatchStubManager) PTR_InteropDispatchStubManager;
class InteropDispatchStubManager : public StubManager
{
VPTR_VTABLE_CLASS(InteropDispatchStubManager, StubManager)
public:
static void Init();
#ifndef DACCESS_COMPILE
InteropDispatchStubManager() : StubManager() {WRAPPER_NO_CONTRACT;}
~InteropDispatchStubManager() {WRAPPER_NO_CONTRACT;}
#endif
#ifdef _DEBUG
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "InteropDispatchStubManager"; }
#endif
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
private:
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
#ifndef DACCESS_COMPILE
virtual BOOL TraceManager(Thread *thread,
TraceDestination *trace,
T_CONTEXT *pContext,
BYTE **pRetAddr);
#endif
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr)
{ LIMITED_METHOD_CONTRACT; return W("InteropDispatchStub"); }
#endif
};
//
// Since we don't generate delegate invoke stubs at runtime on WIN64, we
// can't use the StubLinkStubManager for these stubs. Instead, we create
// an additional DelegateInvokeStubManager instead.
//
typedef VPTR(class DelegateInvokeStubManager) PTR_DelegateInvokeStubManager;
class DelegateInvokeStubManager : public StubManager
{
VPTR_VTABLE_CLASS(DelegateInvokeStubManager, StubManager)
public:
SPTR_DECL(DelegateInvokeStubManager, g_pManager);
static void Init();
#if !defined(DACCESS_COMPILE)
DelegateInvokeStubManager() : StubManager(), m_rangeList() {LIMITED_METHOD_CONTRACT;}
~DelegateInvokeStubManager() {WRAPPER_NO_CONTRACT;}
#endif // DACCESS_COMPILE
BOOL AddStub(Stub* pStub);
void RemoveStub(Stub* pStub);
#ifdef _DEBUG
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "DelegateInvokeStubManager"; }
#endif
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
#if !defined(DACCESS_COMPILE)
virtual BOOL TraceManager(Thread *thread, TraceDestination *trace, T_CONTEXT *pContext, BYTE **pRetAddr);
static BOOL TraceDelegateObject(BYTE *orDel, TraceDestination *trace);
#endif // DACCESS_COMPILE
private:
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination *trace);
protected:
LockedRangeList m_rangeList;
public:
// Get dac-ized pointer to rangelist.
PTR_RangeList GetRangeList()
{
SUPPORTS_DAC;
TADDR addr = PTR_HOST_MEMBER_TADDR(DelegateInvokeStubManager, this, m_rangeList);
return PTR_RangeList(addr);
}
#ifdef DACCESS_COMPILE
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr)
{ LIMITED_METHOD_CONTRACT; return W("DelegateInvokeStub"); }
#endif
};
#if defined(TARGET_X86) && !defined(UNIX_X86_ABI)
//---------------------------------------------------------------------------------------
//
// This is the stub manager to help the managed debugger step into a tail call.
// It helps the debugger trace through JIT_TailCall().
//
typedef VPTR(class TailCallStubManager) PTR_TailCallStubManager;
class TailCallStubManager : public StubManager
{
VPTR_VTABLE_CLASS(TailCallStubManager, StubManager)
public:
static void Init();
#if !defined(DACCESS_COMPILE)
TailCallStubManager() : StubManager() {WRAPPER_NO_CONTRACT;}
~TailCallStubManager() {WRAPPER_NO_CONTRACT;}
virtual BOOL TraceManager(Thread * pThread, TraceDestination * pTrace, T_CONTEXT * pContext, BYTE ** ppRetAddr);
static bool IsTailCallJitHelper(PCODE code);
#endif // DACCESS_COMPILE
#if defined(_DEBUG)
virtual const char * DbgGetName() { LIMITED_METHOD_CONTRACT; return "TailCallStubManager"; }
#endif // _DEBUG
virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress);
private:
virtual BOOL DoTraceStub(PCODE stubStartAddress, TraceDestination * pTrace);
#if defined(DACCESS_COMPILE)
virtual void DoEnumMemoryRegions(CLRDataEnumMemoryFlags flags);
protected:
virtual LPCWSTR GetStubManagerName(PCODE addr) {LIMITED_METHOD_CONTRACT; return W("TailCallStub");}
#endif // !DACCESS_COMPILE
};
#else // TARGET_X86 && UNIX_X86_ABI
class TailCallStubManager
{
public:
static void Init()
{
}
static bool IsTailCallJitHelper(PCODE code)
{
return false;
}
};
#endif // TARGET_X86 && UNIX_X86_ABI
//
// Helpers for common value locations in stubs to make stub managers more portable
//
class StubManagerHelpers
{
public:
static PCODE GetReturnAddress(T_CONTEXT * pContext)
{
#if defined(TARGET_X86)
return *dac_cast<PTR_PCODE>(pContext->Esp);
#elif defined(TARGET_AMD64)
return *dac_cast<PTR_PCODE>(pContext->Rsp);
#elif defined(TARGET_ARM)
return pContext->Lr;
#elif defined(TARGET_ARM64)
return pContext->Lr;
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetReturnAddress");
return NULL;
#endif
}
static PTR_Object GetThisPtr(T_CONTEXT * pContext)
{
#if defined(TARGET_X86)
return dac_cast<PTR_Object>(pContext->Ecx);
#elif defined(TARGET_AMD64)
#ifdef UNIX_AMD64_ABI
return dac_cast<PTR_Object>(pContext->Rdi);
#else
return dac_cast<PTR_Object>(pContext->Rcx);
#endif
#elif defined(TARGET_ARM)
return dac_cast<PTR_Object>((TADDR)pContext->R0);
#elif defined(TARGET_ARM64)
return dac_cast<PTR_Object>(pContext->X0);
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetThisPtr");
return NULL;
#endif
}
static PCODE GetTailCallTarget(T_CONTEXT * pContext)
{
#if defined(TARGET_X86)
return pContext->Eax;
#elif defined(TARGET_AMD64)
return pContext->Rax;
#elif defined(TARGET_ARM)
return pContext->R12;
#elif defined(TARGET_ARM64)
return pContext->X12;
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetTailCallTarget");
return NULL;
#endif
}
static TADDR GetHiddenArg(T_CONTEXT * pContext)
{
#if defined(TARGET_X86)
return pContext->Eax;
#elif defined(TARGET_AMD64)
return pContext->R10;
#elif defined(TARGET_ARM)
return pContext->R12;
#elif defined(TARGET_ARM64)
return pContext->X12;
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetHiddenArg");
return NULL;
#endif
}
static PCODE GetRetAddrFromMulticastILStubFrame(T_CONTEXT * pContext)
{
/*
Following is the callstack corresponding to context received by ILStubManager::TraceManager.
This function returns the return address (user code address) where control should return after all
delegates in multicast delegate have been executed.
StubHelpers::MulticastDebuggerTraceHelper
IL_STUB_MulticastDelegate_Invoke
UserCode which invokes multicast delegate <---
*/
#if defined(TARGET_X86)
return *((PCODE *)pContext->Ebp + 1);
#elif defined(TARGET_AMD64)
T_CONTEXT context(*pContext);
Thread::VirtualUnwindCallFrame(&context);
Thread::VirtualUnwindCallFrame(&context);
return context.Rip;
#elif defined(TARGET_ARM)
return *((PCODE *)((TADDR)pContext->R11) + 1);
#elif defined(TARGET_ARM64)
return *((PCODE *)pContext->Fp + 1);
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetRetAddrFromMulticastILStubFrame");
return NULL;
#endif
}
static TADDR GetSecondArg(T_CONTEXT * pContext)
{
#if defined(TARGET_X86)
return pContext->Edx;
#elif defined(TARGET_AMD64)
#ifdef UNIX_AMD64_ABI
return pContext->Rsi;
#else
return pContext->Rdx;
#endif
#elif defined(TARGET_ARM)
return pContext->R1;
#elif defined(TARGET_ARM64)
return pContext->X1;
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetSecondArg");
return NULL;
#endif
}
};
#endif // !__stubmgr_h__
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/native/libs/System.Security.Cryptography.Native.Android/pal_cipher.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#pragma once
#include "pal_jni.h"
#define TAG_MAX_LENGTH 16
#define CIPHER_ENCRYPT_MODE 1
#define CIPHER_DECRYPT_MODE 2
typedef struct CipherInfo CipherInfo;
typedef struct CipherCtx
{
jobject cipher;
CipherInfo* type;
int32_t keySizeInBits;
int32_t ivLength;
int32_t tagLength;
int32_t encMode;
uint8_t* key;
uint8_t* iv;
} CipherCtx;
PALEXPORT int32_t AndroidCryptoNative_CipherIsSupported(CipherInfo* type);
PALEXPORT CipherCtx* AndroidCryptoNative_CipherCreate(CipherInfo* type, uint8_t* key, int32_t keySizeInBits, uint8_t* iv, int32_t enc);
PALEXPORT CipherCtx* AndroidCryptoNative_CipherCreatePartial(CipherInfo* type);
PALEXPORT int32_t AndroidCryptoNative_CipherSetTagLength(CipherCtx* ctx, int32_t tagLength);
PALEXPORT int32_t AndroidCryptoNative_CipherSetKeyAndIV(CipherCtx* ctx, uint8_t* key, uint8_t* iv, int32_t enc);
PALEXPORT int32_t AndroidCryptoNative_CipherSetNonceLength(CipherCtx* ctx, int32_t ivLength);
PALEXPORT void AndroidCryptoNative_CipherDestroy(CipherCtx* ctx);
PALEXPORT int32_t AndroidCryptoNative_CipherReset(CipherCtx* ctx, uint8_t* pIv, int32_t cIv);
PALEXPORT int32_t AndroidCryptoNative_CipherCtxSetPadding(CipherCtx* ctx, int32_t padding);
PALEXPORT int32_t AndroidCryptoNative_CipherUpdateAAD(CipherCtx* ctx, uint8_t* in, int32_t inl);
PALEXPORT int32_t AndroidCryptoNative_CipherUpdate(CipherCtx* ctx, uint8_t* out, int32_t* outl, uint8_t* in, int32_t inl);
PALEXPORT int32_t AndroidCryptoNative_CipherFinalEx(CipherCtx* ctx, uint8_t* outm, int32_t* outl);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes128Ecb(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes128Cbc(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes128Cfb8(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes128Cfb128(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes128Gcm(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes128Ccm(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes192Ecb(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes192Cbc(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes192Cfb8(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes192Cfb128(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes192Gcm(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes192Ccm(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes256Ecb(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes256Cbc(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes256Cfb8(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes256Cfb128(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes256Gcm(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes256Ccm(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Des3Ecb(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Des3Cbc(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Des3Cfb8(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Des3Cfb64(void);
PALEXPORT CipherInfo* AndroidCryptoNative_DesEcb(void);
PALEXPORT CipherInfo* AndroidCryptoNative_DesCfb8(void);
PALEXPORT CipherInfo* AndroidCryptoNative_DesCbc(void);
PALEXPORT CipherInfo* AndroidCryptoNative_ChaCha20Poly1305(void);
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#pragma once
#include "pal_jni.h"
#define TAG_MAX_LENGTH 16
#define CIPHER_ENCRYPT_MODE 1
#define CIPHER_DECRYPT_MODE 2
typedef struct CipherInfo CipherInfo;
typedef struct CipherCtx
{
jobject cipher;
CipherInfo* type;
int32_t keySizeInBits;
int32_t ivLength;
int32_t tagLength;
int32_t encMode;
uint8_t* key;
uint8_t* iv;
} CipherCtx;
PALEXPORT int32_t AndroidCryptoNative_CipherIsSupported(CipherInfo* type);
PALEXPORT CipherCtx* AndroidCryptoNative_CipherCreate(CipherInfo* type, uint8_t* key, int32_t keySizeInBits, uint8_t* iv, int32_t enc);
PALEXPORT CipherCtx* AndroidCryptoNative_CipherCreatePartial(CipherInfo* type);
PALEXPORT int32_t AndroidCryptoNative_CipherSetTagLength(CipherCtx* ctx, int32_t tagLength);
PALEXPORT int32_t AndroidCryptoNative_CipherSetKeyAndIV(CipherCtx* ctx, uint8_t* key, uint8_t* iv, int32_t enc);
PALEXPORT int32_t AndroidCryptoNative_CipherSetNonceLength(CipherCtx* ctx, int32_t ivLength);
PALEXPORT void AndroidCryptoNative_CipherDestroy(CipherCtx* ctx);
PALEXPORT int32_t AndroidCryptoNative_CipherReset(CipherCtx* ctx, uint8_t* pIv, int32_t cIv);
PALEXPORT int32_t AndroidCryptoNative_CipherCtxSetPadding(CipherCtx* ctx, int32_t padding);
PALEXPORT int32_t AndroidCryptoNative_CipherUpdateAAD(CipherCtx* ctx, uint8_t* in, int32_t inl);
PALEXPORT int32_t AndroidCryptoNative_CipherUpdate(CipherCtx* ctx, uint8_t* out, int32_t* outl, uint8_t* in, int32_t inl);
PALEXPORT int32_t AndroidCryptoNative_CipherFinalEx(CipherCtx* ctx, uint8_t* outm, int32_t* outl);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes128Ecb(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes128Cbc(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes128Cfb8(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes128Cfb128(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes128Gcm(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes128Ccm(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes192Ecb(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes192Cbc(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes192Cfb8(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes192Cfb128(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes192Gcm(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes192Ccm(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes256Ecb(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes256Cbc(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes256Cfb8(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes256Cfb128(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes256Gcm(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Aes256Ccm(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Des3Ecb(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Des3Cbc(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Des3Cfb8(void);
PALEXPORT CipherInfo* AndroidCryptoNative_Des3Cfb64(void);
PALEXPORT CipherInfo* AndroidCryptoNative_DesEcb(void);
PALEXPORT CipherInfo* AndroidCryptoNative_DesCfb8(void);
PALEXPORT CipherInfo* AndroidCryptoNative_DesCbc(void);
PALEXPORT CipherInfo* AndroidCryptoNative_ChaCha20Poly1305(void);
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/coreclr/pal/inc/rt/winapifamily.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
//
// ===========================================================================
// File: windows.h
//
// ===========================================================================
// dummy winapifamily.h for PAL
#ifndef _INC_WINAPIFAMILY
#define _INC_WINAPIFAMILY
//
// Windows APIs can be placed in a partition represented by one of the below bits. The
// WINAPI_FAMILY value determines which partitions are available to the client code.
//
#define WINAPI_PARTITION_DESKTOP 0x00000001
#define WINAPI_PARTITION_APP 0x00000002
// A family may be defined as the union of multiple families. WINAPI_FAMILY should be set
// to one of these values.
#define WINAPI_FAMILY_APP WINAPI_PARTITION_APP
#define WINAPI_FAMILY_DESKTOP_APP (WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_APP)
// Provide a default for WINAPI_FAMILY if needed.
#ifndef WINAPI_FAMILY
#define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP
#endif
// Macro to determine if a partition is enabled
#define WINAPI_FAMILY_PARTITION(Partition) ((WINAPI_FAMILY & Partition) == Partition)
// Macro to determine if only one partition is enabled from a set
#define WINAPI_FAMILY_ONE_PARTITION(PartitionSet, Partition) ((WINAPI_FAMILY & PartitionSet) == Partition)
#endif
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
//
// ===========================================================================
// File: windows.h
//
// ===========================================================================
// dummy winapifamily.h for PAL
#ifndef _INC_WINAPIFAMILY
#define _INC_WINAPIFAMILY
//
// Windows APIs can be placed in a partition represented by one of the below bits. The
// WINAPI_FAMILY value determines which partitions are available to the client code.
//
#define WINAPI_PARTITION_DESKTOP 0x00000001
#define WINAPI_PARTITION_APP 0x00000002
// A family may be defined as the union of multiple families. WINAPI_FAMILY should be set
// to one of these values.
#define WINAPI_FAMILY_APP WINAPI_PARTITION_APP
#define WINAPI_FAMILY_DESKTOP_APP (WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_APP)
// Provide a default for WINAPI_FAMILY if needed.
#ifndef WINAPI_FAMILY
#define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP
#endif
// Macro to determine if a partition is enabled
#define WINAPI_FAMILY_PARTITION(Partition) ((WINAPI_FAMILY & Partition) == Partition)
// Macro to determine if only one partition is enabled from a set
#define WINAPI_FAMILY_ONE_PARTITION(PartitionSet, Partition) ((WINAPI_FAMILY & PartitionSet) == Partition)
#endif
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/native/corehost/ijwhost/amd64/bootstrap_thunk.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#ifndef IJW_BOOTSTRAP_THUNK_H
#define IJW_BOOTSTRAP_THUNK_H
#if !defined(TARGET_AMD64)
#error "This file should only be included on amd64 builds."
#endif
#include "pal.h"
#include "corhdr.h"
extern "C" void start_runtime_thunk_stub();
#include <pshpack1.h>
class bootstrap_thunk
{
private:
BYTE m_mov_r10[2];
BYTE m_val_r10[8];
BYTE m_mov_r11[2];
BYTE m_val_r11[8];
BYTE m_jmp_r11[3];
BYTE m_padding[1];
// Data for the thunk
std::uint32_t m_token;
pal::dll_t m_dll;
std::uintptr_t *m_slot;
public:
// Get thunk from the return address that the call instruction would have pushed
static bootstrap_thunk *get_thunk_from_cookie(std::uintptr_t cookie);
// Get thunk from the return address that the call instruction would have pushed
static bootstrap_thunk *get_thunk_from_entrypoint(std::uintptr_t entryAddr);
// Initializes the thunk to point to pThunkInitFcn that will load the
// runtime and perform the real thunk initialization.
void initialize(std::uintptr_t pThunkInitFcn,
pal::dll_t dll,
std::uint32_t token,
std::uintptr_t *pSlot);
// Returns the slot address of the vtable entry for this thunk
std::uintptr_t *get_slot_address();
// Returns the pal::dll_t for this thunk's module
pal::dll_t get_dll_handle();
// Returns the token of this thunk
std::uint32_t get_token();
std::uintptr_t get_entrypoint();
};
#include <poppack.h>
#endif
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#ifndef IJW_BOOTSTRAP_THUNK_H
#define IJW_BOOTSTRAP_THUNK_H
#if !defined(TARGET_AMD64)
#error "This file should only be included on amd64 builds."
#endif
#include "pal.h"
#include "corhdr.h"
extern "C" void start_runtime_thunk_stub();
#include <pshpack1.h>
class bootstrap_thunk
{
private:
BYTE m_mov_r10[2];
BYTE m_val_r10[8];
BYTE m_mov_r11[2];
BYTE m_val_r11[8];
BYTE m_jmp_r11[3];
BYTE m_padding[1];
// Data for the thunk
std::uint32_t m_token;
pal::dll_t m_dll;
std::uintptr_t *m_slot;
public:
// Get thunk from the return address that the call instruction would have pushed
static bootstrap_thunk *get_thunk_from_cookie(std::uintptr_t cookie);
// Get thunk from the return address that the call instruction would have pushed
static bootstrap_thunk *get_thunk_from_entrypoint(std::uintptr_t entryAddr);
// Initializes the thunk to point to pThunkInitFcn that will load the
// runtime and perform the real thunk initialization.
void initialize(std::uintptr_t pThunkInitFcn,
pal::dll_t dll,
std::uint32_t token,
std::uintptr_t *pSlot);
// Returns the slot address of the vtable entry for this thunk
std::uintptr_t *get_slot_address();
// Returns the pal::dll_t for this thunk's module
pal::dll_t get_dll_handle();
// Returns the token of this thunk
std::uint32_t get_token();
std::uintptr_t get_entrypoint();
};
#include <poppack.h>
#endif
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/tests/Common/hostpolicymock/CMakeLists.txt
|
project (hostpolicy)
include_directories(${INC_PLATFORM_DIR})
set(SOURCES HostpolicyMock.cpp )
add_library(hostpolicy SHARED ${SOURCES})
install(TARGETS hostpolicy DESTINATION bin)
|
project (hostpolicy)
include_directories(${INC_PLATFORM_DIR})
set(SOURCES HostpolicyMock.cpp )
add_library(hostpolicy SHARED ${SOURCES})
install(TARGETS hostpolicy DESTINATION bin)
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/coreclr/inc/gcinfotypes.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#ifndef __GCINFOTYPES_H__
#define __GCINFOTYPES_H__
#ifndef FEATURE_REDHAWK
#include "gcinfo.h"
#endif
// *****************************************************************************
// WARNING!!!: These values and code are also used by SOS in the diagnostics
// repo. Should updated in a backwards and forwards compatible way.
// See: https://github.com/dotnet/diagnostics/blob/master/src/inc/gcinfotypes.h
// *****************************************************************************
#define PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED
#define FIXED_STACK_PARAMETER_SCRATCH_AREA
#define BITS_PER_SIZE_T ((int)sizeof(size_t)*8)
//--------------------------------------------------------------------------------
// It turns out, that ((size_t)x) << y == x, when y is not a literal
// and its value is BITS_PER_SIZE_T
// I guess the processor only shifts of the right operand modulo BITS_PER_SIZE_T
// In many cases, we want the above operation to yield 0,
// hence the following macros
//--------------------------------------------------------------------------------
__forceinline size_t SAFE_SHIFT_LEFT(size_t x, size_t count)
{
_ASSERTE(count <= BITS_PER_SIZE_T);
return (x << 1) << (count - 1);
}
__forceinline size_t SAFE_SHIFT_RIGHT(size_t x, size_t count)
{
_ASSERTE(count <= BITS_PER_SIZE_T);
return (x >> 1) >> (count - 1);
}
inline UINT32 CeilOfLog2(size_t x)
{
_ASSERTE(x > 0);
UINT32 result = (x & (x - 1)) ? 1 : 0;
while (x != 1)
{
result++;
x >>= 1;
}
return result;
}
enum GcSlotFlags
{
GC_SLOT_BASE = 0x0,
GC_SLOT_INTERIOR = 0x1,
GC_SLOT_PINNED = 0x2,
GC_SLOT_UNTRACKED = 0x4,
// For internal use by the encoder/decoder
GC_SLOT_IS_REGISTER = 0x8,
GC_SLOT_IS_DELETED = 0x10,
};
enum GcStackSlotBase
{
GC_CALLER_SP_REL = 0x0,
GC_SP_REL = 0x1,
GC_FRAMEREG_REL = 0x2,
GC_SPBASE_FIRST = GC_CALLER_SP_REL,
GC_SPBASE_LAST = GC_FRAMEREG_REL,
};
#ifdef _DEBUG
const char* const GcStackSlotBaseNames[] =
{
"caller.sp",
"sp",
"frame",
};
#endif
enum GcSlotState
{
GC_SLOT_DEAD = 0x0,
GC_SLOT_LIVE = 0x1,
};
struct GcStackSlot
{
INT32 SpOffset;
GcStackSlotBase Base;
bool operator==(const GcStackSlot& other)
{
return ((SpOffset == other.SpOffset) && (Base == other.Base));
}
bool operator!=(const GcStackSlot& other)
{
return ((SpOffset != other.SpOffset) || (Base != other.Base));
}
};
//--------------------------------------------------------------------------------
// ReturnKind -- encoding return type information in GcInfo
//
// When a method is stopped at a call - site for GC (ex: via return-address
// hijacking) the runtime needs to know whether the value is a GC - value
// (gc - pointer or gc - pointers stored in an aggregate).
// It needs this information so that mark - phase can preserve the gc-pointers
// being returned.
//
// The Runtime doesn't need the precise return-type of a method.
// It only needs to find the GC-pointers in the return value.
// The only scenarios currently supported by CoreCLR are:
// 1. Object references
// 2. ByRef pointers
// 3. ARM64/X64 only : Structs returned in two registers
// 4. X86 only : Floating point returns to perform the correct save/restore
// of the return value around return-hijacking.
//
// Based on these cases, the legal set of ReturnKind enumerations are specified
// for each architecture/encoding.
// A value of this enumeration is stored in the GcInfo header.
//
//--------------------------------------------------------------------------------
// RT_Unset: An intermediate step for staged bringup.
// When ReturnKind is RT_Unset, it means that the JIT did not set
// the ReturnKind in the GCInfo, and therefore the VM cannot rely on it,
// and must use other mechanisms (similar to GcInfo ver 1) to determine
// the Return type's GC information.
//
// RT_Unset is only used in the following situations:
// X64: Used by JIT64 until updated to use GcInfo v2 API
// ARM: Used by JIT32 until updated to use GcInfo v2 API
//
// RT_Unset should have a valid encoding, whose bits are actually stored in the image.
// For X86, there are no free bits, and there's no RT_Unused enumeration.
#if defined(TARGET_X86)
// 00 RT_Scalar
// 01 RT_Object
// 10 RT_ByRef
// 11 RT_Float
#elif defined(TARGET_ARM)
// 00 RT_Scalar
// 01 RT_Object
// 10 RT_ByRef
// 11 RT_Unset
#elif defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64)
// Slim Header:
// 00 RT_Scalar
// 01 RT_Object
// 10 RT_ByRef
// 11 RT_Unset
// Fat Header:
// 0000 RT_Scalar
// 0001 RT_Object
// 0010 RT_ByRef
// 0011 RT_Unset
// 0100 RT_Scalar_Obj
// 1000 RT_Scalar_ByRef
// 0101 RT_Obj_Obj
// 1001 RT_Obj_ByRef
// 0110 RT_ByRef_Obj
// 1010 RT_ByRef_ByRef
#else
#ifdef PORTABILITY_WARNING
PORTABILITY_WARNING("Need ReturnKind for new Platform")
#endif // PORTABILITY_WARNING
#endif // Target checks
enum ReturnKind {
// Cases for Return in one register
RT_Scalar = 0,
RT_Object = 1,
RT_ByRef = 2,
#ifdef TARGET_X86
RT_Float = 3, // Encoding 3 means RT_Float on X86
#else
RT_Unset = 3, // RT_Unset on other platforms
#endif // TARGET_X86
// Cases for Struct Return in two registers
//
// We have the following equivalencies, because the VM's behavior is the same
// for both cases:
// RT_Scalar_Scalar == RT_Scalar
// RT_Obj_Scalar == RT_Object
// RT_ByRef_Scalar == RT_Byref
// The encoding for these equivalencies will play out well because
// RT_Scalar is zero.
//
// Naming: RT_firstReg_secondReg
// Encoding: <Two bits for secondRef> <Two bits for first Reg>
//
// This encoding with exclusive bits for each register is chosen for ease of use,
// and because it doesn't cost any more bits.
// It can be changed (ex: to a linear sequence) if necessary.
// For example, we can encode the GC-information for the two registers in 3 bits (instead of 4)
// if we approximate RT_Obj_ByRef and RT_ByRef_Obj as RT_ByRef_ByRef.
// RT_Scalar_Scalar = RT_Scalar
RT_Scalar_Obj = RT_Object << 2 | RT_Scalar,
RT_Scalar_ByRef = RT_ByRef << 2 | RT_Scalar,
// RT_Obj_Scalar = RT_Object
RT_Obj_Obj = RT_Object << 2 | RT_Object,
RT_Obj_ByRef = RT_ByRef << 2 | RT_Object,
// RT_ByRef_Scalar = RT_Byref
RT_ByRef_Obj = RT_Object << 2 | RT_ByRef,
RT_ByRef_ByRef = RT_ByRef << 2 | RT_ByRef,
// Illegal or uninitialized value,
// Not a valid encoding, never written to image.
RT_Illegal = 0xFF
};
// Identify ReturnKinds containing useful information
inline bool IsValidReturnKind(ReturnKind returnKind)
{
return (returnKind != RT_Illegal)
#ifndef TARGET_X86
&& (returnKind != RT_Unset)
#endif // TARGET_X86
;
}
// Identify ReturnKinds that can be a part of a multi-reg struct return
inline bool IsValidFieldReturnKind(ReturnKind returnKind)
{
return (returnKind == RT_Scalar || returnKind == RT_Object || returnKind == RT_ByRef);
}
inline bool IsPointerFieldReturnKind(ReturnKind returnKind)
{
_ASSERTE(IsValidFieldReturnKind(returnKind));
return (returnKind == RT_Object || returnKind == RT_ByRef);
}
inline bool IsValidReturnRegister(size_t regNo)
{
return (regNo == 0)
#ifdef FEATURE_MULTIREG_RETURN
|| (regNo == 1)
#endif // FEATURE_MULTIREG_RETURN
;
}
inline bool IsStructReturnKind(ReturnKind returnKind)
{
// Two bits encode integer/ref/float return-kinds.
// Encodings needing more than two bits are (non-scalar) struct-returns.
return returnKind > 3;
}
inline bool IsScalarReturnKind(ReturnKind returnKind)
{
return (returnKind == RT_Scalar)
#ifdef TARGET_X86
|| (returnKind == RT_Float)
#endif // TARGET_X86
;
}
inline bool IsPointerReturnKind(ReturnKind returnKind)
{
return IsValidReturnKind(returnKind) && !IsScalarReturnKind(returnKind);
}
// Helpers for combining/extracting individual ReturnKinds from/to Struct ReturnKinds.
// Encoding is two bits per register
inline ReturnKind GetStructReturnKind(ReturnKind reg0, ReturnKind reg1)
{
_ASSERTE(IsValidFieldReturnKind(reg0) && IsValidFieldReturnKind(reg1));
ReturnKind structReturnKind = (ReturnKind)(reg1 << 2 | reg0);
_ASSERTE(IsValidReturnKind(structReturnKind));
return structReturnKind;
}
// Extract returnKind for the specified return register.
// Also determines if higher ordinal return registers contain object references
inline ReturnKind ExtractRegReturnKind(ReturnKind returnKind, size_t returnRegOrdinal, bool& moreRegs)
{
_ASSERTE(IsValidReturnKind(returnKind));
_ASSERTE(IsValidReturnRegister(returnRegOrdinal));
// Return kind of each return register is encoded in two bits at returnRegOrdinal*2 position from LSB
ReturnKind regReturnKind = (ReturnKind)((returnKind >> (returnRegOrdinal * 2)) & 3);
// Check if any other higher ordinal return registers have object references.
// ReturnKind of higher ordinal return registers are encoded at (returnRegOrdinal+1)*2) position from LSB
// If all of the remaining bits are 0 then there isn't any more RT_Object or RT_ByRef encoded in returnKind.
moreRegs = (returnKind >> ((returnRegOrdinal+1) * 2)) != 0;
_ASSERTE(IsValidReturnKind(regReturnKind));
_ASSERTE((returnRegOrdinal == 0) || IsValidFieldReturnKind(regReturnKind));
return regReturnKind;
}
inline const char *ReturnKindToString(ReturnKind returnKind)
{
switch (returnKind) {
case RT_Scalar: return "Scalar";
case RT_Object: return "Object";
case RT_ByRef: return "ByRef";
#ifdef TARGET_X86
case RT_Float: return "Float";
#else
case RT_Unset: return "UNSET";
#endif // TARGET_X86
case RT_Scalar_Obj: return "{Scalar, Object}";
case RT_Scalar_ByRef: return "{Scalar, ByRef}";
case RT_Obj_Obj: return "{Object, Object}";
case RT_Obj_ByRef: return "{Object, ByRef}";
case RT_ByRef_Obj: return "{ByRef, Object}";
case RT_ByRef_ByRef: return "{ByRef, ByRef}";
case RT_Illegal: return "<Illegal>";
default: return "!Impossible!";
}
}
#ifdef TARGET_X86
#include <stdlib.h> // For memcmp()
#include "bitvector.h" // for ptrArgTP
#ifndef FASTCALL
#define FASTCALL __fastcall
#endif
// we use offsetof to get the offset of a field
#include <stddef.h> // offsetof
enum infoHdrAdjustConstants {
// Constants
SET_FRAMESIZE_MAX = 7,
SET_ARGCOUNT_MAX = 8, // Change to 6
SET_PROLOGSIZE_MAX = 16,
SET_EPILOGSIZE_MAX = 10, // Change to 6
SET_EPILOGCNT_MAX = 4,
SET_UNTRACKED_MAX = 3,
SET_RET_KIND_MAX = 4, // 2 bits for ReturnKind
ADJ_ENCODING_MAX = 0x7f, // Maximum valid encoding in a byte
// Also used to mask off next bit from each encoding byte.
MORE_BYTES_TO_FOLLOW = 0x80 // If the High-bit of a header or adjustment byte
// is set, then there are more adjustments to follow.
};
//
// Enum to define codes that are used to incrementally adjust the InfoHdr structure.
// First set of opcodes
enum infoHdrAdjust {
SET_FRAMESIZE = 0, // 0x00
SET_ARGCOUNT = SET_FRAMESIZE + SET_FRAMESIZE_MAX + 1, // 0x08
SET_PROLOGSIZE = SET_ARGCOUNT + SET_ARGCOUNT_MAX + 1, // 0x11
SET_EPILOGSIZE = SET_PROLOGSIZE + SET_PROLOGSIZE_MAX + 1, // 0x22
SET_EPILOGCNT = SET_EPILOGSIZE + SET_EPILOGSIZE_MAX + 1, // 0x2d
SET_UNTRACKED = SET_EPILOGCNT + (SET_EPILOGCNT_MAX + 1) * 2, // 0x37
FIRST_FLIP = SET_UNTRACKED + SET_UNTRACKED_MAX + 1,
FLIP_EDI_SAVED = FIRST_FLIP, // 0x3b
FLIP_ESI_SAVED, // 0x3c
FLIP_EBX_SAVED, // 0x3d
FLIP_EBP_SAVED, // 0x3e
FLIP_EBP_FRAME, // 0x3f
FLIP_INTERRUPTIBLE, // 0x40
FLIP_DOUBLE_ALIGN, // 0x41
FLIP_SECURITY, // 0x42
FLIP_HANDLERS, // 0x43
FLIP_LOCALLOC, // 0x44
FLIP_EDITnCONTINUE, // 0x45
FLIP_VAR_PTR_TABLE_SZ, // 0x46 Flip whether a table-size exits after the header encoding
FFFF_UNTRACKED_CNT, // 0x47 There is a count (>SET_UNTRACKED_MAX) after the header encoding
FLIP_VARARGS, // 0x48
FLIP_PROF_CALLBACKS, // 0x49
FLIP_HAS_GS_COOKIE, // 0x4A - The offset of the GuardStack cookie follows after the header encoding
FLIP_SYNC, // 0x4B
FLIP_HAS_GENERICS_CONTEXT,// 0x4C
FLIP_GENERICS_CONTEXT_IS_METHODDESC,// 0x4D
FLIP_REV_PINVOKE_FRAME, // 0x4E
NEXT_OPCODE, // 0x4F -- see next Adjustment enumeration
NEXT_FOUR_START = 0x50,
NEXT_FOUR_FRAMESIZE = 0x50,
NEXT_FOUR_ARGCOUNT = 0x60,
NEXT_THREE_PROLOGSIZE = 0x70,
NEXT_THREE_EPILOGSIZE = 0x78
};
// Second set of opcodes, when first code is 0x4F
enum infoHdrAdjust2 {
SET_RETURNKIND = 0, // 0x00-SET_RET_KIND_MAX Set ReturnKind to value
};
#define HAS_UNTRACKED ((unsigned int) -1)
#define HAS_VARPTR ((unsigned int) -1)
// 0 is a valid offset for the Reverse P/Invoke block
// So use -1 as the sentinel for invalid and -2 as the sentinel for present.
#define INVALID_REV_PINVOKE_OFFSET ((unsigned int) -1)
#define HAS_REV_PINVOKE_FRAME_OFFSET ((unsigned int) -2)
// 0 is not a valid offset for EBP-frames as all locals are at a negative offset
// For ESP frames, the cookie is above (at a higher address than) the buffers,
// and so cannot be at offset 0.
#define INVALID_GS_COOKIE_OFFSET 0
// Temporary value to indicate that the offset needs to be read after the header
#define HAS_GS_COOKIE_OFFSET ((unsigned int) -1)
// 0 is not a valid sync offset
#define INVALID_SYNC_OFFSET 0
// Temporary value to indicate that the offset needs to be read after the header
#define HAS_SYNC_OFFSET ((unsigned int) -1)
#define INVALID_ARGTAB_OFFSET 0
#include <pshpack1.h>
// Working set optimization: saving 12 * 128 = 1536 bytes in infoHdrShortcut
struct InfoHdr;
struct InfoHdrSmall {
unsigned char prologSize; // 0
unsigned char epilogSize; // 1
unsigned char epilogCount : 3; // 2 [0:2]
unsigned char epilogAtEnd : 1; // 2 [3]
unsigned char ediSaved : 1; // 2 [4] which callee-saved regs are pushed onto stack
unsigned char esiSaved : 1; // 2 [5]
unsigned char ebxSaved : 1; // 2 [6]
unsigned char ebpSaved : 1; // 2 [7]
unsigned char ebpFrame : 1; // 3 [0] locals accessed relative to ebp
unsigned char interruptible : 1; // 3 [1] is intr. at all points (except prolog/epilog), not just call-sites
unsigned char doubleAlign : 1; // 3 [2] uses double-aligned stack (ebpFrame will be false)
unsigned char security : 1; // 3 [3] has slot for security object
unsigned char handlers : 1; // 3 [4] has callable handlers
unsigned char localloc : 1; // 3 [5] uses localloc
unsigned char editNcontinue : 1; // 3 [6] was JITed in EnC mode
unsigned char varargs : 1; // 3 [7] function uses varargs calling convention
unsigned char profCallbacks : 1; // 4 [0]
unsigned char genericsContext : 1;//4 [1] function reports a generics context parameter is present
unsigned char genericsContextIsMethodDesc : 1;//4[2]
unsigned char returnKind : 2; // 4 [4] Available GcInfo v2 onwards, previously undefined
unsigned short argCount; // 5,6 in bytes
unsigned int frameSize; // 7,8,9,10 in bytes
unsigned int untrackedCnt; // 11,12,13,14
unsigned int varPtrTableSize; // 15.16,17,18
// Checks whether "this" is compatible with "target".
// It is not an exact bit match as "this" could have some
// marker/place-holder values, which will have to be written out
// after the header.
bool isHeaderMatch(const InfoHdr& target) const;
};
struct InfoHdr : public InfoHdrSmall {
// 0 (zero) means that there is no GuardStack cookie
// The cookie is either at ESP+gsCookieOffset or EBP-gsCookieOffset
unsigned int gsCookieOffset; // 19,20,21,22
unsigned int syncStartOffset; // 23,24,25,26
unsigned int syncEndOffset; // 27,28,29,30
unsigned int revPInvokeOffset; // 31,32,33,34 Available GcInfo v2 onwards, previously undefined
// 35 bytes total
// Checks whether "this" is compatible with "target".
// It is not an exact bit match as "this" could have some
// marker/place-holder values, which will have to be written out
// after the header.
bool isHeaderMatch(const InfoHdr& target) const
{
#ifdef _ASSERTE
// target cannot have place-holder values.
_ASSERTE(target.untrackedCnt != HAS_UNTRACKED &&
target.varPtrTableSize != HAS_VARPTR &&
target.gsCookieOffset != HAS_GS_COOKIE_OFFSET &&
target.syncStartOffset != HAS_SYNC_OFFSET &&
target.revPInvokeOffset != HAS_REV_PINVOKE_FRAME_OFFSET);
#endif
// compare two InfoHdr's up to but not including the untrackCnt field
if (memcmp(this, &target, offsetof(InfoHdr, untrackedCnt)) != 0)
return false;
if (untrackedCnt != target.untrackedCnt) {
if (target.untrackedCnt <= SET_UNTRACKED_MAX)
return false;
else if (untrackedCnt != HAS_UNTRACKED)
return false;
}
if (varPtrTableSize != target.varPtrTableSize) {
if ((varPtrTableSize != 0) != (target.varPtrTableSize != 0))
return false;
}
if ((gsCookieOffset == INVALID_GS_COOKIE_OFFSET) !=
(target.gsCookieOffset == INVALID_GS_COOKIE_OFFSET))
return false;
if ((syncStartOffset == INVALID_SYNC_OFFSET) !=
(target.syncStartOffset == INVALID_SYNC_OFFSET))
return false;
if ((revPInvokeOffset == INVALID_REV_PINVOKE_OFFSET) !=
(target.revPInvokeOffset == INVALID_REV_PINVOKE_OFFSET))
return false;
return true;
}
};
union CallPattern {
struct {
unsigned char argCnt;
unsigned char regMask; // EBP=0x8, EBX=0x4, ESI=0x2, EDI=0x1
unsigned char argMask;
unsigned char codeDelta;
} fld;
unsigned val;
};
#include <poppack.h>
#define IH_MAX_PROLOG_SIZE (51)
extern const InfoHdrSmall infoHdrShortcut[];
extern int infoHdrLookup[];
inline void GetInfoHdr(int index, InfoHdr * header)
{
*((InfoHdrSmall *)header) = infoHdrShortcut[index];
header->gsCookieOffset = INVALID_GS_COOKIE_OFFSET;
header->syncStartOffset = INVALID_SYNC_OFFSET;
header->syncEndOffset = INVALID_SYNC_OFFSET;
header->revPInvokeOffset = INVALID_REV_PINVOKE_OFFSET;
}
PTR_CBYTE FASTCALL decodeHeader(PTR_CBYTE table, UINT32 version, InfoHdr* header);
BYTE FASTCALL encodeHeaderFirst(const InfoHdr& header, InfoHdr* state, int* more, int *pCached);
BYTE FASTCALL encodeHeaderNext(const InfoHdr& header, InfoHdr* state, BYTE &codeSet);
size_t FASTCALL decodeUnsigned(PTR_CBYTE src, unsigned* value);
size_t FASTCALL decodeUDelta(PTR_CBYTE src, unsigned* value, unsigned lastValue);
size_t FASTCALL decodeSigned(PTR_CBYTE src, int * value);
#define CP_MAX_CODE_DELTA (0x23)
#define CP_MAX_ARG_CNT (0x02)
#define CP_MAX_ARG_MASK (0x00)
extern const unsigned callPatternTable[];
extern const unsigned callCommonDelta[];
int FASTCALL lookupCallPattern(unsigned argCnt,
unsigned regMask,
unsigned argMask,
unsigned codeDelta);
void FASTCALL decodeCallPattern(int pattern,
unsigned * argCnt,
unsigned * regMask,
unsigned * argMask,
unsigned * codeDelta);
#endif // _TARGET_86_
// Stack offsets must be 8-byte aligned, so we use this unaligned
// offset to represent that the method doesn't have a security object
#define NO_SECURITY_OBJECT (-1)
#define NO_GS_COOKIE (-1)
#define NO_STACK_BASE_REGISTER (0xffffffff)
#define NO_SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA (0xffffffff)
#define NO_GENERICS_INST_CONTEXT (-1)
#define NO_REVERSE_PINVOKE_FRAME (-1)
#define NO_PSP_SYM (-1)
#if defined(TARGET_AMD64)
#ifndef TARGET_POINTER_SIZE
#define TARGET_POINTER_SIZE 8 // equal to sizeof(void*) and the managed pointer size in bytes for this target
#endif
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64)
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6)
#define NORMALIZE_STACK_SLOT(x) ((x)>>3)
#define DENORMALIZE_STACK_SLOT(x) ((x)<<3)
#define NORMALIZE_CODE_LENGTH(x) (x)
#define DENORMALIZE_CODE_LENGTH(x) (x)
// Encode RBP as 0
#define NORMALIZE_STACK_BASE_REGISTER(x) ((x) ^ 5)
#define DENORMALIZE_STACK_BASE_REGISTER(x) ((x) ^ 5)
#define NORMALIZE_SIZE_OF_STACK_AREA(x) ((x)>>3)
#define DENORMALIZE_SIZE_OF_STACK_AREA(x) ((x)<<3)
#define CODE_OFFSETS_NEED_NORMALIZATION 0
#define NORMALIZE_CODE_OFFSET(x) (x)
#define DENORMALIZE_CODE_OFFSET(x) (x)
#define NORMALIZE_REGISTER(x) (x)
#define DENORMALIZE_REGISTER(x) (x)
#define NORMALIZE_NUM_SAFE_POINTS(x) (x)
#define DENORMALIZE_NUM_SAFE_POINTS(x) (x)
#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define PSP_SYM_STACK_SLOT_ENCBASE 6
#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 6
#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 6
#define GS_COOKIE_STACK_SLOT_ENCBASE 6
#define CODE_LENGTH_ENCBASE 8
#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2
#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 4
#define STACK_BASE_REGISTER_ENCBASE 3
#define SIZE_OF_STACK_AREA_ENCBASE 3
#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 4
#define REVERSE_PINVOKE_FRAME_ENCBASE 6
#define NUM_REGISTERS_ENCBASE 2
#define NUM_STACK_SLOTS_ENCBASE 2
#define NUM_UNTRACKED_SLOTS_ENCBASE 1
#define NORM_PROLOG_SIZE_ENCBASE 5
#define NORM_EPILOG_SIZE_ENCBASE 3
#define NORM_CODE_OFFSET_DELTA_ENCBASE 3
#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 6
#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 6
#define REGISTER_ENCBASE 3
#define REGISTER_DELTA_ENCBASE 2
#define STACK_SLOT_ENCBASE 6
#define STACK_SLOT_DELTA_ENCBASE 4
#define NUM_SAFE_POINTS_ENCBASE 2
#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 1
#define NUM_EH_CLAUSES_ENCBASE 2
#define POINTER_SIZE_ENCBASE 3
#define LIVESTATE_RLE_RUN_ENCBASE 2
#define LIVESTATE_RLE_SKIP_ENCBASE 4
#elif defined(TARGET_ARM)
#ifndef TARGET_POINTER_SIZE
#define TARGET_POINTER_SIZE 4 // equal to sizeof(void*) and the managed pointer size in bytes for this target
#endif
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64)
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6)
#define NORMALIZE_STACK_SLOT(x) ((x)>>2)
#define DENORMALIZE_STACK_SLOT(x) ((x)<<2)
#define NORMALIZE_CODE_LENGTH(x) ((x)>>1)
#define DENORMALIZE_CODE_LENGTH(x) ((x)<<1)
// Encode R11 as zero
#define NORMALIZE_STACK_BASE_REGISTER(x) ((((x) - 4) & 7) ^ 7)
#define DENORMALIZE_STACK_BASE_REGISTER(x) (((x) ^ 7) + 4)
#define NORMALIZE_SIZE_OF_STACK_AREA(x) ((x)>>2)
#define DENORMALIZE_SIZE_OF_STACK_AREA(x) ((x)<<2)
#define CODE_OFFSETS_NEED_NORMALIZATION 1
#define NORMALIZE_CODE_OFFSET(x) (x) // Instructions are 2/4 bytes long in Thumb/ARM states,
#define DENORMALIZE_CODE_OFFSET(x) (x) // but the safe-point offsets are encoded with a -1 adjustment.
#define NORMALIZE_REGISTER(x) (x)
#define DENORMALIZE_REGISTER(x) (x)
#define NORMALIZE_NUM_SAFE_POINTS(x) (x)
#define DENORMALIZE_NUM_SAFE_POINTS(x) (x)
#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
// The choices of these encoding bases only affects space overhead
// and performance, not semantics/correctness.
#define PSP_SYM_STACK_SLOT_ENCBASE 5
#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 5
#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 5
#define GS_COOKIE_STACK_SLOT_ENCBASE 5
#define CODE_LENGTH_ENCBASE 7
#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2
#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 2
#define STACK_BASE_REGISTER_ENCBASE 1
#define SIZE_OF_STACK_AREA_ENCBASE 3
#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 3
#define REVERSE_PINVOKE_FRAME_ENCBASE 5
#define NUM_REGISTERS_ENCBASE 2
#define NUM_STACK_SLOTS_ENCBASE 3
#define NUM_UNTRACKED_SLOTS_ENCBASE 3
#define NORM_PROLOG_SIZE_ENCBASE 5
#define NORM_EPILOG_SIZE_ENCBASE 3
#define NORM_CODE_OFFSET_DELTA_ENCBASE 3
#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 4
#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 6
#define REGISTER_ENCBASE 2
#define REGISTER_DELTA_ENCBASE 1
#define STACK_SLOT_ENCBASE 6
#define STACK_SLOT_DELTA_ENCBASE 4
#define NUM_SAFE_POINTS_ENCBASE 3
#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 2
#define NUM_EH_CLAUSES_ENCBASE 3
#define POINTER_SIZE_ENCBASE 3
#define LIVESTATE_RLE_RUN_ENCBASE 2
#define LIVESTATE_RLE_SKIP_ENCBASE 4
#elif defined(TARGET_ARM64)
#ifndef TARGET_POINTER_SIZE
#define TARGET_POINTER_SIZE 8 // equal to sizeof(void*) and the managed pointer size in bytes for this target
#endif
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64)
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6)
#define NORMALIZE_STACK_SLOT(x) ((x)>>3) // GC Pointers are 8-bytes aligned
#define DENORMALIZE_STACK_SLOT(x) ((x)<<3)
#define NORMALIZE_CODE_LENGTH(x) ((x)>>2) // All Instructions are 4 bytes long
#define DENORMALIZE_CODE_LENGTH(x) ((x)<<2)
#define NORMALIZE_STACK_BASE_REGISTER(x) ((x)^29) // Encode Frame pointer X29 as zero
#define DENORMALIZE_STACK_BASE_REGISTER(x) ((x)^29)
#define NORMALIZE_SIZE_OF_STACK_AREA(x) ((x)>>3)
#define DENORMALIZE_SIZE_OF_STACK_AREA(x) ((x)<<3)
#define CODE_OFFSETS_NEED_NORMALIZATION 0
#define NORMALIZE_CODE_OFFSET(x) (x) // Instructions are 4 bytes long, but the safe-point
#define DENORMALIZE_CODE_OFFSET(x) (x) // offsets are encoded with a -1 adjustment.
#define NORMALIZE_REGISTER(x) (x)
#define DENORMALIZE_REGISTER(x) (x)
#define NORMALIZE_NUM_SAFE_POINTS(x) (x)
#define DENORMALIZE_NUM_SAFE_POINTS(x) (x)
#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define PSP_SYM_STACK_SLOT_ENCBASE 6
#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 6
#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 6
#define GS_COOKIE_STACK_SLOT_ENCBASE 6
#define CODE_LENGTH_ENCBASE 8
#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2
#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 4
#define STACK_BASE_REGISTER_ENCBASE 2 // FP encoded as 0, SP as 2.
#define SIZE_OF_STACK_AREA_ENCBASE 3
#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 4
#define REVERSE_PINVOKE_FRAME_ENCBASE 6
#define NUM_REGISTERS_ENCBASE 3
#define NUM_STACK_SLOTS_ENCBASE 2
#define NUM_UNTRACKED_SLOTS_ENCBASE 1
#define NORM_PROLOG_SIZE_ENCBASE 5
#define NORM_EPILOG_SIZE_ENCBASE 3
#define NORM_CODE_OFFSET_DELTA_ENCBASE 3
#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 6
#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 6
#define REGISTER_ENCBASE 3
#define REGISTER_DELTA_ENCBASE 2
#define STACK_SLOT_ENCBASE 6
#define STACK_SLOT_DELTA_ENCBASE 4
#define NUM_SAFE_POINTS_ENCBASE 3
#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 1
#define NUM_EH_CLAUSES_ENCBASE 2
#define POINTER_SIZE_ENCBASE 3
#define LIVESTATE_RLE_RUN_ENCBASE 2
#define LIVESTATE_RLE_SKIP_ENCBASE 4
#elif defined(TARGET_LOONGARCH64)
#ifndef TARGET_POINTER_SIZE
#define TARGET_POINTER_SIZE 8 // equal to sizeof(void*) and the managed pointer size in bytes for this target
#endif
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64)
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6)
#define NORMALIZE_STACK_SLOT(x) ((x)>>3) // GC Pointers are 8-bytes aligned
#define DENORMALIZE_STACK_SLOT(x) ((x)<<3)
#define NORMALIZE_CODE_LENGTH(x) ((x)>>2) // All Instructions are 4 bytes long
#define DENORMALIZE_CODE_LENGTH(x) ((x)<<2)
#define NORMALIZE_STACK_BASE_REGISTER(x) ((x)^22) // Encode Frame pointer fp=$22 as zero
#define DENORMALIZE_STACK_BASE_REGISTER(x) ((x)^22)
#define NORMALIZE_SIZE_OF_STACK_AREA(x) ((x)>>3)
#define DENORMALIZE_SIZE_OF_STACK_AREA(x) ((x)<<3)
#define CODE_OFFSETS_NEED_NORMALIZATION 0
#define NORMALIZE_CODE_OFFSET(x) (x) // Instructions are 4 bytes long, but the safe-point
#define DENORMALIZE_CODE_OFFSET(x) (x) // offsets are encoded with a -1 adjustment.
#define NORMALIZE_REGISTER(x) (x)
#define DENORMALIZE_REGISTER(x) (x)
#define NORMALIZE_NUM_SAFE_POINTS(x) (x)
#define DENORMALIZE_NUM_SAFE_POINTS(x) (x)
#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define PSP_SYM_STACK_SLOT_ENCBASE 6
#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 6
#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 6
#define GS_COOKIE_STACK_SLOT_ENCBASE 6
#define CODE_LENGTH_ENCBASE 8
#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2
#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 4
////TODO for LOONGARCH64.
// FP/SP encoded as 0 or 2 ??
#define STACK_BASE_REGISTER_ENCBASE 2
#define SIZE_OF_STACK_AREA_ENCBASE 3
#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 4
#define REVERSE_PINVOKE_FRAME_ENCBASE 6
#define NUM_REGISTERS_ENCBASE 3
#define NUM_STACK_SLOTS_ENCBASE 2
#define NUM_UNTRACKED_SLOTS_ENCBASE 1
#define NORM_PROLOG_SIZE_ENCBASE 5
#define NORM_EPILOG_SIZE_ENCBASE 3
#define NORM_CODE_OFFSET_DELTA_ENCBASE 3
#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 6
#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 6
#define REGISTER_ENCBASE 3
#define REGISTER_DELTA_ENCBASE 2
#define STACK_SLOT_ENCBASE 6
#define STACK_SLOT_DELTA_ENCBASE 4
#define NUM_SAFE_POINTS_ENCBASE 3
#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 1
#define NUM_EH_CLAUSES_ENCBASE 2
#define POINTER_SIZE_ENCBASE 3
#define LIVESTATE_RLE_RUN_ENCBASE 2
#define LIVESTATE_RLE_SKIP_ENCBASE 4
#else
#ifndef TARGET_X86
#ifdef PORTABILITY_WARNING
PORTABILITY_WARNING("Please specialize these definitions for your platform!")
#endif
#endif
#ifndef TARGET_POINTER_SIZE
#define TARGET_POINTER_SIZE 4 // equal to sizeof(void*) and the managed pointer size in bytes for this target
#endif
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64)
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6)
#define NORMALIZE_STACK_SLOT(x) (x)
#define DENORMALIZE_STACK_SLOT(x) (x)
#define NORMALIZE_CODE_LENGTH(x) (x)
#define DENORMALIZE_CODE_LENGTH(x) (x)
#define NORMALIZE_STACK_BASE_REGISTER(x) (x)
#define DENORMALIZE_STACK_BASE_REGISTER(x) (x)
#define NORMALIZE_SIZE_OF_STACK_AREA(x) (x)
#define DENORMALIZE_SIZE_OF_STACK_AREA(x) (x)
#define CODE_OFFSETS_NEED_NORMALIZATION 0
#define NORMALIZE_CODE_OFFSET(x) (x)
#define DENORMALIZE_CODE_OFFSET(x) (x)
#define NORMALIZE_REGISTER(x) (x)
#define DENORMALIZE_REGISTER(x) (x)
#define NORMALIZE_NUM_SAFE_POINTS(x) (x)
#define DENORMALIZE_NUM_SAFE_POINTS(x) (x)
#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define PSP_SYM_STACK_SLOT_ENCBASE 6
#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 6
#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 6
#define GS_COOKIE_STACK_SLOT_ENCBASE 6
#define CODE_LENGTH_ENCBASE 6
#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2
#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 2
#define STACK_BASE_REGISTER_ENCBASE 3
#define SIZE_OF_STACK_AREA_ENCBASE 6
#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 3
#define REVERSE_PINVOKE_FRAME_ENCBASE 6
#define NUM_REGISTERS_ENCBASE 3
#define NUM_STACK_SLOTS_ENCBASE 5
#define NUM_UNTRACKED_SLOTS_ENCBASE 5
#define NORM_PROLOG_SIZE_ENCBASE 4
#define NORM_EPILOG_SIZE_ENCBASE 3
#define NORM_CODE_OFFSET_DELTA_ENCBASE 3
#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 5
#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 5
#define REGISTER_ENCBASE 3
#define REGISTER_DELTA_ENCBASE REGISTER_ENCBASE
#define STACK_SLOT_ENCBASE 6
#define STACK_SLOT_DELTA_ENCBASE 4
#define NUM_SAFE_POINTS_ENCBASE 4
#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 1
#define NUM_EH_CLAUSES_ENCBASE 2
#define POINTER_SIZE_ENCBASE 3
#define LIVESTATE_RLE_RUN_ENCBASE 2
#define LIVESTATE_RLE_SKIP_ENCBASE 4
#endif
#endif // !__GCINFOTYPES_H__
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#ifndef __GCINFOTYPES_H__
#define __GCINFOTYPES_H__
#ifndef FEATURE_REDHAWK
#include "gcinfo.h"
#endif
// *****************************************************************************
// WARNING!!!: These values and code are also used by SOS in the diagnostics
// repo. Should updated in a backwards and forwards compatible way.
// See: https://github.com/dotnet/diagnostics/blob/master/src/inc/gcinfotypes.h
// *****************************************************************************
#define PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED
#define FIXED_STACK_PARAMETER_SCRATCH_AREA
#define BITS_PER_SIZE_T ((int)sizeof(size_t)*8)
//--------------------------------------------------------------------------------
// It turns out, that ((size_t)x) << y == x, when y is not a literal
// and its value is BITS_PER_SIZE_T
// I guess the processor only shifts of the right operand modulo BITS_PER_SIZE_T
// In many cases, we want the above operation to yield 0,
// hence the following macros
//--------------------------------------------------------------------------------
__forceinline size_t SAFE_SHIFT_LEFT(size_t x, size_t count)
{
_ASSERTE(count <= BITS_PER_SIZE_T);
return (x << 1) << (count - 1);
}
__forceinline size_t SAFE_SHIFT_RIGHT(size_t x, size_t count)
{
_ASSERTE(count <= BITS_PER_SIZE_T);
return (x >> 1) >> (count - 1);
}
inline UINT32 CeilOfLog2(size_t x)
{
_ASSERTE(x > 0);
UINT32 result = (x & (x - 1)) ? 1 : 0;
while (x != 1)
{
result++;
x >>= 1;
}
return result;
}
enum GcSlotFlags
{
GC_SLOT_BASE = 0x0,
GC_SLOT_INTERIOR = 0x1,
GC_SLOT_PINNED = 0x2,
GC_SLOT_UNTRACKED = 0x4,
// For internal use by the encoder/decoder
GC_SLOT_IS_REGISTER = 0x8,
GC_SLOT_IS_DELETED = 0x10,
};
enum GcStackSlotBase
{
GC_CALLER_SP_REL = 0x0,
GC_SP_REL = 0x1,
GC_FRAMEREG_REL = 0x2,
GC_SPBASE_FIRST = GC_CALLER_SP_REL,
GC_SPBASE_LAST = GC_FRAMEREG_REL,
};
#ifdef _DEBUG
const char* const GcStackSlotBaseNames[] =
{
"caller.sp",
"sp",
"frame",
};
#endif
enum GcSlotState
{
GC_SLOT_DEAD = 0x0,
GC_SLOT_LIVE = 0x1,
};
struct GcStackSlot
{
INT32 SpOffset;
GcStackSlotBase Base;
bool operator==(const GcStackSlot& other)
{
return ((SpOffset == other.SpOffset) && (Base == other.Base));
}
bool operator!=(const GcStackSlot& other)
{
return ((SpOffset != other.SpOffset) || (Base != other.Base));
}
};
//--------------------------------------------------------------------------------
// ReturnKind -- encoding return type information in GcInfo
//
// When a method is stopped at a call - site for GC (ex: via return-address
// hijacking) the runtime needs to know whether the value is a GC - value
// (gc - pointer or gc - pointers stored in an aggregate).
// It needs this information so that mark - phase can preserve the gc-pointers
// being returned.
//
// The Runtime doesn't need the precise return-type of a method.
// It only needs to find the GC-pointers in the return value.
// The only scenarios currently supported by CoreCLR are:
// 1. Object references
// 2. ByRef pointers
// 3. ARM64/X64 only : Structs returned in two registers
// 4. X86 only : Floating point returns to perform the correct save/restore
// of the return value around return-hijacking.
//
// Based on these cases, the legal set of ReturnKind enumerations are specified
// for each architecture/encoding.
// A value of this enumeration is stored in the GcInfo header.
//
//--------------------------------------------------------------------------------
// RT_Unset: An intermediate step for staged bringup.
// When ReturnKind is RT_Unset, it means that the JIT did not set
// the ReturnKind in the GCInfo, and therefore the VM cannot rely on it,
// and must use other mechanisms (similar to GcInfo ver 1) to determine
// the Return type's GC information.
//
// RT_Unset is only used in the following situations:
// X64: Used by JIT64 until updated to use GcInfo v2 API
// ARM: Used by JIT32 until updated to use GcInfo v2 API
//
// RT_Unset should have a valid encoding, whose bits are actually stored in the image.
// For X86, there are no free bits, and there's no RT_Unused enumeration.
#if defined(TARGET_X86)
// 00 RT_Scalar
// 01 RT_Object
// 10 RT_ByRef
// 11 RT_Float
#elif defined(TARGET_ARM)
// 00 RT_Scalar
// 01 RT_Object
// 10 RT_ByRef
// 11 RT_Unset
#elif defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64)
// Slim Header:
// 00 RT_Scalar
// 01 RT_Object
// 10 RT_ByRef
// 11 RT_Unset
// Fat Header:
// 0000 RT_Scalar
// 0001 RT_Object
// 0010 RT_ByRef
// 0011 RT_Unset
// 0100 RT_Scalar_Obj
// 1000 RT_Scalar_ByRef
// 0101 RT_Obj_Obj
// 1001 RT_Obj_ByRef
// 0110 RT_ByRef_Obj
// 1010 RT_ByRef_ByRef
#else
#ifdef PORTABILITY_WARNING
PORTABILITY_WARNING("Need ReturnKind for new Platform")
#endif // PORTABILITY_WARNING
#endif // Target checks
enum ReturnKind {
// Cases for Return in one register
RT_Scalar = 0,
RT_Object = 1,
RT_ByRef = 2,
#ifdef TARGET_X86
RT_Float = 3, // Encoding 3 means RT_Float on X86
#else
RT_Unset = 3, // RT_Unset on other platforms
#endif // TARGET_X86
// Cases for Struct Return in two registers
//
// We have the following equivalencies, because the VM's behavior is the same
// for both cases:
// RT_Scalar_Scalar == RT_Scalar
// RT_Obj_Scalar == RT_Object
// RT_ByRef_Scalar == RT_Byref
// The encoding for these equivalencies will play out well because
// RT_Scalar is zero.
//
// Naming: RT_firstReg_secondReg
// Encoding: <Two bits for secondRef> <Two bits for first Reg>
//
// This encoding with exclusive bits for each register is chosen for ease of use,
// and because it doesn't cost any more bits.
// It can be changed (ex: to a linear sequence) if necessary.
// For example, we can encode the GC-information for the two registers in 3 bits (instead of 4)
// if we approximate RT_Obj_ByRef and RT_ByRef_Obj as RT_ByRef_ByRef.
// RT_Scalar_Scalar = RT_Scalar
RT_Scalar_Obj = RT_Object << 2 | RT_Scalar,
RT_Scalar_ByRef = RT_ByRef << 2 | RT_Scalar,
// RT_Obj_Scalar = RT_Object
RT_Obj_Obj = RT_Object << 2 | RT_Object,
RT_Obj_ByRef = RT_ByRef << 2 | RT_Object,
// RT_ByRef_Scalar = RT_Byref
RT_ByRef_Obj = RT_Object << 2 | RT_ByRef,
RT_ByRef_ByRef = RT_ByRef << 2 | RT_ByRef,
// Illegal or uninitialized value,
// Not a valid encoding, never written to image.
RT_Illegal = 0xFF
};
// Identify ReturnKinds containing useful information
inline bool IsValidReturnKind(ReturnKind returnKind)
{
return (returnKind != RT_Illegal)
#ifndef TARGET_X86
&& (returnKind != RT_Unset)
#endif // TARGET_X86
;
}
// Identify ReturnKinds that can be a part of a multi-reg struct return
inline bool IsValidFieldReturnKind(ReturnKind returnKind)
{
return (returnKind == RT_Scalar || returnKind == RT_Object || returnKind == RT_ByRef);
}
inline bool IsPointerFieldReturnKind(ReturnKind returnKind)
{
_ASSERTE(IsValidFieldReturnKind(returnKind));
return (returnKind == RT_Object || returnKind == RT_ByRef);
}
inline bool IsValidReturnRegister(size_t regNo)
{
return (regNo == 0)
#ifdef FEATURE_MULTIREG_RETURN
|| (regNo == 1)
#endif // FEATURE_MULTIREG_RETURN
;
}
inline bool IsStructReturnKind(ReturnKind returnKind)
{
// Two bits encode integer/ref/float return-kinds.
// Encodings needing more than two bits are (non-scalar) struct-returns.
return returnKind > 3;
}
inline bool IsScalarReturnKind(ReturnKind returnKind)
{
return (returnKind == RT_Scalar)
#ifdef TARGET_X86
|| (returnKind == RT_Float)
#endif // TARGET_X86
;
}
inline bool IsPointerReturnKind(ReturnKind returnKind)
{
return IsValidReturnKind(returnKind) && !IsScalarReturnKind(returnKind);
}
// Helpers for combining/extracting individual ReturnKinds from/to Struct ReturnKinds.
// Encoding is two bits per register
inline ReturnKind GetStructReturnKind(ReturnKind reg0, ReturnKind reg1)
{
_ASSERTE(IsValidFieldReturnKind(reg0) && IsValidFieldReturnKind(reg1));
ReturnKind structReturnKind = (ReturnKind)(reg1 << 2 | reg0);
_ASSERTE(IsValidReturnKind(structReturnKind));
return structReturnKind;
}
// Extract returnKind for the specified return register.
// Also determines if higher ordinal return registers contain object references
inline ReturnKind ExtractRegReturnKind(ReturnKind returnKind, size_t returnRegOrdinal, bool& moreRegs)
{
_ASSERTE(IsValidReturnKind(returnKind));
_ASSERTE(IsValidReturnRegister(returnRegOrdinal));
// Return kind of each return register is encoded in two bits at returnRegOrdinal*2 position from LSB
ReturnKind regReturnKind = (ReturnKind)((returnKind >> (returnRegOrdinal * 2)) & 3);
// Check if any other higher ordinal return registers have object references.
// ReturnKind of higher ordinal return registers are encoded at (returnRegOrdinal+1)*2) position from LSB
// If all of the remaining bits are 0 then there isn't any more RT_Object or RT_ByRef encoded in returnKind.
moreRegs = (returnKind >> ((returnRegOrdinal+1) * 2)) != 0;
_ASSERTE(IsValidReturnKind(regReturnKind));
_ASSERTE((returnRegOrdinal == 0) || IsValidFieldReturnKind(regReturnKind));
return regReturnKind;
}
inline const char *ReturnKindToString(ReturnKind returnKind)
{
switch (returnKind) {
case RT_Scalar: return "Scalar";
case RT_Object: return "Object";
case RT_ByRef: return "ByRef";
#ifdef TARGET_X86
case RT_Float: return "Float";
#else
case RT_Unset: return "UNSET";
#endif // TARGET_X86
case RT_Scalar_Obj: return "{Scalar, Object}";
case RT_Scalar_ByRef: return "{Scalar, ByRef}";
case RT_Obj_Obj: return "{Object, Object}";
case RT_Obj_ByRef: return "{Object, ByRef}";
case RT_ByRef_Obj: return "{ByRef, Object}";
case RT_ByRef_ByRef: return "{ByRef, ByRef}";
case RT_Illegal: return "<Illegal>";
default: return "!Impossible!";
}
}
#ifdef TARGET_X86
#include <stdlib.h> // For memcmp()
#include "bitvector.h" // for ptrArgTP
#ifndef FASTCALL
#define FASTCALL __fastcall
#endif
// we use offsetof to get the offset of a field
#include <stddef.h> // offsetof
enum infoHdrAdjustConstants {
// Constants
SET_FRAMESIZE_MAX = 7,
SET_ARGCOUNT_MAX = 8, // Change to 6
SET_PROLOGSIZE_MAX = 16,
SET_EPILOGSIZE_MAX = 10, // Change to 6
SET_EPILOGCNT_MAX = 4,
SET_UNTRACKED_MAX = 3,
SET_RET_KIND_MAX = 4, // 2 bits for ReturnKind
ADJ_ENCODING_MAX = 0x7f, // Maximum valid encoding in a byte
// Also used to mask off next bit from each encoding byte.
MORE_BYTES_TO_FOLLOW = 0x80 // If the High-bit of a header or adjustment byte
// is set, then there are more adjustments to follow.
};
//
// Enum to define codes that are used to incrementally adjust the InfoHdr structure.
// First set of opcodes
enum infoHdrAdjust {
SET_FRAMESIZE = 0, // 0x00
SET_ARGCOUNT = SET_FRAMESIZE + SET_FRAMESIZE_MAX + 1, // 0x08
SET_PROLOGSIZE = SET_ARGCOUNT + SET_ARGCOUNT_MAX + 1, // 0x11
SET_EPILOGSIZE = SET_PROLOGSIZE + SET_PROLOGSIZE_MAX + 1, // 0x22
SET_EPILOGCNT = SET_EPILOGSIZE + SET_EPILOGSIZE_MAX + 1, // 0x2d
SET_UNTRACKED = SET_EPILOGCNT + (SET_EPILOGCNT_MAX + 1) * 2, // 0x37
FIRST_FLIP = SET_UNTRACKED + SET_UNTRACKED_MAX + 1,
FLIP_EDI_SAVED = FIRST_FLIP, // 0x3b
FLIP_ESI_SAVED, // 0x3c
FLIP_EBX_SAVED, // 0x3d
FLIP_EBP_SAVED, // 0x3e
FLIP_EBP_FRAME, // 0x3f
FLIP_INTERRUPTIBLE, // 0x40
FLIP_DOUBLE_ALIGN, // 0x41
FLIP_SECURITY, // 0x42
FLIP_HANDLERS, // 0x43
FLIP_LOCALLOC, // 0x44
FLIP_EDITnCONTINUE, // 0x45
FLIP_VAR_PTR_TABLE_SZ, // 0x46 Flip whether a table-size exits after the header encoding
FFFF_UNTRACKED_CNT, // 0x47 There is a count (>SET_UNTRACKED_MAX) after the header encoding
FLIP_VARARGS, // 0x48
FLIP_PROF_CALLBACKS, // 0x49
FLIP_HAS_GS_COOKIE, // 0x4A - The offset of the GuardStack cookie follows after the header encoding
FLIP_SYNC, // 0x4B
FLIP_HAS_GENERICS_CONTEXT,// 0x4C
FLIP_GENERICS_CONTEXT_IS_METHODDESC,// 0x4D
FLIP_REV_PINVOKE_FRAME, // 0x4E
NEXT_OPCODE, // 0x4F -- see next Adjustment enumeration
NEXT_FOUR_START = 0x50,
NEXT_FOUR_FRAMESIZE = 0x50,
NEXT_FOUR_ARGCOUNT = 0x60,
NEXT_THREE_PROLOGSIZE = 0x70,
NEXT_THREE_EPILOGSIZE = 0x78
};
// Second set of opcodes, when first code is 0x4F
enum infoHdrAdjust2 {
SET_RETURNKIND = 0, // 0x00-SET_RET_KIND_MAX Set ReturnKind to value
};
#define HAS_UNTRACKED ((unsigned int) -1)
#define HAS_VARPTR ((unsigned int) -1)
// 0 is a valid offset for the Reverse P/Invoke block
// So use -1 as the sentinel for invalid and -2 as the sentinel for present.
#define INVALID_REV_PINVOKE_OFFSET ((unsigned int) -1)
#define HAS_REV_PINVOKE_FRAME_OFFSET ((unsigned int) -2)
// 0 is not a valid offset for EBP-frames as all locals are at a negative offset
// For ESP frames, the cookie is above (at a higher address than) the buffers,
// and so cannot be at offset 0.
#define INVALID_GS_COOKIE_OFFSET 0
// Temporary value to indicate that the offset needs to be read after the header
#define HAS_GS_COOKIE_OFFSET ((unsigned int) -1)
// 0 is not a valid sync offset
#define INVALID_SYNC_OFFSET 0
// Temporary value to indicate that the offset needs to be read after the header
#define HAS_SYNC_OFFSET ((unsigned int) -1)
#define INVALID_ARGTAB_OFFSET 0
#include <pshpack1.h>
// Working set optimization: saving 12 * 128 = 1536 bytes in infoHdrShortcut
struct InfoHdr;
struct InfoHdrSmall {
unsigned char prologSize; // 0
unsigned char epilogSize; // 1
unsigned char epilogCount : 3; // 2 [0:2]
unsigned char epilogAtEnd : 1; // 2 [3]
unsigned char ediSaved : 1; // 2 [4] which callee-saved regs are pushed onto stack
unsigned char esiSaved : 1; // 2 [5]
unsigned char ebxSaved : 1; // 2 [6]
unsigned char ebpSaved : 1; // 2 [7]
unsigned char ebpFrame : 1; // 3 [0] locals accessed relative to ebp
unsigned char interruptible : 1; // 3 [1] is intr. at all points (except prolog/epilog), not just call-sites
unsigned char doubleAlign : 1; // 3 [2] uses double-aligned stack (ebpFrame will be false)
unsigned char security : 1; // 3 [3] has slot for security object
unsigned char handlers : 1; // 3 [4] has callable handlers
unsigned char localloc : 1; // 3 [5] uses localloc
unsigned char editNcontinue : 1; // 3 [6] was JITed in EnC mode
unsigned char varargs : 1; // 3 [7] function uses varargs calling convention
unsigned char profCallbacks : 1; // 4 [0]
unsigned char genericsContext : 1;//4 [1] function reports a generics context parameter is present
unsigned char genericsContextIsMethodDesc : 1;//4[2]
unsigned char returnKind : 2; // 4 [4] Available GcInfo v2 onwards, previously undefined
unsigned short argCount; // 5,6 in bytes
unsigned int frameSize; // 7,8,9,10 in bytes
unsigned int untrackedCnt; // 11,12,13,14
unsigned int varPtrTableSize; // 15.16,17,18
// Checks whether "this" is compatible with "target".
// It is not an exact bit match as "this" could have some
// marker/place-holder values, which will have to be written out
// after the header.
bool isHeaderMatch(const InfoHdr& target) const;
};
struct InfoHdr : public InfoHdrSmall {
// 0 (zero) means that there is no GuardStack cookie
// The cookie is either at ESP+gsCookieOffset or EBP-gsCookieOffset
unsigned int gsCookieOffset; // 19,20,21,22
unsigned int syncStartOffset; // 23,24,25,26
unsigned int syncEndOffset; // 27,28,29,30
unsigned int revPInvokeOffset; // 31,32,33,34 Available GcInfo v2 onwards, previously undefined
// 35 bytes total
// Checks whether "this" is compatible with "target".
// It is not an exact bit match as "this" could have some
// marker/place-holder values, which will have to be written out
// after the header.
bool isHeaderMatch(const InfoHdr& target) const
{
#ifdef _ASSERTE
// target cannot have place-holder values.
_ASSERTE(target.untrackedCnt != HAS_UNTRACKED &&
target.varPtrTableSize != HAS_VARPTR &&
target.gsCookieOffset != HAS_GS_COOKIE_OFFSET &&
target.syncStartOffset != HAS_SYNC_OFFSET &&
target.revPInvokeOffset != HAS_REV_PINVOKE_FRAME_OFFSET);
#endif
// compare two InfoHdr's up to but not including the untrackCnt field
if (memcmp(this, &target, offsetof(InfoHdr, untrackedCnt)) != 0)
return false;
if (untrackedCnt != target.untrackedCnt) {
if (target.untrackedCnt <= SET_UNTRACKED_MAX)
return false;
else if (untrackedCnt != HAS_UNTRACKED)
return false;
}
if (varPtrTableSize != target.varPtrTableSize) {
if ((varPtrTableSize != 0) != (target.varPtrTableSize != 0))
return false;
}
if ((gsCookieOffset == INVALID_GS_COOKIE_OFFSET) !=
(target.gsCookieOffset == INVALID_GS_COOKIE_OFFSET))
return false;
if ((syncStartOffset == INVALID_SYNC_OFFSET) !=
(target.syncStartOffset == INVALID_SYNC_OFFSET))
return false;
if ((revPInvokeOffset == INVALID_REV_PINVOKE_OFFSET) !=
(target.revPInvokeOffset == INVALID_REV_PINVOKE_OFFSET))
return false;
return true;
}
};
union CallPattern {
struct {
unsigned char argCnt;
unsigned char regMask; // EBP=0x8, EBX=0x4, ESI=0x2, EDI=0x1
unsigned char argMask;
unsigned char codeDelta;
} fld;
unsigned val;
};
#include <poppack.h>
#define IH_MAX_PROLOG_SIZE (51)
extern const InfoHdrSmall infoHdrShortcut[];
extern int infoHdrLookup[];
inline void GetInfoHdr(int index, InfoHdr * header)
{
*((InfoHdrSmall *)header) = infoHdrShortcut[index];
header->gsCookieOffset = INVALID_GS_COOKIE_OFFSET;
header->syncStartOffset = INVALID_SYNC_OFFSET;
header->syncEndOffset = INVALID_SYNC_OFFSET;
header->revPInvokeOffset = INVALID_REV_PINVOKE_OFFSET;
}
PTR_CBYTE FASTCALL decodeHeader(PTR_CBYTE table, UINT32 version, InfoHdr* header);
BYTE FASTCALL encodeHeaderFirst(const InfoHdr& header, InfoHdr* state, int* more, int *pCached);
BYTE FASTCALL encodeHeaderNext(const InfoHdr& header, InfoHdr* state, BYTE &codeSet);
size_t FASTCALL decodeUnsigned(PTR_CBYTE src, unsigned* value);
size_t FASTCALL decodeUDelta(PTR_CBYTE src, unsigned* value, unsigned lastValue);
size_t FASTCALL decodeSigned(PTR_CBYTE src, int * value);
#define CP_MAX_CODE_DELTA (0x23)
#define CP_MAX_ARG_CNT (0x02)
#define CP_MAX_ARG_MASK (0x00)
extern const unsigned callPatternTable[];
extern const unsigned callCommonDelta[];
int FASTCALL lookupCallPattern(unsigned argCnt,
unsigned regMask,
unsigned argMask,
unsigned codeDelta);
void FASTCALL decodeCallPattern(int pattern,
unsigned * argCnt,
unsigned * regMask,
unsigned * argMask,
unsigned * codeDelta);
#endif // _TARGET_86_
// Stack offsets must be 8-byte aligned, so we use this unaligned
// offset to represent that the method doesn't have a security object
#define NO_SECURITY_OBJECT (-1)
#define NO_GS_COOKIE (-1)
#define NO_STACK_BASE_REGISTER (0xffffffff)
#define NO_SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA (0xffffffff)
#define NO_GENERICS_INST_CONTEXT (-1)
#define NO_REVERSE_PINVOKE_FRAME (-1)
#define NO_PSP_SYM (-1)
#if defined(TARGET_AMD64)
#ifndef TARGET_POINTER_SIZE
#define TARGET_POINTER_SIZE 8 // equal to sizeof(void*) and the managed pointer size in bytes for this target
#endif
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64)
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6)
#define NORMALIZE_STACK_SLOT(x) ((x)>>3)
#define DENORMALIZE_STACK_SLOT(x) ((x)<<3)
#define NORMALIZE_CODE_LENGTH(x) (x)
#define DENORMALIZE_CODE_LENGTH(x) (x)
// Encode RBP as 0
#define NORMALIZE_STACK_BASE_REGISTER(x) ((x) ^ 5)
#define DENORMALIZE_STACK_BASE_REGISTER(x) ((x) ^ 5)
#define NORMALIZE_SIZE_OF_STACK_AREA(x) ((x)>>3)
#define DENORMALIZE_SIZE_OF_STACK_AREA(x) ((x)<<3)
#define CODE_OFFSETS_NEED_NORMALIZATION 0
#define NORMALIZE_CODE_OFFSET(x) (x)
#define DENORMALIZE_CODE_OFFSET(x) (x)
#define NORMALIZE_REGISTER(x) (x)
#define DENORMALIZE_REGISTER(x) (x)
#define NORMALIZE_NUM_SAFE_POINTS(x) (x)
#define DENORMALIZE_NUM_SAFE_POINTS(x) (x)
#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define PSP_SYM_STACK_SLOT_ENCBASE 6
#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 6
#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 6
#define GS_COOKIE_STACK_SLOT_ENCBASE 6
#define CODE_LENGTH_ENCBASE 8
#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2
#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 4
#define STACK_BASE_REGISTER_ENCBASE 3
#define SIZE_OF_STACK_AREA_ENCBASE 3
#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 4
#define REVERSE_PINVOKE_FRAME_ENCBASE 6
#define NUM_REGISTERS_ENCBASE 2
#define NUM_STACK_SLOTS_ENCBASE 2
#define NUM_UNTRACKED_SLOTS_ENCBASE 1
#define NORM_PROLOG_SIZE_ENCBASE 5
#define NORM_EPILOG_SIZE_ENCBASE 3
#define NORM_CODE_OFFSET_DELTA_ENCBASE 3
#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 6
#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 6
#define REGISTER_ENCBASE 3
#define REGISTER_DELTA_ENCBASE 2
#define STACK_SLOT_ENCBASE 6
#define STACK_SLOT_DELTA_ENCBASE 4
#define NUM_SAFE_POINTS_ENCBASE 2
#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 1
#define NUM_EH_CLAUSES_ENCBASE 2
#define POINTER_SIZE_ENCBASE 3
#define LIVESTATE_RLE_RUN_ENCBASE 2
#define LIVESTATE_RLE_SKIP_ENCBASE 4
#elif defined(TARGET_ARM)
#ifndef TARGET_POINTER_SIZE
#define TARGET_POINTER_SIZE 4 // equal to sizeof(void*) and the managed pointer size in bytes for this target
#endif
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64)
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6)
#define NORMALIZE_STACK_SLOT(x) ((x)>>2)
#define DENORMALIZE_STACK_SLOT(x) ((x)<<2)
#define NORMALIZE_CODE_LENGTH(x) ((x)>>1)
#define DENORMALIZE_CODE_LENGTH(x) ((x)<<1)
// Encode R11 as zero
#define NORMALIZE_STACK_BASE_REGISTER(x) ((((x) - 4) & 7) ^ 7)
#define DENORMALIZE_STACK_BASE_REGISTER(x) (((x) ^ 7) + 4)
#define NORMALIZE_SIZE_OF_STACK_AREA(x) ((x)>>2)
#define DENORMALIZE_SIZE_OF_STACK_AREA(x) ((x)<<2)
#define CODE_OFFSETS_NEED_NORMALIZATION 1
#define NORMALIZE_CODE_OFFSET(x) (x) // Instructions are 2/4 bytes long in Thumb/ARM states,
#define DENORMALIZE_CODE_OFFSET(x) (x) // but the safe-point offsets are encoded with a -1 adjustment.
#define NORMALIZE_REGISTER(x) (x)
#define DENORMALIZE_REGISTER(x) (x)
#define NORMALIZE_NUM_SAFE_POINTS(x) (x)
#define DENORMALIZE_NUM_SAFE_POINTS(x) (x)
#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
// The choices of these encoding bases only affects space overhead
// and performance, not semantics/correctness.
#define PSP_SYM_STACK_SLOT_ENCBASE 5
#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 5
#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 5
#define GS_COOKIE_STACK_SLOT_ENCBASE 5
#define CODE_LENGTH_ENCBASE 7
#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2
#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 2
#define STACK_BASE_REGISTER_ENCBASE 1
#define SIZE_OF_STACK_AREA_ENCBASE 3
#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 3
#define REVERSE_PINVOKE_FRAME_ENCBASE 5
#define NUM_REGISTERS_ENCBASE 2
#define NUM_STACK_SLOTS_ENCBASE 3
#define NUM_UNTRACKED_SLOTS_ENCBASE 3
#define NORM_PROLOG_SIZE_ENCBASE 5
#define NORM_EPILOG_SIZE_ENCBASE 3
#define NORM_CODE_OFFSET_DELTA_ENCBASE 3
#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 4
#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 6
#define REGISTER_ENCBASE 2
#define REGISTER_DELTA_ENCBASE 1
#define STACK_SLOT_ENCBASE 6
#define STACK_SLOT_DELTA_ENCBASE 4
#define NUM_SAFE_POINTS_ENCBASE 3
#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 2
#define NUM_EH_CLAUSES_ENCBASE 3
#define POINTER_SIZE_ENCBASE 3
#define LIVESTATE_RLE_RUN_ENCBASE 2
#define LIVESTATE_RLE_SKIP_ENCBASE 4
#elif defined(TARGET_ARM64)
#ifndef TARGET_POINTER_SIZE
#define TARGET_POINTER_SIZE 8 // equal to sizeof(void*) and the managed pointer size in bytes for this target
#endif
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64)
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6)
#define NORMALIZE_STACK_SLOT(x) ((x)>>3) // GC Pointers are 8-bytes aligned
#define DENORMALIZE_STACK_SLOT(x) ((x)<<3)
#define NORMALIZE_CODE_LENGTH(x) ((x)>>2) // All Instructions are 4 bytes long
#define DENORMALIZE_CODE_LENGTH(x) ((x)<<2)
#define NORMALIZE_STACK_BASE_REGISTER(x) ((x)^29) // Encode Frame pointer X29 as zero
#define DENORMALIZE_STACK_BASE_REGISTER(x) ((x)^29)
#define NORMALIZE_SIZE_OF_STACK_AREA(x) ((x)>>3)
#define DENORMALIZE_SIZE_OF_STACK_AREA(x) ((x)<<3)
#define CODE_OFFSETS_NEED_NORMALIZATION 0
#define NORMALIZE_CODE_OFFSET(x) (x) // Instructions are 4 bytes long, but the safe-point
#define DENORMALIZE_CODE_OFFSET(x) (x) // offsets are encoded with a -1 adjustment.
#define NORMALIZE_REGISTER(x) (x)
#define DENORMALIZE_REGISTER(x) (x)
#define NORMALIZE_NUM_SAFE_POINTS(x) (x)
#define DENORMALIZE_NUM_SAFE_POINTS(x) (x)
#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define PSP_SYM_STACK_SLOT_ENCBASE 6
#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 6
#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 6
#define GS_COOKIE_STACK_SLOT_ENCBASE 6
#define CODE_LENGTH_ENCBASE 8
#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2
#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 4
#define STACK_BASE_REGISTER_ENCBASE 2 // FP encoded as 0, SP as 2.
#define SIZE_OF_STACK_AREA_ENCBASE 3
#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 4
#define REVERSE_PINVOKE_FRAME_ENCBASE 6
#define NUM_REGISTERS_ENCBASE 3
#define NUM_STACK_SLOTS_ENCBASE 2
#define NUM_UNTRACKED_SLOTS_ENCBASE 1
#define NORM_PROLOG_SIZE_ENCBASE 5
#define NORM_EPILOG_SIZE_ENCBASE 3
#define NORM_CODE_OFFSET_DELTA_ENCBASE 3
#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 6
#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 6
#define REGISTER_ENCBASE 3
#define REGISTER_DELTA_ENCBASE 2
#define STACK_SLOT_ENCBASE 6
#define STACK_SLOT_DELTA_ENCBASE 4
#define NUM_SAFE_POINTS_ENCBASE 3
#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 1
#define NUM_EH_CLAUSES_ENCBASE 2
#define POINTER_SIZE_ENCBASE 3
#define LIVESTATE_RLE_RUN_ENCBASE 2
#define LIVESTATE_RLE_SKIP_ENCBASE 4
#elif defined(TARGET_LOONGARCH64)
#ifndef TARGET_POINTER_SIZE
#define TARGET_POINTER_SIZE 8 // equal to sizeof(void*) and the managed pointer size in bytes for this target
#endif
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64)
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6)
#define NORMALIZE_STACK_SLOT(x) ((x)>>3) // GC Pointers are 8-bytes aligned
#define DENORMALIZE_STACK_SLOT(x) ((x)<<3)
#define NORMALIZE_CODE_LENGTH(x) ((x)>>2) // All Instructions are 4 bytes long
#define DENORMALIZE_CODE_LENGTH(x) ((x)<<2)
#define NORMALIZE_STACK_BASE_REGISTER(x) ((x)^22) // Encode Frame pointer fp=$22 as zero
#define DENORMALIZE_STACK_BASE_REGISTER(x) ((x)^22)
#define NORMALIZE_SIZE_OF_STACK_AREA(x) ((x)>>3)
#define DENORMALIZE_SIZE_OF_STACK_AREA(x) ((x)<<3)
#define CODE_OFFSETS_NEED_NORMALIZATION 0
#define NORMALIZE_CODE_OFFSET(x) (x) // Instructions are 4 bytes long, but the safe-point
#define DENORMALIZE_CODE_OFFSET(x) (x) // offsets are encoded with a -1 adjustment.
#define NORMALIZE_REGISTER(x) (x)
#define DENORMALIZE_REGISTER(x) (x)
#define NORMALIZE_NUM_SAFE_POINTS(x) (x)
#define DENORMALIZE_NUM_SAFE_POINTS(x) (x)
#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define PSP_SYM_STACK_SLOT_ENCBASE 6
#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 6
#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 6
#define GS_COOKIE_STACK_SLOT_ENCBASE 6
#define CODE_LENGTH_ENCBASE 8
#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2
#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 4
////TODO for LOONGARCH64.
// FP/SP encoded as 0 or 2 ??
#define STACK_BASE_REGISTER_ENCBASE 2
#define SIZE_OF_STACK_AREA_ENCBASE 3
#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 4
#define REVERSE_PINVOKE_FRAME_ENCBASE 6
#define NUM_REGISTERS_ENCBASE 3
#define NUM_STACK_SLOTS_ENCBASE 2
#define NUM_UNTRACKED_SLOTS_ENCBASE 1
#define NORM_PROLOG_SIZE_ENCBASE 5
#define NORM_EPILOG_SIZE_ENCBASE 3
#define NORM_CODE_OFFSET_DELTA_ENCBASE 3
#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 6
#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 6
#define REGISTER_ENCBASE 3
#define REGISTER_DELTA_ENCBASE 2
#define STACK_SLOT_ENCBASE 6
#define STACK_SLOT_DELTA_ENCBASE 4
#define NUM_SAFE_POINTS_ENCBASE 3
#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 1
#define NUM_EH_CLAUSES_ENCBASE 2
#define POINTER_SIZE_ENCBASE 3
#define LIVESTATE_RLE_RUN_ENCBASE 2
#define LIVESTATE_RLE_SKIP_ENCBASE 4
#else
#ifndef TARGET_X86
#ifdef PORTABILITY_WARNING
PORTABILITY_WARNING("Please specialize these definitions for your platform!")
#endif
#endif
#ifndef TARGET_POINTER_SIZE
#define TARGET_POINTER_SIZE 4 // equal to sizeof(void*) and the managed pointer size in bytes for this target
#endif
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64)
#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6)
#define NORMALIZE_STACK_SLOT(x) (x)
#define DENORMALIZE_STACK_SLOT(x) (x)
#define NORMALIZE_CODE_LENGTH(x) (x)
#define DENORMALIZE_CODE_LENGTH(x) (x)
#define NORMALIZE_STACK_BASE_REGISTER(x) (x)
#define DENORMALIZE_STACK_BASE_REGISTER(x) (x)
#define NORMALIZE_SIZE_OF_STACK_AREA(x) (x)
#define DENORMALIZE_SIZE_OF_STACK_AREA(x) (x)
#define CODE_OFFSETS_NEED_NORMALIZATION 0
#define NORMALIZE_CODE_OFFSET(x) (x)
#define DENORMALIZE_CODE_OFFSET(x) (x)
#define NORMALIZE_REGISTER(x) (x)
#define DENORMALIZE_REGISTER(x) (x)
#define NORMALIZE_NUM_SAFE_POINTS(x) (x)
#define DENORMALIZE_NUM_SAFE_POINTS(x) (x)
#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
#define PSP_SYM_STACK_SLOT_ENCBASE 6
#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 6
#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 6
#define GS_COOKIE_STACK_SLOT_ENCBASE 6
#define CODE_LENGTH_ENCBASE 6
#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2
#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 2
#define STACK_BASE_REGISTER_ENCBASE 3
#define SIZE_OF_STACK_AREA_ENCBASE 6
#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 3
#define REVERSE_PINVOKE_FRAME_ENCBASE 6
#define NUM_REGISTERS_ENCBASE 3
#define NUM_STACK_SLOTS_ENCBASE 5
#define NUM_UNTRACKED_SLOTS_ENCBASE 5
#define NORM_PROLOG_SIZE_ENCBASE 4
#define NORM_EPILOG_SIZE_ENCBASE 3
#define NORM_CODE_OFFSET_DELTA_ENCBASE 3
#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 5
#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 5
#define REGISTER_ENCBASE 3
#define REGISTER_DELTA_ENCBASE REGISTER_ENCBASE
#define STACK_SLOT_ENCBASE 6
#define STACK_SLOT_DELTA_ENCBASE 4
#define NUM_SAFE_POINTS_ENCBASE 4
#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 1
#define NUM_EH_CLAUSES_ENCBASE 2
#define POINTER_SIZE_ENCBASE 3
#define LIVESTATE_RLE_RUN_ENCBASE 2
#define LIVESTATE_RLE_SKIP_ENCBASE 4
#endif
#endif // !__GCINFOTYPES_H__
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/native/libs/System.Security.Cryptography.Native.Android/pal_x509store.c
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#include "pal_x509store.h"
#include "pal_eckey.h"
#include "pal_misc.h"
#include "pal_rsa.h"
#include <assert.h>
#include <stdbool.h>
#include <string.h>
typedef enum
{
EntryFlags_None = 0,
EntryFlags_HasCertificate = 1,
EntryFlags_HasPrivateKey = 2,
EntryFlags_MatchesCertificate = 4,
} EntryFlags;
// Returns whether or not the store contains the specified alias
// If the entry exists, the flags parameter is set based on the contents of the entry
ARGS_NON_NULL_ALL static bool ContainsEntryForAlias(
JNIEnv* env, jobject /*KeyStore*/ store, jobject /*X509Certificate*/ cert, jstring alias, EntryFlags* flags)
{
bool ret = false;
EntryFlags flagsLocal = EntryFlags_None;
INIT_LOCALS(loc, entry, existingCert);
bool containsAlias = (*env)->CallBooleanMethod(env, store, g_KeyStoreContainsAlias, alias);
if (!containsAlias)
goto cleanup;
ret = true;
// KeyStore.Entry entry = store.getEntry(alias, null);
// if (entry instanceof KeyStore.PrivateKeyEntry) {
// existingCert = ((KeyStore.PrivateKeyEntry)entry).getCertificate();
// } else if (entry instanceof KeyStore.TrustedCertificateEntry) {
// existingCert = ((KeyStore.TrustedCertificateEntry)entry).getTrustedCertificate();
// }
loc[entry] = (*env)->CallObjectMethod(env, store, g_KeyStoreGetEntry, alias, NULL);
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
if ((*env)->IsInstanceOf(env, loc[entry], g_PrivateKeyEntryClass))
{
// Private key entries always have a certificate
flagsLocal |= EntryFlags_HasCertificate;
flagsLocal |= EntryFlags_HasPrivateKey;
loc[existingCert] = (*env)->CallObjectMethod(env, loc[entry], g_PrivateKeyEntryGetCertificate);
}
else if ((*env)->IsInstanceOf(env, loc[entry], g_TrustedCertificateEntryClass))
{
flagsLocal |= EntryFlags_HasCertificate;
loc[existingCert] = (*env)->CallObjectMethod(env, loc[entry], g_TrustedCertificateEntryGetTrustedCertificate);
}
else
{
// Entry for alias exists, but doesn't represent a certificate or private key + certificate
goto cleanup;
}
assert(loc[existingCert] != NULL);
if ((*env)->CallBooleanMethod(env, cert, g_X509CertEquals, loc[existingCert]))
{
flagsLocal |= EntryFlags_MatchesCertificate;
}
cleanup:
RELEASE_LOCALS(loc, env);
*flags = flagsLocal;
return ret;
}
ARGS_NON_NULL_ALL
static bool ContainsMatchingCertificateForAlias(JNIEnv* env,
jobject /*KeyStore*/ store,
jobject /*X509Certificate*/ cert,
jstring alias)
{
EntryFlags flags;
if (!ContainsEntryForAlias(env, store, cert, alias, &flags))
return false;
EntryFlags matchesFlags = EntryFlags_HasCertificate & EntryFlags_MatchesCertificate;
return (flags & matchesFlags) == matchesFlags;
}
int32_t AndroidCryptoNative_X509StoreAddCertificate(jobject /*KeyStore*/ store,
jobject /*X509Certificate*/ cert,
const char* hashString)
{
abort_if_invalid_pointer_argument (store);
abort_if_invalid_pointer_argument (cert);
abort_if_invalid_pointer_argument (hashString);
JNIEnv* env = GetJNIEnv();
jstring alias = make_java_string(env, hashString);
EntryFlags flags;
if (ContainsEntryForAlias(env, store, cert, alias, &flags))
{
ReleaseLRef(env, alias);
EntryFlags matchesFlags = EntryFlags_HasCertificate & EntryFlags_MatchesCertificate;
if ((flags & matchesFlags) != matchesFlags)
{
LOG_ERROR("Store already contains alias with entry that does not match the expected certificate");
return FAIL;
}
// Certificate is already in store - nothing to do
LOG_DEBUG("Store already contains certificate");
return SUCCESS;
}
// store.setCertificateEntry(alias, cert);
(*env)->CallVoidMethod(env, store, g_KeyStoreSetCertificateEntry, alias, cert);
(*env)->DeleteLocalRef(env, alias);
return CheckJNIExceptions(env) ? FAIL : SUCCESS;
}
int32_t AndroidCryptoNative_X509StoreAddCertificateWithPrivateKey(jobject /*KeyStore*/ store,
jobject /*X509Certificate*/ cert,
void* key,
PAL_KeyAlgorithm algorithm,
const char* hashString)
{
abort_if_invalid_pointer_argument (store);
abort_if_invalid_pointer_argument (cert);
abort_if_invalid_pointer_argument (key);
abort_if_invalid_pointer_argument (hashString);
int32_t ret = FAIL;
JNIEnv* env = GetJNIEnv();
INIT_LOCALS(loc, alias, certs);
jobject privateKey = NULL;
loc[alias] = make_java_string(env, hashString);
EntryFlags flags;
if (ContainsEntryForAlias(env, store, cert, loc[alias], &flags))
{
EntryFlags matchesFlags = EntryFlags_HasCertificate & EntryFlags_MatchesCertificate;
if ((flags & matchesFlags) != matchesFlags)
{
RELEASE_LOCALS(loc, env);
LOG_ERROR("Store already contains alias with entry that does not match the expected certificate");
return FAIL;
}
if ((flags & EntryFlags_HasPrivateKey) == EntryFlags_HasPrivateKey)
{
RELEASE_LOCALS(loc, env);
// Certificate with private key is already in store - nothing to do
LOG_DEBUG("Store already contains certificate with private key");
return SUCCESS;
}
// Delete existing entry. We will replace the existing cert with the cert + private key.
// store.deleteEntry(alias);
(*env)->CallVoidMethod(env, store, g_KeyStoreDeleteEntry, loc[alias]);
}
bool releasePrivateKey = true;
switch (algorithm)
{
case PAL_EC:
{
EC_KEY* ec = (EC_KEY*)key;
privateKey = (*env)->CallObjectMethod(env, ec->keyPair, g_keyPairGetPrivateMethod);
break;
}
case PAL_DSA:
{
// key is a KeyPair jobject
privateKey = (*env)->CallObjectMethod(env, key, g_keyPairGetPrivateMethod);
break;
}
case PAL_RSA:
{
RSA* rsa = (RSA*)key;
privateKey = rsa->privateKey;
releasePrivateKey = false; // Private key is a global ref stored directly on RSA handle
break;
}
default:
{
releasePrivateKey = false;
LOG_ERROR("Unknown algorithm for private key");
goto cleanup;
}
}
// X509Certificate[] certs = new X509Certificate[] { cert };
// store.setKeyEntry(alias, privateKey, null, certs);
loc[certs] = make_java_object_array(env, 1, g_X509CertClass, cert);
(*env)->CallVoidMethod(env, store, g_KeyStoreSetKeyEntry, loc[alias], privateKey, NULL, loc[certs]);
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
ret = SUCCESS;
cleanup:
RELEASE_LOCALS(loc, env);
if (releasePrivateKey)
{
(*env)->DeleteLocalRef(env, privateKey);
}
return ret;
}
bool AndroidCryptoNative_X509StoreContainsCertificate(jobject /*KeyStore*/ store,
jobject /*X509Certificate*/ cert,
const char* hashString)
{
abort_if_invalid_pointer_argument (store);
abort_if_invalid_pointer_argument (cert);
abort_if_invalid_pointer_argument (hashString);
JNIEnv* env = GetJNIEnv();
jstring alias = make_java_string(env, hashString);
bool containsCert = ContainsMatchingCertificateForAlias(env, store, cert, alias);
(*env)->DeleteLocalRef(env, alias);
return containsCert;
}
ARGS_NON_NULL_ALL
static void* HandleFromKeys(JNIEnv* env,
jobject /*PublicKey*/ publicKey,
jobject /*PrivateKey*/ privateKey,
PAL_KeyAlgorithm* algorithm)
{
if ((*env)->IsInstanceOf(env, privateKey, g_DSAKeyClass))
{
*algorithm = PAL_DSA;
return AndroidCryptoNative_CreateKeyPair(env, publicKey, privateKey);
}
else if ((*env)->IsInstanceOf(env, privateKey, g_ECKeyClass))
{
*algorithm = PAL_EC;
return AndroidCryptoNative_NewEcKeyFromKeys(env, publicKey, privateKey);
}
else if ((*env)->IsInstanceOf(env, privateKey, g_RSAKeyClass))
{
*algorithm = PAL_RSA;
return AndroidCryptoNative_NewRsaFromKeys(env, publicKey, privateKey);
}
LOG_INFO("Ignoring unknown private key type");
*algorithm = PAL_UnknownAlgorithm;
return NULL;
}
ARGS_NON_NULL_ALL static int32_t
EnumerateCertificates(JNIEnv* env, jobject /*KeyStore*/ store, EnumCertificatesCallback cb, void* context)
{
int32_t ret = FAIL;
// Enumeration<String> aliases = store.aliases();
jobject aliases = (*env)->CallObjectMethod(env, store, g_KeyStoreAliases);
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
// while (aliases.hasMoreElements()) {
// String alias = aliases.nextElement();
// KeyStore.Entry entry = store.getEntry(alias);
// if (entry instanceof KeyStore.PrivateKeyEntry) {
// ...
// } else if (entry instanceof KeyStore.TrustedCertificateEntry) {
// ...
// }
// }
jboolean hasNext = (*env)->CallBooleanMethod(env, aliases, g_EnumerationHasMoreElements);
while (hasNext)
{
INIT_LOCALS(loc, alias, entry, cert, publicKey, privateKey);
loc[alias] = (*env)->CallObjectMethod(env, aliases, g_EnumerationNextElement);
ON_EXCEPTION_PRINT_AND_GOTO(loop_cleanup);
loc[entry] = (*env)->CallObjectMethod(env, store, g_KeyStoreGetEntry, loc[alias], NULL);
ON_EXCEPTION_PRINT_AND_GOTO(loop_cleanup);
if ((*env)->IsInstanceOf(env, loc[entry], g_PrivateKeyEntryClass))
{
// Certificate cert = entry.getCertificate();
// Public publicKey = cert.getPublicKey();
// PrivateKey privateKey = entry.getPrivateKey();
loc[cert] = (*env)->CallObjectMethod(env, loc[entry], g_PrivateKeyEntryGetCertificate);
loc[publicKey] = (*env)->CallObjectMethod(env, loc[cert], g_X509CertGetPublicKey);
loc[privateKey] = (*env)->CallObjectMethod(env, loc[entry], g_PrivateKeyEntryGetPrivateKey);
PAL_KeyAlgorithm keyAlgorithm = PAL_UnknownAlgorithm;
void* keyHandle = HandleFromKeys(env, loc[publicKey], loc[privateKey], &keyAlgorithm);
// Private key entries always have a certificate.
// For key algorithms we recognize, the certificate and private key handle are given to the callback.
// For key algorithms we do not recognize, only the certificate will be given to the callback.
cb(AddGRef(env, loc[cert]), keyHandle, keyAlgorithm, context);
}
else if ((*env)->IsInstanceOf(env, loc[entry], g_TrustedCertificateEntryClass))
{
// Certificate cert = entry.getTrustedCertificate();
loc[cert] = (*env)->CallObjectMethod(env, loc[entry], g_TrustedCertificateEntryGetTrustedCertificate);
cb(AddGRef(env, loc[cert]), NULL /*privateKey*/, PAL_UnknownAlgorithm, context);
}
loop_cleanup:
RELEASE_LOCALS(loc, env);
hasNext = (*env)->CallBooleanMethod(env, aliases, g_EnumerationHasMoreElements);
}
ret = SUCCESS;
cleanup:
(*env)->DeleteLocalRef(env, aliases);
return ret;
}
int32_t AndroidCryptoNative_X509StoreEnumerateCertificates(jobject /*KeyStore*/ store,
EnumCertificatesCallback cb,
void* context)
{
abort_if_invalid_pointer_argument (store);
abort_if_invalid_pointer_argument (cb);
JNIEnv* env = GetJNIEnv();
return EnumerateCertificates(env, store, cb, context);
}
ARGS_NON_NULL_ALL
static bool SystemAliasFilter(JNIEnv* env, jstring alias)
{
const char systemPrefix[] = "system:";
size_t prefixLen = (sizeof(systemPrefix) / sizeof(*systemPrefix)) - 1;
const char* aliasPtr = (*env)->GetStringUTFChars(env, alias, NULL);
bool isSystem = (strncmp(aliasPtr, systemPrefix, prefixLen) == 0);
(*env)->ReleaseStringUTFChars(env, alias, aliasPtr);
return isSystem;
}
typedef bool (*FilterAliasFunction)(JNIEnv* env, jstring alias);
ARGS_NON_NULL_ALL static int32_t EnumerateTrustedCertificates(
JNIEnv* env, jobject /*KeyStore*/ store, bool systemOnly, EnumTrustedCertificatesCallback cb, void* context)
{
int32_t ret = FAIL;
// Filter to only system certificates if necessary
// System certificates are included for 'current user' (matches Windows)
FilterAliasFunction filter = systemOnly ? &SystemAliasFilter : NULL;
// Enumeration<String> aliases = store.aliases();
jobject aliases = (*env)->CallObjectMethod(env, store, g_KeyStoreAliases);
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
// while (aliases.hasMoreElements()) {
// String alias = aliases.nextElement();
// X509Certificate cert = (X509Certificate)store.getCertificate(alias);
// if (cert != null) {
// cb(cert, context);
// }
// }
jboolean hasNext = (*env)->CallBooleanMethod(env, aliases, g_EnumerationHasMoreElements);
while (hasNext)
{
jstring alias = (*env)->CallObjectMethod(env, aliases, g_EnumerationNextElement);
ON_EXCEPTION_PRINT_AND_GOTO(loop_cleanup);
if (filter == NULL || filter(env, alias))
{
jobject cert = (*env)->CallObjectMethod(env, store, g_KeyStoreGetCertificate, alias);
if (cert != NULL && !CheckJNIExceptions(env))
{
cert = ToGRef(env, cert);
cb(cert, context);
}
}
hasNext = (*env)->CallBooleanMethod(env, aliases, g_EnumerationHasMoreElements);
loop_cleanup:
(*env)->DeleteLocalRef(env, alias);
}
ret = SUCCESS;
cleanup:
(*env)->DeleteLocalRef(env, aliases);
return ret;
}
int32_t AndroidCryptoNative_X509StoreEnumerateTrustedCertificates(bool systemOnly,
EnumTrustedCertificatesCallback cb,
void* context)
{
abort_if_invalid_pointer_argument (cb);
JNIEnv* env = GetJNIEnv();
int32_t ret = FAIL;
INIT_LOCALS(loc, storeType, store);
// KeyStore store = KeyStore.getInstance("AndroidCAStore");
// store.load(null, null);
loc[storeType] = make_java_string(env, "AndroidCAStore");
loc[store] = (*env)->CallStaticObjectMethod(env, g_KeyStoreClass, g_KeyStoreGetInstance, loc[storeType]);
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
(*env)->CallVoidMethod(env, loc[store], g_KeyStoreLoad, NULL, NULL);
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
ret = EnumerateTrustedCertificates(env, loc[store], systemOnly, cb, context);
cleanup:
RELEASE_LOCALS(loc, env);
return ret;
}
jobject /*KeyStore*/ AndroidCryptoNative_X509StoreOpenDefault(void)
{
JNIEnv* env = GetJNIEnv();
jobject ret = NULL;
// KeyStore store = KeyStore.getInstance("AndroidKeyStore");
// store.load(null, null);
jstring storeType = make_java_string(env, "AndroidKeyStore");
jobject store = (*env)->CallStaticObjectMethod(env, g_KeyStoreClass, g_KeyStoreGetInstance, storeType);
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
(*env)->CallVoidMethod(env, store, g_KeyStoreLoad, NULL, NULL);
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
ret = ToGRef(env, store);
cleanup:
(*env)->DeleteLocalRef(env, storeType);
return ret;
}
int32_t AndroidCryptoNative_X509StoreRemoveCertificate(jobject /*KeyStore*/ store,
jobject /*X509Certificate*/ cert,
const char* hashString)
{
abort_if_invalid_pointer_argument (store);
JNIEnv* env = GetJNIEnv();
jstring alias = make_java_string(env, hashString);
if (!ContainsMatchingCertificateForAlias(env, store, cert, alias))
{
// Certificate is not in store - nothing to do
return SUCCESS;
}
// store.deleteEntry(alias);
(*env)->CallVoidMethod(env, store, g_KeyStoreDeleteEntry, alias);
(*env)->DeleteLocalRef(env, alias);
return CheckJNIExceptions(env) ? FAIL : SUCCESS;
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#include "pal_x509store.h"
#include "pal_eckey.h"
#include "pal_misc.h"
#include "pal_rsa.h"
#include <assert.h>
#include <stdbool.h>
#include <string.h>
typedef enum
{
EntryFlags_None = 0,
EntryFlags_HasCertificate = 1,
EntryFlags_HasPrivateKey = 2,
EntryFlags_MatchesCertificate = 4,
} EntryFlags;
// Returns whether or not the store contains the specified alias
// If the entry exists, the flags parameter is set based on the contents of the entry
ARGS_NON_NULL_ALL static bool ContainsEntryForAlias(
JNIEnv* env, jobject /*KeyStore*/ store, jobject /*X509Certificate*/ cert, jstring alias, EntryFlags* flags)
{
bool ret = false;
EntryFlags flagsLocal = EntryFlags_None;
INIT_LOCALS(loc, entry, existingCert);
bool containsAlias = (*env)->CallBooleanMethod(env, store, g_KeyStoreContainsAlias, alias);
if (!containsAlias)
goto cleanup;
ret = true;
// KeyStore.Entry entry = store.getEntry(alias, null);
// if (entry instanceof KeyStore.PrivateKeyEntry) {
// existingCert = ((KeyStore.PrivateKeyEntry)entry).getCertificate();
// } else if (entry instanceof KeyStore.TrustedCertificateEntry) {
// existingCert = ((KeyStore.TrustedCertificateEntry)entry).getTrustedCertificate();
// }
loc[entry] = (*env)->CallObjectMethod(env, store, g_KeyStoreGetEntry, alias, NULL);
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
if ((*env)->IsInstanceOf(env, loc[entry], g_PrivateKeyEntryClass))
{
// Private key entries always have a certificate
flagsLocal |= EntryFlags_HasCertificate;
flagsLocal |= EntryFlags_HasPrivateKey;
loc[existingCert] = (*env)->CallObjectMethod(env, loc[entry], g_PrivateKeyEntryGetCertificate);
}
else if ((*env)->IsInstanceOf(env, loc[entry], g_TrustedCertificateEntryClass))
{
flagsLocal |= EntryFlags_HasCertificate;
loc[existingCert] = (*env)->CallObjectMethod(env, loc[entry], g_TrustedCertificateEntryGetTrustedCertificate);
}
else
{
// Entry for alias exists, but doesn't represent a certificate or private key + certificate
goto cleanup;
}
assert(loc[existingCert] != NULL);
if ((*env)->CallBooleanMethod(env, cert, g_X509CertEquals, loc[existingCert]))
{
flagsLocal |= EntryFlags_MatchesCertificate;
}
cleanup:
RELEASE_LOCALS(loc, env);
*flags = flagsLocal;
return ret;
}
ARGS_NON_NULL_ALL
static bool ContainsMatchingCertificateForAlias(JNIEnv* env,
jobject /*KeyStore*/ store,
jobject /*X509Certificate*/ cert,
jstring alias)
{
EntryFlags flags;
if (!ContainsEntryForAlias(env, store, cert, alias, &flags))
return false;
EntryFlags matchesFlags = EntryFlags_HasCertificate & EntryFlags_MatchesCertificate;
return (flags & matchesFlags) == matchesFlags;
}
int32_t AndroidCryptoNative_X509StoreAddCertificate(jobject /*KeyStore*/ store,
jobject /*X509Certificate*/ cert,
const char* hashString)
{
abort_if_invalid_pointer_argument (store);
abort_if_invalid_pointer_argument (cert);
abort_if_invalid_pointer_argument (hashString);
JNIEnv* env = GetJNIEnv();
jstring alias = make_java_string(env, hashString);
EntryFlags flags;
if (ContainsEntryForAlias(env, store, cert, alias, &flags))
{
ReleaseLRef(env, alias);
EntryFlags matchesFlags = EntryFlags_HasCertificate & EntryFlags_MatchesCertificate;
if ((flags & matchesFlags) != matchesFlags)
{
LOG_ERROR("Store already contains alias with entry that does not match the expected certificate");
return FAIL;
}
// Certificate is already in store - nothing to do
LOG_DEBUG("Store already contains certificate");
return SUCCESS;
}
// store.setCertificateEntry(alias, cert);
(*env)->CallVoidMethod(env, store, g_KeyStoreSetCertificateEntry, alias, cert);
(*env)->DeleteLocalRef(env, alias);
return CheckJNIExceptions(env) ? FAIL : SUCCESS;
}
int32_t AndroidCryptoNative_X509StoreAddCertificateWithPrivateKey(jobject /*KeyStore*/ store,
jobject /*X509Certificate*/ cert,
void* key,
PAL_KeyAlgorithm algorithm,
const char* hashString)
{
abort_if_invalid_pointer_argument (store);
abort_if_invalid_pointer_argument (cert);
abort_if_invalid_pointer_argument (key);
abort_if_invalid_pointer_argument (hashString);
int32_t ret = FAIL;
JNIEnv* env = GetJNIEnv();
INIT_LOCALS(loc, alias, certs);
jobject privateKey = NULL;
loc[alias] = make_java_string(env, hashString);
EntryFlags flags;
if (ContainsEntryForAlias(env, store, cert, loc[alias], &flags))
{
EntryFlags matchesFlags = EntryFlags_HasCertificate & EntryFlags_MatchesCertificate;
if ((flags & matchesFlags) != matchesFlags)
{
RELEASE_LOCALS(loc, env);
LOG_ERROR("Store already contains alias with entry that does not match the expected certificate");
return FAIL;
}
if ((flags & EntryFlags_HasPrivateKey) == EntryFlags_HasPrivateKey)
{
RELEASE_LOCALS(loc, env);
// Certificate with private key is already in store - nothing to do
LOG_DEBUG("Store already contains certificate with private key");
return SUCCESS;
}
// Delete existing entry. We will replace the existing cert with the cert + private key.
// store.deleteEntry(alias);
(*env)->CallVoidMethod(env, store, g_KeyStoreDeleteEntry, loc[alias]);
}
bool releasePrivateKey = true;
switch (algorithm)
{
case PAL_EC:
{
EC_KEY* ec = (EC_KEY*)key;
privateKey = (*env)->CallObjectMethod(env, ec->keyPair, g_keyPairGetPrivateMethod);
break;
}
case PAL_DSA:
{
// key is a KeyPair jobject
privateKey = (*env)->CallObjectMethod(env, key, g_keyPairGetPrivateMethod);
break;
}
case PAL_RSA:
{
RSA* rsa = (RSA*)key;
privateKey = rsa->privateKey;
releasePrivateKey = false; // Private key is a global ref stored directly on RSA handle
break;
}
default:
{
releasePrivateKey = false;
LOG_ERROR("Unknown algorithm for private key");
goto cleanup;
}
}
// X509Certificate[] certs = new X509Certificate[] { cert };
// store.setKeyEntry(alias, privateKey, null, certs);
loc[certs] = make_java_object_array(env, 1, g_X509CertClass, cert);
(*env)->CallVoidMethod(env, store, g_KeyStoreSetKeyEntry, loc[alias], privateKey, NULL, loc[certs]);
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
ret = SUCCESS;
cleanup:
RELEASE_LOCALS(loc, env);
if (releasePrivateKey)
{
(*env)->DeleteLocalRef(env, privateKey);
}
return ret;
}
bool AndroidCryptoNative_X509StoreContainsCertificate(jobject /*KeyStore*/ store,
jobject /*X509Certificate*/ cert,
const char* hashString)
{
abort_if_invalid_pointer_argument (store);
abort_if_invalid_pointer_argument (cert);
abort_if_invalid_pointer_argument (hashString);
JNIEnv* env = GetJNIEnv();
jstring alias = make_java_string(env, hashString);
bool containsCert = ContainsMatchingCertificateForAlias(env, store, cert, alias);
(*env)->DeleteLocalRef(env, alias);
return containsCert;
}
ARGS_NON_NULL_ALL
static void* HandleFromKeys(JNIEnv* env,
jobject /*PublicKey*/ publicKey,
jobject /*PrivateKey*/ privateKey,
PAL_KeyAlgorithm* algorithm)
{
if ((*env)->IsInstanceOf(env, privateKey, g_DSAKeyClass))
{
*algorithm = PAL_DSA;
return AndroidCryptoNative_CreateKeyPair(env, publicKey, privateKey);
}
else if ((*env)->IsInstanceOf(env, privateKey, g_ECKeyClass))
{
*algorithm = PAL_EC;
return AndroidCryptoNative_NewEcKeyFromKeys(env, publicKey, privateKey);
}
else if ((*env)->IsInstanceOf(env, privateKey, g_RSAKeyClass))
{
*algorithm = PAL_RSA;
return AndroidCryptoNative_NewRsaFromKeys(env, publicKey, privateKey);
}
LOG_INFO("Ignoring unknown private key type");
*algorithm = PAL_UnknownAlgorithm;
return NULL;
}
ARGS_NON_NULL_ALL static int32_t
EnumerateCertificates(JNIEnv* env, jobject /*KeyStore*/ store, EnumCertificatesCallback cb, void* context)
{
int32_t ret = FAIL;
// Enumeration<String> aliases = store.aliases();
jobject aliases = (*env)->CallObjectMethod(env, store, g_KeyStoreAliases);
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
// while (aliases.hasMoreElements()) {
// String alias = aliases.nextElement();
// KeyStore.Entry entry = store.getEntry(alias);
// if (entry instanceof KeyStore.PrivateKeyEntry) {
// ...
// } else if (entry instanceof KeyStore.TrustedCertificateEntry) {
// ...
// }
// }
jboolean hasNext = (*env)->CallBooleanMethod(env, aliases, g_EnumerationHasMoreElements);
while (hasNext)
{
INIT_LOCALS(loc, alias, entry, cert, publicKey, privateKey);
loc[alias] = (*env)->CallObjectMethod(env, aliases, g_EnumerationNextElement);
ON_EXCEPTION_PRINT_AND_GOTO(loop_cleanup);
loc[entry] = (*env)->CallObjectMethod(env, store, g_KeyStoreGetEntry, loc[alias], NULL);
ON_EXCEPTION_PRINT_AND_GOTO(loop_cleanup);
if ((*env)->IsInstanceOf(env, loc[entry], g_PrivateKeyEntryClass))
{
// Certificate cert = entry.getCertificate();
// Public publicKey = cert.getPublicKey();
// PrivateKey privateKey = entry.getPrivateKey();
loc[cert] = (*env)->CallObjectMethod(env, loc[entry], g_PrivateKeyEntryGetCertificate);
loc[publicKey] = (*env)->CallObjectMethod(env, loc[cert], g_X509CertGetPublicKey);
loc[privateKey] = (*env)->CallObjectMethod(env, loc[entry], g_PrivateKeyEntryGetPrivateKey);
PAL_KeyAlgorithm keyAlgorithm = PAL_UnknownAlgorithm;
void* keyHandle = HandleFromKeys(env, loc[publicKey], loc[privateKey], &keyAlgorithm);
// Private key entries always have a certificate.
// For key algorithms we recognize, the certificate and private key handle are given to the callback.
// For key algorithms we do not recognize, only the certificate will be given to the callback.
cb(AddGRef(env, loc[cert]), keyHandle, keyAlgorithm, context);
}
else if ((*env)->IsInstanceOf(env, loc[entry], g_TrustedCertificateEntryClass))
{
// Certificate cert = entry.getTrustedCertificate();
loc[cert] = (*env)->CallObjectMethod(env, loc[entry], g_TrustedCertificateEntryGetTrustedCertificate);
cb(AddGRef(env, loc[cert]), NULL /*privateKey*/, PAL_UnknownAlgorithm, context);
}
loop_cleanup:
RELEASE_LOCALS(loc, env);
hasNext = (*env)->CallBooleanMethod(env, aliases, g_EnumerationHasMoreElements);
}
ret = SUCCESS;
cleanup:
(*env)->DeleteLocalRef(env, aliases);
return ret;
}
int32_t AndroidCryptoNative_X509StoreEnumerateCertificates(jobject /*KeyStore*/ store,
EnumCertificatesCallback cb,
void* context)
{
abort_if_invalid_pointer_argument (store);
abort_if_invalid_pointer_argument (cb);
JNIEnv* env = GetJNIEnv();
return EnumerateCertificates(env, store, cb, context);
}
ARGS_NON_NULL_ALL
static bool SystemAliasFilter(JNIEnv* env, jstring alias)
{
const char systemPrefix[] = "system:";
size_t prefixLen = (sizeof(systemPrefix) / sizeof(*systemPrefix)) - 1;
const char* aliasPtr = (*env)->GetStringUTFChars(env, alias, NULL);
bool isSystem = (strncmp(aliasPtr, systemPrefix, prefixLen) == 0);
(*env)->ReleaseStringUTFChars(env, alias, aliasPtr);
return isSystem;
}
typedef bool (*FilterAliasFunction)(JNIEnv* env, jstring alias);
ARGS_NON_NULL_ALL static int32_t EnumerateTrustedCertificates(
JNIEnv* env, jobject /*KeyStore*/ store, bool systemOnly, EnumTrustedCertificatesCallback cb, void* context)
{
int32_t ret = FAIL;
// Filter to only system certificates if necessary
// System certificates are included for 'current user' (matches Windows)
FilterAliasFunction filter = systemOnly ? &SystemAliasFilter : NULL;
// Enumeration<String> aliases = store.aliases();
jobject aliases = (*env)->CallObjectMethod(env, store, g_KeyStoreAliases);
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
// while (aliases.hasMoreElements()) {
// String alias = aliases.nextElement();
// X509Certificate cert = (X509Certificate)store.getCertificate(alias);
// if (cert != null) {
// cb(cert, context);
// }
// }
jboolean hasNext = (*env)->CallBooleanMethod(env, aliases, g_EnumerationHasMoreElements);
while (hasNext)
{
jstring alias = (*env)->CallObjectMethod(env, aliases, g_EnumerationNextElement);
ON_EXCEPTION_PRINT_AND_GOTO(loop_cleanup);
if (filter == NULL || filter(env, alias))
{
jobject cert = (*env)->CallObjectMethod(env, store, g_KeyStoreGetCertificate, alias);
if (cert != NULL && !CheckJNIExceptions(env))
{
cert = ToGRef(env, cert);
cb(cert, context);
}
}
hasNext = (*env)->CallBooleanMethod(env, aliases, g_EnumerationHasMoreElements);
loop_cleanup:
(*env)->DeleteLocalRef(env, alias);
}
ret = SUCCESS;
cleanup:
(*env)->DeleteLocalRef(env, aliases);
return ret;
}
int32_t AndroidCryptoNative_X509StoreEnumerateTrustedCertificates(bool systemOnly,
EnumTrustedCertificatesCallback cb,
void* context)
{
abort_if_invalid_pointer_argument (cb);
JNIEnv* env = GetJNIEnv();
int32_t ret = FAIL;
INIT_LOCALS(loc, storeType, store);
// KeyStore store = KeyStore.getInstance("AndroidCAStore");
// store.load(null, null);
loc[storeType] = make_java_string(env, "AndroidCAStore");
loc[store] = (*env)->CallStaticObjectMethod(env, g_KeyStoreClass, g_KeyStoreGetInstance, loc[storeType]);
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
(*env)->CallVoidMethod(env, loc[store], g_KeyStoreLoad, NULL, NULL);
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
ret = EnumerateTrustedCertificates(env, loc[store], systemOnly, cb, context);
cleanup:
RELEASE_LOCALS(loc, env);
return ret;
}
jobject /*KeyStore*/ AndroidCryptoNative_X509StoreOpenDefault(void)
{
JNIEnv* env = GetJNIEnv();
jobject ret = NULL;
// KeyStore store = KeyStore.getInstance("AndroidKeyStore");
// store.load(null, null);
jstring storeType = make_java_string(env, "AndroidKeyStore");
jobject store = (*env)->CallStaticObjectMethod(env, g_KeyStoreClass, g_KeyStoreGetInstance, storeType);
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
(*env)->CallVoidMethod(env, store, g_KeyStoreLoad, NULL, NULL);
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
ret = ToGRef(env, store);
cleanup:
(*env)->DeleteLocalRef(env, storeType);
return ret;
}
int32_t AndroidCryptoNative_X509StoreRemoveCertificate(jobject /*KeyStore*/ store,
jobject /*X509Certificate*/ cert,
const char* hashString)
{
abort_if_invalid_pointer_argument (store);
JNIEnv* env = GetJNIEnv();
jstring alias = make_java_string(env, hashString);
if (!ContainsMatchingCertificateForAlias(env, store, cert, alias))
{
// Certificate is not in store - nothing to do
return SUCCESS;
}
// store.deleteEntry(alias);
(*env)->CallVoidMethod(env, store, g_KeyStoreDeleteEntry, alias);
(*env)->DeleteLocalRef(env, alias);
return CheckJNIExceptions(env) ? FAIL : SUCCESS;
}
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/coreclr/md/ceefilegen/stdafx.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//*****************************************************************************
// stdafx.h
//
//
// Common include file for utility code.
//*****************************************************************************
#define _CRT_DEPENDENCY_ //this code depends on the crt file functions
#include <crtwrap.h>
#include <string.h>
#include <limits.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h> // for qsort
#include <windows.h>
#include <time.h>
#include <corerror.h>
#include <utilcode.h>
#include <corpriv.h>
#include "pesectionman.h"
#include "ceegen.h"
#include "ceesectionstring.h"
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//*****************************************************************************
// stdafx.h
//
//
// Common include file for utility code.
//*****************************************************************************
#define _CRT_DEPENDENCY_ //this code depends on the crt file functions
#include <crtwrap.h>
#include <string.h>
#include <limits.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h> // for qsort
#include <windows.h>
#include <time.h>
#include <corerror.h>
#include <utilcode.h>
#include <corpriv.h>
#include "pesectionman.h"
#include "ceegen.h"
#include "ceesectionstring.h"
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/libraries/System.Private.Xml/src/Utils/System.Xml.Utils.txt
|
;==++==
;
; Copyright (c) Microsoft Corporation. All rights reserved.
;
;==--==
; NOTE: do not use \", use ' instead
; NOTE: Use # or ; for comments
; These are the managed resources for System.Xml.Utils.dll in Silverlight. See
; ResourceManager documentation and the ResGen tool.
Xml_UnsupportedClass=Object type is not supported.
Xml_CannotResolveUrl=Cannot resolve '{0}'.
|
;==++==
;
; Copyright (c) Microsoft Corporation. All rights reserved.
;
;==--==
; NOTE: do not use \", use ' instead
; NOTE: Use # or ; for comments
; These are the managed resources for System.Xml.Utils.dll in Silverlight. See
; ResourceManager documentation and the ResGen tool.
Xml_UnsupportedClass=Object type is not supported.
Xml_CannotResolveUrl=Cannot resolve '{0}'.
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/coreclr/vm/fcall.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// FCall.H
//
//
// FCall is a high-performance alternative to ECall. Unlike ECall, FCall
// methods do not necessarily create a frame. Jitted code calls directly
// to the FCall entry point. It is possible to do operations that need
// to have a frame within an FCall, you need to manually set up the frame
// before you do such operations.
// It is illegal to cause a GC or EH to happen in an FCALL before setting
// up a frame. To prevent accidentally violating this rule, FCALLs turn
// on BEGINGCFORBID, which insures that these things can't happen in a
// checked build without causing an ASSERTE. Once you set up a frame,
// this state is turned off as long as the frame is active, and then is
// turned on again when the frame is torn down. This mechanism should
// be sufficient to insure that the rules are followed.
// In general you set up a frame by using the following macros
// HELPER_METHOD_FRAME_BEGIN_RET*() // Use If the FCALL has a return value
// HELPER_METHOD_FRAME_BEGIN*() // Use If FCALL does not return a value
// HELPER_METHOD_FRAME_END*()
// These macros introduce a scope which is protected by an HelperMethodFrame.
// In this scope you can do EH or GC. There are rules associated with
// their use. In particular
// 1) These macros can only be used in the body of a FCALL (that is
// something using the FCIMPL* or HCIMPL* macros for their decaration.
// 2) You may not perform a 'return' within this scope..
// Compile time errors occur if you try to violate either of these rules.
// The frame that is set up does NOT protect any GC variables (in particular the
// arguments of the FCALL. Thus you need to do an explicit GCPROTECT once the
// frame is established if you need to protect an argument. There are flavors
// of HELPER_METHOD_FRAME that protect a certain number of GC variables. For
// example
// HELPER_METHOD_FRAME_BEGIN_RET_2(arg1, arg2)
// will protect the GC variables arg1, and arg2 as well as erecting the frame.
// Another invariant that you must be aware of is the need to poll to see if
// a GC is needed by some other thread. Unless the FCALL is VERY short,
// every code path through the FCALL must do such a poll. The important
// thing here is that a poll will cause a GC, and thus you can only do it
// when all you GC variables are protected. To make things easier
// HELPER_METHOD_FRAMES that protect things automatically do this poll.
// If you don't need to protect anything HELPER_METHOD_FRAME_BEGIN_0
// will also do the poll.
// Sometimes it is convenient to do the poll a the end of the frame, you
// can use HELPER_METHOD_FRAME_BEGIN_NOPOLL and HELPER_METHOD_FRAME_END_POLL
// to do the poll at the end. If somewhere in the middle is the best
// place you can do that too with HELPER_METHOD_POLL()
// You don't need to erect a helper method frame to do a poll. FC_GC_POLL
// can do this (remember all your GC refs will be trashed).
// Finally if your method is VERY small, you can get away without a poll,
// you have to use FC_GC_POLL_NOT_NEEDED to mark this.
// Use sparingly!
// It is possible to set up the frame as the first operation in the FCALL and
// tear it down as the last operation before returning. This works and is
// reasonably efficient (as good as an ECall), however, if it is the case that
// you can defer the setup of the frame to an unlikely code path (exception path)
// that is much better.
// If you defer setup of the frame, all codepaths leading to the frame setup
// must be wrapped with PERMIT_HELPER_METHOD_FRAME_BEGIN/END. These block
// certain compiler optimizations that interfere with the delayed frame setup.
// These macros are automatically included in the HCIMPL, FCIMPL, and frame
// setup macros.
// <TODO>TODO: we should have a way of doing a trial allocation (an allocation that
// will fail if it would cause a GC). That way even FCALLs that need to allocate
// would not necessarily need to set up a frame. </TODO>
// It is common to only need to set up a frame in order to throw an exception.
// While this can be done by doing
// HELPER_METHOD_FRAME_BEGIN() // Use if FCALL does not return a value
// COMPlusThrow(execpt);
// HELPER_METHOD_FRAME_END()
// It is more efficient (in space) to use convenience macro FCTHROW that does
// this for you (sets up a frame, and does the throw).
// FCTHROW(except)
// Since FCALLS have to conform to the EE calling conventions and not to C
// calling conventions, FCALLS, need to be declared using special macros (FCIMPL*)
// that implement the correct calling conventions. There are variants of these
// macros depending on the number of args, and sometimes the types of the
// arguments.
//------------------------------------------------------------------------
// A very simple example:
//
// FCIMPL2(INT32, Div, INT32 x, INT32 y)
// {
// if (y == 0)
// FCThrow(kDivideByZeroException);
// return x/y;
// }
// FCIMPLEND
//
//
// *** WATCH OUT FOR THESE GOTCHAS: ***
// ------------------------------------
// - In your FCDECL & FCIMPL protos, don't declare a param as type OBJECTREF
// or any of its deriveds. This will break on the checked build because
// __fastcall doesn't enregister C++ objects (which OBJECTREF is).
// Instead, you need to do something like;
//
// FCIMPL(.., .., Object* pObject0)
// OBJECTREF pObject = ObjectToOBJECTREF(pObject0);
// FCIMPL
//
// For similar reasons, use Object* rather than OBJECTREF as a return type.
// Consider either using ObjectToOBJECTREF or calling VALIDATEOBJECTREF
// to make sure your Object* is valid.
//
// - FCThrow() must be called directly from your FCall impl function: it
// cannot be called from a subfunction. Calling from a subfunction breaks
// the VC code parsing workaround that lets us recover the callee saved registers.
// Fortunately, you'll get a compile error complaining about an
// unknown variable "__me".
//
// - If your FCall returns VOID, you must use FCThrowVoid() rather than
// FCThrow(). This is because FCThrow() has to generate an unexecuted
// "return" statement for the code parser.
//
// - On x86, if first and/or second argument of your FCall cannot be passed
// in either of the __fastcall registers (ECX/EDX), you must use "V" versions
// of FCDECL and FCIMPL macros to enregister arguments correctly. Some of the
// most common types that fit this requirement are 64-bit values (i.e. INT64 or
// UINT64) and floating-point values (i.e. FLOAT or DOUBLE). For example, FCDECL3_IVI
// must be used for FCalls that take 3 arguments and 2nd argument is INT64 and
// FDECL2_VV must be used for FCalls that take 2 arguments where both are FLOAT.
//
// - You may use structs for protecting multiple OBJECTREF's simultaneously.
// In these cases, you must use a variant of a helper method frame with PROTECT
// in the name, to ensure all the OBJECTREF's in the struct get protected.
// Also, initialize all the OBJECTREF's first. Like this:
//
// FCIMPL4(Object*, COMNlsInfo::nativeChangeCaseString, LocaleIDObject* localeUNSAFE,
// INT_PTR pNativeTextInfo, StringObject* pStringUNSAFE, CLR_BOOL bIsToUpper)
// {
// [ignoring CONTRACT for now]
// struct _gc
// {
// STRINGREF pResult;
// STRINGREF pString;
// LOCALEIDREF pLocale;
// } gc;
// gc.pResult = NULL;
// gc.pString = ObjectToSTRINGREF(pStringUNSAFE);
// gc.pLocale = (LOCALEIDREF)ObjectToOBJECTREF(localeUNSAFE);
//
// HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc)
//
// If you forgot the PROTECT part, the macro will only protect the first OBJECTREF,
// introducing a subtle GC hole in your code. Fortunately, we now issue a
// compile-time error if you forget.
// How FCall works:
// ----------------
// An FCall target uses __fastcall or some other calling convention to
// match the IL calling convention exactly. Thus, a call to FCall is a direct
// call to the target w/ no intervening stub or frame.
//
// The tricky part is when FCThrow is called. FCThrow must generate
// a proper method frame before allocating and throwing the exception.
// To do this, it must recover several things:
//
// - The location of the FCIMPL's return address (since that's
// where the frame will be based.)
//
// - The on-entry values of the callee-saved regs; which must
// be recorded in the frame so that GC can update them.
// Depending on how VC compiles your FCIMPL, those values are still
// in the original registers or saved on the stack.
//
// To figure out which, FCThrow() generates the code:
//
// while (NULL == __FCThrow(__me, ...)) {};
// return 0;
//
// The "return" statement will never execute; but its presence guarantees
// that VC will follow the __FCThrow() call with a VC epilog
// that restores the callee-saved registers using a pretty small
// and predictable set of Intel opcodes. __FCThrow() parses this
// epilog and simulates its execution to recover the callee saved
// registers.
//
// The while loop is to prevent the compiler from doing tail call optimizations.
// The helper frame interpretter needs the frame to be present.
//
// - The MethodDesc* that this FCall implements. This MethodDesc*
// is part of the frame and ensures that the FCall will appear
// in the exception's stack trace. To get this, FCDECL declares
// a static local __me, initialized to point to the FC target itself.
// This address is exactly what's stored in the ECall lookup tables;
// so __FCThrow() simply does a reverse lookup on that table to recover
// the MethodDesc*.
//
#ifndef __FCall_h__
#define __FCall_h__
#include "gms.h"
#include "runtimeexceptionkind.h"
#include "debugreturn.h"
//==============================================================================================
// These macros defeat compiler optimizations that might mix nonvolatile
// register loads and stores with other code in the function body. This
// creates problems for the frame setup code, which assumes that any
// nonvolatiles that are saved at the point of the frame setup will be
// re-loaded when the frame is popped.
//
// Currently this is only known to be an issue on AMD64. It's uncertain
// whether it is an issue on x86.
//==============================================================================================
#if defined(TARGET_AMD64) && !defined(TARGET_UNIX)
//
// On AMD64 this is accomplished by including a setjmp anywhere in a function.
// Doesn't matter whether it is reachable or not, and in fact in optimized
// builds the setjmp is removed altogether.
//
#include <setjmp.h>
#ifdef _DEBUG
//
// Linked list of unmanaged methods preceeding a HelperMethodFrame push. This
// is linked onto the current Thread. Each list entry is stack-allocated so it
// can be associated with an unmanaged frame. Each unmanaged frame needs to be
// associated with at least one list entry.
//
struct HelperMethodFrameCallerList
{
HelperMethodFrameCallerList *pCaller;
};
#endif // _DEBUG
//
// Resets the Thread state at a new managed -> fcall transition.
//
class FCallTransitionState
{
public:
FCallTransitionState () NOT_DEBUG({ LIMITED_METHOD_CONTRACT; });
~FCallTransitionState () NOT_DEBUG({ LIMITED_METHOD_CONTRACT; });
#ifdef _DEBUG
private:
Thread *m_pThread;
HelperMethodFrameCallerList *m_pPreviousHelperMethodFrameCallerList;
#endif // _DEBUG
};
//
// Pushes/pops state for each caller.
//
class PermitHelperMethodFrameState
{
public:
PermitHelperMethodFrameState () NOT_DEBUG({ LIMITED_METHOD_CONTRACT; });
~PermitHelperMethodFrameState () NOT_DEBUG({ LIMITED_METHOD_CONTRACT; });
static VOID CheckHelperMethodFramePermitted () NOT_DEBUG({ LIMITED_METHOD_CONTRACT; });
#ifdef _DEBUG
private:
Thread *m_pThread;
HelperMethodFrameCallerList m_ListEntry;
#endif // _DEBUG
};
//
// Resets the Thread state after the HelperMethodFrame is pushed. At this
// point, the HelperMethodFrame is capable of unwinding to the managed code,
// so we can reset the Thread state for any nested fcalls.
//
class CompletedFCallTransitionState
{
public:
CompletedFCallTransitionState () NOT_DEBUG({ LIMITED_METHOD_CONTRACT; });
~CompletedFCallTransitionState () NOT_DEBUG({ LIMITED_METHOD_CONTRACT; });
#ifdef _DEBUG
private:
HelperMethodFrameCallerList *m_pLastHelperMethodFrameCallerList;
#endif // _DEBUG
};
#define PERMIT_HELPER_METHOD_FRAME_BEGIN() \
if (1) \
{ \
PermitHelperMethodFrameState ___PermitHelperMethodFrameState;
#define PERMIT_HELPER_METHOD_FRAME_END() \
} \
else \
{ \
jmp_buf ___jmpbuf; \
setjmp(___jmpbuf); \
__assume(0); \
}
#define FCALL_TRANSITION_BEGIN() \
FCallTransitionState ___FCallTransitionState; \
PERMIT_HELPER_METHOD_FRAME_BEGIN();
#define FCALL_TRANSITION_END() \
PERMIT_HELPER_METHOD_FRAME_END();
#define CHECK_HELPER_METHOD_FRAME_PERMITTED() \
PermitHelperMethodFrameState::CheckHelperMethodFramePermitted(); \
CompletedFCallTransitionState ___CompletedFCallTransitionState;
#else // unsupported processor
#define PERMIT_HELPER_METHOD_FRAME_BEGIN()
#define PERMIT_HELPER_METHOD_FRAME_END()
#define FCALL_TRANSITION_BEGIN()
#define FCALL_TRANSITION_END()
#define CHECK_HELPER_METHOD_FRAME_PERMITTED()
#endif // unsupported processor
//==============================================================================================
// This is where FCThrow ultimately ends up. Never call this directly.
// Use the FCThrow() macros. __FCThrowArgument is the helper to throw ArgumentExceptions
// with a resource taken from the managed resource manager.
//==============================================================================================
LPVOID __FCThrow(LPVOID me, enum RuntimeExceptionKind reKind, UINT resID, LPCWSTR arg1, LPCWSTR arg2, LPCWSTR arg3);
LPVOID __FCThrowArgument(LPVOID me, enum RuntimeExceptionKind reKind, LPCWSTR argumentName, LPCWSTR resourceName);
//==============================================================================================
// FDECLn: A set of macros for generating header declarations for FC targets.
// Use FIMPLn for the actual body.
//==============================================================================================
// Note: on the x86, these defs reverse all but the first two arguments
// (IL stack calling convention is reversed from __fastcall.)
// Calling convention for varargs
#define F_CALL_VA_CONV __cdecl
#ifdef TARGET_X86
// Choose the appropriate calling convention for FCALL helpers on the basis of the JIT calling convention
#ifdef __GNUC__
#define F_CALL_CONV __attribute__((cdecl, regparm(3)))
// GCC FCALL convention (simulated via cdecl, regparm(3)) is different from MSVC FCALL convention. GCC can use up
// to 3 registers to store parameters. The registers used are EAX, EDX, ECX. Dummy parameters and reordering
// of the actual parameters in the FCALL signature is used to make the calling convention to look like in MSVC.
#define SWIZZLE_REGARG_ORDER
#else // __GNUC__
#define F_CALL_CONV __fastcall
#endif // !__GNUC__
#define SWIZZLE_STKARG_ORDER
#else // TARGET_X86
//
// non-x86 platforms don't have messed-up calling convention swizzling
//
#define F_CALL_CONV
#endif // !TARGET_X86
#ifdef SWIZZLE_STKARG_ORDER
#ifdef SWIZZLE_REGARG_ORDER
#define FCDECL0(rettype, funcname) rettype F_CALL_CONV funcname()
#define FCDECL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1)
#define FCDECL1_V(rettype, funcname, a1) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, int /* ECX */, a1)
#define FCDECL2(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1)
#define FCDECL2VA(rettype, funcname, a1, a2) rettype F_CALL_VA_CONV funcname(a1, a2, ...)
#define FCDECL2_VV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, int /* ECX */, a2, a1)
#define FCDECL2_VI(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a2, a1)
#define FCDECL2_IV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1, a2)
#define FCDECL3(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a3)
#define FCDECL3_IIV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a3)
#define FCDECL3_VII(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a3, a2, a1)
#define FCDECL3_IVV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1, a3, a2)
#define FCDECL3_IVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a3, a1, a2)
#define FCDECL3_VVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a3, a2, a1)
#define FCDECL3_VVV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, int /* ECX */, a3, a2, a1)
#define FCDECL4(rettype, funcname, a1, a2, a3, a4) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a4, a3)
#define FCDECL5(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a5, a4, a3)
#define FCDECL6(rettype, funcname, a1, a2, a3, a4, a5, a6) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a6, a5, a4, a3)
#define FCDECL7(rettype, funcname, a1, a2, a3, a4, a5, a6, a7) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a7, a6, a5, a4, a3)
#define FCDECL8(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a8, a7, a6, a5, a4, a3)
#define FCDECL9(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL10(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL11(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL12(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL13(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL14(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a14, a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a3, a1, a5, a4, a2)
#define FCDECL5_VII(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a3, a2, a5, a4, a1)
#else // SWIZZLE_REGARG_ORDER
#define FCDECL0(rettype, funcname) rettype F_CALL_CONV funcname()
#define FCDECL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1)
#define FCDECL1_V(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1)
#define FCDECL2(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2)
#define FCDECL2VA(rettype, funcname, a1, a2) rettype F_CALL_VA_CONV funcname(a1, a2, ...)
#define FCDECL2_VV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a2, a1)
#define FCDECL2_VI(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a2, a1)
#define FCDECL2_IV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2)
#define FCDECL3(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL3_IIV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL3_VII(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a2, a3, a1)
#define FCDECL3_IVV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a3, a2)
#define FCDECL3_IVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a3, a2)
#define FCDECL3_VVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a2, a1, a3)
#define FCDECL3_VVV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a3, a2, a1)
#define FCDECL4(rettype, funcname, a1, a2, a3, a4) rettype F_CALL_CONV funcname(a1, a2, a4, a3)
#define FCDECL5(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a2, a5, a4, a3)
#define FCDECL6(rettype, funcname, a1, a2, a3, a4, a5, a6) rettype F_CALL_CONV funcname(a1, a2, a6, a5, a4, a3)
#define FCDECL7(rettype, funcname, a1, a2, a3, a4, a5, a6, a7) rettype F_CALL_CONV funcname(a1, a2, a7, a6, a5, a4, a3)
#define FCDECL8(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8) rettype F_CALL_CONV funcname(a1, a2, a8, a7, a6, a5, a4, a3)
#define FCDECL9(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9) rettype F_CALL_CONV funcname(a1, a2, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL10(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) rettype F_CALL_CONV funcname(a1, a2, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL11(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) rettype F_CALL_CONV funcname(a1, a2, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL12(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) rettype F_CALL_CONV funcname(a1, a2, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL13(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) rettype F_CALL_CONV funcname(a1, a2, a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL14(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) rettype F_CALL_CONV funcname(a1, a2, a14, a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a3, a5, a4, a2)
#define FCDECL5_VII(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a2, a3, a5, a4, a1)
#endif // !SWIZZLE_REGARG_ORDER
#if 0
//
// don't use something like this... directly calling an FCALL from within the runtime breaks stackwalking because
// the FCALL reverse mapping only gets established in ECall::GetFCallImpl and that codepath is circumvented by
// directly calling and FCALL
// See below for usage of FC_CALL_INNER (used in SecurityStackWalk::Check presently)
//
#define FCCALL0(funcname) funcname()
#define FCCALL1(funcname, a1) funcname(a1)
#define FCCALL2(funcname, a1, a2) funcname(a1, a2)
#define FCCALL3(funcname, a1, a2, a3) funcname(a1, a2, a3)
#define FCCALL4(funcname, a1, a2, a3, a4) funcname(a1, a2, a4, a3)
#define FCCALL5(funcname, a1, a2, a3, a4, a5) funcname(a1, a2, a5, a4, a3)
#define FCCALL6(funcname, a1, a2, a3, a4, a5, a6) funcname(a1, a2, a6, a5, a4, a3)
#define FCCALL7(funcname, a1, a2, a3, a4, a5, a6, a7) funcname(a1, a2, a7, a6, a5, a4, a3)
#define FCCALL8(funcname, a1, a2, a3, a4, a5, a6, a7, a8) funcname(a1, a2, a8, a7, a6, a5, a4, a3)
#define FCCALL9(funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9) funcname(a1, a2, a9, a8, a7, a6, a5, a4, a3)
#define FCCALL10(funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) funcname(a1, a2, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCCALL11(funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) funcname(a1, a2, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCCALL12(funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) funcname(a1, a2, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#endif // 0
#else // !SWIZZLE_STKARG_ORDER
#define FCDECL0(rettype, funcname) rettype F_CALL_CONV funcname()
#define FCDECL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1)
#define FCDECL1_V(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1)
#define FCDECL2(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2)
#define FCDECL2VA(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2, ...)
#define FCDECL2_VV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2)
#define FCDECL2_VI(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2)
#define FCDECL2_IV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2)
#define FCDECL3(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL3_IIV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL3_VII(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL3_IVV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL3_IVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL3_VVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL3_VVV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL4(rettype, funcname, a1, a2, a3, a4) rettype F_CALL_CONV funcname(a1, a2, a3, a4)
#define FCDECL5(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5)
#define FCDECL6(rettype, funcname, a1, a2, a3, a4, a5, a6) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6)
#define FCDECL7(rettype, funcname, a1, a2, a3, a4, a5, a6, a7) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7)
#define FCDECL8(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8)
#define FCDECL9(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9)
#define FCDECL10(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
#define FCDECL11(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)
#define FCDECL12(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)
#define FCDECL13(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13)
#define FCDECL14(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)
#define FCDECL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5)
#define FCDECL5_VII(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5)
#endif // !SWIZZLE_STKARG_ORDER
#define HELPER_FRAME_DECL(x) FrameWithCookie<HelperMethodFrame_##x##OBJ> __helperframe
// use the capture state machinery if the architecture has one
//
// For a normal build we create a loop (see explaination on RestoreState below)
// We don't want a loop here for PREFAST since that causes
// warning 263: Using _alloca in a loop
// And we can't use DEBUG_OK_TO_RETURN for PREFAST because the PREFAST version
// requires that you already be in a DEBUG_ASSURE_NO_RETURN_BEGIN scope
#define HelperMethodFrame_0OBJ HelperMethodFrame
#define HELPER_FRAME_ARGS(attribs) __me, attribs
#define FORLAZYMACHSTATE(x) x
#if defined(_PREFAST_)
#define FORLAZYMACHSTATE_BEGINLOOP(x) x
#define FORLAZYMACHSTATE_ENDLOOP(x)
#define FORLAZYMACHSTATE_DEBUG_OK_TO_RETURN_BEGIN
#define FORLAZYMACHSTATE_DEBUG_OK_TO_RETURN_END
#else
#define FORLAZYMACHSTATE_BEGINLOOP(x) x do
#define FORLAZYMACHSTATE_ENDLOOP(x) while(x)
#define FORLAZYMACHSTATE_DEBUG_OK_TO_RETURN_BEGIN DEBUG_OK_TO_RETURN_BEGIN(LAZYMACHSTATE)
#define FORLAZYMACHSTATE_DEBUG_OK_TO_RETURN_END DEBUG_OK_TO_RETURN_END(LAZYMACHSTATE)
#endif
// BEGIN: before gcpoll
//FCallGCCanTriggerNoDtor __fcallGcCanTrigger;
//__fcallGcCanTrigger.Enter();
// END: after gcpoll
//__fcallGcCanTrigger.Leave(__FUNCTION__, __FILE__, __LINE__);
// We have to put DEBUG_OK_TO_RETURN_BEGIN around the FORLAZYMACHSTATE
// to allow the HELPER_FRAME to be installed inside an SO_INTOLERANT region
// which does not allow a return. The return is used by FORLAZYMACHSTATE
// to capture the state, but is not an actual return, so it is ok.
#define HELPER_METHOD_FRAME_BEGIN_EX_BODY(ret, helperFrame, gcpoll, allowGC) \
FORLAZYMACHSTATE_BEGINLOOP(int alwaysZero = 0;) \
{ \
INDEBUG(static BOOL __haveCheckedRestoreState = FALSE;) \
PERMIT_HELPER_METHOD_FRAME_BEGIN(); \
CHECK_HELPER_METHOD_FRAME_PERMITTED(); \
helperFrame; \
FORLAZYMACHSTATE_DEBUG_OK_TO_RETURN_BEGIN; \
FORLAZYMACHSTATE(CAPTURE_STATE(__helperframe.MachineState(), ret);) \
FORLAZYMACHSTATE_DEBUG_OK_TO_RETURN_END; \
INDEBUG(__helperframe.SetAddrOfHaveCheckedRestoreState(&__haveCheckedRestoreState)); \
DEBUG_ASSURE_NO_RETURN_BEGIN(HELPER_METHOD_FRAME); \
INCONTRACT(FCallGCCanTrigger::Enter());
#define HELPER_METHOD_FRAME_BEGIN_EX(ret, helperFrame, gcpoll, allowGC) \
HELPER_METHOD_FRAME_BEGIN_EX_BODY(ret, helperFrame, gcpoll, allowGC) \
/* <TODO>TODO TURN THIS ON!!! </TODO> */ \
/* gcpoll; */ \
INSTALL_MANAGED_EXCEPTION_DISPATCHER; \
__helperframe.Push(); \
MAKE_CURRENT_THREAD_AVAILABLE_EX(__helperframe.GetThread()); \
INSTALL_UNWIND_AND_CONTINUE_HANDLER_FOR_HMF(&__helperframe);
#define HELPER_METHOD_FRAME_BEGIN_EX_NOTHROW(ret, helperFrame, gcpoll, allowGC, probeFailExpr) \
HELPER_METHOD_FRAME_BEGIN_EX_BODY(ret, helperFrame, gcpoll, allowGC) \
__helperframe.Push(); \
MAKE_CURRENT_THREAD_AVAILABLE_EX(__helperframe.GetThread()); \
/* <TODO>TODO TURN THIS ON!!! </TODO> */ \
/* gcpoll; */
// The while(__helperframe.RestoreState() needs a bit of explanation.
// The issue is insuring that the same machine state (which registers saved)
// exists when the machine state is probed (when the frame is created, and
// when it is actually used (when the frame is popped. We do this by creating
// a flow of control from use to def. Note that 'RestoreState' always returns false
// we never actually loop, but the compiler does not know that, and thus
// will be forced to make the keep the state of register spills the same at
// the two locations.
#define HELPER_METHOD_FRAME_END_EX_BODY(gcpoll,allowGC) \
/* <TODO>TODO TURN THIS ON!!! </TODO> */ \
/* gcpoll; */ \
DEBUG_ASSURE_NO_RETURN_END(HELPER_METHOD_FRAME); \
INCONTRACT(FCallGCCanTrigger::Leave(__FUNCTION__, __FILE__, __LINE__)); \
FORLAZYMACHSTATE(alwaysZero = \
HelperMethodFrameRestoreState(INDEBUG_COMMA(&__helperframe) \
__helperframe.MachineState());) \
PERMIT_HELPER_METHOD_FRAME_END() \
} FORLAZYMACHSTATE_ENDLOOP(alwaysZero);
#define HELPER_METHOD_FRAME_END_EX(gcpoll,allowGC) \
UNINSTALL_UNWIND_AND_CONTINUE_HANDLER; \
__helperframe.Pop(); \
UNINSTALL_MANAGED_EXCEPTION_DISPATCHER; \
HELPER_METHOD_FRAME_END_EX_BODY(gcpoll,allowGC);
#define HELPER_METHOD_FRAME_END_EX_NOTHROW(gcpoll,allowGC) \
__helperframe.Pop(); \
HELPER_METHOD_FRAME_END_EX_BODY(gcpoll,allowGC);
#define HELPER_METHOD_FRAME_BEGIN_ATTRIB(attribs) \
HELPER_METHOD_FRAME_BEGIN_EX( \
return, \
HELPER_FRAME_DECL(0)(HELPER_FRAME_ARGS(attribs)), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_0() \
HELPER_METHOD_FRAME_BEGIN_ATTRIB(Frame::FRAME_ATTR_NONE)
#define HELPER_METHOD_FRAME_BEGIN_ATTRIB_NOPOLL(attribs) \
HELPER_METHOD_FRAME_BEGIN_EX( \
return, \
HELPER_FRAME_DECL(0)(HELPER_FRAME_ARGS(attribs)), \
{},FALSE)
#define HELPER_METHOD_FRAME_BEGIN_NOPOLL() HELPER_METHOD_FRAME_BEGIN_ATTRIB_NOPOLL(Frame::FRAME_ATTR_NONE)
#define HELPER_METHOD_FRAME_BEGIN_ATTRIB_1(attribs, arg1) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_EX( \
return, \
HELPER_FRAME_DECL(1)(HELPER_FRAME_ARGS(attribs), \
(OBJECTREF*) &arg1), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_1(arg1) HELPER_METHOD_FRAME_BEGIN_ATTRIB_1(Frame::FRAME_ATTR_NONE, arg1)
#define HELPER_METHOD_FRAME_BEGIN_ATTRIB_2(attribs, arg1, arg2) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
static_assert(sizeof(arg2) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_EX( \
return, \
HELPER_FRAME_DECL(2)(HELPER_FRAME_ARGS(attribs), \
(OBJECTREF*) &arg1, (OBJECTREF*) &arg2), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_2(arg1, arg2) HELPER_METHOD_FRAME_BEGIN_ATTRIB_2(Frame::FRAME_ATTR_NONE, arg1, arg2)
#define HELPER_METHOD_FRAME_BEGIN_ATTRIB_3(attribs, arg1, arg2, arg3) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
static_assert(sizeof(arg2) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
static_assert(sizeof(arg3) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_EX( \
return, \
HELPER_FRAME_DECL(3)(HELPER_FRAME_ARGS(attribs), \
(OBJECTREF*) &arg1, (OBJECTREF*) &arg2, (OBJECTREF*) &arg3), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_3(arg1, arg2, arg3) HELPER_METHOD_FRAME_BEGIN_ATTRIB_3(Frame::FRAME_ATTR_NONE, arg1, arg2, arg3)
#define HELPER_METHOD_FRAME_BEGIN_PROTECT(gc) \
HELPER_METHOD_FRAME_BEGIN_EX( \
return, \
HELPER_FRAME_DECL(PROTECT)(HELPER_FRAME_ARGS(Frame::FRAME_ATTR_NONE), \
(OBJECTREF*)&(gc), sizeof(gc)/sizeof(OBJECTREF)), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_NOPOLL(attribs) \
HELPER_METHOD_FRAME_BEGIN_EX( \
return 0, \
HELPER_FRAME_DECL(0)(HELPER_FRAME_ARGS(attribs)), \
{},FALSE)
#define HELPER_METHOD_FRAME_BEGIN_RET_VC_ATTRIB_NOPOLL(attribs) \
HELPER_METHOD_FRAME_BEGIN_EX( \
FC_RETURN_VC(), \
HELPER_FRAME_DECL(0)(HELPER_FRAME_ARGS(attribs)), \
{},FALSE)
#define HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB(attribs) \
HELPER_METHOD_FRAME_BEGIN_EX( \
return 0, \
HELPER_FRAME_DECL(0)(HELPER_FRAME_ARGS(attribs)), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_RET_0() \
HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB(Frame::FRAME_ATTR_NONE)
#define HELPER_METHOD_FRAME_BEGIN_RET_VC_0() \
HELPER_METHOD_FRAME_BEGIN_EX( \
FC_RETURN_VC(), \
HELPER_FRAME_DECL(0)(HELPER_FRAME_ARGS(Frame::FRAME_ATTR_NONE)), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_1(attribs, arg1) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_EX( \
return 0, \
HELPER_FRAME_DECL(1)(HELPER_FRAME_ARGS(attribs), \
(OBJECTREF*) &arg1), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_RET_NOTHROW_1(probeFailExpr, arg1) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_EX_NOTHROW( \
return 0, \
HELPER_FRAME_DECL(1)(HELPER_FRAME_ARGS(Frame::FRAME_ATTR_NO_THREAD_ABORT), \
(OBJECTREF*) &arg1), \
HELPER_METHOD_POLL(), TRUE, probeFailExpr)
#define HELPER_METHOD_FRAME_BEGIN_RET_VC_ATTRIB_1(attribs, arg1) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_EX( \
FC_RETURN_VC(), \
HELPER_FRAME_DECL(1)(HELPER_FRAME_ARGS(attribs), \
(OBJECTREF*) &arg1), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_2(attribs, arg1, arg2) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
static_assert(sizeof(arg2) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_EX( \
return 0, \
HELPER_FRAME_DECL(2)(HELPER_FRAME_ARGS(attribs), \
(OBJECTREF*) &arg1, (OBJECTREF*) &arg2), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_RET_VC_ATTRIB_2(attribs, arg1, arg2) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
static_assert(sizeof(arg2) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_EX( \
FC_RETURN_VC(), \
HELPER_FRAME_DECL(2)(HELPER_FRAME_ARGS(attribs), \
(OBJECTREF*) &arg1, (OBJECTREF*) &arg2), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_PROTECT(attribs, gc) \
HELPER_METHOD_FRAME_BEGIN_EX( \
return 0, \
HELPER_FRAME_DECL(PROTECT)(HELPER_FRAME_ARGS(attribs), \
(OBJECTREF*)&(gc), sizeof(gc)/sizeof(OBJECTREF)), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_RET_VC_NOPOLL() \
HELPER_METHOD_FRAME_BEGIN_RET_VC_ATTRIB_NOPOLL(Frame::FRAME_ATTR_NONE)
#define HELPER_METHOD_FRAME_BEGIN_RET_NOPOLL() \
HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_NOPOLL(Frame::FRAME_ATTR_NONE)
#define HELPER_METHOD_FRAME_BEGIN_RET_1(arg1) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_1(Frame::FRAME_ATTR_NONE, arg1)
#define HELPER_METHOD_FRAME_BEGIN_RET_VC_1(arg1) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_RET_VC_ATTRIB_1(Frame::FRAME_ATTR_NONE, arg1)
#define HELPER_METHOD_FRAME_BEGIN_RET_2(arg1, arg2) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
static_assert(sizeof(arg2) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_2(Frame::FRAME_ATTR_NONE, arg1, arg2)
#define HELPER_METHOD_FRAME_BEGIN_RET_VC_2(arg1, arg2) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
static_assert(sizeof(arg2) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_RET_VC_ATTRIB_2(Frame::FRAME_ATTR_NONE, arg1, arg2)
#define HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc) \
HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_PROTECT(Frame::FRAME_ATTR_NONE, gc)
#define HELPER_METHOD_FRAME_END() HELPER_METHOD_FRAME_END_EX({},FALSE)
#define HELPER_METHOD_FRAME_END_POLL() HELPER_METHOD_FRAME_END_EX(HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_END_NOTHROW()HELPER_METHOD_FRAME_END_EX_NOTHROW({},FALSE)
// This is the fastest way to do a GC poll if you have already erected a HelperMethodFrame
#define HELPER_METHOD_POLL() { __helperframe.Poll(); INCONTRACT(__fCallCheck.SetDidPoll()); }
// The HelperMethodFrame knows how to get its return address. Let other code get at it, too.
// (Uses comma operator to call InsureInit & discard result.
#define HELPER_METHOD_FRAME_GET_RETURN_ADDRESS() \
( static_cast<UINT_PTR>( (__helperframe.InsureInit(false, NULL)), (__helperframe.MachineState()->GetRetAddr()) ) )
// Very short routines, or routines that are guarenteed to force GC or EH
// don't need to poll the GC. USE VERY SPARINGLY!!!
#define FC_GC_POLL_NOT_NEEDED() INCONTRACT(__fCallCheck.SetNotNeeded())
Object* FC_GCPoll(void* me, Object* objToProtect = NULL);
#define FC_GC_POLL_EX(ret) \
{ \
INCONTRACT(Thread::TriggersGC(GetThread());) \
INCONTRACT(__fCallCheck.SetDidPoll();) \
if (g_TrapReturningThreads.LoadWithoutBarrier()) \
{ \
if (FC_GCPoll(__me)) \
return ret; \
while (0 == FC_NO_TAILCALL) { }; /* side effect the compile can't remove */ \
} \
}
#define FC_GC_POLL() FC_GC_POLL_EX(;)
#define FC_GC_POLL_RET() FC_GC_POLL_EX(0)
#define FC_GC_POLL_AND_RETURN_OBJREF(obj) \
{ \
INCONTRACT(__fCallCheck.SetDidPoll();) \
Object* __temp = OBJECTREFToObject(obj); \
if (g_TrapReturningThreads.LoadWithoutBarrier()) \
{ \
__temp = FC_GCPoll(__me, __temp); \
while (0 == FC_NO_TAILCALL) { }; /* side effect the compile can't remove */ \
} \
return __temp; \
}
#if defined(ENABLE_CONTRACTS)
#define FC_CAN_TRIGGER_GC() FCallGCCanTrigger::Enter()
#define FC_CAN_TRIGGER_GC_END() FCallGCCanTrigger::Leave(__FUNCTION__, __FILE__, __LINE__)
#define FC_CAN_TRIGGER_GC_HAVE_THREAD(thread) FCallGCCanTrigger::Enter(thread)
#define FC_CAN_TRIGGER_GC_HAVE_THREADEND(thread) FCallGCCanTrigger::Leave(thread, __FUNCTION__, __FILE__, __LINE__)
// turns on forbidGC for the lifetime of the instance
class ForbidGC {
protected:
Thread *m_pThread;
public:
ForbidGC(const char *szFile, int lineNum);
~ForbidGC();
};
// this little helper class checks to make certain
// 1) ForbidGC is set throughout the routine.
// 2) Sometime during the routine, a GC poll is done
class FCallCheck : public ForbidGC {
public:
FCallCheck(const char *szFile, int lineNum);
~FCallCheck();
void SetDidPoll() {LIMITED_METHOD_CONTRACT; didGCPoll = true; }
void SetNotNeeded() {LIMITED_METHOD_CONTRACT; notNeeded = true; }
private:
#ifdef _DEBUG
DWORD unbreakableLockCount;
#endif
bool didGCPoll; // GC poll was done
bool notNeeded; // GC poll not needed
unsigned __int64 startTicks; // tick count at beginning of FCall
};
// FC_COMMON_PROLOG is used for both FCalls and HCalls
#define FC_COMMON_PROLOG(target, assertFn) \
/* The following line has to be first. We do not want to trash last error */ \
DWORD __lastError = ::GetLastError(); \
static void* __cache = 0; \
assertFn(__cache, (LPVOID)target); \
{ \
Thread *_pThread = GetThread(); \
Thread::ObjectRefFlush(_pThread); \
} \
FCallCheck __fCallCheck(__FILE__, __LINE__); \
FCALL_TRANSITION_BEGIN(); \
::SetLastError(__lastError); \
void FCallAssert(void*& cache, void* target);
void HCallAssert(void*& cache, void* target);
#else
#define FC_COMMON_PROLOG(target, assertFn) FCALL_TRANSITION_BEGIN()
#define FC_CAN_TRIGGER_GC()
#define FC_CAN_TRIGGER_GC_END()
#endif // ENABLE_CONTRACTS
// #FC_INNER
// Macros that allows fcall to be split into two function to avoid the helper frame overhead on common fast
// codepaths.
//
// The helper routine needs to know the name of the routine that called it so that it can look up the name of
// the managed routine this code is associted with (for managed stack traces). This is passed with the
// FC_INNER_PROLOG macro.
//
// The helper can set up a HELPER_METHOD_FRAME, but should pass the
// Frame::FRAME_ATTR_EXACT_DEPTH|Frame::FRAME_ATTR_CAPTURE_DEPTH_2 which indicates the exact number of
// unwinds to do to get back to managed code. Currently we only support depth 2 which means that the
// HELPER_METHOD_FRAME needs to be set up in the function directly called by the FCALL. The helper should
// use the NOINLINE macro to prevent the compiler from inlining it into the FCALL (which would obviously
// mess up the unwind count).
//
// The other invarient that needs to hold is that the epilog walker needs to be able to get from the call to
// the helper routine to the end of the FCALL using trivial heurisitics. The easiest (and only supported)
// way of doing this is to place your helper right before a return (eg at the end of the method). Generally
// this is not a problem at all, since the FCALL itself will pick off some common case and then tail-call to
// the helper for everything else. You must use the code:FC_INNER_RETURN macros to do the call, to insure
// that the C++ compiler does not tail-call optimize the call to the inner function and mess up the stack
// depth.
//
// see code:ObjectNative::GetClass for an example
//
#define FC_INNER_PROLOG(outerfuncname) \
LPVOID __me; \
__me = GetEEFuncEntryPointMacro(outerfuncname); \
FC_CAN_TRIGGER_GC(); \
INCONTRACT(FCallCheck __fCallCheck(__FILE__, __LINE__));
// This variant should be used for inner fcall functions that have the
// __me value passed as an argument to the function. This allows
// inner functions to be shared across multiple fcalls.
#define FC_INNER_PROLOG_NO_ME_SETUP() \
FC_CAN_TRIGGER_GC(); \
INCONTRACT(FCallCheck __fCallCheck(__FILE__, __LINE__));
#define FC_INNER_EPILOG() \
FC_CAN_TRIGGER_GC_END();
// If you are using FC_INNER, and you are tail calling to the helper method (a common case), then you need
// to use the FC_INNER_RETURN macros (there is one for methods that return a value and another if the
// function returns void). This macro's purpose is to inhibit any tail calll optimization the C++ compiler
// might do, which would otherwise confuse the epilog walker.
//
// * See #FC_INNER for more
extern RAW_KEYWORD(volatile) int FC_NO_TAILCALL;
#define FC_INNER_RETURN(type, expr) \
type __retVal = expr; \
while (0 == FC_NO_TAILCALL) { }; /* side effect the compile can't remove */ \
return(__retVal);
#define FC_INNER_RETURN_VOID(stmt) \
stmt; \
while (0 == FC_NO_TAILCALL) { }; /* side effect the compile can't remove */ \
return;
//==============================================================================================
// FIMPLn: A set of macros for generating the proto for the actual
// implementation (use FDECLN for header protos.)
//
// The hidden "__me" variable lets us recover the original MethodDesc*
// so any thrown exceptions will have the correct stack trace. FCThrow()
// passes this along to __FCThrowInternal().
//==============================================================================================
#define GetEEFuncEntryPointMacro(func) ((LPVOID)(func))
#define FCIMPL_PROLOG(funcname) \
LPVOID __me; \
__me = GetEEFuncEntryPointMacro(funcname); \
FC_COMMON_PROLOG(__me, FCallAssert)
#if defined(_DEBUG) && !defined(__GNUC__)
// Build the list of all fcalls signatures. It is used in binder.cpp to verify
// compatibility of managed and unmanaged fcall signatures. The check is currently done
// for x86 only.
#define CHECK_FCALL_SIGNATURE
#endif
#ifdef CHECK_FCALL_SIGNATURE
struct FCSigCheck {
public:
FCSigCheck(void* fnc, const char* sig)
{
LIMITED_METHOD_CONTRACT;
func = fnc;
signature = sig;
next = g_pFCSigCheck;
g_pFCSigCheck = this;
}
FCSigCheck* next;
void* func;
const char* signature;
static FCSigCheck* g_pFCSigCheck;
};
#define FCSIGCHECK(funcname, signature) \
static FCSigCheck UNIQUE_LABEL(FCSigCheck)(GetEEFuncEntryPointMacro(funcname), signature);
#else // CHECK_FCALL_SIGNATURE
#define FCSIGCHECK(funcname, signature)
#endif // !CHECK_FCALL_SIGNATURE
#ifdef SWIZZLE_STKARG_ORDER
#ifdef SWIZZLE_REGARG_ORDER
#define FCIMPL0(rettype, funcname) rettype F_CALL_CONV funcname() { FCIMPL_PROLOG(funcname)
#define FCIMPL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL1_V(rettype, funcname, a1) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, int /* ECX */, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL2(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_VV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, int /* ECX */, a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_VI(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_IV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL3(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IIV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VII(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a3, a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IVV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1, a3, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a3, a1, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a3, a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VVV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, int /* ECX */, a3, a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL4(rettype, funcname, a1, a2, a3, a4) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL5(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL6(rettype, funcname, a1, a2, a3, a4, a5, a6) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL7(rettype, funcname, a1, a2, a3, a4, a5, a6, a7) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL8(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL9(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL10(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL11(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a11, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL12(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL13(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL14(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a14, a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a3, a1, a5, a4, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL5_VII(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a3, a2, a5, a4, a1) { FCIMPL_PROLOG(funcname)
#else // SWIZZLE_REGARG_ORDER
#define FCIMPL0(rettype, funcname) FCSIGCHECK(funcname, #rettype) \
rettype F_CALL_CONV funcname() { FCIMPL_PROLOG(funcname)
#define FCIMPL1(rettype, funcname, a1) FCSIGCHECK(funcname, #rettype "," #a1) \
rettype F_CALL_CONV funcname(a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL1_V(rettype, funcname, a1) FCSIGCHECK(funcname, #rettype "," "V" #a1) \
rettype F_CALL_CONV funcname(a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL2(rettype, funcname, a1, a2) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2) \
rettype F_CALL_CONV funcname(a1, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL2VA(rettype, funcname, a1, a2) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," "...") \
rettype F_CALL_VA_CONV funcname(a1, a2, ...) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_VV(rettype, funcname, a1, a2) FCSIGCHECK(funcname, #rettype "," "V" #a1 "," "V" #a2) \
rettype F_CALL_CONV funcname(a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_VI(rettype, funcname, a1, a2) FCSIGCHECK(funcname, #rettype "," "V" #a1 "," #a2) \
rettype F_CALL_CONV funcname(a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_IV(rettype, funcname, a1, a2) FCSIGCHECK(funcname, #rettype "," #a1 "," "V" #a2) \
rettype F_CALL_CONV funcname(a1, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL3(rettype, funcname, a1, a2, a3) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3) \
rettype F_CALL_CONV funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IIV(rettype, funcname, a1, a2, a3) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," "V" #a3) \
rettype F_CALL_CONV funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VII(rettype, funcname, a1, a2, a3) FCSIGCHECK(funcname, #rettype "," "V" #a1 "," #a2 "," #a3) \
rettype F_CALL_CONV funcname(a2, a3, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IVV(rettype, funcname, a1, a2, a3) FCSIGCHECK(funcname, #rettype "," #a1 "," "V" #a2 "," "V" #a3) \
rettype F_CALL_CONV funcname(a1, a3, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IVI(rettype, funcname, a1, a2, a3) FCSIGCHECK(funcname, #rettype "," #a1 "," "V" #a2 "," #a3) \
rettype F_CALL_CONV funcname(a1, a3, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VVI(rettype, funcname, a1, a2, a3) FCSIGCHECK(funcname, #rettype "," "V" #a1 "," "V" #a2 "," #a3) \
rettype F_CALL_CONV funcname(a2, a1, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VVV(rettype, funcname, a1, a2, a3) FCSIGCHECK(funcname, #rettype "," "V" #a1 "," "V" #a2 "," "V" #a3) \
rettype F_CALL_CONV funcname(a3, a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL4(rettype, funcname, a1, a2, a3, a4) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4) \
rettype F_CALL_CONV funcname(a1, a2, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL5(rettype, funcname, a1, a2, a3, a4, a5) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5) \
rettype F_CALL_CONV funcname(a1, a2, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL6(rettype, funcname, a1, a2, a3, a4, a5, a6) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6) \
rettype F_CALL_CONV funcname(a1, a2, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL7(rettype, funcname, a1, a2, a3, a4, a5, a6, a7) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6 "," #a7) \
rettype F_CALL_CONV funcname(a1, a2, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL8(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6 "," #a7 "," #a8) \
rettype F_CALL_CONV funcname(a1, a2, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL9(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6 "," #a7 "," #a8 "," #a9) \
rettype F_CALL_CONV funcname(a1, a2, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL10(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6 "," #a7 "," #a8 "," #a9 "," #a10) \
rettype F_CALL_CONV funcname(a1, a2, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL11(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6 "," #a7 "," #a8 "," #a9 "," #a10 "," #a11) \
rettype F_CALL_CONV funcname(a1, a2, a11, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL12(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6 "," #a7 "," #a8 "," #a9 "," #a10 "," #a11 "," #a12) \
rettype F_CALL_CONV funcname(a1, a2, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL13(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6 "," #a7 "," #a8 "," #a9 "," #a10 "," #a11 "," #a12 "," #a13) \
rettype F_CALL_CONV funcname(a1, a2, a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL14(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6 "," #a7 "," #a8 "," #a9 "," #a10 "," #a11 "," #a12 "," #a13 "," #a14) \
rettype F_CALL_CONV funcname(a1, a2, a14, a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) FCSIGCHECK(funcname, #rettype "," #a1 "," "V" #a2 "," #a3 "," #a4 "," #a5) \
rettype F_CALL_CONV funcname(a1, a3, a5, a4, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL5_VII(rettype, funcname, a1, a2, a3, a4, a5) FCSIGCHECK(funcname, #rettype "," "V" #a1 "," #a2 "," #a3 "," #a4 "," #a5) \
rettype F_CALL_CONV funcname(a2, a3, a5, a4, a1) { FCIMPL_PROLOG(funcname)
#endif // !SWIZZLE_REGARG_ORDER
#else // SWIZZLE_STKARG_ORDER
#define FCIMPL0(rettype, funcname) rettype funcname() { FCIMPL_PROLOG(funcname)
#define FCIMPL1(rettype, funcname, a1) rettype funcname(a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL1_V(rettype, funcname, a1) rettype funcname(a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL2(rettype, funcname, a1, a2) rettype funcname(a1, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL2VA(rettype, funcname, a1, a2) rettype funcname(a1, a2, ...) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_VV(rettype, funcname, a1, a2) rettype funcname(a1, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_VI(rettype, funcname, a1, a2) rettype funcname(a1, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_IV(rettype, funcname, a1, a2) rettype funcname(a1, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL3(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IIV(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IVV(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VII(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IVI(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VVI(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VVV(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL4(rettype, funcname, a1, a2, a3, a4) rettype funcname(a1, a2, a3, a4) { FCIMPL_PROLOG(funcname)
#define FCIMPL5(rettype, funcname, a1, a2, a3, a4, a5) rettype funcname(a1, a2, a3, a4, a5) { FCIMPL_PROLOG(funcname)
#define FCIMPL6(rettype, funcname, a1, a2, a3, a4, a5, a6) rettype funcname(a1, a2, a3, a4, a5, a6) { FCIMPL_PROLOG(funcname)
#define FCIMPL7(rettype, funcname, a1, a2, a3, a4, a5, a6, a7) rettype funcname(a1, a2, a3, a4, a5, a6, a7) { FCIMPL_PROLOG(funcname)
#define FCIMPL8(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8) { FCIMPL_PROLOG(funcname)
#define FCIMPL9(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9) { FCIMPL_PROLOG(funcname)
#define FCIMPL10(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { FCIMPL_PROLOG(funcname)
#define FCIMPL11(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) { FCIMPL_PROLOG(funcname)
#define FCIMPL12(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) { FCIMPL_PROLOG(funcname)
#define FCIMPL13(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) { FCIMPL_PROLOG(funcname)
#define FCIMPL14(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) { FCIMPL_PROLOG(funcname)
#define FCIMPL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) rettype funcname(a1, a2, a3, a4, a5) { FCIMPL_PROLOG(funcname)
#define FCIMPL5_VII(rettype, funcname, a1, a2, a3, a4, a5) rettype funcname(a1, a2, a3, a4, a5) { FCIMPL_PROLOG(funcname)
#endif // !SWIZZLE_STKARG_ORDER
//==============================================================================================
// Use this to terminte an FCIMPLEND.
//==============================================================================================
#define FCIMPL_EPILOG() FCALL_TRANSITION_END()
#define FCIMPLEND FCIMPL_EPILOG(); }
#define HCIMPL_PROLOG(funcname) LPVOID __me; __me = 0; FC_COMMON_PROLOG(funcname, HCallAssert)
// HCIMPL macros are just like their FCIMPL counterparts, however
// they do not remember the function they come from. Thus they will not
// show up in a stack trace. This is what you want for JIT helpers and the like
#ifdef SWIZZLE_STKARG_ORDER
#ifdef SWIZZLE_REGARG_ORDER
#define HCIMPL0(rettype, funcname) rettype F_CALL_CONV funcname() { HCIMPL_PROLOG(funcname)
#define HCIMPL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL1_RAW(rettype, funcname, a1) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1) {
#define HCIMPL1_V(rettype, funcname, a1) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, int /* ECX */, a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL2(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL2_RAW(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1) {
#define HCIMPL2_VV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, int /* ECX */, a2, a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL2_IV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1, a2) { HCIMPL_PROLOG(funcname)
#define HCIMPL3(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a3) { HCIMPL_PROLOG(funcname)
#define HCIMPL3_RAW(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a3) {
#define HCIMPL4(rettype, funcname, a1, a2, a3, a4) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a4, a3) { HCIMPL_PROLOG(funcname)
#define HCIMPL5(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a5, a4, a3) { HCIMPL_PROLOG(funcname)
#define HCCALL0(funcname) funcname()
#define HCCALL1(funcname, a1) funcname(0, 0, a1)
#define HCCALL1_V(funcname, a1) funcname(0, 0, 0, a1)
#define HCCALL2(funcname, a1, a2) funcname(0, a2, a1)
#define HCCALL3(funcname, a1, a2, a3) funcname(0, a2, a1, a3)
#define HCCALL4(funcname, a1, a2, a3, a4) funcname(0, a2, a1, a4, a3)
#define HCCALL5(funcname, a1, a2, a3, a4, a5) funcname(0, a2, a1, a5, a4, a3)
#define HCCALL1_PTR(rettype, funcptr, a1) rettype (F_CALL_CONV * funcptr)(int /* EAX */, int /* EDX */, a1)
#define HCCALL2_PTR(rettype, funcptr, a1, a2) rettype (F_CALL_CONV * funcptr)(int /* EAX */, a2, a1)
#else // SWIZZLE_REGARG_ORDER
#define HCIMPL0(rettype, funcname) rettype F_CALL_CONV funcname() { HCIMPL_PROLOG(funcname)
#define HCIMPL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL1_RAW(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1) {
#define HCIMPL1_V(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL2(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2) { HCIMPL_PROLOG(funcname)
#define HCIMPL2_RAW(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2) {
#define HCIMPL2_VV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a2, a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL2_IV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2) { HCIMPL_PROLOG(funcname)
#define HCIMPL3(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3) { HCIMPL_PROLOG(funcname)
#define HCIMPL3_RAW(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3) {
#define HCIMPL4(rettype, funcname, a1, a2, a3, a4) rettype F_CALL_CONV funcname(a1, a2, a4, a3) { HCIMPL_PROLOG(funcname)
#define HCIMPL5(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a2, a5, a4, a3) { HCIMPL_PROLOG(funcname)
#define HCCALL0(funcname) funcname()
#define HCCALL1(funcname, a1) funcname(a1)
#define HCCALL1_V(funcname, a1) funcname(a1)
#define HCCALL2(funcname, a1, a2) funcname(a1, a2)
#define HCCALL3(funcname, a1, a2, a3) funcname(a1, a2, a3)
#define HCCALL4(funcname, a1, a2, a3, a4) funcname(a1, a2, a4, a3)
#define HCCALL5(funcname, a1, a2, a3, a4, a5) funcname(a1, a2, a5, a4, a3)
#define HCCALL1_PTR(rettype, funcptr, a1) rettype (F_CALL_CONV * (funcptr))(a1)
#define HCCALL2_PTR(rettype, funcptr, a1, a2) rettype (F_CALL_CONV * (funcptr))(a1, a2)
#endif // !SWIZZLE_REGARG_ORDER
#else // SWIZZLE_STKARG_ORDER
#define HCIMPL0(rettype, funcname) rettype F_CALL_CONV funcname() { HCIMPL_PROLOG(funcname)
#define HCIMPL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL1_RAW(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1) {
#define HCIMPL1_V(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL2(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2) { HCIMPL_PROLOG(funcname)
#define HCIMPL2_RAW(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2) {
#define HCIMPL2_VV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2) { HCIMPL_PROLOG(funcname)
#define HCIMPL2_IV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2) { HCIMPL_PROLOG(funcname)
#define HCIMPL3(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3) { HCIMPL_PROLOG(funcname)
#define HCIMPL3_RAW(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3) {
#define HCIMPL4(rettype, funcname, a1, a2, a3, a4) rettype F_CALL_CONV funcname(a1, a2, a3, a4) { HCIMPL_PROLOG(funcname)
#define HCIMPL5(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5) { HCIMPL_PROLOG(funcname)
#define HCCALL0(funcname) funcname()
#define HCCALL1(funcname, a1) funcname(a1)
#define HCCALL1_V(funcname, a1) funcname(a1)
#define HCCALL2(funcname, a1, a2) funcname(a1, a2)
#define HCCALL3(funcname, a1, a2, a3) funcname(a1, a2, a3)
#define HCCALL4(funcname, a1, a2, a3, a4) funcname(a1, a2, a3, a4)
#define HCCALL5(funcname, a1, a2, a3, a4, a5) funcname(a1, a2, a3, a4, a5)
#define HCCALL1_PTR(rettype, funcptr, a1) rettype (F_CALL_CONV * (funcptr))(a1)
#define HCCALL2_PTR(rettype, funcptr, a1, a2) rettype (F_CALL_CONV * (funcptr))(a1, a2)
#endif // !SWIZZLE_STKARG_ORDER
#define HCIMPLEND_RAW }
#define HCIMPLEND FCALL_TRANSITION_END(); }
//==============================================================================================
// Throws an exception from an FCall. See rexcep.h for a list of valid
// exception codes.
//==============================================================================================
#define FCThrow(reKind) FCThrowEx(reKind, 0, 0, 0, 0)
//==============================================================================================
// This version lets you attach a message with inserts (similar to
// COMPlusThrow()).
//==============================================================================================
#define FCThrowEx(reKind, resID, arg1, arg2, arg3) \
{ \
while (NULL == \
__FCThrow(__me, reKind, resID, arg1, arg2, arg3)) {}; \
return 0; \
}
//==============================================================================================
// Like FCThrow but can be used for a VOID-returning FCall. The only
// difference is in the "return" statement.
//==============================================================================================
#define FCThrowVoid(reKind) FCThrowExVoid(reKind, 0, 0, 0, 0)
//==============================================================================================
// This version lets you attach a message with inserts (similar to
// COMPlusThrow()).
//==============================================================================================
#define FCThrowExVoid(reKind, resID, arg1, arg2, arg3) \
{ \
while (NULL == \
__FCThrow(__me, reKind, resID, arg1, arg2, arg3)) {}; \
return; \
}
// Use FCThrowRes to throw an exception with a localized error message from the
// ResourceManager in managed code.
#define FCThrowRes(reKind, resourceName) FCThrowArgumentEx(reKind, NULL, resourceName)
#define FCThrowArgumentNull(argName) FCThrowArgumentEx(kArgumentNullException, argName, NULL)
#define FCThrowArgumentOutOfRange(argName, message) FCThrowArgumentEx(kArgumentOutOfRangeException, argName, message)
#define FCThrowArgument(argName, message) FCThrowArgumentEx(kArgumentException, argName, message)
#define FCThrowArgumentEx(reKind, argName, resourceName) \
{ \
while (NULL == \
__FCThrowArgument(__me, reKind, argName, resourceName)) {}; \
return 0; \
}
// Use FCThrowRes to throw an exception with a localized error message from the
// ResourceManager in managed code.
#define FCThrowResVoid(reKind, resourceName) FCThrowArgumentVoidEx(reKind, NULL, resourceName)
#define FCThrowArgumentNullVoid(argName) FCThrowArgumentVoidEx(kArgumentNullException, argName, NULL)
#define FCThrowArgumentOutOfRangeVoid(argName, message) FCThrowArgumentVoidEx(kArgumentOutOfRangeException, argName, message)
#define FCThrowArgumentVoid(argName, message) FCThrowArgumentVoidEx(kArgumentException, argName, message)
#define FCThrowArgumentVoidEx(reKind, argName, resourceName) \
{ \
while (NULL == \
__FCThrowArgument(__me, reKind, argName, resourceName)) {}; \
return; \
}
// The x86 JIT calling convention expects returned small types (e.g. bool) to be
// widened on return. The C/C++ calling convention does not guarantee returned
// small types to be widened. The small types has to be artifically widened on return
// to fit x86 JIT calling convention. Thus fcalls returning small types has to
// use the FC_XXX_RET types to force C/C++ compiler to do the widening.
//
// The most common small return type of FCALLs is bool. The widening of bool is
// especially tricky since the value has to be also normalized. FC_BOOL_RET and
// FC_RETURN_BOOL macros are provided to make it fool-proof. FCALLs returning bool
// should be implemented using following pattern:
// FCIMPL0(FC_BOOL_RET, Foo) // the return type should be FC_BOOL_RET
// BOOL ret;
//
// FC_RETURN_BOOL(ret); // return statements should be FC_RETURN_BOOL
// FCIMPLEND
// This rules are verified in binder.cpp if COMPlus_ConsistencyCheck is set.
#ifdef _PREFAST_
// Use prefast build to ensure that functions returning FC_BOOL_RET
// are using FC_RETURN_BOOL to return it. Missing FC_RETURN_BOOL will
// result into type mismatch error in prefast builds. This will also
// catch misuses of FC_BOOL_RET for other places (e.g. in FCALL parameters).
typedef LPVOID FC_BOOL_RET;
#define FC_RETURN_BOOL(x) do { return (LPVOID)!!(x); } while(0)
#else
#if defined(TARGET_X86) || defined(TARGET_AMD64)
// The return value is artifically widened on x86 and amd64
typedef INT32 FC_BOOL_RET;
#else
typedef CLR_BOOL FC_BOOL_RET;
#endif
#define FC_RETURN_BOOL(x) do { return !!(x); } while(0)
#endif
#if defined(TARGET_X86) || defined(TARGET_AMD64)
// The return value is artifically widened on x86 and amd64
typedef UINT32 FC_CHAR_RET;
typedef INT32 FC_INT8_RET;
typedef UINT32 FC_UINT8_RET;
typedef INT32 FC_INT16_RET;
typedef UINT32 FC_UINT16_RET;
#else
typedef CLR_CHAR FC_CHAR_RET;
typedef INT8 FC_INT8_RET;
typedef UINT8 FC_UINT8_RET;
typedef INT16 FC_INT16_RET;
typedef UINT16 FC_UINT16_RET;
#endif
// FC_TypedByRef should be used for TypedReferences in FCall signatures
#define FC_TypedByRef TypedByRef
#define FC_DECIMAL DECIMAL
// The fcall entrypoints has to be at unique addresses. Use this helper macro to make
// the code of the fcalls unique if you get assert in ecall.cpp that mentions it.
// The parameter of the FCUnique macro is an arbitrary 32-bit random non-zero number.
#define FCUnique(unique) { Volatile<int> u = (unique); while (u.LoadWithoutBarrier() == 0) { }; }
// FCALL contracts come in two forms:
//
// Short form that should be used if the FCALL contract does not have any extras like preconditions, failure injection. Example:
//
// FCIMPL0(void, foo)
// {
// FCALL_CONTRACT;
// ...
//
// Long form that should be used otherwise. Example:
//
// FCIMPL1(void, foo, void *p)
// {
// CONTRACTL {
// FCALL_CHECK;
// PRECONDITION(CheckPointer(p));
// } CONTRACTL_END;
// ...
//
// FCALL_CHECK defines the actual contract conditions required for FCALLs
//
#define FCALL_CHECK \
THROWS; \
DISABLED(GC_TRIGGERS); /* FCALLS with HELPER frames have issues with GC_TRIGGERS */ \
MODE_COOPERATIVE;
//
// FCALL_CONTRACT should be the following shortcut:
//
// #define FCALL_CONTRACT CONTRACTL { FCALL_CHECK; } CONTRACTL_END;
//
// Since there is very little value in having runtime contracts in FCalls, FCALL_CONTRACT is defined as static contract only for performance reasons.
//
#define FCALL_CONTRACT \
STATIC_CONTRACT_THROWS; \
/* FCALLS are a special case contract wise, they are "NOTRIGGER, unless you setup a frame" */ \
STATIC_CONTRACT_GC_NOTRIGGER; \
STATIC_CONTRACT_MODE_COOPERATIVE
#endif //__FCall_h__
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// FCall.H
//
//
// FCall is a high-performance alternative to ECall. Unlike ECall, FCall
// methods do not necessarily create a frame. Jitted code calls directly
// to the FCall entry point. It is possible to do operations that need
// to have a frame within an FCall, you need to manually set up the frame
// before you do such operations.
// It is illegal to cause a GC or EH to happen in an FCALL before setting
// up a frame. To prevent accidentally violating this rule, FCALLs turn
// on BEGINGCFORBID, which insures that these things can't happen in a
// checked build without causing an ASSERTE. Once you set up a frame,
// this state is turned off as long as the frame is active, and then is
// turned on again when the frame is torn down. This mechanism should
// be sufficient to insure that the rules are followed.
// In general you set up a frame by using the following macros
// HELPER_METHOD_FRAME_BEGIN_RET*() // Use If the FCALL has a return value
// HELPER_METHOD_FRAME_BEGIN*() // Use If FCALL does not return a value
// HELPER_METHOD_FRAME_END*()
// These macros introduce a scope which is protected by an HelperMethodFrame.
// In this scope you can do EH or GC. There are rules associated with
// their use. In particular
// 1) These macros can only be used in the body of a FCALL (that is
// something using the FCIMPL* or HCIMPL* macros for their decaration.
// 2) You may not perform a 'return' within this scope..
// Compile time errors occur if you try to violate either of these rules.
// The frame that is set up does NOT protect any GC variables (in particular the
// arguments of the FCALL. Thus you need to do an explicit GCPROTECT once the
// frame is established if you need to protect an argument. There are flavors
// of HELPER_METHOD_FRAME that protect a certain number of GC variables. For
// example
// HELPER_METHOD_FRAME_BEGIN_RET_2(arg1, arg2)
// will protect the GC variables arg1, and arg2 as well as erecting the frame.
// Another invariant that you must be aware of is the need to poll to see if
// a GC is needed by some other thread. Unless the FCALL is VERY short,
// every code path through the FCALL must do such a poll. The important
// thing here is that a poll will cause a GC, and thus you can only do it
// when all you GC variables are protected. To make things easier
// HELPER_METHOD_FRAMES that protect things automatically do this poll.
// If you don't need to protect anything HELPER_METHOD_FRAME_BEGIN_0
// will also do the poll.
// Sometimes it is convenient to do the poll a the end of the frame, you
// can use HELPER_METHOD_FRAME_BEGIN_NOPOLL and HELPER_METHOD_FRAME_END_POLL
// to do the poll at the end. If somewhere in the middle is the best
// place you can do that too with HELPER_METHOD_POLL()
// You don't need to erect a helper method frame to do a poll. FC_GC_POLL
// can do this (remember all your GC refs will be trashed).
// Finally if your method is VERY small, you can get away without a poll,
// you have to use FC_GC_POLL_NOT_NEEDED to mark this.
// Use sparingly!
// It is possible to set up the frame as the first operation in the FCALL and
// tear it down as the last operation before returning. This works and is
// reasonably efficient (as good as an ECall), however, if it is the case that
// you can defer the setup of the frame to an unlikely code path (exception path)
// that is much better.
// If you defer setup of the frame, all codepaths leading to the frame setup
// must be wrapped with PERMIT_HELPER_METHOD_FRAME_BEGIN/END. These block
// certain compiler optimizations that interfere with the delayed frame setup.
// These macros are automatically included in the HCIMPL, FCIMPL, and frame
// setup macros.
// <TODO>TODO: we should have a way of doing a trial allocation (an allocation that
// will fail if it would cause a GC). That way even FCALLs that need to allocate
// would not necessarily need to set up a frame. </TODO>
// It is common to only need to set up a frame in order to throw an exception.
// While this can be done by doing
// HELPER_METHOD_FRAME_BEGIN() // Use if FCALL does not return a value
// COMPlusThrow(execpt);
// HELPER_METHOD_FRAME_END()
// It is more efficient (in space) to use convenience macro FCTHROW that does
// this for you (sets up a frame, and does the throw).
// FCTHROW(except)
// Since FCALLS have to conform to the EE calling conventions and not to C
// calling conventions, FCALLS, need to be declared using special macros (FCIMPL*)
// that implement the correct calling conventions. There are variants of these
// macros depending on the number of args, and sometimes the types of the
// arguments.
//------------------------------------------------------------------------
// A very simple example:
//
// FCIMPL2(INT32, Div, INT32 x, INT32 y)
// {
// if (y == 0)
// FCThrow(kDivideByZeroException);
// return x/y;
// }
// FCIMPLEND
//
//
// *** WATCH OUT FOR THESE GOTCHAS: ***
// ------------------------------------
// - In your FCDECL & FCIMPL protos, don't declare a param as type OBJECTREF
// or any of its deriveds. This will break on the checked build because
// __fastcall doesn't enregister C++ objects (which OBJECTREF is).
// Instead, you need to do something like;
//
// FCIMPL(.., .., Object* pObject0)
// OBJECTREF pObject = ObjectToOBJECTREF(pObject0);
// FCIMPL
//
// For similar reasons, use Object* rather than OBJECTREF as a return type.
// Consider either using ObjectToOBJECTREF or calling VALIDATEOBJECTREF
// to make sure your Object* is valid.
//
// - FCThrow() must be called directly from your FCall impl function: it
// cannot be called from a subfunction. Calling from a subfunction breaks
// the VC code parsing workaround that lets us recover the callee saved registers.
// Fortunately, you'll get a compile error complaining about an
// unknown variable "__me".
//
// - If your FCall returns VOID, you must use FCThrowVoid() rather than
// FCThrow(). This is because FCThrow() has to generate an unexecuted
// "return" statement for the code parser.
//
// - On x86, if first and/or second argument of your FCall cannot be passed
// in either of the __fastcall registers (ECX/EDX), you must use "V" versions
// of FCDECL and FCIMPL macros to enregister arguments correctly. Some of the
// most common types that fit this requirement are 64-bit values (i.e. INT64 or
// UINT64) and floating-point values (i.e. FLOAT or DOUBLE). For example, FCDECL3_IVI
// must be used for FCalls that take 3 arguments and 2nd argument is INT64 and
// FDECL2_VV must be used for FCalls that take 2 arguments where both are FLOAT.
//
// - You may use structs for protecting multiple OBJECTREF's simultaneously.
// In these cases, you must use a variant of a helper method frame with PROTECT
// in the name, to ensure all the OBJECTREF's in the struct get protected.
// Also, initialize all the OBJECTREF's first. Like this:
//
// FCIMPL4(Object*, COMNlsInfo::nativeChangeCaseString, LocaleIDObject* localeUNSAFE,
// INT_PTR pNativeTextInfo, StringObject* pStringUNSAFE, CLR_BOOL bIsToUpper)
// {
// [ignoring CONTRACT for now]
// struct _gc
// {
// STRINGREF pResult;
// STRINGREF pString;
// LOCALEIDREF pLocale;
// } gc;
// gc.pResult = NULL;
// gc.pString = ObjectToSTRINGREF(pStringUNSAFE);
// gc.pLocale = (LOCALEIDREF)ObjectToOBJECTREF(localeUNSAFE);
//
// HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc)
//
// If you forgot the PROTECT part, the macro will only protect the first OBJECTREF,
// introducing a subtle GC hole in your code. Fortunately, we now issue a
// compile-time error if you forget.
// How FCall works:
// ----------------
// An FCall target uses __fastcall or some other calling convention to
// match the IL calling convention exactly. Thus, a call to FCall is a direct
// call to the target w/ no intervening stub or frame.
//
// The tricky part is when FCThrow is called. FCThrow must generate
// a proper method frame before allocating and throwing the exception.
// To do this, it must recover several things:
//
// - The location of the FCIMPL's return address (since that's
// where the frame will be based.)
//
// - The on-entry values of the callee-saved regs; which must
// be recorded in the frame so that GC can update them.
// Depending on how VC compiles your FCIMPL, those values are still
// in the original registers or saved on the stack.
//
// To figure out which, FCThrow() generates the code:
//
// while (NULL == __FCThrow(__me, ...)) {};
// return 0;
//
// The "return" statement will never execute; but its presence guarantees
// that VC will follow the __FCThrow() call with a VC epilog
// that restores the callee-saved registers using a pretty small
// and predictable set of Intel opcodes. __FCThrow() parses this
// epilog and simulates its execution to recover the callee saved
// registers.
//
// The while loop is to prevent the compiler from doing tail call optimizations.
// The helper frame interpretter needs the frame to be present.
//
// - The MethodDesc* that this FCall implements. This MethodDesc*
// is part of the frame and ensures that the FCall will appear
// in the exception's stack trace. To get this, FCDECL declares
// a static local __me, initialized to point to the FC target itself.
// This address is exactly what's stored in the ECall lookup tables;
// so __FCThrow() simply does a reverse lookup on that table to recover
// the MethodDesc*.
//
#ifndef __FCall_h__
#define __FCall_h__
#include "gms.h"
#include "runtimeexceptionkind.h"
#include "debugreturn.h"
//==============================================================================================
// These macros defeat compiler optimizations that might mix nonvolatile
// register loads and stores with other code in the function body. This
// creates problems for the frame setup code, which assumes that any
// nonvolatiles that are saved at the point of the frame setup will be
// re-loaded when the frame is popped.
//
// Currently this is only known to be an issue on AMD64. It's uncertain
// whether it is an issue on x86.
//==============================================================================================
#if defined(TARGET_AMD64) && !defined(TARGET_UNIX)
//
// On AMD64 this is accomplished by including a setjmp anywhere in a function.
// Doesn't matter whether it is reachable or not, and in fact in optimized
// builds the setjmp is removed altogether.
//
#include <setjmp.h>
#ifdef _DEBUG
//
// Linked list of unmanaged methods preceeding a HelperMethodFrame push. This
// is linked onto the current Thread. Each list entry is stack-allocated so it
// can be associated with an unmanaged frame. Each unmanaged frame needs to be
// associated with at least one list entry.
//
struct HelperMethodFrameCallerList
{
HelperMethodFrameCallerList *pCaller;
};
#endif // _DEBUG
//
// Resets the Thread state at a new managed -> fcall transition.
//
class FCallTransitionState
{
public:
FCallTransitionState () NOT_DEBUG({ LIMITED_METHOD_CONTRACT; });
~FCallTransitionState () NOT_DEBUG({ LIMITED_METHOD_CONTRACT; });
#ifdef _DEBUG
private:
Thread *m_pThread;
HelperMethodFrameCallerList *m_pPreviousHelperMethodFrameCallerList;
#endif // _DEBUG
};
//
// Pushes/pops state for each caller.
//
class PermitHelperMethodFrameState
{
public:
PermitHelperMethodFrameState () NOT_DEBUG({ LIMITED_METHOD_CONTRACT; });
~PermitHelperMethodFrameState () NOT_DEBUG({ LIMITED_METHOD_CONTRACT; });
static VOID CheckHelperMethodFramePermitted () NOT_DEBUG({ LIMITED_METHOD_CONTRACT; });
#ifdef _DEBUG
private:
Thread *m_pThread;
HelperMethodFrameCallerList m_ListEntry;
#endif // _DEBUG
};
//
// Resets the Thread state after the HelperMethodFrame is pushed. At this
// point, the HelperMethodFrame is capable of unwinding to the managed code,
// so we can reset the Thread state for any nested fcalls.
//
class CompletedFCallTransitionState
{
public:
CompletedFCallTransitionState () NOT_DEBUG({ LIMITED_METHOD_CONTRACT; });
~CompletedFCallTransitionState () NOT_DEBUG({ LIMITED_METHOD_CONTRACT; });
#ifdef _DEBUG
private:
HelperMethodFrameCallerList *m_pLastHelperMethodFrameCallerList;
#endif // _DEBUG
};
#define PERMIT_HELPER_METHOD_FRAME_BEGIN() \
if (1) \
{ \
PermitHelperMethodFrameState ___PermitHelperMethodFrameState;
#define PERMIT_HELPER_METHOD_FRAME_END() \
} \
else \
{ \
jmp_buf ___jmpbuf; \
setjmp(___jmpbuf); \
__assume(0); \
}
#define FCALL_TRANSITION_BEGIN() \
FCallTransitionState ___FCallTransitionState; \
PERMIT_HELPER_METHOD_FRAME_BEGIN();
#define FCALL_TRANSITION_END() \
PERMIT_HELPER_METHOD_FRAME_END();
#define CHECK_HELPER_METHOD_FRAME_PERMITTED() \
PermitHelperMethodFrameState::CheckHelperMethodFramePermitted(); \
CompletedFCallTransitionState ___CompletedFCallTransitionState;
#else // unsupported processor
#define PERMIT_HELPER_METHOD_FRAME_BEGIN()
#define PERMIT_HELPER_METHOD_FRAME_END()
#define FCALL_TRANSITION_BEGIN()
#define FCALL_TRANSITION_END()
#define CHECK_HELPER_METHOD_FRAME_PERMITTED()
#endif // unsupported processor
//==============================================================================================
// This is where FCThrow ultimately ends up. Never call this directly.
// Use the FCThrow() macros. __FCThrowArgument is the helper to throw ArgumentExceptions
// with a resource taken from the managed resource manager.
//==============================================================================================
LPVOID __FCThrow(LPVOID me, enum RuntimeExceptionKind reKind, UINT resID, LPCWSTR arg1, LPCWSTR arg2, LPCWSTR arg3);
LPVOID __FCThrowArgument(LPVOID me, enum RuntimeExceptionKind reKind, LPCWSTR argumentName, LPCWSTR resourceName);
//==============================================================================================
// FDECLn: A set of macros for generating header declarations for FC targets.
// Use FIMPLn for the actual body.
//==============================================================================================
// Note: on the x86, these defs reverse all but the first two arguments
// (IL stack calling convention is reversed from __fastcall.)
// Calling convention for varargs
#define F_CALL_VA_CONV __cdecl
#ifdef TARGET_X86
// Choose the appropriate calling convention for FCALL helpers on the basis of the JIT calling convention
#ifdef __GNUC__
#define F_CALL_CONV __attribute__((cdecl, regparm(3)))
// GCC FCALL convention (simulated via cdecl, regparm(3)) is different from MSVC FCALL convention. GCC can use up
// to 3 registers to store parameters. The registers used are EAX, EDX, ECX. Dummy parameters and reordering
// of the actual parameters in the FCALL signature is used to make the calling convention to look like in MSVC.
#define SWIZZLE_REGARG_ORDER
#else // __GNUC__
#define F_CALL_CONV __fastcall
#endif // !__GNUC__
#define SWIZZLE_STKARG_ORDER
#else // TARGET_X86
//
// non-x86 platforms don't have messed-up calling convention swizzling
//
#define F_CALL_CONV
#endif // !TARGET_X86
#ifdef SWIZZLE_STKARG_ORDER
#ifdef SWIZZLE_REGARG_ORDER
#define FCDECL0(rettype, funcname) rettype F_CALL_CONV funcname()
#define FCDECL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1)
#define FCDECL1_V(rettype, funcname, a1) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, int /* ECX */, a1)
#define FCDECL2(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1)
#define FCDECL2VA(rettype, funcname, a1, a2) rettype F_CALL_VA_CONV funcname(a1, a2, ...)
#define FCDECL2_VV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, int /* ECX */, a2, a1)
#define FCDECL2_VI(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a2, a1)
#define FCDECL2_IV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1, a2)
#define FCDECL3(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a3)
#define FCDECL3_IIV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a3)
#define FCDECL3_VII(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a3, a2, a1)
#define FCDECL3_IVV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1, a3, a2)
#define FCDECL3_IVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a3, a1, a2)
#define FCDECL3_VVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a3, a2, a1)
#define FCDECL3_VVV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, int /* ECX */, a3, a2, a1)
#define FCDECL4(rettype, funcname, a1, a2, a3, a4) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a4, a3)
#define FCDECL5(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a5, a4, a3)
#define FCDECL6(rettype, funcname, a1, a2, a3, a4, a5, a6) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a6, a5, a4, a3)
#define FCDECL7(rettype, funcname, a1, a2, a3, a4, a5, a6, a7) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a7, a6, a5, a4, a3)
#define FCDECL8(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a8, a7, a6, a5, a4, a3)
#define FCDECL9(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL10(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL11(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL12(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL13(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL14(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a14, a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a3, a1, a5, a4, a2)
#define FCDECL5_VII(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a3, a2, a5, a4, a1)
#else // SWIZZLE_REGARG_ORDER
#define FCDECL0(rettype, funcname) rettype F_CALL_CONV funcname()
#define FCDECL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1)
#define FCDECL1_V(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1)
#define FCDECL2(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2)
#define FCDECL2VA(rettype, funcname, a1, a2) rettype F_CALL_VA_CONV funcname(a1, a2, ...)
#define FCDECL2_VV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a2, a1)
#define FCDECL2_VI(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a2, a1)
#define FCDECL2_IV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2)
#define FCDECL3(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL3_IIV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL3_VII(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a2, a3, a1)
#define FCDECL3_IVV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a3, a2)
#define FCDECL3_IVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a3, a2)
#define FCDECL3_VVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a2, a1, a3)
#define FCDECL3_VVV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a3, a2, a1)
#define FCDECL4(rettype, funcname, a1, a2, a3, a4) rettype F_CALL_CONV funcname(a1, a2, a4, a3)
#define FCDECL5(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a2, a5, a4, a3)
#define FCDECL6(rettype, funcname, a1, a2, a3, a4, a5, a6) rettype F_CALL_CONV funcname(a1, a2, a6, a5, a4, a3)
#define FCDECL7(rettype, funcname, a1, a2, a3, a4, a5, a6, a7) rettype F_CALL_CONV funcname(a1, a2, a7, a6, a5, a4, a3)
#define FCDECL8(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8) rettype F_CALL_CONV funcname(a1, a2, a8, a7, a6, a5, a4, a3)
#define FCDECL9(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9) rettype F_CALL_CONV funcname(a1, a2, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL10(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) rettype F_CALL_CONV funcname(a1, a2, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL11(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) rettype F_CALL_CONV funcname(a1, a2, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL12(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) rettype F_CALL_CONV funcname(a1, a2, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL13(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) rettype F_CALL_CONV funcname(a1, a2, a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL14(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) rettype F_CALL_CONV funcname(a1, a2, a14, a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCDECL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a3, a5, a4, a2)
#define FCDECL5_VII(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a2, a3, a5, a4, a1)
#endif // !SWIZZLE_REGARG_ORDER
#if 0
//
// don't use something like this... directly calling an FCALL from within the runtime breaks stackwalking because
// the FCALL reverse mapping only gets established in ECall::GetFCallImpl and that codepath is circumvented by
// directly calling and FCALL
// See below for usage of FC_CALL_INNER (used in SecurityStackWalk::Check presently)
//
#define FCCALL0(funcname) funcname()
#define FCCALL1(funcname, a1) funcname(a1)
#define FCCALL2(funcname, a1, a2) funcname(a1, a2)
#define FCCALL3(funcname, a1, a2, a3) funcname(a1, a2, a3)
#define FCCALL4(funcname, a1, a2, a3, a4) funcname(a1, a2, a4, a3)
#define FCCALL5(funcname, a1, a2, a3, a4, a5) funcname(a1, a2, a5, a4, a3)
#define FCCALL6(funcname, a1, a2, a3, a4, a5, a6) funcname(a1, a2, a6, a5, a4, a3)
#define FCCALL7(funcname, a1, a2, a3, a4, a5, a6, a7) funcname(a1, a2, a7, a6, a5, a4, a3)
#define FCCALL8(funcname, a1, a2, a3, a4, a5, a6, a7, a8) funcname(a1, a2, a8, a7, a6, a5, a4, a3)
#define FCCALL9(funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9) funcname(a1, a2, a9, a8, a7, a6, a5, a4, a3)
#define FCCALL10(funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) funcname(a1, a2, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCCALL11(funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) funcname(a1, a2, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#define FCCALL12(funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) funcname(a1, a2, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#endif // 0
#else // !SWIZZLE_STKARG_ORDER
#define FCDECL0(rettype, funcname) rettype F_CALL_CONV funcname()
#define FCDECL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1)
#define FCDECL1_V(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1)
#define FCDECL2(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2)
#define FCDECL2VA(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2, ...)
#define FCDECL2_VV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2)
#define FCDECL2_VI(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2)
#define FCDECL2_IV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2)
#define FCDECL3(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL3_IIV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL3_VII(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL3_IVV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL3_IVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL3_VVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL3_VVV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
#define FCDECL4(rettype, funcname, a1, a2, a3, a4) rettype F_CALL_CONV funcname(a1, a2, a3, a4)
#define FCDECL5(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5)
#define FCDECL6(rettype, funcname, a1, a2, a3, a4, a5, a6) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6)
#define FCDECL7(rettype, funcname, a1, a2, a3, a4, a5, a6, a7) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7)
#define FCDECL8(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8)
#define FCDECL9(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9)
#define FCDECL10(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
#define FCDECL11(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)
#define FCDECL12(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)
#define FCDECL13(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13)
#define FCDECL14(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)
#define FCDECL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5)
#define FCDECL5_VII(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5)
#endif // !SWIZZLE_STKARG_ORDER
#define HELPER_FRAME_DECL(x) FrameWithCookie<HelperMethodFrame_##x##OBJ> __helperframe
// use the capture state machinery if the architecture has one
//
// For a normal build we create a loop (see explaination on RestoreState below)
// We don't want a loop here for PREFAST since that causes
// warning 263: Using _alloca in a loop
// And we can't use DEBUG_OK_TO_RETURN for PREFAST because the PREFAST version
// requires that you already be in a DEBUG_ASSURE_NO_RETURN_BEGIN scope
#define HelperMethodFrame_0OBJ HelperMethodFrame
#define HELPER_FRAME_ARGS(attribs) __me, attribs
#define FORLAZYMACHSTATE(x) x
#if defined(_PREFAST_)
#define FORLAZYMACHSTATE_BEGINLOOP(x) x
#define FORLAZYMACHSTATE_ENDLOOP(x)
#define FORLAZYMACHSTATE_DEBUG_OK_TO_RETURN_BEGIN
#define FORLAZYMACHSTATE_DEBUG_OK_TO_RETURN_END
#else
#define FORLAZYMACHSTATE_BEGINLOOP(x) x do
#define FORLAZYMACHSTATE_ENDLOOP(x) while(x)
#define FORLAZYMACHSTATE_DEBUG_OK_TO_RETURN_BEGIN DEBUG_OK_TO_RETURN_BEGIN(LAZYMACHSTATE)
#define FORLAZYMACHSTATE_DEBUG_OK_TO_RETURN_END DEBUG_OK_TO_RETURN_END(LAZYMACHSTATE)
#endif
// BEGIN: before gcpoll
//FCallGCCanTriggerNoDtor __fcallGcCanTrigger;
//__fcallGcCanTrigger.Enter();
// END: after gcpoll
//__fcallGcCanTrigger.Leave(__FUNCTION__, __FILE__, __LINE__);
// We have to put DEBUG_OK_TO_RETURN_BEGIN around the FORLAZYMACHSTATE
// to allow the HELPER_FRAME to be installed inside an SO_INTOLERANT region
// which does not allow a return. The return is used by FORLAZYMACHSTATE
// to capture the state, but is not an actual return, so it is ok.
#define HELPER_METHOD_FRAME_BEGIN_EX_BODY(ret, helperFrame, gcpoll, allowGC) \
FORLAZYMACHSTATE_BEGINLOOP(int alwaysZero = 0;) \
{ \
INDEBUG(static BOOL __haveCheckedRestoreState = FALSE;) \
PERMIT_HELPER_METHOD_FRAME_BEGIN(); \
CHECK_HELPER_METHOD_FRAME_PERMITTED(); \
helperFrame; \
FORLAZYMACHSTATE_DEBUG_OK_TO_RETURN_BEGIN; \
FORLAZYMACHSTATE(CAPTURE_STATE(__helperframe.MachineState(), ret);) \
FORLAZYMACHSTATE_DEBUG_OK_TO_RETURN_END; \
INDEBUG(__helperframe.SetAddrOfHaveCheckedRestoreState(&__haveCheckedRestoreState)); \
DEBUG_ASSURE_NO_RETURN_BEGIN(HELPER_METHOD_FRAME); \
INCONTRACT(FCallGCCanTrigger::Enter());
#define HELPER_METHOD_FRAME_BEGIN_EX(ret, helperFrame, gcpoll, allowGC) \
HELPER_METHOD_FRAME_BEGIN_EX_BODY(ret, helperFrame, gcpoll, allowGC) \
/* <TODO>TODO TURN THIS ON!!! </TODO> */ \
/* gcpoll; */ \
INSTALL_MANAGED_EXCEPTION_DISPATCHER; \
__helperframe.Push(); \
MAKE_CURRENT_THREAD_AVAILABLE_EX(__helperframe.GetThread()); \
INSTALL_UNWIND_AND_CONTINUE_HANDLER_FOR_HMF(&__helperframe);
#define HELPER_METHOD_FRAME_BEGIN_EX_NOTHROW(ret, helperFrame, gcpoll, allowGC, probeFailExpr) \
HELPER_METHOD_FRAME_BEGIN_EX_BODY(ret, helperFrame, gcpoll, allowGC) \
__helperframe.Push(); \
MAKE_CURRENT_THREAD_AVAILABLE_EX(__helperframe.GetThread()); \
/* <TODO>TODO TURN THIS ON!!! </TODO> */ \
/* gcpoll; */
// The while(__helperframe.RestoreState() needs a bit of explanation.
// The issue is insuring that the same machine state (which registers saved)
// exists when the machine state is probed (when the frame is created, and
// when it is actually used (when the frame is popped. We do this by creating
// a flow of control from use to def. Note that 'RestoreState' always returns false
// we never actually loop, but the compiler does not know that, and thus
// will be forced to make the keep the state of register spills the same at
// the two locations.
#define HELPER_METHOD_FRAME_END_EX_BODY(gcpoll,allowGC) \
/* <TODO>TODO TURN THIS ON!!! </TODO> */ \
/* gcpoll; */ \
DEBUG_ASSURE_NO_RETURN_END(HELPER_METHOD_FRAME); \
INCONTRACT(FCallGCCanTrigger::Leave(__FUNCTION__, __FILE__, __LINE__)); \
FORLAZYMACHSTATE(alwaysZero = \
HelperMethodFrameRestoreState(INDEBUG_COMMA(&__helperframe) \
__helperframe.MachineState());) \
PERMIT_HELPER_METHOD_FRAME_END() \
} FORLAZYMACHSTATE_ENDLOOP(alwaysZero);
#define HELPER_METHOD_FRAME_END_EX(gcpoll,allowGC) \
UNINSTALL_UNWIND_AND_CONTINUE_HANDLER; \
__helperframe.Pop(); \
UNINSTALL_MANAGED_EXCEPTION_DISPATCHER; \
HELPER_METHOD_FRAME_END_EX_BODY(gcpoll,allowGC);
#define HELPER_METHOD_FRAME_END_EX_NOTHROW(gcpoll,allowGC) \
__helperframe.Pop(); \
HELPER_METHOD_FRAME_END_EX_BODY(gcpoll,allowGC);
#define HELPER_METHOD_FRAME_BEGIN_ATTRIB(attribs) \
HELPER_METHOD_FRAME_BEGIN_EX( \
return, \
HELPER_FRAME_DECL(0)(HELPER_FRAME_ARGS(attribs)), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_0() \
HELPER_METHOD_FRAME_BEGIN_ATTRIB(Frame::FRAME_ATTR_NONE)
#define HELPER_METHOD_FRAME_BEGIN_ATTRIB_NOPOLL(attribs) \
HELPER_METHOD_FRAME_BEGIN_EX( \
return, \
HELPER_FRAME_DECL(0)(HELPER_FRAME_ARGS(attribs)), \
{},FALSE)
#define HELPER_METHOD_FRAME_BEGIN_NOPOLL() HELPER_METHOD_FRAME_BEGIN_ATTRIB_NOPOLL(Frame::FRAME_ATTR_NONE)
#define HELPER_METHOD_FRAME_BEGIN_ATTRIB_1(attribs, arg1) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_EX( \
return, \
HELPER_FRAME_DECL(1)(HELPER_FRAME_ARGS(attribs), \
(OBJECTREF*) &arg1), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_1(arg1) HELPER_METHOD_FRAME_BEGIN_ATTRIB_1(Frame::FRAME_ATTR_NONE, arg1)
#define HELPER_METHOD_FRAME_BEGIN_ATTRIB_2(attribs, arg1, arg2) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
static_assert(sizeof(arg2) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_EX( \
return, \
HELPER_FRAME_DECL(2)(HELPER_FRAME_ARGS(attribs), \
(OBJECTREF*) &arg1, (OBJECTREF*) &arg2), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_2(arg1, arg2) HELPER_METHOD_FRAME_BEGIN_ATTRIB_2(Frame::FRAME_ATTR_NONE, arg1, arg2)
#define HELPER_METHOD_FRAME_BEGIN_ATTRIB_3(attribs, arg1, arg2, arg3) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
static_assert(sizeof(arg2) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
static_assert(sizeof(arg3) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_EX( \
return, \
HELPER_FRAME_DECL(3)(HELPER_FRAME_ARGS(attribs), \
(OBJECTREF*) &arg1, (OBJECTREF*) &arg2, (OBJECTREF*) &arg3), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_3(arg1, arg2, arg3) HELPER_METHOD_FRAME_BEGIN_ATTRIB_3(Frame::FRAME_ATTR_NONE, arg1, arg2, arg3)
#define HELPER_METHOD_FRAME_BEGIN_PROTECT(gc) \
HELPER_METHOD_FRAME_BEGIN_EX( \
return, \
HELPER_FRAME_DECL(PROTECT)(HELPER_FRAME_ARGS(Frame::FRAME_ATTR_NONE), \
(OBJECTREF*)&(gc), sizeof(gc)/sizeof(OBJECTREF)), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_NOPOLL(attribs) \
HELPER_METHOD_FRAME_BEGIN_EX( \
return 0, \
HELPER_FRAME_DECL(0)(HELPER_FRAME_ARGS(attribs)), \
{},FALSE)
#define HELPER_METHOD_FRAME_BEGIN_RET_VC_ATTRIB_NOPOLL(attribs) \
HELPER_METHOD_FRAME_BEGIN_EX( \
FC_RETURN_VC(), \
HELPER_FRAME_DECL(0)(HELPER_FRAME_ARGS(attribs)), \
{},FALSE)
#define HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB(attribs) \
HELPER_METHOD_FRAME_BEGIN_EX( \
return 0, \
HELPER_FRAME_DECL(0)(HELPER_FRAME_ARGS(attribs)), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_RET_0() \
HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB(Frame::FRAME_ATTR_NONE)
#define HELPER_METHOD_FRAME_BEGIN_RET_VC_0() \
HELPER_METHOD_FRAME_BEGIN_EX( \
FC_RETURN_VC(), \
HELPER_FRAME_DECL(0)(HELPER_FRAME_ARGS(Frame::FRAME_ATTR_NONE)), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_1(attribs, arg1) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_EX( \
return 0, \
HELPER_FRAME_DECL(1)(HELPER_FRAME_ARGS(attribs), \
(OBJECTREF*) &arg1), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_RET_NOTHROW_1(probeFailExpr, arg1) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_EX_NOTHROW( \
return 0, \
HELPER_FRAME_DECL(1)(HELPER_FRAME_ARGS(Frame::FRAME_ATTR_NO_THREAD_ABORT), \
(OBJECTREF*) &arg1), \
HELPER_METHOD_POLL(), TRUE, probeFailExpr)
#define HELPER_METHOD_FRAME_BEGIN_RET_VC_ATTRIB_1(attribs, arg1) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_EX( \
FC_RETURN_VC(), \
HELPER_FRAME_DECL(1)(HELPER_FRAME_ARGS(attribs), \
(OBJECTREF*) &arg1), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_2(attribs, arg1, arg2) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
static_assert(sizeof(arg2) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_EX( \
return 0, \
HELPER_FRAME_DECL(2)(HELPER_FRAME_ARGS(attribs), \
(OBJECTREF*) &arg1, (OBJECTREF*) &arg2), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_RET_VC_ATTRIB_2(attribs, arg1, arg2) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
static_assert(sizeof(arg2) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_EX( \
FC_RETURN_VC(), \
HELPER_FRAME_DECL(2)(HELPER_FRAME_ARGS(attribs), \
(OBJECTREF*) &arg1, (OBJECTREF*) &arg2), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_PROTECT(attribs, gc) \
HELPER_METHOD_FRAME_BEGIN_EX( \
return 0, \
HELPER_FRAME_DECL(PROTECT)(HELPER_FRAME_ARGS(attribs), \
(OBJECTREF*)&(gc), sizeof(gc)/sizeof(OBJECTREF)), \
HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_BEGIN_RET_VC_NOPOLL() \
HELPER_METHOD_FRAME_BEGIN_RET_VC_ATTRIB_NOPOLL(Frame::FRAME_ATTR_NONE)
#define HELPER_METHOD_FRAME_BEGIN_RET_NOPOLL() \
HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_NOPOLL(Frame::FRAME_ATTR_NONE)
#define HELPER_METHOD_FRAME_BEGIN_RET_1(arg1) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_1(Frame::FRAME_ATTR_NONE, arg1)
#define HELPER_METHOD_FRAME_BEGIN_RET_VC_1(arg1) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_RET_VC_ATTRIB_1(Frame::FRAME_ATTR_NONE, arg1)
#define HELPER_METHOD_FRAME_BEGIN_RET_2(arg1, arg2) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
static_assert(sizeof(arg2) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_2(Frame::FRAME_ATTR_NONE, arg1, arg2)
#define HELPER_METHOD_FRAME_BEGIN_RET_VC_2(arg1, arg2) \
static_assert(sizeof(arg1) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
static_assert(sizeof(arg2) == sizeof(OBJECTREF), "GC protecting structs of multiple OBJECTREFs requires a PROTECT variant of the HELPER METHOD FRAME macro");\
HELPER_METHOD_FRAME_BEGIN_RET_VC_ATTRIB_2(Frame::FRAME_ATTR_NONE, arg1, arg2)
#define HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc) \
HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_PROTECT(Frame::FRAME_ATTR_NONE, gc)
#define HELPER_METHOD_FRAME_END() HELPER_METHOD_FRAME_END_EX({},FALSE)
#define HELPER_METHOD_FRAME_END_POLL() HELPER_METHOD_FRAME_END_EX(HELPER_METHOD_POLL(),TRUE)
#define HELPER_METHOD_FRAME_END_NOTHROW()HELPER_METHOD_FRAME_END_EX_NOTHROW({},FALSE)
// This is the fastest way to do a GC poll if you have already erected a HelperMethodFrame
#define HELPER_METHOD_POLL() { __helperframe.Poll(); INCONTRACT(__fCallCheck.SetDidPoll()); }
// The HelperMethodFrame knows how to get its return address. Let other code get at it, too.
// (Uses comma operator to call InsureInit & discard result.
#define HELPER_METHOD_FRAME_GET_RETURN_ADDRESS() \
( static_cast<UINT_PTR>( (__helperframe.InsureInit(false, NULL)), (__helperframe.MachineState()->GetRetAddr()) ) )
// Very short routines, or routines that are guarenteed to force GC or EH
// don't need to poll the GC. USE VERY SPARINGLY!!!
#define FC_GC_POLL_NOT_NEEDED() INCONTRACT(__fCallCheck.SetNotNeeded())
Object* FC_GCPoll(void* me, Object* objToProtect = NULL);
#define FC_GC_POLL_EX(ret) \
{ \
INCONTRACT(Thread::TriggersGC(GetThread());) \
INCONTRACT(__fCallCheck.SetDidPoll();) \
if (g_TrapReturningThreads.LoadWithoutBarrier()) \
{ \
if (FC_GCPoll(__me)) \
return ret; \
while (0 == FC_NO_TAILCALL) { }; /* side effect the compile can't remove */ \
} \
}
#define FC_GC_POLL() FC_GC_POLL_EX(;)
#define FC_GC_POLL_RET() FC_GC_POLL_EX(0)
#define FC_GC_POLL_AND_RETURN_OBJREF(obj) \
{ \
INCONTRACT(__fCallCheck.SetDidPoll();) \
Object* __temp = OBJECTREFToObject(obj); \
if (g_TrapReturningThreads.LoadWithoutBarrier()) \
{ \
__temp = FC_GCPoll(__me, __temp); \
while (0 == FC_NO_TAILCALL) { }; /* side effect the compile can't remove */ \
} \
return __temp; \
}
#if defined(ENABLE_CONTRACTS)
#define FC_CAN_TRIGGER_GC() FCallGCCanTrigger::Enter()
#define FC_CAN_TRIGGER_GC_END() FCallGCCanTrigger::Leave(__FUNCTION__, __FILE__, __LINE__)
#define FC_CAN_TRIGGER_GC_HAVE_THREAD(thread) FCallGCCanTrigger::Enter(thread)
#define FC_CAN_TRIGGER_GC_HAVE_THREADEND(thread) FCallGCCanTrigger::Leave(thread, __FUNCTION__, __FILE__, __LINE__)
// turns on forbidGC for the lifetime of the instance
class ForbidGC {
protected:
Thread *m_pThread;
public:
ForbidGC(const char *szFile, int lineNum);
~ForbidGC();
};
// this little helper class checks to make certain
// 1) ForbidGC is set throughout the routine.
// 2) Sometime during the routine, a GC poll is done
class FCallCheck : public ForbidGC {
public:
FCallCheck(const char *szFile, int lineNum);
~FCallCheck();
void SetDidPoll() {LIMITED_METHOD_CONTRACT; didGCPoll = true; }
void SetNotNeeded() {LIMITED_METHOD_CONTRACT; notNeeded = true; }
private:
#ifdef _DEBUG
DWORD unbreakableLockCount;
#endif
bool didGCPoll; // GC poll was done
bool notNeeded; // GC poll not needed
unsigned __int64 startTicks; // tick count at beginning of FCall
};
// FC_COMMON_PROLOG is used for both FCalls and HCalls
#define FC_COMMON_PROLOG(target, assertFn) \
/* The following line has to be first. We do not want to trash last error */ \
DWORD __lastError = ::GetLastError(); \
static void* __cache = 0; \
assertFn(__cache, (LPVOID)target); \
{ \
Thread *_pThread = GetThread(); \
Thread::ObjectRefFlush(_pThread); \
} \
FCallCheck __fCallCheck(__FILE__, __LINE__); \
FCALL_TRANSITION_BEGIN(); \
::SetLastError(__lastError); \
void FCallAssert(void*& cache, void* target);
void HCallAssert(void*& cache, void* target);
#else
#define FC_COMMON_PROLOG(target, assertFn) FCALL_TRANSITION_BEGIN()
#define FC_CAN_TRIGGER_GC()
#define FC_CAN_TRIGGER_GC_END()
#endif // ENABLE_CONTRACTS
// #FC_INNER
// Macros that allows fcall to be split into two function to avoid the helper frame overhead on common fast
// codepaths.
//
// The helper routine needs to know the name of the routine that called it so that it can look up the name of
// the managed routine this code is associted with (for managed stack traces). This is passed with the
// FC_INNER_PROLOG macro.
//
// The helper can set up a HELPER_METHOD_FRAME, but should pass the
// Frame::FRAME_ATTR_EXACT_DEPTH|Frame::FRAME_ATTR_CAPTURE_DEPTH_2 which indicates the exact number of
// unwinds to do to get back to managed code. Currently we only support depth 2 which means that the
// HELPER_METHOD_FRAME needs to be set up in the function directly called by the FCALL. The helper should
// use the NOINLINE macro to prevent the compiler from inlining it into the FCALL (which would obviously
// mess up the unwind count).
//
// The other invarient that needs to hold is that the epilog walker needs to be able to get from the call to
// the helper routine to the end of the FCALL using trivial heurisitics. The easiest (and only supported)
// way of doing this is to place your helper right before a return (eg at the end of the method). Generally
// this is not a problem at all, since the FCALL itself will pick off some common case and then tail-call to
// the helper for everything else. You must use the code:FC_INNER_RETURN macros to do the call, to insure
// that the C++ compiler does not tail-call optimize the call to the inner function and mess up the stack
// depth.
//
// see code:ObjectNative::GetClass for an example
//
#define FC_INNER_PROLOG(outerfuncname) \
LPVOID __me; \
__me = GetEEFuncEntryPointMacro(outerfuncname); \
FC_CAN_TRIGGER_GC(); \
INCONTRACT(FCallCheck __fCallCheck(__FILE__, __LINE__));
// This variant should be used for inner fcall functions that have the
// __me value passed as an argument to the function. This allows
// inner functions to be shared across multiple fcalls.
#define FC_INNER_PROLOG_NO_ME_SETUP() \
FC_CAN_TRIGGER_GC(); \
INCONTRACT(FCallCheck __fCallCheck(__FILE__, __LINE__));
#define FC_INNER_EPILOG() \
FC_CAN_TRIGGER_GC_END();
// If you are using FC_INNER, and you are tail calling to the helper method (a common case), then you need
// to use the FC_INNER_RETURN macros (there is one for methods that return a value and another if the
// function returns void). This macro's purpose is to inhibit any tail calll optimization the C++ compiler
// might do, which would otherwise confuse the epilog walker.
//
// * See #FC_INNER for more
extern RAW_KEYWORD(volatile) int FC_NO_TAILCALL;
#define FC_INNER_RETURN(type, expr) \
type __retVal = expr; \
while (0 == FC_NO_TAILCALL) { }; /* side effect the compile can't remove */ \
return(__retVal);
#define FC_INNER_RETURN_VOID(stmt) \
stmt; \
while (0 == FC_NO_TAILCALL) { }; /* side effect the compile can't remove */ \
return;
//==============================================================================================
// FIMPLn: A set of macros for generating the proto for the actual
// implementation (use FDECLN for header protos.)
//
// The hidden "__me" variable lets us recover the original MethodDesc*
// so any thrown exceptions will have the correct stack trace. FCThrow()
// passes this along to __FCThrowInternal().
//==============================================================================================
#define GetEEFuncEntryPointMacro(func) ((LPVOID)(func))
#define FCIMPL_PROLOG(funcname) \
LPVOID __me; \
__me = GetEEFuncEntryPointMacro(funcname); \
FC_COMMON_PROLOG(__me, FCallAssert)
#if defined(_DEBUG) && !defined(__GNUC__)
// Build the list of all fcalls signatures. It is used in binder.cpp to verify
// compatibility of managed and unmanaged fcall signatures. The check is currently done
// for x86 only.
#define CHECK_FCALL_SIGNATURE
#endif
#ifdef CHECK_FCALL_SIGNATURE
struct FCSigCheck {
public:
FCSigCheck(void* fnc, const char* sig)
{
LIMITED_METHOD_CONTRACT;
func = fnc;
signature = sig;
next = g_pFCSigCheck;
g_pFCSigCheck = this;
}
FCSigCheck* next;
void* func;
const char* signature;
static FCSigCheck* g_pFCSigCheck;
};
#define FCSIGCHECK(funcname, signature) \
static FCSigCheck UNIQUE_LABEL(FCSigCheck)(GetEEFuncEntryPointMacro(funcname), signature);
#else // CHECK_FCALL_SIGNATURE
#define FCSIGCHECK(funcname, signature)
#endif // !CHECK_FCALL_SIGNATURE
#ifdef SWIZZLE_STKARG_ORDER
#ifdef SWIZZLE_REGARG_ORDER
#define FCIMPL0(rettype, funcname) rettype F_CALL_CONV funcname() { FCIMPL_PROLOG(funcname)
#define FCIMPL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL1_V(rettype, funcname, a1) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, int /* ECX */, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL2(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_VV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, int /* ECX */, a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_VI(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_IV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL3(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IIV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VII(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a3, a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IVV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1, a3, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a3, a1, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a3, a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VVV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, int /* ECX */, a3, a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL4(rettype, funcname, a1, a2, a3, a4) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL5(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL6(rettype, funcname, a1, a2, a3, a4, a5, a6) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL7(rettype, funcname, a1, a2, a3, a4, a5, a6, a7) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL8(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL9(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL10(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL11(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a11, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL12(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL13(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL14(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a14, a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a3, a1, a5, a4, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL5_VII(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a3, a2, a5, a4, a1) { FCIMPL_PROLOG(funcname)
#else // SWIZZLE_REGARG_ORDER
#define FCIMPL0(rettype, funcname) FCSIGCHECK(funcname, #rettype) \
rettype F_CALL_CONV funcname() { FCIMPL_PROLOG(funcname)
#define FCIMPL1(rettype, funcname, a1) FCSIGCHECK(funcname, #rettype "," #a1) \
rettype F_CALL_CONV funcname(a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL1_V(rettype, funcname, a1) FCSIGCHECK(funcname, #rettype "," "V" #a1) \
rettype F_CALL_CONV funcname(a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL2(rettype, funcname, a1, a2) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2) \
rettype F_CALL_CONV funcname(a1, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL2VA(rettype, funcname, a1, a2) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," "...") \
rettype F_CALL_VA_CONV funcname(a1, a2, ...) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_VV(rettype, funcname, a1, a2) FCSIGCHECK(funcname, #rettype "," "V" #a1 "," "V" #a2) \
rettype F_CALL_CONV funcname(a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_VI(rettype, funcname, a1, a2) FCSIGCHECK(funcname, #rettype "," "V" #a1 "," #a2) \
rettype F_CALL_CONV funcname(a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_IV(rettype, funcname, a1, a2) FCSIGCHECK(funcname, #rettype "," #a1 "," "V" #a2) \
rettype F_CALL_CONV funcname(a1, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL3(rettype, funcname, a1, a2, a3) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3) \
rettype F_CALL_CONV funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IIV(rettype, funcname, a1, a2, a3) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," "V" #a3) \
rettype F_CALL_CONV funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VII(rettype, funcname, a1, a2, a3) FCSIGCHECK(funcname, #rettype "," "V" #a1 "," #a2 "," #a3) \
rettype F_CALL_CONV funcname(a2, a3, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IVV(rettype, funcname, a1, a2, a3) FCSIGCHECK(funcname, #rettype "," #a1 "," "V" #a2 "," "V" #a3) \
rettype F_CALL_CONV funcname(a1, a3, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IVI(rettype, funcname, a1, a2, a3) FCSIGCHECK(funcname, #rettype "," #a1 "," "V" #a2 "," #a3) \
rettype F_CALL_CONV funcname(a1, a3, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VVI(rettype, funcname, a1, a2, a3) FCSIGCHECK(funcname, #rettype "," "V" #a1 "," "V" #a2 "," #a3) \
rettype F_CALL_CONV funcname(a2, a1, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VVV(rettype, funcname, a1, a2, a3) FCSIGCHECK(funcname, #rettype "," "V" #a1 "," "V" #a2 "," "V" #a3) \
rettype F_CALL_CONV funcname(a3, a2, a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL4(rettype, funcname, a1, a2, a3, a4) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4) \
rettype F_CALL_CONV funcname(a1, a2, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL5(rettype, funcname, a1, a2, a3, a4, a5) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5) \
rettype F_CALL_CONV funcname(a1, a2, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL6(rettype, funcname, a1, a2, a3, a4, a5, a6) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6) \
rettype F_CALL_CONV funcname(a1, a2, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL7(rettype, funcname, a1, a2, a3, a4, a5, a6, a7) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6 "," #a7) \
rettype F_CALL_CONV funcname(a1, a2, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL8(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6 "," #a7 "," #a8) \
rettype F_CALL_CONV funcname(a1, a2, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL9(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6 "," #a7 "," #a8 "," #a9) \
rettype F_CALL_CONV funcname(a1, a2, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL10(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6 "," #a7 "," #a8 "," #a9 "," #a10) \
rettype F_CALL_CONV funcname(a1, a2, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL11(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6 "," #a7 "," #a8 "," #a9 "," #a10 "," #a11) \
rettype F_CALL_CONV funcname(a1, a2, a11, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL12(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6 "," #a7 "," #a8 "," #a9 "," #a10 "," #a11 "," #a12) \
rettype F_CALL_CONV funcname(a1, a2, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL13(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6 "," #a7 "," #a8 "," #a9 "," #a10 "," #a11 "," #a12 "," #a13) \
rettype F_CALL_CONV funcname(a1, a2, a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL14(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) FCSIGCHECK(funcname, #rettype "," #a1 "," #a2 "," #a3 "," #a4 "," #a5 "," #a6 "," #a7 "," #a8 "," #a9 "," #a10 "," #a11 "," #a12 "," #a13 "," #a14) \
rettype F_CALL_CONV funcname(a1, a2, a14, a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) FCSIGCHECK(funcname, #rettype "," #a1 "," "V" #a2 "," #a3 "," #a4 "," #a5) \
rettype F_CALL_CONV funcname(a1, a3, a5, a4, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL5_VII(rettype, funcname, a1, a2, a3, a4, a5) FCSIGCHECK(funcname, #rettype "," "V" #a1 "," #a2 "," #a3 "," #a4 "," #a5) \
rettype F_CALL_CONV funcname(a2, a3, a5, a4, a1) { FCIMPL_PROLOG(funcname)
#endif // !SWIZZLE_REGARG_ORDER
#else // SWIZZLE_STKARG_ORDER
#define FCIMPL0(rettype, funcname) rettype funcname() { FCIMPL_PROLOG(funcname)
#define FCIMPL1(rettype, funcname, a1) rettype funcname(a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL1_V(rettype, funcname, a1) rettype funcname(a1) { FCIMPL_PROLOG(funcname)
#define FCIMPL2(rettype, funcname, a1, a2) rettype funcname(a1, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL2VA(rettype, funcname, a1, a2) rettype funcname(a1, a2, ...) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_VV(rettype, funcname, a1, a2) rettype funcname(a1, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_VI(rettype, funcname, a1, a2) rettype funcname(a1, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL2_IV(rettype, funcname, a1, a2) rettype funcname(a1, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL3(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IIV(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IVV(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VII(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_IVI(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VVI(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL3_VVV(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3) { FCIMPL_PROLOG(funcname)
#define FCIMPL4(rettype, funcname, a1, a2, a3, a4) rettype funcname(a1, a2, a3, a4) { FCIMPL_PROLOG(funcname)
#define FCIMPL5(rettype, funcname, a1, a2, a3, a4, a5) rettype funcname(a1, a2, a3, a4, a5) { FCIMPL_PROLOG(funcname)
#define FCIMPL6(rettype, funcname, a1, a2, a3, a4, a5, a6) rettype funcname(a1, a2, a3, a4, a5, a6) { FCIMPL_PROLOG(funcname)
#define FCIMPL7(rettype, funcname, a1, a2, a3, a4, a5, a6, a7) rettype funcname(a1, a2, a3, a4, a5, a6, a7) { FCIMPL_PROLOG(funcname)
#define FCIMPL8(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8) { FCIMPL_PROLOG(funcname)
#define FCIMPL9(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9) { FCIMPL_PROLOG(funcname)
#define FCIMPL10(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) { FCIMPL_PROLOG(funcname)
#define FCIMPL11(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) { FCIMPL_PROLOG(funcname)
#define FCIMPL12(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) { FCIMPL_PROLOG(funcname)
#define FCIMPL13(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) { FCIMPL_PROLOG(funcname)
#define FCIMPL14(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) { FCIMPL_PROLOG(funcname)
#define FCIMPL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) rettype funcname(a1, a2, a3, a4, a5) { FCIMPL_PROLOG(funcname)
#define FCIMPL5_VII(rettype, funcname, a1, a2, a3, a4, a5) rettype funcname(a1, a2, a3, a4, a5) { FCIMPL_PROLOG(funcname)
#endif // !SWIZZLE_STKARG_ORDER
//==============================================================================================
// Use this to terminte an FCIMPLEND.
//==============================================================================================
#define FCIMPL_EPILOG() FCALL_TRANSITION_END()
#define FCIMPLEND FCIMPL_EPILOG(); }
#define HCIMPL_PROLOG(funcname) LPVOID __me; __me = 0; FC_COMMON_PROLOG(funcname, HCallAssert)
// HCIMPL macros are just like their FCIMPL counterparts, however
// they do not remember the function they come from. Thus they will not
// show up in a stack trace. This is what you want for JIT helpers and the like
#ifdef SWIZZLE_STKARG_ORDER
#ifdef SWIZZLE_REGARG_ORDER
#define HCIMPL0(rettype, funcname) rettype F_CALL_CONV funcname() { HCIMPL_PROLOG(funcname)
#define HCIMPL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL1_RAW(rettype, funcname, a1) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1) {
#define HCIMPL1_V(rettype, funcname, a1) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, int /* ECX */, a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL2(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL2_RAW(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1) {
#define HCIMPL2_VV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, int /* ECX */, a2, a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL2_IV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1, a2) { HCIMPL_PROLOG(funcname)
#define HCIMPL3(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a3) { HCIMPL_PROLOG(funcname)
#define HCIMPL3_RAW(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a3) {
#define HCIMPL4(rettype, funcname, a1, a2, a3, a4) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a4, a3) { HCIMPL_PROLOG(funcname)
#define HCIMPL5(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a2, a1, a5, a4, a3) { HCIMPL_PROLOG(funcname)
#define HCCALL0(funcname) funcname()
#define HCCALL1(funcname, a1) funcname(0, 0, a1)
#define HCCALL1_V(funcname, a1) funcname(0, 0, 0, a1)
#define HCCALL2(funcname, a1, a2) funcname(0, a2, a1)
#define HCCALL3(funcname, a1, a2, a3) funcname(0, a2, a1, a3)
#define HCCALL4(funcname, a1, a2, a3, a4) funcname(0, a2, a1, a4, a3)
#define HCCALL5(funcname, a1, a2, a3, a4, a5) funcname(0, a2, a1, a5, a4, a3)
#define HCCALL1_PTR(rettype, funcptr, a1) rettype (F_CALL_CONV * funcptr)(int /* EAX */, int /* EDX */, a1)
#define HCCALL2_PTR(rettype, funcptr, a1, a2) rettype (F_CALL_CONV * funcptr)(int /* EAX */, a2, a1)
#else // SWIZZLE_REGARG_ORDER
#define HCIMPL0(rettype, funcname) rettype F_CALL_CONV funcname() { HCIMPL_PROLOG(funcname)
#define HCIMPL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL1_RAW(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1) {
#define HCIMPL1_V(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL2(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2) { HCIMPL_PROLOG(funcname)
#define HCIMPL2_RAW(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2) {
#define HCIMPL2_VV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a2, a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL2_IV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2) { HCIMPL_PROLOG(funcname)
#define HCIMPL3(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3) { HCIMPL_PROLOG(funcname)
#define HCIMPL3_RAW(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3) {
#define HCIMPL4(rettype, funcname, a1, a2, a3, a4) rettype F_CALL_CONV funcname(a1, a2, a4, a3) { HCIMPL_PROLOG(funcname)
#define HCIMPL5(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a2, a5, a4, a3) { HCIMPL_PROLOG(funcname)
#define HCCALL0(funcname) funcname()
#define HCCALL1(funcname, a1) funcname(a1)
#define HCCALL1_V(funcname, a1) funcname(a1)
#define HCCALL2(funcname, a1, a2) funcname(a1, a2)
#define HCCALL3(funcname, a1, a2, a3) funcname(a1, a2, a3)
#define HCCALL4(funcname, a1, a2, a3, a4) funcname(a1, a2, a4, a3)
#define HCCALL5(funcname, a1, a2, a3, a4, a5) funcname(a1, a2, a5, a4, a3)
#define HCCALL1_PTR(rettype, funcptr, a1) rettype (F_CALL_CONV * (funcptr))(a1)
#define HCCALL2_PTR(rettype, funcptr, a1, a2) rettype (F_CALL_CONV * (funcptr))(a1, a2)
#endif // !SWIZZLE_REGARG_ORDER
#else // SWIZZLE_STKARG_ORDER
#define HCIMPL0(rettype, funcname) rettype F_CALL_CONV funcname() { HCIMPL_PROLOG(funcname)
#define HCIMPL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL1_RAW(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1) {
#define HCIMPL1_V(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1) { HCIMPL_PROLOG(funcname)
#define HCIMPL2(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2) { HCIMPL_PROLOG(funcname)
#define HCIMPL2_RAW(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2) {
#define HCIMPL2_VV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2) { HCIMPL_PROLOG(funcname)
#define HCIMPL2_IV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2) { HCIMPL_PROLOG(funcname)
#define HCIMPL3(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3) { HCIMPL_PROLOG(funcname)
#define HCIMPL3_RAW(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3) {
#define HCIMPL4(rettype, funcname, a1, a2, a3, a4) rettype F_CALL_CONV funcname(a1, a2, a3, a4) { HCIMPL_PROLOG(funcname)
#define HCIMPL5(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5) { HCIMPL_PROLOG(funcname)
#define HCCALL0(funcname) funcname()
#define HCCALL1(funcname, a1) funcname(a1)
#define HCCALL1_V(funcname, a1) funcname(a1)
#define HCCALL2(funcname, a1, a2) funcname(a1, a2)
#define HCCALL3(funcname, a1, a2, a3) funcname(a1, a2, a3)
#define HCCALL4(funcname, a1, a2, a3, a4) funcname(a1, a2, a3, a4)
#define HCCALL5(funcname, a1, a2, a3, a4, a5) funcname(a1, a2, a3, a4, a5)
#define HCCALL1_PTR(rettype, funcptr, a1) rettype (F_CALL_CONV * (funcptr))(a1)
#define HCCALL2_PTR(rettype, funcptr, a1, a2) rettype (F_CALL_CONV * (funcptr))(a1, a2)
#endif // !SWIZZLE_STKARG_ORDER
#define HCIMPLEND_RAW }
#define HCIMPLEND FCALL_TRANSITION_END(); }
//==============================================================================================
// Throws an exception from an FCall. See rexcep.h for a list of valid
// exception codes.
//==============================================================================================
#define FCThrow(reKind) FCThrowEx(reKind, 0, 0, 0, 0)
//==============================================================================================
// This version lets you attach a message with inserts (similar to
// COMPlusThrow()).
//==============================================================================================
#define FCThrowEx(reKind, resID, arg1, arg2, arg3) \
{ \
while (NULL == \
__FCThrow(__me, reKind, resID, arg1, arg2, arg3)) {}; \
return 0; \
}
//==============================================================================================
// Like FCThrow but can be used for a VOID-returning FCall. The only
// difference is in the "return" statement.
//==============================================================================================
#define FCThrowVoid(reKind) FCThrowExVoid(reKind, 0, 0, 0, 0)
//==============================================================================================
// This version lets you attach a message with inserts (similar to
// COMPlusThrow()).
//==============================================================================================
#define FCThrowExVoid(reKind, resID, arg1, arg2, arg3) \
{ \
while (NULL == \
__FCThrow(__me, reKind, resID, arg1, arg2, arg3)) {}; \
return; \
}
// Use FCThrowRes to throw an exception with a localized error message from the
// ResourceManager in managed code.
#define FCThrowRes(reKind, resourceName) FCThrowArgumentEx(reKind, NULL, resourceName)
#define FCThrowArgumentNull(argName) FCThrowArgumentEx(kArgumentNullException, argName, NULL)
#define FCThrowArgumentOutOfRange(argName, message) FCThrowArgumentEx(kArgumentOutOfRangeException, argName, message)
#define FCThrowArgument(argName, message) FCThrowArgumentEx(kArgumentException, argName, message)
#define FCThrowArgumentEx(reKind, argName, resourceName) \
{ \
while (NULL == \
__FCThrowArgument(__me, reKind, argName, resourceName)) {}; \
return 0; \
}
// Use FCThrowRes to throw an exception with a localized error message from the
// ResourceManager in managed code.
#define FCThrowResVoid(reKind, resourceName) FCThrowArgumentVoidEx(reKind, NULL, resourceName)
#define FCThrowArgumentNullVoid(argName) FCThrowArgumentVoidEx(kArgumentNullException, argName, NULL)
#define FCThrowArgumentOutOfRangeVoid(argName, message) FCThrowArgumentVoidEx(kArgumentOutOfRangeException, argName, message)
#define FCThrowArgumentVoid(argName, message) FCThrowArgumentVoidEx(kArgumentException, argName, message)
#define FCThrowArgumentVoidEx(reKind, argName, resourceName) \
{ \
while (NULL == \
__FCThrowArgument(__me, reKind, argName, resourceName)) {}; \
return; \
}
// The x86 JIT calling convention expects returned small types (e.g. bool) to be
// widened on return. The C/C++ calling convention does not guarantee returned
// small types to be widened. The small types has to be artifically widened on return
// to fit x86 JIT calling convention. Thus fcalls returning small types has to
// use the FC_XXX_RET types to force C/C++ compiler to do the widening.
//
// The most common small return type of FCALLs is bool. The widening of bool is
// especially tricky since the value has to be also normalized. FC_BOOL_RET and
// FC_RETURN_BOOL macros are provided to make it fool-proof. FCALLs returning bool
// should be implemented using following pattern:
// FCIMPL0(FC_BOOL_RET, Foo) // the return type should be FC_BOOL_RET
// BOOL ret;
//
// FC_RETURN_BOOL(ret); // return statements should be FC_RETURN_BOOL
// FCIMPLEND
// This rules are verified in binder.cpp if COMPlus_ConsistencyCheck is set.
#ifdef _PREFAST_
// Use prefast build to ensure that functions returning FC_BOOL_RET
// are using FC_RETURN_BOOL to return it. Missing FC_RETURN_BOOL will
// result into type mismatch error in prefast builds. This will also
// catch misuses of FC_BOOL_RET for other places (e.g. in FCALL parameters).
typedef LPVOID FC_BOOL_RET;
#define FC_RETURN_BOOL(x) do { return (LPVOID)!!(x); } while(0)
#else
#if defined(TARGET_X86) || defined(TARGET_AMD64)
// The return value is artifically widened on x86 and amd64
typedef INT32 FC_BOOL_RET;
#else
typedef CLR_BOOL FC_BOOL_RET;
#endif
#define FC_RETURN_BOOL(x) do { return !!(x); } while(0)
#endif
#if defined(TARGET_X86) || defined(TARGET_AMD64)
// The return value is artifically widened on x86 and amd64
typedef UINT32 FC_CHAR_RET;
typedef INT32 FC_INT8_RET;
typedef UINT32 FC_UINT8_RET;
typedef INT32 FC_INT16_RET;
typedef UINT32 FC_UINT16_RET;
#else
typedef CLR_CHAR FC_CHAR_RET;
typedef INT8 FC_INT8_RET;
typedef UINT8 FC_UINT8_RET;
typedef INT16 FC_INT16_RET;
typedef UINT16 FC_UINT16_RET;
#endif
// FC_TypedByRef should be used for TypedReferences in FCall signatures
#define FC_TypedByRef TypedByRef
#define FC_DECIMAL DECIMAL
// The fcall entrypoints has to be at unique addresses. Use this helper macro to make
// the code of the fcalls unique if you get assert in ecall.cpp that mentions it.
// The parameter of the FCUnique macro is an arbitrary 32-bit random non-zero number.
#define FCUnique(unique) { Volatile<int> u = (unique); while (u.LoadWithoutBarrier() == 0) { }; }
// FCALL contracts come in two forms:
//
// Short form that should be used if the FCALL contract does not have any extras like preconditions, failure injection. Example:
//
// FCIMPL0(void, foo)
// {
// FCALL_CONTRACT;
// ...
//
// Long form that should be used otherwise. Example:
//
// FCIMPL1(void, foo, void *p)
// {
// CONTRACTL {
// FCALL_CHECK;
// PRECONDITION(CheckPointer(p));
// } CONTRACTL_END;
// ...
//
// FCALL_CHECK defines the actual contract conditions required for FCALLs
//
#define FCALL_CHECK \
THROWS; \
DISABLED(GC_TRIGGERS); /* FCALLS with HELPER frames have issues with GC_TRIGGERS */ \
MODE_COOPERATIVE;
//
// FCALL_CONTRACT should be the following shortcut:
//
// #define FCALL_CONTRACT CONTRACTL { FCALL_CHECK; } CONTRACTL_END;
//
// Since there is very little value in having runtime contracts in FCalls, FCALL_CONTRACT is defined as static contract only for performance reasons.
//
#define FCALL_CONTRACT \
STATIC_CONTRACT_THROWS; \
/* FCALLS are a special case contract wise, they are "NOTRIGGER, unless you setup a frame" */ \
STATIC_CONTRACT_GC_NOTRIGGER; \
STATIC_CONTRACT_MODE_COOPERATIVE
#endif //__FCall_h__
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/coreclr/pal/src/libunwind/src/aarch64/Linit.c
|
#define UNW_LOCAL_ONLY
#include <libunwind.h>
#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
#include "Ginit.c"
#endif
|
#define UNW_LOCAL_ONLY
#include <libunwind.h>
#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
#include "Ginit.c"
#endif
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/native/public/mono/jit/details/jit-functions.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// This file does not have ifdef guards, it is meant to be included multiple times with different definitions of MONO_API_FUNCTION
#ifndef MONO_API_FUNCTION
#error "MONO_API_FUNCTION(ret,name,args) macro not defined before including function declaration header"
#endif
MONO_API_FUNCTION(MONO_RT_EXTERNAL_ONLY MonoDomain *, mono_jit_init, (const char *file))
MONO_API_FUNCTION(MONO_RT_EXTERNAL_ONLY MonoDomain *, mono_jit_init_version, (const char *root_domain_name, const char *runtime_version))
MONO_API_FUNCTION(MonoDomain *, mono_jit_init_version_for_test_only, (const char *root_domain_name, const char *runtime_version))
MONO_API_FUNCTION(int, mono_jit_exec, (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]))
MONO_API_FUNCTION(void, mono_jit_cleanup, (MonoDomain *domain))
MONO_API_FUNCTION(mono_bool, mono_jit_set_trace_options, (const char* options))
MONO_API_FUNCTION(void, mono_set_signal_chaining, (mono_bool chain_signals))
MONO_API_FUNCTION(void, mono_set_crash_chaining, (mono_bool chain_signals))
/**
* This function is deprecated, use mono_jit_set_aot_mode instead.
*/
MONO_API_FUNCTION(void, mono_jit_set_aot_only, (mono_bool aot_only))
MONO_API_FUNCTION(void, mono_jit_set_aot_mode, (MonoAotMode mode))
/*
* Returns whether the runtime was invoked for the purpose of AOT-compiling an
* assembly, i.e. no managed code will run.
*/
MONO_API_FUNCTION(mono_bool, mono_jit_aot_compiling, (void))
MONO_API_FUNCTION(void, mono_set_break_policy, (MonoBreakPolicyFunc policy_callback))
MONO_API_FUNCTION(void, mono_jit_parse_options, (int argc, char * argv[]))
MONO_API_FUNCTION(char*, mono_get_runtime_build_info, (void))
MONO_API_FUNCTION(MONO_RT_EXTERNAL_ONLY void, mono_set_use_llvm, (mono_bool use_llvm))
MONO_API_FUNCTION(MONO_RT_EXTERNAL_ONLY void, mono_aot_register_module, (void **aot_info))
MONO_API_FUNCTION(MONO_RT_EXTERNAL_ONLY MonoDomain*, mono_jit_thread_attach, (MonoDomain *domain))
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
// This file does not have ifdef guards, it is meant to be included multiple times with different definitions of MONO_API_FUNCTION
#ifndef MONO_API_FUNCTION
#error "MONO_API_FUNCTION(ret,name,args) macro not defined before including function declaration header"
#endif
MONO_API_FUNCTION(MONO_RT_EXTERNAL_ONLY MonoDomain *, mono_jit_init, (const char *file))
MONO_API_FUNCTION(MONO_RT_EXTERNAL_ONLY MonoDomain *, mono_jit_init_version, (const char *root_domain_name, const char *runtime_version))
MONO_API_FUNCTION(MonoDomain *, mono_jit_init_version_for_test_only, (const char *root_domain_name, const char *runtime_version))
MONO_API_FUNCTION(int, mono_jit_exec, (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]))
MONO_API_FUNCTION(void, mono_jit_cleanup, (MonoDomain *domain))
MONO_API_FUNCTION(mono_bool, mono_jit_set_trace_options, (const char* options))
MONO_API_FUNCTION(void, mono_set_signal_chaining, (mono_bool chain_signals))
MONO_API_FUNCTION(void, mono_set_crash_chaining, (mono_bool chain_signals))
/**
* This function is deprecated, use mono_jit_set_aot_mode instead.
*/
MONO_API_FUNCTION(void, mono_jit_set_aot_only, (mono_bool aot_only))
MONO_API_FUNCTION(void, mono_jit_set_aot_mode, (MonoAotMode mode))
/*
* Returns whether the runtime was invoked for the purpose of AOT-compiling an
* assembly, i.e. no managed code will run.
*/
MONO_API_FUNCTION(mono_bool, mono_jit_aot_compiling, (void))
MONO_API_FUNCTION(void, mono_set_break_policy, (MonoBreakPolicyFunc policy_callback))
MONO_API_FUNCTION(void, mono_jit_parse_options, (int argc, char * argv[]))
MONO_API_FUNCTION(char*, mono_get_runtime_build_info, (void))
MONO_API_FUNCTION(MONO_RT_EXTERNAL_ONLY void, mono_set_use_llvm, (mono_bool use_llvm))
MONO_API_FUNCTION(MONO_RT_EXTERNAL_ONLY void, mono_aot_register_module, (void **aot_info))
MONO_API_FUNCTION(MONO_RT_EXTERNAL_ONLY MonoDomain*, mono_jit_thread_attach, (MonoDomain *domain))
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/coreclr/vm/qcall.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// QCall.H
#ifndef __QCall_h__
#define __QCall_h__
#include "clr_std/type_traits"
//
// QCALLS
//
// QCalls are internal calls from managed code in CoreLib to unmanaged code in VM. QCalls are very much like
// a normal P/Invoke from CoreLib to VM.
//
// Unlike FCalls, QCalls will marshal all arguments as unmanaged types like a normal P/Invoke. QCall also switch to preemptive
// GC mode like a normal P/Invoke. These two features should make QCalls easier to write reliably compared to FCalls.
// QCalls are not prone to GC holes and GC starvation bugs that are common with FCalls.
//
// QCalls perform better compared to FCalls w/ HelperMethodFrame. The QCall overhead is about 1.4x less compared to
// FCall w/ HelperMethodFrame overhead on x86. The performance is about the same on x64. However, the implementation
// of P/Invoke marshaling on x64 is not tuned for performance yet. The QCalls should become significantly faster compared
// to FCalls w/ HelperMethodFrame on x64 as we do performance tuning of P/Invoke marshaling on x64.
//
//
// The preferred type of QCall arguments is primitive types that efficiently handled by the P/Invoke marshaler (INT32, LPCWSTR, BOOL).
// (Notice that BOOL is the correct boolean flavor for QCall arguments. CLR_BOOL is the correct boolean flavor for FCall arguments.)
//
// The pointers to common unmanaged EE structures should be wrapped into helper handle types. This is to make the managed implementation
// type safe and avoid falling into unsafe C# everywhere. See the AssemblyHandle below for a good example.
//
// There is a way to pass raw object references in and out of QCalls. It is done by wrapping a pointer to
// a local variable in a handle. It is intentionally cumbersome and should be avoided if reasonably possible.
// See the StringHandleOnStack in the example below. String arguments will get marshaled in as LPCWSTR.
// Returning objects, especially strings, from QCalls is the only common pattern
// where returning the raw objects (as an OUT argument) is widely acceptable.
//
//
// QCall example - managed part (do not replicate the comments into your actual QCall implementation):
// ---------------------------------------------------------------------------------------------------
//
// class Foo {
//
// // All QCalls should have the following DllImport and SuppressUnmanagedCodeSecurity attributes
// [DllImport(JitHelpers.QCall, EntryPoint = "FooNative_Bar", CharSet = CharSet.Unicode)]
// // QCalls should always be static extern.
// private static extern bool Bar(int flags, string inString, StringHandleOnStack retString);
//
// // Many QCalls have a thin managed wrapper around them to expose them to the world in more meaningful way.
// public string Bar(int flags)
// {
// string retString = null;
//
// // The strings are returned from QCalls by taking address
// // of a local variable using JitHelpers.GetStringHandleOnStack method
// if (!Bar(flags, this.Id, JitHelpers.GetStringHandleOnStack(ref retString)))
// FatalError();
//
// return retString;
// }
//
// Every QCall produces a couple of bogus FXCop warnings currently. Just add them to the FXCop exlusion list for now.
//
//
// QCall example - unmanaged part (do not replicate the comments into your actual QCall implementation):
// -----------------------------------------------------------------------------------------------------
//
// The entrypoints of all QCalls has to be registered in tables in vm\qcallentrypoints.cpp using the DllImportEntry macro,
// For example: DllImportEntry(FooNative_Bar)
//
// extern "C" BOOL QCALLTYPE FooNative_Bar(int flags, LPCWSTR wszString, QCall::StringHandleOnStack retString)
// {
// // All QCalls should have QCALL_CONTRACT. It is alias for THROWS; GC_TRIGGERS; MODE_PREEMPTIVE.
// QCALL_CONTRACT;
//
// // Optionally, use QCALL_CHECK instead and the expanded form of the contract if you want to specify preconditions:
// // CONTRACTL {
// // QCALL_CHECK;
// // PRECONDITION(wszString != NULL);
// // } CONTRACTL_END;
//
// // The only line between QCALL_CONTRACT and BEGIN_QCALL
// // should be the return value declaration if there is one.
// BOOL retVal = FALSE;
//
// // The body has to be enclosed in BEGIN_QCALL/END_QCALL macro. It is necessary to make the exception handling work.
// BEGIN_QCALL;
//
// // Validate arguments if necessary and throw exceptions like anywhere else in the EE. There is no convention currently
// // on whether the argument validation should be done in managed or unmanaged code.
// if (flags != 0)
// COMPlusThrow(kArgumentException, L"InvalidFlags");
//
// // No need to worry about GC moving strings passed into QCall. Marshaling pins them for us.
// printf("%S", wszString);
//
// // This is the most efficient way to return strings back to managed code. No need to use StringBuilder.
// retString.Set(L"Hello");
//
// // You can not return from inside of BEGIN_QCALL/END_QCALL. The return value has to be passed out in helper variable.
// retVal = TRUE;
//
// END_QCALL;
//
// return retVal;
// }
#ifdef TARGET_UNIX
#define QCALLTYPE __cdecl
#else // TARGET_UNIX
#define QCALLTYPE __stdcall
#endif // !TARGET_UNIX
#define BEGIN_QCALL \
INSTALL_MANAGED_EXCEPTION_DISPATCHER \
INSTALL_UNWIND_AND_CONTINUE_HANDLER
#define END_QCALL \
UNINSTALL_UNWIND_AND_CONTINUE_HANDLER \
UNINSTALL_MANAGED_EXCEPTION_DISPATCHER
#define QCALL_CHECK \
THROWS; \
GC_TRIGGERS; \
MODE_PREEMPTIVE; \
#define QCALL_CHECK_NO_GC_TRANSITION \
THROWS; \
GC_TRIGGERS; \
MODE_COOPERATIVE; \
#define QCALL_CONTRACT CONTRACTL { QCALL_CHECK; } CONTRACTL_END;
#define QCALL_CONTRACT_NO_GC_TRANSITION CONTRACTL { QCALL_CHECK_NO_GC_TRANSITION; } CONTRACTL_END;
//
// Scope class for QCall helper methods and types
//
class QCall
{
public:
//
// Helper types to aid marshaling of QCall arguments in type-safe manner
//
// The C/C++ compiler has to treat these types as POD (plain old data) to generate
// a calling convention compatible with P/Invoke marshaling. This means that:
// NONE OF THESE HELPER TYPES CAN HAVE A CONSTRUCTOR OR DESTRUCTOR!
// THESE HELPER TYPES CAN NOT BE IMPLEMENTED USING INHERITANCE OR TEMPLATES!
//
//
// StringHandleOnStack is used for managed strings
//
struct StringHandleOnStack
{
StringObject ** m_ppStringObject;
#ifndef DACCESS_COMPILE
//
// Helpers for returning managed string from QCall
//
// Raw setter - note that you need to be in cooperative mode
void Set(STRINGREF s)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
MODE_COOPERATIVE;
}
CONTRACTL_END;
// The space for the return value has to be on the stack
_ASSERTE(Thread::IsAddressInCurrentStack(m_ppStringObject));
*m_ppStringObject = STRINGREFToObject(s);
}
void Set(const SString& value);
void Set(LPCWSTR pwzValue);
void Set(LPCUTF8 pszValue);
#endif // !DACCESS_COMPILE
};
//
// ObjectHandleOnStack type is used for managed objects
//
struct ObjectHandleOnStack
{
Object ** m_ppObject;
OBJECTREF Get()
{
LIMITED_METHOD_CONTRACT;
return ObjectToOBJECTREF(*m_ppObject);
}
#ifndef DACCESS_COMPILE
//
// Helpers for returning common managed types from QCall
//
void Set(OBJECTREF o)
{
LIMITED_METHOD_CONTRACT;
// The space for the return value has to be on the stack
_ASSERTE(Thread::IsAddressInCurrentStack(m_ppObject));
*m_ppObject = OBJECTREFToObject(o);
}
void SetByteArray(const BYTE * p, COUNT_T length);
void SetIntPtrArray(const PVOID * p, COUNT_T length);
void SetGuidArray(const GUID * p, COUNT_T length);
// Do not add operator overloads to convert this object into a stack reference to a specific object type
// such as OBJECTREF *. While such things are correct, our debug checking logic is unable to verify that
// the object reference is actually protected from access and therefore will assert.
// See bug 254159 for details.
#endif // !DACCESS_COMPILE
};
//
// StackCrawlMarkHandle is used for passing StackCrawlMark into QCalls
//
struct StackCrawlMarkHandle
{
StackCrawlMark * m_pMark;
operator StackCrawlMark * ()
{
LIMITED_METHOD_CONTRACT;
return m_pMark;
}
};
struct AssemblyHandle
{
Object ** m_ppObject;
DomainAssembly * m_pAssembly;
operator DomainAssembly * ()
{
LIMITED_METHOD_CONTRACT;
return m_pAssembly;
}
DomainAssembly * operator->() const
{
LIMITED_METHOD_CONTRACT;
return m_pAssembly;
}
};
struct ModuleHandle
{
Object ** m_ppObject;
Module * m_pModule;
operator Module * ()
{
LIMITED_METHOD_CONTRACT;
return m_pModule;
}
Module * operator->() const
{
LIMITED_METHOD_CONTRACT;
return m_pModule;
}
};
struct TypeHandle
{
Object ** m_ppObject;
PTR_VOID m_pTypeHandle;
::TypeHandle AsTypeHandle()
{
LIMITED_METHOD_CONTRACT;
return ::TypeHandle::FromPtr(m_pTypeHandle);
}
};
struct LoaderAllocatorHandle
{
LoaderAllocator * m_pLoaderAllocator;
operator LoaderAllocator * ()
{
LIMITED_METHOD_CONTRACT;
return m_pLoaderAllocator;
}
LoaderAllocator * operator -> () const
{
LIMITED_METHOD_CONTRACT;
return m_pLoaderAllocator;
}
static LoaderAllocatorHandle From(LoaderAllocator * pLoaderAllocator)
{
LoaderAllocatorHandle h;
h.m_pLoaderAllocator = pLoaderAllocator;
return h;
}
};
// The lifetime management between managed and native Thread objects is broken. There is a resurrection
// race where one can get a dangling pointer to the unmanaged Thread object. Once this race is fixed
// we may need to revisit how the unmanaged thread handles are passed around.
struct ThreadHandle
{
Thread * m_pThread;
operator Thread * ()
{
LIMITED_METHOD_CONTRACT;
return m_pThread;
}
Thread * operator->() const
{
LIMITED_METHOD_CONTRACT;
return m_pThread;
}
};
};
typedef void* EnregisteredTypeHandle;
extern const void* QCallResolveDllImport(const char* name);
#endif //__QCall_h__
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// QCall.H
#ifndef __QCall_h__
#define __QCall_h__
#include "clr_std/type_traits"
//
// QCALLS
//
// QCalls are internal calls from managed code in CoreLib to unmanaged code in VM. QCalls are very much like
// a normal P/Invoke from CoreLib to VM.
//
// Unlike FCalls, QCalls will marshal all arguments as unmanaged types like a normal P/Invoke. QCall also switch to preemptive
// GC mode like a normal P/Invoke. These two features should make QCalls easier to write reliably compared to FCalls.
// QCalls are not prone to GC holes and GC starvation bugs that are common with FCalls.
//
// QCalls perform better compared to FCalls w/ HelperMethodFrame. The QCall overhead is about 1.4x less compared to
// FCall w/ HelperMethodFrame overhead on x86. The performance is about the same on x64. However, the implementation
// of P/Invoke marshaling on x64 is not tuned for performance yet. The QCalls should become significantly faster compared
// to FCalls w/ HelperMethodFrame on x64 as we do performance tuning of P/Invoke marshaling on x64.
//
//
// The preferred type of QCall arguments is primitive types that efficiently handled by the P/Invoke marshaler (INT32, LPCWSTR, BOOL).
// (Notice that BOOL is the correct boolean flavor for QCall arguments. CLR_BOOL is the correct boolean flavor for FCall arguments.)
//
// The pointers to common unmanaged EE structures should be wrapped into helper handle types. This is to make the managed implementation
// type safe and avoid falling into unsafe C# everywhere. See the AssemblyHandle below for a good example.
//
// There is a way to pass raw object references in and out of QCalls. It is done by wrapping a pointer to
// a local variable in a handle. It is intentionally cumbersome and should be avoided if reasonably possible.
// See the StringHandleOnStack in the example below. String arguments will get marshaled in as LPCWSTR.
// Returning objects, especially strings, from QCalls is the only common pattern
// where returning the raw objects (as an OUT argument) is widely acceptable.
//
//
// QCall example - managed part (do not replicate the comments into your actual QCall implementation):
// ---------------------------------------------------------------------------------------------------
//
// class Foo {
//
// // All QCalls should have the following DllImport and SuppressUnmanagedCodeSecurity attributes
// [DllImport(JitHelpers.QCall, EntryPoint = "FooNative_Bar", CharSet = CharSet.Unicode)]
// // QCalls should always be static extern.
// private static extern bool Bar(int flags, string inString, StringHandleOnStack retString);
//
// // Many QCalls have a thin managed wrapper around them to expose them to the world in more meaningful way.
// public string Bar(int flags)
// {
// string retString = null;
//
// // The strings are returned from QCalls by taking address
// // of a local variable using JitHelpers.GetStringHandleOnStack method
// if (!Bar(flags, this.Id, JitHelpers.GetStringHandleOnStack(ref retString)))
// FatalError();
//
// return retString;
// }
//
// Every QCall produces a couple of bogus FXCop warnings currently. Just add them to the FXCop exlusion list for now.
//
//
// QCall example - unmanaged part (do not replicate the comments into your actual QCall implementation):
// -----------------------------------------------------------------------------------------------------
//
// The entrypoints of all QCalls has to be registered in tables in vm\qcallentrypoints.cpp using the DllImportEntry macro,
// For example: DllImportEntry(FooNative_Bar)
//
// extern "C" BOOL QCALLTYPE FooNative_Bar(int flags, LPCWSTR wszString, QCall::StringHandleOnStack retString)
// {
// // All QCalls should have QCALL_CONTRACT. It is alias for THROWS; GC_TRIGGERS; MODE_PREEMPTIVE.
// QCALL_CONTRACT;
//
// // Optionally, use QCALL_CHECK instead and the expanded form of the contract if you want to specify preconditions:
// // CONTRACTL {
// // QCALL_CHECK;
// // PRECONDITION(wszString != NULL);
// // } CONTRACTL_END;
//
// // The only line between QCALL_CONTRACT and BEGIN_QCALL
// // should be the return value declaration if there is one.
// BOOL retVal = FALSE;
//
// // The body has to be enclosed in BEGIN_QCALL/END_QCALL macro. It is necessary to make the exception handling work.
// BEGIN_QCALL;
//
// // Validate arguments if necessary and throw exceptions like anywhere else in the EE. There is no convention currently
// // on whether the argument validation should be done in managed or unmanaged code.
// if (flags != 0)
// COMPlusThrow(kArgumentException, L"InvalidFlags");
//
// // No need to worry about GC moving strings passed into QCall. Marshaling pins them for us.
// printf("%S", wszString);
//
// // This is the most efficient way to return strings back to managed code. No need to use StringBuilder.
// retString.Set(L"Hello");
//
// // You can not return from inside of BEGIN_QCALL/END_QCALL. The return value has to be passed out in helper variable.
// retVal = TRUE;
//
// END_QCALL;
//
// return retVal;
// }
#ifdef TARGET_UNIX
#define QCALLTYPE __cdecl
#else // TARGET_UNIX
#define QCALLTYPE __stdcall
#endif // !TARGET_UNIX
#define BEGIN_QCALL \
INSTALL_MANAGED_EXCEPTION_DISPATCHER \
INSTALL_UNWIND_AND_CONTINUE_HANDLER
#define END_QCALL \
UNINSTALL_UNWIND_AND_CONTINUE_HANDLER \
UNINSTALL_MANAGED_EXCEPTION_DISPATCHER
#define QCALL_CHECK \
THROWS; \
GC_TRIGGERS; \
MODE_PREEMPTIVE; \
#define QCALL_CHECK_NO_GC_TRANSITION \
THROWS; \
GC_TRIGGERS; \
MODE_COOPERATIVE; \
#define QCALL_CONTRACT CONTRACTL { QCALL_CHECK; } CONTRACTL_END;
#define QCALL_CONTRACT_NO_GC_TRANSITION CONTRACTL { QCALL_CHECK_NO_GC_TRANSITION; } CONTRACTL_END;
//
// Scope class for QCall helper methods and types
//
class QCall
{
public:
//
// Helper types to aid marshaling of QCall arguments in type-safe manner
//
// The C/C++ compiler has to treat these types as POD (plain old data) to generate
// a calling convention compatible with P/Invoke marshaling. This means that:
// NONE OF THESE HELPER TYPES CAN HAVE A CONSTRUCTOR OR DESTRUCTOR!
// THESE HELPER TYPES CAN NOT BE IMPLEMENTED USING INHERITANCE OR TEMPLATES!
//
//
// StringHandleOnStack is used for managed strings
//
struct StringHandleOnStack
{
StringObject ** m_ppStringObject;
#ifndef DACCESS_COMPILE
//
// Helpers for returning managed string from QCall
//
// Raw setter - note that you need to be in cooperative mode
void Set(STRINGREF s)
{
CONTRACTL
{
NOTHROW;
GC_NOTRIGGER;
MODE_COOPERATIVE;
}
CONTRACTL_END;
// The space for the return value has to be on the stack
_ASSERTE(Thread::IsAddressInCurrentStack(m_ppStringObject));
*m_ppStringObject = STRINGREFToObject(s);
}
void Set(const SString& value);
void Set(LPCWSTR pwzValue);
void Set(LPCUTF8 pszValue);
#endif // !DACCESS_COMPILE
};
//
// ObjectHandleOnStack type is used for managed objects
//
struct ObjectHandleOnStack
{
Object ** m_ppObject;
OBJECTREF Get()
{
LIMITED_METHOD_CONTRACT;
return ObjectToOBJECTREF(*m_ppObject);
}
#ifndef DACCESS_COMPILE
//
// Helpers for returning common managed types from QCall
//
void Set(OBJECTREF o)
{
LIMITED_METHOD_CONTRACT;
// The space for the return value has to be on the stack
_ASSERTE(Thread::IsAddressInCurrentStack(m_ppObject));
*m_ppObject = OBJECTREFToObject(o);
}
void SetByteArray(const BYTE * p, COUNT_T length);
void SetIntPtrArray(const PVOID * p, COUNT_T length);
void SetGuidArray(const GUID * p, COUNT_T length);
// Do not add operator overloads to convert this object into a stack reference to a specific object type
// such as OBJECTREF *. While such things are correct, our debug checking logic is unable to verify that
// the object reference is actually protected from access and therefore will assert.
// See bug 254159 for details.
#endif // !DACCESS_COMPILE
};
//
// StackCrawlMarkHandle is used for passing StackCrawlMark into QCalls
//
struct StackCrawlMarkHandle
{
StackCrawlMark * m_pMark;
operator StackCrawlMark * ()
{
LIMITED_METHOD_CONTRACT;
return m_pMark;
}
};
struct AssemblyHandle
{
Object ** m_ppObject;
DomainAssembly * m_pAssembly;
operator DomainAssembly * ()
{
LIMITED_METHOD_CONTRACT;
return m_pAssembly;
}
DomainAssembly * operator->() const
{
LIMITED_METHOD_CONTRACT;
return m_pAssembly;
}
};
struct ModuleHandle
{
Object ** m_ppObject;
Module * m_pModule;
operator Module * ()
{
LIMITED_METHOD_CONTRACT;
return m_pModule;
}
Module * operator->() const
{
LIMITED_METHOD_CONTRACT;
return m_pModule;
}
};
struct TypeHandle
{
Object ** m_ppObject;
PTR_VOID m_pTypeHandle;
::TypeHandle AsTypeHandle()
{
LIMITED_METHOD_CONTRACT;
return ::TypeHandle::FromPtr(m_pTypeHandle);
}
};
struct LoaderAllocatorHandle
{
LoaderAllocator * m_pLoaderAllocator;
operator LoaderAllocator * ()
{
LIMITED_METHOD_CONTRACT;
return m_pLoaderAllocator;
}
LoaderAllocator * operator -> () const
{
LIMITED_METHOD_CONTRACT;
return m_pLoaderAllocator;
}
static LoaderAllocatorHandle From(LoaderAllocator * pLoaderAllocator)
{
LoaderAllocatorHandle h;
h.m_pLoaderAllocator = pLoaderAllocator;
return h;
}
};
// The lifetime management between managed and native Thread objects is broken. There is a resurrection
// race where one can get a dangling pointer to the unmanaged Thread object. Once this race is fixed
// we may need to revisit how the unmanaged thread handles are passed around.
struct ThreadHandle
{
Thread * m_pThread;
operator Thread * ()
{
LIMITED_METHOD_CONTRACT;
return m_pThread;
}
Thread * operator->() const
{
LIMITED_METHOD_CONTRACT;
return m_pThread;
}
};
};
typedef void* EnregisteredTypeHandle;
extern const void* QCallResolveDllImport(const char* name);
#endif //__QCall_h__
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/mono/mono/metadata/dynamic-stream.c
|
/**
* \file
* MonoDynamicStream
* Copyright 2016 Microsoft
*
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include <config.h>
#include <glib.h>
#include "mono/metadata/dynamic-stream-internals.h"
#include "mono/metadata/metadata-internals.h"
#include "mono/utils/checked-build.h"
#include "mono/utils/mono-error-internals.h"
#include "object-internals.h"
void
mono_dynstream_init (MonoDynamicStream *sh)
{
MONO_REQ_GC_NEUTRAL_MODE;
sh->index = 0;
sh->alloc_size = 4096;
sh->data = (char *)g_malloc (4096);
sh->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
mono_dynstream_insert_string (sh, "");
}
static void
make_room_in_stream (MonoDynamicStream *stream, int size)
{
MONO_REQ_GC_NEUTRAL_MODE;
if (size <= stream->alloc_size)
return;
while (stream->alloc_size <= size) {
if (stream->alloc_size < 4096)
stream->alloc_size = 4096;
else
stream->alloc_size *= 2;
}
stream->data = (char *)g_realloc (stream->data, stream->alloc_size);
}
guint32
mono_dynstream_insert_string (MonoDynamicStream *sh, const char *str)
{
MONO_REQ_GC_NEUTRAL_MODE;
guint32 idx;
guint32 len;
gpointer oldkey, oldval;
if (g_hash_table_lookup_extended (sh->hash, str, &oldkey, &oldval))
return GPOINTER_TO_UINT (oldval);
len = strlen (str) + 1;
idx = sh->index;
make_room_in_stream (sh, idx + len);
/*
* We strdup the string even if we already copy them in sh->data
* so that the string pointers in the hash remain valid even if
* we need to realloc sh->data. We may want to avoid that later.
*/
g_hash_table_insert (sh->hash, g_strdup (str), GUINT_TO_POINTER (idx));
memcpy (sh->data + idx, str, len);
sh->index += len;
return idx;
}
guint32
mono_dynstream_insert_mstring (MonoDynamicStream *sh, MonoString *str, MonoError *error)
{
MONO_REQ_GC_UNSAFE_MODE;
error_init (error);
char *name = mono_string_to_utf8_checked_internal (str, error);
return_val_if_nok (error, -1);
guint32 idx;
idx = mono_dynstream_insert_string (sh, name);
g_free (name);
return idx;
}
guint32
mono_dynstream_add_data (MonoDynamicStream *stream, gconstpointer data, guint32 len)
{
MONO_REQ_GC_NEUTRAL_MODE;
guint32 idx;
make_room_in_stream (stream, stream->index + len);
memcpy (stream->data + stream->index, data, len);
idx = stream->index;
stream->index += len;
/*
* align index? Not without adding an additional param that controls it since
* we may store a blob value in pieces.
*/
return idx;
}
guint32
mono_dynstream_add_zero (MonoDynamicStream *stream, guint32 len)
{
MONO_REQ_GC_NEUTRAL_MODE;
guint32 idx;
make_room_in_stream (stream, stream->index + len);
memset (stream->data + stream->index, 0, len);
idx = stream->index;
stream->index += len;
return idx;
}
void
mono_dynstream_data_align (MonoDynamicStream *stream)
{
MONO_REQ_GC_NEUTRAL_MODE;
guint32 count = stream->index % 4;
/* we assume the stream data will be aligned */
if (count)
mono_dynstream_add_zero (stream, 4 - count);
}
|
/**
* \file
* MonoDynamicStream
* Copyright 2016 Microsoft
*
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include <config.h>
#include <glib.h>
#include "mono/metadata/dynamic-stream-internals.h"
#include "mono/metadata/metadata-internals.h"
#include "mono/utils/checked-build.h"
#include "mono/utils/mono-error-internals.h"
#include "object-internals.h"
void
mono_dynstream_init (MonoDynamicStream *sh)
{
MONO_REQ_GC_NEUTRAL_MODE;
sh->index = 0;
sh->alloc_size = 4096;
sh->data = (char *)g_malloc (4096);
sh->hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
mono_dynstream_insert_string (sh, "");
}
static void
make_room_in_stream (MonoDynamicStream *stream, int size)
{
MONO_REQ_GC_NEUTRAL_MODE;
if (size <= stream->alloc_size)
return;
while (stream->alloc_size <= size) {
if (stream->alloc_size < 4096)
stream->alloc_size = 4096;
else
stream->alloc_size *= 2;
}
stream->data = (char *)g_realloc (stream->data, stream->alloc_size);
}
guint32
mono_dynstream_insert_string (MonoDynamicStream *sh, const char *str)
{
MONO_REQ_GC_NEUTRAL_MODE;
guint32 idx;
guint32 len;
gpointer oldkey, oldval;
if (g_hash_table_lookup_extended (sh->hash, str, &oldkey, &oldval))
return GPOINTER_TO_UINT (oldval);
len = strlen (str) + 1;
idx = sh->index;
make_room_in_stream (sh, idx + len);
/*
* We strdup the string even if we already copy them in sh->data
* so that the string pointers in the hash remain valid even if
* we need to realloc sh->data. We may want to avoid that later.
*/
g_hash_table_insert (sh->hash, g_strdup (str), GUINT_TO_POINTER (idx));
memcpy (sh->data + idx, str, len);
sh->index += len;
return idx;
}
guint32
mono_dynstream_insert_mstring (MonoDynamicStream *sh, MonoString *str, MonoError *error)
{
MONO_REQ_GC_UNSAFE_MODE;
error_init (error);
char *name = mono_string_to_utf8_checked_internal (str, error);
return_val_if_nok (error, -1);
guint32 idx;
idx = mono_dynstream_insert_string (sh, name);
g_free (name);
return idx;
}
guint32
mono_dynstream_add_data (MonoDynamicStream *stream, gconstpointer data, guint32 len)
{
MONO_REQ_GC_NEUTRAL_MODE;
guint32 idx;
make_room_in_stream (stream, stream->index + len);
memcpy (stream->data + stream->index, data, len);
idx = stream->index;
stream->index += len;
/*
* align index? Not without adding an additional param that controls it since
* we may store a blob value in pieces.
*/
return idx;
}
guint32
mono_dynstream_add_zero (MonoDynamicStream *stream, guint32 len)
{
MONO_REQ_GC_NEUTRAL_MODE;
guint32 idx;
make_room_in_stream (stream, stream->index + len);
memset (stream->data + stream->index, 0, len);
idx = stream->index;
stream->index += len;
return idx;
}
void
mono_dynstream_data_align (MonoDynamicStream *stream)
{
MONO_REQ_GC_NEUTRAL_MODE;
guint32 count = stream->index % 4;
/* we assume the stream data will be aligned */
if (count)
mono_dynstream_add_zero (stream, 4 - count);
}
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/mono/mono/utils/mono-proclib.c
|
/**
* \file
* Copyright 2008-2011 Novell Inc
* Copyright 2011 Xamarin Inc
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include "config.h"
#include "utils/mono-proclib.h"
#include "utils/mono-time.h"
#include "utils/mono-errno.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SCHED_GETAFFINITY
#include <sched.h>
#endif
#include <utils/mono-mmap.h>
#include <utils/strenc-internals.h>
#include <utils/strenc.h>
#include <utils/mono-error-internals.h>
#include <utils/mono-logger-internals.h>
#if defined(_POSIX_VERSION)
#ifdef HAVE_SYS_ERRNO_H
#include <sys/errno.h>
#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <errno.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#endif
#if defined(__HAIKU__)
#include <os/kernel/OS.h>
#endif
#if defined(_AIX)
#include <procinfo.h>
#endif
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
#include <sys/proc.h>
#if defined(__APPLE__)
#include <mach/mach.h>
#endif
#ifdef HAVE_SYS_USER_H
#include <sys/user.h>
#endif
#ifdef HAVE_STRUCT_KINFO_PROC_KP_PROC
# define kinfo_starttime_member kp_proc.p_starttime
# define kinfo_pid_member kp_proc.p_pid
# define kinfo_name_member kp_proc.p_comm
#elif defined(__NetBSD__)
# define kinfo_starttime_member p_ustart_sec
# define kinfo_pid_member p_pid
# define kinfo_name_member p_comm
#elif defined(__OpenBSD__)
// Can not figure out how to get the proc's start time on OpenBSD
# undef kinfo_starttime_member
# define kinfo_pid_member p_pid
# define kinfo_name_member p_comm
#else
#define kinfo_starttime_member ki_start
#define kinfo_pid_member ki_pid
#define kinfo_name_member ki_comm
#endif
#define USE_SYSCTL 1
#endif
#ifdef HAVE_SCHED_GETAFFINITY
# ifndef HAVE_GNU_CPU_COUNT
static int
CPU_COUNT(cpu_set_t *set)
{
int i, count = 0;
for (int i = 0; i < CPU_SETSIZE; i++)
if (CPU_ISSET(i, set))
count++;
return count;
}
# endif
#endif
/**
* mono_process_list:
* \param size a pointer to a location where the size of the returned array is stored
* \returns an array of pid values for the processes currently running on the system.
* The size of the array is stored in \p size.
*/
gpointer*
mono_process_list (int *size)
{
#if USE_SYSCTL
int res, i;
#ifdef KERN_PROC2
int mib [6];
size_t data_len = sizeof (struct kinfo_proc2) * 400;
struct kinfo_proc2 *processes = g_malloc (data_len);
#else
int mib [4];
size_t data_len = sizeof (struct kinfo_proc) * 16;
struct kinfo_proc *processes;
int limit = 8;
#endif /* KERN_PROC2 */
void **buf = NULL;
if (size)
*size = 0;
#ifdef KERN_PROC2
if (!processes)
return NULL;
mib [0] = CTL_KERN;
mib [1] = KERN_PROC2;
mib [2] = KERN_PROC_ALL;
mib [3] = 0;
mib [4] = sizeof(struct kinfo_proc2);
mib [5] = 400; /* XXX */
res = sysctl (mib, 6, processes, &data_len, NULL, 0);
if (res < 0) {
g_free (processes);
return NULL;
}
#else
processes = NULL;
while (limit) {
mib [0] = CTL_KERN;
mib [1] = KERN_PROC;
mib [2] = KERN_PROC_ALL;
mib [3] = 0;
res = sysctl (mib, 3, NULL, &data_len, NULL, 0);
if (res)
return NULL;
processes = (struct kinfo_proc *) g_malloc (data_len);
res = sysctl (mib, 3, processes, &data_len, NULL, 0);
if (res < 0) {
g_free (processes);
if (errno != ENOMEM)
return NULL;
limit --;
} else {
break;
}
}
#endif /* KERN_PROC2 */
#ifdef KERN_PROC2
res = data_len/sizeof (struct kinfo_proc2);
#else
res = data_len/sizeof (struct kinfo_proc);
#endif /* KERN_PROC2 */
buf = (void **) g_realloc (buf, res * sizeof (void*));
for (i = 0; i < res; ++i)
buf [i] = GINT_TO_POINTER (processes [i].kinfo_pid_member);
g_free (processes);
if (size)
*size = res;
return buf;
#elif defined(__HAIKU__)
int32 cookie = 0;
int32 i = 0;
team_info ti;
system_info si;
get_system_info(&si);
void **buf = g_calloc(si.used_teams, sizeof(void*));
while (get_next_team_info(&cookie, &ti) == B_OK && i < si.used_teams) {
buf[i++] = GINT_TO_POINTER (ti.team);
}
*size = i;
return buf;
#elif defined(_AIX)
void **buf = NULL;
struct procentry64 *procs = NULL;
int count = 0;
int i = 0;
pid_t pid = 1; // start at 1, 0 is a null process (???)
// count number of procs + compensate for new ones forked in while we do it.
// (it's not an atomic operation) 1000000 is the limit IBM ps seems to use
// when I inspected it under truss. the second call we do to getprocs64 will
// then only allocate what we need, instead of allocating some obscenely large
// array on the heap.
count = getprocs64(NULL, sizeof (struct procentry64), NULL, 0, &pid, 1000000);
if (count < 1)
goto cleanup;
count += 10;
pid = 1; // reset the pid cookie
// 5026 bytes is the ideal size for the C struct. you may not like it, but
// this is what peak allocation looks like
procs = g_calloc (count, sizeof (struct procentry64));
// the man page recommends you do this in a loop, but you can also just do it
// in one shot; again, like what ps does. let the returned count (in case it's
// less) be what we then allocate the array of pids from (in case of ANOTHER
// system-wide race condition with processes)
count = getprocs64 (procs, sizeof (struct procentry64), NULL, 0, &pid, count);
if (count < 1 || procs == NULL)
goto cleanup;
buf = g_calloc (count, sizeof (void*));
for (i = 0; i < count; i++) {
buf[i] = GINT_TO_POINTER (procs[i].pi_pid);
}
*size = i;
cleanup:
g_free (procs);
return buf;
#else
const char *name;
void **buf = NULL;
int count = 0;
int i = 0;
GDir *dir = g_dir_open ("/proc/", 0, NULL);
if (!dir) {
if (size)
*size = 0;
return NULL;
}
while ((name = g_dir_read_name (dir))) {
int pid;
char *nend;
pid = strtol (name, &nend, 10);
if (pid <= 0 || nend == name || *nend)
continue;
if (i >= count) {
if (!count)
count = 16;
else
count *= 2;
buf = (void **)g_realloc (buf, count * sizeof (void*));
}
buf [i++] = GINT_TO_POINTER (pid);
}
g_dir_close (dir);
if (size)
*size = i;
return buf;
#endif
}
static G_GNUC_UNUSED char*
get_pid_status_item_buf (int pid, const char *item, char *rbuf, int blen, MonoProcessError *error)
{
char buf [256];
char *s;
FILE *f;
size_t len = strlen (item);
g_snprintf (buf, sizeof (buf), "/proc/%d/status", pid);
f = fopen (buf, "r");
if (!f) {
if (error)
*error = MONO_PROCESS_ERROR_NOT_FOUND;
return NULL;
}
while ((s = fgets (buf, sizeof (buf), f))) {
if (*item != *buf)
continue;
if (strncmp (buf, item, len))
continue;
s = buf + len;
while (g_ascii_isspace (*s)) s++;
if (*s++ != ':')
continue;
while (g_ascii_isspace (*s)) s++;
fclose (f);
len = strlen (s);
memcpy (rbuf, s, MIN (len, blen));
rbuf [MIN (len, blen) - 1] = 0;
if (error)
*error = MONO_PROCESS_ERROR_NONE;
return rbuf;
}
fclose (f);
if (error)
*error = MONO_PROCESS_ERROR_OTHER;
return NULL;
}
#if USE_SYSCTL
#ifdef KERN_PROC2
#define KINFO_PROC struct kinfo_proc2
#else
#define KINFO_PROC struct kinfo_proc
#endif
static gboolean
sysctl_kinfo_proc (gpointer pid, KINFO_PROC* processi)
{
int res;
size_t data_len = sizeof (KINFO_PROC);
#ifdef KERN_PROC2
int mib [6];
mib [0] = CTL_KERN;
mib [1] = KERN_PROC2;
mib [2] = KERN_PROC_PID;
mib [3] = GPOINTER_TO_UINT (pid);
mib [4] = sizeof(KINFO_PROC);
mib [5] = 400; /* XXX */
res = sysctl (mib, 6, processi, &data_len, NULL, 0);
#else
int mib [4];
mib [0] = CTL_KERN;
mib [1] = KERN_PROC;
mib [2] = KERN_PROC_PID;
mib [3] = GPOINTER_TO_UINT (pid);
res = sysctl (mib, 4, processi, &data_len, NULL, 0);
#endif /* KERN_PROC2 */
if (res < 0 || data_len != sizeof (KINFO_PROC))
return FALSE;
return TRUE;
}
#endif /* USE_SYSCTL */
/**
* mono_process_get_name:
* \param pid pid of the process
* \param buf byte buffer where to store the name of the prcoess
* \param len size of the buffer \p buf
* \returns the name of the process identified by \p pid, storing it
* inside \p buf for a maximum of len bytes (including the terminating 0).
*/
char*
mono_process_get_name (gpointer pid, char *buf, int len)
{
#if USE_SYSCTL
KINFO_PROC processi;
memset (buf, 0, len);
if (sysctl_kinfo_proc (pid, &processi))
memcpy (buf, processi.kinfo_name_member, len - 1);
return buf;
#elif defined(_AIX)
struct procentry64 proc;
pid_t newpid = GPOINTER_TO_INT (pid);
if (getprocs64 (&proc, sizeof (struct procentry64), NULL, 0, &newpid, 1) == 1) {
g_strlcpy (buf, proc.pi_comm, len - 1);
}
return buf;
#else
char fname [128];
FILE *file;
char *p;
size_t r;
sprintf (fname, "/proc/%d/cmdline", GPOINTER_TO_INT (pid));
buf [0] = 0;
file = fopen (fname, "r");
if (!file)
return buf;
r = fread (buf, 1, len - 1, file);
fclose (file);
buf [r] = 0;
p = strrchr (buf, '/');
if (p)
return p + 1;
if (r == 0) {
return get_pid_status_item_buf (GPOINTER_TO_INT (pid), "Name", buf, len, NULL);
}
return buf;
#endif
}
void
mono_process_get_times (gpointer pid, gint64 *start_time, gint64 *user_time, gint64 *kernel_time)
{
if (user_time)
*user_time = mono_process_get_data (pid, MONO_PROCESS_USER_TIME);
if (kernel_time)
*kernel_time = mono_process_get_data (pid, MONO_PROCESS_SYSTEM_TIME);
if (start_time) {
*start_time = 0;
#if USE_SYSCTL && defined(kinfo_starttime_member)
{
KINFO_PROC processi;
if (sysctl_kinfo_proc (pid, &processi)) {
#if defined(__NetBSD__)
struct timeval tv;
tv.tv_sec = processi.kinfo_starttime_member;
tv.tv_usec = processi.p_ustart_usec;
*start_time = mono_100ns_datetime_from_timeval(tv);
#else
*start_time = mono_100ns_datetime_from_timeval (processi.kinfo_starttime_member);
#endif
}
}
#endif
if (*start_time == 0) {
static guint64 boot_time = 0;
if (!boot_time)
boot_time = mono_100ns_datetime () - mono_msec_boottime () * 10000;
*start_time = boot_time + mono_process_get_data (pid, MONO_PROCESS_ELAPSED);
}
}
}
/*
* /proc/pid/stat format:
* pid (cmdname) S
* [0] ppid pgid sid tty_nr tty_pgrp flags min_flt cmin_flt maj_flt cmaj_flt
* [10] utime stime cutime cstime prio nice threads 0 start_time vsize
* [20] rss rsslim start_code end_code start_stack esp eip pending blocked sigign
* [30] sigcatch wchan 0 0 exit_signal cpu rt_prio policy
*/
#define RET_ERROR(err) do { \
if (error) *error = (err); \
return 0; \
} while (0)
static gint64
get_process_stat_item (int pid, int pos, int sum, MonoProcessError *error)
{
#if defined(__APPLE__)
double process_user_time = 0, process_system_time = 0;//, process_percent = 0;
task_t task;
struct task_basic_info t_info;
mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT, th_count;
thread_array_t th_array;
size_t i;
kern_return_t ret;
if (pid == getpid ()) {
/* task_for_pid () doesn't work on ios, even for the current process */
task = mach_task_self ();
} else {
do {
ret = task_for_pid (mach_task_self (), pid, &task);
} while (ret == KERN_ABORTED);
if (ret != KERN_SUCCESS)
RET_ERROR (MONO_PROCESS_ERROR_NOT_FOUND);
}
do {
ret = task_info (task, TASK_BASIC_INFO, (task_info_t)&t_info, &t_info_count);
} while (ret == KERN_ABORTED);
if (ret != KERN_SUCCESS) {
if (pid != getpid ())
mach_port_deallocate (mach_task_self (), task);
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
}
do {
ret = task_threads (task, &th_array, &th_count);
} while (ret == KERN_ABORTED);
if (ret != KERN_SUCCESS) {
if (pid != getpid ())
mach_port_deallocate (mach_task_self (), task);
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
}
for (i = 0; i < th_count; i++) {
double thread_user_time, thread_system_time;//, thread_percent;
struct thread_basic_info th_info;
mach_msg_type_number_t th_info_count = THREAD_BASIC_INFO_COUNT;
do {
ret = thread_info(th_array[i], THREAD_BASIC_INFO, (thread_info_t)&th_info, &th_info_count);
} while (ret == KERN_ABORTED);
if (ret == KERN_SUCCESS) {
thread_user_time = th_info.user_time.seconds + th_info.user_time.microseconds / 1e6;
thread_system_time = th_info.system_time.seconds + th_info.system_time.microseconds / 1e6;
//thread_percent = (double)th_info.cpu_usage / TH_USAGE_SCALE;
process_user_time += thread_user_time;
process_system_time += thread_system_time;
//process_percent += th_percent;
}
}
for (i = 0; i < th_count; i++)
mach_port_deallocate(task, th_array[i]);
if (pid != getpid ())
mach_port_deallocate (mach_task_self (), task);
process_user_time += t_info.user_time.seconds + t_info.user_time.microseconds / 1e6;
process_system_time += t_info.system_time.seconds + t_info.system_time.microseconds / 1e6;
if (pos == 10 && sum == TRUE)
return (gint64)((process_user_time + process_system_time) * 10000000);
else if (pos == 10)
return (gint64)(process_user_time * 10000000);
else if (pos == 11)
return (gint64)(process_system_time * 10000000);
return 0;
#else
char buf [512];
char *s, *end;
FILE *f;
size_t len;
int i;
gint64 value;
g_snprintf (buf, sizeof (buf), "/proc/%d/stat", pid);
f = fopen (buf, "r");
if (!f)
RET_ERROR (MONO_PROCESS_ERROR_NOT_FOUND);
len = fread (buf, 1, sizeof (buf), f);
fclose (f);
if (len <= 0)
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
s = strchr (buf, ')');
if (!s)
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
s++;
while (g_ascii_isspace (*s)) s++;
if (!*s)
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
/* skip the status char */
while (*s && !g_ascii_isspace (*s)) s++;
if (!*s)
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
for (i = 0; i < pos; ++i) {
while (g_ascii_isspace (*s)) s++;
if (!*s)
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
while (*s && !g_ascii_isspace (*s)) s++;
if (!*s)
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
}
/* we are finally at the needed item */
value = strtoul (s, &end, 0);
/* add also the following value */
if (sum) {
while (g_ascii_isspace (*s)) s++;
if (!*s)
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
value += strtoul (s, &end, 0);
}
if (error)
*error = MONO_PROCESS_ERROR_NONE;
return value;
#endif
}
static int
get_user_hz (void)
{
static int user_hz = 0;
if (user_hz == 0) {
#if defined (_SC_CLK_TCK) && defined (HAVE_SYSCONF)
user_hz = sysconf (_SC_CLK_TCK);
#endif
if (user_hz == 0)
user_hz = 100;
}
return user_hz;
}
static gint64
get_process_stat_time (int pid, int pos, int sum, MonoProcessError *error)
{
gint64 val = get_process_stat_item (pid, pos, sum, error);
#if defined(__APPLE__)
return val;
#else
/* return 100ns ticks */
return (val * 10000000) / get_user_hz ();
#endif
}
static gint64
get_pid_status_item (int pid, const char *item, MonoProcessError *error, int multiplier)
{
#if defined(__APPLE__)
// ignore the multiplier
gint64 ret;
task_t task;
task_vm_info_data_t t_info;
mach_msg_type_number_t info_count = TASK_VM_INFO_COUNT;
kern_return_t mach_ret;
if (pid == getpid ()) {
/* task_for_pid () doesn't work on ios, even for the current process */
task = mach_task_self ();
} else {
do {
mach_ret = task_for_pid (mach_task_self (), pid, &task);
} while (mach_ret == KERN_ABORTED);
if (mach_ret != KERN_SUCCESS)
RET_ERROR (MONO_PROCESS_ERROR_NOT_FOUND);
}
do {
mach_ret = task_info (task, TASK_VM_INFO, (task_info_t)&t_info, &info_count);
} while (mach_ret == KERN_ABORTED);
if (mach_ret != KERN_SUCCESS) {
if (pid != getpid ())
mach_port_deallocate (mach_task_self (), task);
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
}
if(strcmp (item, "VmData") == 0)
ret = t_info.internal + t_info.compressed;
else if (strcmp (item, "VmRSS") == 0)
ret = t_info.resident_size;
else if(strcmp (item, "VmHWM") == 0)
ret = t_info.resident_size_peak;
else if (strcmp (item, "VmSize") == 0 || strcmp (item, "VmPeak") == 0)
ret = t_info.virtual_size;
else if (strcmp (item, "Threads") == 0) {
struct task_basic_info t_info;
mach_msg_type_number_t th_count = TASK_BASIC_INFO_COUNT;
do {
mach_ret = task_info (task, TASK_BASIC_INFO, (task_info_t)&t_info, &th_count);
} while (mach_ret == KERN_ABORTED);
if (mach_ret != KERN_SUCCESS) {
if (pid != getpid ())
mach_port_deallocate (mach_task_self (), task);
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
}
ret = th_count;
} else if (strcmp (item, "VmSwap") == 0)
ret = t_info.compressed;
else
ret = 0;
if (pid != getpid ())
mach_port_deallocate (mach_task_self (), task);
return ret;
#else
char buf [64];
char *s;
s = get_pid_status_item_buf (pid, item, buf, sizeof (buf), error);
if (s)
return ((gint64) atol (s)) * multiplier;
return 0;
#endif
}
/**
* mono_process_get_data:
* \param pid pid of the process
* \param data description of data to return
* \returns a data item of a process like user time, memory use etc,
* according to the \p data argumet.
*/
gint64
mono_process_get_data_with_error (gpointer pid, MonoProcessData data, MonoProcessError *error)
{
gint64 val;
int rpid = GPOINTER_TO_INT (pid);
if (error)
*error = MONO_PROCESS_ERROR_OTHER;
switch (data) {
case MONO_PROCESS_NUM_THREADS:
return get_pid_status_item (rpid, "Threads", error, 1);
case MONO_PROCESS_USER_TIME:
return get_process_stat_time (rpid, 10, FALSE, error);
case MONO_PROCESS_SYSTEM_TIME:
return get_process_stat_time (rpid, 11, FALSE, error);
case MONO_PROCESS_TOTAL_TIME:
return get_process_stat_time (rpid, 10, TRUE, error);
case MONO_PROCESS_WORKING_SET:
return get_pid_status_item (rpid, "VmRSS", error, 1024);
case MONO_PROCESS_WORKING_SET_PEAK:
val = get_pid_status_item (rpid, "VmHWM", error, 1024);
if (val == 0)
val = get_pid_status_item (rpid, "VmRSS", error, 1024);
return val;
case MONO_PROCESS_PRIVATE_BYTES:
return get_pid_status_item (rpid, "VmData", error, 1024);
case MONO_PROCESS_VIRTUAL_BYTES:
return get_pid_status_item (rpid, "VmSize", error, 1024);
case MONO_PROCESS_VIRTUAL_BYTES_PEAK:
val = get_pid_status_item (rpid, "VmPeak", error, 1024);
if (val == 0)
val = get_pid_status_item (rpid, "VmSize", error, 1024);
return val;
case MONO_PROCESS_FAULTS:
return get_process_stat_item (rpid, 6, TRUE, error);
case MONO_PROCESS_ELAPSED:
return get_process_stat_time (rpid, 18, FALSE, error);
case MONO_PROCESS_PPID:
return get_process_stat_time (rpid, 0, FALSE, error);
case MONO_PROCESS_PAGED_BYTES:
return get_pid_status_item (rpid, "VmSwap", error, 1024);
/* Nothing yet */
case MONO_PROCESS_END:
return 0;
}
return 0;
}
gint64
mono_process_get_data (gpointer pid, MonoProcessData data)
{
MonoProcessError error;
return mono_process_get_data_with_error (pid, data, &error);
}
#ifndef HOST_WIN32
int
mono_process_current_pid ()
{
#if defined(HAVE_GETPID)
return (int) getpid ();
#elif defined(HOST_WASI)
return 0;
#else
#error getpid
#endif
}
#endif /* !HOST_WIN32 */
/**
* mono_cpu_count:
* \returns the number of processors on the system.
*/
#ifndef HOST_WIN32
int
mono_cpu_count (void)
{
#ifdef HOST_ANDROID
/* Android tries really hard to save power by powering off CPUs on SMP phones which
* means the normal way to query cpu count returns a wrong value with userspace API.
* Instead we use /sys entries to query the actual hardware CPU count.
*/
int count = 0;
char buffer[8] = {'\0'};
int present = open ("/sys/devices/system/cpu/present", O_RDONLY);
/* Format of the /sys entry is a cpulist of indexes which in the case
* of present is always of the form "0-(n-1)" when there is more than
* 1 core, n being the number of CPU cores in the system. Otherwise
* the value is simply 0
*/
if (present != -1 && read (present, (char*)buffer, sizeof (buffer)) > 3)
count = strtol (((char*)buffer) + 2, NULL, 10);
if (present != -1)
close (present);
if (count > 0)
return count + 1;
#endif
#if defined(HOST_ARM) || defined (HOST_ARM64)
/*
* Recap from Alexander Köplinger <[email protected]>:
*
* When we merged the change from PR #2722, we started seeing random failures on ARM in
* the MonoTests.System.Threading.ThreadPoolTests.SetAndGetMaxThreads and
* MonoTests.System.Threading.ManualResetEventSlimTests.Constructor_Defaults tests. Both
* of those tests are dealing with Environment.ProcessorCount to verify some implementation
* details.
*
* It turns out that on the Jetson TK1 board we use on public Jenkins and on ARM kernels
* in general, the value returned by sched_getaffinity (or _SC_NPROCESSORS_ONLN) doesn't
* contain CPUs/cores that are powered off for power saving reasons. This is contrary to
* what happens on x86, where even cores in deep-sleep state are returned [1], [2]. This
* means that we would get a processor count of 1 at one point in time and a higher value
* when load increases later on as the system wakes CPUs.
*
* Various runtime pieces like the threadpool and also user code however relies on the
* value returned by Environment.ProcessorCount e.g. for deciding how many parallel tasks
* to start, thereby limiting the performance when that code thinks we only have one CPU.
*
* Talking to a few people, this was the reason why we changed to _SC_NPROCESSORS_CONF in
* mono#1688 and why we added a special case for Android in mono@de3addc to get the "real"
* number of processors in the system.
*
* Because of those issues Android/Dalvik also switched from _ONLN to _SC_NPROCESSORS_CONF
* for the Java API Runtime.availableProcessors() too [3], citing:
* > Traditionally this returned the number currently online, but many mobile devices are
* able to take unused cores offline to save power, so releases newer than Android 4.2 (Jelly
* Bean) return the maximum number of cores that could be made available if there were no
* power or heat constraints.
*
* The problem with sticking to _SC_NPROCESSORS_CONF however is that it breaks down in
* constrained environments like Docker or with an explicit CPU affinity set by the Linux
* `taskset` command, They'd get a higher CPU count than can be used, start more threads etc.
* which results in unnecessary context switches and overloaded systems. That's why we need
* to respect sched_getaffinity.
*
* So while in an ideal world we would be able to rely on sched_getaffinity/_SC_NPROCESSORS_ONLN
* to return the number of theoretically available CPUs regardless of power saving measures
* everywhere, we can't do this on ARM.
*
* I think the pragmatic solution is the following:
* * use sched_getaffinity (+ fallback to _SC_NPROCESSORS_ONLN in case of error) on x86. This
* ensures we're inline with what OpenJDK [4] and CoreCLR [5] do
* * use _SC_NPROCESSORS_CONF exclusively on ARM (I think we could eventually even get rid of
* the HOST_ANDROID special case)
*
* Helpful links:
*
* [1] https://sourceware.org/ml/libc-alpha/2013-07/msg00383.html
* [2] https://lists.01.org/pipermail/powertop/2012-September/000433.html
* [3] https://android.googlesource.com/platform/libcore/+/750dc634e56c58d1d04f6a138734ac2b772900b5%5E1..750dc634e56c58d1d04f6a138734ac2b772900b5/
* [4] https://bugs.openjdk.java.net/browse/JDK-6515172
* [5] https://github.com/dotnet/coreclr/blob/7058273693db2555f127ce16e6b0c5b40fb04867/src/pal/src/misc/sysinfo.cpp#L148
*/
#if defined (_SC_NPROCESSORS_CONF) && defined (HAVE_SYSCONF)
{
int count = sysconf (_SC_NPROCESSORS_CONF);
if (count > 0)
return count;
}
#endif
#else
#ifdef HAVE_SCHED_GETAFFINITY
{
cpu_set_t set;
if (sched_getaffinity (mono_process_current_pid (), sizeof (set), &set) == 0)
return CPU_COUNT (&set);
}
#endif
#if defined (_SC_NPROCESSORS_ONLN) && defined (HAVE_SYSCONF)
{
int count = sysconf (_SC_NPROCESSORS_ONLN);
if (count > 0)
return count;
}
#endif
#endif /* defined(HOST_ARM) || defined (HOST_ARM64) */
#ifdef USE_SYSCTL
{
int count;
int mib [2];
size_t len = sizeof (int);
mib [0] = CTL_HW;
mib [1] = HW_NCPU;
if (sysctl (mib, 2, &count, &len, NULL, 0) == 0)
return count;
}
#endif
/* FIXME: warn */
return 1;
}
#endif /* !HOST_WIN32 */
static void
get_cpu_times (int cpu_id, gint64 *user, gint64 *systemt, gint64 *irq, gint64 *sirq, gint64 *idle)
{
char buf [256];
char *s;
int uhz = get_user_hz ();
guint64 user_ticks = 0, nice_ticks = 0, system_ticks = 0, idle_ticks = 0, irq_ticks = 0, sirq_ticks = 0;
FILE *f = fopen ("/proc/stat", "r");
if (!f)
return;
if (cpu_id < 0)
uhz *= mono_cpu_count ();
while ((s = fgets (buf, sizeof (buf), f))) {
char *data = NULL;
if (cpu_id < 0 && strncmp (s, "cpu", 3) == 0 && g_ascii_isspace (s [3])) {
data = s + 4;
} else if (cpu_id >= 0 && strncmp (s, "cpu", 3) == 0 && strtol (s + 3, &data, 10) == cpu_id) {
if (data == s + 3)
continue;
data++;
} else {
continue;
}
user_ticks = strtoull (data, &data, 10);
nice_ticks = strtoull (data, &data, 10);
system_ticks = strtoull (data, &data, 10);
idle_ticks = strtoull (data, &data, 10);
/* iowait_ticks = strtoull (data, &data, 10); */
irq_ticks = strtoull (data, &data, 10);
sirq_ticks = strtoull (data, &data, 10);
break;
}
fclose (f);
if (user)
*user = (user_ticks + nice_ticks) * 10000000 / uhz;
if (systemt)
*systemt = (system_ticks) * 10000000 / uhz;
if (irq)
*irq = (irq_ticks) * 10000000 / uhz;
if (sirq)
*sirq = (sirq_ticks) * 10000000 / uhz;
if (idle)
*idle = (idle_ticks) * 10000000 / uhz;
}
/**
* mono_cpu_get_data:
* \param cpu_id processor number or -1 to get a summary of all the processors
* \param data type of data to retrieve
* Get data about a processor on the system, like time spent in user space or idle time.
*/
gint64
mono_cpu_get_data (int cpu_id, MonoCpuData data, MonoProcessError *error)
{
gint64 value = 0;
if (error)
*error = MONO_PROCESS_ERROR_NONE;
switch (data) {
case MONO_CPU_USER_TIME:
get_cpu_times (cpu_id, &value, NULL, NULL, NULL, NULL);
break;
case MONO_CPU_PRIV_TIME:
get_cpu_times (cpu_id, NULL, &value, NULL, NULL, NULL);
break;
case MONO_CPU_INTR_TIME:
get_cpu_times (cpu_id, NULL, NULL, &value, NULL, NULL);
break;
case MONO_CPU_DCP_TIME:
get_cpu_times (cpu_id, NULL, NULL, NULL, &value, NULL);
break;
case MONO_CPU_IDLE_TIME:
get_cpu_times (cpu_id, NULL, NULL, NULL, NULL, &value);
break;
case MONO_CPU_END:
/* Nothing yet */
return 0;
}
return value;
}
int
mono_atexit (void (*func)(void))
{
#if defined(HOST_ANDROID) || !defined(HAVE_ATEXIT)
/* Some versions of android libc doesn't define atexit () */
return 0;
#else
return atexit (func);
#endif
}
/*
* This function returns the cpu usage in percentage,
* normalized on the number of cores.
*
* Warning : the percentage returned can be > 100%. This
* might happens on systems like Android which, for
* battery and performance reasons, shut down cores and
* lie about the number of active cores.
*/
#ifndef HOST_WIN32
gint32
mono_cpu_usage (MonoCpuUsageState *prev)
{
gint32 cpu_usage = 0;
#ifdef HAVE_GETRUSAGE
gint64 cpu_total_time;
gint64 cpu_busy_time;
struct rusage resource_usage;
gint64 current_time;
gint64 kernel_time;
gint64 user_time;
if (getrusage (RUSAGE_SELF, &resource_usage) == -1) {
g_error ("getrusage() failed, errno is %d (%s)\n", errno, strerror (errno));
return -1;
}
current_time = mono_100ns_ticks ();
kernel_time = resource_usage.ru_stime.tv_sec * 1000 * 1000 * 10 + resource_usage.ru_stime.tv_usec * 10;
user_time = resource_usage.ru_utime.tv_sec * 1000 * 1000 * 10 + resource_usage.ru_utime.tv_usec * 10;
cpu_busy_time = (user_time - (prev ? prev->user_time : 0)) + (kernel_time - (prev ? prev->kernel_time : 0));
cpu_total_time = (current_time - (prev ? prev->current_time : 0)) * mono_cpu_count ();
if (prev) {
prev->kernel_time = kernel_time;
prev->user_time = user_time;
prev->current_time = current_time;
}
if (cpu_total_time > 0 && cpu_busy_time > 0)
cpu_usage = (gint32)(cpu_busy_time * 100 / cpu_total_time);
#endif
return cpu_usage;
}
#endif /* !HOST_WIN32 */
|
/**
* \file
* Copyright 2008-2011 Novell Inc
* Copyright 2011 Xamarin Inc
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include "config.h"
#include "utils/mono-proclib.h"
#include "utils/mono-time.h"
#include "utils/mono-errno.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SCHED_GETAFFINITY
#include <sched.h>
#endif
#include <utils/mono-mmap.h>
#include <utils/strenc-internals.h>
#include <utils/strenc.h>
#include <utils/mono-error-internals.h>
#include <utils/mono-logger-internals.h>
#if defined(_POSIX_VERSION)
#ifdef HAVE_SYS_ERRNO_H
#include <sys/errno.h>
#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <errno.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#endif
#if defined(__HAIKU__)
#include <os/kernel/OS.h>
#endif
#if defined(_AIX)
#include <procinfo.h>
#endif
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
#include <sys/proc.h>
#if defined(__APPLE__)
#include <mach/mach.h>
#endif
#ifdef HAVE_SYS_USER_H
#include <sys/user.h>
#endif
#ifdef HAVE_STRUCT_KINFO_PROC_KP_PROC
# define kinfo_starttime_member kp_proc.p_starttime
# define kinfo_pid_member kp_proc.p_pid
# define kinfo_name_member kp_proc.p_comm
#elif defined(__NetBSD__)
# define kinfo_starttime_member p_ustart_sec
# define kinfo_pid_member p_pid
# define kinfo_name_member p_comm
#elif defined(__OpenBSD__)
// Can not figure out how to get the proc's start time on OpenBSD
# undef kinfo_starttime_member
# define kinfo_pid_member p_pid
# define kinfo_name_member p_comm
#else
#define kinfo_starttime_member ki_start
#define kinfo_pid_member ki_pid
#define kinfo_name_member ki_comm
#endif
#define USE_SYSCTL 1
#endif
#ifdef HAVE_SCHED_GETAFFINITY
# ifndef HAVE_GNU_CPU_COUNT
static int
CPU_COUNT(cpu_set_t *set)
{
int i, count = 0;
for (int i = 0; i < CPU_SETSIZE; i++)
if (CPU_ISSET(i, set))
count++;
return count;
}
# endif
#endif
/**
* mono_process_list:
* \param size a pointer to a location where the size of the returned array is stored
* \returns an array of pid values for the processes currently running on the system.
* The size of the array is stored in \p size.
*/
gpointer*
mono_process_list (int *size)
{
#if USE_SYSCTL
int res, i;
#ifdef KERN_PROC2
int mib [6];
size_t data_len = sizeof (struct kinfo_proc2) * 400;
struct kinfo_proc2 *processes = g_malloc (data_len);
#else
int mib [4];
size_t data_len = sizeof (struct kinfo_proc) * 16;
struct kinfo_proc *processes;
int limit = 8;
#endif /* KERN_PROC2 */
void **buf = NULL;
if (size)
*size = 0;
#ifdef KERN_PROC2
if (!processes)
return NULL;
mib [0] = CTL_KERN;
mib [1] = KERN_PROC2;
mib [2] = KERN_PROC_ALL;
mib [3] = 0;
mib [4] = sizeof(struct kinfo_proc2);
mib [5] = 400; /* XXX */
res = sysctl (mib, 6, processes, &data_len, NULL, 0);
if (res < 0) {
g_free (processes);
return NULL;
}
#else
processes = NULL;
while (limit) {
mib [0] = CTL_KERN;
mib [1] = KERN_PROC;
mib [2] = KERN_PROC_ALL;
mib [3] = 0;
res = sysctl (mib, 3, NULL, &data_len, NULL, 0);
if (res)
return NULL;
processes = (struct kinfo_proc *) g_malloc (data_len);
res = sysctl (mib, 3, processes, &data_len, NULL, 0);
if (res < 0) {
g_free (processes);
if (errno != ENOMEM)
return NULL;
limit --;
} else {
break;
}
}
#endif /* KERN_PROC2 */
#ifdef KERN_PROC2
res = data_len/sizeof (struct kinfo_proc2);
#else
res = data_len/sizeof (struct kinfo_proc);
#endif /* KERN_PROC2 */
buf = (void **) g_realloc (buf, res * sizeof (void*));
for (i = 0; i < res; ++i)
buf [i] = GINT_TO_POINTER (processes [i].kinfo_pid_member);
g_free (processes);
if (size)
*size = res;
return buf;
#elif defined(__HAIKU__)
int32 cookie = 0;
int32 i = 0;
team_info ti;
system_info si;
get_system_info(&si);
void **buf = g_calloc(si.used_teams, sizeof(void*));
while (get_next_team_info(&cookie, &ti) == B_OK && i < si.used_teams) {
buf[i++] = GINT_TO_POINTER (ti.team);
}
*size = i;
return buf;
#elif defined(_AIX)
void **buf = NULL;
struct procentry64 *procs = NULL;
int count = 0;
int i = 0;
pid_t pid = 1; // start at 1, 0 is a null process (???)
// count number of procs + compensate for new ones forked in while we do it.
// (it's not an atomic operation) 1000000 is the limit IBM ps seems to use
// when I inspected it under truss. the second call we do to getprocs64 will
// then only allocate what we need, instead of allocating some obscenely large
// array on the heap.
count = getprocs64(NULL, sizeof (struct procentry64), NULL, 0, &pid, 1000000);
if (count < 1)
goto cleanup;
count += 10;
pid = 1; // reset the pid cookie
// 5026 bytes is the ideal size for the C struct. you may not like it, but
// this is what peak allocation looks like
procs = g_calloc (count, sizeof (struct procentry64));
// the man page recommends you do this in a loop, but you can also just do it
// in one shot; again, like what ps does. let the returned count (in case it's
// less) be what we then allocate the array of pids from (in case of ANOTHER
// system-wide race condition with processes)
count = getprocs64 (procs, sizeof (struct procentry64), NULL, 0, &pid, count);
if (count < 1 || procs == NULL)
goto cleanup;
buf = g_calloc (count, sizeof (void*));
for (i = 0; i < count; i++) {
buf[i] = GINT_TO_POINTER (procs[i].pi_pid);
}
*size = i;
cleanup:
g_free (procs);
return buf;
#else
const char *name;
void **buf = NULL;
int count = 0;
int i = 0;
GDir *dir = g_dir_open ("/proc/", 0, NULL);
if (!dir) {
if (size)
*size = 0;
return NULL;
}
while ((name = g_dir_read_name (dir))) {
int pid;
char *nend;
pid = strtol (name, &nend, 10);
if (pid <= 0 || nend == name || *nend)
continue;
if (i >= count) {
if (!count)
count = 16;
else
count *= 2;
buf = (void **)g_realloc (buf, count * sizeof (void*));
}
buf [i++] = GINT_TO_POINTER (pid);
}
g_dir_close (dir);
if (size)
*size = i;
return buf;
#endif
}
static G_GNUC_UNUSED char*
get_pid_status_item_buf (int pid, const char *item, char *rbuf, int blen, MonoProcessError *error)
{
char buf [256];
char *s;
FILE *f;
size_t len = strlen (item);
g_snprintf (buf, sizeof (buf), "/proc/%d/status", pid);
f = fopen (buf, "r");
if (!f) {
if (error)
*error = MONO_PROCESS_ERROR_NOT_FOUND;
return NULL;
}
while ((s = fgets (buf, sizeof (buf), f))) {
if (*item != *buf)
continue;
if (strncmp (buf, item, len))
continue;
s = buf + len;
while (g_ascii_isspace (*s)) s++;
if (*s++ != ':')
continue;
while (g_ascii_isspace (*s)) s++;
fclose (f);
len = strlen (s);
memcpy (rbuf, s, MIN (len, blen));
rbuf [MIN (len, blen) - 1] = 0;
if (error)
*error = MONO_PROCESS_ERROR_NONE;
return rbuf;
}
fclose (f);
if (error)
*error = MONO_PROCESS_ERROR_OTHER;
return NULL;
}
#if USE_SYSCTL
#ifdef KERN_PROC2
#define KINFO_PROC struct kinfo_proc2
#else
#define KINFO_PROC struct kinfo_proc
#endif
static gboolean
sysctl_kinfo_proc (gpointer pid, KINFO_PROC* processi)
{
int res;
size_t data_len = sizeof (KINFO_PROC);
#ifdef KERN_PROC2
int mib [6];
mib [0] = CTL_KERN;
mib [1] = KERN_PROC2;
mib [2] = KERN_PROC_PID;
mib [3] = GPOINTER_TO_UINT (pid);
mib [4] = sizeof(KINFO_PROC);
mib [5] = 400; /* XXX */
res = sysctl (mib, 6, processi, &data_len, NULL, 0);
#else
int mib [4];
mib [0] = CTL_KERN;
mib [1] = KERN_PROC;
mib [2] = KERN_PROC_PID;
mib [3] = GPOINTER_TO_UINT (pid);
res = sysctl (mib, 4, processi, &data_len, NULL, 0);
#endif /* KERN_PROC2 */
if (res < 0 || data_len != sizeof (KINFO_PROC))
return FALSE;
return TRUE;
}
#endif /* USE_SYSCTL */
/**
* mono_process_get_name:
* \param pid pid of the process
* \param buf byte buffer where to store the name of the prcoess
* \param len size of the buffer \p buf
* \returns the name of the process identified by \p pid, storing it
* inside \p buf for a maximum of len bytes (including the terminating 0).
*/
char*
mono_process_get_name (gpointer pid, char *buf, int len)
{
#if USE_SYSCTL
KINFO_PROC processi;
memset (buf, 0, len);
if (sysctl_kinfo_proc (pid, &processi))
memcpy (buf, processi.kinfo_name_member, len - 1);
return buf;
#elif defined(_AIX)
struct procentry64 proc;
pid_t newpid = GPOINTER_TO_INT (pid);
if (getprocs64 (&proc, sizeof (struct procentry64), NULL, 0, &newpid, 1) == 1) {
g_strlcpy (buf, proc.pi_comm, len - 1);
}
return buf;
#else
char fname [128];
FILE *file;
char *p;
size_t r;
sprintf (fname, "/proc/%d/cmdline", GPOINTER_TO_INT (pid));
buf [0] = 0;
file = fopen (fname, "r");
if (!file)
return buf;
r = fread (buf, 1, len - 1, file);
fclose (file);
buf [r] = 0;
p = strrchr (buf, '/');
if (p)
return p + 1;
if (r == 0) {
return get_pid_status_item_buf (GPOINTER_TO_INT (pid), "Name", buf, len, NULL);
}
return buf;
#endif
}
void
mono_process_get_times (gpointer pid, gint64 *start_time, gint64 *user_time, gint64 *kernel_time)
{
if (user_time)
*user_time = mono_process_get_data (pid, MONO_PROCESS_USER_TIME);
if (kernel_time)
*kernel_time = mono_process_get_data (pid, MONO_PROCESS_SYSTEM_TIME);
if (start_time) {
*start_time = 0;
#if USE_SYSCTL && defined(kinfo_starttime_member)
{
KINFO_PROC processi;
if (sysctl_kinfo_proc (pid, &processi)) {
#if defined(__NetBSD__)
struct timeval tv;
tv.tv_sec = processi.kinfo_starttime_member;
tv.tv_usec = processi.p_ustart_usec;
*start_time = mono_100ns_datetime_from_timeval(tv);
#else
*start_time = mono_100ns_datetime_from_timeval (processi.kinfo_starttime_member);
#endif
}
}
#endif
if (*start_time == 0) {
static guint64 boot_time = 0;
if (!boot_time)
boot_time = mono_100ns_datetime () - mono_msec_boottime () * 10000;
*start_time = boot_time + mono_process_get_data (pid, MONO_PROCESS_ELAPSED);
}
}
}
/*
* /proc/pid/stat format:
* pid (cmdname) S
* [0] ppid pgid sid tty_nr tty_pgrp flags min_flt cmin_flt maj_flt cmaj_flt
* [10] utime stime cutime cstime prio nice threads 0 start_time vsize
* [20] rss rsslim start_code end_code start_stack esp eip pending blocked sigign
* [30] sigcatch wchan 0 0 exit_signal cpu rt_prio policy
*/
#define RET_ERROR(err) do { \
if (error) *error = (err); \
return 0; \
} while (0)
static gint64
get_process_stat_item (int pid, int pos, int sum, MonoProcessError *error)
{
#if defined(__APPLE__)
double process_user_time = 0, process_system_time = 0;//, process_percent = 0;
task_t task;
struct task_basic_info t_info;
mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT, th_count;
thread_array_t th_array;
size_t i;
kern_return_t ret;
if (pid == getpid ()) {
/* task_for_pid () doesn't work on ios, even for the current process */
task = mach_task_self ();
} else {
do {
ret = task_for_pid (mach_task_self (), pid, &task);
} while (ret == KERN_ABORTED);
if (ret != KERN_SUCCESS)
RET_ERROR (MONO_PROCESS_ERROR_NOT_FOUND);
}
do {
ret = task_info (task, TASK_BASIC_INFO, (task_info_t)&t_info, &t_info_count);
} while (ret == KERN_ABORTED);
if (ret != KERN_SUCCESS) {
if (pid != getpid ())
mach_port_deallocate (mach_task_self (), task);
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
}
do {
ret = task_threads (task, &th_array, &th_count);
} while (ret == KERN_ABORTED);
if (ret != KERN_SUCCESS) {
if (pid != getpid ())
mach_port_deallocate (mach_task_self (), task);
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
}
for (i = 0; i < th_count; i++) {
double thread_user_time, thread_system_time;//, thread_percent;
struct thread_basic_info th_info;
mach_msg_type_number_t th_info_count = THREAD_BASIC_INFO_COUNT;
do {
ret = thread_info(th_array[i], THREAD_BASIC_INFO, (thread_info_t)&th_info, &th_info_count);
} while (ret == KERN_ABORTED);
if (ret == KERN_SUCCESS) {
thread_user_time = th_info.user_time.seconds + th_info.user_time.microseconds / 1e6;
thread_system_time = th_info.system_time.seconds + th_info.system_time.microseconds / 1e6;
//thread_percent = (double)th_info.cpu_usage / TH_USAGE_SCALE;
process_user_time += thread_user_time;
process_system_time += thread_system_time;
//process_percent += th_percent;
}
}
for (i = 0; i < th_count; i++)
mach_port_deallocate(task, th_array[i]);
if (pid != getpid ())
mach_port_deallocate (mach_task_self (), task);
process_user_time += t_info.user_time.seconds + t_info.user_time.microseconds / 1e6;
process_system_time += t_info.system_time.seconds + t_info.system_time.microseconds / 1e6;
if (pos == 10 && sum == TRUE)
return (gint64)((process_user_time + process_system_time) * 10000000);
else if (pos == 10)
return (gint64)(process_user_time * 10000000);
else if (pos == 11)
return (gint64)(process_system_time * 10000000);
return 0;
#else
char buf [512];
char *s, *end;
FILE *f;
size_t len;
int i;
gint64 value;
g_snprintf (buf, sizeof (buf), "/proc/%d/stat", pid);
f = fopen (buf, "r");
if (!f)
RET_ERROR (MONO_PROCESS_ERROR_NOT_FOUND);
len = fread (buf, 1, sizeof (buf), f);
fclose (f);
if (len <= 0)
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
s = strchr (buf, ')');
if (!s)
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
s++;
while (g_ascii_isspace (*s)) s++;
if (!*s)
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
/* skip the status char */
while (*s && !g_ascii_isspace (*s)) s++;
if (!*s)
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
for (i = 0; i < pos; ++i) {
while (g_ascii_isspace (*s)) s++;
if (!*s)
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
while (*s && !g_ascii_isspace (*s)) s++;
if (!*s)
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
}
/* we are finally at the needed item */
value = strtoul (s, &end, 0);
/* add also the following value */
if (sum) {
while (g_ascii_isspace (*s)) s++;
if (!*s)
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
value += strtoul (s, &end, 0);
}
if (error)
*error = MONO_PROCESS_ERROR_NONE;
return value;
#endif
}
static int
get_user_hz (void)
{
static int user_hz = 0;
if (user_hz == 0) {
#if defined (_SC_CLK_TCK) && defined (HAVE_SYSCONF)
user_hz = sysconf (_SC_CLK_TCK);
#endif
if (user_hz == 0)
user_hz = 100;
}
return user_hz;
}
static gint64
get_process_stat_time (int pid, int pos, int sum, MonoProcessError *error)
{
gint64 val = get_process_stat_item (pid, pos, sum, error);
#if defined(__APPLE__)
return val;
#else
/* return 100ns ticks */
return (val * 10000000) / get_user_hz ();
#endif
}
static gint64
get_pid_status_item (int pid, const char *item, MonoProcessError *error, int multiplier)
{
#if defined(__APPLE__)
// ignore the multiplier
gint64 ret;
task_t task;
task_vm_info_data_t t_info;
mach_msg_type_number_t info_count = TASK_VM_INFO_COUNT;
kern_return_t mach_ret;
if (pid == getpid ()) {
/* task_for_pid () doesn't work on ios, even for the current process */
task = mach_task_self ();
} else {
do {
mach_ret = task_for_pid (mach_task_self (), pid, &task);
} while (mach_ret == KERN_ABORTED);
if (mach_ret != KERN_SUCCESS)
RET_ERROR (MONO_PROCESS_ERROR_NOT_FOUND);
}
do {
mach_ret = task_info (task, TASK_VM_INFO, (task_info_t)&t_info, &info_count);
} while (mach_ret == KERN_ABORTED);
if (mach_ret != KERN_SUCCESS) {
if (pid != getpid ())
mach_port_deallocate (mach_task_self (), task);
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
}
if(strcmp (item, "VmData") == 0)
ret = t_info.internal + t_info.compressed;
else if (strcmp (item, "VmRSS") == 0)
ret = t_info.resident_size;
else if(strcmp (item, "VmHWM") == 0)
ret = t_info.resident_size_peak;
else if (strcmp (item, "VmSize") == 0 || strcmp (item, "VmPeak") == 0)
ret = t_info.virtual_size;
else if (strcmp (item, "Threads") == 0) {
struct task_basic_info t_info;
mach_msg_type_number_t th_count = TASK_BASIC_INFO_COUNT;
do {
mach_ret = task_info (task, TASK_BASIC_INFO, (task_info_t)&t_info, &th_count);
} while (mach_ret == KERN_ABORTED);
if (mach_ret != KERN_SUCCESS) {
if (pid != getpid ())
mach_port_deallocate (mach_task_self (), task);
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
}
ret = th_count;
} else if (strcmp (item, "VmSwap") == 0)
ret = t_info.compressed;
else
ret = 0;
if (pid != getpid ())
mach_port_deallocate (mach_task_self (), task);
return ret;
#else
char buf [64];
char *s;
s = get_pid_status_item_buf (pid, item, buf, sizeof (buf), error);
if (s)
return ((gint64) atol (s)) * multiplier;
return 0;
#endif
}
/**
* mono_process_get_data:
* \param pid pid of the process
* \param data description of data to return
* \returns a data item of a process like user time, memory use etc,
* according to the \p data argumet.
*/
gint64
mono_process_get_data_with_error (gpointer pid, MonoProcessData data, MonoProcessError *error)
{
gint64 val;
int rpid = GPOINTER_TO_INT (pid);
if (error)
*error = MONO_PROCESS_ERROR_OTHER;
switch (data) {
case MONO_PROCESS_NUM_THREADS:
return get_pid_status_item (rpid, "Threads", error, 1);
case MONO_PROCESS_USER_TIME:
return get_process_stat_time (rpid, 10, FALSE, error);
case MONO_PROCESS_SYSTEM_TIME:
return get_process_stat_time (rpid, 11, FALSE, error);
case MONO_PROCESS_TOTAL_TIME:
return get_process_stat_time (rpid, 10, TRUE, error);
case MONO_PROCESS_WORKING_SET:
return get_pid_status_item (rpid, "VmRSS", error, 1024);
case MONO_PROCESS_WORKING_SET_PEAK:
val = get_pid_status_item (rpid, "VmHWM", error, 1024);
if (val == 0)
val = get_pid_status_item (rpid, "VmRSS", error, 1024);
return val;
case MONO_PROCESS_PRIVATE_BYTES:
return get_pid_status_item (rpid, "VmData", error, 1024);
case MONO_PROCESS_VIRTUAL_BYTES:
return get_pid_status_item (rpid, "VmSize", error, 1024);
case MONO_PROCESS_VIRTUAL_BYTES_PEAK:
val = get_pid_status_item (rpid, "VmPeak", error, 1024);
if (val == 0)
val = get_pid_status_item (rpid, "VmSize", error, 1024);
return val;
case MONO_PROCESS_FAULTS:
return get_process_stat_item (rpid, 6, TRUE, error);
case MONO_PROCESS_ELAPSED:
return get_process_stat_time (rpid, 18, FALSE, error);
case MONO_PROCESS_PPID:
return get_process_stat_time (rpid, 0, FALSE, error);
case MONO_PROCESS_PAGED_BYTES:
return get_pid_status_item (rpid, "VmSwap", error, 1024);
/* Nothing yet */
case MONO_PROCESS_END:
return 0;
}
return 0;
}
gint64
mono_process_get_data (gpointer pid, MonoProcessData data)
{
MonoProcessError error;
return mono_process_get_data_with_error (pid, data, &error);
}
#ifndef HOST_WIN32
int
mono_process_current_pid ()
{
#if defined(HAVE_GETPID)
return (int) getpid ();
#elif defined(HOST_WASI)
return 0;
#else
#error getpid
#endif
}
#endif /* !HOST_WIN32 */
/**
* mono_cpu_count:
* \returns the number of processors on the system.
*/
#ifndef HOST_WIN32
int
mono_cpu_count (void)
{
#ifdef HOST_ANDROID
/* Android tries really hard to save power by powering off CPUs on SMP phones which
* means the normal way to query cpu count returns a wrong value with userspace API.
* Instead we use /sys entries to query the actual hardware CPU count.
*/
int count = 0;
char buffer[8] = {'\0'};
int present = open ("/sys/devices/system/cpu/present", O_RDONLY);
/* Format of the /sys entry is a cpulist of indexes which in the case
* of present is always of the form "0-(n-1)" when there is more than
* 1 core, n being the number of CPU cores in the system. Otherwise
* the value is simply 0
*/
if (present != -1 && read (present, (char*)buffer, sizeof (buffer)) > 3)
count = strtol (((char*)buffer) + 2, NULL, 10);
if (present != -1)
close (present);
if (count > 0)
return count + 1;
#endif
#if defined(HOST_ARM) || defined (HOST_ARM64)
/*
* Recap from Alexander Köplinger <[email protected]>:
*
* When we merged the change from PR #2722, we started seeing random failures on ARM in
* the MonoTests.System.Threading.ThreadPoolTests.SetAndGetMaxThreads and
* MonoTests.System.Threading.ManualResetEventSlimTests.Constructor_Defaults tests. Both
* of those tests are dealing with Environment.ProcessorCount to verify some implementation
* details.
*
* It turns out that on the Jetson TK1 board we use on public Jenkins and on ARM kernels
* in general, the value returned by sched_getaffinity (or _SC_NPROCESSORS_ONLN) doesn't
* contain CPUs/cores that are powered off for power saving reasons. This is contrary to
* what happens on x86, where even cores in deep-sleep state are returned [1], [2]. This
* means that we would get a processor count of 1 at one point in time and a higher value
* when load increases later on as the system wakes CPUs.
*
* Various runtime pieces like the threadpool and also user code however relies on the
* value returned by Environment.ProcessorCount e.g. for deciding how many parallel tasks
* to start, thereby limiting the performance when that code thinks we only have one CPU.
*
* Talking to a few people, this was the reason why we changed to _SC_NPROCESSORS_CONF in
* mono#1688 and why we added a special case for Android in mono@de3addc to get the "real"
* number of processors in the system.
*
* Because of those issues Android/Dalvik also switched from _ONLN to _SC_NPROCESSORS_CONF
* for the Java API Runtime.availableProcessors() too [3], citing:
* > Traditionally this returned the number currently online, but many mobile devices are
* able to take unused cores offline to save power, so releases newer than Android 4.2 (Jelly
* Bean) return the maximum number of cores that could be made available if there were no
* power or heat constraints.
*
* The problem with sticking to _SC_NPROCESSORS_CONF however is that it breaks down in
* constrained environments like Docker or with an explicit CPU affinity set by the Linux
* `taskset` command, They'd get a higher CPU count than can be used, start more threads etc.
* which results in unnecessary context switches and overloaded systems. That's why we need
* to respect sched_getaffinity.
*
* So while in an ideal world we would be able to rely on sched_getaffinity/_SC_NPROCESSORS_ONLN
* to return the number of theoretically available CPUs regardless of power saving measures
* everywhere, we can't do this on ARM.
*
* I think the pragmatic solution is the following:
* * use sched_getaffinity (+ fallback to _SC_NPROCESSORS_ONLN in case of error) on x86. This
* ensures we're inline with what OpenJDK [4] and CoreCLR [5] do
* * use _SC_NPROCESSORS_CONF exclusively on ARM (I think we could eventually even get rid of
* the HOST_ANDROID special case)
*
* Helpful links:
*
* [1] https://sourceware.org/ml/libc-alpha/2013-07/msg00383.html
* [2] https://lists.01.org/pipermail/powertop/2012-September/000433.html
* [3] https://android.googlesource.com/platform/libcore/+/750dc634e56c58d1d04f6a138734ac2b772900b5%5E1..750dc634e56c58d1d04f6a138734ac2b772900b5/
* [4] https://bugs.openjdk.java.net/browse/JDK-6515172
* [5] https://github.com/dotnet/coreclr/blob/7058273693db2555f127ce16e6b0c5b40fb04867/src/pal/src/misc/sysinfo.cpp#L148
*/
#if defined (_SC_NPROCESSORS_CONF) && defined (HAVE_SYSCONF)
{
int count = sysconf (_SC_NPROCESSORS_CONF);
if (count > 0)
return count;
}
#endif
#else
#ifdef HAVE_SCHED_GETAFFINITY
{
cpu_set_t set;
if (sched_getaffinity (mono_process_current_pid (), sizeof (set), &set) == 0)
return CPU_COUNT (&set);
}
#endif
#if defined (_SC_NPROCESSORS_ONLN) && defined (HAVE_SYSCONF)
{
int count = sysconf (_SC_NPROCESSORS_ONLN);
if (count > 0)
return count;
}
#endif
#endif /* defined(HOST_ARM) || defined (HOST_ARM64) */
#ifdef USE_SYSCTL
{
int count;
int mib [2];
size_t len = sizeof (int);
mib [0] = CTL_HW;
mib [1] = HW_NCPU;
if (sysctl (mib, 2, &count, &len, NULL, 0) == 0)
return count;
}
#endif
/* FIXME: warn */
return 1;
}
#endif /* !HOST_WIN32 */
static void
get_cpu_times (int cpu_id, gint64 *user, gint64 *systemt, gint64 *irq, gint64 *sirq, gint64 *idle)
{
char buf [256];
char *s;
int uhz = get_user_hz ();
guint64 user_ticks = 0, nice_ticks = 0, system_ticks = 0, idle_ticks = 0, irq_ticks = 0, sirq_ticks = 0;
FILE *f = fopen ("/proc/stat", "r");
if (!f)
return;
if (cpu_id < 0)
uhz *= mono_cpu_count ();
while ((s = fgets (buf, sizeof (buf), f))) {
char *data = NULL;
if (cpu_id < 0 && strncmp (s, "cpu", 3) == 0 && g_ascii_isspace (s [3])) {
data = s + 4;
} else if (cpu_id >= 0 && strncmp (s, "cpu", 3) == 0 && strtol (s + 3, &data, 10) == cpu_id) {
if (data == s + 3)
continue;
data++;
} else {
continue;
}
user_ticks = strtoull (data, &data, 10);
nice_ticks = strtoull (data, &data, 10);
system_ticks = strtoull (data, &data, 10);
idle_ticks = strtoull (data, &data, 10);
/* iowait_ticks = strtoull (data, &data, 10); */
irq_ticks = strtoull (data, &data, 10);
sirq_ticks = strtoull (data, &data, 10);
break;
}
fclose (f);
if (user)
*user = (user_ticks + nice_ticks) * 10000000 / uhz;
if (systemt)
*systemt = (system_ticks) * 10000000 / uhz;
if (irq)
*irq = (irq_ticks) * 10000000 / uhz;
if (sirq)
*sirq = (sirq_ticks) * 10000000 / uhz;
if (idle)
*idle = (idle_ticks) * 10000000 / uhz;
}
/**
* mono_cpu_get_data:
* \param cpu_id processor number or -1 to get a summary of all the processors
* \param data type of data to retrieve
* Get data about a processor on the system, like time spent in user space or idle time.
*/
gint64
mono_cpu_get_data (int cpu_id, MonoCpuData data, MonoProcessError *error)
{
gint64 value = 0;
if (error)
*error = MONO_PROCESS_ERROR_NONE;
switch (data) {
case MONO_CPU_USER_TIME:
get_cpu_times (cpu_id, &value, NULL, NULL, NULL, NULL);
break;
case MONO_CPU_PRIV_TIME:
get_cpu_times (cpu_id, NULL, &value, NULL, NULL, NULL);
break;
case MONO_CPU_INTR_TIME:
get_cpu_times (cpu_id, NULL, NULL, &value, NULL, NULL);
break;
case MONO_CPU_DCP_TIME:
get_cpu_times (cpu_id, NULL, NULL, NULL, &value, NULL);
break;
case MONO_CPU_IDLE_TIME:
get_cpu_times (cpu_id, NULL, NULL, NULL, NULL, &value);
break;
case MONO_CPU_END:
/* Nothing yet */
return 0;
}
return value;
}
int
mono_atexit (void (*func)(void))
{
#if defined(HOST_ANDROID) || !defined(HAVE_ATEXIT)
/* Some versions of android libc doesn't define atexit () */
return 0;
#else
return atexit (func);
#endif
}
/*
* This function returns the cpu usage in percentage,
* normalized on the number of cores.
*
* Warning : the percentage returned can be > 100%. This
* might happens on systems like Android which, for
* battery and performance reasons, shut down cores and
* lie about the number of active cores.
*/
#ifndef HOST_WIN32
gint32
mono_cpu_usage (MonoCpuUsageState *prev)
{
gint32 cpu_usage = 0;
#ifdef HAVE_GETRUSAGE
gint64 cpu_total_time;
gint64 cpu_busy_time;
struct rusage resource_usage;
gint64 current_time;
gint64 kernel_time;
gint64 user_time;
if (getrusage (RUSAGE_SELF, &resource_usage) == -1) {
g_error ("getrusage() failed, errno is %d (%s)\n", errno, strerror (errno));
return -1;
}
current_time = mono_100ns_ticks ();
kernel_time = resource_usage.ru_stime.tv_sec * 1000 * 1000 * 10 + resource_usage.ru_stime.tv_usec * 10;
user_time = resource_usage.ru_utime.tv_sec * 1000 * 1000 * 10 + resource_usage.ru_utime.tv_usec * 10;
cpu_busy_time = (user_time - (prev ? prev->user_time : 0)) + (kernel_time - (prev ? prev->kernel_time : 0));
cpu_total_time = (current_time - (prev ? prev->current_time : 0)) * mono_cpu_count ();
if (prev) {
prev->kernel_time = kernel_time;
prev->user_time = user_time;
prev->current_time = current_time;
}
if (cpu_total_time > 0 && cpu_busy_time > 0)
cpu_usage = (gint32)(cpu_busy_time * 100 / cpu_total_time);
#endif
return cpu_usage;
}
#endif /* !HOST_WIN32 */
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/coreclr/tools/superpmi/mcs/verbdump.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//----------------------------------------------------------
// verbDump.h - verb that Dumps a MC file
//----------------------------------------------------------
#ifndef _verbDump
#define _verbDump
class verbDump
{
public:
static int DoWork(const char* nameofInput, int indexCount, const int* indexes, bool simple);
};
#endif
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//----------------------------------------------------------
// verbDump.h - verb that Dumps a MC file
//----------------------------------------------------------
#ifndef _verbDump
#define _verbDump
class verbDump
{
public:
static int DoWork(const char* nameofInput, int indexCount, const int* indexes, bool simple);
};
#endif
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/native/external/brotli/common/constants.h
|
/* Copyright 2016 Google Inc. All Rights Reserved.
Distributed under MIT license.
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
*/
/**
* @file
* Common constants used in decoder and encoder API.
*/
#ifndef BROTLI_COMMON_CONSTANTS_H_
#define BROTLI_COMMON_CONSTANTS_H_
#include "./platform.h"
#include <brotli/port.h>
#include <brotli/types.h>
/* Specification: 7.3. Encoding of the context map */
#define BROTLI_CONTEXT_MAP_MAX_RLE 16
/* Specification: 2. Compressed representation overview */
#define BROTLI_MAX_NUMBER_OF_BLOCK_TYPES 256
/* Specification: 3.3. Alphabet sizes: insert-and-copy length */
#define BROTLI_NUM_LITERAL_SYMBOLS 256
#define BROTLI_NUM_COMMAND_SYMBOLS 704
#define BROTLI_NUM_BLOCK_LEN_SYMBOLS 26
#define BROTLI_MAX_CONTEXT_MAP_SYMBOLS (BROTLI_MAX_NUMBER_OF_BLOCK_TYPES + \
BROTLI_CONTEXT_MAP_MAX_RLE)
#define BROTLI_MAX_BLOCK_TYPE_SYMBOLS (BROTLI_MAX_NUMBER_OF_BLOCK_TYPES + 2)
/* Specification: 3.5. Complex prefix codes */
#define BROTLI_REPEAT_PREVIOUS_CODE_LENGTH 16
#define BROTLI_REPEAT_ZERO_CODE_LENGTH 17
#define BROTLI_CODE_LENGTH_CODES (BROTLI_REPEAT_ZERO_CODE_LENGTH + 1)
/* "code length of 8 is repeated" */
#define BROTLI_INITIAL_REPEATED_CODE_LENGTH 8
/* "Large Window Brotli" */
/**
* The theoretical maximum number of distance bits specified for large window
* brotli, for 64-bit encoders and decoders. Even when in practice 32-bit
* encoders and decoders only support up to 30 max distance bits, the value is
* set to 62 because it affects the large window brotli file format.
* Specifically, it affects the encoding of simple huffman tree for distances,
* see Specification RFC 7932 chapter 3.4.
*/
#define BROTLI_LARGE_MAX_DISTANCE_BITS 62U
#define BROTLI_LARGE_MIN_WBITS 10
/**
* The maximum supported large brotli window bits by the encoder and decoder.
* Large window brotli allows up to 62 bits, however the current encoder and
* decoder, designed for 32-bit integers, only support up to 30 bits maximum.
*/
#define BROTLI_LARGE_MAX_WBITS 30
/* Specification: 4. Encoding of distances */
#define BROTLI_NUM_DISTANCE_SHORT_CODES 16
/**
* Maximal number of "postfix" bits.
*
* Number of "postfix" bits is stored as 2 bits in meta-block header.
*/
#define BROTLI_MAX_NPOSTFIX 3
#define BROTLI_MAX_NDIRECT 120
#define BROTLI_MAX_DISTANCE_BITS 24U
#define BROTLI_DISTANCE_ALPHABET_SIZE(NPOSTFIX, NDIRECT, MAXNBITS) ( \
BROTLI_NUM_DISTANCE_SHORT_CODES + (NDIRECT) + \
((MAXNBITS) << ((NPOSTFIX) + 1)))
/* BROTLI_NUM_DISTANCE_SYMBOLS == 1128 */
#define BROTLI_NUM_DISTANCE_SYMBOLS \
BROTLI_DISTANCE_ALPHABET_SIZE( \
BROTLI_MAX_NDIRECT, BROTLI_MAX_NPOSTFIX, BROTLI_LARGE_MAX_DISTANCE_BITS)
/* ((1 << 26) - 4) is the maximal distance that can be expressed in RFC 7932
brotli stream using NPOSTFIX = 0 and NDIRECT = 0. With other NPOSTFIX and
NDIRECT values distances up to ((1 << 29) + 88) could be expressed. */
#define BROTLI_MAX_DISTANCE 0x3FFFFFC
/* ((1 << 31) - 4) is the safe distance limit. Using this number as a limit
allows safe distance calculation without overflows, given the distance
alphabet size is limited to corresponding size
(see kLargeWindowDistanceCodeLimits). */
#define BROTLI_MAX_ALLOWED_DISTANCE 0x7FFFFFFC
/* Specification: 4. Encoding of Literal Insertion Lengths and Copy Lengths */
#define BROTLI_NUM_INS_COPY_CODES 24
/* 7.1. Context modes and context ID lookup for literals */
/* "context IDs for literals are in the range of 0..63" */
#define BROTLI_LITERAL_CONTEXT_BITS 6
/* 7.2. Context ID for distances */
#define BROTLI_DISTANCE_CONTEXT_BITS 2
/* 9.1. Format of the Stream Header */
/* Number of slack bytes for window size. Don't confuse
with BROTLI_NUM_DISTANCE_SHORT_CODES. */
#define BROTLI_WINDOW_GAP 16
#define BROTLI_MAX_BACKWARD_LIMIT(W) (((size_t)1 << (W)) - BROTLI_WINDOW_GAP)
typedef struct BrotliDistanceCodeLimit {
uint32_t max_alphabet_size;
uint32_t max_distance;
} BrotliDistanceCodeLimit;
/* This function calculates maximal size of distance alphabet, such that the
distances greater than the given values can not be represented.
This limits are designed to support fast and safe 32-bit decoders.
"32-bit" means that signed integer values up to ((1 << 31) - 1) could be
safely expressed.
Brotli distance alphabet symbols do not represent consecutive distance
ranges. Each distance alphabet symbol (excluding direct distances and short
codes), represent interleaved (for NPOSTFIX > 0) range of distances.
A "group" of consecutive (1 << NPOSTFIX) symbols represent non-interleaved
range. Two consecutive groups require the same amount of "extra bits".
It is important that distance alphabet represents complete "groups".
To avoid complex logic on encoder side about interleaved ranges
it was decided to restrict both sides to complete distance code "groups".
*/
BROTLI_UNUSED_FUNCTION BrotliDistanceCodeLimit BrotliCalculateDistanceCodeLimit(
uint32_t max_distance, uint32_t npostfix, uint32_t ndirect) {
BrotliDistanceCodeLimit result;
/* Marking this function as unused, because not all files
including "constants.h" use it -> compiler warns about that. */
BROTLI_UNUSED(&BrotliCalculateDistanceCodeLimit);
if (max_distance <= ndirect) {
/* This case never happens / exists only for the sake of completeness. */
result.max_alphabet_size = max_distance + BROTLI_NUM_DISTANCE_SHORT_CODES;
result.max_distance = max_distance;
return result;
} else {
/* The first prohibited value. */
uint32_t forbidden_distance = max_distance + 1;
/* Subtract "directly" encoded region. */
uint32_t offset = forbidden_distance - ndirect - 1;
uint32_t ndistbits = 0;
uint32_t tmp;
uint32_t half;
uint32_t group;
/* Postfix for the last dcode in the group. */
uint32_t postfix = (1u << npostfix) - 1;
uint32_t extra;
uint32_t start;
/* Remove postfix and "head-start". */
offset = (offset >> npostfix) + 4;
/* Calculate the number of distance bits. */
tmp = offset / 2;
/* Poor-man's log2floor, to avoid extra dependencies. */
while (tmp != 0) {ndistbits++; tmp = tmp >> 1;}
/* One bit is covered with subrange addressing ("half"). */
ndistbits--;
/* Find subrange. */
half = (offset >> ndistbits) & 1;
/* Calculate the "group" part of dcode. */
group = ((ndistbits - 1) << 1) | half;
/* Calculated "group" covers the prohibited distance value. */
if (group == 0) {
/* This case is added for correctness; does not occur for limit > 128. */
result.max_alphabet_size = ndirect + BROTLI_NUM_DISTANCE_SHORT_CODES;
result.max_distance = ndirect;
return result;
}
/* Decrement "group", so it is the last permitted "group". */
group--;
/* After group was decremented, ndistbits and half must be recalculated. */
ndistbits = (group >> 1) + 1;
/* The last available distance in the subrange has all extra bits set. */
extra = (1u << ndistbits) - 1;
/* Calculate region start. NB: ndistbits >= 1. */
start = (1u << (ndistbits + 1)) - 4;
/* Move to subregion. */
start += (group & 1) << ndistbits;
/* Calculate the alphabet size. */
result.max_alphabet_size = ((group << npostfix) | postfix) + ndirect +
BROTLI_NUM_DISTANCE_SHORT_CODES + 1;
/* Calculate the maximal distance representable by alphabet. */
result.max_distance = ((start + extra) << npostfix) + postfix + ndirect + 1;
return result;
}
}
/* Represents the range of values belonging to a prefix code:
[offset, offset + 2^nbits) */
typedef struct {
uint16_t offset;
uint8_t nbits;
} BrotliPrefixCodeRange;
/* "Soft-private", it is exported, but not "advertised" as API. */
BROTLI_COMMON_API extern const BrotliPrefixCodeRange
_kBrotliPrefixCodeRanges[BROTLI_NUM_BLOCK_LEN_SYMBOLS];
#endif /* BROTLI_COMMON_CONSTANTS_H_ */
|
/* Copyright 2016 Google Inc. All Rights Reserved.
Distributed under MIT license.
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
*/
/**
* @file
* Common constants used in decoder and encoder API.
*/
#ifndef BROTLI_COMMON_CONSTANTS_H_
#define BROTLI_COMMON_CONSTANTS_H_
#include "./platform.h"
#include <brotli/port.h>
#include <brotli/types.h>
/* Specification: 7.3. Encoding of the context map */
#define BROTLI_CONTEXT_MAP_MAX_RLE 16
/* Specification: 2. Compressed representation overview */
#define BROTLI_MAX_NUMBER_OF_BLOCK_TYPES 256
/* Specification: 3.3. Alphabet sizes: insert-and-copy length */
#define BROTLI_NUM_LITERAL_SYMBOLS 256
#define BROTLI_NUM_COMMAND_SYMBOLS 704
#define BROTLI_NUM_BLOCK_LEN_SYMBOLS 26
#define BROTLI_MAX_CONTEXT_MAP_SYMBOLS (BROTLI_MAX_NUMBER_OF_BLOCK_TYPES + \
BROTLI_CONTEXT_MAP_MAX_RLE)
#define BROTLI_MAX_BLOCK_TYPE_SYMBOLS (BROTLI_MAX_NUMBER_OF_BLOCK_TYPES + 2)
/* Specification: 3.5. Complex prefix codes */
#define BROTLI_REPEAT_PREVIOUS_CODE_LENGTH 16
#define BROTLI_REPEAT_ZERO_CODE_LENGTH 17
#define BROTLI_CODE_LENGTH_CODES (BROTLI_REPEAT_ZERO_CODE_LENGTH + 1)
/* "code length of 8 is repeated" */
#define BROTLI_INITIAL_REPEATED_CODE_LENGTH 8
/* "Large Window Brotli" */
/**
* The theoretical maximum number of distance bits specified for large window
* brotli, for 64-bit encoders and decoders. Even when in practice 32-bit
* encoders and decoders only support up to 30 max distance bits, the value is
* set to 62 because it affects the large window brotli file format.
* Specifically, it affects the encoding of simple huffman tree for distances,
* see Specification RFC 7932 chapter 3.4.
*/
#define BROTLI_LARGE_MAX_DISTANCE_BITS 62U
#define BROTLI_LARGE_MIN_WBITS 10
/**
* The maximum supported large brotli window bits by the encoder and decoder.
* Large window brotli allows up to 62 bits, however the current encoder and
* decoder, designed for 32-bit integers, only support up to 30 bits maximum.
*/
#define BROTLI_LARGE_MAX_WBITS 30
/* Specification: 4. Encoding of distances */
#define BROTLI_NUM_DISTANCE_SHORT_CODES 16
/**
* Maximal number of "postfix" bits.
*
* Number of "postfix" bits is stored as 2 bits in meta-block header.
*/
#define BROTLI_MAX_NPOSTFIX 3
#define BROTLI_MAX_NDIRECT 120
#define BROTLI_MAX_DISTANCE_BITS 24U
#define BROTLI_DISTANCE_ALPHABET_SIZE(NPOSTFIX, NDIRECT, MAXNBITS) ( \
BROTLI_NUM_DISTANCE_SHORT_CODES + (NDIRECT) + \
((MAXNBITS) << ((NPOSTFIX) + 1)))
/* BROTLI_NUM_DISTANCE_SYMBOLS == 1128 */
#define BROTLI_NUM_DISTANCE_SYMBOLS \
BROTLI_DISTANCE_ALPHABET_SIZE( \
BROTLI_MAX_NDIRECT, BROTLI_MAX_NPOSTFIX, BROTLI_LARGE_MAX_DISTANCE_BITS)
/* ((1 << 26) - 4) is the maximal distance that can be expressed in RFC 7932
brotli stream using NPOSTFIX = 0 and NDIRECT = 0. With other NPOSTFIX and
NDIRECT values distances up to ((1 << 29) + 88) could be expressed. */
#define BROTLI_MAX_DISTANCE 0x3FFFFFC
/* ((1 << 31) - 4) is the safe distance limit. Using this number as a limit
allows safe distance calculation without overflows, given the distance
alphabet size is limited to corresponding size
(see kLargeWindowDistanceCodeLimits). */
#define BROTLI_MAX_ALLOWED_DISTANCE 0x7FFFFFFC
/* Specification: 4. Encoding of Literal Insertion Lengths and Copy Lengths */
#define BROTLI_NUM_INS_COPY_CODES 24
/* 7.1. Context modes and context ID lookup for literals */
/* "context IDs for literals are in the range of 0..63" */
#define BROTLI_LITERAL_CONTEXT_BITS 6
/* 7.2. Context ID for distances */
#define BROTLI_DISTANCE_CONTEXT_BITS 2
/* 9.1. Format of the Stream Header */
/* Number of slack bytes for window size. Don't confuse
with BROTLI_NUM_DISTANCE_SHORT_CODES. */
#define BROTLI_WINDOW_GAP 16
#define BROTLI_MAX_BACKWARD_LIMIT(W) (((size_t)1 << (W)) - BROTLI_WINDOW_GAP)
typedef struct BrotliDistanceCodeLimit {
uint32_t max_alphabet_size;
uint32_t max_distance;
} BrotliDistanceCodeLimit;
/* This function calculates maximal size of distance alphabet, such that the
distances greater than the given values can not be represented.
This limits are designed to support fast and safe 32-bit decoders.
"32-bit" means that signed integer values up to ((1 << 31) - 1) could be
safely expressed.
Brotli distance alphabet symbols do not represent consecutive distance
ranges. Each distance alphabet symbol (excluding direct distances and short
codes), represent interleaved (for NPOSTFIX > 0) range of distances.
A "group" of consecutive (1 << NPOSTFIX) symbols represent non-interleaved
range. Two consecutive groups require the same amount of "extra bits".
It is important that distance alphabet represents complete "groups".
To avoid complex logic on encoder side about interleaved ranges
it was decided to restrict both sides to complete distance code "groups".
*/
BROTLI_UNUSED_FUNCTION BrotliDistanceCodeLimit BrotliCalculateDistanceCodeLimit(
uint32_t max_distance, uint32_t npostfix, uint32_t ndirect) {
BrotliDistanceCodeLimit result;
/* Marking this function as unused, because not all files
including "constants.h" use it -> compiler warns about that. */
BROTLI_UNUSED(&BrotliCalculateDistanceCodeLimit);
if (max_distance <= ndirect) {
/* This case never happens / exists only for the sake of completeness. */
result.max_alphabet_size = max_distance + BROTLI_NUM_DISTANCE_SHORT_CODES;
result.max_distance = max_distance;
return result;
} else {
/* The first prohibited value. */
uint32_t forbidden_distance = max_distance + 1;
/* Subtract "directly" encoded region. */
uint32_t offset = forbidden_distance - ndirect - 1;
uint32_t ndistbits = 0;
uint32_t tmp;
uint32_t half;
uint32_t group;
/* Postfix for the last dcode in the group. */
uint32_t postfix = (1u << npostfix) - 1;
uint32_t extra;
uint32_t start;
/* Remove postfix and "head-start". */
offset = (offset >> npostfix) + 4;
/* Calculate the number of distance bits. */
tmp = offset / 2;
/* Poor-man's log2floor, to avoid extra dependencies. */
while (tmp != 0) {ndistbits++; tmp = tmp >> 1;}
/* One bit is covered with subrange addressing ("half"). */
ndistbits--;
/* Find subrange. */
half = (offset >> ndistbits) & 1;
/* Calculate the "group" part of dcode. */
group = ((ndistbits - 1) << 1) | half;
/* Calculated "group" covers the prohibited distance value. */
if (group == 0) {
/* This case is added for correctness; does not occur for limit > 128. */
result.max_alphabet_size = ndirect + BROTLI_NUM_DISTANCE_SHORT_CODES;
result.max_distance = ndirect;
return result;
}
/* Decrement "group", so it is the last permitted "group". */
group--;
/* After group was decremented, ndistbits and half must be recalculated. */
ndistbits = (group >> 1) + 1;
/* The last available distance in the subrange has all extra bits set. */
extra = (1u << ndistbits) - 1;
/* Calculate region start. NB: ndistbits >= 1. */
start = (1u << (ndistbits + 1)) - 4;
/* Move to subregion. */
start += (group & 1) << ndistbits;
/* Calculate the alphabet size. */
result.max_alphabet_size = ((group << npostfix) | postfix) + ndirect +
BROTLI_NUM_DISTANCE_SHORT_CODES + 1;
/* Calculate the maximal distance representable by alphabet. */
result.max_distance = ((start + extra) << npostfix) + postfix + ndirect + 1;
return result;
}
}
/* Represents the range of values belonging to a prefix code:
[offset, offset + 2^nbits) */
typedef struct {
uint16_t offset;
uint8_t nbits;
} BrotliPrefixCodeRange;
/* "Soft-private", it is exported, but not "advertised" as API. */
BROTLI_COMMON_API extern const BrotliPrefixCodeRange
_kBrotliPrefixCodeRanges[BROTLI_NUM_BLOCK_LEN_SYMBOLS];
#endif /* BROTLI_COMMON_CONSTANTS_H_ */
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/coreclr/nativeaot/Runtime/inc/TargetPtrs.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#ifndef _TARGETPTRS_H_
#define _TARGETPTRS_H_
typedef DPTR(class MethodTable) PTR_EEType;
typedef SPTR(struct StaticGcDesc) PTR_StaticGcDesc;
#ifdef TARGET_AMD64
typedef uint64_t UIntTarget;
#elif defined(TARGET_X86)
typedef uint32_t UIntTarget;
#elif defined(TARGET_ARM)
typedef uint32_t UIntTarget;
#elif defined(TARGET_ARM64)
typedef uint64_t UIntTarget;
#elif defined(TARGET_WASM)
typedef uint32_t UIntTarget;
#else
#error unexpected target architecture
#endif
typedef PTR_UInt8 TgtPTR_UInt8;
typedef PTR_UInt32 TgtPTR_UInt32;
typedef void * TgtPTR_Void;
typedef PTR_EEType TgtPTR_EEType;
typedef class Thread * TgtPTR_Thread;
typedef struct CORINFO_Object * TgtPTR_CORINFO_Object;
typedef PTR_StaticGcDesc TgtPTR_StaticGcDesc;
#endif // !_TARGETPTRS_H_
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#ifndef _TARGETPTRS_H_
#define _TARGETPTRS_H_
typedef DPTR(class MethodTable) PTR_EEType;
typedef SPTR(struct StaticGcDesc) PTR_StaticGcDesc;
#ifdef TARGET_AMD64
typedef uint64_t UIntTarget;
#elif defined(TARGET_X86)
typedef uint32_t UIntTarget;
#elif defined(TARGET_ARM)
typedef uint32_t UIntTarget;
#elif defined(TARGET_ARM64)
typedef uint64_t UIntTarget;
#elif defined(TARGET_WASM)
typedef uint32_t UIntTarget;
#else
#error unexpected target architecture
#endif
typedef PTR_UInt8 TgtPTR_UInt8;
typedef PTR_UInt32 TgtPTR_UInt32;
typedef void * TgtPTR_Void;
typedef PTR_EEType TgtPTR_EEType;
typedef class Thread * TgtPTR_Thread;
typedef struct CORINFO_Object * TgtPTR_CORINFO_Object;
typedef PTR_StaticGcDesc TgtPTR_StaticGcDesc;
#endif // !_TARGETPTRS_H_
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/coreclr/nativeaot/Runtime/RuntimeInstance.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#ifndef __RuntimeInstance_h__
#define __RuntimeInstance_h__
class ThreadStore;
typedef DPTR(ThreadStore) PTR_ThreadStore;
class ICodeManager;
struct StaticGcDesc;
typedef SPTR(StaticGcDesc) PTR_StaticGcDesc;
class TypeManager;
enum GenericVarianceType : uint8_t;
#include "ICodeManager.h"
extern "C" void PopulateDebugHeaders();
class RuntimeInstance
{
friend class AsmOffsets;
friend struct DefaultSListTraits<RuntimeInstance>;
friend class Thread;
friend void PopulateDebugHeaders();
PTR_ThreadStore m_pThreadStore;
HANDLE m_hPalInstance; // this is the HANDLE passed into DllMain
ReaderWriterLock m_ModuleListLock;
public:
struct OsModuleEntry;
typedef DPTR(OsModuleEntry) PTR_OsModuleEntry;
struct OsModuleEntry
{
PTR_OsModuleEntry m_pNext;
HANDLE m_osModule;
};
typedef SList<OsModuleEntry> OsModuleList;
private:
OsModuleList m_OsModuleList;
struct CodeManagerEntry;
typedef DPTR(CodeManagerEntry) PTR_CodeManagerEntry;
struct CodeManagerEntry
{
PTR_CodeManagerEntry m_pNext;
PTR_VOID m_pvStartRange;
uint32_t m_cbRange;
ICodeManager * m_pCodeManager;
};
typedef SList<CodeManagerEntry> CodeManagerList;
CodeManagerList m_CodeManagerList;
public:
struct TypeManagerEntry
{
TypeManagerEntry* m_pNext;
TypeManager* m_pTypeManager;
};
typedef SList<TypeManagerEntry> TypeManagerList;
private:
TypeManagerList m_TypeManagerList;
bool m_conservativeStackReportingEnabled;
struct UnboxingStubsRegion
{
PTR_VOID m_pRegionStart;
uint32_t m_cbRegion;
UnboxingStubsRegion* m_pNextRegion;
UnboxingStubsRegion() : m_pRegionStart(0), m_cbRegion(0), m_pNextRegion(NULL) { }
};
UnboxingStubsRegion* m_pUnboxingStubsRegion;
RuntimeInstance();
SList<Module>* GetModuleList();
SList<TypeManager*>* GetModuleManagerList();
bool BuildGenericTypeHashTable();
ICodeManager * FindCodeManagerForClasslibFunction(PTR_VOID address);
public:
~RuntimeInstance();
ThreadStore * GetThreadStore();
HANDLE GetPalInstance();
PTR_UInt8 FindMethodStartAddress(PTR_VOID ControlPC);
PTR_UInt8 GetTargetOfUnboxingAndInstantiatingStub(PTR_VOID ControlPC);
void EnableConservativeStackReporting();
bool IsConservativeStackReportingEnabled() { return m_conservativeStackReportingEnabled; }
bool RegisterCodeManager(ICodeManager * pCodeManager, PTR_VOID pvStartRange, uint32_t cbRange);
void UnregisterCodeManager(ICodeManager * pCodeManager);
ICodeManager * FindCodeManagerByAddress(PTR_VOID ControlPC);
PTR_VOID GetClasslibFunctionFromCodeAddress(PTR_VOID address, ClasslibFunctionId functionId);
bool RegisterTypeManager(TypeManager * pTypeManager);
TypeManagerList& GetTypeManagerList();
OsModuleList* GetOsModuleList();
ReaderWriterLock& GetTypeManagerLock();
bool RegisterUnboxingStubs(PTR_VOID pvStartRange, uint32_t cbRange);
bool IsUnboxingStub(uint8_t* pCode);
static bool Initialize(HANDLE hPalInstance);
void Destroy();
void EnumAllStaticGCRefs(void * pfnCallback, void * pvCallbackData);
bool ShouldHijackCallsiteForGcStress(uintptr_t CallsiteIP);
bool ShouldHijackLoopForGcStress(uintptr_t CallsiteIP);
void SetLoopHijackFlags(uint32_t flag);
};
typedef DPTR(RuntimeInstance) PTR_RuntimeInstance;
PTR_RuntimeInstance GetRuntimeInstance();
#endif // __RuntimeInstance_h__
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#ifndef __RuntimeInstance_h__
#define __RuntimeInstance_h__
class ThreadStore;
typedef DPTR(ThreadStore) PTR_ThreadStore;
class ICodeManager;
struct StaticGcDesc;
typedef SPTR(StaticGcDesc) PTR_StaticGcDesc;
class TypeManager;
enum GenericVarianceType : uint8_t;
#include "ICodeManager.h"
extern "C" void PopulateDebugHeaders();
class RuntimeInstance
{
friend class AsmOffsets;
friend struct DefaultSListTraits<RuntimeInstance>;
friend class Thread;
friend void PopulateDebugHeaders();
PTR_ThreadStore m_pThreadStore;
HANDLE m_hPalInstance; // this is the HANDLE passed into DllMain
ReaderWriterLock m_ModuleListLock;
public:
struct OsModuleEntry;
typedef DPTR(OsModuleEntry) PTR_OsModuleEntry;
struct OsModuleEntry
{
PTR_OsModuleEntry m_pNext;
HANDLE m_osModule;
};
typedef SList<OsModuleEntry> OsModuleList;
private:
OsModuleList m_OsModuleList;
struct CodeManagerEntry;
typedef DPTR(CodeManagerEntry) PTR_CodeManagerEntry;
struct CodeManagerEntry
{
PTR_CodeManagerEntry m_pNext;
PTR_VOID m_pvStartRange;
uint32_t m_cbRange;
ICodeManager * m_pCodeManager;
};
typedef SList<CodeManagerEntry> CodeManagerList;
CodeManagerList m_CodeManagerList;
public:
struct TypeManagerEntry
{
TypeManagerEntry* m_pNext;
TypeManager* m_pTypeManager;
};
typedef SList<TypeManagerEntry> TypeManagerList;
private:
TypeManagerList m_TypeManagerList;
bool m_conservativeStackReportingEnabled;
struct UnboxingStubsRegion
{
PTR_VOID m_pRegionStart;
uint32_t m_cbRegion;
UnboxingStubsRegion* m_pNextRegion;
UnboxingStubsRegion() : m_pRegionStart(0), m_cbRegion(0), m_pNextRegion(NULL) { }
};
UnboxingStubsRegion* m_pUnboxingStubsRegion;
RuntimeInstance();
SList<Module>* GetModuleList();
SList<TypeManager*>* GetModuleManagerList();
bool BuildGenericTypeHashTable();
ICodeManager * FindCodeManagerForClasslibFunction(PTR_VOID address);
public:
~RuntimeInstance();
ThreadStore * GetThreadStore();
HANDLE GetPalInstance();
PTR_UInt8 FindMethodStartAddress(PTR_VOID ControlPC);
PTR_UInt8 GetTargetOfUnboxingAndInstantiatingStub(PTR_VOID ControlPC);
void EnableConservativeStackReporting();
bool IsConservativeStackReportingEnabled() { return m_conservativeStackReportingEnabled; }
bool RegisterCodeManager(ICodeManager * pCodeManager, PTR_VOID pvStartRange, uint32_t cbRange);
void UnregisterCodeManager(ICodeManager * pCodeManager);
ICodeManager * FindCodeManagerByAddress(PTR_VOID ControlPC);
PTR_VOID GetClasslibFunctionFromCodeAddress(PTR_VOID address, ClasslibFunctionId functionId);
bool RegisterTypeManager(TypeManager * pTypeManager);
TypeManagerList& GetTypeManagerList();
OsModuleList* GetOsModuleList();
ReaderWriterLock& GetTypeManagerLock();
bool RegisterUnboxingStubs(PTR_VOID pvStartRange, uint32_t cbRange);
bool IsUnboxingStub(uint8_t* pCode);
static bool Initialize(HANDLE hPalInstance);
void Destroy();
void EnumAllStaticGCRefs(void * pfnCallback, void * pvCallbackData);
bool ShouldHijackCallsiteForGcStress(uintptr_t CallsiteIP);
bool ShouldHijackLoopForGcStress(uintptr_t CallsiteIP);
void SetLoopHijackFlags(uint32_t flag);
};
typedef DPTR(RuntimeInstance) PTR_RuntimeInstance;
PTR_RuntimeInstance GetRuntimeInstance();
#endif // __RuntimeInstance_h__
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/coreclr/nativeaot/Runtime/TypeManager.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#pragma once
#include "ModuleHeaders.h"
#include "ICodeManager.h"
struct StaticGcDesc;
class DispatchMap;
class TypeManager
{
// NOTE: Part of this layout is a contract with the managed side in TypeManagerHandle.cs
HANDLE m_osModule;
ReadyToRunHeader * m_pHeader;
DispatchMap** m_pDispatchMapTable;
StaticGcDesc* m_pStaticsGCInfo;
StaticGcDesc* m_pThreadStaticsGCInfo;
uint8_t* m_pStaticsGCDataSection;
uint8_t* m_pThreadStaticsDataSection;
uint32_t* m_pTlsIndex; // Pointer to TLS index if this module uses thread statics
void** m_pClasslibFunctions;
uint32_t m_nClasslibFunctions;
uint32_t* m_pLoopHijackFlag;
TypeManager(HANDLE osModule, ReadyToRunHeader * pHeader, void** pClasslibFunctions, uint32_t nClasslibFunctions);
public:
static TypeManager * Create(HANDLE osModule, void * pModuleHeader, void** pClasslibFunctions, uint32_t nClasslibFunctions);
void * GetModuleSection(ReadyToRunSectionType sectionId, int * length);
void EnumStaticGCRefs(void * pfnCallback, void * pvCallbackData);
HANDLE GetOsModuleHandle();
void* GetClasslibFunction(ClasslibFunctionId functionId);
uint32_t* GetPointerToTlsIndex() { return m_pTlsIndex; }
void SetLoopHijackFlag(uint32_t flag) { if (m_pLoopHijackFlag != nullptr) *m_pLoopHijackFlag = flag; }
private:
struct ModuleInfoRow
{
int32_t SectionId;
int32_t Flags;
void * Start;
void * End;
bool HasEndPointer();
int GetLength();
};
void EnumStaticGCRefsBlock(void * pfnCallback, void * pvCallbackData, StaticGcDesc* pStaticGcInfo);
void EnumThreadStaticGCRefsBlock(void * pfnCallback, void * pvCallbackData, StaticGcDesc* pStaticGcInfo, uint8_t* pbThreadStaticData);
};
// TypeManagerHandle represents an AOT module in MRT based runtimes.
// These handles are a pointer to a TypeManager.
struct TypeManagerHandle
{
static TypeManagerHandle Null()
{
TypeManagerHandle handle;
handle._value = nullptr;
return handle;
}
static TypeManagerHandle Create(TypeManager * value)
{
TypeManagerHandle handle;
handle._value = value;
return handle;
}
void *_value;
TypeManager* AsTypeManager();
};
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#pragma once
#include "ModuleHeaders.h"
#include "ICodeManager.h"
struct StaticGcDesc;
class DispatchMap;
class TypeManager
{
// NOTE: Part of this layout is a contract with the managed side in TypeManagerHandle.cs
HANDLE m_osModule;
ReadyToRunHeader * m_pHeader;
DispatchMap** m_pDispatchMapTable;
StaticGcDesc* m_pStaticsGCInfo;
StaticGcDesc* m_pThreadStaticsGCInfo;
uint8_t* m_pStaticsGCDataSection;
uint8_t* m_pThreadStaticsDataSection;
uint32_t* m_pTlsIndex; // Pointer to TLS index if this module uses thread statics
void** m_pClasslibFunctions;
uint32_t m_nClasslibFunctions;
uint32_t* m_pLoopHijackFlag;
TypeManager(HANDLE osModule, ReadyToRunHeader * pHeader, void** pClasslibFunctions, uint32_t nClasslibFunctions);
public:
static TypeManager * Create(HANDLE osModule, void * pModuleHeader, void** pClasslibFunctions, uint32_t nClasslibFunctions);
void * GetModuleSection(ReadyToRunSectionType sectionId, int * length);
void EnumStaticGCRefs(void * pfnCallback, void * pvCallbackData);
HANDLE GetOsModuleHandle();
void* GetClasslibFunction(ClasslibFunctionId functionId);
uint32_t* GetPointerToTlsIndex() { return m_pTlsIndex; }
void SetLoopHijackFlag(uint32_t flag) { if (m_pLoopHijackFlag != nullptr) *m_pLoopHijackFlag = flag; }
private:
struct ModuleInfoRow
{
int32_t SectionId;
int32_t Flags;
void * Start;
void * End;
bool HasEndPointer();
int GetLength();
};
void EnumStaticGCRefsBlock(void * pfnCallback, void * pvCallbackData, StaticGcDesc* pStaticGcInfo);
void EnumThreadStaticGCRefsBlock(void * pfnCallback, void * pvCallbackData, StaticGcDesc* pStaticGcInfo, uint8_t* pbThreadStaticData);
};
// TypeManagerHandle represents an AOT module in MRT based runtimes.
// These handles are a pointer to a TypeManager.
struct TypeManagerHandle
{
static TypeManagerHandle Null()
{
TypeManagerHandle handle;
handle._value = nullptr;
return handle;
}
static TypeManagerHandle Create(TypeManager * value)
{
TypeManagerHandle handle;
handle._value = value;
return handle;
}
void *_value;
TypeManager* AsTypeManager();
};
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/native/eventpipe/ds-ipc-pal-socket.h
|
#ifndef __DIAGNOSTICS_IPC_PAL_SOCKET_H__
#define __DIAGNOSTICS_IPC_PAL_SOCKET_H__
#include "ds-rt-config.h"
#ifdef ENABLE_PERFTRACING
#include "ds-ipc-pal.h"
#undef DS_IMPL_GETTER_SETTER
#ifdef DS_IMPL_IPC_PAL_SOCKET_GETTER_SETTER
#define DS_IMPL_GETTER_SETTER
#endif
#include "ds-getter-setter.h"
#ifdef HOST_WIN32
#include <winsock2.h>
typedef SOCKET ds_ipc_socket_t;
typedef SOCKADDR ds_ipc_socket_address_t;
typedef ADDRESS_FAMILY ds_ipc_socket_family_t;
typedef int ds_ipc_socket_len_t;
#else
#include <sys/socket.h>
typedef int ds_ipc_socket_t;
typedef struct sockaddr ds_ipc_socket_address_t;
typedef int ds_ipc_socket_family_t;
typedef socklen_t ds_ipc_socket_len_t;
#endif
/*
* DiagnosticsIpc.
*/
#if defined(DS_INLINE_GETTER_SETTER) || defined(DS_IMPL_IPC_PAL_SOCKET_GETTER_SETTER)
struct _DiagnosticsIpc {
#else
struct _DiagnosticsIpc_Internal {
#endif
ds_ipc_socket_address_t *server_address;
ds_ipc_socket_len_t server_address_len;
ds_ipc_socket_family_t server_address_family;
ds_ipc_socket_t server_socket;
bool is_listening;
bool is_closed;
bool is_dual_mode;
DiagnosticsIpcConnectionMode mode;
};
#if !defined(DS_INLINE_GETTER_SETTER) && !defined(DS_IMPL_IPC_PAL_SOCKET_GETTER_SETTER)
struct _DiagnosticsIpc {
uint8_t _internal [sizeof (struct _DiagnosticsIpc_Internal)];
};
#endif
/*
* DiagnosticsIpcStream.
*/
#if defined(DS_INLINE_GETTER_SETTER) || defined(DS_IMPL_IPC_PAL_SOCKET_GETTER_SETTER)
struct _DiagnosticsIpcStream {
#else
struct _DiagnosticsIpcStream_Internal {
#endif
IpcStream stream;
ds_ipc_socket_t client_socket;
DiagnosticsIpcConnectionMode mode;
};
#if !defined(DS_INLINE_GETTER_SETTER) && !defined(DS_IMPL_IPC_PAL_SOCKET_GETTER_SETTER)
struct _DiagnosticsIpcStream {
uint8_t _internal [sizeof (struct _DiagnosticsIpcStream_Internal)];
};
#endif
#endif /* ENABLE_PERFTRACING */
#endif /* __DIAGNOSTICS_IPC_PAL_SOCKET_H__ */
|
#ifndef __DIAGNOSTICS_IPC_PAL_SOCKET_H__
#define __DIAGNOSTICS_IPC_PAL_SOCKET_H__
#include "ds-rt-config.h"
#ifdef ENABLE_PERFTRACING
#include "ds-ipc-pal.h"
#undef DS_IMPL_GETTER_SETTER
#ifdef DS_IMPL_IPC_PAL_SOCKET_GETTER_SETTER
#define DS_IMPL_GETTER_SETTER
#endif
#include "ds-getter-setter.h"
#ifdef HOST_WIN32
#include <winsock2.h>
typedef SOCKET ds_ipc_socket_t;
typedef SOCKADDR ds_ipc_socket_address_t;
typedef ADDRESS_FAMILY ds_ipc_socket_family_t;
typedef int ds_ipc_socket_len_t;
#else
#include <sys/socket.h>
typedef int ds_ipc_socket_t;
typedef struct sockaddr ds_ipc_socket_address_t;
typedef int ds_ipc_socket_family_t;
typedef socklen_t ds_ipc_socket_len_t;
#endif
/*
* DiagnosticsIpc.
*/
#if defined(DS_INLINE_GETTER_SETTER) || defined(DS_IMPL_IPC_PAL_SOCKET_GETTER_SETTER)
struct _DiagnosticsIpc {
#else
struct _DiagnosticsIpc_Internal {
#endif
ds_ipc_socket_address_t *server_address;
ds_ipc_socket_len_t server_address_len;
ds_ipc_socket_family_t server_address_family;
ds_ipc_socket_t server_socket;
bool is_listening;
bool is_closed;
bool is_dual_mode;
DiagnosticsIpcConnectionMode mode;
};
#if !defined(DS_INLINE_GETTER_SETTER) && !defined(DS_IMPL_IPC_PAL_SOCKET_GETTER_SETTER)
struct _DiagnosticsIpc {
uint8_t _internal [sizeof (struct _DiagnosticsIpc_Internal)];
};
#endif
/*
* DiagnosticsIpcStream.
*/
#if defined(DS_INLINE_GETTER_SETTER) || defined(DS_IMPL_IPC_PAL_SOCKET_GETTER_SETTER)
struct _DiagnosticsIpcStream {
#else
struct _DiagnosticsIpcStream_Internal {
#endif
IpcStream stream;
ds_ipc_socket_t client_socket;
DiagnosticsIpcConnectionMode mode;
};
#if !defined(DS_INLINE_GETTER_SETTER) && !defined(DS_IMPL_IPC_PAL_SOCKET_GETTER_SETTER)
struct _DiagnosticsIpcStream {
uint8_t _internal [sizeof (struct _DiagnosticsIpcStream_Internal)];
};
#endif
#endif /* ENABLE_PERFTRACING */
#endif /* __DIAGNOSTICS_IPC_PAL_SOCKET_H__ */
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/native/public/mono/metadata/details/class-types.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
#ifndef _MONO_CLASS_TYPES_H
#define _MONO_CLASS_TYPES_H
#include <mono/metadata/details/metadata-types.h>
#include <mono/metadata/details/image-types.h>
#include <mono/metadata/details/loader-types.h>
#include <mono/utils/details/mono-error-types.h>
MONO_BEGIN_DECLS
typedef struct MonoVTable MonoVTable;
typedef struct _MonoClassField MonoClassField;
typedef struct _MonoProperty MonoProperty;
typedef struct _MonoEvent MonoEvent;
typedef enum {
MONO_TYPE_NAME_FORMAT_IL,
MONO_TYPE_NAME_FORMAT_REFLECTION,
MONO_TYPE_NAME_FORMAT_FULL_NAME,
MONO_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED
} MonoTypeNameFormat;
MONO_END_DECLS
#endif /* _MONO_CLASS_TYPES_H */
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
#ifndef _MONO_CLASS_TYPES_H
#define _MONO_CLASS_TYPES_H
#include <mono/metadata/details/metadata-types.h>
#include <mono/metadata/details/image-types.h>
#include <mono/metadata/details/loader-types.h>
#include <mono/utils/details/mono-error-types.h>
MONO_BEGIN_DECLS
typedef struct MonoVTable MonoVTable;
typedef struct _MonoClassField MonoClassField;
typedef struct _MonoProperty MonoProperty;
typedef struct _MonoEvent MonoEvent;
typedef enum {
MONO_TYPE_NAME_FORMAT_IL,
MONO_TYPE_NAME_FORMAT_REFLECTION,
MONO_TYPE_NAME_FORMAT_FULL_NAME,
MONO_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED
} MonoTypeNameFormat;
MONO_END_DECLS
#endif /* _MONO_CLASS_TYPES_H */
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/coreclr/jit/gtstructs.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// clang-format off
/*****************************************************************************/
#ifndef GTSTRUCT_0
#error Define GTSTRUCT_0 before including this file.
#endif
#ifndef GTSTRUCT_1
#error Define GTSTRUCT_1 before including this file.
#endif
#ifndef GTSTRUCT_2
#error Define GTSTRUCT_2 before including this file.
#endif
#ifndef GTSTRUCT_3
#error Define GTSTRUCT_3 before including this file.
#endif
#ifndef GTSTRUCT_4
#error Define GTSTRUCT_4 before including this file.
#endif
#ifndef GTSTRUCT_N
#error Define GTSTRUCT_N before including this file.
#endif
#ifndef GTSTRUCT_2_SPECIAL
#error Define GTSTRUCT_2_SPECIAL before including this file.
#endif
#ifndef GTSTRUCT_3_SPECIAL
#error Define GTSTRUCT_3_SPECIAL before including this file.
#endif
/*****************************************************************************/
//
// Field name , Allowed node enum(s)
//
// The "SPECIAL" variants indicate that some or all of the allowed opers exist elsewhere. This is
// used in the DEBUGGABLE_GENTREE implementation when determining which vtable pointer to use for
// a given oper. For example, IntConCommon (for the GenTreeIntConCommon type) allows opers
// for all its subtypes. The "SPECIAL" version is attached to the supertypes. "N" is always
// considered "special".
GTSTRUCT_0(UnOp , GT_OP)
GTSTRUCT_0(Op , GT_OP)
#if !defined(FEATURE_EH_FUNCLETS)
GTSTRUCT_2(Val , GT_END_LFIN, GT_JMP)
#else
GTSTRUCT_1(Val , GT_JMP)
#endif
GTSTRUCT_2_SPECIAL(IntConCommon, GT_CNS_INT, GT_CNS_LNG)
GTSTRUCT_1(IntCon , GT_CNS_INT)
GTSTRUCT_1(LngCon , GT_CNS_LNG)
GTSTRUCT_1(DblCon , GT_CNS_DBL)
GTSTRUCT_1(StrCon , GT_CNS_STR)
GTSTRUCT_N(LclVarCommon, GT_LCL_VAR, GT_LCL_FLD, GT_PHI_ARG, GT_STORE_LCL_VAR, GT_STORE_LCL_FLD, GT_LCL_VAR_ADDR, GT_LCL_FLD_ADDR)
GTSTRUCT_3(LclVar , GT_LCL_VAR, GT_LCL_VAR_ADDR, GT_STORE_LCL_VAR)
GTSTRUCT_3(LclFld , GT_LCL_FLD, GT_STORE_LCL_FLD, GT_LCL_FLD_ADDR)
GTSTRUCT_1(Cast , GT_CAST)
GTSTRUCT_1(Box , GT_BOX)
GTSTRUCT_1(Field , GT_FIELD)
GTSTRUCT_1(Call , GT_CALL)
GTSTRUCT_1(FieldList , GT_FIELD_LIST)
GTSTRUCT_1(Colon , GT_COLON)
GTSTRUCT_1(FptrVal , GT_FTN_ADDR)
GTSTRUCT_1(Intrinsic , GT_INTRINSIC)
GTSTRUCT_1(Index , GT_INDEX)
GTSTRUCT_1(IndexAddr , GT_INDEX_ADDR)
#if defined(FEATURE_HW_INTRINSICS) && defined(FEATURE_SIMD)
GTSTRUCT_N(MultiOp , GT_SIMD, GT_HWINTRINSIC)
#elif defined(FEATURE_SIMD)
GTSTRUCT_N(MultiOp , GT_SIMD)
#elif defined(FEATURE_HW_INTRINSICS)
GTSTRUCT_N(MultiOp , GT_HWINTRINSIC)
#endif
GTSTRUCT_1(BoundsChk , GT_BOUNDS_CHECK)
GTSTRUCT_1(ArrLen , GT_ARR_LENGTH)
GTSTRUCT_1(ArrElem , GT_ARR_ELEM)
GTSTRUCT_1(ArrOffs , GT_ARR_OFFSET)
GTSTRUCT_1(ArrIndex , GT_ARR_INDEX)
GTSTRUCT_1(RetExpr , GT_RET_EXPR)
GTSTRUCT_1(ILOffset , GT_IL_OFFSET)
GTSTRUCT_2(CopyOrReload, GT_COPY, GT_RELOAD)
GTSTRUCT_2(ClsVar , GT_CLS_VAR, GT_CLS_VAR_ADDR)
GTSTRUCT_1(ArgPlace , GT_ARGPLACE)
GTSTRUCT_1(CmpXchg , GT_CMPXCHG)
GTSTRUCT_1(AddrMode , GT_LEA)
GTSTRUCT_N(Blk , GT_BLK, GT_STORE_BLK, GT_OBJ, GT_STORE_OBJ, GT_STORE_DYN_BLK)
GTSTRUCT_2(Obj , GT_OBJ, GT_STORE_OBJ)
GTSTRUCT_1(StoreDynBlk , GT_STORE_DYN_BLK)
GTSTRUCT_1(Qmark , GT_QMARK)
GTSTRUCT_1(PhiArg , GT_PHI_ARG)
GTSTRUCT_1(Phi , GT_PHI)
GTSTRUCT_1(StoreInd , GT_STOREIND)
GTSTRUCT_N(Indir , GT_STOREIND, GT_IND, GT_NULLCHECK, GT_BLK, GT_STORE_BLK, GT_OBJ, GT_STORE_OBJ, GT_STORE_DYN_BLK)
#if FEATURE_ARG_SPLIT
GTSTRUCT_2_SPECIAL(PutArgStk, GT_PUTARG_STK, GT_PUTARG_SPLIT)
GTSTRUCT_1(PutArgSplit , GT_PUTARG_SPLIT)
#else // !FEATURE_ARG_SPLIT
GTSTRUCT_1(PutArgStk , GT_PUTARG_STK)
#endif // !FEATURE_ARG_SPLIT
GTSTRUCT_1(PhysReg , GT_PHYSREG)
#ifdef FEATURE_SIMD
GTSTRUCT_1(SIMD , GT_SIMD)
#endif // FEATURE_SIMD
#ifdef FEATURE_HW_INTRINSICS
GTSTRUCT_1(HWIntrinsic , GT_HWINTRINSIC)
#endif // FEATURE_HW_INTRINSICS
GTSTRUCT_1(AllocObj , GT_ALLOCOBJ)
GTSTRUCT_1(RuntimeLookup, GT_RUNTIMELOOKUP)
GTSTRUCT_2(CC , GT_JCC, GT_SETCC)
#if defined(TARGET_X86)
GTSTRUCT_1(MultiRegOp , GT_MUL_LONG)
#elif defined (TARGET_ARM)
GTSTRUCT_3(MultiRegOp , GT_MUL_LONG, GT_PUTARG_REG, GT_BITCAST)
#endif
/*****************************************************************************/
#undef GTSTRUCT_0
#undef GTSTRUCT_1
#undef GTSTRUCT_2
#undef GTSTRUCT_3
#undef GTSTRUCT_4
#undef GTSTRUCT_N
#undef GTSTRUCT_2_SPECIAL
#undef GTSTRUCT_3_SPECIAL
/*****************************************************************************/
// clang-format on
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// clang-format off
/*****************************************************************************/
#ifndef GTSTRUCT_0
#error Define GTSTRUCT_0 before including this file.
#endif
#ifndef GTSTRUCT_1
#error Define GTSTRUCT_1 before including this file.
#endif
#ifndef GTSTRUCT_2
#error Define GTSTRUCT_2 before including this file.
#endif
#ifndef GTSTRUCT_3
#error Define GTSTRUCT_3 before including this file.
#endif
#ifndef GTSTRUCT_4
#error Define GTSTRUCT_4 before including this file.
#endif
#ifndef GTSTRUCT_N
#error Define GTSTRUCT_N before including this file.
#endif
#ifndef GTSTRUCT_2_SPECIAL
#error Define GTSTRUCT_2_SPECIAL before including this file.
#endif
#ifndef GTSTRUCT_3_SPECIAL
#error Define GTSTRUCT_3_SPECIAL before including this file.
#endif
/*****************************************************************************/
//
// Field name , Allowed node enum(s)
//
// The "SPECIAL" variants indicate that some or all of the allowed opers exist elsewhere. This is
// used in the DEBUGGABLE_GENTREE implementation when determining which vtable pointer to use for
// a given oper. For example, IntConCommon (for the GenTreeIntConCommon type) allows opers
// for all its subtypes. The "SPECIAL" version is attached to the supertypes. "N" is always
// considered "special".
GTSTRUCT_0(UnOp , GT_OP)
GTSTRUCT_0(Op , GT_OP)
#if !defined(FEATURE_EH_FUNCLETS)
GTSTRUCT_2(Val , GT_END_LFIN, GT_JMP)
#else
GTSTRUCT_1(Val , GT_JMP)
#endif
GTSTRUCT_2_SPECIAL(IntConCommon, GT_CNS_INT, GT_CNS_LNG)
GTSTRUCT_1(IntCon , GT_CNS_INT)
GTSTRUCT_1(LngCon , GT_CNS_LNG)
GTSTRUCT_1(DblCon , GT_CNS_DBL)
GTSTRUCT_1(StrCon , GT_CNS_STR)
GTSTRUCT_N(LclVarCommon, GT_LCL_VAR, GT_LCL_FLD, GT_PHI_ARG, GT_STORE_LCL_VAR, GT_STORE_LCL_FLD, GT_LCL_VAR_ADDR, GT_LCL_FLD_ADDR)
GTSTRUCT_3(LclVar , GT_LCL_VAR, GT_LCL_VAR_ADDR, GT_STORE_LCL_VAR)
GTSTRUCT_3(LclFld , GT_LCL_FLD, GT_STORE_LCL_FLD, GT_LCL_FLD_ADDR)
GTSTRUCT_1(Cast , GT_CAST)
GTSTRUCT_1(Box , GT_BOX)
GTSTRUCT_1(Field , GT_FIELD)
GTSTRUCT_1(Call , GT_CALL)
GTSTRUCT_1(FieldList , GT_FIELD_LIST)
GTSTRUCT_1(Colon , GT_COLON)
GTSTRUCT_1(FptrVal , GT_FTN_ADDR)
GTSTRUCT_1(Intrinsic , GT_INTRINSIC)
GTSTRUCT_1(Index , GT_INDEX)
GTSTRUCT_1(IndexAddr , GT_INDEX_ADDR)
#if defined(FEATURE_HW_INTRINSICS) && defined(FEATURE_SIMD)
GTSTRUCT_N(MultiOp , GT_SIMD, GT_HWINTRINSIC)
#elif defined(FEATURE_SIMD)
GTSTRUCT_N(MultiOp , GT_SIMD)
#elif defined(FEATURE_HW_INTRINSICS)
GTSTRUCT_N(MultiOp , GT_HWINTRINSIC)
#endif
GTSTRUCT_1(BoundsChk , GT_BOUNDS_CHECK)
GTSTRUCT_1(ArrLen , GT_ARR_LENGTH)
GTSTRUCT_1(ArrElem , GT_ARR_ELEM)
GTSTRUCT_1(ArrOffs , GT_ARR_OFFSET)
GTSTRUCT_1(ArrIndex , GT_ARR_INDEX)
GTSTRUCT_1(RetExpr , GT_RET_EXPR)
GTSTRUCT_1(ILOffset , GT_IL_OFFSET)
GTSTRUCT_2(CopyOrReload, GT_COPY, GT_RELOAD)
GTSTRUCT_2(ClsVar , GT_CLS_VAR, GT_CLS_VAR_ADDR)
GTSTRUCT_1(ArgPlace , GT_ARGPLACE)
GTSTRUCT_1(CmpXchg , GT_CMPXCHG)
GTSTRUCT_1(AddrMode , GT_LEA)
GTSTRUCT_N(Blk , GT_BLK, GT_STORE_BLK, GT_OBJ, GT_STORE_OBJ, GT_STORE_DYN_BLK)
GTSTRUCT_2(Obj , GT_OBJ, GT_STORE_OBJ)
GTSTRUCT_1(StoreDynBlk , GT_STORE_DYN_BLK)
GTSTRUCT_1(Qmark , GT_QMARK)
GTSTRUCT_1(PhiArg , GT_PHI_ARG)
GTSTRUCT_1(Phi , GT_PHI)
GTSTRUCT_1(StoreInd , GT_STOREIND)
GTSTRUCT_N(Indir , GT_STOREIND, GT_IND, GT_NULLCHECK, GT_BLK, GT_STORE_BLK, GT_OBJ, GT_STORE_OBJ, GT_STORE_DYN_BLK)
#if FEATURE_ARG_SPLIT
GTSTRUCT_2_SPECIAL(PutArgStk, GT_PUTARG_STK, GT_PUTARG_SPLIT)
GTSTRUCT_1(PutArgSplit , GT_PUTARG_SPLIT)
#else // !FEATURE_ARG_SPLIT
GTSTRUCT_1(PutArgStk , GT_PUTARG_STK)
#endif // !FEATURE_ARG_SPLIT
GTSTRUCT_1(PhysReg , GT_PHYSREG)
#ifdef FEATURE_SIMD
GTSTRUCT_1(SIMD , GT_SIMD)
#endif // FEATURE_SIMD
#ifdef FEATURE_HW_INTRINSICS
GTSTRUCT_1(HWIntrinsic , GT_HWINTRINSIC)
#endif // FEATURE_HW_INTRINSICS
GTSTRUCT_1(AllocObj , GT_ALLOCOBJ)
GTSTRUCT_1(RuntimeLookup, GT_RUNTIMELOOKUP)
GTSTRUCT_2(CC , GT_JCC, GT_SETCC)
#if defined(TARGET_X86)
GTSTRUCT_1(MultiRegOp , GT_MUL_LONG)
#elif defined (TARGET_ARM)
GTSTRUCT_3(MultiRegOp , GT_MUL_LONG, GT_PUTARG_REG, GT_BITCAST)
#endif
/*****************************************************************************/
#undef GTSTRUCT_0
#undef GTSTRUCT_1
#undef GTSTRUCT_2
#undef GTSTRUCT_3
#undef GTSTRUCT_4
#undef GTSTRUCT_N
#undef GTSTRUCT_2_SPECIAL
#undef GTSTRUCT_3_SPECIAL
/*****************************************************************************/
// clang-format on
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/mono/mono/utils/strenc.c
|
/**
* \file
* string encoding conversions
*
* Author:
* Dick Porter ([email protected])
*
* (C) 2003 Ximian, Inc.
*/
#include <config.h>
#include <glib.h>
#include <string.h>
#include "strenc.h"
#include "strenc-internals.h"
#include <mono/utils/mono-error.h>
#include "mono-error-internals.h"
static const char trailingBytesForUTF8[256] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,0,0
};
/**
* mono_unicode_from_external:
* \param in pointers to the buffer.
* \param bytes number of bytes in the string.
* Tries to turn a NULL-terminated string into UTF-16.
*
* First, see if it's valid UTF-8, in which case just turn it directly
* into UTF-16. If the conversion doesn't succeed, return NULL.
*
* Callers must free the returned string if not NULL. \p bytes holds the number
* of bytes in the returned string, not including the terminator.
*/
gunichar2 *mono_unicode_from_external (const gchar *in, gsize *bytes)
{
if(in==NULL) {
return(NULL);
}
if(g_utf8_validate (in, -1, NULL)) {
glong items_written;
gunichar2 *unires=g_utf8_to_utf16 (in, -1, NULL, &items_written, NULL);
items_written *= 2;
*bytes = items_written;
return(unires);
}
return(NULL);
}
/**
* mono_utf8_from_external:
* \param in pointer to the string buffer.
* Tries to turn a NULL-terminated string into UTF8.
*
* First, see if it's valid UTF-8, in which case there's nothing more
* to be done. If the conversion doesn't succeed, return NULL.
*
* Callers must free the returned string if not NULL.
*
* This function is identical to \c mono_unicode_from_external, apart
* from returning UTF-8 not UTF-16; it's handy in a few places to work
* in UTF-8.
*/
gchar *mono_utf8_from_external (const gchar *in)
{
if(in==NULL) {
return(NULL);
}
if(g_utf8_validate (in, -1, NULL)) {
return(g_strdup (in));
}
return(NULL);
}
/**
* mono_unicode_to_external:
* \param uni a UTF-16 string to convert to an external representation.
* Turns NULL-terminated UTF-16 into UTF-8. If the conversion doesn't
* work, then NULL is returned.
* Callers must free the returned string.
*/
gchar *mono_unicode_to_external (const gunichar2 *uni)
{
return mono_unicode_to_external_checked (uni, NULL);
}
gchar *mono_unicode_to_external_checked (const gunichar2 *uni, MonoError *err)
{
gchar *utf8;
GError *gerr = NULL;
utf8=g_utf16_to_utf8 (uni, -1, NULL, NULL, &gerr);
if (utf8 == NULL) {
mono_error_set_argument (err, "uni", gerr->message);
g_error_free (gerr);
return NULL;
}
return(utf8);
}
/**
* mono_utf8_validate_and_len
* \param source Pointer to putative UTF-8 encoded string.
* Checks \p source for being valid UTF-8. \p utf is assumed to be
* null-terminated.
* \returns TRUE if \p source is valid.
* \p oEnd will equal the null terminator at the end of the string if valid.
* if not valid, it will equal the first charater of the invalid sequence.
* \p oLength will equal the length to \p oEnd
**/
gboolean
mono_utf8_validate_and_len (const gchar *source, glong* oLength, const gchar** oEnd)
{
gboolean retVal = TRUE;
gboolean lastRet = TRUE;
guchar* ptr = (guchar*) source;
guchar* srcPtr;
guint length;
guchar a;
*oLength = 0;
while (*ptr != 0) {
length = trailingBytesForUTF8 [*ptr] + 1;
srcPtr = (guchar*) ptr + length;
switch (length) {
default: retVal = FALSE;
/* Everything else falls through when "TRUE"... */
case 4: if ((a = (*--srcPtr)) < (guchar) 0x80 || a > (guchar) 0xBF) retVal = FALSE;
if ((a == (guchar) 0xBF || a == (guchar) 0xBE) && *(srcPtr-1) == (guchar) 0xBF) {
if (*(srcPtr-2) == (guchar) 0x8F || *(srcPtr-2) == (guchar) 0x9F ||
*(srcPtr-2) == (guchar) 0xAF || *(srcPtr-2) == (guchar) 0xBF)
retVal = FALSE;
}
case 3: if ((a = (*--srcPtr)) < (guchar) 0x80 || a > (guchar) 0xBF) retVal = FALSE;
case 2: if ((a = (*--srcPtr)) < (guchar) 0x80 || a > (guchar) 0xBF) retVal = FALSE;
switch (*ptr) {
/* no fall-through in this inner switch */
case 0xE0: if (a < (guchar) 0xA0) retVal = FALSE; break;
case 0xED: if (a > (guchar) 0x9F) retVal = FALSE; break;
case 0xEF: {
if (a == (guchar)0xB7 && (*(srcPtr+1) > (guchar) 0x8F && *(srcPtr+1) < 0xB0)) retVal = FALSE;
else if (a == (guchar)0xBF && (*(srcPtr+1) == (guchar) 0xBE || *(srcPtr+1) == 0xBF)) retVal = FALSE;
break;
}
case 0xF0: if (a < (guchar) 0x90) retVal = FALSE; break;
case 0xF4: if (a > (guchar) 0x8F) retVal = FALSE; break;
default: if (a < (guchar) 0x80) retVal = FALSE;
}
case 1: if (*ptr >= (guchar ) 0x80 && *ptr < (guchar) 0xC2) retVal = FALSE;
}
if (*ptr > (guchar) 0xF4)
retVal = FALSE;
//If the string is invalid, set the end to the invalid byte.
if (!retVal && lastRet) {
if (oEnd != NULL)
*oEnd = (gchar*) ptr;
lastRet = FALSE;
}
ptr += length;
(*oLength)++;
}
if (retVal && oEnd != NULL)
*oEnd = (gchar*) ptr;
return retVal;
}
/**
* mono_utf8_validate_and_len_with_bounds
* \param source: Pointer to putative UTF-8 encoded string.
* \param max_bytes: Max number of bytes that can be decoded.
*
* Checks \p source for being valid UTF-8. \p utf is assumed to be
* null-terminated.
*
* This function returns FALSE if it needs to decode characters beyond \p max_bytes.
*
* \returns TRUE if \p source is valid.
* \p oEnd will equal the null terminator at the end of the string if valid.
* if not valid, it will equal the first charater of the invalid sequence.
* \p oLength will equal the length to \p oEnd
**/
gboolean
mono_utf8_validate_and_len_with_bounds (const gchar *source, glong max_bytes, glong* oLength, const gchar** oEnd)
{
gboolean retVal = TRUE;
gboolean lastRet = TRUE;
guchar* ptr = (guchar*) source;
guchar *end = ptr + max_bytes;
guchar* srcPtr;
guint length;
guchar a;
*oLength = 0;
if (max_bytes < 1) {
if (oEnd)
*oEnd = (gchar*) ptr;
return FALSE;
}
while (*ptr != 0) {
length = trailingBytesForUTF8 [*ptr] + 1;
srcPtr = (guchar*) ptr + length;
/* since *ptr is not zero we must ensure that we can decode the current char + the byte after
srcPtr points to the first byte after the current char.*/
if (srcPtr >= end) {
retVal = FALSE;
break;
}
switch (length) {
default: retVal = FALSE;
/* Everything else falls through when "TRUE"... */
case 4: if ((a = (*--srcPtr)) < (guchar) 0x80 || a > (guchar) 0xBF) retVal = FALSE;
if ((a == (guchar) 0xBF || a == (guchar) 0xBE) && *(srcPtr-1) == (guchar) 0xBF) {
if (*(srcPtr-2) == (guchar) 0x8F || *(srcPtr-2) == (guchar) 0x9F ||
*(srcPtr-2) == (guchar) 0xAF || *(srcPtr-2) == (guchar) 0xBF)
retVal = FALSE;
}
case 3: if ((a = (*--srcPtr)) < (guchar) 0x80 || a > (guchar) 0xBF) retVal = FALSE;
case 2: if ((a = (*--srcPtr)) < (guchar) 0x80 || a > (guchar) 0xBF) retVal = FALSE;
switch (*ptr) {
/* no fall-through in this inner switch */
case 0xE0: if (a < (guchar) 0xA0) retVal = FALSE; break;
case 0xED: if (a > (guchar) 0x9F) retVal = FALSE; break;
case 0xEF: {
if (a == (guchar)0xB7 && (*(srcPtr+1) > (guchar) 0x8F && *(srcPtr+1) < 0xB0)) retVal = FALSE;
else if (a == (guchar)0xBF && (*(srcPtr+1) == (guchar) 0xBE || *(srcPtr+1) == 0xBF)) retVal = FALSE;
break;
}
case 0xF0: if (a < (guchar) 0x90) retVal = FALSE; break;
case 0xF4: if (a > (guchar) 0x8F) retVal = FALSE; break;
default: if (a < (guchar) 0x80) retVal = FALSE;
}
case 1: if (*ptr >= (guchar ) 0x80 && *ptr < (guchar) 0xC2) retVal = FALSE;
}
if (*ptr > (guchar) 0xF4)
retVal = FALSE;
//If the string is invalid, set the end to the invalid byte.
if (!retVal && lastRet) {
if (oEnd != NULL)
*oEnd = (gchar*) ptr;
lastRet = FALSE;
}
ptr += length;
(*oLength)++;
}
if (retVal && oEnd != NULL)
*oEnd = (gchar*) ptr;
return retVal;
}
|
/**
* \file
* string encoding conversions
*
* Author:
* Dick Porter ([email protected])
*
* (C) 2003 Ximian, Inc.
*/
#include <config.h>
#include <glib.h>
#include <string.h>
#include "strenc.h"
#include "strenc-internals.h"
#include <mono/utils/mono-error.h>
#include "mono-error-internals.h"
static const char trailingBytesForUTF8[256] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,0,0
};
/**
* mono_unicode_from_external:
* \param in pointers to the buffer.
* \param bytes number of bytes in the string.
* Tries to turn a NULL-terminated string into UTF-16.
*
* First, see if it's valid UTF-8, in which case just turn it directly
* into UTF-16. If the conversion doesn't succeed, return NULL.
*
* Callers must free the returned string if not NULL. \p bytes holds the number
* of bytes in the returned string, not including the terminator.
*/
gunichar2 *mono_unicode_from_external (const gchar *in, gsize *bytes)
{
if(in==NULL) {
return(NULL);
}
if(g_utf8_validate (in, -1, NULL)) {
glong items_written;
gunichar2 *unires=g_utf8_to_utf16 (in, -1, NULL, &items_written, NULL);
items_written *= 2;
*bytes = items_written;
return(unires);
}
return(NULL);
}
/**
* mono_utf8_from_external:
* \param in pointer to the string buffer.
* Tries to turn a NULL-terminated string into UTF8.
*
* First, see if it's valid UTF-8, in which case there's nothing more
* to be done. If the conversion doesn't succeed, return NULL.
*
* Callers must free the returned string if not NULL.
*
* This function is identical to \c mono_unicode_from_external, apart
* from returning UTF-8 not UTF-16; it's handy in a few places to work
* in UTF-8.
*/
gchar *mono_utf8_from_external (const gchar *in)
{
if(in==NULL) {
return(NULL);
}
if(g_utf8_validate (in, -1, NULL)) {
return(g_strdup (in));
}
return(NULL);
}
/**
* mono_unicode_to_external:
* \param uni a UTF-16 string to convert to an external representation.
* Turns NULL-terminated UTF-16 into UTF-8. If the conversion doesn't
* work, then NULL is returned.
* Callers must free the returned string.
*/
gchar *mono_unicode_to_external (const gunichar2 *uni)
{
return mono_unicode_to_external_checked (uni, NULL);
}
gchar *mono_unicode_to_external_checked (const gunichar2 *uni, MonoError *err)
{
gchar *utf8;
GError *gerr = NULL;
utf8=g_utf16_to_utf8 (uni, -1, NULL, NULL, &gerr);
if (utf8 == NULL) {
mono_error_set_argument (err, "uni", gerr->message);
g_error_free (gerr);
return NULL;
}
return(utf8);
}
/**
* mono_utf8_validate_and_len
* \param source Pointer to putative UTF-8 encoded string.
* Checks \p source for being valid UTF-8. \p utf is assumed to be
* null-terminated.
* \returns TRUE if \p source is valid.
* \p oEnd will equal the null terminator at the end of the string if valid.
* if not valid, it will equal the first charater of the invalid sequence.
* \p oLength will equal the length to \p oEnd
**/
gboolean
mono_utf8_validate_and_len (const gchar *source, glong* oLength, const gchar** oEnd)
{
gboolean retVal = TRUE;
gboolean lastRet = TRUE;
guchar* ptr = (guchar*) source;
guchar* srcPtr;
guint length;
guchar a;
*oLength = 0;
while (*ptr != 0) {
length = trailingBytesForUTF8 [*ptr] + 1;
srcPtr = (guchar*) ptr + length;
switch (length) {
default: retVal = FALSE;
/* Everything else falls through when "TRUE"... */
case 4: if ((a = (*--srcPtr)) < (guchar) 0x80 || a > (guchar) 0xBF) retVal = FALSE;
if ((a == (guchar) 0xBF || a == (guchar) 0xBE) && *(srcPtr-1) == (guchar) 0xBF) {
if (*(srcPtr-2) == (guchar) 0x8F || *(srcPtr-2) == (guchar) 0x9F ||
*(srcPtr-2) == (guchar) 0xAF || *(srcPtr-2) == (guchar) 0xBF)
retVal = FALSE;
}
case 3: if ((a = (*--srcPtr)) < (guchar) 0x80 || a > (guchar) 0xBF) retVal = FALSE;
case 2: if ((a = (*--srcPtr)) < (guchar) 0x80 || a > (guchar) 0xBF) retVal = FALSE;
switch (*ptr) {
/* no fall-through in this inner switch */
case 0xE0: if (a < (guchar) 0xA0) retVal = FALSE; break;
case 0xED: if (a > (guchar) 0x9F) retVal = FALSE; break;
case 0xEF: {
if (a == (guchar)0xB7 && (*(srcPtr+1) > (guchar) 0x8F && *(srcPtr+1) < 0xB0)) retVal = FALSE;
else if (a == (guchar)0xBF && (*(srcPtr+1) == (guchar) 0xBE || *(srcPtr+1) == 0xBF)) retVal = FALSE;
break;
}
case 0xF0: if (a < (guchar) 0x90) retVal = FALSE; break;
case 0xF4: if (a > (guchar) 0x8F) retVal = FALSE; break;
default: if (a < (guchar) 0x80) retVal = FALSE;
}
case 1: if (*ptr >= (guchar ) 0x80 && *ptr < (guchar) 0xC2) retVal = FALSE;
}
if (*ptr > (guchar) 0xF4)
retVal = FALSE;
//If the string is invalid, set the end to the invalid byte.
if (!retVal && lastRet) {
if (oEnd != NULL)
*oEnd = (gchar*) ptr;
lastRet = FALSE;
}
ptr += length;
(*oLength)++;
}
if (retVal && oEnd != NULL)
*oEnd = (gchar*) ptr;
return retVal;
}
/**
* mono_utf8_validate_and_len_with_bounds
* \param source: Pointer to putative UTF-8 encoded string.
* \param max_bytes: Max number of bytes that can be decoded.
*
* Checks \p source for being valid UTF-8. \p utf is assumed to be
* null-terminated.
*
* This function returns FALSE if it needs to decode characters beyond \p max_bytes.
*
* \returns TRUE if \p source is valid.
* \p oEnd will equal the null terminator at the end of the string if valid.
* if not valid, it will equal the first charater of the invalid sequence.
* \p oLength will equal the length to \p oEnd
**/
gboolean
mono_utf8_validate_and_len_with_bounds (const gchar *source, glong max_bytes, glong* oLength, const gchar** oEnd)
{
gboolean retVal = TRUE;
gboolean lastRet = TRUE;
guchar* ptr = (guchar*) source;
guchar *end = ptr + max_bytes;
guchar* srcPtr;
guint length;
guchar a;
*oLength = 0;
if (max_bytes < 1) {
if (oEnd)
*oEnd = (gchar*) ptr;
return FALSE;
}
while (*ptr != 0) {
length = trailingBytesForUTF8 [*ptr] + 1;
srcPtr = (guchar*) ptr + length;
/* since *ptr is not zero we must ensure that we can decode the current char + the byte after
srcPtr points to the first byte after the current char.*/
if (srcPtr >= end) {
retVal = FALSE;
break;
}
switch (length) {
default: retVal = FALSE;
/* Everything else falls through when "TRUE"... */
case 4: if ((a = (*--srcPtr)) < (guchar) 0x80 || a > (guchar) 0xBF) retVal = FALSE;
if ((a == (guchar) 0xBF || a == (guchar) 0xBE) && *(srcPtr-1) == (guchar) 0xBF) {
if (*(srcPtr-2) == (guchar) 0x8F || *(srcPtr-2) == (guchar) 0x9F ||
*(srcPtr-2) == (guchar) 0xAF || *(srcPtr-2) == (guchar) 0xBF)
retVal = FALSE;
}
case 3: if ((a = (*--srcPtr)) < (guchar) 0x80 || a > (guchar) 0xBF) retVal = FALSE;
case 2: if ((a = (*--srcPtr)) < (guchar) 0x80 || a > (guchar) 0xBF) retVal = FALSE;
switch (*ptr) {
/* no fall-through in this inner switch */
case 0xE0: if (a < (guchar) 0xA0) retVal = FALSE; break;
case 0xED: if (a > (guchar) 0x9F) retVal = FALSE; break;
case 0xEF: {
if (a == (guchar)0xB7 && (*(srcPtr+1) > (guchar) 0x8F && *(srcPtr+1) < 0xB0)) retVal = FALSE;
else if (a == (guchar)0xBF && (*(srcPtr+1) == (guchar) 0xBE || *(srcPtr+1) == 0xBF)) retVal = FALSE;
break;
}
case 0xF0: if (a < (guchar) 0x90) retVal = FALSE; break;
case 0xF4: if (a > (guchar) 0x8F) retVal = FALSE; break;
default: if (a < (guchar) 0x80) retVal = FALSE;
}
case 1: if (*ptr >= (guchar ) 0x80 && *ptr < (guchar) 0xC2) retVal = FALSE;
}
if (*ptr > (guchar) 0xF4)
retVal = FALSE;
//If the string is invalid, set the end to the invalid byte.
if (!retVal && lastRet) {
if (oEnd != NULL)
*oEnd = (gchar*) ptr;
lastRet = FALSE;
}
ptr += length;
(*oLength)++;
}
if (retVal && oEnd != NULL)
*oEnd = (gchar*) ptr;
return retVal;
}
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/coreclr/gc/env/gcenv.object.h
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#ifndef __GCENV_OBJECT_H__
#define __GCENV_OBJECT_H__
// ARM requires that 64-bit primitive types are aligned at 64-bit boundaries for interlocked-like operations.
// Additionally the platform ABI requires these types and composite type containing them to be similarly
// aligned when passed as arguments.
#ifdef TARGET_ARM
#define FEATURE_64BIT_ALIGNMENT
#endif
//-------------------------------------------------------------------------------------------------
//
// Low-level types describing GC object layouts.
//
// Bits stolen from the sync block index that the GC/HandleTable knows about (currently these are at the same
// positions as the mainline runtime but we can change this below when it becomes apparent how Redhawk will
// handle sync blocks).
#define BIT_SBLK_GC_RESERVE 0x20000000
#define BIT_SBLK_FINALIZER_RUN 0x40000000
// The sync block index header (small structure that immediately precedes every object in the GC heap). Only
// the GC uses this so far, and only to store a couple of bits of information.
class ObjHeader
{
private:
#if defined(HOST_64BIT)
uint32_t m_uAlignpad;
#endif // HOST_64BIT
uint32_t m_uSyncBlockValue;
public:
uint32_t GetBits() { return m_uSyncBlockValue; }
void SetBit(uint32_t uBit) { Interlocked::Or(&m_uSyncBlockValue, uBit); }
void ClrBit(uint32_t uBit) { Interlocked::And(&m_uSyncBlockValue, ~uBit); }
void SetGCBit() { m_uSyncBlockValue |= BIT_SBLK_GC_RESERVE; }
void ClrGCBit() { m_uSyncBlockValue &= ~BIT_SBLK_GC_RESERVE; }
};
static_assert(sizeof(ObjHeader) == sizeof(uintptr_t), "this assumption is made by the VM!");
#define MTFlag_RequireAlign8 0x00001000
#define MTFlag_Category_ValueType 0x00040000
#define MTFlag_Category_ValueType_Mask 0x000C0000
#define MTFlag_ContainsPointers 0x01000000
#define MTFlag_HasCriticalFinalizer 0x08000000
#define MTFlag_HasFinalizer 0x00100000
#define MTFlag_IsArray 0x00080000
#define MTFlag_Collectible 0x10000000
#define MTFlag_HasComponentSize 0x80000000
class MethodTable
{
public:
union
{
uint16_t m_componentSize;
uint32_t m_flags;
};
uint32_t m_baseSize;
MethodTable * m_pRelatedType;
public:
void InitializeFreeObject()
{
m_baseSize = 3 * sizeof(void *);
m_flags = MTFlag_HasComponentSize | MTFlag_IsArray;
m_componentSize = 1;
}
uint32_t GetBaseSize()
{
return m_baseSize;
}
uint16_t RawGetComponentSize()
{
return m_componentSize;
}
bool Collectible()
{
return (m_flags & MTFlag_Collectible) != 0;
}
bool ContainsPointers()
{
return (m_flags & MTFlag_ContainsPointers) != 0;
}
bool ContainsPointersOrCollectible()
{
return ContainsPointers() || Collectible();
}
bool RequiresAlign8()
{
return (m_flags & MTFlag_RequireAlign8) != 0;
}
bool IsValueType()
{
return (m_flags & MTFlag_Category_ValueType_Mask) == MTFlag_Category_ValueType;
}
bool HasComponentSize()
{
// Note that we can't just check m_componentSize != 0 here. The VM
// may still construct a method table that does not have a component
// size, according to this method, but still has a number in the low
// 16 bits of the method table flags parameter.
//
// The solution here is to do what the VM does and check the
// HasComponentSize flag so that we're on the same page.
return (m_flags & MTFlag_HasComponentSize) != 0;
}
bool HasFinalizer()
{
return (m_flags & MTFlag_HasFinalizer) != 0;
}
bool HasCriticalFinalizer()
{
return (m_flags & MTFlag_HasCriticalFinalizer) != 0;
}
bool IsArray()
{
return (m_flags & MTFlag_IsArray) != 0;
}
MethodTable * GetParent()
{
_ASSERTE(!IsArray());
return m_pRelatedType;
}
bool SanityCheck()
{
return true;
}
};
class Object
{
MethodTable * m_pMethTab;
public:
ObjHeader * GetHeader()
{
return ((ObjHeader *)this) - 1;
}
MethodTable * RawGetMethodTable() const
{
return m_pMethTab;
}
MethodTable * GetGCSafeMethodTable() const
{
#ifdef HOST_64BIT
return (MethodTable *)((uintptr_t)m_pMethTab & ~7);
#else
return (MethodTable *)((uintptr_t)m_pMethTab & ~3);
#endif //HOST_64BIT
}
void RawSetMethodTable(MethodTable * pMT)
{
m_pMethTab = pMT;
}
};
#define MIN_OBJECT_SIZE (2*sizeof(uint8_t*) + sizeof(ObjHeader))
class ArrayBase : public Object
{
uint32_t m_dwLength;
public:
uint32_t GetNumComponents()
{
return m_dwLength;
}
static size_t GetOffsetOfNumComponents()
{
return offsetof(ArrayBase, m_dwLength);
}
};
#endif // __GCENV_OBJECT_H__
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#ifndef __GCENV_OBJECT_H__
#define __GCENV_OBJECT_H__
// ARM requires that 64-bit primitive types are aligned at 64-bit boundaries for interlocked-like operations.
// Additionally the platform ABI requires these types and composite type containing them to be similarly
// aligned when passed as arguments.
#ifdef TARGET_ARM
#define FEATURE_64BIT_ALIGNMENT
#endif
//-------------------------------------------------------------------------------------------------
//
// Low-level types describing GC object layouts.
//
// Bits stolen from the sync block index that the GC/HandleTable knows about (currently these are at the same
// positions as the mainline runtime but we can change this below when it becomes apparent how Redhawk will
// handle sync blocks).
#define BIT_SBLK_GC_RESERVE 0x20000000
#define BIT_SBLK_FINALIZER_RUN 0x40000000
// The sync block index header (small structure that immediately precedes every object in the GC heap). Only
// the GC uses this so far, and only to store a couple of bits of information.
class ObjHeader
{
private:
#if defined(HOST_64BIT)
uint32_t m_uAlignpad;
#endif // HOST_64BIT
uint32_t m_uSyncBlockValue;
public:
uint32_t GetBits() { return m_uSyncBlockValue; }
void SetBit(uint32_t uBit) { Interlocked::Or(&m_uSyncBlockValue, uBit); }
void ClrBit(uint32_t uBit) { Interlocked::And(&m_uSyncBlockValue, ~uBit); }
void SetGCBit() { m_uSyncBlockValue |= BIT_SBLK_GC_RESERVE; }
void ClrGCBit() { m_uSyncBlockValue &= ~BIT_SBLK_GC_RESERVE; }
};
static_assert(sizeof(ObjHeader) == sizeof(uintptr_t), "this assumption is made by the VM!");
#define MTFlag_RequireAlign8 0x00001000
#define MTFlag_Category_ValueType 0x00040000
#define MTFlag_Category_ValueType_Mask 0x000C0000
#define MTFlag_ContainsPointers 0x01000000
#define MTFlag_HasCriticalFinalizer 0x08000000
#define MTFlag_HasFinalizer 0x00100000
#define MTFlag_IsArray 0x00080000
#define MTFlag_Collectible 0x10000000
#define MTFlag_HasComponentSize 0x80000000
class MethodTable
{
public:
union
{
uint16_t m_componentSize;
uint32_t m_flags;
};
uint32_t m_baseSize;
MethodTable * m_pRelatedType;
public:
void InitializeFreeObject()
{
m_baseSize = 3 * sizeof(void *);
m_flags = MTFlag_HasComponentSize | MTFlag_IsArray;
m_componentSize = 1;
}
uint32_t GetBaseSize()
{
return m_baseSize;
}
uint16_t RawGetComponentSize()
{
return m_componentSize;
}
bool Collectible()
{
return (m_flags & MTFlag_Collectible) != 0;
}
bool ContainsPointers()
{
return (m_flags & MTFlag_ContainsPointers) != 0;
}
bool ContainsPointersOrCollectible()
{
return ContainsPointers() || Collectible();
}
bool RequiresAlign8()
{
return (m_flags & MTFlag_RequireAlign8) != 0;
}
bool IsValueType()
{
return (m_flags & MTFlag_Category_ValueType_Mask) == MTFlag_Category_ValueType;
}
bool HasComponentSize()
{
// Note that we can't just check m_componentSize != 0 here. The VM
// may still construct a method table that does not have a component
// size, according to this method, but still has a number in the low
// 16 bits of the method table flags parameter.
//
// The solution here is to do what the VM does and check the
// HasComponentSize flag so that we're on the same page.
return (m_flags & MTFlag_HasComponentSize) != 0;
}
bool HasFinalizer()
{
return (m_flags & MTFlag_HasFinalizer) != 0;
}
bool HasCriticalFinalizer()
{
return (m_flags & MTFlag_HasCriticalFinalizer) != 0;
}
bool IsArray()
{
return (m_flags & MTFlag_IsArray) != 0;
}
MethodTable * GetParent()
{
_ASSERTE(!IsArray());
return m_pRelatedType;
}
bool SanityCheck()
{
return true;
}
};
class Object
{
MethodTable * m_pMethTab;
public:
ObjHeader * GetHeader()
{
return ((ObjHeader *)this) - 1;
}
MethodTable * RawGetMethodTable() const
{
return m_pMethTab;
}
MethodTable * GetGCSafeMethodTable() const
{
#ifdef HOST_64BIT
return (MethodTable *)((uintptr_t)m_pMethTab & ~7);
#else
return (MethodTable *)((uintptr_t)m_pMethTab & ~3);
#endif //HOST_64BIT
}
void RawSetMethodTable(MethodTable * pMT)
{
m_pMethTab = pMT;
}
};
#define MIN_OBJECT_SIZE (2*sizeof(uint8_t*) + sizeof(ObjHeader))
class ArrayBase : public Object
{
uint32_t m_dwLength;
public:
uint32_t GetNumComponents()
{
return m_dwLength;
}
static size_t GetOffsetOfNumComponents()
{
return offsetof(ArrayBase, m_dwLength);
}
};
#endif // __GCENV_OBJECT_H__
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/native/external/zlib-intel/gzguts.h
|
/* gzguts.h -- zlib internal header definitions for gz* operations
* Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#ifdef _LARGEFILE64_SOURCE
# ifndef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE 1
# endif
# ifdef _FILE_OFFSET_BITS
# undef _FILE_OFFSET_BITS
# endif
#endif
#ifdef HAVE_HIDDEN
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
#else
# define ZLIB_INTERNAL
#endif
#include <stdio.h>
#include "zlib.h"
#ifdef STDC
# include <string.h>
# include <stdlib.h>
# include <limits.h>
#endif
#ifndef _POSIX_SOURCE
# define _POSIX_SOURCE
#endif
#include <fcntl.h>
#ifdef _WIN32
# include <stddef.h>
#endif
#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
# include <io.h>
#endif
#if defined(_WIN32)
# define WIDECHAR
#endif
#ifdef WINAPI_FAMILY
# define open _open
# define read _read
# define write _write
# define close _close
#endif
#ifdef NO_DEFLATE /* for compatibility with old definition */
# define NO_GZCOMPRESS
#endif
#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
# ifndef HAVE_VSNPRINTF
# define HAVE_VSNPRINTF
# endif
#endif
#if defined(__CYGWIN__)
# ifndef HAVE_VSNPRINTF
# define HAVE_VSNPRINTF
# endif
#endif
#if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410)
# ifndef HAVE_VSNPRINTF
# define HAVE_VSNPRINTF
# endif
#endif
#ifndef HAVE_VSNPRINTF
# ifdef MSDOS
/* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
but for now we just assume it doesn't. */
# define NO_vsnprintf
# endif
# ifdef __TURBOC__
# define NO_vsnprintf
# endif
# ifdef WIN32
/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
# if !defined(vsnprintf) && !defined(NO_vsnprintf)
# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
# define vsnprintf _vsnprintf
# endif
# endif
# endif
# ifdef __SASC
# define NO_vsnprintf
# endif
# ifdef VMS
# define NO_vsnprintf
# endif
# ifdef __OS400__
# define NO_vsnprintf
# endif
# ifdef __MVS__
# define NO_vsnprintf
# endif
#endif
/* unlike snprintf (which is required in C99), _snprintf does not guarantee
null termination of the result -- however this is only used in gzlib.c where
the result is assured to fit in the space provided */
#if defined(_MSC_VER) && _MSC_VER < 1900
# define snprintf _snprintf
#endif
#ifndef local
# define local static
#endif
/* since "static" is used to mean two completely different things in C, we
define "local" for the non-static meaning of "static", for readability
(compile with -Dlocal if your debugger can't find static symbols) */
/* gz* functions always use library allocation functions */
#ifndef STDC
extern voidp malloc OF((uInt size));
extern void free OF((voidpf ptr));
#endif
/* get errno and strerror definition */
#if defined UNDER_CE
# include <windows.h>
# define zstrerror() gz_strwinerror((DWORD)GetLastError())
#else
# ifndef NO_STRERROR
# include <errno.h>
# define zstrerror() strerror(errno)
# else
# define zstrerror() "stdio error (consult errno)"
# endif
#endif
/* provide prototypes for these when building zlib without LFS */
#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
#endif
/* default memLevel */
#if MAX_MEM_LEVEL >= 8
# define DEF_MEM_LEVEL 8
#else
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
#endif
/* default i/o buffer size -- double this for output when reading (this and
twice this must be able to fit in an unsigned type) */
#define GZBUFSIZE 8192
/* gzip modes, also provide a little integrity check on the passed structure */
#define GZ_NONE 0
#define GZ_READ 7247
#define GZ_WRITE 31153
#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */
/* values for gz_state how */
#define LOOK 0 /* look for a gzip header */
#define COPY 1 /* copy input directly */
#define GZIP 2 /* decompress a gzip stream */
/* internal gzip file state data structure */
typedef struct {
/* exposed contents for gzgetc() macro */
struct gzFile_s x; /* "x" for exposed */
/* x.have: number of bytes available at x.next */
/* x.next: next output data to deliver or write */
/* x.pos: current position in uncompressed data */
/* used for both reading and writing */
int mode; /* see gzip modes above */
int fd; /* file descriptor */
char *path; /* path or fd for error messages */
unsigned size; /* buffer size, zero if not allocated yet */
unsigned want; /* requested buffer size, default is GZBUFSIZE */
unsigned char *in; /* input buffer (double-sized when writing) */
unsigned char *out; /* output buffer (double-sized when reading) */
int direct; /* 0 if processing gzip, 1 if transparent */
/* just for reading */
int how; /* 0: get header, 1: copy, 2: decompress */
z_off64_t start; /* where the gzip data started, for rewinding */
int eof; /* true if end of input file reached */
int past; /* true if read requested past end */
/* just for writing */
int level; /* compression level */
int strategy; /* compression strategy */
/* seek request */
z_off64_t skip; /* amount to skip (already rewound if backwards) */
int seek; /* true if seek request pending */
/* error information */
int err; /* error code */
char *msg; /* error message */
/* zlib inflate or deflate stream */
z_stream strm; /* stream structure in-place (not a pointer) */
} gz_state;
typedef gz_state FAR *gz_statep;
/* shared functions */
void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
#if defined UNDER_CE
char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
#endif
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
value -- needed when comparing unsigned to z_off64_t, which is signed
(possible z_off64_t types off_t, off64_t, and long are all signed) */
#ifdef INT_MAX
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
#else
unsigned ZLIB_INTERNAL gz_intmax OF((void));
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
#endif
|
/* gzguts.h -- zlib internal header definitions for gz* operations
* Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#ifdef _LARGEFILE64_SOURCE
# ifndef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE 1
# endif
# ifdef _FILE_OFFSET_BITS
# undef _FILE_OFFSET_BITS
# endif
#endif
#ifdef HAVE_HIDDEN
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
#else
# define ZLIB_INTERNAL
#endif
#include <stdio.h>
#include "zlib.h"
#ifdef STDC
# include <string.h>
# include <stdlib.h>
# include <limits.h>
#endif
#ifndef _POSIX_SOURCE
# define _POSIX_SOURCE
#endif
#include <fcntl.h>
#ifdef _WIN32
# include <stddef.h>
#endif
#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
# include <io.h>
#endif
#if defined(_WIN32)
# define WIDECHAR
#endif
#ifdef WINAPI_FAMILY
# define open _open
# define read _read
# define write _write
# define close _close
#endif
#ifdef NO_DEFLATE /* for compatibility with old definition */
# define NO_GZCOMPRESS
#endif
#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
# ifndef HAVE_VSNPRINTF
# define HAVE_VSNPRINTF
# endif
#endif
#if defined(__CYGWIN__)
# ifndef HAVE_VSNPRINTF
# define HAVE_VSNPRINTF
# endif
#endif
#if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410)
# ifndef HAVE_VSNPRINTF
# define HAVE_VSNPRINTF
# endif
#endif
#ifndef HAVE_VSNPRINTF
# ifdef MSDOS
/* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
but for now we just assume it doesn't. */
# define NO_vsnprintf
# endif
# ifdef __TURBOC__
# define NO_vsnprintf
# endif
# ifdef WIN32
/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
# if !defined(vsnprintf) && !defined(NO_vsnprintf)
# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
# define vsnprintf _vsnprintf
# endif
# endif
# endif
# ifdef __SASC
# define NO_vsnprintf
# endif
# ifdef VMS
# define NO_vsnprintf
# endif
# ifdef __OS400__
# define NO_vsnprintf
# endif
# ifdef __MVS__
# define NO_vsnprintf
# endif
#endif
/* unlike snprintf (which is required in C99), _snprintf does not guarantee
null termination of the result -- however this is only used in gzlib.c where
the result is assured to fit in the space provided */
#if defined(_MSC_VER) && _MSC_VER < 1900
# define snprintf _snprintf
#endif
#ifndef local
# define local static
#endif
/* since "static" is used to mean two completely different things in C, we
define "local" for the non-static meaning of "static", for readability
(compile with -Dlocal if your debugger can't find static symbols) */
/* gz* functions always use library allocation functions */
#ifndef STDC
extern voidp malloc OF((uInt size));
extern void free OF((voidpf ptr));
#endif
/* get errno and strerror definition */
#if defined UNDER_CE
# include <windows.h>
# define zstrerror() gz_strwinerror((DWORD)GetLastError())
#else
# ifndef NO_STRERROR
# include <errno.h>
# define zstrerror() strerror(errno)
# else
# define zstrerror() "stdio error (consult errno)"
# endif
#endif
/* provide prototypes for these when building zlib without LFS */
#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
#endif
/* default memLevel */
#if MAX_MEM_LEVEL >= 8
# define DEF_MEM_LEVEL 8
#else
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
#endif
/* default i/o buffer size -- double this for output when reading (this and
twice this must be able to fit in an unsigned type) */
#define GZBUFSIZE 8192
/* gzip modes, also provide a little integrity check on the passed structure */
#define GZ_NONE 0
#define GZ_READ 7247
#define GZ_WRITE 31153
#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */
/* values for gz_state how */
#define LOOK 0 /* look for a gzip header */
#define COPY 1 /* copy input directly */
#define GZIP 2 /* decompress a gzip stream */
/* internal gzip file state data structure */
typedef struct {
/* exposed contents for gzgetc() macro */
struct gzFile_s x; /* "x" for exposed */
/* x.have: number of bytes available at x.next */
/* x.next: next output data to deliver or write */
/* x.pos: current position in uncompressed data */
/* used for both reading and writing */
int mode; /* see gzip modes above */
int fd; /* file descriptor */
char *path; /* path or fd for error messages */
unsigned size; /* buffer size, zero if not allocated yet */
unsigned want; /* requested buffer size, default is GZBUFSIZE */
unsigned char *in; /* input buffer (double-sized when writing) */
unsigned char *out; /* output buffer (double-sized when reading) */
int direct; /* 0 if processing gzip, 1 if transparent */
/* just for reading */
int how; /* 0: get header, 1: copy, 2: decompress */
z_off64_t start; /* where the gzip data started, for rewinding */
int eof; /* true if end of input file reached */
int past; /* true if read requested past end */
/* just for writing */
int level; /* compression level */
int strategy; /* compression strategy */
/* seek request */
z_off64_t skip; /* amount to skip (already rewound if backwards) */
int seek; /* true if seek request pending */
/* error information */
int err; /* error code */
char *msg; /* error message */
/* zlib inflate or deflate stream */
z_stream strm; /* stream structure in-place (not a pointer) */
} gz_state;
typedef gz_state FAR *gz_statep;
/* shared functions */
void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
#if defined UNDER_CE
char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
#endif
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
value -- needed when comparing unsigned to z_off64_t, which is signed
(possible z_off64_t types off_t, off64_t, and long are all signed) */
#ifdef INT_MAX
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
#else
unsigned ZLIB_INTERNAL gz_intmax OF((void));
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
#endif
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/libraries/System.IO.FileSystem/tests/DirectoryInfo/test-dir/dummy.txt
| -1 |
||
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/libraries/System.Text.Json/tests/System.Text.Json.FSharp.Tests/ValueOptionTests.fs
|
module System.Text.Json.Tests.FSharp.ValueOptionTests
open System.Text.Json
open System.Text.Json.Serialization
open System.Text.Json.Tests.FSharp.Helpers
open Xunit
let getOptionalElementInputs() = seq {
let wrap value = [| box value |]
wrap 42
wrap false
wrap "string"
wrap [|1..5|]
wrap (3,2)
wrap {| Name = "Mary" ; Age = 32 |}
wrap struct {| Name = "Mary" ; Age = 32 |}
wrap [false; true; false; false]
wrap (Set.ofSeq [1 .. 5])
wrap (Map.ofSeq [("key1", "value1"); ("key2", "value2")])
}
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Root-level ValueNone should serialize as null``(_ : 'T) =
let expected = "null"
let actual = JsonSerializer.Serialize<'T voption>(ValueNone)
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``ValueNone property should serialize as null``(_ : 'T) =
let expected = """{"value":null}"""
let actual = JsonSerializer.Serialize {| value = ValueOption<'T>.ValueNone |}
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``ValueNone collection element should serialize as null``(_ : 'T) =
let expected = """[null]"""
let actual = JsonSerializer.Serialize [| ValueOption<'T>.ValueNone |]
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Root-level ValueSome should serialize as the payload`` (value : 'T) =
let expected = JsonSerializer.Serialize(value)
let actual = JsonSerializer.Serialize(ValueSome value)
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``ValueSome property should serialize as the payload`` (value : 'T) =
let expected = JsonSerializer.Serialize {| value = value |}
let actual = JsonSerializer.Serialize {| value = ValueSome value |}
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``ValueSome collection element should serialize as the payload`` (value : 'T) =
let expected = JsonSerializer.Serialize [|value|]
let actual = JsonSerializer.Serialize [|ValueSome value|]
Assert.Equal(expected, actual)
[<Fact>]
let ``ValueSome of null should serialize as null`` () =
let expected = "null"
let actual = JsonSerializer.Serialize<string voption>(ValueSome null)
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``ValueSome of ValueNone should serialize as null`` (_ : 'T) =
let expected = "null"
let actual = JsonSerializer.Serialize<'T voption voption>(ValueSome ValueNone)
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``ValueSome of ValueSome of ValueNone should serialize as null`` (_ : 'T) =
let expected = "null"
let actual = JsonSerializer.Serialize<'T voption voption voption>(ValueSome (ValueSome ValueNone))
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``ValueSome of ValueSome of value should serialize as value`` (value : 'T) =
let expected = JsonSerializer.Serialize value
let actual = JsonSerializer.Serialize(ValueSome (ValueSome value))
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``WhenWritingDefault enabled should skip ValueNone properties``(_ : 'T) =
let expected = "{}"
let options = new JsonSerializerOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault)
let actual = JsonSerializer.Serialize<{| value : 'T voption |}>({| value = ValueNone |}, options)
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Root-level null should deserialize as ValueNone``(_ : 'T) =
let actual = JsonSerializer.Deserialize<'T voption>("null")
Assert.Equal(ValueNone, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Null property should deserialize as ValueNone``(_ : 'T) =
let actual = JsonSerializer.Deserialize<{| value : 'T voption |}>("""{"value":null}""")
Assert.Equal(ValueNone, actual.value)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Missing property should deserialize as ValueNone``(_ : 'T) =
let actual = JsonSerializer.Deserialize<{| value : 'T voption |}>("{}")
Assert.Equal(ValueNone, actual.value)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Null element should deserialize as ValueNone``(_ : 'T) =
let expected = [ValueOption<'T>.ValueNone]
let actual = JsonSerializer.Deserialize<'T voption []>("""[null]""")
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Root-level value should deserialize as ValueSome``(value : 'T) =
let json = JsonSerializer.Serialize(value)
let actual = JsonSerializer.Deserialize<'T voption>(json)
Assert.Equal(ValueSome value, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Property value should deserialize as ValueSome``(value : 'T) =
let json = JsonSerializer.Serialize {| value = value |}
let actual = JsonSerializer.Deserialize<{| value : 'T voption|}>(json)
Assert.Equal(ValueSome value, actual.value)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Collection element should deserialize as ValueSome``(value : 'T) =
let json = JsonSerializer.Serialize [| value |]
let actual = JsonSerializer.Deserialize<'T voption []>(json)
Assert.Equal([ValueSome value], actual)
[<Fact>]
let ``Optional value should support resumable serialization``() = async {
let valueToSerialize = {| Values = ValueSome [|1 .. 200|] |}
let expectedJson = JsonSerializer.Serialize valueToSerialize
let options = new JsonSerializerOptions(DefaultBufferSize = 1)
let! actualJson = JsonSerializer.SerializeAsync(valueToSerialize, options)
Assert.Equal(expectedJson, actualJson)
}
[<Fact>]
let ``Optional value should support resumable deserialization``() = async {
let valueToSerialize = {| Values = ValueSome [|1 .. 200|] |}
let json = JsonSerializer.Serialize valueToSerialize
let options = new JsonSerializerOptions(DefaultBufferSize = 1)
let! result = JsonSerializer.DeserializeAsync<{| Values : int [] voption |}>(json, options)
Assert.Equal(valueToSerialize, result)
}
|
module System.Text.Json.Tests.FSharp.ValueOptionTests
open System.Text.Json
open System.Text.Json.Serialization
open System.Text.Json.Tests.FSharp.Helpers
open Xunit
let getOptionalElementInputs() = seq {
let wrap value = [| box value |]
wrap 42
wrap false
wrap "string"
wrap [|1..5|]
wrap (3,2)
wrap {| Name = "Mary" ; Age = 32 |}
wrap struct {| Name = "Mary" ; Age = 32 |}
wrap [false; true; false; false]
wrap (Set.ofSeq [1 .. 5])
wrap (Map.ofSeq [("key1", "value1"); ("key2", "value2")])
}
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Root-level ValueNone should serialize as null``(_ : 'T) =
let expected = "null"
let actual = JsonSerializer.Serialize<'T voption>(ValueNone)
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``ValueNone property should serialize as null``(_ : 'T) =
let expected = """{"value":null}"""
let actual = JsonSerializer.Serialize {| value = ValueOption<'T>.ValueNone |}
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``ValueNone collection element should serialize as null``(_ : 'T) =
let expected = """[null]"""
let actual = JsonSerializer.Serialize [| ValueOption<'T>.ValueNone |]
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Root-level ValueSome should serialize as the payload`` (value : 'T) =
let expected = JsonSerializer.Serialize(value)
let actual = JsonSerializer.Serialize(ValueSome value)
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``ValueSome property should serialize as the payload`` (value : 'T) =
let expected = JsonSerializer.Serialize {| value = value |}
let actual = JsonSerializer.Serialize {| value = ValueSome value |}
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``ValueSome collection element should serialize as the payload`` (value : 'T) =
let expected = JsonSerializer.Serialize [|value|]
let actual = JsonSerializer.Serialize [|ValueSome value|]
Assert.Equal(expected, actual)
[<Fact>]
let ``ValueSome of null should serialize as null`` () =
let expected = "null"
let actual = JsonSerializer.Serialize<string voption>(ValueSome null)
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``ValueSome of ValueNone should serialize as null`` (_ : 'T) =
let expected = "null"
let actual = JsonSerializer.Serialize<'T voption voption>(ValueSome ValueNone)
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``ValueSome of ValueSome of ValueNone should serialize as null`` (_ : 'T) =
let expected = "null"
let actual = JsonSerializer.Serialize<'T voption voption voption>(ValueSome (ValueSome ValueNone))
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``ValueSome of ValueSome of value should serialize as value`` (value : 'T) =
let expected = JsonSerializer.Serialize value
let actual = JsonSerializer.Serialize(ValueSome (ValueSome value))
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``WhenWritingDefault enabled should skip ValueNone properties``(_ : 'T) =
let expected = "{}"
let options = new JsonSerializerOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault)
let actual = JsonSerializer.Serialize<{| value : 'T voption |}>({| value = ValueNone |}, options)
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Root-level null should deserialize as ValueNone``(_ : 'T) =
let actual = JsonSerializer.Deserialize<'T voption>("null")
Assert.Equal(ValueNone, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Null property should deserialize as ValueNone``(_ : 'T) =
let actual = JsonSerializer.Deserialize<{| value : 'T voption |}>("""{"value":null}""")
Assert.Equal(ValueNone, actual.value)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Missing property should deserialize as ValueNone``(_ : 'T) =
let actual = JsonSerializer.Deserialize<{| value : 'T voption |}>("{}")
Assert.Equal(ValueNone, actual.value)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Null element should deserialize as ValueNone``(_ : 'T) =
let expected = [ValueOption<'T>.ValueNone]
let actual = JsonSerializer.Deserialize<'T voption []>("""[null]""")
Assert.Equal(expected, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Root-level value should deserialize as ValueSome``(value : 'T) =
let json = JsonSerializer.Serialize(value)
let actual = JsonSerializer.Deserialize<'T voption>(json)
Assert.Equal(ValueSome value, actual)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Property value should deserialize as ValueSome``(value : 'T) =
let json = JsonSerializer.Serialize {| value = value |}
let actual = JsonSerializer.Deserialize<{| value : 'T voption|}>(json)
Assert.Equal(ValueSome value, actual.value)
[<Theory>]
[<MemberData(nameof(getOptionalElementInputs))>]
let ``Collection element should deserialize as ValueSome``(value : 'T) =
let json = JsonSerializer.Serialize [| value |]
let actual = JsonSerializer.Deserialize<'T voption []>(json)
Assert.Equal([ValueSome value], actual)
[<Fact>]
let ``Optional value should support resumable serialization``() = async {
let valueToSerialize = {| Values = ValueSome [|1 .. 200|] |}
let expectedJson = JsonSerializer.Serialize valueToSerialize
let options = new JsonSerializerOptions(DefaultBufferSize = 1)
let! actualJson = JsonSerializer.SerializeAsync(valueToSerialize, options)
Assert.Equal(expectedJson, actualJson)
}
[<Fact>]
let ``Optional value should support resumable deserialization``() = async {
let valueToSerialize = {| Values = ValueSome [|1 .. 200|] |}
let json = JsonSerializer.Serialize valueToSerialize
let options = new JsonSerializerOptions(DefaultBufferSize = 1)
let! result = JsonSerializer.DeserializeAsync<{| Values : int [] voption |}>(json, options)
Assert.Equal(valueToSerialize, result)
}
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/tests/JIT/CodeGenBringUpTests/IntConv_d.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="IntConv.cs" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="IntConv.cs" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/libraries/System.Private.CoreLib/src/System/Text/UTF8Encoding.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// The worker functions in this file was optimized for performance. If you make changes
// you should use care to consider all of the interesting cases.
// The code of all worker functions in this file is written twice: Once as a slow loop, and the
// second time as a fast loop. The slow loops handles all special cases, throws exceptions, etc.
// The fast loops attempts to blaze through as fast as possible with optimistic range checks,
// processing multiple characters at a time, and falling back to the slow loop for all special cases.
using System.Buffers;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text.Unicode;
namespace System.Text
{
// Encodes text into and out of UTF-8. UTF-8 is a way of writing
// Unicode characters with variable numbers of bytes per character,
// optimized for the lower 127 ASCII characters. It's an efficient way
// of encoding US English in an internationalizable way.
//
// Don't override IsAlwaysNormalized because it is just a Unicode Transformation and could be confused.
//
// The UTF-8 byte order mark is simply the Unicode byte order mark
// (0xFEFF) written in UTF-8 (0xEF 0xBB 0xBF). The byte order mark is
// used mostly to distinguish UTF-8 text from other encodings, and doesn't
// switch the byte orderings.
public partial class UTF8Encoding : Encoding
{
/*
bytes bits UTF-8 representation
----- ---- -----------------------------------
1 7 0vvvvvvv
2 11 110vvvvv 10vvvvvv
3 16 1110vvvv 10vvvvvv 10vvvvvv
4 21 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv
----- ---- -----------------------------------
Surrogate:
Real Unicode value = (HighSurrogate - 0xD800) * 0x400 + (LowSurrogate - 0xDC00) + 0x10000
*/
private const int UTF8_CODEPAGE = 65001;
/// <summary>
/// Transcoding to UTF-8 bytes from UTF-16 input chars will result in a maximum 3:1 expansion.
/// </summary>
/// <remarks>
/// Supplementary code points are expanded to UTF-8 from UTF-16 at a 4:2 ratio,
/// so 3:1 is still the correct value for maximum expansion.
/// </remarks>
private const int MaxUtf8BytesPerChar = 3;
// Used by Encoding.UTF8 for lazy initialization
// The initialization code will not be run until a static member of the class is referenced
internal static readonly UTF8EncodingSealed s_default = new UTF8EncodingSealed(encoderShouldEmitUTF8Identifier: true);
internal static ReadOnlySpan<byte> PreambleSpan => new byte[3] { 0xEF, 0xBB, 0xBF }; // uses C# compiler's optimization for static byte[] data
// Yes, the idea of emitting U+FEFF as a UTF-8 identifier has made it into
// the standard.
private readonly bool _emitUTF8Identifier;
private readonly bool _isThrowException;
public UTF8Encoding() :
base(UTF8_CODEPAGE)
{
}
public UTF8Encoding(bool encoderShouldEmitUTF8Identifier) :
this()
{
_emitUTF8Identifier = encoderShouldEmitUTF8Identifier;
}
public UTF8Encoding(bool encoderShouldEmitUTF8Identifier, bool throwOnInvalidBytes) :
this(encoderShouldEmitUTF8Identifier)
{
_isThrowException = throwOnInvalidBytes;
// Encoding's constructor already did this, but it'll be wrong if we're throwing exceptions
if (_isThrowException)
SetDefaultFallbacks();
}
internal sealed override void SetDefaultFallbacks()
{
// For UTF-X encodings, we use a replacement fallback with an empty string
if (_isThrowException)
{
this.encoderFallback = EncoderFallback.ExceptionFallback;
this.decoderFallback = DecoderFallback.ExceptionFallback;
}
else
{
this.encoderFallback = new EncoderReplacementFallback("\xFFFD");
this.decoderFallback = new DecoderReplacementFallback("\xFFFD");
}
}
// WARNING: GetByteCount(string chars)
// WARNING: has different variable names than EncodingNLS.cs, so this can't just be cut & pasted,
// WARNING: otherwise it'll break VB's way of declaring these.
//
// The following methods are copied from EncodingNLS.cs.
// Unfortunately EncodingNLS.cs is internal and we're public, so we have to re-implement them here.
// These should be kept in sync for the following classes:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
// Returns the number of bytes required to encode a range of characters in
// a character array.
//
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
// parent method is safe
public override unsafe int GetByteCount(char[] chars, int index, int count)
{
// Validate input parameters
if (chars is null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.chars, ExceptionResource.ArgumentNull_Array);
}
if ((index | count) < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException((index < 0) ? ExceptionArgument.index : ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (chars.Length - index < count)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.chars, ExceptionResource.ArgumentOutOfRange_IndexCountBuffer);
}
fixed (char* pChars = chars)
{
return GetByteCountCommon(pChars + index, count);
}
}
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
// parent method is safe
public override unsafe int GetByteCount(string chars)
{
// Validate input parameters
if (chars is null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.chars);
}
fixed (char* pChars = chars)
{
return GetByteCountCommon(pChars, chars.Length);
}
}
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
[CLSCompliant(false)]
public override unsafe int GetByteCount(char* chars, int count)
{
// Validate Parameters
if (chars == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.chars);
}
if (count < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
return GetByteCountCommon(chars, count);
}
public override unsafe int GetByteCount(ReadOnlySpan<char> chars)
{
// It's ok for us to pass null pointers down to the workhorse below.
fixed (char* charsPtr = &MemoryMarshal.GetReference(chars))
{
return GetByteCountCommon(charsPtr, chars.Length);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private unsafe int GetByteCountCommon(char* pChars, int charCount)
{
// Common helper method for all non-EncoderNLS entry points to GetByteCount.
// A modification of this method should be copied in to each of the supported encodings: ASCII, UTF8, UTF16, UTF32.
Debug.Assert(charCount >= 0, "Caller shouldn't specify negative length buffer.");
Debug.Assert(pChars != null || charCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
// First call into the fast path.
// Don't bother providing a fallback mechanism; our fast path doesn't use it.
int totalByteCount = GetByteCountFast(pChars, charCount, fallback: null, out int charsConsumed);
if (charsConsumed != charCount)
{
// If there's still data remaining in the source buffer, go down the fallback path.
// We need to check for integer overflow since the fallback could change the required
// output count in unexpected ways.
totalByteCount += GetByteCountWithFallback(pChars, charCount, charsConsumed);
if (totalByteCount < 0)
{
ThrowConversionOverflow();
}
}
return totalByteCount;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)] // called directly by GetCharCountCommon
private protected sealed override unsafe int GetByteCountFast(char* pChars, int charsLength, EncoderFallback? fallback, out int charsConsumed)
{
// The number of UTF-8 code units may exceed the number of UTF-16 code units,
// so we'll need to check for overflow before casting to Int32.
char* ptrToFirstInvalidChar = Utf16Utility.GetPointerToFirstInvalidChar(pChars, charsLength, out long utf8CodeUnitCountAdjustment, out _);
int tempCharsConsumed = (int)(ptrToFirstInvalidChar - pChars);
charsConsumed = tempCharsConsumed;
long totalUtf8Bytes = tempCharsConsumed + utf8CodeUnitCountAdjustment;
if ((ulong)totalUtf8Bytes > int.MaxValue)
{
ThrowConversionOverflow();
}
return (int)totalUtf8Bytes;
}
// Parent method is safe.
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
public override unsafe int GetBytes(string s, int charIndex, int charCount,
byte[] bytes, int byteIndex)
{
// Validate Parameters
if (s is null || bytes is null)
{
ThrowHelper.ThrowArgumentNullException(
argument: (s is null) ? ExceptionArgument.s : ExceptionArgument.bytes,
resource: ExceptionResource.ArgumentNull_Array);
}
if ((charIndex | charCount) < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(
argument: (charIndex < 0) ? ExceptionArgument.charIndex : ExceptionArgument.charCount,
resource: ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (s.Length - charIndex < charCount)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.s, ExceptionResource.ArgumentOutOfRange_IndexCount);
}
if ((uint)byteIndex > bytes.Length)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.byteIndex, ExceptionResource.ArgumentOutOfRange_Index);
}
fixed (char* pChars = s)
fixed (byte* pBytes = bytes)
{
return GetBytesCommon(pChars + charIndex, charCount, pBytes + byteIndex, bytes.Length - byteIndex);
}
}
// Encodes a range of characters in a character array into a range of bytes
// in a byte array. An exception occurs if the byte array is not large
// enough to hold the complete encoding of the characters. The
// GetByteCount method can be used to determine the exact number of
// bytes that will be produced for a given range of characters.
// Alternatively, the GetMaxByteCount method can be used to
// determine the maximum number of bytes that will be produced for a given
// number of characters, regardless of the actual character values.
//
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
// parent method is safe
public override unsafe int GetBytes(char[] chars, int charIndex, int charCount,
byte[] bytes, int byteIndex)
{
// Validate parameters
if (chars is null || bytes is null)
{
ThrowHelper.ThrowArgumentNullException(
argument: (chars is null) ? ExceptionArgument.chars : ExceptionArgument.bytes,
resource: ExceptionResource.ArgumentNull_Array);
}
if ((charIndex | charCount) < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(
argument: (charIndex < 0) ? ExceptionArgument.charIndex : ExceptionArgument.charCount,
resource: ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (chars.Length - charIndex < charCount)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.chars, ExceptionResource.ArgumentOutOfRange_IndexCount);
}
if ((uint)byteIndex > bytes.Length)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.byteIndex, ExceptionResource.ArgumentOutOfRange_Index);
}
fixed (char* pChars = chars)
fixed (byte* pBytes = bytes)
{
return GetBytesCommon(pChars + charIndex, charCount, pBytes + byteIndex, bytes.Length - byteIndex);
}
}
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
[CLSCompliant(false)]
public override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount)
{
// Validate Parameters
if (chars == null || bytes == null)
{
ThrowHelper.ThrowArgumentNullException(
argument: (chars is null) ? ExceptionArgument.chars : ExceptionArgument.bytes,
resource: ExceptionResource.ArgumentNull_Array);
}
if ((charCount | byteCount) < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(
argument: (charCount < 0) ? ExceptionArgument.charCount : ExceptionArgument.byteCount,
resource: ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
return GetBytesCommon(chars, charCount, bytes, byteCount);
}
public override unsafe int GetBytes(ReadOnlySpan<char> chars, Span<byte> bytes)
{
// It's ok for us to operate on null / empty spans.
fixed (char* charsPtr = &MemoryMarshal.GetReference(chars))
fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes))
{
return GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private unsafe int GetBytesCommon(char* pChars, int charCount, byte* pBytes, int byteCount)
{
// Common helper method for all non-EncoderNLS entry points to GetBytes.
// A modification of this method should be copied in to each of the supported encodings: ASCII, UTF8, UTF16, UTF32.
Debug.Assert(charCount >= 0, "Caller shouldn't specify negative length buffer.");
Debug.Assert(pChars != null || charCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
Debug.Assert(byteCount >= 0, "Caller shouldn't specify negative length buffer.");
Debug.Assert(pBytes != null || byteCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
// First call into the fast path.
int bytesWritten = GetBytesFast(pChars, charCount, pBytes, byteCount, out int charsConsumed);
if (charsConsumed == charCount)
{
// All elements converted - return immediately.
return bytesWritten;
}
else
{
// Simple narrowing conversion couldn't operate on entire buffer - invoke fallback.
return GetBytesWithFallback(pChars, charCount, pBytes, byteCount, charsConsumed, bytesWritten);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)] // called directly by GetBytesCommon
private protected sealed override unsafe int GetBytesFast(char* pChars, int charsLength, byte* pBytes, int bytesLength, out int charsConsumed)
{
// We don't care about the exact OperationStatus value returned by the workhorse routine; we only
// care if the workhorse was able to consume the entire input payload. If we're unable to do so,
// we'll handle the remainder in the fallback routine.
Utf8Utility.TranscodeToUtf8(pChars, charsLength, pBytes, bytesLength, out char* pInputBufferRemaining, out byte* pOutputBufferRemaining);
charsConsumed = (int)(pInputBufferRemaining - pChars);
return (int)(pOutputBufferRemaining - pBytes);
}
// Returns the number of characters produced by decoding a range of bytes
// in a byte array.
//
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
// parent method is safe
public override unsafe int GetCharCount(byte[] bytes, int index, int count)
{
// Validate Parameters
if (bytes is null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.bytes, ExceptionResource.ArgumentNull_Array);
}
if ((index | count) < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException((index < 0) ? ExceptionArgument.index : ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (bytes.Length - index < count)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.bytes, ExceptionResource.ArgumentOutOfRange_IndexCountBuffer);
}
fixed (byte* pBytes = bytes)
{
return GetCharCountCommon(pBytes + index, count);
}
}
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
[CLSCompliant(false)]
public override unsafe int GetCharCount(byte* bytes, int count)
{
// Validate Parameters
if (bytes == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.bytes, ExceptionResource.ArgumentNull_Array);
}
if (count < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
return GetCharCountCommon(bytes, count);
}
public override unsafe int GetCharCount(ReadOnlySpan<byte> bytes)
{
// It's ok for us to pass null pointers down to the workhorse routine.
fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes))
{
return GetCharCountCommon(bytesPtr, bytes.Length);
}
}
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
// parent method is safe
public override unsafe int GetChars(byte[] bytes, int byteIndex, int byteCount,
char[] chars, int charIndex)
{
// Validate Parameters
if (bytes is null || chars is null)
{
ThrowHelper.ThrowArgumentNullException(
argument: (bytes is null) ? ExceptionArgument.bytes : ExceptionArgument.chars,
resource: ExceptionResource.ArgumentNull_Array);
}
if ((byteIndex | byteCount) < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(
argument: (byteIndex < 0) ? ExceptionArgument.byteIndex : ExceptionArgument.byteCount,
resource: ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (bytes.Length - byteIndex < byteCount)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.bytes, ExceptionResource.ArgumentOutOfRange_IndexCountBuffer);
}
if ((uint)charIndex > (uint)chars.Length)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.charIndex, ExceptionResource.ArgumentOutOfRange_Index);
}
fixed (byte* pBytes = bytes)
fixed (char* pChars = chars)
{
return GetCharsCommon(pBytes + byteIndex, byteCount, pChars + charIndex, chars.Length - charIndex);
}
}
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
[CLSCompliant(false)]
public override unsafe int GetChars(byte* bytes, int byteCount, char* chars, int charCount)
{
// Validate Parameters
if (bytes is null || chars is null)
{
ThrowHelper.ThrowArgumentNullException(
argument: (bytes is null) ? ExceptionArgument.bytes : ExceptionArgument.chars,
resource: ExceptionResource.ArgumentNull_Array);
}
if ((byteCount | charCount) < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(
argument: (byteCount < 0) ? ExceptionArgument.byteCount : ExceptionArgument.charCount,
resource: ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
return GetCharsCommon(bytes, byteCount, chars, charCount);
}
public override unsafe int GetChars(ReadOnlySpan<byte> bytes, Span<char> chars)
{
// It's ok for us to pass null pointers down to the workhorse below.
fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes))
fixed (char* charsPtr = &MemoryMarshal.GetReference(chars))
{
return GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length);
}
}
// WARNING: If we throw an error, then System.Resources.ResourceReader calls this method.
// So if we're really broken, then that could also throw an error... recursively.
// So try to make sure GetChars can at least process all uses by
// System.Resources.ResourceReader!
//
// Note: We throw exceptions on individually encoded surrogates and other non-shortest forms.
// If exceptions aren't turned on, then we drop all non-shortest &individual surrogates.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private unsafe int GetCharsCommon(byte* pBytes, int byteCount, char* pChars, int charCount)
{
// Common helper method for all non-DecoderNLS entry points to GetChars.
// A modification of this method should be copied in to each of the supported encodings: ASCII, UTF8, UTF16, UTF32.
Debug.Assert(byteCount >= 0, "Caller shouldn't specify negative length buffer.");
Debug.Assert(pBytes != null || byteCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
Debug.Assert(charCount >= 0, "Caller shouldn't specify negative length buffer.");
Debug.Assert(pChars != null || charCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
// First call into the fast path.
int charsWritten = GetCharsFast(pBytes, byteCount, pChars, charCount, out int bytesConsumed);
if (bytesConsumed == byteCount)
{
// All elements converted - return immediately.
return charsWritten;
}
else
{
// Simple narrowing conversion couldn't operate on entire buffer - invoke fallback.
return GetCharsWithFallback(pBytes, byteCount, pChars, charCount, bytesConsumed, charsWritten);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)] // called directly by GetCharsCommon
private protected sealed override unsafe int GetCharsFast(byte* pBytes, int bytesLength, char* pChars, int charsLength, out int bytesConsumed)
{
// We don't care about the exact OperationStatus value returned by the workhorse routine; we only
// care if the workhorse was able to consume the entire input payload. If we're unable to do so,
// we'll handle the remainder in the fallback routine.
Utf8Utility.TranscodeToUtf16(pBytes, bytesLength, pChars, charsLength, out byte* pInputBufferRemaining, out char* pOutputBufferRemaining);
bytesConsumed = (int)(pInputBufferRemaining - pBytes);
return (int)(pOutputBufferRemaining - pChars);
}
private protected sealed override unsafe int GetCharsWithFallback(ReadOnlySpan<byte> bytes, int originalBytesLength, Span<char> chars, int originalCharsLength, DecoderNLS? decoder)
{
// We special-case DecoderReplacementFallback if it's telling us to write a single U+FFFD char,
// since we believe this to be relatively common and we can handle it more efficiently than
// the base implementation.
if (((decoder is null) ? this.DecoderFallback : decoder.Fallback) is DecoderReplacementFallback replacementFallback
&& replacementFallback.MaxCharCount == 1
&& replacementFallback.DefaultString[0] == UnicodeUtility.ReplacementChar)
{
// Don't care about the exact OperationStatus, just how much of the payload we were able
// to process.
Utf8.ToUtf16(bytes, chars, out int bytesRead, out int charsWritten, replaceInvalidSequences: true, isFinalBlock: decoder is null || decoder.MustFlush);
// Slice off how much we consumed / wrote.
bytes = bytes.Slice(bytesRead);
chars = chars.Slice(charsWritten);
}
// If we couldn't go through our fast fallback mechanism, or if we still have leftover
// data because we couldn't consume everything in the loop above, we need to go down the
// slow fallback path.
if (bytes.IsEmpty)
{
return originalCharsLength - chars.Length; // total number of chars written
}
else
{
return base.GetCharsWithFallback(bytes, originalBytesLength, chars, originalCharsLength, decoder);
}
}
// Returns a string containing the decoded representation of a range of
// bytes in a byte array.
//
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
// parent method is safe
public override unsafe string GetString(byte[] bytes, int index, int count)
{
// Validate Parameters
if (bytes is null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.bytes, ExceptionResource.ArgumentNull_Array);
}
if ((index | count) < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(
argument: (index < 0) ? ExceptionArgument.index : ExceptionArgument.count,
resource: ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (bytes.Length - index < count)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.bytes, ExceptionResource.ArgumentOutOfRange_IndexCountBuffer);
}
// Avoid problems with empty input buffer
if (count == 0)
return string.Empty;
fixed (byte* pBytes = bytes)
{
return string.CreateStringFromEncoding(pBytes + index, count, this);
}
}
//
// End of standard methods copied from EncodingNLS.cs
//
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private unsafe int GetCharCountCommon(byte* pBytes, int byteCount)
{
// Common helper method for all non-DecoderNLS entry points to GetCharCount.
// A modification of this method should be copied in to each of the supported encodings: ASCII, UTF8, UTF16, UTF32.
Debug.Assert(byteCount >= 0, "Caller shouldn't specify negative length buffer.");
Debug.Assert(pBytes != null || byteCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
// First call into the fast path.
// Don't bother providing a fallback mechanism; our fast path doesn't use it.
int totalCharCount = GetCharCountFast(pBytes, byteCount, fallback: null, out int bytesConsumed);
if (bytesConsumed != byteCount)
{
// If there's still data remaining in the source buffer, go down the fallback path.
// We need to check for integer overflow since the fallback could change the required
// output count in unexpected ways.
totalCharCount += GetCharCountWithFallback(pBytes, byteCount, bytesConsumed);
if (totalCharCount < 0)
{
ThrowConversionOverflow();
}
}
return totalCharCount;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)] // called directly by GetCharCountCommon
private protected sealed override unsafe int GetCharCountFast(byte* pBytes, int bytesLength, DecoderFallback? fallback, out int bytesConsumed)
{
// The number of UTF-16 code units will never exceed the number of UTF-8 code units,
// so the addition at the end of this method will not overflow.
byte* ptrToFirstInvalidByte = Utf8Utility.GetPointerToFirstInvalidByte(pBytes, bytesLength, out int utf16CodeUnitCountAdjustment, out _);
int tempBytesConsumed = (int)(ptrToFirstInvalidByte - pBytes);
bytesConsumed = tempBytesConsumed;
return tempBytesConsumed + utf16CodeUnitCountAdjustment;
}
public override Decoder GetDecoder()
{
return new DecoderNLS(this);
}
public override Encoder GetEncoder()
{
return new EncoderNLS(this);
}
//
// Beginning of methods used by shared fallback logic.
//
internal sealed override bool TryGetByteCount(Rune value, out int byteCount)
{
// All well-formed Rune instances can be converted to 1..4 UTF-8 code units.
byteCount = value.Utf8SequenceLength;
return true;
}
internal sealed override OperationStatus EncodeRune(Rune value, Span<byte> bytes, out int bytesWritten)
{
// All well-formed Rune instances can be encoded as 1..4 UTF-8 code units.
// If there's an error, it's because the destination was too small.
return value.TryEncodeToUtf8(bytes, out bytesWritten) ? OperationStatus.Done : OperationStatus.DestinationTooSmall;
}
internal sealed override OperationStatus DecodeFirstRune(ReadOnlySpan<byte> bytes, out Rune value, out int bytesConsumed)
{
return Rune.DecodeFromUtf8(bytes, out value, out bytesConsumed);
}
//
// End of methods used by shared fallback logic.
//
public override int GetMaxByteCount(int charCount)
{
if (charCount < 0)
throw new ArgumentOutOfRangeException(nameof(charCount),
SR.ArgumentOutOfRange_NeedNonNegNum);
// Characters would be # of characters + 1 in case left over high surrogate is ? * max fallback
long byteCount = (long)charCount + 1;
if (EncoderFallback.MaxCharCount > 1)
byteCount *= EncoderFallback.MaxCharCount;
byteCount *= MaxUtf8BytesPerChar;
if (byteCount > 0x7fffffff)
throw new ArgumentOutOfRangeException(nameof(charCount), SR.ArgumentOutOfRange_GetByteCountOverflow);
return (int)byteCount;
}
public override int GetMaxCharCount(int byteCount)
{
if (byteCount < 0)
throw new ArgumentOutOfRangeException(nameof(byteCount),
SR.ArgumentOutOfRange_NeedNonNegNum);
// Figure out our length, 1 char per input byte + 1 char if 1st byte is last byte of 4 byte surrogate pair
long charCount = ((long)byteCount + 1);
// Non-shortest form would fall back, so get max count from fallback.
// So would 11... followed by 11..., so you could fall back every byte
if (DecoderFallback.MaxCharCount > 1)
{
charCount *= DecoderFallback.MaxCharCount;
}
if (charCount > 0x7fffffff)
throw new ArgumentOutOfRangeException(nameof(byteCount), SR.ArgumentOutOfRange_GetCharCountOverflow);
return (int)charCount;
}
public override byte[] GetPreamble()
{
if (_emitUTF8Identifier)
{
// Allocate new array to prevent users from modifying it.
return new byte[3] { 0xEF, 0xBB, 0xBF };
}
else
return Array.Empty<byte>();
}
public override ReadOnlySpan<byte> Preamble =>
GetType() != typeof(UTF8Encoding) ? new ReadOnlySpan<byte>(GetPreamble()) : // in case a derived UTF8Encoding overrode GetPreamble
_emitUTF8Identifier ? PreambleSpan :
default;
public override bool Equals([NotNullWhen(true)] object? value)
{
if (value is UTF8Encoding that)
{
return (_emitUTF8Identifier == that._emitUTF8Identifier) &&
(EncoderFallback.Equals(that.EncoderFallback)) &&
(DecoderFallback.Equals(that.DecoderFallback));
}
return false;
}
public override int GetHashCode()
{
// Not great distribution, but this is relatively unlikely to be used as the key in a hashtable.
return this.EncoderFallback.GetHashCode() + this.DecoderFallback.GetHashCode() +
UTF8_CODEPAGE + (_emitUTF8Identifier ? 1 : 0);
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// The worker functions in this file was optimized for performance. If you make changes
// you should use care to consider all of the interesting cases.
// The code of all worker functions in this file is written twice: Once as a slow loop, and the
// second time as a fast loop. The slow loops handles all special cases, throws exceptions, etc.
// The fast loops attempts to blaze through as fast as possible with optimistic range checks,
// processing multiple characters at a time, and falling back to the slow loop for all special cases.
using System.Buffers;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text.Unicode;
namespace System.Text
{
// Encodes text into and out of UTF-8. UTF-8 is a way of writing
// Unicode characters with variable numbers of bytes per character,
// optimized for the lower 127 ASCII characters. It's an efficient way
// of encoding US English in an internationalizable way.
//
// Don't override IsAlwaysNormalized because it is just a Unicode Transformation and could be confused.
//
// The UTF-8 byte order mark is simply the Unicode byte order mark
// (0xFEFF) written in UTF-8 (0xEF 0xBB 0xBF). The byte order mark is
// used mostly to distinguish UTF-8 text from other encodings, and doesn't
// switch the byte orderings.
public partial class UTF8Encoding : Encoding
{
/*
bytes bits UTF-8 representation
----- ---- -----------------------------------
1 7 0vvvvvvv
2 11 110vvvvv 10vvvvvv
3 16 1110vvvv 10vvvvvv 10vvvvvv
4 21 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv
----- ---- -----------------------------------
Surrogate:
Real Unicode value = (HighSurrogate - 0xD800) * 0x400 + (LowSurrogate - 0xDC00) + 0x10000
*/
private const int UTF8_CODEPAGE = 65001;
/// <summary>
/// Transcoding to UTF-8 bytes from UTF-16 input chars will result in a maximum 3:1 expansion.
/// </summary>
/// <remarks>
/// Supplementary code points are expanded to UTF-8 from UTF-16 at a 4:2 ratio,
/// so 3:1 is still the correct value for maximum expansion.
/// </remarks>
private const int MaxUtf8BytesPerChar = 3;
// Used by Encoding.UTF8 for lazy initialization
// The initialization code will not be run until a static member of the class is referenced
internal static readonly UTF8EncodingSealed s_default = new UTF8EncodingSealed(encoderShouldEmitUTF8Identifier: true);
internal static ReadOnlySpan<byte> PreambleSpan => new byte[3] { 0xEF, 0xBB, 0xBF }; // uses C# compiler's optimization for static byte[] data
// Yes, the idea of emitting U+FEFF as a UTF-8 identifier has made it into
// the standard.
private readonly bool _emitUTF8Identifier;
private readonly bool _isThrowException;
public UTF8Encoding() :
base(UTF8_CODEPAGE)
{
}
public UTF8Encoding(bool encoderShouldEmitUTF8Identifier) :
this()
{
_emitUTF8Identifier = encoderShouldEmitUTF8Identifier;
}
public UTF8Encoding(bool encoderShouldEmitUTF8Identifier, bool throwOnInvalidBytes) :
this(encoderShouldEmitUTF8Identifier)
{
_isThrowException = throwOnInvalidBytes;
// Encoding's constructor already did this, but it'll be wrong if we're throwing exceptions
if (_isThrowException)
SetDefaultFallbacks();
}
internal sealed override void SetDefaultFallbacks()
{
// For UTF-X encodings, we use a replacement fallback with an empty string
if (_isThrowException)
{
this.encoderFallback = EncoderFallback.ExceptionFallback;
this.decoderFallback = DecoderFallback.ExceptionFallback;
}
else
{
this.encoderFallback = new EncoderReplacementFallback("\xFFFD");
this.decoderFallback = new DecoderReplacementFallback("\xFFFD");
}
}
// WARNING: GetByteCount(string chars)
// WARNING: has different variable names than EncodingNLS.cs, so this can't just be cut & pasted,
// WARNING: otherwise it'll break VB's way of declaring these.
//
// The following methods are copied from EncodingNLS.cs.
// Unfortunately EncodingNLS.cs is internal and we're public, so we have to re-implement them here.
// These should be kept in sync for the following classes:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
// Returns the number of bytes required to encode a range of characters in
// a character array.
//
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
// parent method is safe
public override unsafe int GetByteCount(char[] chars, int index, int count)
{
// Validate input parameters
if (chars is null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.chars, ExceptionResource.ArgumentNull_Array);
}
if ((index | count) < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException((index < 0) ? ExceptionArgument.index : ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (chars.Length - index < count)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.chars, ExceptionResource.ArgumentOutOfRange_IndexCountBuffer);
}
fixed (char* pChars = chars)
{
return GetByteCountCommon(pChars + index, count);
}
}
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
// parent method is safe
public override unsafe int GetByteCount(string chars)
{
// Validate input parameters
if (chars is null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.chars);
}
fixed (char* pChars = chars)
{
return GetByteCountCommon(pChars, chars.Length);
}
}
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
[CLSCompliant(false)]
public override unsafe int GetByteCount(char* chars, int count)
{
// Validate Parameters
if (chars == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.chars);
}
if (count < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
return GetByteCountCommon(chars, count);
}
public override unsafe int GetByteCount(ReadOnlySpan<char> chars)
{
// It's ok for us to pass null pointers down to the workhorse below.
fixed (char* charsPtr = &MemoryMarshal.GetReference(chars))
{
return GetByteCountCommon(charsPtr, chars.Length);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private unsafe int GetByteCountCommon(char* pChars, int charCount)
{
// Common helper method for all non-EncoderNLS entry points to GetByteCount.
// A modification of this method should be copied in to each of the supported encodings: ASCII, UTF8, UTF16, UTF32.
Debug.Assert(charCount >= 0, "Caller shouldn't specify negative length buffer.");
Debug.Assert(pChars != null || charCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
// First call into the fast path.
// Don't bother providing a fallback mechanism; our fast path doesn't use it.
int totalByteCount = GetByteCountFast(pChars, charCount, fallback: null, out int charsConsumed);
if (charsConsumed != charCount)
{
// If there's still data remaining in the source buffer, go down the fallback path.
// We need to check for integer overflow since the fallback could change the required
// output count in unexpected ways.
totalByteCount += GetByteCountWithFallback(pChars, charCount, charsConsumed);
if (totalByteCount < 0)
{
ThrowConversionOverflow();
}
}
return totalByteCount;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)] // called directly by GetCharCountCommon
private protected sealed override unsafe int GetByteCountFast(char* pChars, int charsLength, EncoderFallback? fallback, out int charsConsumed)
{
// The number of UTF-8 code units may exceed the number of UTF-16 code units,
// so we'll need to check for overflow before casting to Int32.
char* ptrToFirstInvalidChar = Utf16Utility.GetPointerToFirstInvalidChar(pChars, charsLength, out long utf8CodeUnitCountAdjustment, out _);
int tempCharsConsumed = (int)(ptrToFirstInvalidChar - pChars);
charsConsumed = tempCharsConsumed;
long totalUtf8Bytes = tempCharsConsumed + utf8CodeUnitCountAdjustment;
if ((ulong)totalUtf8Bytes > int.MaxValue)
{
ThrowConversionOverflow();
}
return (int)totalUtf8Bytes;
}
// Parent method is safe.
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
public override unsafe int GetBytes(string s, int charIndex, int charCount,
byte[] bytes, int byteIndex)
{
// Validate Parameters
if (s is null || bytes is null)
{
ThrowHelper.ThrowArgumentNullException(
argument: (s is null) ? ExceptionArgument.s : ExceptionArgument.bytes,
resource: ExceptionResource.ArgumentNull_Array);
}
if ((charIndex | charCount) < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(
argument: (charIndex < 0) ? ExceptionArgument.charIndex : ExceptionArgument.charCount,
resource: ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (s.Length - charIndex < charCount)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.s, ExceptionResource.ArgumentOutOfRange_IndexCount);
}
if ((uint)byteIndex > bytes.Length)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.byteIndex, ExceptionResource.ArgumentOutOfRange_Index);
}
fixed (char* pChars = s)
fixed (byte* pBytes = bytes)
{
return GetBytesCommon(pChars + charIndex, charCount, pBytes + byteIndex, bytes.Length - byteIndex);
}
}
// Encodes a range of characters in a character array into a range of bytes
// in a byte array. An exception occurs if the byte array is not large
// enough to hold the complete encoding of the characters. The
// GetByteCount method can be used to determine the exact number of
// bytes that will be produced for a given range of characters.
// Alternatively, the GetMaxByteCount method can be used to
// determine the maximum number of bytes that will be produced for a given
// number of characters, regardless of the actual character values.
//
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
// parent method is safe
public override unsafe int GetBytes(char[] chars, int charIndex, int charCount,
byte[] bytes, int byteIndex)
{
// Validate parameters
if (chars is null || bytes is null)
{
ThrowHelper.ThrowArgumentNullException(
argument: (chars is null) ? ExceptionArgument.chars : ExceptionArgument.bytes,
resource: ExceptionResource.ArgumentNull_Array);
}
if ((charIndex | charCount) < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(
argument: (charIndex < 0) ? ExceptionArgument.charIndex : ExceptionArgument.charCount,
resource: ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (chars.Length - charIndex < charCount)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.chars, ExceptionResource.ArgumentOutOfRange_IndexCount);
}
if ((uint)byteIndex > bytes.Length)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.byteIndex, ExceptionResource.ArgumentOutOfRange_Index);
}
fixed (char* pChars = chars)
fixed (byte* pBytes = bytes)
{
return GetBytesCommon(pChars + charIndex, charCount, pBytes + byteIndex, bytes.Length - byteIndex);
}
}
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
[CLSCompliant(false)]
public override unsafe int GetBytes(char* chars, int charCount, byte* bytes, int byteCount)
{
// Validate Parameters
if (chars == null || bytes == null)
{
ThrowHelper.ThrowArgumentNullException(
argument: (chars is null) ? ExceptionArgument.chars : ExceptionArgument.bytes,
resource: ExceptionResource.ArgumentNull_Array);
}
if ((charCount | byteCount) < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(
argument: (charCount < 0) ? ExceptionArgument.charCount : ExceptionArgument.byteCount,
resource: ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
return GetBytesCommon(chars, charCount, bytes, byteCount);
}
public override unsafe int GetBytes(ReadOnlySpan<char> chars, Span<byte> bytes)
{
// It's ok for us to operate on null / empty spans.
fixed (char* charsPtr = &MemoryMarshal.GetReference(chars))
fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes))
{
return GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private unsafe int GetBytesCommon(char* pChars, int charCount, byte* pBytes, int byteCount)
{
// Common helper method for all non-EncoderNLS entry points to GetBytes.
// A modification of this method should be copied in to each of the supported encodings: ASCII, UTF8, UTF16, UTF32.
Debug.Assert(charCount >= 0, "Caller shouldn't specify negative length buffer.");
Debug.Assert(pChars != null || charCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
Debug.Assert(byteCount >= 0, "Caller shouldn't specify negative length buffer.");
Debug.Assert(pBytes != null || byteCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
// First call into the fast path.
int bytesWritten = GetBytesFast(pChars, charCount, pBytes, byteCount, out int charsConsumed);
if (charsConsumed == charCount)
{
// All elements converted - return immediately.
return bytesWritten;
}
else
{
// Simple narrowing conversion couldn't operate on entire buffer - invoke fallback.
return GetBytesWithFallback(pChars, charCount, pBytes, byteCount, charsConsumed, bytesWritten);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)] // called directly by GetBytesCommon
private protected sealed override unsafe int GetBytesFast(char* pChars, int charsLength, byte* pBytes, int bytesLength, out int charsConsumed)
{
// We don't care about the exact OperationStatus value returned by the workhorse routine; we only
// care if the workhorse was able to consume the entire input payload. If we're unable to do so,
// we'll handle the remainder in the fallback routine.
Utf8Utility.TranscodeToUtf8(pChars, charsLength, pBytes, bytesLength, out char* pInputBufferRemaining, out byte* pOutputBufferRemaining);
charsConsumed = (int)(pInputBufferRemaining - pChars);
return (int)(pOutputBufferRemaining - pBytes);
}
// Returns the number of characters produced by decoding a range of bytes
// in a byte array.
//
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
// parent method is safe
public override unsafe int GetCharCount(byte[] bytes, int index, int count)
{
// Validate Parameters
if (bytes is null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.bytes, ExceptionResource.ArgumentNull_Array);
}
if ((index | count) < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException((index < 0) ? ExceptionArgument.index : ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (bytes.Length - index < count)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.bytes, ExceptionResource.ArgumentOutOfRange_IndexCountBuffer);
}
fixed (byte* pBytes = bytes)
{
return GetCharCountCommon(pBytes + index, count);
}
}
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
[CLSCompliant(false)]
public override unsafe int GetCharCount(byte* bytes, int count)
{
// Validate Parameters
if (bytes == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.bytes, ExceptionResource.ArgumentNull_Array);
}
if (count < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
return GetCharCountCommon(bytes, count);
}
public override unsafe int GetCharCount(ReadOnlySpan<byte> bytes)
{
// It's ok for us to pass null pointers down to the workhorse routine.
fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes))
{
return GetCharCountCommon(bytesPtr, bytes.Length);
}
}
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
// parent method is safe
public override unsafe int GetChars(byte[] bytes, int byteIndex, int byteCount,
char[] chars, int charIndex)
{
// Validate Parameters
if (bytes is null || chars is null)
{
ThrowHelper.ThrowArgumentNullException(
argument: (bytes is null) ? ExceptionArgument.bytes : ExceptionArgument.chars,
resource: ExceptionResource.ArgumentNull_Array);
}
if ((byteIndex | byteCount) < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(
argument: (byteIndex < 0) ? ExceptionArgument.byteIndex : ExceptionArgument.byteCount,
resource: ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (bytes.Length - byteIndex < byteCount)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.bytes, ExceptionResource.ArgumentOutOfRange_IndexCountBuffer);
}
if ((uint)charIndex > (uint)chars.Length)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.charIndex, ExceptionResource.ArgumentOutOfRange_Index);
}
fixed (byte* pBytes = bytes)
fixed (char* pChars = chars)
{
return GetCharsCommon(pBytes + byteIndex, byteCount, pChars + charIndex, chars.Length - charIndex);
}
}
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
[CLSCompliant(false)]
public override unsafe int GetChars(byte* bytes, int byteCount, char* chars, int charCount)
{
// Validate Parameters
if (bytes is null || chars is null)
{
ThrowHelper.ThrowArgumentNullException(
argument: (bytes is null) ? ExceptionArgument.bytes : ExceptionArgument.chars,
resource: ExceptionResource.ArgumentNull_Array);
}
if ((byteCount | charCount) < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(
argument: (byteCount < 0) ? ExceptionArgument.byteCount : ExceptionArgument.charCount,
resource: ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
return GetCharsCommon(bytes, byteCount, chars, charCount);
}
public override unsafe int GetChars(ReadOnlySpan<byte> bytes, Span<char> chars)
{
// It's ok for us to pass null pointers down to the workhorse below.
fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes))
fixed (char* charsPtr = &MemoryMarshal.GetReference(chars))
{
return GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length);
}
}
// WARNING: If we throw an error, then System.Resources.ResourceReader calls this method.
// So if we're really broken, then that could also throw an error... recursively.
// So try to make sure GetChars can at least process all uses by
// System.Resources.ResourceReader!
//
// Note: We throw exceptions on individually encoded surrogates and other non-shortest forms.
// If exceptions aren't turned on, then we drop all non-shortest &individual surrogates.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private unsafe int GetCharsCommon(byte* pBytes, int byteCount, char* pChars, int charCount)
{
// Common helper method for all non-DecoderNLS entry points to GetChars.
// A modification of this method should be copied in to each of the supported encodings: ASCII, UTF8, UTF16, UTF32.
Debug.Assert(byteCount >= 0, "Caller shouldn't specify negative length buffer.");
Debug.Assert(pBytes != null || byteCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
Debug.Assert(charCount >= 0, "Caller shouldn't specify negative length buffer.");
Debug.Assert(pChars != null || charCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
// First call into the fast path.
int charsWritten = GetCharsFast(pBytes, byteCount, pChars, charCount, out int bytesConsumed);
if (bytesConsumed == byteCount)
{
// All elements converted - return immediately.
return charsWritten;
}
else
{
// Simple narrowing conversion couldn't operate on entire buffer - invoke fallback.
return GetCharsWithFallback(pBytes, byteCount, pChars, charCount, bytesConsumed, charsWritten);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)] // called directly by GetCharsCommon
private protected sealed override unsafe int GetCharsFast(byte* pBytes, int bytesLength, char* pChars, int charsLength, out int bytesConsumed)
{
// We don't care about the exact OperationStatus value returned by the workhorse routine; we only
// care if the workhorse was able to consume the entire input payload. If we're unable to do so,
// we'll handle the remainder in the fallback routine.
Utf8Utility.TranscodeToUtf16(pBytes, bytesLength, pChars, charsLength, out byte* pInputBufferRemaining, out char* pOutputBufferRemaining);
bytesConsumed = (int)(pInputBufferRemaining - pBytes);
return (int)(pOutputBufferRemaining - pChars);
}
private protected sealed override unsafe int GetCharsWithFallback(ReadOnlySpan<byte> bytes, int originalBytesLength, Span<char> chars, int originalCharsLength, DecoderNLS? decoder)
{
// We special-case DecoderReplacementFallback if it's telling us to write a single U+FFFD char,
// since we believe this to be relatively common and we can handle it more efficiently than
// the base implementation.
if (((decoder is null) ? this.DecoderFallback : decoder.Fallback) is DecoderReplacementFallback replacementFallback
&& replacementFallback.MaxCharCount == 1
&& replacementFallback.DefaultString[0] == UnicodeUtility.ReplacementChar)
{
// Don't care about the exact OperationStatus, just how much of the payload we were able
// to process.
Utf8.ToUtf16(bytes, chars, out int bytesRead, out int charsWritten, replaceInvalidSequences: true, isFinalBlock: decoder is null || decoder.MustFlush);
// Slice off how much we consumed / wrote.
bytes = bytes.Slice(bytesRead);
chars = chars.Slice(charsWritten);
}
// If we couldn't go through our fast fallback mechanism, or if we still have leftover
// data because we couldn't consume everything in the loop above, we need to go down the
// slow fallback path.
if (bytes.IsEmpty)
{
return originalCharsLength - chars.Length; // total number of chars written
}
else
{
return base.GetCharsWithFallback(bytes, originalBytesLength, chars, originalCharsLength, decoder);
}
}
// Returns a string containing the decoded representation of a range of
// bytes in a byte array.
//
// All of our public Encodings that don't use EncodingNLS must have this (including EncodingNLS)
// So if you fix this, fix the others. Currently those include:
// EncodingNLS, UTF7Encoding, UTF8Encoding, UTF32Encoding, ASCIIEncoding, UnicodeEncoding
// parent method is safe
public override unsafe string GetString(byte[] bytes, int index, int count)
{
// Validate Parameters
if (bytes is null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.bytes, ExceptionResource.ArgumentNull_Array);
}
if ((index | count) < 0)
{
ThrowHelper.ThrowArgumentOutOfRangeException(
argument: (index < 0) ? ExceptionArgument.index : ExceptionArgument.count,
resource: ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
}
if (bytes.Length - index < count)
{
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.bytes, ExceptionResource.ArgumentOutOfRange_IndexCountBuffer);
}
// Avoid problems with empty input buffer
if (count == 0)
return string.Empty;
fixed (byte* pBytes = bytes)
{
return string.CreateStringFromEncoding(pBytes + index, count, this);
}
}
//
// End of standard methods copied from EncodingNLS.cs
//
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private unsafe int GetCharCountCommon(byte* pBytes, int byteCount)
{
// Common helper method for all non-DecoderNLS entry points to GetCharCount.
// A modification of this method should be copied in to each of the supported encodings: ASCII, UTF8, UTF16, UTF32.
Debug.Assert(byteCount >= 0, "Caller shouldn't specify negative length buffer.");
Debug.Assert(pBytes != null || byteCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
// First call into the fast path.
// Don't bother providing a fallback mechanism; our fast path doesn't use it.
int totalCharCount = GetCharCountFast(pBytes, byteCount, fallback: null, out int bytesConsumed);
if (bytesConsumed != byteCount)
{
// If there's still data remaining in the source buffer, go down the fallback path.
// We need to check for integer overflow since the fallback could change the required
// output count in unexpected ways.
totalCharCount += GetCharCountWithFallback(pBytes, byteCount, bytesConsumed);
if (totalCharCount < 0)
{
ThrowConversionOverflow();
}
}
return totalCharCount;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)] // called directly by GetCharCountCommon
private protected sealed override unsafe int GetCharCountFast(byte* pBytes, int bytesLength, DecoderFallback? fallback, out int bytesConsumed)
{
// The number of UTF-16 code units will never exceed the number of UTF-8 code units,
// so the addition at the end of this method will not overflow.
byte* ptrToFirstInvalidByte = Utf8Utility.GetPointerToFirstInvalidByte(pBytes, bytesLength, out int utf16CodeUnitCountAdjustment, out _);
int tempBytesConsumed = (int)(ptrToFirstInvalidByte - pBytes);
bytesConsumed = tempBytesConsumed;
return tempBytesConsumed + utf16CodeUnitCountAdjustment;
}
public override Decoder GetDecoder()
{
return new DecoderNLS(this);
}
public override Encoder GetEncoder()
{
return new EncoderNLS(this);
}
//
// Beginning of methods used by shared fallback logic.
//
internal sealed override bool TryGetByteCount(Rune value, out int byteCount)
{
// All well-formed Rune instances can be converted to 1..4 UTF-8 code units.
byteCount = value.Utf8SequenceLength;
return true;
}
internal sealed override OperationStatus EncodeRune(Rune value, Span<byte> bytes, out int bytesWritten)
{
// All well-formed Rune instances can be encoded as 1..4 UTF-8 code units.
// If there's an error, it's because the destination was too small.
return value.TryEncodeToUtf8(bytes, out bytesWritten) ? OperationStatus.Done : OperationStatus.DestinationTooSmall;
}
internal sealed override OperationStatus DecodeFirstRune(ReadOnlySpan<byte> bytes, out Rune value, out int bytesConsumed)
{
return Rune.DecodeFromUtf8(bytes, out value, out bytesConsumed);
}
//
// End of methods used by shared fallback logic.
//
public override int GetMaxByteCount(int charCount)
{
if (charCount < 0)
throw new ArgumentOutOfRangeException(nameof(charCount),
SR.ArgumentOutOfRange_NeedNonNegNum);
// Characters would be # of characters + 1 in case left over high surrogate is ? * max fallback
long byteCount = (long)charCount + 1;
if (EncoderFallback.MaxCharCount > 1)
byteCount *= EncoderFallback.MaxCharCount;
byteCount *= MaxUtf8BytesPerChar;
if (byteCount > 0x7fffffff)
throw new ArgumentOutOfRangeException(nameof(charCount), SR.ArgumentOutOfRange_GetByteCountOverflow);
return (int)byteCount;
}
public override int GetMaxCharCount(int byteCount)
{
if (byteCount < 0)
throw new ArgumentOutOfRangeException(nameof(byteCount),
SR.ArgumentOutOfRange_NeedNonNegNum);
// Figure out our length, 1 char per input byte + 1 char if 1st byte is last byte of 4 byte surrogate pair
long charCount = ((long)byteCount + 1);
// Non-shortest form would fall back, so get max count from fallback.
// So would 11... followed by 11..., so you could fall back every byte
if (DecoderFallback.MaxCharCount > 1)
{
charCount *= DecoderFallback.MaxCharCount;
}
if (charCount > 0x7fffffff)
throw new ArgumentOutOfRangeException(nameof(byteCount), SR.ArgumentOutOfRange_GetCharCountOverflow);
return (int)charCount;
}
public override byte[] GetPreamble()
{
if (_emitUTF8Identifier)
{
// Allocate new array to prevent users from modifying it.
return new byte[3] { 0xEF, 0xBB, 0xBF };
}
else
return Array.Empty<byte>();
}
public override ReadOnlySpan<byte> Preamble =>
GetType() != typeof(UTF8Encoding) ? new ReadOnlySpan<byte>(GetPreamble()) : // in case a derived UTF8Encoding overrode GetPreamble
_emitUTF8Identifier ? PreambleSpan :
default;
public override bool Equals([NotNullWhen(true)] object? value)
{
if (value is UTF8Encoding that)
{
return (_emitUTF8Identifier == that._emitUTF8Identifier) &&
(EncoderFallback.Equals(that.EncoderFallback)) &&
(DecoderFallback.Equals(that.DecoderFallback));
}
return false;
}
public override int GetHashCode()
{
// Not great distribution, but this is relatively unlikely to be used as the key in a hashtable.
return this.EncoderFallback.GetHashCode() + this.DecoderFallback.GetHashCode() +
UTF8_CODEPAGE + (_emitUTF8Identifier ? 1 : 0);
}
}
}
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/coreclr/nativeaot/System.Private.DisabledReflection/src/Resources/Strings.resx
|
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Arg_HTCapacityOverflow" xml:space="preserve">
<value>Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table.</value>
</data>
<data name="Reflection_Disabled" xml:space="preserve">
<value>This operation is not available because the reflection support was disabled at compile time.</value>
</data>
</root>
|
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Arg_HTCapacityOverflow" xml:space="preserve">
<value>Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table.</value>
</data>
<data name="Reflection_Disabled" xml:space="preserve">
<value>This operation is not available because the reflection support was disabled at compile time.</value>
</data>
</root>
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/tests/JIT/Regression/CLR-x86-JIT/V1-M11-Beta1/b43313/b43313.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<DebugType />
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<DebugType />
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/tests/baseservices/threading/generics/syncdelegate/GThread27.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<ItemGroup>
<Compile Include="thread27.cs" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<ItemGroup>
<Compile Include="thread27.cs" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/tests/Loader/classloader/rmv/il/RMV-2-5-8-two.ilproj
|
<Project Sdk="Microsoft.NET.Sdk.IL">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<ItemGroup>
<Compile Include="RMV-2-5-8-two.il" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk.IL">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<ItemGroup>
<Compile Include="RMV-2-5-8-two.il" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/libraries/System.DirectoryServices/src/System/DirectoryServices/ResultPropertyCollection.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections;
using System.Globalization;
namespace System.DirectoryServices
{
/// <devdoc>
/// Contains the properties on a <see cref='System.DirectoryServices.SearchResult'/>.
/// </devdoc>
public class ResultPropertyCollection : DictionaryBase
{
internal ResultPropertyCollection()
{
}
/// <devdoc>
/// Gets the property with the given name.
/// </devdoc>
public ResultPropertyValueCollection this[string name]
{
get
{
object objectName = name.ToLowerInvariant();
if (Contains((string)objectName))
{
return (ResultPropertyValueCollection)InnerHashtable[objectName]!;
}
else
{
return new ResultPropertyValueCollection(Array.Empty<object>());
}
}
}
public ICollection PropertyNames => Dictionary.Keys;
public ICollection Values => Dictionary.Values;
internal void Add(string name, ResultPropertyValueCollection value)
{
Dictionary.Add(name.ToLowerInvariant(), value);
}
public bool Contains(string propertyName)
{
object objectName = propertyName.ToLowerInvariant();
return Dictionary.Contains(objectName);
}
public void CopyTo(ResultPropertyValueCollection[] array, int index)
{
Dictionary.Values.CopyTo((Array)array, index);
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections;
using System.Globalization;
namespace System.DirectoryServices
{
/// <devdoc>
/// Contains the properties on a <see cref='System.DirectoryServices.SearchResult'/>.
/// </devdoc>
public class ResultPropertyCollection : DictionaryBase
{
internal ResultPropertyCollection()
{
}
/// <devdoc>
/// Gets the property with the given name.
/// </devdoc>
public ResultPropertyValueCollection this[string name]
{
get
{
object objectName = name.ToLowerInvariant();
if (Contains((string)objectName))
{
return (ResultPropertyValueCollection)InnerHashtable[objectName]!;
}
else
{
return new ResultPropertyValueCollection(Array.Empty<object>());
}
}
}
public ICollection PropertyNames => Dictionary.Keys;
public ICollection Values => Dictionary.Values;
internal void Add(string name, ResultPropertyValueCollection value)
{
Dictionary.Add(name.ToLowerInvariant(), value);
}
public bool Contains(string propertyName)
{
object objectName = propertyName.ToLowerInvariant();
return Dictionary.Contains(objectName);
}
public void CopyTo(ResultPropertyValueCollection[] array, int index)
{
Dictionary.Values.CopyTo((Array)array, index);
}
}
}
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/tests/JIT/CodeGenBringUpTests/Array2.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
using System;
using System.Runtime.CompilerServices;
public class BringUpTest_Array2
{
const int Pass = 100;
const int Fail = -1;
[MethodImplAttribute(MethodImplOptions.NoInlining)]
static int Array2(int[] a)
{
return a[1];
}
static int Main()
{
int[] a = {1, 2, 3, 4};
if (Array2(a) != 2) return Fail;
return Pass;
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
using System;
using System.Runtime.CompilerServices;
public class BringUpTest_Array2
{
const int Pass = 100;
const int Fail = -1;
[MethodImplAttribute(MethodImplOptions.NoInlining)]
static int Array2(int[] a)
{
return a[1];
}
static int Main()
{
int[] a = {1, 2, 3, 4};
if (Array2(a) != 2) return Fail;
return Pass;
}
}
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/tests/Loader/classloader/generics/GenericMethods/method001f.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<ItemGroup>
<Compile Include="method001f.cs" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<ItemGroup>
<Compile Include="method001f.cs" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/libraries/System.Security.SecureString/Directory.Build.props
|
<Project>
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<StrongNameKeyId>Microsoft</StrongNameKeyId>
</PropertyGroup>
</Project>
|
<Project>
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<StrongNameKeyId>Microsoft</StrongNameKeyId>
</PropertyGroup>
</Project>
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/libraries/System.IO.Pipelines/src/System/IO/Pipelines/StreamPipeReaderOptions.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Buffers;
namespace System.IO.Pipelines
{
/// <summary>Represents a set of options for controlling the creation of the <see cref="System.IO.Pipelines.PipeReader" />.</summary>
public class StreamPipeReaderOptions
{
private const int DefaultBufferSize = 4096;
internal const int DefaultMaxBufferSize = 2048 * 1024;
private const int DefaultMinimumReadSize = 1024;
internal static readonly StreamPipeReaderOptions s_default = new StreamPipeReaderOptions();
/// <summary>Initializes a <see cref="System.IO.Pipelines.StreamPipeReaderOptions" /> instance, optionally specifying a memory pool, a minimum buffer size, a minimum read size, and whether the underlying stream should be left open after the <see cref="System.IO.Pipelines.PipeReader" /> completes.</summary>
/// <param name="pool">The memory pool to use when allocating memory. The default value is <see langword="null" />.</param>
/// <param name="bufferSize">The minimum buffer size to use when renting memory from the <paramref name="pool" />. The default value is 4096.</param>
/// <param name="minimumReadSize">The threshold of remaining bytes in the buffer before a new buffer is allocated. The default value is 1024.</param>
/// <param name="leaveOpen"><see langword="true" /> to leave the underlying stream open after the <see cref="System.IO.Pipelines.PipeReader" /> completes; <see langword="false" /> to close it. The default is <see langword="false" />.</param>
public StreamPipeReaderOptions(MemoryPool<byte>? pool, int bufferSize, int minimumReadSize, bool leaveOpen) :
this(pool, bufferSize, minimumReadSize, leaveOpen, useZeroByteReads: false)
{
}
/// <summary>Initializes a <see cref="System.IO.Pipelines.StreamPipeReaderOptions" /> instance, optionally specifying a memory pool, a minimum buffer size, a minimum read size, and whether the underlying stream should be left open after the <see cref="System.IO.Pipelines.PipeReader" /> completes.</summary>
/// <param name="pool">The memory pool to use when allocating memory. The default value is <see langword="null" />.</param>
/// <param name="bufferSize">The minimum buffer size to use when renting memory from the <paramref name="pool" />. The default value is 4096.</param>
/// <param name="minimumReadSize">The threshold of remaining bytes in the buffer before a new buffer is allocated. The default value is 1024.</param>
/// <param name="leaveOpen"><see langword="true" /> to leave the underlying stream open after the <see cref="System.IO.Pipelines.PipeReader" /> completes; <see langword="false" /> to close it. The default is <see langword="false" />.</param>
/// <param name="useZeroByteReads"><see langword="true" /> if reads with an empty buffer should be issued to the underlying stream before allocating memory; otherwise, <see langword="false" />.</param>
public StreamPipeReaderOptions(MemoryPool<byte>? pool = null, int bufferSize = -1, int minimumReadSize = -1, bool leaveOpen = false, bool useZeroByteReads = false)
{
Pool = pool ?? MemoryPool<byte>.Shared;
IsDefaultSharedMemoryPool = Pool == MemoryPool<byte>.Shared;
BufferSize =
bufferSize == -1 ? DefaultBufferSize :
bufferSize <= 0 ? throw new ArgumentOutOfRangeException(nameof(bufferSize)) :
bufferSize;
MinimumReadSize =
minimumReadSize == -1 ? DefaultMinimumReadSize :
minimumReadSize <= 0 ? throw new ArgumentOutOfRangeException(nameof(minimumReadSize)) :
minimumReadSize;
LeaveOpen = leaveOpen;
UseZeroByteReads = useZeroByteReads;
}
/// <summary>Gets the minimum buffer size to use when renting memory from the <see cref="System.IO.Pipelines.StreamPipeReaderOptions.Pool" />.</summary>
/// <value>The buffer size.</value>
public int BufferSize { get; }
/// <summary>Gets the maximum buffer size to use when renting memory from the <see cref="System.IO.Pipelines.StreamPipeReaderOptions.Pool" />.</summary>
/// <value>The maximum buffer size.</value>
internal int MaxBufferSize { get; } = DefaultMaxBufferSize;
/// <summary>Gets the threshold of remaining bytes in the buffer before a new buffer is allocated.</summary>
/// <value>The minimum read size.</value>
public int MinimumReadSize { get; }
/// <summary>Gets the <see cref="System.Buffers.MemoryPool{T}" /> to use when allocating memory.</summary>
/// <value>A memory pool instance.</value>
public MemoryPool<byte> Pool { get; }
/// <summary>Gets the value that indicates if the underlying stream should be left open after the <see cref="System.IO.Pipelines.PipeReader" /> completes.</summary>
/// <value><see langword="true" /> if the underlying stream should be left open after the <see cref="System.IO.Pipelines.PipeReader" /> completes; otherwise, <see langword="false" />.</value>
public bool LeaveOpen { get; }
/// <summary>Gets the value that indicates if reads with an empty buffer should be issued to the underlying stream, in order to wait for data to arrive before allocating memory.</summary>
/// <value><see langword="true" /> if reads with an empty buffer should be issued to the underlying stream before allocating memory; otherwise, <see langword="false" />.</value>
public bool UseZeroByteReads { get; }
/// <summary>
/// Returns true if Pool is <see cref="MemoryPool{Byte}"/>.Shared
/// </summary>
internal bool IsDefaultSharedMemoryPool { get; }
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Buffers;
namespace System.IO.Pipelines
{
/// <summary>Represents a set of options for controlling the creation of the <see cref="System.IO.Pipelines.PipeReader" />.</summary>
public class StreamPipeReaderOptions
{
private const int DefaultBufferSize = 4096;
internal const int DefaultMaxBufferSize = 2048 * 1024;
private const int DefaultMinimumReadSize = 1024;
internal static readonly StreamPipeReaderOptions s_default = new StreamPipeReaderOptions();
/// <summary>Initializes a <see cref="System.IO.Pipelines.StreamPipeReaderOptions" /> instance, optionally specifying a memory pool, a minimum buffer size, a minimum read size, and whether the underlying stream should be left open after the <see cref="System.IO.Pipelines.PipeReader" /> completes.</summary>
/// <param name="pool">The memory pool to use when allocating memory. The default value is <see langword="null" />.</param>
/// <param name="bufferSize">The minimum buffer size to use when renting memory from the <paramref name="pool" />. The default value is 4096.</param>
/// <param name="minimumReadSize">The threshold of remaining bytes in the buffer before a new buffer is allocated. The default value is 1024.</param>
/// <param name="leaveOpen"><see langword="true" /> to leave the underlying stream open after the <see cref="System.IO.Pipelines.PipeReader" /> completes; <see langword="false" /> to close it. The default is <see langword="false" />.</param>
public StreamPipeReaderOptions(MemoryPool<byte>? pool, int bufferSize, int minimumReadSize, bool leaveOpen) :
this(pool, bufferSize, minimumReadSize, leaveOpen, useZeroByteReads: false)
{
}
/// <summary>Initializes a <see cref="System.IO.Pipelines.StreamPipeReaderOptions" /> instance, optionally specifying a memory pool, a minimum buffer size, a minimum read size, and whether the underlying stream should be left open after the <see cref="System.IO.Pipelines.PipeReader" /> completes.</summary>
/// <param name="pool">The memory pool to use when allocating memory. The default value is <see langword="null" />.</param>
/// <param name="bufferSize">The minimum buffer size to use when renting memory from the <paramref name="pool" />. The default value is 4096.</param>
/// <param name="minimumReadSize">The threshold of remaining bytes in the buffer before a new buffer is allocated. The default value is 1024.</param>
/// <param name="leaveOpen"><see langword="true" /> to leave the underlying stream open after the <see cref="System.IO.Pipelines.PipeReader" /> completes; <see langword="false" /> to close it. The default is <see langword="false" />.</param>
/// <param name="useZeroByteReads"><see langword="true" /> if reads with an empty buffer should be issued to the underlying stream before allocating memory; otherwise, <see langword="false" />.</param>
public StreamPipeReaderOptions(MemoryPool<byte>? pool = null, int bufferSize = -1, int minimumReadSize = -1, bool leaveOpen = false, bool useZeroByteReads = false)
{
Pool = pool ?? MemoryPool<byte>.Shared;
IsDefaultSharedMemoryPool = Pool == MemoryPool<byte>.Shared;
BufferSize =
bufferSize == -1 ? DefaultBufferSize :
bufferSize <= 0 ? throw new ArgumentOutOfRangeException(nameof(bufferSize)) :
bufferSize;
MinimumReadSize =
minimumReadSize == -1 ? DefaultMinimumReadSize :
minimumReadSize <= 0 ? throw new ArgumentOutOfRangeException(nameof(minimumReadSize)) :
minimumReadSize;
LeaveOpen = leaveOpen;
UseZeroByteReads = useZeroByteReads;
}
/// <summary>Gets the minimum buffer size to use when renting memory from the <see cref="System.IO.Pipelines.StreamPipeReaderOptions.Pool" />.</summary>
/// <value>The buffer size.</value>
public int BufferSize { get; }
/// <summary>Gets the maximum buffer size to use when renting memory from the <see cref="System.IO.Pipelines.StreamPipeReaderOptions.Pool" />.</summary>
/// <value>The maximum buffer size.</value>
internal int MaxBufferSize { get; } = DefaultMaxBufferSize;
/// <summary>Gets the threshold of remaining bytes in the buffer before a new buffer is allocated.</summary>
/// <value>The minimum read size.</value>
public int MinimumReadSize { get; }
/// <summary>Gets the <see cref="System.Buffers.MemoryPool{T}" /> to use when allocating memory.</summary>
/// <value>A memory pool instance.</value>
public MemoryPool<byte> Pool { get; }
/// <summary>Gets the value that indicates if the underlying stream should be left open after the <see cref="System.IO.Pipelines.PipeReader" /> completes.</summary>
/// <value><see langword="true" /> if the underlying stream should be left open after the <see cref="System.IO.Pipelines.PipeReader" /> completes; otherwise, <see langword="false" />.</value>
public bool LeaveOpen { get; }
/// <summary>Gets the value that indicates if reads with an empty buffer should be issued to the underlying stream, in order to wait for data to arrive before allocating memory.</summary>
/// <value><see langword="true" /> if reads with an empty buffer should be issued to the underlying stream before allocating memory; otherwise, <see langword="false" />.</value>
public bool UseZeroByteReads { get; }
/// <summary>
/// Returns true if Pool is <see cref="MemoryPool{Byte}"/>.Shared
/// </summary>
internal bool IsDefaultSharedMemoryPool { get; }
}
}
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/libraries/System.Linq/tests/FirstTests.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using Xunit;
namespace System.Linq.Tests
{
public class FirstTests : EnumerableTests
{
[Fact]
public void SameResultsRepeatCallsIntQuery()
{
var q = from x in new[] { 9999, 0, 888, -1, 66, -777, 1, 2, -12345 }
where x > int.MinValue
select x;
Assert.Equal(q.First(), q.First());
}
[Fact]
public void SameResultsRepeatCallsStringQuery()
{
var q = from x in new[] { "!@#$%^", "C", "AAA", "", "Calling Twice", "SoS", string.Empty }
where !string.IsNullOrEmpty(x)
select x;
Assert.Equal(q.First(), q.First());
}
private static void TestEmptyIList<T>()
{
T[] source = { };
Assert.NotNull(source as IList<T>);
Assert.Throws<InvalidOperationException>(() => source.RunOnce().First());
}
[Fact]
public void EmptyIListT()
{
TestEmptyIList<int>();
TestEmptyIList<string>();
TestEmptyIList<DateTime>();
TestEmptyIList<FirstTests>();
}
[Fact]
public void IListTOneElement()
{
int[] source = { 5 };
int expected = 5;
Assert.NotNull(source as IList<int>);
Assert.Equal(expected, source.First());
}
[Fact]
public void IListTManyElementsFirstIsDefault()
{
int?[] source = { null, -10, 2, 4, 3, 0, 2 };
int? expected = null;
Assert.IsAssignableFrom<IList<int?>>(source);
Assert.Equal(expected, source.First());
}
[Fact]
public void IListTManyElementsFirstIsNotDefault()
{
int?[] source = { 19, null, -10, 2, 4, 3, 0, 2 };
int? expected = 19;
Assert.IsAssignableFrom<IList<int?>>(source);
Assert.Equal(expected, source.First());
}
private static void TestEmptyNotIList<T>()
{
static IEnumerable<T1> EmptySource<T1>()
{
yield break;
}
var source = EmptySource<T>();
Assert.Null(source as IList<T>);
Assert.Throws<InvalidOperationException>(() => source.RunOnce().First());
}
[Fact]
public void EmptyNotIListT()
{
TestEmptyNotIList<int>();
TestEmptyNotIList<string>();
TestEmptyNotIList<DateTime>();
TestEmptyNotIList<FirstTests>();
}
[Fact]
public void OneElementNotIListT()
{
IEnumerable<int> source = NumberRangeGuaranteedNotCollectionType(-5, 1);
int expected = -5;
Assert.Null(source as IList<int>);
Assert.Equal(expected, source.First());
}
[Fact]
public void ManyElementsNotIListT()
{
IEnumerable<int> source = NumberRangeGuaranteedNotCollectionType(3, 10);
int expected = 3;
Assert.Null(source as IList<int>);
Assert.Equal(expected, source.First());
}
[Fact]
public void EmptySource()
{
int[] source = { };
Assert.Throws<InvalidOperationException>(() => source.First(x => true));
Assert.Throws<InvalidOperationException>(() => source.First(x => false));
}
[Fact]
public void OneElementTruePredicate()
{
int[] source = { 4 };
Func<int, bool> predicate = IsEven;
int expected = 4;
Assert.Equal(expected, source.First(predicate));
}
[Fact]
public void ManyElementsPredicateFalseForAll()
{
int[] source = { 9, 5, 1, 3, 17, 21 };
Func<int, bool> predicate = IsEven;
Assert.Throws<InvalidOperationException>(() => source.First(predicate));
}
[Fact]
public void PredicateTrueOnlyForLast()
{
int[] source = { 9, 5, 1, 3, 17, 21, 50 };
Func<int, bool> predicate = IsEven;
int expected = 50;
Assert.Equal(expected, source.First(predicate));
}
[Fact]
public void PredicateTrueForSome()
{
int[] source = { 3, 7, 10, 7, 9, 2, 11, 17, 13, 8 };
Func<int, bool> predicate = IsEven;
int expected = 10;
Assert.Equal(expected, source.First(predicate));
}
[Fact]
public void PredicateTrueForSomeRunOnce()
{
int[] source = { 3, 7, 10, 7, 9, 2, 11, 17, 13, 8 };
Func<int, bool> predicate = IsEven;
int expected = 10;
Assert.Equal(expected, source.RunOnce().First(predicate));
}
[Fact]
public void NullSource()
{
AssertExtensions.Throws<ArgumentNullException>("source", () => ((IEnumerable<int>)null).First());
}
[Fact]
public void NullSourcePredicateUsed()
{
AssertExtensions.Throws<ArgumentNullException>("source", () => ((IEnumerable<int>)null).First(i => i != 2));
}
[Fact]
public void NullPredicate()
{
Func<int, bool> predicate = null;
AssertExtensions.Throws<ArgumentNullException>("predicate", () => Enumerable.Range(0, 3).First(predicate));
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using Xunit;
namespace System.Linq.Tests
{
public class FirstTests : EnumerableTests
{
[Fact]
public void SameResultsRepeatCallsIntQuery()
{
var q = from x in new[] { 9999, 0, 888, -1, 66, -777, 1, 2, -12345 }
where x > int.MinValue
select x;
Assert.Equal(q.First(), q.First());
}
[Fact]
public void SameResultsRepeatCallsStringQuery()
{
var q = from x in new[] { "!@#$%^", "C", "AAA", "", "Calling Twice", "SoS", string.Empty }
where !string.IsNullOrEmpty(x)
select x;
Assert.Equal(q.First(), q.First());
}
private static void TestEmptyIList<T>()
{
T[] source = { };
Assert.NotNull(source as IList<T>);
Assert.Throws<InvalidOperationException>(() => source.RunOnce().First());
}
[Fact]
public void EmptyIListT()
{
TestEmptyIList<int>();
TestEmptyIList<string>();
TestEmptyIList<DateTime>();
TestEmptyIList<FirstTests>();
}
[Fact]
public void IListTOneElement()
{
int[] source = { 5 };
int expected = 5;
Assert.NotNull(source as IList<int>);
Assert.Equal(expected, source.First());
}
[Fact]
public void IListTManyElementsFirstIsDefault()
{
int?[] source = { null, -10, 2, 4, 3, 0, 2 };
int? expected = null;
Assert.IsAssignableFrom<IList<int?>>(source);
Assert.Equal(expected, source.First());
}
[Fact]
public void IListTManyElementsFirstIsNotDefault()
{
int?[] source = { 19, null, -10, 2, 4, 3, 0, 2 };
int? expected = 19;
Assert.IsAssignableFrom<IList<int?>>(source);
Assert.Equal(expected, source.First());
}
private static void TestEmptyNotIList<T>()
{
static IEnumerable<T1> EmptySource<T1>()
{
yield break;
}
var source = EmptySource<T>();
Assert.Null(source as IList<T>);
Assert.Throws<InvalidOperationException>(() => source.RunOnce().First());
}
[Fact]
public void EmptyNotIListT()
{
TestEmptyNotIList<int>();
TestEmptyNotIList<string>();
TestEmptyNotIList<DateTime>();
TestEmptyNotIList<FirstTests>();
}
[Fact]
public void OneElementNotIListT()
{
IEnumerable<int> source = NumberRangeGuaranteedNotCollectionType(-5, 1);
int expected = -5;
Assert.Null(source as IList<int>);
Assert.Equal(expected, source.First());
}
[Fact]
public void ManyElementsNotIListT()
{
IEnumerable<int> source = NumberRangeGuaranteedNotCollectionType(3, 10);
int expected = 3;
Assert.Null(source as IList<int>);
Assert.Equal(expected, source.First());
}
[Fact]
public void EmptySource()
{
int[] source = { };
Assert.Throws<InvalidOperationException>(() => source.First(x => true));
Assert.Throws<InvalidOperationException>(() => source.First(x => false));
}
[Fact]
public void OneElementTruePredicate()
{
int[] source = { 4 };
Func<int, bool> predicate = IsEven;
int expected = 4;
Assert.Equal(expected, source.First(predicate));
}
[Fact]
public void ManyElementsPredicateFalseForAll()
{
int[] source = { 9, 5, 1, 3, 17, 21 };
Func<int, bool> predicate = IsEven;
Assert.Throws<InvalidOperationException>(() => source.First(predicate));
}
[Fact]
public void PredicateTrueOnlyForLast()
{
int[] source = { 9, 5, 1, 3, 17, 21, 50 };
Func<int, bool> predicate = IsEven;
int expected = 50;
Assert.Equal(expected, source.First(predicate));
}
[Fact]
public void PredicateTrueForSome()
{
int[] source = { 3, 7, 10, 7, 9, 2, 11, 17, 13, 8 };
Func<int, bool> predicate = IsEven;
int expected = 10;
Assert.Equal(expected, source.First(predicate));
}
[Fact]
public void PredicateTrueForSomeRunOnce()
{
int[] source = { 3, 7, 10, 7, 9, 2, 11, 17, 13, 8 };
Func<int, bool> predicate = IsEven;
int expected = 10;
Assert.Equal(expected, source.RunOnce().First(predicate));
}
[Fact]
public void NullSource()
{
AssertExtensions.Throws<ArgumentNullException>("source", () => ((IEnumerable<int>)null).First());
}
[Fact]
public void NullSourcePredicateUsed()
{
AssertExtensions.Throws<ArgumentNullException>("source", () => ((IEnumerable<int>)null).First(i => i != 2));
}
[Fact]
public void NullPredicate()
{
Func<int, bool> predicate = null;
AssertExtensions.Throws<ArgumentNullException>("predicate", () => Enumerable.Range(0, 3).First(predicate));
}
}
}
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/libraries/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/ComInterop/ComEventSinksContainer.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Microsoft.CSharp.RuntimeBinder.ComInterop
{
/// <summary>
/// ComEventSinksContainer is just a regular list with a finalizer.
/// This list is usually attached as a custom data for RCW object and
/// is finalized whenever RCW is finalized.
/// </summary>
internal sealed class ComEventSinksContainer : List<ComEventsSink>, IDisposable
{
private ComEventSinksContainer()
{
}
private static readonly object s_comObjectEventSinksKey = new object();
public static ComEventSinksContainer FromRuntimeCallableWrapper(object rcw, bool createIfNotFound)
{
object data = Marshal.GetComObjectData(rcw, s_comObjectEventSinksKey);
if (data != null || !createIfNotFound)
{
return (ComEventSinksContainer)data;
}
lock (s_comObjectEventSinksKey)
{
data = Marshal.GetComObjectData(rcw, s_comObjectEventSinksKey);
if (data != null)
{
return (ComEventSinksContainer)data;
}
ComEventSinksContainer comEventSinks = new ComEventSinksContainer();
if (!Marshal.SetComObjectData(rcw, s_comObjectEventSinksKey, comEventSinks))
{
throw Error.SetComObjectDataFailed();
}
return comEventSinks;
}
}
#region IDisposable Members
public void Dispose()
{
DisposeAll();
GC.SuppressFinalize(this);
}
#endregion
private void DisposeAll()
{
foreach (ComEventsSink sink in this)
{
ComEventsSink.RemoveAll(sink);
}
}
~ComEventSinksContainer()
{
DisposeAll();
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace Microsoft.CSharp.RuntimeBinder.ComInterop
{
/// <summary>
/// ComEventSinksContainer is just a regular list with a finalizer.
/// This list is usually attached as a custom data for RCW object and
/// is finalized whenever RCW is finalized.
/// </summary>
internal sealed class ComEventSinksContainer : List<ComEventsSink>, IDisposable
{
private ComEventSinksContainer()
{
}
private static readonly object s_comObjectEventSinksKey = new object();
public static ComEventSinksContainer FromRuntimeCallableWrapper(object rcw, bool createIfNotFound)
{
object data = Marshal.GetComObjectData(rcw, s_comObjectEventSinksKey);
if (data != null || !createIfNotFound)
{
return (ComEventSinksContainer)data;
}
lock (s_comObjectEventSinksKey)
{
data = Marshal.GetComObjectData(rcw, s_comObjectEventSinksKey);
if (data != null)
{
return (ComEventSinksContainer)data;
}
ComEventSinksContainer comEventSinks = new ComEventSinksContainer();
if (!Marshal.SetComObjectData(rcw, s_comObjectEventSinksKey, comEventSinks))
{
throw Error.SetComObjectDataFailed();
}
return comEventSinks;
}
}
#region IDisposable Members
public void Dispose()
{
DisposeAll();
GC.SuppressFinalize(this);
}
#endregion
private void DisposeAll()
{
foreach (ComEventsSink sink in this)
{
ComEventsSink.RemoveAll(sink);
}
}
~ComEventSinksContainer()
{
DisposeAll();
}
}
}
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/tests/Loader/classloader/TypeGeneratorTests/TypeGeneratorTest787/Generated787.il
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
.assembly extern mscorlib { .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) .ver 4:0:0:0 }
.assembly extern TestFramework { .publickeytoken = ( B0 3F 5F 7F 11 D5 0A 3A ) }
//TYPES IN FORWARDER ASSEMBLIES:
//TEST ASSEMBLY:
.assembly Generated787 { .hash algorithm 0x00008004 }
.assembly extern xunit.core {}
.class public BaseClass0
{
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed {
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.class public BaseClass1
extends BaseClass0
{
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed {
ldarg.0
call instance void BaseClass0::.ctor()
ret
}
}
.class public G3_C1259`1<T0>
extends class G2_C306`2<class BaseClass0,class BaseClass1>
implements class IBase2`2<class BaseClass1,class BaseClass0>
{
.method public hidebysig virtual instance string Method7<M0>() cil managed noinlining {
ldstr "G3_C1259::Method7.15162<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig newslot virtual instance string 'IBase2<class BaseClass1,class BaseClass0>.Method7'<M0>() cil managed noinlining {
.override method instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<[1]>()
ldstr "G3_C1259::Method7.MI.15163<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig newslot virtual instance string 'G2_C306<class BaseClass0,class BaseClass1>.ClassMethod1943'<M0>() cil managed noinlining {
.override method instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1943<[1]>()
ldstr "G3_C1259::ClassMethod1943.MI.15164<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig newslot virtual instance string 'G2_C306<class BaseClass0,class BaseClass1>.ClassMethod1944'<M0>() cil managed noinlining {
.override method instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1944<[1]>()
ldstr "G3_C1259::ClassMethod1944.MI.15165<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed {
ldarg.0
call instance void class G2_C306`2<class BaseClass0,class BaseClass1>::.ctor()
ret
}
}
.class public G2_C306`2<T0, T1>
extends class G1_C6`2<!T0,!T0>
implements class IBase1`1<!T1>, class IBase2`2<!T0,!T0>
{
.method public hidebysig virtual instance string Method4() cil managed noinlining {
ldstr "G2_C306::Method4.7602()"
ret
}
.method public hidebysig newslot virtual instance string 'IBase1<T1>.Method4'() cil managed noinlining {
.override method instance string class IBase1`1<!T1>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ret
}
.method public hidebysig newslot virtual instance string Method5() cil managed noinlining {
ldstr "G2_C306::Method5.7604()"
ret
}
.method public hidebysig newslot virtual instance string 'IBase1<T1>.Method5'() cil managed noinlining {
.override method instance string class IBase1`1<!T1>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ret
}
.method public hidebysig virtual instance string Method6<M0>() cil managed noinlining {
ldstr "G2_C306::Method6.7606<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig newslot virtual instance string 'IBase1<T1>.Method6'<M0>() cil managed noinlining {
.override method instance string class IBase1`1<!T1>::Method6<[1]>()
ldstr "G2_C306::Method6.MI.7607<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig virtual instance string Method7<M0>() cil managed noinlining {
ldstr "G2_C306::Method7.7608<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig newslot virtual instance string ClassMethod1943<M0>() cil managed noinlining {
ldstr "G2_C306::ClassMethod1943.7609<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig newslot virtual instance string ClassMethod1944<M0>() cil managed noinlining {
ldstr "G2_C306::ClassMethod1944.7610<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig newslot virtual instance string 'G1_C6<T0,T0>.ClassMethod1326'() cil managed noinlining {
.override method instance string class G1_C6`2<!T0,!T0>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ret
}
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed {
ldarg.0
call instance void class G1_C6`2<!T0,!T0>::.ctor()
ret
}
}
.class interface public abstract IBase2`2<+T0, -T1>
{
.method public hidebysig newslot abstract virtual instance string Method7<M0>() cil managed { }
}
.class public G1_C6`2<T0, T1>
implements class IBase2`2<class BaseClass1,!T0>
{
.method public hidebysig newslot virtual instance string Method7<M0>() cil managed noinlining {
ldstr "G1_C6::Method7.4808<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig newslot virtual instance string ClassMethod1326() cil managed noinlining {
ldstr "G1_C6::ClassMethod1326.4809()"
ret
}
.method public hidebysig newslot virtual instance string ClassMethod1327<M0>() cil managed noinlining {
ldstr "G1_C6::ClassMethod1327.4810<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed {
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.class interface public abstract IBase1`1<+T0>
{
.method public hidebysig newslot abstract virtual instance string Method4() cil managed { }
.method public hidebysig newslot abstract virtual instance string Method5() cil managed { }
.method public hidebysig newslot abstract virtual instance string Method6<M0>() cil managed { }
}
.class public auto ansi beforefieldinit Generated787 {
.method static void M.BaseClass0<(BaseClass0)W>(!!W inst, string exp) cil managed {
.maxstack 5
.locals init (string[] actualResults)
ldc.i4.s 0
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.BaseClass0<(BaseClass0)W>(!!W inst, string exp)"
ldc.i4.s 0
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.BaseClass1<(BaseClass1)W>(!!W inst, string exp) cil managed {
.maxstack 5
.locals init (string[] actualResults)
ldc.i4.s 0
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.BaseClass1<(BaseClass1)W>(!!W inst, string exp)"
ldc.i4.s 0
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G3_C1259.T<T0,(class G3_C1259`1<!!T0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G3_C1259.T<T0,(class G3_C1259`1<!!T0>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<!!T0>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<!!T0>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<!!T0>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<!!T0>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<!!T0>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<!!T0>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<!!T0>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<!!T0>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G3_C1259.A<(class G3_C1259`1<class BaseClass0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G3_C1259.A<(class G3_C1259`1<class BaseClass0>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass0>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass0>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass0>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass0>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass0>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass0>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass0>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass0>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G3_C1259.B<(class G3_C1259`1<class BaseClass1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G3_C1259.B<(class G3_C1259`1<class BaseClass1>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass1>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass1>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass1>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass1>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass1>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G2_C306.T.T<T0,T1,(class G2_C306`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G2_C306.T.T<T0,T1,(class G2_C306`2<!!T0,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<!!T0,!!T1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<!!T0,!!T1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<!!T0,!!T1>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<!!T0,!!T1>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<!!T0,!!T1>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<!!T0,!!T1>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<!!T0,!!T1>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<!!T0,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G2_C306.A.T<T1,(class G2_C306`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G2_C306.A.T<T1,(class G2_C306`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,!!T1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,!!T1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,!!T1>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,!!T1>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,!!T1>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,!!T1>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,!!T1>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G2_C306.A.A<(class G2_C306`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G2_C306.A.A<(class G2_C306`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G2_C306.A.B<(class G2_C306`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G2_C306.A.B<(class G2_C306`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G2_C306.B.T<T1,(class G2_C306`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G2_C306.B.T<T1,(class G2_C306`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,!!T1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,!!T1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,!!T1>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,!!T1>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,!!T1>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,!!T1>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,!!T1>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G2_C306.B.A<(class G2_C306`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G2_C306.B.A<(class G2_C306`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G2_C306.B.B<(class G2_C306`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G2_C306.B.B<(class G2_C306`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase2.T.T<T0,T1,(class IBase2`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 6
.locals init (string[] actualResults)
ldc.i4.s 1
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase2.T.T<T0,T1,(class IBase2`2<!!T0,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 1
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase2`2<!!T0,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase2.A.T<T1,(class IBase2`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 6
.locals init (string[] actualResults)
ldc.i4.s 1
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase2.A.T<T1,(class IBase2`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 1
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase2`2<class BaseClass0,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase2.A.A<(class IBase2`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 6
.locals init (string[] actualResults)
ldc.i4.s 1
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase2.A.A<(class IBase2`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)"
ldc.i4.s 1
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase2.A.B<(class IBase2`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 6
.locals init (string[] actualResults)
ldc.i4.s 1
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase2.A.B<(class IBase2`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)"
ldc.i4.s 1
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase2.B.T<T1,(class IBase2`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 6
.locals init (string[] actualResults)
ldc.i4.s 1
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase2.B.T<T1,(class IBase2`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 1
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase2`2<class BaseClass1,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase2.B.A<(class IBase2`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 6
.locals init (string[] actualResults)
ldc.i4.s 1
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase2.B.A<(class IBase2`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)"
ldc.i4.s 1
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase2.B.B<(class IBase2`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 6
.locals init (string[] actualResults)
ldc.i4.s 1
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase2.B.B<(class IBase2`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)"
ldc.i4.s 1
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G1_C6.T.T<T0,T1,(class G1_C6`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G1_C6.T.T<T0,T1,(class G1_C6`2<!!T0,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<!!T0,!!T1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<!!T0,!!T1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<!!T0,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G1_C6.A.T<T1,(class G1_C6`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G1_C6.A.T<T1,(class G1_C6`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,!!T1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,!!T1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G1_C6.A.A<(class G1_C6`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G1_C6.A.A<(class G1_C6`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G1_C6.A.B<(class G1_C6`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G1_C6.A.B<(class G1_C6`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G1_C6.B.T<T1,(class G1_C6`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G1_C6.B.T<T1,(class G1_C6`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,!!T1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,!!T1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G1_C6.B.A<(class G1_C6`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G1_C6.B.A<(class G1_C6`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass0>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass0>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass0>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G1_C6.B.B<(class G1_C6`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G1_C6.B.B<(class G1_C6`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase1.T<T0,(class IBase1`1<!!T0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase1.T<T0,(class IBase1`1<!!T0>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<!!T0>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<!!T0>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<!!T0>::Method6<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase1.A<(class IBase1`1<class BaseClass0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase1.A<(class IBase1`1<class BaseClass0>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<class BaseClass0>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<class BaseClass0>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase1.B<(class IBase1`1<class BaseClass1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase1.B<(class IBase1`1<class BaseClass1>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<class BaseClass1>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<class BaseClass1>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<class BaseClass1>::Method6<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method public hidebysig static void MethodCallingTest() cil managed
{
.maxstack 10
.locals init (object V_0)
ldstr "========================== Method Calling Test =========================="
call void [mscorlib]System.Console::WriteLine(string)
newobj instance void class G3_C1259`1<class BaseClass0>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1944<object>()
ldstr "G3_C1259::ClassMethod1944.MI.15165<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1943<object>()
ldstr "G3_C1259::ClassMethod1943.MI.15164<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method5()
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method4()
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
castclass class G3_C1259`1<class BaseClass0>
callvirt instance string class G3_C1259`1<class BaseClass0>::Method7<object>()
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass0>
callvirt instance string class G3_C1259`1<class BaseClass0>::ClassMethod1944<object>()
ldstr "G3_C1259::ClassMethod1944.MI.15165<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass0>
callvirt instance string class G3_C1259`1<class BaseClass0>::ClassMethod1943<object>()
ldstr "G3_C1259::ClassMethod1943.MI.15164<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass0>
callvirt instance string class G3_C1259`1<class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass0>
callvirt instance string class G3_C1259`1<class BaseClass0>::Method5()
ldstr "G2_C306::Method5.7604()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass0>
callvirt instance string class G3_C1259`1<class BaseClass0>::Method4()
ldstr "G2_C306::Method4.7602()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass0>
callvirt instance string class G3_C1259`1<class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass0>
callvirt instance string class G3_C1259`1<class BaseClass0>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G3_C1259`1<class BaseClass1>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1944<object>()
ldstr "G3_C1259::ClassMethod1944.MI.15165<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1943<object>()
ldstr "G3_C1259::ClassMethod1943.MI.15164<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method5()
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method4()
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
castclass class G3_C1259`1<class BaseClass1>
callvirt instance string class G3_C1259`1<class BaseClass1>::Method7<object>()
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass1>
callvirt instance string class G3_C1259`1<class BaseClass1>::ClassMethod1944<object>()
ldstr "G3_C1259::ClassMethod1944.MI.15165<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass1>
callvirt instance string class G3_C1259`1<class BaseClass1>::ClassMethod1943<object>()
ldstr "G3_C1259::ClassMethod1943.MI.15164<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass1>
callvirt instance string class G3_C1259`1<class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass1>
callvirt instance string class G3_C1259`1<class BaseClass1>::Method5()
ldstr "G2_C306::Method5.7604()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass1>
callvirt instance string class G3_C1259`1<class BaseClass1>::Method4()
ldstr "G2_C306::Method4.7602()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass1>
callvirt instance string class G3_C1259`1<class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass1>
callvirt instance string class G3_C1259`1<class BaseClass1>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G2_C306`2<class BaseClass0,class BaseClass0>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1944<object>()
ldstr "G2_C306::ClassMethod1944.7610<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1943<object>()
ldstr "G2_C306::ClassMethod1943.7609<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method5()
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method4()
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G2_C306`2<class BaseClass0,class BaseClass1>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1944<object>()
ldstr "G2_C306::ClassMethod1944.7610<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1943<object>()
ldstr "G2_C306::ClassMethod1943.7609<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method5()
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method4()
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G2_C306`2<class BaseClass1,class BaseClass0>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1944<object>()
ldstr "G2_C306::ClassMethod1944.7610<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1943<object>()
ldstr "G2_C306::ClassMethod1943.7609<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method5()
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method4()
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G2_C306`2<class BaseClass1,class BaseClass1>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1944<object>()
ldstr "G2_C306::ClassMethod1944.7610<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1943<object>()
ldstr "G2_C306::ClassMethod1943.7609<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method5()
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method4()
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G1_C6`2<class BaseClass0,class BaseClass0>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
ldstr "G1_C6::ClassMethod1326.4809()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G1_C6`2<class BaseClass0,class BaseClass1>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
ldstr "G1_C6::ClassMethod1326.4809()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G1_C6`2<class BaseClass1,class BaseClass0>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass0>::ClassMethod1326()
ldstr "G1_C6::ClassMethod1326.4809()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass0>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G1_C6`2<class BaseClass1,class BaseClass1>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
ldstr "G1_C6::ClassMethod1326.4809()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldstr "========================================================================\n\n"
call void [mscorlib]System.Console::WriteLine(string)
ret
}
.method public hidebysig static void ConstrainedCallsTest() cil managed
{
.maxstack 10
.locals init (object V_0)
ldstr "========================== Constrained Calls Test =========================="
call void [mscorlib]System.Console::WriteLine(string)
newobj instance void class G3_C1259`1<class BaseClass0>::.ctor()
stloc.0
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass0,class BaseClass0,class G3_C1259`1<class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G1_C6.A.T<class BaseClass0,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G1_C6.A.A<class G3_C1259`1<class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G3_C1259`1<class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass0,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.B.A<class G3_C1259`1<class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G3_C1259`1<class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass0,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.A.A<class G3_C1259`1<class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G3_C1259`1<class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G3_C1259`1<class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G3_C1259`1<class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G3_C1259`1<class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G2_C306.T.T<class BaseClass0,class BaseClass1,class G3_C1259`1<class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G2_C306.A.T<class BaseClass1,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G2_C306.A.B<class G3_C1259`1<class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass1,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.B<class G3_C1259`1<class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass0,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.A<class G3_C1259`1<class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G3_C1259.T<class BaseClass0,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G3_C1259.A<class G3_C1259`1<class BaseClass0>>(!!0,string)
newobj instance void class G3_C1259`1<class BaseClass1>::.ctor()
stloc.0
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass0,class BaseClass0,class G3_C1259`1<class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G1_C6.A.T<class BaseClass0,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G1_C6.A.A<class G3_C1259`1<class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G3_C1259`1<class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass0,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.B.A<class G3_C1259`1<class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G3_C1259`1<class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass0,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.A.A<class G3_C1259`1<class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G3_C1259`1<class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G3_C1259`1<class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G3_C1259`1<class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G3_C1259`1<class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G2_C306.T.T<class BaseClass0,class BaseClass1,class G3_C1259`1<class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G2_C306.A.T<class BaseClass1,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G2_C306.A.B<class G3_C1259`1<class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass1,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.B<class G3_C1259`1<class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass0,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.A<class G3_C1259`1<class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G3_C1259.T<class BaseClass1,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G3_C1259.B<class G3_C1259`1<class BaseClass1>>(!!0,string)
newobj instance void class G2_C306`2<class BaseClass0,class BaseClass0>::.ctor()
stloc.0
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass0,class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.A.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.A.A<class G2_C306`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.A<class G2_C306`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.A<class G2_C306`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G2_C306`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G2_C306`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.T.T<class BaseClass0,class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.A.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.A.A<class G2_C306`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.A<class G2_C306`2<class BaseClass0,class BaseClass0>>(!!0,string)
newobj instance void class G2_C306`2<class BaseClass0,class BaseClass1>::.ctor()
stloc.0
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass0,class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.A.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.A.A<class G2_C306`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.A<class G2_C306`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.A<class G2_C306`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G2_C306`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G2_C306`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.T.T<class BaseClass0,class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.A.T<class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.A.B<class G2_C306`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.B<class G2_C306`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.A<class G2_C306`2<class BaseClass0,class BaseClass1>>(!!0,string)
newobj instance void class G2_C306`2<class BaseClass1,class BaseClass0>::.ctor()
stloc.0
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass1,class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.B.T<class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.B.B<class G2_C306`2<class BaseClass1,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G2_C306`2<class BaseClass1,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G2_C306`2<class BaseClass1,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.T.T<class BaseClass1,class BaseClass0,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.B.T<class BaseClass0,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.B.A<class G2_C306`2<class BaseClass1,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass0,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.A<class G2_C306`2<class BaseClass1,class BaseClass0>>(!!0,string)
newobj instance void class G2_C306`2<class BaseClass1,class BaseClass1>::.ctor()
stloc.0
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass1,class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.B.T<class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.B.B<class G2_C306`2<class BaseClass1,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G2_C306`2<class BaseClass1,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G2_C306`2<class BaseClass1,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.T.T<class BaseClass1,class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.B.T<class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.B.B<class G2_C306`2<class BaseClass1,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.B<class G2_C306`2<class BaseClass1,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass0,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.A<class G2_C306`2<class BaseClass1,class BaseClass1>>(!!0,string)
newobj instance void class G1_C6`2<class BaseClass0,class BaseClass0>::.ctor()
stloc.0
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass0,class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.A.T<class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.A.A<class G1_C6`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.A<class G1_C6`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.A<class G1_C6`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G1_C6`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G1_C6`2<class BaseClass0,class BaseClass0>>(!!0,string)
newobj instance void class G1_C6`2<class BaseClass0,class BaseClass1>::.ctor()
stloc.0
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass0,class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.A.T<class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.A.B<class G1_C6`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.A<class G1_C6`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.A<class G1_C6`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G1_C6`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G1_C6`2<class BaseClass0,class BaseClass1>>(!!0,string)
newobj instance void class G1_C6`2<class BaseClass1,class BaseClass0>::.ctor()
stloc.0
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass1,class BaseClass0,class G1_C6`2<class BaseClass1,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.B.T<class BaseClass0,class G1_C6`2<class BaseClass1,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.B.A<class G1_C6`2<class BaseClass1,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G1_C6`2<class BaseClass1,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G1_C6`2<class BaseClass1,class BaseClass0>>(!!0,string)
newobj instance void class G1_C6`2<class BaseClass1,class BaseClass1>::.ctor()
stloc.0
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass1,class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.B.T<class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.B.B<class G1_C6`2<class BaseClass1,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G1_C6`2<class BaseClass1,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G1_C6`2<class BaseClass1,class BaseClass1>>(!!0,string)
ldstr "========================================================================\n\n"
call void [mscorlib]System.Console::WriteLine(string)
ret
}
.method public hidebysig static void StructConstrainedInterfaceCallsTest() cil managed
{
.maxstack 10
ldstr "===================== Struct Constrained Interface Calls Test ====================="
call void [mscorlib]System.Console::WriteLine(string)
ldstr "========================================================================\n\n"
call void [mscorlib]System.Console::WriteLine(string)
ret
}
.method public hidebysig static void CalliTest() cil managed
{
.maxstack 10
.locals init (object V_0)
ldstr "========================== Method Calli Test =========================="
call void [mscorlib]System.Console::WriteLine(string)
newobj instance void class G3_C1259`1<class BaseClass0>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1944<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::ClassMethod1944.MI.15165<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1943<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::ClassMethod1943.MI.15164<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method6<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method5()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method4()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method4()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method5()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method6<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method4()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method5()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method6<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass0>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass0>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass0>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass0>::ClassMethod1944<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::ClassMethod1944.MI.15165<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass0>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass0>::ClassMethod1943<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::ClassMethod1943.MI.15164<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass0>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass0>::Method6<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass0>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass0>::Method5()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method5.7604()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass0>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass0>::Method4()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method4.7602()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass0>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass0>::ClassMethod1327<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass0>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass0>::ClassMethod1326()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G3_C1259`1<class BaseClass1>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1944<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::ClassMethod1944.MI.15165<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1943<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::ClassMethod1943.MI.15164<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method6<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method5()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method4()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method4()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method5()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method6<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method4()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method5()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method6<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass1>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass1>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass1>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass1>::ClassMethod1944<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::ClassMethod1944.MI.15165<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass1>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass1>::ClassMethod1943<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::ClassMethod1943.MI.15164<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass1>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass1>::Method6<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass1>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass1>::Method5()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method5.7604()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass1>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass1>::Method4()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method4.7602()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass1>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass1>::ClassMethod1327<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass1>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass1>::ClassMethod1326()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G2_C306`2<class BaseClass0,class BaseClass0>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1944<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::ClassMethod1944.7610<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1943<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::ClassMethod1943.7609<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method5()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method4()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method4()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method5()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G2_C306`2<class BaseClass0,class BaseClass1>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1944<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::ClassMethod1944.7610<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1943<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::ClassMethod1943.7609<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method5()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method4()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method4()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method5()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method4()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method5()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G2_C306`2<class BaseClass1,class BaseClass0>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1944<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::ClassMethod1944.7610<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1943<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::ClassMethod1943.7609<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method5()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method4()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1327<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1326()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method4()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method5()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G2_C306`2<class BaseClass1,class BaseClass1>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1944<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::ClassMethod1944.7610<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1943<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::ClassMethod1943.7609<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method5()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method4()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method4()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method5()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method4()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method5()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G1_C6`2<class BaseClass0,class BaseClass0>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::ClassMethod1326.4809()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G1_C6`2<class BaseClass0,class BaseClass1>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::ClassMethod1326.4809()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G1_C6`2<class BaseClass1,class BaseClass0>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass0>::ClassMethod1327<object>()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass0>::ClassMethod1326()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass0>)
ldstr "G1_C6::ClassMethod1326.4809()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass0>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass0>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass0>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass0>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G1_C6`2<class BaseClass1,class BaseClass1>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass1>)
ldstr "G1_C6::ClassMethod1326.4809()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass1>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass1>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass1>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldstr "========================================================================\n\n"
call void [mscorlib]System.Console::WriteLine(string)
ret
}
.method public hidebysig static int32 Main() cil managed
{
.custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = (
01 00 00 00
)
.entrypoint
.maxstack 10
call void Generated787::MethodCallingTest()
call void Generated787::ConstrainedCallsTest()
call void Generated787::StructConstrainedInterfaceCallsTest()
call void Generated787::CalliTest()
ldc.i4 100
ret
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
.assembly extern mscorlib { .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) .ver 4:0:0:0 }
.assembly extern TestFramework { .publickeytoken = ( B0 3F 5F 7F 11 D5 0A 3A ) }
//TYPES IN FORWARDER ASSEMBLIES:
//TEST ASSEMBLY:
.assembly Generated787 { .hash algorithm 0x00008004 }
.assembly extern xunit.core {}
.class public BaseClass0
{
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed {
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.class public BaseClass1
extends BaseClass0
{
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed {
ldarg.0
call instance void BaseClass0::.ctor()
ret
}
}
.class public G3_C1259`1<T0>
extends class G2_C306`2<class BaseClass0,class BaseClass1>
implements class IBase2`2<class BaseClass1,class BaseClass0>
{
.method public hidebysig virtual instance string Method7<M0>() cil managed noinlining {
ldstr "G3_C1259::Method7.15162<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig newslot virtual instance string 'IBase2<class BaseClass1,class BaseClass0>.Method7'<M0>() cil managed noinlining {
.override method instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<[1]>()
ldstr "G3_C1259::Method7.MI.15163<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig newslot virtual instance string 'G2_C306<class BaseClass0,class BaseClass1>.ClassMethod1943'<M0>() cil managed noinlining {
.override method instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1943<[1]>()
ldstr "G3_C1259::ClassMethod1943.MI.15164<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig newslot virtual instance string 'G2_C306<class BaseClass0,class BaseClass1>.ClassMethod1944'<M0>() cil managed noinlining {
.override method instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1944<[1]>()
ldstr "G3_C1259::ClassMethod1944.MI.15165<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed {
ldarg.0
call instance void class G2_C306`2<class BaseClass0,class BaseClass1>::.ctor()
ret
}
}
.class public G2_C306`2<T0, T1>
extends class G1_C6`2<!T0,!T0>
implements class IBase1`1<!T1>, class IBase2`2<!T0,!T0>
{
.method public hidebysig virtual instance string Method4() cil managed noinlining {
ldstr "G2_C306::Method4.7602()"
ret
}
.method public hidebysig newslot virtual instance string 'IBase1<T1>.Method4'() cil managed noinlining {
.override method instance string class IBase1`1<!T1>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ret
}
.method public hidebysig newslot virtual instance string Method5() cil managed noinlining {
ldstr "G2_C306::Method5.7604()"
ret
}
.method public hidebysig newslot virtual instance string 'IBase1<T1>.Method5'() cil managed noinlining {
.override method instance string class IBase1`1<!T1>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ret
}
.method public hidebysig virtual instance string Method6<M0>() cil managed noinlining {
ldstr "G2_C306::Method6.7606<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig newslot virtual instance string 'IBase1<T1>.Method6'<M0>() cil managed noinlining {
.override method instance string class IBase1`1<!T1>::Method6<[1]>()
ldstr "G2_C306::Method6.MI.7607<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig virtual instance string Method7<M0>() cil managed noinlining {
ldstr "G2_C306::Method7.7608<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig newslot virtual instance string ClassMethod1943<M0>() cil managed noinlining {
ldstr "G2_C306::ClassMethod1943.7609<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig newslot virtual instance string ClassMethod1944<M0>() cil managed noinlining {
ldstr "G2_C306::ClassMethod1944.7610<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig newslot virtual instance string 'G1_C6<T0,T0>.ClassMethod1326'() cil managed noinlining {
.override method instance string class G1_C6`2<!T0,!T0>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ret
}
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed {
ldarg.0
call instance void class G1_C6`2<!T0,!T0>::.ctor()
ret
}
}
.class interface public abstract IBase2`2<+T0, -T1>
{
.method public hidebysig newslot abstract virtual instance string Method7<M0>() cil managed { }
}
.class public G1_C6`2<T0, T1>
implements class IBase2`2<class BaseClass1,!T0>
{
.method public hidebysig newslot virtual instance string Method7<M0>() cil managed noinlining {
ldstr "G1_C6::Method7.4808<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig newslot virtual instance string ClassMethod1326() cil managed noinlining {
ldstr "G1_C6::ClassMethod1326.4809()"
ret
}
.method public hidebysig newslot virtual instance string ClassMethod1327<M0>() cil managed noinlining {
ldstr "G1_C6::ClassMethod1327.4810<"
ldtoken !!M0
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
call string [mscorlib]System.String::Concat(object,object)
ldstr ">()"
call string [mscorlib]System.String::Concat(object,object)
ret
}
.method public hidebysig specialname rtspecialname instance void .ctor() cil managed {
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.class interface public abstract IBase1`1<+T0>
{
.method public hidebysig newslot abstract virtual instance string Method4() cil managed { }
.method public hidebysig newslot abstract virtual instance string Method5() cil managed { }
.method public hidebysig newslot abstract virtual instance string Method6<M0>() cil managed { }
}
.class public auto ansi beforefieldinit Generated787 {
.method static void M.BaseClass0<(BaseClass0)W>(!!W inst, string exp) cil managed {
.maxstack 5
.locals init (string[] actualResults)
ldc.i4.s 0
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.BaseClass0<(BaseClass0)W>(!!W inst, string exp)"
ldc.i4.s 0
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.BaseClass1<(BaseClass1)W>(!!W inst, string exp) cil managed {
.maxstack 5
.locals init (string[] actualResults)
ldc.i4.s 0
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.BaseClass1<(BaseClass1)W>(!!W inst, string exp)"
ldc.i4.s 0
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G3_C1259.T<T0,(class G3_C1259`1<!!T0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G3_C1259.T<T0,(class G3_C1259`1<!!T0>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<!!T0>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<!!T0>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<!!T0>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<!!T0>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<!!T0>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<!!T0>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<!!T0>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<!!T0>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G3_C1259.A<(class G3_C1259`1<class BaseClass0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G3_C1259.A<(class G3_C1259`1<class BaseClass0>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass0>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass0>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass0>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass0>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass0>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass0>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass0>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass0>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G3_C1259.B<(class G3_C1259`1<class BaseClass1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G3_C1259.B<(class G3_C1259`1<class BaseClass1>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass1>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass1>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass1>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass1>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass1>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G3_C1259`1<class BaseClass1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G2_C306.T.T<T0,T1,(class G2_C306`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G2_C306.T.T<T0,T1,(class G2_C306`2<!!T0,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<!!T0,!!T1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<!!T0,!!T1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<!!T0,!!T1>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<!!T0,!!T1>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<!!T0,!!T1>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<!!T0,!!T1>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<!!T0,!!T1>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<!!T0,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G2_C306.A.T<T1,(class G2_C306`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G2_C306.A.T<T1,(class G2_C306`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,!!T1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,!!T1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,!!T1>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,!!T1>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,!!T1>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,!!T1>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,!!T1>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G2_C306.A.A<(class G2_C306`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G2_C306.A.A<(class G2_C306`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G2_C306.A.B<(class G2_C306`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G2_C306.A.B<(class G2_C306`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G2_C306.B.T<T1,(class G2_C306`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G2_C306.B.T<T1,(class G2_C306`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,!!T1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,!!T1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,!!T1>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,!!T1>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,!!T1>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,!!T1>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,!!T1>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G2_C306.B.A<(class G2_C306`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G2_C306.B.A<(class G2_C306`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G2_C306.B.B<(class G2_C306`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 13
.locals init (string[] actualResults)
ldc.i4.s 8
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G2_C306.B.B<(class G2_C306`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)"
ldc.i4.s 8
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1943<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 3
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1944<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 4
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 5
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 6
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method6<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 7
ldarga.s 0
constrained. !!W
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase2.T.T<T0,T1,(class IBase2`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 6
.locals init (string[] actualResults)
ldc.i4.s 1
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase2.T.T<T0,T1,(class IBase2`2<!!T0,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 1
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase2`2<!!T0,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase2.A.T<T1,(class IBase2`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 6
.locals init (string[] actualResults)
ldc.i4.s 1
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase2.A.T<T1,(class IBase2`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 1
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase2`2<class BaseClass0,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase2.A.A<(class IBase2`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 6
.locals init (string[] actualResults)
ldc.i4.s 1
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase2.A.A<(class IBase2`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)"
ldc.i4.s 1
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase2.A.B<(class IBase2`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 6
.locals init (string[] actualResults)
ldc.i4.s 1
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase2.A.B<(class IBase2`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)"
ldc.i4.s 1
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase2.B.T<T1,(class IBase2`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 6
.locals init (string[] actualResults)
ldc.i4.s 1
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase2.B.T<T1,(class IBase2`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 1
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase2`2<class BaseClass1,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase2.B.A<(class IBase2`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 6
.locals init (string[] actualResults)
ldc.i4.s 1
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase2.B.A<(class IBase2`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)"
ldc.i4.s 1
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase2.B.B<(class IBase2`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 6
.locals init (string[] actualResults)
ldc.i4.s 1
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase2.B.B<(class IBase2`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)"
ldc.i4.s 1
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G1_C6.T.T<T0,T1,(class G1_C6`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G1_C6.T.T<T0,T1,(class G1_C6`2<!!T0,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<!!T0,!!T1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<!!T0,!!T1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<!!T0,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G1_C6.A.T<T1,(class G1_C6`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G1_C6.A.T<T1,(class G1_C6`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,!!T1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,!!T1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G1_C6.A.A<(class G1_C6`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G1_C6.A.A<(class G1_C6`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G1_C6.A.B<(class G1_C6`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G1_C6.A.B<(class G1_C6`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G1_C6.B.T<T1,(class G1_C6`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G1_C6.B.T<T1,(class G1_C6`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,!!T1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,!!T1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,!!T1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G1_C6.B.A<(class G1_C6`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G1_C6.B.A<(class G1_C6`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass0>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass0>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass0>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.G1_C6.B.B<(class G1_C6`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.G1_C6.B.B<(class G1_C6`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::Method7<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase1.T<T0,(class IBase1`1<!!T0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase1.T<T0,(class IBase1`1<!!T0>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<!!T0>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<!!T0>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<!!T0>::Method6<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase1.A<(class IBase1`1<class BaseClass0>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase1.A<(class IBase1`1<class BaseClass0>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<class BaseClass0>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<class BaseClass0>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method static void M.IBase1.B<(class IBase1`1<class BaseClass1>)W>(!!W 'inst', string exp) cil managed {
.maxstack 8
.locals init (string[] actualResults)
ldc.i4.s 3
newarr string
stloc.s actualResults
ldarg.1
ldstr "M.IBase1.B<(class IBase1`1<class BaseClass1>)W>(!!W 'inst', string exp)"
ldc.i4.s 3
ldloc.s actualResults
ldc.i4.s 0
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<class BaseClass1>::Method4()
stelem.ref
ldloc.s actualResults
ldc.i4.s 1
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<class BaseClass1>::Method5()
stelem.ref
ldloc.s actualResults
ldc.i4.s 2
ldarga.s 0
constrained. !!W
callvirt instance string class IBase1`1<class BaseClass1>::Method6<object>()
stelem.ref
ldloc.s actualResults
call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[])
ret
}
.method public hidebysig static void MethodCallingTest() cil managed
{
.maxstack 10
.locals init (object V_0)
ldstr "========================== Method Calling Test =========================="
call void [mscorlib]System.Console::WriteLine(string)
newobj instance void class G3_C1259`1<class BaseClass0>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1944<object>()
ldstr "G3_C1259::ClassMethod1944.MI.15165<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1943<object>()
ldstr "G3_C1259::ClassMethod1943.MI.15164<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method5()
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method4()
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
castclass class G3_C1259`1<class BaseClass0>
callvirt instance string class G3_C1259`1<class BaseClass0>::Method7<object>()
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass0>
callvirt instance string class G3_C1259`1<class BaseClass0>::ClassMethod1944<object>()
ldstr "G3_C1259::ClassMethod1944.MI.15165<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass0>
callvirt instance string class G3_C1259`1<class BaseClass0>::ClassMethod1943<object>()
ldstr "G3_C1259::ClassMethod1943.MI.15164<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass0>
callvirt instance string class G3_C1259`1<class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass0>
callvirt instance string class G3_C1259`1<class BaseClass0>::Method5()
ldstr "G2_C306::Method5.7604()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass0>
callvirt instance string class G3_C1259`1<class BaseClass0>::Method4()
ldstr "G2_C306::Method4.7602()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass0>
callvirt instance string class G3_C1259`1<class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass0>
callvirt instance string class G3_C1259`1<class BaseClass0>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G3_C1259`1<class BaseClass1>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1944<object>()
ldstr "G3_C1259::ClassMethod1944.MI.15165<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1943<object>()
ldstr "G3_C1259::ClassMethod1943.MI.15164<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method5()
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method4()
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
castclass class G3_C1259`1<class BaseClass1>
callvirt instance string class G3_C1259`1<class BaseClass1>::Method7<object>()
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass1>
callvirt instance string class G3_C1259`1<class BaseClass1>::ClassMethod1944<object>()
ldstr "G3_C1259::ClassMethod1944.MI.15165<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass1>
callvirt instance string class G3_C1259`1<class BaseClass1>::ClassMethod1943<object>()
ldstr "G3_C1259::ClassMethod1943.MI.15164<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass1>
callvirt instance string class G3_C1259`1<class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass1>
callvirt instance string class G3_C1259`1<class BaseClass1>::Method5()
ldstr "G2_C306::Method5.7604()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass1>
callvirt instance string class G3_C1259`1<class BaseClass1>::Method4()
ldstr "G2_C306::Method4.7602()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass1>
callvirt instance string class G3_C1259`1<class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G3_C1259`1<class BaseClass1>
callvirt instance string class G3_C1259`1<class BaseClass1>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G2_C306`2<class BaseClass0,class BaseClass0>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1944<object>()
ldstr "G2_C306::ClassMethod1944.7610<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1943<object>()
ldstr "G2_C306::ClassMethod1943.7609<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method5()
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method4()
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G2_C306`2<class BaseClass0,class BaseClass1>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1944<object>()
ldstr "G2_C306::ClassMethod1944.7610<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1943<object>()
ldstr "G2_C306::ClassMethod1943.7609<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method5()
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method4()
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G2_C306`2<class BaseClass1,class BaseClass0>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1944<object>()
ldstr "G2_C306::ClassMethod1944.7610<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1943<object>()
ldstr "G2_C306::ClassMethod1943.7609<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method5()
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method4()
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G2_C306`2<class BaseClass1,class BaseClass1>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1944<object>()
ldstr "G2_C306::ClassMethod1944.7610<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1943<object>()
ldstr "G2_C306::ClassMethod1943.7609<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method5()
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method4()
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
callvirt instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass1>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method4()
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method5()
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>()
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G1_C6`2<class BaseClass0,class BaseClass0>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
ldstr "G1_C6::ClassMethod1326.4809()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G1_C6`2<class BaseClass0,class BaseClass1>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
ldstr "G1_C6::ClassMethod1326.4809()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass0,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G1_C6`2<class BaseClass1,class BaseClass0>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass0>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass0>::ClassMethod1326()
ldstr "G1_C6::ClassMethod1326.4809()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass0>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass0>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
newobj instance void class G1_C6`2<class BaseClass1,class BaseClass1>::.ctor()
stloc.0
ldloc.0
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
ldstr "G1_C6::ClassMethod1326.4809()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
dup
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
callvirt instance string class G1_C6`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldloc.0
dup
callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
pop
ldstr "========================================================================\n\n"
call void [mscorlib]System.Console::WriteLine(string)
ret
}
.method public hidebysig static void ConstrainedCallsTest() cil managed
{
.maxstack 10
.locals init (object V_0)
ldstr "========================== Constrained Calls Test =========================="
call void [mscorlib]System.Console::WriteLine(string)
newobj instance void class G3_C1259`1<class BaseClass0>::.ctor()
stloc.0
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass0,class BaseClass0,class G3_C1259`1<class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G1_C6.A.T<class BaseClass0,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G1_C6.A.A<class G3_C1259`1<class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G3_C1259`1<class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass0,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.B.A<class G3_C1259`1<class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G3_C1259`1<class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass0,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.A.A<class G3_C1259`1<class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G3_C1259`1<class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G3_C1259`1<class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G3_C1259`1<class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G3_C1259`1<class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G2_C306.T.T<class BaseClass0,class BaseClass1,class G3_C1259`1<class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G2_C306.A.T<class BaseClass1,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G2_C306.A.B<class G3_C1259`1<class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass1,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.B<class G3_C1259`1<class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass0,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.A<class G3_C1259`1<class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G3_C1259.T<class BaseClass0,class G3_C1259`1<class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G3_C1259.A<class G3_C1259`1<class BaseClass0>>(!!0,string)
newobj instance void class G3_C1259`1<class BaseClass1>::.ctor()
stloc.0
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass0,class BaseClass0,class G3_C1259`1<class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G1_C6.A.T<class BaseClass0,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G1_C6.A.A<class G3_C1259`1<class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G3_C1259`1<class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass0,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.B.A<class G3_C1259`1<class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G3_C1259`1<class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass0,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.A.A<class G3_C1259`1<class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G3_C1259`1<class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G3_C1259`1<class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G3_C1259`1<class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G3_C1259::Method7.MI.15163<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G3_C1259`1<class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G2_C306.T.T<class BaseClass0,class BaseClass1,class G3_C1259`1<class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G2_C306.A.T<class BaseClass1,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G2_C306.A.B<class G3_C1259`1<class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass1,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.B<class G3_C1259`1<class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass0,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.A<class G3_C1259`1<class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G3_C1259.T<class BaseClass1,class G3_C1259`1<class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G3_C1259::ClassMethod1943.MI.15164<System.Object>()#G3_C1259::ClassMethod1944.MI.15165<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G3_C1259::Method7.15162<System.Object>()#"
call void Generated787::M.G3_C1259.B<class G3_C1259`1<class BaseClass1>>(!!0,string)
newobj instance void class G2_C306`2<class BaseClass0,class BaseClass0>::.ctor()
stloc.0
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass0,class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.A.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.A.A<class G2_C306`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.A<class G2_C306`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.A<class G2_C306`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G2_C306`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G2_C306`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.T.T<class BaseClass0,class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.A.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.A.A<class G2_C306`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.A<class G2_C306`2<class BaseClass0,class BaseClass0>>(!!0,string)
newobj instance void class G2_C306`2<class BaseClass0,class BaseClass1>::.ctor()
stloc.0
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass0,class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.A.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.A.A<class G2_C306`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.A<class G2_C306`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.A<class G2_C306`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G2_C306`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G2_C306`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.T.T<class BaseClass0,class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.A.T<class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.A.B<class G2_C306`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass1,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.B<class G2_C306`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass0,class G2_C306`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.A<class G2_C306`2<class BaseClass0,class BaseClass1>>(!!0,string)
newobj instance void class G2_C306`2<class BaseClass1,class BaseClass0>::.ctor()
stloc.0
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass1,class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.B.T<class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.B.B<class G2_C306`2<class BaseClass1,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G2_C306`2<class BaseClass1,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G2_C306`2<class BaseClass1,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.T.T<class BaseClass1,class BaseClass0,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.B.T<class BaseClass0,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.B.A<class G2_C306`2<class BaseClass1,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass0,class G2_C306`2<class BaseClass1,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.A<class G2_C306`2<class BaseClass1,class BaseClass0>>(!!0,string)
newobj instance void class G2_C306`2<class BaseClass1,class BaseClass1>::.ctor()
stloc.0
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass1,class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.B.T<class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G1_C6.B.B<class G2_C306`2<class BaseClass1,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G2_C306`2<class BaseClass1,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G2_C306`2<class BaseClass1,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.T.T<class BaseClass1,class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.B.T<class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::ClassMethod1326.MI.7611()#G1_C6::ClassMethod1327.4810<System.Object>()#G2_C306::ClassMethod1943.7609<System.Object>()#G2_C306::ClassMethod1944.7610<System.Object>()#G2_C306::Method4.7602()#G2_C306::Method5.7604()#G2_C306::Method6.7606<System.Object>()#G2_C306::Method7.7608<System.Object>()#"
call void Generated787::M.G2_C306.B.B<class G2_C306`2<class BaseClass1,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass1,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.B<class G2_C306`2<class BaseClass1,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.T<class BaseClass0,class G2_C306`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G2_C306::Method4.MI.7603()#G2_C306::Method5.MI.7605()#G2_C306::Method6.MI.7607<System.Object>()#"
call void Generated787::M.IBase1.A<class G2_C306`2<class BaseClass1,class BaseClass1>>(!!0,string)
newobj instance void class G1_C6`2<class BaseClass0,class BaseClass0>::.ctor()
stloc.0
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass0,class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.A.T<class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.A.A<class G1_C6`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.A<class G1_C6`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.A<class G1_C6`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G1_C6`2<class BaseClass0,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G1_C6`2<class BaseClass0,class BaseClass0>>(!!0,string)
newobj instance void class G1_C6`2<class BaseClass0,class BaseClass1>::.ctor()
stloc.0
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass0,class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.A.T<class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.A.B<class G1_C6`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.A<class G1_C6`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass0,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.A<class G1_C6`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G1_C6`2<class BaseClass0,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G1_C6`2<class BaseClass0,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G1_C6`2<class BaseClass0,class BaseClass1>>(!!0,string)
newobj instance void class G1_C6`2<class BaseClass1,class BaseClass0>::.ctor()
stloc.0
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass1,class BaseClass0,class G1_C6`2<class BaseClass1,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.B.T<class BaseClass0,class G1_C6`2<class BaseClass1,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.B.A<class G1_C6`2<class BaseClass1,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G1_C6`2<class BaseClass1,class BaseClass0>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass0>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass0>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G1_C6`2<class BaseClass1,class BaseClass0>>(!!0,string)
newobj instance void class G1_C6`2<class BaseClass1,class BaseClass1>::.ctor()
stloc.0
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.T.T<class BaseClass1,class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.B.T<class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G1_C6::ClassMethod1326.4809()#G1_C6::ClassMethod1327.4810<System.Object>()#G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.G1_C6.B.B<class G1_C6`2<class BaseClass1,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.T<class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.B.B<class G1_C6`2<class BaseClass1,class BaseClass1>>(!!0,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass1>>(!!2,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.T<class BaseClass1,class G1_C6`2<class BaseClass1,class BaseClass1>>(!!1,string)
ldloc.0
ldstr "G1_C6::Method7.4808<System.Object>()#"
call void Generated787::M.IBase2.A.B<class G1_C6`2<class BaseClass1,class BaseClass1>>(!!0,string)
ldstr "========================================================================\n\n"
call void [mscorlib]System.Console::WriteLine(string)
ret
}
.method public hidebysig static void StructConstrainedInterfaceCallsTest() cil managed
{
.maxstack 10
ldstr "===================== Struct Constrained Interface Calls Test ====================="
call void [mscorlib]System.Console::WriteLine(string)
ldstr "========================================================================\n\n"
call void [mscorlib]System.Console::WriteLine(string)
ret
}
.method public hidebysig static void CalliTest() cil managed
{
.maxstack 10
.locals init (object V_0)
ldstr "========================== Method Calli Test =========================="
call void [mscorlib]System.Console::WriteLine(string)
newobj instance void class G3_C1259`1<class BaseClass0>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1944<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::ClassMethod1944.MI.15165<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1943<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::ClassMethod1943.MI.15164<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method6<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method5()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method4()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method4()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method5()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method6<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method4()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method5()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method6<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass0>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass0>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass0>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass0>::ClassMethod1944<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::ClassMethod1944.MI.15165<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass0>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass0>::ClassMethod1943<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G3_C1259::ClassMethod1943.MI.15164<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass0>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass0>::Method6<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass0>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass0>::Method5()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method5.7604()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass0>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass0>::Method4()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::Method4.7602()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass0>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass0>::ClassMethod1327<object>()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass0>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass0>::ClassMethod1326()
calli default string(class G3_C1259`1<class BaseClass0>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G3_C1259`1<class BaseClass0> on type class G3_C1259`1<class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G3_C1259`1<class BaseClass1>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::Method7.MI.15163<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1944<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::ClassMethod1944.MI.15165<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1943<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::ClassMethod1943.MI.15164<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method6<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method5()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method4()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method4()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method5()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method6<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method4()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method5()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method6<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass1>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass1>::Method7<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::Method7.15162<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass1>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass1>::ClassMethod1944<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::ClassMethod1944.MI.15165<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass1>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass1>::ClassMethod1943<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G3_C1259::ClassMethod1943.MI.15164<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass1>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass1>::Method6<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass1>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass1>::Method5()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method5.7604()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass1>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass1>::Method4()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::Method4.7602()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass1>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass1>::ClassMethod1327<object>()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G3_C1259`1<class BaseClass1>
ldloc.0
ldvirtftn instance string class G3_C1259`1<class BaseClass1>::ClassMethod1326()
calli default string(class G3_C1259`1<class BaseClass1>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G3_C1259`1<class BaseClass1> on type class G3_C1259`1<class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G2_C306`2<class BaseClass0,class BaseClass0>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1944<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::ClassMethod1944.7610<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1943<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::ClassMethod1943.7609<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method5()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass0>::Method4()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method4()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method5()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass0>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G2_C306`2<class BaseClass0,class BaseClass1>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1944<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::ClassMethod1944.7610<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1943<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::ClassMethod1943.7609<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method5()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::Method4()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method4()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method5()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method4()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method5()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass0,class BaseClass1>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G2_C306`2<class BaseClass1,class BaseClass0>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1944<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::ClassMethod1944.7610<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1943<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::ClassMethod1943.7609<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method5()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass0>::Method4()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1327<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass0>::ClassMethod1326()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method4()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method5()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass0>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G2_C306`2<class BaseClass1,class BaseClass1>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1944<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::ClassMethod1944.7610<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1943<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::ClassMethod1943.7609<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method7.7608<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method6.7606<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method5()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method5.7604()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass1>::Method4()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method4.7602()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G2_C306`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G2_C306`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::ClassMethod1326.MI.7611()"
ldstr "class G2_C306`2<class BaseClass1,class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method4()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method5()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass1>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass1> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method4()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method4.MI.7603()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method5()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method5.MI.7605()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase1`1<class BaseClass0>::Method6<object>()
calli default string(class G2_C306`2<class BaseClass1,class BaseClass1>)
ldstr "G2_C306::Method6.MI.7607<System.Object>()"
ldstr "class IBase1`1<class BaseClass0> on type class G2_C306`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G1_C6`2<class BaseClass0,class BaseClass0>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1327<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::ClassMethod1326()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::ClassMethod1326.4809()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass0>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G1_C6`2<class BaseClass0,class BaseClass1>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass1>::ClassMethod1327<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass1>::ClassMethod1326()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::ClassMethod1326.4809()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass0,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class G1_C6`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass0,class BaseClass1>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass0,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G1_C6`2<class BaseClass1,class BaseClass0>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass0>::ClassMethod1327<object>()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass0>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass0>::ClassMethod1326()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass0>)
ldstr "G1_C6::ClassMethod1326.4809()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass0>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass0>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass0>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass0> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass0>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass0>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass0>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
newobj instance void class G1_C6`2<class BaseClass1,class BaseClass1>::.ctor()
stloc.0
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1327<object>()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass1>)
ldstr "G1_C6::ClassMethod1327.4810<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::ClassMethod1326()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass1>)
ldstr "G1_C6::ClassMethod1326.4809()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
castclass class G1_C6`2<class BaseClass1,class BaseClass1>
ldloc.0
ldvirtftn instance string class G1_C6`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass1>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class G1_C6`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass1>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldloc.0
ldloc.0
ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>()
calli default string(class G1_C6`2<class BaseClass1,class BaseClass1>)
ldstr "G1_C6::Method7.4808<System.Object>()"
ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C6`2<class BaseClass1,class BaseClass1>"
call void [TestFramework]TestFramework::MethodCallTest(string,string,string)
ldstr "========================================================================\n\n"
call void [mscorlib]System.Console::WriteLine(string)
ret
}
.method public hidebysig static int32 Main() cil managed
{
.custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = (
01 00 00 00
)
.entrypoint
.maxstack 10
call void Generated787::MethodCallingTest()
call void Generated787::ConstrainedCallsTest()
call void Generated787::StructConstrainedInterfaceCallsTest()
call void Generated787::CalliTest()
ldc.i4 100
ret
}
}
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/libraries/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.PlatformNotSupported.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
namespace Microsoft.Win32.SafeHandles
{
[UnsupportedOSPlatform("tvos")]
internal sealed class SafeGssNameHandle : SafeHandle
{
public override bool IsInvalid
{
get { throw new PlatformNotSupportedException(); }
}
protected override bool ReleaseHandle() => throw new PlatformNotSupportedException();
public SafeGssNameHandle()
: base(IntPtr.Zero, true)
{
}
}
[UnsupportedOSPlatform("tvos")]
internal sealed class SafeGssCredHandle : SafeHandle
{
public SafeGssCredHandle()
: base(IntPtr.Zero, true)
{
}
public override bool IsInvalid
{
get { throw new PlatformNotSupportedException(); }
}
protected override bool ReleaseHandle() => throw new PlatformNotSupportedException();
}
[UnsupportedOSPlatform("tvos")]
internal sealed class SafeGssContextHandle : SafeHandle
{
public SafeGssContextHandle()
: base(IntPtr.Zero, true)
{
}
public override bool IsInvalid
{
get { throw new PlatformNotSupportedException(); }
}
protected override bool ReleaseHandle() => throw new PlatformNotSupportedException();
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
namespace Microsoft.Win32.SafeHandles
{
[UnsupportedOSPlatform("tvos")]
internal sealed class SafeGssNameHandle : SafeHandle
{
public override bool IsInvalid
{
get { throw new PlatformNotSupportedException(); }
}
protected override bool ReleaseHandle() => throw new PlatformNotSupportedException();
public SafeGssNameHandle()
: base(IntPtr.Zero, true)
{
}
}
[UnsupportedOSPlatform("tvos")]
internal sealed class SafeGssCredHandle : SafeHandle
{
public SafeGssCredHandle()
: base(IntPtr.Zero, true)
{
}
public override bool IsInvalid
{
get { throw new PlatformNotSupportedException(); }
}
protected override bool ReleaseHandle() => throw new PlatformNotSupportedException();
}
[UnsupportedOSPlatform("tvos")]
internal sealed class SafeGssContextHandle : SafeHandle
{
public SafeGssContextHandle()
: base(IntPtr.Zero, true)
{
}
public override bool IsInvalid
{
get { throw new PlatformNotSupportedException(); }
}
protected override bool ReleaseHandle() => throw new PlatformNotSupportedException();
}
}
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/tests/Regressions/coreclr/20452/twopassvariance.il
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
.assembly extern mscorlib { }
.assembly twopassvariance { }
.class Base { }
.class Derived extends Base { }
.class SuperDerived extends Derived { }
.class MegaSuperDerived extends SuperDerived { }
.class interface IFoo<-T>
{
.method public newslot virtual instance class [mscorlib]System.Type Gimme()
{
ldtoken class IFoo<!0>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ret
}
}
.class interface IBar<T> implements class IFoo<!T>
{
.method public virtual final instance class [mscorlib]System.Type Gimme()
{
.override method instance class [mscorlib]System.Type class IFoo<!T>::Gimme()
ldtoken class IBar<!0>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ret
}
}
.class interface IBaz<T> implements class IFoo<!T>
{
.method public virtual final instance class [mscorlib]System.Type Gimme()
{
.override method instance class [mscorlib]System.Type class IFoo<!T>::Gimme()
ldtoken class IBar<!0>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ret
}
}
.class interface IQux implements class IFoo<class Base>, class IFoo<class Derived>
{
.method public virtual final instance class [mscorlib]System.Type Gimme()
{
.override method instance class [mscorlib]System.Type class IFoo<class Base>::Gimme()
ldtoken IQux
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ret
}
}
.class Fooer1
implements class IFoo<class Base>, class IFoo<class Derived>
{
.method public specialname rtspecialname instance void .ctor()
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.class Fooer2
implements class IFoo<class Derived>, class IFoo<class Base>
{
.method public specialname rtspecialname instance void .ctor()
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.class Fooer3
implements class IBaz<class Base>, class IBar<class Derived>, class IFoo<object>
{
.method public specialname rtspecialname instance void .ctor()
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.class Fooer4
implements IQux, class IBar<class Derived>
{
.method public specialname rtspecialname instance void .ctor()
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.class Fooer5
implements class IBar<class Derived>, IQux
{
.method public specialname rtspecialname instance void .ctor()
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.class Fooer6
implements class IFoo<class Base>, class IBar<class Base>
{
.method public specialname rtspecialname instance void .ctor()
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.class Fooer7
implements class IBar<class Base>, class IFoo<class Base>
{
.method public specialname rtspecialname instance void .ctor()
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.method static int32 main()
{
.entrypoint
newobj instance void Fooer1::.ctor()
castclass class IFoo<class SuperDerived>
callvirt instance class [mscorlib]System.Type class IFoo<class SuperDerived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IFoo<class Base>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer1_IFoo_SuperDerivedOK
ldc.i4.1
ret
Fooer1_IFoo_SuperDerivedOK:
newobj instance void Fooer2::.ctor()
castclass class IFoo<class SuperDerived>
callvirt instance class [mscorlib]System.Type class IFoo<class SuperDerived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IFoo<class Derived>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer2_IFoo_SuperDerivedOK
ldc.i4.2
ret
Fooer2_IFoo_SuperDerivedOK:
newobj instance void Fooer3::.ctor()
castclass class IFoo<class Base>
callvirt instance class [mscorlib]System.Type class IFoo<class Base>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Base>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer3_IFoo_BaseOK
ldc.i4.3
ret
Fooer3_IFoo_BaseOK:
newobj instance void Fooer3::.ctor()
castclass class IFoo<class Derived>
callvirt instance class [mscorlib]System.Type class IFoo<class Derived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Derived>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer3_IFoo_DerivedOK
ldc.i4.4
ret
Fooer3_IFoo_DerivedOK:
newobj instance void Fooer3::.ctor()
castclass class IFoo<class SuperDerived>
callvirt instance class [mscorlib]System.Type class IFoo<class SuperDerived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Base>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer3_IFoo_SuperDerivedOK
ldc.i4.5
ret
Fooer3_IFoo_SuperDerivedOK:
newobj instance void Fooer4::.ctor()
castclass class IFoo<class Base>
callvirt instance class [mscorlib]System.Type class IFoo<class Base>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken IQux
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer4_IFoo_BaseOK
ldc.i4.6
ret
Fooer4_IFoo_BaseOK:
newobj instance void Fooer4::.ctor()
castclass class IFoo<class Derived>
callvirt instance class [mscorlib]System.Type class IFoo<class Derived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Derived>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer4_IFoo_DerivedOK
ldc.i4.7
ret
Fooer4_IFoo_DerivedOK:
newobj instance void Fooer4::.ctor()
castclass class IFoo<class SuperDerived>
callvirt instance class [mscorlib]System.Type class IFoo<class SuperDerived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken IQux
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer4_IFoo_SuperDerivedOK
ldc.i4.8
ret
Fooer4_IFoo_SuperDerivedOK:
newobj instance void Fooer5::.ctor()
castclass class IFoo<class SuperDerived>
callvirt instance class [mscorlib]System.Type class IFoo<class SuperDerived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Derived>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer5_IFoo_SuperDerivedOK
ldc.i4 9
ret
Fooer5_IFoo_SuperDerivedOK:
newobj instance void Fooer6::.ctor()
castclass class IFoo<class Base>
callvirt instance class [mscorlib]System.Type class IFoo<class Base>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Base>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer6_IFoo_BaseOK
ldc.i4 10
ret
Fooer6_IFoo_BaseOK:
newobj instance void Fooer6::.ctor()
castclass class IFoo<class Derived>
callvirt instance class [mscorlib]System.Type class IFoo<class Derived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Base>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer6_IFoo_DerivedOK
ldc.i4 11
ret
Fooer6_IFoo_DerivedOK:
newobj instance void Fooer7::.ctor()
castclass class IFoo<class Base>
callvirt instance class [mscorlib]System.Type class IFoo<class Base>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Base>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer7_IFoo_BaseOK
ldc.i4 12
ret
Fooer7_IFoo_BaseOK:
newobj instance void Fooer7::.ctor()
castclass class IFoo<class Derived>
callvirt instance class [mscorlib]System.Type class IFoo<class Derived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Base>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer7_IFoo_DerivedOK
ldc.i4 13
ret
Fooer7_IFoo_DerivedOK:
ldc.i4 100
ret
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
.assembly extern mscorlib { }
.assembly twopassvariance { }
.class Base { }
.class Derived extends Base { }
.class SuperDerived extends Derived { }
.class MegaSuperDerived extends SuperDerived { }
.class interface IFoo<-T>
{
.method public newslot virtual instance class [mscorlib]System.Type Gimme()
{
ldtoken class IFoo<!0>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ret
}
}
.class interface IBar<T> implements class IFoo<!T>
{
.method public virtual final instance class [mscorlib]System.Type Gimme()
{
.override method instance class [mscorlib]System.Type class IFoo<!T>::Gimme()
ldtoken class IBar<!0>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ret
}
}
.class interface IBaz<T> implements class IFoo<!T>
{
.method public virtual final instance class [mscorlib]System.Type Gimme()
{
.override method instance class [mscorlib]System.Type class IFoo<!T>::Gimme()
ldtoken class IBar<!0>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ret
}
}
.class interface IQux implements class IFoo<class Base>, class IFoo<class Derived>
{
.method public virtual final instance class [mscorlib]System.Type Gimme()
{
.override method instance class [mscorlib]System.Type class IFoo<class Base>::Gimme()
ldtoken IQux
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ret
}
}
.class Fooer1
implements class IFoo<class Base>, class IFoo<class Derived>
{
.method public specialname rtspecialname instance void .ctor()
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.class Fooer2
implements class IFoo<class Derived>, class IFoo<class Base>
{
.method public specialname rtspecialname instance void .ctor()
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.class Fooer3
implements class IBaz<class Base>, class IBar<class Derived>, class IFoo<object>
{
.method public specialname rtspecialname instance void .ctor()
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.class Fooer4
implements IQux, class IBar<class Derived>
{
.method public specialname rtspecialname instance void .ctor()
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.class Fooer5
implements class IBar<class Derived>, IQux
{
.method public specialname rtspecialname instance void .ctor()
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.class Fooer6
implements class IFoo<class Base>, class IBar<class Base>
{
.method public specialname rtspecialname instance void .ctor()
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.class Fooer7
implements class IBar<class Base>, class IFoo<class Base>
{
.method public specialname rtspecialname instance void .ctor()
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
.method static int32 main()
{
.entrypoint
newobj instance void Fooer1::.ctor()
castclass class IFoo<class SuperDerived>
callvirt instance class [mscorlib]System.Type class IFoo<class SuperDerived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IFoo<class Base>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer1_IFoo_SuperDerivedOK
ldc.i4.1
ret
Fooer1_IFoo_SuperDerivedOK:
newobj instance void Fooer2::.ctor()
castclass class IFoo<class SuperDerived>
callvirt instance class [mscorlib]System.Type class IFoo<class SuperDerived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IFoo<class Derived>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer2_IFoo_SuperDerivedOK
ldc.i4.2
ret
Fooer2_IFoo_SuperDerivedOK:
newobj instance void Fooer3::.ctor()
castclass class IFoo<class Base>
callvirt instance class [mscorlib]System.Type class IFoo<class Base>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Base>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer3_IFoo_BaseOK
ldc.i4.3
ret
Fooer3_IFoo_BaseOK:
newobj instance void Fooer3::.ctor()
castclass class IFoo<class Derived>
callvirt instance class [mscorlib]System.Type class IFoo<class Derived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Derived>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer3_IFoo_DerivedOK
ldc.i4.4
ret
Fooer3_IFoo_DerivedOK:
newobj instance void Fooer3::.ctor()
castclass class IFoo<class SuperDerived>
callvirt instance class [mscorlib]System.Type class IFoo<class SuperDerived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Base>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer3_IFoo_SuperDerivedOK
ldc.i4.5
ret
Fooer3_IFoo_SuperDerivedOK:
newobj instance void Fooer4::.ctor()
castclass class IFoo<class Base>
callvirt instance class [mscorlib]System.Type class IFoo<class Base>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken IQux
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer4_IFoo_BaseOK
ldc.i4.6
ret
Fooer4_IFoo_BaseOK:
newobj instance void Fooer4::.ctor()
castclass class IFoo<class Derived>
callvirt instance class [mscorlib]System.Type class IFoo<class Derived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Derived>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer4_IFoo_DerivedOK
ldc.i4.7
ret
Fooer4_IFoo_DerivedOK:
newobj instance void Fooer4::.ctor()
castclass class IFoo<class SuperDerived>
callvirt instance class [mscorlib]System.Type class IFoo<class SuperDerived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken IQux
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer4_IFoo_SuperDerivedOK
ldc.i4.8
ret
Fooer4_IFoo_SuperDerivedOK:
newobj instance void Fooer5::.ctor()
castclass class IFoo<class SuperDerived>
callvirt instance class [mscorlib]System.Type class IFoo<class SuperDerived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Derived>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer5_IFoo_SuperDerivedOK
ldc.i4 9
ret
Fooer5_IFoo_SuperDerivedOK:
newobj instance void Fooer6::.ctor()
castclass class IFoo<class Base>
callvirt instance class [mscorlib]System.Type class IFoo<class Base>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Base>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer6_IFoo_BaseOK
ldc.i4 10
ret
Fooer6_IFoo_BaseOK:
newobj instance void Fooer6::.ctor()
castclass class IFoo<class Derived>
callvirt instance class [mscorlib]System.Type class IFoo<class Derived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Base>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer6_IFoo_DerivedOK
ldc.i4 11
ret
Fooer6_IFoo_DerivedOK:
newobj instance void Fooer7::.ctor()
castclass class IFoo<class Base>
callvirt instance class [mscorlib]System.Type class IFoo<class Base>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Base>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer7_IFoo_BaseOK
ldc.i4 12
ret
Fooer7_IFoo_BaseOK:
newobj instance void Fooer7::.ctor()
castclass class IFoo<class Derived>
callvirt instance class [mscorlib]System.Type class IFoo<class Derived>::Gimme()
dup
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)
ldtoken class IBar<class Base>
call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
ceq
brtrue Fooer7_IFoo_DerivedOK
ldc.i4 13
ret
Fooer7_IFoo_DerivedOK:
ldc.i4 100
ret
}
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/libraries/System.Private.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Int8Array.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
namespace System.Runtime.InteropServices.JavaScript
{
[CLSCompliant(false)]
public sealed class Int8Array : TypedArray<Int8Array, sbyte>
{
public Int8Array()
{ }
public Int8Array(int length) : base(length)
{ }
public Int8Array(ArrayBuffer buffer) : base(buffer)
{ }
public Int8Array(ArrayBuffer buffer, int byteOffset) : base(buffer, byteOffset)
{ }
public Int8Array(ArrayBuffer buffer, int byteOffset, int length) : base(buffer, byteOffset, length)
{ }
public Int8Array(SharedArrayBuffer buffer) : base(buffer)
{ }
public Int8Array(SharedArrayBuffer buffer, int byteOffset) : base(buffer, byteOffset)
{ }
public Int8Array(SharedArrayBuffer buffer, int byteOffset, int length) : base(buffer, byteOffset, length)
{ }
internal Int8Array(IntPtr jsHandle) : base(jsHandle)
{ }
/// <summary>
/// Defines an implicit conversion of Int8Array class to a sbyte
/// </summary>
[CLSCompliant(false)]
public static implicit operator Span<sbyte>(Int8Array typedarray) => typedarray.ToArray();
/// <summary>
/// Defines an implicit conversion of sbyte to a Int8Array class.
/// </summary>
[CLSCompliant(false)]
public static implicit operator Int8Array(Span<sbyte> span) => From(span);
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
namespace System.Runtime.InteropServices.JavaScript
{
[CLSCompliant(false)]
public sealed class Int8Array : TypedArray<Int8Array, sbyte>
{
public Int8Array()
{ }
public Int8Array(int length) : base(length)
{ }
public Int8Array(ArrayBuffer buffer) : base(buffer)
{ }
public Int8Array(ArrayBuffer buffer, int byteOffset) : base(buffer, byteOffset)
{ }
public Int8Array(ArrayBuffer buffer, int byteOffset, int length) : base(buffer, byteOffset, length)
{ }
public Int8Array(SharedArrayBuffer buffer) : base(buffer)
{ }
public Int8Array(SharedArrayBuffer buffer, int byteOffset) : base(buffer, byteOffset)
{ }
public Int8Array(SharedArrayBuffer buffer, int byteOffset, int length) : base(buffer, byteOffset, length)
{ }
internal Int8Array(IntPtr jsHandle) : base(jsHandle)
{ }
/// <summary>
/// Defines an implicit conversion of Int8Array class to a sbyte
/// </summary>
[CLSCompliant(false)]
public static implicit operator Span<sbyte>(Int8Array typedarray) => typedarray.ToArray();
/// <summary>
/// Defines an implicit conversion of sbyte to a Int8Array class.
/// </summary>
[CLSCompliant(false)]
public static implicit operator Int8Array(Span<sbyte> span) => From(span);
}
}
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./.github/ISSUE_TEMPLATE/04_blank_issue.md
|
---
name: Blank issue
about: Something that doesn't fit the other categories
title: ''
labels: ''
assignees: ''
---
|
---
name: Blank issue
about: Something that doesn't fit the other categories
title: ''
labels: ''
assignees: ''
---
| -1 |
dotnet/runtime
| 66,427 |
Remove 4146 from libunwind
|
Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
AaronRobinsonMSFT
| 2022-03-10T01:32:16Z | 2022-03-14T21:00:38Z |
7e1dd58065e624dd3431c9dcbde9e30b3b5beaed
|
c3d393250cd63a679405fa9e35684772cbf2e1ef
|
Remove 4146 from libunwind. Contributes to https://github.com/dotnet/runtime/issues/66154
~~This converts the invalid arithmetic negation on an unsigned value to use the identity of bitwise negation plus one.~~
Upstream PR: https://github.com/libunwind/libunwind/pull/333
/cc @GrabYourPitchforks @jkotas @janvorli @am11
|
./src/tests/FunctionalTests/iOS/Simulator/PInvoke/iOS.Simulator.PInvoke.Test.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<MonoForceInterpreter>true</MonoForceInterpreter>
<RunAOTCompilation>false</RunAOTCompilation>
<TestRuntime>true</TestRuntime>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<TargetOS Condition="'$(TargetOS)' == ''">iOSSimulator</TargetOS>
<MainLibraryFileName>iOS.Simulator.PInvoke.Test.dll</MainLibraryFileName>
<IncludesTestRunner>false</IncludesTestRunner>
<ExpectedExitCode>42</ExpectedExitCode>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.cs" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<MonoForceInterpreter>true</MonoForceInterpreter>
<RunAOTCompilation>false</RunAOTCompilation>
<TestRuntime>true</TestRuntime>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<TargetOS Condition="'$(TargetOS)' == ''">iOSSimulator</TargetOS>
<MainLibraryFileName>iOS.Simulator.PInvoke.Test.dll</MainLibraryFileName>
<IncludesTestRunner>false</IncludesTestRunner>
<ExpectedExitCode>42</ExpectedExitCode>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.cs" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/JsonMetadataServicesConverter.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
using System.Text.Json.Serialization.Metadata;
namespace System.Text.Json.Serialization.Converters
{
/// <summary>
/// Provides a mechanism to invoke "fast-path" serialization logic via
/// <see cref="JsonTypeInfo{T}.SerializeHandler"/>. This type holds an optional
/// reference to an actual <see cref="JsonConverter{T}"/> for the type
/// <typeparamref name="T"/>, to provide a fallback when the fast path cannot be used.
/// </summary>
/// <typeparam name="T">The type to converter</typeparam>
internal sealed class JsonMetadataServicesConverter<T> : JsonResumableConverter<T>
{
private readonly Func<JsonConverter<T>> _converterCreator;
private readonly ConverterStrategy _converterStrategy;
private JsonConverter<T>? _converter;
// A backing converter for when fast-path logic cannot be used.
internal JsonConverter<T> Converter
{
get
{
_converter ??= _converterCreator();
Debug.Assert(_converter != null);
Debug.Assert(_converter.ConverterStrategy == _converterStrategy);
return _converter;
}
}
internal override ConverterStrategy ConverterStrategy => _converterStrategy;
internal override Type? KeyType => Converter.KeyType;
internal override Type? ElementType => Converter.ElementType;
internal override bool ConstructorIsParameterized => Converter.ConstructorIsParameterized;
public JsonMetadataServicesConverter(Func<JsonConverter<T>> converterCreator!!, ConverterStrategy converterStrategy)
{
_converterCreator = converterCreator;
_converterStrategy = converterStrategy;
}
internal override bool OnTryRead(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, ref ReadStack state, out T? value)
{
JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo;
if (_converterStrategy == ConverterStrategy.Object)
{
if (jsonTypeInfo.PropertyCache == null)
{
jsonTypeInfo.InitializePropCache();
}
if (jsonTypeInfo.ParameterCache == null && jsonTypeInfo.IsObjectWithParameterizedCtor)
{
jsonTypeInfo.InitializeParameterCache();
}
}
return Converter.OnTryRead(ref reader, typeToConvert, options, ref state, out value);
}
internal override bool OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, ref WriteStack state)
{
JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo;
Debug.Assert(options == jsonTypeInfo.Options);
if (!state.SupportContinuation &&
jsonTypeInfo is JsonTypeInfo<T> info &&
info.SerializeHandler != null &&
info.Options.JsonSerializerContext?.CanUseSerializationLogic == true)
{
info.SerializeHandler(writer, value);
return true;
}
if (_converterStrategy == ConverterStrategy.Object && jsonTypeInfo.PropertyCache == null)
{
jsonTypeInfo.InitializePropCache();
}
return Converter.OnTryWrite(writer, value, options, ref state);
}
internal override void ConfigureJsonTypeInfo(JsonTypeInfo jsonTypeInfo, JsonSerializerOptions options)
=> Converter.ConfigureJsonTypeInfo(jsonTypeInfo, options);
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
using System.Text.Json.Serialization.Metadata;
namespace System.Text.Json.Serialization.Converters
{
/// <summary>
/// Provides a mechanism to invoke "fast-path" serialization logic via
/// <see cref="JsonTypeInfo{T}.SerializeHandler"/>. This type holds an optional
/// reference to an actual <see cref="JsonConverter{T}"/> for the type
/// <typeparamref name="T"/>, to provide a fallback when the fast path cannot be used.
/// </summary>
/// <typeparam name="T">The type to converter</typeparam>
internal sealed class JsonMetadataServicesConverter<T> : JsonResumableConverter<T>
{
private readonly Func<JsonConverter<T>> _converterCreator;
private readonly ConverterStrategy _converterStrategy;
private JsonConverter<T>? _converter;
// A backing converter for when fast-path logic cannot be used.
internal JsonConverter<T> Converter
{
get
{
_converter ??= _converterCreator();
Debug.Assert(_converter != null);
Debug.Assert(_converter.ConverterStrategy == _converterStrategy);
return _converter;
}
}
internal override ConverterStrategy ConverterStrategy => _converterStrategy;
internal override Type? KeyType => Converter.KeyType;
internal override Type? ElementType => Converter.ElementType;
internal override bool ConstructorIsParameterized => Converter.ConstructorIsParameterized;
internal override bool CanHaveIdMetadata => Converter.CanHaveIdMetadata;
public JsonMetadataServicesConverter(Func<JsonConverter<T>> converterCreator!!, ConverterStrategy converterStrategy)
{
_converterCreator = converterCreator;
_converterStrategy = converterStrategy;
}
internal override bool OnTryRead(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, ref ReadStack state, out T? value)
{
JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo;
if (_converterStrategy == ConverterStrategy.Object)
{
if (jsonTypeInfo.PropertyCache == null)
{
jsonTypeInfo.InitializePropCache();
}
if (jsonTypeInfo.ParameterCache == null && jsonTypeInfo.IsObjectWithParameterizedCtor)
{
jsonTypeInfo.InitializeParameterCache();
}
}
return Converter.OnTryRead(ref reader, typeToConvert, options, ref state, out value);
}
internal override bool OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, ref WriteStack state)
{
JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo;
Debug.Assert(options == jsonTypeInfo.Options);
if (!state.SupportContinuation &&
jsonTypeInfo is JsonTypeInfo<T> info &&
info.SerializeHandler != null &&
info.Options.JsonSerializerContext?.CanUseSerializationLogic == true)
{
info.SerializeHandler(writer, value);
return true;
}
if (_converterStrategy == ConverterStrategy.Object && jsonTypeInfo.PropertyCache == null)
{
jsonTypeInfo.InitializePropCache();
}
return Converter.OnTryWrite(writer, value, options, ref state);
}
internal override void ConfigureJsonTypeInfo(JsonTypeInfo jsonTypeInfo, JsonSerializerOptions options)
=> Converter.ConfigureJsonTypeInfo(jsonTypeInfo, options);
internal override void CreateInstanceForReferenceResolver(ref Utf8JsonReader reader, ref ReadStack state, JsonSerializerOptions options)
=> Converter.CreateInstanceForReferenceResolver(ref reader, ref state, options);
}
}
| 1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Text.Json/tests/Common/TestClasses/TestClasses.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Collections.ObjectModel;
using System.Linq;
using Xunit;
namespace System.Text.Json.Serialization.Tests
{
public interface ITestClass
{
void Initialize();
void Verify();
}
public enum SampleEnumByte : byte
{
MinZero = byte.MinValue,
One = 1,
Two = 2,
Max = byte.MaxValue
}
public enum SampleEnumSByte : sbyte
{
MinNegative = sbyte.MinValue,
Zero = 0,
One = 1,
Two = 2,
Max = sbyte.MaxValue
}
public enum SampleEnum
{
MinZero = 0,
One = 1,
Two = 2
}
public enum SampleEnumInt16 : short
{
MinNegative = short.MinValue,
Zero = 0,
One = 1,
Two = 2,
Max = short.MaxValue
}
public enum SampleEnumUInt16 : ushort
{
MinZero = ushort.MinValue,
One = 1,
Two = 2,
Max = ushort.MaxValue
}
public enum SampleEnumInt32 : Int32
{
MinNegative = Int32.MinValue,
Zero = 0,
One = 1,
Two = 2,
Max = Int32.MaxValue
}
public enum SampleEnumUInt32 : UInt32
{
MinZero = UInt32.MinValue,
One = 1,
Two = 2,
Max = UInt32.MaxValue
}
public enum SampleEnumInt64 : long
{
MinNegative = long.MinValue,
Zero = 0,
One = 1,
Two = 2,
Max = long.MaxValue
}
public enum SampleEnumUInt64 : ulong
{
MinZero = ulong.MinValue,
One = 1,
Two = 2,
Max = ulong.MaxValue
}
public struct SimpleStruct
{
public int One { get; set; }
public double Two { get; set; }
}
public struct SimpleStructWithSimpleClass: ITestClass
{
public short MyInt32 { get; set; }
public SimpleTestClass MySimpleClass { get; set; }
public int[] MyInt32Array { get; set; }
public static readonly string s_json =
@"{" +
@"""MySimpleClass"" : {""MyString"" : ""Hello"", ""MyDouble"" : 3.14}," +
@"""MyInt32"" : 32," +
@"""MyInt32Array"" : [32]" +
@"}";
public void Initialize()
{
MySimpleClass = new SimpleTestClass { MyString = "Hello", MyDouble = 3.14 };
MyInt32 = 32;
MyInt32Array = new int[] { 32 };
}
public void Verify()
{
Assert.Equal(32, MyInt32);
Assert.Equal(32, MyInt32Array[0]);
Assert.Equal("Hello", MySimpleClass.MyString);
Assert.Equal(3.14, MySimpleClass.MyDouble);
}
}
public class TestClassWithNull
{
public string MyString { get; set; }
public static readonly string s_json =
@"{" +
@"""MyString"" : null" +
@"}";
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(s_json);
public void Verify()
{
Assert.Null(MyString);
}
}
public class TestClassWithInitializedProperties
{
public string MyString { get; set; } = "Hello";
public int? MyInt { get; set; } = 1;
public DateTime? MyDateTime { get; set; } = new DateTime(1995, 4, 16);
public int[] MyIntArray { get; set; } = new int[] { 1 };
public List<int> MyIntList { get; set; } = new List<int> { 1 };
public List<int?> MyNullableIntList { get; set; } = new List<int?> { 1 };
public List<object> MyObjectList { get; set; } = new List<object> { 1 };
public List<List<object>> MyListList { get; set; } = new List<List<object>> { new List<object> { 1 } };
public List<Dictionary<string, string>> MyDictionaryList { get; set; } = new List<Dictionary<string, string>> {
new Dictionary<string, string> { ["key"] = "value" }
};
public Dictionary<string, string> MyStringDictionary { get; set; } = new Dictionary<string, string> { ["key"] = "value" };
public Dictionary<string, DateTime?> MyNullableDateTimeDictionary { get; set; } = new Dictionary<string, DateTime?> { ["key"] = new DateTime(1995, 04, 16) };
public Dictionary<string, object> MyObjectDictionary { get; set; } = new Dictionary<string, object> { ["key"] = "value" };
public Dictionary<string, Dictionary<string, string>> MyStringDictionaryDictionary { get; set; } = new Dictionary<string, Dictionary<string, string>>
{
["key"] = new Dictionary<string, string>
{
["key"] = "value"
}
};
public Dictionary<string, List<object>> MyListDictionary { get; set; } = new Dictionary<string, List<object>> {
["key"] = new List<object> { "value" }
};
public Dictionary<string, Dictionary<string, object>> MyObjectDictionaryDictionary { get; set; } = new Dictionary<string, Dictionary<string, object>>
{
["key"] = new Dictionary<string, object>
{
["key"] = "value"
}
};
public static readonly string s_null_json =
@"{" +
@"""MyString"" : null," +
@"""MyInt"" : null," +
@"""MyDateTime"" : null," +
@"""MyIntArray"" : null," +
@"""MyIntList"" : null," +
@"""MyNullableIntList"" : null," +
@"""MyObjectList"" : [null]," +
@"""MyListList"" : [[null]]," +
@"""MyDictionaryList"" : [{""key"" : null}]," +
@"""MyStringDictionary"" : {""key"" : null}," +
@"""MyNullableDateTimeDictionary"" : {""key"" : null}," +
@"""MyObjectDictionary"" : {""key"" : null}," +
@"""MyStringDictionaryDictionary"" : {""key"" : {""key"" : null}}," +
@"""MyListDictionary"" : {""key"" : [null]}," +
@"""MyObjectDictionaryDictionary"" : {""key"" : {""key"" : null}}" +
@"}";
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(s_null_json);
}
public class TestClassWithNestedObjectInner : ITestClass
{
public SimpleTestClass MyData { get; set; }
public static readonly string s_json =
@"{" +
@"""MyData"":" + SimpleTestClass.s_json +
@"}";
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(s_json);
public void Initialize()
{
MyData = new SimpleTestClass();
MyData.Initialize();
}
public void Verify()
{
Assert.NotNull(MyData);
MyData.Verify();
}
}
public class TestClassWithNestedObjectOuter : ITestClass
{
public TestClassWithNestedObjectInner MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":" + TestClassWithNestedObjectInner.s_json +
@"}");
public void Initialize()
{
MyData = new TestClassWithNestedObjectInner();
MyData.Initialize();
}
public void Verify()
{
Assert.NotNull(MyData);
MyData.Verify();
}
}
public class TestClassWithObjectList : ITestClass
{
public List<SimpleTestClass> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
"null," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyData.Add(obj);
}
MyData.Add(null);
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyData.Add(obj);
}
}
public void Verify()
{
Assert.Equal(3, MyData.Count);
MyData[0].Verify();
Assert.Null(MyData[1]);
MyData[2].Verify();
}
}
public class TestClassWithObjectArray : ITestClass
{
public SimpleTestClass[] MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyData = new SimpleTestClass[2] { obj1, obj2 };
}
public void Verify()
{
MyData[0].Verify();
MyData[1].Verify();
Assert.Equal(2, MyData.Length);
}
}
public class TestClassWithObjectIEnumerableT : ITestClass
{
public IEnumerable<SimpleTestClass> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyData = new SimpleTestClass[] { obj1, obj2 };
}
public void Verify()
{
int count = 0;
foreach (SimpleTestClass data in MyData)
{
data.Verify();
count++;
}
Assert.Equal(2, count);
}
}
public class TestClassWithObjectIListT : ITestClass
{
public IList<SimpleTestClass> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyData.Add(obj);
}
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyData.Add(obj);
}
}
public void Verify()
{
Assert.Equal(2, MyData.Count);
MyData[0].Verify();
MyData[1].Verify();
}
}
public class TestClassWithObjectICollectionT : ITestClass
{
public ICollection<SimpleTestClass> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyData.Add(obj);
}
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyData.Add(obj);
}
}
public void Verify()
{
Assert.Equal(2, MyData.Count);
foreach (SimpleTestClass data in MyData)
{
data.Verify();
}
}
}
public class TestClassWithObjectIEnumerable : ITestClass
{
public IEnumerable MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyData = new SimpleTestClass[] { obj1, obj2 };
}
public void Verify()
{
int count = 0;
foreach (object data in MyData)
{
if (data is JsonElement element)
{
SimpleTestClass obj = JsonSerializer.Deserialize<SimpleTestClass>(element.GetRawText());
obj.Verify();
}
else
{
((SimpleTestClass)data).Verify();
}
count++;
}
Assert.Equal(2, count);
}
}
public class TestClassWithObjectIList : ITestClass
{
public IList MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyData.Add(obj);
}
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyData.Add(obj);
}
}
public void Verify()
{
int count = 0;
foreach (object data in MyData)
{
if (data is JsonElement element)
{
SimpleTestClass obj = JsonSerializer.Deserialize<SimpleTestClass>(element.GetRawText());
obj.Verify();
}
else
{
((SimpleTestClass)data).Verify();
}
count++;
}
Assert.Equal(2, count);
}
}
public class TestClassWithObjectICollection : ITestClass
{
public ICollection MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
List<SimpleTestClass> dataTemp = new List<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
dataTemp.Add(obj);
}
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
dataTemp.Add(obj);
}
MyData = dataTemp;
}
public void Verify()
{
int count = 0;
foreach (object data in MyData)
{
if (data is JsonElement element)
{
SimpleTestClass obj = JsonSerializer.Deserialize<SimpleTestClass>(element.GetRawText());
obj.Verify();
}
else
{
((SimpleTestClass)data).Verify();
}
count++;
}
Assert.Equal(2, count);
}
}
public class TestClassWithObjectIReadOnlyCollectionT : ITestClass
{
public IReadOnlyCollection<SimpleTestClass> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyData = new SimpleTestClass[] { obj1, obj2 };
}
public void Verify()
{
Assert.Equal(2, MyData.Count);
foreach (SimpleTestClass data in MyData)
{
data.Verify();
}
}
}
public class TestClassWithObjectIReadOnlyListT : ITestClass
{
public IReadOnlyList<SimpleTestClass> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyData = new SimpleTestClass[] { obj1, obj2 };
}
public void Verify()
{
Assert.Equal(2, MyData.Count);
MyData[0].Verify();
MyData[1].Verify();
}
}
public class TestClassWithObjectISetT : ITestClass
{
public ISet<SimpleTestClass> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyData = new HashSet<SimpleTestClass> { obj1, obj2 };
}
public void Verify()
{
Assert.Equal(2, MyData.Count);
foreach (SimpleTestClass obj in MyData)
{
obj.Verify();
}
}
}
public class TestClassWithInitializedArray
{
public int[] Values { get; set; }
public TestClassWithInitializedArray()
{
Values = Array.Empty<int>();
}
}
public class SimpleClassWithDictionary
{
public int MyInt { get; set; }
public Dictionary<string, string> MyDictionary { get; set; }
}
public class OuterClassHavingPropertiesDefinedAfterClassWithDictionary
{
public double MyDouble { get; set; }
public SimpleClassWithDictionary MyInnerTestClass { get; set; }
public int MyInt { get; set; }
public string MyString { get; set; }
public List<string> MyList { get; set; }
public int[] MyIntArray { get; set; }
}
public class TestClassWithStringArray : ITestClass
{
public string[] MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new string[] { "Hello", "World" };
}
public void Verify()
{
Assert.Equal("Hello", MyData[0]);
Assert.Equal("World", MyData[1]);
Assert.Equal(2, MyData.Length);
}
}
public class TestClassWithGenericList : ITestClass
{
public List<string> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
Assert.Equal(2, MyData.Count);
}
public void Verify()
{
Assert.Equal("Hello", MyData[0]);
Assert.Equal("World", MyData[1]);
Assert.Equal(2, MyData.Count);
}
}
public class TestClassWithGenericIEnumerable : ITestClass
{
public IEnumerable MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
int count = 0;
foreach (string data in MyData)
{
count++;
}
Assert.Equal(2, count);
}
public void Verify()
{
string[] expected = { "Hello", "World" };
int count = 0;
foreach (object data in MyData)
{
if (data is JsonElement element)
{
Assert.Equal(expected[count], element.GetString());
}
else
{
Assert.Equal(expected[count], (string)data);
}
count++;
}
Assert.Equal(2, count);
}
}
public class TestClassWithGenericIList : ITestClass
{
public IList MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
Assert.Equal(2, MyData.Count);
}
public void Verify()
{
string[] expected = { "Hello", "World" };
int count = 0;
foreach (object data in MyData)
{
if (data is JsonElement element)
{
Assert.Equal(expected[count], element.GetString());
}
else
{
Assert.Equal(expected[count], (string)data);
}
count++;
}
Assert.Equal(2, count);
}
}
public class TestClassWithGenericICollection : ITestClass
{
public ICollection MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
Assert.Equal(2, MyData.Count);
}
public void Verify()
{
string[] expected = { "Hello", "World" };
int count = 0;
foreach (object data in MyData)
{
if (data is JsonElement element)
{
Assert.Equal(expected[count], element.GetString());
}
else
{
Assert.Equal(expected[count], (string)data);
}
count++;
}
Assert.Equal(2, count);
}
}
public class TestClassWithGenericIEnumerableT : ITestClass
{
public IEnumerable<string> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
int count = 0;
foreach (string data in MyData)
{
count++;
}
Assert.Equal(2, count);
}
public void Verify()
{
string[] expected = { "Hello", "World" };
int count = 0;
foreach (string data in MyData)
{
Assert.Equal(expected[count], data);
count++;
}
Assert.Equal(2, count);
}
}
public class TestClassWithGenericIListT : ITestClass
{
public IList<string> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
Assert.Equal(2, MyData.Count);
}
public void Verify()
{
Assert.Equal("Hello", MyData[0]);
Assert.Equal("World", MyData[1]);
Assert.Equal(2, MyData.Count);
}
}
public class TestClassWithGenericICollectionT : ITestClass
{
public ICollection<string> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
Assert.Equal(2, MyData.Count);
}
public void Verify()
{
string[] expected = { "Hello", "World" };
int i = 0;
foreach (string data in MyData)
{
Assert.Equal(expected[i++], data);
}
Assert.Equal(2, MyData.Count);
}
}
public class TestClassWithGenericIReadOnlyCollectionT : ITestClass
{
public IReadOnlyCollection<string> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
Assert.Equal(2, MyData.Count);
}
public void Verify()
{
string[] expected = { "Hello", "World" };
int i = 0;
foreach (string data in MyData)
{
Assert.Equal(expected[i++], data);
}
Assert.Equal(2, MyData.Count);
}
}
public class TestClassWithGenericIReadOnlyListT : ITestClass
{
public IReadOnlyList<string> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
Assert.Equal(2, MyData.Count);
}
public void Verify()
{
Assert.Equal("Hello", MyData[0]);
Assert.Equal("World", MyData[1]);
Assert.Equal(2, MyData.Count);
}
}
public class TestClassWithGenericISetT : ITestClass
{
public ISet<string> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new HashSet<string>
{
"Hello",
"World"
};
Assert.Equal(2, MyData.Count);
}
public void Verify()
{
Assert.Equal(2, MyData.Count);
bool helloSeen = false;
bool worldSeen = false;
foreach (string data in MyData)
{
if (data == "Hello")
{
helloSeen = true;
}
else if (data == "World")
{
worldSeen = true;
}
}
Assert.True(helloSeen && worldSeen);
}
}
public class TestClassWithStringToPrimitiveDictionary : ITestClass
{
public Dictionary<string, int> MyInt32Dict { get; set; }
public Dictionary<string, bool> MyBooleanDict { get; set; }
public Dictionary<string, float> MySingleDict { get; set; }
public Dictionary<string, double> MyDoubleDict { get; set; }
public Dictionary<string, DateTime> MyDateTimeDict { get; set; }
public IDictionary<string, int> MyInt32IDict { get; set; }
public IDictionary<string, bool> MyBooleanIDict { get; set; }
public IDictionary<string, float> MySingleIDict { get; set; }
public IDictionary<string, double> MyDoubleIDict { get; set; }
public IDictionary<string, DateTime> MyDateTimeIDict { get; set; }
public IReadOnlyDictionary<string, int> MyInt32IReadOnlyDict { get; set; }
public IReadOnlyDictionary<string, bool> MyBooleanIReadOnlyDict { get; set; }
public IReadOnlyDictionary<string, float> MySingleIReadOnlyDict { get; set; }
public IReadOnlyDictionary<string, double> MyDoubleIReadOnlyDict { get; set; }
public IReadOnlyDictionary<string, DateTime> MyDateTimeIReadOnlyDict { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyInt32Dict"":{" +
@"""key1"": 1," +
@"""key2"": 2" +
@"}," +
@"""MyBooleanDict"":{" +
@"""key1"": true," +
@"""key2"": false" +
@"}," +
@"""MySingleDict"":{" +
@"""key1"": 1.1," +
@"""key2"": 2.2" +
@"}," +
@"""MyDoubleDict"":{" +
@"""key1"": 3.3," +
@"""key2"": 4.4" +
@"}," +
@"""MyDateTimeDict"":{" +
@"""key1"": ""2019-01-30T12:01:02.0000000""," +
@"""key2"": ""2019-01-30T12:01:02.0000000Z""" +
@"}," +
@"""MyInt32IDict"":{" +
@"""key1"": 1," +
@"""key2"": 2" +
@"}," +
@"""MyBooleanIDict"":{" +
@"""key1"": true," +
@"""key2"": false" +
@"}," +
@"""MySingleIDict"":{" +
@"""key1"": 1.1," +
@"""key2"": 2.2" +
@"}," +
@"""MyDoubleIDict"":{" +
@"""key1"": 3.3," +
@"""key2"": 4.4" +
@"}," +
@"""MyDateTimeIDict"":{" +
@"""key1"": ""2019-01-30T12:01:02.0000000""," +
@"""key2"": ""2019-01-30T12:01:02.0000000Z""" +
@"}," +
@"""MyInt32IReadOnlyDict"":{" +
@"""key1"": 1," +
@"""key2"": 2" +
@"}," +
@"""MyBooleanIReadOnlyDict"":{" +
@"""key1"": true," +
@"""key2"": false" +
@"}," +
@"""MySingleIReadOnlyDict"":{" +
@"""key1"": 1.1," +
@"""key2"": 2.2" +
@"}," +
@"""MyDoubleIReadOnlyDict"":{" +
@"""key1"": 3.3," +
@"""key2"": 4.4" +
@"}," +
@"""MyDateTimeIReadOnlyDict"":{" +
@"""key1"": ""2019-01-30T12:01:02.0000000""," +
@"""key2"": ""2019-01-30T12:01:02.0000000Z""" +
@"}" +
@"}");
public void Initialize()
{
MyInt32Dict = new Dictionary<string, int> { { "key1", 1 }, { "key2", 2 } };
MyBooleanDict = new Dictionary<string, bool> { { "key1", true }, { "key2", false } };
MySingleDict = new Dictionary<string, float> { { "key1", 1.1f }, { "key2", 2.2f } };
MyDoubleDict = new Dictionary<string, double> { { "key1", 3.3d }, { "key2", 4.4d } };
MyDateTimeDict = new Dictionary<string, DateTime> { { "key1", new DateTime(2019, 1, 30, 12, 1, 2) }, { "key2", new DateTime(2019, 1, 30, 12, 1, 2, DateTimeKind.Utc) } };
MyInt32IDict = new Dictionary<string, int> { { "key1", 1 }, { "key2", 2 } };
MyBooleanIDict = new Dictionary<string, bool> { { "key1", true }, { "key2", false } };
MySingleIDict = new Dictionary<string, float> { { "key1", 1.1f }, { "key2", 2.2f } };
MyDoubleIDict = new Dictionary<string, double> { { "key1", 3.3d }, { "key2", 4.4d } };
MyDateTimeIDict = new Dictionary<string, DateTime> { { "key1", new DateTime(2019, 1, 30, 12, 1, 2) }, { "key2", new DateTime(2019, 1, 30, 12, 1, 2, DateTimeKind.Utc) } };
MyInt32IReadOnlyDict = new Dictionary<string, int> { { "key1", 1 }, { "key2", 2 } };
MyBooleanIReadOnlyDict = new Dictionary<string, bool> { { "key1", true }, { "key2", false } };
MySingleIReadOnlyDict = new Dictionary<string, float> { { "key1", 1.1f }, { "key2", 2.2f } };
MyDoubleIReadOnlyDict = new Dictionary<string, double> { { "key1", 3.3d }, { "key2", 4.4d } };
MyDateTimeIReadOnlyDict = new Dictionary<string, DateTime> { { "key1", new DateTime(2019, 1, 30, 12, 1, 2) }, { "key2", new DateTime(2019, 1, 30, 12, 1, 2, DateTimeKind.Utc) } };
}
public void Verify()
{
Assert.Equal(1, MyInt32Dict["key1"]);
Assert.Equal(2, MyInt32Dict["key2"]);
Assert.Equal(2, MyInt32Dict.Count);
Assert.True(MyBooleanDict["key1"]);
Assert.False(MyBooleanDict["key2"]);
Assert.Equal(2, MyBooleanDict.Count);
Assert.Equal(1.1f, MySingleDict["key1"]);
Assert.Equal(2.2f, MySingleDict["key2"]);
Assert.Equal(2, MySingleDict.Count);
Assert.Equal(3.3d, MyDoubleDict["key1"]);
Assert.Equal(4.4d, MyDoubleDict["key2"]);
Assert.Equal(2, MyDoubleDict.Count);
Assert.Equal(new DateTime(2019, 1, 30, 12, 1, 2), MyDateTimeDict["key1"]);
Assert.Equal(new DateTime(2019, 1, 30, 12, 1, 2, DateTimeKind.Utc), MyDateTimeDict["key2"]);
Assert.Equal(2, MyDateTimeDict.Count);
Assert.Equal(1, MyInt32IDict["key1"]);
Assert.Equal(2, MyInt32IDict["key2"]);
Assert.Equal(2, MyInt32IDict.Count);
Assert.True(MyBooleanIDict["key1"]);
Assert.False(MyBooleanIDict["key2"]);
Assert.Equal(2, MyBooleanIDict.Count);
Assert.Equal(1.1f, MySingleIDict["key1"]);
Assert.Equal(2.2f, MySingleIDict["key2"]);
Assert.Equal(2, MySingleIDict.Count);
Assert.Equal(3.3d, MyDoubleIDict["key1"]);
Assert.Equal(4.4d, MyDoubleIDict["key2"]);
Assert.Equal(2, MyDoubleIDict.Count);
Assert.Equal(new DateTime(2019, 1, 30, 12, 1, 2), MyDateTimeIDict["key1"]);
Assert.Equal(new DateTime(2019, 1, 30, 12, 1, 2, DateTimeKind.Utc), MyDateTimeIDict["key2"]);
Assert.Equal(2, MyDateTimeIDict.Count);
Assert.Equal(1, MyInt32IReadOnlyDict["key1"]);
Assert.Equal(2, MyInt32IReadOnlyDict["key2"]);
Assert.Equal(2, MyInt32IReadOnlyDict.Count);
Assert.True(MyBooleanIReadOnlyDict["key1"]);
Assert.False(MyBooleanIReadOnlyDict["key2"]);
Assert.Equal(2, MyBooleanIReadOnlyDict.Count);
Assert.Equal(1.1f, MySingleIReadOnlyDict["key1"]);
Assert.Equal(2.2f, MySingleIReadOnlyDict["key2"]);
Assert.Equal(2, MySingleIReadOnlyDict.Count);
Assert.Equal(3.3d, MyDoubleIReadOnlyDict["key1"]);
Assert.Equal(4.4d, MyDoubleIReadOnlyDict["key2"]);
Assert.Equal(2, MyDoubleIReadOnlyDict.Count);
Assert.Equal(new DateTime(2019, 1, 30, 12, 1, 2), MyDateTimeIReadOnlyDict["key1"]);
Assert.Equal(new DateTime(2019, 1, 30, 12, 1, 2, DateTimeKind.Utc), MyDateTimeIReadOnlyDict["key2"]);
Assert.Equal(2, MyDateTimeIReadOnlyDict.Count);
}
}
public class TestClassWithObjectIEnumerableConstructibleTypes : ITestClass
{
public Stack<SimpleTestClass> MyStack { get; set; }
public Queue<SimpleTestClass> MyQueue { get; set; }
public HashSet<SimpleTestClass> MyHashSet { get; set; }
public LinkedList<SimpleTestClass> MyLinkedList { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyStack"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyQueue"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyHashSet"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyLinkedList"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
MyStack = new Stack<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyStack.Push(obj);
}
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyStack.Push(obj);
}
MyQueue = new Queue<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyQueue.Enqueue(obj);
}
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyQueue.Enqueue(obj);
}
MyHashSet = new HashSet<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyHashSet.Add(obj);
}
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyHashSet.Add(obj);
}
MyLinkedList = new LinkedList<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyLinkedList.AddLast(obj);
}
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyLinkedList.AddLast(obj);
}
}
public void Verify()
{
Assert.Equal(2, MyStack.Count);
foreach (SimpleTestClass data in MyStack)
{
data.Verify();
}
Assert.Equal(2, MyQueue.Count);
foreach (SimpleTestClass data in MyQueue)
{
data.Verify();
}
Assert.Equal(2, MyHashSet.Count);
foreach (SimpleTestClass data in MyHashSet)
{
data.Verify();
}
Assert.Equal(2, MyLinkedList.Count);
foreach (SimpleTestClass data in MyLinkedList)
{
data.Verify();
}
}
}
public class TestClassWithObjectImmutableTypes : ITestClass
{
public ImmutableArray<SimpleTestClass> MyImmutableArray { get; set; }
public IImmutableList<SimpleTestClass> MyIImmutableList { get; set; }
public IImmutableStack<SimpleTestClass> MyIImmutableStack { get; set; }
public IImmutableQueue<SimpleTestClass> MyIImmutableQueue { get; set; }
public IImmutableSet<SimpleTestClass> MyIImmutableSet { get; set; }
public ImmutableHashSet<SimpleTestClass> MyImmutableHashSet { get; set; }
public ImmutableList<SimpleTestClass> MyImmutableList { get; set; }
public ImmutableStack<SimpleTestClass> MyImmutableStack { get; set; }
public ImmutableQueue<SimpleTestClass> MyImmutableQueue { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyImmutableArray"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyIImmutableList"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyIImmutableStack"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyIImmutableQueue"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyIImmutableSet"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyImmutableHashSet"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyImmutableList"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyImmutableStack"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyImmutableQueue"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyImmutableArray = ImmutableArray.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyIImmutableList = ImmutableList.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyIImmutableStack = ImmutableStack.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyIImmutableQueue = ImmutableQueue.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyIImmutableSet = ImmutableHashSet.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyImmutableHashSet = ImmutableHashSet.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyImmutableList = ImmutableList.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyImmutableStack = ImmutableStack.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyImmutableQueue = ImmutableQueue.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
}
public void Verify()
{
Assert.Equal(2, MyImmutableArray.Length);
foreach (SimpleTestClass data in MyImmutableArray)
{
data.Verify();
}
Assert.Equal(2, MyIImmutableList.Count);
foreach (SimpleTestClass data in MyIImmutableList)
{
data.Verify();
}
int i = 0;
foreach (SimpleTestClass data in MyIImmutableStack)
{
data.Verify();
i++;
}
Assert.Equal(2, i);
i = 0;
foreach (SimpleTestClass data in MyIImmutableQueue)
{
data.Verify();
i++;
}
Assert.Equal(2, i);
Assert.Equal(2, MyIImmutableSet.Count);
foreach (SimpleTestClass data in MyIImmutableSet)
{
data.Verify();
}
Assert.Equal(2, MyImmutableHashSet.Count);
foreach (SimpleTestClass data in MyImmutableHashSet)
{
data.Verify();
}
Assert.Equal(2, MyImmutableList.Count);
foreach (SimpleTestClass data in MyImmutableList)
{
data.Verify();
}
i = 0;
foreach (SimpleTestClass data in MyImmutableStack)
{
data.Verify();
i++;
}
Assert.Equal(2, i);
i = 0;
foreach (SimpleTestClass data in MyImmutableQueue)
{
data.Verify();
i++;
}
Assert.Equal(2, i);
}
}
public class SimpleDerivedTestClass : SimpleTestClass
{
}
public class OverridePropertyNameRuntime_TestClass
{
public Int16 MyInt16 { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""blah"" : 1" +
@"}"
);
}
public class LargeDataTestClass : ITestClass
{
public List<LargeDataChildTestClass> Children { get; set; } = new List<LargeDataChildTestClass>();
public const int ChildrenCount = 10;
public string MyString { get; set; }
public const int MyStringLength = 1000;
public void Initialize()
{
MyString = new string('1', MyStringLength);
for (int i = 0; i < ChildrenCount; i++)
{
var child = new LargeDataChildTestClass
{
MyString = new string('2', LargeDataChildTestClass.MyStringLength),
MyStringArray = new string[LargeDataChildTestClass.MyStringArrayArrayCount]
};
for (int j = 0; j < child.MyStringArray.Length; j++)
{
child.MyStringArray[j] = new string('3', LargeDataChildTestClass.MyStringArrayElementStringLength);
}
Children.Add(child);
}
}
public void Verify()
{
Assert.Equal(MyStringLength, MyString.Length);
Assert.Equal('1', MyString[0]);
Assert.Equal('1', MyString[MyStringLength - 1]);
Assert.Equal(ChildrenCount, Children.Count);
for (int i = 0; i < ChildrenCount; i++)
{
LargeDataChildTestClass child = Children[i];
Assert.Equal(LargeDataChildTestClass.MyStringLength, child.MyString.Length);
Assert.Equal('2', child.MyString[0]);
Assert.Equal('2', child.MyString[LargeDataChildTestClass.MyStringLength - 1]);
Assert.Equal(LargeDataChildTestClass.MyStringArrayArrayCount, child.MyStringArray.Length);
for (int j = 0; j < LargeDataChildTestClass.MyStringArrayArrayCount; j++)
{
Assert.Equal('3', child.MyStringArray[j][0]);
Assert.Equal('3', child.MyStringArray[j][LargeDataChildTestClass.MyStringArrayElementStringLength - 1]);
}
}
}
}
public class LargeDataChildTestClass
{
public const int MyStringLength = 2000;
public string MyString { get; set; }
public string[] MyStringArray { get; set; }
public const int MyStringArrayArrayCount = 1000;
public const int MyStringArrayElementStringLength = 50;
}
public class EmptyClass { }
public class BasicPerson : ITestClass
{
public int age { get; set; }
public string first { get; set; }
public string last { get; set; }
public List<string> phoneNumbers { get; set; }
public BasicJsonAddress address { get; set; }
public void Initialize()
{
age = 30;
first = "John";
last = "Smith";
phoneNumbers = new List<string> { "425-000-0000", "425-000-0001" };
address = new BasicJsonAddress
{
street = "1 Microsoft Way",
city = "Redmond",
zip = 98052
};
}
public void Verify()
{
Assert.Equal(30, age);
Assert.Equal("John", first);
Assert.Equal("Smith", last);
Assert.Equal("425-000-0000", phoneNumbers[0]);
Assert.Equal("425-000-0001", phoneNumbers[1]);
Assert.Equal("1 Microsoft Way", address.street);
Assert.Equal("Redmond", address.city);
Assert.Equal(98052, address.zip);
}
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
"{" +
@"""age"" : 30," +
@"""first"" : ""John""," +
@"""last"" : ""Smith""," +
@"""phoneNumbers"" : [" +
@"""425-000-0000""," +
@"""425-000-0001""" +
@"]," +
@"""address"" : {" +
@"""street"" : ""1 Microsoft Way""," +
@"""city"" : ""Redmond""," +
@"""zip"" : 98052" +
"}" +
"}");
}
public class BasicJsonAddress
{
public string street { get; set; }
public string city { get; set; }
public int zip { get; set; }
}
public class BasicCompany : ITestClass
{
public List<BasicJsonAddress> sites { get; set; }
public BasicJsonAddress mainSite { get; set; }
public string name { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
"{\n" +
@"""name"" : ""Microsoft""," + "\n" +
@"""sites"" :[" + "\n" +
"{\n" +
@"""street"" : ""1 Lone Tree Rd S""," + "\n" +
@"""city"" : ""Fargo""," + "\n" +
@"""zip"" : 58104" + "\n" +
"},\n" +
"{\n" +
@"""street"" : ""8055 Microsoft Way""," + "\n" +
@"""city"" : ""Charlotte""," + "\n" +
@"""zip"" : 28273" + "\n" +
"}\n" +
"],\n" +
@"""mainSite"":" + "\n" +
"{\n" +
@"""street"" : ""1 Microsoft Way""," + "\n" +
@"""city"" : ""Redmond""," + "\n" +
@"""zip"" : 98052" + "\n" +
"}\n" +
"}");
public void Initialize()
{
name = "Microsoft";
sites = new List<BasicJsonAddress>
{
new BasicJsonAddress
{
street = "1 Lone Tree Rd S",
city = "Fargo",
zip = 58104
},
new BasicJsonAddress
{
street = "8055 Microsoft Way",
city = "Charlotte",
zip = 28273
}
};
mainSite =
new BasicJsonAddress
{
street = "1 Microsoft Way",
city = "Redmond",
zip = 98052
};
}
public void Verify()
{
Assert.Equal("Microsoft", name);
Assert.Equal("1 Lone Tree Rd S", sites[0].street);
Assert.Equal("Fargo", sites[0].city);
Assert.Equal(58104, sites[0].zip);
Assert.Equal("8055 Microsoft Way", sites[1].street);
Assert.Equal("Charlotte", sites[1].city);
Assert.Equal(28273, sites[1].zip);
Assert.Equal("1 Microsoft Way", mainSite.street);
Assert.Equal("Redmond", mainSite.city);
Assert.Equal(98052, mainSite.zip);
}
}
public class ClassWithUnicodeProperty
{
public int A\u0467 { get; set; }
// A 400 character property name with a unicode character making it 401 bytes.
public int A\u046734567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 { get; set; }
}
public class ClassWithExtensionProperty
{
public SimpleTestClass MyNestedClass { get; set; }
public int MyInt { get; set; }
[JsonExtensionData]
public IDictionary<string, JsonElement> MyOverflow { get; set; }
}
public class ClassWithExtensionField
{
public SimpleTestClass MyNestedClass { get; set; }
public int MyInt { get; set; }
[JsonInclude]
[JsonExtensionData]
public IDictionary<string, JsonElement> MyOverflow;
}
public class TestClassWithNestedObjectCommentsInner : ITestClass
{
public SimpleTestClass MyData { get; set; }
public static readonly string s_json =
@"{" +
@"""MyData"":" + SimpleTestClass.s_json + " // Trailing comment\n" +
"/* Multi\nLine Comment with } */\n" +
@"}";
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(s_json);
public void Initialize()
{
MyData = new SimpleTestClass();
MyData.Initialize();
}
public void Verify()
{
Assert.NotNull(MyData);
MyData.Verify();
}
}
public class TestClassWithNestedObjectCommentsOuter : ITestClass
{
public TestClassWithNestedObjectCommentsInner MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
" // This } will be ignored\n" +
@"""MyData"":" + TestClassWithNestedObjectCommentsInner.s_json +
" /* As will this [ */\n" +
@"}");
public void Initialize()
{
MyData = new TestClassWithNestedObjectCommentsInner();
MyData.Initialize();
}
public void Verify()
{
Assert.NotNull(MyData);
MyData.Verify();
}
}
public class ClassWithType<T>
{
public T Prop { get; set; }
}
public class ConverterForInt32 : JsonConverter<int>
{
public override int Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return 25;
}
public override void Write(Utf8JsonWriter writer, int value, JsonSerializerOptions options)
{
throw new NotImplementedException("Converter was called");
}
}
public class SimpleSnakeCasePolicy : JsonNamingPolicy
{
public override string ConvertName(string name)
{
return string.Concat(name.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToLower();
}
}
public static class CollectionTestTypes
{
public static IEnumerable<Type> EnumerableTypes<TElement>()
{
yield return typeof(TElement[]); // ArrayConverter
yield return typeof(ConcurrentQueue<TElement>); // ConcurrentQueueOfTConverter
yield return typeof(GenericICollectionWrapper<TElement>); // ICollectionOfTConverter
yield return typeof(WrapperForIEnumerable); // IEnumerableConverter
yield return typeof(WrapperForIReadOnlyCollectionOfT<TElement>); // IEnumerableOfTConverter
yield return typeof(Queue); // IEnumerableWithAddMethodConverter
yield return typeof(WrapperForIList); // IListConverter
yield return typeof(Collection<TElement>); // IListOfTConverter
yield return typeof(ImmutableList<TElement>); // ImmutableEnumerableOfTConverter
yield return typeof(HashSet<TElement>); // ISetOfTConverter
yield return typeof(List<TElement>); // ListOfTConverter
yield return typeof(Queue<TElement>); // QueueOfTConverter
}
public static IEnumerable<Type> DeserializableGenericEnumerableTypes<TElement>()
{
yield return typeof(TElement[]); // ArrayConverter
yield return typeof(ConcurrentQueue<TElement>); // ConcurrentQueueOfTConverter
yield return typeof(GenericICollectionWrapper<TElement>); // ICollectionOfTConverter
yield return typeof(IEnumerable<TElement>); // IEnumerableConverter
yield return typeof(Collection<TElement>); // IListOfTConverter
yield return typeof(ImmutableList<TElement>); // ImmutableEnumerableOfTConverter
yield return typeof(HashSet<TElement>); // ISetOfTConverter
yield return typeof(List<TElement>); // ListOfTConverter
yield return typeof(Queue<TElement>); // QueueOfTConverter
}
public static IEnumerable<Type> DeserializableNonGenericEnumerableTypes()
{
yield return typeof(Queue); // IEnumerableWithAddMethodConverter
yield return typeof(WrapperForIList); // IListConverter
}
public static IEnumerable<Type> DictionaryTypes<TElement>()
{
yield return typeof(Dictionary<string, TElement>); // DictionaryOfStringTValueConverter
yield return typeof(Hashtable); // IDictionaryConverter
yield return typeof(ConcurrentDictionary<string, TElement>); // IDictionaryOfStringTValueConverter
yield return typeof(GenericIDictionaryWrapper<string, TElement>); // IDictionaryOfStringTValueConverter
yield return typeof(ImmutableDictionary<string, TElement>); // ImmutableDictionaryOfStringTValueConverter
yield return typeof(GenericIReadOnlyDictionaryWrapper<string, TElement>); // IReadOnlyDictionaryOfStringTValueConverter
}
public static IEnumerable<Type> DeserializableDictionaryTypes<TKey, TValue>()
{
yield return typeof(Dictionary<TKey, TValue>); // DictionaryOfStringTValueConverter
yield return typeof(Hashtable); // IDictionaryConverter
yield return typeof(IDictionary); // IDictionaryConverter
yield return typeof(ConcurrentDictionary<TKey, TValue>); // IDictionaryOfStringTValueConverter
yield return typeof(IDictionary<TKey, TValue>); // IDictionaryOfStringTValueConverter
yield return typeof(GenericIDictionaryWrapper<TKey, TValue>); // IDictionaryOfStringTValueConverter
yield return typeof(ImmutableDictionary<TKey, TValue>); // ImmutableDictionaryOfStringTValueConverter
yield return typeof(IReadOnlyDictionary<TKey, TValue>); // IReadOnlyDictionaryOfStringTValueConverter
}
public static IEnumerable<Type> DeserializableNonGenericDictionaryTypes()
{
yield return typeof(Hashtable); // IDictionaryConverter
yield return typeof(SortedList); // IDictionaryConverter
}
}
public class PocoDictionary
{
public Dictionary<string, string> key { get; set; }
}
public class Poco
{
public int Id { get; set; }
}
public class UppercaseNamingPolicy : JsonNamingPolicy
{
public override string ConvertName(string name)
{
return name.ToUpperInvariant();
}
}
public class NullNamingPolicy : JsonNamingPolicy
{
public override string ConvertName(string name)
{
return null;
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Collections.ObjectModel;
using System.Linq;
using Xunit;
namespace System.Text.Json.Serialization.Tests
{
public interface ITestClass
{
void Initialize();
void Verify();
}
public enum SampleEnumByte : byte
{
MinZero = byte.MinValue,
One = 1,
Two = 2,
Max = byte.MaxValue
}
public enum SampleEnumSByte : sbyte
{
MinNegative = sbyte.MinValue,
Zero = 0,
One = 1,
Two = 2,
Max = sbyte.MaxValue
}
public enum SampleEnum
{
MinZero = 0,
One = 1,
Two = 2
}
public enum SampleEnumInt16 : short
{
MinNegative = short.MinValue,
Zero = 0,
One = 1,
Two = 2,
Max = short.MaxValue
}
public enum SampleEnumUInt16 : ushort
{
MinZero = ushort.MinValue,
One = 1,
Two = 2,
Max = ushort.MaxValue
}
public enum SampleEnumInt32 : Int32
{
MinNegative = Int32.MinValue,
Zero = 0,
One = 1,
Two = 2,
Max = Int32.MaxValue
}
public enum SampleEnumUInt32 : UInt32
{
MinZero = UInt32.MinValue,
One = 1,
Two = 2,
Max = UInt32.MaxValue
}
public enum SampleEnumInt64 : long
{
MinNegative = long.MinValue,
Zero = 0,
One = 1,
Two = 2,
Max = long.MaxValue
}
public enum SampleEnumUInt64 : ulong
{
MinZero = ulong.MinValue,
One = 1,
Two = 2,
Max = ulong.MaxValue
}
public struct SimpleStruct
{
public int One { get; set; }
public double Two { get; set; }
}
public struct SimpleStructWithSimpleClass: ITestClass
{
public short MyInt32 { get; set; }
public SimpleTestClass MySimpleClass { get; set; }
public int[] MyInt32Array { get; set; }
public static readonly string s_json =
@"{" +
@"""MySimpleClass"" : {""MyString"" : ""Hello"", ""MyDouble"" : 3.14}," +
@"""MyInt32"" : 32," +
@"""MyInt32Array"" : [32]" +
@"}";
public void Initialize()
{
MySimpleClass = new SimpleTestClass { MyString = "Hello", MyDouble = 3.14 };
MyInt32 = 32;
MyInt32Array = new int[] { 32 };
}
public void Verify()
{
Assert.Equal(32, MyInt32);
Assert.Equal(32, MyInt32Array[0]);
Assert.Equal("Hello", MySimpleClass.MyString);
Assert.Equal(3.14, MySimpleClass.MyDouble);
}
}
public class TestClassWithNull
{
public string MyString { get; set; }
public static readonly string s_json =
@"{" +
@"""MyString"" : null" +
@"}";
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(s_json);
public void Verify()
{
Assert.Null(MyString);
}
}
public class TestClassWithInitializedProperties
{
public string MyString { get; set; } = "Hello";
public int? MyInt { get; set; } = 1;
public DateTime? MyDateTime { get; set; } = new DateTime(1995, 4, 16);
public int[] MyIntArray { get; set; } = new int[] { 1 };
public List<int> MyIntList { get; set; } = new List<int> { 1 };
public List<int?> MyNullableIntList { get; set; } = new List<int?> { 1 };
public List<object> MyObjectList { get; set; } = new List<object> { 1 };
public List<List<object>> MyListList { get; set; } = new List<List<object>> { new List<object> { 1 } };
public List<Dictionary<string, string>> MyDictionaryList { get; set; } = new List<Dictionary<string, string>> {
new Dictionary<string, string> { ["key"] = "value" }
};
public Dictionary<string, string> MyStringDictionary { get; set; } = new Dictionary<string, string> { ["key"] = "value" };
public Dictionary<string, DateTime?> MyNullableDateTimeDictionary { get; set; } = new Dictionary<string, DateTime?> { ["key"] = new DateTime(1995, 04, 16) };
public Dictionary<string, object> MyObjectDictionary { get; set; } = new Dictionary<string, object> { ["key"] = "value" };
public Dictionary<string, Dictionary<string, string>> MyStringDictionaryDictionary { get; set; } = new Dictionary<string, Dictionary<string, string>>
{
["key"] = new Dictionary<string, string>
{
["key"] = "value"
}
};
public Dictionary<string, List<object>> MyListDictionary { get; set; } = new Dictionary<string, List<object>> {
["key"] = new List<object> { "value" }
};
public Dictionary<string, Dictionary<string, object>> MyObjectDictionaryDictionary { get; set; } = new Dictionary<string, Dictionary<string, object>>
{
["key"] = new Dictionary<string, object>
{
["key"] = "value"
}
};
public static readonly string s_null_json =
@"{" +
@"""MyString"" : null," +
@"""MyInt"" : null," +
@"""MyDateTime"" : null," +
@"""MyIntArray"" : null," +
@"""MyIntList"" : null," +
@"""MyNullableIntList"" : null," +
@"""MyObjectList"" : [null]," +
@"""MyListList"" : [[null]]," +
@"""MyDictionaryList"" : [{""key"" : null}]," +
@"""MyStringDictionary"" : {""key"" : null}," +
@"""MyNullableDateTimeDictionary"" : {""key"" : null}," +
@"""MyObjectDictionary"" : {""key"" : null}," +
@"""MyStringDictionaryDictionary"" : {""key"" : {""key"" : null}}," +
@"""MyListDictionary"" : {""key"" : [null]}," +
@"""MyObjectDictionaryDictionary"" : {""key"" : {""key"" : null}}" +
@"}";
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(s_null_json);
}
public class TestClassWithNestedObjectInner : ITestClass
{
public SimpleTestClass MyData { get; set; }
public static readonly string s_json =
@"{" +
@"""MyData"":" + SimpleTestClass.s_json +
@"}";
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(s_json);
public void Initialize()
{
MyData = new SimpleTestClass();
MyData.Initialize();
}
public void Verify()
{
Assert.NotNull(MyData);
MyData.Verify();
}
}
public class TestClassWithNestedObjectOuter : ITestClass
{
public TestClassWithNestedObjectInner MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":" + TestClassWithNestedObjectInner.s_json +
@"}");
public void Initialize()
{
MyData = new TestClassWithNestedObjectInner();
MyData.Initialize();
}
public void Verify()
{
Assert.NotNull(MyData);
MyData.Verify();
}
}
public class TestClassWithObjectList : ITestClass
{
public List<SimpleTestClass> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
"null," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyData.Add(obj);
}
MyData.Add(null);
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyData.Add(obj);
}
}
public void Verify()
{
Assert.Equal(3, MyData.Count);
MyData[0].Verify();
Assert.Null(MyData[1]);
MyData[2].Verify();
}
}
public class TestClassWithObjectArray : ITestClass
{
public SimpleTestClass[] MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyData = new SimpleTestClass[2] { obj1, obj2 };
}
public void Verify()
{
MyData[0].Verify();
MyData[1].Verify();
Assert.Equal(2, MyData.Length);
}
}
public class TestClassWithObjectIEnumerableT : ITestClass
{
public IEnumerable<SimpleTestClass> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyData = new SimpleTestClass[] { obj1, obj2 };
}
public void Verify()
{
int count = 0;
foreach (SimpleTestClass data in MyData)
{
data.Verify();
count++;
}
Assert.Equal(2, count);
}
}
public class TestClassWithObjectIListT : ITestClass
{
public IList<SimpleTestClass> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyData.Add(obj);
}
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyData.Add(obj);
}
}
public void Verify()
{
Assert.Equal(2, MyData.Count);
MyData[0].Verify();
MyData[1].Verify();
}
}
public class TestClassWithObjectICollectionT : ITestClass
{
public ICollection<SimpleTestClass> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyData.Add(obj);
}
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyData.Add(obj);
}
}
public void Verify()
{
Assert.Equal(2, MyData.Count);
foreach (SimpleTestClass data in MyData)
{
data.Verify();
}
}
}
public class TestClassWithObjectIEnumerable : ITestClass
{
public IEnumerable MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyData = new SimpleTestClass[] { obj1, obj2 };
}
public void Verify()
{
int count = 0;
foreach (object data in MyData)
{
if (data is JsonElement element)
{
SimpleTestClass obj = JsonSerializer.Deserialize<SimpleTestClass>(element.GetRawText());
obj.Verify();
}
else
{
((SimpleTestClass)data).Verify();
}
count++;
}
Assert.Equal(2, count);
}
}
public class TestClassWithObjectIList : ITestClass
{
public IList MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyData.Add(obj);
}
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyData.Add(obj);
}
}
public void Verify()
{
int count = 0;
foreach (object data in MyData)
{
if (data is JsonElement element)
{
SimpleTestClass obj = JsonSerializer.Deserialize<SimpleTestClass>(element.GetRawText());
obj.Verify();
}
else
{
((SimpleTestClass)data).Verify();
}
count++;
}
Assert.Equal(2, count);
}
}
public class TestClassWithObjectICollection : ITestClass
{
public ICollection MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
List<SimpleTestClass> dataTemp = new List<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
dataTemp.Add(obj);
}
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
dataTemp.Add(obj);
}
MyData = dataTemp;
}
public void Verify()
{
int count = 0;
foreach (object data in MyData)
{
if (data is JsonElement element)
{
SimpleTestClass obj = JsonSerializer.Deserialize<SimpleTestClass>(element.GetRawText());
obj.Verify();
}
else
{
((SimpleTestClass)data).Verify();
}
count++;
}
Assert.Equal(2, count);
}
}
public class TestClassWithObjectIReadOnlyCollectionT : ITestClass
{
public IReadOnlyCollection<SimpleTestClass> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyData = new SimpleTestClass[] { obj1, obj2 };
}
public void Verify()
{
Assert.Equal(2, MyData.Count);
foreach (SimpleTestClass data in MyData)
{
data.Verify();
}
}
}
public class TestClassWithObjectIReadOnlyListT : ITestClass
{
public IReadOnlyList<SimpleTestClass> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyData = new SimpleTestClass[] { obj1, obj2 };
}
public void Verify()
{
Assert.Equal(2, MyData.Count);
MyData[0].Verify();
MyData[1].Verify();
}
}
public class TestClassWithObjectISetT : ITestClass
{
public ISet<SimpleTestClass> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyData = new HashSet<SimpleTestClass> { obj1, obj2 };
}
public void Verify()
{
Assert.Equal(2, MyData.Count);
foreach (SimpleTestClass obj in MyData)
{
obj.Verify();
}
}
}
public class TestClassWithInitializedArray
{
public int[] Values { get; set; }
public TestClassWithInitializedArray()
{
Values = Array.Empty<int>();
}
}
public class SimpleClassWithDictionary
{
public int MyInt { get; set; }
public Dictionary<string, string> MyDictionary { get; set; }
}
public class OuterClassHavingPropertiesDefinedAfterClassWithDictionary
{
public double MyDouble { get; set; }
public SimpleClassWithDictionary MyInnerTestClass { get; set; }
public int MyInt { get; set; }
public string MyString { get; set; }
public List<string> MyList { get; set; }
public int[] MyIntArray { get; set; }
}
public class TestClassWithStringArray : ITestClass
{
public string[] MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new string[] { "Hello", "World" };
}
public void Verify()
{
Assert.Equal("Hello", MyData[0]);
Assert.Equal("World", MyData[1]);
Assert.Equal(2, MyData.Length);
}
}
public class TestClassWithGenericList : ITestClass
{
public List<string> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
Assert.Equal(2, MyData.Count);
}
public void Verify()
{
Assert.Equal("Hello", MyData[0]);
Assert.Equal("World", MyData[1]);
Assert.Equal(2, MyData.Count);
}
}
public class TestClassWithGenericIEnumerable : ITestClass
{
public IEnumerable MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
int count = 0;
foreach (string data in MyData)
{
count++;
}
Assert.Equal(2, count);
}
public void Verify()
{
string[] expected = { "Hello", "World" };
int count = 0;
foreach (object data in MyData)
{
if (data is JsonElement element)
{
Assert.Equal(expected[count], element.GetString());
}
else
{
Assert.Equal(expected[count], (string)data);
}
count++;
}
Assert.Equal(2, count);
}
}
public class TestClassWithGenericIList : ITestClass
{
public IList MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
Assert.Equal(2, MyData.Count);
}
public void Verify()
{
string[] expected = { "Hello", "World" };
int count = 0;
foreach (object data in MyData)
{
if (data is JsonElement element)
{
Assert.Equal(expected[count], element.GetString());
}
else
{
Assert.Equal(expected[count], (string)data);
}
count++;
}
Assert.Equal(2, count);
}
}
public class TestClassWithGenericICollection : ITestClass
{
public ICollection MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
Assert.Equal(2, MyData.Count);
}
public void Verify()
{
string[] expected = { "Hello", "World" };
int count = 0;
foreach (object data in MyData)
{
if (data is JsonElement element)
{
Assert.Equal(expected[count], element.GetString());
}
else
{
Assert.Equal(expected[count], (string)data);
}
count++;
}
Assert.Equal(2, count);
}
}
public class TestClassWithGenericIEnumerableT : ITestClass
{
public IEnumerable<string> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
int count = 0;
foreach (string data in MyData)
{
count++;
}
Assert.Equal(2, count);
}
public void Verify()
{
string[] expected = { "Hello", "World" };
int count = 0;
foreach (string data in MyData)
{
Assert.Equal(expected[count], data);
count++;
}
Assert.Equal(2, count);
}
}
public class TestClassWithGenericIListT : ITestClass
{
public IList<string> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
Assert.Equal(2, MyData.Count);
}
public void Verify()
{
Assert.Equal("Hello", MyData[0]);
Assert.Equal("World", MyData[1]);
Assert.Equal(2, MyData.Count);
}
}
public class TestClassWithGenericICollectionT : ITestClass
{
public ICollection<string> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
Assert.Equal(2, MyData.Count);
}
public void Verify()
{
string[] expected = { "Hello", "World" };
int i = 0;
foreach (string data in MyData)
{
Assert.Equal(expected[i++], data);
}
Assert.Equal(2, MyData.Count);
}
}
public class TestClassWithGenericIReadOnlyCollectionT : ITestClass
{
public IReadOnlyCollection<string> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
Assert.Equal(2, MyData.Count);
}
public void Verify()
{
string[] expected = { "Hello", "World" };
int i = 0;
foreach (string data in MyData)
{
Assert.Equal(expected[i++], data);
}
Assert.Equal(2, MyData.Count);
}
}
public class TestClassWithGenericIReadOnlyListT : ITestClass
{
public IReadOnlyList<string> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new List<string>
{
"Hello",
"World"
};
Assert.Equal(2, MyData.Count);
}
public void Verify()
{
Assert.Equal("Hello", MyData[0]);
Assert.Equal("World", MyData[1]);
Assert.Equal(2, MyData.Count);
}
}
public class TestClassWithGenericISetT : ITestClass
{
public ISet<string> MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyData"":[" +
@"""Hello""," +
@"""World""" +
@"]" +
@"}");
public void Initialize()
{
MyData = new HashSet<string>
{
"Hello",
"World"
};
Assert.Equal(2, MyData.Count);
}
public void Verify()
{
Assert.Equal(2, MyData.Count);
bool helloSeen = false;
bool worldSeen = false;
foreach (string data in MyData)
{
if (data == "Hello")
{
helloSeen = true;
}
else if (data == "World")
{
worldSeen = true;
}
}
Assert.True(helloSeen && worldSeen);
}
}
public class TestClassWithStringToPrimitiveDictionary : ITestClass
{
public Dictionary<string, int> MyInt32Dict { get; set; }
public Dictionary<string, bool> MyBooleanDict { get; set; }
public Dictionary<string, float> MySingleDict { get; set; }
public Dictionary<string, double> MyDoubleDict { get; set; }
public Dictionary<string, DateTime> MyDateTimeDict { get; set; }
public IDictionary<string, int> MyInt32IDict { get; set; }
public IDictionary<string, bool> MyBooleanIDict { get; set; }
public IDictionary<string, float> MySingleIDict { get; set; }
public IDictionary<string, double> MyDoubleIDict { get; set; }
public IDictionary<string, DateTime> MyDateTimeIDict { get; set; }
public IReadOnlyDictionary<string, int> MyInt32IReadOnlyDict { get; set; }
public IReadOnlyDictionary<string, bool> MyBooleanIReadOnlyDict { get; set; }
public IReadOnlyDictionary<string, float> MySingleIReadOnlyDict { get; set; }
public IReadOnlyDictionary<string, double> MyDoubleIReadOnlyDict { get; set; }
public IReadOnlyDictionary<string, DateTime> MyDateTimeIReadOnlyDict { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyInt32Dict"":{" +
@"""key1"": 1," +
@"""key2"": 2" +
@"}," +
@"""MyBooleanDict"":{" +
@"""key1"": true," +
@"""key2"": false" +
@"}," +
@"""MySingleDict"":{" +
@"""key1"": 1.1," +
@"""key2"": 2.2" +
@"}," +
@"""MyDoubleDict"":{" +
@"""key1"": 3.3," +
@"""key2"": 4.4" +
@"}," +
@"""MyDateTimeDict"":{" +
@"""key1"": ""2019-01-30T12:01:02.0000000""," +
@"""key2"": ""2019-01-30T12:01:02.0000000Z""" +
@"}," +
@"""MyInt32IDict"":{" +
@"""key1"": 1," +
@"""key2"": 2" +
@"}," +
@"""MyBooleanIDict"":{" +
@"""key1"": true," +
@"""key2"": false" +
@"}," +
@"""MySingleIDict"":{" +
@"""key1"": 1.1," +
@"""key2"": 2.2" +
@"}," +
@"""MyDoubleIDict"":{" +
@"""key1"": 3.3," +
@"""key2"": 4.4" +
@"}," +
@"""MyDateTimeIDict"":{" +
@"""key1"": ""2019-01-30T12:01:02.0000000""," +
@"""key2"": ""2019-01-30T12:01:02.0000000Z""" +
@"}," +
@"""MyInt32IReadOnlyDict"":{" +
@"""key1"": 1," +
@"""key2"": 2" +
@"}," +
@"""MyBooleanIReadOnlyDict"":{" +
@"""key1"": true," +
@"""key2"": false" +
@"}," +
@"""MySingleIReadOnlyDict"":{" +
@"""key1"": 1.1," +
@"""key2"": 2.2" +
@"}," +
@"""MyDoubleIReadOnlyDict"":{" +
@"""key1"": 3.3," +
@"""key2"": 4.4" +
@"}," +
@"""MyDateTimeIReadOnlyDict"":{" +
@"""key1"": ""2019-01-30T12:01:02.0000000""," +
@"""key2"": ""2019-01-30T12:01:02.0000000Z""" +
@"}" +
@"}");
public void Initialize()
{
MyInt32Dict = new Dictionary<string, int> { { "key1", 1 }, { "key2", 2 } };
MyBooleanDict = new Dictionary<string, bool> { { "key1", true }, { "key2", false } };
MySingleDict = new Dictionary<string, float> { { "key1", 1.1f }, { "key2", 2.2f } };
MyDoubleDict = new Dictionary<string, double> { { "key1", 3.3d }, { "key2", 4.4d } };
MyDateTimeDict = new Dictionary<string, DateTime> { { "key1", new DateTime(2019, 1, 30, 12, 1, 2) }, { "key2", new DateTime(2019, 1, 30, 12, 1, 2, DateTimeKind.Utc) } };
MyInt32IDict = new Dictionary<string, int> { { "key1", 1 }, { "key2", 2 } };
MyBooleanIDict = new Dictionary<string, bool> { { "key1", true }, { "key2", false } };
MySingleIDict = new Dictionary<string, float> { { "key1", 1.1f }, { "key2", 2.2f } };
MyDoubleIDict = new Dictionary<string, double> { { "key1", 3.3d }, { "key2", 4.4d } };
MyDateTimeIDict = new Dictionary<string, DateTime> { { "key1", new DateTime(2019, 1, 30, 12, 1, 2) }, { "key2", new DateTime(2019, 1, 30, 12, 1, 2, DateTimeKind.Utc) } };
MyInt32IReadOnlyDict = new Dictionary<string, int> { { "key1", 1 }, { "key2", 2 } };
MyBooleanIReadOnlyDict = new Dictionary<string, bool> { { "key1", true }, { "key2", false } };
MySingleIReadOnlyDict = new Dictionary<string, float> { { "key1", 1.1f }, { "key2", 2.2f } };
MyDoubleIReadOnlyDict = new Dictionary<string, double> { { "key1", 3.3d }, { "key2", 4.4d } };
MyDateTimeIReadOnlyDict = new Dictionary<string, DateTime> { { "key1", new DateTime(2019, 1, 30, 12, 1, 2) }, { "key2", new DateTime(2019, 1, 30, 12, 1, 2, DateTimeKind.Utc) } };
}
public void Verify()
{
Assert.Equal(1, MyInt32Dict["key1"]);
Assert.Equal(2, MyInt32Dict["key2"]);
Assert.Equal(2, MyInt32Dict.Count);
Assert.True(MyBooleanDict["key1"]);
Assert.False(MyBooleanDict["key2"]);
Assert.Equal(2, MyBooleanDict.Count);
Assert.Equal(1.1f, MySingleDict["key1"]);
Assert.Equal(2.2f, MySingleDict["key2"]);
Assert.Equal(2, MySingleDict.Count);
Assert.Equal(3.3d, MyDoubleDict["key1"]);
Assert.Equal(4.4d, MyDoubleDict["key2"]);
Assert.Equal(2, MyDoubleDict.Count);
Assert.Equal(new DateTime(2019, 1, 30, 12, 1, 2), MyDateTimeDict["key1"]);
Assert.Equal(new DateTime(2019, 1, 30, 12, 1, 2, DateTimeKind.Utc), MyDateTimeDict["key2"]);
Assert.Equal(2, MyDateTimeDict.Count);
Assert.Equal(1, MyInt32IDict["key1"]);
Assert.Equal(2, MyInt32IDict["key2"]);
Assert.Equal(2, MyInt32IDict.Count);
Assert.True(MyBooleanIDict["key1"]);
Assert.False(MyBooleanIDict["key2"]);
Assert.Equal(2, MyBooleanIDict.Count);
Assert.Equal(1.1f, MySingleIDict["key1"]);
Assert.Equal(2.2f, MySingleIDict["key2"]);
Assert.Equal(2, MySingleIDict.Count);
Assert.Equal(3.3d, MyDoubleIDict["key1"]);
Assert.Equal(4.4d, MyDoubleIDict["key2"]);
Assert.Equal(2, MyDoubleIDict.Count);
Assert.Equal(new DateTime(2019, 1, 30, 12, 1, 2), MyDateTimeIDict["key1"]);
Assert.Equal(new DateTime(2019, 1, 30, 12, 1, 2, DateTimeKind.Utc), MyDateTimeIDict["key2"]);
Assert.Equal(2, MyDateTimeIDict.Count);
Assert.Equal(1, MyInt32IReadOnlyDict["key1"]);
Assert.Equal(2, MyInt32IReadOnlyDict["key2"]);
Assert.Equal(2, MyInt32IReadOnlyDict.Count);
Assert.True(MyBooleanIReadOnlyDict["key1"]);
Assert.False(MyBooleanIReadOnlyDict["key2"]);
Assert.Equal(2, MyBooleanIReadOnlyDict.Count);
Assert.Equal(1.1f, MySingleIReadOnlyDict["key1"]);
Assert.Equal(2.2f, MySingleIReadOnlyDict["key2"]);
Assert.Equal(2, MySingleIReadOnlyDict.Count);
Assert.Equal(3.3d, MyDoubleIReadOnlyDict["key1"]);
Assert.Equal(4.4d, MyDoubleIReadOnlyDict["key2"]);
Assert.Equal(2, MyDoubleIReadOnlyDict.Count);
Assert.Equal(new DateTime(2019, 1, 30, 12, 1, 2), MyDateTimeIReadOnlyDict["key1"]);
Assert.Equal(new DateTime(2019, 1, 30, 12, 1, 2, DateTimeKind.Utc), MyDateTimeIReadOnlyDict["key2"]);
Assert.Equal(2, MyDateTimeIReadOnlyDict.Count);
}
}
public class TestClassWithObjectIEnumerableConstructibleTypes : ITestClass
{
public Stack<SimpleTestClass> MyStack { get; set; }
public Queue<SimpleTestClass> MyQueue { get; set; }
public HashSet<SimpleTestClass> MyHashSet { get; set; }
public LinkedList<SimpleTestClass> MyLinkedList { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyStack"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyQueue"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyHashSet"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyLinkedList"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
MyStack = new Stack<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyStack.Push(obj);
}
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyStack.Push(obj);
}
MyQueue = new Queue<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyQueue.Enqueue(obj);
}
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyQueue.Enqueue(obj);
}
MyHashSet = new HashSet<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyHashSet.Add(obj);
}
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyHashSet.Add(obj);
}
MyLinkedList = new LinkedList<SimpleTestClass>();
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyLinkedList.AddLast(obj);
}
{
SimpleTestClass obj = new SimpleTestClass();
obj.Initialize();
MyLinkedList.AddLast(obj);
}
}
public void Verify()
{
Assert.Equal(2, MyStack.Count);
foreach (SimpleTestClass data in MyStack)
{
data.Verify();
}
Assert.Equal(2, MyQueue.Count);
foreach (SimpleTestClass data in MyQueue)
{
data.Verify();
}
Assert.Equal(2, MyHashSet.Count);
foreach (SimpleTestClass data in MyHashSet)
{
data.Verify();
}
Assert.Equal(2, MyLinkedList.Count);
foreach (SimpleTestClass data in MyLinkedList)
{
data.Verify();
}
}
}
public class TestClassWithObjectImmutableTypes : ITestClass
{
public ImmutableArray<SimpleTestClass> MyImmutableArray { get; set; }
public IImmutableList<SimpleTestClass> MyIImmutableList { get; set; }
public IImmutableStack<SimpleTestClass> MyIImmutableStack { get; set; }
public IImmutableQueue<SimpleTestClass> MyIImmutableQueue { get; set; }
public IImmutableSet<SimpleTestClass> MyIImmutableSet { get; set; }
public ImmutableHashSet<SimpleTestClass> MyImmutableHashSet { get; set; }
public ImmutableList<SimpleTestClass> MyImmutableList { get; set; }
public ImmutableStack<SimpleTestClass> MyImmutableStack { get; set; }
public ImmutableQueue<SimpleTestClass> MyImmutableQueue { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""MyImmutableArray"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyIImmutableList"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyIImmutableStack"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyIImmutableQueue"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyIImmutableSet"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyImmutableHashSet"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyImmutableList"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyImmutableStack"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]," +
@"""MyImmutableQueue"":[" +
SimpleTestClass.s_json + "," +
SimpleTestClass.s_json +
@"]" +
@"}");
public void Initialize()
{
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyImmutableArray = ImmutableArray.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyIImmutableList = ImmutableList.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyIImmutableStack = ImmutableStack.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyIImmutableQueue = ImmutableQueue.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyIImmutableSet = ImmutableHashSet.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyImmutableHashSet = ImmutableHashSet.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyImmutableList = ImmutableList.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyImmutableStack = ImmutableStack.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
{
SimpleTestClass obj1 = new SimpleTestClass();
obj1.Initialize();
SimpleTestClass obj2 = new SimpleTestClass();
obj2.Initialize();
MyImmutableQueue = ImmutableQueue.CreateRange(new List<SimpleTestClass> { obj1, obj2 });
}
}
public void Verify()
{
Assert.Equal(2, MyImmutableArray.Length);
foreach (SimpleTestClass data in MyImmutableArray)
{
data.Verify();
}
Assert.Equal(2, MyIImmutableList.Count);
foreach (SimpleTestClass data in MyIImmutableList)
{
data.Verify();
}
int i = 0;
foreach (SimpleTestClass data in MyIImmutableStack)
{
data.Verify();
i++;
}
Assert.Equal(2, i);
i = 0;
foreach (SimpleTestClass data in MyIImmutableQueue)
{
data.Verify();
i++;
}
Assert.Equal(2, i);
Assert.Equal(2, MyIImmutableSet.Count);
foreach (SimpleTestClass data in MyIImmutableSet)
{
data.Verify();
}
Assert.Equal(2, MyImmutableHashSet.Count);
foreach (SimpleTestClass data in MyImmutableHashSet)
{
data.Verify();
}
Assert.Equal(2, MyImmutableList.Count);
foreach (SimpleTestClass data in MyImmutableList)
{
data.Verify();
}
i = 0;
foreach (SimpleTestClass data in MyImmutableStack)
{
data.Verify();
i++;
}
Assert.Equal(2, i);
i = 0;
foreach (SimpleTestClass data in MyImmutableQueue)
{
data.Verify();
i++;
}
Assert.Equal(2, i);
}
}
public class SimpleDerivedTestClass : SimpleTestClass
{
}
public class OverridePropertyNameRuntime_TestClass
{
public Int16 MyInt16 { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
@"""blah"" : 1" +
@"}"
);
}
public class LargeDataTestClass : ITestClass
{
public List<LargeDataChildTestClass> Children { get; set; } = new List<LargeDataChildTestClass>();
public const int ChildrenCount = 10;
public string MyString { get; set; }
public const int MyStringLength = 1000;
public void Initialize()
{
MyString = new string('1', MyStringLength);
for (int i = 0; i < ChildrenCount; i++)
{
var child = new LargeDataChildTestClass
{
MyString = new string('2', LargeDataChildTestClass.MyStringLength),
MyStringArray = new string[LargeDataChildTestClass.MyStringArrayArrayCount]
};
for (int j = 0; j < child.MyStringArray.Length; j++)
{
child.MyStringArray[j] = new string('3', LargeDataChildTestClass.MyStringArrayElementStringLength);
}
Children.Add(child);
}
}
public void Verify()
{
Assert.Equal(MyStringLength, MyString.Length);
Assert.Equal('1', MyString[0]);
Assert.Equal('1', MyString[MyStringLength - 1]);
Assert.Equal(ChildrenCount, Children.Count);
for (int i = 0; i < ChildrenCount; i++)
{
LargeDataChildTestClass child = Children[i];
Assert.Equal(LargeDataChildTestClass.MyStringLength, child.MyString.Length);
Assert.Equal('2', child.MyString[0]);
Assert.Equal('2', child.MyString[LargeDataChildTestClass.MyStringLength - 1]);
Assert.Equal(LargeDataChildTestClass.MyStringArrayArrayCount, child.MyStringArray.Length);
for (int j = 0; j < LargeDataChildTestClass.MyStringArrayArrayCount; j++)
{
Assert.Equal('3', child.MyStringArray[j][0]);
Assert.Equal('3', child.MyStringArray[j][LargeDataChildTestClass.MyStringArrayElementStringLength - 1]);
}
}
}
}
public class LargeDataChildTestClass
{
public const int MyStringLength = 2000;
public string MyString { get; set; }
public string[] MyStringArray { get; set; }
public const int MyStringArrayArrayCount = 1000;
public const int MyStringArrayElementStringLength = 50;
}
public class EmptyClass { }
public class BasicPerson : ITestClass
{
public int age { get; set; }
public string first { get; set; }
public string last { get; set; }
public List<string> phoneNumbers { get; set; }
public BasicJsonAddress address { get; set; }
public void Initialize()
{
age = 30;
first = "John";
last = "Smith";
phoneNumbers = new List<string> { "425-000-0000", "425-000-0001" };
address = new BasicJsonAddress
{
street = "1 Microsoft Way",
city = "Redmond",
zip = 98052
};
}
public void Verify()
{
Assert.Equal(30, age);
Assert.Equal("John", first);
Assert.Equal("Smith", last);
Assert.Equal("425-000-0000", phoneNumbers[0]);
Assert.Equal("425-000-0001", phoneNumbers[1]);
Assert.Equal("1 Microsoft Way", address.street);
Assert.Equal("Redmond", address.city);
Assert.Equal(98052, address.zip);
}
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
"{" +
@"""age"" : 30," +
@"""first"" : ""John""," +
@"""last"" : ""Smith""," +
@"""phoneNumbers"" : [" +
@"""425-000-0000""," +
@"""425-000-0001""" +
@"]," +
@"""address"" : {" +
@"""street"" : ""1 Microsoft Way""," +
@"""city"" : ""Redmond""," +
@"""zip"" : 98052" +
"}" +
"}");
}
public class BasicJsonAddress
{
public string street { get; set; }
public string city { get; set; }
public int zip { get; set; }
}
public class BasicCompany : ITestClass
{
public List<BasicJsonAddress> sites { get; set; }
public BasicJsonAddress mainSite { get; set; }
public string name { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
"{\n" +
@"""name"" : ""Microsoft""," + "\n" +
@"""sites"" :[" + "\n" +
"{\n" +
@"""street"" : ""1 Lone Tree Rd S""," + "\n" +
@"""city"" : ""Fargo""," + "\n" +
@"""zip"" : 58104" + "\n" +
"},\n" +
"{\n" +
@"""street"" : ""8055 Microsoft Way""," + "\n" +
@"""city"" : ""Charlotte""," + "\n" +
@"""zip"" : 28273" + "\n" +
"}\n" +
"],\n" +
@"""mainSite"":" + "\n" +
"{\n" +
@"""street"" : ""1 Microsoft Way""," + "\n" +
@"""city"" : ""Redmond""," + "\n" +
@"""zip"" : 98052" + "\n" +
"}\n" +
"}");
public void Initialize()
{
name = "Microsoft";
sites = new List<BasicJsonAddress>
{
new BasicJsonAddress
{
street = "1 Lone Tree Rd S",
city = "Fargo",
zip = 58104
},
new BasicJsonAddress
{
street = "8055 Microsoft Way",
city = "Charlotte",
zip = 28273
}
};
mainSite =
new BasicJsonAddress
{
street = "1 Microsoft Way",
city = "Redmond",
zip = 98052
};
}
public void Verify()
{
Assert.Equal("Microsoft", name);
Assert.Equal("1 Lone Tree Rd S", sites[0].street);
Assert.Equal("Fargo", sites[0].city);
Assert.Equal(58104, sites[0].zip);
Assert.Equal("8055 Microsoft Way", sites[1].street);
Assert.Equal("Charlotte", sites[1].city);
Assert.Equal(28273, sites[1].zip);
Assert.Equal("1 Microsoft Way", mainSite.street);
Assert.Equal("Redmond", mainSite.city);
Assert.Equal(98052, mainSite.zip);
}
}
public class ClassWithUnicodeProperty
{
public int A\u0467 { get; set; }
// A 400 character property name with a unicode character making it 401 bytes.
public int A\u046734567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 { get; set; }
}
public class ClassWithExtensionProperty
{
public SimpleTestClass MyNestedClass { get; set; }
public int MyInt { get; set; }
[JsonExtensionData]
public IDictionary<string, JsonElement> MyOverflow { get; set; }
}
public class ClassWithExtensionField
{
public SimpleTestClass MyNestedClass { get; set; }
public int MyInt { get; set; }
[JsonInclude]
[JsonExtensionData]
public IDictionary<string, JsonElement> MyOverflow;
}
public class TestClassWithNestedObjectCommentsInner : ITestClass
{
public SimpleTestClass MyData { get; set; }
public static readonly string s_json =
@"{" +
@"""MyData"":" + SimpleTestClass.s_json + " // Trailing comment\n" +
"/* Multi\nLine Comment with } */\n" +
@"}";
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(s_json);
public void Initialize()
{
MyData = new SimpleTestClass();
MyData.Initialize();
}
public void Verify()
{
Assert.NotNull(MyData);
MyData.Verify();
}
}
public class TestClassWithNestedObjectCommentsOuter : ITestClass
{
public TestClassWithNestedObjectCommentsInner MyData { get; set; }
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(
@"{" +
" // This } will be ignored\n" +
@"""MyData"":" + TestClassWithNestedObjectCommentsInner.s_json +
" /* As will this [ */\n" +
@"}");
public void Initialize()
{
MyData = new TestClassWithNestedObjectCommentsInner();
MyData.Initialize();
}
public void Verify()
{
Assert.NotNull(MyData);
MyData.Verify();
}
}
public class ClassWithType<T>
{
public T Prop { get; set; }
}
public class ConverterForInt32 : JsonConverter<int>
{
public override int Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return 25;
}
public override void Write(Utf8JsonWriter writer, int value, JsonSerializerOptions options)
{
throw new NotImplementedException("Converter was called");
}
}
public class SimpleSnakeCasePolicy : JsonNamingPolicy
{
public override string ConvertName(string name)
{
return string.Concat(name.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToLower();
}
}
public static class CollectionTestTypes
{
public static IEnumerable<Type> EnumerableTypes<TElement>()
{
yield return typeof(TElement[]); // ArrayConverter
yield return typeof(ConcurrentQueue<TElement>); // ConcurrentQueueOfTConverter
yield return typeof(GenericICollectionWrapper<TElement>); // ICollectionOfTConverter
yield return typeof(WrapperForIEnumerable); // IEnumerableConverter
yield return typeof(WrapperForIReadOnlyCollectionOfT<TElement>); // IEnumerableOfTConverter
yield return typeof(Queue); // IEnumerableWithAddMethodConverter
yield return typeof(WrapperForIList); // IListConverter
yield return typeof(Collection<TElement>); // IListOfTConverter
yield return typeof(ImmutableList<TElement>); // ImmutableEnumerableOfTConverter
yield return typeof(HashSet<TElement>); // ISetOfTConverter
yield return typeof(List<TElement>); // ListOfTConverter
yield return typeof(Queue<TElement>); // QueueOfTConverter
}
public static IEnumerable<Type> DeserializableGenericEnumerableTypes<TElement>()
{
yield return typeof(TElement[]); // ArrayConverter
yield return typeof(ConcurrentQueue<TElement>); // ConcurrentQueueOfTConverter
yield return typeof(GenericICollectionWrapper<TElement>); // ICollectionOfTConverter
yield return typeof(IEnumerable<TElement>); // IEnumerableConverter
yield return typeof(Collection<TElement>); // IListOfTConverter
yield return typeof(ImmutableList<TElement>); // ImmutableEnumerableOfTConverter
yield return typeof(HashSet<TElement>); // ISetOfTConverter
yield return typeof(List<TElement>); // ListOfTConverter
yield return typeof(Queue<TElement>); // QueueOfTConverter
}
public static IEnumerable<Type> DeserializableNonGenericEnumerableTypes()
{
yield return typeof(Queue); // IEnumerableWithAddMethodConverter
yield return typeof(WrapperForIList); // IListConverter
}
public static IEnumerable<Type> DictionaryTypes<TElement>()
{
yield return typeof(Dictionary<string, TElement>); // DictionaryOfStringTValueConverter
yield return typeof(Hashtable); // IDictionaryConverter
yield return typeof(ConcurrentDictionary<string, TElement>); // IDictionaryOfStringTValueConverter
yield return typeof(GenericIDictionaryWrapper<string, TElement>); // IDictionaryOfStringTValueConverter
yield return typeof(ImmutableDictionary<string, TElement>); // ImmutableDictionaryOfStringTValueConverter
yield return typeof(GenericIReadOnlyDictionaryWrapper<string, TElement>); // IReadOnlyDictionaryOfStringTValueConverter
}
public static IEnumerable<Type> DeserializableDictionaryTypes<TKey, TValue>()
{
yield return typeof(Dictionary<TKey, TValue>); // DictionaryOfStringTValueConverter
yield return typeof(Hashtable); // IDictionaryConverter
yield return typeof(IDictionary); // IDictionaryConverter
yield return typeof(ConcurrentDictionary<TKey, TValue>); // IDictionaryOfStringTValueConverter
yield return typeof(IDictionary<TKey, TValue>); // IDictionaryOfStringTValueConverter
yield return typeof(GenericIDictionaryWrapper<TKey, TValue>); // IDictionaryOfStringTValueConverter
yield return typeof(ImmutableDictionary<TKey, TValue>); // ImmutableDictionaryOfStringTValueConverter
yield return typeof(IReadOnlyDictionary<TKey, TValue>); // IReadOnlyDictionaryOfStringTValueConverter
}
public static IEnumerable<Type> DeserializableNonGenericDictionaryTypes()
{
yield return typeof(Hashtable); // IDictionaryConverter
yield return typeof(SortedList); // IDictionaryConverter
}
}
public class PocoDictionary
{
public Dictionary<string, string> key { get; set; }
}
public class Poco
{
public int Id { get; set; }
}
public class UppercaseNamingPolicy : JsonNamingPolicy
{
public override string ConvertName(string name)
{
return name.ToUpperInvariant();
}
}
public class NullNamingPolicy : JsonNamingPolicy
{
public override string ConvertName(string name)
{
return null;
}
}
public class PersonReference
{
internal Guid Id { get; set; }
public string Name { get; set; }
public PersonReference Spouse { get; set; }
}
public class JsonElementClass : ITestClass
{
public JsonElement Number { get; set; }
public JsonElement True { get; set; }
public JsonElement False { get; set; }
public JsonElement String { get; set; }
public JsonElement Array { get; set; }
public JsonElement Object { get; set; }
public JsonElement Null { get; set; }
public static readonly string s_json =
@"{" +
@"""Number"" : 1," +
@"""True"" : true," +
@"""False"" : false," +
@"""String"" : ""Hello""," +
@"""Array"" : [2, false, true, ""Goodbye""]," +
@"""Object"" : {}," +
@"""Null"" : null" +
@"}";
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(s_json);
public void Initialize()
{
Number = JsonDocument.Parse(@"1").RootElement.Clone();
True = JsonDocument.Parse(@"true").RootElement.Clone();
False = JsonDocument.Parse(@"false").RootElement.Clone();
String = JsonDocument.Parse(@"""Hello""").RootElement.Clone();
Array = JsonDocument.Parse(@"[2, false, true, ""Goodbye""]").RootElement.Clone();
Object = JsonDocument.Parse(@"{}").RootElement.Clone();
Null = JsonDocument.Parse(@"null").RootElement.Clone();
}
public void Verify()
{
Assert.Equal(JsonValueKind.Number, Number.ValueKind);
Assert.Equal("1", Number.ToString());
Assert.Equal(JsonValueKind.True, True.ValueKind);
Assert.Equal("True", True.ToString());
Assert.Equal(JsonValueKind.False, False.ValueKind);
Assert.Equal("False", False.ToString());
Assert.Equal(JsonValueKind.String, String.ValueKind);
Assert.Equal("Hello", String.ToString());
Assert.Equal(JsonValueKind.Array, Array.ValueKind);
JsonElement[] elements = Array.EnumerateArray().ToArray();
Assert.Equal(JsonValueKind.Number, elements[0].ValueKind);
Assert.Equal("2", elements[0].ToString());
Assert.Equal(JsonValueKind.False, elements[1].ValueKind);
Assert.Equal("False", elements[1].ToString());
Assert.Equal(JsonValueKind.True, elements[2].ValueKind);
Assert.Equal("True", elements[2].ToString());
Assert.Equal(JsonValueKind.String, elements[3].ValueKind);
Assert.Equal("Goodbye", elements[3].ToString());
Assert.Equal(JsonValueKind.Object, Object.ValueKind);
Assert.Equal("{}", Object.ToString());
Assert.Equal(JsonValueKind.Null, Null.ValueKind);
Assert.Equal("", Null.ToString()); // JsonElement returns empty string for null.
}
}
public class JsonElementArrayClass : ITestClass
{
public JsonElement[] Array { get; set; }
public static readonly string s_json =
@"{" +
@"""Array"" : [" +
@"1, " +
@"true, " +
@"false, " +
@"""Hello""," +
@"[2, false, true, ""Goodbye""]," +
@"{}" +
@"]" +
@"}";
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(s_json);
public void Initialize()
{
Array = new JsonElement[]
{
JsonDocument.Parse(@"1").RootElement.Clone(),
JsonDocument.Parse(@"true").RootElement.Clone(),
JsonDocument.Parse(@"false").RootElement.Clone(),
JsonDocument.Parse(@"""Hello""").RootElement.Clone()
};
}
public void Verify()
{
Assert.Equal(JsonValueKind.Number, Array[0].ValueKind);
Assert.Equal("1", Array[0].ToString());
Assert.Equal(JsonValueKind.True, Array[1].ValueKind);
Assert.Equal("True", Array[1].ToString());
Assert.Equal(JsonValueKind.False, Array[2].ValueKind);
Assert.Equal("False", Array[2].ToString());
Assert.Equal(JsonValueKind.String, Array[3].ValueKind);
Assert.Equal("Hello", Array[3].ToString());
}
}
public class ClassWithComplexObjects : ITestClass
{
public object Array { get; set; }
public object Object { get; set; }
public static readonly string s_array =
@"[" +
@"1," +
@"""Hello""," +
@"true," +
@"false," +
@"{}," +
@"[2, ""Goodbye"", false, true, {}, [3]]" +
@"]";
public static readonly string s_object =
@"{" +
@"""NestedArray"" : " +
s_array +
@"}";
public static readonly string s_json =
@"{" +
@"""Array"" : " +
s_array + "," +
@"""Object"" : " +
s_object +
@"}";
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(s_json);
public void Initialize()
{
Array = JsonDocument.Parse(s_array).RootElement.Clone();
Object = JsonDocument.Parse(s_object).RootElement.Clone();
}
public void Verify()
{
Assert.IsType<JsonElement>(Array);
ValidateArray((JsonElement)Array);
Assert.IsType<JsonElement>(Object);
JsonElement jsonObject = (JsonElement)Object;
Assert.Equal(JsonValueKind.Object, jsonObject.ValueKind);
JsonElement.ObjectEnumerator enumerator = jsonObject.EnumerateObject();
JsonProperty property = enumerator.First();
Assert.Equal("NestedArray", property.Name);
Assert.True(property.NameEquals("NestedArray"));
ValidateArray(property.Value);
void ValidateArray(JsonElement element)
{
Assert.Equal(JsonValueKind.Array, element.ValueKind);
JsonElement[] elements = element.EnumerateArray().ToArray();
Assert.Equal(JsonValueKind.Number, elements[0].ValueKind);
Assert.Equal("1", elements[0].ToString());
Assert.Equal(JsonValueKind.String, elements[1].ValueKind);
Assert.Equal("Hello", elements[1].ToString());
Assert.Equal(JsonValueKind.True, elements[2].ValueKind);
Assert.True(elements[2].GetBoolean());
Assert.Equal(JsonValueKind.False, elements[3].ValueKind);
Assert.False(elements[3].GetBoolean());
}
}
}
public class JsonDocumentClass : ITestClass, IDisposable
{
public JsonDocument Document { get; set; }
public static readonly string s_json =
@"{" +
@"""Number"" : 1," +
@"""True"" : true," +
@"""False"" : false," +
@"""String"" : ""Hello""," +
@"""Array"" : [2, false, true, ""Goodbye""]," +
@"""Object"" : {}," +
@"""Null"" : null" +
@"}";
public readonly byte[] s_data = Encoding.UTF8.GetBytes(s_json);
public void Initialize()
{
Document = JsonDocument.Parse(s_json);
}
public void Verify()
{
JsonElement number = Document.RootElement.GetProperty("Number");
JsonElement trueBool = Document.RootElement.GetProperty("True");
JsonElement falseBool = Document.RootElement.GetProperty("False");
JsonElement stringType = Document.RootElement.GetProperty("String");
JsonElement arrayType = Document.RootElement.GetProperty("Array");
JsonElement objectType = Document.RootElement.GetProperty("Object");
JsonElement nullType = Document.RootElement.GetProperty("Null");
Assert.Equal(JsonValueKind.Number, number.ValueKind);
Assert.Equal("1", number.ToString());
Assert.Equal(JsonValueKind.True, trueBool.ValueKind);
Assert.Equal("True", true.ToString());
Assert.Equal(JsonValueKind.False, falseBool.ValueKind);
Assert.Equal("False", false.ToString());
Assert.Equal(JsonValueKind.String, stringType.ValueKind);
Assert.Equal("Hello", stringType.ToString());
Assert.Equal(JsonValueKind.Array, arrayType.ValueKind);
JsonElement[] elements = arrayType.EnumerateArray().ToArray();
Assert.Equal(JsonValueKind.Number, elements[0].ValueKind);
Assert.Equal("2", elements[0].ToString());
Assert.Equal(JsonValueKind.False, elements[1].ValueKind);
Assert.Equal("False", elements[1].ToString());
Assert.Equal(JsonValueKind.True, elements[2].ValueKind);
Assert.Equal("True", elements[2].ToString());
Assert.Equal(JsonValueKind.String, elements[3].ValueKind);
Assert.Equal("Goodbye", elements[3].ToString());
Assert.Equal(JsonValueKind.Object, objectType.ValueKind);
Assert.Equal("{}", objectType.ToString());
Assert.Equal(JsonValueKind.Null, nullType.ValueKind);
Assert.Equal("", nullType.ToString()); // JsonElement returns empty string for null.
}
public void Dispose()
{
Document.Dispose();
}
}
public class JsonDocumentArrayClass : ITestClass, IDisposable
{
public JsonDocument Document { get; set; }
public static readonly string s_json =
@"{" +
@"""Array"" : [" +
@"1, " +
@"true, " +
@"false, " +
@"""Hello""," +
@"[2, false, true, ""Goodbye""]," +
@"{}" +
@"]" +
@"}";
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(s_json);
public void Initialize()
{
Document = JsonDocument.Parse(s_json);
}
public void Verify()
{
JsonElement[] array = Document.RootElement.GetProperty("Array").EnumerateArray().ToArray();
Assert.Equal(JsonValueKind.Number, array[0].ValueKind);
Assert.Equal("1", array[0].ToString());
Assert.Equal(JsonValueKind.True, array[1].ValueKind);
Assert.Equal("True", array[1].ToString());
Assert.Equal(JsonValueKind.False, array[2].ValueKind);
Assert.Equal("False", array[2].ToString());
Assert.Equal(JsonValueKind.String, array[3].ValueKind);
Assert.Equal("Hello", array[3].ToString());
}
public void Dispose()
{
Document.Dispose();
}
}
}
| 1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/Serialization/JsonSerializerWrapper.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.IO;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization.Metadata;
using System.Text.Json.Serialization.Tests;
using System.Threading.Tasks;
namespace System.Text.Json.SourceGeneration.Tests
{
internal sealed class StringSerializerWrapper : JsonSerializerWrapperForString
{
private readonly JsonSerializerContext _defaultContext;
private readonly Func<JsonSerializerOptions, JsonSerializerContext> _customContextCreator;
protected internal override bool SupportsNullValueOnDeserialize => false;
public StringSerializerWrapper(JsonSerializerContext defaultContext!!, Func<JsonSerializerOptions, JsonSerializerContext> customContextCreator!!)
{
_defaultContext = defaultContext;
_customContextCreator = customContextCreator;
}
protected internal override Task<string> SerializeWrapper(object value, Type type, JsonSerializerOptions? options = null)
{
if (options != null)
{
return Task.FromResult(Serialize(value, type, options));
}
return Task.FromResult(JsonSerializer.Serialize(value, type, _defaultContext));
}
private string Serialize(object value, Type type, JsonSerializerOptions options)
{
JsonSerializerContext context = _customContextCreator(new JsonSerializerOptions(options));
return JsonSerializer.Serialize(value, type, context);
}
protected internal override Task<string> SerializeWrapper<T>(T value, JsonSerializerOptions? options = null)
{
Type runtimeType = GetRuntimeType(value);
if (runtimeType != typeof(T))
{
return SerializeWrapper(value, runtimeType, options);
}
if (options != null)
{
return Task.FromResult(Serialize(value, options));
}
JsonTypeInfo<T> typeInfo = (JsonTypeInfo<T>)_defaultContext.GetTypeInfo(typeof(T));
return Task.FromResult(JsonSerializer.Serialize(value, typeInfo));
}
private string Serialize<T>(T value, JsonSerializerOptions options)
{
JsonSerializerContext context = _customContextCreator(new JsonSerializerOptions(options));
JsonTypeInfo<T> typeInfo = (JsonTypeInfo<T>)context.GetTypeInfo(typeof(T));
return JsonSerializer.Serialize(value, typeInfo);
}
private static Type GetRuntimeType<TValue>(in TValue value)
{
if (typeof(TValue) == typeof(object) && value != null)
{
return value.GetType();
}
return typeof(TValue);
}
protected internal override Task<string> SerializeWrapper(object value, Type inputType, JsonSerializerContext context)
=> throw new NotImplementedException();
protected internal override Task<string> SerializeWrapper<T>(T value, JsonTypeInfo<T> jsonTypeInfo)
=> throw new NotImplementedException();
protected internal override Task<T> DeserializeWrapper<T>(string json, JsonSerializerOptions? options = null)
{
if (options != null)
{
return Task.FromResult(Deserialize<T>(json, options));
}
JsonTypeInfo<T> typeInfo = (JsonTypeInfo<T>)_defaultContext.GetTypeInfo(typeof(T));
return Task.FromResult(JsonSerializer.Deserialize<T>(json, typeInfo));
}
private T Deserialize<T>(string json, JsonSerializerOptions options)
{
JsonSerializerContext context = _customContextCreator(new JsonSerializerOptions(options));
JsonTypeInfo<T> typeInfo = (JsonTypeInfo<T>)context.GetTypeInfo(typeof(T));
return JsonSerializer.Deserialize<T>(json, typeInfo);
}
protected internal override Task<object> DeserializeWrapper(string json, Type type, JsonSerializerOptions? options = null)
{
if (options != null)
{
return Task.FromResult(Deserialize(json, type, options));
}
return Task.FromResult(JsonSerializer.Deserialize(json, type, _defaultContext));
}
private object Deserialize(string json, Type type, JsonSerializerOptions options)
{
JsonSerializerContext context = _customContextCreator(new JsonSerializerOptions(options));
return JsonSerializer.Deserialize(json, type, context);
}
protected internal override Task<T> DeserializeWrapper<T>(string json, JsonTypeInfo<T> jsonTypeInfo)
=> throw new NotImplementedException();
protected internal override Task<object> DeserializeWrapper(string json, Type type, JsonSerializerContext context)
=> throw new NotImplementedException();
}
internal sealed class StreamSerializerWrapper : JsonSerializerWrapperForStream
{
private readonly JsonSerializerContext _defaultContext;
private readonly Func<JsonSerializerOptions, JsonSerializerContext> _customContextCreator;
public StreamSerializerWrapper(JsonSerializerContext defaultContext!!, Func<JsonSerializerOptions, JsonSerializerContext> customContextCreator!!)
{
_defaultContext = defaultContext;
_customContextCreator = customContextCreator;
}
protected internal override async Task<T> DeserializeWrapper<T>(Stream utf8Json, JsonSerializerOptions? options = null)
{
if (options != null)
{
return await Deserialize<T>(utf8Json, options);
}
JsonTypeInfo<T> typeInfo = (JsonTypeInfo<T>)_defaultContext.GetTypeInfo(typeof(T));
return await JsonSerializer.DeserializeAsync<T>(utf8Json, typeInfo);
}
private async Task<T> Deserialize<T>(Stream utf8Json, JsonSerializerOptions options)
{
JsonSerializerContext context = _customContextCreator(new JsonSerializerOptions(options));
JsonTypeInfo<T> typeInfo = (JsonTypeInfo<T>)context.GetTypeInfo(typeof(T));
return await JsonSerializer.DeserializeAsync<T>(utf8Json, typeInfo);
}
protected internal override Task<object> DeserializeWrapper(Stream utf8Json, Type returnType, JsonSerializerOptions options = null) => throw new NotImplementedException();
protected internal override Task<T> DeserializeWrapper<T>(Stream utf8Json, JsonTypeInfo<T> jsonTypeInfo) => throw new NotImplementedException();
protected internal override Task SerializeWrapper<T>(Stream stream, T value, JsonSerializerOptions options = null) => throw new NotImplementedException();
protected internal override Task SerializeWrapper(Stream stream, object value, Type inputType, JsonSerializerOptions options = null) => throw new NotImplementedException();
protected internal override Task SerializeWrapper<T>(Stream stream, T value, JsonTypeInfo<T> jsonTypeInfo) => throw new NotImplementedException();
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.IO;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization.Metadata;
using System.Text.Json.Serialization.Tests;
using System.Threading.Tasks;
namespace System.Text.Json.SourceGeneration.Tests
{
internal sealed class StringSerializerWrapper : JsonSerializerWrapperForString
{
private readonly JsonSerializerContext _defaultContext;
private readonly Func<JsonSerializerOptions, JsonSerializerContext> _customContextCreator;
protected internal override bool SupportsNullValueOnDeserialize => false;
public StringSerializerWrapper(JsonSerializerContext defaultContext!!, Func<JsonSerializerOptions, JsonSerializerContext> customContextCreator!!)
{
_defaultContext = defaultContext;
_customContextCreator = customContextCreator;
}
protected internal override Task<string> SerializeWrapper(object value, Type type, JsonSerializerOptions? options = null)
{
if (options != null)
{
return Task.FromResult(Serialize(value, type, options));
}
return Task.FromResult(JsonSerializer.Serialize(value, type, _defaultContext));
}
private string Serialize(object value, Type type, JsonSerializerOptions options)
{
JsonSerializerContext context = _customContextCreator(new JsonSerializerOptions(options));
return JsonSerializer.Serialize(value, type, context);
}
protected internal override Task<string> SerializeWrapper<T>(T value, JsonSerializerOptions? options = null)
{
Type runtimeType = GetRuntimeType(value);
if (runtimeType != typeof(T))
{
return SerializeWrapper(value, runtimeType, options);
}
if (options != null)
{
return Task.FromResult(Serialize(value, options));
}
JsonTypeInfo<T> typeInfo = (JsonTypeInfo<T>)_defaultContext.GetTypeInfo(typeof(T));
return Task.FromResult(JsonSerializer.Serialize(value, typeInfo));
}
private string Serialize<T>(T value, JsonSerializerOptions options)
{
JsonSerializerContext context = _customContextCreator(new JsonSerializerOptions(options));
JsonTypeInfo<T> typeInfo = (JsonTypeInfo<T>)context.GetTypeInfo(typeof(T));
return JsonSerializer.Serialize(value, typeInfo);
}
private static Type GetRuntimeType<TValue>(in TValue value)
{
if (typeof(TValue) == typeof(object) && value != null)
{
return value.GetType();
}
return typeof(TValue);
}
protected internal override Task<string> SerializeWrapper(object value, Type inputType, JsonSerializerContext context)
=> throw new NotImplementedException();
protected internal override Task<string> SerializeWrapper<T>(T value, JsonTypeInfo<T> jsonTypeInfo)
=> throw new NotImplementedException();
protected internal override Task<T> DeserializeWrapper<T>(string json, JsonSerializerOptions? options = null)
{
if (options != null)
{
return Task.FromResult(Deserialize<T>(json, options));
}
JsonTypeInfo<T> typeInfo = (JsonTypeInfo<T>)_defaultContext.GetTypeInfo(typeof(T));
return Task.FromResult(JsonSerializer.Deserialize<T>(json, typeInfo));
}
private T Deserialize<T>(string json, JsonSerializerOptions options)
{
JsonSerializerContext context = _customContextCreator(new JsonSerializerOptions(options));
JsonTypeInfo<T> typeInfo = (JsonTypeInfo<T>)context.GetTypeInfo(typeof(T));
return JsonSerializer.Deserialize<T>(json, typeInfo);
}
protected internal override Task<object> DeserializeWrapper(string json, Type type, JsonSerializerOptions? options = null)
{
if (options != null)
{
return Task.FromResult(Deserialize(json, type, options));
}
return Task.FromResult(JsonSerializer.Deserialize(json, type, _defaultContext));
}
private object Deserialize(string json, Type type, JsonSerializerOptions options)
{
JsonSerializerContext context = _customContextCreator(new JsonSerializerOptions(options));
return JsonSerializer.Deserialize(json, type, context);
}
protected internal override Task<T> DeserializeWrapper<T>(string json, JsonTypeInfo<T> jsonTypeInfo)
=> throw new NotImplementedException();
protected internal override Task<object> DeserializeWrapper(string json, Type type, JsonSerializerContext context)
=> throw new NotImplementedException();
}
internal sealed class StreamSerializerWrapper : JsonSerializerWrapperForStream
{
private readonly JsonSerializerContext _defaultContext;
private readonly Func<JsonSerializerOptions, JsonSerializerContext> _customContextCreator;
public StreamSerializerWrapper(JsonSerializerContext defaultContext!!, Func<JsonSerializerOptions, JsonSerializerContext> customContextCreator!!)
{
_defaultContext = defaultContext;
_customContextCreator = customContextCreator;
}
protected internal override async Task<T> DeserializeWrapper<T>(Stream utf8Json, JsonSerializerOptions? options = null)
{
if (options != null)
{
return await Deserialize<T>(utf8Json, options);
}
JsonTypeInfo<T> typeInfo = (JsonTypeInfo<T>)_defaultContext.GetTypeInfo(typeof(T));
return await JsonSerializer.DeserializeAsync<T>(utf8Json, typeInfo);
}
private async Task<T> Deserialize<T>(Stream utf8Json, JsonSerializerOptions options)
{
JsonSerializerContext context = _customContextCreator(new JsonSerializerOptions(options));
JsonTypeInfo<T> typeInfo = (JsonTypeInfo<T>)context.GetTypeInfo(typeof(T));
return await JsonSerializer.DeserializeAsync<T>(utf8Json, typeInfo);
}
protected internal override Task<object> DeserializeWrapper(Stream utf8Json, Type returnType, JsonSerializerOptions options = null) => throw new NotImplementedException();
protected internal override Task<T> DeserializeWrapper<T>(Stream utf8Json, JsonTypeInfo<T> jsonTypeInfo) => throw new NotImplementedException();
protected internal override async Task SerializeWrapper<T>(Stream stream, T value, JsonSerializerOptions options = null)
{
JsonSerializerContext context = options != null
? _customContextCreator(new JsonSerializerOptions(options))
: _defaultContext;
JsonTypeInfo<T> typeInfo = (JsonTypeInfo<T>)context.GetTypeInfo(typeof(T));
await JsonSerializer.SerializeAsync<T>(stream, value, typeInfo);
}
protected internal override async Task SerializeWrapper(Stream stream, object value, Type inputType, JsonSerializerOptions options = null)
{
JsonSerializerContext context = options != null
? _customContextCreator(new JsonSerializerOptions(options))
: _defaultContext;
await JsonSerializer.SerializeAsync(stream, value, inputType, context);
}
protected internal override Task SerializeWrapper<T>(Stream stream, T value, JsonTypeInfo<T> jsonTypeInfo) => throw new NotImplementedException();
}
}
| 1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/System.Text.Json.SourceGeneration.Tests.targets
|
<Project>
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkCurrent)</TargetFrameworks>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
<!-- SYSLIB0020: JsonSerializerOptions.IgnoreNullValues is obsolete -->
<!-- SYSLIB1037: Suppress init-only property deserialization warning -->
<!-- SYSLIB1038: Suppress JsonInclude on inaccessible members warning -->
<NoWarn>$(NoWarn);SYSLIB0020;SYSLIB1037;SYSLIB1038</NoWarn>
</PropertyGroup>
<PropertyGroup>
<DefineConstants>$(DefineConstants);BUILDING_SOURCE_GENERATOR_TESTS</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Common\CollectionTests\CollectionTests.AsyncEnumerable.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.AsyncEnumerable.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Concurrent.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Concurrent.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Dictionary.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Dictionary.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Dictionary.KeyPolicy.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Dictionary.KeyPolicy.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Dictionary.NonStringKey.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Dictionary.NonStringKey.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Generic.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Generic.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Generic.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Generic.Write.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Immutable.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Immutable.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.KeyValuePair.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.KeyValuePair.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.NonGeneric.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.NonGeneric.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.NonGeneric.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.NonGeneric.Write.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.ObjectModel.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.ObjectModel.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.ObjectModel.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.ObjectModel.Write.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Specialized.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Specialized.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Specialized.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Specialized.Write.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Immutable.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Immutable.Write.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.AttributePresence.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.AttributePresence.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.Cache.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.Cache.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.Exceptions.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.Exceptions.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.ParameterMatching.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.ParameterMatching.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.Stream.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.Stream.cs" />
<Compile Include="..\Common\ExtensionDataTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ExtensionDataTests.cs" />
<Compile Include="..\Common\JsonSerializerWrapperForStream.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\JsonSerializerWrapperForStream.cs" />
<Compile Include="..\Common\JsonSerializerWrapperForString.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\JsonSerializerWrapperForString.cs" />
<Compile Include="..\Common\JsonTestHelper.cs" Link="CommonTest\System\Text\Json\JsonTestHelper.cs" />
<Compile Include="..\Common\NodeInteropTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\NodeInteropTests.cs" />
<Compile Include="..\Common\PropertyNameTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\PropertyNameTests.cs" />
<Compile Include="..\Common\PropertyVisibilityTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\PropertyVisibilityTests.cs" />
<Compile Include="..\Common\PropertyVisibilityTests.InitOnly.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\PropertyVisibilityTests.InitOnly.cs" />
<Compile Include="..\Common\PropertyVisibilityTests.NonPublicAccessors.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\PropertyVisibilityTests.NonPublicAccessors.cs" />
<Compile Include="..\Common\SampleTestData.OrderPayload.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\SampleTestData.OrderPayload.cs" />
<Compile Include="..\Common\SerializerTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\SerializerTests.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.ConcurrentCollections.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.ConcurrentCollections.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.Constructor.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.Constructor.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.GenericCollections.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.GenericCollections.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.ImmutableCollections.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.ImmutableCollections.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.NonGenericCollections.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.NonGenericCollections.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.Polymorphic.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.Polymorphic.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClass.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClass.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithFields.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithFields.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithNullables.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithNullables.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithObject.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithObject.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithObjectArrays.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithObjectArrays.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithSimpleObject.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithSimpleObject.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestStruct.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestStruct.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestStructWithFields.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestStructWithFields.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.ValueTypedMember.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.ValueTypedMember.cs" />
<Compile Include="..\Common\UnsupportedTypesTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\UnsupportedTypesTests.cs" />
<Compile Include="ContextClasses.cs" />
<Compile Include="JsonSerializerContextTests.cs" />
<Compile Include="Serialization\CollectionTests.cs" />
<Compile Include="Serialization\ConstructorTests.cs" />
<Compile Include="Serialization\ExtensionDataTests.cs" />
<Compile Include="Serialization\JsonSerializerWrapper.cs" />
<Compile Include="JsonTestHelper.cs" />
<Compile Include="MetadataAndSerializationContextTests.cs" />
<Compile Include="MetadataContextTests.cs" />
<Compile Include="MixedModeContextTests.cs" />
<Compile Include="NETStandardContextTests.cs" />
<Compile Include="RealWorldContextTests.cs" />
<Compile Include="SerializationContextTests.cs" />
<Compile Include="SerializationLogicTests.cs" />
<Compile Include="Serialization\NodeInteropTests.cs" />
<Compile Include="Serialization\PropertyNameTests.cs" />
<Compile Include="Serialization\PropertyVisibilityTests.cs" />
<Compile Include="Serialization\UnsupportedTypesTests.cs" />
<Compile Include="TestClasses.cs" />
<Compile Include="TestClasses.CustomConverters.cs" />
</ItemGroup>
<Target Name="FixIncrementalCoreCompileWithAnalyzers" BeforeTargets="CoreCompile">
<ItemGroup>
<CustomAdditionalCompileInputs Include="@(Analyzer)" />
</ItemGroup>
</Target>
</Project>
|
<Project>
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkCurrent)</TargetFrameworks>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
<!-- SYSLIB0020: JsonSerializerOptions.IgnoreNullValues is obsolete -->
<!-- SYSLIB1037: Suppress init-only property deserialization warning -->
<!-- SYSLIB1038: Suppress JsonInclude on inaccessible members warning -->
<NoWarn>$(NoWarn);SYSLIB0020;SYSLIB1037;SYSLIB1038</NoWarn>
</PropertyGroup>
<PropertyGroup>
<DefineConstants>$(DefineConstants);BUILDING_SOURCE_GENERATOR_TESTS</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Common\CollectionTests\CollectionTests.AsyncEnumerable.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.AsyncEnumerable.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Concurrent.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Concurrent.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Dictionary.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Dictionary.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Dictionary.KeyPolicy.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Dictionary.KeyPolicy.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Dictionary.NonStringKey.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Dictionary.NonStringKey.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Generic.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Generic.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Generic.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Generic.Write.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Immutable.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Immutable.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.KeyValuePair.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.KeyValuePair.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.NonGeneric.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.NonGeneric.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.NonGeneric.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.NonGeneric.Write.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.ObjectModel.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.ObjectModel.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.ObjectModel.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.ObjectModel.Write.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Specialized.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Specialized.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Specialized.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Specialized.Write.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Immutable.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Immutable.Write.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.AttributePresence.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.AttributePresence.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.Cache.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.Cache.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.Exceptions.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.Exceptions.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.ParameterMatching.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.ParameterMatching.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.Stream.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.Stream.cs" />
<Compile Include="..\Common\ExtensionDataTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ExtensionDataTests.cs" />
<Compile Include="..\Common\JsonSerializerWrapperForStream.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\JsonSerializerWrapperForStream.cs" />
<Compile Include="..\Common\JsonSerializerWrapperForString.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\JsonSerializerWrapperForString.cs" />
<Compile Include="..\Common\JsonTestHelper.cs" Link="CommonTest\System\Text\Json\JsonTestHelper.cs" />
<Compile Include="..\Common\NodeInteropTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\NodeInteropTests.cs" />
<Compile Include="..\Common\PropertyNameTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\PropertyNameTests.cs" />
<Compile Include="..\Common\PropertyVisibilityTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\PropertyVisibilityTests.cs" />
<Compile Include="..\Common\PropertyVisibilityTests.InitOnly.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\PropertyVisibilityTests.InitOnly.cs" />
<Compile Include="..\Common\PropertyVisibilityTests.NonPublicAccessors.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\PropertyVisibilityTests.NonPublicAccessors.cs" />
<Compile Include="..\Common\ReferenceHandlerTests\ReferenceHandlerTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ReferenceHandlerTests\ReferenceHandlerTests.cs" />
<Compile Include="..\Common\ReferenceHandlerTests\ReferenceHandlerTests.Deserialize.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ReferenceHandlerTests\ReferenceHandlerTests.Deserialize.cs" />
<Compile Include="..\Common\ReferenceHandlerTests\ReferenceHandlerTests.IgnoreCycles.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ReferenceHandlerTests\ReferenceHandlerTests.IgnoreCycles.cs" />
<Compile Include="..\Common\ReferenceHandlerTests\ReferenceHandlerTests.Serialize.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ReferenceHandlerTests\ReferenceHandlerTests.Serialize.cs" />
<Compile Include="..\Common\SampleTestData.OrderPayload.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\SampleTestData.OrderPayload.cs" />
<Compile Include="..\Common\SerializerTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\SerializerTests.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.ConcurrentCollections.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.ConcurrentCollections.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.Constructor.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.Constructor.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.GenericCollections.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.GenericCollections.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.ImmutableCollections.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.ImmutableCollections.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.NonGenericCollections.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.NonGenericCollections.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.Polymorphic.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.Polymorphic.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClass.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClass.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithFields.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithFields.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithNullables.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithNullables.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithObject.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithObject.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithObjectArrays.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithObjectArrays.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithSimpleObject.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithSimpleObject.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestStruct.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestStruct.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestStructWithFields.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestStructWithFields.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.ValueTypedMember.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.ValueTypedMember.cs" />
<Compile Include="..\Common\TestClasses\TestData.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestData.cs" />
<Compile Include="..\Common\UnsupportedTypesTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\UnsupportedTypesTests.cs" />
<Compile Include="ContextClasses.cs" />
<Compile Include="JsonSerializerContextTests.cs" />
<Compile Include="Serialization\CollectionTests.cs" />
<Compile Include="Serialization\ConstructorTests.cs" />
<Compile Include="Serialization\ExtensionDataTests.cs" />
<Compile Include="Serialization\JsonSerializerWrapper.cs" />
<Compile Include="Serialization\ReferenceHandlerTests.cs" />
<Compile Include="Serialization\ReferenceHandlerTests.IgnoreCycles.cs" />
<Compile Include="JsonTestHelper.cs" />
<Compile Include="MetadataAndSerializationContextTests.cs" />
<Compile Include="MetadataContextTests.cs" />
<Compile Include="MixedModeContextTests.cs" />
<Compile Include="NETStandardContextTests.cs" />
<Compile Include="RealWorldContextTests.cs" />
<Compile Include="SerializationContextTests.cs" />
<Compile Include="SerializationLogicTests.cs" />
<Compile Include="Serialization\NodeInteropTests.cs" />
<Compile Include="Serialization\PropertyNameTests.cs" />
<Compile Include="Serialization\PropertyVisibilityTests.cs" />
<Compile Include="Serialization\UnsupportedTypesTests.cs" />
<Compile Include="TestClasses.cs" />
<Compile Include="TestClasses.CustomConverters.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
</ItemGroup>
<Target Name="FixIncrementalCoreCompileWithAnalyzers" BeforeTargets="CoreCompile">
<ItemGroup>
<CustomAdditionalCompileInputs Include="@(Analyzer)" />
</ItemGroup>
</Target>
</Project>
| 1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Text.Json/tests/System.Text.Json.Tests/NewtonsoftTests/JsonSerializerTests.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// Copyright (c) 2007 James Newton-King
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
using System.Collections.Generic;
using Xunit;
namespace System.Text.Json.Tests
{
public class IncompleteTestClass
{
public int Key { get; set; }
}
public class JsonSerializerTests
{
[Fact]
public void DeserializeBoolean_Null()
{
Assert.Throws<JsonException>(
() => JsonSerializer.Deserialize<IList<bool>>(@"[null]"));
}
[Fact]
public void DeserializeBoolean_DateTime()
{
Assert.Throws<JsonException>(
() => JsonSerializer.Deserialize<IList<bool>>(@"['2000-12-20T10:55:55Z']"));
}
[Fact]
public void DeserializeBoolean_BadString()
{
Assert.Throws<JsonException>(
() => JsonSerializer.Deserialize<IList<bool>>(@"['pie']"));
}
[Fact]
public void DeserializeBoolean_EmptyString()
{
Assert.Throws<JsonException>(
() => JsonSerializer.Deserialize<IList<bool>>(@"['']"));
}
[Fact]
public void IncompleteContainers()
{
JsonException e = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<IList<object>>("[1,"));
Assert.Contains("Path: $[1] | LineNumber: 0 | BytePositionInLine: 2.", e.Message);
e = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<IList<int>>("[1,"));
Assert.Contains("Path: $[1] | LineNumber: 0 | BytePositionInLine: 2.", e.Message);
e = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<IList<int>>("[1"));
Assert.Contains("Path: $[0] | LineNumber: 0 | BytePositionInLine: 2.", e.Message);
e = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<IDictionary<string, int>>("{\"key\":1,"));
Assert.Contains("Path: $.key | LineNumber: 0 | BytePositionInLine: 8.", e.Message);
e = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<IDictionary<string, int>>("{\"key\":1"));
Assert.Contains("Path: $.key | LineNumber: 0 | BytePositionInLine: 8.", e.Message);
e = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<IncompleteTestClass>("{\"key\":1,"));
Assert.Contains("$ | LineNumber: 0 | BytePositionInLine: 8.", e.Message);
}
[Fact]
public void NewProperty()
{
Assert.Equal(@"{""IsTransient"":true}", JsonSerializer.Serialize(new ChildClass { IsTransient = true }));
ChildClass childClass = JsonSerializer.Deserialize<ChildClass>(@"{""IsTransient"":true}");
Assert.True(childClass.IsTransient);
}
[Fact]
public void NewPropertyVirtual()
{
Assert.Equal(@"{""IsTransient"":true}", JsonSerializer.Serialize(new ChildClassVirtual { IsTransient = true }));
ChildClassVirtual childClass = JsonSerializer.Deserialize<ChildClassVirtual>(@"{""IsTransient"":true}");
Assert.True(childClass.IsTransient);
}
[Fact]
public void DeserializeCommentTestObjectWithComments()
{
CommentTestObject o = JsonSerializer.Deserialize<CommentTestObject>(@"{/* Test */}", new JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip });
Assert.False(o.A);
o = JsonSerializer.Deserialize<CommentTestObject>(@"{""A"": true/* Test */}", new JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip });
Assert.True(o.A);
}
[Fact]
public void PreserveReferencesCallbackTest()
{
PersonReference p1 = new PersonReference
{
Name = "John Smith"
};
PersonReference p2 = new PersonReference
{
Name = "Mary Sue",
};
p1.Spouse = p2;
p2.Spouse = p1;
Assert.Throws<JsonException> (() => JsonSerializer.Serialize(p1));
}
}
public class PersonReference
{
internal Guid Id { get; set; }
public string Name { get; set; }
public PersonReference Spouse { get; set; }
}
public class CommentTestObject
{
public bool A { get; set; }
}
public class ChildClassVirtual : BaseClassVirtual
{
public new virtual bool IsTransient { get; set; }
}
public class BaseClassVirtual
{
internal virtual bool IsTransient { get; set; }
}
public class BaseClass
{
internal bool IsTransient { get; set; }
}
public class ChildClass : BaseClass
{
public new bool IsTransient { get; set; }
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// Copyright (c) 2007 James Newton-King
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
using System.Collections.Generic;
using System.Text.Json.Serialization.Tests;
using Xunit;
namespace System.Text.Json.Tests
{
public class IncompleteTestClass
{
public int Key { get; set; }
}
public class JsonSerializerTests
{
[Fact]
public void DeserializeBoolean_Null()
{
Assert.Throws<JsonException>(
() => JsonSerializer.Deserialize<IList<bool>>(@"[null]"));
}
[Fact]
public void DeserializeBoolean_DateTime()
{
Assert.Throws<JsonException>(
() => JsonSerializer.Deserialize<IList<bool>>(@"['2000-12-20T10:55:55Z']"));
}
[Fact]
public void DeserializeBoolean_BadString()
{
Assert.Throws<JsonException>(
() => JsonSerializer.Deserialize<IList<bool>>(@"['pie']"));
}
[Fact]
public void DeserializeBoolean_EmptyString()
{
Assert.Throws<JsonException>(
() => JsonSerializer.Deserialize<IList<bool>>(@"['']"));
}
[Fact]
public void IncompleteContainers()
{
JsonException e = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<IList<object>>("[1,"));
Assert.Contains("Path: $[1] | LineNumber: 0 | BytePositionInLine: 2.", e.Message);
e = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<IList<int>>("[1,"));
Assert.Contains("Path: $[1] | LineNumber: 0 | BytePositionInLine: 2.", e.Message);
e = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<IList<int>>("[1"));
Assert.Contains("Path: $[0] | LineNumber: 0 | BytePositionInLine: 2.", e.Message);
e = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<IDictionary<string, int>>("{\"key\":1,"));
Assert.Contains("Path: $.key | LineNumber: 0 | BytePositionInLine: 8.", e.Message);
e = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<IDictionary<string, int>>("{\"key\":1"));
Assert.Contains("Path: $.key | LineNumber: 0 | BytePositionInLine: 8.", e.Message);
e = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<IncompleteTestClass>("{\"key\":1,"));
Assert.Contains("$ | LineNumber: 0 | BytePositionInLine: 8.", e.Message);
}
[Fact]
public void NewProperty()
{
Assert.Equal(@"{""IsTransient"":true}", JsonSerializer.Serialize(new ChildClass { IsTransient = true }));
ChildClass childClass = JsonSerializer.Deserialize<ChildClass>(@"{""IsTransient"":true}");
Assert.True(childClass.IsTransient);
}
[Fact]
public void NewPropertyVirtual()
{
Assert.Equal(@"{""IsTransient"":true}", JsonSerializer.Serialize(new ChildClassVirtual { IsTransient = true }));
ChildClassVirtual childClass = JsonSerializer.Deserialize<ChildClassVirtual>(@"{""IsTransient"":true}");
Assert.True(childClass.IsTransient);
}
[Fact]
public void DeserializeCommentTestObjectWithComments()
{
CommentTestObject o = JsonSerializer.Deserialize<CommentTestObject>(@"{/* Test */}", new JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip });
Assert.False(o.A);
o = JsonSerializer.Deserialize<CommentTestObject>(@"{""A"": true/* Test */}", new JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip });
Assert.True(o.A);
}
[Fact]
public void PreserveReferencesCallbackTest()
{
PersonReference p1 = new PersonReference
{
Name = "John Smith"
};
PersonReference p2 = new PersonReference
{
Name = "Mary Sue",
};
p1.Spouse = p2;
p2.Spouse = p1;
Assert.Throws<JsonException> (() => JsonSerializer.Serialize(p1));
}
}
public class CommentTestObject
{
public bool A { get; set; }
}
public class ChildClassVirtual : BaseClassVirtual
{
public new virtual bool IsTransient { get; set; }
}
public class BaseClassVirtual
{
internal virtual bool IsTransient { get; set; }
}
public class BaseClass
{
internal bool IsTransient { get; set; }
}
public class ChildClass : BaseClass
{
public new bool IsTransient { get; set; }
}
}
| 1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/JsonDocumentTests.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.IO;
using System.Linq;
using Xunit;
namespace System.Text.Json.Serialization.Tests
{
public class JsonDocumentTests
{
[Fact]
public void SerializeJsonDocument()
{
using JsonDocumentClass obj = new JsonDocumentClass();
obj.Document = JsonSerializer.Deserialize<JsonDocument>(JsonDocumentClass.s_json);
obj.Verify();
string reserialized = JsonSerializer.Serialize(obj.Document);
// Properties in the exported json will be in the order that they were reflected, doing a quick check to see that
// we end up with the same length (i.e. same amount of data) to start.
Assert.Equal(JsonDocumentClass.s_json.StripWhitespace().Length, reserialized.Length);
// Shoving it back through the parser should validate round tripping.
obj.Document = JsonSerializer.Deserialize<JsonDocument>(reserialized);
obj.Verify();
}
public class JsonDocumentClass : ITestClass, IDisposable
{
public JsonDocument Document { get; set; }
public static readonly string s_json =
@"{" +
@"""Number"" : 1," +
@"""True"" : true," +
@"""False"" : false," +
@"""String"" : ""Hello""," +
@"""Array"" : [2, false, true, ""Goodbye""]," +
@"""Object"" : {}," +
@"""Null"" : null" +
@"}";
public readonly byte[] s_data = Encoding.UTF8.GetBytes(s_json);
public void Initialize()
{
Document = JsonDocument.Parse(s_json);
}
public void Verify()
{
JsonElement number = Document.RootElement.GetProperty("Number");
JsonElement trueBool = Document.RootElement.GetProperty("True");
JsonElement falseBool = Document.RootElement.GetProperty("False");
JsonElement stringType = Document.RootElement.GetProperty("String");
JsonElement arrayType = Document.RootElement.GetProperty("Array");
JsonElement objectType = Document.RootElement.GetProperty("Object");
JsonElement nullType = Document.RootElement.GetProperty("Null");
Assert.Equal(JsonValueKind.Number, number.ValueKind);
Assert.Equal("1", number.ToString());
Assert.Equal(JsonValueKind.True, trueBool.ValueKind);
Assert.Equal("True", true.ToString());
Assert.Equal(JsonValueKind.False, falseBool.ValueKind);
Assert.Equal("False", false.ToString());
Assert.Equal(JsonValueKind.String, stringType.ValueKind);
Assert.Equal("Hello", stringType.ToString());
Assert.Equal(JsonValueKind.Array, arrayType.ValueKind);
JsonElement[] elements = arrayType.EnumerateArray().ToArray();
Assert.Equal(JsonValueKind.Number, elements[0].ValueKind);
Assert.Equal("2", elements[0].ToString());
Assert.Equal(JsonValueKind.False, elements[1].ValueKind);
Assert.Equal("False", elements[1].ToString());
Assert.Equal(JsonValueKind.True, elements[2].ValueKind);
Assert.Equal("True", elements[2].ToString());
Assert.Equal(JsonValueKind.String, elements[3].ValueKind);
Assert.Equal("Goodbye", elements[3].ToString());
Assert.Equal(JsonValueKind.Object, objectType.ValueKind);
Assert.Equal("{}", objectType.ToString());
Assert.Equal(JsonValueKind.Null, nullType.ValueKind);
Assert.Equal("", nullType.ToString()); // JsonElement returns empty string for null.
}
public void Dispose()
{
Document.Dispose();
}
}
[Fact]
public void SerializeJsonElementArray()
{
using JsonDocumentArrayClass obj = new JsonDocumentArrayClass();
obj.Document = JsonSerializer.Deserialize<JsonDocument>(JsonDocumentArrayClass.s_json);
obj.Verify();
string reserialized = JsonSerializer.Serialize(obj.Document);
// Properties in the exported json will be in the order that they were reflected, doing a quick check to see that
// we end up with the same length (i.e. same amount of data) to start.
Assert.Equal(JsonDocumentArrayClass.s_json.StripWhitespace().Length, reserialized.Length);
// Shoving it back through the parser should validate round tripping.
obj.Document = JsonSerializer.Deserialize<JsonDocument>(reserialized);
obj.Verify();
}
public class JsonDocumentArrayClass : ITestClass, IDisposable
{
public JsonDocument Document { get; set; }
public static readonly string s_json =
@"{" +
@"""Array"" : [" +
@"1, " +
@"true, " +
@"false, " +
@"""Hello""," +
@"[2, false, true, ""Goodbye""]," +
@"{}" +
@"]" +
@"}";
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(s_json);
public void Initialize()
{
Document = JsonDocument.Parse(s_json);
}
public void Verify()
{
JsonElement[] array = Document.RootElement.GetProperty("Array").EnumerateArray().ToArray();
Assert.Equal(JsonValueKind.Number, array[0].ValueKind);
Assert.Equal("1", array[0].ToString());
Assert.Equal(JsonValueKind.True, array[1].ValueKind);
Assert.Equal("True", array[1].ToString());
Assert.Equal(JsonValueKind.False, array[2].ValueKind);
Assert.Equal("False", array[2].ToString());
Assert.Equal(JsonValueKind.String, array[3].ValueKind);
Assert.Equal("Hello", array[3].ToString());
}
public void Dispose()
{
Document.Dispose();
}
}
[Theory,
InlineData(5),
InlineData(10),
InlineData(20),
InlineData(1024)]
public void ReadJsonDocumentFromStream(int defaultBufferSize)
{
// Streams need to read ahead when they hit objects or arrays that are assigned to JsonElement or object.
byte[] data = Encoding.UTF8.GetBytes(@"{""Data"":[1,true,{""City"":""MyCity""},null,""foo""]}");
MemoryStream stream = new MemoryStream(data);
JsonDocument obj = JsonSerializer.DeserializeAsync<JsonDocument>(stream, new JsonSerializerOptions { DefaultBufferSize = defaultBufferSize }).Result;
data = Encoding.UTF8.GetBytes(@"[1,true,{""City"":""MyCity""},null,""foo""]");
stream = new MemoryStream(data);
obj = JsonSerializer.DeserializeAsync<JsonDocument>(stream, new JsonSerializerOptions { DefaultBufferSize = defaultBufferSize }).Result;
// Ensure we fail with incomplete data
data = Encoding.UTF8.GetBytes(@"{""Data"":[1,true,{""City"":""MyCity""},null,""foo""]");
stream = new MemoryStream(data);
Assert.Throws<JsonException>(() => JsonSerializer.DeserializeAsync<JsonDocument>(stream, new JsonSerializerOptions { DefaultBufferSize = defaultBufferSize }).Result);
data = Encoding.UTF8.GetBytes(@"[1,true,{""City"":""MyCity""},null,""foo""");
stream = new MemoryStream(data);
Assert.Throws<JsonException>(() => JsonSerializer.DeserializeAsync<JsonDocument>(stream, new JsonSerializerOptions { DefaultBufferSize = defaultBufferSize }).Result);
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.IO;
using System.Linq;
using Xunit;
namespace System.Text.Json.Serialization.Tests
{
public class JsonDocumentTests
{
[Fact]
public void SerializeJsonDocument()
{
using JsonDocumentClass obj = new JsonDocumentClass();
obj.Document = JsonSerializer.Deserialize<JsonDocument>(JsonDocumentClass.s_json);
obj.Verify();
string reserialized = JsonSerializer.Serialize(obj.Document);
// Properties in the exported json will be in the order that they were reflected, doing a quick check to see that
// we end up with the same length (i.e. same amount of data) to start.
Assert.Equal(JsonDocumentClass.s_json.StripWhitespace().Length, reserialized.Length);
// Shoving it back through the parser should validate round tripping.
obj.Document = JsonSerializer.Deserialize<JsonDocument>(reserialized);
obj.Verify();
}
[Fact]
public void SerializeJsonElementArray()
{
using JsonDocumentArrayClass obj = new JsonDocumentArrayClass();
obj.Document = JsonSerializer.Deserialize<JsonDocument>(JsonDocumentArrayClass.s_json);
obj.Verify();
string reserialized = JsonSerializer.Serialize(obj.Document);
// Properties in the exported json will be in the order that they were reflected, doing a quick check to see that
// we end up with the same length (i.e. same amount of data) to start.
Assert.Equal(JsonDocumentArrayClass.s_json.StripWhitespace().Length, reserialized.Length);
// Shoving it back through the parser should validate round tripping.
obj.Document = JsonSerializer.Deserialize<JsonDocument>(reserialized);
obj.Verify();
}
[Theory,
InlineData(5),
InlineData(10),
InlineData(20),
InlineData(1024)]
public void ReadJsonDocumentFromStream(int defaultBufferSize)
{
// Streams need to read ahead when they hit objects or arrays that are assigned to JsonElement or object.
byte[] data = Encoding.UTF8.GetBytes(@"{""Data"":[1,true,{""City"":""MyCity""},null,""foo""]}");
MemoryStream stream = new MemoryStream(data);
JsonDocument obj = JsonSerializer.DeserializeAsync<JsonDocument>(stream, new JsonSerializerOptions { DefaultBufferSize = defaultBufferSize }).Result;
data = Encoding.UTF8.GetBytes(@"[1,true,{""City"":""MyCity""},null,""foo""]");
stream = new MemoryStream(data);
obj = JsonSerializer.DeserializeAsync<JsonDocument>(stream, new JsonSerializerOptions { DefaultBufferSize = defaultBufferSize }).Result;
// Ensure we fail with incomplete data
data = Encoding.UTF8.GetBytes(@"{""Data"":[1,true,{""City"":""MyCity""},null,""foo""]");
stream = new MemoryStream(data);
Assert.Throws<JsonException>(() => JsonSerializer.DeserializeAsync<JsonDocument>(stream, new JsonSerializerOptions { DefaultBufferSize = defaultBufferSize }).Result);
data = Encoding.UTF8.GetBytes(@"[1,true,{""City"":""MyCity""},null,""foo""");
stream = new MemoryStream(data);
Assert.Throws<JsonException>(() => JsonSerializer.DeserializeAsync<JsonDocument>(stream, new JsonSerializerOptions { DefaultBufferSize = defaultBufferSize }).Result);
}
}
}
| 1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/JsonElementTests.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.IO;
using System.Linq;
using Xunit;
namespace System.Text.Json.Serialization.Tests
{
public class JsonElementTests
{
[Fact]
public void SerializeJsonElement()
{
JsonElementClass obj = JsonSerializer.Deserialize<JsonElementClass>(JsonElementClass.s_json);
obj.Verify();
string reserialized = JsonSerializer.Serialize(obj);
// Properties in the exported json will be in the order that they were reflected, doing a quick check to see that
// we end up with the same length (i.e. same amount of data) to start.
Assert.Equal(JsonElementClass.s_json.StripWhitespace().Length, reserialized.Length);
// Shoving it back through the parser should validate round tripping.
obj = JsonSerializer.Deserialize<JsonElementClass>(reserialized);
obj.Verify();
}
public class JsonElementClass : ITestClass
{
public JsonElement Number { get; set; }
public JsonElement True { get; set; }
public JsonElement False { get; set; }
public JsonElement String { get; set; }
public JsonElement Array { get; set; }
public JsonElement Object { get; set; }
public JsonElement Null { get; set; }
public static readonly string s_json =
@"{" +
@"""Number"" : 1," +
@"""True"" : true," +
@"""False"" : false," +
@"""String"" : ""Hello""," +
@"""Array"" : [2, false, true, ""Goodbye""]," +
@"""Object"" : {}," +
@"""Null"" : null" +
@"}";
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(s_json);
public void Initialize()
{
Number = JsonDocument.Parse(@"1").RootElement.Clone();
True = JsonDocument.Parse(@"true").RootElement.Clone();
False = JsonDocument.Parse(@"false").RootElement.Clone();
String = JsonDocument.Parse(@"""Hello""").RootElement.Clone();
Array = JsonDocument.Parse(@"[2, false, true, ""Goodbye""]").RootElement.Clone();
Object = JsonDocument.Parse(@"{}").RootElement.Clone();
Null = JsonDocument.Parse(@"null").RootElement.Clone();
}
public void Verify()
{
Assert.Equal(JsonValueKind.Number, Number.ValueKind);
Assert.Equal("1", Number.ToString());
Assert.Equal(JsonValueKind.True, True.ValueKind);
Assert.Equal("True", True.ToString());
Assert.Equal(JsonValueKind.False, False.ValueKind);
Assert.Equal("False", False.ToString());
Assert.Equal(JsonValueKind.String, String.ValueKind);
Assert.Equal("Hello", String.ToString());
Assert.Equal(JsonValueKind.Array, Array.ValueKind);
JsonElement[] elements = Array.EnumerateArray().ToArray();
Assert.Equal(JsonValueKind.Number, elements[0].ValueKind);
Assert.Equal("2", elements[0].ToString());
Assert.Equal(JsonValueKind.False, elements[1].ValueKind);
Assert.Equal("False", elements[1].ToString());
Assert.Equal(JsonValueKind.True, elements[2].ValueKind);
Assert.Equal("True", elements[2].ToString());
Assert.Equal(JsonValueKind.String, elements[3].ValueKind);
Assert.Equal("Goodbye", elements[3].ToString());
Assert.Equal(JsonValueKind.Object, Object.ValueKind);
Assert.Equal("{}", Object.ToString());
Assert.Equal(JsonValueKind.Null, Null.ValueKind);
Assert.Equal("", Null.ToString()); // JsonElement returns empty string for null.
}
}
[Fact]
public void SerializeJsonElementArray()
{
JsonElementArrayClass obj = JsonSerializer.Deserialize<JsonElementArrayClass>(JsonElementArrayClass.s_json);
obj.Verify();
string reserialized = JsonSerializer.Serialize(obj);
// Properties in the exported json will be in the order that they were reflected, doing a quick check to see that
// we end up with the same length (i.e. same amount of data) to start.
Assert.Equal(JsonElementArrayClass.s_json.StripWhitespace().Length, reserialized.Length);
// Shoving it back through the parser should validate round tripping.
obj = JsonSerializer.Deserialize<JsonElementArrayClass>(reserialized);
obj.Verify();
}
public class JsonElementArrayClass : ITestClass
{
public JsonElement[] Array { get; set; }
public static readonly string s_json =
@"{" +
@"""Array"" : [" +
@"1, " +
@"true, " +
@"false, " +
@"""Hello""," +
@"[2, false, true, ""Goodbye""]," +
@"{}" +
@"]" +
@"}";
public static readonly byte[] s_data = Encoding.UTF8.GetBytes(s_json);
public void Initialize()
{
Array = new JsonElement[]
{
JsonDocument.Parse(@"1").RootElement.Clone(),
JsonDocument.Parse(@"true").RootElement.Clone(),
JsonDocument.Parse(@"false").RootElement.Clone(),
JsonDocument.Parse(@"""Hello""").RootElement.Clone()
};
}
public void Verify()
{
Assert.Equal(JsonValueKind.Number, Array[0].ValueKind);
Assert.Equal("1", Array[0].ToString());
Assert.Equal(JsonValueKind.True, Array[1].ValueKind);
Assert.Equal("True", Array[1].ToString());
Assert.Equal(JsonValueKind.False, Array[2].ValueKind);
Assert.Equal("False", Array[2].ToString());
Assert.Equal(JsonValueKind.String, Array[3].ValueKind);
Assert.Equal("Hello", Array[3].ToString());
}
}
[Theory,
InlineData(5),
InlineData(10),
InlineData(20),
InlineData(1024)]
public void ReadJsonElementFromStream(int defaultBufferSize)
{
// Streams need to read ahead when they hit objects or arrays that are assigned to JsonElement or object.
byte[] data = Encoding.UTF8.GetBytes(@"{""Data"":[1,true,{""City"":""MyCity""},null,""foo""]}");
MemoryStream stream = new MemoryStream(data);
JsonElement obj = JsonSerializer.DeserializeAsync<JsonElement>(stream, new JsonSerializerOptions { DefaultBufferSize = defaultBufferSize }).Result;
data = Encoding.UTF8.GetBytes(@"[1,true,{""City"":""MyCity""},null,""foo""]");
stream = new MemoryStream(data);
obj = JsonSerializer.DeserializeAsync<JsonElement>(stream, new JsonSerializerOptions { DefaultBufferSize = defaultBufferSize }).Result;
// Ensure we fail with incomplete data
data = Encoding.UTF8.GetBytes(@"{""Data"":[1,true,{""City"":""MyCity""},null,""foo""]");
stream = new MemoryStream(data);
Assert.Throws<JsonException>(() => JsonSerializer.DeserializeAsync<JsonElement>(stream, new JsonSerializerOptions { DefaultBufferSize = defaultBufferSize }).Result);
data = Encoding.UTF8.GetBytes(@"[1,true,{""City"":""MyCity""},null,""foo""");
stream = new MemoryStream(data);
Assert.Throws<JsonException>(() => JsonSerializer.DeserializeAsync<JsonElement>(stream, new JsonSerializerOptions { DefaultBufferSize = defaultBufferSize }).Result);
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.IO;
using System.Linq;
using Xunit;
namespace System.Text.Json.Serialization.Tests
{
public class JsonElementTests
{
[Fact]
public void SerializeJsonElement()
{
JsonElementClass obj = JsonSerializer.Deserialize<JsonElementClass>(JsonElementClass.s_json);
obj.Verify();
string reserialized = JsonSerializer.Serialize(obj);
// Properties in the exported json will be in the order that they were reflected, doing a quick check to see that
// we end up with the same length (i.e. same amount of data) to start.
Assert.Equal(JsonElementClass.s_json.StripWhitespace().Length, reserialized.Length);
// Shoving it back through the parser should validate round tripping.
obj = JsonSerializer.Deserialize<JsonElementClass>(reserialized);
obj.Verify();
}
[Fact]
public void SerializeJsonElementArray()
{
JsonElementArrayClass obj = JsonSerializer.Deserialize<JsonElementArrayClass>(JsonElementArrayClass.s_json);
obj.Verify();
string reserialized = JsonSerializer.Serialize(obj);
// Properties in the exported json will be in the order that they were reflected, doing a quick check to see that
// we end up with the same length (i.e. same amount of data) to start.
Assert.Equal(JsonElementArrayClass.s_json.StripWhitespace().Length, reserialized.Length);
// Shoving it back through the parser should validate round tripping.
obj = JsonSerializer.Deserialize<JsonElementArrayClass>(reserialized);
obj.Verify();
}
[Theory,
InlineData(5),
InlineData(10),
InlineData(20),
InlineData(1024)]
public void ReadJsonElementFromStream(int defaultBufferSize)
{
// Streams need to read ahead when they hit objects or arrays that are assigned to JsonElement or object.
byte[] data = Encoding.UTF8.GetBytes(@"{""Data"":[1,true,{""City"":""MyCity""},null,""foo""]}");
MemoryStream stream = new MemoryStream(data);
JsonElement obj = JsonSerializer.DeserializeAsync<JsonElement>(stream, new JsonSerializerOptions { DefaultBufferSize = defaultBufferSize }).Result;
data = Encoding.UTF8.GetBytes(@"[1,true,{""City"":""MyCity""},null,""foo""]");
stream = new MemoryStream(data);
obj = JsonSerializer.DeserializeAsync<JsonElement>(stream, new JsonSerializerOptions { DefaultBufferSize = defaultBufferSize }).Result;
// Ensure we fail with incomplete data
data = Encoding.UTF8.GetBytes(@"{""Data"":[1,true,{""City"":""MyCity""},null,""foo""]");
stream = new MemoryStream(data);
Assert.Throws<JsonException>(() => JsonSerializer.DeserializeAsync<JsonElement>(stream, new JsonSerializerOptions { DefaultBufferSize = defaultBufferSize }).Result);
data = Encoding.UTF8.GetBytes(@"[1,true,{""City"":""MyCity""},null,""foo""");
stream = new MemoryStream(data);
Assert.Throws<JsonException>(() => JsonSerializer.DeserializeAsync<JsonElement>(stream, new JsonSerializerOptions { DefaultBufferSize = defaultBufferSize }).Result);
}
}
}
| 1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ReferenceHandlerTests.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Text.Encodings.Web;
using System.Text.Json.Tests;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Xunit;
namespace System.Text.Json.Serialization.Tests
{
public static partial class ReferenceHandlerTests
{
[Fact]
public static void ThrowByDefaultOnLoop()
{
Employee a = new Employee();
a.Manager = a;
JsonException ex = Assert.Throws<JsonException>(() => JsonSerializer.Serialize(a));
}
#region Root Object
[Fact]
public static void ObjectLoop()
{
Employee angela = new Employee();
angela.Manager = angela;
// Compare parity with Newtonsoft.Json
string expected = JsonConvert.SerializeObject(angela, s_newtonsoftSerializerSettingsPreserve);
string actual = JsonSerializer.Serialize(angela, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
// Ensure round-trip
Employee angelaCopy = JsonSerializer.Deserialize<Employee>(actual, s_serializerOptionsPreserve);
Assert.Same(angelaCopy.Manager, angelaCopy);
}
[Fact]
public static void ObjectArrayLoop()
{
Employee angela = new Employee();
angela.Subordinates = new List<Employee> { angela };
string expected = JsonConvert.SerializeObject(angela, s_newtonsoftSerializerSettingsPreserve);
string actual = JsonSerializer.Serialize(angela, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
Employee angelaCopy = JsonSerializer.Deserialize<Employee>(actual, s_serializerOptionsPreserve);
Assert.Same(angelaCopy.Subordinates[0], angelaCopy);
}
[Fact]
public static void ObjectDictionaryLoop()
{
Employee angela = new Employee();
angela.Contacts = new Dictionary<string, Employee> { { "555-5555", angela } };
string expected = JsonConvert.SerializeObject(angela, s_newtonsoftSerializerSettingsPreserve);
string actual = JsonSerializer.Serialize(angela, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
Employee angelaCopy = JsonSerializer.Deserialize<Employee>(actual, s_serializerOptionsPreserve);
Assert.Same(angelaCopy.Contacts["555-5555"], angelaCopy);
}
[Fact]
public static void ObjectPreserveDuplicateObjects()
{
Employee angela = new Employee
{
Manager = new Employee { Name = "Bob" }
};
angela.Manager2 = angela.Manager;
string expected = JsonConvert.SerializeObject(angela, s_newtonsoftSerializerSettingsPreserve);
string actual = JsonSerializer.Serialize(angela, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
Employee angelaCopy = JsonSerializer.Deserialize<Employee>(actual, s_serializerOptionsPreserve);
Assert.Same(angelaCopy.Manager, angelaCopy.Manager2);
}
[Fact]
public static void ObjectPreserveDuplicateDictionaries()
{
Employee angela = new Employee
{
Contacts = new Dictionary<string, Employee> { { "444-4444", new Employee { Name = "Bob" } } }
};
angela.Contacts2 = angela.Contacts;
string expected = JsonConvert.SerializeObject(angela, s_newtonsoftSerializerSettingsPreserve);
string actual = JsonSerializer.Serialize(angela, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
Employee angelaCopy = JsonSerializer.Deserialize<Employee>(actual, s_serializerOptionsPreserve);
Assert.Same(angelaCopy.Contacts, angelaCopy.Contacts2);
}
[Fact]
public static void ObjectPreserveDuplicateArrays()
{
Employee angela = new Employee
{
Subordinates = new List<Employee> { new Employee { Name = "Bob" } }
};
angela.Subordinates2 = angela.Subordinates;
string expected = JsonConvert.SerializeObject(angela, s_newtonsoftSerializerSettingsPreserve);
string actual = JsonSerializer.Serialize(angela, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
Employee angelaCopy = JsonSerializer.Deserialize<Employee>(actual, s_serializerOptionsPreserve);
Assert.Same(angelaCopy.Subordinates, angelaCopy.Subordinates2);
}
[Fact]
public static void KeyValuePairTest()
{
var kvp = new KeyValuePair<string, string>("key", "value");
string json = JsonSerializer.Serialize(kvp, s_deserializerOptionsPreserve);
KeyValuePair<string, string> kvp2 = JsonSerializer.Deserialize<KeyValuePair<string, string>>(json, s_deserializerOptionsPreserve);
Assert.Equal(kvp.Key, kvp2.Key);
Assert.Equal(kvp.Value, kvp2.Value);
}
private class ClassWithZeroLengthProperty<TValue>
{
[JsonPropertyName("")]
public TValue ZeroLengthProperty { get; set; }
}
[Fact]
public static void OjectZeroLengthProperty()
{
// Default
ClassWithZeroLengthProperty<int> rootValue = RoundTripZeroLengthProperty(new ClassWithZeroLengthProperty<int>(), 10);
Assert.Equal(10, rootValue.ZeroLengthProperty);
ClassWithZeroLengthProperty<Employee> rootObject = RoundTripZeroLengthProperty(new ClassWithZeroLengthProperty<Employee>(), new Employee { Name = "Test" });
Assert.Equal("Test", rootObject.ZeroLengthProperty.Name);
ClassWithZeroLengthProperty<List<int>> rootArray = RoundTripZeroLengthProperty(new ClassWithZeroLengthProperty<List<int>>(), new List<int>());
Assert.Equal(0, rootArray.ZeroLengthProperty.Count);
// Preserve
ClassWithZeroLengthProperty<int> rootValue2 = RoundTripZeroLengthProperty(new ClassWithZeroLengthProperty<int>(), 10, s_deserializerOptionsPreserve);
Assert.Equal(10, rootValue2.ZeroLengthProperty);
ClassWithZeroLengthProperty<Employee> rootObject2 = RoundTripZeroLengthProperty(new ClassWithZeroLengthProperty<Employee>(), new Employee { Name = "Test" }, s_deserializerOptionsPreserve);
Assert.Equal("Test", rootObject2.ZeroLengthProperty.Name);
ClassWithZeroLengthProperty<List<int>> rootArray2 = RoundTripZeroLengthProperty(new ClassWithZeroLengthProperty<List<int>>(), new List<int>(), s_deserializerOptionsPreserve);
Assert.Equal(0, rootArray2.ZeroLengthProperty.Count);
}
private static ClassWithZeroLengthProperty<TValue> RoundTripZeroLengthProperty<TValue>(ClassWithZeroLengthProperty<TValue> obj, TValue value, JsonSerializerOptions opts = null)
{
obj.ZeroLengthProperty = value;
string json = JsonSerializer.Serialize(obj, opts);
Assert.Contains("\"\":", json);
return JsonSerializer.Deserialize<ClassWithZeroLengthProperty<TValue>>(json, opts);
}
[Fact]
public static void UnicodePropertyNames()
{
ClassWithUnicodeProperty obj = new ClassWithUnicodeProperty
{
A\u0467 = 1
};
// Verify the name is escaped after serialize.
string json = JsonSerializer.Serialize(obj, s_serializerOptionsPreserve);
Assert.StartsWith("{\"$id\":\"1\",", json);
Assert.Contains(@"""A\u0467"":1", json);
// Round-trip
ClassWithUnicodeProperty objCopy = JsonSerializer.Deserialize<ClassWithUnicodeProperty>(json, s_serializerOptionsPreserve);
Assert.Equal(1, objCopy.A\u0467);
// With custom escaper
// Specifying encoder on options does not impact deserialize.
var optionsWithEncoder = new JsonSerializerOptions
{
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
ReferenceHandler = ReferenceHandler.Preserve
};
json = JsonSerializer.Serialize(obj, optionsWithEncoder);
Assert.StartsWith("{\"$id\":\"1\",", json);
Assert.Contains("\"A\u0467\":1", json);
// Round-trip
objCopy = JsonSerializer.Deserialize<ClassWithUnicodeProperty>(json, optionsWithEncoder);
Assert.Equal(1, objCopy.A\u0467);
// We want to go over StackallocByteThreshold=256 to force a pooled allocation, so this property is 400 chars and 401 bytes.
obj = new ClassWithUnicodeProperty
{
A\u046734567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 = 1
};
// Verify the name is escaped after serialize.
json = JsonSerializer.Serialize(obj, s_serializerOptionsPreserve);
Assert.StartsWith("{\"$id\":\"1\",", json);
Assert.Contains(@"""A\u046734567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"":1", json);
// Round-trip
objCopy = JsonSerializer.Deserialize<ClassWithUnicodeProperty>(json, s_serializerOptionsPreserve);
Assert.Equal(1, objCopy.A\u046734567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890);
// With custom escaper
json = JsonSerializer.Serialize(obj, optionsWithEncoder);
Assert.StartsWith("{\"$id\":\"1\",", json);
Assert.Contains("\"A\u046734567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\":1", json);
// Round-trip
objCopy = JsonSerializer.Deserialize<ClassWithUnicodeProperty>(json, optionsWithEncoder);
Assert.Equal(1, objCopy.A\u046734567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890);
}
#endregion Root Object
#region Root Dictionary
private class DictionaryWithGenericCycle : Dictionary<string, DictionaryWithGenericCycle> { }
[Fact]
public static void DictionaryLoop()
{
DictionaryWithGenericCycle root = new DictionaryWithGenericCycle();
root["Self"] = root;
root["Other"] = new DictionaryWithGenericCycle();
string expected = JsonConvert.SerializeObject(root, s_newtonsoftSerializerSettingsPreserve);
string actual = JsonSerializer.Serialize(root, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
DictionaryWithGenericCycle rootCopy = JsonSerializer.Deserialize<DictionaryWithGenericCycle>(actual, s_serializerOptionsPreserve);
Assert.Same(rootCopy, rootCopy["Self"]);
}
[Fact]
public static void DictionaryPreserveDuplicateDictionaries()
{
DictionaryWithGenericCycle root = new DictionaryWithGenericCycle();
root["Self1"] = root;
root["Self2"] = root;
string expected = JsonConvert.SerializeObject(root, s_newtonsoftSerializerSettingsPreserve);
string actual = JsonSerializer.Serialize(root, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
DictionaryWithGenericCycle rootCopy = JsonSerializer.Deserialize<DictionaryWithGenericCycle>(actual, s_serializerOptionsPreserve);
Assert.Same(rootCopy, rootCopy["Self1"]);
Assert.Same(rootCopy, rootCopy["Self2"]);
}
[Fact]
public static void DictionaryObjectLoop()
{
Dictionary<string, Employee> root = new Dictionary<string, Employee>();
root["Angela"] = new Employee() { Name = "Angela", Contacts = root };
string expected = JsonConvert.SerializeObject(root, s_newtonsoftSerializerSettingsPreserve);
string actual = JsonSerializer.Serialize(root, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
Dictionary<string, Employee> rootCopy = JsonSerializer.Deserialize<Dictionary<string, Employee>>(actual, s_serializerOptionsPreserve);
Assert.Same(rootCopy, rootCopy["Angela"].Contacts);
}
private class DictionaryWithGenericCycleWithinList : Dictionary<string, List<DictionaryWithGenericCycleWithinList>> { }
[Fact]
public static void DictionaryArrayLoop()
{
DictionaryWithGenericCycleWithinList root = new DictionaryWithGenericCycleWithinList();
root["ArrayWithSelf"] = new List<DictionaryWithGenericCycleWithinList> { root };
string expected = JsonConvert.SerializeObject(root, s_newtonsoftSerializerSettingsPreserve);
string actual = JsonSerializer.Serialize(root, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
DictionaryWithGenericCycleWithinList rootCopy = JsonSerializer.Deserialize<DictionaryWithGenericCycleWithinList>(actual, s_serializerOptionsPreserve);
Assert.Same(rootCopy, rootCopy["ArrayWithSelf"][0]);
}
[Fact]
public static void DictionaryPreserveDuplicateArrays()
{
DictionaryWithGenericCycleWithinList root = new DictionaryWithGenericCycleWithinList();
root["Array1"] = new List<DictionaryWithGenericCycleWithinList> { root };
root["Array2"] = root["Array1"];
string expected = JsonConvert.SerializeObject(root, s_newtonsoftSerializerSettingsPreserve);
string actual = JsonSerializer.Serialize(root, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
DictionaryWithGenericCycleWithinList rootCopy = JsonSerializer.Deserialize<DictionaryWithGenericCycleWithinList>(actual, s_serializerOptionsPreserve);
Assert.Same(rootCopy, rootCopy["Array1"][0]);
Assert.Same(rootCopy["Array2"], rootCopy["Array1"]);
}
[Fact]
public static void DictionaryPreserveDuplicateObjects()
{
Dictionary<string, Employee> root = new Dictionary<string, Employee>
{
["Employee1"] = new Employee { Name = "Angela" }
};
root["Employee2"] = root["Employee1"];
string expected = JsonConvert.SerializeObject(root, s_newtonsoftSerializerSettingsPreserve);
string actual = JsonSerializer.Serialize(root, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
Dictionary<string, Employee> rootCopy = JsonSerializer.Deserialize<Dictionary<string, Employee>>(actual, s_serializerOptionsPreserve);
Assert.Same(rootCopy["Employee1"], rootCopy["Employee2"]);
}
[Fact]
public static void DictionaryZeroLengthKey()
{
// Default
Dictionary<string, int> rootValue = RoundTripDictionaryZeroLengthKey(new Dictionary<string, int>(), 10);
Assert.Equal(10, rootValue[string.Empty]);
Dictionary<string, Employee> rootObject = RoundTripDictionaryZeroLengthKey(new Dictionary<string, Employee>(), new Employee { Name = "Test" });
Assert.Equal("Test", rootObject[string.Empty].Name);
Dictionary<string, List<int>> rootArray = RoundTripDictionaryZeroLengthKey(new Dictionary<string, List<int>>(), new List<int>());
Assert.Equal(0, rootArray[string.Empty].Count);
// Preserve
Dictionary<string, int> rootValue2 = RoundTripDictionaryZeroLengthKey(new Dictionary<string, int>(), 10, s_deserializerOptionsPreserve);
Assert.Equal(10, rootValue2[string.Empty]);
Dictionary<string, Employee> rootObject2 = RoundTripDictionaryZeroLengthKey(new Dictionary<string, Employee>(), new Employee { Name = "Test" }, s_deserializerOptionsPreserve);
Assert.Equal("Test", rootObject2[string.Empty].Name);
Dictionary<string, List<int>> rootArray2 = RoundTripDictionaryZeroLengthKey(new Dictionary<string, List<int>>(), new List<int>(), s_deserializerOptionsPreserve);
Assert.Equal(0, rootArray2[string.Empty].Count);
}
private static Dictionary<string, TValue> RoundTripDictionaryZeroLengthKey<TValue>(Dictionary<string, TValue> dictionary, TValue value, JsonSerializerOptions opts = null)
{
dictionary[string.Empty] = value;
string json = JsonSerializer.Serialize(dictionary, opts);
Assert.Contains("\"\":", json);
return JsonSerializer.Deserialize<Dictionary<string, TValue>>(json, opts);
}
[Fact]
public static void UnicodeDictionaryKeys()
{
Dictionary<string, int> obj = new Dictionary<string, int> { { "A\u0467", 1 } };
// Verify the name is escaped after serialize.
string json = JsonSerializer.Serialize(obj, s_serializerOptionsPreserve);
Assert.Equal(@"{""$id"":""1"",""A\u0467"":1}", json);
// Round-trip
Dictionary<string, int> objCopy = JsonSerializer.Deserialize<Dictionary<string, int>>(json, s_serializerOptionsPreserve);
Assert.Equal(1, objCopy["A\u0467"]);
// Verify with encoder.
var optionsWithEncoder = new JsonSerializerOptions
{
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
ReferenceHandler = ReferenceHandler.Preserve
};
json = JsonSerializer.Serialize(obj, optionsWithEncoder);
Assert.Equal("{\"$id\":\"1\",\"A\u0467\":1}", json);
// Round-trip
objCopy = JsonSerializer.Deserialize<Dictionary<string, int>>(json, optionsWithEncoder);
Assert.Equal(1, objCopy["A\u0467"]);
// We want to go over StackallocByteThreshold=256 to force a pooled allocation, so this property is 200 chars and 400 bytes.
const int charsInProperty = 200;
string longPropertyName = new string('\u0467', charsInProperty);
obj = new Dictionary<string, int> { { $"{longPropertyName}", 1 } };
Assert.Equal(1, obj[longPropertyName]);
// Verify the name is escaped after serialize.
json = JsonSerializer.Serialize(obj, s_serializerOptionsPreserve);
// Duplicate the unicode character 'charsInProperty' times.
string longPropertyNameEscaped = new StringBuilder().Insert(0, @"\u0467", charsInProperty).ToString();
string expectedJson = $"{{\"$id\":\"1\",\"{longPropertyNameEscaped}\":1}}";
Assert.Equal(expectedJson, json);
// Round-trip
objCopy = JsonSerializer.Deserialize<Dictionary<string, int>>(json, s_serializerOptionsPreserve);
Assert.Equal(1, objCopy[longPropertyName]);
// Verify the name is escaped after serialize.
json = JsonSerializer.Serialize(obj, optionsWithEncoder);
// Duplicate the unicode character 'charsInProperty' times.
longPropertyNameEscaped = new StringBuilder().Insert(0, "\u0467", charsInProperty).ToString();
expectedJson = $"{{\"$id\":\"1\",\"{longPropertyNameEscaped}\":1}}";
Assert.Equal(expectedJson, json);
// Round-trip
objCopy = JsonSerializer.Deserialize<Dictionary<string, int>>(json, optionsWithEncoder);
Assert.Equal(1, objCopy[longPropertyName]);
}
#endregion
#region Root Array
private class ListWithGenericCycle : List<ListWithGenericCycle> { }
[Fact]
public static void ArrayLoop()
{
ListWithGenericCycle root = new ListWithGenericCycle();
root.Add(root);
string expected = JsonConvert.SerializeObject(root, s_newtonsoftSerializerSettingsPreserve);
string actual = JsonSerializer.Serialize(root, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
ListWithGenericCycle rootCopy = JsonSerializer.Deserialize<ListWithGenericCycle>(actual, s_serializerOptionsPreserve);
Assert.Same(rootCopy, rootCopy[0]);
// Duplicate reference
root = new ListWithGenericCycle();
root.Add(root);
root.Add(root);
root.Add(root);
expected = JsonConvert.SerializeObject(root, s_newtonsoftSerializerSettingsPreserve);
actual = JsonSerializer.Serialize(root, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
rootCopy = JsonSerializer.Deserialize<ListWithGenericCycle>(actual, s_serializerOptionsPreserve);
Assert.Same(rootCopy, rootCopy[0]);
Assert.Same(rootCopy, rootCopy[1]);
Assert.Same(rootCopy, rootCopy[2]);
}
[Fact]
public static void ArrayObjectLoop()
{
List<Employee> root = new List<Employee>();
root.Add(new Employee() { Name = "Angela", Subordinates = root });
string expected = JsonConvert.SerializeObject(root, s_newtonsoftSerializerSettingsPreserve);
string actual = JsonSerializer.Serialize(root, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
List<Employee> rootCopy = JsonSerializer.Deserialize<List<Employee>>(actual, s_serializerOptionsPreserve);
Assert.Same(rootCopy, rootCopy[0].Subordinates);
}
[Fact]
public static void ArrayPreserveDuplicateObjects()
{
List<Employee> root = new List<Employee>
{
new Employee { Name = "Angela" }
};
root.Add(root[0]);
string expected = JsonConvert.SerializeObject(root, s_newtonsoftSerializerSettingsPreserve);
string actual = JsonSerializer.Serialize(root, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
List<Employee> rootCopy = JsonSerializer.Deserialize<List<Employee>>(actual, s_serializerOptionsPreserve);
Assert.Same(rootCopy[0], rootCopy[1]);
}
private class ListWithGenericCycleWithinDictionary : List<Dictionary<string, ListWithGenericCycleWithinDictionary>> { }
[Fact]
public static void ArrayDictionaryLoop()
{
ListWithGenericCycleWithinDictionary root = new ListWithGenericCycleWithinDictionary();
root.Add(new Dictionary<string, ListWithGenericCycleWithinDictionary> { { "Root", root } });
string expected = JsonConvert.SerializeObject(root, s_newtonsoftSerializerSettingsPreserve);
string actual = JsonSerializer.Serialize(root, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
ListWithGenericCycleWithinDictionary rootCopy = JsonSerializer.Deserialize<ListWithGenericCycleWithinDictionary>(actual, s_serializerOptionsPreserve);
Assert.Same(rootCopy, rootCopy[0]["Root"]);
}
[Fact]
public static void ArrayPreserveDuplicateDictionaries()
{
ListWithGenericCycleWithinDictionary root = new ListWithGenericCycleWithinDictionary
{
new Dictionary<string, ListWithGenericCycleWithinDictionary>()
};
root.Add(root[0]);
string expected = JsonConvert.SerializeObject(root, s_newtonsoftSerializerSettingsPreserve);
string actual = JsonSerializer.Serialize(root, s_serializerOptionsPreserve);
Assert.Equal(expected, actual);
ListWithGenericCycleWithinDictionary rootCopy = JsonSerializer.Deserialize<ListWithGenericCycleWithinDictionary>(actual, s_serializerOptionsPreserve);
Assert.Same(rootCopy[0], rootCopy[1]);
}
#endregion
#region ReferenceResolver
[Fact]
public static void CustomReferenceResolver()
{
string json = @"[
{
""$id"": ""0b64ffdf-d155-44ad-9689-58d9adb137f3"",
""Name"": ""John Smith"",
""Spouse"": {
""$id"": ""ae3c399c-058d-431d-91b0-a36c266441b9"",
""Name"": ""Jane Smith"",
""Spouse"": {
""$ref"": ""0b64ffdf-d155-44ad-9689-58d9adb137f3""
}
}
},
{
""$ref"": ""ae3c399c-058d-431d-91b0-a36c266441b9""
}
]";
var options = new JsonSerializerOptions
{
WriteIndented = true,
ReferenceHandler = new ReferenceHandler<GuidReferenceResolver>()
};
ImmutableArray<PersonReference> people = JsonSerializer.Deserialize<ImmutableArray<PersonReference>>(json, options);
Assert.Equal(2, people.Length);
PersonReference john = people[0];
PersonReference jane = people[1];
Assert.Same(john, jane.Spouse);
Assert.Same(jane, john.Spouse);
Assert.Equal(json, JsonSerializer.Serialize(people, options), ignoreLineEndingDifferences: true);
}
[Fact]
public static void CustomReferenceResolverPersistent()
{
var options = new JsonSerializerOptions
{
WriteIndented = true,
ReferenceHandler = new PresistentGuidReferenceHandler
{
// Re-use the same resolver instance across all (de)serialiations based on this options instance.
PersistentResolver = new GuidReferenceResolver()
}
};
string json =
@"[
{
""$id"": ""0b64ffdf-d155-44ad-9689-58d9adb137f3"",
""Name"": ""John Smith"",
""Spouse"": {
""$id"": ""ae3c399c-058d-431d-91b0-a36c266441b9"",
""Name"": ""Jane Smith"",
""Spouse"": {
""$ref"": ""0b64ffdf-d155-44ad-9689-58d9adb137f3""
}
}
},
{
""$ref"": ""ae3c399c-058d-431d-91b0-a36c266441b9""
}
]";
ImmutableArray<PersonReference> firstListOfPeople = JsonSerializer.Deserialize<ImmutableArray<PersonReference>>(json, options);
json =
@"[
{
""$ref"": ""0b64ffdf-d155-44ad-9689-58d9adb137f3""
},
{
""$ref"": ""ae3c399c-058d-431d-91b0-a36c266441b9""
}
]";
ImmutableArray<PersonReference> secondListOfPeople = JsonSerializer.Deserialize<ImmutableArray<PersonReference>>(json, options);
Assert.Same(firstListOfPeople[0], secondListOfPeople[0]);
Assert.Same(firstListOfPeople[1], secondListOfPeople[1]);
Assert.Same(firstListOfPeople[0].Spouse, secondListOfPeople[0].Spouse);
Assert.Same(firstListOfPeople[1].Spouse, secondListOfPeople[1].Spouse);
Assert.Equal(json, JsonSerializer.Serialize(secondListOfPeople, options), ignoreLineEndingDifferences: true);
}
internal class PresistentGuidReferenceHandler : ReferenceHandler
{
public ReferenceResolver PersistentResolver { get; set; }
public override ReferenceResolver CreateResolver() => PersistentResolver;
}
public class GuidReferenceResolver : ReferenceResolver
{
private readonly IDictionary<Guid, PersonReference> _people = new Dictionary<Guid, PersonReference>();
public override object ResolveReference(string referenceId)
{
Guid id = new Guid(referenceId);
PersonReference p;
_people.TryGetValue(id, out p);
return p;
}
public override string GetReference(object value, out bool alreadyExists)
{
PersonReference p = (PersonReference)value;
alreadyExists = _people.ContainsKey(p.Id);
_people[p.Id] = p;
return p.Id.ToString();
}
public override void AddReference(string reference, object value)
{
Guid id = new Guid(reference);
PersonReference person = (PersonReference)value;
person.Id = id;
_people[id] = person;
}
}
[Fact]
public static void TestBadReferenceResolver()
{
var options = new JsonSerializerOptions { ReferenceHandler = new ReferenceHandler<BadReferenceResolver>() };
PersonReference angela = new PersonReference { Name = "Angela" };
PersonReference bob = new PersonReference { Name = "Bob" };
angela.Spouse = bob;
bob.Spouse = angela;
// Nothing is preserved, hence MaxDepth will be reached.
Assert.Throws<JsonException>(() => JsonSerializer.Serialize(angela, options));
}
class BadReferenceResolver : ReferenceResolver
{
private int _count;
public override void AddReference(string referenceId, object value)
{
throw new NotImplementedException();
}
public override string GetReference(object value, out bool alreadyExists)
{
alreadyExists = false;
_count++;
return _count.ToString();
}
public override object ResolveReference(string referenceId)
{
throw new NotImplementedException();
}
}
#endregion
[Fact]
public static void PreserveReferenceOfTypeObject()
{
var root = new ClassWithObjectProperty();
root.Child = new ClassWithObjectProperty();
root.Sibling = root.Child;
Assert.Same(root.Child, root.Sibling);
string json = JsonSerializer.Serialize(root, s_serializerOptionsPreserve);
ClassWithObjectProperty rootCopy = JsonSerializer.Deserialize<ClassWithObjectProperty>(json, s_serializerOptionsPreserve);
Assert.Same(rootCopy.Child, rootCopy.Sibling);
}
[Fact]
public static async Task PreserveReferenceOfTypeObjectAsync()
{
var root = new ClassWithObjectProperty();
root.Child = new ClassWithObjectProperty();
root.Sibling = root.Child;
Assert.Same(root.Child, root.Sibling);
var stream = new MemoryStream();
await JsonSerializer.SerializeAsync(stream, root, s_serializerOptionsPreserve);
stream.Position = 0;
ClassWithObjectProperty rootCopy = await JsonSerializer.DeserializeAsync<ClassWithObjectProperty>(stream, s_serializerOptionsPreserve);
Assert.Same(rootCopy.Child, rootCopy.Sibling);
}
[Fact]
public static void PreserveReferenceOfTypeOfObjectOnCollection()
{
var root = new ClassWithListOfObjectProperty();
root.Child = new ClassWithListOfObjectProperty();
root.ListOfObjects = new List<object>();
root.ListOfObjects.Add(root.Child);
Assert.Same(root.Child, root.ListOfObjects[0]);
string json = JsonSerializer.Serialize(root, s_serializerOptionsPreserve);
ClassWithListOfObjectProperty rootCopy = JsonSerializer.Deserialize<ClassWithListOfObjectProperty>(json, s_serializerOptionsPreserve);
Assert.Same(rootCopy.Child, rootCopy.ListOfObjects[0]);
}
[Fact]
public static void DoNotPreserveReferenceWhenRefPropertyIsAbsent()
{
string json = @"{""Child"":{""$id"":""1""},""Sibling"":{""foo"":""1""}}";
ClassWithObjectProperty root = JsonSerializer.Deserialize<ClassWithObjectProperty>(json);
Assert.IsType<JsonElement>(root.Sibling);
// $ref with any escaped character shall not be treated as metadata, hence Sibling must be JsonElement.
json = @"{""Child"":{""$id"":""1""},""Sibling"":{""\\u0024ref"":""1""}}";
root = JsonSerializer.Deserialize<ClassWithObjectProperty>(json);
Assert.IsType<JsonElement>(root.Sibling);
}
[Fact]
public static void VerifyValidationsOnPreservedReferenceOfTypeObject()
{
const string baseJson = @"{""Child"":{""$id"":""1""},""Sibling"":";
// A JSON object that contains a '$ref' metadata property must not contain any other properties.
string testJson = baseJson + @"{""foo"":""value"",""$ref"":""1""}}";
JsonException ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<ClassWithObjectProperty>(testJson, s_serializerOptionsPreserve));
Assert.Equal("$.Sibling", ex.Path);
testJson = baseJson + @"{""$ref"":""1"",""bar"":""value""}}";
ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<ClassWithObjectProperty>(testJson, s_serializerOptionsPreserve));
Assert.Equal("$.Sibling", ex.Path);
// The '$id' and '$ref' metadata properties must be JSON strings.
testJson = baseJson + @"{""$ref"":1}}";
ex = Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<ClassWithObjectProperty>(testJson, s_serializerOptionsPreserve));
Assert.Equal("$.Sibling", ex.Path);
}
[Fact]
public static void BoxedStructReferencePreservation_NestedStructObject()
{
IBoxedStructWithObjectProperty value = new StructWithObjectProperty();
value.Property = new object[] { value };
string json = JsonSerializer.Serialize(value, new JsonSerializerOptions { ReferenceHandler = ReferenceHandler.Preserve });
Assert.Equal(@"{""$id"":""1"",""Property"":[{""$ref"":""1""}]}", json);
}
[Fact]
public static void BoxedStructReferencePreservation_NestedStructCollection()
{
IBoxedStructWithObjectProperty value = new StructCollection();
value.Property = new object[] { value };
string json = JsonSerializer.Serialize(value, s_serializerOptionsPreserve);
Assert.Equal(@"{""$id"":""1"",""Property"":[{""$ref"":""1""}]}", json);
}
[Fact]
public static void BoxedStructReferencePreservation_SiblingStructObjects()
{
object box = new StructWithObjectProperty { Property = 42 };
var array = new object[] { box, box };
string json = JsonSerializer.Serialize(array, s_serializerOptionsPreserve);
Assert.Equal(@"[{""$id"":""1"",""Property"":42},{""$ref"":""1""}]", json);
}
[Fact]
public static void BoxedStructReferencePreservation_SiblingStructCollections()
{
object box = new StructCollection { Property = 42 };
var array = new object[] { box, box };
string json = JsonSerializer.Serialize(array, s_serializerOptionsPreserve);
Assert.Equal(@"[{""$id"":""1"",""$values"":[42]},{""$ref"":""1""}]", json);
}
[Fact]
public static void BoxedStructReferencePreservation_SiblingPrimitiveValues()
{
object box = 42;
var array = new object[] { box, box };
string json = JsonSerializer.Serialize(array, s_serializerOptionsPreserve);
Assert.Equal(@"[42,42]", json);
}
private class ClassWithObjectProperty
{
public ClassWithObjectProperty Child { get; set; }
public object Sibling { get; set; }
}
private class ClassWithListOfObjectProperty
{
public ClassWithListOfObjectProperty Child { get; set; }
public List<object> ListOfObjects { get; set; }
}
private interface IBoxedStructWithObjectProperty
{
object? Property { get; set; }
}
private struct StructWithObjectProperty : IBoxedStructWithObjectProperty
{
public object? Property { get; set; }
}
private struct StructCollection : IBoxedStructWithObjectProperty, IEnumerable<object?>
{
public object? Property { get; set; }
public IEnumerator<object?> GetEnumerator()
{
yield return Property;
}
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Text.Json.Serialization.Tests
{
public sealed partial class ReferenceHandlerTestsDynamic : ReferenceHandlerTests
{
public ReferenceHandlerTestsDynamic() : base(JsonSerializerWrapperForString.StringSerializer, JsonSerializerWrapperForStream.AsyncStreamSerializer) { }
}
public sealed partial class ReferenceHandlerTests_IgnoreCycles_Dynamic : ReferenceHandlerTests_IgnoreCycles
{
public ReferenceHandlerTests_IgnoreCycles_Dynamic() : base(JsonSerializerWrapperForString.StringSerializer, JsonSerializerWrapperForStream.AsyncStreamSerializer) { }
}
}
| 1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Text.Json/tests/System.Text.Json.Tests/System.Text.Json.Tests.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkMinimum)</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- SYSLIB0020: JsonSerializerOptions.IgnoreNullValues is obsolete -->
<NoWarn>$(NoWarn);SYSLIB0020</NoWarn>
<!-- these tests depend on the pdb files. Causes test failures like:
[FAIL] System.Text.Json.Tests.DebuggerTests.DefaultJsonElement -->
<DebuggerSupport Condition="'$(DebuggerSupport)' == '' and '$(TargetOS)' == 'Browser'">true</DebuggerSupport>
<!-- Needed for JsonSerializerOptionsUpdateHandler tests -->
<MetadataUpdaterSupport Condition="'$(MetadataUpdaterSupport)' == '' and '$(TargetOS)' == 'Browser'">true</MetadataUpdaterSupport>
<WasmXHarnessArgs>$(WasmXHarnessArgs) --timeout=1800</WasmXHarnessArgs>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
<DefineConstants Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETCoreApp'">$(DefineConstants);BUILDING_INBOX_LIBRARY</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(ContinuousIntegrationBuild)' == 'true'">
<HighAotMemoryUsageAssembly Include="System.Text.Json.Tests.dll"/>
</ItemGroup>
<ItemGroup>
<Compile Include="$(CommonTestPath)System\IO\WrappedMemoryStream.cs" Link="CommonTest\System\IO\WrappedMemoryStream.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.AsyncEnumerable.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.AsyncEnumerable.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Concurrent.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Concurrent.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Dictionary.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Dictionary.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Dictionary.KeyPolicy.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Dictionary.KeyPolicy.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Dictionary.NonStringKey.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Dictionary.NonStringKey.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Generic.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Generic.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Generic.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Generic.Write.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Immutable.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Immutable.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.KeyValuePair.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.KeyValuePair.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.NonGeneric.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.NonGeneric.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.NonGeneric.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.NonGeneric.Write.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.ObjectModel.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.ObjectModel.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.ObjectModel.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.ObjectModel.Write.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Specialized.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Specialized.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Specialized.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Specialized.Write.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Immutable.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Immutable.Write.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.AttributePresence.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.AttributePresence.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.Cache.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.Cache.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.Exceptions.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.Exceptions.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.ParameterMatching.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.ParameterMatching.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.Stream.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.Stream.cs" />
<Compile Include="..\Common\ExtensionDataTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ExtensionDataTests.cs" />
<Compile Include="..\Common\JsonSerializerWrapperForStream.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\JsonSerializerWrapperForStream.cs" />
<Compile Include="..\Common\JsonSerializerWrapperForString.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\JsonSerializerWrapperForString.cs" />
<Compile Include="..\Common\JsonTestHelper.cs" Link="CommonTest\System\Text\Json\JsonTestHelper.cs" />
<Compile Include="..\Common\NodeInteropTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\NodeInteropTests.cs" />
<Compile Include="..\Common\PropertyNameTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\PropertyNameTests.cs" />
<Compile Include="..\Common\PropertyVisibilityTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\PropertyVisibilityTests.cs" />
<Compile Include="..\Common\PropertyVisibilityTests.InitOnly.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\PropertyVisibilityTests.InitOnly.cs" />
<Compile Include="..\Common\PropertyVisibilityTests.NonPublicAccessors.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\PropertyVisibilityTests.NonPublicAccessors.cs" />
<Compile Include="..\Common\SampleTestData.OrderPayload.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\SampleTestData.OrderPayload.cs" />
<Compile Include="..\Common\SerializerTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\SerializerTests.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.ConcurrentCollections.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.ConcurrentCollections.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.Constructor.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.Constructor.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.GenericCollections.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.GenericCollections.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.ImmutableCollections.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.ImmutableCollections.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.NonGenericCollections.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.NonGenericCollections.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.Polymorphic.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.Polymorphic.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClass.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClass.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithFields.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithFields.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithNullables.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithNullables.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithObject.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithObject.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithObjectArrays.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithObjectArrays.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithSimpleObject.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithSimpleObject.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestStruct.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestStruct.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestStructWithFields.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestStructWithFields.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.ValueTypedMember.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.ValueTypedMember.cs" />
<Compile Include="..\Common\UnsupportedTypesTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\UnsupportedTypesTests.cs" />
<Compile Include="BitStackTests.cs" />
<Compile Include="BufferFactory.cs" />
<Compile Include="BufferSegment.cs" />
<Compile Include="DebuggerTests.cs" />
<Compile Include="FixedSizedBufferWriter.cs" />
<Compile Include="InvalidBufferWriter.cs" />
<Compile Include="JsonBase64TestData.cs" />
<Compile Include="JsonDateTimeTestData.cs" />
<Compile Include="JsonDocumentTests.cs" />
<Compile Include="JsonElementCloneTests.cs" />
<Compile Include="JsonElementParseTests.cs" />
<Compile Include="JsonElementWriteTests.cs" />
<Compile Include="JsonEncodedTextTests.cs" />
<Compile Include="JsonGuidTestData.cs" />
<Compile Include="JsonNode\Common.cs" />
<Compile Include="JsonNode\JsonArrayTests.cs" />
<Compile Include="JsonNode\JsonNodeTests.cs" />
<Compile Include="JsonNode\JsonNodeOperatorTests.cs" />
<Compile Include="JsonNode\JsonObjectTests.cs" />
<Compile Include="JsonNode\JsonValueTests.cs" />
<Compile Include="JsonNode\ParseTests.cs" />
<Compile Include="JsonNode\ParentPathRootTests.cs" />
<Compile Include="JsonNode\ToStringTests.cs" />
<Compile Include="JsonNumberTestData.cs" />
<Compile Include="JsonPropertyTests.cs" />
<Compile Include="JsonReaderStateAndOptionsTests.cs" />
<Compile Include="JsonTestHelper.cs" />
<Compile Include="JsonWriterOptionsTests.cs" />
<Compile Include="NewtonsoftTests\CamelCaseTests.cs" />
<Compile Include="NewtonsoftTests\CustomObjectConverterTests.cs" />
<Compile Include="NewtonsoftTests\DateTimeConverterTests.cs" />
<Compile Include="NewtonsoftTests\EnumConverterTests.cs" />
<Compile Include="NewtonsoftTests\ImmutableCollectionsTests.cs" />
<Compile Include="NewtonsoftTests\JsonSerializerTests.cs" />
<Compile Include="Serialization\Array.ReadTests.cs" />
<Compile Include="Serialization\Array.WriteTests.cs" />
<Compile Include="Serialization\CacheTests.cs" />
<Compile Include="Serialization\CamelCaseUnitTests.cs" />
<Compile Include="Serialization\CollectionTests.cs" />
<Compile Include="Serialization\ConstructorTests.cs" />
<Compile Include="Serialization\ContinuationTests.cs" />
<Compile Include="Serialization\ContinuationTests.NullToken.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Array.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Attribute.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.BadConverters.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Callback.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.ContravariantDictionaryConverter.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.DerivedTypes.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.DictionaryEnumConverter.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.DictionaryGuidConverter.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.DictionaryInt32StringConverter.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.DictionaryInt32StringKeyValueConverter.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.DictionaryKeyValueConverter.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Dynamic.Sample.Tests.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Enum.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Exceptions.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Dynamic.Sample.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.HandleNull.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Int32.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Interface.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.InvalidCast.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.KeyConverters.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.List.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.NullValueType.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.NullableTypes.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Object.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Point.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Polymorphic.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.ReadAhead.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.ValueTypedMember.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.cs" />
<Compile Include="Serialization\CyclicTests.cs" />
<Compile Include="Serialization\DomTests.cs" />
<Compile Include="Serialization\DynamicTests.cs" />
<Compile Include="Serialization\EnumConverterTests.cs" />
<Compile Include="Serialization\EnumTests.cs" />
<Compile Include="Serialization\ExceptionTests.cs" />
<Compile Include="Serialization\ExtensionDataTests.cs" />
<Compile Include="Serialization\InvalidJsonTests.cs" />
<Compile Include="Serialization\InvalidTypeTests.cs" />
<Compile Include="Serialization\JsonDocumentTests.cs" />
<Compile Include="Serialization\JsonElementTests.cs" />
<Compile Include="Serialization\JsonSerializerApiValidation.cs" />
<Compile Include="Serialization\JsonSerializerWrapperForStream.cs" />
<Compile Include="Serialization\JsonSerializerWrapperForString.cs" />
<Compile Include="Serialization\MetadataTests\MetadataTests.cs" />
<Compile Include="Serialization\MetadataTests\MetadataTests.JsonSerializer.cs" />
<Compile Include="Serialization\MetadataTests\MetadataTests.Options.cs" />
<Compile Include="Serialization\NodeInteropTests.cs" />
<Compile Include="Serialization\Null.ReadTests.cs" />
<Compile Include="Serialization\Null.WriteTests.cs" />
<Compile Include="Serialization\NullableTests.cs" />
<Compile Include="Serialization\NumberHandlingTests.cs" />
<Compile Include="Serialization\Object.ReadTests.cs" />
<Compile Include="Serialization\Object.WriteTests.cs" />
<Compile Include="Serialization\OnSerializeTests.cs" />
<Compile Include="Serialization\OptionsTests.cs" />
<Compile Include="Serialization\PolymorphicTests.cs" />
<Compile Include="Serialization\PropertyNameTests.cs" />
<Compile Include="Serialization\PropertyOrderTests.cs" />
<Compile Include="Serialization\PropertyVisibilityTests.cs" />
<Compile Include="Serialization\ReadScenarioTests.cs" />
<Compile Include="Serialization\ReadValueTests.cs" />
<Compile Include="Serialization\ReferenceHandlerTests.cs" />
<Compile Include="Serialization\ReferenceHandlerTests.Deserialize.cs" />
<Compile Include="Serialization\ReferenceHandlerTests.IgnoreCycles.cs" />
<Compile Include="Serialization\ReferenceHandlerTests.Serialize.cs" />
<Compile Include="Serialization\SpanTests.cs" />
<Compile Include="Serialization\StreamTests.cs" />
<Compile Include="Serialization\Stream.Collections.cs" />
<Compile Include="Serialization\Stream.DeserializeAsyncEnumerable.cs" />
<Compile Include="Serialization\Stream.ReadTests.cs" />
<Compile Include="Serialization\Stream.WriteTests.cs" />
<Compile Include="Serialization\TestData.cs" />
<Compile Include="Serialization\UnsupportedTypesTests.cs" />
<Compile Include="Serialization\Value.ReadTests.cs" />
<Compile Include="Serialization\Value.WriteTests.cs" />
<Compile Include="Serialization\WriteValueTests.cs" />
<Compile Include="TestCaseType.cs" />
<Compile Include="TestClasses.ClassWithComplexObjects.cs" />
<Compile Include="Utf8JsonReaderTests.cs" />
<Compile Include="Utf8JsonReaderTests.MultiSegment.cs" />
<Compile Include="Utf8JsonReaderTests.TryGet.cs" />
<Compile Include="Utf8JsonReaderTests.TryGet.Date.cs" />
<Compile Include="Utf8JsonReaderTests.ValueTextEquals.cs" />
<Compile Include="Utf8JsonWriterTests.cs" />
<Compile Include="Utf8JsonWriterTests.WriteRaw.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\src\System\Text\Json\BitStack.cs" Link="BitStack.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != '$(NetCoreAppCurrent)'">
<Compile Include="$(CommonPath)System\Runtime\CompilerServices\IsExternalInit.cs" Link="Common\System\Runtime\CompilerServices\IsExternalInit.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicDependencyAttribute.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicallyAccessedMemberTypes.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Compile Include="$(CommonPath)System\Buffers\ArrayBufferWriter.cs" Link="CommonTest\System\Buffers\ArrayBufferWriter.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
<ProjectReference Include="$(LibrariesProjectRoot)System.IO.Pipelines\src\System.IO.Pipelines.csproj" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<ProjectReference Include="$(LibrariesProjectRoot)System.Collections.Immutable\src\System.Collections.Immutable.csproj" />
<ProjectReference Include="..\..\src\System.Text.Json.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\gen\System.Text.Json.SourceGeneration.Roslyn4.0.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);$(NetFrameworkMinimum)</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- SYSLIB0020: JsonSerializerOptions.IgnoreNullValues is obsolete -->
<NoWarn>$(NoWarn);SYSLIB0020</NoWarn>
<!-- these tests depend on the pdb files. Causes test failures like:
[FAIL] System.Text.Json.Tests.DebuggerTests.DefaultJsonElement -->
<DebuggerSupport Condition="'$(DebuggerSupport)' == '' and '$(TargetOS)' == 'Browser'">true</DebuggerSupport>
<!-- Needed for JsonSerializerOptionsUpdateHandler tests -->
<MetadataUpdaterSupport Condition="'$(MetadataUpdaterSupport)' == '' and '$(TargetOS)' == 'Browser'">true</MetadataUpdaterSupport>
<WasmXHarnessArgs>$(WasmXHarnessArgs) --timeout=1800</WasmXHarnessArgs>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
<DefineConstants Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETCoreApp'">$(DefineConstants);BUILDING_INBOX_LIBRARY</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(ContinuousIntegrationBuild)' == 'true'">
<HighAotMemoryUsageAssembly Include="System.Text.Json.Tests.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(CommonTestPath)System\IO\WrappedMemoryStream.cs" Link="CommonTest\System\IO\WrappedMemoryStream.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.AsyncEnumerable.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.AsyncEnumerable.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Concurrent.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Concurrent.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Dictionary.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Dictionary.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Dictionary.KeyPolicy.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Dictionary.KeyPolicy.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Dictionary.NonStringKey.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Dictionary.NonStringKey.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Generic.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Generic.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Generic.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Generic.Write.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Immutable.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Immutable.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.KeyValuePair.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.KeyValuePair.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.NonGeneric.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.NonGeneric.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.NonGeneric.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.NonGeneric.Write.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.ObjectModel.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.ObjectModel.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.ObjectModel.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.ObjectModel.Write.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Specialized.Read.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Specialized.Read.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Specialized.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Specialized.Write.cs" />
<Compile Include="..\Common\CollectionTests\CollectionTests.Immutable.Write.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\CollectionTests\CollectionTests.Immutable.Write.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.AttributePresence.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.AttributePresence.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.Cache.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.Cache.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.Exceptions.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.Exceptions.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.ParameterMatching.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.ParameterMatching.cs" />
<Compile Include="..\Common\ConstructorTests\ConstructorTests.Stream.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ConstructorTests\ConstructorTests.Stream.cs" />
<Compile Include="..\Common\ExtensionDataTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ExtensionDataTests.cs" />
<Compile Include="..\Common\JsonSerializerWrapperForStream.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\JsonSerializerWrapperForStream.cs" />
<Compile Include="..\Common\JsonSerializerWrapperForString.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\JsonSerializerWrapperForString.cs" />
<Compile Include="..\Common\JsonTestHelper.cs" Link="CommonTest\System\Text\Json\JsonTestHelper.cs" />
<Compile Include="..\Common\NodeInteropTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\NodeInteropTests.cs" />
<Compile Include="..\Common\PropertyNameTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\PropertyNameTests.cs" />
<Compile Include="..\Common\PropertyVisibilityTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\PropertyVisibilityTests.cs" />
<Compile Include="..\Common\PropertyVisibilityTests.InitOnly.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\PropertyVisibilityTests.InitOnly.cs" />
<Compile Include="..\Common\PropertyVisibilityTests.NonPublicAccessors.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\PropertyVisibilityTests.NonPublicAccessors.cs" />
<Compile Include="..\Common\ReferenceHandlerTests\ReferenceHandlerTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ReferenceHandlerTests\ReferenceHandlerTests.cs" />
<Compile Include="..\Common\ReferenceHandlerTests\ReferenceHandlerTests.Deserialize.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ReferenceHandlerTests\ReferenceHandlerTests.Deserialize.cs" />
<Compile Include="..\Common\ReferenceHandlerTests\ReferenceHandlerTests.IgnoreCycles.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ReferenceHandlerTests\ReferenceHandlerTests.IgnoreCycles.cs" />
<Compile Include="..\Common\ReferenceHandlerTests\ReferenceHandlerTests.Serialize.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\ReferenceHandlerTests\ReferenceHandlerTests.Serialize.cs" />
<Compile Include="..\Common\SampleTestData.OrderPayload.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\SampleTestData.OrderPayload.cs" />
<Compile Include="..\Common\SerializerTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\SerializerTests.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.ConcurrentCollections.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.ConcurrentCollections.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.Constructor.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.Constructor.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.GenericCollections.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.GenericCollections.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.ImmutableCollections.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.ImmutableCollections.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.NonGenericCollections.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.NonGenericCollections.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.Polymorphic.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.Polymorphic.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClass.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClass.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithFields.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithFields.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithNullables.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithNullables.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithObject.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithObject.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithObjectArrays.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithObjectArrays.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestClassWithSimpleObject.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestClassWithSimpleObject.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestStruct.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestStruct.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.SimpleTestStructWithFields.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.SimpleTestStructWithFields.cs" />
<Compile Include="..\Common\TestClasses\TestClasses.ValueTypedMember.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestClasses.ValueTypedMember.cs" />
<Compile Include="..\Common\TestClasses\TestData.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\TestClasses\TestData.cs" />
<Compile Include="..\Common\UnsupportedTypesTests.cs" Link="CommonTest\System\Text\Json\Tests\Serialization\UnsupportedTypesTests.cs" />
<Compile Include="BitStackTests.cs" />
<Compile Include="BufferFactory.cs" />
<Compile Include="BufferSegment.cs" />
<Compile Include="DebuggerTests.cs" />
<Compile Include="FixedSizedBufferWriter.cs" />
<Compile Include="InvalidBufferWriter.cs" />
<Compile Include="JsonBase64TestData.cs" />
<Compile Include="JsonDateTimeTestData.cs" />
<Compile Include="JsonDocumentTests.cs" />
<Compile Include="JsonElementCloneTests.cs" />
<Compile Include="JsonElementParseTests.cs" />
<Compile Include="JsonElementWriteTests.cs" />
<Compile Include="JsonEncodedTextTests.cs" />
<Compile Include="JsonGuidTestData.cs" />
<Compile Include="JsonNode\Common.cs" />
<Compile Include="JsonNode\JsonArrayTests.cs" />
<Compile Include="JsonNode\JsonNodeTests.cs" />
<Compile Include="JsonNode\JsonNodeOperatorTests.cs" />
<Compile Include="JsonNode\JsonObjectTests.cs" />
<Compile Include="JsonNode\JsonValueTests.cs" />
<Compile Include="JsonNode\ParseTests.cs" />
<Compile Include="JsonNode\ParentPathRootTests.cs" />
<Compile Include="JsonNode\ToStringTests.cs" />
<Compile Include="JsonNumberTestData.cs" />
<Compile Include="JsonPropertyTests.cs" />
<Compile Include="JsonReaderStateAndOptionsTests.cs" />
<Compile Include="JsonTestHelper.cs" />
<Compile Include="JsonWriterOptionsTests.cs" />
<Compile Include="NewtonsoftTests\CamelCaseTests.cs" />
<Compile Include="NewtonsoftTests\CustomObjectConverterTests.cs" />
<Compile Include="NewtonsoftTests\DateTimeConverterTests.cs" />
<Compile Include="NewtonsoftTests\EnumConverterTests.cs" />
<Compile Include="NewtonsoftTests\ImmutableCollectionsTests.cs" />
<Compile Include="NewtonsoftTests\JsonSerializerTests.cs" />
<Compile Include="Serialization\Array.ReadTests.cs" />
<Compile Include="Serialization\Array.WriteTests.cs" />
<Compile Include="Serialization\CacheTests.cs" />
<Compile Include="Serialization\CamelCaseUnitTests.cs" />
<Compile Include="Serialization\CollectionTests.cs" />
<Compile Include="Serialization\ConstructorTests.cs" />
<Compile Include="Serialization\ContinuationTests.cs" />
<Compile Include="Serialization\ContinuationTests.NullToken.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Array.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Attribute.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.BadConverters.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Callback.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.ContravariantDictionaryConverter.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.DerivedTypes.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.DictionaryEnumConverter.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.DictionaryGuidConverter.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.DictionaryInt32StringConverter.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.DictionaryInt32StringKeyValueConverter.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.DictionaryKeyValueConverter.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Dynamic.Sample.Tests.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Enum.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Exceptions.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Dynamic.Sample.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.HandleNull.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Int32.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Interface.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.InvalidCast.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.KeyConverters.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.List.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.NullValueType.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.NullableTypes.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Object.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Point.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.Polymorphic.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.ReadAhead.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.ValueTypedMember.cs" />
<Compile Include="Serialization\CustomConverterTests\CustomConverterTests.cs" />
<Compile Include="Serialization\CyclicTests.cs" />
<Compile Include="Serialization\DomTests.cs" />
<Compile Include="Serialization\DynamicTests.cs" />
<Compile Include="Serialization\EnumConverterTests.cs" />
<Compile Include="Serialization\EnumTests.cs" />
<Compile Include="Serialization\ExceptionTests.cs" />
<Compile Include="Serialization\ExtensionDataTests.cs" />
<Compile Include="Serialization\InvalidJsonTests.cs" />
<Compile Include="Serialization\InvalidTypeTests.cs" />
<Compile Include="Serialization\JsonDocumentTests.cs" />
<Compile Include="Serialization\JsonElementTests.cs" />
<Compile Include="Serialization\JsonSerializerApiValidation.cs" />
<Compile Include="Serialization\JsonSerializerWrapperForStream.cs" />
<Compile Include="Serialization\JsonSerializerWrapperForString.cs" />
<Compile Include="Serialization\MetadataTests\MetadataTests.cs" />
<Compile Include="Serialization\MetadataTests\MetadataTests.JsonSerializer.cs" />
<Compile Include="Serialization\MetadataTests\MetadataTests.Options.cs" />
<Compile Include="Serialization\NodeInteropTests.cs" />
<Compile Include="Serialization\Null.ReadTests.cs" />
<Compile Include="Serialization\Null.WriteTests.cs" />
<Compile Include="Serialization\NullableTests.cs" />
<Compile Include="Serialization\NumberHandlingTests.cs" />
<Compile Include="Serialization\Object.ReadTests.cs" />
<Compile Include="Serialization\Object.WriteTests.cs" />
<Compile Include="Serialization\OnSerializeTests.cs" />
<Compile Include="Serialization\OptionsTests.cs" />
<Compile Include="Serialization\PolymorphicTests.cs" />
<Compile Include="Serialization\PropertyNameTests.cs" />
<Compile Include="Serialization\PropertyOrderTests.cs" />
<Compile Include="Serialization\PropertyVisibilityTests.cs" />
<Compile Include="Serialization\ReadScenarioTests.cs" />
<Compile Include="Serialization\ReadValueTests.cs" />
<Compile Include="Serialization\ReferenceHandlerTests.cs" />
<Compile Include="Serialization\SpanTests.cs" />
<Compile Include="Serialization\StreamTests.cs" />
<Compile Include="Serialization\Stream.Collections.cs" />
<Compile Include="Serialization\Stream.DeserializeAsyncEnumerable.cs" />
<Compile Include="Serialization\Stream.ReadTests.cs" />
<Compile Include="Serialization\Stream.WriteTests.cs" />
<Compile Include="Serialization\UnsupportedTypesTests.cs" />
<Compile Include="Serialization\Value.ReadTests.cs" />
<Compile Include="Serialization\Value.WriteTests.cs" />
<Compile Include="Serialization\WriteValueTests.cs" />
<Compile Include="TestCaseType.cs" />
<Compile Include="Utf8JsonReaderTests.cs" />
<Compile Include="Utf8JsonReaderTests.MultiSegment.cs" />
<Compile Include="Utf8JsonReaderTests.TryGet.cs" />
<Compile Include="Utf8JsonReaderTests.TryGet.Date.cs" />
<Compile Include="Utf8JsonReaderTests.ValueTextEquals.cs" />
<Compile Include="Utf8JsonWriterTests.cs" />
<Compile Include="Utf8JsonWriterTests.WriteRaw.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\src\System\Text\Json\BitStack.cs" Link="BitStack.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != '$(NetCoreAppCurrent)'">
<Compile Include="$(CommonPath)System\Runtime\CompilerServices\IsExternalInit.cs" Link="Common\System\Runtime\CompilerServices\IsExternalInit.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicDependencyAttribute.cs" />
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\DynamicallyAccessedMemberTypes.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Compile Include="$(CommonPath)System\Buffers\ArrayBufferWriter.cs" Link="CommonTest\System\Buffers\ArrayBufferWriter.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
<ProjectReference Include="$(LibrariesProjectRoot)System.IO.Pipelines\src\System.IO.Pipelines.csproj" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<ProjectReference Include="$(LibrariesProjectRoot)System.Collections.Immutable\src\System.Collections.Immutable.csproj" />
<ProjectReference Include="..\..\src\System.Text.Json.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\gen\System.Text.Json.SourceGeneration.Roslyn4.0.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
</Project>
| 1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/NullableLift.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Microsoft.CSharp.RuntimeBinder.Semantics
{
internal enum NullableCallLiftKind
{
NotLifted,
Operator,
EqualityOperator,
InequalityOperator,
UserDefinedConversion,
NullableConversion,
NullableConversionConstructor,
NullableIntermediateConversion,
NotLiftedIntermediateConversion
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Microsoft.CSharp.RuntimeBinder.Semantics
{
internal enum NullableCallLiftKind
{
NotLifted,
Operator,
EqualityOperator,
InequalityOperator,
UserDefinedConversion,
NullableConversion,
NullableConversionConstructor,
NullableIntermediateConversion,
NotLiftedIntermediateConversion
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/tests/nativeaot/SmokeTests/DynamicGenerics/universal_generics.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Linq.Expressions;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using CoreFXTestLibrary;
using TypeOfRepo;
namespace UniversalGen
{
public enum MyEnum { ME_1, ME_2 }
public class MyGen<T>
{
#pragma warning disable 0414 // The field '...blah...' is assigned but its value is never used
int a;
long b;
char c;
double d;
MyEnum e;
T f;
object g;
MyGenStruct<T> h;
MyGen<T> i;
MyGenStruct<T> j;
MyGenStruct<float> k;
MyStruct l;
MyGen<Type> m;
int[] a_array;
long[] b_array;
char[] c_array;
double[] d_array;
MyEnum[] e_array;
T[] f_array; // Universal canonical arrays NYI
object[] g_array;
MyGenStruct<T>[] h_array; // Universal canonical arrays NYI
MyGen<T>[] i_array; // Universal canonical arrays NYI
MyGenStruct<T>[] j_array; // Universal canonical arrays NYI
MyGenStruct<float>[] k_array; // Universal canonical arrays NYI
MyStruct[] l_array; // Universal canonical arrays NYI
MyGen<Type>[] m_array; // Universal canonical arrays NYI
static int a_static;
static long b_static;
static char c_static;
static double d_static;
static MyEnum e_static;
static T f_static;
static object g_static;
static MyGenStruct<T> h_static;
static MyGen<T> i_static;
static MyGenStruct<T> j_static;
static MyGenStruct<float> k_static;
static MyStruct l_static;
static MyGen<string> m_static;
static int[] a_array_static;
static long[] b_array_static;
static char[] c_array_static;
static double[] d_array_static;
static MyEnum[] e_array_static;
static T[] f_array_static;
static object[] g_array_static;
static MyGenStruct<T>[] h_array_static;
static MyGen<T>[] i_array_static;
static MyGenStruct<T>[] j_array_static;
static MyGenStruct<float>[] k_array_static;
static MyStruct[] l_array_static;
static MyGen<string>[] m_array_static;
public MyGen()
{
a = 1;
b = 2;
c = 'c';
d = 0.3;
e = MyEnum.ME_1;
f = default(T);
g = new object();
h = default(MyGenStruct<T>);
i = null;
j = default(MyGenStruct<T>);
k = default(MyGenStruct<float>);
l = default(MyStruct);
m = null;
a_array = null;
b_array = null;
c_array = null;
d_array = null;
e_array = null;
f_array = null;
g_array = null;
h_array = null;
i_array = null;
j_array = null;
k_array = null;
l_array = null;
m_array = null;
a_static = 2;
b_static = 3;
c_static = 'd';
d_static = 0.5;
e_static = MyEnum.ME_2;
f_static = default(T);
g_static = null;
h_static = default(MyGenStruct<T>);
i_static = null;
j_static = default(MyGenStruct<T>);
k_static = default(MyGenStruct<float>);
l_static = default(MyStruct);
m_static = null;
a_array_static = null;
b_array_static = null;
c_array_static = null;
d_array_static = null;
e_array_static = null;
f_array_static = null;
g_array_static = null;
h_array_static = null;
i_array_static = null;
j_array_static = null;
k_array_static = null;
l_array_static = null;
m_array_static = null;
}
#pragma warning restore 0414
}
public struct MyStruct { }
public struct MyGenStruct<T>
{
#pragma warning disable 0414 // The field '...blah...' is assigned but its value is never used
int a;
T b;
MyGen<T> c;
string d;
public MyGenStruct(object o)
{
a = 2;
b = default(T);
c = default(MyGen<T>);
d = "asd";
}
#pragma warning restore 0414
}
public class MyDerivedList<T> : List<T>
{
}
public struct MyListItem
{
string _id;
public MyListItem(string id) { _id = id; }
public override string ToString() { return "MyListItem(" + _id + ")"; }
}
public class StringWrapper
{
string _f;
public StringWrapper(string s) { _f = s; }
public override string ToString() { return _f; }
}
public class TestFieldsBase
{
public virtual void SetVal1(object val) { }
public virtual void SetVal2(object val) { }
public virtual void SetVal3(object val) { }
public virtual void SetVal4(object val) { }
public virtual void SetVal5(object val) { }
public virtual void SetVal6(object val) { }
public virtual object GetVal1() { return null; }
public virtual object GetVal2() { return null; }
public virtual object GetVal3() { return null; }
public virtual object GetVal4() { return null; }
public virtual object GetVal5() { return null; }
public virtual object GetVal6() { return null; }
}
public class UCGInstanceFields<T, U> : TestFieldsBase
{
protected T _1;
protected U _2;
protected int _3; // Test field of known type at unknown offset
public override void SetVal1(object val) { _1 = (T)val; }
public override void SetVal2(object val) { _2 = (U)val; }
public override void SetVal3(object val) { _3 = (int)val; }
public override object GetVal1() { return _1; }
public override object GetVal2() { return _2; }
public override object GetVal3() { return _3; }
}
public class UCGInstanceFieldsDerived<T, U> : UCGInstanceFields<T, T>
{
T _4;
double _5; // Test field of known type at unknown offset
U _6;
public override void SetVal1(object val) { _1 = (T)val; }
public override void SetVal4(object val) { _4 = (T)val; }
public override void SetVal5(object val) { _5 = (double)val; }
public override void SetVal6(object val) { _6 = (U)val; }
public override object GetVal3() { return _3; }
public override object GetVal4() { return _4; }
public override object GetVal5() { return _5; }
public override object GetVal6() { return _6; }
}
public class UCGInstanceFieldsDerived2<T> : UCGInstanceFields<float, T>
{
T _4;
public override void SetVal4(object val) { _4 = (T)val; }
public override object GetVal4() { return _4; }
}
public class UCGInstanceFieldsMostDerived<T> : UCGInstanceFieldsDerived2<float>
{
double _5; // Test field of known type at unknown offset
T _6;
public override void SetVal5(object val) { _5 = (double)val; }
public override void SetVal6(object val) { _6 = (T)val; }
public override object GetVal5() { return _5; }
public override object GetVal6() { return _6; }
}
public class UCGStaticFields<T, U> : TestFieldsBase
{
static T _1;
static U _2;
static int _3; // Test field of known type at unknown offset
public override void SetVal1(object val) { _1 = (T)val; }
public override void SetVal2(object val) { _2 = (U)val; }
public override void SetVal3(object val) { _3 = (int)val; }
public override object GetVal1() { return _1; }
public override object GetVal2() { return _2; }
public override object GetVal3() { return _3; }
}
public class UCGThreadStaticFields<T, U> : TestFieldsBase
{
[ThreadStatic]
static T _1;
[ThreadStatic]
static U _2;
[ThreadStatic]
static int _3; // Test field of known type at unknown offset
public override void SetVal1(object val) { _1 = (T)val; }
public override void SetVal2(object val) { _2 = (U)val; }
public override void SetVal3(object val) { _3 = (int)val; }
public override object GetVal1() { return _1; }
public override object GetVal2() { return _2; }
public override object GetVal3() { return _3; }
}
public class UCGStaticFieldsLayoutCompatStatic<T, U> : TestFieldsBase
{
public static T _1;
public static U _2;
public static int _3; // Test field of known type at unknown offset
public override void SetVal1(object val) { _1 = (T)val; }
public override void SetVal2(object val) { _2 = (U)val; }
public override void SetVal3(object val) { _3 = (int)val; }
public override object GetVal1() { return _1; }
public override object GetVal2() { return _2; }
public override object GetVal3() { return _3; }
}
public class UCGStaticFieldsLayoutCompatDynamic<T, U> : TestFieldsBase
{
public override void SetVal1(object val) { UCGStaticFieldsLayoutCompatStatic<T,U>._1 = (T)val; }
public override void SetVal2(object val) { UCGStaticFieldsLayoutCompatStatic<T, U>._2 = (U)val; }
public override void SetVal3(object val) { UCGStaticFieldsLayoutCompatStatic<T, U>._3 = (int)val; }
public override object GetVal1() { return UCGStaticFieldsLayoutCompatStatic<T, U>._1; }
public override object GetVal2() { return UCGStaticFieldsLayoutCompatStatic<T, U>._2; }
public override object GetVal3() { return UCGStaticFieldsLayoutCompatStatic<T, U>._3; }
}
#region Test case taken from a real app (minimal repro for a field layout bug)
public class GenBaseType<T> where T : IComparable<T>
{
protected String _myString = new String('c', 3);
protected T _tValue;
protected IComparer<T> _comparer;
protected GenBaseType(T tValue, IComparer<T> comparer)
{
if (comparer == null)
{
throw new System.ArgumentNullException("comparer");
}
this._tValue = tValue;
this._comparer = comparer;
}
}
public class GenDerivedType<T, U> : GenBaseType<T> where T : IComparable<T>
{
IList _iListObject;
U _uValue;
Func<object, IList, T, U, IComparer<T>, IDisposable> _action;
public GenDerivedType(IList iListObject, U uValue, Func<object, IList, T, U, IComparer<T>, IDisposable> action, T tValue, IComparer<T> comparer)
: base(tValue, comparer)
{
if (iListObject == null)
{
throw new System.ArgumentNullException("iListObject");
}
if (action == null)
{
throw new System.ArgumentNullException("action");
}
this._iListObject = iListObject;
this._uValue = uValue;
this._action = action;
}
public GenDerivedType(IList iListObject, U uValue, Func<object, IList, T, U, IComparer<T>, IDisposable> action, T tValue)
: this(iListObject, uValue, action, tValue, Comparer<T>.Default)
{
action(this._myString, this._iListObject, this._tValue, this._uValue, this._comparer);
}
}
public class GenDerivedType_Activator<T> where T : new()
{
static List<T> _listToUseAsParam = new List<T>(new T[] { default(T), new T() });
static TimeSpan _timeSpanToUseAsParam = TimeSpan.FromSeconds(123456.0);
static T _tToUseAsParam = new T();
static GenDerivedType<TimeSpan, T> _instance;
static String _delResult;
public GenDerivedType_Activator()
{
_instance = new GenDerivedType<TimeSpan, T>(_listToUseAsParam, _tToUseAsParam, new Func<object, IList, TimeSpan, T, IComparer<TimeSpan>, IDisposable>(FuncForDelegate), _timeSpanToUseAsParam);
}
public static IDisposable FuncForDelegate(object stringObj, IList iListObject, TimeSpan ts, T tValue, IComparer<TimeSpan> comparer)
{
_delResult = "GenDerivedType_Activator<" + typeof(T) + ">.FuncForDelegate";
Assert.AreEqual(stringObj, "ccc");
Assert.AreEqual(_listToUseAsParam, iListObject);
Assert.AreEqual(_timeSpanToUseAsParam, ts);
Assert.AreEqual(_tToUseAsParam, tValue);
Assert.AreEqual(comparer, Comparer<TimeSpan>.Default);
return null;
}
public override string ToString() { return _delResult; }
}
#endregion
public class TestClassConstructorBase
{
public static Type s_cctorOutput = null;
public virtual bool QueryStatic() { return false; }
}
public class UCGClassConstructorType<T> : TestClassConstructorBase
{
private static bool s_cctorRun = RunInCCtor();
private static bool RunInCCtor()
{
TestClassConstructorBase.s_cctorOutput = typeof(UCGClassConstructorType<T>);
return true;
}
public override bool QueryStatic() { return s_cctorRun; }
}
public interface IGetValue
{
int GetValue();
}
public struct UCGWrapperStruct : IGetValue
{
public UCGWrapperStruct(int wrapValue)
{
_WrappedValue = wrapValue;
}
public int _WrappedValue;
public int GetValue()
{
return _WrappedValue;
}
}
public interface IGVMTest
{
string GVMMethod<T>();
}
public class MakeGVMCallBase
{
public virtual string CallGvm(IGVMTest obj) { return null; }
}
public class MakeGVMCall<T> : MakeGVMCallBase
{
public override string CallGvm(IGVMTest obj)
{
return obj.GVMMethod<T>();
}
}
public class GVMTestClass<T> : IGVMTest
{
public string GVMMethod<U>()
{
return typeof(T).ToString() + typeof(U).ToString();
}
}
public struct GVMTestStruct<T> : IGVMTest
{
public string GVMMethod<U>()
{
return typeof(T).ToString() + typeof(U).ToString();
}
}
public class Base
{
public virtual object GetElementAt(int index) { return null; }
public virtual object this[int index] { get { return null; } set { } }
public virtual bool EmptyMethodTest(object param) { return true; }
public virtual object dupTest(object o1, object o2) { return null; }
public virtual bool FunctionCallTestsSetMember(object o1) { return false; }
public virtual bool FunctionCallTestsSetMemberByRef(object o1) { return false; }
public virtual bool FunctionCallTestsByRefGC(object o1) { return false; }
public virtual bool FunctionCallTestsSetByValue(object o1) { return false; }
public virtual bool FunctionCallTestsSetLocalByRef(object o1) { return false; }
public virtual bool FunctionCallTestsSetByValue2(object o1) { return false; }
public virtual void InterlockedTests(object o1, object o2) { }
public virtual void nestedTest() {}
}
public class UnmanagedByRef<T> : Base where T : struct, IGetValue
{
public T refVal;
[MethodImpl(MethodImplOptions.NoInlining)]
public unsafe void TestAsPointer(T x)
{
IntPtr unsafeValuePtr = (IntPtr)Unsafe.AsPointer(ref x);
GC.Collect();
GC.Collect();
GC.Collect();
GC.Collect();
GC.Collect();
var res = Unsafe.Read<T>(unsafeValuePtr.ToPointer());
Assert.IsTrue(this.refVal.Equals(res));
}
[MethodImpl(MethodImplOptions.NoInlining)]
public unsafe void TestGeneralFunction(T x)
{
IntPtr unsafeValuePtr = someFuncWithByRefArgs(ref x);
GC.Collect();
GC.Collect();
GC.Collect();
GC.Collect();
GC.Collect();
T res = Unsafe.Read<T>(unsafeValuePtr.ToPointer());
Assert.IsTrue(this.refVal.Equals(res));
}
[MethodImpl(MethodImplOptions.NoInlining)]
unsafe IntPtr someFuncWithByRefArgs(ref T x)
{
return (IntPtr)Unsafe.AsPointer(ref x);
}
public override unsafe bool FunctionCallTestsByRefGC(object o1)
{
var x = (T)o1;
this.refVal = x;
TestAsPointer(x);
TestGeneralFunction(x);
return true;
}
}
public class UCGSamples<T, U> : Base
{
public T[] _elements = new T[10];
public T member;
public T getMember() { return this.member; }
public override object GetElementAt(int index)
{
return _elements[index];
}
public override object this[int index]
{
get
{
return _elements[index];
}
set
{
_elements[index] = (T)value;
}
}
private void Empty(T t, T u)
{
}
public override void nestedTest()
{
testMethodInner();
//testMethodInner2();
testMethodInner3();
}
private MyGenStruct<UCGSamples<T,U>> testMethodInner()
{
return default(MyGenStruct<UCGSamples<T,U>>);
}
private MyGenStruct<MyGenStruct<UCGSamples<T,U>>> testMethodInner3()
{
return default(MyGenStruct<MyGenStruct<UCGSamples<T,U>>>);
}
public override bool EmptyMethodTest(object param)
{
T t = (T) param;
Empty(t, t);
return true;
}
private T dupTestInternal(T t1, T t2)
{
// IL for this method uses a 'dup' opcode
T local = default(T);
if ((local = t1).Equals(t2))
{
local = t2;
}
return local;
}
public override object dupTest(object o1, object o2)
{
return (object) dupTestInternal((T) o1, (T) o2);
}
private void set(T t)
{
member = t;
}
private void setEQ(T t1, T t2)
{
t2 = t1;
}
private void setByRefInner(T t, ref T tRef)
{
tRef = t;
}
[MethodImpl(MethodImplOptions.NoInlining)]
private void setInner(T t1, T t2)
{
t1 = t2;
}
[MethodImpl(MethodImplOptions.NoInlining)]
private void setOuter(T t1, T t2)
{
setInner(t1, t2);
}
private void setByRef(T t, ref T tRef)
{
setByRefInner(t, ref tRef);
}
public override bool FunctionCallTestsSetMember(object o1)
{
// eventually calls this.set(T) which sets this.member
T t = (T) o1;
set(t);
return this.member.Equals(t) && t.Equals(this.getMember());
}
public override bool FunctionCallTestsSetMemberByRef(object o1)
{
// same as 'FunctionCallTestsSetMember', but sets this.member via passing it byref
T t = (T) o1;
Assert.IsFalse(this.member.Equals(t));
setByRef(t, ref this.member);
return this.member.Equals(t);
}
public override bool FunctionCallTestsSetByValue(object o1)
{
// Calls setEQ, which sets second arg equal to first
// shouldn't change value of args since we're not passing byref
T t = (T) o1;
setEQ(t, this.member);
return !this.member.Equals(t);
}
public override bool FunctionCallTestsSetLocalByRef(object o1)
{
// same as 'FunctionCallTests', but sets a local via passing it byref
T t = (T) o1;
T t2 = default(T);
Assert.IsFalse(t2.Equals(t));
setByRef(t, ref t2);
return t2.Equals(t);
}
public override bool FunctionCallTestsSetByValue2(object o1)
{
T t = (T) o1;
Assert.IsTrue(!this.member.Equals(t));
setOuter(t, this.member);
return !this.member.Equals(t);
}
}
public class InterlockedClass<T, U> : Base where T : class
{
T member= default(T);
/*public InterlockedClass()
{
member = default(T);
}*/
public void setMember(T t)
{
this.member = t;
}
public T exchangeTest(T val)
{
T ret;
ret = System.Threading.Interlocked.Exchange<T>(ref this.member, val);
Assert.IsTrue(this.member.Equals(val));
return ret;
}
public T compareExchangeTest(T val)
{
T ret;
ret = System.Threading.Interlocked.CompareExchange<T>(ref this.member, val, this.member);
Assert.IsTrue(this.member.Equals(val));
return ret;
}
public override void InterlockedTests(object o1, object o2)
{
this.setMember((T)o1);
T ret = this.exchangeTest((T)o2);
Assert.IsTrue(ret.Equals(o1));
this.setMember((T)o1);
Assert.IsTrue(this.member.Equals((T) o1));
ret = this.compareExchangeTest((T)o2);
Assert.IsTrue(ret.Equals(o1));
}
}
public class Test
{
[TestMethod]
public static void TestInterlockedPrimitives()
{
var t = TypeOf.UG_InterlockedClass.MakeGenericType(TypeOf.String, TypeOf.Short);
Base o = (Base)Activator.CreateInstance(t);
o.InterlockedTests((object)"abc", (object)"def");
}
[TestMethod]
public static void TestArraysAndGC()
{
var t = TypeOf.UG_UCGSamples.MakeGenericType(TypeOf.Short, TypeOf.Short);
Base o = (Base)Activator.CreateInstance(t);
for (int i = 0; i < 10; i++)
o[i] = (short)i;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
for (int i = 0; i < 10; i++)
Assert.IsTrue((short)o[i] == (short)i);
t = TypeOf.UG_UCGSamples.MakeGenericType(typeof(StringWrapper), TypeOf.Short);
o = (Base)Activator.CreateInstance(t);
for (int i = 0; i < 10; i++)
o[i] = new StringWrapper("teststring" + i);
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
for (int i = 0; i < 10; i++)
Assert.IsTrue(((StringWrapper)o[i]).ToString() == "teststring" + i);
}
[TestMethod]
public static void TestUSGByRefFunctionCalls()
{
var t = TypeOf.UG_UnmanagedByRef.MakeGenericType(typeof(UCGWrapperStruct));
Base o = (Base)Activator.CreateInstance(t);
Assert.IsTrue(o.FunctionCallTestsByRefGC(new UCGWrapperStruct(2)));
}
[TestMethod]
public static void TestUSGSamples()
{
var t = TypeOf.UG_UCGSamples.MakeGenericType(TypeOf.Short, TypeOf.Short);
Base o = (Base)Activator.CreateInstance(t);
var result = o.GetElementAt(5);
Assert.AreEqual(result.ToString(), "0");
Assert.AreEqual(result.GetType(), TypeOf.Short);
Assert.IsTrue(o.EmptyMethodTest((short) 45));
Assert.AreEqual((short)o.dupTest((short)12, (short)-453),
(short)12);
o.nestedTest();
Assert.IsTrue(o.FunctionCallTestsSetMember((short) 79));
Assert.IsTrue(o.FunctionCallTestsSetMemberByRef((short) 85));
Assert.IsTrue(o.FunctionCallTestsSetByValue((short) 138));
Assert.IsTrue(o.FunctionCallTestsSetLocalByRef((short) 19));
Assert.IsTrue(o.FunctionCallTestsSetByValue2((short) 99));
for (int i = 0; i < 10; i++)
{
// No explicit typecasts
int val = 123 + i;
try
{
// This assignment should throw an InvalidCastException
// We have to explicitly cast "val" to "short"
o[i] = val;
Assert.IsTrue(false);
}
catch (InvalidCastException) { }
o[i] = (short)val;
Assert.AreEqual(o.GetElementAt(i), o[i]);
Assert.AreEqual(o[i], (short)val);
Assert.AreEqual(o.GetElementAt(i).ToString(), val.ToString());
// Explicit typecast to the correct type
val = 456 + i * 10;
o[i] = (short)val;
Assert.AreEqual((short)o.GetElementAt(i), (short)o[i]);
Assert.AreEqual((short)o[i], (short)val);
Assert.AreEqual(((short)o.GetElementAt(i)).ToString(), val.ToString());
}
}
[TestMethod]
public static void TestMakeGenericType()
{
new MyGenStruct<Type>(null);
var t = TypeOf.UG_MyGen.MakeGenericType(TypeOf.Object);
Assert.AreEqual(t.ToString(), "UniversalGen.MyGen`1[System.Object]");
t = TypeOf.UG_MyGen.MakeGenericType(TypeOf.String);
Assert.AreEqual(t.ToString(), "UniversalGen.MyGen`1[System.String]");
t = TypeOf.UG_MyGen.MakeGenericType(TypeOf.Int32);
Assert.AreEqual(t.ToString(), "UniversalGen.MyGen`1[System.Int32]");
t = TypeOf.UG_MyGen.MakeGenericType(TypeOf.CommonType2);
Assert.AreEqual(t.ToString(), "UniversalGen.MyGen`1[CommonType2]");
t = TypeOf.UG_MyGen.MakeGenericType(typeof(KeyValuePair<string, object>));
Assert.AreEqual(t.ToString(), "UniversalGen.MyGen`1[System.Collections.Generic.KeyValuePair`2[System.String,System.Object]]");
// List test
{
t = typeof(MyDerivedList<>).MakeGenericType(TypeOf.UG_MyListItem);
Assert.AreEqual(t.ToString(), "UniversalGen.MyDerivedList`1[UniversalGen.MyListItem]");
var l = Activator.CreateInstance(t);
MethodInfo ListTest = typeof(Test).GetTypeInfo().GetDeclaredMethod("ListTest").MakeGenericMethod(TypeOf.UG_MyListItem);
ListTest.Invoke(null, new object[] { l, new MyListItem("a"), new MyListItem("b") });
}
}
public static void ListTest<T>(MyDerivedList<T> l, T t1, T t2)
{
l.Add(t1);
l.Add(t2);
l.Add(t1);
Assert.AreEqual(3, l.Count);
Assert.AreEqual("MyListItem(a)", l[0].ToString());
Assert.AreEqual("MyListItem(b)", l[1].ToString());
Assert.AreEqual("MyListItem(a)", l[2].ToString());
}
[TestMethod]
public static void TestUSCInstanceFieldUsage()
{
var t = TypeOf.UG_UCGInstanceFields.MakeGenericType(TypeOf.Int32, TypeOf.Int32);
TestFieldsBase o = (TestFieldsBase)Activator.CreateInstance(t);
o.SetVal1(1);
o.SetVal2(2);
o.SetVal3(3);
Assert.AreEqual(o.GetVal1(), 1);
Assert.AreEqual(o.GetVal2(), 2);
Assert.AreEqual(o.GetVal3(), 3);
t = TypeOf.UG_UCGInstanceFieldsDerived.MakeGenericType(TypeOf.String, TypeOf.Int32);
o = (TestFieldsBase)Activator.CreateInstance(t);
o.SetVal1("11");
o.SetVal2("22");
o.SetVal3(33);
o.SetVal4("44");
o.SetVal5(55.55);
o.SetVal6(66);
Assert.AreEqual(o.GetVal1(), "11");
Assert.AreEqual(o.GetVal2(), "22");
Assert.AreEqual(o.GetVal3(), 33);
Assert.AreEqual(o.GetVal4(), "44");
Assert.AreEqual(o.GetVal5(), 55.55);
Assert.AreEqual(o.GetVal6(), 66);
t = TypeOf.UG_UCGInstanceFieldsMostDerived.MakeGenericType(TypeOf.Int32);
o = (TestFieldsBase)Activator.CreateInstance(t);
o.SetVal1(11.11f);
o.SetVal2(22.22f);
o.SetVal3(333);
o.SetVal4(44.44f);
o.SetVal5(555.555);
o.SetVal6(666);
Assert.AreEqual(o.GetVal1(), 11.11f);
Assert.AreEqual(o.GetVal2(), 22.22f);
Assert.AreEqual(o.GetVal3(), 333);
Assert.AreEqual(o.GetVal4(), 44.44f);
Assert.AreEqual(o.GetVal5(), 555.555);
Assert.AreEqual(o.GetVal6(), 666);
t = TypeOf.UG_UCGGenDerivedTypeActivator.MakeGenericType(typeof(MyGenStruct<double>));
object o2 = Activator.CreateInstance(t);
Assert.AreEqual(o2.ToString(), "GenDerivedType_Activator<UniversalGen.MyGenStruct`1[System.Double]>.FuncForDelegate");
}
[TestMethod]
public static void TestUSCStaticFieldUsage()
{
// Test with primitive types as field types
var t = TypeOf.UG_UCGStaticFields.MakeGenericType(TypeOf.Int32, TypeOf.Int32);
TestFieldsBase o = (TestFieldsBase)Activator.CreateInstance(t);
o.SetVal1(4);
o.SetVal2(5);
o.SetVal3(6);
Assert.AreEqual(o.GetVal1(), 4);
Assert.AreEqual(o.GetVal2(), 5);
Assert.AreEqual(o.GetVal3(), 6);
// Test with valuetypes as field types
t = TypeOf.UG_UCGStaticFields.MakeGenericType(TypeOf.UG_UCGWrapperStruct, TypeOf.UG_UCGWrapperStruct);
o = (TestFieldsBase)Activator.CreateInstance(t);
o.SetVal1(new UCGWrapperStruct(7));
o.SetVal2(new UCGWrapperStruct(8));
o.SetVal3(9);
Assert.AreEqual(((UCGWrapperStruct)o.GetVal1())._WrappedValue, 7);
Assert.AreEqual(((UCGWrapperStruct)o.GetVal2())._WrappedValue, 8);
Assert.AreEqual(o.GetVal3(), 9);
}
[TestMethod]
public static void TestUSCThreadStaticFieldUsage()
{
// Test with primitive types as field types
var t = TypeOf.UG_UCGThreadStaticFields.MakeGenericType(TypeOf.Int32, TypeOf.Int32);
TestFieldsBase o = (TestFieldsBase)Activator.CreateInstance(t);
o.SetVal1(16);
o.SetVal2(17);
o.SetVal3(18);
Assert.AreEqual(o.GetVal1(), 16);
Assert.AreEqual(o.GetVal2(), 17);
Assert.AreEqual(o.GetVal3(), 18);
// Test with valuetypes as field types
t = TypeOf.UG_UCGThreadStaticFields.MakeGenericType(TypeOf.UG_UCGWrapperStruct, TypeOf.UG_UCGWrapperStruct);
o = (TestFieldsBase)Activator.CreateInstance(t);
o.SetVal1(new UCGWrapperStruct(19));
o.SetVal2(new UCGWrapperStruct(20));
o.SetVal3(21);
Assert.AreEqual(((UCGWrapperStruct)o.GetVal1())._WrappedValue, 19);
Assert.AreEqual(((UCGWrapperStruct)o.GetVal2())._WrappedValue, 20);
Assert.AreEqual(o.GetVal3(), 21);
}
// Test that static layout is compatible between universal shared generics, and normal generics
[TestMethod]
public static void TestUSCStaticFieldLayoutCompat()
{
// In this test, we set values using static code, and the universal shared generic is supposed to read from
// the same static variables
// Test with primitive types as field types
TestFieldsBase o = new UCGStaticFieldsLayoutCompatStatic<int, int>();
o.SetVal1(10);
o.SetVal2(11);
o.SetVal3(12);
var t = TypeOf.UG_UCGStaticFieldsLayoutCompatDynamic.MakeGenericType(TypeOf.Int32, TypeOf.Int32);
o = (TestFieldsBase)Activator.CreateInstance(t);
Assert.AreEqual(o.GetVal1(), 10);
Assert.AreEqual(o.GetVal2(), 11);
Assert.AreEqual(o.GetVal3(), 12);
// Test with valuetypes as field types
o = new UCGStaticFieldsLayoutCompatStatic<UCGWrapperStruct, UCGWrapperStruct>();
o.SetVal1(new UCGWrapperStruct(13));
o.SetVal2(new UCGWrapperStruct(14));
o.SetVal3(15);
t = TypeOf.UG_UCGStaticFieldsLayoutCompatDynamic.MakeGenericType(TypeOf.UG_UCGWrapperStruct, TypeOf.UG_UCGWrapperStruct);
o = (TestFieldsBase)Activator.CreateInstance(t);
Assert.AreEqual(((UCGWrapperStruct)o.GetVal1())._WrappedValue, 13);
Assert.AreEqual(((UCGWrapperStruct)o.GetVal2())._WrappedValue, 14);
Assert.AreEqual(o.GetVal3(), 15);
}
// Test class constructor implicit call
[TestMethod]
public static void TestUSCClassConstructorImplicit()
{
try
{
Assert.AreEqual(null, TestClassConstructorBase.s_cctorOutput);
var t = TypeOf.UG_UCGClassConstructorType.MakeGenericType(TypeOf.Int16);
var o = (TestClassConstructorBase)Activator.CreateInstance(t);
Assert.AreEqual(true, o.QueryStatic());
Assert.AreEqual(t, TestClassConstructorBase.s_cctorOutput);
}
finally
{
TestClassConstructorBase.s_cctorOutput = null;
}
}
// Test class constructor explicit call
[TestMethod]
public static void TestUSCClassConstructorExplicit()
{
try
{
Assert.AreEqual(null, TestClassConstructorBase.s_cctorOutput);
var t = TypeOf.UG_UCGClassConstructorType.MakeGenericType(TypeOf.Int32);
System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(t.TypeHandle);
Assert.AreEqual(t, TestClassConstructorBase.s_cctorOutput);
}
finally
{
TestClassConstructorBase.s_cctorOutput = null;
}
}
[TestMethod]
public static void TestUniversalGenericsGvmCall()
{
var t = TypeOf.UG_MakeGVMCall.MakeGenericType(TypeOf.Int16);
var o = (MakeGVMCallBase)Activator.CreateInstance(t);
var tTestClassType = TypeOf.UG_GVMTestClass.MakeGenericType(TypeOf.Int32);
IGVMTest testClass = (IGVMTest)Activator.CreateInstance(tTestClassType);
Assert.AreEqual(TypeOf.Int32.ToString() + TypeOf.Int16.ToString(), o.CallGvm(testClass));
var tTestStructType = TypeOf.UG_GVMTestClass.MakeGenericType(TypeOf.Double);
IGVMTest testStruct = (IGVMTest)Activator.CreateInstance(tTestStructType);
Assert.AreEqual(TypeOf.Double.ToString() + TypeOf.Int16.ToString(), o.CallGvm(testStruct));
}
}
}
namespace PartialUSC
{
public class TestVirtualCallsBase
{
public virtual void TestVirtualCall0(object o) { }
public virtual void TestVirtualCall1(object o, string instTypeName) { }
public virtual void TestVirtualCall2(object o, string instTypeName) { }
public virtual void TestVirtualCall3(object o, bool TAndUAreTheSame, string instTypeName) { }
public virtual void TestVirtualCall4(object o, string instTypeName) { }
}
public class UCGTestVirtualCalls<T, U> : TestVirtualCallsBase
{
public override void TestVirtualCall0(object o)
{
VerifyCallResult(((Base<T>)o).Method1(), "Base<" + typeof(T) + ">.Method1");
VerifyCallResult(((Base<T>)o).Method2(), "Base<" + typeof(T) + ">.Method2");
VerifyCallResult(((Base<T>)o).Method3(), "Base<" + typeof(T) + ">.Method3");
}
public override void TestVirtualCall1(object o, string instTypeName)
{
VerifyCallResult(((IBase<T, U>)o).Method4(), instTypeName + ".Method4");
VerifyCallResult(((IBase<T, U>)o).Method5(), instTypeName + ".Method5");
VerifyCallResult(((IBase<T, U>)o).Method6(), instTypeName + ".Method6");
}
public override void TestVirtualCall2(object o, string instTypeName)
{
VerifyCallResult(((Derived<T, U>)o).Method1(), instTypeName + ".Method1");
VerifyCallResult(((Derived<T, U>)o).Method2(), instTypeName + ".Method2");
VerifyCallResult(((Derived<T, U>)o).Method3(), instTypeName + ".Method3");
VerifyCallResult(((Derived<T, U>)o).Method4(), instTypeName + ".Method4");
VerifyCallResult(((Derived<T, U>)o).Method5(), instTypeName + ".Method5");
VerifyCallResult(((Derived<T, U>)o).Method6(), instTypeName + ".Method6");
}
public override void TestVirtualCall3(object o, bool TAndUAreTheSame, string instTypeName)
{
if (TAndUAreTheSame)
{
VerifyCallResult(((Derived2<T, T>)o).Method1(), instTypeName + ".Method1");
VerifyCallResult(((Derived2<T, T>)o).Method2(), instTypeName + ".Method2");
VerifyCallResult(((Derived2<T, T>)o).Method3(), instTypeName + ".Method3");
VerifyCallResult(((Derived2<T, T>)o).Method4(), instTypeName + ".Method4");
VerifyCallResult(((Derived2<T, T>)o).Method5(), instTypeName + ".Method5");
VerifyCallResult(((Derived2<T, T>)o).Method6(), instTypeName + ".Method6");
}
else
{
VerifyCallResult(((Derived2<T, U>)o).Method1(), instTypeName + ".Method1");
VerifyCallResult(((Derived2<T, U>)o).Method2(), instTypeName + ".Method2");
VerifyCallResult(((Derived2<T, U>)o).Method3(), instTypeName + ".Method3");
VerifyCallResult(((Derived2<T, U>)o).Method4(), instTypeName + ".Method4");
VerifyCallResult(((Derived2<T, U>)o).Method5(), instTypeName + ".Method5");
VerifyCallResult(((Derived2<T, U>)o).Method6(), instTypeName + ".Method6");
}
}
public override void TestVirtualCall4(object o, string instTypeName)
{
((Derived3<T, T>)o).Method1();
((Derived3<T, T>)o).Method2();
((Derived3<T, T>)o).Method3();
((Derived3<T, T>)o).Method4();
((Derived3<T, T>)o).Method5();
((Derived3<T, T>)o).Method6();
}
private void VerifyCallResult(string result, string expected)
{
Assert.AreEqual(result, expected);
}
}
#pragma warning disable 0114
public class Base<T>
{
public virtual string Method1() { return "Base<" + typeof(T) + ">.Method1"; }
public virtual string Method2() { return "Base<" + typeof(T) + ">.Method2"; }
public virtual string Method3() { return "Base<" + typeof(T) + ">.Method3"; }
}
public interface IBase<T, U>
{
string Method4();
string Method5();
string Method6();
}
public class Derived<T, U> : Base<T>, IBase<T, U>
{
public virtual string Method1() { return "Derived<" + typeof(T) + "," + typeof(U) + ">.Method1"; }
public virtual string Method2() { return "Derived<" + typeof(T) + "," + typeof(U) + ">.Method2"; }
public virtual string Method3() { return "Derived<" + typeof(T) + "," + typeof(U) + ">.Method3"; }
public virtual string Method4() { return "Derived<" + typeof(T) + "," + typeof(U) + ">.Method4"; }
public virtual string Method5() { return "Derived<" + typeof(T) + "," + typeof(U) + ">.Method5"; }
public virtual string Method6() { return "Derived<" + typeof(T) + "," + typeof(U) + ">.Method6"; }
}
public class Derived2<T, U> : Derived<T, int>
{
public override string Method1() { return "Derived2<" + typeof(T) + "," + typeof(U) + ">.Method1"; }
public override string Method2() { return "Derived2<" + typeof(T) + "," + typeof(U) + ">.Method2"; }
public override string Method3() { return "Derived2<" + typeof(T) + "," + typeof(U) + ">.Method3"; }
public override string Method4() { return "Derived2<" + typeof(T) + "," + typeof(U) + ">.Method4"; }
public override string Method5() { return "Derived2<" + typeof(T) + "," + typeof(U) + ">.Method5"; }
public override string Method6() { return "Derived2<" + typeof(T) + "," + typeof(U) + ">.Method6"; }
}
public class Derived3<T, U> : Derived2<T, Type>
{
public virtual string Method1() { return "Derived3<" + typeof(T) + "," + typeof(U) + ">.Method1"; }
public virtual string Method2() { return "Derived3<" + typeof(T) + "," + typeof(U) + ">.Method2"; }
public virtual string Method3() { return "Derived3<" + typeof(T) + "," + typeof(U) + ">.Method3"; }
public virtual string Method4() { return "Derived3<" + typeof(T) + "," + typeof(U) + ">.Method4"; }
public virtual string Method5() { return "Derived3<" + typeof(T) + "," + typeof(U) + ">.Method5"; }
public virtual string Method6() { return "Derived3<" + typeof(T) + "," + typeof(U) + ">.Method6"; }
}
#pragma warning restore 114
public struct MyStruct<T, U> { }
public class TestRelatedTypeCases { public virtual void DoTest() { } }
public class NullableCaseTest<T> : TestRelatedTypeCases
{
public override void DoTest()
{
MyStruct<T, T>? nullable = null;
Assert.IsFalse(nullable.HasValue);
nullable = new MyStruct<T, T>();
Assert.IsTrue(nullable.Value.Equals(default(MyStruct<T, T>)));
Assert.IsTrue(nullable.GetType().ToString() == "Nullable<MyStruct<" + typeof(T) + "," + typeof(T) + ">>");
MyStruct<T, int>? nullable2 = null;
Assert.IsFalse(nullable2.HasValue);
nullable2 = new MyStruct<T, int>();
Assert.IsTrue(nullable2.Value.Equals(default(MyStruct<T, int>)));
Assert.IsTrue(nullable2.GetType().ToString() == "Nullable<MyStruct<" + typeof(T) + ",System.Int32>>");
}
}
public class ArrayCaseTest<T> : TestRelatedTypeCases
{
public override void DoTest()
{
MyStruct<T, T>[] arr1 = new MyStruct<T, T>[] { };
MyStruct<T, long>[] arr2 = new MyStruct<T, long>[] { };
MyStruct<object, T>[] arr3 = new MyStruct<object, T>[] { };
}
}
public class CustomCollection<V> : System.Collections.ObjectModel.KeyedCollection<V, System.Collections.DictionaryEntry>
{
public CustomCollection()
{
}
public CustomCollection(System.Collections.Generic.IEqualityComparer<V> comparer)
: base(comparer)
{
}
protected override V GetKeyForItem(System.Collections.DictionaryEntry entry)
{
return (V)((object)entry.Key);
}
}
public class Test
{
[TestMethod]
public static void TestVirtualCallsPartialUSGVTableMismatch()
{
Type collectionType = typeof(CustomCollection<>).MakeGenericType(TypeOf.Short);
var collection = Activator.CreateInstance(collectionType);
MethodInfo GetKeyForItem = collectionType.GetTypeInfo().GetDeclaredMethod("GetKeyForItem");
short result = (short)GetKeyForItem.Invoke(collection, new object[] { new DictionaryEntry((short)123, "abc") });
Assert.IsTrue(result == (short)123);
}
[TestMethod]
public static void TestVirtualCalls()
{
for (int i = 0; i < 10; i++)
{
foreach (var typeArg in new Type[] { TypeOf.Short, TypeOf.String, TypeOf.CommonType1, typeof(List<int>) })
{
{
var t = TypeOf.PCT_UCGTestVirtualCalls.MakeGenericType(typeArg, typeArg);
TestVirtualCallsBase caller = (TestVirtualCallsBase)Activator.CreateInstance(t);
var obj = Activator.CreateInstance(TypeOf.PCT_Derived.MakeGenericType(typeArg, typeArg));
caller.TestVirtualCall0(obj);
caller.TestVirtualCall1(obj, "Derived<" + typeArg + "," + typeArg + ">");
caller.TestVirtualCall2(obj, "Derived<" + typeArg + "," + typeArg + ">");
try { caller.TestVirtualCall3(obj, true, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
try { caller.TestVirtualCall3(obj, false, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
try { caller.TestVirtualCall4(obj, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
}
{
var t = TypeOf.PCT_UCGTestVirtualCalls.MakeGenericType(typeArg, TypeOf.Int32);
TestVirtualCallsBase caller = (TestVirtualCallsBase)Activator.CreateInstance(t);
var obj = Activator.CreateInstance(TypeOf.PCT_Derived2.MakeGenericType(typeArg, typeArg));
caller.TestVirtualCall0(obj);
caller.TestVirtualCall1(obj, "Derived2<" + typeArg + "," + typeArg + ">");
caller.TestVirtualCall2(obj, "Derived2<" + typeArg + "," + typeArg + ">");
caller.TestVirtualCall3(obj, true, "Derived2<" + typeArg + "," + typeArg + ">");
try { caller.TestVirtualCall3(obj, false, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
try { caller.TestVirtualCall4(obj, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
}
{
var t_int = TypeOf.PCT_UCGTestVirtualCalls.MakeGenericType(typeArg, TypeOf.Int32);
var t_type = TypeOf.PCT_UCGTestVirtualCalls.MakeGenericType(typeArg, TypeOf.Type);
TestVirtualCallsBase caller_int = (TestVirtualCallsBase)Activator.CreateInstance(t_int);
TestVirtualCallsBase caller_type = (TestVirtualCallsBase)Activator.CreateInstance(t_type);
var obj = Activator.CreateInstance(TypeOf.PCT_Derived3.MakeGenericType(typeArg, typeArg));
caller_int.TestVirtualCall0(obj);
caller_type.TestVirtualCall0(obj);
caller_int.TestVirtualCall1(obj, "Derived2<" + typeArg + "," + TypeOf.Type + ">");
try { caller_type.TestVirtualCall1(obj, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
caller_int.TestVirtualCall2(obj, "Derived2<" + typeArg + "," + TypeOf.Type + ">");
try { caller_type.TestVirtualCall2(obj, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
caller_type.TestVirtualCall3(obj, false, "Derived2<" + typeArg + "," + TypeOf.Type + ">");
try { caller_type.TestVirtualCall3(obj, true, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
try { caller_int.TestVirtualCall3(obj, false, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
try { caller_int.TestVirtualCall3(obj, true, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
caller_int.TestVirtualCall4(obj, "Derived3<" + typeArg + "," + typeArg + ">");
caller_type.TestVirtualCall4(obj, "Derived3<" + typeArg + "," + typeArg + ">");
}
#if false
// Bug with callsite address with the nullable test case...
{
var t = TypeOf.PCT_NullableCaseTest.MakeGenericType(typeArg);
TestRelatedTypeCases caller = (TestRelatedTypeCases)Activator.CreateInstance(t);
caller.DoTest();
t = TypeOf.PCT_ArrayCaseTest.MakeGenericType(typeArg);
caller = (TestRelatedTypeCases)Activator.CreateInstance(t);
caller.DoTest();
}
#endif
}
}
}
}
}
namespace VirtualCalls
{
public class TestClass { }
public struct TestStruct { }
public class TestVirtualCallsBase
{
public virtual void TestVirtualCallNonGenericInstance(object o) { }
public virtual void TestVirtualCallStaticallyCompiledGenericInstance(object o1, object o2) { }
public virtual void TestUniversalGenericMethodCallOnNonUniversalContainingType() { }
public virtual void TestVirtualCall(object o, object value) { }
public virtual void TestVirtualCallUsingDelegates(object o, object value)
{
// TODO
// Not working today. Requires the following:
// 1) Fix instantiation problem with universal canonical types. Example: Foo<T, string>
// could create types like Foo<__UniversalCanon, string>, which are incorrect conceptually
// 2) Fix NUTC to emit the LOAD_VIRTUAL_FUNCTION opcode for delegates using runtime determined tokens
// like Foo<!0>.Method instead of Foo<__UC>.Method (otherwise binder fails with an assert)
}
}
public class UCGTestVirtualCalls<T> : TestVirtualCallsBase
{
public override void TestVirtualCallNonGenericInstance(object o)
{
NonGenBase obj = (NonGenBase)o;
Func<string> del1 = obj.Method1;
Func<string> del2 = obj.Method2;
Func<string> del3 = obj.Method3;
if (o.GetType() == typeof(NonGenBase))
{
Assert.AreEqual(obj.Method1(), "NonGenBase.Method1");
Assert.AreEqual(obj.Method2(), "NonGenBase.Method2");
Assert.AreEqual(obj.Method3(), "NonGenBase.Method3");
Assert.AreEqual(del1(), "NonGenBase.Method1");
Assert.AreEqual(del2(), "NonGenBase.Method2");
Assert.AreEqual(del3(), "NonGenBase.Method3");
}
else
{
Assert.AreEqual(obj.Method1(), "NonGenDerived.Method1");
Assert.AreEqual(obj.Method2(), "NonGenDerived.Method2");
Assert.AreEqual(obj.Method3(), "NonGenDerived.Method3");
Assert.AreEqual(del1(), "NonGenDerived.Method1");
Assert.AreEqual(del2(), "NonGenDerived.Method2");
Assert.AreEqual(del3(), "NonGenDerived.Method3");
}
}
public override void TestVirtualCallStaticallyCompiledGenericInstance(object o1, object o2)
{
string result;
// Static non-shareable instantiation
result = ((Base<double>)o1).Method1(1.23);
VerifyCallResult<double>(result, "Method1", o1);
result = ((Base<double>)o1).Method2(1.23);
VerifyCallResult<double>(result, "Method2", o1);
result = ((Base<double>)o1).Method3(1.23);
VerifyCallResult<double>(result, "Method3", o1);
result = ((Derived<double>)o1).Method1(1.23);
VerifyCallResult<double>(result, "Method1", o1);
result = ((Derived<double>)o1).Method2(1.23);
VerifyCallResult<double>(result, "Method2", o1);
result = ((Derived<double>)o1).Method3(1.23);
VerifyCallResult<double>(result, "Method3", o1);
result = ((Derived<double>)o1).Method4(1.23);
VerifyCallResult<double>(result, "Method4", o1);
result = ((Derived<double>)o1).Method5(1.23);
VerifyCallResult<double>(result, "Method5", o1);
result = ((Derived<double>)o1).Method6(1.23);
VerifyCallResult<double>(result, "Method6", o1);
// Static normal canonical-shareable instantiation
result = ((Base<Type>)o2).Method1(this.GetType());
VerifyCallResult<Type>(result, "Method1", o2);
result = ((Base<Type>)o2).Method2(this.GetType());
VerifyCallResult<Type>(result, "Method2", o2);
result = ((Base<Type>)o2).Method3(this.GetType());
VerifyCallResult<Type>(result, "Method3", o2);
result = ((Derived<Type>)o2).Method1(this.GetType());
VerifyCallResult<Type>(result, "Method1", o2);
result = ((Derived<Type>)o2).Method2(this.GetType());
VerifyCallResult<Type>(result, "Method2", o2);
result = ((Derived<Type>)o2).Method3(this.GetType());
VerifyCallResult<Type>(result, "Method3", o2);
result = ((Derived<Type>)o2).Method4(this.GetType());
VerifyCallResult<Type>(result, "Method4", o2);
result = ((Derived<Type>)o2).Method5(this.GetType());
VerifyCallResult<Type>(result, "Method5", o2);
result = ((Derived<Type>)o2).Method6(this.GetType());
VerifyCallResult<Type>(result, "Method6", o2);
}
public override void TestUniversalGenericMethodCallOnNonUniversalContainingType()
{
string result;
var obj1 = new UCGTestVirtualCalls<TestClass>();
result = obj1.GenericMethod<T>();
Assert.AreEqual(result, "UCGTestVirtualCalls<TestClass>.GenericMethod<" + typeof(T).Name + ">");
result = UCGTestVirtualCalls<TestClass>.StaticGenericMethod<T>();
Assert.AreEqual(result, "UCGTestVirtualCalls<TestClass>.StaticGenericMethod<" + typeof(T).Name + ">");
var obj2 = new UCGTestVirtualCalls<TestStruct>();
result = obj2.GenericMethod<T>();
Assert.AreEqual(result, "UCGTestVirtualCalls<TestStruct>.GenericMethod<" + typeof(T).Name + ">");
result = UCGTestVirtualCalls<TestStruct>.StaticGenericMethod<T>();
Assert.AreEqual(result, "UCGTestVirtualCalls<TestStruct>.StaticGenericMethod<" + typeof(T).Name + ">");
}
string GenericMethod<ARG>() { return "UCGTestVirtualCalls<" + typeof(T).Name + ">.GenericMethod<" + typeof(ARG).Name + ">"; }
static string StaticGenericMethod<ARG>() { return "UCGTestVirtualCalls<" + typeof(T).Name + ">.StaticGenericMethod<" + typeof(ARG).Name + ">"; }
public override void TestVirtualCall(object o, object value)
{
string result;
result = ((Base<T>)o).Method1((T)value);
VerifyCallResult<T>(result, "Method1", o);
result = ((Base<T>)o).Method2((T)value);
VerifyCallResult<T>(result, "Method2", o);
result = ((Base<T>)o).Method3((T)value);
VerifyCallResult<T>(result, "Method3", o);
result = ((Derived<T>)o).Method1((T)value);
VerifyCallResult<T>(result, "Method1", o);
result = ((Derived<T>)o).Method2((T)value);
VerifyCallResult<T>(result, "Method2", o);
result = ((Derived<T>)o).Method3((T)value);
VerifyCallResult<T>(result, "Method3", o);
result = ((Derived<T>)o).Method4((T)value);
VerifyCallResult<T>(result, "Method4", o);
result = ((Derived<T>)o).Method5((T)value);
VerifyCallResult<T>(result, "Method5", o);
result = ((Derived<T>)o).Method6((T)value);
VerifyCallResult<T>(result, "Method6", o);
result = ((Base<T>)o).Method1(default(T));
VerifyCallResult<T>(result, "Method1", o);
result = ((Base<T>)o).Method2(default(T));
VerifyCallResult<T>(result, "Method2", o);
result = ((Base<T>)o).Method3(default(T));
VerifyCallResult<T>(result, "Method3", o);
result = ((Derived<T>)o).Method1(default(T));
VerifyCallResult<T>(result, "Method1", o);
result = ((Derived<T>)o).Method2(default(T));
VerifyCallResult<T>(result, "Method2", o);
result = ((Derived<T>)o).Method3(default(T));
VerifyCallResult<T>(result, "Method3", o);
result = ((Derived<T>)o).Method4(default(T));
VerifyCallResult<T>(result, "Method4", o);
result = ((Derived<T>)o).Method5(default(T));
VerifyCallResult<T>(result, "Method5", o);
result = ((Derived<T>)o).Method6(default(T));
VerifyCallResult<T>(result, "Method6", o);
}
void VerifyCallResult<ARG>(string result, string methodName, object o)
{
string expected = "";
if (o.GetType().ToString().Contains("Derived_NoOverride"))
{
if (methodName == "Method1" || methodName == "Method2" || methodName == "Method3")
expected = "Base<" + typeof(ARG) + ">." + methodName;
else
expected = "Derived<" + typeof(ARG) + ">." + methodName;
}
else expected = "Derived_WithOverride<" + typeof(ARG) + ">." + methodName;
Assert.AreEqual(result, expected);
}
}
public class NonGenBase
{
public virtual string Method1() { return "NonGenBase.Method1"; }
public virtual string Method2() { return "NonGenBase.Method2"; }
public virtual string Method3() { return "NonGenBase.Method3"; }
}
public class NonGenDerived : NonGenBase
{
public override string Method1() { return "NonGenDerived.Method1"; }
public override string Method2() { return "NonGenDerived.Method2"; }
public override string Method3() { return "NonGenDerived.Method3"; }
}
public class Base<T>
{
public virtual string Method1(T t) { return "Base<" + typeof(T) + ">.Method1"; }
public virtual string Method2(T t) { return "Base<" + typeof(T) + ">.Method2"; }
public virtual string Method3(T t) { return "Base<" + typeof(T) + ">.Method3"; }
}
public class Derived<T> : Base<T>
{
public virtual string Method4(T t) { return "Derived<" + typeof(T) + ">.Method4"; }
public virtual string Method5(T t) { return "Derived<" + typeof(T) + ">.Method5"; }
public virtual string Method6(T t) { return "Derived<" + typeof(T) + ">.Method6"; }
}
#pragma warning disable 114 // 'method' hides inherited member 'method'
public class Derived_NoOverride<T> : Derived<T>
{
public virtual string Method1(T t) { return "Derived_NoOverride<" + typeof(T) + ">.Method1"; }
public virtual string Method2(T t) { return "Derived_NoOverride<" + typeof(T) + ">.Method2"; }
public virtual string Method3(T t) { return "Derived_NoOverride<" + typeof(T) + ">.Method3"; }
public virtual string Method4(T t) { return "Derived_NoOverride<" + typeof(T) + ">.Method4"; }
public virtual string Method5(T t) { return "Derived_NoOverride<" + typeof(T) + ">.Method5"; }
public virtual string Method6(T t) { return "Derived_NoOverride<" + typeof(T) + ">.Method6"; }
}
#pragma warning restore 114
public class Derived_WithOverride<T> : Derived<T>
{
public override string Method1(T t) { return "Derived_WithOverride<" + typeof(T) + ">.Method1"; }
public override string Method2(T t) { return "Derived_WithOverride<" + typeof(T) + ">.Method2"; }
public override string Method3(T t) { return "Derived_WithOverride<" + typeof(T) + ">.Method3"; }
public override string Method4(T t) { return "Derived_WithOverride<" + typeof(T) + ">.Method4"; }
public override string Method5(T t) { return "Derived_WithOverride<" + typeof(T) + ">.Method5"; }
public override string Method6(T t) { return "Derived_WithOverride<" + typeof(T) + ">.Method6"; }
}
public class Test
{
[TestMethod]
public static void TestVirtualCalls()
{
var rootingStaticInstantiation1 = new UCGTestVirtualCalls<long>();
var rootingStaticInstantiation2 = new UCGTestVirtualCalls<List<int>>();
for (int i = 0; i < 10; i++)
{
foreach (var typeArg in new Type[] { TypeOf.Short, TypeOf.String, TypeOf.Long, typeof(List<int>) })
{
object value = null;
if (typeArg == TypeOf.Short)
value = (short)123;
else if (typeArg == TypeOf.String)
value = "456";
else if (typeArg == TypeOf.Long)
value = (long)789;
else if (typeArg == typeof(List<int>))
value = new List<int>();
var t = TypeOf.VCT_UCGTestVirtualCalls.MakeGenericType(typeArg);
TestVirtualCallsBase caller = (TestVirtualCallsBase)Activator.CreateInstance(t);
var obj = Activator.CreateInstance(TypeOf.VCT_Derived_NoOverride.MakeGenericType(typeArg));
caller.TestVirtualCall(obj, value);
caller.TestVirtualCallUsingDelegates(obj, value);
caller.TestVirtualCallNonGenericInstance(new NonGenBase());
caller.TestVirtualCallStaticallyCompiledGenericInstance(new Derived_NoOverride<double>(), new Derived_NoOverride<Type>());
caller.TestUniversalGenericMethodCallOnNonUniversalContainingType();
obj = Activator.CreateInstance(TypeOf.VCT_Derived_WithOverride.MakeGenericType(typeArg));
caller.TestVirtualCall(obj, value);
caller.TestVirtualCallUsingDelegates(obj, value);
caller.TestVirtualCallNonGenericInstance(new NonGenDerived());
caller.TestVirtualCallStaticallyCompiledGenericInstance(new Derived_WithOverride<double>(), new Derived_WithOverride<Type>());
caller.TestUniversalGenericMethodCallOnNonUniversalContainingType();
}
}
}
}
}
namespace CallingConvention
{
public class Foo<T>
{
public int _value;
}
public struct Bar<T>
{
public int _value;
}
public unsafe interface IBase<T>
{
void SimpleFunc(T tval);
T VirtualCoolFunc(object o, Bar<T> b, Foo<T> f, T[] a, T t_val, ref T brt_val, ref T brt_default, int index, int* ptr, int** ptrptr, ref int* brptr);
}
public unsafe class CCTester<T> : IBase<T>
{
public virtual void SimpleFunc(T tval)
{
Assert.AreEqual(tval.ToString(), Test.s_expectedT.ToString());
}
public virtual T VirtualCoolFunc(object o, Bar<T> b, Foo<T> f, T[] a, T t_val, ref T brt_val, ref T brt_default, int index, int* ptr, int** ptrptr, ref int* brptr)
{
Assert.AreEqual(o, "Hello");
Assert.AreEqual(b._value, 1);
Assert.AreEqual(f._value, 2);
Assert.AreEqual(a[0], brt_val);
Assert.AreEqual(brt_default, default(T));
Assert.AreEqual(index, 123);
Assert.IsTrue(ptr == ((int*)456));
Assert.IsTrue(ptrptr == ((int**)789));
Assert.IsTrue(brptr == ((int*)159));
brt_val = brt_default;
brt_default = t_val;
brptr = ptr;
return t_val;
}
}
public interface ITestCallInterface<T>
{
void M(T t);
}
public class TestCallInterfaceImpl : ITestCallInterface<short>
{
public void M(short s)
{
TestInterfaceUseBase.ShortValue = s;
Console.WriteLine("In M(" + s + ")");
}
}
public class TestInterfaceUseBase
{
public static short ShortValue;
public virtual void TestUseInterface(object o, object value) { }
}
public class UCGTestUseInterface<T> : TestInterfaceUseBase
{
public override void TestUseInterface(object o, object value)
{
for (int i = 0; i < 10; i++)
{
((ITestCallInterface<T>)o).M((T)value);
}
}
}
public class TestNonVirtualFunctionCallUseBase
{
public virtual object TestNonVirtualInstanceFunction(object o, object value) { return null; }
}
public class UCGSeperateClass<T>
{
[MethodImpl(MethodImplOptions.NoInlining)]
public object BoxParam(T t)
{
return (object)t;
}
}
public class UCGTestNonVirtualFunctionCallUse<T> : TestNonVirtualFunctionCallUseBase
{
public override object TestNonVirtualInstanceFunction(object o, object value)
{
return ((UCGSeperateClass<T>)o).BoxParam((T)value);
}
}
#region Calling convention converter test with structs of known/unknown sizes
public class EmptyClass<T>
{
public override string ToString() { return "EmptyClass<" + typeof(T).Name + ">"; }
}
public class ClassWithTField<T>
{
T _field1;
public ClassWithTField(T f) { _field1 = f; }
public override string ToString() { return "ClassWithTField<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}"; }
}
public struct StructWithTField<T>
{
T _field1;
public StructWithTField(T f) { _field1 = f; }
public override string ToString() { return "StructWithTField<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}"; }
}
public struct TestStructKnownSize<T>
{
EmptyClass<T> _field1;
ClassWithTField<T> _field2;
internal TestStructKnownSize(EmptyClass<T> l, T tValue) { _field1 = l; _field2 = new ClassWithTField<T>(tValue); }
public override string ToString() { return "TestStructKnownSize<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}. _field2 = {" + _field2.ToString() + "}"; }
}
public struct TestStructIndeterminateSize<T>
{
EmptyClass<T> _field1;
StructWithTField<T> _field2;
internal TestStructIndeterminateSize(EmptyClass<T> l, T tValue) { _field1 = l; _field2 = new StructWithTField<T>(tValue); }
public override string ToString() { return "TestStructIndeterminateSize<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}. _field2 = {" + _field2.ToString() + "}"; }
}
public struct StructWithOneField1<T>
{
MainClass<T, T> _field1;
internal StructWithOneField1(MainClass<T, T> f) { _field1 = f; }
public override string ToString() { return "StructWithOneField1<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}"; }
}
public struct StructWithOneField2<T>
{
ClassWithTField<T> _field1;
internal StructWithOneField2(ClassWithTField<T> f) { _field1 = f; }
public override string ToString() { return "StructWithOneField2<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}"; }
}
public struct StructWithOneField3<T>
{
StructWithTField<T> _field1;
internal StructWithOneField3(StructWithTField<T> f) { _field1 = f; }
public override string ToString() { return "StructWithOneField3<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}"; }
}
public struct StructWithTwoFields1<T>
{
MainClass<T, T> _field1;
TestStructKnownSize<T> _field2;
internal StructWithTwoFields1(MainClass<T, T> f, T tValue) { _field1 = f; _field2 = new TestStructKnownSize<T>(new EmptyClass<T>(), tValue); }
public override string ToString() { return "StructWithTwoFields1<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}. _field2 = {" + _field2.ToString() + "}"; }
}
public struct StructWithTwoFields2<T>
{
MainClass<T, T> _field1;
TestStructIndeterminateSize<T> _field2;
internal StructWithTwoFields2(MainClass<T, T> f, T tValue) { _field1 = f; _field2 = new TestStructIndeterminateSize<T>(new EmptyClass<T>(), tValue); }
public override string ToString() { return "StructWithTwoFields2<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}. _field2 = {" + _field2.ToString() + "}"; }
}
public struct StructWithTwoGenParams<T, U>
{
T _field1;
public StructWithTwoGenParams(T t) { _field1 = t; }
public override string ToString() { return "StructWithTwoGenParams<" + typeof(T) + "," + typeof(U) + ">. _field1 = {" + _field1.ToString() + "}"; }
}
// No fields depending on type U in the following structs (on purpose)
public struct StructWithOneFieldTwoGenParams1<T, U>
{
MainClass<T, T> _field1;
internal StructWithOneFieldTwoGenParams1(MainClass<T, T> f) { _field1 = f; }
public override string ToString() { return "StructWithOneFieldTwoGenParams1<" + typeof(T) + "," + typeof(U) +">. _field1 = {" + _field1.ToString() + "}"; }
}
public struct StructWithOneFieldTwoGenParams2<T, U>
{
ClassWithTField<T> _field1;
internal StructWithOneFieldTwoGenParams2(ClassWithTField<T> f) { _field1 = f; }
public override string ToString() { return "StructWithOneFieldTwoGenParams2<" + typeof(T) + "," + typeof(U) + ">. _field1 = {" + _field1.ToString() + "}"; }
}
public struct StructWithOneFieldTwoGenParams3<T, U>
{
StructWithTField<T> _field1;
internal StructWithOneFieldTwoGenParams3(StructWithTField<T> f) { _field1 = f; }
public override string ToString() { return "StructWithOneFieldTwoGenParams3<" + typeof(T) + "," + typeof(U) + ">. _field1 = {" + _field1.ToString() + "}"; }
}
public struct StructWithTwoFieldsTwoGenParams1<T, U>
{
MainClass<T, T> _field1;
TestStructKnownSize<T> _field2;
internal StructWithTwoFieldsTwoGenParams1(MainClass<T, T> f, T tValue) { _field1 = f; _field2 = new TestStructKnownSize<T>(new EmptyClass<T>(), tValue); }
public override string ToString() { return "StructWithTwoFieldsTwoGenParams1<" + typeof(T) + "," + typeof(U) + ">. _field1 = {" + _field1.ToString() + "}. _field2 = {" + _field2.ToString() + "}"; }
}
public struct StructWithTwoFieldsTwoGenParams2<T, U>
{
MainClass<T, T> _field1;
TestStructIndeterminateSize<T> _field2;
internal StructWithTwoFieldsTwoGenParams2(MainClass<T, T> f, T tValue) { _field1 = f; _field2 = new TestStructIndeterminateSize<T>(new EmptyClass<T>(), tValue); }
public override string ToString() { return "StructWithTwoFieldsTwoGenParams2<" + typeof(T) + "," + typeof(U) + ">. _field1 = {" + _field1.ToString() + "}. _field2 = {" + _field2.ToString() + "}"; }
}
public class MainClass<T, U>
{
string _id = null;
T _tValue = default(T);
static MainClass<T, T> _mainTT = null;
public MainClass() { }
private MainClass(string id, T tValue)
{
_id = id;
_tValue = tValue;
}
private MainClass<T, T> GetMainTT()
{
if (_mainTT == null)
{
_mainTT = new MainClass<T, T>();
_mainTT._id = this._id;
_mainTT._tValue = this._tValue;
}
return _mainTT;
}
public void SetID(string id) { _id = id; }
public void SetT(T tValue) { _tValue = tValue; }
public override string ToString() { return "MainClass<" + typeof(T).Name + ">. _id = {" + _id.ToString() + "}. _tValue = {" + _tValue.ToString() + "}"; }
public ClassWithTField<T> GetClassWithTField() { return new ClassWithTField<T>(_tValue); }
public ClassWithTField<T> PassthruClassWithTField(ClassWithTField<T> value) { return value; }
public delegate ClassWithTField<T> PassthruClassWithTFieldDelegate(MainClass<T, U> obj, ClassWithTField<T> value);
public object PassthruClassWithTFieldDelegateDirectCall(MainClass<T, U> obj, ClassWithTField<T> value, PassthruClassWithTFieldDelegate del) { return del(obj, value); }
public StructWithTField<T> GetStructWithTField() { return new StructWithTField<T>(_tValue); }
public StructWithTField<T> PassthruStructWithTField(StructWithTField<T> value) { return value; }
public delegate StructWithTField<T> PassthruStructWithTFieldDelegate(MainClass<T, U> obj, StructWithTField<T> value);
public object PassthruStructWithTFieldDelegateDirectCall(MainClass<T, U> obj, StructWithTField<T> value, PassthruStructWithTFieldDelegate del) { return del(obj, value); }
public TestStructKnownSize<T> GetTestStructKnownSize() { return new TestStructKnownSize<T>(new EmptyClass<T>(), _tValue); }
public TestStructKnownSize<T> PassthruTestStructKnownSize(TestStructKnownSize<T> value) { return value; }
public delegate TestStructKnownSize<T> PassthruTestStructKnownSizeDelegate(MainClass<T, U> obj, TestStructKnownSize<T> value);
public object PassthruTestStructKnownSizeDelegateDirectCall(MainClass<T, U> obj, TestStructKnownSize<T> value, PassthruTestStructKnownSizeDelegate del) { return del(obj, value); }
public TestStructIndeterminateSize<T> GetTestStructIndeterminateSize() { return new TestStructIndeterminateSize<T>(new EmptyClass<T>(), _tValue); }
public TestStructIndeterminateSize<T> PassthruTestStructIndeterminateSize(TestStructIndeterminateSize<T> value) { return value; }
public delegate TestStructIndeterminateSize<T> PassthruTestStructIndeterminateSizeDelegate(MainClass<T, U> obj, TestStructIndeterminateSize<T> value);
public object PassthruTestStructIndeterminateSizeDelegateDirectCall(MainClass<T, U> obj, TestStructIndeterminateSize<T> value, PassthruTestStructIndeterminateSizeDelegate del) { return del(obj, value); }
public TestStructKnownSize<TestStructIndeterminateSize<T>> GetTestStructKnownSizeWrappingTestStructIndeterminateSize() { return new TestStructKnownSize<TestStructIndeterminateSize<T>>(new EmptyClass<TestStructIndeterminateSize<T>>(), new TestStructIndeterminateSize<T>(new EmptyClass<T>(), _tValue)); }
public TestStructKnownSize<TestStructIndeterminateSize<T>> PassthruTestStructKnownSizeWrappingTestStructIndeterminateSize(TestStructKnownSize<TestStructIndeterminateSize<T>> value) { return value; }
public delegate TestStructKnownSize<TestStructIndeterminateSize<T>> PassthruTestStructKnownSizeWrappingTestStructIndeterminateSizeDelegate(MainClass<T, U> obj, TestStructKnownSize<TestStructIndeterminateSize<T>> value);
public object PassthruTestStructKnownSizeWrappingTestStructIndeterminateSizeDelegateDirectCall(MainClass<T, U> obj, TestStructKnownSize<TestStructIndeterminateSize<T>> value, PassthruTestStructKnownSizeWrappingTestStructIndeterminateSizeDelegate del) { return del(obj, value); }
public TestStructIndeterminateSize<TestStructKnownSize<T>> GetTestStructIndeterminateSizeWrappingTestStructKnownSize() { return new TestStructIndeterminateSize<TestStructKnownSize<T>>(new EmptyClass<TestStructKnownSize<T>>(), new TestStructKnownSize<T>(new EmptyClass<T>(), _tValue)); }
public TestStructIndeterminateSize<TestStructKnownSize<T>> PassthruTestStructIndeterminateSizeWrappingTestStructKnownSize(TestStructIndeterminateSize<TestStructKnownSize<T>> value) { return value; }
public delegate TestStructIndeterminateSize<TestStructKnownSize<T>> PassthruTestStructIndeterminateSizeWrappingTestStructKnownSizeDelegate(MainClass<T, U> obj, TestStructIndeterminateSize<TestStructKnownSize<T>> value);
public object PassthruTestStructIndeterminateSizeWrappingTestStructKnownSizeDelegateDirectCall(MainClass<T, U> obj, TestStructIndeterminateSize<TestStructKnownSize<T>> value, PassthruTestStructIndeterminateSizeWrappingTestStructKnownSizeDelegate del) { return del(obj, value); }
public TestStructIndeterminateSize<TestStructKnownSize<ClassWithTField<T>>> GetTestStructIndeterminateSizeWrappingTestStructKnownSizeWrappingReferenceType() { return new TestStructIndeterminateSize<TestStructKnownSize<ClassWithTField<T>>>(new EmptyClass<TestStructKnownSize<ClassWithTField<T>>>(), new TestStructKnownSize<ClassWithTField<T>>(new EmptyClass<ClassWithTField<T>>(), new ClassWithTField<T>(_tValue))); }
public TestStructIndeterminateSize<TestStructKnownSize<ClassWithTField<T>>> PassthruTestStructIndeterminateSizeWrappingTestStructKnownSizeWrappingReferenceType(TestStructIndeterminateSize<TestStructKnownSize<ClassWithTField<T>>> value) { return value; }
public delegate TestStructIndeterminateSize<TestStructKnownSize<ClassWithTField<T>>> PassthruTestStructIndeterminateSizeWrappingTestStructKnownSizeWrappingReferenceTypeDelegate(MainClass<T, U> obj, TestStructIndeterminateSize<TestStructKnownSize<ClassWithTField<T>>> value);
public object PassthruTestStructIndeterminateSizeWrappingTestStructKnownSizeWrappingReferenceTypeDelegateDirectCall(MainClass<T, U> obj, TestStructIndeterminateSize<TestStructKnownSize<ClassWithTField<T>>> value, PassthruTestStructIndeterminateSizeWrappingTestStructKnownSizeWrappingReferenceTypeDelegate del) { return del(obj, value); }
public TestStructIndeterminateSize<TestStructIndeterminateSize<ClassWithTField<T>>> GetTestStructIndeterminateSizeWrappingTestStructIndeterminateSizeWrappingReferenceType() { return new TestStructIndeterminateSize<TestStructIndeterminateSize<ClassWithTField<T>>>(new EmptyClass<TestStructIndeterminateSize<ClassWithTField<T>>>(), new TestStructIndeterminateSize<ClassWithTField<T>>(new EmptyClass<ClassWithTField<T>>(), new ClassWithTField<T>(_tValue))); }
public TestStructIndeterminateSize<TestStructIndeterminateSize<ClassWithTField<T>>> PassthruTestStructIndeterminateSizeWrappingTestStructIndeterminateSizeWrappingReferenceType(TestStructIndeterminateSize<TestStructIndeterminateSize<ClassWithTField<T>>> value) { return value; }
public delegate TestStructIndeterminateSize<TestStructIndeterminateSize<ClassWithTField<T>>> PassthruTestStructIndeterminateSizeWrappingTestStructIndeterminateSizeWrappingReferenceTypeDelegate(MainClass<T, U> obj, TestStructIndeterminateSize<TestStructIndeterminateSize<ClassWithTField<T>>> value);
public object PassthruTestStructIndeterminateSizeWrappingTestStructIndeterminateSizeWrappingReferenceTypeDelegateDirectCall(MainClass<T, U> obj, TestStructIndeterminateSize<TestStructIndeterminateSize<ClassWithTField<T>>> value, PassthruTestStructIndeterminateSizeWrappingTestStructIndeterminateSizeWrappingReferenceTypeDelegate del) { return del(obj, value); }
public StructWithOneField1<T> GetStructWithOneField1() { return new StructWithOneField1<T>(GetMainTT()); }
public StructWithOneField1<T> PassthruStructWithOneField1(StructWithOneField1<T> value) { return value; }
public delegate StructWithOneField1<T> PassthruStructWithOneField1Delegate(MainClass<T, U> obj, StructWithOneField1<T> value);
public object PassthruStructWithOneField1DelegateDirectCall(MainClass<T, U> obj, StructWithOneField1<T> value, PassthruStructWithOneField1Delegate del) { return del(obj, value); }
public StructWithOneField2<T> GetStructWithOneField2() { return new StructWithOneField2<T>(new ClassWithTField<T>(_tValue)); }
public StructWithOneField2<T> PassthruStructWithOneField2(StructWithOneField2<T> value) { return value; }
public delegate StructWithOneField2<T> PassthruStructWithOneField2Delegate(MainClass<T, U> obj, StructWithOneField2<T> value);
public object PassthruStructWithOneField2DelegateDirectCall(MainClass<T, U> obj, StructWithOneField2<T> value, PassthruStructWithOneField2Delegate del) { return del(obj, value); }
public StructWithOneField3<T> GetStructWithOneField3() { return new StructWithOneField3<T>(new StructWithTField<T>(_tValue)); }
public StructWithOneField3<T> PassthruStructWithOneField3(StructWithOneField3<T> value) { return value; }
public delegate StructWithOneField3<T> PassthruStructWithOneField3Delegate(MainClass<T, U> obj, StructWithOneField3<T> value);
public object PassthruStructWithOneField3DelegateDirectCall(MainClass<T, U> obj, StructWithOneField3<T> value, PassthruStructWithOneField3Delegate del) { return del(obj, value); }
public StructWithTwoFields1<T> GetStructWithTwoFields1() { return new StructWithTwoFields1<T>(GetMainTT(), _tValue); }
public StructWithTwoFields1<T> PassthruStructWithTwoFields1(StructWithTwoFields1<T> value) { return value; }
public delegate StructWithTwoFields1<T> PassthruStructWithTwoFields1Delegate(MainClass<T, U> obj, StructWithTwoFields1<T> value);
public object PassthruStructWithTwoFields1DelegateDirectCall(MainClass<T, U> obj, StructWithTwoFields1<T> value, PassthruStructWithTwoFields1Delegate del) { return del(obj, value); }
public StructWithTwoFields2<T> GetStructWithTwoFields2() { return new StructWithTwoFields2<T>(GetMainTT(), _tValue); }
public StructWithTwoFields2<T> PassthruStructWithTwoFields2(StructWithTwoFields2<T> value) { return value; }
public delegate StructWithTwoFields2<T> PassthruStructWithTwoFields2Delegate(MainClass<T, U> obj, StructWithTwoFields2<T> value);
public object PassthruStructWithTwoFields2DelegateDirectCall(MainClass<T, U> obj, StructWithTwoFields2<T> value, PassthruStructWithTwoFields2Delegate del) { return del(obj, value); }
public StructWithTwoGenParams<int, T> GetStructWithTwoGenParams1() { return new StructWithTwoGenParams<int, T>(int.Parse(_id)); }
public StructWithTwoGenParams<int, T> PassthruStructWithTwoGenParams1(StructWithTwoGenParams<int, T> value) { return value; }
public delegate StructWithTwoGenParams<int, T> PassthruStructWithTwoGenParams1Delegate(MainClass<T, U> obj, StructWithTwoGenParams<int, T> value);
public object PassthruStructWithTwoGenParams1DelegateDirectCall(MainClass<T, U> obj, StructWithTwoGenParams<int, T> value, PassthruStructWithTwoGenParams1Delegate del) { return del(obj, value); }
public StructWithTwoGenParams<int, KeyValuePair<int, StructWithTwoGenParams<List<T>, T>>> GetStructWithTwoGenParams2() { return new StructWithTwoGenParams<int, KeyValuePair<int, StructWithTwoGenParams<List<T>, T>>>(int.Parse(_id)); }
public StructWithTwoGenParams<int, KeyValuePair<int, StructWithTwoGenParams<List<T>, T>>> PassthruStructWithTwoGenParams2(StructWithTwoGenParams<int, KeyValuePair<int, StructWithTwoGenParams<List<T>, T>>> value) { return value; }
public delegate StructWithTwoGenParams<int, KeyValuePair<int, StructWithTwoGenParams<List<T>, T>>> PassthruStructWithTwoGenParams2Delegate(MainClass<T, U> obj, StructWithTwoGenParams<int, KeyValuePair<int, StructWithTwoGenParams<List<T>, T>>> value);
public object PassthruStructWithTwoGenParams2DelegateDirectCall(MainClass<T, U> obj, StructWithTwoGenParams<int, KeyValuePair<int, StructWithTwoGenParams<List<T>, T>>> value, PassthruStructWithTwoGenParams2Delegate del) { return del(obj, value); }
public StructWithTwoGenParams<int, StructWithTwoGenParams<List<T>, KeyValuePair<T, T>>> GetStructWithTwoGenParams3() { return new StructWithTwoGenParams<int, StructWithTwoGenParams<List<T>, KeyValuePair<T, T>>>(int.Parse(_id)); }
public StructWithTwoGenParams<int, StructWithTwoGenParams<List<T>, KeyValuePair<T, T>>> PassthruStructWithTwoGenParams3(StructWithTwoGenParams<int, StructWithTwoGenParams<List<T>, KeyValuePair<T, T>>> value) { return value; }
public delegate StructWithTwoGenParams<int, StructWithTwoGenParams<List<T>, KeyValuePair<T, T>>> PassthruStructWithTwoGenParams3Delegate(MainClass<T, U> obj, StructWithTwoGenParams<int, StructWithTwoGenParams<List<T>, KeyValuePair<T, T>>> value);
public object PassthruStructWithTwoGenParams3DelegateDirectCall(MainClass<T, U> obj, StructWithTwoGenParams<int, StructWithTwoGenParams<List<T>, KeyValuePair<T, T>>> value, PassthruStructWithTwoGenParams3Delegate del) { return del(obj, value); }
public StructWithTwoGenParams<int, StructWithTwoGenParams<List<int>, KeyValuePair<int, string>>> GetStructWithTwoGenParams4() { return new StructWithTwoGenParams<int, StructWithTwoGenParams<List<int>, KeyValuePair<int, string>>>(int.Parse(_id)); }
public StructWithTwoGenParams<int, StructWithTwoGenParams<List<int>, KeyValuePair<int, string>>> PassthruStructWithTwoGenParams4(StructWithTwoGenParams<int, StructWithTwoGenParams<List<int>, KeyValuePair<int, string>>> value) { return value; }
public delegate StructWithTwoGenParams<int, StructWithTwoGenParams<List<int>, KeyValuePair<int, string>>> PassthruStructWithTwoGenParams4Delegate(MainClass<T, U> obj, StructWithTwoGenParams<int, StructWithTwoGenParams<List<int>, KeyValuePair<int, string>>> value);
public object PassthruStructWithTwoGenParams4DelegateDirectCall(MainClass<T, U> obj, StructWithTwoGenParams<int, StructWithTwoGenParams<List<int>, KeyValuePair<int, string>>> value, PassthruStructWithTwoGenParams4Delegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams1<T, T> GetStructWithOneFieldTwoGenParams1() { return new StructWithOneFieldTwoGenParams1<T, T>(GetMainTT()); }
public StructWithOneFieldTwoGenParams1<T, T> PassthruStructWithOneFieldTwoGenParams1(StructWithOneFieldTwoGenParams1<T, T> value) { return value; }
public delegate StructWithOneFieldTwoGenParams1<T, T> PassthruStructWithOneFieldTwoGenParams1Delegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams1<T, T> value);
public object PassthruStructWithOneFieldTwoGenParams1DelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams1<T, T> value, PassthruStructWithOneFieldTwoGenParams1Delegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams2<T, T> GetStructWithOneFieldTwoGenParams2() { return new StructWithOneFieldTwoGenParams2<T, T>(new ClassWithTField<T>(_tValue)); }
public StructWithOneFieldTwoGenParams2<T, T> PassthruStructWithOneFieldTwoGenParams2(StructWithOneFieldTwoGenParams2<T, T> value) { return value; }
public delegate StructWithOneFieldTwoGenParams2<T, T> PassthruStructWithOneFieldTwoGenParams2Delegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams2<T, T> value);
public object PassthruStructWithOneFieldTwoGenParams2DelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams2<T, T> value, PassthruStructWithOneFieldTwoGenParams2Delegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams3<T, T> GetStructWithOneFieldTwoGenParams3() { return new StructWithOneFieldTwoGenParams3<T, T>(new StructWithTField<T>(_tValue)); }
public StructWithOneFieldTwoGenParams3<T, T> PassthruStructWithOneFieldTwoGenParams3(StructWithOneFieldTwoGenParams3<T, T> value) { return value; }
public delegate StructWithOneFieldTwoGenParams3<T, T> PassthruStructWithOneFieldTwoGenParams3Delegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams3<T, T> value);
public object PassthruStructWithOneFieldTwoGenParams3DelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams3<T, T> value, PassthruStructWithOneFieldTwoGenParams3Delegate del) { return del(obj, value); }
public StructWithTwoFieldsTwoGenParams1<T, T> GetStructWithTwoFieldsTwoGenParams1() { return new StructWithTwoFieldsTwoGenParams1<T, T>(GetMainTT(), _tValue); }
public StructWithTwoFieldsTwoGenParams1<T, T> PassthruStructWithTwoFieldsTwoGenParams1(StructWithTwoFieldsTwoGenParams1<T, T> value) { return value; }
public delegate StructWithTwoFieldsTwoGenParams1<T, T> PassthruStructWithTwoFieldsTwoGenParams1Delegate(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams1<T, T> value);
public object PassthruStructWithTwoFieldsTwoGenParams1DelegateDirectCall(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams1<T, T> value, PassthruStructWithTwoFieldsTwoGenParams1Delegate del) { return del(obj, value); }
public StructWithTwoFieldsTwoGenParams2<T, T> GetStructWithTwoFieldsTwoGenParams2() { return new StructWithTwoFieldsTwoGenParams2<T, T>(GetMainTT(), _tValue); }
public StructWithTwoFieldsTwoGenParams2<T, T> PassthruStructWithTwoFieldsTwoGenParams2(StructWithTwoFieldsTwoGenParams2<T, T> value) { return value; }
public delegate StructWithTwoFieldsTwoGenParams2<T, T> PassthruStructWithTwoFieldsTwoGenParams2Delegate(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams2<T, T> value);
public object PassthruStructWithTwoFieldsTwoGenParams2DelegateDirectCall(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams2<T, T> value, PassthruStructWithTwoFieldsTwoGenParams2Delegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams1<T, float> GetStructWithOneFieldTwoGenParams1_KnownU() { return new StructWithOneFieldTwoGenParams1<T, float>(GetMainTT()); }
public StructWithOneFieldTwoGenParams1<T, float> PassthruStructWithOneFieldTwoGenParams1_KnownU(StructWithOneFieldTwoGenParams1<T, float> value) { return value; }
public delegate StructWithOneFieldTwoGenParams1<T, float> PassthruStructWithOneFieldTwoGenParams1_KnownUDelegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams1<T, float> value);
public object PassthruStructWithOneFieldTwoGenParams1_KnownUDelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams1<T, float> value, PassthruStructWithOneFieldTwoGenParams1_KnownUDelegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams2<T, float> GetStructWithOneFieldTwoGenParams2_KnownU() { return new StructWithOneFieldTwoGenParams2<T, float>(new ClassWithTField<T>(_tValue)); }
public StructWithOneFieldTwoGenParams2<T, float> PassthruStructWithOneFieldTwoGenParams2_KnownU(StructWithOneFieldTwoGenParams2<T, float> value) { return value; }
public delegate StructWithOneFieldTwoGenParams2<T, float> PassthruStructWithOneFieldTwoGenParams2_KnownUDelegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams2<T, float> value);
public object PassthruStructWithOneFieldTwoGenParams2_KnownUDelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams2<T, float> value, PassthruStructWithOneFieldTwoGenParams2_KnownUDelegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams3<T, float> GetStructWithOneFieldTwoGenParams3_KnownU() { return new StructWithOneFieldTwoGenParams3<T, float>(new StructWithTField<T>(_tValue)); }
public StructWithOneFieldTwoGenParams3<T, float> PassthruStructWithOneFieldTwoGenParams3_KnownU(StructWithOneFieldTwoGenParams3<T, float> value) { return value; }
public delegate StructWithOneFieldTwoGenParams3<T, float> PassthruStructWithOneFieldTwoGenParams3_KnownUDelegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams3<T, float> value);
public object PassthruStructWithOneFieldTwoGenParams3_KnownUDelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams3<T, float> value, PassthruStructWithOneFieldTwoGenParams3_KnownUDelegate del) { return del(obj, value); }
public StructWithTwoFieldsTwoGenParams1<T, float> GetStructWithTwoFieldsTwoGenParams1_KnownU() { return new StructWithTwoFieldsTwoGenParams1<T, float>(GetMainTT(), _tValue); }
public StructWithTwoFieldsTwoGenParams1<T, float> PassthruStructWithTwoFieldsTwoGenParams1_KnownU(StructWithTwoFieldsTwoGenParams1<T, float> value) { return value; }
public delegate StructWithTwoFieldsTwoGenParams1<T, float> PassthruStructWithTwoFieldsTwoGenParams1_KnownUDelegate(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams1<T, float> value);
public object PassthruStructWithTwoFieldsTwoGenParams1_KnownUDelegateDirectCall(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams1<T, float> value, PassthruStructWithTwoFieldsTwoGenParams1_KnownUDelegate del) { return del(obj, value); }
public StructWithTwoFieldsTwoGenParams2<T, float> GetStructWithTwoFieldsTwoGenParams2_KnownU() { return new StructWithTwoFieldsTwoGenParams2<T, float>(GetMainTT(), _tValue); }
public StructWithTwoFieldsTwoGenParams2<T, float> PassthruStructWithTwoFieldsTwoGenParams2_KnownU(StructWithTwoFieldsTwoGenParams2<T, float> value) { return value; }
public delegate StructWithTwoFieldsTwoGenParams2<T, float> PassthruStructWithTwoFieldsTwoGenParams2_KnownUDelegate(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams2<T, float> value);
public object PassthruStructWithTwoFieldsTwoGenParams2_KnownUDelegateDirectCall(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams2<T, float> value, PassthruStructWithTwoFieldsTwoGenParams2_KnownUDelegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams1<long, T> GetStructWithOneFieldTwoGenParams1_KnownT() { return new StructWithOneFieldTwoGenParams1<long, T>(new MainClass<long, long>("123", long.Parse(_id))); }
public StructWithOneFieldTwoGenParams1<long, T> PassthruStructWithOneFieldTwoGenParams1_KnownT(StructWithOneFieldTwoGenParams1<long, T> value) { return value; }
public delegate StructWithOneFieldTwoGenParams1<long, T> PassthruStructWithOneFieldTwoGenParams1_KnownTDelegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams1<long, T> value);
public object PassthruStructWithOneFieldTwoGenParams1_KnownTDelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams1<long, T> value, PassthruStructWithOneFieldTwoGenParams1_KnownTDelegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams2<long, T> GetStructWithOneFieldTwoGenParams2_KnownT() { return new StructWithOneFieldTwoGenParams2<long, T>(new ClassWithTField<long>(long.Parse(_id))); }
public StructWithOneFieldTwoGenParams2<long, T> PassthruStructWithOneFieldTwoGenParams2_KnownT(StructWithOneFieldTwoGenParams2<long, T> value) { return value; }
public delegate StructWithOneFieldTwoGenParams2<long, T> PassthruStructWithOneFieldTwoGenParams2_KnownTDelegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams2<long, T> value);
public object PassthruStructWithOneFieldTwoGenParams2_KnownTDelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams2<long, T> value, PassthruStructWithOneFieldTwoGenParams2_KnownTDelegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams3<long, T> GetStructWithOneFieldTwoGenParams3_KnownT() { return new StructWithOneFieldTwoGenParams3<long, T>(new StructWithTField<long>(long.Parse(_id))); }
public StructWithOneFieldTwoGenParams3<long, T> PassthruStructWithOneFieldTwoGenParams3_KnownT(StructWithOneFieldTwoGenParams3<long, T> value) { return value; }
public delegate StructWithOneFieldTwoGenParams3<long, T> PassthruStructWithOneFieldTwoGenParams3_KnownTDelegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams3<long, T> value);
public object PassthruStructWithOneFieldTwoGenParams3_KnownTDelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams3<long, T> value, PassthruStructWithOneFieldTwoGenParams3_KnownTDelegate del) { return del(obj, value); }
public StructWithTwoFieldsTwoGenParams1<long, T> GetStructWithTwoFieldsTwoGenParams1_KnownT() { return new StructWithTwoFieldsTwoGenParams1<long, T>(new MainClass<long, long>("456", long.Parse(_id)), long.Parse(_id)); }
public StructWithTwoFieldsTwoGenParams1<long, T> PassthruStructWithTwoFieldsTwoGenParams1_KnownT(StructWithTwoFieldsTwoGenParams1<long, T> value) { return value; }
public delegate StructWithTwoFieldsTwoGenParams1<long, T> PassthruStructWithTwoFieldsTwoGenParams1_KnownTDelegate(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams1<long, T> value);
public object PassthruStructWithTwoFieldsTwoGenParams1_KnownTDelegateDirectCall(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams1<long, T> value, PassthruStructWithTwoFieldsTwoGenParams1_KnownTDelegate del) { return del(obj, value); }
public StructWithTwoFieldsTwoGenParams2<long, T> GetStructWithTwoFieldsTwoGenParams2_KnownT() { return new StructWithTwoFieldsTwoGenParams2<long, T>(new MainClass<long, long>("789", long.Parse(_id)), long.Parse(_id)); }
public StructWithTwoFieldsTwoGenParams2<long, T> PassthruStructWithTwoFieldsTwoGenParams2_KnownT(StructWithTwoFieldsTwoGenParams2<long, T> value) { return value; }
public delegate StructWithTwoFieldsTwoGenParams2<long, T> PassthruStructWithTwoFieldsTwoGenParams2_KnownTDelegate(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams2<long, T> value);
public object PassthruStructWithTwoFieldsTwoGenParams2_KnownTDelegateDirectCall(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams2<long, T> value, PassthruStructWithTwoFieldsTwoGenParams2_KnownTDelegate del) { return del(obj, value); }
public string ObjectToString<Y>(Y x) { return x.ToString(); }
}
#endregion
public class Test
{
[TestMethod]
public static void TestInstancesOfKnownAndUnknownSizes()
{
foreach (Type genArg in new Type[] { TypeOf.Double, TypeOf.String })
{
Type t = typeof(MainClass<,>).MakeGenericType(genArg, TypeOf.Double);
object o = Activator.CreateInstance(t);
object genArgInst = genArg == TypeOf.Double ? (object)12.43 : "56.78";
MethodInfo SetID = t.GetTypeInfo().GetDeclaredMethod("SetID");
SetID.Invoke(o, new object[] { "abc" });
MethodInfo SetT = t.GetTypeInfo().GetDeclaredMethod("SetT");
SetT.Invoke(o, new object[] { genArgInst });
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetClassWithTField", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTField", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetTestStructKnownSize", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetTestStructIndeterminateSize", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetTestStructKnownSizeWrappingTestStructIndeterminateSize", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetTestStructIndeterminateSizeWrappingTestStructKnownSize", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetTestStructIndeterminateSizeWrappingTestStructKnownSizeWrappingReferenceType", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetTestStructIndeterminateSizeWrappingTestStructIndeterminateSizeWrappingReferenceType", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneField1", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneField2", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneField3", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoFields1", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoFields2", "abc", genArgInst);
SetID.Invoke(o, new object[] { "11" });
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoGenParams1", "11", null);
SetID.Invoke(o, new object[] { "22" });
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoGenParams2", "22", null);
SetID.Invoke(o, new object[] { "33" });
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoGenParams3", "33", null);
SetID.Invoke(o, new object[] { "44" });
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoGenParams4", "44", null);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams1", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams2", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams3", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoFieldsTwoGenParams1", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoFieldsTwoGenParams2", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams1_KnownU", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams2_KnownU", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams3_KnownU", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoFieldsTwoGenParams1_KnownU", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoFieldsTwoGenParams2_KnownU", "abc", genArgInst);
SetID.Invoke(o, new object[] { "55" });
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams1_KnownT", "123", "55");
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams2_KnownT", "55", null);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams3_KnownT", "55", null);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoFieldsTwoGenParams1_KnownT", "456", "55");
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoFieldsTwoGenParams2_KnownT", "789", "55");
}
}
static string TestInstancesOfKnownAndUnknownSizes_GetExpectedResult(Type t, object a, object b, string getterFunc)
{
switch (getterFunc)
{
case "GetClassWithTField": return "ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}";
case "GetStructWithTField": return "StructWithTField<" + t.Name + ">. _field1 = {" + b + "}";
case "GetTestStructKnownSize": return "TestStructKnownSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}";
case "GetTestStructIndeterminateSize": return "TestStructIndeterminateSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {StructWithTField<" + t.Name + ">. _field1 = {" + b + "}}";
case "GetTestStructKnownSizeWrappingTestStructIndeterminateSize": return "TestStructKnownSize<TestStructIndeterminateSize`1>. _field1 = {EmptyClass<TestStructIndeterminateSize`1>}. _field2 = {ClassWithTField<TestStructIndeterminateSize`1>. _field1 = {TestStructIndeterminateSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {StructWithTField<" + t.Name + ">. _field1 = {" + b + "}}}}";
case "GetTestStructIndeterminateSizeWrappingTestStructKnownSize": return "TestStructIndeterminateSize<TestStructKnownSize`1>. _field1 = {EmptyClass<TestStructKnownSize`1>}. _field2 = {StructWithTField<TestStructKnownSize`1>. _field1 = {TestStructKnownSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}}}";
case "GetTestStructIndeterminateSizeWrappingTestStructKnownSizeWrappingReferenceType": return "TestStructIndeterminateSize<TestStructKnownSize`1>. _field1 = {EmptyClass<TestStructKnownSize`1>}. _field2 = {StructWithTField<TestStructKnownSize`1>. _field1 = {TestStructKnownSize<ClassWithTField`1>. _field1 = {EmptyClass<ClassWithTField`1>}. _field2 = {ClassWithTField<ClassWithTField`1>. _field1 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}}}}";
case "GetTestStructIndeterminateSizeWrappingTestStructIndeterminateSizeWrappingReferenceType": return "TestStructIndeterminateSize<TestStructIndeterminateSize`1>. _field1 = {EmptyClass<TestStructIndeterminateSize`1>}. _field2 = {StructWithTField<TestStructIndeterminateSize`1>. _field1 = {TestStructIndeterminateSize<ClassWithTField`1>. _field1 = {EmptyClass<ClassWithTField`1>}. _field2 = {StructWithTField<ClassWithTField`1>. _field1 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}}}}";
case "GetStructWithOneField1": return "StructWithOneField1<" + t.Name + ">. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}";
case "GetStructWithOneField2": return "StructWithOneField2<" + t.Name + ">. _field1 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}";
case "GetStructWithOneField3": return "StructWithOneField3<" + t.Name + ">. _field1 = {StructWithTField<" + t.Name + ">. _field1 = {" + b + "}}";
case "GetStructWithTwoFields1": return "StructWithTwoFields1<" + t.Name + ">. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}. _field2 = {TestStructKnownSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}}";
case "GetStructWithTwoFields2": return "StructWithTwoFields2<" + t.Name + ">. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}. _field2 = {TestStructIndeterminateSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {StructWithTField<" + t.Name + ">. _field1 = {" + b + "}}}";
case "GetStructWithTwoGenParams1": return "StructWithTwoGenParams<System.Int32," + t + ">. _field1 = {" + a + "}";
case "GetStructWithTwoGenParams2": return "StructWithTwoGenParams<System.Int32,System.Collections.Generic.KeyValuePair`2[System.Int32,CallingConvention.StructWithTwoGenParams`2[System.Collections.Generic.List`1[" + t + "]," + t + "]]>. _field1 = {" + a + "}";
case "GetStructWithTwoGenParams3": return "StructWithTwoGenParams<System.Int32,CallingConvention.StructWithTwoGenParams`2[System.Collections.Generic.List`1[" + t + "],System.Collections.Generic.KeyValuePair`2[" + t + "," + t + "]]>. _field1 = {" + a + "}";
case "GetStructWithTwoGenParams4": return "StructWithTwoGenParams<System.Int32,CallingConvention.StructWithTwoGenParams`2[System.Collections.Generic.List`1[System.Int32],System.Collections.Generic.KeyValuePair`2[System.Int32,System.String]]>. _field1 = {" + a + "}";
case "GetStructWithOneFieldTwoGenParams1": return "StructWithOneFieldTwoGenParams1<" + t + "," + t + ">. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}";
case "GetStructWithOneFieldTwoGenParams2": return "StructWithOneFieldTwoGenParams2<" + t + "," + t + ">. _field1 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}";
case "GetStructWithOneFieldTwoGenParams3": return "StructWithOneFieldTwoGenParams3<" + t + "," + t + ">. _field1 = {StructWithTField<" + t.Name + ">. _field1 = {" + b + "}}";
case "GetStructWithTwoFieldsTwoGenParams1": return "StructWithTwoFieldsTwoGenParams1<" + t + "," + t + ">. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}. _field2 = {TestStructKnownSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}}";
case "GetStructWithTwoFieldsTwoGenParams2": return "StructWithTwoFieldsTwoGenParams2<" + t + "," + t + ">. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}. _field2 = {TestStructIndeterminateSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {StructWithTField<" + t.Name + ">. _field1 = {" + b + "}}}";
case "GetStructWithOneFieldTwoGenParams1_KnownU": return "StructWithOneFieldTwoGenParams1<" + t + ",System.Single>. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}";
case "GetStructWithOneFieldTwoGenParams2_KnownU": return "StructWithOneFieldTwoGenParams2<" + t + ",System.Single>. _field1 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}";
case "GetStructWithOneFieldTwoGenParams3_KnownU": return "StructWithOneFieldTwoGenParams3<" + t + ",System.Single>. _field1 = {StructWithTField<" + t.Name + ">. _field1 = {" + b + "}}";
case "GetStructWithTwoFieldsTwoGenParams1_KnownU": return "StructWithTwoFieldsTwoGenParams1<" + t + ",System.Single>. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}. _field2 = {TestStructKnownSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}}";
case "GetStructWithTwoFieldsTwoGenParams2_KnownU": return "StructWithTwoFieldsTwoGenParams2<" + t + ",System.Single>. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}. _field2 = {TestStructIndeterminateSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {StructWithTField<" + t.Name + ">. _field1 = {" + b + "}}}";
case "GetStructWithOneFieldTwoGenParams1_KnownT": return "StructWithOneFieldTwoGenParams1<System.Int64," + t + ">. _field1 = {MainClass<Int64>. _id = {" + a + "}. _tValue = {" + b + "}}";
case "GetStructWithOneFieldTwoGenParams2_KnownT": return "StructWithOneFieldTwoGenParams2<System.Int64," + t + ">. _field1 = {ClassWithTField<Int64>. _field1 = {" + a + "}}";
case "GetStructWithOneFieldTwoGenParams3_KnownT": return "StructWithOneFieldTwoGenParams3<System.Int64," + t + ">. _field1 = {StructWithTField<Int64>. _field1 = {" + a + "}}";
case "GetStructWithTwoFieldsTwoGenParams1_KnownT": return "StructWithTwoFieldsTwoGenParams1<System.Int64," + t + ">. _field1 = {MainClass<Int64>. _id = {" + a + "}. _tValue = {" + b + "}}. _field2 = {TestStructKnownSize<Int64>. _field1 = {EmptyClass<Int64>}. _field2 = {ClassWithTField<Int64>. _field1 = {" + b + "}}}";
case "GetStructWithTwoFieldsTwoGenParams2_KnownT": return "StructWithTwoFieldsTwoGenParams2<System.Int64," + t + ">. _field1 = {MainClass<Int64>. _id = {" + a + "}. _tValue = {" + b + "}}. _field2 = {TestStructIndeterminateSize<Int64>. _field1 = {EmptyClass<Int64>}. _field2 = {StructWithTField<Int64>. _field1 = {" + b + "}}}";
default: return null;
}
}
static void TestInstancesOfKnownAndUnknownSizes_Inner(Type t, object o, string getterFunc, object a, object b)
{
string expectedResult = TestInstancesOfKnownAndUnknownSizes_GetExpectedResult(t.GenericTypeArguments[0], a, b, getterFunc);
// Test that the abi handling for a return value works
MethodInfo getter = t.GetTypeInfo().GetDeclaredMethod(getterFunc);
object retVal = getter.Invoke(o, null);
Assert.AreEqual(expectedResult, retVal.ToString());
MethodInfo toString = t.GetTypeInfo().GetDeclaredMethod("ObjectToString").MakeGenericMethod(retVal.GetType());
string res = (string)toString.Invoke(o, new object[] { retVal });
Assert.AreEqual(expectedResult, res);
// Test that the abi handling for a parameter
string passthruName = "Passthru" + getterFunc.Substring("Get".Length);
MethodInfo passthru = t.GetTypeInfo().GetDeclaredMethod(passthruName);
object passthruRetVal = passthru.Invoke(o, new object[] { retVal });
// Passthru return value testing
res = (string)toString.Invoke(o, new object[] { passthruRetVal });
Assert.AreEqual(expectedResult, res);
// Test that the abi handling for a parameter and return value, through the constructed delegate invoke path
Type delegateType = t.GetTypeInfo().GetDeclaredNestedType(passthruName + "Delegate").AsType();
Type funcType = delegateType.MakeGenericType(t.GenericTypeArguments);
Delegate passthruDelegate = passthru.CreateDelegate(funcType);
object passthruDelegateRetVal = passthruDelegate.DynamicInvoke(o, passthruRetVal);
// Passthru delegate return value testing
res = (string)toString.Invoke(o, new object[] { passthruDelegateRetVal });
Assert.AreEqual(expectedResult, res);
// PassthurDelegate direct call testing
MethodInfo delegateDirectCall = delegateDirectCall = t.GetTypeInfo().GetDeclaredMethod(passthruName + "DelegateDirectCall");
if (delegateDirectCall != null)
{
object passthruDelegateDirectCallRetVal = delegateDirectCall.Invoke(o, new object[] { o, passthruDelegateRetVal, passthruDelegate });
// Passthru delegate return value testing
res = (string)toString.Invoke(o, new object[] { passthruDelegateDirectCallRetVal });
Assert.AreEqual(expectedResult, res);
}
}
[TestMethod]
public static void TestCallInstanceFunction()
{
var t = TypeOf.CCT_UCGTestNonVirtualFunctionCallUse.MakeGenericType(TypeOf.Short);
TestNonVirtualFunctionCallUseBase o = (TestNonVirtualFunctionCallUseBase)Activator.CreateInstance(t);
new UCGSeperateClass<short>().BoxParam(4);
short testValue = (short)3817;
object returnValue = o.TestNonVirtualInstanceFunction(new UCGSeperateClass<short>(), (object)testValue);
Assert.AreEqual(testValue, (short)returnValue);
}
public static object s_expectedT;
[TestMethod]
public static void TestCallInterface()
{
var t = TypeOf.CCT_UCGTestUseInterface.MakeGenericType(TypeOf.Short);
TestInterfaceUseBase o = (TestInterfaceUseBase)Activator.CreateInstance(t);
ITestCallInterface<short> temp = (ITestCallInterface<short>)new TestCallInterfaceImpl();
TestInterfaceUseBase.ShortValue = 0;
short testValue = (short)3817;
o.TestUseInterface(new TestCallInterfaceImpl(), (object)testValue);
Assert.AreEqual(testValue, TestInterfaceUseBase.ShortValue);
}
[TestMethod]
public static void CallingConventionTest()
{
// Using the normal canonical template for the instantiation
{
s_expectedT = "Hello";
CallingConventionTest_Inner<string>("Hello");
}
// Using the universal canonical template for the instantiation
{
s_expectedT = 443;
CallingConventionTest_Inner<short>(443);
}
}
static void CallingConventionTest_Inner<ARG>(ARG val)
{
var t = TypeOf.CCT_CCTester.MakeGenericType(typeof(ARG));
IBase<ARG> o = (IBase<ARG>)Activator.CreateInstance(t);
SimpleFuncCaller<ARG>(o, val);
CoolFuncCaller<ARG>(o, val);
}
static unsafe void SimpleFuncCaller<T>(IBase<T> obj, T tval)
{
obj.SimpleFunc(tval);
}
static unsafe void CoolFuncCaller<T>(IBase<T> obj, T tval)
{
T brt_default = default(T);
int* somePtr = (int*)159;
T t_copy = tval;
T retVal = obj.VirtualCoolFunc("Hello", new Bar<T> { _value = 1 }, new Foo<T> { _value = 2 }, new T[] { tval }, t_copy, ref tval, ref brt_default, 123, (int*)456, (int**)789, ref somePtr);
Assert.AreEqual(tval, default(T));
Assert.AreEqual(brt_default, t_copy);
Assert.AreEqual(retVal, t_copy);
Assert.IsTrue(somePtr == (int*)456);
}
}
}
namespace DynamicInvoke
{
public class Type1<T>
{
T _myField;
public Type1(T t) { _myField = t; }
public T GetMyField() { return _myField; }
public override string ToString() { return "Type1<" + typeof(T) + ">._myField = " + _myField.ToString(); }
}
public class Type2<T>
{
T _myField;
public Type2(T t) { _myField = t; }
public override string ToString() { return "Type2<" + typeof(T) + ">._myField = " + _myField.ToString(); }
}
public class Type3<T>
{
T[] _myField;
public Type3(T t1, T t2, T t3) { _myField = new T[] { t1, t2, t3 }; }
public T Get_A_T(int index) { return _myField[index]; }
}
public class TestType<T, U, V>
{
public string SimpleMethod1()
{
return "SimpleMethod1";
}
public string SimpleMethod2(int a, string b, object c, List<float> d)
{
string result = "SimpleMethod2(" + a + "," + b + "," + c;
foreach (float f in d) result += "," + f;
return result + ")";
}
public T Method0(T t, ref string resultStr)
{
resultStr = "Method0-" + t.ToString();
return t;
}
public void Method1(T t1, ref T t2)
{
t2 = t1;
}
public Type1<T> Method2(Type2<T> l_t, T t, ref string resultStr)
{
resultStr = l_t.ToString();
return new Type1<T>(t);
}
public Type1<U> Method3(Type2<U> l_u, U u, ref string resultStr)
{
resultStr = l_u.ToString();
return new Type1<U>(u);
}
public KeyValuePair<Type3<T>, U> ComplexMethod(KeyValuePair<Type1<T[]>, U> kvp)
{
Type1<T[]> key = kvp.Key;
T[] array = key.GetMyField();
return new KeyValuePair<Type3<T>, U>(new Type3<T>(array[0], array[1], array[2]), kvp.Value);
}
}
public class Test
{
[TestMethod]
public static void TestDynamicInvoke()
{
TestDynamicInvoke_Inner<string>("123", "456");
TestDynamicInvoke_Inner<char>('a', 'b');
TestDynamicInvoke_Inner<short>((short)111, (short)222);
TestDynamicInvoke_Inner<float>((float)3.3f, (float)4.4f);
TestDynamicInvoke_Inner<double>((double)5.55, (double)6.66);
}
public static void TestDynamicInvoke_Inner<T>(T argParam1, T argParam2)
{
string argParam1Str = argParam1.ToString();
string argParam2Str = argParam2.ToString();
var t = TypeOf.DI_TestType.MakeGenericType(typeof(T), TypeOf.String, /* Use int32 here to force usage of the universal template*/ TypeOf.Int32);
var o = Activator.CreateInstance(t);
// SimpleMethod1
{
MethodInfo simpleMethod1 = t.GetTypeInfo().GetDeclaredMethod("SimpleMethod1");
string result = (string)simpleMethod1.Invoke(o, null);
Assert.AreEqual(result, "SimpleMethod1");
Delegate simpleMethod1Del = simpleMethod1.CreateDelegate(typeof(Func<string>), o);
result = (string)simpleMethod1Del.DynamicInvoke(null);
Assert.AreEqual(result, "SimpleMethod1");
}
// SimpleMethod2
{
MethodInfo simpleMethod2 = t.GetTypeInfo().GetDeclaredMethod("SimpleMethod2");
object[] args = new object[] {
123,
"456",
new Dictionary<object, string>(),
new List<float>(new float[]{1.2f, 3.4f, 5.6f})
};
string result = (string)simpleMethod2.Invoke(o, args);
Assert.AreEqual(result, "SimpleMethod2(123,456,System.Collections.Generic.Dictionary`2[System.Object,System.String],1.2,3.4,5.6)");
Delegate simpleMethod2Del = simpleMethod2.CreateDelegate(typeof(Func<int, string, Dictionary<object, string>, List<float>, string>), o);
result = (string)simpleMethod2Del.DynamicInvoke(args);
Assert.AreEqual(result, "SimpleMethod2(123,456,System.Collections.Generic.Dictionary`2[System.Object,System.String],1.2,3.4,5.6)");
}
// Method0
{
MethodInfo method0 = t.GetTypeInfo().GetDeclaredMethod("Method0");
string resultStr = null;
object[] args = new object[] { argParam1, resultStr };
string result = method0.Invoke(o, args).ToString();
resultStr = (string)args[1];
Assert.AreEqual(resultStr, "Method0-" + argParam1Str);
Assert.AreEqual(result, argParam1Str);
}
// Method1
{
MethodInfo method1 = t.GetTypeInfo().GetDeclaredMethod("Method1");
object[] args = new object[] { argParam1, argParam2 };
method1.Invoke(o, args);
Assert.AreEqual(args[0].ToString(), args[1].ToString());
Assert.AreEqual(args[0], args[1]);
Assert.AreEqual(args[1], argParam1);
}
// Method2 and Method3
{
MethodInfo method2 = t.GetTypeInfo().GetDeclaredMethod("Method2");
MethodInfo method3 = t.GetTypeInfo().GetDeclaredMethod("Method3");
var args_for_method2 = new object[] { new Type2<T>(argParam1), argParam2, "" };
var args_for_method3 = new object[] { new Type2<string>("hello"), "myTest", "" };
string result_of_method2 = method2.Invoke(o, args_for_method2).ToString();
string result_of_method3 = method3.Invoke(o, args_for_method3).ToString();
string resultStr_method2 = args_for_method2[2].ToString();
string resultStr_method3 = args_for_method3[2].ToString();
Assert.AreEqual(resultStr_method2, "Type2<" + typeof(T) + ">._myField = " + argParam1.ToString());
Assert.AreEqual(resultStr_method3, "Type2<System.String>._myField = hello");
Assert.AreEqual(result_of_method2, "Type1<" + typeof(T) + ">._myField = " + argParam2.ToString());
Assert.AreEqual(result_of_method3, "Type1<System.String>._myField = myTest");
}
// ComplexMethod
{
MethodInfo complex_method = t.GetTypeInfo().GetDeclaredMethod("ComplexMethod");
Type1<T[]> myType1 = new Type1<T[]>(new T[] { argParam1, argParam2, argParam1 });
object result = complex_method.Invoke(o, new object[] { new KeyValuePair<Type1<T[]>, string>(myType1, "hello") });
KeyValuePair<Type3<T>, String> resultAsKvp = (KeyValuePair<Type3<T>, String>) result;
Assert.AreEqual(resultAsKvp.Key.Get_A_T(0), argParam1);
Assert.AreEqual(resultAsKvp.Key.Get_A_T(1), argParam2);
Assert.AreEqual(resultAsKvp.Key.Get_A_T(2), argParam1);
Assert.AreEqual(resultAsKvp.Value, "hello");
}
}
}
}
namespace TypeLayout
{
public struct GenStructStatic<X, Y, Z>
{
public X x;
public Y y;
public Z z;
}
public struct GenStructDynamic<X, Y, Z>
{
public X x;
public Y y;
public Z z;
// This forces recursive type layout to ensure that we come up with a sensible result.
public static GenStructDynamic<X, Y, Z> test;
}
public class BaseType
{
public float _f1;
public string _f2;
}
public class GenClassStatic<X, Y, Z> : BaseType
{
public X x;
public Y y;
public Z z;
}
public class GenClassDynamic<X, Y, Z> : BaseType
{
public X x;
public Y y;
public Z z;
}
public abstract class Base
{
public abstract Type GetTypeOfArray();
}
public class MyArray<T> : Base
{
public T[] t = new T[10];
public override Type GetTypeOfArray()
{
return t.GetType();
}
}
public class Test
{
public static GenStructStatic<sbyte, sbyte, sbyte> s_staticStruct;
public static GenStructDynamic<sbyte, sbyte, sbyte> s_dynamicStruct;
public static GenClassStatic<sbyte, sbyte, sbyte> s_staticClass = new GenClassStatic<sbyte,sbyte,sbyte>();
public static GenClassDynamic<sbyte, sbyte, sbyte> s_dynamicClass = new GenClassDynamic<sbyte,sbyte,sbyte>();
public static MyArray<sbyte> s_test = new MyArray<sbyte>();
public static void AssertTypesSimilar(Type left, Type right)
{
#if INTERNAL_CONTRACTS
int sizeLeft, sizeRight, alignmentLeft, alignmentRight;
RuntimeTypeHandle rthLeft = left.TypeHandle;
RuntimeTypeHandle rthRight = right.TypeHandle;
Internal.Runtime.TypeLoader.TypeLoaderEnvironment.GetFieldAlignmentAndSize(rthLeft, out alignmentLeft, out sizeLeft);
Internal.Runtime.TypeLoader.TypeLoaderEnvironment.GetFieldAlignmentAndSize(rthRight, out alignmentRight, out sizeRight);
Assert.AreEqual(sizeLeft, sizeRight);
Assert.AreEqual(alignmentLeft, alignmentRight);
#endif
}
public unsafe static void AssertSameGCDesc(Type left, Type right)
{
RuntimeTypeHandle rthLeft = left.TypeHandle;
RuntimeTypeHandle rthRight = right.TypeHandle;
void** ptrLeft = *(void***)&rthLeft - 1;
void** ptrRight = *(void***)&rthRight - 1;
long leftVal = (long)*ptrLeft--;
long rightVal = (long)*ptrRight--;
Assert.AreEqual(leftVal, rightVal);
int count = leftVal > 0 ? (int)leftVal * 2 : -(int)leftVal * 2 - 1;
for (int i = 0; i < count; i++)
Assert.AreEqual(new IntPtr(*ptrLeft--), new IntPtr(*ptrRight--));
}
[TestMethod]
public static void TestTypeGCDescs()
{
BaseType bt = new BaseType();
bt._f1 = 1;
bt._f2 = new String('c', 2);
s_test.t = null;
s_staticClass.x = s_dynamicClass.x;
s_staticClass.y = s_dynamicClass.y;
s_staticClass.z = s_dynamicClass.z;
GenStructDynamic<sbyte, sbyte, sbyte>.test.x = 0;
Type staticType = null;
Type staticArrayType = null;
Type dynamicType = null;
Type innerType = null;
Type arrayType = null;
Base o = null;
staticType = typeof(GenStructStatic<bool, GenStructStatic<object, object, bool>, object>);
staticArrayType = typeof(GenStructStatic<bool, GenStructStatic<object, object, bool>, object>[]);
innerType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Object, TypeOf.Object, TypeOf.Bool);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, innerType, TypeOf.Object);
arrayType = typeof(MyArray<>).MakeGenericType(dynamicType);
o = (Base)Activator.CreateInstance(arrayType);
AssertSameGCDesc(staticType, dynamicType);
AssertSameGCDesc(staticArrayType, o.GetTypeOfArray());
staticType = typeof(GenStructStatic<bool, object, bool>);
staticArrayType = typeof(GenStructStatic<bool, object, bool>[]);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Object, TypeOf.Bool);
arrayType = typeof(MyArray<>).MakeGenericType(dynamicType);
o = (Base)Activator.CreateInstance(arrayType);
AssertSameGCDesc(staticType, dynamicType);
AssertSameGCDesc(staticArrayType, o.GetTypeOfArray());
staticType = typeof(GenStructStatic<object, bool, short>);
staticArrayType = typeof(GenStructStatic<object, bool, short>[]);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Object, TypeOf.Bool, TypeOf.Int16);
arrayType = typeof(MyArray<>).MakeGenericType(dynamicType);
o = (Base)Activator.CreateInstance(arrayType);
AssertSameGCDesc(staticType, dynamicType);
AssertSameGCDesc(staticArrayType, o.GetTypeOfArray());
staticType = typeof(GenStructStatic<bool, bool, object>);
staticArrayType = typeof(GenStructStatic<bool, bool, object>[]);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Bool, TypeOf.Object);
arrayType = typeof(MyArray<>).MakeGenericType(dynamicType);
o = (Base)Activator.CreateInstance(arrayType);
AssertSameGCDesc(staticType, dynamicType);
AssertSameGCDesc(staticArrayType, o.GetTypeOfArray());
staticType = typeof(GenClassStatic<bool, object, bool>);
staticArrayType = typeof(GenClassStatic<bool, object, bool>[]);
dynamicType = typeof(GenClassDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Object, TypeOf.Bool);
arrayType = typeof(MyArray<>).MakeGenericType(dynamicType);
o = (Base)Activator.CreateInstance(arrayType);
AssertSameGCDesc(staticType, dynamicType);
AssertSameGCDesc(staticArrayType, o.GetTypeOfArray());
staticType = typeof(GenClassStatic<object, bool, short>);
staticArrayType = typeof(GenClassStatic<object, bool, short>[]);
dynamicType = typeof(GenClassDynamic<,,>).MakeGenericType(TypeOf.Object, TypeOf.Bool, TypeOf.Int16);
arrayType = typeof(MyArray<>).MakeGenericType(dynamicType);
o = (Base)Activator.CreateInstance(arrayType);
AssertSameGCDesc(staticType, dynamicType);
AssertSameGCDesc(staticArrayType, o.GetTypeOfArray());
staticType = typeof(GenClassStatic<bool, bool, object>);
staticArrayType = typeof(GenClassStatic<bool, bool, object>[]);
dynamicType = typeof(GenClassDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Bool, TypeOf.Object);
arrayType = typeof(MyArray<>).MakeGenericType(dynamicType);
o = (Base)Activator.CreateInstance(arrayType);
AssertSameGCDesc(staticType, dynamicType);
AssertSameGCDesc(staticArrayType, o.GetTypeOfArray());
}
[TestMethod]
public static void StructsOfPrimitives()
{
// Test type sizes for structs of primitive types
// Ensure the reducer can't get rid of the x,y,z fields from these types.
s_dynamicStruct.x = s_staticStruct.x;
s_dynamicStruct.y = s_staticStruct.y;
s_dynamicStruct.z = s_staticStruct.z;
Type staticType = null;
Type dynamicType = null;
// All permutation of bool, short, int and double across 3 fields
// top level bool
// mid level bool
staticType = typeof(GenStructStatic<bool, bool, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Bool, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, bool, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Bool, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, bool, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Bool, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, bool, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Bool, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level short
staticType = typeof(GenStructStatic<bool, short, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Int16, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, short, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Int16, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, short, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Int16, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, short, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Int16, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level int
staticType = typeof(GenStructStatic<bool, int, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Int32, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, int, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Int32, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, int, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Int32, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, int, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Int32, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level double
staticType = typeof(GenStructStatic<bool, double, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Double, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, double, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Double, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, double, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Double, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, double, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Double, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// top level short
// mid level bool
staticType = typeof(GenStructStatic<short, bool, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Bool, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, bool, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Bool, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, bool, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Bool, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, bool, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Bool, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level short
staticType = typeof(GenStructStatic<short, short, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Int16, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, short, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Int16, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, short, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Int16, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, short, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Int16, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level int
staticType = typeof(GenStructStatic<short, int, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Int32, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, int, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Int32, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, int, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Int32, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, int, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Int32, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level double
staticType = typeof(GenStructStatic<short, double, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Double, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, double, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Double, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, double, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Double, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, double, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Double, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// top level int
// mid level bool
staticType = typeof(GenStructStatic<int, bool, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Bool, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, bool, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Bool, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, bool, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Bool, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, bool, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Bool, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level short
staticType = typeof(GenStructStatic<int, short, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int16, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, short, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int16, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, short, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int16, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, short, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int16, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level int
staticType = typeof(GenStructStatic<int, int, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int32, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, int, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int32, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, int, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int32, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, int, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int32, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level double
staticType = typeof(GenStructStatic<int, double, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Double, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, double, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Double, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, double, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Double, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, double, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Double, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// top level double
// mid level bool
staticType = typeof(GenStructStatic<double, bool, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Bool, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, bool, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Bool, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, bool, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Bool, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, bool, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Bool, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level short
staticType = typeof(GenStructStatic<double, short, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Int16, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, short, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Int16, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, short, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Int16, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, short, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Int16, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level int
staticType = typeof(GenStructStatic<double, int, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Int32, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, int, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Int32, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, int, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Int32, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, int, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Int32, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level double
staticType = typeof(GenStructStatic<double, double, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Double, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, double, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Double, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, double, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Double, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, double, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Double, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
}
}
}
namespace ActivatorCreateInstance
{
public class ReferenceType
{
string _field;
public ReferenceType() { _field = "ReferenceType.ctor"; }
public override string ToString() { return _field; }
}
public class GenReferenceType<T>
{
string _field;
public GenReferenceType() { _field = "GenReferenceType<" + typeof(T) + ">.ctor"; }
public override string ToString() { return _field; }
}
public class ReferenceTypeNoDefaultCtor
{
string _field;
public ReferenceTypeNoDefaultCtor(int param1) { _field = "ReferenceTypeNoDefaultCtor.ctor"; }
public override string ToString() { return _field; }
}
public class GenReferenceTypeNoDefaultCtor<T>
{
string _field;
public GenReferenceTypeNoDefaultCtor(bool param1) { _field = "GenReferenceTypeNoDefaultCtor<" + typeof(T) + ">.ctor"; }
public override string ToString() { return _field; }
}
public struct AValueType
{
int _a;
double _b;
object _c;
public AValueType(int param) { _a = 1; _b = 2.0; _c = new object(); }
public override string ToString() { return "AValueType.ctor" + _a + _b + _c; }
}
public struct AGenValueType<T>
{
T _a;
object _c;
public AGenValueType(double param) { _a = default(T); _c = "3"; }
public override string ToString() { return "AGenValueType<" + typeof(T) + ">.ctor" + _a + _c; }
}
public class Base
{
public virtual string Func() { return null; }
}
public class ACI_Instantiator<T, U> : Base
{
public override string Func()
{
T t = Activator.CreateInstance<T>();
t = Activator.CreateInstance<T>();
return "ACI_Instantiator: " + typeof(T) + " = " + t.ToString();
}
}
public class NEW_Instantiator<T, U> : Base
where T : new()
{
public override string Func()
{
T t = new T();
t = new T();
return "NEW_Instantiator: " + typeof(T) + " = " + t.ToString();
}
}
public class Test
{
[TestMethod]
public static void TestCreateInstance()
{
TestActivatorCreateInstance_Inner(TypeOf.Short, "0");
TestActivatorCreateInstance_Inner(TypeOf.Int32, "0");
TestActivatorCreateInstance_Inner(TypeOf.Long, "0");
TestActivatorCreateInstance_Inner(TypeOf.Float, "0");
TestActivatorCreateInstance_Inner(TypeOf.Double, "0");
TestActivatorCreateInstance_Inner(typeof(ReferenceType), "ReferenceType.ctor");
TestActivatorCreateInstance_Inner(TypeOf.ACI_GenReferenceType.MakeGenericType(TypeOf.String), "GenReferenceType<System.String>.ctor");
TestActivatorCreateInstance_Inner(TypeOf.ACI_GenReferenceType.MakeGenericType(TypeOf.Double), "GenReferenceType<System.Double>.ctor");
TestActivatorCreateInstance_Inner(typeof(GenReferenceType<CommonType1>), "GenReferenceType<CommonType1>.ctor");
TestActivatorCreateInstance_Inner(typeof(ReferenceTypeNoDefaultCtor), null, true);
TestActivatorCreateInstance_Inner(TypeOf.ACI_GenReferenceTypeNoDefaultCtor.MakeGenericType(TypeOf.String), null, true);
TestActivatorCreateInstance_Inner(TypeOf.ACI_GenReferenceTypeNoDefaultCtor.MakeGenericType(TypeOf.Double), null, true);
TestActivatorCreateInstance_Inner(typeof(GenReferenceTypeNoDefaultCtor<CommonType1>), null, true);
TestActivatorCreateInstance_Inner(typeof(AValueType), "AValueType.ctor00");
TestActivatorCreateInstance_Inner(TypeOf.ACI_AGenValueType.MakeGenericType(TypeOf.String), "AGenValueType<System.String>.ctor");
TestActivatorCreateInstance_Inner(TypeOf.ACI_AGenValueType.MakeGenericType(TypeOf.Double), "AGenValueType<System.Double>.ctor0");
#if USC
TestActivatorCreateInstance_Inner(typeof(AGenValueType<CommonType1>), "AGenValueType<CommonType1>.ctorCommonType1");
#else
TestActivatorCreateInstance_Inner(typeof(AGenValueType<CommonType1>), "AGenValueType<CommonType1>.ctor");
#endif
}
static void TestActivatorCreateInstance_Inner(Type typeArg, string toStrVal, bool expectMissingMemberException = false)
{
Type t;
Base o;
string result1, result2;
string expectedResult1 = "ACI_Instantiator: " + typeArg.ToString() + " = " + toStrVal;
string expectedResult2 = "NEW_Instantiator: " + typeArg.ToString() + " = " + toStrVal;
try
{
t = TypeOf.ACI_ACI_Instantiator.MakeGenericType(typeArg, TypeOf.Short);
o = (Base)Activator.CreateInstance(t);
result1 = o.Func();
Assert.AreEqual(expectedResult1, result1);
Assert.IsFalse(expectMissingMemberException);
}
catch (System.MissingMemberException)
{
Assert.IsTrue(expectMissingMemberException);
}
if (expectMissingMemberException)
{
// Types with no default constructor will violate the constraint on "T".
return;
}
t = TypeOf.ACI_NEW_Instantiator.MakeGenericType(typeArg, TypeOf.Short);
o = (Base)Activator.CreateInstance(t);
result2 = o.Func();
Assert.AreEqual(expectedResult2, result2);
}
}
}
namespace MultiThreadUSCCall
{
public class TestType<T>
{
public string Func(T t)
{
return "Func(" + typeof(T) + ")";
}
}
public class Test
{
static void DoTest()
{
Task[] tasks = new Task[50];
for (int i = 0; i < 50; i++)
{
tasks[i] = Task.Run(() =>
{
for (int j = 0; j < 5; j++)
{
var t = typeof(TestType<>).MakeGenericType(TypeOf.Short);
object o = Activator.CreateInstance(t);
MethodInfo mi = t.GetTypeInfo().GetDeclaredMethod("Func");
string s = (string)mi.Invoke(o, new object[] { null });
Assert.AreEqual("Func(System.Int16)", s);
t = null;
o = null;
mi = null;
s = null;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
}
});
}
Task.WaitAll(tasks);
}
[TestMethod]
public static void CallsWithGCCollects()
{
for (int i = 0; i < 5; i++)
{
DoTest();
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
}
}
}
}
namespace Heuristics
{
public struct MyStruct<T>
{
public override string ToString()
{
return typeof(T).ToString();
}
}
//
// Test USG reflection heuristics by using an rd.xml entry to root the type.
// Only look up the type with Type.GetType(string) so it is never statically referenced.
//
public struct OnlyUseViaReflection<T>
{
T _a;
public OnlyUseViaReflection(int dummyToMakeCscPass) { _a = default(T); }
public override string ToString() { return "OnlyUseViaReflection<" + typeof(T) + ">.ctor" + _a; }
public string GenericMethodNotCalledStatically<U>(U u)
{
return typeof(U).ToString();
}
}
public class OnlyUseViaReflectionGenMethod
{
public string GenericMethodNotCalledStatically<T>(T t)
{
return typeof(T).ToString();
}
}
public class TestHeuristics
{
[TestMethod]
public static void TestReflectionHeuristics()
{
Type t;
t = TypeOf.OnlyUseViaReflection.MakeGenericType(TypeOf.Double);
Object o = Activator.CreateInstance(t);
Assert.IsTrue(o != null);
t = TypeOf.OnlyUseViaReflectionGenMethod;
Object obj = Activator.CreateInstance(t);
Assert.IsTrue(obj != null);
}
//
// Try instantiating all reflectable generics in this test app over a specific value type to ensure
// everything marked reflectable works with USG
//
//[TestMethod]
#if false
public static void TestReflectionHeuristicsAllGenerics()
{
var assembly = typeof(TestHeuristics).GetTypeInfo().Assembly;
foreach (var t in assembly.DefinedTypes)
{
if (t.IsGenericType)
{
Assert.IsTrue(t.IsGenericTypeDefinition);
int arity = t.GenericTypeParameters.Length;
Console.WriteLine("Type: {0} Arity: {1}", t.ToString(), arity);
bool hasTypeConstraints = false;
foreach (var tp in t.GenericTypeParameters)
{
if (tp.GetTypeInfo().GetGenericParameterConstraints().Length > 0)
hasTypeConstraints = true;
}
if (hasTypeConstraints)
{
Console.WriteLine("Skipping type - it has at least one type parameter constraint (that forces a specific base type)");
continue;
}
Type[] args = new Type[arity];
for (int i = 0; i < args.Length; i++)
{
args[i] = typeof(MyStruct<int>);
}
Type instantiated = t.MakeGenericType(args);
Assert.IsTrue(instantiated != null);
}
}
}
#endif
}
}
namespace ArrayVarianceTest
{
public class GenType<T, U>
{
public string RunTest(object input_obj, int testId)
{
// These typecases will cause RhTypeCast_IsInstanceOfInterface to execute,
// which will check for variance equalities between types.
IEnumerable<T> source = input_obj as IEnumerable<T>;
ICollection<T> collection = source as ICollection<T>;
switch (testId)
{
case 0:
{
return collection == null ? "NULL" : (collection.Count + " items in ICollection<" + typeof(T).Name + ">");
}
case 1:
{
if (source == null) return "NULL";
int count = 0;
foreach (T item in source)
count++;
return (count + " items in IEnumerable<" + typeof(T).Name + ">");
}
}
return null;
}
}
public enum MyTestEnum : int
{
MTE_1, MTE_2, MTE_3,
}
public class Test
{
[TestMethod]
public static void RunTest()
{
ICollection<string> coll_str = new string[] { "abc", "def" };
int[] int_array = new int[] { 1, 2, 3 };
MyTestEnum[] enum_array = new MyTestEnum[] { MyTestEnum.MTE_1, MyTestEnum.MTE_1, MyTestEnum.MTE_2, MyTestEnum.MTE_2, MyTestEnum.MTE_3, MyTestEnum.MTE_3, };
Type t = TypeOf.AVT_GenType.MakeGenericType(TypeOf.CommonType4, TypeOf.Short);
object o = Activator.CreateInstance(t);
MethodInfo mi = t.GetTypeInfo().GetDeclaredMethod("RunTest");
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { coll_str, 0 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { int_array, 0 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { coll_str, 1 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { int_array, 1 }));
t = TypeOf.AVT_GenType.MakeGenericType(TypeOf.String, TypeOf.Short);
o = Activator.CreateInstance(t);
mi = t.GetTypeInfo().GetDeclaredMethod("RunTest");
Assert.AreEqual("2 items in ICollection<String>", mi.Invoke(o, new object[] { coll_str, 0 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { int_array, 0 }));
Assert.AreEqual("2 items in IEnumerable<String>", mi.Invoke(o, new object[] { coll_str, 1 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { int_array, 1 }));
t = TypeOf.AVT_GenType.MakeGenericType(TypeOf.Object, TypeOf.Short);
o = Activator.CreateInstance(t);
mi = t.GetTypeInfo().GetDeclaredMethod("RunTest");
Assert.AreEqual("2 items in ICollection<Object>", mi.Invoke(o, new object[] { coll_str, 0 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { int_array, 0 }));
Assert.AreEqual("2 items in IEnumerable<Object>", mi.Invoke(o, new object[] { coll_str, 1 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { int_array, 1 }));
t = TypeOf.AVT_GenType.MakeGenericType(TypeOf.Int32, TypeOf.Short);
o = Activator.CreateInstance(t);
mi = t.GetTypeInfo().GetDeclaredMethod("RunTest");
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { coll_str, 0 }));
Assert.AreEqual("3 items in ICollection<Int32>", mi.Invoke(o, new object[] { int_array, 0 }));
Assert.AreEqual("6 items in ICollection<Int32>", mi.Invoke(o, new object[] { enum_array, 0 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { coll_str, 1 }));
Assert.AreEqual("3 items in IEnumerable<Int32>", mi.Invoke(o, new object[] { int_array, 1 }));
Assert.AreEqual("6 items in IEnumerable<Int32>", mi.Invoke(o, new object[] { enum_array, 1 }));
t = TypeOf.AVT_GenType.MakeGenericType(typeof(MyTestEnum), TypeOf.Short);
o = Activator.CreateInstance(t);
mi = t.GetTypeInfo().GetDeclaredMethod("RunTest");
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { coll_str, 0 }));
Assert.AreEqual("3 items in ICollection<MyTestEnum>", mi.Invoke(o, new object[] { int_array, 0 }));
Assert.AreEqual("6 items in ICollection<MyTestEnum>", mi.Invoke(o, new object[] { enum_array, 0 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { coll_str, 1 }));
Assert.AreEqual("3 items in IEnumerable<MyTestEnum>", mi.Invoke(o, new object[] { int_array, 1 }));
Assert.AreEqual("6 items in IEnumerable<MyTestEnum>", mi.Invoke(o, new object[] { enum_array, 1 }));
}
}
}
namespace IsInstTest
{
public interface IBase { }
public interface IObject : IBase { string Func(); }
public class MyObject : IObject
{
string _id;
public MyObject(string id) { _id = id; }
public string Func() { return this.ToString(); }
public override string ToString() { return "MyObject{" + _id + "}"; }
}
public class MyStruct : IObject
{
string _id;
public MyStruct(string id) { _id = id; }
public string Func() { return this.ToString(); }
public override string ToString() { return "MyStruct{" + _id + "}"; }
}
public class ObjectActivator
{
public object Activate(string id, bool activateTheStruct)
{
return activateTheStruct ? (object)new MyStruct(id) : (object)new MyObject(id);
}
}
public class TestType
{
public T ActivateObject_IsInstT<T, U>(string id, bool activateTheStruct) where T : class
{
object o = new ObjectActivator().Activate(id, activateTheStruct);
T t = o as T;
return t;
}
public T ActivateArray_IsInstT<T, U>(string id, bool activateTheStruct) where T : class
{
IObject[] array = new IObject[] {
(IObject)new ObjectActivator().Activate(id, activateTheStruct),
(IObject)new ObjectActivator().Activate(id, activateTheStruct),
(IObject)new ObjectActivator().Activate(id, activateTheStruct)
};
T t = array as T;
return t;
}
}
public class TestRunner
{
[TestMethod]
public static unsafe void RunIsInstAndCheckCastTest()
{
// Test isinst of an interface
MethodInfo ActivateObject_IsInstT = typeof(TestType).GetTypeInfo().GetDeclaredMethod("ActivateObject_IsInstT").MakeGenericMethod(typeof(IObject), TypeOf.Double);
IObject myObject1 = (IObject)ActivateObject_IsInstT.Invoke(new TestType(), new object[] { "1", false });
Assert.AreEqual(myObject1.Func(), "MyObject{1}");
IObject myObject2 = (IObject)ActivateObject_IsInstT.Invoke(new TestType(), new object[] { "2", true });
Assert.AreEqual(myObject2.Func(), "MyStruct{2}");
// Test isinst of a class
ActivateObject_IsInstT = typeof(TestType).GetTypeInfo().GetDeclaredMethod("ActivateObject_IsInstT").MakeGenericMethod(typeof(MyObject), TypeOf.Double);
IObject myObject3 = (IObject)ActivateObject_IsInstT.Invoke(new TestType(), new object[] { "3", false });
Assert.AreEqual(myObject3.Func(), "MyObject{3}");
IObject myObject4 = (IObject)ActivateObject_IsInstT.Invoke(new TestType(), new object[] { "4", true });
Assert.IsTrue(myObject4 == null);
// Test isinst of an array
MethodInfo ActivateArray_IsInstT = typeof(TestType).GetTypeInfo().GetDeclaredMethod("ActivateArray_IsInstT").MakeGenericMethod(typeof(IBase[]), TypeOf.Double);
IBase[] myArray1 = (IBase[])ActivateArray_IsInstT.Invoke(new TestType(), new object[] { "5", false });
Assert.IsTrue(myArray1.Length == 3);
Assert.AreEqual(((IObject)myArray1[0]).Func(), "MyObject{5}");
Assert.AreEqual(((IObject)myArray1[1]).Func(), "MyObject{5}");
Assert.AreEqual(((IObject)myArray1[2]).Func(), "MyObject{5}");
IBase[] myArray2 = (IBase[])ActivateArray_IsInstT.Invoke(new TestType(), new object[] { "6", true });
Assert.IsTrue(myArray2.Length == 3);
Assert.AreEqual(((IObject)myArray2[0]).Func(), "MyStruct{6}");
Assert.AreEqual(((IObject)myArray2[1]).Func(), "MyStruct{6}");
Assert.AreEqual(((IObject)myArray2[2]).Func(), "MyStruct{6}");
}
}
}
namespace DelegateCallTest
{
public interface IBar { }
public class Bar : IBar
{
public Bar() { Console.WriteLine("BarCtor"); }
public override string ToString() { return "BarInstance"; }
}
public class Foo
{
public string CallMethodThroughDelegate<T>(T tValue, Func<IBar, T, string> action)
{
if (action == null)
{
throw new ArgumentNullException("action");
}
return action(new Bar(), tValue);
}
public string Method<T>(IBar i, T tValue)
{
string res = "Method<" + typeof(T) + ">, " + i.ToString() + ", " + tValue.ToString();
return res;
}
}
public class TestRunner
{
[TestMethod]
public static unsafe void TestCallMethodThroughUsgDelegate()
{
Foo o = new Foo();
MethodInfo Method = typeof(Foo).GetTypeInfo().GetDeclaredMethod("Method").MakeGenericMethod(TypeOf.Double);
Type delType = typeof(Func<,,>).MakeGenericType(typeof(IBar), TypeOf.Double, TypeOf.String);
Delegate d = Method.CreateDelegate(delType, o);
MethodInfo CallMethodThroughDelegate = typeof(Foo).GetTypeInfo().GetDeclaredMethod("CallMethodThroughDelegate").MakeGenericMethod(TypeOf.Double);
string res = (string)CallMethodThroughDelegate.Invoke(o, new object[] { 1.2, d });
Assert.AreEqual(res, "Method<System.Double>, BarInstance, 1.2");
}
}
}
// Repro taken from a real app (System.Reactive framework). Bug in field layout caused crashes on x86.
namespace FieldLayoutBugRepro
{
public abstract class CallerBase
{
public abstract string DoCall(object state, TimeSpan dueTime, object action);
}
public class Caller<TState> : CallerBase
{
public override string DoCall(object state, TimeSpan dueTime, object action)
{
BaseType obj = new DerivedType();
return obj.Schedule<TState>((TState)state, dueTime, (Func<IInterface, TState, string>)action);
}
}
public interface IInterface { }
public class BaseType : IInterface
{
public virtual string Schedule<TState>(TState state, TimeSpan dueTime, Func<IInterface, TState, string> action) { return null; }
public override string ToString() { return "BaseType"; }
}
public class DerivedType : BaseType
{
public override string Schedule<TState>(TState state, TimeSpan dueTime, Func<IInterface, TState, string> action)
{
// Root static typespecs:
var t1 = typeof(ScheduledItem<TimeSpan>);
var t2 = typeof(ScheduledItem<TimeSpan, StateProducer<EventPattern<string>>.State>);
ScheduledItem<TimeSpan, TState> scheduledItem = new ScheduledItem<TimeSpan, TState>(this, state, action, dueTime);
return ((ScheduledItem<TimeSpan>)scheduledItem).Execute();
}
public override string ToString()
{
return "DerivedType";
}
}
public interface IMyComparer<T> { }
public class MyComparer<T> : IMyComparer<T>
{
public override string ToString() { return "MyComparer<" + typeof(T) + ">"; }
}
public interface IScheduledItem<TAbsolute> { }
public abstract class ScheduledItem<TAbsolute> : IScheduledItem<TAbsolute>, IComparable<ScheduledItem<TAbsolute>> where TAbsolute : IComparable<TAbsolute>
{
private readonly string _disposable = new String('c', 3);
protected readonly TAbsolute _dueTime;
protected readonly IMyComparer<TAbsolute> _comparer;
[MethodImpl(MethodImplOptions.NoInlining)]
protected ScheduledItem(TAbsolute dueTime, IMyComparer<TAbsolute> comparer)
{
this._dueTime = dueTime;
this._comparer = comparer;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public int CompareTo(ScheduledItem<TAbsolute> other) { return 1; }
[MethodImpl(MethodImplOptions.NoInlining)]
public string Execute() { return ExecuteCore(); }
[MethodImpl(MethodImplOptions.NoInlining)]
public abstract string ExecuteCore();
}
public class ScheduledItem<TAbsolute, TValue> : ScheduledItem<TAbsolute> where TAbsolute : IComparable<TAbsolute>
{
private readonly IInterface _scheduler;
private readonly TValue _state;
private readonly Func<IInterface, TValue, string> _action;
[MethodImpl(MethodImplOptions.NoInlining)]
public ScheduledItem(IInterface scheduler, TValue state, Func<IInterface, TValue, string> action, TAbsolute dueTime)
: this(scheduler, state, action, dueTime, new MyComparer<TAbsolute>())
{
}
[MethodImpl(MethodImplOptions.NoInlining)]
public ScheduledItem(IInterface scheduler, TValue state, Func<IInterface, TValue, string> action, TAbsolute dueTime, IMyComparer<TAbsolute> comparer)
: base(dueTime, comparer)
{
this._scheduler = scheduler;
this._state = state;
this._action = action;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public override string ExecuteCore() { return this.ToString() + "=" + _action(_scheduler, _state); }
[MethodImpl(MethodImplOptions.NoInlining)]
public override string ToString() { return "ScheduledItem<" + typeof(TAbsolute) + "," + typeof(TValue) + ">{_dueTime=" + _dueTime + ",_comparer=" + _comparer + "}"; }
}
public abstract class StateProducerBase
{
[MethodImpl(MethodImplOptions.NoInlining)]
public abstract object GetState(string s1, string s2);
}
public class StateProducer<TSource> : StateProducerBase
{
public struct State
{
public string _s1;
public string _s2;
public State(string s1, string s2)
{
_s1 = s1;
_s2 = s2;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public override string ToString() { return "StateProducer<" + typeof(TSource) + ">/State[" + _s1 + _s2 + "]"; }
}
[MethodImpl(MethodImplOptions.NoInlining)]
public override object GetState(string s1, string s2) { return new State(s1, s2); }
}
public sealed class EventPattern<TEventArgs> { }
public partial class Runner
{
[TestMethod]
public static unsafe void EntryPoint()
{
Type targ1 = typeof(EventPattern<>).MakeGenericType(TypeOf.String);
Type targ2 = typeof(StateProducer<>).MakeGenericType(targ1);
// *** RANDOME REFLECTION BUG: this works on the desktop CLR, but doesn't in ProjectN :) ***:
//Type targ3 = targ2.GetTypeInfo().GetDeclaredNestedType("State").MakeGenericType(targ1);
// Use this workaround instead:
Type targ3 = typeof(StateProducer<>).GetTypeInfo().GetDeclaredNestedType("State").MakeGenericType(targ1);
Type delType = typeof(Func<,,>).MakeGenericType(typeof(IInterface), targ3, TypeOf.String);
var state = ((StateProducerBase)Activator.CreateInstance(targ2)).GetState("abc", "def");
TimeSpan dueTime = new TimeSpan(0x123);
Delegate action = typeof(Runner).GetTypeInfo().GetDeclaredMethod("MyDelTarget").MakeGenericMethod(targ3).CreateDelegate(delType);
Type callerType = typeof(Caller<>).MakeGenericType(targ3);
CallerBase caller = (CallerBase)Activator.CreateInstance(callerType);
string result = caller.DoCall(state, dueTime, action);
Assert.AreEqual("ScheduledItem<System.TimeSpan,FieldLayoutBugRepro.StateProducer`1+State[FieldLayoutBugRepro.EventPattern`1[System.String]]>{_dueTime=00:00:00.0000291,_comparer=MyComparer<System.TimeSpan>}={scheduler=DerivedType,state=StateProducer<FieldLayoutBugRepro.EventPattern`1[System.String]>/State[abcdef]}", result);
}
public static string MyDelTarget<TState>(IInterface scheduler, TState state)
{
return "{scheduler=" + scheduler + ",state=" + state + "}";
}
}
}
namespace DelegateTest
{
public class BaseType
{
public virtual Func<T, string> GVMethod1<T>(T t) { return null; }
public virtual Func<T, string> GVMethod2<T>(T t) { return null; }
}
public class DerivedType : BaseType
{
public override Func<T, string> GVMethod1<T>(T t)
{
return new Func<T, string>((new GenType<T, string>().Method));
}
public override Func<T, string> GVMethod2<T>(T t)
{
return new Func<T, string>((new NonGenType().GenMethod<T, string>));
}
}
public class GenType<T, U>
{
public string Method(T t)
{
return "GenType<" + t.GetType() + "," + typeof(U) + ">.Method{" + t + "," + default(U) + "}";
}
}
public class NonGenType
{
public string GenMethod<T, U>(T t)
{
return "NonGenType.GenMethod<" + t.GetType() + "," + typeof(U) + ">{" + t + "," + default(U) + "}";
}
}
public partial class TestRunner
{
[TestMethod]
public static unsafe void TestMethodCellsWithUSGTargetsUsedOnNonUSGInstantiations()
{
// Root compatible normal canonical instantiations
new GenType<double, object>();
new NonGenType().GenMethod<double, object>(0);
MethodInfo GVMethod1 = typeof(BaseType).GetTypeInfo().GetDeclaredMethod("GVMethod1").MakeGenericMethod(TypeOf.Double);
Delegate del = (Delegate)GVMethod1.Invoke(new DerivedType(), new object[] { 12.34 });
string result = (string)del.DynamicInvoke(new object[] { 56.79 });
Assert.AreEqual("GenType<System.Double,System.String>.Method{56.79,}", result);
MethodInfo GVMethod2 = typeof(BaseType).GetTypeInfo().GetDeclaredMethod("GVMethod2").MakeGenericMethod(TypeOf.Double);
del = (Delegate)GVMethod2.Invoke(new DerivedType(), new object[] { 11.22 });
result = (string)del.DynamicInvoke(new object[] { 88.99 });
Assert.AreEqual("NonGenType.GenMethod<System.Double,System.String>{88.99,}", result);
}
}
}
namespace ArrayExceptionsTest
{
public enum IntBasedEnum
{
}
public enum ShortBasedEnum : short
{
}
public abstract class BaseType
{
public abstract void TestSetExceptionRank1(object valToSet);
public abstract void TestAddressOfExceptionRank1();
public abstract void TestSetExceptionRank2(object valToSet);
public abstract void TestAddressOfExceptionRank2();
public abstract void TestSetExceptionRank3(object valToSet);
public abstract void TestAddressOfExceptionRank3();
public abstract void TestSetExceptionRank4(object valToSet);
public abstract void TestAddressOfExceptionRank4();
}
public class DerivedType<T,U,V> : BaseType
{
[MethodImpl(MethodImplOptions.NoInlining)]
void Func(ref U t)
{ }
public override void TestSetExceptionRank1(object valToSet)
{
T[] tArray = new T[1];
U[] uArray = (U[])(object)tArray;
uArray[0] = (U)valToSet;
}
public override void TestAddressOfExceptionRank1()
{
T[] tArray = new T[1];
U[] uArray = (U[])(object)tArray;
Func(ref uArray[0]);
}
public override void TestSetExceptionRank2(object valToSet)
{
T[,] tArray = new T[1, 1];
U[,] uArray = (U[,])(object)tArray;
uArray[0, 0] = (U)valToSet;
}
public override void TestAddressOfExceptionRank2()
{
T[,] tArray = new T[1, 1];
U[,] uArray = (U[,])(object)tArray;
Func(ref uArray[0, 0]);
}
public override void TestSetExceptionRank3(object valToSet)
{
T[,,] tArray = new T[1, 1, 1];
U[,,] uArray = (U[,,])(object)tArray;
uArray[0, 0, 0] = (U)valToSet;
}
public override void TestAddressOfExceptionRank3()
{
T[,,] tArray = new T[1, 1, 1];
U[,,] uArray = (U[,,])(object)tArray;
Func(ref uArray[0, 0, 0]);
}
public override void TestSetExceptionRank4(object valToSet)
{
T[, ,,] tArray = new T[1, 1, 1, 1];
U[, ,,] uArray = (U[, ,,])(object)tArray;
uArray[0, 0, 0, 0] = (U)valToSet;
}
public override void TestAddressOfExceptionRank4()
{
T[, ,,] tArray = new T[1, 1, 1, 1];
U[, ,,] uArray = (U[, ,,])(object)tArray;
Func(ref uArray[0, 0, 0, 0]);
}
}
public class Runner
{
static void RunIndividualTests(BaseType o, object setObject, bool expectedToThrow)
{
if (expectedToThrow)
{
Assert.Throws<ArrayTypeMismatchException>(() => { o.TestSetExceptionRank1(setObject); });
Assert.Throws<ArrayTypeMismatchException>(() => { o.TestAddressOfExceptionRank1(); });
Assert.Throws<ArrayTypeMismatchException>(() => { o.TestSetExceptionRank2(setObject); });
Assert.Throws<ArrayTypeMismatchException>(() => { o.TestAddressOfExceptionRank2(); });
Assert.Throws<ArrayTypeMismatchException>(() => { o.TestSetExceptionRank3(setObject); });
Assert.Throws<ArrayTypeMismatchException>(() => { o.TestAddressOfExceptionRank3(); });
Assert.Throws<ArrayTypeMismatchException>(() => { o.TestSetExceptionRank4(setObject); });
Assert.Throws<ArrayTypeMismatchException>(() => { o.TestAddressOfExceptionRank4(); });
}
else
{
o.TestSetExceptionRank1(setObject);
o.TestAddressOfExceptionRank1();
o.TestSetExceptionRank2(setObject);
o.TestAddressOfExceptionRank2();
o.TestSetExceptionRank3(setObject);
o.TestAddressOfExceptionRank3();
o.TestSetExceptionRank4(setObject);
o.TestAddressOfExceptionRank4();
}
}
[TestMethod]
public static unsafe void ArrayExceptionsTest_String_Object()
{
Type t = typeof(DerivedType<,,>).MakeGenericType(TypeOf.String, TypeOf.Object, TypeOf.Short);
RunIndividualTests((BaseType)Activator.CreateInstance(t), new object(), true);
}
[TestMethod]
public static unsafe void ArrayExceptionsTest_Int32_Int32()
{
Type t = typeof(DerivedType<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int32, TypeOf.Short);
RunIndividualTests((BaseType)Activator.CreateInstance(t), (object)1024, false);
}
[TestMethod]
public static unsafe void ArrayExceptionsTest_Int32_IntBasedEnum()
{
Type t = typeof(DerivedType<,,>).MakeGenericType(TypeOf.Int32, typeof(IntBasedEnum), TypeOf.Short);
RunIndividualTests((BaseType)Activator.CreateInstance(t), (object)1024, false);
}
[TestMethod]
public static unsafe void ArrayExceptionsTest_UInt32_Int32()
{
Type t = typeof(DerivedType<,,>).MakeGenericType(typeof(uint), TypeOf.Int32, TypeOf.Short);
RunIndividualTests((BaseType)Activator.CreateInstance(t), (object)1024, false);
}
}
}
namespace UnboxAnyTests
{
public enum IntBasedEnum
{
Val = 3
}
public enum ShortBasedEnum : short
{
Val = 17
}
public abstract class BaseType
{
public abstract object TestUnboxAnyAndRebox(object valToSet);
}
public class DerivedType<T,V> : BaseType
{
public static T m_t;
public override object TestUnboxAnyAndRebox(object valToSet)
{
m_t = (T)valToSet;
return (object)m_t;
}
}
public class Runner
{
[TestMethod]
public static unsafe void TestUnboxAnyToString()
{
Type t = typeof(DerivedType<,>).MakeGenericType(TypeOf.String, TypeOf.Short);
BaseType o = (BaseType)Activator.CreateInstance(t);
object tempObj = "TestString";
Assert.AreEqual(tempObj, o.TestUnboxAnyAndRebox(tempObj));
Assert.AreEqual(null, o.TestUnboxAnyAndRebox(null));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
}
[TestMethod]
public static unsafe void TestUnboxAnyToInt()
{
Type t = typeof(DerivedType<,>).MakeGenericType(TypeOf.Int32, TypeOf.Short);
BaseType o = (BaseType)Activator.CreateInstance(t);
Assert.AreEqual(43, (int)o.TestUnboxAnyAndRebox(43));
Assert.AreEqual(IntBasedEnum.Val, (IntBasedEnum)o.TestUnboxAnyAndRebox(IntBasedEnum.Val));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
Assert.Throws<NullReferenceException>(() => { o.TestUnboxAnyAndRebox(null); });
}
[TestMethod]
public static unsafe void TestUnboxAnyToIntBasedEnum()
{
Type t = typeof(DerivedType<,>).MakeGenericType(typeof(IntBasedEnum), TypeOf.Short);
BaseType o = (BaseType)Activator.CreateInstance(t);
Assert.AreEqual(43, (int)o.TestUnboxAnyAndRebox(43));
Assert.AreEqual(IntBasedEnum.Val, (IntBasedEnum)o.TestUnboxAnyAndRebox(IntBasedEnum.Val));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
Assert.Throws<NullReferenceException>(() => { o.TestUnboxAnyAndRebox(null); });
}
[TestMethod]
public static unsafe void TestUnboxAnyToNullableInt()
{
Type t = typeof(DerivedType<,>).MakeGenericType(typeof(int?), TypeOf.Short);
BaseType o = (BaseType)Activator.CreateInstance(t);
Assert.AreEqual(14, (int)o.TestUnboxAnyAndRebox(14));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(IntBasedEnum.Val); });
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
Assert.AreEqual(null, o.TestUnboxAnyAndRebox(null));
}
[TestMethod]
public static unsafe void TestUnboxAnyToNullableIntBasedEnum()
{
Type t = typeof(DerivedType<,>).MakeGenericType(typeof(IntBasedEnum?), TypeOf.Short);
BaseType o = (BaseType)Activator.CreateInstance(t);
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(14); });
Assert.AreEqual(IntBasedEnum.Val, (IntBasedEnum)o.TestUnboxAnyAndRebox(IntBasedEnum.Val));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
Assert.AreEqual(null, o.TestUnboxAnyAndRebox(null));
}
[TestMethod]
public static unsafe void TestUnboxAnyToShort_NonUSG()
{
// Test non-usg case for parallel verification
BaseType o = new DerivedType<short,sbyte>();
Assert.AreEqual(43, (short)o.TestUnboxAnyAndRebox((object)(short)43));
Assert.AreEqual(ShortBasedEnum.Val, (ShortBasedEnum)o.TestUnboxAnyAndRebox(ShortBasedEnum.Val));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
Assert.Throws<NullReferenceException>(() => { o.TestUnboxAnyAndRebox(null); });
}
[TestMethod]
public static unsafe void TestUnboxAnyToShortBasedEnum_NonUSG()
{
// Test non-usg case for parallel verification
BaseType o = new DerivedType<ShortBasedEnum,sbyte>();
Assert.AreEqual(14, (short)o.TestUnboxAnyAndRebox((object)(short)14));
Assert.AreEqual(ShortBasedEnum.Val, (ShortBasedEnum)o.TestUnboxAnyAndRebox(ShortBasedEnum.Val));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
Assert.Throws<NullReferenceException>(() => { o.TestUnboxAnyAndRebox(null); });
}
[TestMethod]
public static unsafe void TestUnboxAnyToNullableShort_NonUSG()
{
// Test non-usg case for parallel verification
BaseType o = new DerivedType<short?,sbyte>();
Assert.AreEqual(14, (short)o.TestUnboxAnyAndRebox((object)(short)14));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(ShortBasedEnum.Val); });
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
Assert.AreEqual(null, o.TestUnboxAnyAndRebox(null));
}
[TestMethod]
public static unsafe void TestUnboxAnyToNullableShortBasedEnum_NonUSG()
{
// Test non-usg case for parallel verification
BaseType o = new DerivedType<ShortBasedEnum?,sbyte>();
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox((object)(short)14); });
Assert.AreEqual(ShortBasedEnum.Val, (ShortBasedEnum)o.TestUnboxAnyAndRebox(ShortBasedEnum.Val));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
Assert.AreEqual(null, o.TestUnboxAnyAndRebox(null));
}
}
}
namespace HFATest
{
public struct Struct00<F, D, I, L> { public D _f1; }
public struct Struct01<F, D, I, L> { public F _f1; }
public struct Struct02<F, D, I, L> { public I _f1; }
public struct Struct03<F, D, I, L> { public L _f1; }
public struct Struct10<F, D, I, L> { public F _f1; public D _f2; }
public struct Struct11<F, D, I, L> { public F _f1; public F _f2; }
public struct Struct12<F, D, I, L> { public F _f1; public I _f2; }
public struct Struct13<F, D, I, L> { public F _f1; public L _f2; }
public struct Struct14<F, D, I, L> { public D _f1; public D _f2; }
public struct Struct15<F, D, I, L> { public D _f1; public F _f2; }
public struct Struct16<F, D, I, L> { public D _f1; public I _f2; }
public struct Struct17<F, D, I, L> { public D _f1; public L _f2; }
public struct Struct20<F, D, I, L> { public F _f1; public D _f2; public F _f3; }
public struct Struct21<F, D, I, L> { public F _f1; public F _f2; public F _f3; }
public struct Struct22<F, D, I, L> { public F _f1; public I _f2; public F _f3; }
public struct Struct23<F, D, I, L> { public F _f1; public L _f2; public F _f3; }
public struct Struct24<F, D, I, L> { public D _f1; public D _f2; public D _f3; }
public struct Struct25<F, D, I, L> { public D _f1; public F _f2; public D _f3; }
public struct Struct26<F, D, I, L> { public D _f1; public I _f2; public D _f3; }
public struct Struct27<F, D, I, L> { public D _f1; public L _f2; public D _f3; }
public struct Struct30<F, D, I, L> { public F _f1; public D _f2; public F _f3; public F _f4; }
public struct Struct31<F, D, I, L> { public F _f1; public F _f2; public F _f3; public F _f4; }
public struct Struct32<F, D, I, L> { public F _f1; public I _f2; public F _f3; public F _f4; }
public struct Struct33<F, D, I, L> { public F _f1; public L _f2; public F _f3; public F _f4; }
public struct Struct34<F, D, I, L> { public D _f1; public D _f2; public D _f3; public D _f4; }
public struct Struct35<F, D, I, L> { public D _f1; public F _f2; public D _f3; public D _f4; }
public struct Struct36<F, D, I, L> { public D _f1; public I _f2; public D _f3; public D _f4; }
public struct Struct37<F, D, I, L> { public D _f1; public L _f2; public D _f3; public D _f4; }
public struct Struct40<F, D, I, L> { public F _f1; public F _f2; public F _f3; public F _f4; public D _f5; }
public struct Struct41<F, D, I, L> { public F _f1; public F _f2; public F _f3; public F _f4; public F _f5; }
public struct Struct42<F, D, I, L> { public F _f1; public F _f2; public F _f3; public F _f4; public I _f5; }
public struct Struct43<F, D, I, L> { public F _f1; public F _f2; public F _f3; public F _f4; public L _f5; }
public struct Struct44<F, D, I, L> { public D _f1; public D _f2; public D _f3; public D _f4; public D _f5; }
public struct Struct45<F, D, I, L> { public D _f1; public D _f2; public D _f3; public D _f4; public F _f5; }
public struct Struct46<F, D, I, L> { public D _f1; public D _f2; public D _f3; public D _f4; public I _f5; }
public struct Struct47<F, D, I, L> { public D _f1; public D _f2; public D _f3; public D _f4; public L _f5; }
public struct FComplex00<F, D, I, L> { public F _f1; public Struct00<F, D, I, L> _f2; }
public struct FComplex01<F, D, I, L> { public F _f1; public Struct01<F, D, I, L> _f2; }
public struct FComplex02<F, D, I, L> { public F _f1; public Struct02<F, D, I, L> _f2; }
public struct FComplex03<F, D, I, L> { public F _f1; public Struct03<F, D, I, L> _f2; }
public struct FComplex10<F, D, I, L> { public F _f1; public Struct20<F, D, I, L> _f2; }
public struct FComplex11<F, D, I, L> { public F _f1; public Struct21<F, D, I, L> _f2; }
public struct FComplex12<F, D, I, L> { public F _f1; public Struct22<F, D, I, L> _f2; }
public struct FComplex13<F, D, I, L> { public F _f1; public Struct23<F, D, I, L> _f2; }
public struct FComplex14<F, D, I, L> { public F _f1; public Struct24<F, D, I, L> _f2; }
public struct FComplex15<F, D, I, L> { public F _f1; public Struct25<F, D, I, L> _f2; }
public struct FComplex16<F, D, I, L> { public F _f1; public Struct26<F, D, I, L> _f2; }
public struct FComplex17<F, D, I, L> { public F _f1; public Struct27<F, D, I, L> _f2; }
public struct DComplex00<F, D, I, L> { public D _f1; public Struct00<F, D, I, L> _f2; }
public struct DComplex01<F, D, I, L> { public D _f1; public Struct01<F, D, I, L> _f2; }
public struct DComplex02<F, D, I, L> { public D _f1; public Struct02<F, D, I, L> _f2; }
public struct DComplex03<F, D, I, L> { public D _f1; public Struct03<F, D, I, L> _f2; }
public struct DComplex10<F, D, I, L> { public D _f1; public Struct20<F, D, I, L> _f2; }
public struct DComplex11<F, D, I, L> { public D _f1; public Struct21<F, D, I, L> _f2; }
public struct DComplex12<F, D, I, L> { public D _f1; public Struct22<F, D, I, L> _f2; }
public struct DComplex13<F, D, I, L> { public D _f1; public Struct23<F, D, I, L> _f2; }
public struct DComplex14<F, D, I, L> { public D _f1; public Struct24<F, D, I, L> _f2; }
public struct DComplex15<F, D, I, L> { public D _f1; public Struct25<F, D, I, L> _f2; }
public struct DComplex16<F, D, I, L> { public D _f1; public Struct26<F, D, I, L> _f2; }
public struct DComplex17<F, D, I, L> { public D _f1; public Struct27<F, D, I, L> _f2; }
public struct Floats3<F, D, I, L> { public F _f1; public F _f2; public F _f3; }
public struct Floats4<F, D, I, L> { public F _f1; public F _f2; public F _f3; public F _f4; }
public struct Floats3Complex<F, D, I, L> { public Floats3<F, D, I, L> _f1; }
public struct Floats4Complex1<F, D, I, L> { public Floats3<F, D, I, L> _f1; public F _f2; }
public struct Floats4Complex2<F, D, I, L> { public Floats4<F, D, I, L> _f1; }
public struct Floats4Complex3<F, D, I, L> { public Floats4<F, D, I, L> _f1; public F _f2; }
public struct Doubles3<F, D, I, L> { public D _f1; public D _f2; public D _f3; }
public struct Doubles4<F, D, I, L> { public D _f1; public D _f2; public D _f3; public D _f4; }
public struct Doubles3Complex<F, D, I, L> { public Doubles3<F, D, I, L> _f1; }
public struct Doubles4Complex1<F, D, I, L> { public Doubles3<F, D, I, L> _f1; public D _f2; }
public struct Doubles4Complex2<F, D, I, L> { public Doubles4<F, D, I, L> _f1; }
public struct Doubles4Complex3<F, D, I, L> { public Doubles4<F, D, I, L> _f1; public D _f2; }
public struct GenStructWrapper<T> { public T _f1; }
public class TestClass<T>
{
public static void TestStruct(T t, object[] values)
{
TestStruct_Inner1(TestStruct_Inner1(t, values), values);
TestStruct_Inner2("abc", TestStruct_Inner2("abc", t, values), values);
TestStruct_Inner3("abc", "def", TestStruct_Inner3("abc", "def", t, values), values);
}
public static T TestStruct_Inner1(T t, object[] values)
{
CheckFieldValues(t, typeof(T).GetTypeInfo(), values, 0);
T copy = t;
return copy;
}
public static T TestStruct_Inner2(string param1, T t, object[] values)
{
CheckFieldValues(t, typeof(T).GetTypeInfo(), values, 0);
T copy = t;
return copy;
}
public static T TestStruct_Inner3(string param1, string param2, T t, object[] values)
{
CheckFieldValues(t, typeof(T).GetTypeInfo(), values, 0);
T copy = t;
return copy;
}
static void CheckFieldValues(object obj, TypeInfo ti, object[] values, int index)
{
for (int i = 1; i <= 5; i++)
{
FieldInfo fi = ti.GetDeclaredField("_f" + i);
if (fi == null) break;
if (fi.FieldType.Name.Contains("Struct") || fi.FieldType.Name.Contains("Floats") || fi.FieldType.Name.Contains("Doubles") || fi.DeclaringType.Name.Contains("GenStructWrapper"))
{
TypeInfo complexti = fi.FieldType.GetTypeInfo();
object complexObj = fi.GetValue(obj);
CheckFieldValues(complexObj, complexti, values, index);
}
else
{
//Console.WriteLine(obj.GetType() + "._f" + i + " == " + values[index] + " ? " + (fi.GetValue(obj).Equals(values[index])));
Assert.AreEqual(fi.GetValue(obj), values[index]);
index++;
}
}
}
}
public class Runner
{
[TestMethod]
public static unsafe void HFATestEntryPoint()
{
// suppress stupid warning about field not being used in code...
new GenStructWrapper<string> { _f1 = "abc" };
HFATestEntryPoint_Inner(typeof(Struct00<,,,>));
HFATestEntryPoint_Inner(typeof(Struct01<,,,>));
HFATestEntryPoint_Inner(typeof(Struct02<,,,>));
HFATestEntryPoint_Inner(typeof(Struct03<,,,>));
HFATestEntryPoint_Inner(typeof(Struct10<,,,>));
HFATestEntryPoint_Inner(typeof(Struct11<,,,>));
HFATestEntryPoint_Inner(typeof(Struct12<,,,>));
HFATestEntryPoint_Inner(typeof(Struct13<,,,>));
HFATestEntryPoint_Inner(typeof(Struct14<,,,>));
HFATestEntryPoint_Inner(typeof(Struct15<,,,>));
HFATestEntryPoint_Inner(typeof(Struct16<,,,>));
HFATestEntryPoint_Inner(typeof(Struct17<,,,>));
HFATestEntryPoint_Inner(typeof(Struct20<,,,>));
HFATestEntryPoint_Inner(typeof(Struct21<,,,>));
HFATestEntryPoint_Inner(typeof(Struct22<,,,>));
HFATestEntryPoint_Inner(typeof(Struct23<,,,>));
HFATestEntryPoint_Inner(typeof(Struct24<,,,>));
HFATestEntryPoint_Inner(typeof(Struct25<,,,>));
HFATestEntryPoint_Inner(typeof(Struct26<,,,>));
HFATestEntryPoint_Inner(typeof(Struct27<,,,>));
HFATestEntryPoint_Inner(typeof(Struct30<,,,>));
HFATestEntryPoint_Inner(typeof(Struct31<,,,>));
HFATestEntryPoint_Inner(typeof(Struct32<,,,>));
HFATestEntryPoint_Inner(typeof(Struct33<,,,>));
HFATestEntryPoint_Inner(typeof(Struct34<,,,>));
HFATestEntryPoint_Inner(typeof(Struct35<,,,>));
HFATestEntryPoint_Inner(typeof(Struct36<,,,>));
HFATestEntryPoint_Inner(typeof(Struct37<,,,>));
HFATestEntryPoint_Inner(typeof(Struct40<,,,>));
HFATestEntryPoint_Inner(typeof(Struct41<,,,>));
HFATestEntryPoint_Inner(typeof(Struct42<,,,>));
HFATestEntryPoint_Inner(typeof(Struct43<,,,>));
HFATestEntryPoint_Inner(typeof(Struct44<,,,>));
HFATestEntryPoint_Inner(typeof(Struct45<,,,>));
HFATestEntryPoint_Inner(typeof(Struct46<,,,>));
HFATestEntryPoint_Inner(typeof(Struct47<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex00<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex01<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex02<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex03<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex10<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex11<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex12<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex13<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex14<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex15<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex16<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex17<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex00<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex01<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex02<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex03<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex10<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex11<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex12<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex13<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex14<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex15<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex16<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex17<,,,>));
HFATestEntryPoint_Inner(typeof(Floats3<,,,>));
HFATestEntryPoint_Inner(typeof(Floats4<,,,>));
HFATestEntryPoint_Inner(typeof(Floats3Complex<,,,>));
HFATestEntryPoint_Inner(typeof(Floats4Complex1<,,,>));
HFATestEntryPoint_Inner(typeof(Floats4Complex2<,,,>));
HFATestEntryPoint_Inner(typeof(Floats4Complex3<,,,>));
HFATestEntryPoint_Inner(typeof(Doubles3<,,,>));
HFATestEntryPoint_Inner(typeof(Doubles4<,,,>));
HFATestEntryPoint_Inner(typeof(Doubles3Complex<,,,>));
HFATestEntryPoint_Inner(typeof(Doubles4Complex1<,,,>));
HFATestEntryPoint_Inner(typeof(Doubles4Complex2<,,,>));
HFATestEntryPoint_Inner(typeof(Doubles4Complex3<,,,>));
}
static void HFATestEntryPoint_Inner(Type structType)
{
Type genStructInst = structType.MakeGenericType(TypeOf.Float, TypeOf.Double, TypeOf.Int32, TypeOf.Long);
{
TypeOf.HFA_TestClass.MakeGenericType(genStructInst).GetTypeInfo().GetDeclaredMethod("TestStruct").Invoke(null, GetInstanceAndValuesArray(genStructInst));
}
{
Type genStructWrapper = TypeOf.HFA_GenStructWrapper.MakeGenericType(genStructInst);
TypeOf.HFA_TestClass.MakeGenericType(genStructWrapper).GetTypeInfo().GetDeclaredMethod("TestStruct").Invoke(null, GetInstanceAndValuesArray(genStructWrapper));
}
}
public static unsafe object[] GetInstanceAndValuesArray(Type genStructInst)
{
object obj = Activator.CreateInstance(genStructInst);
List<object> values = new List<object>();
FillFieldValues(obj, 1, values);
return new object[] { obj, values.ToArray() };
}
static void FillFieldValues(object obj, int multiplier, List<object> values)
{
for (int i = 1; i <= 5; i++)
{
float fvalue = 1.1f * i * multiplier;
double dvalue = 11.11 * i * multiplier;
int ivalue = 10 * i * multiplier;
long lvalue = 123000 * i * multiplier;
FieldInfo fi = obj.GetType().GetTypeInfo().GetDeclaredField("_f" + i);
if (fi == null) return;
if (fi.FieldType == typeof(float))
{
fi.SetValue(obj, fvalue);
values.Add(fvalue);
}
else if (fi.FieldType == typeof(double))
{
fi.SetValue(obj, dvalue);
values.Add(dvalue);
}
else if (fi.FieldType == typeof(int))
{
fi.SetValue(obj, ivalue);
values.Add(ivalue);
}
else if (fi.FieldType == typeof(long))
{
fi.SetValue(obj, lvalue);
values.Add(lvalue);
}
else
{
object complexObj = fi.GetValue(obj);
FillFieldValues(complexObj, multiplier * 2, values);
fi.SetValue(obj, complexObj);
}
}
}
}
}
namespace ComparerOfTTests
{
struct BoringStruct
{
}
struct StructThatImplementsIComparable : IComparable<StructThatImplementsIComparable>
{
public StructThatImplementsIComparable(int x)
{
_x = x;
}
int IComparable<StructThatImplementsIComparable>.CompareTo(StructThatImplementsIComparable other)
{
if (_x == other._x) return 0;
if (_x < other._x) return -1;
return 1;
}
private int _x;
}
struct StructThatImplementsIComparableOfObject : IComparable<object>
{
public StructThatImplementsIComparableOfObject(int x)
{
_x = x;
}
int IComparable<object>.CompareTo(object other)
{
return 1;
}
private int _x;
}
public abstract class BaseType
{
public abstract void TestCompare(object x, object y);
}
public class DerivedType<T,V> : BaseType
{
private static void TestC(T x, T y)
{
Comparer<T> e = Comparer<T>.Default;
bool expectThrow = false;
int expectedResult;
if (x is IComparable<T>)
{
expectedResult = ((IComparable<T>)x).CompareTo(y);
}
else if (x is StructThatImplementsIComparable?)
{
// This logic really applies to all Nullable types but it's a pain to write this for general nullable types without falling back to Reflection
StructThatImplementsIComparable? xn = (StructThatImplementsIComparable?)(object)x;
StructThatImplementsIComparable? yn = (StructThatImplementsIComparable?)(object)y;
if (xn.HasValue && yn.HasValue)
{
IComparable<StructThatImplementsIComparable> xv = ((StructThatImplementsIComparable?)(object)x).Value;
StructThatImplementsIComparable yv = ((StructThatImplementsIComparable?)(object)y).Value;
expectedResult = xv.CompareTo(yv);
}
else if (xn.HasValue)
{
expectedResult = 1;
}
else if (yn.HasValue)
{
expectedResult = -1;
}
else
{
expectedResult = 0;
}
}
else if (x is int?)
{
// This logic really applies to all Nullable types but it's a pain to write this for general nullable types without falling back to Reflection
int? xn = (int?)(object)x;
int? yn = (int?)(object)y;
if (xn.HasValue && yn.HasValue)
{
IComparable<int> xv = ((int?)(object)x).Value;
int yv = ((int?)(object)y).Value;
expectedResult = xv.CompareTo(yv);
}
else if (xn.HasValue)
{
expectedResult = 1;
}
else if (yn.HasValue)
{
expectedResult = -1;
}
else
{
expectedResult = 0;
}
}
else
{
expectedResult = 0;
try
{
expectedResult = System.Collections.Comparer.Default.Compare(x,y);
}
catch
{
expectThrow = true;
}
}
int actualResult = 0;
bool actualThrow = false;
try
{
actualResult = e.Compare(x,y);
}
catch
{
actualThrow = true;
}
Assert.AreEqual(expectedResult, actualResult);
Assert.AreEqual(expectThrow, actualThrow);
}
public override void TestCompare(object x, object y)
{
TestC((T)x, (T)y);
}
}
public class Runner
{
[TestMethod]
public static unsafe void TestStructThatImplementsIComparable()
{
Type t = typeof(DerivedType<,>).MakeGenericType(typeof(StructThatImplementsIComparable), TypeOf.Short);
BaseType o = (BaseType)Activator.CreateInstance(t);
object o1 = new StructThatImplementsIComparable(1);
object o2 = new StructThatImplementsIComparable(2);
o.TestCompare(o2, o1);
o.TestCompare(o1, o2);
o.TestCompare(o1, o1);
}
[TestMethod]
public static unsafe void TestStructThatImplementsIComparableOfObject()
{
Type t = typeof(DerivedType<,>).MakeGenericType(typeof(StructThatImplementsIComparableOfObject), TypeOf.Short);
BaseType o = (BaseType)Activator.CreateInstance(t);
object o1 = new StructThatImplementsIComparableOfObject(1);
object o2 = new StructThatImplementsIComparableOfObject(2);
o.TestCompare(o2, o1);
o.TestCompare(o1, o2);
o.TestCompare(o1, o1);
}
[TestMethod]
public static unsafe void TestBoringStruct()
{
Type t = typeof(DerivedType<,>).MakeGenericType(typeof(BoringStruct), TypeOf.Short);
BaseType o = (BaseType)Activator.CreateInstance(t);
object o1 = new BoringStruct();
object o2 = new BoringStruct();
o.TestCompare(o2, o1);
o.TestCompare(o1, o2);
o.TestCompare(o1, o1);
}
}
}
namespace DefaultValueDelegateParameterTests
{
public delegate int DelegateWithDefaultValue<T>(T val, int defaultParam = 2);
public abstract class BaseType
{
public abstract Delegate GetDefaultValueDelegate();
public abstract void SetExpectedValParameter(object expected);
}
public class TestType<T> : BaseType
{
T s_expected;
public override void SetExpectedValParameter(object expected)
{
s_expected = (T)expected;
}
public override Delegate GetDefaultValueDelegate()
{
return (DelegateWithDefaultValue<T>)DelegateTarget;
}
private int DelegateTarget(T val, int defaultValueParam)
{
Assert.AreEqual(s_expected, val);
return defaultValueParam;
}
}
public class Runner
{
[TestMethod]
public static unsafe void TestCallUniversalGenericDelegate()
{
Type t = typeof(TestType<>).MakeGenericType(TypeOf.Short);
BaseType targetObject = (BaseType)Activator.CreateInstance(t);
targetObject.SetExpectedValParameter((short)3);
Delegate del = targetObject.GetDefaultValueDelegate();
object result;
// Test using default parameter
result = del.DynamicInvoke(new object[]{ (object)(short)3, Type.Missing});
Assert.AreEqual(result, 2);
// Test not using default parameter
result = del.DynamicInvoke(new object[]{ (object)(short)3, 5});
Assert.AreEqual(result, 5);
}
}
}
namespace ArrayOfGenericStructGCTests
{
struct StructWithGCReference
{
public object o;
public object o2;
}
public struct StructWithoutGCReference
{
public IntPtr _value;
public IntPtr _value2;
public IntPtr _value3;
}
public struct GenericStruct<X,Y,Z>
{
public X _x;
public Y _y;
}
public abstract class Base
{
public abstract void SetValues(int index, object x, object y);
}
public class Derived<X, Y, Z> : Base
{
GenericStruct<X, Y, Z>[] _array = new GenericStruct<X, Y, Z>[100];
public override void SetValues(int index, object x, object y)
{
_array[index]._x = (X)x;
_array[index]._y = (Y)y;
}
}
[StructLayout(LayoutKind.Sequential)]
public class ClassWithNonPointerSizedFinalFieldBase<T>
{
public object o1;
public object o2;
public byte b1;
// Ensure the toolchain doesn't DR any part of this type
public override string ToString()
{
if (o1 != null) return o1.ToString();
if (o2 != null) return o1.ToString();
return b1.ToString();
}
}
[StructLayout(LayoutKind.Sequential)]
public class ClassWithNonPointerSizedFinalFieldBase2<T> : ClassWithNonPointerSizedFinalFieldBase<T>
{
public object o3;
public object o4;
public byte b2;
// Ensure the toolchain doesn't DR any part of this type
public override string ToString()
{
if (o1 != null) return o1.ToString();
if (o2 != null) return o1.ToString();
if (o3 != null) return o1.ToString();
if (o4 != null) return o1.ToString();
return b1.ToString() + b2.ToString();
}
}
[StructLayout(LayoutKind.Sequential)]
public class ClassWithNonPointerSizedFinalField<T> : ClassWithNonPointerSizedFinalFieldBase2<T>
{
}
[StructLayout(LayoutKind.Sequential)]
public struct StructWithNonPointerSizedFinalField<T>
{
public object o1;
public object o2;
public byte b1;
public object o3;
public object o4;
public byte b2;
// Ensure the toolchain doesn't DR any part of this type
public override string ToString()
{
if (o1 != null) return o1.ToString();
if (o2 != null) return o1.ToString();
if (o3 != null) return o1.ToString();
if (o4 != null) return o1.ToString();
return b1.ToString() + b2.ToString();
}
}
public class Runner
{
static object s_o = new Derived<int,int,int>();
[MethodImpl(MethodImplOptions.NoInlining)]
public static unsafe IntPtr * decrement(IntPtr * pIntPtr)
{
// This function is a workaround for 469350
// If this is inline in TestArrayOfGenericStructGCTests, nutc
// gc tracker can become confused
return pIntPtr - 1;
}
// This test constructs a valuetype array full of GC pointers and
// non-pointers, and attempts to validate that it is reported correctly, by
// having the non-pointers be close enough to gc pointers that the GC will AV
// if it does the wrong thing
[TestMethod]
public static unsafe void TestArrayOfGenericStructGCTests()
{
Type t = typeof(Derived<,,>).MakeGenericType(typeof(StructWithGCReference), typeof(StructWithoutGCReference), TypeOf.Short);
Base o = (Base)Activator.CreateInstance(t);
StructWithGCReference swgr = new StructWithGCReference();
swgr.o = new object();
swgr.o2 = new object();
StructWithoutGCReference swogr = new StructWithoutGCReference();
GenericStruct<object, IntPtr, bool> tempStruct = new GenericStruct<object, IntPtr, bool>();
tempStruct._x = new object();
IntPtr *pIntPtr = &tempStruct._y;
pIntPtr = decrement(pIntPtr);
long ptrInGCHeapThatIsLikelyGCObjectAddress = (*pIntPtr).ToInt64();
long ptrInGCHeapThatIsNotGCObjectAddress = ptrInGCHeapThatIsLikelyGCObjectAddress + 1;
swogr._value = new IntPtr(ptrInGCHeapThatIsNotGCObjectAddress);
swogr._value2 = new IntPtr(ptrInGCHeapThatIsNotGCObjectAddress+1);
swogr._value3 = new IntPtr(ptrInGCHeapThatIsNotGCObjectAddress+2);
for (int i = 0; i < 100; i++)
o.SetValues(i, swgr, swogr);
GC.Collect(2);
GC.Collect(2);
GC.Collect(2);
}
static string s_str;
// This test creates a type that have both GC pointers and lack a final field which is aligned on a GC boundary
[TestMethod]
public static unsafe void TestNonPointerSizedFinalField()
{
Type t;
object o;
t = typeof(ClassWithNonPointerSizedFinalFieldBase2<>).MakeGenericType(TypeOf.Int32);
o = Activator.CreateInstance(t);
s_str = o.ToString();
t = typeof(ClassWithNonPointerSizedFinalField<>).MakeGenericType(TypeOf.Int32);
o = Activator.CreateInstance(t);
s_str = o.ToString();
t = typeof(ClassWithNonPointerSizedFinalField<>).MakeGenericType(TypeOf.Short);
o = Activator.CreateInstance(t);
s_str = o.ToString();
Type t2 = typeof(StructWithNonPointerSizedFinalField<>).MakeGenericType(TypeOf.Short);
object o2 = Activator.CreateInstance(t2);
s_str = o.ToString();
}
}
}
namespace DelegatesToStructMethods
{
public struct MySpecialStruct<T>
{
T _val;
public MySpecialStruct(T val) { _val = val; }
public Func<short, string> SimpleDelegateCreator()
{
return new Func<short, string>(StructFunc);
}
public Func<short, string> SimpleGenDelegateCreator()
{
return new Func<short, string>(GenStructFunc<T>);
}
public Func<T, string> ComplexDelegateCreator()
{
return new Func<T, string>(StructFuncNeedingCCC);
}
public Func<T, string> ComplexGenDelegateCreator()
{
return new Func<T, string>(GenStructFuncNeedingCCC<T>);
}
public string StructFunc(short s)
{
return typeof(T).Name + "-" + _val.ToString() + "-" + s;
}
public string GenStructFunc<U>(short s)
{
return typeof(T).Name + "-" + typeof(U).Name + "-" + _val.ToString() + "-" + s;
}
public string StructFuncNeedingCCC(T s)
{
return typeof(T).Name + "-" + _val.ToString() + "-" + s;
}
public string GenStructFuncNeedingCCC<U>(T s)
{
return typeof(T).Name + "-" + typeof(U).Name + "-" + _val.ToString() + "-" + s;
}
}
public class MySpecialClass<T>
{
T _val;
public MySpecialClass(T val) { _val = val; }
public Func<short, string> SimpleDelegateCreator()
{
return new Func<short, string>(ClassFunc);
}
public Func<short, string> SimpleGenDelegateCreator()
{
return new Func<short, string>(GenClassFunc<T>);
}
public Func<T, string> ComplexDelegateCreator()
{
return new Func<T, string>(ClassFuncNeedingCCC);
}
public Func<T, string> ComplexGenDelegateCreator()
{
return new Func<T, string>(GenClassFuncNeedingCCC<T>);
}
public string ClassFunc(short s)
{
return typeof(T).Name + "-" + _val.ToString() + "-" + s;
}
public string GenClassFunc<U>(short s)
{
return typeof(T).Name + "-" + typeof(U).Name + "-" + _val.ToString() + "-" + s;
}
public string ClassFuncNeedingCCC(T s)
{
return typeof(T).Name + "-" + _val.ToString() + "-" + s;
}
public string GenClassFuncNeedingCCC<U>(T s)
{
return typeof(T).Name + "-" + typeof(U).Name + "-" + _val.ToString() + "-" + s;
}
}
public class Runner
{
[TestMethod]
public static void TestDelegateInvokeToMethods()
{
MethodInfo testMi = typeof(Runner).GetTypeInfo().GetDeclaredMethod("TestDelegateInvokeToMethods_Inner").MakeGenericMethod(TypeOf.Short);
testMi.Invoke(null, new object[] { (short)44, (short)55, "StructFunc", "GenStructFunc", true });
testMi.Invoke(null, new object[] { (short)44, (short)55, "ClassFunc", "GenClassFunc", false });
}
static string CallDelegateFromNonUSGContext(Delegate d, short val)
{
Func<short, string> del = (Func<short, string>)d;
return del(val);
}
public static void TestDelegateInvokeToMethods_Inner<T>(T tval1, T tval2, string funcName, string genFuncName, bool isTestOnStruct)
{
// USG case
{
Type t = isTestOnStruct ?
typeof(MySpecialStruct<>).MakeGenericType(TypeOf.Short) :
typeof(MySpecialClass<>).MakeGenericType(TypeOf.Short);
object o = Activator.CreateInstance(t, new object[] { (short)123 });
// Simple method signature case
{
MethodInfo delCreator = t.GetTypeInfo().GetDeclaredMethod("SimpleDelegateCreator");
MethodInfo genDelCreator = t.GetTypeInfo().GetDeclaredMethod("SimpleGenDelegateCreator");
MethodInfo mi = t.GetTypeInfo().GetDeclaredMethod(funcName);
Func<short, string> del1 = (Func<short, string>)mi.CreateDelegate(typeof(Func<short, string>), o);
Func<short, string> del2 = (Func<short, string>)delCreator.Invoke(o, null);
string res1 = del1(11);
string res2 = del2(11);
Assert.AreEqual(res1, "Int16-123-11");
Assert.AreEqual(res1, res2);
MethodInfo miGen = t.GetTypeInfo().GetDeclaredMethod(genFuncName).MakeGenericMethod(TypeOf.Short);
Func<short, string> genDel1 = (Func<short, string>)miGen.CreateDelegate(typeof(Func<short, string>), o);
Func<short, string> genDel2 = (Func<short, string>)genDelCreator.Invoke(o, null);
string genRes1 = genDel1(22);
string genRes2 = genDel2(22);
Assert.AreEqual(genRes1, "Int16-Int16-123-22");
Assert.AreEqual(genRes1, genRes2);
}
// Complex method signature case
{
MethodInfo delCreator = t.GetTypeInfo().GetDeclaredMethod("ComplexDelegateCreator");
MethodInfo genDelCreator = t.GetTypeInfo().GetDeclaredMethod("ComplexGenDelegateCreator");
MethodInfo mi = t.GetTypeInfo().GetDeclaredMethod(funcName + "NeedingCCC");
Func<T, string> del1 = (Func<T, string>)mi.CreateDelegate(typeof(Func<T, string>), o);
Func<T, string> del2 = (Func<T, string>)delCreator.Invoke(o, null);
string res1 = del1(tval1);
string res2 = del2(tval1);
Assert.AreEqual(res1, "Int16-123-44");
Assert.AreEqual(res1, res2);
res1 = CallDelegateFromNonUSGContext(del1, 44);
res2 = CallDelegateFromNonUSGContext(del2, 44);
Assert.AreEqual(res1, "Int16-123-44");
Assert.AreEqual(res1, res2);
MethodInfo miGen = t.GetTypeInfo().GetDeclaredMethod(genFuncName + "NeedingCCC").MakeGenericMethod(TypeOf.Short);
Func<T, string> genDel1 = (Func<T, string>)miGen.CreateDelegate(typeof(Func<T, string>), o);
Func<T, string> genDel2 = (Func<T, string>)genDelCreator.Invoke(o, null);
string genRes1 = genDel1(tval2);
string genRes2 = genDel2(tval2);
Assert.AreEqual(genRes1, "Int16-Int16-123-55");
Assert.AreEqual(genRes1, genRes2);
genRes1 = CallDelegateFromNonUSGContext(genDel1, 55);
genRes2 = CallDelegateFromNonUSGContext(genDel2, 55);
Assert.AreEqual(genRes1, "Int16-Int16-123-55");
Assert.AreEqual(genRes1, genRes2);
}
}
// Normal Canonical case
{
Type t = isTestOnStruct ?
typeof(MySpecialStruct<>).MakeGenericType(TypeOf.String) :
typeof(MySpecialClass<>).MakeGenericType(TypeOf.String);
object o = Activator.CreateInstance(t, new object[] { "abc" });
MethodInfo delCreator = t.GetTypeInfo().GetDeclaredMethod("SimpleDelegateCreator");
MethodInfo genDelCreator = t.GetTypeInfo().GetDeclaredMethod("SimpleGenDelegateCreator");
MethodInfo mi = t.GetTypeInfo().GetDeclaredMethod(funcName);
Func<short, string> del1 = (Func<short, string>)mi.CreateDelegate(typeof(Func<short, string>), o);
Func<short, string> del2 = (Func<short, string>)delCreator.Invoke(o, null);
string res1 = del1(66);
string res2 = del2(66);
Assert.AreEqual(res1, "String-abc-66");
Assert.AreEqual(res1, res2);
MethodInfo miGen = t.GetTypeInfo().GetDeclaredMethod(genFuncName).MakeGenericMethod(TypeOf.String);
Func<short, string> genDel1 = (Func<short, string>)miGen.CreateDelegate(typeof(Func<short, string>), o);
Func<short, string> genDel2 = (Func<short, string>)genDelCreator.Invoke(o, null);
string genRes1 = genDel1(77);
string genRes2 = genDel2(77);
Assert.AreEqual(genRes1, "String-String-abc-77");
Assert.AreEqual(genRes1, genRes2);
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Linq.Expressions;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using CoreFXTestLibrary;
using TypeOfRepo;
namespace UniversalGen
{
public enum MyEnum { ME_1, ME_2 }
public class MyGen<T>
{
#pragma warning disable 0414 // The field '...blah...' is assigned but its value is never used
int a;
long b;
char c;
double d;
MyEnum e;
T f;
object g;
MyGenStruct<T> h;
MyGen<T> i;
MyGenStruct<T> j;
MyGenStruct<float> k;
MyStruct l;
MyGen<Type> m;
int[] a_array;
long[] b_array;
char[] c_array;
double[] d_array;
MyEnum[] e_array;
T[] f_array; // Universal canonical arrays NYI
object[] g_array;
MyGenStruct<T>[] h_array; // Universal canonical arrays NYI
MyGen<T>[] i_array; // Universal canonical arrays NYI
MyGenStruct<T>[] j_array; // Universal canonical arrays NYI
MyGenStruct<float>[] k_array; // Universal canonical arrays NYI
MyStruct[] l_array; // Universal canonical arrays NYI
MyGen<Type>[] m_array; // Universal canonical arrays NYI
static int a_static;
static long b_static;
static char c_static;
static double d_static;
static MyEnum e_static;
static T f_static;
static object g_static;
static MyGenStruct<T> h_static;
static MyGen<T> i_static;
static MyGenStruct<T> j_static;
static MyGenStruct<float> k_static;
static MyStruct l_static;
static MyGen<string> m_static;
static int[] a_array_static;
static long[] b_array_static;
static char[] c_array_static;
static double[] d_array_static;
static MyEnum[] e_array_static;
static T[] f_array_static;
static object[] g_array_static;
static MyGenStruct<T>[] h_array_static;
static MyGen<T>[] i_array_static;
static MyGenStruct<T>[] j_array_static;
static MyGenStruct<float>[] k_array_static;
static MyStruct[] l_array_static;
static MyGen<string>[] m_array_static;
public MyGen()
{
a = 1;
b = 2;
c = 'c';
d = 0.3;
e = MyEnum.ME_1;
f = default(T);
g = new object();
h = default(MyGenStruct<T>);
i = null;
j = default(MyGenStruct<T>);
k = default(MyGenStruct<float>);
l = default(MyStruct);
m = null;
a_array = null;
b_array = null;
c_array = null;
d_array = null;
e_array = null;
f_array = null;
g_array = null;
h_array = null;
i_array = null;
j_array = null;
k_array = null;
l_array = null;
m_array = null;
a_static = 2;
b_static = 3;
c_static = 'd';
d_static = 0.5;
e_static = MyEnum.ME_2;
f_static = default(T);
g_static = null;
h_static = default(MyGenStruct<T>);
i_static = null;
j_static = default(MyGenStruct<T>);
k_static = default(MyGenStruct<float>);
l_static = default(MyStruct);
m_static = null;
a_array_static = null;
b_array_static = null;
c_array_static = null;
d_array_static = null;
e_array_static = null;
f_array_static = null;
g_array_static = null;
h_array_static = null;
i_array_static = null;
j_array_static = null;
k_array_static = null;
l_array_static = null;
m_array_static = null;
}
#pragma warning restore 0414
}
public struct MyStruct { }
public struct MyGenStruct<T>
{
#pragma warning disable 0414 // The field '...blah...' is assigned but its value is never used
int a;
T b;
MyGen<T> c;
string d;
public MyGenStruct(object o)
{
a = 2;
b = default(T);
c = default(MyGen<T>);
d = "asd";
}
#pragma warning restore 0414
}
public class MyDerivedList<T> : List<T>
{
}
public struct MyListItem
{
string _id;
public MyListItem(string id) { _id = id; }
public override string ToString() { return "MyListItem(" + _id + ")"; }
}
public class StringWrapper
{
string _f;
public StringWrapper(string s) { _f = s; }
public override string ToString() { return _f; }
}
public class TestFieldsBase
{
public virtual void SetVal1(object val) { }
public virtual void SetVal2(object val) { }
public virtual void SetVal3(object val) { }
public virtual void SetVal4(object val) { }
public virtual void SetVal5(object val) { }
public virtual void SetVal6(object val) { }
public virtual object GetVal1() { return null; }
public virtual object GetVal2() { return null; }
public virtual object GetVal3() { return null; }
public virtual object GetVal4() { return null; }
public virtual object GetVal5() { return null; }
public virtual object GetVal6() { return null; }
}
public class UCGInstanceFields<T, U> : TestFieldsBase
{
protected T _1;
protected U _2;
protected int _3; // Test field of known type at unknown offset
public override void SetVal1(object val) { _1 = (T)val; }
public override void SetVal2(object val) { _2 = (U)val; }
public override void SetVal3(object val) { _3 = (int)val; }
public override object GetVal1() { return _1; }
public override object GetVal2() { return _2; }
public override object GetVal3() { return _3; }
}
public class UCGInstanceFieldsDerived<T, U> : UCGInstanceFields<T, T>
{
T _4;
double _5; // Test field of known type at unknown offset
U _6;
public override void SetVal1(object val) { _1 = (T)val; }
public override void SetVal4(object val) { _4 = (T)val; }
public override void SetVal5(object val) { _5 = (double)val; }
public override void SetVal6(object val) { _6 = (U)val; }
public override object GetVal3() { return _3; }
public override object GetVal4() { return _4; }
public override object GetVal5() { return _5; }
public override object GetVal6() { return _6; }
}
public class UCGInstanceFieldsDerived2<T> : UCGInstanceFields<float, T>
{
T _4;
public override void SetVal4(object val) { _4 = (T)val; }
public override object GetVal4() { return _4; }
}
public class UCGInstanceFieldsMostDerived<T> : UCGInstanceFieldsDerived2<float>
{
double _5; // Test field of known type at unknown offset
T _6;
public override void SetVal5(object val) { _5 = (double)val; }
public override void SetVal6(object val) { _6 = (T)val; }
public override object GetVal5() { return _5; }
public override object GetVal6() { return _6; }
}
public class UCGStaticFields<T, U> : TestFieldsBase
{
static T _1;
static U _2;
static int _3; // Test field of known type at unknown offset
public override void SetVal1(object val) { _1 = (T)val; }
public override void SetVal2(object val) { _2 = (U)val; }
public override void SetVal3(object val) { _3 = (int)val; }
public override object GetVal1() { return _1; }
public override object GetVal2() { return _2; }
public override object GetVal3() { return _3; }
}
public class UCGThreadStaticFields<T, U> : TestFieldsBase
{
[ThreadStatic]
static T _1;
[ThreadStatic]
static U _2;
[ThreadStatic]
static int _3; // Test field of known type at unknown offset
public override void SetVal1(object val) { _1 = (T)val; }
public override void SetVal2(object val) { _2 = (U)val; }
public override void SetVal3(object val) { _3 = (int)val; }
public override object GetVal1() { return _1; }
public override object GetVal2() { return _2; }
public override object GetVal3() { return _3; }
}
public class UCGStaticFieldsLayoutCompatStatic<T, U> : TestFieldsBase
{
public static T _1;
public static U _2;
public static int _3; // Test field of known type at unknown offset
public override void SetVal1(object val) { _1 = (T)val; }
public override void SetVal2(object val) { _2 = (U)val; }
public override void SetVal3(object val) { _3 = (int)val; }
public override object GetVal1() { return _1; }
public override object GetVal2() { return _2; }
public override object GetVal3() { return _3; }
}
public class UCGStaticFieldsLayoutCompatDynamic<T, U> : TestFieldsBase
{
public override void SetVal1(object val) { UCGStaticFieldsLayoutCompatStatic<T,U>._1 = (T)val; }
public override void SetVal2(object val) { UCGStaticFieldsLayoutCompatStatic<T, U>._2 = (U)val; }
public override void SetVal3(object val) { UCGStaticFieldsLayoutCompatStatic<T, U>._3 = (int)val; }
public override object GetVal1() { return UCGStaticFieldsLayoutCompatStatic<T, U>._1; }
public override object GetVal2() { return UCGStaticFieldsLayoutCompatStatic<T, U>._2; }
public override object GetVal3() { return UCGStaticFieldsLayoutCompatStatic<T, U>._3; }
}
#region Test case taken from a real app (minimal repro for a field layout bug)
public class GenBaseType<T> where T : IComparable<T>
{
protected String _myString = new String('c', 3);
protected T _tValue;
protected IComparer<T> _comparer;
protected GenBaseType(T tValue, IComparer<T> comparer)
{
if (comparer == null)
{
throw new System.ArgumentNullException("comparer");
}
this._tValue = tValue;
this._comparer = comparer;
}
}
public class GenDerivedType<T, U> : GenBaseType<T> where T : IComparable<T>
{
IList _iListObject;
U _uValue;
Func<object, IList, T, U, IComparer<T>, IDisposable> _action;
public GenDerivedType(IList iListObject, U uValue, Func<object, IList, T, U, IComparer<T>, IDisposable> action, T tValue, IComparer<T> comparer)
: base(tValue, comparer)
{
if (iListObject == null)
{
throw new System.ArgumentNullException("iListObject");
}
if (action == null)
{
throw new System.ArgumentNullException("action");
}
this._iListObject = iListObject;
this._uValue = uValue;
this._action = action;
}
public GenDerivedType(IList iListObject, U uValue, Func<object, IList, T, U, IComparer<T>, IDisposable> action, T tValue)
: this(iListObject, uValue, action, tValue, Comparer<T>.Default)
{
action(this._myString, this._iListObject, this._tValue, this._uValue, this._comparer);
}
}
public class GenDerivedType_Activator<T> where T : new()
{
static List<T> _listToUseAsParam = new List<T>(new T[] { default(T), new T() });
static TimeSpan _timeSpanToUseAsParam = TimeSpan.FromSeconds(123456.0);
static T _tToUseAsParam = new T();
static GenDerivedType<TimeSpan, T> _instance;
static String _delResult;
public GenDerivedType_Activator()
{
_instance = new GenDerivedType<TimeSpan, T>(_listToUseAsParam, _tToUseAsParam, new Func<object, IList, TimeSpan, T, IComparer<TimeSpan>, IDisposable>(FuncForDelegate), _timeSpanToUseAsParam);
}
public static IDisposable FuncForDelegate(object stringObj, IList iListObject, TimeSpan ts, T tValue, IComparer<TimeSpan> comparer)
{
_delResult = "GenDerivedType_Activator<" + typeof(T) + ">.FuncForDelegate";
Assert.AreEqual(stringObj, "ccc");
Assert.AreEqual(_listToUseAsParam, iListObject);
Assert.AreEqual(_timeSpanToUseAsParam, ts);
Assert.AreEqual(_tToUseAsParam, tValue);
Assert.AreEqual(comparer, Comparer<TimeSpan>.Default);
return null;
}
public override string ToString() { return _delResult; }
}
#endregion
public class TestClassConstructorBase
{
public static Type s_cctorOutput = null;
public virtual bool QueryStatic() { return false; }
}
public class UCGClassConstructorType<T> : TestClassConstructorBase
{
private static bool s_cctorRun = RunInCCtor();
private static bool RunInCCtor()
{
TestClassConstructorBase.s_cctorOutput = typeof(UCGClassConstructorType<T>);
return true;
}
public override bool QueryStatic() { return s_cctorRun; }
}
public interface IGetValue
{
int GetValue();
}
public struct UCGWrapperStruct : IGetValue
{
public UCGWrapperStruct(int wrapValue)
{
_WrappedValue = wrapValue;
}
public int _WrappedValue;
public int GetValue()
{
return _WrappedValue;
}
}
public interface IGVMTest
{
string GVMMethod<T>();
}
public class MakeGVMCallBase
{
public virtual string CallGvm(IGVMTest obj) { return null; }
}
public class MakeGVMCall<T> : MakeGVMCallBase
{
public override string CallGvm(IGVMTest obj)
{
return obj.GVMMethod<T>();
}
}
public class GVMTestClass<T> : IGVMTest
{
public string GVMMethod<U>()
{
return typeof(T).ToString() + typeof(U).ToString();
}
}
public struct GVMTestStruct<T> : IGVMTest
{
public string GVMMethod<U>()
{
return typeof(T).ToString() + typeof(U).ToString();
}
}
public class Base
{
public virtual object GetElementAt(int index) { return null; }
public virtual object this[int index] { get { return null; } set { } }
public virtual bool EmptyMethodTest(object param) { return true; }
public virtual object dupTest(object o1, object o2) { return null; }
public virtual bool FunctionCallTestsSetMember(object o1) { return false; }
public virtual bool FunctionCallTestsSetMemberByRef(object o1) { return false; }
public virtual bool FunctionCallTestsByRefGC(object o1) { return false; }
public virtual bool FunctionCallTestsSetByValue(object o1) { return false; }
public virtual bool FunctionCallTestsSetLocalByRef(object o1) { return false; }
public virtual bool FunctionCallTestsSetByValue2(object o1) { return false; }
public virtual void InterlockedTests(object o1, object o2) { }
public virtual void nestedTest() {}
}
public class UnmanagedByRef<T> : Base where T : struct, IGetValue
{
public T refVal;
[MethodImpl(MethodImplOptions.NoInlining)]
public unsafe void TestAsPointer(T x)
{
IntPtr unsafeValuePtr = (IntPtr)Unsafe.AsPointer(ref x);
GC.Collect();
GC.Collect();
GC.Collect();
GC.Collect();
GC.Collect();
var res = Unsafe.Read<T>(unsafeValuePtr.ToPointer());
Assert.IsTrue(this.refVal.Equals(res));
}
[MethodImpl(MethodImplOptions.NoInlining)]
public unsafe void TestGeneralFunction(T x)
{
IntPtr unsafeValuePtr = someFuncWithByRefArgs(ref x);
GC.Collect();
GC.Collect();
GC.Collect();
GC.Collect();
GC.Collect();
T res = Unsafe.Read<T>(unsafeValuePtr.ToPointer());
Assert.IsTrue(this.refVal.Equals(res));
}
[MethodImpl(MethodImplOptions.NoInlining)]
unsafe IntPtr someFuncWithByRefArgs(ref T x)
{
return (IntPtr)Unsafe.AsPointer(ref x);
}
public override unsafe bool FunctionCallTestsByRefGC(object o1)
{
var x = (T)o1;
this.refVal = x;
TestAsPointer(x);
TestGeneralFunction(x);
return true;
}
}
public class UCGSamples<T, U> : Base
{
public T[] _elements = new T[10];
public T member;
public T getMember() { return this.member; }
public override object GetElementAt(int index)
{
return _elements[index];
}
public override object this[int index]
{
get
{
return _elements[index];
}
set
{
_elements[index] = (T)value;
}
}
private void Empty(T t, T u)
{
}
public override void nestedTest()
{
testMethodInner();
//testMethodInner2();
testMethodInner3();
}
private MyGenStruct<UCGSamples<T,U>> testMethodInner()
{
return default(MyGenStruct<UCGSamples<T,U>>);
}
private MyGenStruct<MyGenStruct<UCGSamples<T,U>>> testMethodInner3()
{
return default(MyGenStruct<MyGenStruct<UCGSamples<T,U>>>);
}
public override bool EmptyMethodTest(object param)
{
T t = (T) param;
Empty(t, t);
return true;
}
private T dupTestInternal(T t1, T t2)
{
// IL for this method uses a 'dup' opcode
T local = default(T);
if ((local = t1).Equals(t2))
{
local = t2;
}
return local;
}
public override object dupTest(object o1, object o2)
{
return (object) dupTestInternal((T) o1, (T) o2);
}
private void set(T t)
{
member = t;
}
private void setEQ(T t1, T t2)
{
t2 = t1;
}
private void setByRefInner(T t, ref T tRef)
{
tRef = t;
}
[MethodImpl(MethodImplOptions.NoInlining)]
private void setInner(T t1, T t2)
{
t1 = t2;
}
[MethodImpl(MethodImplOptions.NoInlining)]
private void setOuter(T t1, T t2)
{
setInner(t1, t2);
}
private void setByRef(T t, ref T tRef)
{
setByRefInner(t, ref tRef);
}
public override bool FunctionCallTestsSetMember(object o1)
{
// eventually calls this.set(T) which sets this.member
T t = (T) o1;
set(t);
return this.member.Equals(t) && t.Equals(this.getMember());
}
public override bool FunctionCallTestsSetMemberByRef(object o1)
{
// same as 'FunctionCallTestsSetMember', but sets this.member via passing it byref
T t = (T) o1;
Assert.IsFalse(this.member.Equals(t));
setByRef(t, ref this.member);
return this.member.Equals(t);
}
public override bool FunctionCallTestsSetByValue(object o1)
{
// Calls setEQ, which sets second arg equal to first
// shouldn't change value of args since we're not passing byref
T t = (T) o1;
setEQ(t, this.member);
return !this.member.Equals(t);
}
public override bool FunctionCallTestsSetLocalByRef(object o1)
{
// same as 'FunctionCallTests', but sets a local via passing it byref
T t = (T) o1;
T t2 = default(T);
Assert.IsFalse(t2.Equals(t));
setByRef(t, ref t2);
return t2.Equals(t);
}
public override bool FunctionCallTestsSetByValue2(object o1)
{
T t = (T) o1;
Assert.IsTrue(!this.member.Equals(t));
setOuter(t, this.member);
return !this.member.Equals(t);
}
}
public class InterlockedClass<T, U> : Base where T : class
{
T member= default(T);
/*public InterlockedClass()
{
member = default(T);
}*/
public void setMember(T t)
{
this.member = t;
}
public T exchangeTest(T val)
{
T ret;
ret = System.Threading.Interlocked.Exchange<T>(ref this.member, val);
Assert.IsTrue(this.member.Equals(val));
return ret;
}
public T compareExchangeTest(T val)
{
T ret;
ret = System.Threading.Interlocked.CompareExchange<T>(ref this.member, val, this.member);
Assert.IsTrue(this.member.Equals(val));
return ret;
}
public override void InterlockedTests(object o1, object o2)
{
this.setMember((T)o1);
T ret = this.exchangeTest((T)o2);
Assert.IsTrue(ret.Equals(o1));
this.setMember((T)o1);
Assert.IsTrue(this.member.Equals((T) o1));
ret = this.compareExchangeTest((T)o2);
Assert.IsTrue(ret.Equals(o1));
}
}
public class Test
{
[TestMethod]
public static void TestInterlockedPrimitives()
{
var t = TypeOf.UG_InterlockedClass.MakeGenericType(TypeOf.String, TypeOf.Short);
Base o = (Base)Activator.CreateInstance(t);
o.InterlockedTests((object)"abc", (object)"def");
}
[TestMethod]
public static void TestArraysAndGC()
{
var t = TypeOf.UG_UCGSamples.MakeGenericType(TypeOf.Short, TypeOf.Short);
Base o = (Base)Activator.CreateInstance(t);
for (int i = 0; i < 10; i++)
o[i] = (short)i;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
for (int i = 0; i < 10; i++)
Assert.IsTrue((short)o[i] == (short)i);
t = TypeOf.UG_UCGSamples.MakeGenericType(typeof(StringWrapper), TypeOf.Short);
o = (Base)Activator.CreateInstance(t);
for (int i = 0; i < 10; i++)
o[i] = new StringWrapper("teststring" + i);
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
for (int i = 0; i < 10; i++)
Assert.IsTrue(((StringWrapper)o[i]).ToString() == "teststring" + i);
}
[TestMethod]
public static void TestUSGByRefFunctionCalls()
{
var t = TypeOf.UG_UnmanagedByRef.MakeGenericType(typeof(UCGWrapperStruct));
Base o = (Base)Activator.CreateInstance(t);
Assert.IsTrue(o.FunctionCallTestsByRefGC(new UCGWrapperStruct(2)));
}
[TestMethod]
public static void TestUSGSamples()
{
var t = TypeOf.UG_UCGSamples.MakeGenericType(TypeOf.Short, TypeOf.Short);
Base o = (Base)Activator.CreateInstance(t);
var result = o.GetElementAt(5);
Assert.AreEqual(result.ToString(), "0");
Assert.AreEqual(result.GetType(), TypeOf.Short);
Assert.IsTrue(o.EmptyMethodTest((short) 45));
Assert.AreEqual((short)o.dupTest((short)12, (short)-453),
(short)12);
o.nestedTest();
Assert.IsTrue(o.FunctionCallTestsSetMember((short) 79));
Assert.IsTrue(o.FunctionCallTestsSetMemberByRef((short) 85));
Assert.IsTrue(o.FunctionCallTestsSetByValue((short) 138));
Assert.IsTrue(o.FunctionCallTestsSetLocalByRef((short) 19));
Assert.IsTrue(o.FunctionCallTestsSetByValue2((short) 99));
for (int i = 0; i < 10; i++)
{
// No explicit typecasts
int val = 123 + i;
try
{
// This assignment should throw an InvalidCastException
// We have to explicitly cast "val" to "short"
o[i] = val;
Assert.IsTrue(false);
}
catch (InvalidCastException) { }
o[i] = (short)val;
Assert.AreEqual(o.GetElementAt(i), o[i]);
Assert.AreEqual(o[i], (short)val);
Assert.AreEqual(o.GetElementAt(i).ToString(), val.ToString());
// Explicit typecast to the correct type
val = 456 + i * 10;
o[i] = (short)val;
Assert.AreEqual((short)o.GetElementAt(i), (short)o[i]);
Assert.AreEqual((short)o[i], (short)val);
Assert.AreEqual(((short)o.GetElementAt(i)).ToString(), val.ToString());
}
}
[TestMethod]
public static void TestMakeGenericType()
{
new MyGenStruct<Type>(null);
var t = TypeOf.UG_MyGen.MakeGenericType(TypeOf.Object);
Assert.AreEqual(t.ToString(), "UniversalGen.MyGen`1[System.Object]");
t = TypeOf.UG_MyGen.MakeGenericType(TypeOf.String);
Assert.AreEqual(t.ToString(), "UniversalGen.MyGen`1[System.String]");
t = TypeOf.UG_MyGen.MakeGenericType(TypeOf.Int32);
Assert.AreEqual(t.ToString(), "UniversalGen.MyGen`1[System.Int32]");
t = TypeOf.UG_MyGen.MakeGenericType(TypeOf.CommonType2);
Assert.AreEqual(t.ToString(), "UniversalGen.MyGen`1[CommonType2]");
t = TypeOf.UG_MyGen.MakeGenericType(typeof(KeyValuePair<string, object>));
Assert.AreEqual(t.ToString(), "UniversalGen.MyGen`1[System.Collections.Generic.KeyValuePair`2[System.String,System.Object]]");
// List test
{
t = typeof(MyDerivedList<>).MakeGenericType(TypeOf.UG_MyListItem);
Assert.AreEqual(t.ToString(), "UniversalGen.MyDerivedList`1[UniversalGen.MyListItem]");
var l = Activator.CreateInstance(t);
MethodInfo ListTest = typeof(Test).GetTypeInfo().GetDeclaredMethod("ListTest").MakeGenericMethod(TypeOf.UG_MyListItem);
ListTest.Invoke(null, new object[] { l, new MyListItem("a"), new MyListItem("b") });
}
}
public static void ListTest<T>(MyDerivedList<T> l, T t1, T t2)
{
l.Add(t1);
l.Add(t2);
l.Add(t1);
Assert.AreEqual(3, l.Count);
Assert.AreEqual("MyListItem(a)", l[0].ToString());
Assert.AreEqual("MyListItem(b)", l[1].ToString());
Assert.AreEqual("MyListItem(a)", l[2].ToString());
}
[TestMethod]
public static void TestUSCInstanceFieldUsage()
{
var t = TypeOf.UG_UCGInstanceFields.MakeGenericType(TypeOf.Int32, TypeOf.Int32);
TestFieldsBase o = (TestFieldsBase)Activator.CreateInstance(t);
o.SetVal1(1);
o.SetVal2(2);
o.SetVal3(3);
Assert.AreEqual(o.GetVal1(), 1);
Assert.AreEqual(o.GetVal2(), 2);
Assert.AreEqual(o.GetVal3(), 3);
t = TypeOf.UG_UCGInstanceFieldsDerived.MakeGenericType(TypeOf.String, TypeOf.Int32);
o = (TestFieldsBase)Activator.CreateInstance(t);
o.SetVal1("11");
o.SetVal2("22");
o.SetVal3(33);
o.SetVal4("44");
o.SetVal5(55.55);
o.SetVal6(66);
Assert.AreEqual(o.GetVal1(), "11");
Assert.AreEqual(o.GetVal2(), "22");
Assert.AreEqual(o.GetVal3(), 33);
Assert.AreEqual(o.GetVal4(), "44");
Assert.AreEqual(o.GetVal5(), 55.55);
Assert.AreEqual(o.GetVal6(), 66);
t = TypeOf.UG_UCGInstanceFieldsMostDerived.MakeGenericType(TypeOf.Int32);
o = (TestFieldsBase)Activator.CreateInstance(t);
o.SetVal1(11.11f);
o.SetVal2(22.22f);
o.SetVal3(333);
o.SetVal4(44.44f);
o.SetVal5(555.555);
o.SetVal6(666);
Assert.AreEqual(o.GetVal1(), 11.11f);
Assert.AreEqual(o.GetVal2(), 22.22f);
Assert.AreEqual(o.GetVal3(), 333);
Assert.AreEqual(o.GetVal4(), 44.44f);
Assert.AreEqual(o.GetVal5(), 555.555);
Assert.AreEqual(o.GetVal6(), 666);
t = TypeOf.UG_UCGGenDerivedTypeActivator.MakeGenericType(typeof(MyGenStruct<double>));
object o2 = Activator.CreateInstance(t);
Assert.AreEqual(o2.ToString(), "GenDerivedType_Activator<UniversalGen.MyGenStruct`1[System.Double]>.FuncForDelegate");
}
[TestMethod]
public static void TestUSCStaticFieldUsage()
{
// Test with primitive types as field types
var t = TypeOf.UG_UCGStaticFields.MakeGenericType(TypeOf.Int32, TypeOf.Int32);
TestFieldsBase o = (TestFieldsBase)Activator.CreateInstance(t);
o.SetVal1(4);
o.SetVal2(5);
o.SetVal3(6);
Assert.AreEqual(o.GetVal1(), 4);
Assert.AreEqual(o.GetVal2(), 5);
Assert.AreEqual(o.GetVal3(), 6);
// Test with valuetypes as field types
t = TypeOf.UG_UCGStaticFields.MakeGenericType(TypeOf.UG_UCGWrapperStruct, TypeOf.UG_UCGWrapperStruct);
o = (TestFieldsBase)Activator.CreateInstance(t);
o.SetVal1(new UCGWrapperStruct(7));
o.SetVal2(new UCGWrapperStruct(8));
o.SetVal3(9);
Assert.AreEqual(((UCGWrapperStruct)o.GetVal1())._WrappedValue, 7);
Assert.AreEqual(((UCGWrapperStruct)o.GetVal2())._WrappedValue, 8);
Assert.AreEqual(o.GetVal3(), 9);
}
[TestMethod]
public static void TestUSCThreadStaticFieldUsage()
{
// Test with primitive types as field types
var t = TypeOf.UG_UCGThreadStaticFields.MakeGenericType(TypeOf.Int32, TypeOf.Int32);
TestFieldsBase o = (TestFieldsBase)Activator.CreateInstance(t);
o.SetVal1(16);
o.SetVal2(17);
o.SetVal3(18);
Assert.AreEqual(o.GetVal1(), 16);
Assert.AreEqual(o.GetVal2(), 17);
Assert.AreEqual(o.GetVal3(), 18);
// Test with valuetypes as field types
t = TypeOf.UG_UCGThreadStaticFields.MakeGenericType(TypeOf.UG_UCGWrapperStruct, TypeOf.UG_UCGWrapperStruct);
o = (TestFieldsBase)Activator.CreateInstance(t);
o.SetVal1(new UCGWrapperStruct(19));
o.SetVal2(new UCGWrapperStruct(20));
o.SetVal3(21);
Assert.AreEqual(((UCGWrapperStruct)o.GetVal1())._WrappedValue, 19);
Assert.AreEqual(((UCGWrapperStruct)o.GetVal2())._WrappedValue, 20);
Assert.AreEqual(o.GetVal3(), 21);
}
// Test that static layout is compatible between universal shared generics, and normal generics
[TestMethod]
public static void TestUSCStaticFieldLayoutCompat()
{
// In this test, we set values using static code, and the universal shared generic is supposed to read from
// the same static variables
// Test with primitive types as field types
TestFieldsBase o = new UCGStaticFieldsLayoutCompatStatic<int, int>();
o.SetVal1(10);
o.SetVal2(11);
o.SetVal3(12);
var t = TypeOf.UG_UCGStaticFieldsLayoutCompatDynamic.MakeGenericType(TypeOf.Int32, TypeOf.Int32);
o = (TestFieldsBase)Activator.CreateInstance(t);
Assert.AreEqual(o.GetVal1(), 10);
Assert.AreEqual(o.GetVal2(), 11);
Assert.AreEqual(o.GetVal3(), 12);
// Test with valuetypes as field types
o = new UCGStaticFieldsLayoutCompatStatic<UCGWrapperStruct, UCGWrapperStruct>();
o.SetVal1(new UCGWrapperStruct(13));
o.SetVal2(new UCGWrapperStruct(14));
o.SetVal3(15);
t = TypeOf.UG_UCGStaticFieldsLayoutCompatDynamic.MakeGenericType(TypeOf.UG_UCGWrapperStruct, TypeOf.UG_UCGWrapperStruct);
o = (TestFieldsBase)Activator.CreateInstance(t);
Assert.AreEqual(((UCGWrapperStruct)o.GetVal1())._WrappedValue, 13);
Assert.AreEqual(((UCGWrapperStruct)o.GetVal2())._WrappedValue, 14);
Assert.AreEqual(o.GetVal3(), 15);
}
// Test class constructor implicit call
[TestMethod]
public static void TestUSCClassConstructorImplicit()
{
try
{
Assert.AreEqual(null, TestClassConstructorBase.s_cctorOutput);
var t = TypeOf.UG_UCGClassConstructorType.MakeGenericType(TypeOf.Int16);
var o = (TestClassConstructorBase)Activator.CreateInstance(t);
Assert.AreEqual(true, o.QueryStatic());
Assert.AreEqual(t, TestClassConstructorBase.s_cctorOutput);
}
finally
{
TestClassConstructorBase.s_cctorOutput = null;
}
}
// Test class constructor explicit call
[TestMethod]
public static void TestUSCClassConstructorExplicit()
{
try
{
Assert.AreEqual(null, TestClassConstructorBase.s_cctorOutput);
var t = TypeOf.UG_UCGClassConstructorType.MakeGenericType(TypeOf.Int32);
System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(t.TypeHandle);
Assert.AreEqual(t, TestClassConstructorBase.s_cctorOutput);
}
finally
{
TestClassConstructorBase.s_cctorOutput = null;
}
}
[TestMethod]
public static void TestUniversalGenericsGvmCall()
{
var t = TypeOf.UG_MakeGVMCall.MakeGenericType(TypeOf.Int16);
var o = (MakeGVMCallBase)Activator.CreateInstance(t);
var tTestClassType = TypeOf.UG_GVMTestClass.MakeGenericType(TypeOf.Int32);
IGVMTest testClass = (IGVMTest)Activator.CreateInstance(tTestClassType);
Assert.AreEqual(TypeOf.Int32.ToString() + TypeOf.Int16.ToString(), o.CallGvm(testClass));
var tTestStructType = TypeOf.UG_GVMTestClass.MakeGenericType(TypeOf.Double);
IGVMTest testStruct = (IGVMTest)Activator.CreateInstance(tTestStructType);
Assert.AreEqual(TypeOf.Double.ToString() + TypeOf.Int16.ToString(), o.CallGvm(testStruct));
}
}
}
namespace PartialUSC
{
public class TestVirtualCallsBase
{
public virtual void TestVirtualCall0(object o) { }
public virtual void TestVirtualCall1(object o, string instTypeName) { }
public virtual void TestVirtualCall2(object o, string instTypeName) { }
public virtual void TestVirtualCall3(object o, bool TAndUAreTheSame, string instTypeName) { }
public virtual void TestVirtualCall4(object o, string instTypeName) { }
}
public class UCGTestVirtualCalls<T, U> : TestVirtualCallsBase
{
public override void TestVirtualCall0(object o)
{
VerifyCallResult(((Base<T>)o).Method1(), "Base<" + typeof(T) + ">.Method1");
VerifyCallResult(((Base<T>)o).Method2(), "Base<" + typeof(T) + ">.Method2");
VerifyCallResult(((Base<T>)o).Method3(), "Base<" + typeof(T) + ">.Method3");
}
public override void TestVirtualCall1(object o, string instTypeName)
{
VerifyCallResult(((IBase<T, U>)o).Method4(), instTypeName + ".Method4");
VerifyCallResult(((IBase<T, U>)o).Method5(), instTypeName + ".Method5");
VerifyCallResult(((IBase<T, U>)o).Method6(), instTypeName + ".Method6");
}
public override void TestVirtualCall2(object o, string instTypeName)
{
VerifyCallResult(((Derived<T, U>)o).Method1(), instTypeName + ".Method1");
VerifyCallResult(((Derived<T, U>)o).Method2(), instTypeName + ".Method2");
VerifyCallResult(((Derived<T, U>)o).Method3(), instTypeName + ".Method3");
VerifyCallResult(((Derived<T, U>)o).Method4(), instTypeName + ".Method4");
VerifyCallResult(((Derived<T, U>)o).Method5(), instTypeName + ".Method5");
VerifyCallResult(((Derived<T, U>)o).Method6(), instTypeName + ".Method6");
}
public override void TestVirtualCall3(object o, bool TAndUAreTheSame, string instTypeName)
{
if (TAndUAreTheSame)
{
VerifyCallResult(((Derived2<T, T>)o).Method1(), instTypeName + ".Method1");
VerifyCallResult(((Derived2<T, T>)o).Method2(), instTypeName + ".Method2");
VerifyCallResult(((Derived2<T, T>)o).Method3(), instTypeName + ".Method3");
VerifyCallResult(((Derived2<T, T>)o).Method4(), instTypeName + ".Method4");
VerifyCallResult(((Derived2<T, T>)o).Method5(), instTypeName + ".Method5");
VerifyCallResult(((Derived2<T, T>)o).Method6(), instTypeName + ".Method6");
}
else
{
VerifyCallResult(((Derived2<T, U>)o).Method1(), instTypeName + ".Method1");
VerifyCallResult(((Derived2<T, U>)o).Method2(), instTypeName + ".Method2");
VerifyCallResult(((Derived2<T, U>)o).Method3(), instTypeName + ".Method3");
VerifyCallResult(((Derived2<T, U>)o).Method4(), instTypeName + ".Method4");
VerifyCallResult(((Derived2<T, U>)o).Method5(), instTypeName + ".Method5");
VerifyCallResult(((Derived2<T, U>)o).Method6(), instTypeName + ".Method6");
}
}
public override void TestVirtualCall4(object o, string instTypeName)
{
((Derived3<T, T>)o).Method1();
((Derived3<T, T>)o).Method2();
((Derived3<T, T>)o).Method3();
((Derived3<T, T>)o).Method4();
((Derived3<T, T>)o).Method5();
((Derived3<T, T>)o).Method6();
}
private void VerifyCallResult(string result, string expected)
{
Assert.AreEqual(result, expected);
}
}
#pragma warning disable 0114
public class Base<T>
{
public virtual string Method1() { return "Base<" + typeof(T) + ">.Method1"; }
public virtual string Method2() { return "Base<" + typeof(T) + ">.Method2"; }
public virtual string Method3() { return "Base<" + typeof(T) + ">.Method3"; }
}
public interface IBase<T, U>
{
string Method4();
string Method5();
string Method6();
}
public class Derived<T, U> : Base<T>, IBase<T, U>
{
public virtual string Method1() { return "Derived<" + typeof(T) + "," + typeof(U) + ">.Method1"; }
public virtual string Method2() { return "Derived<" + typeof(T) + "," + typeof(U) + ">.Method2"; }
public virtual string Method3() { return "Derived<" + typeof(T) + "," + typeof(U) + ">.Method3"; }
public virtual string Method4() { return "Derived<" + typeof(T) + "," + typeof(U) + ">.Method4"; }
public virtual string Method5() { return "Derived<" + typeof(T) + "," + typeof(U) + ">.Method5"; }
public virtual string Method6() { return "Derived<" + typeof(T) + "," + typeof(U) + ">.Method6"; }
}
public class Derived2<T, U> : Derived<T, int>
{
public override string Method1() { return "Derived2<" + typeof(T) + "," + typeof(U) + ">.Method1"; }
public override string Method2() { return "Derived2<" + typeof(T) + "," + typeof(U) + ">.Method2"; }
public override string Method3() { return "Derived2<" + typeof(T) + "," + typeof(U) + ">.Method3"; }
public override string Method4() { return "Derived2<" + typeof(T) + "," + typeof(U) + ">.Method4"; }
public override string Method5() { return "Derived2<" + typeof(T) + "," + typeof(U) + ">.Method5"; }
public override string Method6() { return "Derived2<" + typeof(T) + "," + typeof(U) + ">.Method6"; }
}
public class Derived3<T, U> : Derived2<T, Type>
{
public virtual string Method1() { return "Derived3<" + typeof(T) + "," + typeof(U) + ">.Method1"; }
public virtual string Method2() { return "Derived3<" + typeof(T) + "," + typeof(U) + ">.Method2"; }
public virtual string Method3() { return "Derived3<" + typeof(T) + "," + typeof(U) + ">.Method3"; }
public virtual string Method4() { return "Derived3<" + typeof(T) + "," + typeof(U) + ">.Method4"; }
public virtual string Method5() { return "Derived3<" + typeof(T) + "," + typeof(U) + ">.Method5"; }
public virtual string Method6() { return "Derived3<" + typeof(T) + "," + typeof(U) + ">.Method6"; }
}
#pragma warning restore 114
public struct MyStruct<T, U> { }
public class TestRelatedTypeCases { public virtual void DoTest() { } }
public class NullableCaseTest<T> : TestRelatedTypeCases
{
public override void DoTest()
{
MyStruct<T, T>? nullable = null;
Assert.IsFalse(nullable.HasValue);
nullable = new MyStruct<T, T>();
Assert.IsTrue(nullable.Value.Equals(default(MyStruct<T, T>)));
Assert.IsTrue(nullable.GetType().ToString() == "Nullable<MyStruct<" + typeof(T) + "," + typeof(T) + ">>");
MyStruct<T, int>? nullable2 = null;
Assert.IsFalse(nullable2.HasValue);
nullable2 = new MyStruct<T, int>();
Assert.IsTrue(nullable2.Value.Equals(default(MyStruct<T, int>)));
Assert.IsTrue(nullable2.GetType().ToString() == "Nullable<MyStruct<" + typeof(T) + ",System.Int32>>");
}
}
public class ArrayCaseTest<T> : TestRelatedTypeCases
{
public override void DoTest()
{
MyStruct<T, T>[] arr1 = new MyStruct<T, T>[] { };
MyStruct<T, long>[] arr2 = new MyStruct<T, long>[] { };
MyStruct<object, T>[] arr3 = new MyStruct<object, T>[] { };
}
}
public class CustomCollection<V> : System.Collections.ObjectModel.KeyedCollection<V, System.Collections.DictionaryEntry>
{
public CustomCollection()
{
}
public CustomCollection(System.Collections.Generic.IEqualityComparer<V> comparer)
: base(comparer)
{
}
protected override V GetKeyForItem(System.Collections.DictionaryEntry entry)
{
return (V)((object)entry.Key);
}
}
public class Test
{
[TestMethod]
public static void TestVirtualCallsPartialUSGVTableMismatch()
{
Type collectionType = typeof(CustomCollection<>).MakeGenericType(TypeOf.Short);
var collection = Activator.CreateInstance(collectionType);
MethodInfo GetKeyForItem = collectionType.GetTypeInfo().GetDeclaredMethod("GetKeyForItem");
short result = (short)GetKeyForItem.Invoke(collection, new object[] { new DictionaryEntry((short)123, "abc") });
Assert.IsTrue(result == (short)123);
}
[TestMethod]
public static void TestVirtualCalls()
{
for (int i = 0; i < 10; i++)
{
foreach (var typeArg in new Type[] { TypeOf.Short, TypeOf.String, TypeOf.CommonType1, typeof(List<int>) })
{
{
var t = TypeOf.PCT_UCGTestVirtualCalls.MakeGenericType(typeArg, typeArg);
TestVirtualCallsBase caller = (TestVirtualCallsBase)Activator.CreateInstance(t);
var obj = Activator.CreateInstance(TypeOf.PCT_Derived.MakeGenericType(typeArg, typeArg));
caller.TestVirtualCall0(obj);
caller.TestVirtualCall1(obj, "Derived<" + typeArg + "," + typeArg + ">");
caller.TestVirtualCall2(obj, "Derived<" + typeArg + "," + typeArg + ">");
try { caller.TestVirtualCall3(obj, true, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
try { caller.TestVirtualCall3(obj, false, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
try { caller.TestVirtualCall4(obj, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
}
{
var t = TypeOf.PCT_UCGTestVirtualCalls.MakeGenericType(typeArg, TypeOf.Int32);
TestVirtualCallsBase caller = (TestVirtualCallsBase)Activator.CreateInstance(t);
var obj = Activator.CreateInstance(TypeOf.PCT_Derived2.MakeGenericType(typeArg, typeArg));
caller.TestVirtualCall0(obj);
caller.TestVirtualCall1(obj, "Derived2<" + typeArg + "," + typeArg + ">");
caller.TestVirtualCall2(obj, "Derived2<" + typeArg + "," + typeArg + ">");
caller.TestVirtualCall3(obj, true, "Derived2<" + typeArg + "," + typeArg + ">");
try { caller.TestVirtualCall3(obj, false, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
try { caller.TestVirtualCall4(obj, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
}
{
var t_int = TypeOf.PCT_UCGTestVirtualCalls.MakeGenericType(typeArg, TypeOf.Int32);
var t_type = TypeOf.PCT_UCGTestVirtualCalls.MakeGenericType(typeArg, TypeOf.Type);
TestVirtualCallsBase caller_int = (TestVirtualCallsBase)Activator.CreateInstance(t_int);
TestVirtualCallsBase caller_type = (TestVirtualCallsBase)Activator.CreateInstance(t_type);
var obj = Activator.CreateInstance(TypeOf.PCT_Derived3.MakeGenericType(typeArg, typeArg));
caller_int.TestVirtualCall0(obj);
caller_type.TestVirtualCall0(obj);
caller_int.TestVirtualCall1(obj, "Derived2<" + typeArg + "," + TypeOf.Type + ">");
try { caller_type.TestVirtualCall1(obj, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
caller_int.TestVirtualCall2(obj, "Derived2<" + typeArg + "," + TypeOf.Type + ">");
try { caller_type.TestVirtualCall2(obj, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
caller_type.TestVirtualCall3(obj, false, "Derived2<" + typeArg + "," + TypeOf.Type + ">");
try { caller_type.TestVirtualCall3(obj, true, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
try { caller_int.TestVirtualCall3(obj, false, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
try { caller_int.TestVirtualCall3(obj, true, ""); Assert.IsTrue(false); }
catch (InvalidCastException) { }
caller_int.TestVirtualCall4(obj, "Derived3<" + typeArg + "," + typeArg + ">");
caller_type.TestVirtualCall4(obj, "Derived3<" + typeArg + "," + typeArg + ">");
}
#if false
// Bug with callsite address with the nullable test case...
{
var t = TypeOf.PCT_NullableCaseTest.MakeGenericType(typeArg);
TestRelatedTypeCases caller = (TestRelatedTypeCases)Activator.CreateInstance(t);
caller.DoTest();
t = TypeOf.PCT_ArrayCaseTest.MakeGenericType(typeArg);
caller = (TestRelatedTypeCases)Activator.CreateInstance(t);
caller.DoTest();
}
#endif
}
}
}
}
}
namespace VirtualCalls
{
public class TestClass { }
public struct TestStruct { }
public class TestVirtualCallsBase
{
public virtual void TestVirtualCallNonGenericInstance(object o) { }
public virtual void TestVirtualCallStaticallyCompiledGenericInstance(object o1, object o2) { }
public virtual void TestUniversalGenericMethodCallOnNonUniversalContainingType() { }
public virtual void TestVirtualCall(object o, object value) { }
public virtual void TestVirtualCallUsingDelegates(object o, object value)
{
// TODO
// Not working today. Requires the following:
// 1) Fix instantiation problem with universal canonical types. Example: Foo<T, string>
// could create types like Foo<__UniversalCanon, string>, which are incorrect conceptually
// 2) Fix NUTC to emit the LOAD_VIRTUAL_FUNCTION opcode for delegates using runtime determined tokens
// like Foo<!0>.Method instead of Foo<__UC>.Method (otherwise binder fails with an assert)
}
}
public class UCGTestVirtualCalls<T> : TestVirtualCallsBase
{
public override void TestVirtualCallNonGenericInstance(object o)
{
NonGenBase obj = (NonGenBase)o;
Func<string> del1 = obj.Method1;
Func<string> del2 = obj.Method2;
Func<string> del3 = obj.Method3;
if (o.GetType() == typeof(NonGenBase))
{
Assert.AreEqual(obj.Method1(), "NonGenBase.Method1");
Assert.AreEqual(obj.Method2(), "NonGenBase.Method2");
Assert.AreEqual(obj.Method3(), "NonGenBase.Method3");
Assert.AreEqual(del1(), "NonGenBase.Method1");
Assert.AreEqual(del2(), "NonGenBase.Method2");
Assert.AreEqual(del3(), "NonGenBase.Method3");
}
else
{
Assert.AreEqual(obj.Method1(), "NonGenDerived.Method1");
Assert.AreEqual(obj.Method2(), "NonGenDerived.Method2");
Assert.AreEqual(obj.Method3(), "NonGenDerived.Method3");
Assert.AreEqual(del1(), "NonGenDerived.Method1");
Assert.AreEqual(del2(), "NonGenDerived.Method2");
Assert.AreEqual(del3(), "NonGenDerived.Method3");
}
}
public override void TestVirtualCallStaticallyCompiledGenericInstance(object o1, object o2)
{
string result;
// Static non-shareable instantiation
result = ((Base<double>)o1).Method1(1.23);
VerifyCallResult<double>(result, "Method1", o1);
result = ((Base<double>)o1).Method2(1.23);
VerifyCallResult<double>(result, "Method2", o1);
result = ((Base<double>)o1).Method3(1.23);
VerifyCallResult<double>(result, "Method3", o1);
result = ((Derived<double>)o1).Method1(1.23);
VerifyCallResult<double>(result, "Method1", o1);
result = ((Derived<double>)o1).Method2(1.23);
VerifyCallResult<double>(result, "Method2", o1);
result = ((Derived<double>)o1).Method3(1.23);
VerifyCallResult<double>(result, "Method3", o1);
result = ((Derived<double>)o1).Method4(1.23);
VerifyCallResult<double>(result, "Method4", o1);
result = ((Derived<double>)o1).Method5(1.23);
VerifyCallResult<double>(result, "Method5", o1);
result = ((Derived<double>)o1).Method6(1.23);
VerifyCallResult<double>(result, "Method6", o1);
// Static normal canonical-shareable instantiation
result = ((Base<Type>)o2).Method1(this.GetType());
VerifyCallResult<Type>(result, "Method1", o2);
result = ((Base<Type>)o2).Method2(this.GetType());
VerifyCallResult<Type>(result, "Method2", o2);
result = ((Base<Type>)o2).Method3(this.GetType());
VerifyCallResult<Type>(result, "Method3", o2);
result = ((Derived<Type>)o2).Method1(this.GetType());
VerifyCallResult<Type>(result, "Method1", o2);
result = ((Derived<Type>)o2).Method2(this.GetType());
VerifyCallResult<Type>(result, "Method2", o2);
result = ((Derived<Type>)o2).Method3(this.GetType());
VerifyCallResult<Type>(result, "Method3", o2);
result = ((Derived<Type>)o2).Method4(this.GetType());
VerifyCallResult<Type>(result, "Method4", o2);
result = ((Derived<Type>)o2).Method5(this.GetType());
VerifyCallResult<Type>(result, "Method5", o2);
result = ((Derived<Type>)o2).Method6(this.GetType());
VerifyCallResult<Type>(result, "Method6", o2);
}
public override void TestUniversalGenericMethodCallOnNonUniversalContainingType()
{
string result;
var obj1 = new UCGTestVirtualCalls<TestClass>();
result = obj1.GenericMethod<T>();
Assert.AreEqual(result, "UCGTestVirtualCalls<TestClass>.GenericMethod<" + typeof(T).Name + ">");
result = UCGTestVirtualCalls<TestClass>.StaticGenericMethod<T>();
Assert.AreEqual(result, "UCGTestVirtualCalls<TestClass>.StaticGenericMethod<" + typeof(T).Name + ">");
var obj2 = new UCGTestVirtualCalls<TestStruct>();
result = obj2.GenericMethod<T>();
Assert.AreEqual(result, "UCGTestVirtualCalls<TestStruct>.GenericMethod<" + typeof(T).Name + ">");
result = UCGTestVirtualCalls<TestStruct>.StaticGenericMethod<T>();
Assert.AreEqual(result, "UCGTestVirtualCalls<TestStruct>.StaticGenericMethod<" + typeof(T).Name + ">");
}
string GenericMethod<ARG>() { return "UCGTestVirtualCalls<" + typeof(T).Name + ">.GenericMethod<" + typeof(ARG).Name + ">"; }
static string StaticGenericMethod<ARG>() { return "UCGTestVirtualCalls<" + typeof(T).Name + ">.StaticGenericMethod<" + typeof(ARG).Name + ">"; }
public override void TestVirtualCall(object o, object value)
{
string result;
result = ((Base<T>)o).Method1((T)value);
VerifyCallResult<T>(result, "Method1", o);
result = ((Base<T>)o).Method2((T)value);
VerifyCallResult<T>(result, "Method2", o);
result = ((Base<T>)o).Method3((T)value);
VerifyCallResult<T>(result, "Method3", o);
result = ((Derived<T>)o).Method1((T)value);
VerifyCallResult<T>(result, "Method1", o);
result = ((Derived<T>)o).Method2((T)value);
VerifyCallResult<T>(result, "Method2", o);
result = ((Derived<T>)o).Method3((T)value);
VerifyCallResult<T>(result, "Method3", o);
result = ((Derived<T>)o).Method4((T)value);
VerifyCallResult<T>(result, "Method4", o);
result = ((Derived<T>)o).Method5((T)value);
VerifyCallResult<T>(result, "Method5", o);
result = ((Derived<T>)o).Method6((T)value);
VerifyCallResult<T>(result, "Method6", o);
result = ((Base<T>)o).Method1(default(T));
VerifyCallResult<T>(result, "Method1", o);
result = ((Base<T>)o).Method2(default(T));
VerifyCallResult<T>(result, "Method2", o);
result = ((Base<T>)o).Method3(default(T));
VerifyCallResult<T>(result, "Method3", o);
result = ((Derived<T>)o).Method1(default(T));
VerifyCallResult<T>(result, "Method1", o);
result = ((Derived<T>)o).Method2(default(T));
VerifyCallResult<T>(result, "Method2", o);
result = ((Derived<T>)o).Method3(default(T));
VerifyCallResult<T>(result, "Method3", o);
result = ((Derived<T>)o).Method4(default(T));
VerifyCallResult<T>(result, "Method4", o);
result = ((Derived<T>)o).Method5(default(T));
VerifyCallResult<T>(result, "Method5", o);
result = ((Derived<T>)o).Method6(default(T));
VerifyCallResult<T>(result, "Method6", o);
}
void VerifyCallResult<ARG>(string result, string methodName, object o)
{
string expected = "";
if (o.GetType().ToString().Contains("Derived_NoOverride"))
{
if (methodName == "Method1" || methodName == "Method2" || methodName == "Method3")
expected = "Base<" + typeof(ARG) + ">." + methodName;
else
expected = "Derived<" + typeof(ARG) + ">." + methodName;
}
else expected = "Derived_WithOverride<" + typeof(ARG) + ">." + methodName;
Assert.AreEqual(result, expected);
}
}
public class NonGenBase
{
public virtual string Method1() { return "NonGenBase.Method1"; }
public virtual string Method2() { return "NonGenBase.Method2"; }
public virtual string Method3() { return "NonGenBase.Method3"; }
}
public class NonGenDerived : NonGenBase
{
public override string Method1() { return "NonGenDerived.Method1"; }
public override string Method2() { return "NonGenDerived.Method2"; }
public override string Method3() { return "NonGenDerived.Method3"; }
}
public class Base<T>
{
public virtual string Method1(T t) { return "Base<" + typeof(T) + ">.Method1"; }
public virtual string Method2(T t) { return "Base<" + typeof(T) + ">.Method2"; }
public virtual string Method3(T t) { return "Base<" + typeof(T) + ">.Method3"; }
}
public class Derived<T> : Base<T>
{
public virtual string Method4(T t) { return "Derived<" + typeof(T) + ">.Method4"; }
public virtual string Method5(T t) { return "Derived<" + typeof(T) + ">.Method5"; }
public virtual string Method6(T t) { return "Derived<" + typeof(T) + ">.Method6"; }
}
#pragma warning disable 114 // 'method' hides inherited member 'method'
public class Derived_NoOverride<T> : Derived<T>
{
public virtual string Method1(T t) { return "Derived_NoOverride<" + typeof(T) + ">.Method1"; }
public virtual string Method2(T t) { return "Derived_NoOverride<" + typeof(T) + ">.Method2"; }
public virtual string Method3(T t) { return "Derived_NoOverride<" + typeof(T) + ">.Method3"; }
public virtual string Method4(T t) { return "Derived_NoOverride<" + typeof(T) + ">.Method4"; }
public virtual string Method5(T t) { return "Derived_NoOverride<" + typeof(T) + ">.Method5"; }
public virtual string Method6(T t) { return "Derived_NoOverride<" + typeof(T) + ">.Method6"; }
}
#pragma warning restore 114
public class Derived_WithOverride<T> : Derived<T>
{
public override string Method1(T t) { return "Derived_WithOverride<" + typeof(T) + ">.Method1"; }
public override string Method2(T t) { return "Derived_WithOverride<" + typeof(T) + ">.Method2"; }
public override string Method3(T t) { return "Derived_WithOverride<" + typeof(T) + ">.Method3"; }
public override string Method4(T t) { return "Derived_WithOverride<" + typeof(T) + ">.Method4"; }
public override string Method5(T t) { return "Derived_WithOverride<" + typeof(T) + ">.Method5"; }
public override string Method6(T t) { return "Derived_WithOverride<" + typeof(T) + ">.Method6"; }
}
public class Test
{
[TestMethod]
public static void TestVirtualCalls()
{
var rootingStaticInstantiation1 = new UCGTestVirtualCalls<long>();
var rootingStaticInstantiation2 = new UCGTestVirtualCalls<List<int>>();
for (int i = 0; i < 10; i++)
{
foreach (var typeArg in new Type[] { TypeOf.Short, TypeOf.String, TypeOf.Long, typeof(List<int>) })
{
object value = null;
if (typeArg == TypeOf.Short)
value = (short)123;
else if (typeArg == TypeOf.String)
value = "456";
else if (typeArg == TypeOf.Long)
value = (long)789;
else if (typeArg == typeof(List<int>))
value = new List<int>();
var t = TypeOf.VCT_UCGTestVirtualCalls.MakeGenericType(typeArg);
TestVirtualCallsBase caller = (TestVirtualCallsBase)Activator.CreateInstance(t);
var obj = Activator.CreateInstance(TypeOf.VCT_Derived_NoOverride.MakeGenericType(typeArg));
caller.TestVirtualCall(obj, value);
caller.TestVirtualCallUsingDelegates(obj, value);
caller.TestVirtualCallNonGenericInstance(new NonGenBase());
caller.TestVirtualCallStaticallyCompiledGenericInstance(new Derived_NoOverride<double>(), new Derived_NoOverride<Type>());
caller.TestUniversalGenericMethodCallOnNonUniversalContainingType();
obj = Activator.CreateInstance(TypeOf.VCT_Derived_WithOverride.MakeGenericType(typeArg));
caller.TestVirtualCall(obj, value);
caller.TestVirtualCallUsingDelegates(obj, value);
caller.TestVirtualCallNonGenericInstance(new NonGenDerived());
caller.TestVirtualCallStaticallyCompiledGenericInstance(new Derived_WithOverride<double>(), new Derived_WithOverride<Type>());
caller.TestUniversalGenericMethodCallOnNonUniversalContainingType();
}
}
}
}
}
namespace CallingConvention
{
public class Foo<T>
{
public int _value;
}
public struct Bar<T>
{
public int _value;
}
public unsafe interface IBase<T>
{
void SimpleFunc(T tval);
T VirtualCoolFunc(object o, Bar<T> b, Foo<T> f, T[] a, T t_val, ref T brt_val, ref T brt_default, int index, int* ptr, int** ptrptr, ref int* brptr);
}
public unsafe class CCTester<T> : IBase<T>
{
public virtual void SimpleFunc(T tval)
{
Assert.AreEqual(tval.ToString(), Test.s_expectedT.ToString());
}
public virtual T VirtualCoolFunc(object o, Bar<T> b, Foo<T> f, T[] a, T t_val, ref T brt_val, ref T brt_default, int index, int* ptr, int** ptrptr, ref int* brptr)
{
Assert.AreEqual(o, "Hello");
Assert.AreEqual(b._value, 1);
Assert.AreEqual(f._value, 2);
Assert.AreEqual(a[0], brt_val);
Assert.AreEqual(brt_default, default(T));
Assert.AreEqual(index, 123);
Assert.IsTrue(ptr == ((int*)456));
Assert.IsTrue(ptrptr == ((int**)789));
Assert.IsTrue(brptr == ((int*)159));
brt_val = brt_default;
brt_default = t_val;
brptr = ptr;
return t_val;
}
}
public interface ITestCallInterface<T>
{
void M(T t);
}
public class TestCallInterfaceImpl : ITestCallInterface<short>
{
public void M(short s)
{
TestInterfaceUseBase.ShortValue = s;
Console.WriteLine("In M(" + s + ")");
}
}
public class TestInterfaceUseBase
{
public static short ShortValue;
public virtual void TestUseInterface(object o, object value) { }
}
public class UCGTestUseInterface<T> : TestInterfaceUseBase
{
public override void TestUseInterface(object o, object value)
{
for (int i = 0; i < 10; i++)
{
((ITestCallInterface<T>)o).M((T)value);
}
}
}
public class TestNonVirtualFunctionCallUseBase
{
public virtual object TestNonVirtualInstanceFunction(object o, object value) { return null; }
}
public class UCGSeperateClass<T>
{
[MethodImpl(MethodImplOptions.NoInlining)]
public object BoxParam(T t)
{
return (object)t;
}
}
public class UCGTestNonVirtualFunctionCallUse<T> : TestNonVirtualFunctionCallUseBase
{
public override object TestNonVirtualInstanceFunction(object o, object value)
{
return ((UCGSeperateClass<T>)o).BoxParam((T)value);
}
}
#region Calling convention converter test with structs of known/unknown sizes
public class EmptyClass<T>
{
public override string ToString() { return "EmptyClass<" + typeof(T).Name + ">"; }
}
public class ClassWithTField<T>
{
T _field1;
public ClassWithTField(T f) { _field1 = f; }
public override string ToString() { return "ClassWithTField<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}"; }
}
public struct StructWithTField<T>
{
T _field1;
public StructWithTField(T f) { _field1 = f; }
public override string ToString() { return "StructWithTField<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}"; }
}
public struct TestStructKnownSize<T>
{
EmptyClass<T> _field1;
ClassWithTField<T> _field2;
internal TestStructKnownSize(EmptyClass<T> l, T tValue) { _field1 = l; _field2 = new ClassWithTField<T>(tValue); }
public override string ToString() { return "TestStructKnownSize<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}. _field2 = {" + _field2.ToString() + "}"; }
}
public struct TestStructIndeterminateSize<T>
{
EmptyClass<T> _field1;
StructWithTField<T> _field2;
internal TestStructIndeterminateSize(EmptyClass<T> l, T tValue) { _field1 = l; _field2 = new StructWithTField<T>(tValue); }
public override string ToString() { return "TestStructIndeterminateSize<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}. _field2 = {" + _field2.ToString() + "}"; }
}
public struct StructWithOneField1<T>
{
MainClass<T, T> _field1;
internal StructWithOneField1(MainClass<T, T> f) { _field1 = f; }
public override string ToString() { return "StructWithOneField1<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}"; }
}
public struct StructWithOneField2<T>
{
ClassWithTField<T> _field1;
internal StructWithOneField2(ClassWithTField<T> f) { _field1 = f; }
public override string ToString() { return "StructWithOneField2<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}"; }
}
public struct StructWithOneField3<T>
{
StructWithTField<T> _field1;
internal StructWithOneField3(StructWithTField<T> f) { _field1 = f; }
public override string ToString() { return "StructWithOneField3<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}"; }
}
public struct StructWithTwoFields1<T>
{
MainClass<T, T> _field1;
TestStructKnownSize<T> _field2;
internal StructWithTwoFields1(MainClass<T, T> f, T tValue) { _field1 = f; _field2 = new TestStructKnownSize<T>(new EmptyClass<T>(), tValue); }
public override string ToString() { return "StructWithTwoFields1<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}. _field2 = {" + _field2.ToString() + "}"; }
}
public struct StructWithTwoFields2<T>
{
MainClass<T, T> _field1;
TestStructIndeterminateSize<T> _field2;
internal StructWithTwoFields2(MainClass<T, T> f, T tValue) { _field1 = f; _field2 = new TestStructIndeterminateSize<T>(new EmptyClass<T>(), tValue); }
public override string ToString() { return "StructWithTwoFields2<" + typeof(T).Name + ">. _field1 = {" + _field1.ToString() + "}. _field2 = {" + _field2.ToString() + "}"; }
}
public struct StructWithTwoGenParams<T, U>
{
T _field1;
public StructWithTwoGenParams(T t) { _field1 = t; }
public override string ToString() { return "StructWithTwoGenParams<" + typeof(T) + "," + typeof(U) + ">. _field1 = {" + _field1.ToString() + "}"; }
}
// No fields depending on type U in the following structs (on purpose)
public struct StructWithOneFieldTwoGenParams1<T, U>
{
MainClass<T, T> _field1;
internal StructWithOneFieldTwoGenParams1(MainClass<T, T> f) { _field1 = f; }
public override string ToString() { return "StructWithOneFieldTwoGenParams1<" + typeof(T) + "," + typeof(U) +">. _field1 = {" + _field1.ToString() + "}"; }
}
public struct StructWithOneFieldTwoGenParams2<T, U>
{
ClassWithTField<T> _field1;
internal StructWithOneFieldTwoGenParams2(ClassWithTField<T> f) { _field1 = f; }
public override string ToString() { return "StructWithOneFieldTwoGenParams2<" + typeof(T) + "," + typeof(U) + ">. _field1 = {" + _field1.ToString() + "}"; }
}
public struct StructWithOneFieldTwoGenParams3<T, U>
{
StructWithTField<T> _field1;
internal StructWithOneFieldTwoGenParams3(StructWithTField<T> f) { _field1 = f; }
public override string ToString() { return "StructWithOneFieldTwoGenParams3<" + typeof(T) + "," + typeof(U) + ">. _field1 = {" + _field1.ToString() + "}"; }
}
public struct StructWithTwoFieldsTwoGenParams1<T, U>
{
MainClass<T, T> _field1;
TestStructKnownSize<T> _field2;
internal StructWithTwoFieldsTwoGenParams1(MainClass<T, T> f, T tValue) { _field1 = f; _field2 = new TestStructKnownSize<T>(new EmptyClass<T>(), tValue); }
public override string ToString() { return "StructWithTwoFieldsTwoGenParams1<" + typeof(T) + "," + typeof(U) + ">. _field1 = {" + _field1.ToString() + "}. _field2 = {" + _field2.ToString() + "}"; }
}
public struct StructWithTwoFieldsTwoGenParams2<T, U>
{
MainClass<T, T> _field1;
TestStructIndeterminateSize<T> _field2;
internal StructWithTwoFieldsTwoGenParams2(MainClass<T, T> f, T tValue) { _field1 = f; _field2 = new TestStructIndeterminateSize<T>(new EmptyClass<T>(), tValue); }
public override string ToString() { return "StructWithTwoFieldsTwoGenParams2<" + typeof(T) + "," + typeof(U) + ">. _field1 = {" + _field1.ToString() + "}. _field2 = {" + _field2.ToString() + "}"; }
}
public class MainClass<T, U>
{
string _id = null;
T _tValue = default(T);
static MainClass<T, T> _mainTT = null;
public MainClass() { }
private MainClass(string id, T tValue)
{
_id = id;
_tValue = tValue;
}
private MainClass<T, T> GetMainTT()
{
if (_mainTT == null)
{
_mainTT = new MainClass<T, T>();
_mainTT._id = this._id;
_mainTT._tValue = this._tValue;
}
return _mainTT;
}
public void SetID(string id) { _id = id; }
public void SetT(T tValue) { _tValue = tValue; }
public override string ToString() { return "MainClass<" + typeof(T).Name + ">. _id = {" + _id.ToString() + "}. _tValue = {" + _tValue.ToString() + "}"; }
public ClassWithTField<T> GetClassWithTField() { return new ClassWithTField<T>(_tValue); }
public ClassWithTField<T> PassthruClassWithTField(ClassWithTField<T> value) { return value; }
public delegate ClassWithTField<T> PassthruClassWithTFieldDelegate(MainClass<T, U> obj, ClassWithTField<T> value);
public object PassthruClassWithTFieldDelegateDirectCall(MainClass<T, U> obj, ClassWithTField<T> value, PassthruClassWithTFieldDelegate del) { return del(obj, value); }
public StructWithTField<T> GetStructWithTField() { return new StructWithTField<T>(_tValue); }
public StructWithTField<T> PassthruStructWithTField(StructWithTField<T> value) { return value; }
public delegate StructWithTField<T> PassthruStructWithTFieldDelegate(MainClass<T, U> obj, StructWithTField<T> value);
public object PassthruStructWithTFieldDelegateDirectCall(MainClass<T, U> obj, StructWithTField<T> value, PassthruStructWithTFieldDelegate del) { return del(obj, value); }
public TestStructKnownSize<T> GetTestStructKnownSize() { return new TestStructKnownSize<T>(new EmptyClass<T>(), _tValue); }
public TestStructKnownSize<T> PassthruTestStructKnownSize(TestStructKnownSize<T> value) { return value; }
public delegate TestStructKnownSize<T> PassthruTestStructKnownSizeDelegate(MainClass<T, U> obj, TestStructKnownSize<T> value);
public object PassthruTestStructKnownSizeDelegateDirectCall(MainClass<T, U> obj, TestStructKnownSize<T> value, PassthruTestStructKnownSizeDelegate del) { return del(obj, value); }
public TestStructIndeterminateSize<T> GetTestStructIndeterminateSize() { return new TestStructIndeterminateSize<T>(new EmptyClass<T>(), _tValue); }
public TestStructIndeterminateSize<T> PassthruTestStructIndeterminateSize(TestStructIndeterminateSize<T> value) { return value; }
public delegate TestStructIndeterminateSize<T> PassthruTestStructIndeterminateSizeDelegate(MainClass<T, U> obj, TestStructIndeterminateSize<T> value);
public object PassthruTestStructIndeterminateSizeDelegateDirectCall(MainClass<T, U> obj, TestStructIndeterminateSize<T> value, PassthruTestStructIndeterminateSizeDelegate del) { return del(obj, value); }
public TestStructKnownSize<TestStructIndeterminateSize<T>> GetTestStructKnownSizeWrappingTestStructIndeterminateSize() { return new TestStructKnownSize<TestStructIndeterminateSize<T>>(new EmptyClass<TestStructIndeterminateSize<T>>(), new TestStructIndeterminateSize<T>(new EmptyClass<T>(), _tValue)); }
public TestStructKnownSize<TestStructIndeterminateSize<T>> PassthruTestStructKnownSizeWrappingTestStructIndeterminateSize(TestStructKnownSize<TestStructIndeterminateSize<T>> value) { return value; }
public delegate TestStructKnownSize<TestStructIndeterminateSize<T>> PassthruTestStructKnownSizeWrappingTestStructIndeterminateSizeDelegate(MainClass<T, U> obj, TestStructKnownSize<TestStructIndeterminateSize<T>> value);
public object PassthruTestStructKnownSizeWrappingTestStructIndeterminateSizeDelegateDirectCall(MainClass<T, U> obj, TestStructKnownSize<TestStructIndeterminateSize<T>> value, PassthruTestStructKnownSizeWrappingTestStructIndeterminateSizeDelegate del) { return del(obj, value); }
public TestStructIndeterminateSize<TestStructKnownSize<T>> GetTestStructIndeterminateSizeWrappingTestStructKnownSize() { return new TestStructIndeterminateSize<TestStructKnownSize<T>>(new EmptyClass<TestStructKnownSize<T>>(), new TestStructKnownSize<T>(new EmptyClass<T>(), _tValue)); }
public TestStructIndeterminateSize<TestStructKnownSize<T>> PassthruTestStructIndeterminateSizeWrappingTestStructKnownSize(TestStructIndeterminateSize<TestStructKnownSize<T>> value) { return value; }
public delegate TestStructIndeterminateSize<TestStructKnownSize<T>> PassthruTestStructIndeterminateSizeWrappingTestStructKnownSizeDelegate(MainClass<T, U> obj, TestStructIndeterminateSize<TestStructKnownSize<T>> value);
public object PassthruTestStructIndeterminateSizeWrappingTestStructKnownSizeDelegateDirectCall(MainClass<T, U> obj, TestStructIndeterminateSize<TestStructKnownSize<T>> value, PassthruTestStructIndeterminateSizeWrappingTestStructKnownSizeDelegate del) { return del(obj, value); }
public TestStructIndeterminateSize<TestStructKnownSize<ClassWithTField<T>>> GetTestStructIndeterminateSizeWrappingTestStructKnownSizeWrappingReferenceType() { return new TestStructIndeterminateSize<TestStructKnownSize<ClassWithTField<T>>>(new EmptyClass<TestStructKnownSize<ClassWithTField<T>>>(), new TestStructKnownSize<ClassWithTField<T>>(new EmptyClass<ClassWithTField<T>>(), new ClassWithTField<T>(_tValue))); }
public TestStructIndeterminateSize<TestStructKnownSize<ClassWithTField<T>>> PassthruTestStructIndeterminateSizeWrappingTestStructKnownSizeWrappingReferenceType(TestStructIndeterminateSize<TestStructKnownSize<ClassWithTField<T>>> value) { return value; }
public delegate TestStructIndeterminateSize<TestStructKnownSize<ClassWithTField<T>>> PassthruTestStructIndeterminateSizeWrappingTestStructKnownSizeWrappingReferenceTypeDelegate(MainClass<T, U> obj, TestStructIndeterminateSize<TestStructKnownSize<ClassWithTField<T>>> value);
public object PassthruTestStructIndeterminateSizeWrappingTestStructKnownSizeWrappingReferenceTypeDelegateDirectCall(MainClass<T, U> obj, TestStructIndeterminateSize<TestStructKnownSize<ClassWithTField<T>>> value, PassthruTestStructIndeterminateSizeWrappingTestStructKnownSizeWrappingReferenceTypeDelegate del) { return del(obj, value); }
public TestStructIndeterminateSize<TestStructIndeterminateSize<ClassWithTField<T>>> GetTestStructIndeterminateSizeWrappingTestStructIndeterminateSizeWrappingReferenceType() { return new TestStructIndeterminateSize<TestStructIndeterminateSize<ClassWithTField<T>>>(new EmptyClass<TestStructIndeterminateSize<ClassWithTField<T>>>(), new TestStructIndeterminateSize<ClassWithTField<T>>(new EmptyClass<ClassWithTField<T>>(), new ClassWithTField<T>(_tValue))); }
public TestStructIndeterminateSize<TestStructIndeterminateSize<ClassWithTField<T>>> PassthruTestStructIndeterminateSizeWrappingTestStructIndeterminateSizeWrappingReferenceType(TestStructIndeterminateSize<TestStructIndeterminateSize<ClassWithTField<T>>> value) { return value; }
public delegate TestStructIndeterminateSize<TestStructIndeterminateSize<ClassWithTField<T>>> PassthruTestStructIndeterminateSizeWrappingTestStructIndeterminateSizeWrappingReferenceTypeDelegate(MainClass<T, U> obj, TestStructIndeterminateSize<TestStructIndeterminateSize<ClassWithTField<T>>> value);
public object PassthruTestStructIndeterminateSizeWrappingTestStructIndeterminateSizeWrappingReferenceTypeDelegateDirectCall(MainClass<T, U> obj, TestStructIndeterminateSize<TestStructIndeterminateSize<ClassWithTField<T>>> value, PassthruTestStructIndeterminateSizeWrappingTestStructIndeterminateSizeWrappingReferenceTypeDelegate del) { return del(obj, value); }
public StructWithOneField1<T> GetStructWithOneField1() { return new StructWithOneField1<T>(GetMainTT()); }
public StructWithOneField1<T> PassthruStructWithOneField1(StructWithOneField1<T> value) { return value; }
public delegate StructWithOneField1<T> PassthruStructWithOneField1Delegate(MainClass<T, U> obj, StructWithOneField1<T> value);
public object PassthruStructWithOneField1DelegateDirectCall(MainClass<T, U> obj, StructWithOneField1<T> value, PassthruStructWithOneField1Delegate del) { return del(obj, value); }
public StructWithOneField2<T> GetStructWithOneField2() { return new StructWithOneField2<T>(new ClassWithTField<T>(_tValue)); }
public StructWithOneField2<T> PassthruStructWithOneField2(StructWithOneField2<T> value) { return value; }
public delegate StructWithOneField2<T> PassthruStructWithOneField2Delegate(MainClass<T, U> obj, StructWithOneField2<T> value);
public object PassthruStructWithOneField2DelegateDirectCall(MainClass<T, U> obj, StructWithOneField2<T> value, PassthruStructWithOneField2Delegate del) { return del(obj, value); }
public StructWithOneField3<T> GetStructWithOneField3() { return new StructWithOneField3<T>(new StructWithTField<T>(_tValue)); }
public StructWithOneField3<T> PassthruStructWithOneField3(StructWithOneField3<T> value) { return value; }
public delegate StructWithOneField3<T> PassthruStructWithOneField3Delegate(MainClass<T, U> obj, StructWithOneField3<T> value);
public object PassthruStructWithOneField3DelegateDirectCall(MainClass<T, U> obj, StructWithOneField3<T> value, PassthruStructWithOneField3Delegate del) { return del(obj, value); }
public StructWithTwoFields1<T> GetStructWithTwoFields1() { return new StructWithTwoFields1<T>(GetMainTT(), _tValue); }
public StructWithTwoFields1<T> PassthruStructWithTwoFields1(StructWithTwoFields1<T> value) { return value; }
public delegate StructWithTwoFields1<T> PassthruStructWithTwoFields1Delegate(MainClass<T, U> obj, StructWithTwoFields1<T> value);
public object PassthruStructWithTwoFields1DelegateDirectCall(MainClass<T, U> obj, StructWithTwoFields1<T> value, PassthruStructWithTwoFields1Delegate del) { return del(obj, value); }
public StructWithTwoFields2<T> GetStructWithTwoFields2() { return new StructWithTwoFields2<T>(GetMainTT(), _tValue); }
public StructWithTwoFields2<T> PassthruStructWithTwoFields2(StructWithTwoFields2<T> value) { return value; }
public delegate StructWithTwoFields2<T> PassthruStructWithTwoFields2Delegate(MainClass<T, U> obj, StructWithTwoFields2<T> value);
public object PassthruStructWithTwoFields2DelegateDirectCall(MainClass<T, U> obj, StructWithTwoFields2<T> value, PassthruStructWithTwoFields2Delegate del) { return del(obj, value); }
public StructWithTwoGenParams<int, T> GetStructWithTwoGenParams1() { return new StructWithTwoGenParams<int, T>(int.Parse(_id)); }
public StructWithTwoGenParams<int, T> PassthruStructWithTwoGenParams1(StructWithTwoGenParams<int, T> value) { return value; }
public delegate StructWithTwoGenParams<int, T> PassthruStructWithTwoGenParams1Delegate(MainClass<T, U> obj, StructWithTwoGenParams<int, T> value);
public object PassthruStructWithTwoGenParams1DelegateDirectCall(MainClass<T, U> obj, StructWithTwoGenParams<int, T> value, PassthruStructWithTwoGenParams1Delegate del) { return del(obj, value); }
public StructWithTwoGenParams<int, KeyValuePair<int, StructWithTwoGenParams<List<T>, T>>> GetStructWithTwoGenParams2() { return new StructWithTwoGenParams<int, KeyValuePair<int, StructWithTwoGenParams<List<T>, T>>>(int.Parse(_id)); }
public StructWithTwoGenParams<int, KeyValuePair<int, StructWithTwoGenParams<List<T>, T>>> PassthruStructWithTwoGenParams2(StructWithTwoGenParams<int, KeyValuePair<int, StructWithTwoGenParams<List<T>, T>>> value) { return value; }
public delegate StructWithTwoGenParams<int, KeyValuePair<int, StructWithTwoGenParams<List<T>, T>>> PassthruStructWithTwoGenParams2Delegate(MainClass<T, U> obj, StructWithTwoGenParams<int, KeyValuePair<int, StructWithTwoGenParams<List<T>, T>>> value);
public object PassthruStructWithTwoGenParams2DelegateDirectCall(MainClass<T, U> obj, StructWithTwoGenParams<int, KeyValuePair<int, StructWithTwoGenParams<List<T>, T>>> value, PassthruStructWithTwoGenParams2Delegate del) { return del(obj, value); }
public StructWithTwoGenParams<int, StructWithTwoGenParams<List<T>, KeyValuePair<T, T>>> GetStructWithTwoGenParams3() { return new StructWithTwoGenParams<int, StructWithTwoGenParams<List<T>, KeyValuePair<T, T>>>(int.Parse(_id)); }
public StructWithTwoGenParams<int, StructWithTwoGenParams<List<T>, KeyValuePair<T, T>>> PassthruStructWithTwoGenParams3(StructWithTwoGenParams<int, StructWithTwoGenParams<List<T>, KeyValuePair<T, T>>> value) { return value; }
public delegate StructWithTwoGenParams<int, StructWithTwoGenParams<List<T>, KeyValuePair<T, T>>> PassthruStructWithTwoGenParams3Delegate(MainClass<T, U> obj, StructWithTwoGenParams<int, StructWithTwoGenParams<List<T>, KeyValuePair<T, T>>> value);
public object PassthruStructWithTwoGenParams3DelegateDirectCall(MainClass<T, U> obj, StructWithTwoGenParams<int, StructWithTwoGenParams<List<T>, KeyValuePair<T, T>>> value, PassthruStructWithTwoGenParams3Delegate del) { return del(obj, value); }
public StructWithTwoGenParams<int, StructWithTwoGenParams<List<int>, KeyValuePair<int, string>>> GetStructWithTwoGenParams4() { return new StructWithTwoGenParams<int, StructWithTwoGenParams<List<int>, KeyValuePair<int, string>>>(int.Parse(_id)); }
public StructWithTwoGenParams<int, StructWithTwoGenParams<List<int>, KeyValuePair<int, string>>> PassthruStructWithTwoGenParams4(StructWithTwoGenParams<int, StructWithTwoGenParams<List<int>, KeyValuePair<int, string>>> value) { return value; }
public delegate StructWithTwoGenParams<int, StructWithTwoGenParams<List<int>, KeyValuePair<int, string>>> PassthruStructWithTwoGenParams4Delegate(MainClass<T, U> obj, StructWithTwoGenParams<int, StructWithTwoGenParams<List<int>, KeyValuePair<int, string>>> value);
public object PassthruStructWithTwoGenParams4DelegateDirectCall(MainClass<T, U> obj, StructWithTwoGenParams<int, StructWithTwoGenParams<List<int>, KeyValuePair<int, string>>> value, PassthruStructWithTwoGenParams4Delegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams1<T, T> GetStructWithOneFieldTwoGenParams1() { return new StructWithOneFieldTwoGenParams1<T, T>(GetMainTT()); }
public StructWithOneFieldTwoGenParams1<T, T> PassthruStructWithOneFieldTwoGenParams1(StructWithOneFieldTwoGenParams1<T, T> value) { return value; }
public delegate StructWithOneFieldTwoGenParams1<T, T> PassthruStructWithOneFieldTwoGenParams1Delegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams1<T, T> value);
public object PassthruStructWithOneFieldTwoGenParams1DelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams1<T, T> value, PassthruStructWithOneFieldTwoGenParams1Delegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams2<T, T> GetStructWithOneFieldTwoGenParams2() { return new StructWithOneFieldTwoGenParams2<T, T>(new ClassWithTField<T>(_tValue)); }
public StructWithOneFieldTwoGenParams2<T, T> PassthruStructWithOneFieldTwoGenParams2(StructWithOneFieldTwoGenParams2<T, T> value) { return value; }
public delegate StructWithOneFieldTwoGenParams2<T, T> PassthruStructWithOneFieldTwoGenParams2Delegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams2<T, T> value);
public object PassthruStructWithOneFieldTwoGenParams2DelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams2<T, T> value, PassthruStructWithOneFieldTwoGenParams2Delegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams3<T, T> GetStructWithOneFieldTwoGenParams3() { return new StructWithOneFieldTwoGenParams3<T, T>(new StructWithTField<T>(_tValue)); }
public StructWithOneFieldTwoGenParams3<T, T> PassthruStructWithOneFieldTwoGenParams3(StructWithOneFieldTwoGenParams3<T, T> value) { return value; }
public delegate StructWithOneFieldTwoGenParams3<T, T> PassthruStructWithOneFieldTwoGenParams3Delegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams3<T, T> value);
public object PassthruStructWithOneFieldTwoGenParams3DelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams3<T, T> value, PassthruStructWithOneFieldTwoGenParams3Delegate del) { return del(obj, value); }
public StructWithTwoFieldsTwoGenParams1<T, T> GetStructWithTwoFieldsTwoGenParams1() { return new StructWithTwoFieldsTwoGenParams1<T, T>(GetMainTT(), _tValue); }
public StructWithTwoFieldsTwoGenParams1<T, T> PassthruStructWithTwoFieldsTwoGenParams1(StructWithTwoFieldsTwoGenParams1<T, T> value) { return value; }
public delegate StructWithTwoFieldsTwoGenParams1<T, T> PassthruStructWithTwoFieldsTwoGenParams1Delegate(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams1<T, T> value);
public object PassthruStructWithTwoFieldsTwoGenParams1DelegateDirectCall(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams1<T, T> value, PassthruStructWithTwoFieldsTwoGenParams1Delegate del) { return del(obj, value); }
public StructWithTwoFieldsTwoGenParams2<T, T> GetStructWithTwoFieldsTwoGenParams2() { return new StructWithTwoFieldsTwoGenParams2<T, T>(GetMainTT(), _tValue); }
public StructWithTwoFieldsTwoGenParams2<T, T> PassthruStructWithTwoFieldsTwoGenParams2(StructWithTwoFieldsTwoGenParams2<T, T> value) { return value; }
public delegate StructWithTwoFieldsTwoGenParams2<T, T> PassthruStructWithTwoFieldsTwoGenParams2Delegate(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams2<T, T> value);
public object PassthruStructWithTwoFieldsTwoGenParams2DelegateDirectCall(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams2<T, T> value, PassthruStructWithTwoFieldsTwoGenParams2Delegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams1<T, float> GetStructWithOneFieldTwoGenParams1_KnownU() { return new StructWithOneFieldTwoGenParams1<T, float>(GetMainTT()); }
public StructWithOneFieldTwoGenParams1<T, float> PassthruStructWithOneFieldTwoGenParams1_KnownU(StructWithOneFieldTwoGenParams1<T, float> value) { return value; }
public delegate StructWithOneFieldTwoGenParams1<T, float> PassthruStructWithOneFieldTwoGenParams1_KnownUDelegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams1<T, float> value);
public object PassthruStructWithOneFieldTwoGenParams1_KnownUDelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams1<T, float> value, PassthruStructWithOneFieldTwoGenParams1_KnownUDelegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams2<T, float> GetStructWithOneFieldTwoGenParams2_KnownU() { return new StructWithOneFieldTwoGenParams2<T, float>(new ClassWithTField<T>(_tValue)); }
public StructWithOneFieldTwoGenParams2<T, float> PassthruStructWithOneFieldTwoGenParams2_KnownU(StructWithOneFieldTwoGenParams2<T, float> value) { return value; }
public delegate StructWithOneFieldTwoGenParams2<T, float> PassthruStructWithOneFieldTwoGenParams2_KnownUDelegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams2<T, float> value);
public object PassthruStructWithOneFieldTwoGenParams2_KnownUDelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams2<T, float> value, PassthruStructWithOneFieldTwoGenParams2_KnownUDelegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams3<T, float> GetStructWithOneFieldTwoGenParams3_KnownU() { return new StructWithOneFieldTwoGenParams3<T, float>(new StructWithTField<T>(_tValue)); }
public StructWithOneFieldTwoGenParams3<T, float> PassthruStructWithOneFieldTwoGenParams3_KnownU(StructWithOneFieldTwoGenParams3<T, float> value) { return value; }
public delegate StructWithOneFieldTwoGenParams3<T, float> PassthruStructWithOneFieldTwoGenParams3_KnownUDelegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams3<T, float> value);
public object PassthruStructWithOneFieldTwoGenParams3_KnownUDelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams3<T, float> value, PassthruStructWithOneFieldTwoGenParams3_KnownUDelegate del) { return del(obj, value); }
public StructWithTwoFieldsTwoGenParams1<T, float> GetStructWithTwoFieldsTwoGenParams1_KnownU() { return new StructWithTwoFieldsTwoGenParams1<T, float>(GetMainTT(), _tValue); }
public StructWithTwoFieldsTwoGenParams1<T, float> PassthruStructWithTwoFieldsTwoGenParams1_KnownU(StructWithTwoFieldsTwoGenParams1<T, float> value) { return value; }
public delegate StructWithTwoFieldsTwoGenParams1<T, float> PassthruStructWithTwoFieldsTwoGenParams1_KnownUDelegate(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams1<T, float> value);
public object PassthruStructWithTwoFieldsTwoGenParams1_KnownUDelegateDirectCall(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams1<T, float> value, PassthruStructWithTwoFieldsTwoGenParams1_KnownUDelegate del) { return del(obj, value); }
public StructWithTwoFieldsTwoGenParams2<T, float> GetStructWithTwoFieldsTwoGenParams2_KnownU() { return new StructWithTwoFieldsTwoGenParams2<T, float>(GetMainTT(), _tValue); }
public StructWithTwoFieldsTwoGenParams2<T, float> PassthruStructWithTwoFieldsTwoGenParams2_KnownU(StructWithTwoFieldsTwoGenParams2<T, float> value) { return value; }
public delegate StructWithTwoFieldsTwoGenParams2<T, float> PassthruStructWithTwoFieldsTwoGenParams2_KnownUDelegate(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams2<T, float> value);
public object PassthruStructWithTwoFieldsTwoGenParams2_KnownUDelegateDirectCall(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams2<T, float> value, PassthruStructWithTwoFieldsTwoGenParams2_KnownUDelegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams1<long, T> GetStructWithOneFieldTwoGenParams1_KnownT() { return new StructWithOneFieldTwoGenParams1<long, T>(new MainClass<long, long>("123", long.Parse(_id))); }
public StructWithOneFieldTwoGenParams1<long, T> PassthruStructWithOneFieldTwoGenParams1_KnownT(StructWithOneFieldTwoGenParams1<long, T> value) { return value; }
public delegate StructWithOneFieldTwoGenParams1<long, T> PassthruStructWithOneFieldTwoGenParams1_KnownTDelegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams1<long, T> value);
public object PassthruStructWithOneFieldTwoGenParams1_KnownTDelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams1<long, T> value, PassthruStructWithOneFieldTwoGenParams1_KnownTDelegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams2<long, T> GetStructWithOneFieldTwoGenParams2_KnownT() { return new StructWithOneFieldTwoGenParams2<long, T>(new ClassWithTField<long>(long.Parse(_id))); }
public StructWithOneFieldTwoGenParams2<long, T> PassthruStructWithOneFieldTwoGenParams2_KnownT(StructWithOneFieldTwoGenParams2<long, T> value) { return value; }
public delegate StructWithOneFieldTwoGenParams2<long, T> PassthruStructWithOneFieldTwoGenParams2_KnownTDelegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams2<long, T> value);
public object PassthruStructWithOneFieldTwoGenParams2_KnownTDelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams2<long, T> value, PassthruStructWithOneFieldTwoGenParams2_KnownTDelegate del) { return del(obj, value); }
public StructWithOneFieldTwoGenParams3<long, T> GetStructWithOneFieldTwoGenParams3_KnownT() { return new StructWithOneFieldTwoGenParams3<long, T>(new StructWithTField<long>(long.Parse(_id))); }
public StructWithOneFieldTwoGenParams3<long, T> PassthruStructWithOneFieldTwoGenParams3_KnownT(StructWithOneFieldTwoGenParams3<long, T> value) { return value; }
public delegate StructWithOneFieldTwoGenParams3<long, T> PassthruStructWithOneFieldTwoGenParams3_KnownTDelegate(MainClass<T, U> obj, StructWithOneFieldTwoGenParams3<long, T> value);
public object PassthruStructWithOneFieldTwoGenParams3_KnownTDelegateDirectCall(MainClass<T, U> obj, StructWithOneFieldTwoGenParams3<long, T> value, PassthruStructWithOneFieldTwoGenParams3_KnownTDelegate del) { return del(obj, value); }
public StructWithTwoFieldsTwoGenParams1<long, T> GetStructWithTwoFieldsTwoGenParams1_KnownT() { return new StructWithTwoFieldsTwoGenParams1<long, T>(new MainClass<long, long>("456", long.Parse(_id)), long.Parse(_id)); }
public StructWithTwoFieldsTwoGenParams1<long, T> PassthruStructWithTwoFieldsTwoGenParams1_KnownT(StructWithTwoFieldsTwoGenParams1<long, T> value) { return value; }
public delegate StructWithTwoFieldsTwoGenParams1<long, T> PassthruStructWithTwoFieldsTwoGenParams1_KnownTDelegate(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams1<long, T> value);
public object PassthruStructWithTwoFieldsTwoGenParams1_KnownTDelegateDirectCall(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams1<long, T> value, PassthruStructWithTwoFieldsTwoGenParams1_KnownTDelegate del) { return del(obj, value); }
public StructWithTwoFieldsTwoGenParams2<long, T> GetStructWithTwoFieldsTwoGenParams2_KnownT() { return new StructWithTwoFieldsTwoGenParams2<long, T>(new MainClass<long, long>("789", long.Parse(_id)), long.Parse(_id)); }
public StructWithTwoFieldsTwoGenParams2<long, T> PassthruStructWithTwoFieldsTwoGenParams2_KnownT(StructWithTwoFieldsTwoGenParams2<long, T> value) { return value; }
public delegate StructWithTwoFieldsTwoGenParams2<long, T> PassthruStructWithTwoFieldsTwoGenParams2_KnownTDelegate(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams2<long, T> value);
public object PassthruStructWithTwoFieldsTwoGenParams2_KnownTDelegateDirectCall(MainClass<T, U> obj, StructWithTwoFieldsTwoGenParams2<long, T> value, PassthruStructWithTwoFieldsTwoGenParams2_KnownTDelegate del) { return del(obj, value); }
public string ObjectToString<Y>(Y x) { return x.ToString(); }
}
#endregion
public class Test
{
[TestMethod]
public static void TestInstancesOfKnownAndUnknownSizes()
{
foreach (Type genArg in new Type[] { TypeOf.Double, TypeOf.String })
{
Type t = typeof(MainClass<,>).MakeGenericType(genArg, TypeOf.Double);
object o = Activator.CreateInstance(t);
object genArgInst = genArg == TypeOf.Double ? (object)12.43 : "56.78";
MethodInfo SetID = t.GetTypeInfo().GetDeclaredMethod("SetID");
SetID.Invoke(o, new object[] { "abc" });
MethodInfo SetT = t.GetTypeInfo().GetDeclaredMethod("SetT");
SetT.Invoke(o, new object[] { genArgInst });
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetClassWithTField", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTField", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetTestStructKnownSize", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetTestStructIndeterminateSize", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetTestStructKnownSizeWrappingTestStructIndeterminateSize", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetTestStructIndeterminateSizeWrappingTestStructKnownSize", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetTestStructIndeterminateSizeWrappingTestStructKnownSizeWrappingReferenceType", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetTestStructIndeterminateSizeWrappingTestStructIndeterminateSizeWrappingReferenceType", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneField1", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneField2", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneField3", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoFields1", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoFields2", "abc", genArgInst);
SetID.Invoke(o, new object[] { "11" });
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoGenParams1", "11", null);
SetID.Invoke(o, new object[] { "22" });
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoGenParams2", "22", null);
SetID.Invoke(o, new object[] { "33" });
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoGenParams3", "33", null);
SetID.Invoke(o, new object[] { "44" });
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoGenParams4", "44", null);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams1", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams2", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams3", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoFieldsTwoGenParams1", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoFieldsTwoGenParams2", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams1_KnownU", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams2_KnownU", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams3_KnownU", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoFieldsTwoGenParams1_KnownU", "abc", genArgInst);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoFieldsTwoGenParams2_KnownU", "abc", genArgInst);
SetID.Invoke(o, new object[] { "55" });
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams1_KnownT", "123", "55");
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams2_KnownT", "55", null);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithOneFieldTwoGenParams3_KnownT", "55", null);
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoFieldsTwoGenParams1_KnownT", "456", "55");
TestInstancesOfKnownAndUnknownSizes_Inner(t, o, "GetStructWithTwoFieldsTwoGenParams2_KnownT", "789", "55");
}
}
static string TestInstancesOfKnownAndUnknownSizes_GetExpectedResult(Type t, object a, object b, string getterFunc)
{
switch (getterFunc)
{
case "GetClassWithTField": return "ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}";
case "GetStructWithTField": return "StructWithTField<" + t.Name + ">. _field1 = {" + b + "}";
case "GetTestStructKnownSize": return "TestStructKnownSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}";
case "GetTestStructIndeterminateSize": return "TestStructIndeterminateSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {StructWithTField<" + t.Name + ">. _field1 = {" + b + "}}";
case "GetTestStructKnownSizeWrappingTestStructIndeterminateSize": return "TestStructKnownSize<TestStructIndeterminateSize`1>. _field1 = {EmptyClass<TestStructIndeterminateSize`1>}. _field2 = {ClassWithTField<TestStructIndeterminateSize`1>. _field1 = {TestStructIndeterminateSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {StructWithTField<" + t.Name + ">. _field1 = {" + b + "}}}}";
case "GetTestStructIndeterminateSizeWrappingTestStructKnownSize": return "TestStructIndeterminateSize<TestStructKnownSize`1>. _field1 = {EmptyClass<TestStructKnownSize`1>}. _field2 = {StructWithTField<TestStructKnownSize`1>. _field1 = {TestStructKnownSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}}}";
case "GetTestStructIndeterminateSizeWrappingTestStructKnownSizeWrappingReferenceType": return "TestStructIndeterminateSize<TestStructKnownSize`1>. _field1 = {EmptyClass<TestStructKnownSize`1>}. _field2 = {StructWithTField<TestStructKnownSize`1>. _field1 = {TestStructKnownSize<ClassWithTField`1>. _field1 = {EmptyClass<ClassWithTField`1>}. _field2 = {ClassWithTField<ClassWithTField`1>. _field1 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}}}}";
case "GetTestStructIndeterminateSizeWrappingTestStructIndeterminateSizeWrappingReferenceType": return "TestStructIndeterminateSize<TestStructIndeterminateSize`1>. _field1 = {EmptyClass<TestStructIndeterminateSize`1>}. _field2 = {StructWithTField<TestStructIndeterminateSize`1>. _field1 = {TestStructIndeterminateSize<ClassWithTField`1>. _field1 = {EmptyClass<ClassWithTField`1>}. _field2 = {StructWithTField<ClassWithTField`1>. _field1 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}}}}";
case "GetStructWithOneField1": return "StructWithOneField1<" + t.Name + ">. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}";
case "GetStructWithOneField2": return "StructWithOneField2<" + t.Name + ">. _field1 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}";
case "GetStructWithOneField3": return "StructWithOneField3<" + t.Name + ">. _field1 = {StructWithTField<" + t.Name + ">. _field1 = {" + b + "}}";
case "GetStructWithTwoFields1": return "StructWithTwoFields1<" + t.Name + ">. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}. _field2 = {TestStructKnownSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}}";
case "GetStructWithTwoFields2": return "StructWithTwoFields2<" + t.Name + ">. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}. _field2 = {TestStructIndeterminateSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {StructWithTField<" + t.Name + ">. _field1 = {" + b + "}}}";
case "GetStructWithTwoGenParams1": return "StructWithTwoGenParams<System.Int32," + t + ">. _field1 = {" + a + "}";
case "GetStructWithTwoGenParams2": return "StructWithTwoGenParams<System.Int32,System.Collections.Generic.KeyValuePair`2[System.Int32,CallingConvention.StructWithTwoGenParams`2[System.Collections.Generic.List`1[" + t + "]," + t + "]]>. _field1 = {" + a + "}";
case "GetStructWithTwoGenParams3": return "StructWithTwoGenParams<System.Int32,CallingConvention.StructWithTwoGenParams`2[System.Collections.Generic.List`1[" + t + "],System.Collections.Generic.KeyValuePair`2[" + t + "," + t + "]]>. _field1 = {" + a + "}";
case "GetStructWithTwoGenParams4": return "StructWithTwoGenParams<System.Int32,CallingConvention.StructWithTwoGenParams`2[System.Collections.Generic.List`1[System.Int32],System.Collections.Generic.KeyValuePair`2[System.Int32,System.String]]>. _field1 = {" + a + "}";
case "GetStructWithOneFieldTwoGenParams1": return "StructWithOneFieldTwoGenParams1<" + t + "," + t + ">. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}";
case "GetStructWithOneFieldTwoGenParams2": return "StructWithOneFieldTwoGenParams2<" + t + "," + t + ">. _field1 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}";
case "GetStructWithOneFieldTwoGenParams3": return "StructWithOneFieldTwoGenParams3<" + t + "," + t + ">. _field1 = {StructWithTField<" + t.Name + ">. _field1 = {" + b + "}}";
case "GetStructWithTwoFieldsTwoGenParams1": return "StructWithTwoFieldsTwoGenParams1<" + t + "," + t + ">. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}. _field2 = {TestStructKnownSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}}";
case "GetStructWithTwoFieldsTwoGenParams2": return "StructWithTwoFieldsTwoGenParams2<" + t + "," + t + ">. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}. _field2 = {TestStructIndeterminateSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {StructWithTField<" + t.Name + ">. _field1 = {" + b + "}}}";
case "GetStructWithOneFieldTwoGenParams1_KnownU": return "StructWithOneFieldTwoGenParams1<" + t + ",System.Single>. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}";
case "GetStructWithOneFieldTwoGenParams2_KnownU": return "StructWithOneFieldTwoGenParams2<" + t + ",System.Single>. _field1 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}";
case "GetStructWithOneFieldTwoGenParams3_KnownU": return "StructWithOneFieldTwoGenParams3<" + t + ",System.Single>. _field1 = {StructWithTField<" + t.Name + ">. _field1 = {" + b + "}}";
case "GetStructWithTwoFieldsTwoGenParams1_KnownU": return "StructWithTwoFieldsTwoGenParams1<" + t + ",System.Single>. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}. _field2 = {TestStructKnownSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {ClassWithTField<" + t.Name + ">. _field1 = {" + b + "}}}";
case "GetStructWithTwoFieldsTwoGenParams2_KnownU": return "StructWithTwoFieldsTwoGenParams2<" + t + ",System.Single>. _field1 = {MainClass<" + t.Name + ">. _id = {" + a + "}. _tValue = {" + b + "}}. _field2 = {TestStructIndeterminateSize<" + t.Name + ">. _field1 = {EmptyClass<" + t.Name + ">}. _field2 = {StructWithTField<" + t.Name + ">. _field1 = {" + b + "}}}";
case "GetStructWithOneFieldTwoGenParams1_KnownT": return "StructWithOneFieldTwoGenParams1<System.Int64," + t + ">. _field1 = {MainClass<Int64>. _id = {" + a + "}. _tValue = {" + b + "}}";
case "GetStructWithOneFieldTwoGenParams2_KnownT": return "StructWithOneFieldTwoGenParams2<System.Int64," + t + ">. _field1 = {ClassWithTField<Int64>. _field1 = {" + a + "}}";
case "GetStructWithOneFieldTwoGenParams3_KnownT": return "StructWithOneFieldTwoGenParams3<System.Int64," + t + ">. _field1 = {StructWithTField<Int64>. _field1 = {" + a + "}}";
case "GetStructWithTwoFieldsTwoGenParams1_KnownT": return "StructWithTwoFieldsTwoGenParams1<System.Int64," + t + ">. _field1 = {MainClass<Int64>. _id = {" + a + "}. _tValue = {" + b + "}}. _field2 = {TestStructKnownSize<Int64>. _field1 = {EmptyClass<Int64>}. _field2 = {ClassWithTField<Int64>. _field1 = {" + b + "}}}";
case "GetStructWithTwoFieldsTwoGenParams2_KnownT": return "StructWithTwoFieldsTwoGenParams2<System.Int64," + t + ">. _field1 = {MainClass<Int64>. _id = {" + a + "}. _tValue = {" + b + "}}. _field2 = {TestStructIndeterminateSize<Int64>. _field1 = {EmptyClass<Int64>}. _field2 = {StructWithTField<Int64>. _field1 = {" + b + "}}}";
default: return null;
}
}
static void TestInstancesOfKnownAndUnknownSizes_Inner(Type t, object o, string getterFunc, object a, object b)
{
string expectedResult = TestInstancesOfKnownAndUnknownSizes_GetExpectedResult(t.GenericTypeArguments[0], a, b, getterFunc);
// Test that the abi handling for a return value works
MethodInfo getter = t.GetTypeInfo().GetDeclaredMethod(getterFunc);
object retVal = getter.Invoke(o, null);
Assert.AreEqual(expectedResult, retVal.ToString());
MethodInfo toString = t.GetTypeInfo().GetDeclaredMethod("ObjectToString").MakeGenericMethod(retVal.GetType());
string res = (string)toString.Invoke(o, new object[] { retVal });
Assert.AreEqual(expectedResult, res);
// Test that the abi handling for a parameter
string passthruName = "Passthru" + getterFunc.Substring("Get".Length);
MethodInfo passthru = t.GetTypeInfo().GetDeclaredMethod(passthruName);
object passthruRetVal = passthru.Invoke(o, new object[] { retVal });
// Passthru return value testing
res = (string)toString.Invoke(o, new object[] { passthruRetVal });
Assert.AreEqual(expectedResult, res);
// Test that the abi handling for a parameter and return value, through the constructed delegate invoke path
Type delegateType = t.GetTypeInfo().GetDeclaredNestedType(passthruName + "Delegate").AsType();
Type funcType = delegateType.MakeGenericType(t.GenericTypeArguments);
Delegate passthruDelegate = passthru.CreateDelegate(funcType);
object passthruDelegateRetVal = passthruDelegate.DynamicInvoke(o, passthruRetVal);
// Passthru delegate return value testing
res = (string)toString.Invoke(o, new object[] { passthruDelegateRetVal });
Assert.AreEqual(expectedResult, res);
// PassthurDelegate direct call testing
MethodInfo delegateDirectCall = delegateDirectCall = t.GetTypeInfo().GetDeclaredMethod(passthruName + "DelegateDirectCall");
if (delegateDirectCall != null)
{
object passthruDelegateDirectCallRetVal = delegateDirectCall.Invoke(o, new object[] { o, passthruDelegateRetVal, passthruDelegate });
// Passthru delegate return value testing
res = (string)toString.Invoke(o, new object[] { passthruDelegateDirectCallRetVal });
Assert.AreEqual(expectedResult, res);
}
}
[TestMethod]
public static void TestCallInstanceFunction()
{
var t = TypeOf.CCT_UCGTestNonVirtualFunctionCallUse.MakeGenericType(TypeOf.Short);
TestNonVirtualFunctionCallUseBase o = (TestNonVirtualFunctionCallUseBase)Activator.CreateInstance(t);
new UCGSeperateClass<short>().BoxParam(4);
short testValue = (short)3817;
object returnValue = o.TestNonVirtualInstanceFunction(new UCGSeperateClass<short>(), (object)testValue);
Assert.AreEqual(testValue, (short)returnValue);
}
public static object s_expectedT;
[TestMethod]
public static void TestCallInterface()
{
var t = TypeOf.CCT_UCGTestUseInterface.MakeGenericType(TypeOf.Short);
TestInterfaceUseBase o = (TestInterfaceUseBase)Activator.CreateInstance(t);
ITestCallInterface<short> temp = (ITestCallInterface<short>)new TestCallInterfaceImpl();
TestInterfaceUseBase.ShortValue = 0;
short testValue = (short)3817;
o.TestUseInterface(new TestCallInterfaceImpl(), (object)testValue);
Assert.AreEqual(testValue, TestInterfaceUseBase.ShortValue);
}
[TestMethod]
public static void CallingConventionTest()
{
// Using the normal canonical template for the instantiation
{
s_expectedT = "Hello";
CallingConventionTest_Inner<string>("Hello");
}
// Using the universal canonical template for the instantiation
{
s_expectedT = 443;
CallingConventionTest_Inner<short>(443);
}
}
static void CallingConventionTest_Inner<ARG>(ARG val)
{
var t = TypeOf.CCT_CCTester.MakeGenericType(typeof(ARG));
IBase<ARG> o = (IBase<ARG>)Activator.CreateInstance(t);
SimpleFuncCaller<ARG>(o, val);
CoolFuncCaller<ARG>(o, val);
}
static unsafe void SimpleFuncCaller<T>(IBase<T> obj, T tval)
{
obj.SimpleFunc(tval);
}
static unsafe void CoolFuncCaller<T>(IBase<T> obj, T tval)
{
T brt_default = default(T);
int* somePtr = (int*)159;
T t_copy = tval;
T retVal = obj.VirtualCoolFunc("Hello", new Bar<T> { _value = 1 }, new Foo<T> { _value = 2 }, new T[] { tval }, t_copy, ref tval, ref brt_default, 123, (int*)456, (int**)789, ref somePtr);
Assert.AreEqual(tval, default(T));
Assert.AreEqual(brt_default, t_copy);
Assert.AreEqual(retVal, t_copy);
Assert.IsTrue(somePtr == (int*)456);
}
}
}
namespace DynamicInvoke
{
public class Type1<T>
{
T _myField;
public Type1(T t) { _myField = t; }
public T GetMyField() { return _myField; }
public override string ToString() { return "Type1<" + typeof(T) + ">._myField = " + _myField.ToString(); }
}
public class Type2<T>
{
T _myField;
public Type2(T t) { _myField = t; }
public override string ToString() { return "Type2<" + typeof(T) + ">._myField = " + _myField.ToString(); }
}
public class Type3<T>
{
T[] _myField;
public Type3(T t1, T t2, T t3) { _myField = new T[] { t1, t2, t3 }; }
public T Get_A_T(int index) { return _myField[index]; }
}
public class TestType<T, U, V>
{
public string SimpleMethod1()
{
return "SimpleMethod1";
}
public string SimpleMethod2(int a, string b, object c, List<float> d)
{
string result = "SimpleMethod2(" + a + "," + b + "," + c;
foreach (float f in d) result += "," + f;
return result + ")";
}
public T Method0(T t, ref string resultStr)
{
resultStr = "Method0-" + t.ToString();
return t;
}
public void Method1(T t1, ref T t2)
{
t2 = t1;
}
public Type1<T> Method2(Type2<T> l_t, T t, ref string resultStr)
{
resultStr = l_t.ToString();
return new Type1<T>(t);
}
public Type1<U> Method3(Type2<U> l_u, U u, ref string resultStr)
{
resultStr = l_u.ToString();
return new Type1<U>(u);
}
public KeyValuePair<Type3<T>, U> ComplexMethod(KeyValuePair<Type1<T[]>, U> kvp)
{
Type1<T[]> key = kvp.Key;
T[] array = key.GetMyField();
return new KeyValuePair<Type3<T>, U>(new Type3<T>(array[0], array[1], array[2]), kvp.Value);
}
}
public class Test
{
[TestMethod]
public static void TestDynamicInvoke()
{
TestDynamicInvoke_Inner<string>("123", "456");
TestDynamicInvoke_Inner<char>('a', 'b');
TestDynamicInvoke_Inner<short>((short)111, (short)222);
TestDynamicInvoke_Inner<float>((float)3.3f, (float)4.4f);
TestDynamicInvoke_Inner<double>((double)5.55, (double)6.66);
}
public static void TestDynamicInvoke_Inner<T>(T argParam1, T argParam2)
{
string argParam1Str = argParam1.ToString();
string argParam2Str = argParam2.ToString();
var t = TypeOf.DI_TestType.MakeGenericType(typeof(T), TypeOf.String, /* Use int32 here to force usage of the universal template*/ TypeOf.Int32);
var o = Activator.CreateInstance(t);
// SimpleMethod1
{
MethodInfo simpleMethod1 = t.GetTypeInfo().GetDeclaredMethod("SimpleMethod1");
string result = (string)simpleMethod1.Invoke(o, null);
Assert.AreEqual(result, "SimpleMethod1");
Delegate simpleMethod1Del = simpleMethod1.CreateDelegate(typeof(Func<string>), o);
result = (string)simpleMethod1Del.DynamicInvoke(null);
Assert.AreEqual(result, "SimpleMethod1");
}
// SimpleMethod2
{
MethodInfo simpleMethod2 = t.GetTypeInfo().GetDeclaredMethod("SimpleMethod2");
object[] args = new object[] {
123,
"456",
new Dictionary<object, string>(),
new List<float>(new float[]{1.2f, 3.4f, 5.6f})
};
string result = (string)simpleMethod2.Invoke(o, args);
Assert.AreEqual(result, "SimpleMethod2(123,456,System.Collections.Generic.Dictionary`2[System.Object,System.String],1.2,3.4,5.6)");
Delegate simpleMethod2Del = simpleMethod2.CreateDelegate(typeof(Func<int, string, Dictionary<object, string>, List<float>, string>), o);
result = (string)simpleMethod2Del.DynamicInvoke(args);
Assert.AreEqual(result, "SimpleMethod2(123,456,System.Collections.Generic.Dictionary`2[System.Object,System.String],1.2,3.4,5.6)");
}
// Method0
{
MethodInfo method0 = t.GetTypeInfo().GetDeclaredMethod("Method0");
string resultStr = null;
object[] args = new object[] { argParam1, resultStr };
string result = method0.Invoke(o, args).ToString();
resultStr = (string)args[1];
Assert.AreEqual(resultStr, "Method0-" + argParam1Str);
Assert.AreEqual(result, argParam1Str);
}
// Method1
{
MethodInfo method1 = t.GetTypeInfo().GetDeclaredMethod("Method1");
object[] args = new object[] { argParam1, argParam2 };
method1.Invoke(o, args);
Assert.AreEqual(args[0].ToString(), args[1].ToString());
Assert.AreEqual(args[0], args[1]);
Assert.AreEqual(args[1], argParam1);
}
// Method2 and Method3
{
MethodInfo method2 = t.GetTypeInfo().GetDeclaredMethod("Method2");
MethodInfo method3 = t.GetTypeInfo().GetDeclaredMethod("Method3");
var args_for_method2 = new object[] { new Type2<T>(argParam1), argParam2, "" };
var args_for_method3 = new object[] { new Type2<string>("hello"), "myTest", "" };
string result_of_method2 = method2.Invoke(o, args_for_method2).ToString();
string result_of_method3 = method3.Invoke(o, args_for_method3).ToString();
string resultStr_method2 = args_for_method2[2].ToString();
string resultStr_method3 = args_for_method3[2].ToString();
Assert.AreEqual(resultStr_method2, "Type2<" + typeof(T) + ">._myField = " + argParam1.ToString());
Assert.AreEqual(resultStr_method3, "Type2<System.String>._myField = hello");
Assert.AreEqual(result_of_method2, "Type1<" + typeof(T) + ">._myField = " + argParam2.ToString());
Assert.AreEqual(result_of_method3, "Type1<System.String>._myField = myTest");
}
// ComplexMethod
{
MethodInfo complex_method = t.GetTypeInfo().GetDeclaredMethod("ComplexMethod");
Type1<T[]> myType1 = new Type1<T[]>(new T[] { argParam1, argParam2, argParam1 });
object result = complex_method.Invoke(o, new object[] { new KeyValuePair<Type1<T[]>, string>(myType1, "hello") });
KeyValuePair<Type3<T>, String> resultAsKvp = (KeyValuePair<Type3<T>, String>) result;
Assert.AreEqual(resultAsKvp.Key.Get_A_T(0), argParam1);
Assert.AreEqual(resultAsKvp.Key.Get_A_T(1), argParam2);
Assert.AreEqual(resultAsKvp.Key.Get_A_T(2), argParam1);
Assert.AreEqual(resultAsKvp.Value, "hello");
}
}
}
}
namespace TypeLayout
{
public struct GenStructStatic<X, Y, Z>
{
public X x;
public Y y;
public Z z;
}
public struct GenStructDynamic<X, Y, Z>
{
public X x;
public Y y;
public Z z;
// This forces recursive type layout to ensure that we come up with a sensible result.
public static GenStructDynamic<X, Y, Z> test;
}
public class BaseType
{
public float _f1;
public string _f2;
}
public class GenClassStatic<X, Y, Z> : BaseType
{
public X x;
public Y y;
public Z z;
}
public class GenClassDynamic<X, Y, Z> : BaseType
{
public X x;
public Y y;
public Z z;
}
public abstract class Base
{
public abstract Type GetTypeOfArray();
}
public class MyArray<T> : Base
{
public T[] t = new T[10];
public override Type GetTypeOfArray()
{
return t.GetType();
}
}
public class Test
{
public static GenStructStatic<sbyte, sbyte, sbyte> s_staticStruct;
public static GenStructDynamic<sbyte, sbyte, sbyte> s_dynamicStruct;
public static GenClassStatic<sbyte, sbyte, sbyte> s_staticClass = new GenClassStatic<sbyte,sbyte,sbyte>();
public static GenClassDynamic<sbyte, sbyte, sbyte> s_dynamicClass = new GenClassDynamic<sbyte,sbyte,sbyte>();
public static MyArray<sbyte> s_test = new MyArray<sbyte>();
public static void AssertTypesSimilar(Type left, Type right)
{
#if INTERNAL_CONTRACTS
int sizeLeft, sizeRight, alignmentLeft, alignmentRight;
RuntimeTypeHandle rthLeft = left.TypeHandle;
RuntimeTypeHandle rthRight = right.TypeHandle;
Internal.Runtime.TypeLoader.TypeLoaderEnvironment.GetFieldAlignmentAndSize(rthLeft, out alignmentLeft, out sizeLeft);
Internal.Runtime.TypeLoader.TypeLoaderEnvironment.GetFieldAlignmentAndSize(rthRight, out alignmentRight, out sizeRight);
Assert.AreEqual(sizeLeft, sizeRight);
Assert.AreEqual(alignmentLeft, alignmentRight);
#endif
}
public unsafe static void AssertSameGCDesc(Type left, Type right)
{
RuntimeTypeHandle rthLeft = left.TypeHandle;
RuntimeTypeHandle rthRight = right.TypeHandle;
void** ptrLeft = *(void***)&rthLeft - 1;
void** ptrRight = *(void***)&rthRight - 1;
long leftVal = (long)*ptrLeft--;
long rightVal = (long)*ptrRight--;
Assert.AreEqual(leftVal, rightVal);
int count = leftVal > 0 ? (int)leftVal * 2 : -(int)leftVal * 2 - 1;
for (int i = 0; i < count; i++)
Assert.AreEqual(new IntPtr(*ptrLeft--), new IntPtr(*ptrRight--));
}
[TestMethod]
public static void TestTypeGCDescs()
{
BaseType bt = new BaseType();
bt._f1 = 1;
bt._f2 = new String('c', 2);
s_test.t = null;
s_staticClass.x = s_dynamicClass.x;
s_staticClass.y = s_dynamicClass.y;
s_staticClass.z = s_dynamicClass.z;
GenStructDynamic<sbyte, sbyte, sbyte>.test.x = 0;
Type staticType = null;
Type staticArrayType = null;
Type dynamicType = null;
Type innerType = null;
Type arrayType = null;
Base o = null;
staticType = typeof(GenStructStatic<bool, GenStructStatic<object, object, bool>, object>);
staticArrayType = typeof(GenStructStatic<bool, GenStructStatic<object, object, bool>, object>[]);
innerType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Object, TypeOf.Object, TypeOf.Bool);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, innerType, TypeOf.Object);
arrayType = typeof(MyArray<>).MakeGenericType(dynamicType);
o = (Base)Activator.CreateInstance(arrayType);
AssertSameGCDesc(staticType, dynamicType);
AssertSameGCDesc(staticArrayType, o.GetTypeOfArray());
staticType = typeof(GenStructStatic<bool, object, bool>);
staticArrayType = typeof(GenStructStatic<bool, object, bool>[]);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Object, TypeOf.Bool);
arrayType = typeof(MyArray<>).MakeGenericType(dynamicType);
o = (Base)Activator.CreateInstance(arrayType);
AssertSameGCDesc(staticType, dynamicType);
AssertSameGCDesc(staticArrayType, o.GetTypeOfArray());
staticType = typeof(GenStructStatic<object, bool, short>);
staticArrayType = typeof(GenStructStatic<object, bool, short>[]);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Object, TypeOf.Bool, TypeOf.Int16);
arrayType = typeof(MyArray<>).MakeGenericType(dynamicType);
o = (Base)Activator.CreateInstance(arrayType);
AssertSameGCDesc(staticType, dynamicType);
AssertSameGCDesc(staticArrayType, o.GetTypeOfArray());
staticType = typeof(GenStructStatic<bool, bool, object>);
staticArrayType = typeof(GenStructStatic<bool, bool, object>[]);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Bool, TypeOf.Object);
arrayType = typeof(MyArray<>).MakeGenericType(dynamicType);
o = (Base)Activator.CreateInstance(arrayType);
AssertSameGCDesc(staticType, dynamicType);
AssertSameGCDesc(staticArrayType, o.GetTypeOfArray());
staticType = typeof(GenClassStatic<bool, object, bool>);
staticArrayType = typeof(GenClassStatic<bool, object, bool>[]);
dynamicType = typeof(GenClassDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Object, TypeOf.Bool);
arrayType = typeof(MyArray<>).MakeGenericType(dynamicType);
o = (Base)Activator.CreateInstance(arrayType);
AssertSameGCDesc(staticType, dynamicType);
AssertSameGCDesc(staticArrayType, o.GetTypeOfArray());
staticType = typeof(GenClassStatic<object, bool, short>);
staticArrayType = typeof(GenClassStatic<object, bool, short>[]);
dynamicType = typeof(GenClassDynamic<,,>).MakeGenericType(TypeOf.Object, TypeOf.Bool, TypeOf.Int16);
arrayType = typeof(MyArray<>).MakeGenericType(dynamicType);
o = (Base)Activator.CreateInstance(arrayType);
AssertSameGCDesc(staticType, dynamicType);
AssertSameGCDesc(staticArrayType, o.GetTypeOfArray());
staticType = typeof(GenClassStatic<bool, bool, object>);
staticArrayType = typeof(GenClassStatic<bool, bool, object>[]);
dynamicType = typeof(GenClassDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Bool, TypeOf.Object);
arrayType = typeof(MyArray<>).MakeGenericType(dynamicType);
o = (Base)Activator.CreateInstance(arrayType);
AssertSameGCDesc(staticType, dynamicType);
AssertSameGCDesc(staticArrayType, o.GetTypeOfArray());
}
[TestMethod]
public static void StructsOfPrimitives()
{
// Test type sizes for structs of primitive types
// Ensure the reducer can't get rid of the x,y,z fields from these types.
s_dynamicStruct.x = s_staticStruct.x;
s_dynamicStruct.y = s_staticStruct.y;
s_dynamicStruct.z = s_staticStruct.z;
Type staticType = null;
Type dynamicType = null;
// All permutation of bool, short, int and double across 3 fields
// top level bool
// mid level bool
staticType = typeof(GenStructStatic<bool, bool, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Bool, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, bool, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Bool, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, bool, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Bool, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, bool, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Bool, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level short
staticType = typeof(GenStructStatic<bool, short, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Int16, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, short, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Int16, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, short, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Int16, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, short, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Int16, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level int
staticType = typeof(GenStructStatic<bool, int, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Int32, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, int, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Int32, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, int, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Int32, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, int, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Int32, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level double
staticType = typeof(GenStructStatic<bool, double, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Double, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, double, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Double, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, double, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Double, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<bool, double, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Bool, TypeOf.Double, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// top level short
// mid level bool
staticType = typeof(GenStructStatic<short, bool, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Bool, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, bool, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Bool, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, bool, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Bool, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, bool, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Bool, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level short
staticType = typeof(GenStructStatic<short, short, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Int16, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, short, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Int16, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, short, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Int16, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, short, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Int16, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level int
staticType = typeof(GenStructStatic<short, int, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Int32, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, int, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Int32, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, int, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Int32, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, int, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Int32, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level double
staticType = typeof(GenStructStatic<short, double, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Double, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, double, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Double, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, double, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Double, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<short, double, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int16, TypeOf.Double, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// top level int
// mid level bool
staticType = typeof(GenStructStatic<int, bool, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Bool, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, bool, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Bool, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, bool, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Bool, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, bool, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Bool, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level short
staticType = typeof(GenStructStatic<int, short, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int16, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, short, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int16, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, short, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int16, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, short, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int16, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level int
staticType = typeof(GenStructStatic<int, int, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int32, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, int, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int32, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, int, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int32, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, int, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int32, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level double
staticType = typeof(GenStructStatic<int, double, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Double, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, double, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Double, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, double, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Double, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<int, double, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Double, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// top level double
// mid level bool
staticType = typeof(GenStructStatic<double, bool, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Bool, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, bool, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Bool, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, bool, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Bool, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, bool, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Bool, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level short
staticType = typeof(GenStructStatic<double, short, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Int16, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, short, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Int16, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, short, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Int16, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, short, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Int16, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level int
staticType = typeof(GenStructStatic<double, int, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Int32, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, int, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Int32, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, int, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Int32, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, int, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Int32, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
// mid level double
staticType = typeof(GenStructStatic<double, double, bool>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Double, TypeOf.Bool);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, double, short>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Double, TypeOf.Int16);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, double, int>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Double, TypeOf.Int32);
AssertTypesSimilar(staticType, dynamicType);
staticType = typeof(GenStructStatic<double, double, double>);
dynamicType = typeof(GenStructDynamic<,,>).MakeGenericType(TypeOf.Double, TypeOf.Double, TypeOf.Double);
AssertTypesSimilar(staticType, dynamicType);
}
}
}
namespace ActivatorCreateInstance
{
public class ReferenceType
{
string _field;
public ReferenceType() { _field = "ReferenceType.ctor"; }
public override string ToString() { return _field; }
}
public class GenReferenceType<T>
{
string _field;
public GenReferenceType() { _field = "GenReferenceType<" + typeof(T) + ">.ctor"; }
public override string ToString() { return _field; }
}
public class ReferenceTypeNoDefaultCtor
{
string _field;
public ReferenceTypeNoDefaultCtor(int param1) { _field = "ReferenceTypeNoDefaultCtor.ctor"; }
public override string ToString() { return _field; }
}
public class GenReferenceTypeNoDefaultCtor<T>
{
string _field;
public GenReferenceTypeNoDefaultCtor(bool param1) { _field = "GenReferenceTypeNoDefaultCtor<" + typeof(T) + ">.ctor"; }
public override string ToString() { return _field; }
}
public struct AValueType
{
int _a;
double _b;
object _c;
public AValueType(int param) { _a = 1; _b = 2.0; _c = new object(); }
public override string ToString() { return "AValueType.ctor" + _a + _b + _c; }
}
public struct AGenValueType<T>
{
T _a;
object _c;
public AGenValueType(double param) { _a = default(T); _c = "3"; }
public override string ToString() { return "AGenValueType<" + typeof(T) + ">.ctor" + _a + _c; }
}
public class Base
{
public virtual string Func() { return null; }
}
public class ACI_Instantiator<T, U> : Base
{
public override string Func()
{
T t = Activator.CreateInstance<T>();
t = Activator.CreateInstance<T>();
return "ACI_Instantiator: " + typeof(T) + " = " + t.ToString();
}
}
public class NEW_Instantiator<T, U> : Base
where T : new()
{
public override string Func()
{
T t = new T();
t = new T();
return "NEW_Instantiator: " + typeof(T) + " = " + t.ToString();
}
}
public class Test
{
[TestMethod]
public static void TestCreateInstance()
{
TestActivatorCreateInstance_Inner(TypeOf.Short, "0");
TestActivatorCreateInstance_Inner(TypeOf.Int32, "0");
TestActivatorCreateInstance_Inner(TypeOf.Long, "0");
TestActivatorCreateInstance_Inner(TypeOf.Float, "0");
TestActivatorCreateInstance_Inner(TypeOf.Double, "0");
TestActivatorCreateInstance_Inner(typeof(ReferenceType), "ReferenceType.ctor");
TestActivatorCreateInstance_Inner(TypeOf.ACI_GenReferenceType.MakeGenericType(TypeOf.String), "GenReferenceType<System.String>.ctor");
TestActivatorCreateInstance_Inner(TypeOf.ACI_GenReferenceType.MakeGenericType(TypeOf.Double), "GenReferenceType<System.Double>.ctor");
TestActivatorCreateInstance_Inner(typeof(GenReferenceType<CommonType1>), "GenReferenceType<CommonType1>.ctor");
TestActivatorCreateInstance_Inner(typeof(ReferenceTypeNoDefaultCtor), null, true);
TestActivatorCreateInstance_Inner(TypeOf.ACI_GenReferenceTypeNoDefaultCtor.MakeGenericType(TypeOf.String), null, true);
TestActivatorCreateInstance_Inner(TypeOf.ACI_GenReferenceTypeNoDefaultCtor.MakeGenericType(TypeOf.Double), null, true);
TestActivatorCreateInstance_Inner(typeof(GenReferenceTypeNoDefaultCtor<CommonType1>), null, true);
TestActivatorCreateInstance_Inner(typeof(AValueType), "AValueType.ctor00");
TestActivatorCreateInstance_Inner(TypeOf.ACI_AGenValueType.MakeGenericType(TypeOf.String), "AGenValueType<System.String>.ctor");
TestActivatorCreateInstance_Inner(TypeOf.ACI_AGenValueType.MakeGenericType(TypeOf.Double), "AGenValueType<System.Double>.ctor0");
#if USC
TestActivatorCreateInstance_Inner(typeof(AGenValueType<CommonType1>), "AGenValueType<CommonType1>.ctorCommonType1");
#else
TestActivatorCreateInstance_Inner(typeof(AGenValueType<CommonType1>), "AGenValueType<CommonType1>.ctor");
#endif
}
static void TestActivatorCreateInstance_Inner(Type typeArg, string toStrVal, bool expectMissingMemberException = false)
{
Type t;
Base o;
string result1, result2;
string expectedResult1 = "ACI_Instantiator: " + typeArg.ToString() + " = " + toStrVal;
string expectedResult2 = "NEW_Instantiator: " + typeArg.ToString() + " = " + toStrVal;
try
{
t = TypeOf.ACI_ACI_Instantiator.MakeGenericType(typeArg, TypeOf.Short);
o = (Base)Activator.CreateInstance(t);
result1 = o.Func();
Assert.AreEqual(expectedResult1, result1);
Assert.IsFalse(expectMissingMemberException);
}
catch (System.MissingMemberException)
{
Assert.IsTrue(expectMissingMemberException);
}
if (expectMissingMemberException)
{
// Types with no default constructor will violate the constraint on "T".
return;
}
t = TypeOf.ACI_NEW_Instantiator.MakeGenericType(typeArg, TypeOf.Short);
o = (Base)Activator.CreateInstance(t);
result2 = o.Func();
Assert.AreEqual(expectedResult2, result2);
}
}
}
namespace MultiThreadUSCCall
{
public class TestType<T>
{
public string Func(T t)
{
return "Func(" + typeof(T) + ")";
}
}
public class Test
{
static void DoTest()
{
Task[] tasks = new Task[50];
for (int i = 0; i < 50; i++)
{
tasks[i] = Task.Run(() =>
{
for (int j = 0; j < 5; j++)
{
var t = typeof(TestType<>).MakeGenericType(TypeOf.Short);
object o = Activator.CreateInstance(t);
MethodInfo mi = t.GetTypeInfo().GetDeclaredMethod("Func");
string s = (string)mi.Invoke(o, new object[] { null });
Assert.AreEqual("Func(System.Int16)", s);
t = null;
o = null;
mi = null;
s = null;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
}
});
}
Task.WaitAll(tasks);
}
[TestMethod]
public static void CallsWithGCCollects()
{
for (int i = 0; i < 5; i++)
{
DoTest();
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
}
}
}
}
namespace Heuristics
{
public struct MyStruct<T>
{
public override string ToString()
{
return typeof(T).ToString();
}
}
//
// Test USG reflection heuristics by using an rd.xml entry to root the type.
// Only look up the type with Type.GetType(string) so it is never statically referenced.
//
public struct OnlyUseViaReflection<T>
{
T _a;
public OnlyUseViaReflection(int dummyToMakeCscPass) { _a = default(T); }
public override string ToString() { return "OnlyUseViaReflection<" + typeof(T) + ">.ctor" + _a; }
public string GenericMethodNotCalledStatically<U>(U u)
{
return typeof(U).ToString();
}
}
public class OnlyUseViaReflectionGenMethod
{
public string GenericMethodNotCalledStatically<T>(T t)
{
return typeof(T).ToString();
}
}
public class TestHeuristics
{
[TestMethod]
public static void TestReflectionHeuristics()
{
Type t;
t = TypeOf.OnlyUseViaReflection.MakeGenericType(TypeOf.Double);
Object o = Activator.CreateInstance(t);
Assert.IsTrue(o != null);
t = TypeOf.OnlyUseViaReflectionGenMethod;
Object obj = Activator.CreateInstance(t);
Assert.IsTrue(obj != null);
}
//
// Try instantiating all reflectable generics in this test app over a specific value type to ensure
// everything marked reflectable works with USG
//
//[TestMethod]
#if false
public static void TestReflectionHeuristicsAllGenerics()
{
var assembly = typeof(TestHeuristics).GetTypeInfo().Assembly;
foreach (var t in assembly.DefinedTypes)
{
if (t.IsGenericType)
{
Assert.IsTrue(t.IsGenericTypeDefinition);
int arity = t.GenericTypeParameters.Length;
Console.WriteLine("Type: {0} Arity: {1}", t.ToString(), arity);
bool hasTypeConstraints = false;
foreach (var tp in t.GenericTypeParameters)
{
if (tp.GetTypeInfo().GetGenericParameterConstraints().Length > 0)
hasTypeConstraints = true;
}
if (hasTypeConstraints)
{
Console.WriteLine("Skipping type - it has at least one type parameter constraint (that forces a specific base type)");
continue;
}
Type[] args = new Type[arity];
for (int i = 0; i < args.Length; i++)
{
args[i] = typeof(MyStruct<int>);
}
Type instantiated = t.MakeGenericType(args);
Assert.IsTrue(instantiated != null);
}
}
}
#endif
}
}
namespace ArrayVarianceTest
{
public class GenType<T, U>
{
public string RunTest(object input_obj, int testId)
{
// These typecases will cause RhTypeCast_IsInstanceOfInterface to execute,
// which will check for variance equalities between types.
IEnumerable<T> source = input_obj as IEnumerable<T>;
ICollection<T> collection = source as ICollection<T>;
switch (testId)
{
case 0:
{
return collection == null ? "NULL" : (collection.Count + " items in ICollection<" + typeof(T).Name + ">");
}
case 1:
{
if (source == null) return "NULL";
int count = 0;
foreach (T item in source)
count++;
return (count + " items in IEnumerable<" + typeof(T).Name + ">");
}
}
return null;
}
}
public enum MyTestEnum : int
{
MTE_1, MTE_2, MTE_3,
}
public class Test
{
[TestMethod]
public static void RunTest()
{
ICollection<string> coll_str = new string[] { "abc", "def" };
int[] int_array = new int[] { 1, 2, 3 };
MyTestEnum[] enum_array = new MyTestEnum[] { MyTestEnum.MTE_1, MyTestEnum.MTE_1, MyTestEnum.MTE_2, MyTestEnum.MTE_2, MyTestEnum.MTE_3, MyTestEnum.MTE_3, };
Type t = TypeOf.AVT_GenType.MakeGenericType(TypeOf.CommonType4, TypeOf.Short);
object o = Activator.CreateInstance(t);
MethodInfo mi = t.GetTypeInfo().GetDeclaredMethod("RunTest");
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { coll_str, 0 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { int_array, 0 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { coll_str, 1 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { int_array, 1 }));
t = TypeOf.AVT_GenType.MakeGenericType(TypeOf.String, TypeOf.Short);
o = Activator.CreateInstance(t);
mi = t.GetTypeInfo().GetDeclaredMethod("RunTest");
Assert.AreEqual("2 items in ICollection<String>", mi.Invoke(o, new object[] { coll_str, 0 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { int_array, 0 }));
Assert.AreEqual("2 items in IEnumerable<String>", mi.Invoke(o, new object[] { coll_str, 1 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { int_array, 1 }));
t = TypeOf.AVT_GenType.MakeGenericType(TypeOf.Object, TypeOf.Short);
o = Activator.CreateInstance(t);
mi = t.GetTypeInfo().GetDeclaredMethod("RunTest");
Assert.AreEqual("2 items in ICollection<Object>", mi.Invoke(o, new object[] { coll_str, 0 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { int_array, 0 }));
Assert.AreEqual("2 items in IEnumerable<Object>", mi.Invoke(o, new object[] { coll_str, 1 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { int_array, 1 }));
t = TypeOf.AVT_GenType.MakeGenericType(TypeOf.Int32, TypeOf.Short);
o = Activator.CreateInstance(t);
mi = t.GetTypeInfo().GetDeclaredMethod("RunTest");
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { coll_str, 0 }));
Assert.AreEqual("3 items in ICollection<Int32>", mi.Invoke(o, new object[] { int_array, 0 }));
Assert.AreEqual("6 items in ICollection<Int32>", mi.Invoke(o, new object[] { enum_array, 0 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { coll_str, 1 }));
Assert.AreEqual("3 items in IEnumerable<Int32>", mi.Invoke(o, new object[] { int_array, 1 }));
Assert.AreEqual("6 items in IEnumerable<Int32>", mi.Invoke(o, new object[] { enum_array, 1 }));
t = TypeOf.AVT_GenType.MakeGenericType(typeof(MyTestEnum), TypeOf.Short);
o = Activator.CreateInstance(t);
mi = t.GetTypeInfo().GetDeclaredMethod("RunTest");
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { coll_str, 0 }));
Assert.AreEqual("3 items in ICollection<MyTestEnum>", mi.Invoke(o, new object[] { int_array, 0 }));
Assert.AreEqual("6 items in ICollection<MyTestEnum>", mi.Invoke(o, new object[] { enum_array, 0 }));
Assert.AreEqual("NULL", mi.Invoke(o, new object[] { coll_str, 1 }));
Assert.AreEqual("3 items in IEnumerable<MyTestEnum>", mi.Invoke(o, new object[] { int_array, 1 }));
Assert.AreEqual("6 items in IEnumerable<MyTestEnum>", mi.Invoke(o, new object[] { enum_array, 1 }));
}
}
}
namespace IsInstTest
{
public interface IBase { }
public interface IObject : IBase { string Func(); }
public class MyObject : IObject
{
string _id;
public MyObject(string id) { _id = id; }
public string Func() { return this.ToString(); }
public override string ToString() { return "MyObject{" + _id + "}"; }
}
public class MyStruct : IObject
{
string _id;
public MyStruct(string id) { _id = id; }
public string Func() { return this.ToString(); }
public override string ToString() { return "MyStruct{" + _id + "}"; }
}
public class ObjectActivator
{
public object Activate(string id, bool activateTheStruct)
{
return activateTheStruct ? (object)new MyStruct(id) : (object)new MyObject(id);
}
}
public class TestType
{
public T ActivateObject_IsInstT<T, U>(string id, bool activateTheStruct) where T : class
{
object o = new ObjectActivator().Activate(id, activateTheStruct);
T t = o as T;
return t;
}
public T ActivateArray_IsInstT<T, U>(string id, bool activateTheStruct) where T : class
{
IObject[] array = new IObject[] {
(IObject)new ObjectActivator().Activate(id, activateTheStruct),
(IObject)new ObjectActivator().Activate(id, activateTheStruct),
(IObject)new ObjectActivator().Activate(id, activateTheStruct)
};
T t = array as T;
return t;
}
}
public class TestRunner
{
[TestMethod]
public static unsafe void RunIsInstAndCheckCastTest()
{
// Test isinst of an interface
MethodInfo ActivateObject_IsInstT = typeof(TestType).GetTypeInfo().GetDeclaredMethod("ActivateObject_IsInstT").MakeGenericMethod(typeof(IObject), TypeOf.Double);
IObject myObject1 = (IObject)ActivateObject_IsInstT.Invoke(new TestType(), new object[] { "1", false });
Assert.AreEqual(myObject1.Func(), "MyObject{1}");
IObject myObject2 = (IObject)ActivateObject_IsInstT.Invoke(new TestType(), new object[] { "2", true });
Assert.AreEqual(myObject2.Func(), "MyStruct{2}");
// Test isinst of a class
ActivateObject_IsInstT = typeof(TestType).GetTypeInfo().GetDeclaredMethod("ActivateObject_IsInstT").MakeGenericMethod(typeof(MyObject), TypeOf.Double);
IObject myObject3 = (IObject)ActivateObject_IsInstT.Invoke(new TestType(), new object[] { "3", false });
Assert.AreEqual(myObject3.Func(), "MyObject{3}");
IObject myObject4 = (IObject)ActivateObject_IsInstT.Invoke(new TestType(), new object[] { "4", true });
Assert.IsTrue(myObject4 == null);
// Test isinst of an array
MethodInfo ActivateArray_IsInstT = typeof(TestType).GetTypeInfo().GetDeclaredMethod("ActivateArray_IsInstT").MakeGenericMethod(typeof(IBase[]), TypeOf.Double);
IBase[] myArray1 = (IBase[])ActivateArray_IsInstT.Invoke(new TestType(), new object[] { "5", false });
Assert.IsTrue(myArray1.Length == 3);
Assert.AreEqual(((IObject)myArray1[0]).Func(), "MyObject{5}");
Assert.AreEqual(((IObject)myArray1[1]).Func(), "MyObject{5}");
Assert.AreEqual(((IObject)myArray1[2]).Func(), "MyObject{5}");
IBase[] myArray2 = (IBase[])ActivateArray_IsInstT.Invoke(new TestType(), new object[] { "6", true });
Assert.IsTrue(myArray2.Length == 3);
Assert.AreEqual(((IObject)myArray2[0]).Func(), "MyStruct{6}");
Assert.AreEqual(((IObject)myArray2[1]).Func(), "MyStruct{6}");
Assert.AreEqual(((IObject)myArray2[2]).Func(), "MyStruct{6}");
}
}
}
namespace DelegateCallTest
{
public interface IBar { }
public class Bar : IBar
{
public Bar() { Console.WriteLine("BarCtor"); }
public override string ToString() { return "BarInstance"; }
}
public class Foo
{
public string CallMethodThroughDelegate<T>(T tValue, Func<IBar, T, string> action)
{
if (action == null)
{
throw new ArgumentNullException("action");
}
return action(new Bar(), tValue);
}
public string Method<T>(IBar i, T tValue)
{
string res = "Method<" + typeof(T) + ">, " + i.ToString() + ", " + tValue.ToString();
return res;
}
}
public class TestRunner
{
[TestMethod]
public static unsafe void TestCallMethodThroughUsgDelegate()
{
Foo o = new Foo();
MethodInfo Method = typeof(Foo).GetTypeInfo().GetDeclaredMethod("Method").MakeGenericMethod(TypeOf.Double);
Type delType = typeof(Func<,,>).MakeGenericType(typeof(IBar), TypeOf.Double, TypeOf.String);
Delegate d = Method.CreateDelegate(delType, o);
MethodInfo CallMethodThroughDelegate = typeof(Foo).GetTypeInfo().GetDeclaredMethod("CallMethodThroughDelegate").MakeGenericMethod(TypeOf.Double);
string res = (string)CallMethodThroughDelegate.Invoke(o, new object[] { 1.2, d });
Assert.AreEqual(res, "Method<System.Double>, BarInstance, 1.2");
}
}
}
// Repro taken from a real app (System.Reactive framework). Bug in field layout caused crashes on x86.
namespace FieldLayoutBugRepro
{
public abstract class CallerBase
{
public abstract string DoCall(object state, TimeSpan dueTime, object action);
}
public class Caller<TState> : CallerBase
{
public override string DoCall(object state, TimeSpan dueTime, object action)
{
BaseType obj = new DerivedType();
return obj.Schedule<TState>((TState)state, dueTime, (Func<IInterface, TState, string>)action);
}
}
public interface IInterface { }
public class BaseType : IInterface
{
public virtual string Schedule<TState>(TState state, TimeSpan dueTime, Func<IInterface, TState, string> action) { return null; }
public override string ToString() { return "BaseType"; }
}
public class DerivedType : BaseType
{
public override string Schedule<TState>(TState state, TimeSpan dueTime, Func<IInterface, TState, string> action)
{
// Root static typespecs:
var t1 = typeof(ScheduledItem<TimeSpan>);
var t2 = typeof(ScheduledItem<TimeSpan, StateProducer<EventPattern<string>>.State>);
ScheduledItem<TimeSpan, TState> scheduledItem = new ScheduledItem<TimeSpan, TState>(this, state, action, dueTime);
return ((ScheduledItem<TimeSpan>)scheduledItem).Execute();
}
public override string ToString()
{
return "DerivedType";
}
}
public interface IMyComparer<T> { }
public class MyComparer<T> : IMyComparer<T>
{
public override string ToString() { return "MyComparer<" + typeof(T) + ">"; }
}
public interface IScheduledItem<TAbsolute> { }
public abstract class ScheduledItem<TAbsolute> : IScheduledItem<TAbsolute>, IComparable<ScheduledItem<TAbsolute>> where TAbsolute : IComparable<TAbsolute>
{
private readonly string _disposable = new String('c', 3);
protected readonly TAbsolute _dueTime;
protected readonly IMyComparer<TAbsolute> _comparer;
[MethodImpl(MethodImplOptions.NoInlining)]
protected ScheduledItem(TAbsolute dueTime, IMyComparer<TAbsolute> comparer)
{
this._dueTime = dueTime;
this._comparer = comparer;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public int CompareTo(ScheduledItem<TAbsolute> other) { return 1; }
[MethodImpl(MethodImplOptions.NoInlining)]
public string Execute() { return ExecuteCore(); }
[MethodImpl(MethodImplOptions.NoInlining)]
public abstract string ExecuteCore();
}
public class ScheduledItem<TAbsolute, TValue> : ScheduledItem<TAbsolute> where TAbsolute : IComparable<TAbsolute>
{
private readonly IInterface _scheduler;
private readonly TValue _state;
private readonly Func<IInterface, TValue, string> _action;
[MethodImpl(MethodImplOptions.NoInlining)]
public ScheduledItem(IInterface scheduler, TValue state, Func<IInterface, TValue, string> action, TAbsolute dueTime)
: this(scheduler, state, action, dueTime, new MyComparer<TAbsolute>())
{
}
[MethodImpl(MethodImplOptions.NoInlining)]
public ScheduledItem(IInterface scheduler, TValue state, Func<IInterface, TValue, string> action, TAbsolute dueTime, IMyComparer<TAbsolute> comparer)
: base(dueTime, comparer)
{
this._scheduler = scheduler;
this._state = state;
this._action = action;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public override string ExecuteCore() { return this.ToString() + "=" + _action(_scheduler, _state); }
[MethodImpl(MethodImplOptions.NoInlining)]
public override string ToString() { return "ScheduledItem<" + typeof(TAbsolute) + "," + typeof(TValue) + ">{_dueTime=" + _dueTime + ",_comparer=" + _comparer + "}"; }
}
public abstract class StateProducerBase
{
[MethodImpl(MethodImplOptions.NoInlining)]
public abstract object GetState(string s1, string s2);
}
public class StateProducer<TSource> : StateProducerBase
{
public struct State
{
public string _s1;
public string _s2;
public State(string s1, string s2)
{
_s1 = s1;
_s2 = s2;
}
[MethodImpl(MethodImplOptions.NoInlining)]
public override string ToString() { return "StateProducer<" + typeof(TSource) + ">/State[" + _s1 + _s2 + "]"; }
}
[MethodImpl(MethodImplOptions.NoInlining)]
public override object GetState(string s1, string s2) { return new State(s1, s2); }
}
public sealed class EventPattern<TEventArgs> { }
public partial class Runner
{
[TestMethod]
public static unsafe void EntryPoint()
{
Type targ1 = typeof(EventPattern<>).MakeGenericType(TypeOf.String);
Type targ2 = typeof(StateProducer<>).MakeGenericType(targ1);
// *** RANDOME REFLECTION BUG: this works on the desktop CLR, but doesn't in ProjectN :) ***:
//Type targ3 = targ2.GetTypeInfo().GetDeclaredNestedType("State").MakeGenericType(targ1);
// Use this workaround instead:
Type targ3 = typeof(StateProducer<>).GetTypeInfo().GetDeclaredNestedType("State").MakeGenericType(targ1);
Type delType = typeof(Func<,,>).MakeGenericType(typeof(IInterface), targ3, TypeOf.String);
var state = ((StateProducerBase)Activator.CreateInstance(targ2)).GetState("abc", "def");
TimeSpan dueTime = new TimeSpan(0x123);
Delegate action = typeof(Runner).GetTypeInfo().GetDeclaredMethod("MyDelTarget").MakeGenericMethod(targ3).CreateDelegate(delType);
Type callerType = typeof(Caller<>).MakeGenericType(targ3);
CallerBase caller = (CallerBase)Activator.CreateInstance(callerType);
string result = caller.DoCall(state, dueTime, action);
Assert.AreEqual("ScheduledItem<System.TimeSpan,FieldLayoutBugRepro.StateProducer`1+State[FieldLayoutBugRepro.EventPattern`1[System.String]]>{_dueTime=00:00:00.0000291,_comparer=MyComparer<System.TimeSpan>}={scheduler=DerivedType,state=StateProducer<FieldLayoutBugRepro.EventPattern`1[System.String]>/State[abcdef]}", result);
}
public static string MyDelTarget<TState>(IInterface scheduler, TState state)
{
return "{scheduler=" + scheduler + ",state=" + state + "}";
}
}
}
namespace DelegateTest
{
public class BaseType
{
public virtual Func<T, string> GVMethod1<T>(T t) { return null; }
public virtual Func<T, string> GVMethod2<T>(T t) { return null; }
}
public class DerivedType : BaseType
{
public override Func<T, string> GVMethod1<T>(T t)
{
return new Func<T, string>((new GenType<T, string>().Method));
}
public override Func<T, string> GVMethod2<T>(T t)
{
return new Func<T, string>((new NonGenType().GenMethod<T, string>));
}
}
public class GenType<T, U>
{
public string Method(T t)
{
return "GenType<" + t.GetType() + "," + typeof(U) + ">.Method{" + t + "," + default(U) + "}";
}
}
public class NonGenType
{
public string GenMethod<T, U>(T t)
{
return "NonGenType.GenMethod<" + t.GetType() + "," + typeof(U) + ">{" + t + "," + default(U) + "}";
}
}
public partial class TestRunner
{
[TestMethod]
public static unsafe void TestMethodCellsWithUSGTargetsUsedOnNonUSGInstantiations()
{
// Root compatible normal canonical instantiations
new GenType<double, object>();
new NonGenType().GenMethod<double, object>(0);
MethodInfo GVMethod1 = typeof(BaseType).GetTypeInfo().GetDeclaredMethod("GVMethod1").MakeGenericMethod(TypeOf.Double);
Delegate del = (Delegate)GVMethod1.Invoke(new DerivedType(), new object[] { 12.34 });
string result = (string)del.DynamicInvoke(new object[] { 56.79 });
Assert.AreEqual("GenType<System.Double,System.String>.Method{56.79,}", result);
MethodInfo GVMethod2 = typeof(BaseType).GetTypeInfo().GetDeclaredMethod("GVMethod2").MakeGenericMethod(TypeOf.Double);
del = (Delegate)GVMethod2.Invoke(new DerivedType(), new object[] { 11.22 });
result = (string)del.DynamicInvoke(new object[] { 88.99 });
Assert.AreEqual("NonGenType.GenMethod<System.Double,System.String>{88.99,}", result);
}
}
}
namespace ArrayExceptionsTest
{
public enum IntBasedEnum
{
}
public enum ShortBasedEnum : short
{
}
public abstract class BaseType
{
public abstract void TestSetExceptionRank1(object valToSet);
public abstract void TestAddressOfExceptionRank1();
public abstract void TestSetExceptionRank2(object valToSet);
public abstract void TestAddressOfExceptionRank2();
public abstract void TestSetExceptionRank3(object valToSet);
public abstract void TestAddressOfExceptionRank3();
public abstract void TestSetExceptionRank4(object valToSet);
public abstract void TestAddressOfExceptionRank4();
}
public class DerivedType<T,U,V> : BaseType
{
[MethodImpl(MethodImplOptions.NoInlining)]
void Func(ref U t)
{ }
public override void TestSetExceptionRank1(object valToSet)
{
T[] tArray = new T[1];
U[] uArray = (U[])(object)tArray;
uArray[0] = (U)valToSet;
}
public override void TestAddressOfExceptionRank1()
{
T[] tArray = new T[1];
U[] uArray = (U[])(object)tArray;
Func(ref uArray[0]);
}
public override void TestSetExceptionRank2(object valToSet)
{
T[,] tArray = new T[1, 1];
U[,] uArray = (U[,])(object)tArray;
uArray[0, 0] = (U)valToSet;
}
public override void TestAddressOfExceptionRank2()
{
T[,] tArray = new T[1, 1];
U[,] uArray = (U[,])(object)tArray;
Func(ref uArray[0, 0]);
}
public override void TestSetExceptionRank3(object valToSet)
{
T[,,] tArray = new T[1, 1, 1];
U[,,] uArray = (U[,,])(object)tArray;
uArray[0, 0, 0] = (U)valToSet;
}
public override void TestAddressOfExceptionRank3()
{
T[,,] tArray = new T[1, 1, 1];
U[,,] uArray = (U[,,])(object)tArray;
Func(ref uArray[0, 0, 0]);
}
public override void TestSetExceptionRank4(object valToSet)
{
T[, ,,] tArray = new T[1, 1, 1, 1];
U[, ,,] uArray = (U[, ,,])(object)tArray;
uArray[0, 0, 0, 0] = (U)valToSet;
}
public override void TestAddressOfExceptionRank4()
{
T[, ,,] tArray = new T[1, 1, 1, 1];
U[, ,,] uArray = (U[, ,,])(object)tArray;
Func(ref uArray[0, 0, 0, 0]);
}
}
public class Runner
{
static void RunIndividualTests(BaseType o, object setObject, bool expectedToThrow)
{
if (expectedToThrow)
{
Assert.Throws<ArrayTypeMismatchException>(() => { o.TestSetExceptionRank1(setObject); });
Assert.Throws<ArrayTypeMismatchException>(() => { o.TestAddressOfExceptionRank1(); });
Assert.Throws<ArrayTypeMismatchException>(() => { o.TestSetExceptionRank2(setObject); });
Assert.Throws<ArrayTypeMismatchException>(() => { o.TestAddressOfExceptionRank2(); });
Assert.Throws<ArrayTypeMismatchException>(() => { o.TestSetExceptionRank3(setObject); });
Assert.Throws<ArrayTypeMismatchException>(() => { o.TestAddressOfExceptionRank3(); });
Assert.Throws<ArrayTypeMismatchException>(() => { o.TestSetExceptionRank4(setObject); });
Assert.Throws<ArrayTypeMismatchException>(() => { o.TestAddressOfExceptionRank4(); });
}
else
{
o.TestSetExceptionRank1(setObject);
o.TestAddressOfExceptionRank1();
o.TestSetExceptionRank2(setObject);
o.TestAddressOfExceptionRank2();
o.TestSetExceptionRank3(setObject);
o.TestAddressOfExceptionRank3();
o.TestSetExceptionRank4(setObject);
o.TestAddressOfExceptionRank4();
}
}
[TestMethod]
public static unsafe void ArrayExceptionsTest_String_Object()
{
Type t = typeof(DerivedType<,,>).MakeGenericType(TypeOf.String, TypeOf.Object, TypeOf.Short);
RunIndividualTests((BaseType)Activator.CreateInstance(t), new object(), true);
}
[TestMethod]
public static unsafe void ArrayExceptionsTest_Int32_Int32()
{
Type t = typeof(DerivedType<,,>).MakeGenericType(TypeOf.Int32, TypeOf.Int32, TypeOf.Short);
RunIndividualTests((BaseType)Activator.CreateInstance(t), (object)1024, false);
}
[TestMethod]
public static unsafe void ArrayExceptionsTest_Int32_IntBasedEnum()
{
Type t = typeof(DerivedType<,,>).MakeGenericType(TypeOf.Int32, typeof(IntBasedEnum), TypeOf.Short);
RunIndividualTests((BaseType)Activator.CreateInstance(t), (object)1024, false);
}
[TestMethod]
public static unsafe void ArrayExceptionsTest_UInt32_Int32()
{
Type t = typeof(DerivedType<,,>).MakeGenericType(typeof(uint), TypeOf.Int32, TypeOf.Short);
RunIndividualTests((BaseType)Activator.CreateInstance(t), (object)1024, false);
}
}
}
namespace UnboxAnyTests
{
public enum IntBasedEnum
{
Val = 3
}
public enum ShortBasedEnum : short
{
Val = 17
}
public abstract class BaseType
{
public abstract object TestUnboxAnyAndRebox(object valToSet);
}
public class DerivedType<T,V> : BaseType
{
public static T m_t;
public override object TestUnboxAnyAndRebox(object valToSet)
{
m_t = (T)valToSet;
return (object)m_t;
}
}
public class Runner
{
[TestMethod]
public static unsafe void TestUnboxAnyToString()
{
Type t = typeof(DerivedType<,>).MakeGenericType(TypeOf.String, TypeOf.Short);
BaseType o = (BaseType)Activator.CreateInstance(t);
object tempObj = "TestString";
Assert.AreEqual(tempObj, o.TestUnboxAnyAndRebox(tempObj));
Assert.AreEqual(null, o.TestUnboxAnyAndRebox(null));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
}
[TestMethod]
public static unsafe void TestUnboxAnyToInt()
{
Type t = typeof(DerivedType<,>).MakeGenericType(TypeOf.Int32, TypeOf.Short);
BaseType o = (BaseType)Activator.CreateInstance(t);
Assert.AreEqual(43, (int)o.TestUnboxAnyAndRebox(43));
Assert.AreEqual(IntBasedEnum.Val, (IntBasedEnum)o.TestUnboxAnyAndRebox(IntBasedEnum.Val));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
Assert.Throws<NullReferenceException>(() => { o.TestUnboxAnyAndRebox(null); });
}
[TestMethod]
public static unsafe void TestUnboxAnyToIntBasedEnum()
{
Type t = typeof(DerivedType<,>).MakeGenericType(typeof(IntBasedEnum), TypeOf.Short);
BaseType o = (BaseType)Activator.CreateInstance(t);
Assert.AreEqual(43, (int)o.TestUnboxAnyAndRebox(43));
Assert.AreEqual(IntBasedEnum.Val, (IntBasedEnum)o.TestUnboxAnyAndRebox(IntBasedEnum.Val));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
Assert.Throws<NullReferenceException>(() => { o.TestUnboxAnyAndRebox(null); });
}
[TestMethod]
public static unsafe void TestUnboxAnyToNullableInt()
{
Type t = typeof(DerivedType<,>).MakeGenericType(typeof(int?), TypeOf.Short);
BaseType o = (BaseType)Activator.CreateInstance(t);
Assert.AreEqual(14, (int)o.TestUnboxAnyAndRebox(14));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(IntBasedEnum.Val); });
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
Assert.AreEqual(null, o.TestUnboxAnyAndRebox(null));
}
[TestMethod]
public static unsafe void TestUnboxAnyToNullableIntBasedEnum()
{
Type t = typeof(DerivedType<,>).MakeGenericType(typeof(IntBasedEnum?), TypeOf.Short);
BaseType o = (BaseType)Activator.CreateInstance(t);
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(14); });
Assert.AreEqual(IntBasedEnum.Val, (IntBasedEnum)o.TestUnboxAnyAndRebox(IntBasedEnum.Val));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
Assert.AreEqual(null, o.TestUnboxAnyAndRebox(null));
}
[TestMethod]
public static unsafe void TestUnboxAnyToShort_NonUSG()
{
// Test non-usg case for parallel verification
BaseType o = new DerivedType<short,sbyte>();
Assert.AreEqual(43, (short)o.TestUnboxAnyAndRebox((object)(short)43));
Assert.AreEqual(ShortBasedEnum.Val, (ShortBasedEnum)o.TestUnboxAnyAndRebox(ShortBasedEnum.Val));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
Assert.Throws<NullReferenceException>(() => { o.TestUnboxAnyAndRebox(null); });
}
[TestMethod]
public static unsafe void TestUnboxAnyToShortBasedEnum_NonUSG()
{
// Test non-usg case for parallel verification
BaseType o = new DerivedType<ShortBasedEnum,sbyte>();
Assert.AreEqual(14, (short)o.TestUnboxAnyAndRebox((object)(short)14));
Assert.AreEqual(ShortBasedEnum.Val, (ShortBasedEnum)o.TestUnboxAnyAndRebox(ShortBasedEnum.Val));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
Assert.Throws<NullReferenceException>(() => { o.TestUnboxAnyAndRebox(null); });
}
[TestMethod]
public static unsafe void TestUnboxAnyToNullableShort_NonUSG()
{
// Test non-usg case for parallel verification
BaseType o = new DerivedType<short?,sbyte>();
Assert.AreEqual(14, (short)o.TestUnboxAnyAndRebox((object)(short)14));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(ShortBasedEnum.Val); });
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
Assert.AreEqual(null, o.TestUnboxAnyAndRebox(null));
}
[TestMethod]
public static unsafe void TestUnboxAnyToNullableShortBasedEnum_NonUSG()
{
// Test non-usg case for parallel verification
BaseType o = new DerivedType<ShortBasedEnum?,sbyte>();
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox((object)(short)14); });
Assert.AreEqual(ShortBasedEnum.Val, (ShortBasedEnum)o.TestUnboxAnyAndRebox(ShortBasedEnum.Val));
Assert.Throws<InvalidCastException>(() => { o.TestUnboxAnyAndRebox(new object()); });
Assert.AreEqual(null, o.TestUnboxAnyAndRebox(null));
}
}
}
namespace HFATest
{
public struct Struct00<F, D, I, L> { public D _f1; }
public struct Struct01<F, D, I, L> { public F _f1; }
public struct Struct02<F, D, I, L> { public I _f1; }
public struct Struct03<F, D, I, L> { public L _f1; }
public struct Struct10<F, D, I, L> { public F _f1; public D _f2; }
public struct Struct11<F, D, I, L> { public F _f1; public F _f2; }
public struct Struct12<F, D, I, L> { public F _f1; public I _f2; }
public struct Struct13<F, D, I, L> { public F _f1; public L _f2; }
public struct Struct14<F, D, I, L> { public D _f1; public D _f2; }
public struct Struct15<F, D, I, L> { public D _f1; public F _f2; }
public struct Struct16<F, D, I, L> { public D _f1; public I _f2; }
public struct Struct17<F, D, I, L> { public D _f1; public L _f2; }
public struct Struct20<F, D, I, L> { public F _f1; public D _f2; public F _f3; }
public struct Struct21<F, D, I, L> { public F _f1; public F _f2; public F _f3; }
public struct Struct22<F, D, I, L> { public F _f1; public I _f2; public F _f3; }
public struct Struct23<F, D, I, L> { public F _f1; public L _f2; public F _f3; }
public struct Struct24<F, D, I, L> { public D _f1; public D _f2; public D _f3; }
public struct Struct25<F, D, I, L> { public D _f1; public F _f2; public D _f3; }
public struct Struct26<F, D, I, L> { public D _f1; public I _f2; public D _f3; }
public struct Struct27<F, D, I, L> { public D _f1; public L _f2; public D _f3; }
public struct Struct30<F, D, I, L> { public F _f1; public D _f2; public F _f3; public F _f4; }
public struct Struct31<F, D, I, L> { public F _f1; public F _f2; public F _f3; public F _f4; }
public struct Struct32<F, D, I, L> { public F _f1; public I _f2; public F _f3; public F _f4; }
public struct Struct33<F, D, I, L> { public F _f1; public L _f2; public F _f3; public F _f4; }
public struct Struct34<F, D, I, L> { public D _f1; public D _f2; public D _f3; public D _f4; }
public struct Struct35<F, D, I, L> { public D _f1; public F _f2; public D _f3; public D _f4; }
public struct Struct36<F, D, I, L> { public D _f1; public I _f2; public D _f3; public D _f4; }
public struct Struct37<F, D, I, L> { public D _f1; public L _f2; public D _f3; public D _f4; }
public struct Struct40<F, D, I, L> { public F _f1; public F _f2; public F _f3; public F _f4; public D _f5; }
public struct Struct41<F, D, I, L> { public F _f1; public F _f2; public F _f3; public F _f4; public F _f5; }
public struct Struct42<F, D, I, L> { public F _f1; public F _f2; public F _f3; public F _f4; public I _f5; }
public struct Struct43<F, D, I, L> { public F _f1; public F _f2; public F _f3; public F _f4; public L _f5; }
public struct Struct44<F, D, I, L> { public D _f1; public D _f2; public D _f3; public D _f4; public D _f5; }
public struct Struct45<F, D, I, L> { public D _f1; public D _f2; public D _f3; public D _f4; public F _f5; }
public struct Struct46<F, D, I, L> { public D _f1; public D _f2; public D _f3; public D _f4; public I _f5; }
public struct Struct47<F, D, I, L> { public D _f1; public D _f2; public D _f3; public D _f4; public L _f5; }
public struct FComplex00<F, D, I, L> { public F _f1; public Struct00<F, D, I, L> _f2; }
public struct FComplex01<F, D, I, L> { public F _f1; public Struct01<F, D, I, L> _f2; }
public struct FComplex02<F, D, I, L> { public F _f1; public Struct02<F, D, I, L> _f2; }
public struct FComplex03<F, D, I, L> { public F _f1; public Struct03<F, D, I, L> _f2; }
public struct FComplex10<F, D, I, L> { public F _f1; public Struct20<F, D, I, L> _f2; }
public struct FComplex11<F, D, I, L> { public F _f1; public Struct21<F, D, I, L> _f2; }
public struct FComplex12<F, D, I, L> { public F _f1; public Struct22<F, D, I, L> _f2; }
public struct FComplex13<F, D, I, L> { public F _f1; public Struct23<F, D, I, L> _f2; }
public struct FComplex14<F, D, I, L> { public F _f1; public Struct24<F, D, I, L> _f2; }
public struct FComplex15<F, D, I, L> { public F _f1; public Struct25<F, D, I, L> _f2; }
public struct FComplex16<F, D, I, L> { public F _f1; public Struct26<F, D, I, L> _f2; }
public struct FComplex17<F, D, I, L> { public F _f1; public Struct27<F, D, I, L> _f2; }
public struct DComplex00<F, D, I, L> { public D _f1; public Struct00<F, D, I, L> _f2; }
public struct DComplex01<F, D, I, L> { public D _f1; public Struct01<F, D, I, L> _f2; }
public struct DComplex02<F, D, I, L> { public D _f1; public Struct02<F, D, I, L> _f2; }
public struct DComplex03<F, D, I, L> { public D _f1; public Struct03<F, D, I, L> _f2; }
public struct DComplex10<F, D, I, L> { public D _f1; public Struct20<F, D, I, L> _f2; }
public struct DComplex11<F, D, I, L> { public D _f1; public Struct21<F, D, I, L> _f2; }
public struct DComplex12<F, D, I, L> { public D _f1; public Struct22<F, D, I, L> _f2; }
public struct DComplex13<F, D, I, L> { public D _f1; public Struct23<F, D, I, L> _f2; }
public struct DComplex14<F, D, I, L> { public D _f1; public Struct24<F, D, I, L> _f2; }
public struct DComplex15<F, D, I, L> { public D _f1; public Struct25<F, D, I, L> _f2; }
public struct DComplex16<F, D, I, L> { public D _f1; public Struct26<F, D, I, L> _f2; }
public struct DComplex17<F, D, I, L> { public D _f1; public Struct27<F, D, I, L> _f2; }
public struct Floats3<F, D, I, L> { public F _f1; public F _f2; public F _f3; }
public struct Floats4<F, D, I, L> { public F _f1; public F _f2; public F _f3; public F _f4; }
public struct Floats3Complex<F, D, I, L> { public Floats3<F, D, I, L> _f1; }
public struct Floats4Complex1<F, D, I, L> { public Floats3<F, D, I, L> _f1; public F _f2; }
public struct Floats4Complex2<F, D, I, L> { public Floats4<F, D, I, L> _f1; }
public struct Floats4Complex3<F, D, I, L> { public Floats4<F, D, I, L> _f1; public F _f2; }
public struct Doubles3<F, D, I, L> { public D _f1; public D _f2; public D _f3; }
public struct Doubles4<F, D, I, L> { public D _f1; public D _f2; public D _f3; public D _f4; }
public struct Doubles3Complex<F, D, I, L> { public Doubles3<F, D, I, L> _f1; }
public struct Doubles4Complex1<F, D, I, L> { public Doubles3<F, D, I, L> _f1; public D _f2; }
public struct Doubles4Complex2<F, D, I, L> { public Doubles4<F, D, I, L> _f1; }
public struct Doubles4Complex3<F, D, I, L> { public Doubles4<F, D, I, L> _f1; public D _f2; }
public struct GenStructWrapper<T> { public T _f1; }
public class TestClass<T>
{
public static void TestStruct(T t, object[] values)
{
TestStruct_Inner1(TestStruct_Inner1(t, values), values);
TestStruct_Inner2("abc", TestStruct_Inner2("abc", t, values), values);
TestStruct_Inner3("abc", "def", TestStruct_Inner3("abc", "def", t, values), values);
}
public static T TestStruct_Inner1(T t, object[] values)
{
CheckFieldValues(t, typeof(T).GetTypeInfo(), values, 0);
T copy = t;
return copy;
}
public static T TestStruct_Inner2(string param1, T t, object[] values)
{
CheckFieldValues(t, typeof(T).GetTypeInfo(), values, 0);
T copy = t;
return copy;
}
public static T TestStruct_Inner3(string param1, string param2, T t, object[] values)
{
CheckFieldValues(t, typeof(T).GetTypeInfo(), values, 0);
T copy = t;
return copy;
}
static void CheckFieldValues(object obj, TypeInfo ti, object[] values, int index)
{
for (int i = 1; i <= 5; i++)
{
FieldInfo fi = ti.GetDeclaredField("_f" + i);
if (fi == null) break;
if (fi.FieldType.Name.Contains("Struct") || fi.FieldType.Name.Contains("Floats") || fi.FieldType.Name.Contains("Doubles") || fi.DeclaringType.Name.Contains("GenStructWrapper"))
{
TypeInfo complexti = fi.FieldType.GetTypeInfo();
object complexObj = fi.GetValue(obj);
CheckFieldValues(complexObj, complexti, values, index);
}
else
{
//Console.WriteLine(obj.GetType() + "._f" + i + " == " + values[index] + " ? " + (fi.GetValue(obj).Equals(values[index])));
Assert.AreEqual(fi.GetValue(obj), values[index]);
index++;
}
}
}
}
public class Runner
{
[TestMethod]
public static unsafe void HFATestEntryPoint()
{
// suppress stupid warning about field not being used in code...
new GenStructWrapper<string> { _f1 = "abc" };
HFATestEntryPoint_Inner(typeof(Struct00<,,,>));
HFATestEntryPoint_Inner(typeof(Struct01<,,,>));
HFATestEntryPoint_Inner(typeof(Struct02<,,,>));
HFATestEntryPoint_Inner(typeof(Struct03<,,,>));
HFATestEntryPoint_Inner(typeof(Struct10<,,,>));
HFATestEntryPoint_Inner(typeof(Struct11<,,,>));
HFATestEntryPoint_Inner(typeof(Struct12<,,,>));
HFATestEntryPoint_Inner(typeof(Struct13<,,,>));
HFATestEntryPoint_Inner(typeof(Struct14<,,,>));
HFATestEntryPoint_Inner(typeof(Struct15<,,,>));
HFATestEntryPoint_Inner(typeof(Struct16<,,,>));
HFATestEntryPoint_Inner(typeof(Struct17<,,,>));
HFATestEntryPoint_Inner(typeof(Struct20<,,,>));
HFATestEntryPoint_Inner(typeof(Struct21<,,,>));
HFATestEntryPoint_Inner(typeof(Struct22<,,,>));
HFATestEntryPoint_Inner(typeof(Struct23<,,,>));
HFATestEntryPoint_Inner(typeof(Struct24<,,,>));
HFATestEntryPoint_Inner(typeof(Struct25<,,,>));
HFATestEntryPoint_Inner(typeof(Struct26<,,,>));
HFATestEntryPoint_Inner(typeof(Struct27<,,,>));
HFATestEntryPoint_Inner(typeof(Struct30<,,,>));
HFATestEntryPoint_Inner(typeof(Struct31<,,,>));
HFATestEntryPoint_Inner(typeof(Struct32<,,,>));
HFATestEntryPoint_Inner(typeof(Struct33<,,,>));
HFATestEntryPoint_Inner(typeof(Struct34<,,,>));
HFATestEntryPoint_Inner(typeof(Struct35<,,,>));
HFATestEntryPoint_Inner(typeof(Struct36<,,,>));
HFATestEntryPoint_Inner(typeof(Struct37<,,,>));
HFATestEntryPoint_Inner(typeof(Struct40<,,,>));
HFATestEntryPoint_Inner(typeof(Struct41<,,,>));
HFATestEntryPoint_Inner(typeof(Struct42<,,,>));
HFATestEntryPoint_Inner(typeof(Struct43<,,,>));
HFATestEntryPoint_Inner(typeof(Struct44<,,,>));
HFATestEntryPoint_Inner(typeof(Struct45<,,,>));
HFATestEntryPoint_Inner(typeof(Struct46<,,,>));
HFATestEntryPoint_Inner(typeof(Struct47<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex00<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex01<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex02<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex03<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex10<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex11<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex12<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex13<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex14<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex15<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex16<,,,>));
HFATestEntryPoint_Inner(typeof(FComplex17<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex00<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex01<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex02<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex03<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex10<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex11<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex12<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex13<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex14<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex15<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex16<,,,>));
HFATestEntryPoint_Inner(typeof(DComplex17<,,,>));
HFATestEntryPoint_Inner(typeof(Floats3<,,,>));
HFATestEntryPoint_Inner(typeof(Floats4<,,,>));
HFATestEntryPoint_Inner(typeof(Floats3Complex<,,,>));
HFATestEntryPoint_Inner(typeof(Floats4Complex1<,,,>));
HFATestEntryPoint_Inner(typeof(Floats4Complex2<,,,>));
HFATestEntryPoint_Inner(typeof(Floats4Complex3<,,,>));
HFATestEntryPoint_Inner(typeof(Doubles3<,,,>));
HFATestEntryPoint_Inner(typeof(Doubles4<,,,>));
HFATestEntryPoint_Inner(typeof(Doubles3Complex<,,,>));
HFATestEntryPoint_Inner(typeof(Doubles4Complex1<,,,>));
HFATestEntryPoint_Inner(typeof(Doubles4Complex2<,,,>));
HFATestEntryPoint_Inner(typeof(Doubles4Complex3<,,,>));
}
static void HFATestEntryPoint_Inner(Type structType)
{
Type genStructInst = structType.MakeGenericType(TypeOf.Float, TypeOf.Double, TypeOf.Int32, TypeOf.Long);
{
TypeOf.HFA_TestClass.MakeGenericType(genStructInst).GetTypeInfo().GetDeclaredMethod("TestStruct").Invoke(null, GetInstanceAndValuesArray(genStructInst));
}
{
Type genStructWrapper = TypeOf.HFA_GenStructWrapper.MakeGenericType(genStructInst);
TypeOf.HFA_TestClass.MakeGenericType(genStructWrapper).GetTypeInfo().GetDeclaredMethod("TestStruct").Invoke(null, GetInstanceAndValuesArray(genStructWrapper));
}
}
public static unsafe object[] GetInstanceAndValuesArray(Type genStructInst)
{
object obj = Activator.CreateInstance(genStructInst);
List<object> values = new List<object>();
FillFieldValues(obj, 1, values);
return new object[] { obj, values.ToArray() };
}
static void FillFieldValues(object obj, int multiplier, List<object> values)
{
for (int i = 1; i <= 5; i++)
{
float fvalue = 1.1f * i * multiplier;
double dvalue = 11.11 * i * multiplier;
int ivalue = 10 * i * multiplier;
long lvalue = 123000 * i * multiplier;
FieldInfo fi = obj.GetType().GetTypeInfo().GetDeclaredField("_f" + i);
if (fi == null) return;
if (fi.FieldType == typeof(float))
{
fi.SetValue(obj, fvalue);
values.Add(fvalue);
}
else if (fi.FieldType == typeof(double))
{
fi.SetValue(obj, dvalue);
values.Add(dvalue);
}
else if (fi.FieldType == typeof(int))
{
fi.SetValue(obj, ivalue);
values.Add(ivalue);
}
else if (fi.FieldType == typeof(long))
{
fi.SetValue(obj, lvalue);
values.Add(lvalue);
}
else
{
object complexObj = fi.GetValue(obj);
FillFieldValues(complexObj, multiplier * 2, values);
fi.SetValue(obj, complexObj);
}
}
}
}
}
namespace ComparerOfTTests
{
struct BoringStruct
{
}
struct StructThatImplementsIComparable : IComparable<StructThatImplementsIComparable>
{
public StructThatImplementsIComparable(int x)
{
_x = x;
}
int IComparable<StructThatImplementsIComparable>.CompareTo(StructThatImplementsIComparable other)
{
if (_x == other._x) return 0;
if (_x < other._x) return -1;
return 1;
}
private int _x;
}
struct StructThatImplementsIComparableOfObject : IComparable<object>
{
public StructThatImplementsIComparableOfObject(int x)
{
_x = x;
}
int IComparable<object>.CompareTo(object other)
{
return 1;
}
private int _x;
}
public abstract class BaseType
{
public abstract void TestCompare(object x, object y);
}
public class DerivedType<T,V> : BaseType
{
private static void TestC(T x, T y)
{
Comparer<T> e = Comparer<T>.Default;
bool expectThrow = false;
int expectedResult;
if (x is IComparable<T>)
{
expectedResult = ((IComparable<T>)x).CompareTo(y);
}
else if (x is StructThatImplementsIComparable?)
{
// This logic really applies to all Nullable types but it's a pain to write this for general nullable types without falling back to Reflection
StructThatImplementsIComparable? xn = (StructThatImplementsIComparable?)(object)x;
StructThatImplementsIComparable? yn = (StructThatImplementsIComparable?)(object)y;
if (xn.HasValue && yn.HasValue)
{
IComparable<StructThatImplementsIComparable> xv = ((StructThatImplementsIComparable?)(object)x).Value;
StructThatImplementsIComparable yv = ((StructThatImplementsIComparable?)(object)y).Value;
expectedResult = xv.CompareTo(yv);
}
else if (xn.HasValue)
{
expectedResult = 1;
}
else if (yn.HasValue)
{
expectedResult = -1;
}
else
{
expectedResult = 0;
}
}
else if (x is int?)
{
// This logic really applies to all Nullable types but it's a pain to write this for general nullable types without falling back to Reflection
int? xn = (int?)(object)x;
int? yn = (int?)(object)y;
if (xn.HasValue && yn.HasValue)
{
IComparable<int> xv = ((int?)(object)x).Value;
int yv = ((int?)(object)y).Value;
expectedResult = xv.CompareTo(yv);
}
else if (xn.HasValue)
{
expectedResult = 1;
}
else if (yn.HasValue)
{
expectedResult = -1;
}
else
{
expectedResult = 0;
}
}
else
{
expectedResult = 0;
try
{
expectedResult = System.Collections.Comparer.Default.Compare(x,y);
}
catch
{
expectThrow = true;
}
}
int actualResult = 0;
bool actualThrow = false;
try
{
actualResult = e.Compare(x,y);
}
catch
{
actualThrow = true;
}
Assert.AreEqual(expectedResult, actualResult);
Assert.AreEqual(expectThrow, actualThrow);
}
public override void TestCompare(object x, object y)
{
TestC((T)x, (T)y);
}
}
public class Runner
{
[TestMethod]
public static unsafe void TestStructThatImplementsIComparable()
{
Type t = typeof(DerivedType<,>).MakeGenericType(typeof(StructThatImplementsIComparable), TypeOf.Short);
BaseType o = (BaseType)Activator.CreateInstance(t);
object o1 = new StructThatImplementsIComparable(1);
object o2 = new StructThatImplementsIComparable(2);
o.TestCompare(o2, o1);
o.TestCompare(o1, o2);
o.TestCompare(o1, o1);
}
[TestMethod]
public static unsafe void TestStructThatImplementsIComparableOfObject()
{
Type t = typeof(DerivedType<,>).MakeGenericType(typeof(StructThatImplementsIComparableOfObject), TypeOf.Short);
BaseType o = (BaseType)Activator.CreateInstance(t);
object o1 = new StructThatImplementsIComparableOfObject(1);
object o2 = new StructThatImplementsIComparableOfObject(2);
o.TestCompare(o2, o1);
o.TestCompare(o1, o2);
o.TestCompare(o1, o1);
}
[TestMethod]
public static unsafe void TestBoringStruct()
{
Type t = typeof(DerivedType<,>).MakeGenericType(typeof(BoringStruct), TypeOf.Short);
BaseType o = (BaseType)Activator.CreateInstance(t);
object o1 = new BoringStruct();
object o2 = new BoringStruct();
o.TestCompare(o2, o1);
o.TestCompare(o1, o2);
o.TestCompare(o1, o1);
}
}
}
namespace DefaultValueDelegateParameterTests
{
public delegate int DelegateWithDefaultValue<T>(T val, int defaultParam = 2);
public abstract class BaseType
{
public abstract Delegate GetDefaultValueDelegate();
public abstract void SetExpectedValParameter(object expected);
}
public class TestType<T> : BaseType
{
T s_expected;
public override void SetExpectedValParameter(object expected)
{
s_expected = (T)expected;
}
public override Delegate GetDefaultValueDelegate()
{
return (DelegateWithDefaultValue<T>)DelegateTarget;
}
private int DelegateTarget(T val, int defaultValueParam)
{
Assert.AreEqual(s_expected, val);
return defaultValueParam;
}
}
public class Runner
{
[TestMethod]
public static unsafe void TestCallUniversalGenericDelegate()
{
Type t = typeof(TestType<>).MakeGenericType(TypeOf.Short);
BaseType targetObject = (BaseType)Activator.CreateInstance(t);
targetObject.SetExpectedValParameter((short)3);
Delegate del = targetObject.GetDefaultValueDelegate();
object result;
// Test using default parameter
result = del.DynamicInvoke(new object[]{ (object)(short)3, Type.Missing});
Assert.AreEqual(result, 2);
// Test not using default parameter
result = del.DynamicInvoke(new object[]{ (object)(short)3, 5});
Assert.AreEqual(result, 5);
}
}
}
namespace ArrayOfGenericStructGCTests
{
struct StructWithGCReference
{
public object o;
public object o2;
}
public struct StructWithoutGCReference
{
public IntPtr _value;
public IntPtr _value2;
public IntPtr _value3;
}
public struct GenericStruct<X,Y,Z>
{
public X _x;
public Y _y;
}
public abstract class Base
{
public abstract void SetValues(int index, object x, object y);
}
public class Derived<X, Y, Z> : Base
{
GenericStruct<X, Y, Z>[] _array = new GenericStruct<X, Y, Z>[100];
public override void SetValues(int index, object x, object y)
{
_array[index]._x = (X)x;
_array[index]._y = (Y)y;
}
}
[StructLayout(LayoutKind.Sequential)]
public class ClassWithNonPointerSizedFinalFieldBase<T>
{
public object o1;
public object o2;
public byte b1;
// Ensure the toolchain doesn't DR any part of this type
public override string ToString()
{
if (o1 != null) return o1.ToString();
if (o2 != null) return o1.ToString();
return b1.ToString();
}
}
[StructLayout(LayoutKind.Sequential)]
public class ClassWithNonPointerSizedFinalFieldBase2<T> : ClassWithNonPointerSizedFinalFieldBase<T>
{
public object o3;
public object o4;
public byte b2;
// Ensure the toolchain doesn't DR any part of this type
public override string ToString()
{
if (o1 != null) return o1.ToString();
if (o2 != null) return o1.ToString();
if (o3 != null) return o1.ToString();
if (o4 != null) return o1.ToString();
return b1.ToString() + b2.ToString();
}
}
[StructLayout(LayoutKind.Sequential)]
public class ClassWithNonPointerSizedFinalField<T> : ClassWithNonPointerSizedFinalFieldBase2<T>
{
}
[StructLayout(LayoutKind.Sequential)]
public struct StructWithNonPointerSizedFinalField<T>
{
public object o1;
public object o2;
public byte b1;
public object o3;
public object o4;
public byte b2;
// Ensure the toolchain doesn't DR any part of this type
public override string ToString()
{
if (o1 != null) return o1.ToString();
if (o2 != null) return o1.ToString();
if (o3 != null) return o1.ToString();
if (o4 != null) return o1.ToString();
return b1.ToString() + b2.ToString();
}
}
public class Runner
{
static object s_o = new Derived<int,int,int>();
[MethodImpl(MethodImplOptions.NoInlining)]
public static unsafe IntPtr * decrement(IntPtr * pIntPtr)
{
// This function is a workaround for 469350
// If this is inline in TestArrayOfGenericStructGCTests, nutc
// gc tracker can become confused
return pIntPtr - 1;
}
// This test constructs a valuetype array full of GC pointers and
// non-pointers, and attempts to validate that it is reported correctly, by
// having the non-pointers be close enough to gc pointers that the GC will AV
// if it does the wrong thing
[TestMethod]
public static unsafe void TestArrayOfGenericStructGCTests()
{
Type t = typeof(Derived<,,>).MakeGenericType(typeof(StructWithGCReference), typeof(StructWithoutGCReference), TypeOf.Short);
Base o = (Base)Activator.CreateInstance(t);
StructWithGCReference swgr = new StructWithGCReference();
swgr.o = new object();
swgr.o2 = new object();
StructWithoutGCReference swogr = new StructWithoutGCReference();
GenericStruct<object, IntPtr, bool> tempStruct = new GenericStruct<object, IntPtr, bool>();
tempStruct._x = new object();
IntPtr *pIntPtr = &tempStruct._y;
pIntPtr = decrement(pIntPtr);
long ptrInGCHeapThatIsLikelyGCObjectAddress = (*pIntPtr).ToInt64();
long ptrInGCHeapThatIsNotGCObjectAddress = ptrInGCHeapThatIsLikelyGCObjectAddress + 1;
swogr._value = new IntPtr(ptrInGCHeapThatIsNotGCObjectAddress);
swogr._value2 = new IntPtr(ptrInGCHeapThatIsNotGCObjectAddress+1);
swogr._value3 = new IntPtr(ptrInGCHeapThatIsNotGCObjectAddress+2);
for (int i = 0; i < 100; i++)
o.SetValues(i, swgr, swogr);
GC.Collect(2);
GC.Collect(2);
GC.Collect(2);
}
static string s_str;
// This test creates a type that have both GC pointers and lack a final field which is aligned on a GC boundary
[TestMethod]
public static unsafe void TestNonPointerSizedFinalField()
{
Type t;
object o;
t = typeof(ClassWithNonPointerSizedFinalFieldBase2<>).MakeGenericType(TypeOf.Int32);
o = Activator.CreateInstance(t);
s_str = o.ToString();
t = typeof(ClassWithNonPointerSizedFinalField<>).MakeGenericType(TypeOf.Int32);
o = Activator.CreateInstance(t);
s_str = o.ToString();
t = typeof(ClassWithNonPointerSizedFinalField<>).MakeGenericType(TypeOf.Short);
o = Activator.CreateInstance(t);
s_str = o.ToString();
Type t2 = typeof(StructWithNonPointerSizedFinalField<>).MakeGenericType(TypeOf.Short);
object o2 = Activator.CreateInstance(t2);
s_str = o.ToString();
}
}
}
namespace DelegatesToStructMethods
{
public struct MySpecialStruct<T>
{
T _val;
public MySpecialStruct(T val) { _val = val; }
public Func<short, string> SimpleDelegateCreator()
{
return new Func<short, string>(StructFunc);
}
public Func<short, string> SimpleGenDelegateCreator()
{
return new Func<short, string>(GenStructFunc<T>);
}
public Func<T, string> ComplexDelegateCreator()
{
return new Func<T, string>(StructFuncNeedingCCC);
}
public Func<T, string> ComplexGenDelegateCreator()
{
return new Func<T, string>(GenStructFuncNeedingCCC<T>);
}
public string StructFunc(short s)
{
return typeof(T).Name + "-" + _val.ToString() + "-" + s;
}
public string GenStructFunc<U>(short s)
{
return typeof(T).Name + "-" + typeof(U).Name + "-" + _val.ToString() + "-" + s;
}
public string StructFuncNeedingCCC(T s)
{
return typeof(T).Name + "-" + _val.ToString() + "-" + s;
}
public string GenStructFuncNeedingCCC<U>(T s)
{
return typeof(T).Name + "-" + typeof(U).Name + "-" + _val.ToString() + "-" + s;
}
}
public class MySpecialClass<T>
{
T _val;
public MySpecialClass(T val) { _val = val; }
public Func<short, string> SimpleDelegateCreator()
{
return new Func<short, string>(ClassFunc);
}
public Func<short, string> SimpleGenDelegateCreator()
{
return new Func<short, string>(GenClassFunc<T>);
}
public Func<T, string> ComplexDelegateCreator()
{
return new Func<T, string>(ClassFuncNeedingCCC);
}
public Func<T, string> ComplexGenDelegateCreator()
{
return new Func<T, string>(GenClassFuncNeedingCCC<T>);
}
public string ClassFunc(short s)
{
return typeof(T).Name + "-" + _val.ToString() + "-" + s;
}
public string GenClassFunc<U>(short s)
{
return typeof(T).Name + "-" + typeof(U).Name + "-" + _val.ToString() + "-" + s;
}
public string ClassFuncNeedingCCC(T s)
{
return typeof(T).Name + "-" + _val.ToString() + "-" + s;
}
public string GenClassFuncNeedingCCC<U>(T s)
{
return typeof(T).Name + "-" + typeof(U).Name + "-" + _val.ToString() + "-" + s;
}
}
public class Runner
{
[TestMethod]
public static void TestDelegateInvokeToMethods()
{
MethodInfo testMi = typeof(Runner).GetTypeInfo().GetDeclaredMethod("TestDelegateInvokeToMethods_Inner").MakeGenericMethod(TypeOf.Short);
testMi.Invoke(null, new object[] { (short)44, (short)55, "StructFunc", "GenStructFunc", true });
testMi.Invoke(null, new object[] { (short)44, (short)55, "ClassFunc", "GenClassFunc", false });
}
static string CallDelegateFromNonUSGContext(Delegate d, short val)
{
Func<short, string> del = (Func<short, string>)d;
return del(val);
}
public static void TestDelegateInvokeToMethods_Inner<T>(T tval1, T tval2, string funcName, string genFuncName, bool isTestOnStruct)
{
// USG case
{
Type t = isTestOnStruct ?
typeof(MySpecialStruct<>).MakeGenericType(TypeOf.Short) :
typeof(MySpecialClass<>).MakeGenericType(TypeOf.Short);
object o = Activator.CreateInstance(t, new object[] { (short)123 });
// Simple method signature case
{
MethodInfo delCreator = t.GetTypeInfo().GetDeclaredMethod("SimpleDelegateCreator");
MethodInfo genDelCreator = t.GetTypeInfo().GetDeclaredMethod("SimpleGenDelegateCreator");
MethodInfo mi = t.GetTypeInfo().GetDeclaredMethod(funcName);
Func<short, string> del1 = (Func<short, string>)mi.CreateDelegate(typeof(Func<short, string>), o);
Func<short, string> del2 = (Func<short, string>)delCreator.Invoke(o, null);
string res1 = del1(11);
string res2 = del2(11);
Assert.AreEqual(res1, "Int16-123-11");
Assert.AreEqual(res1, res2);
MethodInfo miGen = t.GetTypeInfo().GetDeclaredMethod(genFuncName).MakeGenericMethod(TypeOf.Short);
Func<short, string> genDel1 = (Func<short, string>)miGen.CreateDelegate(typeof(Func<short, string>), o);
Func<short, string> genDel2 = (Func<short, string>)genDelCreator.Invoke(o, null);
string genRes1 = genDel1(22);
string genRes2 = genDel2(22);
Assert.AreEqual(genRes1, "Int16-Int16-123-22");
Assert.AreEqual(genRes1, genRes2);
}
// Complex method signature case
{
MethodInfo delCreator = t.GetTypeInfo().GetDeclaredMethod("ComplexDelegateCreator");
MethodInfo genDelCreator = t.GetTypeInfo().GetDeclaredMethod("ComplexGenDelegateCreator");
MethodInfo mi = t.GetTypeInfo().GetDeclaredMethod(funcName + "NeedingCCC");
Func<T, string> del1 = (Func<T, string>)mi.CreateDelegate(typeof(Func<T, string>), o);
Func<T, string> del2 = (Func<T, string>)delCreator.Invoke(o, null);
string res1 = del1(tval1);
string res2 = del2(tval1);
Assert.AreEqual(res1, "Int16-123-44");
Assert.AreEqual(res1, res2);
res1 = CallDelegateFromNonUSGContext(del1, 44);
res2 = CallDelegateFromNonUSGContext(del2, 44);
Assert.AreEqual(res1, "Int16-123-44");
Assert.AreEqual(res1, res2);
MethodInfo miGen = t.GetTypeInfo().GetDeclaredMethod(genFuncName + "NeedingCCC").MakeGenericMethod(TypeOf.Short);
Func<T, string> genDel1 = (Func<T, string>)miGen.CreateDelegate(typeof(Func<T, string>), o);
Func<T, string> genDel2 = (Func<T, string>)genDelCreator.Invoke(o, null);
string genRes1 = genDel1(tval2);
string genRes2 = genDel2(tval2);
Assert.AreEqual(genRes1, "Int16-Int16-123-55");
Assert.AreEqual(genRes1, genRes2);
genRes1 = CallDelegateFromNonUSGContext(genDel1, 55);
genRes2 = CallDelegateFromNonUSGContext(genDel2, 55);
Assert.AreEqual(genRes1, "Int16-Int16-123-55");
Assert.AreEqual(genRes1, genRes2);
}
}
// Normal Canonical case
{
Type t = isTestOnStruct ?
typeof(MySpecialStruct<>).MakeGenericType(TypeOf.String) :
typeof(MySpecialClass<>).MakeGenericType(TypeOf.String);
object o = Activator.CreateInstance(t, new object[] { "abc" });
MethodInfo delCreator = t.GetTypeInfo().GetDeclaredMethod("SimpleDelegateCreator");
MethodInfo genDelCreator = t.GetTypeInfo().GetDeclaredMethod("SimpleGenDelegateCreator");
MethodInfo mi = t.GetTypeInfo().GetDeclaredMethod(funcName);
Func<short, string> del1 = (Func<short, string>)mi.CreateDelegate(typeof(Func<short, string>), o);
Func<short, string> del2 = (Func<short, string>)delCreator.Invoke(o, null);
string res1 = del1(66);
string res2 = del2(66);
Assert.AreEqual(res1, "String-abc-66");
Assert.AreEqual(res1, res2);
MethodInfo miGen = t.GetTypeInfo().GetDeclaredMethod(genFuncName).MakeGenericMethod(TypeOf.String);
Func<short, string> genDel1 = (Func<short, string>)miGen.CreateDelegate(typeof(Func<short, string>), o);
Func<short, string> genDel2 = (Func<short, string>)genDelCreator.Invoke(o, null);
string genRes1 = genDel1(77);
string genRes2 = genDel2(77);
Assert.AreEqual(genRes1, "String-String-abc-77");
Assert.AreEqual(genRes1, genRes2);
}
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/Common/src/Interop/Windows/Advapi32/Interop.EventTraceGuidsEx.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Runtime.InteropServices;
internal static partial class Interop
{
internal static partial class Advapi32
{
internal enum TRACE_QUERY_INFO_CLASS
{
TraceGuidQueryList,
TraceGuidQueryInfo,
TraceGuidQueryProcess,
TraceStackTracingInfo,
MaxTraceSetInfoClass
}
[StructLayout(LayoutKind.Sequential)]
internal struct TRACE_GUID_INFO
{
public int InstanceCount;
public int Reserved;
}
[StructLayout(LayoutKind.Sequential)]
internal struct TRACE_PROVIDER_INSTANCE_INFO
{
public int NextOffset;
public int EnableCount;
public int Pid;
public int Flags;
}
[StructLayout(LayoutKind.Sequential)]
internal struct TRACE_ENABLE_INFO
{
public int IsEnabled;
public byte Level;
public byte Reserved1;
public ushort LoggerId;
public int EnableProperty;
public int Reserved2;
public long MatchAnyKeyword;
public long MatchAllKeyword;
}
[LibraryImport(Interop.Libraries.Advapi32)]
internal static unsafe partial int EnumerateTraceGuidsEx(
TRACE_QUERY_INFO_CLASS TraceQueryInfoClass,
void* InBuffer,
int InBufferSize,
void* OutBuffer,
int OutBufferSize,
out int ReturnLength);
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Runtime.InteropServices;
internal static partial class Interop
{
internal static partial class Advapi32
{
internal enum TRACE_QUERY_INFO_CLASS
{
TraceGuidQueryList,
TraceGuidQueryInfo,
TraceGuidQueryProcess,
TraceStackTracingInfo,
MaxTraceSetInfoClass
}
[StructLayout(LayoutKind.Sequential)]
internal struct TRACE_GUID_INFO
{
public int InstanceCount;
public int Reserved;
}
[StructLayout(LayoutKind.Sequential)]
internal struct TRACE_PROVIDER_INSTANCE_INFO
{
public int NextOffset;
public int EnableCount;
public int Pid;
public int Flags;
}
[StructLayout(LayoutKind.Sequential)]
internal struct TRACE_ENABLE_INFO
{
public int IsEnabled;
public byte Level;
public byte Reserved1;
public ushort LoggerId;
public int EnableProperty;
public int Reserved2;
public long MatchAnyKeyword;
public long MatchAllKeyword;
}
[LibraryImport(Interop.Libraries.Advapi32)]
internal static unsafe partial int EnumerateTraceGuidsEx(
TRACE_QUERY_INFO_CLASS TraceQueryInfoClass,
void* InBuffer,
int InBufferSize,
void* OutBuffer,
int OutBufferSize,
out int ReturnLength);
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Private.Xml/src/System/Xml/Dom/XmlLinkedNode.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Xml
{
// Gets the node immediately preceding or following this node.
public abstract class XmlLinkedNode : XmlNode
{
internal XmlLinkedNode? next;
internal XmlLinkedNode(XmlDocument doc) : base(doc)
{
next = null;
}
// Gets the node immediately preceding this node.
public override XmlNode? PreviousSibling
{
get
{
XmlNode? parent = ParentNode;
if (parent != null)
{
XmlNode? node = parent.FirstChild;
while (node != null)
{
XmlNode? nextSibling = node.NextSibling;
if (nextSibling == this)
{
break;
}
node = nextSibling;
}
return node;
}
return null;
}
}
// Gets the node immediately following this node.
public override XmlNode? NextSibling
{
get
{
XmlNode? parent = ParentNode;
if (parent != null)
{
if (next != parent.FirstChild)
return next;
}
return null;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Xml
{
// Gets the node immediately preceding or following this node.
public abstract class XmlLinkedNode : XmlNode
{
internal XmlLinkedNode? next;
internal XmlLinkedNode(XmlDocument doc) : base(doc)
{
next = null;
}
// Gets the node immediately preceding this node.
public override XmlNode? PreviousSibling
{
get
{
XmlNode? parent = ParentNode;
if (parent != null)
{
XmlNode? node = parent.FirstChild;
while (node != null)
{
XmlNode? nextSibling = node.NextSibling;
if (nextSibling == this)
{
break;
}
node = nextSibling;
}
return node;
}
return null;
}
}
// Gets the node immediately following this node.
public override XmlNode? NextSibling
{
get
{
XmlNode? parent = ParentNode;
if (parent != null)
{
if (next != parent.FirstChild)
return next;
}
return null;
}
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/tests/JIT/Regression/JitBlue/GitHub_15237/GitHub_15237.cs
|
using System;
using System.Globalization;
using System.Numerics;
using System.Runtime.CompilerServices;
namespace UnsafeTesting
{
public class Program
{
static int Main(string[] args)
{
float UnsafeAs = LengthSquaredUnsafeAs();
Console.WriteLine($"Unsafe.As : {UnsafeAs}");
float UnsafeRead = LengthSquaredUnsafeRead();
Console.WriteLine($"Unsafe.Read : {UnsafeRead}");
float UnsafeReadUnaligned = LengthSquaredUnsafeReadUnaligned();
Console.WriteLine($"Unsafe.ReadUnaligned: {UnsafeReadUnaligned}");
float NoVectors = LengthSquaredUnsafeReadUnaligned();
Console.WriteLine($"No Vectors : {NoVectors}");
float ManualVectors = LengthSquaredUnsafeReadUnaligned();
Console.WriteLine($"Manual Vectors : {ManualVectors}");
if ((Math.Abs(UnsafeAs - ManualVectors) > Single.Epsilon) ||
(Math.Abs(UnsafeRead - ManualVectors) > Single.Epsilon) ||
(Math.Abs(UnsafeReadUnaligned - ManualVectors) > Single.Epsilon) ||
(Math.Abs(NoVectors - ManualVectors) > Single.Epsilon))
{
Console.WriteLine("FAIL");
return -1;
}
else
{
Console.WriteLine("PASS");
return 100;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static float LengthSquaredUnsafeAs()
{
QuaternionStruct start = new QuaternionStruct(8.5f, 9.4f, 1.2f, 1f);
return start.LengthSquaredUnsafeAs();
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static float LengthSquaredUnsafeRead()
{
QuaternionStruct start = new QuaternionStruct(8.5f, 9.4f, 1.2f, 1f);
return start.LengthSquaredUnsafeRead();
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static float LengthSquaredUnsafeReadUnaligned()
{
QuaternionStruct start = new QuaternionStruct(8.5f, 9.4f, 1.2f, 1f);
return start.LengthSquaredUnsafeReadUnaligned();
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static float LengthSquaredNoVectors()
{
QuaternionStruct start = new QuaternionStruct(8.5f, 9.4f, 1.2f, 1f);
return start.LengthSquaredNoVectors();
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static float LengthSquaredManualVectors()
{
QuaternionStruct start = new QuaternionStruct(8.5f, 9.4f, 1.2f, 1f);
return start.LengthSquaredManualVectors();
}
}
public struct QuaternionStruct : IEquatable<QuaternionStruct>
{
public float X;
public float Y;
public float Z;
public float W;
public QuaternionStruct(float x, float y, float z, float w)
{
this.X = x;
this.Y = y;
this.Z = z;
this.W = w;
}
public float LengthSquaredManualVectors() => ToVector4(this).LengthSquared();
public float LengthSquaredUnsafeAs()
{
Vector4 q = Unsafe.As<QuaternionStruct, Vector4>(ref this);
return q.LengthSquared();
}
public unsafe float LengthSquaredUnsafeRead()
{
fixed (QuaternionStruct* p = &this)
{
Vector4 q = Unsafe.Read<Vector4>(p);
return q.LengthSquared();
}
}
public float LengthSquaredUnsafeReadUnaligned()
{
Vector4 q = Unsafe.ReadUnaligned<Vector4>(ref Unsafe.As<QuaternionStruct, byte>(ref this));
return q.LengthSquared();
}
public float LengthSquaredNoVectors()
{
return X * X + Y * Y + Z * Z + W * W;
}
public bool Equals(QuaternionStruct other)
{
throw new NotImplementedException();
}
public override string ToString()
{
CultureInfo ci = CultureInfo.CurrentCulture;
return $"{{X:{X.ToString(ci)} Y:{Y.ToString(ci)} Z:{Z.ToString(ci)} W:{W.ToString(ci)}}}";
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static QuaternionStruct FromVector4(Vector4 vector)
{
return new QuaternionStruct(vector.X, vector.Y, vector.Z, vector.W);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static Vector4 ToVector4(QuaternionStruct quaternionStruct)
{
return new Vector4(quaternionStruct.X, quaternionStruct.Y, quaternionStruct.Z, quaternionStruct.W);
}
}
}
|
using System;
using System.Globalization;
using System.Numerics;
using System.Runtime.CompilerServices;
namespace UnsafeTesting
{
public class Program
{
static int Main(string[] args)
{
float UnsafeAs = LengthSquaredUnsafeAs();
Console.WriteLine($"Unsafe.As : {UnsafeAs}");
float UnsafeRead = LengthSquaredUnsafeRead();
Console.WriteLine($"Unsafe.Read : {UnsafeRead}");
float UnsafeReadUnaligned = LengthSquaredUnsafeReadUnaligned();
Console.WriteLine($"Unsafe.ReadUnaligned: {UnsafeReadUnaligned}");
float NoVectors = LengthSquaredUnsafeReadUnaligned();
Console.WriteLine($"No Vectors : {NoVectors}");
float ManualVectors = LengthSquaredUnsafeReadUnaligned();
Console.WriteLine($"Manual Vectors : {ManualVectors}");
if ((Math.Abs(UnsafeAs - ManualVectors) > Single.Epsilon) ||
(Math.Abs(UnsafeRead - ManualVectors) > Single.Epsilon) ||
(Math.Abs(UnsafeReadUnaligned - ManualVectors) > Single.Epsilon) ||
(Math.Abs(NoVectors - ManualVectors) > Single.Epsilon))
{
Console.WriteLine("FAIL");
return -1;
}
else
{
Console.WriteLine("PASS");
return 100;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static float LengthSquaredUnsafeAs()
{
QuaternionStruct start = new QuaternionStruct(8.5f, 9.4f, 1.2f, 1f);
return start.LengthSquaredUnsafeAs();
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static float LengthSquaredUnsafeRead()
{
QuaternionStruct start = new QuaternionStruct(8.5f, 9.4f, 1.2f, 1f);
return start.LengthSquaredUnsafeRead();
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static float LengthSquaredUnsafeReadUnaligned()
{
QuaternionStruct start = new QuaternionStruct(8.5f, 9.4f, 1.2f, 1f);
return start.LengthSquaredUnsafeReadUnaligned();
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static float LengthSquaredNoVectors()
{
QuaternionStruct start = new QuaternionStruct(8.5f, 9.4f, 1.2f, 1f);
return start.LengthSquaredNoVectors();
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static float LengthSquaredManualVectors()
{
QuaternionStruct start = new QuaternionStruct(8.5f, 9.4f, 1.2f, 1f);
return start.LengthSquaredManualVectors();
}
}
public struct QuaternionStruct : IEquatable<QuaternionStruct>
{
public float X;
public float Y;
public float Z;
public float W;
public QuaternionStruct(float x, float y, float z, float w)
{
this.X = x;
this.Y = y;
this.Z = z;
this.W = w;
}
public float LengthSquaredManualVectors() => ToVector4(this).LengthSquared();
public float LengthSquaredUnsafeAs()
{
Vector4 q = Unsafe.As<QuaternionStruct, Vector4>(ref this);
return q.LengthSquared();
}
public unsafe float LengthSquaredUnsafeRead()
{
fixed (QuaternionStruct* p = &this)
{
Vector4 q = Unsafe.Read<Vector4>(p);
return q.LengthSquared();
}
}
public float LengthSquaredUnsafeReadUnaligned()
{
Vector4 q = Unsafe.ReadUnaligned<Vector4>(ref Unsafe.As<QuaternionStruct, byte>(ref this));
return q.LengthSquared();
}
public float LengthSquaredNoVectors()
{
return X * X + Y * Y + Z * Z + W * W;
}
public bool Equals(QuaternionStruct other)
{
throw new NotImplementedException();
}
public override string ToString()
{
CultureInfo ci = CultureInfo.CurrentCulture;
return $"{{X:{X.ToString(ci)} Y:{Y.ToString(ci)} Z:{Z.ToString(ci)} W:{W.ToString(ci)}}}";
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static QuaternionStruct FromVector4(Vector4 vector)
{
return new QuaternionStruct(vector.X, vector.Y, vector.Z, vector.W);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static Vector4 ToVector4(QuaternionStruct quaternionStruct)
{
return new Vector4(quaternionStruct.X, quaternionStruct.Y, quaternionStruct.Z, quaternionStruct.W);
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/tests/Interop/PInvoke/Generics/GenericsTest.Point3D.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Runtime.InteropServices;
using Xunit;
unsafe partial class GenericsNative
{
[DllImport(nameof(GenericsNative))]
public static extern Point3<double> GetPoint3D(double e00, double e01, double e02);
[DllImport(nameof(GenericsNative))]
public static extern void GetPoint3DOut(double e00, double e01, double e02, Point3<double>* value);
[DllImport(nameof(GenericsNative))]
public static extern void GetPoint3DOut(double e00, double e01, double e02, out Point3<double> value);
[DllImport(nameof(GenericsNative))]
public static extern Point3<double>* GetPoint3DPtr(double e00, double e01, double e02);
[DllImport(nameof(GenericsNative), EntryPoint = "GetPoint3DPtr")]
public static extern ref readonly Point3<double> GetPoint3DRef(double e00, double e01, double e02);
[DllImport(nameof(GenericsNative))]
public static extern Point3<double> AddPoint3D(Point3<double> lhs, Point3<double> rhs);
[DllImport(nameof(GenericsNative))]
public static extern Point3<double> AddPoint3Ds(Point3<double>* pValues, int count);
[DllImport(nameof(GenericsNative))]
public static extern Point3<double> AddPoint3Ds([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] Point3<double>[] pValues, int count);
[DllImport(nameof(GenericsNative))]
public static extern Point3<double> AddPoint3Ds(in Point3<double> pValues, int count);
}
unsafe partial class GenericsTest
{
private static void TestPoint3D()
{
GenericsNative.Point3<double> value = GenericsNative.GetPoint3D(1.0, 2.0, 3.0);
Assert.Equal(value.e00, 1.0);
Assert.Equal(value.e01, 2.0);
Assert.Equal(value.e02, 3.0);
GenericsNative.Point3<double> value2;
GenericsNative.GetPoint3DOut(1.0, 2.0, 3.0, &value2);
Assert.Equal(value2.e00, 1.0);
Assert.Equal(value2.e01, 2.0);
Assert.Equal(value2.e02, 3.0);
GenericsNative.GetPoint3DOut(1.0, 2.0, 3.0, out GenericsNative.Point3<double> value3);
Assert.Equal(value3.e00, 1.0);
Assert.Equal(value3.e01, 2.0);
Assert.Equal(value3.e02, 3.0);
GenericsNative.Point3<double>* value4 = GenericsNative.GetPoint3DPtr(1.0, 2.0, 3.0);
Assert.Equal(value4->e00, 1.0);
Assert.Equal(value4->e01, 2.0);
Assert.Equal(value4->e02, 3.0);
ref readonly GenericsNative.Point3<double> value5 = ref GenericsNative.GetPoint3DRef(1.0, 2.0, 3.0);
Assert.Equal(value5.e00, 1.0);
Assert.Equal(value5.e01, 2.0);
Assert.Equal(value5.e02, 3.0);
GenericsNative.Point3<double> result = GenericsNative.AddPoint3D(value, value);
Assert.Equal(result.e00, 2.0);
Assert.Equal(result.e01, 4.0);
Assert.Equal(result.e02, 6.0);
GenericsNative.Point3<double>[] values = new GenericsNative.Point3<double>[] {
value,
value2,
value3,
*value4,
value5
};
fixed (GenericsNative.Point3<double>* pValues = &values[0])
{
GenericsNative.Point3<double> result2 = GenericsNative.AddPoint3Ds(pValues, values.Length);
Assert.Equal(result2.e00, 5.0);
Assert.Equal(result2.e01, 10.0);
Assert.Equal(result2.e02, 15.0);
}
GenericsNative.Point3<double> result3 = GenericsNative.AddPoint3Ds(values, values.Length);
Assert.Equal(result3.e00, 5.0);
Assert.Equal(result3.e01, 10.0);
Assert.Equal(result3.e02, 15.0);
GenericsNative.Point3<double> result4 = GenericsNative.AddPoint3Ds(in values[0], values.Length);
Assert.Equal(result4.e00, 5.0);
Assert.Equal(result4.e01, 10.0);
Assert.Equal(result4.e02, 15.0);
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Runtime.InteropServices;
using Xunit;
unsafe partial class GenericsNative
{
[DllImport(nameof(GenericsNative))]
public static extern Point3<double> GetPoint3D(double e00, double e01, double e02);
[DllImport(nameof(GenericsNative))]
public static extern void GetPoint3DOut(double e00, double e01, double e02, Point3<double>* value);
[DllImport(nameof(GenericsNative))]
public static extern void GetPoint3DOut(double e00, double e01, double e02, out Point3<double> value);
[DllImport(nameof(GenericsNative))]
public static extern Point3<double>* GetPoint3DPtr(double e00, double e01, double e02);
[DllImport(nameof(GenericsNative), EntryPoint = "GetPoint3DPtr")]
public static extern ref readonly Point3<double> GetPoint3DRef(double e00, double e01, double e02);
[DllImport(nameof(GenericsNative))]
public static extern Point3<double> AddPoint3D(Point3<double> lhs, Point3<double> rhs);
[DllImport(nameof(GenericsNative))]
public static extern Point3<double> AddPoint3Ds(Point3<double>* pValues, int count);
[DllImport(nameof(GenericsNative))]
public static extern Point3<double> AddPoint3Ds([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] Point3<double>[] pValues, int count);
[DllImport(nameof(GenericsNative))]
public static extern Point3<double> AddPoint3Ds(in Point3<double> pValues, int count);
}
unsafe partial class GenericsTest
{
private static void TestPoint3D()
{
GenericsNative.Point3<double> value = GenericsNative.GetPoint3D(1.0, 2.0, 3.0);
Assert.Equal(value.e00, 1.0);
Assert.Equal(value.e01, 2.0);
Assert.Equal(value.e02, 3.0);
GenericsNative.Point3<double> value2;
GenericsNative.GetPoint3DOut(1.0, 2.0, 3.0, &value2);
Assert.Equal(value2.e00, 1.0);
Assert.Equal(value2.e01, 2.0);
Assert.Equal(value2.e02, 3.0);
GenericsNative.GetPoint3DOut(1.0, 2.0, 3.0, out GenericsNative.Point3<double> value3);
Assert.Equal(value3.e00, 1.0);
Assert.Equal(value3.e01, 2.0);
Assert.Equal(value3.e02, 3.0);
GenericsNative.Point3<double>* value4 = GenericsNative.GetPoint3DPtr(1.0, 2.0, 3.0);
Assert.Equal(value4->e00, 1.0);
Assert.Equal(value4->e01, 2.0);
Assert.Equal(value4->e02, 3.0);
ref readonly GenericsNative.Point3<double> value5 = ref GenericsNative.GetPoint3DRef(1.0, 2.0, 3.0);
Assert.Equal(value5.e00, 1.0);
Assert.Equal(value5.e01, 2.0);
Assert.Equal(value5.e02, 3.0);
GenericsNative.Point3<double> result = GenericsNative.AddPoint3D(value, value);
Assert.Equal(result.e00, 2.0);
Assert.Equal(result.e01, 4.0);
Assert.Equal(result.e02, 6.0);
GenericsNative.Point3<double>[] values = new GenericsNative.Point3<double>[] {
value,
value2,
value3,
*value4,
value5
};
fixed (GenericsNative.Point3<double>* pValues = &values[0])
{
GenericsNative.Point3<double> result2 = GenericsNative.AddPoint3Ds(pValues, values.Length);
Assert.Equal(result2.e00, 5.0);
Assert.Equal(result2.e01, 10.0);
Assert.Equal(result2.e02, 15.0);
}
GenericsNative.Point3<double> result3 = GenericsNative.AddPoint3Ds(values, values.Length);
Assert.Equal(result3.e00, 5.0);
Assert.Equal(result3.e01, 10.0);
Assert.Equal(result3.e02, 15.0);
GenericsNative.Point3<double> result4 = GenericsNative.AddPoint3Ds(in values[0], values.Length);
Assert.Equal(result4.e00, 5.0);
Assert.Equal(result4.e01, 10.0);
Assert.Equal(result4.e02, 15.0);
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Net.WebSockets/src/System/Net/WebSockets/WebSocketContext.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Security.Principal;
namespace System.Net.WebSockets
{
public abstract class WebSocketContext
{
public abstract Uri RequestUri { get; }
public abstract NameValueCollection Headers { get; }
public abstract string Origin { get; }
public abstract IEnumerable<string> SecWebSocketProtocols { get; }
public abstract string SecWebSocketVersion { get; }
public abstract string SecWebSocketKey { get; }
public abstract CookieCollection CookieCollection { get; }
public abstract IPrincipal? User { get; }
public abstract bool IsAuthenticated { get; }
public abstract bool IsLocal { get; }
public abstract bool IsSecureConnection { get; }
public abstract WebSocket WebSocket { get; }
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Security.Principal;
namespace System.Net.WebSockets
{
public abstract class WebSocketContext
{
public abstract Uri RequestUri { get; }
public abstract NameValueCollection Headers { get; }
public abstract string Origin { get; }
public abstract IEnumerable<string> SecWebSocketProtocols { get; }
public abstract string SecWebSocketVersion { get; }
public abstract string SecWebSocketKey { get; }
public abstract CookieCollection CookieCollection { get; }
public abstract IPrincipal? User { get; }
public abstract bool IsAuthenticated { get; }
public abstract bool IsLocal { get; }
public abstract bool IsSecureConnection { get; }
public abstract WebSocket WebSocket { get; }
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd.Arm64/ShiftLeftLogicalSaturateScalar.Vector64.UInt32.1.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1()
{
var test = new ImmUnaryOpTest__ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (AdvSimd.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class ImmUnaryOpTest__ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1
{
private struct DataTable
{
private byte[] inArray;
private byte[] outArray;
private GCHandle inHandle;
private GCHandle outHandle;
private ulong alignment;
public DataTable(UInt32[] inArray, UInt32[] outArray, int alignment)
{
int sizeOfinArray = inArray.Length * Unsafe.SizeOf<UInt32>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt32>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle = GCHandle.Alloc(this.inArray, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArrayPtr), ref Unsafe.As<UInt32, byte>(ref inArray[0]), (uint)sizeOfinArray);
}
public void* inArrayPtr => Align((byte*)(inHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector64<UInt32> _fld;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref testStruct._fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
return testStruct;
}
public void RunStructFldScenario(ImmUnaryOpTest__ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1 testClass)
{
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(_fld, 1);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(ImmUnaryOpTest__ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1 testClass)
{
fixed (Vector64<UInt32>* pFld = &_fld)
{
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(
AdvSimd.LoadVector64((UInt32*)(pFld)),
1
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 8;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
private static readonly byte Imm = 1;
private static UInt32[] _data = new UInt32[Op1ElementCount];
private static Vector64<UInt32> _clsVar;
private Vector64<UInt32> _fld;
private DataTable _dataTable;
static ImmUnaryOpTest__ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1()
{
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
}
public ImmUnaryOpTest__ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
_dataTable = new DataTable(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.Arm64.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(
Unsafe.Read<Vector64<UInt32>>(_dataTable.inArrayPtr),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(
AdvSimd.LoadVector64((UInt32*)(_dataTable.inArrayPtr)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar), new Type[] { typeof(Vector64<UInt32>), typeof(byte) })
.Invoke(null, new object[] {
Unsafe.Read<Vector64<UInt32>>(_dataTable.inArrayPtr),
(byte)1
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<UInt32>)(result));
ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar), new Type[] { typeof(Vector64<UInt32>), typeof(byte) })
.Invoke(null, new object[] {
AdvSimd.LoadVector64((UInt32*)(_dataTable.inArrayPtr)),
(byte)1
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<UInt32>)(result));
ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(
_clsVar,
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector64<UInt32>* pClsVar = &_clsVar)
{
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(
AdvSimd.LoadVector64((UInt32*)(pClsVar)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var firstOp = Unsafe.Read<Vector64<UInt32>>(_dataTable.inArrayPtr);
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(firstOp, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var firstOp = AdvSimd.LoadVector64((UInt32*)(_dataTable.inArrayPtr));
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(firstOp, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new ImmUnaryOpTest__ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1();
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(test._fld, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new ImmUnaryOpTest__ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1();
fixed (Vector64<UInt32>* pFld = &test._fld)
{
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(
AdvSimd.LoadVector64((UInt32*)(pFld)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(_fld, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector64<UInt32>* pFld = &_fld)
{
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(
AdvSimd.LoadVector64((UInt32*)(pFld)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(test._fld, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(
AdvSimd.LoadVector64((UInt32*)(&test._fld)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector64<UInt32> firstOp, void* result, [CallerMemberName] string method = "")
{
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
ValidateResult(inArray, outArray, method);
}
private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
{
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
ValidateResult(inArray, outArray, method);
}
private void ValidateResult(UInt32[] firstOp, UInt32[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
if (Helpers.ShiftLeftLogicalSaturate(firstOp[0], Imm) != result[0])
{
succeeded = false;
}
else
{
for (var i = 1; i < RetElementCount; i++)
{
if (result[i] != 0)
{
succeeded = false;
break;
}
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd.Arm64)}.{nameof(AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar)}<UInt32>(Vector64<UInt32>, 1): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1()
{
var test = new ImmUnaryOpTest__ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (AdvSimd.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class ImmUnaryOpTest__ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1
{
private struct DataTable
{
private byte[] inArray;
private byte[] outArray;
private GCHandle inHandle;
private GCHandle outHandle;
private ulong alignment;
public DataTable(UInt32[] inArray, UInt32[] outArray, int alignment)
{
int sizeOfinArray = inArray.Length * Unsafe.SizeOf<UInt32>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt32>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle = GCHandle.Alloc(this.inArray, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArrayPtr), ref Unsafe.As<UInt32, byte>(ref inArray[0]), (uint)sizeOfinArray);
}
public void* inArrayPtr => Align((byte*)(inHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector64<UInt32> _fld;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref testStruct._fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
return testStruct;
}
public void RunStructFldScenario(ImmUnaryOpTest__ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1 testClass)
{
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(_fld, 1);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(ImmUnaryOpTest__ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1 testClass)
{
fixed (Vector64<UInt32>* pFld = &_fld)
{
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(
AdvSimd.LoadVector64((UInt32*)(pFld)),
1
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 8;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
private static readonly byte Imm = 1;
private static UInt32[] _data = new UInt32[Op1ElementCount];
private static Vector64<UInt32> _clsVar;
private Vector64<UInt32> _fld;
private DataTable _dataTable;
static ImmUnaryOpTest__ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1()
{
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _clsVar), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
}
public ImmUnaryOpTest__ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _fld), ref Unsafe.As<UInt32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt32(); }
_dataTable = new DataTable(_data, new UInt32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.Arm64.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(
Unsafe.Read<Vector64<UInt32>>(_dataTable.inArrayPtr),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(
AdvSimd.LoadVector64((UInt32*)(_dataTable.inArrayPtr)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar), new Type[] { typeof(Vector64<UInt32>), typeof(byte) })
.Invoke(null, new object[] {
Unsafe.Read<Vector64<UInt32>>(_dataTable.inArrayPtr),
(byte)1
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<UInt32>)(result));
ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar), new Type[] { typeof(Vector64<UInt32>), typeof(byte) })
.Invoke(null, new object[] {
AdvSimd.LoadVector64((UInt32*)(_dataTable.inArrayPtr)),
(byte)1
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<UInt32>)(result));
ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(
_clsVar,
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector64<UInt32>* pClsVar = &_clsVar)
{
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(
AdvSimd.LoadVector64((UInt32*)(pClsVar)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var firstOp = Unsafe.Read<Vector64<UInt32>>(_dataTable.inArrayPtr);
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(firstOp, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var firstOp = AdvSimd.LoadVector64((UInt32*)(_dataTable.inArrayPtr));
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(firstOp, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(firstOp, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new ImmUnaryOpTest__ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1();
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(test._fld, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new ImmUnaryOpTest__ShiftLeftLogicalSaturateScalar_Vector64_UInt32_1();
fixed (Vector64<UInt32>* pFld = &test._fld)
{
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(
AdvSimd.LoadVector64((UInt32*)(pFld)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(_fld, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector64<UInt32>* pFld = &_fld)
{
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(
AdvSimd.LoadVector64((UInt32*)(pFld)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(test._fld, 1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar(
AdvSimd.LoadVector64((UInt32*)(&test._fld)),
1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector64<UInt32> firstOp, void* result, [CallerMemberName] string method = "")
{
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), firstOp);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
ValidateResult(inArray, outArray, method);
}
private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "")
{
UInt32[] inArray = new UInt32[Op1ElementCount];
UInt32[] outArray = new UInt32[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
ValidateResult(inArray, outArray, method);
}
private void ValidateResult(UInt32[] firstOp, UInt32[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
if (Helpers.ShiftLeftLogicalSaturate(firstOp[0], Imm) != result[0])
{
succeeded = false;
}
else
{
for (var i = 1; i < RetElementCount; i++)
{
if (result[i] != 0)
{
succeeded = false;
break;
}
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd.Arm64)}.{nameof(AdvSimd.Arm64.ShiftLeftLogicalSaturateScalar)}<UInt32>(Vector64<UInt32>, 1): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/SHA384Managed.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Internal.Cryptography;
using System.ComponentModel;
namespace System.Security.Cryptography
{
[Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
[EditorBrowsable(EditorBrowsableState.Never)]
// SHA384Managed has a copy of the same implementation as SHA384
public sealed class SHA384Managed : SHA384
{
private readonly HashProvider _hashProvider;
public SHA384Managed()
{
_hashProvider = HashProviderDispenser.CreateHashProvider(HashAlgorithmNames.SHA384);
HashSizeValue = _hashProvider.HashSizeInBytes * 8;
}
protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) =>
_hashProvider.AppendHashData(array, ibStart, cbSize);
protected sealed override void HashCore(ReadOnlySpan<byte> source) =>
_hashProvider.AppendHashData(source);
protected sealed override byte[] HashFinal() =>
_hashProvider.FinalizeHashAndReset();
protected sealed override bool TryHashFinal(Span<byte> destination, out int bytesWritten) =>
_hashProvider.TryFinalizeHashAndReset(destination, out bytesWritten);
public sealed override void Initialize() => _hashProvider.Reset();
protected sealed override void Dispose(bool disposing)
{
_hashProvider.Dispose(disposing);
base.Dispose(disposing);
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Internal.Cryptography;
using System.ComponentModel;
namespace System.Security.Cryptography
{
[Obsolete(Obsoletions.DerivedCryptographicTypesMessage, DiagnosticId = Obsoletions.DerivedCryptographicTypesDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
[EditorBrowsable(EditorBrowsableState.Never)]
// SHA384Managed has a copy of the same implementation as SHA384
public sealed class SHA384Managed : SHA384
{
private readonly HashProvider _hashProvider;
public SHA384Managed()
{
_hashProvider = HashProviderDispenser.CreateHashProvider(HashAlgorithmNames.SHA384);
HashSizeValue = _hashProvider.HashSizeInBytes * 8;
}
protected sealed override void HashCore(byte[] array, int ibStart, int cbSize) =>
_hashProvider.AppendHashData(array, ibStart, cbSize);
protected sealed override void HashCore(ReadOnlySpan<byte> source) =>
_hashProvider.AppendHashData(source);
protected sealed override byte[] HashFinal() =>
_hashProvider.FinalizeHashAndReset();
protected sealed override bool TryHashFinal(Span<byte> destination, out int bytesWritten) =>
_hashProvider.TryFinalizeHashAndReset(destination, out bytesWritten);
public sealed override void Initialize() => _hashProvider.Reset();
protected sealed override void Dispose(bool disposing)
{
_hashProvider.Dispose(disposing);
base.Dispose(disposing);
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/coreclr/tools/Common/TypeSystem/Ecma/EcmaField.CodeGen.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Internal.TypeSystem.Ecma
{
partial class EcmaField
{
public override bool IsIntrinsic
{
get
{
return (GetFieldFlags(FieldFlags.AttributeMetadataCache | FieldFlags.Intrinsic) & FieldFlags.Intrinsic) != 0;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Internal.TypeSystem.Ecma
{
partial class EcmaField
{
public override bool IsIntrinsic
{
get
{
return (GetFieldFlags(FieldFlags.AttributeMetadataCache | FieldFlags.Intrinsic) & FieldFlags.Intrinsic) != 0;
}
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/tests/JIT/jit64/hfa/main/dll/hfa_simple_f64_common.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<CLRTestKind>BuildOnly</CLRTestKind>
<GenerateRunScript>false</GenerateRunScript>
</PropertyGroup>
<PropertyGroup>
<DebugType />
<DefineConstants>$(DefineConstants);SIMPLE_HFA;FLOAT64</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="hfa_common.cs" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<CLRTestKind>BuildOnly</CLRTestKind>
<GenerateRunScript>false</GenerateRunScript>
</PropertyGroup>
<PropertyGroup>
<DebugType />
<DefineConstants>$(DefineConstants);SIMPLE_HFA;FLOAT64</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="hfa_common.cs" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/AbsoluteCompareLessThanOrEqual.Vector64.Single.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void AbsoluteCompareLessThanOrEqual_Vector64_Single()
{
var test = new SimpleBinaryOpTest__AbsoluteCompareLessThanOrEqual_Vector64_Single();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (AdvSimd.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class SimpleBinaryOpTest__AbsoluteCompareLessThanOrEqual_Vector64_Single
{
private struct DataTable
{
private byte[] inArray1;
private byte[] inArray2;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle inHandle2;
private GCHandle outHandle;
private ulong alignment;
public DataTable(Single[] inArray1, Single[] inArray2, Single[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Single>();
int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Single>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Single>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.inArray2 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Single, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Single, byte>(ref inArray2[0]), (uint)sizeOfinArray2);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
inHandle2.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector64<Single> _fld1;
public Vector64<Single> _fld2;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref testStruct._fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref testStruct._fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
return testStruct;
}
public void RunStructFldScenario(SimpleBinaryOpTest__AbsoluteCompareLessThanOrEqual_Vector64_Single testClass)
{
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(_fld1, _fld2);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(SimpleBinaryOpTest__AbsoluteCompareLessThanOrEqual_Vector64_Single testClass)
{
fixed (Vector64<Single>* pFld1 = &_fld1)
fixed (Vector64<Single>* pFld2 = &_fld2)
{
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(
AdvSimd.LoadVector64((Single*)(pFld1)),
AdvSimd.LoadVector64((Single*)(pFld2))
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 8;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
private static Vector64<Single> _clsVar1;
private static Vector64<Single> _clsVar2;
private Vector64<Single> _fld1;
private Vector64<Single> _fld2;
private DataTable _dataTable;
static SimpleBinaryOpTest__AbsoluteCompareLessThanOrEqual_Vector64_Single()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
}
public SimpleBinaryOpTest__AbsoluteCompareLessThanOrEqual_Vector64_Single()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); }
_dataTable = new DataTable(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(
Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector64<Single>>(_dataTable.inArray2Ptr)
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(
AdvSimd.LoadVector64((Single*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector64((Single*)(_dataTable.inArray2Ptr))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.AbsoluteCompareLessThanOrEqual), new Type[] { typeof(Vector64<Single>), typeof(Vector64<Single>) })
.Invoke(null, new object[] {
Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector64<Single>>(_dataTable.inArray2Ptr)
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Single>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.AbsoluteCompareLessThanOrEqual), new Type[] { typeof(Vector64<Single>), typeof(Vector64<Single>) })
.Invoke(null, new object[] {
AdvSimd.LoadVector64((Single*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector64((Single*)(_dataTable.inArray2Ptr))
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Single>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(
_clsVar1,
_clsVar2
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector64<Single>* pClsVar1 = &_clsVar1)
fixed (Vector64<Single>* pClsVar2 = &_clsVar2)
{
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(
AdvSimd.LoadVector64((Single*)(pClsVar1)),
AdvSimd.LoadVector64((Single*)(pClsVar2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr);
var op2 = Unsafe.Read<Vector64<Single>>(_dataTable.inArray2Ptr);
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(op1, op2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var op1 = AdvSimd.LoadVector64((Single*)(_dataTable.inArray1Ptr));
var op2 = AdvSimd.LoadVector64((Single*)(_dataTable.inArray2Ptr));
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(op1, op2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new SimpleBinaryOpTest__AbsoluteCompareLessThanOrEqual_Vector64_Single();
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(test._fld1, test._fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new SimpleBinaryOpTest__AbsoluteCompareLessThanOrEqual_Vector64_Single();
fixed (Vector64<Single>* pFld1 = &test._fld1)
fixed (Vector64<Single>* pFld2 = &test._fld2)
{
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(
AdvSimd.LoadVector64((Single*)(pFld1)),
AdvSimd.LoadVector64((Single*)(pFld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(_fld1, _fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector64<Single>* pFld1 = &_fld1)
fixed (Vector64<Single>* pFld2 = &_fld2)
{
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(
AdvSimd.LoadVector64((Single*)(pFld1)),
AdvSimd.LoadVector64((Single*)(pFld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(test._fld1, test._fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(
AdvSimd.LoadVector64((Single*)(&test._fld1)),
AdvSimd.LoadVector64((Single*)(&test._fld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector64<Single> op1, Vector64<Single> op2, void* result, [CallerMemberName] string method = "")
{
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), op1);
Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), op2);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "")
{
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<Single>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<Single>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Single[] left, Single[] right, Single[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
for (var i = 0; i < RetElementCount; i++)
{
if (BitConverter.SingleToInt32Bits(Helpers.AbsoluteCompareLessThanOrEqual(left[i], right[i])) != BitConverter.SingleToInt32Bits(result[i]))
{
succeeded = false;
break;
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.AbsoluteCompareLessThanOrEqual)}<Single>(Vector64<Single>, Vector64<Single>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})");
TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void AbsoluteCompareLessThanOrEqual_Vector64_Single()
{
var test = new SimpleBinaryOpTest__AbsoluteCompareLessThanOrEqual_Vector64_Single();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (AdvSimd.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class SimpleBinaryOpTest__AbsoluteCompareLessThanOrEqual_Vector64_Single
{
private struct DataTable
{
private byte[] inArray1;
private byte[] inArray2;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle inHandle2;
private GCHandle outHandle;
private ulong alignment;
public DataTable(Single[] inArray1, Single[] inArray2, Single[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Single>();
int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Single>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Single>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.inArray2 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Single, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Single, byte>(ref inArray2[0]), (uint)sizeOfinArray2);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
inHandle2.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector64<Single> _fld1;
public Vector64<Single> _fld2;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref testStruct._fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref testStruct._fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
return testStruct;
}
public void RunStructFldScenario(SimpleBinaryOpTest__AbsoluteCompareLessThanOrEqual_Vector64_Single testClass)
{
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(_fld1, _fld2);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(SimpleBinaryOpTest__AbsoluteCompareLessThanOrEqual_Vector64_Single testClass)
{
fixed (Vector64<Single>* pFld1 = &_fld1)
fixed (Vector64<Single>* pFld2 = &_fld2)
{
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(
AdvSimd.LoadVector64((Single*)(pFld1)),
AdvSimd.LoadVector64((Single*)(pFld2))
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 8;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Single[] _data2 = new Single[Op2ElementCount];
private static Vector64<Single> _clsVar1;
private static Vector64<Single> _clsVar2;
private Vector64<Single> _fld1;
private Vector64<Single> _fld2;
private DataTable _dataTable;
static SimpleBinaryOpTest__AbsoluteCompareLessThanOrEqual_Vector64_Single()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
}
public SimpleBinaryOpTest__AbsoluteCompareLessThanOrEqual_Vector64_Single()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); }
_dataTable = new DataTable(_data1, _data2, new Single[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(
Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector64<Single>>(_dataTable.inArray2Ptr)
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(
AdvSimd.LoadVector64((Single*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector64((Single*)(_dataTable.inArray2Ptr))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.AbsoluteCompareLessThanOrEqual), new Type[] { typeof(Vector64<Single>), typeof(Vector64<Single>) })
.Invoke(null, new object[] {
Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector64<Single>>(_dataTable.inArray2Ptr)
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Single>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.AbsoluteCompareLessThanOrEqual), new Type[] { typeof(Vector64<Single>), typeof(Vector64<Single>) })
.Invoke(null, new object[] {
AdvSimd.LoadVector64((Single*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector64((Single*)(_dataTable.inArray2Ptr))
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Single>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(
_clsVar1,
_clsVar2
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector64<Single>* pClsVar1 = &_clsVar1)
fixed (Vector64<Single>* pClsVar2 = &_clsVar2)
{
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(
AdvSimd.LoadVector64((Single*)(pClsVar1)),
AdvSimd.LoadVector64((Single*)(pClsVar2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr);
var op2 = Unsafe.Read<Vector64<Single>>(_dataTable.inArray2Ptr);
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(op1, op2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var op1 = AdvSimd.LoadVector64((Single*)(_dataTable.inArray1Ptr));
var op2 = AdvSimd.LoadVector64((Single*)(_dataTable.inArray2Ptr));
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(op1, op2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new SimpleBinaryOpTest__AbsoluteCompareLessThanOrEqual_Vector64_Single();
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(test._fld1, test._fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new SimpleBinaryOpTest__AbsoluteCompareLessThanOrEqual_Vector64_Single();
fixed (Vector64<Single>* pFld1 = &test._fld1)
fixed (Vector64<Single>* pFld2 = &test._fld2)
{
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(
AdvSimd.LoadVector64((Single*)(pFld1)),
AdvSimd.LoadVector64((Single*)(pFld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(_fld1, _fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector64<Single>* pFld1 = &_fld1)
fixed (Vector64<Single>* pFld2 = &_fld2)
{
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(
AdvSimd.LoadVector64((Single*)(pFld1)),
AdvSimd.LoadVector64((Single*)(pFld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(test._fld1, test._fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = AdvSimd.AbsoluteCompareLessThanOrEqual(
AdvSimd.LoadVector64((Single*)(&test._fld1)),
AdvSimd.LoadVector64((Single*)(&test._fld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector64<Single> op1, Vector64<Single> op2, void* result, [CallerMemberName] string method = "")
{
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), op1);
Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), op2);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "")
{
Single[] inArray1 = new Single[Op1ElementCount];
Single[] inArray2 = new Single[Op2ElementCount];
Single[] outArray = new Single[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<Single>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<Single>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Single>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Single[] left, Single[] right, Single[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
for (var i = 0; i < RetElementCount; i++)
{
if (BitConverter.SingleToInt32Bits(Helpers.AbsoluteCompareLessThanOrEqual(left[i], right[i])) != BitConverter.SingleToInt32Bits(result[i]))
{
succeeded = false;
break;
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.AbsoluteCompareLessThanOrEqual)}<Single>(Vector64<Single>, Vector64<Single>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})");
TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/Target_X64/X64UnboxingStubNode.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using ILCompiler.DependencyAnalysis.X64;
namespace ILCompiler.DependencyAnalysis
{
public partial class UnboxingStubNode
{
protected override void EmitCode(NodeFactory factory, ref X64Emitter encoder, bool relocsOnly)
{
AddrMode thisPtr = new AddrMode(
Register.RegDirect | encoder.TargetRegister.Arg0, null, 0, 0, AddrModeSize.Int64);
encoder.EmitADD(ref thisPtr, (sbyte)factory.Target.PointerSize);
encoder.EmitJMP(GetUnderlyingMethodEntrypoint(factory));
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using ILCompiler.DependencyAnalysis.X64;
namespace ILCompiler.DependencyAnalysis
{
public partial class UnboxingStubNode
{
protected override void EmitCode(NodeFactory factory, ref X64Emitter encoder, bool relocsOnly)
{
AddrMode thisPtr = new AddrMode(
Register.RegDirect | encoder.TargetRegister.Arg0, null, 0, 0, AddrModeSize.Int64);
encoder.EmitADD(ref thisPtr, (sbyte)factory.Target.PointerSize);
encoder.EmitJMP(GetUnderlyingMethodEntrypoint(factory));
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/tests/JIT/Methodical/divrem/rem/i4rem_cs_ro.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="i4rem.cs" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="i4rem.cs" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/tests/JIT/SIMD/VectorSet.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
using System;
using System.Numerics;
internal partial class VectorTest
{
private const int Pass = 100;
private const int Fail = -1;
private class VectorSetTest
{
public static int VectorSet(float value)
{
int returnVal = Pass;
Vector2 A = new Vector2(0.0f, 0.0f);
A.X = value;
if (!CheckValue(A.X, value)) returnVal = Fail;
if (!CheckValue(A.Y, 0.0f)) returnVal = Fail;
A.Y = value;
if (!CheckValue(A.X, value)) returnVal = Fail;
if (!CheckValue(A.Y, value)) returnVal = Fail;
Vector3 B = new Vector3(0.0f, 0.0f, 0.0f);
B.X = value;
if (!CheckValue(B.X, value)) returnVal = Fail;
if (!CheckValue(B.Y, 0.0f)) returnVal = Fail;
if (!CheckValue(B.Z, 0.0f)) returnVal = Fail;
B.Y = value;
if (!CheckValue(B.X, value)) returnVal = Fail;
if (!CheckValue(B.Y, value)) returnVal = Fail;
if (!CheckValue(B.Z, 0.0f)) returnVal = Fail;
B.Z = value;
if (!CheckValue(B.X, value)) returnVal = Fail;
if (!CheckValue(B.Y, value)) returnVal = Fail;
if (!CheckValue(B.Z, value)) returnVal = Fail;
Vector4 C = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
C.X = value;
if (!CheckValue(C.X, value)) returnVal = Fail;
if (!CheckValue(C.Y, 0.0f)) returnVal = Fail;
if (!CheckValue(C.Z, 0.0f)) returnVal = Fail;
if (!CheckValue(C.W, 0.0f)) returnVal = Fail;
C.Y = value;
if (!CheckValue(C.X, value)) returnVal = Fail;
if (!CheckValue(C.Y, value)) returnVal = Fail;
if (!CheckValue(C.Z, 0.0f)) returnVal = Fail;
if (!CheckValue(C.W, 0.0f)) returnVal = Fail;
C.Z = value;
if (!CheckValue(C.X, value)) returnVal = Fail;
if (!CheckValue(C.Y, value)) returnVal = Fail;
if (!CheckValue(C.Z, value)) returnVal = Fail;
if (!CheckValue(C.W, 0.0f)) returnVal = Fail;
C.W = value;
if (!CheckValue(C.X, value)) returnVal = Fail;
if (!CheckValue(C.Y, value)) returnVal = Fail;
if (!CheckValue(C.Z, value)) returnVal = Fail;
if (!CheckValue(C.W, value)) returnVal = Fail;
return returnVal;
}
}
private static int Main()
{
int returnVal = Pass;
if (VectorSetTest.VectorSet(3.14f) == Fail) returnVal = Fail;
return returnVal;
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
using System;
using System.Numerics;
internal partial class VectorTest
{
private const int Pass = 100;
private const int Fail = -1;
private class VectorSetTest
{
public static int VectorSet(float value)
{
int returnVal = Pass;
Vector2 A = new Vector2(0.0f, 0.0f);
A.X = value;
if (!CheckValue(A.X, value)) returnVal = Fail;
if (!CheckValue(A.Y, 0.0f)) returnVal = Fail;
A.Y = value;
if (!CheckValue(A.X, value)) returnVal = Fail;
if (!CheckValue(A.Y, value)) returnVal = Fail;
Vector3 B = new Vector3(0.0f, 0.0f, 0.0f);
B.X = value;
if (!CheckValue(B.X, value)) returnVal = Fail;
if (!CheckValue(B.Y, 0.0f)) returnVal = Fail;
if (!CheckValue(B.Z, 0.0f)) returnVal = Fail;
B.Y = value;
if (!CheckValue(B.X, value)) returnVal = Fail;
if (!CheckValue(B.Y, value)) returnVal = Fail;
if (!CheckValue(B.Z, 0.0f)) returnVal = Fail;
B.Z = value;
if (!CheckValue(B.X, value)) returnVal = Fail;
if (!CheckValue(B.Y, value)) returnVal = Fail;
if (!CheckValue(B.Z, value)) returnVal = Fail;
Vector4 C = new Vector4(0.0f, 0.0f, 0.0f, 0.0f);
C.X = value;
if (!CheckValue(C.X, value)) returnVal = Fail;
if (!CheckValue(C.Y, 0.0f)) returnVal = Fail;
if (!CheckValue(C.Z, 0.0f)) returnVal = Fail;
if (!CheckValue(C.W, 0.0f)) returnVal = Fail;
C.Y = value;
if (!CheckValue(C.X, value)) returnVal = Fail;
if (!CheckValue(C.Y, value)) returnVal = Fail;
if (!CheckValue(C.Z, 0.0f)) returnVal = Fail;
if (!CheckValue(C.W, 0.0f)) returnVal = Fail;
C.Z = value;
if (!CheckValue(C.X, value)) returnVal = Fail;
if (!CheckValue(C.Y, value)) returnVal = Fail;
if (!CheckValue(C.Z, value)) returnVal = Fail;
if (!CheckValue(C.W, 0.0f)) returnVal = Fail;
C.W = value;
if (!CheckValue(C.X, value)) returnVal = Fail;
if (!CheckValue(C.Y, value)) returnVal = Fail;
if (!CheckValue(C.Z, value)) returnVal = Fail;
if (!CheckValue(C.W, value)) returnVal = Fail;
return returnVal;
}
}
private static int Main()
{
int returnVal = Pass;
if (VectorSetTest.VectorSet(3.14f) == Fail) returnVal = Fail;
return returnVal;
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnDecoder.SetOf.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Formats.Asn1
{
public static partial class AsnDecoder
{
/// <summary>
/// Reads a Set-Of value from <paramref name="source"/> with a specified tag
/// under the specified encoding rules.
/// </summary>
/// <param name="source">The buffer containing encoded data.</param>
/// <param name="ruleSet">The encoding constraints to use when interpreting the data.</param>
/// <param name="contentOffset">
/// When this method returns, the offset of the content payload relative to the start of
/// <paramref name="source"/>.
/// This parameter is treated as uninitialized.
/// </param>
/// <param name="contentLength">
/// When this method returns, the number of bytes in the content payload (which may be 0).
/// This parameter is treated as uninitialized.
/// </param>
/// <param name="bytesConsumed">
/// When this method returns, the total number of bytes for the encoded value.
/// This parameter is treated as uninitialized.
/// </param>
/// <param name="skipSortOrderValidation">
/// <see langword="true"/> to always accept the data in the order it is presented,
/// <see langword="false"/> to verify that the data is sorted correctly when the
/// encoding rules say sorting was required (CER and DER).
/// </param>
/// <param name="expectedTag">
/// The tag to check for before reading, or <see langword="null"/> for the default tag (Universal 17).
/// </param>
/// <remarks>
/// The nested content is not evaluated by this method, except for minimal processing to
/// determine the location of an end-of-contents marker or verification of the content
/// sort order.
/// Therefore, the contents may contain data which is not valid under the current encoding rules.
/// </remarks>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="ruleSet"/> is not defined.
/// </exception>
/// <exception cref="AsnContentException">
/// the next value does not have the correct tag.
///
/// -or-
///
/// the length encoding is not valid under the current encoding rules.
///
/// -or-
///
/// the contents are not valid under the current encoding rules.
/// </exception>
/// <exception cref="ArgumentException">
/// <paramref name="expectedTag"/>.<see cref="Asn1Tag.TagClass"/> is
/// <see cref="TagClass.Universal"/>, but
/// <paramref name="expectedTag"/>.<see cref="Asn1Tag.TagValue"/> is not correct for
/// the method.
/// </exception>
public static void ReadSetOf(
ReadOnlySpan<byte> source,
AsnEncodingRules ruleSet,
out int contentOffset,
out int contentLength,
out int bytesConsumed,
bool skipSortOrderValidation = false,
Asn1Tag? expectedTag = null)
{
Asn1Tag tag = ReadTagAndLength(source, ruleSet, out int? length, out int headerLength);
CheckExpectedTag(tag, expectedTag ?? Asn1Tag.SetOf, UniversalTagNumber.SetOf);
// T-REC-X.690-201508 sec 8.12.1
if (!tag.IsConstructed)
{
throw new AsnContentException(
SR.Format(
SR.ContentException_ConstructedEncodingRequired,
UniversalTagNumber.SetOf));
}
int suffix;
ReadOnlySpan<byte> contents;
if (length.HasValue)
{
suffix = 0;
contents = Slice(source, headerLength, length.Value);
}
else
{
int actualLength = SeekEndOfContents(source.Slice(headerLength), ruleSet);
contents = Slice(source, headerLength, actualLength);
suffix = EndOfContentsEncodedLength;
}
if (!skipSortOrderValidation)
{
// T-REC-X.690-201508 sec 11.6
// BER data is not required to be sorted.
if (ruleSet == AsnEncodingRules.DER ||
ruleSet == AsnEncodingRules.CER)
{
ReadOnlySpan<byte> remaining = contents;
ReadOnlySpan<byte> previous = default;
while (!remaining.IsEmpty)
{
ReadEncodedValue(remaining, ruleSet, out _, out _, out int consumed);
ReadOnlySpan<byte> current = remaining.Slice(0, consumed);
remaining = remaining.Slice(consumed);
if (SetOfValueComparer.Compare(current, previous) < 0)
{
throw new AsnContentException(SR.ContentException_SetOfNotSorted);
}
previous = current;
}
}
}
contentOffset = headerLength;
contentLength = contents.Length;
bytesConsumed = headerLength + contents.Length + suffix;
}
}
public partial class AsnReader
{
/// <summary>
/// Reads the next value as a SET-OF with the specified tag
/// and returns the result as a new reader positioned at the first
/// value in the set-of (or with <see cref="HasData"/> == <see langword="false"/>),
/// using the <see cref="AsnReaderOptions.SkipSetSortOrderVerification"/> value
/// from the constructor (default <see langword="false"/>).
/// </summary>
/// <param name="expectedTag">
/// The tag to check for before reading, or <see langword="null"/> for the default tag (Universal 17).
/// </param>
/// <returns>
/// A new reader positioned at the first
/// value in the set-of (or with <see cref="HasData"/> == <see langword="false"/>).
/// </returns>
/// <remarks>
/// the nested content is not evaluated by this method (aside from sort order, when
/// required), and may contain data which is not valid under the current encoding rules.
/// </remarks>
/// <exception cref="AsnContentException">
/// the next value does not have the correct tag.
///
/// -or-
///
/// the length encoding is not valid under the current encoding rules.
///
/// -or-
///
/// the contents are not valid under the current encoding rules.
/// </exception>
/// <exception cref="ArgumentException">
/// <paramref name="expectedTag"/>.<see cref="Asn1Tag.TagClass"/> is
/// <see cref="TagClass.Universal"/>, but
/// <paramref name="expectedTag"/>.<see cref="Asn1Tag.TagValue"/> is not correct for
/// the method.
/// </exception>
public AsnReader ReadSetOf(Asn1Tag? expectedTag = null)
{
return ReadSetOf(_options.SkipSetSortOrderVerification, expectedTag);
}
/// <summary>
/// Reads the next value as a SET-OF with the specified tag
/// and returns the result as a new reader positioned at the first
/// value in the set-of (or with <see cref="HasData"/> == <see langword="false"/>).
/// </summary>
/// <param name="skipSortOrderValidation">
/// <see langword="true"/> to always accept the data in the order it is presented,
/// <see langword="false"/> to verify that the data is sorted correctly when the
/// encoding rules say sorting was required (CER and DER).
/// </param>
/// <param name="expectedTag">
/// The tag to check for before reading, or <see langword="null"/> for the default tag (Universal 17).
/// </param>
/// <returns>
/// A new reader positioned at the first
/// value in the set-of (or with <see cref="HasData"/> == <see langword="false"/>).
/// </returns>
/// <remarks>
/// the nested content is not evaluated by this method (aside from sort order, when
/// required), and may contain data which is not valid under the current encoding rules.
/// </remarks>
/// <exception cref="AsnContentException">
/// the next value does not have the correct tag.
///
/// -or-
///
/// the length encoding is not valid under the current encoding rules.
///
/// -or-
///
/// the contents are not valid under the current encoding rules.
/// </exception>
/// <exception cref="ArgumentException">
/// <paramref name="expectedTag"/>.<see cref="Asn1Tag.TagClass"/> is
/// <see cref="TagClass.Universal"/>, but
/// <paramref name="expectedTag"/>.<see cref="Asn1Tag.TagValue"/> is not correct for
/// the method.
/// </exception>
public AsnReader ReadSetOf(bool skipSortOrderValidation, Asn1Tag? expectedTag = null)
{
AsnDecoder.ReadSetOf(
_data.Span,
RuleSet,
out int contentOffset,
out int contentLength,
out int bytesConsumed,
skipSortOrderValidation,
expectedTag);
AsnReader ret = CloneAtSlice(contentOffset, contentLength);
_data = _data.Slice(bytesConsumed);
return ret;
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Formats.Asn1
{
public static partial class AsnDecoder
{
/// <summary>
/// Reads a Set-Of value from <paramref name="source"/> with a specified tag
/// under the specified encoding rules.
/// </summary>
/// <param name="source">The buffer containing encoded data.</param>
/// <param name="ruleSet">The encoding constraints to use when interpreting the data.</param>
/// <param name="contentOffset">
/// When this method returns, the offset of the content payload relative to the start of
/// <paramref name="source"/>.
/// This parameter is treated as uninitialized.
/// </param>
/// <param name="contentLength">
/// When this method returns, the number of bytes in the content payload (which may be 0).
/// This parameter is treated as uninitialized.
/// </param>
/// <param name="bytesConsumed">
/// When this method returns, the total number of bytes for the encoded value.
/// This parameter is treated as uninitialized.
/// </param>
/// <param name="skipSortOrderValidation">
/// <see langword="true"/> to always accept the data in the order it is presented,
/// <see langword="false"/> to verify that the data is sorted correctly when the
/// encoding rules say sorting was required (CER and DER).
/// </param>
/// <param name="expectedTag">
/// The tag to check for before reading, or <see langword="null"/> for the default tag (Universal 17).
/// </param>
/// <remarks>
/// The nested content is not evaluated by this method, except for minimal processing to
/// determine the location of an end-of-contents marker or verification of the content
/// sort order.
/// Therefore, the contents may contain data which is not valid under the current encoding rules.
/// </remarks>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="ruleSet"/> is not defined.
/// </exception>
/// <exception cref="AsnContentException">
/// the next value does not have the correct tag.
///
/// -or-
///
/// the length encoding is not valid under the current encoding rules.
///
/// -or-
///
/// the contents are not valid under the current encoding rules.
/// </exception>
/// <exception cref="ArgumentException">
/// <paramref name="expectedTag"/>.<see cref="Asn1Tag.TagClass"/> is
/// <see cref="TagClass.Universal"/>, but
/// <paramref name="expectedTag"/>.<see cref="Asn1Tag.TagValue"/> is not correct for
/// the method.
/// </exception>
public static void ReadSetOf(
ReadOnlySpan<byte> source,
AsnEncodingRules ruleSet,
out int contentOffset,
out int contentLength,
out int bytesConsumed,
bool skipSortOrderValidation = false,
Asn1Tag? expectedTag = null)
{
Asn1Tag tag = ReadTagAndLength(source, ruleSet, out int? length, out int headerLength);
CheckExpectedTag(tag, expectedTag ?? Asn1Tag.SetOf, UniversalTagNumber.SetOf);
// T-REC-X.690-201508 sec 8.12.1
if (!tag.IsConstructed)
{
throw new AsnContentException(
SR.Format(
SR.ContentException_ConstructedEncodingRequired,
UniversalTagNumber.SetOf));
}
int suffix;
ReadOnlySpan<byte> contents;
if (length.HasValue)
{
suffix = 0;
contents = Slice(source, headerLength, length.Value);
}
else
{
int actualLength = SeekEndOfContents(source.Slice(headerLength), ruleSet);
contents = Slice(source, headerLength, actualLength);
suffix = EndOfContentsEncodedLength;
}
if (!skipSortOrderValidation)
{
// T-REC-X.690-201508 sec 11.6
// BER data is not required to be sorted.
if (ruleSet == AsnEncodingRules.DER ||
ruleSet == AsnEncodingRules.CER)
{
ReadOnlySpan<byte> remaining = contents;
ReadOnlySpan<byte> previous = default;
while (!remaining.IsEmpty)
{
ReadEncodedValue(remaining, ruleSet, out _, out _, out int consumed);
ReadOnlySpan<byte> current = remaining.Slice(0, consumed);
remaining = remaining.Slice(consumed);
if (SetOfValueComparer.Compare(current, previous) < 0)
{
throw new AsnContentException(SR.ContentException_SetOfNotSorted);
}
previous = current;
}
}
}
contentOffset = headerLength;
contentLength = contents.Length;
bytesConsumed = headerLength + contents.Length + suffix;
}
}
public partial class AsnReader
{
/// <summary>
/// Reads the next value as a SET-OF with the specified tag
/// and returns the result as a new reader positioned at the first
/// value in the set-of (or with <see cref="HasData"/> == <see langword="false"/>),
/// using the <see cref="AsnReaderOptions.SkipSetSortOrderVerification"/> value
/// from the constructor (default <see langword="false"/>).
/// </summary>
/// <param name="expectedTag">
/// The tag to check for before reading, or <see langword="null"/> for the default tag (Universal 17).
/// </param>
/// <returns>
/// A new reader positioned at the first
/// value in the set-of (or with <see cref="HasData"/> == <see langword="false"/>).
/// </returns>
/// <remarks>
/// the nested content is not evaluated by this method (aside from sort order, when
/// required), and may contain data which is not valid under the current encoding rules.
/// </remarks>
/// <exception cref="AsnContentException">
/// the next value does not have the correct tag.
///
/// -or-
///
/// the length encoding is not valid under the current encoding rules.
///
/// -or-
///
/// the contents are not valid under the current encoding rules.
/// </exception>
/// <exception cref="ArgumentException">
/// <paramref name="expectedTag"/>.<see cref="Asn1Tag.TagClass"/> is
/// <see cref="TagClass.Universal"/>, but
/// <paramref name="expectedTag"/>.<see cref="Asn1Tag.TagValue"/> is not correct for
/// the method.
/// </exception>
public AsnReader ReadSetOf(Asn1Tag? expectedTag = null)
{
return ReadSetOf(_options.SkipSetSortOrderVerification, expectedTag);
}
/// <summary>
/// Reads the next value as a SET-OF with the specified tag
/// and returns the result as a new reader positioned at the first
/// value in the set-of (or with <see cref="HasData"/> == <see langword="false"/>).
/// </summary>
/// <param name="skipSortOrderValidation">
/// <see langword="true"/> to always accept the data in the order it is presented,
/// <see langword="false"/> to verify that the data is sorted correctly when the
/// encoding rules say sorting was required (CER and DER).
/// </param>
/// <param name="expectedTag">
/// The tag to check for before reading, or <see langword="null"/> for the default tag (Universal 17).
/// </param>
/// <returns>
/// A new reader positioned at the first
/// value in the set-of (or with <see cref="HasData"/> == <see langword="false"/>).
/// </returns>
/// <remarks>
/// the nested content is not evaluated by this method (aside from sort order, when
/// required), and may contain data which is not valid under the current encoding rules.
/// </remarks>
/// <exception cref="AsnContentException">
/// the next value does not have the correct tag.
///
/// -or-
///
/// the length encoding is not valid under the current encoding rules.
///
/// -or-
///
/// the contents are not valid under the current encoding rules.
/// </exception>
/// <exception cref="ArgumentException">
/// <paramref name="expectedTag"/>.<see cref="Asn1Tag.TagClass"/> is
/// <see cref="TagClass.Universal"/>, but
/// <paramref name="expectedTag"/>.<see cref="Asn1Tag.TagValue"/> is not correct for
/// the method.
/// </exception>
public AsnReader ReadSetOf(bool skipSortOrderValidation, Asn1Tag? expectedTag = null)
{
AsnDecoder.ReadSetOf(
_data.Span,
RuleSet,
out int contentOffset,
out int contentLength,
out int bytesConsumed,
skipSortOrderValidation,
expectedTag);
AsnReader ret = CloneAtSlice(contentOffset, contentLength);
_data = _data.Slice(bytesConsumed);
return ret;
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/tests/JIT/Methodical/int64/signed/s_ldsfld_mul_do.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
<DebugType>Full</DebugType>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="s_ldsfld_mul.cs" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>1</CLRTestPriority>
</PropertyGroup>
<PropertyGroup>
<DebugType>Full</DebugType>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="s_ldsfld_mul.cs" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/tests/JIT/HardwareIntrinsics/General/Vector64/Ceiling.Single.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
namespace JIT.HardwareIntrinsics.General
{
public static partial class Program
{
private static void CeilingSingle()
{
var test = new VectorUnaryOpTest__CeilingSingle();
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
// Validates passing a static member works
test.RunClsVarScenario();
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
// Validates passing an instance member of a class works
test.RunClassFldScenario();
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class VectorUnaryOpTest__CeilingSingle
{
private struct DataTable
{
private byte[] inArray1;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle outHandle;
private ulong alignment;
public DataTable(Single[] inArray1, Single[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Single>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Single>();
if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Single, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector64<Single> _fld1;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref testStruct._fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
return testStruct;
}
public void RunStructFldScenario(VectorUnaryOpTest__CeilingSingle testClass)
{
var result = Vector64.Ceiling(_fld1);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr);
}
}
private static readonly int LargestVectorSize = 8;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Vector64<Single> _clsVar1;
private Vector64<Single> _fld1;
private DataTable _dataTable;
static VectorUnaryOpTest__CeilingSingle()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
}
public VectorUnaryOpTest__CeilingSingle()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
_dataTable = new DataTable(_data1, new Single[RetElementCount], LargestVectorSize);
}
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = Vector64.Ceiling(
Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr)
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var method = typeof(Vector64).GetMethod(nameof(Vector64.Ceiling), new Type[] {
typeof(Vector64<Single>)
});
if (method is null)
{
method = typeof(Vector64).GetMethod(nameof(Vector64.Ceiling), 1, new Type[] {
typeof(Vector64<>).MakeGenericType(Type.MakeGenericMethodParameter(0))
});
}
if (method.IsGenericMethodDefinition)
{
method = method.MakeGenericMethod(typeof(Single));
}
var result = method.Invoke(null, new object[] {
Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr)
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Single>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = Vector64.Ceiling(
_clsVar1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr);
var result = Vector64.Ceiling(op1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new VectorUnaryOpTest__CeilingSingle();
var result = Vector64.Ceiling(test._fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = Vector64.Ceiling(_fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = Vector64.Ceiling(test._fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
private void ValidateResult(Vector64<Single> op1, void* result, [CallerMemberName] string method = "")
{
Single[] inArray1 = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), op1);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Single>>());
ValidateResult(inArray1, outArray, method);
}
private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "")
{
Single[] inArray1 = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<Single>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Single>>());
ValidateResult(inArray1, outArray, method);
}
private void ValidateResult(Single[] firstOp, Single[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
if (result[0] != MathF.Ceiling(firstOp[0]))
{
succeeded = false;
}
else
{
for (var i = 1; i < RetElementCount; i++)
{
if (result[i] != MathF.Ceiling(firstOp[i]))
{
succeeded = false;
break;
}
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(Vector64)}.{nameof(Vector64.Ceiling)}<Single>(Vector64<Single>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
namespace JIT.HardwareIntrinsics.General
{
public static partial class Program
{
private static void CeilingSingle()
{
var test = new VectorUnaryOpTest__CeilingSingle();
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
// Validates passing a static member works
test.RunClsVarScenario();
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
// Validates passing an instance member of a class works
test.RunClassFldScenario();
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class VectorUnaryOpTest__CeilingSingle
{
private struct DataTable
{
private byte[] inArray1;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle outHandle;
private ulong alignment;
public DataTable(Single[] inArray1, Single[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Single>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Single>();
if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Single, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector64<Single> _fld1;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref testStruct._fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
return testStruct;
}
public void RunStructFldScenario(VectorUnaryOpTest__CeilingSingle testClass)
{
var result = Vector64.Ceiling(_fld1);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr);
}
}
private static readonly int LargestVectorSize = 8;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Single>>() / sizeof(Single);
private static Single[] _data1 = new Single[Op1ElementCount];
private static Vector64<Single> _clsVar1;
private Vector64<Single> _fld1;
private DataTable _dataTable;
static VectorUnaryOpTest__CeilingSingle()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
}
public VectorUnaryOpTest__CeilingSingle()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Single>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); }
_dataTable = new DataTable(_data1, new Single[RetElementCount], LargestVectorSize);
}
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = Vector64.Ceiling(
Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr)
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var method = typeof(Vector64).GetMethod(nameof(Vector64.Ceiling), new Type[] {
typeof(Vector64<Single>)
});
if (method is null)
{
method = typeof(Vector64).GetMethod(nameof(Vector64.Ceiling), 1, new Type[] {
typeof(Vector64<>).MakeGenericType(Type.MakeGenericMethodParameter(0))
});
}
if (method.IsGenericMethodDefinition)
{
method = method.MakeGenericMethod(typeof(Single));
}
var result = method.Invoke(null, new object[] {
Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr)
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Single>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = Vector64.Ceiling(
_clsVar1
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector64<Single>>(_dataTable.inArray1Ptr);
var result = Vector64.Ceiling(op1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new VectorUnaryOpTest__CeilingSingle();
var result = Vector64.Ceiling(test._fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = Vector64.Ceiling(_fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = Vector64.Ceiling(test._fld1);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
private void ValidateResult(Vector64<Single> op1, void* result, [CallerMemberName] string method = "")
{
Single[] inArray1 = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), op1);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Single>>());
ValidateResult(inArray1, outArray, method);
}
private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "")
{
Single[] inArray1 = new Single[Op1ElementCount];
Single[] outArray = new Single[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<Single>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Single>>());
ValidateResult(inArray1, outArray, method);
}
private void ValidateResult(Single[] firstOp, Single[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
if (result[0] != MathF.Ceiling(firstOp[0]))
{
succeeded = false;
}
else
{
for (var i = 1; i < RetElementCount; i++)
{
if (result[i] != MathF.Ceiling(firstOp[i]))
{
succeeded = false;
break;
}
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(Vector64)}.{nameof(Vector64.Ceiling)}<Single>(Vector64<Single>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Composition/tests/Microsoft.Composition.Demos.ExtendedCollectionImports/Microsoft.Composition.Demos.ExtendedCollectionImports.csproj
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<Compile Include="Dictionaries\DictionaryExportDescriptorProvider.cs" />
<Compile Include="Util\Formatters.cs" />
<Compile Include="OrderedImportManyAttribute.cs" />
<Compile Include="OrderedCollections\OrderedImportManyExportDescriptorProvider.cs" />
<Compile Include="KeyByMetadataAttribute.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)System.Composition.TypedParts\src\System.Composition.TypedParts.csproj" />
</ItemGroup>
</Project>
|
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<Compile Include="Dictionaries\DictionaryExportDescriptorProvider.cs" />
<Compile Include="Util\Formatters.cs" />
<Compile Include="OrderedImportManyAttribute.cs" />
<Compile Include="OrderedCollections\OrderedImportManyExportDescriptorProvider.cs" />
<Compile Include="KeyByMetadataAttribute.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)System.Composition.TypedParts\src\System.Composition.TypedParts.csproj" />
</ItemGroup>
</Project>
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd.Arm64/AddSaturateScalar.Vector64.Int32.Vector64.UInt32.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void AddSaturateScalar_Vector64_Int32_Vector64_UInt32()
{
var test = new SimpleBinaryOpTest__AddSaturateScalar_Vector64_Int32_Vector64_UInt32();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (AdvSimd.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class SimpleBinaryOpTest__AddSaturateScalar_Vector64_Int32_Vector64_UInt32
{
private struct DataTable
{
private byte[] inArray1;
private byte[] inArray2;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle inHandle2;
private GCHandle outHandle;
private ulong alignment;
public DataTable(Int32[] inArray1, UInt32[] inArray2, Int32[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int32>();
int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt32>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Int32>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.inArray2 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int32, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<UInt32, byte>(ref inArray2[0]), (uint)sizeOfinArray2);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
inHandle2.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector64<Int32> _fld1;
public Vector64<UInt32> _fld2;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref testStruct._fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
return testStruct;
}
public void RunStructFldScenario(SimpleBinaryOpTest__AddSaturateScalar_Vector64_Int32_Vector64_UInt32 testClass)
{
var result = AdvSimd.Arm64.AddSaturateScalar(_fld1, _fld2);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(SimpleBinaryOpTest__AddSaturateScalar_Vector64_Int32_Vector64_UInt32 testClass)
{
fixed (Vector64<Int32>* pFld1 = &_fld1)
fixed (Vector64<UInt32>* pFld2 = &_fld2)
{
var result = AdvSimd.Arm64.AddSaturateScalar(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector64((UInt32*)(pFld2))
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 8;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
private static Vector64<Int32> _clsVar1;
private static Vector64<UInt32> _clsVar2;
private Vector64<Int32> _fld1;
private Vector64<UInt32> _fld2;
private DataTable _dataTable;
static SimpleBinaryOpTest__AddSaturateScalar_Vector64_Int32_Vector64_UInt32()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
}
public SimpleBinaryOpTest__AddSaturateScalar_Vector64_Int32_Vector64_UInt32()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); }
_dataTable = new DataTable(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.Arm64.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = AdvSimd.Arm64.AddSaturateScalar(
Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray2Ptr)
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = AdvSimd.Arm64.AddSaturateScalar(
AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray2Ptr))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.AddSaturateScalar), new Type[] { typeof(Vector64<Int32>), typeof(Vector64<UInt32>) })
.Invoke(null, new object[] {
Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray2Ptr)
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.AddSaturateScalar), new Type[] { typeof(Vector64<Int32>), typeof(Vector64<UInt32>) })
.Invoke(null, new object[] {
AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray2Ptr))
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = AdvSimd.Arm64.AddSaturateScalar(
_clsVar1,
_clsVar2
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector64<Int32>* pClsVar1 = &_clsVar1)
fixed (Vector64<UInt32>* pClsVar2 = &_clsVar2)
{
var result = AdvSimd.Arm64.AddSaturateScalar(
AdvSimd.LoadVector64((Int32*)(pClsVar1)),
AdvSimd.LoadVector64((UInt32*)(pClsVar2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr);
var op2 = Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray2Ptr);
var result = AdvSimd.Arm64.AddSaturateScalar(op1, op2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var op1 = AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr));
var op2 = AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray2Ptr));
var result = AdvSimd.Arm64.AddSaturateScalar(op1, op2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new SimpleBinaryOpTest__AddSaturateScalar_Vector64_Int32_Vector64_UInt32();
var result = AdvSimd.Arm64.AddSaturateScalar(test._fld1, test._fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new SimpleBinaryOpTest__AddSaturateScalar_Vector64_Int32_Vector64_UInt32();
fixed (Vector64<Int32>* pFld1 = &test._fld1)
fixed (Vector64<UInt32>* pFld2 = &test._fld2)
{
var result = AdvSimd.Arm64.AddSaturateScalar(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector64((UInt32*)(pFld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = AdvSimd.Arm64.AddSaturateScalar(_fld1, _fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector64<Int32>* pFld1 = &_fld1)
fixed (Vector64<UInt32>* pFld2 = &_fld2)
{
var result = AdvSimd.Arm64.AddSaturateScalar(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector64((UInt32*)(pFld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.AddSaturateScalar(test._fld1, test._fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.AddSaturateScalar(
AdvSimd.LoadVector64((Int32*)(&test._fld1)),
AdvSimd.LoadVector64((UInt32*)(&test._fld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector64<Int32> op1, Vector64<UInt32> op2, void* result, [CallerMemberName] string method = "")
{
Int32[] inArray1 = new Int32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), op1);
Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), op2);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "")
{
Int32[] inArray1 = new Int32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<Int32>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Int32[] left, UInt32[] right, Int32[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
if (Helpers.AddSaturate(left[0], right[0]) != result[0])
{
succeeded = false;
}
else
{
for (var i = 1; i < RetElementCount; i++)
{
if (result[i] != 0)
{
succeeded = false;
break;
}
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd.Arm64)}.{nameof(AdvSimd.Arm64.AddSaturateScalar)}<Int32>(Vector64<Int32>, Vector64<UInt32>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})");
TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void AddSaturateScalar_Vector64_Int32_Vector64_UInt32()
{
var test = new SimpleBinaryOpTest__AddSaturateScalar_Vector64_Int32_Vector64_UInt32();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (AdvSimd.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class SimpleBinaryOpTest__AddSaturateScalar_Vector64_Int32_Vector64_UInt32
{
private struct DataTable
{
private byte[] inArray1;
private byte[] inArray2;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle inHandle2;
private GCHandle outHandle;
private ulong alignment;
public DataTable(Int32[] inArray1, UInt32[] inArray2, Int32[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int32>();
int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt32>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Int32>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.inArray2 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int32, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<UInt32, byte>(ref inArray2[0]), (uint)sizeOfinArray2);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
inHandle2.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector64<Int32> _fld1;
public Vector64<UInt32> _fld2;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref testStruct._fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
return testStruct;
}
public void RunStructFldScenario(SimpleBinaryOpTest__AddSaturateScalar_Vector64_Int32_Vector64_UInt32 testClass)
{
var result = AdvSimd.Arm64.AddSaturateScalar(_fld1, _fld2);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(SimpleBinaryOpTest__AddSaturateScalar_Vector64_Int32_Vector64_UInt32 testClass)
{
fixed (Vector64<Int32>* pFld1 = &_fld1)
fixed (Vector64<UInt32>* pFld2 = &_fld2)
{
var result = AdvSimd.Arm64.AddSaturateScalar(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector64((UInt32*)(pFld2))
);
Unsafe.Write(testClass._dataTable.outArrayPtr, result);
testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 8;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32);
private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32);
private static Int32[] _data1 = new Int32[Op1ElementCount];
private static UInt32[] _data2 = new UInt32[Op2ElementCount];
private static Vector64<Int32> _clsVar1;
private static Vector64<UInt32> _clsVar2;
private Vector64<Int32> _fld1;
private Vector64<UInt32> _fld2;
private DataTable _dataTable;
static SimpleBinaryOpTest__AddSaturateScalar_Vector64_Int32_Vector64_UInt32()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
}
public SimpleBinaryOpTest__AddSaturateScalar_Vector64_Int32_Vector64_UInt32()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>());
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); }
for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); }
_dataTable = new DataTable(_data1, _data2, new Int32[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.Arm64.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
var result = AdvSimd.Arm64.AddSaturateScalar(
Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray2Ptr)
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
var result = AdvSimd.Arm64.AddSaturateScalar(
AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray2Ptr))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.AddSaturateScalar), new Type[] { typeof(Vector64<Int32>), typeof(Vector64<UInt32>) })
.Invoke(null, new object[] {
Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr),
Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray2Ptr)
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.AddSaturateScalar), new Type[] { typeof(Vector64<Int32>), typeof(Vector64<UInt32>) })
.Invoke(null, new object[] {
AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr)),
AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray2Ptr))
});
Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result));
ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
var result = AdvSimd.Arm64.AddSaturateScalar(
_clsVar1,
_clsVar2
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector64<Int32>* pClsVar1 = &_clsVar1)
fixed (Vector64<UInt32>* pClsVar2 = &_clsVar2)
{
var result = AdvSimd.Arm64.AddSaturateScalar(
AdvSimd.LoadVector64((Int32*)(pClsVar1)),
AdvSimd.LoadVector64((UInt32*)(pClsVar2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr);
var op2 = Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray2Ptr);
var result = AdvSimd.Arm64.AddSaturateScalar(op1, op2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var op1 = AdvSimd.LoadVector64((Int32*)(_dataTable.inArray1Ptr));
var op2 = AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray2Ptr));
var result = AdvSimd.Arm64.AddSaturateScalar(op1, op2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(op1, op2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new SimpleBinaryOpTest__AddSaturateScalar_Vector64_Int32_Vector64_UInt32();
var result = AdvSimd.Arm64.AddSaturateScalar(test._fld1, test._fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new SimpleBinaryOpTest__AddSaturateScalar_Vector64_Int32_Vector64_UInt32();
fixed (Vector64<Int32>* pFld1 = &test._fld1)
fixed (Vector64<UInt32>* pFld2 = &test._fld2)
{
var result = AdvSimd.Arm64.AddSaturateScalar(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector64((UInt32*)(pFld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
var result = AdvSimd.Arm64.AddSaturateScalar(_fld1, _fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector64<Int32>* pFld1 = &_fld1)
fixed (Vector64<UInt32>* pFld2 = &_fld2)
{
var result = AdvSimd.Arm64.AddSaturateScalar(
AdvSimd.LoadVector64((Int32*)(pFld1)),
AdvSimd.LoadVector64((UInt32*)(pFld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.AddSaturateScalar(test._fld1, test._fld2);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
var result = AdvSimd.Arm64.AddSaturateScalar(
AdvSimd.LoadVector64((Int32*)(&test._fld1)),
AdvSimd.LoadVector64((UInt32*)(&test._fld2))
);
Unsafe.Write(_dataTable.outArrayPtr, result);
ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector64<Int32> op1, Vector64<UInt32> op2, void* result, [CallerMemberName] string method = "")
{
Int32[] inArray1 = new Int32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), op1);
Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), op2);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "")
{
Int32[] inArray1 = new Int32[Op1ElementCount];
UInt32[] inArray2 = new UInt32[Op2ElementCount];
Int32[] outArray = new Int32[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<Int32>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<UInt32>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int32>>());
ValidateResult(inArray1, inArray2, outArray, method);
}
private void ValidateResult(Int32[] left, UInt32[] right, Int32[] result, [CallerMemberName] string method = "")
{
bool succeeded = true;
if (Helpers.AddSaturate(left[0], right[0]) != result[0])
{
succeeded = false;
}
else
{
for (var i = 1; i < RetElementCount; i++)
{
if (result[i] != 0)
{
succeeded = false;
break;
}
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd.Arm64)}.{nameof(AdvSimd.Arm64.AddSaturateScalar)}<Int32>(Vector64<Int32>, Vector64<UInt32>): {method} failed:");
TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})");
TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/PoolingAsyncValueTaskMethodBuilder.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using StateMachineBox = System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.StateMachineBox;
namespace System.Runtime.CompilerServices
{
/// <summary>Represents a builder for asynchronous methods that return a <see cref="ValueTask"/>.</summary>
[StructLayout(LayoutKind.Auto)]
public struct PoolingAsyncValueTaskMethodBuilder
{
/// <summary>Sentinel object used to indicate that the builder completed synchronously and successfully.</summary>
private static readonly StateMachineBox s_syncSuccessSentinel = PoolingAsyncValueTaskMethodBuilder<VoidTaskResult>.s_syncSuccessSentinel;
/// <summary>The wrapped state machine box.</summary>
/// <remarks>
/// If the operation completed synchronously and successfully, this will be <see cref="s_syncSuccessSentinel"/>.
/// </remarks>
private StateMachineBox? m_task; // Debugger depends on the exact name of this field.
/// <summary>Creates an instance of the <see cref="PoolingAsyncValueTaskMethodBuilder"/> struct.</summary>
/// <returns>The initialized instance.</returns>
public static PoolingAsyncValueTaskMethodBuilder Create() => default;
/// <summary>Begins running the builder with the associated state machine.</summary>
/// <typeparam name="TStateMachine">The type of the state machine.</typeparam>
/// <param name="stateMachine">The state machine instance, passed by reference.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Start<TStateMachine>(ref TStateMachine stateMachine)
where TStateMachine : IAsyncStateMachine =>
AsyncMethodBuilderCore.Start(ref stateMachine);
/// <summary>Associates the builder with the specified state machine.</summary>
/// <param name="stateMachine">The state machine instance to associate with the builder.</param>
public void SetStateMachine(IAsyncStateMachine stateMachine) =>
AsyncMethodBuilderCore.SetStateMachine(stateMachine, task: null);
/// <summary>Marks the task as successfully completed.</summary>
public void SetResult()
{
if (m_task is null)
{
m_task = s_syncSuccessSentinel;
}
else
{
m_task.SetResult(default);
}
}
/// <summary>Marks the task as failed and binds the specified exception to the task.</summary>
/// <param name="exception">The exception to bind to the task.</param>
public void SetException(Exception exception) =>
PoolingAsyncValueTaskMethodBuilder<VoidTaskResult>.SetException(exception, ref m_task);
/// <summary>Gets the task for this builder.</summary>
public ValueTask Task
{
get
{
if (m_task == s_syncSuccessSentinel)
{
return default;
}
// With normal access paterns, m_task should always be non-null here: the async method should have
// either completed synchronously, in which case SetResult would have set m_task to a non-null object,
// or it should be completing asynchronously, in which case AwaitUnsafeOnCompleted would have similarly
// initialized m_task to a state machine object. However, if the type is used manually (not via
// compiler-generated code) and accesses Task directly, we force it to be initialized. Things will then
// "work" but in a degraded mode, as we don't know the TStateMachine type here, and thus we use a box around
// the interface instead.
StateMachineBox? box = m_task ??= PoolingAsyncValueTaskMethodBuilder<VoidTaskResult>.CreateWeaklyTypedStateMachineBox();
return new ValueTask(box, box.Version);
}
}
/// <summary>Schedules the state machine to proceed to the next action when the specified awaiter completes.</summary>
/// <typeparam name="TAwaiter">The type of the awaiter.</typeparam>
/// <typeparam name="TStateMachine">The type of the state machine.</typeparam>
/// <param name="awaiter">The awaiter.</param>
/// <param name="stateMachine">The state machine.</param>
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
where TAwaiter : INotifyCompletion
where TStateMachine : IAsyncStateMachine =>
PoolingAsyncValueTaskMethodBuilder<VoidTaskResult>.AwaitOnCompleted(ref awaiter, ref stateMachine, ref m_task);
/// <summary>Schedules the state machine to proceed to the next action when the specified awaiter completes.</summary>
/// <typeparam name="TAwaiter">The type of the awaiter.</typeparam>
/// <typeparam name="TStateMachine">The type of the state machine.</typeparam>
/// <param name="awaiter">The awaiter.</param>
/// <param name="stateMachine">The state machine.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
where TAwaiter : ICriticalNotifyCompletion
where TStateMachine : IAsyncStateMachine =>
PoolingAsyncValueTaskMethodBuilder<VoidTaskResult>.AwaitUnsafeOnCompleted(ref awaiter, ref stateMachine, ref m_task);
/// <summary>
/// Gets an object that may be used to uniquely identify this builder to the debugger.
/// </summary>
/// <remarks>
/// This property lazily instantiates the ID in a non-thread-safe manner.
/// It must only be used by the debugger and tracing purposes, and only in a single-threaded manner
/// when no other threads are in the middle of accessing this or other members that lazily initialize the box.
/// </remarks>
internal object ObjectIdForDebugger =>
m_task ??= PoolingAsyncValueTaskMethodBuilder<VoidTaskResult>.CreateWeaklyTypedStateMachineBox();
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using StateMachineBox = System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder<System.Threading.Tasks.VoidTaskResult>.StateMachineBox;
namespace System.Runtime.CompilerServices
{
/// <summary>Represents a builder for asynchronous methods that return a <see cref="ValueTask"/>.</summary>
[StructLayout(LayoutKind.Auto)]
public struct PoolingAsyncValueTaskMethodBuilder
{
/// <summary>Sentinel object used to indicate that the builder completed synchronously and successfully.</summary>
private static readonly StateMachineBox s_syncSuccessSentinel = PoolingAsyncValueTaskMethodBuilder<VoidTaskResult>.s_syncSuccessSentinel;
/// <summary>The wrapped state machine box.</summary>
/// <remarks>
/// If the operation completed synchronously and successfully, this will be <see cref="s_syncSuccessSentinel"/>.
/// </remarks>
private StateMachineBox? m_task; // Debugger depends on the exact name of this field.
/// <summary>Creates an instance of the <see cref="PoolingAsyncValueTaskMethodBuilder"/> struct.</summary>
/// <returns>The initialized instance.</returns>
public static PoolingAsyncValueTaskMethodBuilder Create() => default;
/// <summary>Begins running the builder with the associated state machine.</summary>
/// <typeparam name="TStateMachine">The type of the state machine.</typeparam>
/// <param name="stateMachine">The state machine instance, passed by reference.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Start<TStateMachine>(ref TStateMachine stateMachine)
where TStateMachine : IAsyncStateMachine =>
AsyncMethodBuilderCore.Start(ref stateMachine);
/// <summary>Associates the builder with the specified state machine.</summary>
/// <param name="stateMachine">The state machine instance to associate with the builder.</param>
public void SetStateMachine(IAsyncStateMachine stateMachine) =>
AsyncMethodBuilderCore.SetStateMachine(stateMachine, task: null);
/// <summary>Marks the task as successfully completed.</summary>
public void SetResult()
{
if (m_task is null)
{
m_task = s_syncSuccessSentinel;
}
else
{
m_task.SetResult(default);
}
}
/// <summary>Marks the task as failed and binds the specified exception to the task.</summary>
/// <param name="exception">The exception to bind to the task.</param>
public void SetException(Exception exception) =>
PoolingAsyncValueTaskMethodBuilder<VoidTaskResult>.SetException(exception, ref m_task);
/// <summary>Gets the task for this builder.</summary>
public ValueTask Task
{
get
{
if (m_task == s_syncSuccessSentinel)
{
return default;
}
// With normal access paterns, m_task should always be non-null here: the async method should have
// either completed synchronously, in which case SetResult would have set m_task to a non-null object,
// or it should be completing asynchronously, in which case AwaitUnsafeOnCompleted would have similarly
// initialized m_task to a state machine object. However, if the type is used manually (not via
// compiler-generated code) and accesses Task directly, we force it to be initialized. Things will then
// "work" but in a degraded mode, as we don't know the TStateMachine type here, and thus we use a box around
// the interface instead.
StateMachineBox? box = m_task ??= PoolingAsyncValueTaskMethodBuilder<VoidTaskResult>.CreateWeaklyTypedStateMachineBox();
return new ValueTask(box, box.Version);
}
}
/// <summary>Schedules the state machine to proceed to the next action when the specified awaiter completes.</summary>
/// <typeparam name="TAwaiter">The type of the awaiter.</typeparam>
/// <typeparam name="TStateMachine">The type of the state machine.</typeparam>
/// <param name="awaiter">The awaiter.</param>
/// <param name="stateMachine">The state machine.</param>
public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
where TAwaiter : INotifyCompletion
where TStateMachine : IAsyncStateMachine =>
PoolingAsyncValueTaskMethodBuilder<VoidTaskResult>.AwaitOnCompleted(ref awaiter, ref stateMachine, ref m_task);
/// <summary>Schedules the state machine to proceed to the next action when the specified awaiter completes.</summary>
/// <typeparam name="TAwaiter">The type of the awaiter.</typeparam>
/// <typeparam name="TStateMachine">The type of the state machine.</typeparam>
/// <param name="awaiter">The awaiter.</param>
/// <param name="stateMachine">The state machine.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine)
where TAwaiter : ICriticalNotifyCompletion
where TStateMachine : IAsyncStateMachine =>
PoolingAsyncValueTaskMethodBuilder<VoidTaskResult>.AwaitUnsafeOnCompleted(ref awaiter, ref stateMachine, ref m_task);
/// <summary>
/// Gets an object that may be used to uniquely identify this builder to the debugger.
/// </summary>
/// <remarks>
/// This property lazily instantiates the ID in a non-thread-safe manner.
/// It must only be used by the debugger and tracing purposes, and only in a single-threaded manner
/// when no other threads are in the middle of accessing this or other members that lazily initialize the box.
/// </remarks>
internal object ObjectIdForDebugger =>
m_task ??= PoolingAsyncValueTaskMethodBuilder<VoidTaskResult>.CreateWeaklyTypedStateMachineBox();
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.ComDisabled.UnitTests/System/Runtime/InteropServices/Marshal/MarshalComDisabledTests.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Xunit;
namespace System.Runtime.InteropServices.Tests
{
[PlatformSpecific(TestPlatforms.Windows)]
public partial class MarshalComDisabledTests
{
[Fact]
public void GetTypeFromCLSID_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.GetTypeFromCLSID(Guid.Empty));
}
[Fact]
public void CreateAggregatedObject_ThrowsNotSupportedException()
{
object value = new object();
Assert.Throws<NotSupportedException>(() => Marshal.CreateAggregatedObject(IntPtr.Zero, value));
}
[Fact]
public void CreateAggregatedObject_T_ThrowsNotSupportedException()
{
object value = new object();
Assert.Throws<NotSupportedException>(() => Marshal.CreateAggregatedObject<object>(IntPtr.Zero, value));
}
[Fact]
public void ReleaseComObject_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.ReleaseComObject(new object()));
}
[Fact]
public void FinalReleaseComObject_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.FinalReleaseComObject(new object()));
}
[Fact]
public void GetComObjectData_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.GetComObjectData("key", "value"));
}
[Fact]
public void SetComObjectData_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.SetComObjectData(new object(), "key", "value"));
}
[Fact]
public void CreateWrapperOfType_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.CreateWrapperOfType(new object(), typeof(object)));
}
[Fact]
public void CreateWrapperOfType_T_TWrapper_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.CreateWrapperOfType<object, object>(new object()));
}
[Fact]
public void GetNativeVariantForObject_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.GetNativeVariantForObject(99, IntPtr.Zero));
}
[Fact]
public void GetNativeVariantForObject_T_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.GetNativeVariantForObject<double>(99, IntPtr.Zero));
}
public struct NativeVariant{}
[Fact]
public void GetObjectForNativeVariant_ThrowsNotSupportedException()
{
NativeVariant variant = new NativeVariant();
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf<NativeVariant>());
try
{
Marshal.StructureToPtr(variant, ptr, fDeleteOld: false);
Assert.Throws<NotSupportedException>(() => Marshal.GetObjectForNativeVariant(ptr));
}
finally
{
Marshal.DestroyStructure<NativeVariant>(ptr);
Marshal.FreeHGlobal(ptr);
}
}
public struct NativeVariant_T{}
[Fact]
public void GetObjectForNativeVariant_T_ThrowsNotSupportedException()
{
NativeVariant_T variant = new NativeVariant_T();
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf<NativeVariant_T>());
try
{
Marshal.StructureToPtr(variant, ptr, fDeleteOld: false);
Assert.Throws<NotSupportedException>(() => Marshal.GetObjectForNativeVariant<NativeVariant_T>(ptr));
}
finally
{
Marshal.DestroyStructure<NativeVariant_T>(ptr);
Marshal.FreeHGlobal(ptr);
}
}
[Fact]
public void GetObjectsForNativeVariants_ThrowsNotSupportedException()
{
IntPtr ptr = Marshal.AllocHGlobal(2 * Marshal.SizeOf<NativeVariant>());
try
{
Assert.Throws<NotSupportedException>(() => Marshal.GetObjectsForNativeVariants(ptr, 2));
}
finally
{
Marshal.FreeHGlobal(ptr);
}
}
[Fact]
public void GetObjectsForNativeVariants_T_ThrowsNotSupportedException()
{
IntPtr ptr = Marshal.AllocHGlobal(2 * Marshal.SizeOf<NativeVariant_T>());
try
{
Assert.Throws<NotSupportedException>(() => Marshal.GetObjectsForNativeVariants<sbyte>(ptr, 2));
}
finally
{
Marshal.FreeHGlobal(ptr);
}
}
[Fact]
public void BindToMoniker_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.BindToMoniker("test"));
}
[Fact]
public void GetIUnknownForObject_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.GetIUnknownForObject(new object()));
}
[Fact]
public void GetIDispatchForObject_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.GetIDispatchForObject(new object()));
}
public struct StructForIUnknown{}
[Fact]
public void GetObjectForIUnknown_ThrowsNotSupportedException()
{
StructForIUnknown test = new StructForIUnknown();
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf<StructForIUnknown>());
try
{
Marshal.StructureToPtr(test, ptr, fDeleteOld: false);
Assert.Throws<NotSupportedException>(() => Marshal.GetObjectForIUnknown(ptr));
}
finally
{
Marshal.DestroyStructure<StructForIUnknown>(ptr);
Marshal.FreeHGlobal(ptr);
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Xunit;
namespace System.Runtime.InteropServices.Tests
{
[PlatformSpecific(TestPlatforms.Windows)]
public partial class MarshalComDisabledTests
{
[Fact]
public void GetTypeFromCLSID_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.GetTypeFromCLSID(Guid.Empty));
}
[Fact]
public void CreateAggregatedObject_ThrowsNotSupportedException()
{
object value = new object();
Assert.Throws<NotSupportedException>(() => Marshal.CreateAggregatedObject(IntPtr.Zero, value));
}
[Fact]
public void CreateAggregatedObject_T_ThrowsNotSupportedException()
{
object value = new object();
Assert.Throws<NotSupportedException>(() => Marshal.CreateAggregatedObject<object>(IntPtr.Zero, value));
}
[Fact]
public void ReleaseComObject_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.ReleaseComObject(new object()));
}
[Fact]
public void FinalReleaseComObject_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.FinalReleaseComObject(new object()));
}
[Fact]
public void GetComObjectData_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.GetComObjectData("key", "value"));
}
[Fact]
public void SetComObjectData_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.SetComObjectData(new object(), "key", "value"));
}
[Fact]
public void CreateWrapperOfType_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.CreateWrapperOfType(new object(), typeof(object)));
}
[Fact]
public void CreateWrapperOfType_T_TWrapper_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.CreateWrapperOfType<object, object>(new object()));
}
[Fact]
public void GetNativeVariantForObject_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.GetNativeVariantForObject(99, IntPtr.Zero));
}
[Fact]
public void GetNativeVariantForObject_T_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.GetNativeVariantForObject<double>(99, IntPtr.Zero));
}
public struct NativeVariant{}
[Fact]
public void GetObjectForNativeVariant_ThrowsNotSupportedException()
{
NativeVariant variant = new NativeVariant();
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf<NativeVariant>());
try
{
Marshal.StructureToPtr(variant, ptr, fDeleteOld: false);
Assert.Throws<NotSupportedException>(() => Marshal.GetObjectForNativeVariant(ptr));
}
finally
{
Marshal.DestroyStructure<NativeVariant>(ptr);
Marshal.FreeHGlobal(ptr);
}
}
public struct NativeVariant_T{}
[Fact]
public void GetObjectForNativeVariant_T_ThrowsNotSupportedException()
{
NativeVariant_T variant = new NativeVariant_T();
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf<NativeVariant_T>());
try
{
Marshal.StructureToPtr(variant, ptr, fDeleteOld: false);
Assert.Throws<NotSupportedException>(() => Marshal.GetObjectForNativeVariant<NativeVariant_T>(ptr));
}
finally
{
Marshal.DestroyStructure<NativeVariant_T>(ptr);
Marshal.FreeHGlobal(ptr);
}
}
[Fact]
public void GetObjectsForNativeVariants_ThrowsNotSupportedException()
{
IntPtr ptr = Marshal.AllocHGlobal(2 * Marshal.SizeOf<NativeVariant>());
try
{
Assert.Throws<NotSupportedException>(() => Marshal.GetObjectsForNativeVariants(ptr, 2));
}
finally
{
Marshal.FreeHGlobal(ptr);
}
}
[Fact]
public void GetObjectsForNativeVariants_T_ThrowsNotSupportedException()
{
IntPtr ptr = Marshal.AllocHGlobal(2 * Marshal.SizeOf<NativeVariant_T>());
try
{
Assert.Throws<NotSupportedException>(() => Marshal.GetObjectsForNativeVariants<sbyte>(ptr, 2));
}
finally
{
Marshal.FreeHGlobal(ptr);
}
}
[Fact]
public void BindToMoniker_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.BindToMoniker("test"));
}
[Fact]
public void GetIUnknownForObject_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.GetIUnknownForObject(new object()));
}
[Fact]
public void GetIDispatchForObject_ThrowsNotSupportedException()
{
Assert.Throws<NotSupportedException>(() => Marshal.GetIDispatchForObject(new object()));
}
public struct StructForIUnknown{}
[Fact]
public void GetObjectForIUnknown_ThrowsNotSupportedException()
{
StructForIUnknown test = new StructForIUnknown();
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf<StructForIUnknown>());
try
{
Marshal.StructureToPtr(test, ptr, fDeleteOld: false);
Assert.Throws<NotSupportedException>(() => Marshal.GetObjectForIUnknown(ptr));
}
finally
{
Marshal.DestroyStructure<StructForIUnknown>(ptr);
Marshal.FreeHGlobal(ptr);
}
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/TypeInfoFromProjectN/TypeInfo_DeclaredPropertiesTests.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Xunit;
using System.Collections.Generic;
#pragma warning disable 0414
#pragma warning disable 0067
#pragma warning disable 3026
namespace System.Reflection.Tests
{
public class TypeInfoDeclaredPropertiesTests
{
// Verify Declared Properties for Base class
[Fact]
public static void TestBaseClassProperty1()
{
VerifyProperty(typeof(TypeInfoPropertiesBaseClass).Project(), "Pubprop1");
}
// Verify Declared Properties for Base class
[Fact]
public static void TestBaseClassProperty2()
{
VerifyProperty(typeof(TypeInfoPropertiesBaseClass).Project(), "SubPubprop1");
}
// Verify Declared Properties for Base class
[Fact]
public static void TestBaseClassProperty3()
{
VerifyProperty(typeof(TypeInfoPropertiesBaseClass).Project(), "Pubprop2");
}
// Verify Declared Properties for Base class
[Fact]
public static void TestBaseClassProperty4()
{
VerifyProperty(typeof(TypeInfoPropertiesBaseClass).Project(), "Pubprop3");
}
// Verify Declared Properties for Derived class
[Fact]
public static void TestSubClassProperty1()
{
VerifyProperty(typeof(TypeInfoPropertiesSubClass).Project(), "Pubprop1");
}
// Verify Declared Properties for Derived class
[Fact]
public static void TestSubClassProperty2()
{
VerifyProperty(typeof(TypeInfoPropertiesSubClass).Project(), "Pubprop2");
}
// Verify Declared Properties for Derived class
[Fact]
public static void TestSubClassProperty3()
{
VerifyProperty(typeof(TypeInfoPropertiesSubClass).Project(), "Pubprop3");
}
//private helper methods
private static void VerifyProperty(Type t, string name)
{
//Fix to initialize Reflection
string str = typeof(object).Project().Name;
TypeInfo ti = t.GetTypeInfo();
IEnumerator<PropertyInfo> allprops = ti.DeclaredProperties.GetEnumerator();
bool found = false;
while (allprops.MoveNext())
{
if (allprops.Current.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase))
{
found = true;
break;
}
}
if (!found)
Assert.False(true, string.Format("Property {0} not found in Type {1}", name, t.Name));
}
} //end class
//Metadata for Reflection
public class TypeInfoPropertiesBaseClass
{
public string Pubprop1 { get { return ""; } set { } }
public string SubPubprop1 { get { return ""; } set { } }
public virtual string Pubprop2 { get { return ""; } set { } }
public static string Pubprop3 { get { return ""; } set { } }
}
public class TypeInfoPropertiesSubClass : TypeInfoPropertiesBaseClass
{
public new string Pubprop1 { get { return ""; } set { } }
public new virtual string Pubprop2 { get { return ""; } set { } }
public static new string Pubprop3 { get { return ""; } set { } }
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Xunit;
using System.Collections.Generic;
#pragma warning disable 0414
#pragma warning disable 0067
#pragma warning disable 3026
namespace System.Reflection.Tests
{
public class TypeInfoDeclaredPropertiesTests
{
// Verify Declared Properties for Base class
[Fact]
public static void TestBaseClassProperty1()
{
VerifyProperty(typeof(TypeInfoPropertiesBaseClass).Project(), "Pubprop1");
}
// Verify Declared Properties for Base class
[Fact]
public static void TestBaseClassProperty2()
{
VerifyProperty(typeof(TypeInfoPropertiesBaseClass).Project(), "SubPubprop1");
}
// Verify Declared Properties for Base class
[Fact]
public static void TestBaseClassProperty3()
{
VerifyProperty(typeof(TypeInfoPropertiesBaseClass).Project(), "Pubprop2");
}
// Verify Declared Properties for Base class
[Fact]
public static void TestBaseClassProperty4()
{
VerifyProperty(typeof(TypeInfoPropertiesBaseClass).Project(), "Pubprop3");
}
// Verify Declared Properties for Derived class
[Fact]
public static void TestSubClassProperty1()
{
VerifyProperty(typeof(TypeInfoPropertiesSubClass).Project(), "Pubprop1");
}
// Verify Declared Properties for Derived class
[Fact]
public static void TestSubClassProperty2()
{
VerifyProperty(typeof(TypeInfoPropertiesSubClass).Project(), "Pubprop2");
}
// Verify Declared Properties for Derived class
[Fact]
public static void TestSubClassProperty3()
{
VerifyProperty(typeof(TypeInfoPropertiesSubClass).Project(), "Pubprop3");
}
//private helper methods
private static void VerifyProperty(Type t, string name)
{
//Fix to initialize Reflection
string str = typeof(object).Project().Name;
TypeInfo ti = t.GetTypeInfo();
IEnumerator<PropertyInfo> allprops = ti.DeclaredProperties.GetEnumerator();
bool found = false;
while (allprops.MoveNext())
{
if (allprops.Current.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase))
{
found = true;
break;
}
}
if (!found)
Assert.False(true, string.Format("Property {0} not found in Type {1}", name, t.Name));
}
} //end class
//Metadata for Reflection
public class TypeInfoPropertiesBaseClass
{
public string Pubprop1 { get { return ""; } set { } }
public string SubPubprop1 { get { return ""; } set { } }
public virtual string Pubprop2 { get { return ""; } set { } }
public static string Pubprop3 { get { return ""; } set { } }
}
public class TypeInfoPropertiesSubClass : TypeInfoPropertiesBaseClass
{
public new string Pubprop1 { get { return ""; } set { } }
public new virtual string Pubprop2 { get { return ""; } set { } }
public static new string Pubprop3 { get { return ""; } set { } }
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Net.NameResolution/tests/PalTests/Fakes/IPAddressFakeExtensions.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Net
{
internal static class IPAddressFakeExtensions
{
public static bool TryWriteBytes(this IPAddress address, Span<byte> destination, out int bytesWritten)
{
byte[] bytes = address.GetAddressBytes();
if (bytes.Length >= destination.Length)
{
new ReadOnlySpan<byte>(bytes).CopyTo(destination);
bytesWritten = bytes.Length;
return true;
}
else
{
bytesWritten = 0;
return false;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Net
{
internal static class IPAddressFakeExtensions
{
public static bool TryWriteBytes(this IPAddress address, Span<byte> destination, out int bytesWritten)
{
byte[] bytes = address.GetAddressBytes();
if (bytes.Length >= destination.Length)
{
new ReadOnlySpan<byte>(bytes).CopyTo(destination);
bytesWritten = bytes.Length;
return true;
}
else
{
bytesWritten = 0;
return false;
}
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Runtime/tests/System/WeakReferenceTests.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Runtime.CompilerServices;
using Xunit;
namespace System.Tests
{
public static unsafe class WeakReferenceTests
{
//
// Helper method to create a weak reference that refers to a new object, without
// accidentally keeping the object alive due to lifetime extension by the JIT.
//
[MethodImpl(MethodImplOptions.NoInlining)]
private static WeakReference MakeWeakReference(Func<object> valueFactory, bool trackResurrection = false)
{
return new WeakReference(valueFactory(), trackResurrection);
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static WeakReference<object> MakeWeakReferenceOfObject(Func<object> valueFactory, bool trackResurrection = false)
{
return new WeakReference<object>(valueFactory(), trackResurrection);
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))]
public static void NonGeneric()
{
object o1 = new char[10];
WeakReference w = new WeakReference(o1);
VerifyStillAlive(w);
Assert.True(RuntimeHelpers.ReferenceEquals(o1, w.Target));
Assert.False(w.TrackResurrection);
GC.KeepAlive(o1);
object o2 = new char[100];
w.Target = o2;
VerifyStillAlive(w);
Assert.True(RuntimeHelpers.ReferenceEquals(o2, w.Target));
GC.KeepAlive(o2);
Latch l = new Latch();
w = MakeWeakReference(() => new C(l));
GC.Collect();
VerifyIsDead(w);
l = new Latch();
w = MakeWeakReference(() => new ResurrectingC(l), true);
GC.Collect();
GC.WaitForPendingFinalizers();
if (!l.FinalizerRan)
{
Console.WriteLine("Attempted GC but could not force test object to finalize. Test skipped.");
}
else
{
VerifyStillAlive(w);
}
l = new Latch();
w = MakeWeakReference(() => new C(l), true);
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
if (!l.FinalizerRan)
{
Console.WriteLine("Attempted GC but could not force test object to finalize. Test skipped.");
}
else
{
VerifyIsDead(w);
}
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))]
public static void Generic()
{
object o1 = new char[10];
WeakReference<object> w = new WeakReference<object>(o1);
VerifyStillAlive(w);
object v1;
Assert.True(w.TryGetTarget(out v1));
Assert.True(object.ReferenceEquals(v1, o1));
GC.KeepAlive(o1);
object o2 = new char[100];
w.SetTarget(o2);
VerifyStillAlive(w);
object v2;
Assert.True(w.TryGetTarget(out v2));
Assert.True(object.ReferenceEquals(v2, o2));
GC.KeepAlive(o2);
Latch l = new Latch();
w = MakeWeakReferenceOfObject(() => new C(l));
GC.Collect();
VerifyIsDead(w);
l = new Latch();
w = MakeWeakReferenceOfObject(() => new ResurrectingC(l), true);
GC.Collect();
GC.WaitForPendingFinalizers();
if (!l.FinalizerRan)
{
Console.WriteLine("Attempted GC but could not force test object to finalize. Test skipped.");
}
else
{
VerifyStillAlive(w);
}
l = new Latch();
w = MakeWeakReferenceOfObject(() => new C(l), true);
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
if (!l.FinalizerRan)
{
Console.WriteLine("Attempted GC but could not force test object to finalize. Test skipped.");
}
else
{
VerifyIsDead(w);
}
}
private class Latch
{
public bool FinalizerRan;
}
private class C
{
public C(Latch latch)
{
_latch = latch;
}
~C()
{
_latch.FinalizerRan = true;
}
private Latch _latch;
}
private static ResurrectingC s_resurrectedC;
private class ResurrectingC
{
public ResurrectingC(Latch latch)
{
_latch = latch;
}
~ResurrectingC()
{
_latch.FinalizerRan = true;
s_resurrectedC = this;
}
private Latch _latch;
}
private static void VerifyStillAlive(WeakReference w)
{
Assert.True(w.IsAlive);
Assert.True(w.Target != null);
}
private static void VerifyStillAlive<T>(WeakReference<T> w) where T : class
{
T value;
bool isAlive = w.TryGetTarget(out value);
Assert.True(isAlive);
Assert.True(value != null);
}
private static void VerifyIsDead(WeakReference w)
{
Assert.False(w.IsAlive);
Assert.Null(w.Target);
}
private static void VerifyIsDead<T>(WeakReference<T> w) where T : class
{
T value;
bool isAlive = w.TryGetTarget(out value);
Assert.False(isAlive);
Assert.True(value == null);
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Runtime.CompilerServices;
using Xunit;
namespace System.Tests
{
public static unsafe class WeakReferenceTests
{
//
// Helper method to create a weak reference that refers to a new object, without
// accidentally keeping the object alive due to lifetime extension by the JIT.
//
[MethodImpl(MethodImplOptions.NoInlining)]
private static WeakReference MakeWeakReference(Func<object> valueFactory, bool trackResurrection = false)
{
return new WeakReference(valueFactory(), trackResurrection);
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static WeakReference<object> MakeWeakReferenceOfObject(Func<object> valueFactory, bool trackResurrection = false)
{
return new WeakReference<object>(valueFactory(), trackResurrection);
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))]
public static void NonGeneric()
{
object o1 = new char[10];
WeakReference w = new WeakReference(o1);
VerifyStillAlive(w);
Assert.True(RuntimeHelpers.ReferenceEquals(o1, w.Target));
Assert.False(w.TrackResurrection);
GC.KeepAlive(o1);
object o2 = new char[100];
w.Target = o2;
VerifyStillAlive(w);
Assert.True(RuntimeHelpers.ReferenceEquals(o2, w.Target));
GC.KeepAlive(o2);
Latch l = new Latch();
w = MakeWeakReference(() => new C(l));
GC.Collect();
VerifyIsDead(w);
l = new Latch();
w = MakeWeakReference(() => new ResurrectingC(l), true);
GC.Collect();
GC.WaitForPendingFinalizers();
if (!l.FinalizerRan)
{
Console.WriteLine("Attempted GC but could not force test object to finalize. Test skipped.");
}
else
{
VerifyStillAlive(w);
}
l = new Latch();
w = MakeWeakReference(() => new C(l), true);
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
if (!l.FinalizerRan)
{
Console.WriteLine("Attempted GC but could not force test object to finalize. Test skipped.");
}
else
{
VerifyIsDead(w);
}
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))]
public static void Generic()
{
object o1 = new char[10];
WeakReference<object> w = new WeakReference<object>(o1);
VerifyStillAlive(w);
object v1;
Assert.True(w.TryGetTarget(out v1));
Assert.True(object.ReferenceEquals(v1, o1));
GC.KeepAlive(o1);
object o2 = new char[100];
w.SetTarget(o2);
VerifyStillAlive(w);
object v2;
Assert.True(w.TryGetTarget(out v2));
Assert.True(object.ReferenceEquals(v2, o2));
GC.KeepAlive(o2);
Latch l = new Latch();
w = MakeWeakReferenceOfObject(() => new C(l));
GC.Collect();
VerifyIsDead(w);
l = new Latch();
w = MakeWeakReferenceOfObject(() => new ResurrectingC(l), true);
GC.Collect();
GC.WaitForPendingFinalizers();
if (!l.FinalizerRan)
{
Console.WriteLine("Attempted GC but could not force test object to finalize. Test skipped.");
}
else
{
VerifyStillAlive(w);
}
l = new Latch();
w = MakeWeakReferenceOfObject(() => new C(l), true);
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
if (!l.FinalizerRan)
{
Console.WriteLine("Attempted GC but could not force test object to finalize. Test skipped.");
}
else
{
VerifyIsDead(w);
}
}
private class Latch
{
public bool FinalizerRan;
}
private class C
{
public C(Latch latch)
{
_latch = latch;
}
~C()
{
_latch.FinalizerRan = true;
}
private Latch _latch;
}
private static ResurrectingC s_resurrectedC;
private class ResurrectingC
{
public ResurrectingC(Latch latch)
{
_latch = latch;
}
~ResurrectingC()
{
_latch.FinalizerRan = true;
s_resurrectedC = this;
}
private Latch _latch;
}
private static void VerifyStillAlive(WeakReference w)
{
Assert.True(w.IsAlive);
Assert.True(w.Target != null);
}
private static void VerifyStillAlive<T>(WeakReference<T> w) where T : class
{
T value;
bool isAlive = w.TryGetTarget(out value);
Assert.True(isAlive);
Assert.True(value != null);
}
private static void VerifyIsDead(WeakReference w)
{
Assert.False(w.IsAlive);
Assert.Null(w.Target);
}
private static void VerifyIsDead<T>(WeakReference<T> w) where T : class
{
T value;
bool isAlive = w.TryGetTarget(out value);
Assert.False(isAlive);
Assert.True(value == null);
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/StaticFieldLayoutTests.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Buffers.Binary;
using System.Linq;
using Internal.TypeSystem;
using Internal.TypeSystem.Ecma;
using Xunit;
namespace TypeSystemTests
{
public class StaticFieldLayoutTests
{
TestTypeSystemContext _context;
ModuleDesc _testModule;
public StaticFieldLayoutTests()
{
_context = new TestTypeSystemContext(TargetArchitecture.X64);
var systemModule = _context.CreateModuleForSimpleName("CoreTestAssembly");
_context.SetSystemModule(systemModule);
_testModule = systemModule;
}
[Fact]
public void TestNoPointers()
{
MetadataType t = _testModule.GetType("StaticFieldLayout", "NoPointers");
foreach (var field in t.GetFields())
{
if (!field.IsStatic)
continue;
switch (field.Name)
{
case "int1":
Assert.Equal(0, field.Offset.AsInt);
break;
case "byte1":
Assert.Equal(4, field.Offset.AsInt);
break;
case "char1":
Assert.Equal(6, field.Offset.AsInt);
break;
default:
throw new Exception(field.Name);
}
}
}
[Fact]
public void TestStillNoPointers()
{
//
// Test that static offsets ignore instance fields preceeding them
//
MetadataType t = _testModule.GetType("StaticFieldLayout", "StillNoPointers");
foreach (var field in t.GetFields())
{
if (!field.IsStatic)
continue;
switch (field.Name)
{
case "bool1":
Assert.Equal(0, field.Offset.AsInt);
break;
default:
throw new Exception(field.Name);
}
}
}
[Fact]
public void TestClassNoPointers()
{
//
// Ensure classes behave the same as structs when containing statics
//
MetadataType t = _testModule.GetType("StaticFieldLayout", "ClassNoPointers");
foreach (var field in t.GetFields())
{
if (!field.IsStatic)
continue;
switch (field.Name)
{
case "int1":
Assert.Equal(0, field.Offset.AsInt);
break;
case "byte1":
Assert.Equal(4, field.Offset.AsInt);
break;
case "char1":
Assert.Equal(6, field.Offset.AsInt);
break;
default:
throw new Exception(field.Name);
}
}
}
[Fact]
public void TestHasPointers()
{
//
// Test a struct containing static types with pointers
//
MetadataType t = _testModule.GetType("StaticFieldLayout", "HasPointers");
foreach (var field in t.GetFields())
{
if (!field.IsStatic)
continue;
switch (field.Name)
{
case "string1":
Assert.Equal(8, field.Offset.AsInt);
break;
case "class1":
Assert.Equal(16, field.Offset.AsInt);
break;
default:
throw new Exception(field.Name);
}
}
}
[Fact]
public void TestMixPointersAndNonPointers()
{
//
// Test that static fields with GC pointers get separate offsets from non-GC fields
//
MetadataType t = _testModule.GetType("StaticFieldLayout", "MixPointersAndNonPointers");
foreach (var field in t.GetFields())
{
if (!field.IsStatic)
continue;
switch (field.Name)
{
case "string1":
Assert.Equal(8, field.Offset.AsInt);
break;
case "int1":
Assert.Equal(0, field.Offset.AsInt);
break;
case "class1":
Assert.Equal(16, field.Offset.AsInt);
break;
case "int2":
Assert.Equal(4, field.Offset.AsInt);
break;
case "string2":
Assert.Equal(24, field.Offset.AsInt);
break;
default:
throw new Exception(field.Name);
}
}
}
[Fact]
public void TestEnsureInheritanceResetsStaticOffsets()
{
//
// Test that when inheriting a class with static fields, the derived slice's static fields
// are again offset from 0
//
MetadataType t = _testModule.GetType("StaticFieldLayout", "EnsureInheritanceResetsStaticOffsets");
foreach (var field in t.GetFields())
{
if (!field.IsStatic)
continue;
switch (field.Name)
{
case "int3":
Assert.Equal(0, field.Offset.AsInt);
break;
case "string3":
Assert.Equal(8, field.Offset.AsInt);
break;
default:
throw new Exception(field.Name);
}
}
}
[Fact]
public void TestLiteralFieldsDontAffectLayout()
{
//
// Test that literal fields are not laid out.
//
MetadataType t = _testModule.GetType("StaticFieldLayout", "LiteralFieldsDontAffectLayout");
Assert.Equal(4, t.GetFields().Count());
foreach (var field in t.GetFields())
{
if (!field.IsStatic)
continue;
switch (field.Name)
{
case "IntConstant":
case "StringConstant":
Assert.True(field.IsStatic);
Assert.True(field.IsLiteral);
break;
case "Int1":
Assert.Equal(0, field.Offset.AsInt);
break;
case "String1":
Assert.Equal(8, field.Offset.AsInt);
break;
default:
throw new Exception(field.Name);
}
}
}
[Fact]
public void TestStaticSelfRef()
{
//
// Test that we can load a struct which has a static field referencing itself without
// going into an infinite loop
//
MetadataType t = _testModule.GetType("StaticFieldLayout", "StaticSelfRef");
foreach (var field in t.GetFields())
{
if (!field.IsStatic)
continue;
switch (field.Name)
{
case "selfRef1":
Assert.Equal(0, field.Offset.AsInt);
break;
default:
throw new Exception(field.Name);
}
}
}
[Fact]
public void TestRvaStatics()
{
//
// Test that an RVA mapped field has the right value for the offset.
//
var ilModule = _context.GetModuleForSimpleName("ILTestAssembly");
var t = ilModule.GetType("StaticFieldLayout", "RvaStatics");
var field = t.GetField("StaticInitedInt");
Assert.True(field.HasRva);
byte[] rvaData = ((EcmaField)field).GetFieldRvaData();
Assert.Equal(4, rvaData.Length);
int value = BinaryPrimitives.ReadInt32LittleEndian(rvaData);
Assert.Equal(0x78563412, value);
}
[Fact]
public void TestFunctionPointer()
{
//
// Test layout with a function pointer typed-field.
//
var ilModule = _context.GetModuleForSimpleName("ILTestAssembly");
var t = ilModule.GetType("StaticFieldLayout", "FunctionPointerType");
var field = t.GetField("StaticMethodField");
Assert.Equal(8, field.Offset.AsInt);
Assert.False(field.HasGCStaticBase);
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Buffers.Binary;
using System.Linq;
using Internal.TypeSystem;
using Internal.TypeSystem.Ecma;
using Xunit;
namespace TypeSystemTests
{
public class StaticFieldLayoutTests
{
TestTypeSystemContext _context;
ModuleDesc _testModule;
public StaticFieldLayoutTests()
{
_context = new TestTypeSystemContext(TargetArchitecture.X64);
var systemModule = _context.CreateModuleForSimpleName("CoreTestAssembly");
_context.SetSystemModule(systemModule);
_testModule = systemModule;
}
[Fact]
public void TestNoPointers()
{
MetadataType t = _testModule.GetType("StaticFieldLayout", "NoPointers");
foreach (var field in t.GetFields())
{
if (!field.IsStatic)
continue;
switch (field.Name)
{
case "int1":
Assert.Equal(0, field.Offset.AsInt);
break;
case "byte1":
Assert.Equal(4, field.Offset.AsInt);
break;
case "char1":
Assert.Equal(6, field.Offset.AsInt);
break;
default:
throw new Exception(field.Name);
}
}
}
[Fact]
public void TestStillNoPointers()
{
//
// Test that static offsets ignore instance fields preceeding them
//
MetadataType t = _testModule.GetType("StaticFieldLayout", "StillNoPointers");
foreach (var field in t.GetFields())
{
if (!field.IsStatic)
continue;
switch (field.Name)
{
case "bool1":
Assert.Equal(0, field.Offset.AsInt);
break;
default:
throw new Exception(field.Name);
}
}
}
[Fact]
public void TestClassNoPointers()
{
//
// Ensure classes behave the same as structs when containing statics
//
MetadataType t = _testModule.GetType("StaticFieldLayout", "ClassNoPointers");
foreach (var field in t.GetFields())
{
if (!field.IsStatic)
continue;
switch (field.Name)
{
case "int1":
Assert.Equal(0, field.Offset.AsInt);
break;
case "byte1":
Assert.Equal(4, field.Offset.AsInt);
break;
case "char1":
Assert.Equal(6, field.Offset.AsInt);
break;
default:
throw new Exception(field.Name);
}
}
}
[Fact]
public void TestHasPointers()
{
//
// Test a struct containing static types with pointers
//
MetadataType t = _testModule.GetType("StaticFieldLayout", "HasPointers");
foreach (var field in t.GetFields())
{
if (!field.IsStatic)
continue;
switch (field.Name)
{
case "string1":
Assert.Equal(8, field.Offset.AsInt);
break;
case "class1":
Assert.Equal(16, field.Offset.AsInt);
break;
default:
throw new Exception(field.Name);
}
}
}
[Fact]
public void TestMixPointersAndNonPointers()
{
//
// Test that static fields with GC pointers get separate offsets from non-GC fields
//
MetadataType t = _testModule.GetType("StaticFieldLayout", "MixPointersAndNonPointers");
foreach (var field in t.GetFields())
{
if (!field.IsStatic)
continue;
switch (field.Name)
{
case "string1":
Assert.Equal(8, field.Offset.AsInt);
break;
case "int1":
Assert.Equal(0, field.Offset.AsInt);
break;
case "class1":
Assert.Equal(16, field.Offset.AsInt);
break;
case "int2":
Assert.Equal(4, field.Offset.AsInt);
break;
case "string2":
Assert.Equal(24, field.Offset.AsInt);
break;
default:
throw new Exception(field.Name);
}
}
}
[Fact]
public void TestEnsureInheritanceResetsStaticOffsets()
{
//
// Test that when inheriting a class with static fields, the derived slice's static fields
// are again offset from 0
//
MetadataType t = _testModule.GetType("StaticFieldLayout", "EnsureInheritanceResetsStaticOffsets");
foreach (var field in t.GetFields())
{
if (!field.IsStatic)
continue;
switch (field.Name)
{
case "int3":
Assert.Equal(0, field.Offset.AsInt);
break;
case "string3":
Assert.Equal(8, field.Offset.AsInt);
break;
default:
throw new Exception(field.Name);
}
}
}
[Fact]
public void TestLiteralFieldsDontAffectLayout()
{
//
// Test that literal fields are not laid out.
//
MetadataType t = _testModule.GetType("StaticFieldLayout", "LiteralFieldsDontAffectLayout");
Assert.Equal(4, t.GetFields().Count());
foreach (var field in t.GetFields())
{
if (!field.IsStatic)
continue;
switch (field.Name)
{
case "IntConstant":
case "StringConstant":
Assert.True(field.IsStatic);
Assert.True(field.IsLiteral);
break;
case "Int1":
Assert.Equal(0, field.Offset.AsInt);
break;
case "String1":
Assert.Equal(8, field.Offset.AsInt);
break;
default:
throw new Exception(field.Name);
}
}
}
[Fact]
public void TestStaticSelfRef()
{
//
// Test that we can load a struct which has a static field referencing itself without
// going into an infinite loop
//
MetadataType t = _testModule.GetType("StaticFieldLayout", "StaticSelfRef");
foreach (var field in t.GetFields())
{
if (!field.IsStatic)
continue;
switch (field.Name)
{
case "selfRef1":
Assert.Equal(0, field.Offset.AsInt);
break;
default:
throw new Exception(field.Name);
}
}
}
[Fact]
public void TestRvaStatics()
{
//
// Test that an RVA mapped field has the right value for the offset.
//
var ilModule = _context.GetModuleForSimpleName("ILTestAssembly");
var t = ilModule.GetType("StaticFieldLayout", "RvaStatics");
var field = t.GetField("StaticInitedInt");
Assert.True(field.HasRva);
byte[] rvaData = ((EcmaField)field).GetFieldRvaData();
Assert.Equal(4, rvaData.Length);
int value = BinaryPrimitives.ReadInt32LittleEndian(rvaData);
Assert.Equal(0x78563412, value);
}
[Fact]
public void TestFunctionPointer()
{
//
// Test layout with a function pointer typed-field.
//
var ilModule = _context.GetModuleForSimpleName("ILTestAssembly");
var t = ilModule.GetType("StaticFieldLayout", "FunctionPointerType");
var field = t.GetField("StaticMethodField");
Assert.Equal(8, field.Offset.AsInt);
Assert.False(field.HasGCStaticBase);
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerProviderConfigurationFactoryTest.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Linq;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Memory;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Configuration;
using Microsoft.Extensions.Logging.Console;
using Xunit;
namespace Microsoft.Extensions.Logging.Test
{
public class LoggerProviderConfigurationFactoryTest
{
[Fact]
public void ChangeTokenFiresWhenSectionAdded()
{
var callbackCalled = false;
var source = new MemoryConfigurationSource();
var configuration = new ConfigurationBuilder().Add(source).Build();
var provider = (MemoryConfigurationProvider) configuration.Providers.Single();
var serviceCollection = new ServiceCollection();
serviceCollection.AddLogging(builder => builder.AddConfiguration(configuration));
var serviceProvider = serviceCollection.BuildServiceProvider();
var loggerProviderConfiguration = serviceProvider.GetService<ILoggerProviderConfiguration<ConsoleLoggerProvider>>();
loggerProviderConfiguration.Configuration.GetReloadToken().RegisterChangeCallback(o => callbackCalled = true, null);
provider.Add("Console:IncludeScopes", "false");
configuration.Reload();
Assert.True(callbackCalled);
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Linq;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Memory;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging.Configuration;
using Microsoft.Extensions.Logging.Console;
using Xunit;
namespace Microsoft.Extensions.Logging.Test
{
public class LoggerProviderConfigurationFactoryTest
{
[Fact]
public void ChangeTokenFiresWhenSectionAdded()
{
var callbackCalled = false;
var source = new MemoryConfigurationSource();
var configuration = new ConfigurationBuilder().Add(source).Build();
var provider = (MemoryConfigurationProvider) configuration.Providers.Single();
var serviceCollection = new ServiceCollection();
serviceCollection.AddLogging(builder => builder.AddConfiguration(configuration));
var serviceProvider = serviceCollection.BuildServiceProvider();
var loggerProviderConfiguration = serviceProvider.GetService<ILoggerProviderConfiguration<ConsoleLoggerProvider>>();
loggerProviderConfiguration.Configuration.GetReloadToken().RegisterChangeCallback(o => callbackCalled = true, null);
provider.Add("Console:IncludeScopes", "false");
configuration.Reload();
Assert.True(callbackCalled);
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/tests/JIT/HardwareIntrinsics/General/Vector64_1/ToVector128.Byte.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
namespace JIT.HardwareIntrinsics.General
{
public static partial class Program
{
private static void ToVector128Byte()
{
var test = new VectorExtend__ToVector128Byte();
// Validates basic functionality works
test.RunBasicScenario();
// Validates calling via reflection works
test.RunReflectionScenario();
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class VectorExtend__ToVector128Byte
{
private static readonly int LargestVectorSize = 8;
private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte);
public bool Succeeded { get; set; } = true;
public void RunBasicScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
Byte[] values = new Byte[ElementCount];
for (int i = 0; i < ElementCount; i++)
{
values[i] = TestLibrary.Generator.GetByte();
}
Vector64<Byte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
Vector128<Byte> result = value.ToVector128();
ValidateResult(result, values, isUnsafe: false);
Vector128<Byte> unsafeResult = value.ToVector128Unsafe();
ValidateResult(unsafeResult, values, isUnsafe: true);
}
public void RunReflectionScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
Byte[] values = new Byte[ElementCount];
for (int i = 0; i < ElementCount; i++)
{
values[i] = TestLibrary.Generator.GetByte();
}
Vector64<Byte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
object result = typeof(Vector64)
.GetMethod(nameof(Vector64.ToVector128))
.MakeGenericMethod(typeof(Byte))
.Invoke(null, new object[] { value });
ValidateResult((Vector128<Byte>)(result), values, isUnsafe: false);
object unsafeResult = typeof(Vector64)
.GetMethod(nameof(Vector64.ToVector128))
.MakeGenericMethod(typeof(Byte))
.Invoke(null, new object[] { value });
ValidateResult((Vector128<Byte>)(unsafeResult), values, isUnsafe: true);
}
private void ValidateResult(Vector128<Byte> result, Byte[] values, bool isUnsafe, [CallerMemberName] string method = "")
{
Byte[] resultElements = new Byte[ElementCount * 2];
Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
ValidateResult(resultElements, values, isUnsafe, method);
}
private void ValidateResult(Byte[] result, Byte[] values, bool isUnsafe, [CallerMemberName] string method = "")
{
bool succeeded = true;
for (int i = 0; i < ElementCount; i++)
{
if (result[i] != values[i])
{
succeeded = false;
break;
}
}
if (!isUnsafe)
{
for (int i = ElementCount; i < ElementCount * 2; i++)
{
if (result[i] != 0)
{
succeeded = false;
break;
}
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"Vector64<Byte>.ToVector128{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics\General\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
namespace JIT.HardwareIntrinsics.General
{
public static partial class Program
{
private static void ToVector128Byte()
{
var test = new VectorExtend__ToVector128Byte();
// Validates basic functionality works
test.RunBasicScenario();
// Validates calling via reflection works
test.RunReflectionScenario();
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class VectorExtend__ToVector128Byte
{
private static readonly int LargestVectorSize = 8;
private static readonly int ElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte);
public bool Succeeded { get; set; } = true;
public void RunBasicScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario));
Byte[] values = new Byte[ElementCount];
for (int i = 0; i < ElementCount; i++)
{
values[i] = TestLibrary.Generator.GetByte();
}
Vector64<Byte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
Vector128<Byte> result = value.ToVector128();
ValidateResult(result, values, isUnsafe: false);
Vector128<Byte> unsafeResult = value.ToVector128Unsafe();
ValidateResult(unsafeResult, values, isUnsafe: true);
}
public void RunReflectionScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario));
Byte[] values = new Byte[ElementCount];
for (int i = 0; i < ElementCount; i++)
{
values[i] = TestLibrary.Generator.GetByte();
}
Vector64<Byte> value = Vector64.Create(values[0], values[1], values[2], values[3], values[4], values[5], values[6], values[7]);
object result = typeof(Vector64)
.GetMethod(nameof(Vector64.ToVector128))
.MakeGenericMethod(typeof(Byte))
.Invoke(null, new object[] { value });
ValidateResult((Vector128<Byte>)(result), values, isUnsafe: false);
object unsafeResult = typeof(Vector64)
.GetMethod(nameof(Vector64.ToVector128))
.MakeGenericMethod(typeof(Byte))
.Invoke(null, new object[] { value });
ValidateResult((Vector128<Byte>)(unsafeResult), values, isUnsafe: true);
}
private void ValidateResult(Vector128<Byte> result, Byte[] values, bool isUnsafe, [CallerMemberName] string method = "")
{
Byte[] resultElements = new Byte[ElementCount * 2];
Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result);
ValidateResult(resultElements, values, isUnsafe, method);
}
private void ValidateResult(Byte[] result, Byte[] values, bool isUnsafe, [CallerMemberName] string method = "")
{
bool succeeded = true;
for (int i = 0; i < ElementCount; i++)
{
if (result[i] != values[i])
{
succeeded = false;
break;
}
}
if (!isUnsafe)
{
for (int i = ElementCount; i < ElementCount * 2; i++)
{
if (result[i] != 0)
{
succeeded = false;
break;
}
}
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"Vector64<Byte>.ToVector128{(isUnsafe ? "Unsafe" : "")}(): {method} failed:");
TestLibrary.TestFramework.LogInformation($" value: ({string.Join(", ", values)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/tests/JIT/Regression/CLR-x86-JIT/V2.0-Beta2/b320147/1086745236.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
using System;
using System.Collections;
using System.Runtime.InteropServices;
public struct AA
{
public void Method1()
{
bool local1 = true;
for (; local1; )
{
if (local1)
break;
}
do
{
if (local1)
break;
}
while (local1);
return;
}
}
[StructLayout(LayoutKind.Sequential)]
public class App
{
static int Main()
{
try
{
Console.WriteLine("Testing AA::Method1");
new AA().Method1();
}
catch (Exception x)
{
Console.WriteLine("Exception handled: " + x.ToString());
}
// JIT Stress test... if jitted it passes
Console.WriteLine("Passed.");
return 100;
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//
using System;
using System.Collections;
using System.Runtime.InteropServices;
public struct AA
{
public void Method1()
{
bool local1 = true;
for (; local1; )
{
if (local1)
break;
}
do
{
if (local1)
break;
}
while (local1);
return;
}
}
[StructLayout(LayoutKind.Sequential)]
public class App
{
static int Main()
{
try
{
Console.WriteLine("Testing AA::Method1");
new AA().Method1();
}
catch (Exception x)
{
Console.WriteLine("Exception handled: " + x.ToString());
}
// JIT Stress test... if jitted it passes
Console.WriteLine("Passed.");
return 100;
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/TestData.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Text;
using Test.Cryptography;
namespace System.Security.Cryptography.Rsa.Tests
{
// Note to contributors:
// Keys contained in this file should be randomly generated for the purpose of inclusion here,
// or obtained from some fixed set of test data. (Please) DO NOT use any key that has ever been
// used for any real purpose.
//
// Note to readers:
// The keys contained in this file should all be treated as compromised. That means that you
// absolutely SHOULD NOT use these keys on anything that you actually want to be protected.
internal class TestData
{
public static readonly byte[] HelloBytes = new ASCIIEncoding().GetBytes("Hello");
public static readonly RSAParameters RSA384Parameters = new RSAParameters
{
Modulus = new byte[]
{
0xDA, 0xCC, 0x22, 0xD8, 0x6E, 0x67, 0x15, 0x75,
0x03, 0x2E, 0x31, 0xF2, 0x06, 0xDC, 0xFC, 0x19,
0x2C, 0x65, 0xE2, 0xD5, 0x10, 0x89, 0xE5, 0x11,
0x2D, 0x09, 0x6F, 0x28, 0x82, 0xAF, 0xDB, 0x5B,
0x78, 0xCD, 0xB6, 0x57, 0x2F, 0xD2, 0xF6, 0x1D,
0xB3, 0x90, 0x47, 0x22, 0x32, 0xE3, 0xD9, 0xF5,
},
Exponent = new byte[]
{
0x01, 0x00, 0x01,
},
D = new byte[]
{
0x7A, 0x59, 0xBD, 0x02, 0x9A, 0x7A, 0x3A, 0x9D,
0x7C, 0x71, 0xD0, 0xAC, 0x2E, 0xFA, 0x54, 0x5F,
0x1F, 0x5C, 0xBA, 0x43, 0xBB, 0x43, 0xE1, 0x3B,
0x78, 0x77, 0xAF, 0x82, 0xEF, 0xEB, 0x40, 0xC3,
0x8D, 0x1E, 0xCD, 0x73, 0x7F, 0x5B, 0xF9, 0xC8,
0x96, 0x92, 0xB2, 0x9C, 0x87, 0x5E, 0xD6, 0xE1,
},
P = new byte[]
{
0xFA, 0xDB, 0xD7, 0xF8, 0xA1, 0x8B, 0x3A, 0x75,
0xA4, 0xF6, 0xDF, 0xAE, 0xE3, 0x42, 0x6F, 0xD0,
0xFF, 0x8B, 0xAC, 0x74, 0xB6, 0x72, 0x2D, 0xEF,
},
DP = new byte[]
{
0x24, 0xFF, 0xBB, 0xD0, 0xDD, 0xF2, 0xAD, 0x02,
0xA0, 0xFC, 0x10, 0x6D, 0xB8, 0xF3, 0x19, 0x8E,
0xD7, 0xC2, 0x00, 0x03, 0x8E, 0xCD, 0x34, 0x5D,
},
Q = new byte[]
{
0xDF, 0x48, 0x14, 0x4A, 0x6D, 0x88, 0xA7, 0x80,
0x14, 0x4F, 0xCE, 0xA6, 0x6B, 0xDC, 0xDA, 0x50,
0xD6, 0x07, 0x1C, 0x54, 0xE5, 0xD0, 0xDA, 0x5B,
},
DQ = new byte[]
{
0x85, 0xDF, 0x73, 0xBB, 0x04, 0x5D, 0x91, 0x00,
0x6C, 0x2D, 0x45, 0x9B, 0xE6, 0xC4, 0x2E, 0x69,
0x95, 0x4A, 0x02, 0x24, 0xAC, 0xFE, 0x42, 0x4D,
},
InverseQ = new byte[]
{
0x1A, 0x3A, 0x76, 0x9C, 0x21, 0x26, 0x2B, 0x84,
0xCA, 0x9C, 0xA9, 0x62, 0x0F, 0x98, 0xD2, 0xF4,
0x3E, 0xAC, 0xCC, 0xD4, 0x87, 0x9A, 0x6F, 0xFD,
},
};
public static readonly RSAParameters RSA1024Params = new RSAParameters
{
Modulus = new byte[]
{
0x9F, 0x05, 0x1F, 0xCE, 0x71, 0xCA, 0x2E, 0x17,
0x0F, 0x43, 0xC6, 0x04, 0x4A, 0x6F, 0xB7, 0x84,
0xD8, 0xAD, 0x62, 0x5B, 0xDB, 0x87, 0x4B, 0x05,
0xAD, 0x03, 0x76, 0x19, 0x63, 0xEE, 0x2A, 0x9D,
0xCC, 0x7D, 0xAF, 0x3A, 0x51, 0x23, 0xAE, 0x7F,
0x19, 0xA6, 0x63, 0xBF, 0x65, 0x6B, 0x5E, 0x37,
0x1C, 0x6A, 0x0A, 0xA7, 0xF0, 0x82, 0xB1, 0xBD,
0xC3, 0x21, 0x50, 0x21, 0x23, 0xEF, 0x40, 0x30,
0x93, 0x11, 0x11, 0x5C, 0xF7, 0x5B, 0x42, 0x72,
0x18, 0xDE, 0xFE, 0x1B, 0xF6, 0x0E, 0x02, 0xBF,
0x28, 0x56, 0xFB, 0x7C, 0xB5, 0xF1, 0x88, 0xCD,
0x66, 0x8F, 0xC1, 0xCA, 0xBA, 0xF9, 0x83, 0x7E,
0x09, 0x5B, 0xD2, 0x91, 0xB9, 0x16, 0x5C, 0x2B,
0x0C, 0x8E, 0x91, 0xBB, 0xC3, 0x84, 0x0D, 0x73,
0xEE, 0xA2, 0x30, 0x82, 0x2F, 0x3C, 0x90, 0x50,
0x88, 0xA7, 0x92, 0x96, 0x99, 0x0C, 0x68, 0xBD,
},
Exponent = new byte[]
{
0x01, 0x00, 0x01,
},
D = new byte[]
{
0x4A, 0xE6, 0xF9, 0x7F, 0xDE, 0xE6, 0x5A, 0x46,
0x5F, 0x58, 0xCF, 0x8D, 0x56, 0xD8, 0x7F, 0x6B,
0x72, 0x3A, 0x5D, 0x21, 0xA2, 0x6A, 0x7C, 0x42,
0x7C, 0xA7, 0xAC, 0x39, 0xB2, 0x71, 0xCD, 0x1E,
0x0D, 0xE3, 0xC7, 0xA5, 0x62, 0xF1, 0xB9, 0x30,
0x42, 0x0F, 0x37, 0x5D, 0xC0, 0x72, 0x4D, 0xEB,
0x0C, 0x95, 0xC0, 0x56, 0x31, 0x7A, 0x06, 0x29,
0xB9, 0x9F, 0x57, 0xE4, 0x7C, 0x4E, 0x25, 0xFF,
0xDD, 0x11, 0x0E, 0xD9, 0xE8, 0xC0, 0x4F, 0x98,
0xC6, 0x13, 0xD7, 0x24, 0x7E, 0x3C, 0x3E, 0xB4,
0xC7, 0x85, 0x8F, 0xD5, 0x94, 0x0B, 0x12, 0x54,
0xF8, 0xA0, 0x0B, 0x61, 0x6F, 0xDD, 0xE8, 0x9B,
0x91, 0x9D, 0x2A, 0x6F, 0x15, 0x99, 0x8C, 0x91,
0xB9, 0x3D, 0xEF, 0x65, 0xC7, 0x78, 0xA6, 0x57,
0x52, 0xC4, 0x17, 0x5B, 0xFC, 0xA8, 0x65, 0x4E,
0x1E, 0x95, 0x82, 0x6B, 0x15, 0x49, 0x6C, 0x6B,
},
P = new byte[]
{
0xD2, 0x4B, 0x09, 0x03, 0x92, 0x29, 0x95, 0xE7,
0x65, 0x94, 0x19, 0x4F, 0x20, 0xD2, 0xB7, 0xF6,
0xB9, 0xB0, 0x78, 0x1F, 0xB7, 0xC2, 0xDD, 0xB4,
0x68, 0xB5, 0xFD, 0x7D, 0xD1, 0x92, 0xBA, 0xA8,
0x50, 0x1E, 0xDC, 0x44, 0x79, 0xBF, 0x21, 0x2F,
0xC2, 0xB5, 0xA0, 0x08, 0x0E, 0xCE, 0x80, 0x0C,
0x37, 0xF6, 0x60, 0xEA, 0xBB, 0x57, 0x7E, 0xA5,
0x74, 0x82, 0x8A, 0x9F, 0xA7, 0x5B, 0x42, 0x03,
},
DP = new byte[]
{
0x77, 0xCD, 0x77, 0x9D, 0x29, 0x2F, 0xB7, 0xCE,
0xD3, 0xF7, 0xC3, 0x53, 0x69, 0x07, 0xA2, 0xF6,
0x54, 0x63, 0x4C, 0x8C, 0x05, 0x4C, 0x66, 0xB1,
0xD8, 0xD5, 0x95, 0x4C, 0x90, 0x90, 0x5E, 0xF6,
0x74, 0x6E, 0xA0, 0x5E, 0x02, 0x5D, 0xF8, 0xB2,
0x14, 0xE3, 0x14, 0x00, 0x83, 0x2E, 0xF1, 0x94,
0x04, 0x6D, 0xC0, 0x58, 0xF9, 0xD1, 0xA6, 0xBC,
0xEB, 0xDB, 0x52, 0xCE, 0x11, 0xB1, 0xD3, 0xB1,
},
Q = new byte[]
{
0xC1, 0x95, 0x31, 0x1A, 0xF4, 0xE5, 0xA4, 0x1F,
0xAC, 0x86, 0x48, 0x35, 0x9B, 0x7E, 0x72, 0xF9,
0x82, 0x17, 0x2A, 0x86, 0x0A, 0x3D, 0x31, 0xCC,
0xD1, 0x1C, 0x23, 0xBB, 0x64, 0x90, 0xDF, 0x1F,
0x56, 0xA7, 0x48, 0x24, 0x9E, 0xAF, 0x18, 0xE3,
0x0C, 0xB6, 0xE6, 0x7B, 0xE4, 0x1F, 0xF7, 0x19,
0x6D, 0x4E, 0xDB, 0xA9, 0x50, 0xCD, 0xD6, 0x28,
0x62, 0xEF, 0x65, 0x72, 0x48, 0xA9, 0x0E, 0x3F,
},
DQ = new byte[]
{
0xAE, 0x52, 0x33, 0x0E, 0x1B, 0x4A, 0x50, 0x29,
0x55, 0xAA, 0xF6, 0x8B, 0x8F, 0xA2, 0xA6, 0xD6,
0x98, 0x97, 0x53, 0xEB, 0xB0, 0x7C, 0xBA, 0xC3,
0xBD, 0xEA, 0xA1, 0x22, 0xB6, 0xC4, 0xDE, 0xA7,
0xD1, 0xD8, 0x81, 0xD6, 0xB8, 0x2E, 0xE5, 0x32,
0x50, 0xD8, 0xC3, 0x64, 0xFD, 0x60, 0xEB, 0x9B,
0x32, 0x1B, 0xB9, 0x23, 0x17, 0x68, 0xC4, 0x59,
0x49, 0xFE, 0x5A, 0x54, 0x37, 0xAA, 0x44, 0xF1,
},
InverseQ = new byte[]
{
0x2A, 0x39, 0xAF, 0xE2, 0x76, 0x06, 0x48, 0x8F,
0x49, 0x93, 0xDF, 0x01, 0xCD, 0x7B, 0xB2, 0xC6,
0x68, 0x15, 0xAF, 0x0E, 0xC9, 0xF1, 0xE0, 0x15,
0x3D, 0xA9, 0x68, 0x27, 0xD6, 0x64, 0x1E, 0x08,
0xDC, 0x01, 0x3B, 0x38, 0x32, 0x62, 0x4F, 0xCD,
0x0C, 0x09, 0xF7, 0x9A, 0x6B, 0xCA, 0x0F, 0x76,
0xC2, 0xFB, 0xDD, 0x7C, 0x5D, 0xF1, 0x85, 0x16,
0x67, 0x9F, 0x98, 0xA7, 0xF3, 0x40, 0x7D, 0x1C,
},
};
public static readonly RSAParameters RSA1032Parameters = new RSAParameters
{
Modulus = new byte[]
{
0xBC, 0xAC, 0xB1, 0xA5, 0x34, 0x9D, 0x7B, 0x35,
0xA5, 0x80, 0xAC, 0x3B, 0x39, 0x98, 0xEB, 0x15,
0xEB, 0xF9, 0x00, 0xEC, 0xB3, 0x29, 0xBF, 0x1F,
0x75, 0x71, 0x7A, 0x00, 0xB2, 0x19, 0x9C, 0x8A,
0x18, 0xD7, 0x91, 0xB5, 0x92, 0xB7, 0xEC, 0x52,
0xBD, 0x5A, 0xF2, 0xDB, 0x0D, 0x3B, 0x63, 0x5F,
0x05, 0x95, 0x75, 0x3D, 0xFF, 0x7B, 0xA7, 0xC9,
0x87, 0x2D, 0xBF, 0x7E, 0x32, 0x26, 0xDE, 0xF4,
0x4A, 0x07, 0xCA, 0x56, 0x8D, 0x10, 0x17, 0x99,
0x2C, 0x2B, 0x41, 0xBF, 0xE5, 0xEC, 0x35, 0x70,
0x82, 0x4C, 0xF1, 0xF4, 0xB1, 0x59, 0x19, 0xFE,
0xD5, 0x13, 0xFD, 0xA5, 0x62, 0x04, 0xAF, 0x20,
0x34, 0xA2, 0xD0, 0x8F, 0xF0, 0x4C, 0x2C, 0xCA,
0x49, 0xD1, 0x68, 0xFA, 0x03, 0xFA, 0x2F, 0xA3,
0x2F, 0xCC, 0xD3, 0x48, 0x4C, 0x15, 0xF0, 0xA2,
0xE5, 0x46, 0x7C, 0x76, 0xFC, 0x76, 0x0B, 0x55,
0x09,
},
Exponent = new byte[]
{
0x01, 0x00, 0x01,
},
D = new byte[]
{
0x9E, 0x59, 0x25, 0xE2, 0xEC, 0x6C, 0xBB, 0x4A,
0x83, 0xF3, 0xA1, 0x19, 0x37, 0xB6, 0xE2, 0x9E,
0x8C, 0x64, 0x78, 0x65, 0x2F, 0xDC, 0xFA, 0x9D,
0xD1, 0x78, 0x82, 0x97, 0x70, 0xE2, 0x53, 0xE2,
0x07, 0x05, 0x6D, 0x32, 0x01, 0xC8, 0x41, 0x1C,
0x13, 0xF5, 0xEF, 0xDA, 0xEE, 0x99, 0x08, 0x46,
0x68, 0xAE, 0x4E, 0x2E, 0xD1, 0x6C, 0x1B, 0x9E,
0xE4, 0xC7, 0xFD, 0x6E, 0x51, 0x73, 0x14, 0x2D,
0xC5, 0x9F, 0xC6, 0x45, 0xA4, 0xC2, 0xE6, 0x65,
0x5D, 0xAC, 0xE6, 0x71, 0xB3, 0x00, 0xDE, 0x0D,
0x7B, 0xB5, 0x2D, 0x68, 0xA8, 0x60, 0x26, 0xC1,
0x8F, 0x02, 0x47, 0x26, 0xE7, 0x71, 0xBD, 0x04,
0x81, 0x99, 0x44, 0x2F, 0x03, 0x42, 0x70, 0x96,
0x58, 0xEF, 0xF6, 0x4A, 0xE4, 0x2E, 0xA4, 0x17,
0x32, 0x47, 0xEC, 0xD2, 0x4A, 0x86, 0x29, 0x9E,
0x8B, 0x9D, 0x11, 0x52, 0x00, 0x02, 0xC8, 0xF5,
0xF1,
},
P = new byte[]
{
0x0E, 0x15, 0x30, 0x0A, 0x9D, 0x34, 0xBA, 0x37,
0xB6, 0xBD, 0xA8, 0x31, 0xBC, 0x67, 0x27, 0xB2,
0xF7, 0xF6, 0xD0, 0xEF, 0xB7, 0xB3, 0x3A, 0x99,
0xC9, 0xAF, 0x28, 0xCF, 0xD6, 0x25, 0xE2, 0x45,
0xA5, 0x4F, 0x25, 0x1B, 0x78, 0x4C, 0x47, 0x91,
0xAD, 0xA5, 0x85, 0xAD, 0xB7, 0x11, 0xD9, 0x30,
0x0A, 0x3D, 0x52, 0xB4, 0x50, 0xCC, 0x30, 0x7F,
0x55, 0xD3, 0x1E, 0x12, 0x17, 0xB9, 0xFF, 0xD7,
0x45,
},
DP = new byte[]
{
0x0D, 0x9D, 0xB4, 0xBE, 0x7E, 0x73, 0x0D, 0x9D,
0x72, 0xA5, 0x7B, 0x2A, 0xE3, 0x73, 0x85, 0x71,
0xC7, 0xC8, 0x2F, 0x09, 0xA7, 0xBE, 0xB5, 0xE9,
0x1D, 0x94, 0xAA, 0xCC, 0x10, 0xCC, 0xBE, 0x33,
0x02, 0x7B, 0x3C, 0x70, 0x8B, 0xE6, 0x8C, 0xC8,
0x30, 0x71, 0xBA, 0x87, 0x54, 0x5B, 0x00, 0x78,
0x2F, 0x5E, 0x4D, 0x49, 0xA4, 0x59, 0x58, 0x86,
0xB5, 0x6F, 0x93, 0x42, 0x81, 0x08, 0x48, 0x72,
0x55,
},
Q = new byte[]
{
0x0D, 0x65, 0xC6, 0x0D, 0xE8, 0xB6, 0xF5, 0x4A,
0x77, 0x56, 0xFD, 0x1C, 0xCB, 0xA7, 0x6C, 0xE4,
0x1E, 0xF4, 0x46, 0xD0, 0x24, 0x03, 0x1E, 0xE9,
0xC5, 0xA4, 0x09, 0x31, 0xB0, 0x73, 0x36, 0xCF,
0xED, 0x35, 0xA8, 0xEE, 0x58, 0x0E, 0x19, 0xDB,
0x85, 0x92, 0xCB, 0x0F, 0x26, 0x6E, 0xC6, 0x90,
0x28, 0xEB, 0x9E, 0x98, 0xE3, 0xE8, 0x4F, 0xF1,
0xA4, 0x59, 0xA8, 0xA2, 0x68, 0x60, 0xA6, 0x10,
0xF5,
},
DQ = new byte[]
{
0x0C, 0xF6, 0xFB, 0xDD, 0xE1, 0xE1, 0x8B, 0x25,
0x70, 0xAF, 0x21, 0x69, 0x88, 0x3A, 0x90, 0xC9,
0x80, 0x9A, 0xEB, 0x1B, 0xE8, 0x7D, 0x8C, 0xA0,
0xB4, 0xBD, 0xB4, 0x97, 0xFD, 0x24, 0xC1, 0x5A,
0x1D, 0x36, 0xDC, 0x2F, 0x29, 0xCF, 0x1B, 0x7E,
0xAF, 0x98, 0x0A, 0x20, 0xB3, 0x14, 0x67, 0xDA,
0x81, 0x7E, 0xE1, 0x8F, 0x1A, 0x9D, 0x69, 0x1F,
0x71, 0xE7, 0xC1, 0xA4, 0xC8, 0x55, 0x1E, 0xDF,
0x31,
},
InverseQ = new byte[]
{
0x01, 0x0C, 0xE9, 0x93, 0x6E, 0x96, 0xFB, 0xAD,
0xF8, 0x72, 0x40, 0xCC, 0x41, 0x9D, 0x01, 0x08,
0x1B, 0xB6, 0x7C, 0x98, 0x1D, 0x44, 0x31, 0x4E,
0x58, 0x58, 0x3A, 0xC7, 0xFE, 0x93, 0x79, 0xEA,
0x02, 0x72, 0xE6, 0xC4, 0xC7, 0xC1, 0x46, 0x38,
0xE1, 0xD5, 0xEC, 0xE7, 0x84, 0x0D, 0xDB, 0x15,
0xA1, 0x2D, 0x70, 0x54, 0xA4, 0x18, 0xF8, 0x76,
0x4F, 0xA5, 0x4C, 0xE1, 0x34, 0xEB, 0xD2, 0x63,
0x5E,
},
};
public static readonly RSAParameters RSA2048Params = new RSAParameters
{
Modulus = new byte[]
{
0xB1, 0x7C, 0xEE, 0x77, 0xB4, 0x59, 0xA4, 0x65,
0x92, 0x8D, 0x7F, 0x55, 0x77, 0x80, 0x39, 0xBA,
0x22, 0xBA, 0x29, 0xA5, 0xFF, 0xE5, 0x53, 0xFB,
0x40, 0x98, 0xA8, 0x35, 0xE5, 0x2D, 0x0A, 0xDC,
0x85, 0x17, 0x6E, 0xE4, 0xD6, 0x93, 0x82, 0x20,
0x71, 0x8D, 0xE9, 0xDD, 0xC9, 0xD5, 0xBD, 0x30,
0x47, 0xEE, 0x59, 0xB9, 0xE6, 0xA8, 0x79, 0x9E,
0x47, 0x96, 0x8E, 0x63, 0xCD, 0xA6, 0x28, 0x9D,
0x7B, 0x6D, 0x83, 0xAA, 0x68, 0xE2, 0x46, 0xD6,
0x1C, 0x8C, 0x2B, 0xA1, 0xC4, 0x04, 0x12, 0xAE,
0x61, 0x07, 0xAF, 0x6F, 0xE9, 0x2B, 0x48, 0x5C,
0xCA, 0xC2, 0x0E, 0x52, 0x71, 0x21, 0x03, 0xE0,
0x05, 0x1C, 0x07, 0xC0, 0x56, 0xFD, 0x8A, 0x61,
0x7A, 0x95, 0x39, 0x4B, 0xAA, 0x5A, 0x9D, 0x03,
0x6D, 0x7A, 0x51, 0x3E, 0x7A, 0xE4, 0xAB, 0xED,
0xB4, 0x0A, 0x88, 0x80, 0x3C, 0x07, 0xED, 0x19,
0x21, 0xA2, 0xDC, 0xD7, 0x9C, 0x3F, 0x3B, 0x19,
0x59, 0x33, 0x39, 0x8A, 0x25, 0xDB, 0xCE, 0x8D,
0x8E, 0x10, 0xDA, 0xB1, 0x38, 0x32, 0xCA, 0x59,
0xA1, 0x69, 0x3C, 0x23, 0x76, 0x50, 0x37, 0xB3,
0xBF, 0x73, 0x58, 0x77, 0x38, 0xC5, 0x16, 0x03,
0x60, 0x36, 0x0D, 0x31, 0x8C, 0xBE, 0xA5, 0x12,
0x2F, 0xE5, 0x16, 0xAD, 0x1C, 0x80, 0x01, 0x50,
0xEB, 0x3C, 0x86, 0x79, 0x22, 0xD3, 0x7F, 0xD4,
0x90, 0x85, 0xB8, 0xEB, 0xB0, 0x7D, 0xD8, 0xC8,
0x8B, 0xBB, 0x88, 0xBE, 0xFE, 0xB8, 0xBA, 0xAD,
0x61, 0xC7, 0xF9, 0x68, 0x20, 0xB2, 0xA9, 0x1D,
0xB4, 0xDC, 0xB0, 0x5B, 0xC7, 0xB3, 0xF2, 0x83,
0x35, 0x43, 0xB0, 0xAE, 0x19, 0x2B, 0xA6, 0xFA,
0x88, 0x48, 0xB9, 0xFB, 0xB3, 0xCD, 0xF8, 0xA9,
0x9C, 0x20, 0x6F, 0x63, 0x23, 0xE5, 0xC2, 0x85,
0xCD, 0x75, 0x7A, 0x55, 0x04, 0xA4, 0x08, 0x99,
},
Exponent = new byte[]
{
0x01, 0x00, 0x01,
},
D = new byte[]
{
0x2C, 0x96, 0x86, 0x11, 0xEC, 0x6C, 0xD8, 0xAF,
0xEB, 0xB1, 0x40, 0x5B, 0xE8, 0x39, 0x7E, 0x47,
0x14, 0x92, 0x50, 0x04, 0x33, 0xD5, 0x18, 0xD3,
0xF5, 0xD6, 0x63, 0xEB, 0xA6, 0x37, 0x3A, 0x93,
0x4B, 0x9C, 0x27, 0x6F, 0xB5, 0xB8, 0x38, 0xE8,
0x8D, 0x9E, 0x69, 0x32, 0x1E, 0x92, 0x63, 0x84,
0xCD, 0x8D, 0x43, 0x5D, 0x40, 0x64, 0xF2, 0xA8,
0xA0, 0xB3, 0x61, 0xF2, 0x10, 0xA7, 0xBD, 0x6C,
0x52, 0xA5, 0xA0, 0x7E, 0x1E, 0xFB, 0x39, 0x70,
0x70, 0x9B, 0x86, 0x1A, 0x8D, 0x73, 0xB8, 0x7D,
0xB6, 0x42, 0x88, 0x00, 0x45, 0x43, 0x6A, 0x5A,
0x65, 0x55, 0x7A, 0xE3, 0x9B, 0x28, 0x00, 0x21,
0x37, 0x27, 0x63, 0x8B, 0x1E, 0x4F, 0x73, 0x84,
0x29, 0x97, 0x73, 0x5D, 0x5E, 0xDE, 0x84, 0xB3,
0x67, 0xBD, 0x62, 0xCB, 0x9F, 0x73, 0xF2, 0xFD,
0x34, 0x4D, 0xB1, 0x1D, 0x05, 0xF7, 0xB7, 0xC8,
0x3C, 0x69, 0xF6, 0x2C, 0x5B, 0x78, 0xC6, 0xB0,
0x55, 0xBF, 0x8B, 0x58, 0xF1, 0xC2, 0x9F, 0x19,
0x4A, 0x17, 0x53, 0x60, 0xDA, 0x52, 0x6F, 0x2E,
0xDE, 0x0F, 0x64, 0x9D, 0x4F, 0xB8, 0xAF, 0x50,
0x2B, 0x8F, 0x99, 0x1E, 0x15, 0x78, 0x32, 0xD7,
0x37, 0x06, 0xC3, 0x08, 0x5D, 0x1C, 0x04, 0xB1,
0x6D, 0x46, 0x84, 0xC9, 0xE8, 0xF6, 0x0E, 0x8E,
0x18, 0xEC, 0x4B, 0x84, 0xC5, 0xF3, 0x65, 0x6B,
0x9B, 0x35, 0x0A, 0xDA, 0x7B, 0xC7, 0xAB, 0x6D,
0x58, 0xFA, 0x17, 0x76, 0xC2, 0x67, 0xF1, 0xBA,
0x9B, 0xDD, 0x1F, 0xB4, 0x8A, 0x56, 0x06, 0x67,
0x36, 0x39, 0xE9, 0x1E, 0x82, 0x8A, 0xAA, 0x28,
0x7A, 0xA7, 0xDA, 0x18, 0x01, 0xD5, 0x1C, 0x19,
0x0C, 0x50, 0xAB, 0x09, 0x35, 0xAF, 0xCE, 0x26,
0x00, 0xD4, 0xD0, 0x61, 0xCC, 0x2A, 0x0E, 0x3F,
0xCA, 0xC3, 0xDB, 0x42, 0x16, 0x9B, 0xFF, 0x41,
},
P = new byte[]
{
0xBA, 0x61, 0xFD, 0x65, 0x6D, 0x86, 0xBA, 0xDD,
0x77, 0xB7, 0x11, 0x9E, 0xC8, 0xC9, 0x7D, 0xB8,
0x6A, 0x23, 0x03, 0x3D, 0xE8, 0xC9, 0xB7, 0xD6,
0xDE, 0xF8, 0x15, 0x7C, 0xF7, 0x0B, 0xB1, 0x1D,
0xC8, 0x83, 0xEC, 0x76, 0x57, 0x9F, 0x7F, 0x47,
0x5E, 0xD5, 0x57, 0x34, 0xD9, 0x16, 0xBD, 0xDC,
0xDD, 0xA0, 0xB2, 0xE0, 0x18, 0xD1, 0x70, 0x65,
0x4E, 0x2B, 0x75, 0x15, 0x77, 0xC4, 0x06, 0x3E,
0x80, 0x3E, 0xC2, 0xB6, 0xA7, 0x40, 0x4A, 0x53,
0x61, 0x30, 0x35, 0x46, 0x9F, 0xD4, 0xFC, 0x7D,
0x80, 0xC9, 0x0E, 0xE1, 0x94, 0x9B, 0xC7, 0xFA,
0xBD, 0x46, 0x9B, 0x4C, 0x12, 0x90, 0x7D, 0x9B,
0xF5, 0xE6, 0x82, 0x46, 0xB9, 0xA6, 0xA9, 0xF6,
0x35, 0xBC, 0x07, 0x9E, 0xC4, 0x78, 0x74, 0x6E,
0x44, 0xAC, 0xBF, 0x5C, 0x59, 0x33, 0xDA, 0x59,
0xDE, 0x9B, 0xED, 0x3D, 0x39, 0x1B, 0x36, 0x23,
},
DP = new byte[]
{
0x75, 0xD7, 0x56, 0xBB, 0x36, 0x50, 0xA4, 0xFD,
0x39, 0x9F, 0xC9, 0xC8, 0x36, 0xF3, 0x0E, 0x45,
0xF6, 0xF5, 0x44, 0x2B, 0x74, 0x6F, 0x75, 0x88,
0xA9, 0x58, 0xF9, 0x5D, 0x15, 0x65, 0x93, 0x0A,
0x5D, 0xA8, 0xEB, 0x6C, 0xB7, 0x61, 0xE4, 0xBB,
0x5F, 0x3E, 0x4B, 0xF0, 0xE2, 0x00, 0xFA, 0xF2,
0x16, 0x3E, 0x70, 0x5A, 0x37, 0xD6, 0xD3, 0xD5,
0x79, 0x63, 0x08, 0x98, 0x16, 0x2D, 0x1E, 0x35,
0x8E, 0x28, 0x20, 0x3C, 0x13, 0xEB, 0x16, 0x13,
0x39, 0xB3, 0x9D, 0x3B, 0x95, 0xFA, 0xB7, 0xD9,
0x31, 0xFF, 0xED, 0x24, 0xBB, 0x2C, 0xF3, 0x77,
0x99, 0x0C, 0x77, 0x4B, 0xD5, 0xC0, 0xFD, 0x6A,
0x0A, 0x43, 0x3F, 0xC3, 0x2F, 0xC6, 0x2C, 0x57,
0xBB, 0x09, 0xB3, 0x57, 0xB2, 0xA8, 0xE6, 0x14,
0x81, 0xDF, 0x26, 0xEE, 0x60, 0x87, 0xE4, 0x5A,
0x45, 0xE1, 0x18, 0x52, 0x49, 0x34, 0xE7, 0x39,
},
Q = new byte[]
{
0xF3, 0xC8, 0x6B, 0xA9, 0xA2, 0xD2, 0xD6, 0xAB,
0x64, 0x59, 0x0F, 0x68, 0x0C, 0xC8, 0x69, 0xC6,
0x51, 0xB2, 0x2C, 0x28, 0xB5, 0xDB, 0xDD, 0x00,
0x70, 0x5E, 0xB3, 0x04, 0x38, 0xC4, 0xAA, 0x45,
0xEF, 0x79, 0xAC, 0x79, 0x8F, 0xF1, 0xF6, 0x07,
0x3B, 0xDF, 0xAF, 0x08, 0xE3, 0xDA, 0x21, 0x37,
0x08, 0x41, 0x1F, 0xA0, 0x84, 0x4D, 0xEB, 0xA9,
0x91, 0xB5, 0xB1, 0xD6, 0xD5, 0x3A, 0x16, 0xD5,
0x7E, 0x7A, 0x9D, 0x65, 0xF1, 0x92, 0x87, 0x69,
0xE7, 0x01, 0xFD, 0x60, 0x95, 0x25, 0x1B, 0xF0,
0x79, 0xE0, 0xE1, 0xCA, 0xCE, 0x99, 0x7A, 0xED,
0xC7, 0x8D, 0xA2, 0x3D, 0x8D, 0x30, 0xB1, 0x8E,
0xDA, 0x99, 0xCF, 0x9E, 0x6B, 0x02, 0x28, 0xD4,
0xEC, 0x25, 0xD5, 0x89, 0x74, 0xCA, 0xA2, 0x7E,
0x47, 0xDB, 0xE8, 0xE5, 0x42, 0x6C, 0xD4, 0xDC,
0xAD, 0xDC, 0x31, 0xB2, 0x42, 0xFB, 0x2C, 0x13,
},
DQ = new byte[]
{
0x2F, 0x5F, 0x0F, 0xC4, 0xBB, 0xF6, 0x1A, 0x6E,
0xDD, 0xA6, 0x0C, 0xBF, 0x5C, 0x54, 0x89, 0x71,
0x57, 0x28, 0xB7, 0x3A, 0x05, 0xF4, 0xBE, 0x62,
0x3A, 0x73, 0xBC, 0x77, 0xA2, 0x8C, 0x5C, 0xC6,
0x10, 0x3D, 0xE5, 0x8D, 0x0D, 0xB2, 0xA7, 0xEB,
0x49, 0xF0, 0x32, 0x74, 0x18, 0xCA, 0xA7, 0x4F,
0xA9, 0x53, 0xF6, 0x50, 0x5B, 0xC5, 0x44, 0x79,
0x03, 0xEE, 0x79, 0xAB, 0x54, 0x6D, 0xE0, 0x48,
0x06, 0x36, 0xCF, 0x65, 0x22, 0xE7, 0x25, 0x57,
0x27, 0xE3, 0x94, 0x17, 0xF3, 0x83, 0x6D, 0x85,
0x72, 0x39, 0x87, 0xC6, 0xC0, 0x14, 0xC4, 0xF5,
0x75, 0xA4, 0x89, 0x15, 0x4A, 0xDD, 0x5E, 0x73,
0x72, 0xF9, 0x16, 0x86, 0x23, 0x27, 0x1D, 0x46,
0x1A, 0xC9, 0x53, 0x50, 0x4D, 0x98, 0x9E, 0xB0,
0xC9, 0x47, 0xEB, 0x5E, 0xB9, 0x64, 0xAA, 0x8C,
0x63, 0x60, 0x79, 0x6B, 0xB9, 0x66, 0x53, 0x6F,
},
InverseQ = new byte[]
{
0x0B, 0x16, 0x6B, 0x2E, 0x87, 0xCF, 0x1C, 0x2C,
0x9C, 0x8A, 0x1C, 0x92, 0xD4, 0xD1, 0x1E, 0xA4,
0x87, 0x25, 0x1C, 0xA1, 0x29, 0x7A, 0xE4, 0xD6,
0x65, 0x69, 0x6E, 0x62, 0xBA, 0xEA, 0x41, 0x69,
0x89, 0xBD, 0x78, 0x5A, 0xA1, 0x2C, 0x51, 0x66,
0xA3, 0x3D, 0x1E, 0x51, 0xA6, 0x65, 0x61, 0xA6,
0x6C, 0x2F, 0xAA, 0xDB, 0x5D, 0x6A, 0x94, 0x4E,
0x65, 0x4A, 0x30, 0x42, 0xE1, 0x7A, 0xA8, 0x5B,
0x2D, 0x41, 0x05, 0x82, 0x5F, 0x6D, 0xDD, 0x9D,
0x9A, 0x6A, 0x6E, 0x6E, 0x7C, 0x1B, 0xB3, 0x0B,
0x93, 0x58, 0x10, 0x1C, 0xEF, 0x91, 0xB6, 0x06,
0xBB, 0xE5, 0xAD, 0x15, 0x74, 0x69, 0xA4, 0x64,
0xFF, 0x6B, 0x88, 0x1E, 0xA1, 0x3C, 0xE3, 0xE1,
0x24, 0x53, 0x4D, 0xC8, 0xD1, 0x0B, 0xF7, 0x7D,
0x1B, 0x68, 0xEA, 0xB5, 0x34, 0xE4, 0xFB, 0x1C,
0x6C, 0xCA, 0x7F, 0x2C, 0x71, 0x19, 0x9D, 0xBC,
},
};
public static readonly RSAParameters RSA16384Params = new RSAParameters
{
Modulus = new byte[]
{
0x9B, 0x2C, 0x70, 0x5F, 0xA9, 0x10, 0x37, 0x1F,
0x8B, 0x48, 0xC6, 0xA8, 0xD5, 0x2B, 0x42, 0xD6,
0x9E, 0x6B, 0x28, 0x21, 0x30, 0x70, 0x18, 0xF3,
0x23, 0x5D, 0xFA, 0x02, 0x7D, 0xC1, 0xFC, 0x18,
0xED, 0x86, 0x07, 0xB3, 0x00, 0xEB, 0xAE, 0x27,
0xE7, 0xC0, 0x7C, 0x55, 0x64, 0x8F, 0xB5, 0x47,
0xE1, 0x98, 0x08, 0xF8, 0x60, 0x85, 0xC7, 0x14,
0x0B, 0x2B, 0x31, 0x62, 0x98, 0x5A, 0xF5, 0x16,
0xFA, 0xA7, 0x9C, 0xA8, 0x65, 0xBA, 0x0A, 0xEC,
0xB8, 0x9F, 0x30, 0x98, 0x9B, 0x55, 0x51, 0x1C,
0x4E, 0xFA, 0x51, 0x0A, 0x79, 0x92, 0x02, 0x3E,
0x6D, 0x9C, 0xCF, 0x8D, 0xE7, 0x7C, 0xA0, 0x32,
0x82, 0xC1, 0x9C, 0x7D, 0x2E, 0xF3, 0x8E, 0x88,
0x74, 0xB7, 0x0C, 0x88, 0x88, 0x00, 0xBA, 0xFB,
0xEF, 0x0A, 0xFF, 0x4A, 0xDC, 0xEC, 0xC6, 0xE5,
0xB8, 0x80, 0x6A, 0xC0, 0x60, 0xF7, 0x8D, 0x8B,
0x23, 0x07, 0x42, 0xC0, 0x67, 0x5F, 0x20, 0x6F,
0x72, 0x98, 0xCE, 0xE5, 0x39, 0x97, 0x0B, 0x76,
0xB8, 0x66, 0x56, 0x22, 0x09, 0xBD, 0x44, 0x67,
0x35, 0x2F, 0x8A, 0xF8, 0x45, 0xD1, 0x36, 0x34,
0x27, 0xD4, 0x78, 0x4D, 0x6E, 0x9E, 0x5D, 0x95,
0x47, 0xBC, 0x81, 0x60, 0x57, 0x1A, 0xB8, 0xC9,
0x5F, 0x18, 0xBE, 0x5B, 0x90, 0x13, 0x15, 0x84,
0x49, 0x16, 0x6E, 0xD6, 0xDD, 0x9D, 0x47, 0xEC,
0x22, 0x8A, 0xD6, 0x7A, 0x97, 0x44, 0x6B, 0x81,
0xA4, 0xA4, 0xF5, 0xE0, 0xEA, 0x4A, 0x54, 0x3B,
0x88, 0x81, 0xB8, 0x5D, 0xA4, 0x8A, 0x05, 0x29,
0xDB, 0x5A, 0xE4, 0x18, 0x8A, 0xF3, 0x07, 0x28,
0x32, 0xD6, 0x91, 0x50, 0xFE, 0x14, 0x5E, 0x1A,
0xE0, 0x9B, 0xFD, 0x25, 0x77, 0xAC, 0x5E, 0xD5,
0xF2, 0xA7, 0xE9, 0x9F, 0xDF, 0x2D, 0x86, 0xA7,
0xA2, 0x88, 0xF7, 0xF3, 0x89, 0x9E, 0x8A, 0xA6,
0xB9, 0x57, 0x36, 0xD1, 0x63, 0xFE, 0xE5, 0x40,
0x12, 0xB5, 0x87, 0x9F, 0x73, 0xF6, 0x76, 0x26,
0x32, 0xA7, 0x71, 0xD0, 0xC7, 0xC0, 0x46, 0x9A,
0xF2, 0x51, 0x31, 0xB1, 0xDD, 0xD1, 0x60, 0xEB,
0x89, 0x02, 0x62, 0x58, 0x44, 0x98, 0xA7, 0x65,
0x53, 0x07, 0x73, 0x75, 0x75, 0xC0, 0xD3, 0x8F,
0x91, 0x34, 0x72, 0x47, 0x5F, 0xF5, 0x6B, 0x7E,
0x25, 0x1E, 0xE0, 0x58, 0xC5, 0xB9, 0x6B, 0x17,
0xBB, 0xCB, 0x5C, 0x4C, 0xB3, 0x01, 0xC9, 0x59,
0xA2, 0x3B, 0xEA, 0x39, 0xC1, 0x4C, 0x7A, 0x21,
0xAA, 0xDB, 0x7E, 0xD9, 0x3E, 0x97, 0x16, 0x5B,
0x93, 0xA2, 0x76, 0x26, 0x39, 0xD4, 0x3C, 0x0D,
0xB8, 0x07, 0x05, 0x48, 0x2A, 0x1B, 0xA1, 0xFF,
0x1C, 0x9B, 0xA0, 0x58, 0x12, 0x26, 0xDF, 0x5F,
0x78, 0x40, 0x35, 0x61, 0xE7, 0x90, 0x92, 0xB0,
0x92, 0xC8, 0x9B, 0xC2, 0xF1, 0xC1, 0xC0, 0x60,
0x79, 0x47, 0x3F, 0x1F, 0xC6, 0x36, 0x15, 0x5A,
0xF7, 0x5A, 0xD1, 0x2C, 0x7A, 0x97, 0x34, 0xAD,
0xBD, 0x63, 0x34, 0x32, 0xE4, 0x7F, 0xCB, 0x18,
0x0B, 0xEA, 0x3A, 0x8E, 0xB0, 0x8C, 0x7A, 0x43,
0xFD, 0x60, 0xF1, 0x76, 0xB4, 0xF0, 0x31, 0x7F,
0xF7, 0xA8, 0x77, 0x17, 0xFF, 0xE7, 0xDB, 0x01,
0x88, 0x2D, 0xB0, 0x5C, 0x53, 0x03, 0x69, 0xF9,
0xD6, 0xA7, 0x59, 0x71, 0x5E, 0x21, 0x9C, 0x55,
0x5B, 0xBD, 0x74, 0x4D, 0x8B, 0x7A, 0x09, 0x42,
0x82, 0x73, 0x14, 0xA6, 0xCF, 0x50, 0x94, 0x90,
0xF4, 0x69, 0x76, 0x89, 0x1D, 0x88, 0xB6, 0x54,
0x34, 0x37, 0xCC, 0x57, 0x4C, 0xBE, 0x7F, 0x00,
0x8A, 0x69, 0x6A, 0x2A, 0xD6, 0x46, 0x74, 0x67,
0xFD, 0xDD, 0x86, 0x90, 0x83, 0xE6, 0x2A, 0xD3,
0xB8, 0x5C, 0xE9, 0xFF, 0x15, 0x8B, 0x7A, 0x35,
0x2D, 0x22, 0xBF, 0xC2, 0x9F, 0x41, 0x6C, 0xD6,
0x6C, 0xDC, 0x98, 0x41, 0xBF, 0x83, 0x83, 0x20,
0x03, 0x1F, 0x32, 0xC0, 0x84, 0xA2, 0x4F, 0x14,
0xFA, 0xF1, 0x61, 0x1D, 0x20, 0xA6, 0xA0, 0xDC,
0x73, 0x4E, 0x5F, 0x08, 0xF6, 0x9C, 0xFC, 0x28,
0x92, 0xD1, 0xC8, 0xB4, 0x17, 0xC1, 0xFA, 0x49,
0xCA, 0x57, 0xD6, 0x63, 0x9B, 0xC0, 0x6E, 0x90,
0x20, 0x57, 0xCC, 0x1D, 0xCA, 0x37, 0xCA, 0xAE,
0x8D, 0x90, 0x0D, 0x73, 0x48, 0x60, 0x2A, 0xD5,
0xA5, 0x09, 0x3D, 0x28, 0x50, 0x8C, 0xC2, 0xD7,
0xA4, 0x68, 0x0E, 0xFA, 0x2C, 0xA4, 0x50, 0x6A,
0x2F, 0x79, 0x4D, 0x9B, 0x98, 0x09, 0xBF, 0xB2,
0x43, 0x4D, 0x32, 0xBE, 0x4D, 0x7B, 0x9F, 0x32,
0x0F, 0x28, 0x91, 0xEC, 0xBF, 0xF8, 0xC7, 0x2E,
0xFC, 0x71, 0xA7, 0xD6, 0x33, 0xD4, 0xA7, 0x1B,
0xEE, 0xB6, 0x56, 0x91, 0x3F, 0x7A, 0xFD, 0xC8,
0x83, 0x7C, 0x4D, 0x06, 0xF1, 0xF7, 0x35, 0x92,
0x75, 0x91, 0x43, 0xC4, 0xA6, 0xE6, 0xB5, 0x2C,
0x73, 0xFA, 0xC7, 0x6E, 0x09, 0x1C, 0xCF, 0x30,
0x1B, 0xD0, 0x76, 0xB7, 0x45, 0x63, 0xAD, 0xDE,
0xF1, 0xBF, 0x27, 0x5D, 0x13, 0xD5, 0x82, 0x6B,
0xD6, 0x02, 0x0E, 0x24, 0x14, 0xA5, 0xA4, 0xD9,
0x8F, 0x6C, 0x48, 0x49, 0x70, 0x1C, 0xC5, 0x93,
0xCF, 0x17, 0x3A, 0xAF, 0x43, 0x0B, 0x7C, 0x5C,
0xD2, 0x3D, 0xD7, 0x93, 0x6F, 0x10, 0xEF, 0x70,
0x25, 0x70, 0x4A, 0xB4, 0x18, 0xD7, 0x3E, 0x16,
0xB8, 0xE4, 0x38, 0x9F, 0x9A, 0xCF, 0xA3, 0xDD,
0x70, 0xAA, 0xA4, 0x0D, 0x02, 0x7C, 0xEB, 0x66,
0xAB, 0x07, 0x8B, 0xBE, 0xE2, 0xFD, 0x70, 0xE2,
0xAA, 0xF9, 0xE3, 0xAF, 0x31, 0xF2, 0x57, 0xC0,
0x97, 0xE7, 0xEF, 0xD8, 0x9E, 0xF6, 0x72, 0x1B,
0x2B, 0xDF, 0x53, 0x96, 0xA2, 0x74, 0x2C, 0x54,
0x23, 0xA6, 0x48, 0x1B, 0x6F, 0xDF, 0x8A, 0xFD,
0x2E, 0xEE, 0x95, 0x53, 0xA9, 0xA4, 0xEA, 0x26,
0xD4, 0x93, 0x4B, 0xFA, 0xCE, 0xB5, 0x6F, 0xF0,
0x64, 0xA5, 0x1E, 0xE4, 0x2C, 0x15, 0x03, 0xBB,
0x46, 0x2E, 0x8F, 0x99, 0x7D, 0xDD, 0xCB, 0x02,
0x89, 0x96, 0x5A, 0x53, 0x08, 0x54, 0x25, 0x72,
0xA9, 0x5E, 0x10, 0xF9, 0x88, 0xCB, 0x30, 0xB7,
0x1F, 0x97, 0xD5, 0xD5, 0x15, 0x73, 0x23, 0x0F,
0x06, 0xD3, 0x5E, 0xCF, 0x25, 0xBD, 0x5E, 0xAD,
0x73, 0xF3, 0x92, 0x62, 0xD0, 0x14, 0xFB, 0x26,
0x4D, 0x21, 0x22, 0x24, 0xCB, 0xE8, 0xAD, 0x5C,
0xFB, 0x99, 0x58, 0x10, 0x69, 0x3D, 0x31, 0x65,
0xC2, 0x3A, 0xAB, 0x64, 0x7A, 0x8A, 0x79, 0x2B,
0xF7, 0x15, 0x35, 0x88, 0x2E, 0xC4, 0xAF, 0x0D,
0xE7, 0x67, 0xD2, 0x76, 0x3B, 0x4E, 0x83, 0xA1,
0x98, 0xF7, 0x47, 0x0C, 0xBE, 0xDF, 0x27, 0xC2,
0x7D, 0xB6, 0xD9, 0x93, 0xEC, 0x92, 0xFE, 0x63,
0xC8, 0x8A, 0x9A, 0xC7, 0xC8, 0x08, 0x0D, 0x5B,
0x97, 0xA3, 0x59, 0x2F, 0x6A, 0x24, 0x1B, 0x64,
0xBA, 0xE6, 0x1C, 0x33, 0xE1, 0xAE, 0x49, 0x79,
0x84, 0xD4, 0x31, 0xBC, 0x03, 0xFE, 0x17, 0x57,
0xEC, 0x0C, 0x8C, 0x4C, 0xAA, 0x75, 0x1A, 0x7E,
0x00, 0xE7, 0x77, 0x38, 0x40, 0xF7, 0xF2, 0xDE,
0x0C, 0x3B, 0x81, 0x9D, 0xA7, 0x2B, 0x7B, 0xE3,
0x63, 0x77, 0xA2, 0x51, 0x92, 0x74, 0xD2, 0x6A,
0x22, 0xE4, 0x63, 0x19, 0x41, 0x9B, 0xD7, 0x59,
0x79, 0x58, 0x8D, 0xA2, 0x18, 0xB2, 0x8E, 0xD8,
0x68, 0x16, 0x4D, 0xA9, 0xE7, 0x8C, 0x15, 0x0E,
0xE7, 0xD9, 0xB7, 0x01, 0xF6, 0xFF, 0x45, 0x5F,
0xFF, 0xDF, 0x23, 0x2C, 0xAC, 0xF1, 0x4B, 0xF7,
0x18, 0x34, 0x99, 0x43, 0x69, 0x08, 0x1B, 0x8E,
0x69, 0x66, 0x07, 0x76, 0x5F, 0xBC, 0x2C, 0x97,
0x2E, 0xFC, 0x0A, 0x32, 0x60, 0xF4, 0x53, 0x25,
0x67, 0x7A, 0xDF, 0x4D, 0x0D, 0xE3, 0x1D, 0xEC,
0x34, 0x1A, 0xB0, 0x7B, 0x2D, 0xF1, 0x22, 0x33,
0xE2, 0xB4, 0x7B, 0x11, 0x98, 0xD9, 0xBE, 0x83,
0x21, 0x7A, 0x25, 0x32, 0x1E, 0x6C, 0x55, 0xA7,
0xD0, 0xAA, 0xE7, 0xBF, 0x60, 0xE6, 0x23, 0x9A,
0x96, 0x60, 0x80, 0xC8, 0xE2, 0x78, 0x98, 0x13,
0xF5, 0xBC, 0xAE, 0x84, 0x6D, 0xE5, 0x11, 0x29,
0xF5, 0x4E, 0x87, 0xE9, 0x55, 0xCF, 0x05, 0x11,
0x6B, 0xE1, 0xD6, 0x81, 0xD8, 0x9C, 0xFD, 0x85,
0xCE, 0x57, 0x7E, 0xDF, 0xE2, 0xF7, 0xF6, 0x44,
0xD8, 0xDD, 0x4F, 0xFE, 0x4A, 0x11, 0x17, 0xDD,
0x08, 0x12, 0x54, 0x34, 0xDC, 0xAC, 0xE0, 0xA3,
0xBE, 0xB4, 0x8F, 0x9B, 0xFF, 0x5A, 0xD7, 0xC2,
0x5E, 0xC6, 0x34, 0x25, 0x6A, 0x1C, 0xDC, 0x90,
0x90, 0x79, 0x4C, 0x0F, 0xD3, 0xCF, 0x71, 0x08,
0xB1, 0x45, 0xA2, 0xBC, 0x7D, 0x32, 0xF9, 0xC0,
0x6A, 0xBC, 0x6D, 0xC1, 0x98, 0xDD, 0xA0, 0x93,
0xAC, 0x7D, 0x74, 0x95, 0x8B, 0x75, 0xE3, 0xF4,
0x64, 0xA1, 0x80, 0xC1, 0xF1, 0xC8, 0xAE, 0x1E,
0xE4, 0x4C, 0x3A, 0x6C, 0xF3, 0x17, 0x41, 0x9E,
0x35, 0x58, 0xEA, 0x35, 0x1E, 0x97, 0x2A, 0x8D,
0x94, 0x9F, 0x6C, 0x62, 0xF7, 0xF7, 0xF6, 0x52,
0x39, 0xA5, 0x10, 0xF0, 0x5C, 0x74, 0x7D, 0xBF,
0x8D, 0x29, 0xB8, 0x91, 0xC3, 0x4E, 0xB7, 0x31,
0xB5, 0x12, 0x1A, 0xA4, 0x39, 0xE2, 0xE8, 0x87,
0x89, 0xFF, 0xA3, 0x38, 0xBB, 0x71, 0x88, 0x21,
0x2A, 0x34, 0x91, 0x18, 0x02, 0x5E, 0xC0, 0x2C,
0xDD, 0x47, 0x87, 0xDF, 0x36, 0x12, 0xCF, 0x96,
0x1C, 0xD1, 0x98, 0x2A, 0x9B, 0x8E, 0x28, 0xF9,
0xDF, 0x81, 0xAF, 0x34, 0x00, 0xB5, 0xB2, 0x9B,
0xE5, 0x8C, 0xA3, 0x82, 0xA9, 0xBE, 0x95, 0xE7,
0x17, 0xEB, 0xEA, 0x57, 0x2E, 0xA7, 0x71, 0x0B,
0xBF, 0xFB, 0x8D, 0xC5, 0x74, 0x9B, 0x98, 0xC0,
0x21, 0x70, 0x54, 0xB1, 0xEC, 0xFF, 0xA0, 0x80,
0xA2, 0x7D, 0x29, 0x09, 0x3F, 0x63, 0x06, 0xA1,
0xDA, 0x9F, 0xAA, 0x17, 0x9D, 0x73, 0x65, 0x04,
0xD9, 0x00, 0x07, 0xB8, 0xFB, 0x8D, 0x08, 0xB5,
0x04, 0xF4, 0x3D, 0x11, 0xAA, 0x32, 0xD3, 0xDD,
0xF6, 0xD2, 0xEC, 0x9B, 0x53, 0x61, 0xD0, 0xFC,
0x6A, 0x35, 0xA1, 0xEA, 0x78, 0xE5, 0xAA, 0xDE,
0x51, 0x3D, 0x54, 0xE6, 0x36, 0xC3, 0x7D, 0xA3,
0x72, 0x78, 0x6C, 0x88, 0x0C, 0x94, 0x9D, 0x31,
0xE5, 0x72, 0xF3, 0x89, 0xE7, 0x38, 0xBF, 0xE9,
0x67, 0xF7, 0xAB, 0xEC, 0xBC, 0x51, 0xF8, 0x37,
0x5E, 0x8B, 0x4F, 0x54, 0xD2, 0xA8, 0xC6, 0x1D,
0x3E, 0x01, 0x8C, 0x36, 0x90, 0x9C, 0x83, 0xA3,
0x87, 0x28, 0x1C, 0x40, 0x67, 0x19, 0x0F, 0x03,
0xD9, 0x17, 0x37, 0xC0, 0xBD, 0x1D, 0x06, 0xAD,
0x61, 0x97, 0xCC, 0x01, 0x6E, 0x3A, 0xB4, 0xD1,
0xDF, 0x43, 0x57, 0x41, 0xE4, 0x9F, 0x49, 0xAF,
0x84, 0x9E, 0xC9, 0xB2, 0x74, 0x67, 0xFC, 0x16,
0xD4, 0x4F, 0x18, 0x5E, 0x87, 0x16, 0x7A, 0x36,
0x00, 0x93, 0x62, 0x81, 0xC0, 0xE9, 0xF0, 0xCE,
0xAD, 0x88, 0x59, 0xE5, 0x77, 0x58, 0xC3, 0x16,
0xAD, 0x02, 0x0D, 0xA0, 0x1C, 0xD3, 0xB7, 0x2C,
0x88, 0xC7, 0xCC, 0x83, 0xC5, 0x99, 0x16, 0x58,
0x7C, 0x24, 0x46, 0xF6, 0x67, 0x27, 0xBA, 0xF7,
0x10, 0x76, 0xD6, 0x64, 0x27, 0x35, 0x15, 0x30,
0xD6, 0xF2, 0x36, 0x4A, 0xCA, 0x42, 0x50, 0xD8,
0x7A, 0xC7, 0xAB, 0x87, 0xB6, 0x6A, 0x98, 0x36,
0x21, 0x38, 0x6B, 0x88, 0x53, 0xE8, 0xDE, 0x30,
0x77, 0x54, 0x94, 0xB8, 0xFD, 0xAD, 0xD9, 0x11,
0xDA, 0x25, 0xE9, 0x6F, 0x65, 0x6B, 0xE0, 0x3D,
0x95, 0xAB, 0x35, 0x0F, 0x9E, 0xC6, 0xB9, 0xA2,
0x14, 0x8B, 0x6C, 0x8B, 0xC1, 0xA1, 0x39, 0xCC,
0x46, 0xF4, 0x82, 0xA3, 0xD9, 0xEF, 0x19, 0xDB,
0xF3, 0x2D, 0x23, 0xD7, 0xB8, 0xA6, 0xFC, 0x3D,
0xF2, 0xEB, 0x9A, 0x33, 0x8C, 0xDD, 0x8A, 0x76,
0x59, 0xD3, 0x2E, 0x7A, 0x52, 0xAC, 0xD9, 0x3F,
0xCB, 0xFB, 0xA5, 0x37, 0xFD, 0xA4, 0xB3, 0xFC,
0xE9, 0x0F, 0xD6, 0x04, 0xF0, 0x75, 0x5C, 0xB3,
0x63, 0x43, 0x82, 0x07, 0x6F, 0x8F, 0x7C, 0x86,
0x92, 0x36, 0x73, 0x7A, 0x9A, 0x66, 0xF9, 0x4A,
0xF3, 0x26, 0xB2, 0x7E, 0x18, 0xBB, 0x9A, 0x24,
0xF3, 0xCF, 0x1F, 0x73, 0xBF, 0x98, 0x9E, 0x36,
0xFC, 0x18, 0xB5, 0x5E, 0x6B, 0x1D, 0x06, 0xDE,
0x70, 0x7A, 0x81, 0xB3, 0x9D, 0x88, 0x11, 0x8C,
0x44, 0xA2, 0x12, 0x84, 0x1B, 0x08, 0xCA, 0xE8,
0x5B, 0xA3, 0xA0, 0x1F, 0x70, 0xD9, 0xFF, 0x46,
0x75, 0x8F, 0x46, 0xF8, 0x3C, 0xB9, 0x68, 0x11,
0x5D, 0xC0, 0xCD, 0x06, 0x8C, 0x70, 0x3B, 0x7F,
0xE3, 0xB9, 0xD3, 0xC3, 0xE1, 0x9F, 0xF8, 0x1C,
0x35, 0xAD, 0xFE, 0x05, 0x7F, 0x0D, 0x12, 0x8B,
0x2C, 0x06, 0xAE, 0xE1, 0x63, 0x3A, 0x05, 0x45,
0xA9, 0x26, 0x06, 0x6E, 0xAA, 0x9B, 0x92, 0x42,
0xE4, 0xD3, 0x51, 0x65, 0x77, 0xC1, 0x42, 0x9F,
0xD2, 0x92, 0x2A, 0xE1, 0xE2, 0x57, 0x03, 0xAA,
0x02, 0xF4, 0x24, 0xB8, 0x66, 0x18, 0x6C, 0xBF,
0x2E, 0x8A, 0xAC, 0x69, 0x32, 0x68, 0x6D, 0xB1,
0x3D, 0x8C, 0x7F, 0x4F, 0x5D, 0x96, 0xA9, 0x78,
0xC5, 0xEC, 0x4A, 0x30, 0x16, 0x48, 0x2D, 0x79,
0x0F, 0x5A, 0xD6, 0xCF, 0x38, 0xAF, 0x80, 0x4E,
0x28, 0x50, 0xA9, 0x16, 0x21, 0xA6, 0xB6, 0xE1,
0x3B, 0x27, 0xDB, 0x61, 0x3E, 0xE3, 0x08, 0x7D,
0x8D, 0x2E, 0xF1, 0x39, 0xF2, 0x75, 0xFF, 0x25,
0xE7, 0x08, 0xDF, 0x2C, 0xBC, 0xE4, 0x49, 0x70,
0x4B, 0xFC, 0x4D, 0xEF, 0x72, 0x32, 0x45, 0xC4,
0x89, 0xFD, 0x7B, 0x56, 0x13, 0x49, 0x86, 0x8E,
0x3E, 0xA8, 0xB0, 0xF1, 0xB3, 0xB5, 0x5B, 0x51,
0x82, 0x32, 0x28, 0xD2, 0x65, 0xCF, 0x72, 0xAB,
0x35, 0x03, 0x01, 0x00, 0x3A, 0x5E, 0xCB, 0x5D,
0x1F, 0x9E, 0x1C, 0xDA, 0xD0, 0xD2, 0x52, 0x4C,
0x2E, 0xD1, 0xA1, 0x1A, 0x5F, 0x92, 0x8F, 0x74,
0xE5, 0xAD, 0x56, 0xA3, 0x8B, 0xED, 0x49, 0xDA,
0x7B, 0x4F, 0x94, 0xB9, 0x38, 0xF4, 0x4C, 0xB9,
0x03, 0x5A, 0x3A, 0xAD, 0xAD, 0xD9, 0xF0, 0x61,
0x75, 0x83, 0x2F, 0x48, 0xD9, 0xE8, 0xD6, 0x67,
0x1D, 0x50, 0x17, 0xD5, 0x0C, 0x76, 0x05, 0xC3,
0x1E, 0xB1, 0xB8, 0x51, 0x87, 0x4B, 0x68, 0xD8,
0x31, 0x10, 0xE7, 0xF3, 0xC3, 0x03, 0x3D, 0xD0,
0xA6, 0xFF, 0x53, 0x2B, 0x8C, 0x71, 0x03, 0xC7,
0xAC, 0xF3, 0xC4, 0xC4, 0x75, 0xB6, 0x38, 0xE3,
0xEB, 0xAA, 0x31, 0x14, 0x94, 0x37, 0xA3, 0xF5,
0xA1, 0xF2, 0x12, 0x43, 0x2B, 0xE9, 0x0C, 0x0C,
0x86, 0x1D, 0xFF, 0xF9, 0x05, 0x46, 0xB7, 0x80,
0x32, 0x15, 0x57, 0xD5, 0xD1, 0x89, 0xFD, 0xAC,
0x7A, 0xA7, 0xF7, 0x70, 0xE1, 0xF1, 0x3E, 0x69,
0x61, 0x2B, 0x17, 0x08, 0x1F, 0x67, 0x24, 0xA7,
0xF6, 0xFA, 0x8A, 0x76, 0x72, 0xF8, 0x9F, 0x58,
0xFB, 0x6D, 0xE9, 0x96, 0x3B, 0x13, 0x26, 0xAC,
0x08, 0xA0, 0x73, 0x0B, 0x7A, 0x9E, 0x81, 0xFF,
0x85, 0x7E, 0x59, 0x3B, 0x95, 0xFC, 0xEB, 0xD4,
0x95, 0xD5, 0x6B, 0xCB, 0x3A, 0xF8, 0x42, 0xB7,
0x84, 0x6E, 0xEC, 0xB3, 0xB3, 0xA9, 0x45, 0x0B,
0x93, 0xE6, 0x37, 0xFA, 0x04, 0x8D, 0x1D, 0x7D,
0xF8, 0xFF, 0xE2, 0x70, 0xF9, 0x50, 0xAA, 0xE6,
0x11, 0xE5, 0xA2, 0x53, 0x64, 0xA7, 0x0F, 0xAD,
0x86, 0xAB, 0xDB, 0x6B, 0xC9, 0x4C, 0xBF, 0x33,
},
Exponent = new byte[]
{
0x01, 0x00, 0x01,
},
D = new byte[]
{
0x36, 0x5D, 0x38, 0xD7, 0x82, 0xE3, 0x2F, 0xF4,
0xC8, 0xB7, 0x0C, 0x06, 0x9D, 0x7C, 0x65, 0x13,
0xCC, 0xF7, 0xAC, 0xDD, 0x07, 0xDB, 0xD6, 0x19,
0xE4, 0xD3, 0xA9, 0x62, 0x13, 0x0E, 0x11, 0xD4,
0xE7, 0xEE, 0x73, 0xA7, 0x16, 0x94, 0xFB, 0x74,
0x76, 0xA0, 0xBC, 0xCE, 0xAC, 0x07, 0x1F, 0x13,
0x5A, 0x69, 0x8A, 0x06, 0xFE, 0xC6, 0x0F, 0xAB,
0xA9, 0x88, 0x0D, 0xEA, 0xC5, 0x86, 0xE4, 0x64,
0x13, 0x18, 0x02, 0xEE, 0x0A, 0x89, 0xC6, 0x07,
0x0E, 0x5D, 0x93, 0x48, 0x7B, 0xEF, 0x45, 0x95,
0xFD, 0xE3, 0x7B, 0xDE, 0x08, 0x1E, 0x8B, 0xD3,
0xB4, 0x52, 0x62, 0x73, 0x0C, 0x5D, 0x60, 0xC0,
0xA1, 0x87, 0xD4, 0x5C, 0x15, 0x45, 0x76, 0x33,
0xBF, 0x74, 0x5C, 0x1B, 0x3F, 0x4E, 0xC6, 0x33,
0xBA, 0x99, 0x67, 0x3C, 0xA2, 0xAE, 0xFF, 0xB5,
0xFE, 0xD0, 0x5A, 0xD6, 0x20, 0x82, 0xCA, 0x5F,
0xAB, 0x3B, 0x81, 0x7A, 0xE8, 0x1C, 0x6F, 0x40,
0x2C, 0x6D, 0x75, 0xDA, 0xE0, 0x34, 0xD7, 0x6A,
0xD6, 0x0A, 0xE0, 0x75, 0x57, 0x65, 0x2C, 0x60,
0x5E, 0x45, 0x54, 0x52, 0x4C, 0x1F, 0x92, 0x76,
0x6E, 0x57, 0xE5, 0x77, 0xF7, 0x5F, 0xDB, 0x58,
0x90, 0x03, 0xEE, 0x6D, 0xC2, 0xC6, 0x95, 0x63,
0xD3, 0x81, 0xD7, 0x3B, 0x3B, 0xFC, 0x3B, 0xA7,
0x17, 0x76, 0x19, 0x0A, 0x05, 0x25, 0x73, 0xCB,
0xBA, 0x84, 0x5A, 0xC5, 0x23, 0x56, 0xF0, 0xB5,
0x40, 0x6A, 0x1C, 0xCC, 0x9A, 0x38, 0xC5, 0x4F,
0x00, 0x31, 0xB6, 0x56, 0x74, 0x6D, 0x78, 0x86,
0xA4, 0x17, 0xB1, 0x5F, 0x19, 0xDB, 0x30, 0x30,
0x38, 0xB3, 0x6C, 0xC0, 0xEB, 0xEB, 0x55, 0xD6,
0xE3, 0xC7, 0x32, 0xC6, 0xDC, 0x29, 0x13, 0x26,
0xB0, 0xB7, 0x7C, 0x45, 0xAB, 0x0A, 0x87, 0xA9,
0x16, 0x6C, 0x17, 0x36, 0x87, 0x09, 0xF8, 0xF8,
0x95, 0x69, 0x85, 0x46, 0x91, 0xDA, 0x7D, 0x15,
0xD8, 0x18, 0x2A, 0x36, 0x46, 0x89, 0xDB, 0xF5,
0xE0, 0xFC, 0x42, 0x07, 0x4B, 0xDC, 0x44, 0xC0,
0x47, 0x52, 0x03, 0xEF, 0x95, 0x4F, 0xA4, 0x3D,
0x90, 0xC8, 0x39, 0x8D, 0x44, 0x27, 0x19, 0x4A,
0x89, 0xEE, 0xCB, 0xD8, 0x24, 0x93, 0x94, 0x6B,
0x31, 0x8B, 0xA6, 0xD7, 0xF3, 0xBA, 0x07, 0x59,
0x70, 0x06, 0xE3, 0xC1, 0xA6, 0x30, 0x22, 0x61,
0x73, 0xC5, 0x39, 0x06, 0x94, 0x16, 0x75, 0xA5,
0x06, 0x0E, 0x28, 0xAE, 0xE8, 0x56, 0x73, 0x59,
0x75, 0x43, 0x26, 0x2B, 0x55, 0x5E, 0xD8, 0x91,
0xE7, 0xE4, 0xDC, 0xB0, 0xE2, 0xC4, 0xC4, 0xEF,
0x67, 0x80, 0x6A, 0x2C, 0xD0, 0xB7, 0xD2, 0xA7,
0x0E, 0xAE, 0x45, 0x5C, 0x65, 0xAB, 0xA1, 0xC9,
0x90, 0x57, 0x2A, 0x7C, 0xAD, 0x04, 0xBD, 0x27,
0xC8, 0x9D, 0x28, 0xD9, 0x01, 0x1B, 0x08, 0xDB,
0xA3, 0xD1, 0xBE, 0xBF, 0x52, 0x91, 0xA3, 0x24,
0xB6, 0x11, 0x66, 0xC4, 0x47, 0x04, 0xCF, 0x8B,
0x69, 0x15, 0x26, 0xF6, 0x07, 0x90, 0xF0, 0x25,
0xF2, 0x12, 0xB3, 0x46, 0x47, 0x7B, 0x47, 0xE0,
0xA7, 0x16, 0x3E, 0x32, 0x81, 0x0C, 0xBF, 0xC2,
0xDE, 0x10, 0xF2, 0xFC, 0x81, 0x07, 0x09, 0x76,
0xFD, 0x6F, 0x48, 0x60, 0xE8, 0x22, 0x83, 0x8F,
0xE8, 0xD0, 0xC3, 0xA8, 0xD0, 0xBA, 0x44, 0xCB,
0xB0, 0xF2, 0xEC, 0x9A, 0xB8, 0x59, 0x5E, 0x82,
0x23, 0x32, 0xCF, 0x52, 0xEB, 0xC2, 0x06, 0xF2,
0xCB, 0xF6, 0x60, 0xF5, 0x83, 0xD7, 0xE0, 0x4D,
0x1A, 0xE8, 0x4B, 0x9A, 0x70, 0x44, 0x33, 0x39,
0x8C, 0xC4, 0x86, 0xD2, 0x10, 0x35, 0x29, 0xD6,
0x3F, 0x1E, 0x4B, 0xE5, 0x38, 0x98, 0xBC, 0x7B,
0x65, 0x95, 0x83, 0xD3, 0x7F, 0x08, 0x59, 0x1D,
0xE5, 0x3C, 0xCD, 0xE3, 0x11, 0x29, 0x7A, 0x48,
0x9B, 0x66, 0x23, 0x9F, 0xB1, 0x49, 0x91, 0x78,
0x77, 0x2F, 0x88, 0x77, 0xE3, 0x5F, 0xFC, 0x05,
0xD5, 0x2F, 0x18, 0xFF, 0x7B, 0xEF, 0x74, 0xDF,
0x17, 0x34, 0xA7, 0x5D, 0xFC, 0x0C, 0x9E, 0xD9,
0x56, 0x2A, 0xD2, 0x3E, 0xAA, 0x2E, 0x27, 0x12,
0x90, 0x25, 0xFA, 0xF1, 0xF5, 0xE0, 0xD2, 0xBB,
0x82, 0xE1, 0x4F, 0x9D, 0x46, 0x3A, 0x0A, 0xB3,
0xE1, 0xDB, 0xCC, 0xA2, 0x8D, 0x82, 0x47, 0xAF,
0x86, 0xFC, 0xF8, 0x24, 0xB6, 0x27, 0xC2, 0xA1,
0x8B, 0x33, 0x7B, 0xBF, 0xD1, 0x41, 0x15, 0xFD,
0x45, 0xB9, 0xA1, 0x63, 0x78, 0x3E, 0x3E, 0x1F,
0x65, 0xAD, 0xD7, 0xAF, 0xCD, 0x74, 0x98, 0x9F,
0x10, 0xA9, 0x7D, 0x8A, 0x6C, 0xED, 0x6B, 0x57,
0x3E, 0x51, 0x51, 0x64, 0x5D, 0xCF, 0x4C, 0x66,
0xA0, 0x58, 0xD8, 0x76, 0x55, 0xBF, 0xB0, 0xC6,
0xFD, 0xAD, 0xE0, 0x4C, 0xA5, 0x1C, 0x1F, 0x74,
0x3A, 0xE5, 0x54, 0x51, 0x42, 0xCA, 0x04, 0x42,
0x59, 0x35, 0xCC, 0x85, 0xF4, 0x02, 0x58, 0x62,
0x39, 0xF4, 0x6C, 0x8B, 0x23, 0xEF, 0xDA, 0xBC,
0x07, 0x85, 0x19, 0x74, 0xE6, 0x1C, 0x80, 0xEF,
0x67, 0xD0, 0x5B, 0x84, 0xEF, 0x88, 0xE2, 0xFA,
0xE7, 0xE1, 0x1F, 0x68, 0x3F, 0x33, 0x8D, 0x53,
0x0E, 0x14, 0x4C, 0xD6, 0x97, 0x4E, 0x20, 0x59,
0x62, 0xBD, 0x10, 0xD8, 0x51, 0xEA, 0xA4, 0x80,
0x6D, 0x55, 0x6C, 0x8E, 0xB1, 0x3F, 0x43, 0xBC,
0xF1, 0x34, 0xDF, 0xD3, 0xA7, 0x08, 0xC5, 0x17,
0xB1, 0x3F, 0xCF, 0x6E, 0xD1, 0x66, 0xD3, 0x90,
0x2A, 0x2E, 0x60, 0x1A, 0xD5, 0xEA, 0xC6, 0x10,
0x5B, 0xA7, 0x65, 0xC9, 0xFC, 0xDD, 0x33, 0x3A,
0x41, 0xDE, 0x1B, 0xED, 0x10, 0x30, 0x36, 0x64,
0xE7, 0x97, 0x7B, 0xF1, 0x03, 0xE4, 0x60, 0x9D,
0x6F, 0xC9, 0xF3, 0x6C, 0x4D, 0x63, 0x0B, 0x8E,
0x4D, 0x51, 0x80, 0x16, 0x8A, 0x12, 0x41, 0x88,
0xAE, 0x24, 0x16, 0xD3, 0xFD, 0x74, 0x9A, 0x8D,
0xA5, 0xAD, 0x25, 0xE7, 0xF9, 0xBB, 0xB9, 0x0D,
0x74, 0xF6, 0x9E, 0x0F, 0xC0, 0x05, 0xA2, 0xF8,
0xB6, 0x1C, 0x6B, 0x73, 0xB8, 0xB0, 0xC6, 0x57,
0xE8, 0x17, 0x91, 0x29, 0xE3, 0x6F, 0x90, 0x97,
0x2F, 0xA5, 0xE1, 0xE0, 0x1F, 0xFE, 0x31, 0x13,
0xB4, 0x27, 0xFC, 0x88, 0xE5, 0x67, 0x75, 0x92,
0x9E, 0x53, 0x80, 0xFF, 0x46, 0x78, 0x7B, 0x4E,
0xFD, 0x69, 0xB4, 0xCD, 0x20, 0x75, 0x59, 0xBB,
0x80, 0x58, 0x46, 0x7E, 0xA5, 0x68, 0x2F, 0x74,
0xBF, 0xBA, 0x0F, 0x4F, 0x0A, 0x11, 0x96, 0x87,
0x3D, 0x2E, 0xFC, 0x8C, 0xC4, 0x19, 0xDB, 0x5C,
0xAB, 0x2C, 0x78, 0x13, 0x3D, 0x0E, 0xF2, 0x55,
0xFC, 0xC1, 0xF1, 0x6D, 0xF9, 0x37, 0x34, 0x76,
0x52, 0xD5, 0xEB, 0x5F, 0x84, 0x5C, 0x31, 0x6C,
0xE3, 0x17, 0x10, 0x48, 0x1B, 0x00, 0x1B, 0x31,
0xF2, 0x2B, 0xE3, 0xF4, 0x95, 0x22, 0xA6, 0x48,
0x41, 0xA4, 0x99, 0xCF, 0xE1, 0x6A, 0xCE, 0xCA,
0x18, 0xAB, 0xC0, 0xEA, 0xE6, 0x99, 0x30, 0x33,
0x78, 0xFB, 0x22, 0x72, 0x3F, 0xAB, 0xFC, 0x46,
0x95, 0xE9, 0x82, 0x1E, 0xBE, 0xC0, 0x3F, 0xA1,
0xE4, 0xB6, 0x3A, 0x60, 0x71, 0xEF, 0x6D, 0x9D,
0x8A, 0x3D, 0x21, 0x2C, 0xA3, 0xFB, 0x72, 0xB6,
0x85, 0x97, 0xEF, 0x52, 0x2B, 0x66, 0xBE, 0x69,
0x55, 0xF6, 0x9C, 0xD4, 0x64, 0x03, 0xB6, 0xC1,
0x01, 0xA2, 0x82, 0xBE, 0x1A, 0x65, 0xBD, 0x00,
0xF6, 0x60, 0x93, 0xD9, 0xC7, 0xDF, 0xC2, 0x3D,
0xF2, 0x66, 0x8A, 0x2B, 0xBE, 0x41, 0x61, 0x84,
0x65, 0xC2, 0x13, 0xCA, 0x06, 0xB3, 0xB4, 0xF7,
0xCD, 0x5C, 0x56, 0x13, 0xF6, 0x51, 0x76, 0x6B,
0xD7, 0x25, 0xAD, 0x2A, 0xDE, 0x45, 0xEB, 0x14,
0xDD, 0x82, 0xBC, 0xD5, 0xE5, 0xBB, 0xCB, 0x01,
0xFB, 0xDE, 0xA4, 0x0E, 0x90, 0xF1, 0xB6, 0x73,
0xDD, 0x3F, 0xCC, 0x13, 0x1C, 0x5F, 0x31, 0x7B,
0x26, 0x8F, 0xDF, 0xE9, 0x33, 0x51, 0xED, 0xFA,
0x41, 0x47, 0x49, 0xCD, 0xD9, 0xA3, 0x7A, 0x81,
0x39, 0x57, 0xC1, 0x28, 0x05, 0x28, 0xE0, 0x89,
0xEF, 0xBD, 0xEB, 0x13, 0x4E, 0xB4, 0x20, 0x15,
0x2D, 0x4F, 0x8E, 0xC4, 0xB6, 0x21, 0xDC, 0x48,
0xA0, 0xC2, 0x9B, 0xB9, 0x01, 0x8E, 0xAE, 0x72,
0x3B, 0x81, 0x38, 0x0B, 0x96, 0xA0, 0x60, 0x9A,
0x12, 0xD3, 0x71, 0x8D, 0x72, 0x6F, 0x85, 0x7E,
0x0E, 0x18, 0xC0, 0xB6, 0x2D, 0x7D, 0x3D, 0xC0,
0xC9, 0x3B, 0xCE, 0x35, 0xE6, 0x08, 0x9A, 0xC8,
0x4C, 0x15, 0xF3, 0x2C, 0xF0, 0x4F, 0x3D, 0x6E,
0x8F, 0x6C, 0x16, 0x08, 0x0D, 0x38, 0xAB, 0xC1,
0xA7, 0xF3, 0x5C, 0x65, 0xA1, 0xD3, 0x3C, 0x11,
0xA5, 0x25, 0x44, 0xAA, 0xBD, 0xAF, 0xBE, 0x4F,
0x6D, 0x81, 0x5B, 0xD9, 0xBD, 0x07, 0xF2, 0xC5,
0xBD, 0xCD, 0x84, 0x52, 0x6C, 0x26, 0x7A, 0x08,
0xD8, 0xB0, 0x88, 0x8E, 0x3F, 0x91, 0x63, 0x2F,
0x2C, 0x3D, 0xD3, 0x35, 0xDA, 0xFC, 0x97, 0xEC,
0x66, 0xA4, 0x78, 0x52, 0x7B, 0xE7, 0x7B, 0x41,
0xE3, 0xEE, 0x3D, 0x1A, 0xF5, 0xE8, 0x4E, 0xF9,
0x5C, 0xEF, 0x31, 0x69, 0xEF, 0xBF, 0xC0, 0x95,
0x41, 0x5E, 0x8A, 0x4C, 0x7B, 0x49, 0x7E, 0x24,
0x94, 0xAF, 0x95, 0x36, 0xBE, 0xC8, 0xB0, 0x8D,
0x1E, 0xB9, 0xED, 0xF1, 0xAA, 0x87, 0x79, 0x94,
0x47, 0xCF, 0x4B, 0x2C, 0x28, 0x01, 0x75, 0xAE,
0x20, 0x2F, 0xC5, 0x23, 0x5D, 0xF2, 0x9B, 0x57,
0xEC, 0x20, 0xEF, 0x7D, 0xA0, 0x70, 0x73, 0x14,
0xDE, 0x39, 0xD1, 0x7B, 0x76, 0xB0, 0x6F, 0xBD,
0x3F, 0x4E, 0xD8, 0xD0, 0xDF, 0x90, 0x6B, 0x3C,
0x42, 0x62, 0x57, 0xF0, 0x2C, 0x19, 0x16, 0x11,
0xB7, 0x54, 0xB3, 0x15, 0x26, 0x14, 0xA7, 0x41,
0x32, 0xCF, 0x6B, 0xAB, 0xFD, 0x8F, 0x88, 0x2E,
0x71, 0x85, 0x09, 0x62, 0x8E, 0xCB, 0x1D, 0xEA,
0x70, 0xE6, 0xE5, 0x6C, 0xE0, 0xA9, 0xB2, 0x83,
0x5F, 0xE9, 0x74, 0xD6, 0x5B, 0x6B, 0xFB, 0x18,
0xB0, 0x44, 0xB8, 0x9D, 0x54, 0x21, 0x09, 0xFD,
0xC3, 0x72, 0x8A, 0x6E, 0x95, 0x14, 0x29, 0x8A,
0x07, 0x9F, 0xBE, 0x0A, 0x87, 0xDE, 0xBA, 0xC8,
0xD0, 0x31, 0x2A, 0x94, 0x0B, 0xB6, 0xF6, 0xA6,
0x15, 0xE6, 0x22, 0xA8, 0x54, 0x72, 0x03, 0x49,
0x28, 0xCD, 0x9C, 0x1E, 0x16, 0x2A, 0x0A, 0x20,
0x8B, 0xCA, 0xA4, 0xDA, 0xEA, 0xDF, 0x3B, 0x72,
0x4F, 0xEF, 0xF4, 0x54, 0xA6, 0xF3, 0x5A, 0xD5,
0x4C, 0x8E, 0xFE, 0x07, 0xA6, 0xAA, 0xE6, 0x6E,
0x95, 0x53, 0x18, 0x1F, 0x12, 0xBE, 0x56, 0x97,
0x4D, 0x60, 0xE1, 0x43, 0x23, 0x66, 0x23, 0x35,
0x2D, 0x7C, 0x94, 0x32, 0xE4, 0xF0, 0xFB, 0x96,
0x8C, 0x69, 0xEB, 0xFB, 0xE0, 0x38, 0x45, 0x94,
0x62, 0xC8, 0xBF, 0xB8, 0x15, 0x5B, 0x2F, 0x1F,
0x4B, 0xA4, 0xAC, 0xD9, 0x09, 0xAD, 0xF9, 0xA3,
0xB5, 0x68, 0xE6, 0xB3, 0x06, 0x5F, 0x21, 0x6D,
0x93, 0xF6, 0x36, 0x65, 0xF6, 0x4A, 0xA2, 0x1F,
0x9B, 0x01, 0x27, 0x37, 0x20, 0x61, 0x33, 0x61,
0xA3, 0xF0, 0xD7, 0x1C, 0xA1, 0x79, 0x2E, 0x2D,
0xBB, 0xDC, 0x4D, 0x69, 0x16, 0x20, 0xE0, 0x4D,
0x1E, 0x6E, 0x82, 0x74, 0x0E, 0x89, 0x5B, 0x33,
0xF8, 0x16, 0xD6, 0x92, 0xE3, 0xF0, 0x06, 0xAF,
0x38, 0xA7, 0x82, 0xF8, 0x96, 0x9C, 0x13, 0xF5,
0xE4, 0x81, 0x2D, 0x90, 0x9F, 0x9F, 0x51, 0x1A,
0x9B, 0xF6, 0x1A, 0x78, 0xD6, 0xF7, 0xCC, 0x07,
0x3A, 0xA3, 0x1A, 0x91, 0x61, 0x14, 0x00, 0x59,
0xF5, 0x9A, 0x72, 0x32, 0x0A, 0xD6, 0x3B, 0xC2,
0x47, 0x36, 0xE3, 0xE4, 0xAA, 0xD9, 0x8A, 0x65,
0x7B, 0xC8, 0x7F, 0x96, 0xB9, 0xC0, 0xA7, 0xF2,
0x55, 0xAD, 0x67, 0x2C, 0x14, 0x0C, 0xDF, 0xC9,
0x4E, 0x36, 0xA3, 0x22, 0xAD, 0xA7, 0x5A, 0x5D,
0xD6, 0xD1, 0xB4, 0xD9, 0x69, 0x39, 0x80, 0x25,
0x97, 0x0D, 0x7F, 0xF7, 0x76, 0x08, 0x29, 0x04,
0x5A, 0xA4, 0x12, 0x4A, 0x29, 0xD9, 0xB9, 0x74,
0x27, 0x40, 0x5A, 0xC6, 0x66, 0xFF, 0xB2, 0x41,
0x9F, 0x0B, 0x84, 0xF2, 0x8B, 0x5F, 0x8E, 0xB9,
0x04, 0x1E, 0x70, 0xFD, 0xAD, 0xBD, 0x03, 0x0C,
0x50, 0x96, 0x2C, 0x80, 0x80, 0xCD, 0xA0, 0x87,
0xB0, 0xBC, 0xF0, 0xB1, 0x77, 0x30, 0xB1, 0xCA,
0xD4, 0xDA, 0xCA, 0xB6, 0xF6, 0xEB, 0xA5, 0x1E,
0x77, 0x6F, 0x2A, 0x6A, 0xA9, 0x45, 0xEF, 0x1B,
0x11, 0x2C, 0x5E, 0xEE, 0x3C, 0x53, 0xF9, 0x37,
0xDB, 0xA1, 0x42, 0x4F, 0x3B, 0x5D, 0xE0, 0xE4,
0xCE, 0x90, 0xD3, 0x90, 0x20, 0x0C, 0x19, 0x7F,
0x05, 0x7A, 0xF7, 0xBE, 0x6E, 0xE3, 0xAA, 0x64,
0x91, 0x41, 0x79, 0x48, 0xA5, 0x72, 0x42, 0xBF,
0xE2, 0x3F, 0x99, 0x8E, 0x89, 0x9B, 0x7E, 0xA9,
0x44, 0xEA, 0x99, 0x32, 0xEF, 0xC7, 0x91, 0x84,
0xEB, 0x6F, 0x48, 0xCF, 0x56, 0x62, 0x60, 0xB5,
0xFB, 0x3A, 0x40, 0x25, 0x86, 0x08, 0x4E, 0x30,
0x8B, 0xEE, 0x82, 0x61, 0x1C, 0xA3, 0x8B, 0x94,
0xBC, 0x25, 0x1E, 0x14, 0xA9, 0x7D, 0xFD, 0x03,
0x4F, 0xE6, 0xB3, 0xD5, 0x96, 0xB9, 0x3F, 0xDC,
0x50, 0x1B, 0x2B, 0x40, 0x00, 0xDD, 0xB8, 0x60,
0x8E, 0xB5, 0xBB, 0x90, 0xED, 0x93, 0x71, 0x91,
0x4A, 0x9E, 0x92, 0xB1, 0x15, 0x69, 0xC2, 0x03,
0xD6, 0xB5, 0xED, 0x95, 0xA5, 0x0B, 0x6E, 0x52,
0xFB, 0x14, 0xDE, 0x1C, 0x3F, 0x99, 0xA0, 0x58,
0x4F, 0x26, 0x8A, 0x86, 0xC9, 0xE1, 0x2A, 0x5B,
0xA5, 0x0D, 0x4A, 0x05, 0x17, 0x01, 0x88, 0xA9,
0x6D, 0x52, 0xAA, 0x7C, 0x9C, 0x22, 0x06, 0x33,
0x33, 0x3D, 0x6E, 0xD4, 0x79, 0xF8, 0x16, 0x9B,
0x0C, 0x5F, 0x37, 0xBE, 0x8B, 0x7C, 0x82, 0x3D,
0x3B, 0xC9, 0xB9, 0xDD, 0x55, 0x8D, 0xFE, 0x6F,
0x06, 0x80, 0x16, 0x88, 0x06, 0xDE, 0x55, 0xFA,
0xC9, 0xB6, 0x91, 0x3E, 0x73, 0x47, 0x6D, 0xE9,
0xD3, 0x5F, 0xEE, 0x03, 0x5F, 0x14, 0x4A, 0xF0,
0x85, 0xAA, 0xAE, 0xCB, 0x0E, 0x41, 0x72, 0xF6,
0x71, 0x20, 0x3B, 0x9C, 0x6E, 0xB4, 0xB6, 0xD8,
0x62, 0xEB, 0xC6, 0x79, 0xA6, 0xB0, 0x02, 0x84,
0x95, 0xE3, 0xA0, 0xE8, 0x33, 0xF1, 0x33, 0xAE,
0xC2, 0xC6, 0x3B, 0xE0, 0x6C, 0x80, 0xAD, 0x66,
0x47, 0x67, 0x79, 0x48, 0xB6, 0x93, 0x9F, 0xCC,
0x4C, 0xB2, 0x1B, 0x77, 0x48, 0x4C, 0xAB, 0x7D,
0xD2, 0xCB, 0xC0, 0xC0, 0xD7, 0x92, 0x4E, 0x16,
0x03, 0xA8, 0x3E, 0x69, 0xAE, 0xDC, 0x00, 0x86,
0x47, 0x0B, 0x26, 0x9B, 0x08, 0x06, 0xF8, 0x9C,
0x5A, 0xE9, 0x57, 0xAB, 0x45, 0xDA, 0xAB, 0x0D,
0x84, 0xEE, 0x07, 0x86, 0xE0, 0xB4, 0x66, 0x06,
0xB7, 0xAE, 0x55, 0x22, 0x7A, 0xEC, 0x56, 0xE9,
0xFF, 0x35, 0xA3, 0x76, 0x82, 0x9E, 0x6C, 0x92,
0xB5, 0xCF, 0x29, 0x6D, 0x5C, 0x59, 0x50, 0xD7,
0xD8, 0x37, 0xA3, 0xD1, 0x76, 0xAF, 0x59, 0xCC,
0x0F, 0xEA, 0x22, 0x89, 0xED, 0x04, 0xDD, 0xD4,
0x40, 0xD5, 0xAA, 0xC8, 0x77, 0xAE, 0xE1, 0xE8,
0x76, 0x0B, 0xE4, 0x3B, 0x22, 0x5E, 0xC1, 0xFD,
0x38, 0x29, 0x1A, 0x76, 0x57, 0x53, 0xE8, 0x97,
0x4E, 0x60, 0x96, 0x51, 0xF6, 0x5C, 0xDC, 0x81,
0xF3, 0xC3, 0x7A, 0xA8, 0xBE, 0x37, 0x83, 0xB8,
0x35, 0xCD, 0xCF, 0x3D, 0xBE, 0x76, 0xC2, 0x75,
},
P = new byte[]
{
0xCA, 0x4D, 0x00, 0x39, 0x39, 0x5E, 0x40, 0xCA,
0x7C, 0x2B, 0xDE, 0xE0, 0xDD, 0x98, 0xEB, 0xB5,
0xF5, 0x8E, 0xAD, 0x22, 0x3F, 0xC4, 0x47, 0xD4,
0x4B, 0x7D, 0xFA, 0xCA, 0x9D, 0x5A, 0xE2, 0xD4,
0x10, 0x1E, 0x7E, 0x7D, 0x04, 0xFC, 0xB9, 0x1D,
0xF4, 0x10, 0xC5, 0x8B, 0xC7, 0x43, 0xE1, 0x4E,
0x39, 0x4E, 0x23, 0x22, 0x95, 0xB0, 0x3A, 0x3B,
0xFF, 0x7C, 0xF2, 0x34, 0x2C, 0xDC, 0x76, 0xD7,
0xD4, 0xBC, 0x67, 0xE3, 0x3F, 0xEF, 0xEA, 0x6E,
0x64, 0xF1, 0x54, 0x51, 0x08, 0x21, 0x8E, 0xC3,
0x11, 0x93, 0x1B, 0x20, 0x5C, 0x07, 0x03, 0x5B,
0x60, 0x7F, 0x90, 0x34, 0x83, 0xD4, 0x0E, 0xF6,
0x05, 0xDA, 0xD9, 0xD6, 0x7A, 0x0B, 0x12, 0xDF,
0x8E, 0xF0, 0x43, 0x0F, 0xD0, 0x77, 0x57, 0x50,
0x0E, 0xE5, 0x84, 0x50, 0x28, 0xFE, 0x4F, 0x63,
0x68, 0xAE, 0x92, 0xF9, 0xD5, 0xB5, 0x83, 0xBB,
0x44, 0x44, 0x66, 0xF2, 0x36, 0xE5, 0x5A, 0x75,
0x13, 0x05, 0x8F, 0xF5, 0x79, 0x23, 0xAA, 0x8A,
0xCC, 0x31, 0x36, 0xBC, 0x35, 0x25, 0x09, 0x10,
0x03, 0xEA, 0x9B, 0x3F, 0x0B, 0x65, 0xFD, 0xA7,
0xC3, 0x69, 0xC6, 0xAA, 0x30, 0x7A, 0xAA, 0x79,
0x6D, 0x80, 0xCA, 0xF2, 0x09, 0xF6, 0xED, 0xA8,
0x83, 0xF8, 0x58, 0xA2, 0xD7, 0x46, 0x79, 0x8B,
0xC3, 0x83, 0x51, 0xC6, 0x04, 0x68, 0x12, 0x4D,
0xD9, 0x85, 0xE2, 0x80, 0x14, 0xEE, 0x2A, 0x9A,
0x06, 0xC0, 0x5A, 0x64, 0xBB, 0x88, 0x37, 0x79,
0xB0, 0x4A, 0x57, 0x17, 0x59, 0x74, 0x7E, 0x05,
0x15, 0xA6, 0x7E, 0x02, 0x60, 0xCB, 0x9B, 0x13,
0x04, 0x2F, 0x28, 0x83, 0x16, 0xEA, 0xC2, 0xBB,
0x14, 0xAF, 0x66, 0x1B, 0x52, 0x05, 0x15, 0x38,
0x34, 0xF7, 0xC3, 0xEE, 0x32, 0x41, 0x38, 0x47,
0xFC, 0xE1, 0xBB, 0x25, 0x30, 0x7E, 0xA0, 0x56,
0xB7, 0x3F, 0xB6, 0xE5, 0x76, 0xC6, 0x77, 0x46,
0xC8, 0xA9, 0x3C, 0x21, 0x2B, 0x85, 0x42, 0x3D,
0x9E, 0x76, 0x45, 0xCD, 0x69, 0x8C, 0xB1, 0xE6,
0x46, 0x8C, 0x7B, 0xEE, 0x52, 0x9F, 0x57, 0x12,
0xB2, 0xF0, 0xF4, 0x43, 0xAE, 0x7E, 0x8F, 0x22,
0xE5, 0x59, 0xBB, 0xF7, 0xCE, 0xE3, 0x99, 0xE4,
0x6F, 0x3D, 0xF4, 0xD3, 0x6E, 0xD4, 0xF0, 0xD0,
0x9F, 0x95, 0x3F, 0x7A, 0xFF, 0x24, 0x82, 0x63,
0x6C, 0xA6, 0x72, 0xCC, 0x22, 0x20, 0x79, 0xF7,
0x38, 0xEA, 0x96, 0xD1, 0xAA, 0xCD, 0xF3, 0xF6,
0x73, 0xAA, 0x69, 0x01, 0x19, 0x9C, 0x17, 0x58,
0xD2, 0x96, 0x25, 0x9D, 0xB4, 0x85, 0xCF, 0x39,
0xBA, 0xF2, 0xFF, 0xCD, 0xCA, 0xC0, 0x98, 0x3D,
0xA3, 0x69, 0x58, 0x11, 0x4A, 0xA0, 0xD9, 0x75,
0x5A, 0x50, 0x69, 0x95, 0xE6, 0xC3, 0x36, 0x51,
0x2E, 0x5B, 0x7A, 0x78, 0xB3, 0x13, 0xF1, 0xA4,
0xDA, 0x3B, 0x22, 0xCB, 0x70, 0x33, 0x59, 0x34,
0x63, 0x4E, 0x67, 0x72, 0xA4, 0xF2, 0xEA, 0x14,
0xB6, 0xC2, 0x21, 0x83, 0xE2, 0x48, 0x46, 0x90,
0xEB, 0xB0, 0x2C, 0x76, 0xB6, 0xAF, 0xEE, 0xE8,
0x9F, 0x15, 0x4F, 0x01, 0x42, 0x7C, 0xF6, 0xBD,
0xC0, 0xC3, 0x78, 0xC6, 0xF9, 0xE0, 0xB9, 0x4B,
0x26, 0x2F, 0xB0, 0x4D, 0x40, 0x5D, 0xDE, 0x0B,
0xA1, 0xB9, 0x01, 0x38, 0xB4, 0xE4, 0xB7, 0x3B,
0x8D, 0xEE, 0xC6, 0x62, 0xA7, 0x97, 0x5A, 0x50,
0x56, 0x62, 0xF9, 0xAD, 0xAD, 0x10, 0x7F, 0xB9,
0x3B, 0x7B, 0x20, 0xC1, 0xAF, 0x81, 0x11, 0x50,
0x70, 0xA7, 0xC2, 0xC4, 0x8D, 0x37, 0x9C, 0xD1,
0xB4, 0x64, 0x9B, 0xE4, 0xFE, 0x0D, 0xA3, 0xC1,
0xC4, 0x75, 0x51, 0x78, 0x23, 0x3F, 0x1B, 0xCF,
0x0E, 0x21, 0x09, 0x71, 0x3C, 0xC9, 0xBF, 0xBC,
0x0E, 0x42, 0x93, 0x01, 0x5D, 0x96, 0xF5, 0x8D,
0x9D, 0x81, 0xEE, 0x50, 0x03, 0x02, 0x83, 0xE9,
0xD4, 0xEC, 0x16, 0x09, 0x0D, 0x36, 0x0A, 0x56,
0xAE, 0xA3, 0xC7, 0x43, 0x68, 0xA7, 0x8E, 0xEA,
0x2A, 0xB5, 0x77, 0xED, 0x0A, 0xD4, 0x41, 0xE4,
0x11, 0xA6, 0xF8, 0x04, 0x9E, 0xB3, 0x2E, 0x98,
0xC3, 0x18, 0x78, 0xBD, 0xBD, 0x8E, 0x8B, 0xB6,
0x9E, 0x98, 0xB5, 0x6D, 0x0F, 0xEF, 0xDC, 0x12,
0x22, 0x1C, 0xBC, 0x4A, 0x7B, 0xFF, 0xD7, 0xC6,
0x0B, 0x67, 0xB0, 0xA3, 0xA5, 0x04, 0xF7, 0xC1,
0x85, 0xD6, 0xEB, 0x74, 0xEC, 0x8B, 0x4A, 0x03,
0x7C, 0x06, 0x27, 0x56, 0xD8, 0x45, 0xD9, 0x2E,
0x30, 0x64, 0xEE, 0x3C, 0x80, 0x38, 0xBC, 0x20,
0xC3, 0x03, 0x98, 0x1F, 0xD3, 0xDC, 0x9A, 0x94,
0x34, 0xF2, 0x87, 0x61, 0x2A, 0x38, 0x7C, 0xDC,
0x43, 0xB9, 0xA6, 0x26, 0x11, 0x54, 0x8E, 0x6B,
0x9B, 0x60, 0x5A, 0x6B, 0xB8, 0x3D, 0x68, 0x3F,
0x5C, 0x6E, 0x16, 0xE1, 0x54, 0xBA, 0x4D, 0xEE,
0x21, 0xFA, 0x71, 0xCD, 0xEC, 0x8A, 0x96, 0xCF,
0xD3, 0x50, 0x54, 0x53, 0xC4, 0xBF, 0x9D, 0x10,
0x4B, 0xD3, 0x33, 0x02, 0x3C, 0xC6, 0x3F, 0xA9,
0xC3, 0x5C, 0x04, 0x87, 0xC2, 0xA7, 0x99, 0x09,
0x72, 0x74, 0x03, 0x5B, 0xA3, 0x52, 0x5A, 0x71,
0xCB, 0x6F, 0x24, 0x8D, 0xCB, 0xCB, 0xE3, 0x17,
0x90, 0xE5, 0xEC, 0x7B, 0xBC, 0x85, 0xD5, 0x60,
0x24, 0x88, 0xB3, 0x6D, 0x0B, 0xA3, 0xBD, 0x43,
0xDA, 0x44, 0xD6, 0xED, 0xCC, 0xC0, 0x1F, 0x6C,
0x4B, 0x9C, 0x71, 0x63, 0x60, 0x0A, 0xEC, 0x73,
0xCF, 0xD1, 0x1D, 0x70, 0x9E, 0xAA, 0xBD, 0x7C,
0xFE, 0x21, 0x46, 0x47, 0xAB, 0x21, 0x46, 0x04,
0x56, 0x4E, 0x6A, 0xA5, 0xC9, 0xD0, 0x6B, 0xCB,
0xBA, 0xD4, 0xE4, 0xFC, 0x6C, 0x03, 0xA2, 0xF2,
0x22, 0x11, 0x25, 0x85, 0x6D, 0x0B, 0x52, 0xB8,
0x6F, 0x42, 0x15, 0x6E, 0x9C, 0xA2, 0x67, 0xFD,
0x16, 0x60, 0x4B, 0x6D, 0xF0, 0x2E, 0xAB, 0xBA,
0x66, 0x42, 0x45, 0x7E, 0x7C, 0x9A, 0xB6, 0xF8,
0x33, 0x3F, 0xB2, 0x5A, 0x9C, 0x75, 0x7C, 0xD4,
0xDE, 0x4A, 0xD6, 0xD6, 0x7E, 0xCA, 0x54, 0xE0,
0x5A, 0xA8, 0x57, 0x0C, 0xF9, 0x53, 0x08, 0xD1,
0x05, 0x9D, 0x92, 0xB5, 0xE3, 0x24, 0x75, 0xF9,
0x42, 0x7F, 0x2C, 0xF7, 0x2B, 0x06, 0x13, 0x44,
0x91, 0x40, 0xE2, 0x18, 0x49, 0x02, 0xA3, 0xA8,
0xFB, 0xFC, 0x05, 0x89, 0x75, 0xBF, 0x4D, 0x27,
0x43, 0x44, 0xB7, 0xD7, 0xE5, 0x13, 0x33, 0x1A,
0x6A, 0xC2, 0x20, 0x67, 0x56, 0x3F, 0x25, 0x2B,
0x8F, 0xCD, 0x74, 0xFA, 0x0F, 0x77, 0x8C, 0x81,
0x5E, 0x88, 0xA0, 0x0C, 0x33, 0x7A, 0xBA, 0xE1,
0x63, 0xB7, 0x94, 0x28, 0x29, 0xEC, 0x0D, 0xEF,
0x80, 0x3B, 0x6F, 0x9E, 0x80, 0xC0, 0xCF, 0x53,
0xDB, 0xB9, 0xB1, 0x93, 0x23, 0x1D, 0x99, 0x40,
0x3A, 0x7D, 0xB0, 0x87, 0x67, 0x93, 0x25, 0x27,
0xB1, 0x73, 0xA1, 0x44, 0x3F, 0xDC, 0x42, 0x72,
0x3C, 0x5F, 0x5C, 0x2C, 0x83, 0x50, 0xFA, 0x15,
0x5B, 0x0B, 0xFB, 0x0A, 0x41, 0xF8, 0x85, 0xC8,
0x0F, 0xF0, 0xEB, 0xBE, 0xCD, 0x84, 0xEF, 0xF2,
0x77, 0xED, 0x73, 0xAA, 0xBC, 0x77, 0x2B, 0x9D,
0x3A, 0x62, 0xC5, 0x08, 0x61, 0x4A, 0xD9, 0xDD,
0x37, 0x88, 0x33, 0xC3, 0xA4, 0xB0, 0xDC, 0xA7,
0x8B, 0xA5, 0xF5, 0x5C, 0xCF, 0xFF, 0x0C, 0x03,
0x11, 0xCF, 0xAB, 0xB4, 0x34, 0xC0, 0x28, 0xAE,
0x12, 0xAA, 0x3A, 0x42, 0x10, 0x46, 0x11, 0x2D,
0xF9, 0xA5, 0x45, 0x2C, 0x81, 0x9B, 0xDC, 0x4E,
0x57, 0xCC, 0x13, 0xB4, 0xC2, 0x1B, 0x99, 0xA1,
0xE9, 0x71, 0x45, 0x9A, 0x2E, 0x7D, 0xF2, 0x98,
0xDE, 0xDA, 0x70, 0x53, 0x63, 0xE1, 0x29, 0xBF,
},
DP = new byte[]
{
0x18, 0x12, 0xF7, 0xBE, 0xD7, 0x93, 0xDE, 0xD3,
0xF9, 0xD8, 0xE2, 0xAA, 0x11, 0xD4, 0xDB, 0xE0,
0x08, 0x7B, 0xD5, 0x20, 0xA9, 0x43, 0xFB, 0x64,
0x49, 0x23, 0x91, 0xCF, 0xC0, 0xD0, 0x0B, 0x04,
0x3F, 0x72, 0xD1, 0x8C, 0xA1, 0x26, 0x4E, 0x05,
0x41, 0x81, 0x29, 0x71, 0x0B, 0xE2, 0x89, 0x12,
0x5D, 0x01, 0x6E, 0x6E, 0xF4, 0x2F, 0x47, 0x8E,
0xD2, 0x45, 0x95, 0x31, 0x1E, 0x51, 0x92, 0x16,
0xF7, 0x2B, 0x00, 0x95, 0xEB, 0x8A, 0xEA, 0x73,
0xFE, 0xB1, 0x35, 0x5E, 0x7B, 0x40, 0x3B, 0x13,
0xFD, 0xA8, 0x6A, 0xE6, 0xFB, 0xEC, 0x9D, 0xBA,
0xA7, 0x0E, 0x27, 0x24, 0x08, 0xB8, 0x18, 0x9B,
0xB0, 0x70, 0xAD, 0xD1, 0xB7, 0x2E, 0x50, 0x2D,
0xA8, 0x7D, 0xF1, 0x0D, 0x15, 0xBA, 0xCD, 0xFA,
0x29, 0xFB, 0xA8, 0x36, 0x3D, 0xDA, 0x9D, 0xA9,
0xEF, 0xD0, 0x2E, 0x8F, 0x6A, 0x9E, 0x32, 0x31,
0xFB, 0xDA, 0xC4, 0x01, 0x79, 0x04, 0xEC, 0x31,
0xD8, 0x74, 0xA6, 0x00, 0x09, 0x4D, 0x74, 0x43,
0x16, 0x2F, 0x99, 0x1A, 0xE6, 0x9C, 0x24, 0xAA,
0xF2, 0x3C, 0x5E, 0x03, 0x2F, 0xA1, 0x10, 0x81,
0x81, 0x60, 0xBA, 0x12, 0x90, 0xB8, 0x58, 0x47,
0x20, 0xFF, 0xDD, 0xA6, 0xD6, 0x06, 0xBB, 0x9B,
0x7D, 0x30, 0xF5, 0xA3, 0x53, 0x49, 0x00, 0xB7,
0xE0, 0x29, 0x65, 0x76, 0xD2, 0x19, 0x6C, 0x6C,
0x35, 0x41, 0x98, 0x85, 0xB3, 0x77, 0xF0, 0x3B,
0xEA, 0x27, 0xC3, 0xDA, 0x0E, 0xF3, 0x13, 0xDE,
0xF8, 0x5A, 0xB0, 0x68, 0x87, 0xED, 0xB3, 0xFD,
0x78, 0xE9, 0x1A, 0x3F, 0xC0, 0x33, 0x1A, 0x9E,
0x35, 0xB6, 0x42, 0xF4, 0xEE, 0xAA, 0x3B, 0x48,
0x36, 0x1A, 0xF5, 0x64, 0xB4, 0xEB, 0x03, 0xEE,
0x6F, 0x67, 0x38, 0xBA, 0xC4, 0xE2, 0x3C, 0x07,
0x5D, 0x11, 0xA3, 0xCA, 0xB6, 0x2D, 0xAB, 0x79,
0x06, 0x4F, 0x9F, 0xBD, 0x48, 0xD8, 0x2F, 0x63,
0x8E, 0x07, 0x8D, 0xAF, 0x48, 0xD5, 0x8F, 0xDF,
0x73, 0x57, 0x11, 0xD1, 0x73, 0x09, 0x1A, 0x36,
0x94, 0x18, 0xAD, 0xBA, 0xDB, 0xBC, 0x38, 0x89,
0x72, 0x1F, 0xF8, 0x81, 0x81, 0x67, 0x70, 0x33,
0x2F, 0xE5, 0xF0, 0xD7, 0x79, 0x98, 0x5E, 0x3C,
0xEF, 0xFC, 0x08, 0x81, 0x8C, 0xC3, 0xEC, 0x70,
0x77, 0x3D, 0x34, 0x93, 0xB7, 0x7F, 0x29, 0xC1,
0x19, 0x31, 0xE9, 0xA1, 0x5F, 0x42, 0x4C, 0x21,
0x5E, 0x75, 0x94, 0x43, 0x19, 0x37, 0x6F, 0x1B,
0xDA, 0x01, 0xE2, 0x83, 0x0E, 0x00, 0x24, 0x4B,
0x1E, 0xAC, 0x5D, 0x87, 0x99, 0xEE, 0xFE, 0x8D,
0x19, 0x31, 0x47, 0xBD, 0xBE, 0xAE, 0x12, 0xAF,
0xEB, 0x1D, 0x63, 0x2C, 0x93, 0x9B, 0xF6, 0xA4,
0xDF, 0x7D, 0x88, 0x43, 0x1D, 0x76, 0x07, 0xA5,
0xBB, 0x85, 0x89, 0x5A, 0x89, 0xBD, 0x0A, 0xD9,
0x9A, 0x5A, 0xC5, 0x36, 0x3E, 0x80, 0xED, 0xD1,
0xAD, 0x2B, 0xAC, 0x65, 0xD9, 0x39, 0x4B, 0x1F,
0xF1, 0xEB, 0xC2, 0x3F, 0x46, 0x93, 0x61, 0x4A,
0x67, 0xB1, 0xCC, 0x68, 0xC8, 0x2E, 0xC1, 0x98,
0x8F, 0x2D, 0xE2, 0xFB, 0xFC, 0x64, 0x90, 0x9C,
0x5E, 0x2F, 0x24, 0xD5, 0x50, 0xF1, 0x2C, 0x3B,
0xC4, 0x2C, 0x92, 0xA7, 0x6E, 0xCC, 0x7C, 0xDB,
0x17, 0x80, 0xC3, 0xA3, 0x72, 0xEB, 0x70, 0xDE,
0xB6, 0x72, 0x3E, 0xCB, 0x88, 0xB4, 0x1B, 0x3C,
0x4A, 0x3B, 0x77, 0x08, 0xF2, 0xFA, 0x6E, 0xA8,
0xA5, 0x6A, 0x6E, 0xA8, 0x7D, 0xF1, 0x37, 0x15,
0x42, 0x82, 0xC4, 0x4B, 0xCD, 0x9E, 0x5B, 0x9C,
0x1D, 0x02, 0x88, 0x06, 0xC5, 0x30, 0xEC, 0x56,
0xE7, 0xC1, 0x2A, 0x53, 0xC8, 0xA5, 0xFE, 0xF2,
0x31, 0xF5, 0x3E, 0x81, 0x6A, 0x41, 0x7B, 0xFE,
0xAE, 0x17, 0xC0, 0x14, 0xBE, 0x85, 0x73, 0x6D,
0x49, 0xDC, 0x27, 0x77, 0x00, 0x14, 0xB1, 0x8C,
0x07, 0x19, 0x9D, 0x39, 0xB0, 0x87, 0xC8, 0xCD,
0x2D, 0xF5, 0x31, 0x86, 0x55, 0x12, 0xF3, 0x8F,
0xEC, 0x4B, 0x32, 0x1D, 0x54, 0x57, 0x94, 0x0B,
0xC7, 0x09, 0xFE, 0xA3, 0xD6, 0x1A, 0xEE, 0xA5,
0xA1, 0x39, 0xED, 0x4C, 0x6F, 0x1D, 0x62, 0x84,
0xF5, 0xF4, 0xA8, 0x4A, 0x75, 0x46, 0x0F, 0x03,
0x5D, 0x69, 0xDC, 0x02, 0x65, 0x25, 0x3A, 0x11,
0x48, 0x54, 0x2B, 0x92, 0x1D, 0xD6, 0x2C, 0x81,
0xAC, 0x22, 0xBA, 0x5C, 0x6C, 0xB5, 0xDA, 0xB5,
0xF5, 0x71, 0x6A, 0x07, 0x0C, 0xAF, 0xAB, 0x3B,
0xB2, 0xE8, 0x9F, 0xED, 0x35, 0x39, 0x0B, 0x32,
0x3E, 0xE2, 0xD3, 0x9C, 0x9E, 0x02, 0xB7, 0xA6,
0x81, 0x72, 0x87, 0x27, 0xC9, 0xF5, 0x74, 0xEE,
0x65, 0x64, 0xD7, 0x5F, 0xDA, 0x5A, 0x1C, 0xA4,
0xB3, 0x95, 0xD0, 0xCC, 0xD6, 0xDC, 0xFF, 0xE5,
0xE2, 0x62, 0xFB, 0x78, 0x0F, 0x34, 0x28, 0x87,
0xF9, 0x25, 0x2B, 0x9B, 0xDC, 0xD5, 0x55, 0x43,
0x20, 0x1B, 0x84, 0x1D, 0x7F, 0xE1, 0x69, 0x98,
0x81, 0xDD, 0x7D, 0x49, 0x7B, 0xDF, 0xFF, 0xBD,
0x7D, 0x11, 0x1B, 0x3C, 0xE8, 0xAE, 0x37, 0x29,
0x07, 0xA4, 0xC4, 0xAD, 0x88, 0x0F, 0x09, 0xD2,
0x56, 0xEA, 0x40, 0x08, 0x5B, 0xC3, 0x44, 0xA0,
0x0E, 0x4F, 0x3E, 0x48, 0x2F, 0x54, 0x21, 0xE3,
0x52, 0x15, 0xAE, 0x7C, 0x80, 0x91, 0x18, 0xB9,
0xD5, 0x64, 0xB1, 0xCB, 0x14, 0xBD, 0x9C, 0x3F,
0xAF, 0xF3, 0xCB, 0x0E, 0x8F, 0x64, 0x5D, 0x65,
0x1E, 0xCA, 0xFC, 0xDC, 0xE5, 0x14, 0xDE, 0x7D,
0xDC, 0x64, 0x2B, 0x4F, 0xE6, 0x0E, 0x8C, 0x9D,
0x81, 0x83, 0xCD, 0x6F, 0x33, 0x48, 0x09, 0x3B,
0xF2, 0x5C, 0xD9, 0x6F, 0x2C, 0x8F, 0x76, 0x39,
0xA8, 0x52, 0x30, 0x0B, 0xE3, 0xC1, 0x20, 0x33,
0xF0, 0x91, 0x85, 0xA9, 0x67, 0x1C, 0x70, 0x91,
0x8E, 0xB3, 0x20, 0xE6, 0xD1, 0x59, 0x4C, 0x78,
0x5F, 0x28, 0xED, 0xCA, 0x32, 0x9B, 0xDA, 0xC0,
0x48, 0xA1, 0x00, 0xE1, 0x85, 0x92, 0xF9, 0xAA,
0xFF, 0x55, 0x1A, 0xA1, 0xE5, 0xEE, 0xC0, 0x10,
0xFE, 0xD8, 0xDF, 0x9B, 0x1C, 0xA4, 0x83, 0xFD,
0x13, 0xD4, 0xFF, 0x9B, 0x83, 0x8F, 0x58, 0x36,
0xB4, 0x72, 0x1B, 0xF0, 0xC1, 0xFE, 0xF4, 0x16,
0x09, 0xCF, 0x15, 0xD8, 0xDB, 0xFF, 0x63, 0x68,
0x7D, 0xAC, 0x2D, 0x20, 0x81, 0x91, 0xA5, 0x65,
0xD1, 0xBC, 0x80, 0xC0, 0x41, 0x73, 0x7A, 0x76,
0x5F, 0x54, 0x00, 0xB5, 0x2B, 0x6F, 0x52, 0x46,
0x0F, 0xD3, 0xDC, 0x62, 0xD1, 0xAA, 0x61, 0x5F,
0x17, 0xD7, 0xDC, 0x6B, 0xF7, 0x48, 0x58, 0xAA,
0xEF, 0xC9, 0xED, 0xE8, 0xA5, 0xAC, 0x80, 0xB0,
0x0A, 0xAB, 0x88, 0x09, 0xED, 0xBA, 0x84, 0x31,
0xAF, 0x89, 0x36, 0x97, 0x92, 0xEB, 0x37, 0xCC,
0x8B, 0xE9, 0x5F, 0x33, 0x8D, 0xE0, 0xD5, 0xE0,
0x16, 0x5E, 0xF3, 0x47, 0x02, 0xEE, 0x7C, 0x3D,
0xC9, 0xEF, 0x73, 0x31, 0x9C, 0xE2, 0xEB, 0x0F,
0xD5, 0x88, 0xE4, 0x74, 0x01, 0x0B, 0xC9, 0x27,
0xD8, 0xB5, 0xCB, 0xE8, 0x25, 0xDE, 0xF7, 0x0A,
0xFC, 0xB8, 0x96, 0x36, 0x30, 0x3D, 0x62, 0x44,
0x50, 0xA9, 0x66, 0x57, 0x2B, 0xF4, 0xD3, 0x5E,
0x5E, 0xF8, 0x67, 0x68, 0x95, 0xD5, 0xB2, 0x3C,
0x82, 0x02, 0xDA, 0xE3, 0x13, 0xA1, 0x7F, 0x55,
0x72, 0x2E, 0x2B, 0x79, 0xC3, 0x79, 0x46, 0x9E,
0x08, 0x7C, 0x97, 0x78, 0x3B, 0x25, 0x8B, 0x6F,
0xD4, 0x30, 0x95, 0xBD, 0xC9, 0x22, 0xBA, 0x21,
0xDC, 0x92, 0xDD, 0x99, 0x7A, 0x2B, 0xFC, 0xA9,
0x66, 0xF5, 0x62, 0xDA, 0x09, 0x44, 0x55, 0xB5,
0x59, 0x77, 0xD7, 0x3C, 0x25, 0x3B, 0xAB, 0x53,
},
Q = new byte[]
{
0xC4, 0x5C, 0xFD, 0xC2, 0x75, 0xB0, 0x8E, 0x6B,
0x0B, 0x8A, 0xCE, 0xCD, 0x4B, 0x98, 0xEA, 0x40,
0x0C, 0xAB, 0xDB, 0x9A, 0xF9, 0x5F, 0x57, 0xA6,
0x5B, 0x2C, 0x0D, 0xAB, 0xC6, 0xAC, 0x6E, 0x14,
0xB9, 0x36, 0x29, 0xA3, 0x5D, 0xDA, 0x8D, 0x4E,
0x03, 0x84, 0xF2, 0xC8, 0x69, 0x45, 0x57, 0x62,
0x5C, 0xBD, 0xFC, 0xBE, 0x3A, 0x15, 0x71, 0xD9,
0x80, 0x7E, 0x9D, 0x42, 0x2C, 0xE7, 0x9F, 0xD4,
0x8D, 0x6A, 0x63, 0x0B, 0x83, 0x77, 0xAC, 0x71,
0x9B, 0x58, 0x1C, 0x94, 0x1F, 0x00, 0x39, 0x4F,
0x27, 0x93, 0xD5, 0x8A, 0x08, 0xF1, 0x94, 0x67,
0x08, 0xB1, 0xA2, 0xA8, 0xC8, 0x14, 0xE8, 0x33,
0x51, 0x07, 0xB2, 0x76, 0xA3, 0xEA, 0xCB, 0x81,
0x1D, 0x77, 0xAE, 0x24, 0xBD, 0xD1, 0xC3, 0xD3,
0x5E, 0xBE, 0x8C, 0xF3, 0x28, 0xA6, 0x0C, 0xB8,
0x44, 0xDC, 0x40, 0x83, 0x12, 0x3F, 0xB2, 0xF7,
0x0F, 0x75, 0x03, 0x42, 0x43, 0x99, 0x39, 0x47,
0x64, 0x6D, 0x33, 0xC4, 0xFE, 0xA6, 0xB7, 0xCE,
0xBF, 0xCC, 0xA2, 0x59, 0x9E, 0xFE, 0x5D, 0xEA,
0x22, 0xD8, 0x68, 0x1E, 0x99, 0xD2, 0x7E, 0x76,
0xBF, 0xEC, 0xED, 0x1A, 0x54, 0x0A, 0x98, 0x57,
0x1C, 0x63, 0xBD, 0xE0, 0xEF, 0x96, 0x71, 0x28,
0x83, 0x03, 0xDE, 0xC8, 0x8B, 0x6A, 0x39, 0xB9,
0x55, 0x35, 0x6E, 0x1A, 0x5D, 0x7C, 0x25, 0x29,
0x0D, 0x6D, 0x7B, 0xCD, 0x5C, 0x51, 0xCE, 0xE9,
0xD1, 0x89, 0xAA, 0x1A, 0xC5, 0x8B, 0x46, 0x96,
0x97, 0xB9, 0x09, 0xCD, 0x46, 0xFB, 0x2B, 0xCF,
0x0C, 0x0D, 0x9F, 0xE0, 0x10, 0x83, 0xBB, 0xF0,
0x86, 0x79, 0xCD, 0xAE, 0xCF, 0x19, 0xDF, 0x22,
0x62, 0x29, 0x70, 0xC4, 0x14, 0x83, 0x3A, 0xED,
0xF2, 0x5E, 0x19, 0x45, 0x33, 0xD4, 0x5F, 0x4D,
0x94, 0x50, 0x10, 0x1F, 0xE0, 0x46, 0x79, 0xB3,
0x0C, 0x54, 0x0E, 0x31, 0x85, 0xBF, 0xA7, 0xA0,
0xC4, 0x6A, 0xAF, 0x00, 0xBD, 0x88, 0x83, 0x67,
0x16, 0xE8, 0x4B, 0x1A, 0xAF, 0x5C, 0x19, 0xDA,
0x20, 0x43, 0xB1, 0x76, 0x9B, 0x6A, 0x63, 0x36,
0x30, 0xE7, 0x57, 0x40, 0x0C, 0xB3, 0x47, 0xCD,
0xC7, 0xB6, 0x97, 0xC8, 0x05, 0x7C, 0x0D, 0x9B,
0xD0, 0x34, 0xAA, 0x28, 0x29, 0x3F, 0xFB, 0x31,
0xBC, 0x23, 0xCA, 0x0D, 0x7F, 0x9F, 0x3E, 0xCF,
0x7E, 0x80, 0x32, 0x92, 0x29, 0xA0, 0xE7, 0xC5,
0x3B, 0xCD, 0x08, 0x80, 0x82, 0x6C, 0x01, 0x5D,
0x10, 0xC4, 0xB4, 0x7F, 0x08, 0xF5, 0x15, 0x4E,
0x03, 0x91, 0xBC, 0x7F, 0xC3, 0x1B, 0xED, 0x33,
0x3F, 0x44, 0xD6, 0x71, 0x3B, 0x1D, 0x85, 0x54,
0x8D, 0x9B, 0x9E, 0x38, 0xB7, 0x11, 0x50, 0x68,
0x64, 0xD7, 0xFB, 0x32, 0xB2, 0x64, 0x0C, 0xC8,
0x8B, 0x8D, 0x33, 0x9D, 0x9A, 0x44, 0x78, 0xE6,
0x08, 0x44, 0x0D, 0x62, 0x56, 0x85, 0x18, 0x9A,
0x48, 0x38, 0x48, 0xA3, 0x7A, 0xBE, 0xC5, 0x1A,
0xC6, 0x01, 0xE4, 0x62, 0xE7, 0x98, 0x4C, 0xB4,
0x3F, 0x73, 0xC5, 0xC8, 0x09, 0x73, 0x32, 0xFC,
0x95, 0x19, 0x41, 0x94, 0xAE, 0x0B, 0xA0, 0x52,
0x31, 0xA9, 0x3E, 0x71, 0x22, 0xB7, 0x13, 0x1D,
0x1E, 0xDA, 0xAD, 0x99, 0x46, 0x35, 0x1E, 0xC5,
0x90, 0x52, 0x82, 0x37, 0x3A, 0xA5, 0x49, 0xEF,
0xA7, 0x6E, 0x81, 0x00, 0x4B, 0x4A, 0xEB, 0x65,
0xCB, 0xFD, 0x2E, 0x4E, 0x83, 0x2C, 0xAB, 0x07,
0xD3, 0x15, 0x5B, 0xFB, 0xC4, 0x55, 0xDE, 0x93,
0x9A, 0x9E, 0xAC, 0x2F, 0x22, 0x24, 0x73, 0xE6,
0x58, 0xF0, 0x83, 0xA8, 0x78, 0x07, 0x29, 0x93,
0x17, 0x62, 0x83, 0xCB, 0x7F, 0x08, 0xD7, 0x3A,
0xA8, 0x32, 0xD9, 0xDC, 0x75, 0xB4, 0x09, 0xF0,
0x5D, 0x77, 0x42, 0x4D, 0xA1, 0xFF, 0xEF, 0x5C,
0xF1, 0x7F, 0xE4, 0x8C, 0x33, 0x1B, 0x94, 0x44,
0xB7, 0xD9, 0x87, 0x23, 0xDA, 0x6D, 0xD2, 0x0C,
0x0D, 0x93, 0x2C, 0xB9, 0x0B, 0xEB, 0x73, 0x4A,
0xDA, 0xFE, 0xF0, 0x86, 0xB4, 0x6B, 0xF8, 0x63,
0x1E, 0x83, 0x4F, 0x33, 0xE7, 0xF7, 0x25, 0x86,
0x39, 0x99, 0x73, 0x68, 0xED, 0xBB, 0x2C, 0x2E,
0x76, 0x45, 0x63, 0x89, 0x2A, 0x49, 0x29, 0x0E,
0x2A, 0xDD, 0x40, 0xB9, 0xFD, 0x58, 0x9B, 0x17,
0xA1, 0x63, 0x5F, 0xA3, 0x94, 0x04, 0x9B, 0xD2,
0x3A, 0xFC, 0x86, 0x0C, 0xBE, 0x13, 0x05, 0xA0,
0xDE, 0xD1, 0x9D, 0x4D, 0xC5, 0x09, 0x46, 0x24,
0x94, 0x37, 0x6B, 0x85, 0x1C, 0xAA, 0xE9, 0x98,
0xBD, 0xDA, 0x59, 0xC9, 0xA9, 0xF2, 0x8B, 0x23,
0x67, 0x54, 0xCA, 0x6B, 0x2D, 0x64, 0xCB, 0x69,
0x72, 0xC2, 0x61, 0x60, 0x95, 0x2C, 0x07, 0x32,
0x23, 0xA6, 0x0A, 0x18, 0x17, 0x37, 0x54, 0x18,
0xA9, 0x69, 0xB3, 0xDE, 0xF7, 0xBB, 0xAD, 0xA4,
0x23, 0x2A, 0x63, 0xAC, 0x3A, 0xC1, 0x37, 0x8A,
0xB5, 0xEE, 0x9F, 0x25, 0xD9, 0x62, 0xF2, 0x53,
0x28, 0xC8, 0xD0, 0xBC, 0x42, 0xB6, 0x3E, 0x58,
0xA0, 0x6A, 0xA4, 0x42, 0xBB, 0x71, 0x8A, 0xEF,
0x73, 0xA2, 0x37, 0xBF, 0xFF, 0x5D, 0x59, 0x3E,
0x05, 0xC0, 0x82, 0x85, 0xB6, 0x72, 0xC9, 0x60,
0xD8, 0xE8, 0x69, 0xB0, 0x18, 0xFC, 0x9A, 0xC8,
0xE0, 0x0A, 0x40, 0xD6, 0x4C, 0x64, 0x0D, 0xA3,
0xE8, 0x20, 0xFB, 0x9E, 0xEB, 0xCE, 0x49, 0xDB,
0x74, 0x3A, 0xC9, 0xCB, 0x6D, 0xD4, 0x82, 0x1F,
0x49, 0xD5, 0xB7, 0x37, 0x3B, 0x2D, 0x81, 0x23,
0x28, 0x68, 0xB9, 0xA6, 0x18, 0x25, 0xA4, 0x5D,
0xA1, 0x69, 0xA2, 0x6B, 0x2B, 0x01, 0xFE, 0x93,
0x62, 0xEA, 0x0D, 0x73, 0x02, 0x1F, 0x64, 0x5A,
0x82, 0x7A, 0x94, 0x84, 0xC1, 0xCA, 0xC5, 0x5C,
0x17, 0x0D, 0x74, 0xB9, 0x5B, 0xAB, 0x6F, 0xC4,
0xAE, 0x94, 0x4E, 0x41, 0xDE, 0x62, 0x10, 0xB8,
0x2E, 0xF1, 0x2D, 0xAC, 0x37, 0x56, 0x33, 0x08,
0x7C, 0x58, 0xC3, 0xD5, 0xFC, 0x6B, 0xDD, 0x9E,
0x6C, 0x80, 0xB1, 0xB8, 0xE8, 0x54, 0x04, 0x07,
0x54, 0x9C, 0x9A, 0x28, 0x89, 0xF9, 0xE0, 0x77,
0xF1, 0xED, 0x92, 0xE3, 0x26, 0xEA, 0x0F, 0xF2,
0xDD, 0x03, 0xCB, 0x7B, 0x42, 0x3F, 0xAD, 0x6D,
0x19, 0x18, 0x3B, 0x5E, 0x8E, 0xA5, 0x33, 0xB1,
0x69, 0x88, 0x3F, 0x5E, 0x5A, 0x3F, 0xE5, 0xA6,
0xF5, 0x9F, 0x2C, 0xE7, 0x88, 0xC3, 0xFB, 0x61,
0x53, 0xAA, 0x0A, 0xD5, 0xD1, 0xB6, 0x88, 0x3C,
0x70, 0x72, 0x01, 0x20, 0x4D, 0x37, 0x06, 0x11,
0x1F, 0x0A, 0x74, 0xC6, 0x36, 0xAF, 0xC9, 0x76,
0x38, 0x34, 0xB6, 0x32, 0x88, 0x4B, 0xC5, 0x1A,
0xD9, 0x69, 0x51, 0xBC, 0xDB, 0xA2, 0x05, 0x79,
0x17, 0x46, 0x67, 0xB1, 0xD3, 0xCE, 0xAE, 0x17,
0x4E, 0x4F, 0x36, 0xBF, 0x3F, 0x86, 0x75, 0xAC,
0x1C, 0xAE, 0x74, 0x60, 0xFF, 0x4D, 0xF0, 0xCE,
0x41, 0xA4, 0x95, 0x4E, 0x90, 0x7D, 0xAC, 0x97,
0xF7, 0x28, 0x78, 0x9E, 0x92, 0x27, 0x76, 0x98,
0x6F, 0x30, 0xF0, 0x75, 0x2D, 0x14, 0xB2, 0xD7,
0x27, 0xCF, 0x48, 0xF4, 0xC0, 0xEC, 0xF9, 0xFD,
0x57, 0xC2, 0x6A, 0xC0, 0x6A, 0xA4, 0x33, 0x7C,
0x42, 0x4E, 0xC8, 0xF4, 0x5A, 0x66, 0x08, 0xA0,
0x47, 0x55, 0x2A, 0x66, 0x25, 0x3A, 0x69, 0xA3,
0x17, 0xB4, 0x84, 0xCC, 0xEF, 0x89, 0x78, 0x68,
0xA0, 0xFF, 0xE7, 0x60, 0x52, 0x61, 0xA4, 0xAA,
0x8D, 0x71, 0xDF, 0x17, 0x47, 0x8B, 0xB8, 0xCB,
0xDF, 0xEE, 0x5D, 0xA2, 0x1F, 0xA3, 0x98, 0x3E,
0xC3, 0xA1, 0x2F, 0x33, 0xEC, 0xDD, 0xAE, 0x8A,
0x8D, 0x0C, 0x34, 0x3A, 0x44, 0x2D, 0x7F, 0x8D,
},
DQ = new byte[]
{
0x0D, 0x79, 0x58, 0x0C, 0x4C, 0xE9, 0x15, 0x8C,
0xB0, 0xD9, 0x10, 0x81, 0xB3, 0xCB, 0x45, 0x5F,
0xA9, 0xBE, 0xED, 0x2D, 0xC0, 0x28, 0xD3, 0xA9,
0xDD, 0x9D, 0xB3, 0x3E, 0x73, 0x3E, 0x87, 0xBB,
0x32, 0x4E, 0x4E, 0x23, 0x20, 0xA0, 0x8B, 0x8B,
0xAB, 0xE0, 0x26, 0x8C, 0xAB, 0xF4, 0x8F, 0x1F,
0x77, 0xBF, 0xAD, 0xA5, 0x1B, 0xF5, 0x36, 0xBF,
0xB6, 0xFA, 0x79, 0x2D, 0xFE, 0x48, 0xD2, 0x85,
0xD2, 0x42, 0x57, 0x93, 0x85, 0xAC, 0xE3, 0x8F,
0x54, 0x1A, 0x82, 0xB3, 0x83, 0x41, 0x0F, 0xAD,
0xA7, 0xC8, 0x94, 0x21, 0x89, 0xA5, 0x92, 0x0A,
0x53, 0xE5, 0x64, 0x84, 0xF2, 0x5D, 0xC4, 0xE5,
0x28, 0x8D, 0x3F, 0xA8, 0xB6, 0x6C, 0xB9, 0x14,
0x1E, 0x02, 0x85, 0x57, 0x8E, 0x12, 0xE3, 0xBE,
0x10, 0x45, 0x41, 0x04, 0xBA, 0x68, 0x52, 0x7D,
0x1E, 0x74, 0x82, 0x94, 0xBB, 0xDE, 0xD5, 0x17,
0xF0, 0xDE, 0x95, 0x9F, 0xA9, 0x65, 0xCD, 0x31,
0x61, 0xE9, 0xC0, 0x60, 0xA7, 0x1C, 0xA7, 0x86,
0x2F, 0x51, 0x0A, 0x5E, 0xDD, 0xF3, 0x14, 0x5C,
0xA9, 0x91, 0x71, 0xEB, 0x8F, 0xA0, 0x8A, 0xFE,
0xF9, 0x02, 0x77, 0xEE, 0x93, 0x8F, 0xBA, 0x8E,
0x57, 0xAB, 0x5C, 0x6F, 0x1F, 0xE1, 0x91, 0xD8,
0x36, 0xCD, 0x40, 0x2F, 0x40, 0xA9, 0xC4, 0x56,
0x3C, 0x4B, 0x93, 0x47, 0x89, 0xDC, 0xA7, 0xEC,
0x1E, 0x38, 0xC2, 0x03, 0x00, 0x6F, 0xB8, 0xA4,
0x00, 0xB5, 0xD2, 0x8F, 0x4D, 0xB8, 0xD5, 0xDA,
0x25, 0x85, 0x13, 0xF0, 0x1B, 0x0B, 0xC7, 0x20,
0xC8, 0xF1, 0xF2, 0x63, 0x7C, 0x9E, 0x9D, 0x79,
0xCE, 0xB0, 0x72, 0xF5, 0xA8, 0xCE, 0x5C, 0xAA,
0x4E, 0x54, 0x0B, 0xA1, 0xD8, 0xCA, 0x7C, 0x73,
0xB1, 0x6A, 0xD5, 0x8F, 0x13, 0x14, 0x62, 0x89,
0xBF, 0x40, 0x93, 0x2A, 0xAC, 0xC8, 0x09, 0x37,
0xC9, 0x03, 0xC7, 0x89, 0x8C, 0x64, 0xEF, 0x4A,
0xAF, 0xCF, 0xA6, 0x3C, 0x85, 0xC4, 0xE5, 0x47,
0x60, 0xA2, 0x05, 0xED, 0x49, 0xD5, 0x27, 0x0C,
0xF9, 0xA3, 0xCB, 0x7C, 0x99, 0x03, 0x7E, 0xD5,
0x4C, 0x1B, 0xC3, 0xB7, 0xE8, 0x67, 0x30, 0xE9,
0x24, 0xE8, 0x19, 0x98, 0x27, 0x10, 0x31, 0x1A,
0xDC, 0xF9, 0x90, 0x27, 0x7B, 0x55, 0x21, 0x96,
0x73, 0x13, 0x7D, 0x9C, 0xD9, 0x82, 0x02, 0xDC,
0x58, 0x10, 0xD1, 0xE7, 0x87, 0xA5, 0xBB, 0xE1,
0xA3, 0xCD, 0xD8, 0xE4, 0x80, 0x8E, 0x8A, 0xB5,
0x69, 0x1E, 0x26, 0x48, 0x85, 0x43, 0xD3, 0xF7,
0x6B, 0x75, 0x47, 0x9A, 0xF8, 0xB7, 0x64, 0xDA,
0x5C, 0x60, 0x0B, 0xDA, 0xEF, 0x34, 0x82, 0x5E,
0x9F, 0xEC, 0xEA, 0xB9, 0x77, 0x8E, 0x5F, 0x97,
0x1A, 0x3C, 0x5B, 0xC7, 0x49, 0xC8, 0x65, 0xBC,
0x29, 0x1F, 0x42, 0x48, 0x71, 0x3A, 0x7B, 0x95,
0x45, 0x41, 0xEE, 0x2D, 0x2E, 0x44, 0xA9, 0xC0,
0x84, 0x6E, 0x20, 0x45, 0xDF, 0x79, 0x51, 0xAB,
0x19, 0xA5, 0x2D, 0x97, 0xBF, 0xCE, 0x8A, 0x8C,
0xDF, 0xC1, 0xC0, 0xF3, 0x8D, 0xFA, 0x72, 0xA8,
0x34, 0x4E, 0xEC, 0x5A, 0x18, 0x6B, 0x41, 0xD0,
0x02, 0x0A, 0x5B, 0xF7, 0x85, 0x6B, 0x4C, 0x8B,
0x75, 0xFF, 0x89, 0x63, 0xF8, 0x16, 0x53, 0x0B,
0x39, 0x70, 0xFF, 0xF0, 0x6C, 0x3C, 0xC5, 0x4B,
0x05, 0x91, 0x26, 0x96, 0xEF, 0x93, 0xAF, 0x7D,
0x67, 0xB6, 0xF2, 0xC3, 0x7E, 0x6A, 0xC5, 0x3D,
0x9F, 0x35, 0x5A, 0xFF, 0x76, 0xA4, 0x71, 0xC6,
0x6D, 0x18, 0xB0, 0x35, 0xF7, 0xC0, 0xCA, 0x97,
0x26, 0xC9, 0x32, 0x2F, 0x90, 0x34, 0xE5, 0x9C,
0x6B, 0x41, 0x5E, 0x4B, 0xCB, 0x66, 0xBE, 0xE6,
0x0E, 0x7E, 0x96, 0xC6, 0x72, 0xE9, 0x2C, 0xB9,
0x6A, 0xA0, 0x71, 0x53, 0x44, 0x67, 0x7C, 0x74,
0x43, 0x3A, 0x04, 0x63, 0xBE, 0x6A, 0x09, 0x0D,
0x82, 0x14, 0x12, 0x1A, 0xDA, 0xB5, 0x28, 0x71,
0x9D, 0x48, 0xD9, 0x0B, 0xC5, 0x8E, 0x9D, 0x75,
0xA8, 0x7B, 0x4F, 0xE3, 0xDE, 0x63, 0x7E, 0x42,
0xC6, 0xE8, 0x39, 0xBA, 0x15, 0x13, 0xB7, 0x66,
0x73, 0x73, 0x5D, 0x20, 0xF9, 0x17, 0x1B, 0xDC,
0x00, 0x4F, 0x98, 0x99, 0xE3, 0xE5, 0xEB, 0x44,
0x46, 0x9A, 0xB2, 0x03, 0x51, 0x28, 0x10, 0x54,
0x59, 0xC5, 0xA8, 0xDD, 0x5F, 0x9D, 0xC5, 0x57,
0x72, 0xA6, 0xBB, 0x48, 0x0A, 0x8E, 0xE1, 0x96,
0xFD, 0x53, 0x22, 0xD9, 0x20, 0x49, 0x17, 0xA0,
0x10, 0xEF, 0x90, 0x98, 0x2C, 0xB4, 0x69, 0x9D,
0x0A, 0x81, 0xFE, 0x21, 0x41, 0x61, 0x1C, 0x3D,
0x0C, 0xAD, 0x1B, 0xCA, 0xA8, 0xED, 0xBE, 0xAB,
0x78, 0xAD, 0x6F, 0xE3, 0x21, 0xB9, 0x48, 0xB1,
0x1F, 0x13, 0x18, 0xA4, 0x38, 0x8B, 0x9A, 0x60,
0xAA, 0xD7, 0x4E, 0xF9, 0x60, 0xC4, 0x67, 0x10,
0xD9, 0x3C, 0xE2, 0x64, 0x02, 0x10, 0x1A, 0x10,
0x91, 0x95, 0x53, 0x24, 0x54, 0xBB, 0x5E, 0x67,
0x68, 0x68, 0x07, 0x32, 0xB3, 0xDD, 0x2F, 0x80,
0x03, 0x59, 0xED, 0xF5, 0x8A, 0x49, 0x2B, 0x40,
0x6D, 0x0D, 0xD7, 0x87, 0x7C, 0x2D, 0x5A, 0x9F,
0x4F, 0xE3, 0xBA, 0xD1, 0x14, 0x08, 0xE2, 0x5A,
0x9B, 0xE7, 0xAE, 0xC0, 0xDF, 0xA6, 0x0D, 0xB4,
0xF4, 0xF2, 0x9F, 0x2A, 0x55, 0x49, 0x94, 0x4A,
0x07, 0xF6, 0xA3, 0x6D, 0x6F, 0x3E, 0xD3, 0x80,
0x94, 0x84, 0x28, 0x2E, 0xA6, 0x55, 0xAB, 0xAC,
0x1B, 0xF3, 0xE7, 0x43, 0x89, 0xF3, 0x00, 0x66,
0x7A, 0x32, 0x5D, 0x72, 0xD1, 0x3B, 0x5C, 0x00,
0xF4, 0xBF, 0x7B, 0xDE, 0xA0, 0xAF, 0xDD, 0x59,
0x1D, 0xB3, 0x73, 0xC2, 0xCD, 0x85, 0x7B, 0xEC,
0x5E, 0x01, 0xAD, 0x49, 0x42, 0xC6, 0xF8, 0x2D,
0xEE, 0x83, 0x04, 0xDC, 0x67, 0x36, 0xE7, 0x4F,
0x76, 0xAF, 0x44, 0x83, 0x6E, 0x90, 0x0A, 0x17,
0xA9, 0x58, 0xF1, 0x4A, 0x5C, 0xED, 0xB4, 0x48,
0xC3, 0xC7, 0x8F, 0x80, 0x92, 0x76, 0x90, 0x59,
0x7B, 0x96, 0x85, 0x1B, 0x6C, 0x0D, 0xBF, 0xCD,
0x04, 0xF8, 0x4D, 0xF7, 0xB4, 0x28, 0x0A, 0x48,
0x10, 0xB8, 0xBD, 0x98, 0x8A, 0xA6, 0x0A, 0xFC,
0x1E, 0x40, 0x51, 0x69, 0x1E, 0xCD, 0xA1, 0xC7,
0xD7, 0xAD, 0xFA, 0xFC, 0xED, 0x0A, 0xD6, 0xF6,
0x38, 0x88, 0x99, 0xD8, 0x8E, 0x96, 0xCD, 0xDA,
0x5C, 0x06, 0x55, 0x1D, 0x7A, 0x1C, 0x00, 0x96,
0xD8, 0x17, 0xD5, 0xF0, 0x80, 0x18, 0x67, 0x56,
0xC6, 0x5C, 0x7C, 0x49, 0x4C, 0x23, 0x17, 0x6E,
0x7B, 0x53, 0xCB, 0x59, 0x82, 0x8D, 0x23, 0x64,
0xD2, 0x4C, 0x83, 0xA8, 0x0A, 0x04, 0x30, 0xFD,
0x3B, 0xA7, 0xE7, 0x6C, 0xEF, 0x21, 0x3A, 0x00,
0xEA, 0x20, 0xF1, 0xA2, 0x99, 0x27, 0x18, 0x79,
0x0E, 0xED, 0x8E, 0x93, 0x26, 0xF7, 0xC2, 0x01,
0x52, 0x62, 0x82, 0x27, 0xD9, 0xBC, 0xEE, 0x66,
0x28, 0xC8, 0xF3, 0x59, 0xD5, 0xBE, 0x59, 0xE6,
0x7F, 0x96, 0x2E, 0x58, 0xAB, 0x2C, 0xBC, 0x0D,
0x8F, 0xAB, 0xAB, 0x04, 0x4F, 0x58, 0x99, 0x40,
0xFC, 0x41, 0x53, 0xFF, 0x3F, 0x71, 0xC3, 0x61,
0xA7, 0xF0, 0xF6, 0x44, 0x47, 0xCD, 0x06, 0x9F,
0x63, 0x29, 0x66, 0xCE, 0xA5, 0x99, 0x54, 0xC4,
0x32, 0xC0, 0xDC, 0x4C, 0xF0, 0x07, 0x07, 0x12,
0xA2, 0xE0, 0xC7, 0x30, 0x0C, 0xCB, 0xC1, 0x10,
0x64, 0xE3, 0xCA, 0x6B, 0xA8, 0x9B, 0x7C, 0xA2,
0x1B, 0x5C, 0x91, 0xF3, 0x55, 0xFC, 0x77, 0x6C,
0xBD, 0xEB, 0xEC, 0x4E, 0xE0, 0x9E, 0xE8, 0x26,
0x7E, 0x64, 0x04, 0x0A, 0x2B, 0x19, 0xB7, 0x0D,
0x58, 0xCA, 0x5A, 0x97, 0x18, 0xF0, 0x8A, 0x4D,
},
InverseQ = new byte[]
{
0x9F, 0xEA, 0xE6, 0xF8, 0x95, 0x54, 0x7E, 0x51,
0x36, 0xC4, 0xBF, 0x4B, 0x07, 0xE2, 0x31, 0x52,
0x67, 0xFC, 0xE5, 0xA4, 0xAB, 0x11, 0x7B, 0x72,
0x78, 0x90, 0xD6, 0x38, 0xDB, 0x3B, 0xEA, 0x51,
0x0B, 0xDE, 0x89, 0x8D, 0xF2, 0xB2, 0xCF, 0xE0,
0x5A, 0xBF, 0xB3, 0x69, 0x15, 0x9F, 0x83, 0x6B,
0xBA, 0x86, 0xE2, 0xE2, 0x63, 0xC6, 0xDA, 0x82,
0x0D, 0xBE, 0xD5, 0x3E, 0x5D, 0xAC, 0x55, 0x21,
0xBF, 0xFD, 0xD2, 0xBA, 0xAD, 0x62, 0x68, 0xF9,
0x51, 0x07, 0xA4, 0xAD, 0xF2, 0x15, 0x8E, 0x4A,
0x2C, 0xA8, 0xF7, 0xAF, 0x6E, 0x89, 0xD7, 0x88,
0x71, 0x56, 0x1A, 0xDB, 0xD0, 0x04, 0x75, 0x65,
0xCC, 0x83, 0xF5, 0xAA, 0x87, 0x8D, 0x8A, 0x6E,
0x4F, 0xFF, 0x75, 0x27, 0x08, 0x0D, 0x3B, 0x49,
0xA2, 0xB9, 0x74, 0x5A, 0xCD, 0x49, 0x8A, 0xF4,
0xA4, 0x01, 0x42, 0xB9, 0xD1, 0x1C, 0xC1, 0xEE,
0xAC, 0x02, 0xA4, 0x84, 0xE4, 0xFA, 0x26, 0xB3,
0x08, 0xDA, 0x71, 0x17, 0x5E, 0x85, 0x70, 0x0B,
0x78, 0xF3, 0xEE, 0xC1, 0x87, 0x09, 0x5F, 0x59,
0xFF, 0x2F, 0xA0, 0x8C, 0x09, 0x4A, 0x5B, 0xD1,
0xCD, 0xBA, 0x8A, 0x5C, 0x62, 0x86, 0x28, 0x4B,
0xC0, 0x38, 0xA4, 0xBD, 0x3E, 0x79, 0xE8, 0x07,
0xC1, 0xD1, 0x01, 0x00, 0xB0, 0xD4, 0x6B, 0x34,
0xE4, 0x73, 0xBC, 0xCB, 0x59, 0x0F, 0x51, 0xB3,
0x74, 0x86, 0x84, 0x63, 0xED, 0xA6, 0x50, 0x2A,
0xC8, 0xCF, 0xF8, 0xC0, 0xCC, 0xFE, 0xEC, 0x95,
0x64, 0xC4, 0x38, 0x7A, 0x07, 0xB6, 0x02, 0x1E,
0x14, 0xD1, 0x63, 0xEC, 0x06, 0x77, 0xCE, 0xD7,
0x36, 0x19, 0xC2, 0x00, 0x9A, 0x22, 0x23, 0x48,
0xF6, 0xD7, 0x3E, 0xC6, 0x82, 0x64, 0xD2, 0x0D,
0xB5, 0x3D, 0x63, 0xBC, 0x81, 0x33, 0x45, 0x29,
0x6D, 0x72, 0x14, 0x25, 0xD5, 0xC9, 0x39, 0x04,
0xF8, 0xB4, 0x28, 0x22, 0x7C, 0x5A, 0xF6, 0xA3,
0x7D, 0x28, 0xFF, 0xB8, 0xCD, 0x9E, 0xD0, 0x8E,
0x36, 0x91, 0x52, 0x43, 0x6E, 0x79, 0x0A, 0x4C,
0x6B, 0x1B, 0x51, 0x49, 0x56, 0x9E, 0xCF, 0x93,
0x5A, 0x2A, 0xA0, 0xBD, 0x2F, 0x54, 0xA4, 0xC8,
0xDF, 0x77, 0x36, 0x6C, 0xBD, 0x88, 0x5A, 0x6C,
0xDE, 0x78, 0xFF, 0x55, 0x6A, 0x82, 0xFA, 0x55,
0x86, 0x0D, 0x7F, 0x64, 0xED, 0xCC, 0x5A, 0x40,
0xE6, 0x36, 0x1B, 0x05, 0x2F, 0x2A, 0x29, 0x9B,
0xF1, 0x47, 0xC0, 0x4D, 0xCA, 0xCA, 0x52, 0x55,
0xFB, 0x33, 0xD9, 0xF9, 0x9C, 0x13, 0x9B, 0xFA,
0x07, 0xEB, 0x7F, 0x45, 0x6E, 0xFC, 0xA4, 0xD5,
0x62, 0x17, 0x41, 0x2F, 0xF9, 0x3D, 0x56, 0x52,
0x4D, 0x24, 0x9F, 0x0E, 0x01, 0x1F, 0x2A, 0x87,
0x0E, 0x4C, 0x51, 0x17, 0xFB, 0xD5, 0x85, 0x0C,
0xA2, 0x6F, 0xAC, 0x89, 0xC0, 0x42, 0x5F, 0x98,
0x7B, 0x27, 0xDD, 0xFD, 0xD3, 0x8A, 0x2F, 0xE5,
0x4F, 0xE5, 0x81, 0x62, 0x59, 0x14, 0x22, 0x89,
0x40, 0x97, 0x26, 0xB6, 0x1F, 0xA9, 0x51, 0xC9,
0xD3, 0xF4, 0x18, 0xCB, 0xE0, 0xEA, 0xAA, 0x08,
0xA1, 0x4B, 0x26, 0x24, 0x44, 0x9B, 0x85, 0x8F,
0xED, 0x33, 0xB9, 0x4B, 0xD8, 0x9A, 0x32, 0x19,
0xAB, 0x06, 0x02, 0x79, 0xC2, 0x58, 0xED, 0xF7,
0x1E, 0x0E, 0x45, 0x05, 0x4B, 0x09, 0x11, 0x1F,
0x22, 0x4A, 0xE3, 0xBD, 0x43, 0xAF, 0x4C, 0xD5,
0xC6, 0x84, 0xB3, 0x5B, 0x43, 0x37, 0xF7, 0x9B,
0xBD, 0x27, 0x49, 0x00, 0xFB, 0x5B, 0x10, 0x22,
0x04, 0xEB, 0xA4, 0xB9, 0x55, 0x29, 0x74, 0x8A,
0xE2, 0x73, 0x58, 0x12, 0x1B, 0xA1, 0x0C, 0x3F,
0x23, 0x6B, 0x5C, 0x86, 0x5B, 0x5E, 0xD7, 0xBD,
0xD3, 0x0F, 0x97, 0x6A, 0x39, 0x44, 0x4F, 0xBD,
0xFD, 0xF6, 0xD2, 0x65, 0x73, 0x35, 0x04, 0x55,
0xE8, 0x61, 0x5D, 0xA0, 0x39, 0xA7, 0x22, 0xE9,
0xD2, 0x50, 0x72, 0x26, 0x60, 0x7A, 0x96, 0x69,
0xE8, 0x03, 0x7C, 0x31, 0x03, 0xAB, 0x12, 0x60,
0x2C, 0x27, 0x2B, 0xC4, 0xFD, 0x99, 0xCC, 0xB5,
0xAE, 0x87, 0x67, 0x79, 0xE0, 0xC0, 0xFC, 0x42,
0x6E, 0xF4, 0xF7, 0x72, 0x50, 0x74, 0xEE, 0xE5,
0x31, 0x0A, 0xC0, 0xF2, 0xFA, 0x88, 0x29, 0xC3,
0x73, 0x8B, 0xDD, 0xC2, 0x33, 0xDB, 0xD9, 0x76,
0xD5, 0x10, 0xD9, 0x69, 0xC5, 0x91, 0xF6, 0xB3,
0x08, 0x65, 0x3C, 0x40, 0x0F, 0x8D, 0x9A, 0x34,
0xDE, 0xAA, 0xE3, 0xD3, 0x27, 0x26, 0xDE, 0x0D,
0xF5, 0xC3, 0x13, 0x7F, 0xCC, 0x37, 0x3F, 0x90,
0x76, 0xAC, 0xB3, 0xB8, 0x44, 0xA6, 0x83, 0x9D,
0xA1, 0x56, 0xC0, 0x73, 0x0D, 0xD9, 0x23, 0xC1,
0xA5, 0x16, 0xD1, 0x3F, 0x58, 0x85, 0x14, 0x87,
0x9D, 0xB5, 0x6F, 0x72, 0xCE, 0x21, 0x97, 0xAB,
0xF0, 0x62, 0x50, 0x3D, 0x52, 0xE5, 0xF3, 0x65,
0x3B, 0xAA, 0xF8, 0x1A, 0x2E, 0x1B, 0x67, 0xF7,
0x48, 0x52, 0xD1, 0xF1, 0x41, 0x8D, 0x99, 0xF0,
0x0E, 0x24, 0x22, 0xC9, 0x31, 0x4C, 0xDA, 0x75,
0x8A, 0x99, 0x44, 0xE7, 0x3A, 0x6D, 0x37, 0xD8,
0xFE, 0x18, 0x90, 0x8E, 0xC6, 0x0D, 0x2A, 0xC5,
0x7B, 0x7F, 0xCA, 0xBD, 0x9C, 0xFB, 0x26, 0xF3,
0xBD, 0x8E, 0x67, 0x9A, 0x4F, 0xCE, 0x36, 0x3A,
0x61, 0xB3, 0x83, 0x27, 0x4C, 0xE3, 0x5B, 0xF0,
0xED, 0x58, 0x3A, 0x3A, 0x61, 0x50, 0x35, 0xD6,
0xEC, 0xAA, 0x5C, 0x5E, 0xCF, 0x47, 0xBB, 0xAF,
0x2B, 0xAA, 0x44, 0x81, 0x11, 0xAF, 0x8C, 0x84,
0x69, 0x83, 0xCF, 0xC3, 0x5B, 0x0D, 0x33, 0xF5,
0x43, 0x86, 0xD5, 0x80, 0x02, 0x19, 0xB4, 0x4A,
0x16, 0x76, 0x55, 0x8C, 0x10, 0x37, 0x44, 0x32,
0x28, 0x63, 0x53, 0x9E, 0x57, 0x80, 0xD4, 0x01,
0x40, 0x00, 0x9F, 0x84, 0xA9, 0xF9, 0x9C, 0x97,
0xBE, 0x48, 0x88, 0x31, 0x8E, 0x8A, 0x86, 0x65,
0xCF, 0xB5, 0xDE, 0xE6, 0x43, 0x72, 0x8C, 0x0D,
0xC9, 0x20, 0x57, 0xAF, 0xC4, 0x75, 0xCA, 0xE8,
0xEF, 0xC0, 0xDD, 0x44, 0xD8, 0xE0, 0xD7, 0xDA,
0xEA, 0x7B, 0x4F, 0xD9, 0x85, 0x0D, 0x7B, 0x2B,
0x84, 0x50, 0x64, 0x4F, 0xBF, 0xA6, 0x5B, 0x59,
0x8E, 0x1C, 0x95, 0x31, 0x34, 0x9D, 0xCB, 0xEF,
0x40, 0x7E, 0xEE, 0x27, 0xA9, 0xBD, 0x4D, 0x4D,
0x11, 0xB0, 0x4B, 0xDA, 0xD5, 0x46, 0x72, 0xE7,
0x92, 0x30, 0x67, 0x6E, 0x53, 0x15, 0xF1, 0x4D,
0xE6, 0xCD, 0x84, 0x20, 0x90, 0xC6, 0xB8, 0xC2,
0x18, 0x93, 0x4A, 0x73, 0x98, 0xC2, 0x01, 0x58,
0x0A, 0xEF, 0x44, 0xB3, 0x1D, 0x0F, 0xC7, 0x5B,
0x53, 0xC0, 0xA4, 0x0F, 0x15, 0x99, 0xAF, 0x80,
0x57, 0xD6, 0x8E, 0xA2, 0x9C, 0x37, 0xD8, 0xCD,
0x22, 0xB7, 0x59, 0x00, 0xBE, 0xEC, 0xC7, 0x2D,
0xB6, 0x53, 0x1E, 0x9F, 0x0E, 0xA8, 0x52, 0x01,
0x58, 0x48, 0x73, 0x50, 0x2C, 0x4A, 0xFD, 0xC5,
0x45, 0x2B, 0xCF, 0xB2, 0x8B, 0x1A, 0x98, 0x53,
0xDF, 0xC4, 0x93, 0x2F, 0x77, 0xEA, 0x3C, 0xF0,
0x68, 0xEE, 0xBE, 0x40, 0x04, 0xDD, 0x0B, 0xF9,
0x09, 0x8D, 0x33, 0x93, 0x28, 0x04, 0x38, 0xC8,
0x84, 0x7F, 0xAB, 0x51, 0xD6, 0xD7, 0xAB, 0x27,
0xE0, 0x3A, 0x3C, 0x02, 0xC4, 0x62, 0xF9, 0x1B,
0x5D, 0xC7, 0xB1, 0xBD, 0x51, 0x96, 0xE0, 0xBB,
0xCA, 0xC2, 0x4A, 0x1B, 0x85, 0x1F, 0x37, 0xC5,
0xF3, 0x7B, 0x87, 0xC0, 0x7B, 0x25, 0xF2, 0x48,
0x5A, 0xCC, 0xE4, 0x1E, 0xB6, 0xE6, 0xA7, 0x04,
0x6F, 0xC6, 0xC4, 0x17, 0x5A, 0x78, 0x82, 0x45,
0x99, 0x3C, 0xA6, 0x2F, 0x52, 0xCE, 0xAE, 0xEE,
0xBD, 0x98, 0x0F, 0x60, 0xC2, 0x1B, 0x85, 0x15,
},
};
public static readonly RSAParameters DiminishedDPParameters = new RSAParameters
{
Modulus = new byte[]
{
0xB7, 0x3F, 0x59, 0xF5, 0xEE, 0x8B, 0xD5, 0x5E,
0x24, 0xB7, 0xFF, 0x02, 0x9A, 0xD1, 0x6A, 0x85,
0x43, 0xC9, 0x6D, 0x25, 0x3E, 0x54, 0x31, 0x9B,
0x93, 0x53, 0x2C, 0x41, 0xC3, 0xC1, 0x47, 0x7B,
0x89, 0xDB, 0x2D, 0x2F, 0x33, 0xD7, 0xB9, 0xA8,
0x74, 0x58, 0x48, 0xE0, 0x6A, 0x8E, 0x68, 0x3B,
0x50, 0x44, 0x51, 0x1E, 0x1B, 0xCA, 0x36, 0x25,
0x27, 0xE1, 0x7C, 0xF4, 0x2B, 0x38, 0x06, 0x15,
},
Exponent = new byte[]
{
0x01, 0x00, 0x01,
},
D = new byte[]
{
0xAF, 0xE6, 0xF2, 0x36, 0x2F, 0x9C, 0xAF, 0x5E,
0xC5, 0xA4, 0x91, 0xF8, 0x30, 0x21, 0x22, 0x3D,
0x76, 0x8A, 0x9E, 0x69, 0x07, 0xE1, 0xCE, 0x14,
0xE7, 0x61, 0x09, 0xB4, 0xBF, 0x72, 0x83, 0x68,
0x22, 0x8C, 0x1A, 0xE9, 0x62, 0x46, 0xAD, 0xDD,
0xCD, 0xA7, 0x59, 0xBD, 0x04, 0x18, 0x68, 0xB9,
0x69, 0x68, 0x17, 0xC5, 0x01, 0xE8, 0x8B, 0xBC,
0xFD, 0xEF, 0xF0, 0x02, 0x0F, 0x85, 0xF7, 0x29,
},
P = new byte[]
{
0xF3, 0x72, 0x7B, 0x1E, 0x86, 0x76, 0x20, 0x55,
0x94, 0xD3, 0xC7, 0x3A, 0x02, 0x27, 0x4D, 0x4F,
0x1A, 0x98, 0x04, 0x4A, 0x29, 0x51, 0xC8, 0x5C,
0xCD, 0x12, 0xC6, 0xFC, 0x57, 0xAD, 0x19, 0x7B,
},
DP = new byte[]
{
// Note the leading 0x00 byte.
0x00, 0x08, 0x8E, 0xFD, 0xC5, 0x14, 0xF5, 0x12,
0x2D, 0xF0, 0x0D, 0x81, 0xF3, 0x88, 0x1F, 0xD9,
0x97, 0xEE, 0x57, 0x69, 0xCF, 0x31, 0xA4, 0xAE,
0x66, 0x94, 0xCF, 0x14, 0x2F, 0xCA, 0xE5, 0x4B,
},
Q = new byte[]
{
0xC0, 0xB2, 0x3A, 0xE8, 0xEA, 0x52, 0xA9, 0xFB,
0x43, 0x4E, 0xFD, 0x4A, 0x51, 0xF3, 0x5E, 0xEB,
0xE8, 0x72, 0xA2, 0x1D, 0xB7, 0x82, 0x0C, 0xD4,
0x49, 0x88, 0x96, 0xB9, 0x54, 0xF4, 0x61, 0xAF,
},
DQ = new byte[]
{
0xAC, 0x24, 0xCC, 0xF1, 0xD4, 0x9B, 0xA2, 0x95,
0x00, 0x0D, 0x69, 0xC3, 0xE2, 0x30, 0x2B, 0x85,
0x4E, 0x74, 0x52, 0x15, 0x80, 0x21, 0xA3, 0x3A,
0x66, 0xB2, 0xAA, 0x0B, 0xC9, 0x34, 0x44, 0xAB,
},
InverseQ = new byte[]
{
0xC2, 0xC9, 0x95, 0x94, 0xC6, 0x8C, 0x40, 0x76,
0x37, 0xEB, 0x04, 0x6B, 0x31, 0xF9, 0x4E, 0x81,
0x1C, 0xCD, 0x0C, 0xCA, 0xAA, 0x9E, 0xED, 0xF6,
0x3B, 0x86, 0x35, 0xB3, 0x8F, 0x86, 0x81, 0x0B,
}
};
public static readonly RSAParameters UnusualExponentParameters = new RSAParameters()
{
Modulus = new byte[]
{
0xF6, 0xBA, 0x82, 0x83, 0x26, 0x0C, 0x39, 0x91,
0x1B, 0x8B, 0x5D, 0xB1, 0x8A, 0x0F, 0xF3, 0x6A,
0x78, 0xD5, 0x59, 0xA8, 0x0D, 0x64, 0x29, 0x3D,
0xD0, 0x0C, 0x35, 0x87, 0x56, 0x00, 0x9B, 0x3C,
0xE8, 0x91, 0xE1, 0xC2, 0x08, 0xAE, 0xDB, 0x9C,
0x15, 0xAB, 0xB5, 0x24, 0x94, 0x10, 0x08, 0xF7,
0x53, 0xCE, 0xD7, 0x7C, 0xCF, 0x75, 0xCF, 0x17,
0x45, 0x3F, 0x4C, 0xD1, 0x02, 0x92, 0x11, 0xCB,
0x31, 0xDF, 0xB5, 0xED, 0x6B, 0x23, 0x8F, 0x8D,
0x96, 0x37, 0x8E, 0x1A, 0x81, 0x20, 0x71, 0x49,
0x17, 0x05, 0xE0, 0x43, 0x1D, 0xA4, 0xD7, 0x7B,
0xB9, 0x99, 0x0A, 0xA9, 0x0B, 0x2F, 0x80, 0x89,
0x9B, 0xF1, 0x79, 0xDA, 0xC9, 0x50, 0xF6, 0xD5,
0x2D, 0xBC, 0xBF, 0xAF, 0xDA, 0x2D, 0xEF, 0x2A,
0x35, 0x29, 0xC5, 0xBC, 0x88, 0x32, 0xE5, 0xAD,
0x4E, 0x5C, 0x8F, 0x5C, 0xD0, 0x1E, 0x8E, 0x93,
},
Exponent = new byte[]
{
0x01, 0xB1,
},
D = new byte[]
{
0x7D, 0x5B, 0xCE, 0x6E, 0x62, 0x8E, 0x31, 0x59,
0xB0, 0x94, 0xD9, 0xE0, 0x69, 0x9E, 0xDD, 0xD1,
0x96, 0xAB, 0x11, 0xC3, 0xF1, 0x85, 0x11, 0xFF,
0x7A, 0xD9, 0xDC, 0x86, 0xFA, 0x9F, 0xF0, 0x47,
0x26, 0x59, 0x7D, 0xEF, 0xE3, 0x4D, 0x9B, 0xEB,
0xFA, 0x74, 0xCD, 0x8C, 0xF7, 0xDD, 0x94, 0x39,
0x14, 0xB4, 0xC4, 0xFC, 0x9B, 0x11, 0xE1, 0x3C,
0xE5, 0x1A, 0xD7, 0x36, 0xC2, 0x0B, 0x8B, 0xB2,
0x82, 0x93, 0x62, 0x80, 0x02, 0x30, 0xAF, 0x15,
0x9E, 0x5A, 0x39, 0x7C, 0x6F, 0xCA, 0x09, 0xC9,
0xD8, 0xC5, 0x21, 0x88, 0x8D, 0x52, 0xEE, 0x3A,
0x50, 0x4D, 0xB3, 0xFA, 0xA0, 0x88, 0x0D, 0x67,
0xDE, 0x9D, 0x68, 0x32, 0x03, 0xC8, 0x35, 0xCE,
0x73, 0x38, 0x19, 0xED, 0x38, 0xFE, 0xD2, 0x5C,
0xD6, 0x12, 0xF0, 0x17, 0x33, 0x99, 0x0D, 0x1F,
0xFB, 0x3D, 0xA1, 0x35, 0x24, 0x03, 0x16, 0xB1,
},
P = new byte[]
{
0xFE, 0xF8, 0x94, 0xF4, 0xC5, 0x2D, 0x9A, 0xA9,
0xA5, 0x40, 0x6E, 0x27, 0xE9, 0x27, 0x46, 0xCF,
0x29, 0xB4, 0xBD, 0x93, 0xE1, 0x99, 0x29, 0xA5,
0xDA, 0x8B, 0x76, 0x28, 0xE3, 0xD1, 0x84, 0xFF,
0x00, 0x19, 0xFD, 0xD3, 0x8C, 0x41, 0xDE, 0xF9,
0x63, 0xC6, 0x7C, 0x85, 0x5A, 0x70, 0x37, 0x6F,
0x6D, 0x9C, 0x96, 0x4A, 0xD8, 0x0C, 0x37, 0x1D,
0x04, 0xB4, 0xAB, 0x34, 0x41, 0xC0, 0x72, 0x8D,
},
DP = new byte[]
{
0x74, 0x00, 0xC3, 0x79, 0x69, 0xAC, 0x1A, 0x06,
0x3C, 0x67, 0x37, 0x70, 0x29, 0xA2, 0x20, 0xCE,
0x95, 0xA2, 0xA3, 0x1C, 0x42, 0x93, 0x22, 0x51,
0xF6, 0x0D, 0xC9, 0x90, 0x88, 0xC2, 0x0E, 0xFB,
0xFF, 0x74, 0x78, 0xCD, 0x9F, 0x97, 0x2B, 0x81,
0x6D, 0x3F, 0x1B, 0xAE, 0xC7, 0x00, 0xCC, 0xF4,
0x06, 0xB5, 0xCC, 0xF3, 0x58, 0x3E, 0x50, 0xA6,
0x54, 0x52, 0x32, 0xB2, 0x15, 0xA3, 0x3B, 0xCD,
},
Q = new byte[]
{
0xF7, 0xB9, 0x69, 0x93, 0xFA, 0x16, 0x23, 0x46,
0x31, 0x27, 0x4A, 0xBB, 0x5A, 0x34, 0xD3, 0xB8,
0x4A, 0xD1, 0xCC, 0xE7, 0x21, 0x3D, 0x66, 0xEC,
0x68, 0x90, 0x92, 0xD9, 0xDB, 0x1F, 0x01, 0xBD,
0x02, 0xC9, 0x3E, 0x14, 0x82, 0x6A, 0x47, 0x8E,
0xC4, 0x47, 0xD8, 0x48, 0x79, 0x74, 0x66, 0x7F,
0x68, 0x08, 0x7E, 0x77, 0x39, 0x24, 0x80, 0xF3,
0x16, 0x83, 0x89, 0xC8, 0x1C, 0x6F, 0x4D, 0x9F,
},
DQ = new byte[]
{
0x32, 0xEA, 0xFC, 0xDE, 0x90, 0x39, 0xC2, 0xAB,
0x1A, 0x10, 0xF1, 0xCC, 0xA4, 0x92, 0xD6, 0xF8,
0xF2, 0x68, 0x9C, 0x38, 0xF7, 0x75, 0xDB, 0xCE,
0x72, 0xE7, 0xEA, 0x28, 0x0C, 0x85, 0x7C, 0x83,
0xAC, 0x07, 0x12, 0xAC, 0x1F, 0x89, 0x22, 0x37,
0xF3, 0x22, 0x47, 0x0F, 0x7C, 0xE1, 0x88, 0x5B,
0x38, 0xDB, 0x50, 0xFA, 0x5A, 0x60, 0xC7, 0x24,
0x5D, 0xE7, 0x02, 0x4E, 0x60, 0xE4, 0x9F, 0x9F,
},
InverseQ = new byte[]
{
0xB1, 0xE1, 0x44, 0xDD, 0xFB, 0x21, 0xA7, 0xF8,
0x54, 0x8E, 0x05, 0x1D, 0x11, 0x2B, 0xC3, 0xE3,
0x56, 0x29, 0x17, 0xEB, 0xD9, 0x9B, 0x3D, 0xAA,
0xBA, 0x8E, 0x55, 0x68, 0x00, 0xD8, 0x10, 0x04,
0xD6, 0x53, 0x8D, 0xE4, 0xBE, 0x81, 0xF6, 0x20,
0x73, 0xF3, 0x7C, 0xAB, 0xB4, 0x61, 0x2D, 0xD8,
0x81, 0x32, 0x0C, 0x1C, 0xFD, 0xCB, 0xB0, 0xAB,
0x22, 0x5F, 0x7B, 0x41, 0xD8, 0x32, 0x59, 0xA3,
},
};
internal static readonly RSAParameters RsaBigExponentParams = new RSAParameters
{
Modulus = (
"AF81C1CBD8203F624A539ED6608175372393A2837D4890E48A19DED369731156" +
"20968D6BE0D3DAA38AA777BE02EE0B6B93B724E8DCC12B632B4FA80BBC925BCE" +
"624F4CA7CC606306B39403E28C932D24DD546FFE4EF6A37F10770B2215EA8CBB" +
"5BF427E8C4D89B79EB338375100C5F83E55DE9B4466DDFBEEE42539AEF33EF18" +
"7B7760C3B1A1B2103C2D8144564A0C1039A09C85CF6B5974EB516FC8D6623C94" +
"AE3A5A0BB3B4C792957D432391566CF3E2A52AFB0C142B9E0681B8972671AF2B" +
"82DD390A39B939CF719568687E4990A63050CA7768DCD6B378842F18FDB1F6D9" +
"FF096BAF7BEB98DCF930D66FCFD503F58D41BFF46212E24E3AFC45EA42BD8847").HexToByteArray(),
Exponent = new byte[] { 0x02, 0x00, 0x00, 0x04, 0x41 },
D = (
"64AF9BA5262483DA92B53F13439FD0EF13012F879ABC03CB7C06F1209904F352" +
"C1F223519DC48BFAEEBB511B0D955F6167B50E034FEA2ABC590B4EA9FBF0C51F" +
"9FFEA16F7927AE681CBF7358452BCA29D58705E0CAA106013B09A6F5F5911498" +
"D2C4FD6915585488E5F3AD89836C93C8775AFAB4D13C2014266BE8EE6B8AA66C" +
"9E942D493466C8E3A370F8E6378CE95D637E03673670BE4BCACE5FCDADD238D9" +
"F32CA35DE845776AC4BF36118812328C493F91C25A9BD42672D0AFAFDE0AF7E6" +
"19078D48B485EF91933DDCFFB54587B8F512D223C81894E91784982F3C5C6587" +
"1351F4655AB023C4AD99B6B03A96F9046CE124A471E828F05F8DB3BC7CCCF2D1").HexToByteArray(),
P = (
"E43A3826A97204AE3CD8649A84DB4BBF0725C4B08F8C43840557A0CD04E313AF" +
"6D0460DDE69CDC508AD043D72514DA7A66BC918CD9624F485644B9DEEAB2BE0E" +
"112956D472CF0FD51F80FD33872D2DCC562A0588B012E8C90CE7D254B94792C6" +
"E7A02B3CCAA150E67A64377ACC49479AD5EB555493B2100CB0410956F7D73BF5").HexToByteArray(),
Q = (
"C4DD2D7ADD6CA50740D3973F40C4DEBDBAB51F7F5181ABAE726C32596A3EDD0A" +
"EE44DAADDD8A9B7A864C4FFDAE00C4CB1F10177BA01C0466F812D522610F8C45" +
"43F1C3EF579FA9E13AE8DA1A4A8DAE307861D2CEAC03560279B61B6514989883" +
"FE86C5C7420D312838FC2F70BED59B5229654201882664CEFA38B48A3723E9CB").HexToByteArray(),
DP = (
"09ECF151F5CDD2C9E6E52682364FA5B4ED094F622E4031BF46B851358A584DCC" +
"B5328B0BD9B63589183F491593D2A3ACAD14E0AACDA1F181B5C7D93C57ED26E6" +
"2C9FC26AF37E4A0644ECE82A7BA8AED88FF1D8E9C56CC66385CDB244EB3D57D1" +
"7E6AD420B19C9E2BEE18192B816265B74DA55FA3825F922D9D8E835B76BF3071").HexToByteArray(),
DQ = (
"89B33B695789174B88368C494639D4D3267224572A40B2FE61910384228E3DBD" +
"11EED9040CD03977E9E0D7FC8BFC4BF4A93283529FF1D96590B18F4EABEF0303" +
"794F293E88DC761B3E23AFECB19F29F8A4D2A9058B714CF3F4D10733F13EA72B" +
"BF1FBEC8D71E106D0CE2115F3AD2DE020325C3879A091C413CD6397F83B3CB89").HexToByteArray(),
InverseQ = (
"7C57ED74C9176FBA76C23183202515062C664D4D49FF3E037047A309DA10F159" +
"0CE01B7A1CD1A4326DC75883DFF93110AB065AAED140C9B98176A8810809ADEC" +
"75E86764A0951597EF467FA8FD509181CD2E491E43BE41084E5BE1B562EE76E9" +
"F92C9AB1E5AEAD9D291A6337E4DE85BDE67A0D72B4E55ADCF207F7A5A5225E15").HexToByteArray()
};
public static readonly RSAParameters CspTestKey = new RSAParameters
{
Modulus = ByteUtils.HexToByteArray("e06aac9ec3e98bae9ebaf921eb7898f34a58a6a4f6370a9d767cd1f0492e7969b4defdb11b1795a63fefb3359b55c392ecb22f5791e1d925ea5cf74bc5094ddc0164ebb021028423151c7641181940112b0d46e9562d3cec8364d58be8d9c84910e196fa458f633cf6431354df98b773c32c0cf6d18147222a96824b64019ae1"),
Exponent = ByteUtils.HexToByteArray("010001"),
D = ByteUtils.HexToByteArray("143d3aa534e8feaa7871475faa435d93ef7c104767572e736608bacc4f654c18def18f72a60d59f73ce3eac72663b5382e75a17465d93702c6e0ac82de59c8f627b01b1bc02b0aa98925b4a010d2c5c563544daeabf148997d8d016b63fa3ce05b3788c5ae9ba0d5ea9b990804f40ac7ebbe62f8b9b884c154a0f8628b00ac43"),
P = ByteUtils.HexToByteArray("e1aab100887245692770c5059cf3b6f2dabb83b015c61a229806e298a79bd360609d4b5894a1c231c9b47fd7b7a4f1a44b3870acf80373b484e5296e9f3ab47b"),
DP = ByteUtils.HexToByteArray("4966e0fe0063d2e9fa37370eb5579ca96fb6508644fed3df6ebdc694cae7e7a050acb9264dea33a5482b9aedcac12f0c369f5c1f16e8e088d63547fdc07332e3"),
Q = ByteUtils.HexToByteArray("fe94f7aa687940d862b0f6f44165656bf81acc5790a9d065624dd0f9d239d39e77d5c3038a317593ce7b24f31e76ce2654ca3cccf878a12088ae8d87b5111553"),
DQ = ByteUtils.HexToByteArray("6c501eeb1e95f013e03160705d5e717f3548d985abe3c3e94ea0c2f7770ce94f33b6fbc886c4323d178d671414f3011467e0bf6b898f71263160ea9041662a47"),
InverseQ = ByteUtils.HexToByteArray("97d9b81076a4b08a1427168b3deacfb3d65d2a5ce23e098671cd1150882161f3911b60e02f6ebbc9a5009d06ef50f2c51ed2da8f787c5b7d63bc7bc0fe1cf75a"),
};
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Text;
using Test.Cryptography;
namespace System.Security.Cryptography.Rsa.Tests
{
// Note to contributors:
// Keys contained in this file should be randomly generated for the purpose of inclusion here,
// or obtained from some fixed set of test data. (Please) DO NOT use any key that has ever been
// used for any real purpose.
//
// Note to readers:
// The keys contained in this file should all be treated as compromised. That means that you
// absolutely SHOULD NOT use these keys on anything that you actually want to be protected.
internal class TestData
{
public static readonly byte[] HelloBytes = new ASCIIEncoding().GetBytes("Hello");
public static readonly RSAParameters RSA384Parameters = new RSAParameters
{
Modulus = new byte[]
{
0xDA, 0xCC, 0x22, 0xD8, 0x6E, 0x67, 0x15, 0x75,
0x03, 0x2E, 0x31, 0xF2, 0x06, 0xDC, 0xFC, 0x19,
0x2C, 0x65, 0xE2, 0xD5, 0x10, 0x89, 0xE5, 0x11,
0x2D, 0x09, 0x6F, 0x28, 0x82, 0xAF, 0xDB, 0x5B,
0x78, 0xCD, 0xB6, 0x57, 0x2F, 0xD2, 0xF6, 0x1D,
0xB3, 0x90, 0x47, 0x22, 0x32, 0xE3, 0xD9, 0xF5,
},
Exponent = new byte[]
{
0x01, 0x00, 0x01,
},
D = new byte[]
{
0x7A, 0x59, 0xBD, 0x02, 0x9A, 0x7A, 0x3A, 0x9D,
0x7C, 0x71, 0xD0, 0xAC, 0x2E, 0xFA, 0x54, 0x5F,
0x1F, 0x5C, 0xBA, 0x43, 0xBB, 0x43, 0xE1, 0x3B,
0x78, 0x77, 0xAF, 0x82, 0xEF, 0xEB, 0x40, 0xC3,
0x8D, 0x1E, 0xCD, 0x73, 0x7F, 0x5B, 0xF9, 0xC8,
0x96, 0x92, 0xB2, 0x9C, 0x87, 0x5E, 0xD6, 0xE1,
},
P = new byte[]
{
0xFA, 0xDB, 0xD7, 0xF8, 0xA1, 0x8B, 0x3A, 0x75,
0xA4, 0xF6, 0xDF, 0xAE, 0xE3, 0x42, 0x6F, 0xD0,
0xFF, 0x8B, 0xAC, 0x74, 0xB6, 0x72, 0x2D, 0xEF,
},
DP = new byte[]
{
0x24, 0xFF, 0xBB, 0xD0, 0xDD, 0xF2, 0xAD, 0x02,
0xA0, 0xFC, 0x10, 0x6D, 0xB8, 0xF3, 0x19, 0x8E,
0xD7, 0xC2, 0x00, 0x03, 0x8E, 0xCD, 0x34, 0x5D,
},
Q = new byte[]
{
0xDF, 0x48, 0x14, 0x4A, 0x6D, 0x88, 0xA7, 0x80,
0x14, 0x4F, 0xCE, 0xA6, 0x6B, 0xDC, 0xDA, 0x50,
0xD6, 0x07, 0x1C, 0x54, 0xE5, 0xD0, 0xDA, 0x5B,
},
DQ = new byte[]
{
0x85, 0xDF, 0x73, 0xBB, 0x04, 0x5D, 0x91, 0x00,
0x6C, 0x2D, 0x45, 0x9B, 0xE6, 0xC4, 0x2E, 0x69,
0x95, 0x4A, 0x02, 0x24, 0xAC, 0xFE, 0x42, 0x4D,
},
InverseQ = new byte[]
{
0x1A, 0x3A, 0x76, 0x9C, 0x21, 0x26, 0x2B, 0x84,
0xCA, 0x9C, 0xA9, 0x62, 0x0F, 0x98, 0xD2, 0xF4,
0x3E, 0xAC, 0xCC, 0xD4, 0x87, 0x9A, 0x6F, 0xFD,
},
};
public static readonly RSAParameters RSA1024Params = new RSAParameters
{
Modulus = new byte[]
{
0x9F, 0x05, 0x1F, 0xCE, 0x71, 0xCA, 0x2E, 0x17,
0x0F, 0x43, 0xC6, 0x04, 0x4A, 0x6F, 0xB7, 0x84,
0xD8, 0xAD, 0x62, 0x5B, 0xDB, 0x87, 0x4B, 0x05,
0xAD, 0x03, 0x76, 0x19, 0x63, 0xEE, 0x2A, 0x9D,
0xCC, 0x7D, 0xAF, 0x3A, 0x51, 0x23, 0xAE, 0x7F,
0x19, 0xA6, 0x63, 0xBF, 0x65, 0x6B, 0x5E, 0x37,
0x1C, 0x6A, 0x0A, 0xA7, 0xF0, 0x82, 0xB1, 0xBD,
0xC3, 0x21, 0x50, 0x21, 0x23, 0xEF, 0x40, 0x30,
0x93, 0x11, 0x11, 0x5C, 0xF7, 0x5B, 0x42, 0x72,
0x18, 0xDE, 0xFE, 0x1B, 0xF6, 0x0E, 0x02, 0xBF,
0x28, 0x56, 0xFB, 0x7C, 0xB5, 0xF1, 0x88, 0xCD,
0x66, 0x8F, 0xC1, 0xCA, 0xBA, 0xF9, 0x83, 0x7E,
0x09, 0x5B, 0xD2, 0x91, 0xB9, 0x16, 0x5C, 0x2B,
0x0C, 0x8E, 0x91, 0xBB, 0xC3, 0x84, 0x0D, 0x73,
0xEE, 0xA2, 0x30, 0x82, 0x2F, 0x3C, 0x90, 0x50,
0x88, 0xA7, 0x92, 0x96, 0x99, 0x0C, 0x68, 0xBD,
},
Exponent = new byte[]
{
0x01, 0x00, 0x01,
},
D = new byte[]
{
0x4A, 0xE6, 0xF9, 0x7F, 0xDE, 0xE6, 0x5A, 0x46,
0x5F, 0x58, 0xCF, 0x8D, 0x56, 0xD8, 0x7F, 0x6B,
0x72, 0x3A, 0x5D, 0x21, 0xA2, 0x6A, 0x7C, 0x42,
0x7C, 0xA7, 0xAC, 0x39, 0xB2, 0x71, 0xCD, 0x1E,
0x0D, 0xE3, 0xC7, 0xA5, 0x62, 0xF1, 0xB9, 0x30,
0x42, 0x0F, 0x37, 0x5D, 0xC0, 0x72, 0x4D, 0xEB,
0x0C, 0x95, 0xC0, 0x56, 0x31, 0x7A, 0x06, 0x29,
0xB9, 0x9F, 0x57, 0xE4, 0x7C, 0x4E, 0x25, 0xFF,
0xDD, 0x11, 0x0E, 0xD9, 0xE8, 0xC0, 0x4F, 0x98,
0xC6, 0x13, 0xD7, 0x24, 0x7E, 0x3C, 0x3E, 0xB4,
0xC7, 0x85, 0x8F, 0xD5, 0x94, 0x0B, 0x12, 0x54,
0xF8, 0xA0, 0x0B, 0x61, 0x6F, 0xDD, 0xE8, 0x9B,
0x91, 0x9D, 0x2A, 0x6F, 0x15, 0x99, 0x8C, 0x91,
0xB9, 0x3D, 0xEF, 0x65, 0xC7, 0x78, 0xA6, 0x57,
0x52, 0xC4, 0x17, 0x5B, 0xFC, 0xA8, 0x65, 0x4E,
0x1E, 0x95, 0x82, 0x6B, 0x15, 0x49, 0x6C, 0x6B,
},
P = new byte[]
{
0xD2, 0x4B, 0x09, 0x03, 0x92, 0x29, 0x95, 0xE7,
0x65, 0x94, 0x19, 0x4F, 0x20, 0xD2, 0xB7, 0xF6,
0xB9, 0xB0, 0x78, 0x1F, 0xB7, 0xC2, 0xDD, 0xB4,
0x68, 0xB5, 0xFD, 0x7D, 0xD1, 0x92, 0xBA, 0xA8,
0x50, 0x1E, 0xDC, 0x44, 0x79, 0xBF, 0x21, 0x2F,
0xC2, 0xB5, 0xA0, 0x08, 0x0E, 0xCE, 0x80, 0x0C,
0x37, 0xF6, 0x60, 0xEA, 0xBB, 0x57, 0x7E, 0xA5,
0x74, 0x82, 0x8A, 0x9F, 0xA7, 0x5B, 0x42, 0x03,
},
DP = new byte[]
{
0x77, 0xCD, 0x77, 0x9D, 0x29, 0x2F, 0xB7, 0xCE,
0xD3, 0xF7, 0xC3, 0x53, 0x69, 0x07, 0xA2, 0xF6,
0x54, 0x63, 0x4C, 0x8C, 0x05, 0x4C, 0x66, 0xB1,
0xD8, 0xD5, 0x95, 0x4C, 0x90, 0x90, 0x5E, 0xF6,
0x74, 0x6E, 0xA0, 0x5E, 0x02, 0x5D, 0xF8, 0xB2,
0x14, 0xE3, 0x14, 0x00, 0x83, 0x2E, 0xF1, 0x94,
0x04, 0x6D, 0xC0, 0x58, 0xF9, 0xD1, 0xA6, 0xBC,
0xEB, 0xDB, 0x52, 0xCE, 0x11, 0xB1, 0xD3, 0xB1,
},
Q = new byte[]
{
0xC1, 0x95, 0x31, 0x1A, 0xF4, 0xE5, 0xA4, 0x1F,
0xAC, 0x86, 0x48, 0x35, 0x9B, 0x7E, 0x72, 0xF9,
0x82, 0x17, 0x2A, 0x86, 0x0A, 0x3D, 0x31, 0xCC,
0xD1, 0x1C, 0x23, 0xBB, 0x64, 0x90, 0xDF, 0x1F,
0x56, 0xA7, 0x48, 0x24, 0x9E, 0xAF, 0x18, 0xE3,
0x0C, 0xB6, 0xE6, 0x7B, 0xE4, 0x1F, 0xF7, 0x19,
0x6D, 0x4E, 0xDB, 0xA9, 0x50, 0xCD, 0xD6, 0x28,
0x62, 0xEF, 0x65, 0x72, 0x48, 0xA9, 0x0E, 0x3F,
},
DQ = new byte[]
{
0xAE, 0x52, 0x33, 0x0E, 0x1B, 0x4A, 0x50, 0x29,
0x55, 0xAA, 0xF6, 0x8B, 0x8F, 0xA2, 0xA6, 0xD6,
0x98, 0x97, 0x53, 0xEB, 0xB0, 0x7C, 0xBA, 0xC3,
0xBD, 0xEA, 0xA1, 0x22, 0xB6, 0xC4, 0xDE, 0xA7,
0xD1, 0xD8, 0x81, 0xD6, 0xB8, 0x2E, 0xE5, 0x32,
0x50, 0xD8, 0xC3, 0x64, 0xFD, 0x60, 0xEB, 0x9B,
0x32, 0x1B, 0xB9, 0x23, 0x17, 0x68, 0xC4, 0x59,
0x49, 0xFE, 0x5A, 0x54, 0x37, 0xAA, 0x44, 0xF1,
},
InverseQ = new byte[]
{
0x2A, 0x39, 0xAF, 0xE2, 0x76, 0x06, 0x48, 0x8F,
0x49, 0x93, 0xDF, 0x01, 0xCD, 0x7B, 0xB2, 0xC6,
0x68, 0x15, 0xAF, 0x0E, 0xC9, 0xF1, 0xE0, 0x15,
0x3D, 0xA9, 0x68, 0x27, 0xD6, 0x64, 0x1E, 0x08,
0xDC, 0x01, 0x3B, 0x38, 0x32, 0x62, 0x4F, 0xCD,
0x0C, 0x09, 0xF7, 0x9A, 0x6B, 0xCA, 0x0F, 0x76,
0xC2, 0xFB, 0xDD, 0x7C, 0x5D, 0xF1, 0x85, 0x16,
0x67, 0x9F, 0x98, 0xA7, 0xF3, 0x40, 0x7D, 0x1C,
},
};
public static readonly RSAParameters RSA1032Parameters = new RSAParameters
{
Modulus = new byte[]
{
0xBC, 0xAC, 0xB1, 0xA5, 0x34, 0x9D, 0x7B, 0x35,
0xA5, 0x80, 0xAC, 0x3B, 0x39, 0x98, 0xEB, 0x15,
0xEB, 0xF9, 0x00, 0xEC, 0xB3, 0x29, 0xBF, 0x1F,
0x75, 0x71, 0x7A, 0x00, 0xB2, 0x19, 0x9C, 0x8A,
0x18, 0xD7, 0x91, 0xB5, 0x92, 0xB7, 0xEC, 0x52,
0xBD, 0x5A, 0xF2, 0xDB, 0x0D, 0x3B, 0x63, 0x5F,
0x05, 0x95, 0x75, 0x3D, 0xFF, 0x7B, 0xA7, 0xC9,
0x87, 0x2D, 0xBF, 0x7E, 0x32, 0x26, 0xDE, 0xF4,
0x4A, 0x07, 0xCA, 0x56, 0x8D, 0x10, 0x17, 0x99,
0x2C, 0x2B, 0x41, 0xBF, 0xE5, 0xEC, 0x35, 0x70,
0x82, 0x4C, 0xF1, 0xF4, 0xB1, 0x59, 0x19, 0xFE,
0xD5, 0x13, 0xFD, 0xA5, 0x62, 0x04, 0xAF, 0x20,
0x34, 0xA2, 0xD0, 0x8F, 0xF0, 0x4C, 0x2C, 0xCA,
0x49, 0xD1, 0x68, 0xFA, 0x03, 0xFA, 0x2F, 0xA3,
0x2F, 0xCC, 0xD3, 0x48, 0x4C, 0x15, 0xF0, 0xA2,
0xE5, 0x46, 0x7C, 0x76, 0xFC, 0x76, 0x0B, 0x55,
0x09,
},
Exponent = new byte[]
{
0x01, 0x00, 0x01,
},
D = new byte[]
{
0x9E, 0x59, 0x25, 0xE2, 0xEC, 0x6C, 0xBB, 0x4A,
0x83, 0xF3, 0xA1, 0x19, 0x37, 0xB6, 0xE2, 0x9E,
0x8C, 0x64, 0x78, 0x65, 0x2F, 0xDC, 0xFA, 0x9D,
0xD1, 0x78, 0x82, 0x97, 0x70, 0xE2, 0x53, 0xE2,
0x07, 0x05, 0x6D, 0x32, 0x01, 0xC8, 0x41, 0x1C,
0x13, 0xF5, 0xEF, 0xDA, 0xEE, 0x99, 0x08, 0x46,
0x68, 0xAE, 0x4E, 0x2E, 0xD1, 0x6C, 0x1B, 0x9E,
0xE4, 0xC7, 0xFD, 0x6E, 0x51, 0x73, 0x14, 0x2D,
0xC5, 0x9F, 0xC6, 0x45, 0xA4, 0xC2, 0xE6, 0x65,
0x5D, 0xAC, 0xE6, 0x71, 0xB3, 0x00, 0xDE, 0x0D,
0x7B, 0xB5, 0x2D, 0x68, 0xA8, 0x60, 0x26, 0xC1,
0x8F, 0x02, 0x47, 0x26, 0xE7, 0x71, 0xBD, 0x04,
0x81, 0x99, 0x44, 0x2F, 0x03, 0x42, 0x70, 0x96,
0x58, 0xEF, 0xF6, 0x4A, 0xE4, 0x2E, 0xA4, 0x17,
0x32, 0x47, 0xEC, 0xD2, 0x4A, 0x86, 0x29, 0x9E,
0x8B, 0x9D, 0x11, 0x52, 0x00, 0x02, 0xC8, 0xF5,
0xF1,
},
P = new byte[]
{
0x0E, 0x15, 0x30, 0x0A, 0x9D, 0x34, 0xBA, 0x37,
0xB6, 0xBD, 0xA8, 0x31, 0xBC, 0x67, 0x27, 0xB2,
0xF7, 0xF6, 0xD0, 0xEF, 0xB7, 0xB3, 0x3A, 0x99,
0xC9, 0xAF, 0x28, 0xCF, 0xD6, 0x25, 0xE2, 0x45,
0xA5, 0x4F, 0x25, 0x1B, 0x78, 0x4C, 0x47, 0x91,
0xAD, 0xA5, 0x85, 0xAD, 0xB7, 0x11, 0xD9, 0x30,
0x0A, 0x3D, 0x52, 0xB4, 0x50, 0xCC, 0x30, 0x7F,
0x55, 0xD3, 0x1E, 0x12, 0x17, 0xB9, 0xFF, 0xD7,
0x45,
},
DP = new byte[]
{
0x0D, 0x9D, 0xB4, 0xBE, 0x7E, 0x73, 0x0D, 0x9D,
0x72, 0xA5, 0x7B, 0x2A, 0xE3, 0x73, 0x85, 0x71,
0xC7, 0xC8, 0x2F, 0x09, 0xA7, 0xBE, 0xB5, 0xE9,
0x1D, 0x94, 0xAA, 0xCC, 0x10, 0xCC, 0xBE, 0x33,
0x02, 0x7B, 0x3C, 0x70, 0x8B, 0xE6, 0x8C, 0xC8,
0x30, 0x71, 0xBA, 0x87, 0x54, 0x5B, 0x00, 0x78,
0x2F, 0x5E, 0x4D, 0x49, 0xA4, 0x59, 0x58, 0x86,
0xB5, 0x6F, 0x93, 0x42, 0x81, 0x08, 0x48, 0x72,
0x55,
},
Q = new byte[]
{
0x0D, 0x65, 0xC6, 0x0D, 0xE8, 0xB6, 0xF5, 0x4A,
0x77, 0x56, 0xFD, 0x1C, 0xCB, 0xA7, 0x6C, 0xE4,
0x1E, 0xF4, 0x46, 0xD0, 0x24, 0x03, 0x1E, 0xE9,
0xC5, 0xA4, 0x09, 0x31, 0xB0, 0x73, 0x36, 0xCF,
0xED, 0x35, 0xA8, 0xEE, 0x58, 0x0E, 0x19, 0xDB,
0x85, 0x92, 0xCB, 0x0F, 0x26, 0x6E, 0xC6, 0x90,
0x28, 0xEB, 0x9E, 0x98, 0xE3, 0xE8, 0x4F, 0xF1,
0xA4, 0x59, 0xA8, 0xA2, 0x68, 0x60, 0xA6, 0x10,
0xF5,
},
DQ = new byte[]
{
0x0C, 0xF6, 0xFB, 0xDD, 0xE1, 0xE1, 0x8B, 0x25,
0x70, 0xAF, 0x21, 0x69, 0x88, 0x3A, 0x90, 0xC9,
0x80, 0x9A, 0xEB, 0x1B, 0xE8, 0x7D, 0x8C, 0xA0,
0xB4, 0xBD, 0xB4, 0x97, 0xFD, 0x24, 0xC1, 0x5A,
0x1D, 0x36, 0xDC, 0x2F, 0x29, 0xCF, 0x1B, 0x7E,
0xAF, 0x98, 0x0A, 0x20, 0xB3, 0x14, 0x67, 0xDA,
0x81, 0x7E, 0xE1, 0x8F, 0x1A, 0x9D, 0x69, 0x1F,
0x71, 0xE7, 0xC1, 0xA4, 0xC8, 0x55, 0x1E, 0xDF,
0x31,
},
InverseQ = new byte[]
{
0x01, 0x0C, 0xE9, 0x93, 0x6E, 0x96, 0xFB, 0xAD,
0xF8, 0x72, 0x40, 0xCC, 0x41, 0x9D, 0x01, 0x08,
0x1B, 0xB6, 0x7C, 0x98, 0x1D, 0x44, 0x31, 0x4E,
0x58, 0x58, 0x3A, 0xC7, 0xFE, 0x93, 0x79, 0xEA,
0x02, 0x72, 0xE6, 0xC4, 0xC7, 0xC1, 0x46, 0x38,
0xE1, 0xD5, 0xEC, 0xE7, 0x84, 0x0D, 0xDB, 0x15,
0xA1, 0x2D, 0x70, 0x54, 0xA4, 0x18, 0xF8, 0x76,
0x4F, 0xA5, 0x4C, 0xE1, 0x34, 0xEB, 0xD2, 0x63,
0x5E,
},
};
public static readonly RSAParameters RSA2048Params = new RSAParameters
{
Modulus = new byte[]
{
0xB1, 0x7C, 0xEE, 0x77, 0xB4, 0x59, 0xA4, 0x65,
0x92, 0x8D, 0x7F, 0x55, 0x77, 0x80, 0x39, 0xBA,
0x22, 0xBA, 0x29, 0xA5, 0xFF, 0xE5, 0x53, 0xFB,
0x40, 0x98, 0xA8, 0x35, 0xE5, 0x2D, 0x0A, 0xDC,
0x85, 0x17, 0x6E, 0xE4, 0xD6, 0x93, 0x82, 0x20,
0x71, 0x8D, 0xE9, 0xDD, 0xC9, 0xD5, 0xBD, 0x30,
0x47, 0xEE, 0x59, 0xB9, 0xE6, 0xA8, 0x79, 0x9E,
0x47, 0x96, 0x8E, 0x63, 0xCD, 0xA6, 0x28, 0x9D,
0x7B, 0x6D, 0x83, 0xAA, 0x68, 0xE2, 0x46, 0xD6,
0x1C, 0x8C, 0x2B, 0xA1, 0xC4, 0x04, 0x12, 0xAE,
0x61, 0x07, 0xAF, 0x6F, 0xE9, 0x2B, 0x48, 0x5C,
0xCA, 0xC2, 0x0E, 0x52, 0x71, 0x21, 0x03, 0xE0,
0x05, 0x1C, 0x07, 0xC0, 0x56, 0xFD, 0x8A, 0x61,
0x7A, 0x95, 0x39, 0x4B, 0xAA, 0x5A, 0x9D, 0x03,
0x6D, 0x7A, 0x51, 0x3E, 0x7A, 0xE4, 0xAB, 0xED,
0xB4, 0x0A, 0x88, 0x80, 0x3C, 0x07, 0xED, 0x19,
0x21, 0xA2, 0xDC, 0xD7, 0x9C, 0x3F, 0x3B, 0x19,
0x59, 0x33, 0x39, 0x8A, 0x25, 0xDB, 0xCE, 0x8D,
0x8E, 0x10, 0xDA, 0xB1, 0x38, 0x32, 0xCA, 0x59,
0xA1, 0x69, 0x3C, 0x23, 0x76, 0x50, 0x37, 0xB3,
0xBF, 0x73, 0x58, 0x77, 0x38, 0xC5, 0x16, 0x03,
0x60, 0x36, 0x0D, 0x31, 0x8C, 0xBE, 0xA5, 0x12,
0x2F, 0xE5, 0x16, 0xAD, 0x1C, 0x80, 0x01, 0x50,
0xEB, 0x3C, 0x86, 0x79, 0x22, 0xD3, 0x7F, 0xD4,
0x90, 0x85, 0xB8, 0xEB, 0xB0, 0x7D, 0xD8, 0xC8,
0x8B, 0xBB, 0x88, 0xBE, 0xFE, 0xB8, 0xBA, 0xAD,
0x61, 0xC7, 0xF9, 0x68, 0x20, 0xB2, 0xA9, 0x1D,
0xB4, 0xDC, 0xB0, 0x5B, 0xC7, 0xB3, 0xF2, 0x83,
0x35, 0x43, 0xB0, 0xAE, 0x19, 0x2B, 0xA6, 0xFA,
0x88, 0x48, 0xB9, 0xFB, 0xB3, 0xCD, 0xF8, 0xA9,
0x9C, 0x20, 0x6F, 0x63, 0x23, 0xE5, 0xC2, 0x85,
0xCD, 0x75, 0x7A, 0x55, 0x04, 0xA4, 0x08, 0x99,
},
Exponent = new byte[]
{
0x01, 0x00, 0x01,
},
D = new byte[]
{
0x2C, 0x96, 0x86, 0x11, 0xEC, 0x6C, 0xD8, 0xAF,
0xEB, 0xB1, 0x40, 0x5B, 0xE8, 0x39, 0x7E, 0x47,
0x14, 0x92, 0x50, 0x04, 0x33, 0xD5, 0x18, 0xD3,
0xF5, 0xD6, 0x63, 0xEB, 0xA6, 0x37, 0x3A, 0x93,
0x4B, 0x9C, 0x27, 0x6F, 0xB5, 0xB8, 0x38, 0xE8,
0x8D, 0x9E, 0x69, 0x32, 0x1E, 0x92, 0x63, 0x84,
0xCD, 0x8D, 0x43, 0x5D, 0x40, 0x64, 0xF2, 0xA8,
0xA0, 0xB3, 0x61, 0xF2, 0x10, 0xA7, 0xBD, 0x6C,
0x52, 0xA5, 0xA0, 0x7E, 0x1E, 0xFB, 0x39, 0x70,
0x70, 0x9B, 0x86, 0x1A, 0x8D, 0x73, 0xB8, 0x7D,
0xB6, 0x42, 0x88, 0x00, 0x45, 0x43, 0x6A, 0x5A,
0x65, 0x55, 0x7A, 0xE3, 0x9B, 0x28, 0x00, 0x21,
0x37, 0x27, 0x63, 0x8B, 0x1E, 0x4F, 0x73, 0x84,
0x29, 0x97, 0x73, 0x5D, 0x5E, 0xDE, 0x84, 0xB3,
0x67, 0xBD, 0x62, 0xCB, 0x9F, 0x73, 0xF2, 0xFD,
0x34, 0x4D, 0xB1, 0x1D, 0x05, 0xF7, 0xB7, 0xC8,
0x3C, 0x69, 0xF6, 0x2C, 0x5B, 0x78, 0xC6, 0xB0,
0x55, 0xBF, 0x8B, 0x58, 0xF1, 0xC2, 0x9F, 0x19,
0x4A, 0x17, 0x53, 0x60, 0xDA, 0x52, 0x6F, 0x2E,
0xDE, 0x0F, 0x64, 0x9D, 0x4F, 0xB8, 0xAF, 0x50,
0x2B, 0x8F, 0x99, 0x1E, 0x15, 0x78, 0x32, 0xD7,
0x37, 0x06, 0xC3, 0x08, 0x5D, 0x1C, 0x04, 0xB1,
0x6D, 0x46, 0x84, 0xC9, 0xE8, 0xF6, 0x0E, 0x8E,
0x18, 0xEC, 0x4B, 0x84, 0xC5, 0xF3, 0x65, 0x6B,
0x9B, 0x35, 0x0A, 0xDA, 0x7B, 0xC7, 0xAB, 0x6D,
0x58, 0xFA, 0x17, 0x76, 0xC2, 0x67, 0xF1, 0xBA,
0x9B, 0xDD, 0x1F, 0xB4, 0x8A, 0x56, 0x06, 0x67,
0x36, 0x39, 0xE9, 0x1E, 0x82, 0x8A, 0xAA, 0x28,
0x7A, 0xA7, 0xDA, 0x18, 0x01, 0xD5, 0x1C, 0x19,
0x0C, 0x50, 0xAB, 0x09, 0x35, 0xAF, 0xCE, 0x26,
0x00, 0xD4, 0xD0, 0x61, 0xCC, 0x2A, 0x0E, 0x3F,
0xCA, 0xC3, 0xDB, 0x42, 0x16, 0x9B, 0xFF, 0x41,
},
P = new byte[]
{
0xBA, 0x61, 0xFD, 0x65, 0x6D, 0x86, 0xBA, 0xDD,
0x77, 0xB7, 0x11, 0x9E, 0xC8, 0xC9, 0x7D, 0xB8,
0x6A, 0x23, 0x03, 0x3D, 0xE8, 0xC9, 0xB7, 0xD6,
0xDE, 0xF8, 0x15, 0x7C, 0xF7, 0x0B, 0xB1, 0x1D,
0xC8, 0x83, 0xEC, 0x76, 0x57, 0x9F, 0x7F, 0x47,
0x5E, 0xD5, 0x57, 0x34, 0xD9, 0x16, 0xBD, 0xDC,
0xDD, 0xA0, 0xB2, 0xE0, 0x18, 0xD1, 0x70, 0x65,
0x4E, 0x2B, 0x75, 0x15, 0x77, 0xC4, 0x06, 0x3E,
0x80, 0x3E, 0xC2, 0xB6, 0xA7, 0x40, 0x4A, 0x53,
0x61, 0x30, 0x35, 0x46, 0x9F, 0xD4, 0xFC, 0x7D,
0x80, 0xC9, 0x0E, 0xE1, 0x94, 0x9B, 0xC7, 0xFA,
0xBD, 0x46, 0x9B, 0x4C, 0x12, 0x90, 0x7D, 0x9B,
0xF5, 0xE6, 0x82, 0x46, 0xB9, 0xA6, 0xA9, 0xF6,
0x35, 0xBC, 0x07, 0x9E, 0xC4, 0x78, 0x74, 0x6E,
0x44, 0xAC, 0xBF, 0x5C, 0x59, 0x33, 0xDA, 0x59,
0xDE, 0x9B, 0xED, 0x3D, 0x39, 0x1B, 0x36, 0x23,
},
DP = new byte[]
{
0x75, 0xD7, 0x56, 0xBB, 0x36, 0x50, 0xA4, 0xFD,
0x39, 0x9F, 0xC9, 0xC8, 0x36, 0xF3, 0x0E, 0x45,
0xF6, 0xF5, 0x44, 0x2B, 0x74, 0x6F, 0x75, 0x88,
0xA9, 0x58, 0xF9, 0x5D, 0x15, 0x65, 0x93, 0x0A,
0x5D, 0xA8, 0xEB, 0x6C, 0xB7, 0x61, 0xE4, 0xBB,
0x5F, 0x3E, 0x4B, 0xF0, 0xE2, 0x00, 0xFA, 0xF2,
0x16, 0x3E, 0x70, 0x5A, 0x37, 0xD6, 0xD3, 0xD5,
0x79, 0x63, 0x08, 0x98, 0x16, 0x2D, 0x1E, 0x35,
0x8E, 0x28, 0x20, 0x3C, 0x13, 0xEB, 0x16, 0x13,
0x39, 0xB3, 0x9D, 0x3B, 0x95, 0xFA, 0xB7, 0xD9,
0x31, 0xFF, 0xED, 0x24, 0xBB, 0x2C, 0xF3, 0x77,
0x99, 0x0C, 0x77, 0x4B, 0xD5, 0xC0, 0xFD, 0x6A,
0x0A, 0x43, 0x3F, 0xC3, 0x2F, 0xC6, 0x2C, 0x57,
0xBB, 0x09, 0xB3, 0x57, 0xB2, 0xA8, 0xE6, 0x14,
0x81, 0xDF, 0x26, 0xEE, 0x60, 0x87, 0xE4, 0x5A,
0x45, 0xE1, 0x18, 0x52, 0x49, 0x34, 0xE7, 0x39,
},
Q = new byte[]
{
0xF3, 0xC8, 0x6B, 0xA9, 0xA2, 0xD2, 0xD6, 0xAB,
0x64, 0x59, 0x0F, 0x68, 0x0C, 0xC8, 0x69, 0xC6,
0x51, 0xB2, 0x2C, 0x28, 0xB5, 0xDB, 0xDD, 0x00,
0x70, 0x5E, 0xB3, 0x04, 0x38, 0xC4, 0xAA, 0x45,
0xEF, 0x79, 0xAC, 0x79, 0x8F, 0xF1, 0xF6, 0x07,
0x3B, 0xDF, 0xAF, 0x08, 0xE3, 0xDA, 0x21, 0x37,
0x08, 0x41, 0x1F, 0xA0, 0x84, 0x4D, 0xEB, 0xA9,
0x91, 0xB5, 0xB1, 0xD6, 0xD5, 0x3A, 0x16, 0xD5,
0x7E, 0x7A, 0x9D, 0x65, 0xF1, 0x92, 0x87, 0x69,
0xE7, 0x01, 0xFD, 0x60, 0x95, 0x25, 0x1B, 0xF0,
0x79, 0xE0, 0xE1, 0xCA, 0xCE, 0x99, 0x7A, 0xED,
0xC7, 0x8D, 0xA2, 0x3D, 0x8D, 0x30, 0xB1, 0x8E,
0xDA, 0x99, 0xCF, 0x9E, 0x6B, 0x02, 0x28, 0xD4,
0xEC, 0x25, 0xD5, 0x89, 0x74, 0xCA, 0xA2, 0x7E,
0x47, 0xDB, 0xE8, 0xE5, 0x42, 0x6C, 0xD4, 0xDC,
0xAD, 0xDC, 0x31, 0xB2, 0x42, 0xFB, 0x2C, 0x13,
},
DQ = new byte[]
{
0x2F, 0x5F, 0x0F, 0xC4, 0xBB, 0xF6, 0x1A, 0x6E,
0xDD, 0xA6, 0x0C, 0xBF, 0x5C, 0x54, 0x89, 0x71,
0x57, 0x28, 0xB7, 0x3A, 0x05, 0xF4, 0xBE, 0x62,
0x3A, 0x73, 0xBC, 0x77, 0xA2, 0x8C, 0x5C, 0xC6,
0x10, 0x3D, 0xE5, 0x8D, 0x0D, 0xB2, 0xA7, 0xEB,
0x49, 0xF0, 0x32, 0x74, 0x18, 0xCA, 0xA7, 0x4F,
0xA9, 0x53, 0xF6, 0x50, 0x5B, 0xC5, 0x44, 0x79,
0x03, 0xEE, 0x79, 0xAB, 0x54, 0x6D, 0xE0, 0x48,
0x06, 0x36, 0xCF, 0x65, 0x22, 0xE7, 0x25, 0x57,
0x27, 0xE3, 0x94, 0x17, 0xF3, 0x83, 0x6D, 0x85,
0x72, 0x39, 0x87, 0xC6, 0xC0, 0x14, 0xC4, 0xF5,
0x75, 0xA4, 0x89, 0x15, 0x4A, 0xDD, 0x5E, 0x73,
0x72, 0xF9, 0x16, 0x86, 0x23, 0x27, 0x1D, 0x46,
0x1A, 0xC9, 0x53, 0x50, 0x4D, 0x98, 0x9E, 0xB0,
0xC9, 0x47, 0xEB, 0x5E, 0xB9, 0x64, 0xAA, 0x8C,
0x63, 0x60, 0x79, 0x6B, 0xB9, 0x66, 0x53, 0x6F,
},
InverseQ = new byte[]
{
0x0B, 0x16, 0x6B, 0x2E, 0x87, 0xCF, 0x1C, 0x2C,
0x9C, 0x8A, 0x1C, 0x92, 0xD4, 0xD1, 0x1E, 0xA4,
0x87, 0x25, 0x1C, 0xA1, 0x29, 0x7A, 0xE4, 0xD6,
0x65, 0x69, 0x6E, 0x62, 0xBA, 0xEA, 0x41, 0x69,
0x89, 0xBD, 0x78, 0x5A, 0xA1, 0x2C, 0x51, 0x66,
0xA3, 0x3D, 0x1E, 0x51, 0xA6, 0x65, 0x61, 0xA6,
0x6C, 0x2F, 0xAA, 0xDB, 0x5D, 0x6A, 0x94, 0x4E,
0x65, 0x4A, 0x30, 0x42, 0xE1, 0x7A, 0xA8, 0x5B,
0x2D, 0x41, 0x05, 0x82, 0x5F, 0x6D, 0xDD, 0x9D,
0x9A, 0x6A, 0x6E, 0x6E, 0x7C, 0x1B, 0xB3, 0x0B,
0x93, 0x58, 0x10, 0x1C, 0xEF, 0x91, 0xB6, 0x06,
0xBB, 0xE5, 0xAD, 0x15, 0x74, 0x69, 0xA4, 0x64,
0xFF, 0x6B, 0x88, 0x1E, 0xA1, 0x3C, 0xE3, 0xE1,
0x24, 0x53, 0x4D, 0xC8, 0xD1, 0x0B, 0xF7, 0x7D,
0x1B, 0x68, 0xEA, 0xB5, 0x34, 0xE4, 0xFB, 0x1C,
0x6C, 0xCA, 0x7F, 0x2C, 0x71, 0x19, 0x9D, 0xBC,
},
};
public static readonly RSAParameters RSA16384Params = new RSAParameters
{
Modulus = new byte[]
{
0x9B, 0x2C, 0x70, 0x5F, 0xA9, 0x10, 0x37, 0x1F,
0x8B, 0x48, 0xC6, 0xA8, 0xD5, 0x2B, 0x42, 0xD6,
0x9E, 0x6B, 0x28, 0x21, 0x30, 0x70, 0x18, 0xF3,
0x23, 0x5D, 0xFA, 0x02, 0x7D, 0xC1, 0xFC, 0x18,
0xED, 0x86, 0x07, 0xB3, 0x00, 0xEB, 0xAE, 0x27,
0xE7, 0xC0, 0x7C, 0x55, 0x64, 0x8F, 0xB5, 0x47,
0xE1, 0x98, 0x08, 0xF8, 0x60, 0x85, 0xC7, 0x14,
0x0B, 0x2B, 0x31, 0x62, 0x98, 0x5A, 0xF5, 0x16,
0xFA, 0xA7, 0x9C, 0xA8, 0x65, 0xBA, 0x0A, 0xEC,
0xB8, 0x9F, 0x30, 0x98, 0x9B, 0x55, 0x51, 0x1C,
0x4E, 0xFA, 0x51, 0x0A, 0x79, 0x92, 0x02, 0x3E,
0x6D, 0x9C, 0xCF, 0x8D, 0xE7, 0x7C, 0xA0, 0x32,
0x82, 0xC1, 0x9C, 0x7D, 0x2E, 0xF3, 0x8E, 0x88,
0x74, 0xB7, 0x0C, 0x88, 0x88, 0x00, 0xBA, 0xFB,
0xEF, 0x0A, 0xFF, 0x4A, 0xDC, 0xEC, 0xC6, 0xE5,
0xB8, 0x80, 0x6A, 0xC0, 0x60, 0xF7, 0x8D, 0x8B,
0x23, 0x07, 0x42, 0xC0, 0x67, 0x5F, 0x20, 0x6F,
0x72, 0x98, 0xCE, 0xE5, 0x39, 0x97, 0x0B, 0x76,
0xB8, 0x66, 0x56, 0x22, 0x09, 0xBD, 0x44, 0x67,
0x35, 0x2F, 0x8A, 0xF8, 0x45, 0xD1, 0x36, 0x34,
0x27, 0xD4, 0x78, 0x4D, 0x6E, 0x9E, 0x5D, 0x95,
0x47, 0xBC, 0x81, 0x60, 0x57, 0x1A, 0xB8, 0xC9,
0x5F, 0x18, 0xBE, 0x5B, 0x90, 0x13, 0x15, 0x84,
0x49, 0x16, 0x6E, 0xD6, 0xDD, 0x9D, 0x47, 0xEC,
0x22, 0x8A, 0xD6, 0x7A, 0x97, 0x44, 0x6B, 0x81,
0xA4, 0xA4, 0xF5, 0xE0, 0xEA, 0x4A, 0x54, 0x3B,
0x88, 0x81, 0xB8, 0x5D, 0xA4, 0x8A, 0x05, 0x29,
0xDB, 0x5A, 0xE4, 0x18, 0x8A, 0xF3, 0x07, 0x28,
0x32, 0xD6, 0x91, 0x50, 0xFE, 0x14, 0x5E, 0x1A,
0xE0, 0x9B, 0xFD, 0x25, 0x77, 0xAC, 0x5E, 0xD5,
0xF2, 0xA7, 0xE9, 0x9F, 0xDF, 0x2D, 0x86, 0xA7,
0xA2, 0x88, 0xF7, 0xF3, 0x89, 0x9E, 0x8A, 0xA6,
0xB9, 0x57, 0x36, 0xD1, 0x63, 0xFE, 0xE5, 0x40,
0x12, 0xB5, 0x87, 0x9F, 0x73, 0xF6, 0x76, 0x26,
0x32, 0xA7, 0x71, 0xD0, 0xC7, 0xC0, 0x46, 0x9A,
0xF2, 0x51, 0x31, 0xB1, 0xDD, 0xD1, 0x60, 0xEB,
0x89, 0x02, 0x62, 0x58, 0x44, 0x98, 0xA7, 0x65,
0x53, 0x07, 0x73, 0x75, 0x75, 0xC0, 0xD3, 0x8F,
0x91, 0x34, 0x72, 0x47, 0x5F, 0xF5, 0x6B, 0x7E,
0x25, 0x1E, 0xE0, 0x58, 0xC5, 0xB9, 0x6B, 0x17,
0xBB, 0xCB, 0x5C, 0x4C, 0xB3, 0x01, 0xC9, 0x59,
0xA2, 0x3B, 0xEA, 0x39, 0xC1, 0x4C, 0x7A, 0x21,
0xAA, 0xDB, 0x7E, 0xD9, 0x3E, 0x97, 0x16, 0x5B,
0x93, 0xA2, 0x76, 0x26, 0x39, 0xD4, 0x3C, 0x0D,
0xB8, 0x07, 0x05, 0x48, 0x2A, 0x1B, 0xA1, 0xFF,
0x1C, 0x9B, 0xA0, 0x58, 0x12, 0x26, 0xDF, 0x5F,
0x78, 0x40, 0x35, 0x61, 0xE7, 0x90, 0x92, 0xB0,
0x92, 0xC8, 0x9B, 0xC2, 0xF1, 0xC1, 0xC0, 0x60,
0x79, 0x47, 0x3F, 0x1F, 0xC6, 0x36, 0x15, 0x5A,
0xF7, 0x5A, 0xD1, 0x2C, 0x7A, 0x97, 0x34, 0xAD,
0xBD, 0x63, 0x34, 0x32, 0xE4, 0x7F, 0xCB, 0x18,
0x0B, 0xEA, 0x3A, 0x8E, 0xB0, 0x8C, 0x7A, 0x43,
0xFD, 0x60, 0xF1, 0x76, 0xB4, 0xF0, 0x31, 0x7F,
0xF7, 0xA8, 0x77, 0x17, 0xFF, 0xE7, 0xDB, 0x01,
0x88, 0x2D, 0xB0, 0x5C, 0x53, 0x03, 0x69, 0xF9,
0xD6, 0xA7, 0x59, 0x71, 0x5E, 0x21, 0x9C, 0x55,
0x5B, 0xBD, 0x74, 0x4D, 0x8B, 0x7A, 0x09, 0x42,
0x82, 0x73, 0x14, 0xA6, 0xCF, 0x50, 0x94, 0x90,
0xF4, 0x69, 0x76, 0x89, 0x1D, 0x88, 0xB6, 0x54,
0x34, 0x37, 0xCC, 0x57, 0x4C, 0xBE, 0x7F, 0x00,
0x8A, 0x69, 0x6A, 0x2A, 0xD6, 0x46, 0x74, 0x67,
0xFD, 0xDD, 0x86, 0x90, 0x83, 0xE6, 0x2A, 0xD3,
0xB8, 0x5C, 0xE9, 0xFF, 0x15, 0x8B, 0x7A, 0x35,
0x2D, 0x22, 0xBF, 0xC2, 0x9F, 0x41, 0x6C, 0xD6,
0x6C, 0xDC, 0x98, 0x41, 0xBF, 0x83, 0x83, 0x20,
0x03, 0x1F, 0x32, 0xC0, 0x84, 0xA2, 0x4F, 0x14,
0xFA, 0xF1, 0x61, 0x1D, 0x20, 0xA6, 0xA0, 0xDC,
0x73, 0x4E, 0x5F, 0x08, 0xF6, 0x9C, 0xFC, 0x28,
0x92, 0xD1, 0xC8, 0xB4, 0x17, 0xC1, 0xFA, 0x49,
0xCA, 0x57, 0xD6, 0x63, 0x9B, 0xC0, 0x6E, 0x90,
0x20, 0x57, 0xCC, 0x1D, 0xCA, 0x37, 0xCA, 0xAE,
0x8D, 0x90, 0x0D, 0x73, 0x48, 0x60, 0x2A, 0xD5,
0xA5, 0x09, 0x3D, 0x28, 0x50, 0x8C, 0xC2, 0xD7,
0xA4, 0x68, 0x0E, 0xFA, 0x2C, 0xA4, 0x50, 0x6A,
0x2F, 0x79, 0x4D, 0x9B, 0x98, 0x09, 0xBF, 0xB2,
0x43, 0x4D, 0x32, 0xBE, 0x4D, 0x7B, 0x9F, 0x32,
0x0F, 0x28, 0x91, 0xEC, 0xBF, 0xF8, 0xC7, 0x2E,
0xFC, 0x71, 0xA7, 0xD6, 0x33, 0xD4, 0xA7, 0x1B,
0xEE, 0xB6, 0x56, 0x91, 0x3F, 0x7A, 0xFD, 0xC8,
0x83, 0x7C, 0x4D, 0x06, 0xF1, 0xF7, 0x35, 0x92,
0x75, 0x91, 0x43, 0xC4, 0xA6, 0xE6, 0xB5, 0x2C,
0x73, 0xFA, 0xC7, 0x6E, 0x09, 0x1C, 0xCF, 0x30,
0x1B, 0xD0, 0x76, 0xB7, 0x45, 0x63, 0xAD, 0xDE,
0xF1, 0xBF, 0x27, 0x5D, 0x13, 0xD5, 0x82, 0x6B,
0xD6, 0x02, 0x0E, 0x24, 0x14, 0xA5, 0xA4, 0xD9,
0x8F, 0x6C, 0x48, 0x49, 0x70, 0x1C, 0xC5, 0x93,
0xCF, 0x17, 0x3A, 0xAF, 0x43, 0x0B, 0x7C, 0x5C,
0xD2, 0x3D, 0xD7, 0x93, 0x6F, 0x10, 0xEF, 0x70,
0x25, 0x70, 0x4A, 0xB4, 0x18, 0xD7, 0x3E, 0x16,
0xB8, 0xE4, 0x38, 0x9F, 0x9A, 0xCF, 0xA3, 0xDD,
0x70, 0xAA, 0xA4, 0x0D, 0x02, 0x7C, 0xEB, 0x66,
0xAB, 0x07, 0x8B, 0xBE, 0xE2, 0xFD, 0x70, 0xE2,
0xAA, 0xF9, 0xE3, 0xAF, 0x31, 0xF2, 0x57, 0xC0,
0x97, 0xE7, 0xEF, 0xD8, 0x9E, 0xF6, 0x72, 0x1B,
0x2B, 0xDF, 0x53, 0x96, 0xA2, 0x74, 0x2C, 0x54,
0x23, 0xA6, 0x48, 0x1B, 0x6F, 0xDF, 0x8A, 0xFD,
0x2E, 0xEE, 0x95, 0x53, 0xA9, 0xA4, 0xEA, 0x26,
0xD4, 0x93, 0x4B, 0xFA, 0xCE, 0xB5, 0x6F, 0xF0,
0x64, 0xA5, 0x1E, 0xE4, 0x2C, 0x15, 0x03, 0xBB,
0x46, 0x2E, 0x8F, 0x99, 0x7D, 0xDD, 0xCB, 0x02,
0x89, 0x96, 0x5A, 0x53, 0x08, 0x54, 0x25, 0x72,
0xA9, 0x5E, 0x10, 0xF9, 0x88, 0xCB, 0x30, 0xB7,
0x1F, 0x97, 0xD5, 0xD5, 0x15, 0x73, 0x23, 0x0F,
0x06, 0xD3, 0x5E, 0xCF, 0x25, 0xBD, 0x5E, 0xAD,
0x73, 0xF3, 0x92, 0x62, 0xD0, 0x14, 0xFB, 0x26,
0x4D, 0x21, 0x22, 0x24, 0xCB, 0xE8, 0xAD, 0x5C,
0xFB, 0x99, 0x58, 0x10, 0x69, 0x3D, 0x31, 0x65,
0xC2, 0x3A, 0xAB, 0x64, 0x7A, 0x8A, 0x79, 0x2B,
0xF7, 0x15, 0x35, 0x88, 0x2E, 0xC4, 0xAF, 0x0D,
0xE7, 0x67, 0xD2, 0x76, 0x3B, 0x4E, 0x83, 0xA1,
0x98, 0xF7, 0x47, 0x0C, 0xBE, 0xDF, 0x27, 0xC2,
0x7D, 0xB6, 0xD9, 0x93, 0xEC, 0x92, 0xFE, 0x63,
0xC8, 0x8A, 0x9A, 0xC7, 0xC8, 0x08, 0x0D, 0x5B,
0x97, 0xA3, 0x59, 0x2F, 0x6A, 0x24, 0x1B, 0x64,
0xBA, 0xE6, 0x1C, 0x33, 0xE1, 0xAE, 0x49, 0x79,
0x84, 0xD4, 0x31, 0xBC, 0x03, 0xFE, 0x17, 0x57,
0xEC, 0x0C, 0x8C, 0x4C, 0xAA, 0x75, 0x1A, 0x7E,
0x00, 0xE7, 0x77, 0x38, 0x40, 0xF7, 0xF2, 0xDE,
0x0C, 0x3B, 0x81, 0x9D, 0xA7, 0x2B, 0x7B, 0xE3,
0x63, 0x77, 0xA2, 0x51, 0x92, 0x74, 0xD2, 0x6A,
0x22, 0xE4, 0x63, 0x19, 0x41, 0x9B, 0xD7, 0x59,
0x79, 0x58, 0x8D, 0xA2, 0x18, 0xB2, 0x8E, 0xD8,
0x68, 0x16, 0x4D, 0xA9, 0xE7, 0x8C, 0x15, 0x0E,
0xE7, 0xD9, 0xB7, 0x01, 0xF6, 0xFF, 0x45, 0x5F,
0xFF, 0xDF, 0x23, 0x2C, 0xAC, 0xF1, 0x4B, 0xF7,
0x18, 0x34, 0x99, 0x43, 0x69, 0x08, 0x1B, 0x8E,
0x69, 0x66, 0x07, 0x76, 0x5F, 0xBC, 0x2C, 0x97,
0x2E, 0xFC, 0x0A, 0x32, 0x60, 0xF4, 0x53, 0x25,
0x67, 0x7A, 0xDF, 0x4D, 0x0D, 0xE3, 0x1D, 0xEC,
0x34, 0x1A, 0xB0, 0x7B, 0x2D, 0xF1, 0x22, 0x33,
0xE2, 0xB4, 0x7B, 0x11, 0x98, 0xD9, 0xBE, 0x83,
0x21, 0x7A, 0x25, 0x32, 0x1E, 0x6C, 0x55, 0xA7,
0xD0, 0xAA, 0xE7, 0xBF, 0x60, 0xE6, 0x23, 0x9A,
0x96, 0x60, 0x80, 0xC8, 0xE2, 0x78, 0x98, 0x13,
0xF5, 0xBC, 0xAE, 0x84, 0x6D, 0xE5, 0x11, 0x29,
0xF5, 0x4E, 0x87, 0xE9, 0x55, 0xCF, 0x05, 0x11,
0x6B, 0xE1, 0xD6, 0x81, 0xD8, 0x9C, 0xFD, 0x85,
0xCE, 0x57, 0x7E, 0xDF, 0xE2, 0xF7, 0xF6, 0x44,
0xD8, 0xDD, 0x4F, 0xFE, 0x4A, 0x11, 0x17, 0xDD,
0x08, 0x12, 0x54, 0x34, 0xDC, 0xAC, 0xE0, 0xA3,
0xBE, 0xB4, 0x8F, 0x9B, 0xFF, 0x5A, 0xD7, 0xC2,
0x5E, 0xC6, 0x34, 0x25, 0x6A, 0x1C, 0xDC, 0x90,
0x90, 0x79, 0x4C, 0x0F, 0xD3, 0xCF, 0x71, 0x08,
0xB1, 0x45, 0xA2, 0xBC, 0x7D, 0x32, 0xF9, 0xC0,
0x6A, 0xBC, 0x6D, 0xC1, 0x98, 0xDD, 0xA0, 0x93,
0xAC, 0x7D, 0x74, 0x95, 0x8B, 0x75, 0xE3, 0xF4,
0x64, 0xA1, 0x80, 0xC1, 0xF1, 0xC8, 0xAE, 0x1E,
0xE4, 0x4C, 0x3A, 0x6C, 0xF3, 0x17, 0x41, 0x9E,
0x35, 0x58, 0xEA, 0x35, 0x1E, 0x97, 0x2A, 0x8D,
0x94, 0x9F, 0x6C, 0x62, 0xF7, 0xF7, 0xF6, 0x52,
0x39, 0xA5, 0x10, 0xF0, 0x5C, 0x74, 0x7D, 0xBF,
0x8D, 0x29, 0xB8, 0x91, 0xC3, 0x4E, 0xB7, 0x31,
0xB5, 0x12, 0x1A, 0xA4, 0x39, 0xE2, 0xE8, 0x87,
0x89, 0xFF, 0xA3, 0x38, 0xBB, 0x71, 0x88, 0x21,
0x2A, 0x34, 0x91, 0x18, 0x02, 0x5E, 0xC0, 0x2C,
0xDD, 0x47, 0x87, 0xDF, 0x36, 0x12, 0xCF, 0x96,
0x1C, 0xD1, 0x98, 0x2A, 0x9B, 0x8E, 0x28, 0xF9,
0xDF, 0x81, 0xAF, 0x34, 0x00, 0xB5, 0xB2, 0x9B,
0xE5, 0x8C, 0xA3, 0x82, 0xA9, 0xBE, 0x95, 0xE7,
0x17, 0xEB, 0xEA, 0x57, 0x2E, 0xA7, 0x71, 0x0B,
0xBF, 0xFB, 0x8D, 0xC5, 0x74, 0x9B, 0x98, 0xC0,
0x21, 0x70, 0x54, 0xB1, 0xEC, 0xFF, 0xA0, 0x80,
0xA2, 0x7D, 0x29, 0x09, 0x3F, 0x63, 0x06, 0xA1,
0xDA, 0x9F, 0xAA, 0x17, 0x9D, 0x73, 0x65, 0x04,
0xD9, 0x00, 0x07, 0xB8, 0xFB, 0x8D, 0x08, 0xB5,
0x04, 0xF4, 0x3D, 0x11, 0xAA, 0x32, 0xD3, 0xDD,
0xF6, 0xD2, 0xEC, 0x9B, 0x53, 0x61, 0xD0, 0xFC,
0x6A, 0x35, 0xA1, 0xEA, 0x78, 0xE5, 0xAA, 0xDE,
0x51, 0x3D, 0x54, 0xE6, 0x36, 0xC3, 0x7D, 0xA3,
0x72, 0x78, 0x6C, 0x88, 0x0C, 0x94, 0x9D, 0x31,
0xE5, 0x72, 0xF3, 0x89, 0xE7, 0x38, 0xBF, 0xE9,
0x67, 0xF7, 0xAB, 0xEC, 0xBC, 0x51, 0xF8, 0x37,
0x5E, 0x8B, 0x4F, 0x54, 0xD2, 0xA8, 0xC6, 0x1D,
0x3E, 0x01, 0x8C, 0x36, 0x90, 0x9C, 0x83, 0xA3,
0x87, 0x28, 0x1C, 0x40, 0x67, 0x19, 0x0F, 0x03,
0xD9, 0x17, 0x37, 0xC0, 0xBD, 0x1D, 0x06, 0xAD,
0x61, 0x97, 0xCC, 0x01, 0x6E, 0x3A, 0xB4, 0xD1,
0xDF, 0x43, 0x57, 0x41, 0xE4, 0x9F, 0x49, 0xAF,
0x84, 0x9E, 0xC9, 0xB2, 0x74, 0x67, 0xFC, 0x16,
0xD4, 0x4F, 0x18, 0x5E, 0x87, 0x16, 0x7A, 0x36,
0x00, 0x93, 0x62, 0x81, 0xC0, 0xE9, 0xF0, 0xCE,
0xAD, 0x88, 0x59, 0xE5, 0x77, 0x58, 0xC3, 0x16,
0xAD, 0x02, 0x0D, 0xA0, 0x1C, 0xD3, 0xB7, 0x2C,
0x88, 0xC7, 0xCC, 0x83, 0xC5, 0x99, 0x16, 0x58,
0x7C, 0x24, 0x46, 0xF6, 0x67, 0x27, 0xBA, 0xF7,
0x10, 0x76, 0xD6, 0x64, 0x27, 0x35, 0x15, 0x30,
0xD6, 0xF2, 0x36, 0x4A, 0xCA, 0x42, 0x50, 0xD8,
0x7A, 0xC7, 0xAB, 0x87, 0xB6, 0x6A, 0x98, 0x36,
0x21, 0x38, 0x6B, 0x88, 0x53, 0xE8, 0xDE, 0x30,
0x77, 0x54, 0x94, 0xB8, 0xFD, 0xAD, 0xD9, 0x11,
0xDA, 0x25, 0xE9, 0x6F, 0x65, 0x6B, 0xE0, 0x3D,
0x95, 0xAB, 0x35, 0x0F, 0x9E, 0xC6, 0xB9, 0xA2,
0x14, 0x8B, 0x6C, 0x8B, 0xC1, 0xA1, 0x39, 0xCC,
0x46, 0xF4, 0x82, 0xA3, 0xD9, 0xEF, 0x19, 0xDB,
0xF3, 0x2D, 0x23, 0xD7, 0xB8, 0xA6, 0xFC, 0x3D,
0xF2, 0xEB, 0x9A, 0x33, 0x8C, 0xDD, 0x8A, 0x76,
0x59, 0xD3, 0x2E, 0x7A, 0x52, 0xAC, 0xD9, 0x3F,
0xCB, 0xFB, 0xA5, 0x37, 0xFD, 0xA4, 0xB3, 0xFC,
0xE9, 0x0F, 0xD6, 0x04, 0xF0, 0x75, 0x5C, 0xB3,
0x63, 0x43, 0x82, 0x07, 0x6F, 0x8F, 0x7C, 0x86,
0x92, 0x36, 0x73, 0x7A, 0x9A, 0x66, 0xF9, 0x4A,
0xF3, 0x26, 0xB2, 0x7E, 0x18, 0xBB, 0x9A, 0x24,
0xF3, 0xCF, 0x1F, 0x73, 0xBF, 0x98, 0x9E, 0x36,
0xFC, 0x18, 0xB5, 0x5E, 0x6B, 0x1D, 0x06, 0xDE,
0x70, 0x7A, 0x81, 0xB3, 0x9D, 0x88, 0x11, 0x8C,
0x44, 0xA2, 0x12, 0x84, 0x1B, 0x08, 0xCA, 0xE8,
0x5B, 0xA3, 0xA0, 0x1F, 0x70, 0xD9, 0xFF, 0x46,
0x75, 0x8F, 0x46, 0xF8, 0x3C, 0xB9, 0x68, 0x11,
0x5D, 0xC0, 0xCD, 0x06, 0x8C, 0x70, 0x3B, 0x7F,
0xE3, 0xB9, 0xD3, 0xC3, 0xE1, 0x9F, 0xF8, 0x1C,
0x35, 0xAD, 0xFE, 0x05, 0x7F, 0x0D, 0x12, 0x8B,
0x2C, 0x06, 0xAE, 0xE1, 0x63, 0x3A, 0x05, 0x45,
0xA9, 0x26, 0x06, 0x6E, 0xAA, 0x9B, 0x92, 0x42,
0xE4, 0xD3, 0x51, 0x65, 0x77, 0xC1, 0x42, 0x9F,
0xD2, 0x92, 0x2A, 0xE1, 0xE2, 0x57, 0x03, 0xAA,
0x02, 0xF4, 0x24, 0xB8, 0x66, 0x18, 0x6C, 0xBF,
0x2E, 0x8A, 0xAC, 0x69, 0x32, 0x68, 0x6D, 0xB1,
0x3D, 0x8C, 0x7F, 0x4F, 0x5D, 0x96, 0xA9, 0x78,
0xC5, 0xEC, 0x4A, 0x30, 0x16, 0x48, 0x2D, 0x79,
0x0F, 0x5A, 0xD6, 0xCF, 0x38, 0xAF, 0x80, 0x4E,
0x28, 0x50, 0xA9, 0x16, 0x21, 0xA6, 0xB6, 0xE1,
0x3B, 0x27, 0xDB, 0x61, 0x3E, 0xE3, 0x08, 0x7D,
0x8D, 0x2E, 0xF1, 0x39, 0xF2, 0x75, 0xFF, 0x25,
0xE7, 0x08, 0xDF, 0x2C, 0xBC, 0xE4, 0x49, 0x70,
0x4B, 0xFC, 0x4D, 0xEF, 0x72, 0x32, 0x45, 0xC4,
0x89, 0xFD, 0x7B, 0x56, 0x13, 0x49, 0x86, 0x8E,
0x3E, 0xA8, 0xB0, 0xF1, 0xB3, 0xB5, 0x5B, 0x51,
0x82, 0x32, 0x28, 0xD2, 0x65, 0xCF, 0x72, 0xAB,
0x35, 0x03, 0x01, 0x00, 0x3A, 0x5E, 0xCB, 0x5D,
0x1F, 0x9E, 0x1C, 0xDA, 0xD0, 0xD2, 0x52, 0x4C,
0x2E, 0xD1, 0xA1, 0x1A, 0x5F, 0x92, 0x8F, 0x74,
0xE5, 0xAD, 0x56, 0xA3, 0x8B, 0xED, 0x49, 0xDA,
0x7B, 0x4F, 0x94, 0xB9, 0x38, 0xF4, 0x4C, 0xB9,
0x03, 0x5A, 0x3A, 0xAD, 0xAD, 0xD9, 0xF0, 0x61,
0x75, 0x83, 0x2F, 0x48, 0xD9, 0xE8, 0xD6, 0x67,
0x1D, 0x50, 0x17, 0xD5, 0x0C, 0x76, 0x05, 0xC3,
0x1E, 0xB1, 0xB8, 0x51, 0x87, 0x4B, 0x68, 0xD8,
0x31, 0x10, 0xE7, 0xF3, 0xC3, 0x03, 0x3D, 0xD0,
0xA6, 0xFF, 0x53, 0x2B, 0x8C, 0x71, 0x03, 0xC7,
0xAC, 0xF3, 0xC4, 0xC4, 0x75, 0xB6, 0x38, 0xE3,
0xEB, 0xAA, 0x31, 0x14, 0x94, 0x37, 0xA3, 0xF5,
0xA1, 0xF2, 0x12, 0x43, 0x2B, 0xE9, 0x0C, 0x0C,
0x86, 0x1D, 0xFF, 0xF9, 0x05, 0x46, 0xB7, 0x80,
0x32, 0x15, 0x57, 0xD5, 0xD1, 0x89, 0xFD, 0xAC,
0x7A, 0xA7, 0xF7, 0x70, 0xE1, 0xF1, 0x3E, 0x69,
0x61, 0x2B, 0x17, 0x08, 0x1F, 0x67, 0x24, 0xA7,
0xF6, 0xFA, 0x8A, 0x76, 0x72, 0xF8, 0x9F, 0x58,
0xFB, 0x6D, 0xE9, 0x96, 0x3B, 0x13, 0x26, 0xAC,
0x08, 0xA0, 0x73, 0x0B, 0x7A, 0x9E, 0x81, 0xFF,
0x85, 0x7E, 0x59, 0x3B, 0x95, 0xFC, 0xEB, 0xD4,
0x95, 0xD5, 0x6B, 0xCB, 0x3A, 0xF8, 0x42, 0xB7,
0x84, 0x6E, 0xEC, 0xB3, 0xB3, 0xA9, 0x45, 0x0B,
0x93, 0xE6, 0x37, 0xFA, 0x04, 0x8D, 0x1D, 0x7D,
0xF8, 0xFF, 0xE2, 0x70, 0xF9, 0x50, 0xAA, 0xE6,
0x11, 0xE5, 0xA2, 0x53, 0x64, 0xA7, 0x0F, 0xAD,
0x86, 0xAB, 0xDB, 0x6B, 0xC9, 0x4C, 0xBF, 0x33,
},
Exponent = new byte[]
{
0x01, 0x00, 0x01,
},
D = new byte[]
{
0x36, 0x5D, 0x38, 0xD7, 0x82, 0xE3, 0x2F, 0xF4,
0xC8, 0xB7, 0x0C, 0x06, 0x9D, 0x7C, 0x65, 0x13,
0xCC, 0xF7, 0xAC, 0xDD, 0x07, 0xDB, 0xD6, 0x19,
0xE4, 0xD3, 0xA9, 0x62, 0x13, 0x0E, 0x11, 0xD4,
0xE7, 0xEE, 0x73, 0xA7, 0x16, 0x94, 0xFB, 0x74,
0x76, 0xA0, 0xBC, 0xCE, 0xAC, 0x07, 0x1F, 0x13,
0x5A, 0x69, 0x8A, 0x06, 0xFE, 0xC6, 0x0F, 0xAB,
0xA9, 0x88, 0x0D, 0xEA, 0xC5, 0x86, 0xE4, 0x64,
0x13, 0x18, 0x02, 0xEE, 0x0A, 0x89, 0xC6, 0x07,
0x0E, 0x5D, 0x93, 0x48, 0x7B, 0xEF, 0x45, 0x95,
0xFD, 0xE3, 0x7B, 0xDE, 0x08, 0x1E, 0x8B, 0xD3,
0xB4, 0x52, 0x62, 0x73, 0x0C, 0x5D, 0x60, 0xC0,
0xA1, 0x87, 0xD4, 0x5C, 0x15, 0x45, 0x76, 0x33,
0xBF, 0x74, 0x5C, 0x1B, 0x3F, 0x4E, 0xC6, 0x33,
0xBA, 0x99, 0x67, 0x3C, 0xA2, 0xAE, 0xFF, 0xB5,
0xFE, 0xD0, 0x5A, 0xD6, 0x20, 0x82, 0xCA, 0x5F,
0xAB, 0x3B, 0x81, 0x7A, 0xE8, 0x1C, 0x6F, 0x40,
0x2C, 0x6D, 0x75, 0xDA, 0xE0, 0x34, 0xD7, 0x6A,
0xD6, 0x0A, 0xE0, 0x75, 0x57, 0x65, 0x2C, 0x60,
0x5E, 0x45, 0x54, 0x52, 0x4C, 0x1F, 0x92, 0x76,
0x6E, 0x57, 0xE5, 0x77, 0xF7, 0x5F, 0xDB, 0x58,
0x90, 0x03, 0xEE, 0x6D, 0xC2, 0xC6, 0x95, 0x63,
0xD3, 0x81, 0xD7, 0x3B, 0x3B, 0xFC, 0x3B, 0xA7,
0x17, 0x76, 0x19, 0x0A, 0x05, 0x25, 0x73, 0xCB,
0xBA, 0x84, 0x5A, 0xC5, 0x23, 0x56, 0xF0, 0xB5,
0x40, 0x6A, 0x1C, 0xCC, 0x9A, 0x38, 0xC5, 0x4F,
0x00, 0x31, 0xB6, 0x56, 0x74, 0x6D, 0x78, 0x86,
0xA4, 0x17, 0xB1, 0x5F, 0x19, 0xDB, 0x30, 0x30,
0x38, 0xB3, 0x6C, 0xC0, 0xEB, 0xEB, 0x55, 0xD6,
0xE3, 0xC7, 0x32, 0xC6, 0xDC, 0x29, 0x13, 0x26,
0xB0, 0xB7, 0x7C, 0x45, 0xAB, 0x0A, 0x87, 0xA9,
0x16, 0x6C, 0x17, 0x36, 0x87, 0x09, 0xF8, 0xF8,
0x95, 0x69, 0x85, 0x46, 0x91, 0xDA, 0x7D, 0x15,
0xD8, 0x18, 0x2A, 0x36, 0x46, 0x89, 0xDB, 0xF5,
0xE0, 0xFC, 0x42, 0x07, 0x4B, 0xDC, 0x44, 0xC0,
0x47, 0x52, 0x03, 0xEF, 0x95, 0x4F, 0xA4, 0x3D,
0x90, 0xC8, 0x39, 0x8D, 0x44, 0x27, 0x19, 0x4A,
0x89, 0xEE, 0xCB, 0xD8, 0x24, 0x93, 0x94, 0x6B,
0x31, 0x8B, 0xA6, 0xD7, 0xF3, 0xBA, 0x07, 0x59,
0x70, 0x06, 0xE3, 0xC1, 0xA6, 0x30, 0x22, 0x61,
0x73, 0xC5, 0x39, 0x06, 0x94, 0x16, 0x75, 0xA5,
0x06, 0x0E, 0x28, 0xAE, 0xE8, 0x56, 0x73, 0x59,
0x75, 0x43, 0x26, 0x2B, 0x55, 0x5E, 0xD8, 0x91,
0xE7, 0xE4, 0xDC, 0xB0, 0xE2, 0xC4, 0xC4, 0xEF,
0x67, 0x80, 0x6A, 0x2C, 0xD0, 0xB7, 0xD2, 0xA7,
0x0E, 0xAE, 0x45, 0x5C, 0x65, 0xAB, 0xA1, 0xC9,
0x90, 0x57, 0x2A, 0x7C, 0xAD, 0x04, 0xBD, 0x27,
0xC8, 0x9D, 0x28, 0xD9, 0x01, 0x1B, 0x08, 0xDB,
0xA3, 0xD1, 0xBE, 0xBF, 0x52, 0x91, 0xA3, 0x24,
0xB6, 0x11, 0x66, 0xC4, 0x47, 0x04, 0xCF, 0x8B,
0x69, 0x15, 0x26, 0xF6, 0x07, 0x90, 0xF0, 0x25,
0xF2, 0x12, 0xB3, 0x46, 0x47, 0x7B, 0x47, 0xE0,
0xA7, 0x16, 0x3E, 0x32, 0x81, 0x0C, 0xBF, 0xC2,
0xDE, 0x10, 0xF2, 0xFC, 0x81, 0x07, 0x09, 0x76,
0xFD, 0x6F, 0x48, 0x60, 0xE8, 0x22, 0x83, 0x8F,
0xE8, 0xD0, 0xC3, 0xA8, 0xD0, 0xBA, 0x44, 0xCB,
0xB0, 0xF2, 0xEC, 0x9A, 0xB8, 0x59, 0x5E, 0x82,
0x23, 0x32, 0xCF, 0x52, 0xEB, 0xC2, 0x06, 0xF2,
0xCB, 0xF6, 0x60, 0xF5, 0x83, 0xD7, 0xE0, 0x4D,
0x1A, 0xE8, 0x4B, 0x9A, 0x70, 0x44, 0x33, 0x39,
0x8C, 0xC4, 0x86, 0xD2, 0x10, 0x35, 0x29, 0xD6,
0x3F, 0x1E, 0x4B, 0xE5, 0x38, 0x98, 0xBC, 0x7B,
0x65, 0x95, 0x83, 0xD3, 0x7F, 0x08, 0x59, 0x1D,
0xE5, 0x3C, 0xCD, 0xE3, 0x11, 0x29, 0x7A, 0x48,
0x9B, 0x66, 0x23, 0x9F, 0xB1, 0x49, 0x91, 0x78,
0x77, 0x2F, 0x88, 0x77, 0xE3, 0x5F, 0xFC, 0x05,
0xD5, 0x2F, 0x18, 0xFF, 0x7B, 0xEF, 0x74, 0xDF,
0x17, 0x34, 0xA7, 0x5D, 0xFC, 0x0C, 0x9E, 0xD9,
0x56, 0x2A, 0xD2, 0x3E, 0xAA, 0x2E, 0x27, 0x12,
0x90, 0x25, 0xFA, 0xF1, 0xF5, 0xE0, 0xD2, 0xBB,
0x82, 0xE1, 0x4F, 0x9D, 0x46, 0x3A, 0x0A, 0xB3,
0xE1, 0xDB, 0xCC, 0xA2, 0x8D, 0x82, 0x47, 0xAF,
0x86, 0xFC, 0xF8, 0x24, 0xB6, 0x27, 0xC2, 0xA1,
0x8B, 0x33, 0x7B, 0xBF, 0xD1, 0x41, 0x15, 0xFD,
0x45, 0xB9, 0xA1, 0x63, 0x78, 0x3E, 0x3E, 0x1F,
0x65, 0xAD, 0xD7, 0xAF, 0xCD, 0x74, 0x98, 0x9F,
0x10, 0xA9, 0x7D, 0x8A, 0x6C, 0xED, 0x6B, 0x57,
0x3E, 0x51, 0x51, 0x64, 0x5D, 0xCF, 0x4C, 0x66,
0xA0, 0x58, 0xD8, 0x76, 0x55, 0xBF, 0xB0, 0xC6,
0xFD, 0xAD, 0xE0, 0x4C, 0xA5, 0x1C, 0x1F, 0x74,
0x3A, 0xE5, 0x54, 0x51, 0x42, 0xCA, 0x04, 0x42,
0x59, 0x35, 0xCC, 0x85, 0xF4, 0x02, 0x58, 0x62,
0x39, 0xF4, 0x6C, 0x8B, 0x23, 0xEF, 0xDA, 0xBC,
0x07, 0x85, 0x19, 0x74, 0xE6, 0x1C, 0x80, 0xEF,
0x67, 0xD0, 0x5B, 0x84, 0xEF, 0x88, 0xE2, 0xFA,
0xE7, 0xE1, 0x1F, 0x68, 0x3F, 0x33, 0x8D, 0x53,
0x0E, 0x14, 0x4C, 0xD6, 0x97, 0x4E, 0x20, 0x59,
0x62, 0xBD, 0x10, 0xD8, 0x51, 0xEA, 0xA4, 0x80,
0x6D, 0x55, 0x6C, 0x8E, 0xB1, 0x3F, 0x43, 0xBC,
0xF1, 0x34, 0xDF, 0xD3, 0xA7, 0x08, 0xC5, 0x17,
0xB1, 0x3F, 0xCF, 0x6E, 0xD1, 0x66, 0xD3, 0x90,
0x2A, 0x2E, 0x60, 0x1A, 0xD5, 0xEA, 0xC6, 0x10,
0x5B, 0xA7, 0x65, 0xC9, 0xFC, 0xDD, 0x33, 0x3A,
0x41, 0xDE, 0x1B, 0xED, 0x10, 0x30, 0x36, 0x64,
0xE7, 0x97, 0x7B, 0xF1, 0x03, 0xE4, 0x60, 0x9D,
0x6F, 0xC9, 0xF3, 0x6C, 0x4D, 0x63, 0x0B, 0x8E,
0x4D, 0x51, 0x80, 0x16, 0x8A, 0x12, 0x41, 0x88,
0xAE, 0x24, 0x16, 0xD3, 0xFD, 0x74, 0x9A, 0x8D,
0xA5, 0xAD, 0x25, 0xE7, 0xF9, 0xBB, 0xB9, 0x0D,
0x74, 0xF6, 0x9E, 0x0F, 0xC0, 0x05, 0xA2, 0xF8,
0xB6, 0x1C, 0x6B, 0x73, 0xB8, 0xB0, 0xC6, 0x57,
0xE8, 0x17, 0x91, 0x29, 0xE3, 0x6F, 0x90, 0x97,
0x2F, 0xA5, 0xE1, 0xE0, 0x1F, 0xFE, 0x31, 0x13,
0xB4, 0x27, 0xFC, 0x88, 0xE5, 0x67, 0x75, 0x92,
0x9E, 0x53, 0x80, 0xFF, 0x46, 0x78, 0x7B, 0x4E,
0xFD, 0x69, 0xB4, 0xCD, 0x20, 0x75, 0x59, 0xBB,
0x80, 0x58, 0x46, 0x7E, 0xA5, 0x68, 0x2F, 0x74,
0xBF, 0xBA, 0x0F, 0x4F, 0x0A, 0x11, 0x96, 0x87,
0x3D, 0x2E, 0xFC, 0x8C, 0xC4, 0x19, 0xDB, 0x5C,
0xAB, 0x2C, 0x78, 0x13, 0x3D, 0x0E, 0xF2, 0x55,
0xFC, 0xC1, 0xF1, 0x6D, 0xF9, 0x37, 0x34, 0x76,
0x52, 0xD5, 0xEB, 0x5F, 0x84, 0x5C, 0x31, 0x6C,
0xE3, 0x17, 0x10, 0x48, 0x1B, 0x00, 0x1B, 0x31,
0xF2, 0x2B, 0xE3, 0xF4, 0x95, 0x22, 0xA6, 0x48,
0x41, 0xA4, 0x99, 0xCF, 0xE1, 0x6A, 0xCE, 0xCA,
0x18, 0xAB, 0xC0, 0xEA, 0xE6, 0x99, 0x30, 0x33,
0x78, 0xFB, 0x22, 0x72, 0x3F, 0xAB, 0xFC, 0x46,
0x95, 0xE9, 0x82, 0x1E, 0xBE, 0xC0, 0x3F, 0xA1,
0xE4, 0xB6, 0x3A, 0x60, 0x71, 0xEF, 0x6D, 0x9D,
0x8A, 0x3D, 0x21, 0x2C, 0xA3, 0xFB, 0x72, 0xB6,
0x85, 0x97, 0xEF, 0x52, 0x2B, 0x66, 0xBE, 0x69,
0x55, 0xF6, 0x9C, 0xD4, 0x64, 0x03, 0xB6, 0xC1,
0x01, 0xA2, 0x82, 0xBE, 0x1A, 0x65, 0xBD, 0x00,
0xF6, 0x60, 0x93, 0xD9, 0xC7, 0xDF, 0xC2, 0x3D,
0xF2, 0x66, 0x8A, 0x2B, 0xBE, 0x41, 0x61, 0x84,
0x65, 0xC2, 0x13, 0xCA, 0x06, 0xB3, 0xB4, 0xF7,
0xCD, 0x5C, 0x56, 0x13, 0xF6, 0x51, 0x76, 0x6B,
0xD7, 0x25, 0xAD, 0x2A, 0xDE, 0x45, 0xEB, 0x14,
0xDD, 0x82, 0xBC, 0xD5, 0xE5, 0xBB, 0xCB, 0x01,
0xFB, 0xDE, 0xA4, 0x0E, 0x90, 0xF1, 0xB6, 0x73,
0xDD, 0x3F, 0xCC, 0x13, 0x1C, 0x5F, 0x31, 0x7B,
0x26, 0x8F, 0xDF, 0xE9, 0x33, 0x51, 0xED, 0xFA,
0x41, 0x47, 0x49, 0xCD, 0xD9, 0xA3, 0x7A, 0x81,
0x39, 0x57, 0xC1, 0x28, 0x05, 0x28, 0xE0, 0x89,
0xEF, 0xBD, 0xEB, 0x13, 0x4E, 0xB4, 0x20, 0x15,
0x2D, 0x4F, 0x8E, 0xC4, 0xB6, 0x21, 0xDC, 0x48,
0xA0, 0xC2, 0x9B, 0xB9, 0x01, 0x8E, 0xAE, 0x72,
0x3B, 0x81, 0x38, 0x0B, 0x96, 0xA0, 0x60, 0x9A,
0x12, 0xD3, 0x71, 0x8D, 0x72, 0x6F, 0x85, 0x7E,
0x0E, 0x18, 0xC0, 0xB6, 0x2D, 0x7D, 0x3D, 0xC0,
0xC9, 0x3B, 0xCE, 0x35, 0xE6, 0x08, 0x9A, 0xC8,
0x4C, 0x15, 0xF3, 0x2C, 0xF0, 0x4F, 0x3D, 0x6E,
0x8F, 0x6C, 0x16, 0x08, 0x0D, 0x38, 0xAB, 0xC1,
0xA7, 0xF3, 0x5C, 0x65, 0xA1, 0xD3, 0x3C, 0x11,
0xA5, 0x25, 0x44, 0xAA, 0xBD, 0xAF, 0xBE, 0x4F,
0x6D, 0x81, 0x5B, 0xD9, 0xBD, 0x07, 0xF2, 0xC5,
0xBD, 0xCD, 0x84, 0x52, 0x6C, 0x26, 0x7A, 0x08,
0xD8, 0xB0, 0x88, 0x8E, 0x3F, 0x91, 0x63, 0x2F,
0x2C, 0x3D, 0xD3, 0x35, 0xDA, 0xFC, 0x97, 0xEC,
0x66, 0xA4, 0x78, 0x52, 0x7B, 0xE7, 0x7B, 0x41,
0xE3, 0xEE, 0x3D, 0x1A, 0xF5, 0xE8, 0x4E, 0xF9,
0x5C, 0xEF, 0x31, 0x69, 0xEF, 0xBF, 0xC0, 0x95,
0x41, 0x5E, 0x8A, 0x4C, 0x7B, 0x49, 0x7E, 0x24,
0x94, 0xAF, 0x95, 0x36, 0xBE, 0xC8, 0xB0, 0x8D,
0x1E, 0xB9, 0xED, 0xF1, 0xAA, 0x87, 0x79, 0x94,
0x47, 0xCF, 0x4B, 0x2C, 0x28, 0x01, 0x75, 0xAE,
0x20, 0x2F, 0xC5, 0x23, 0x5D, 0xF2, 0x9B, 0x57,
0xEC, 0x20, 0xEF, 0x7D, 0xA0, 0x70, 0x73, 0x14,
0xDE, 0x39, 0xD1, 0x7B, 0x76, 0xB0, 0x6F, 0xBD,
0x3F, 0x4E, 0xD8, 0xD0, 0xDF, 0x90, 0x6B, 0x3C,
0x42, 0x62, 0x57, 0xF0, 0x2C, 0x19, 0x16, 0x11,
0xB7, 0x54, 0xB3, 0x15, 0x26, 0x14, 0xA7, 0x41,
0x32, 0xCF, 0x6B, 0xAB, 0xFD, 0x8F, 0x88, 0x2E,
0x71, 0x85, 0x09, 0x62, 0x8E, 0xCB, 0x1D, 0xEA,
0x70, 0xE6, 0xE5, 0x6C, 0xE0, 0xA9, 0xB2, 0x83,
0x5F, 0xE9, 0x74, 0xD6, 0x5B, 0x6B, 0xFB, 0x18,
0xB0, 0x44, 0xB8, 0x9D, 0x54, 0x21, 0x09, 0xFD,
0xC3, 0x72, 0x8A, 0x6E, 0x95, 0x14, 0x29, 0x8A,
0x07, 0x9F, 0xBE, 0x0A, 0x87, 0xDE, 0xBA, 0xC8,
0xD0, 0x31, 0x2A, 0x94, 0x0B, 0xB6, 0xF6, 0xA6,
0x15, 0xE6, 0x22, 0xA8, 0x54, 0x72, 0x03, 0x49,
0x28, 0xCD, 0x9C, 0x1E, 0x16, 0x2A, 0x0A, 0x20,
0x8B, 0xCA, 0xA4, 0xDA, 0xEA, 0xDF, 0x3B, 0x72,
0x4F, 0xEF, 0xF4, 0x54, 0xA6, 0xF3, 0x5A, 0xD5,
0x4C, 0x8E, 0xFE, 0x07, 0xA6, 0xAA, 0xE6, 0x6E,
0x95, 0x53, 0x18, 0x1F, 0x12, 0xBE, 0x56, 0x97,
0x4D, 0x60, 0xE1, 0x43, 0x23, 0x66, 0x23, 0x35,
0x2D, 0x7C, 0x94, 0x32, 0xE4, 0xF0, 0xFB, 0x96,
0x8C, 0x69, 0xEB, 0xFB, 0xE0, 0x38, 0x45, 0x94,
0x62, 0xC8, 0xBF, 0xB8, 0x15, 0x5B, 0x2F, 0x1F,
0x4B, 0xA4, 0xAC, 0xD9, 0x09, 0xAD, 0xF9, 0xA3,
0xB5, 0x68, 0xE6, 0xB3, 0x06, 0x5F, 0x21, 0x6D,
0x93, 0xF6, 0x36, 0x65, 0xF6, 0x4A, 0xA2, 0x1F,
0x9B, 0x01, 0x27, 0x37, 0x20, 0x61, 0x33, 0x61,
0xA3, 0xF0, 0xD7, 0x1C, 0xA1, 0x79, 0x2E, 0x2D,
0xBB, 0xDC, 0x4D, 0x69, 0x16, 0x20, 0xE0, 0x4D,
0x1E, 0x6E, 0x82, 0x74, 0x0E, 0x89, 0x5B, 0x33,
0xF8, 0x16, 0xD6, 0x92, 0xE3, 0xF0, 0x06, 0xAF,
0x38, 0xA7, 0x82, 0xF8, 0x96, 0x9C, 0x13, 0xF5,
0xE4, 0x81, 0x2D, 0x90, 0x9F, 0x9F, 0x51, 0x1A,
0x9B, 0xF6, 0x1A, 0x78, 0xD6, 0xF7, 0xCC, 0x07,
0x3A, 0xA3, 0x1A, 0x91, 0x61, 0x14, 0x00, 0x59,
0xF5, 0x9A, 0x72, 0x32, 0x0A, 0xD6, 0x3B, 0xC2,
0x47, 0x36, 0xE3, 0xE4, 0xAA, 0xD9, 0x8A, 0x65,
0x7B, 0xC8, 0x7F, 0x96, 0xB9, 0xC0, 0xA7, 0xF2,
0x55, 0xAD, 0x67, 0x2C, 0x14, 0x0C, 0xDF, 0xC9,
0x4E, 0x36, 0xA3, 0x22, 0xAD, 0xA7, 0x5A, 0x5D,
0xD6, 0xD1, 0xB4, 0xD9, 0x69, 0x39, 0x80, 0x25,
0x97, 0x0D, 0x7F, 0xF7, 0x76, 0x08, 0x29, 0x04,
0x5A, 0xA4, 0x12, 0x4A, 0x29, 0xD9, 0xB9, 0x74,
0x27, 0x40, 0x5A, 0xC6, 0x66, 0xFF, 0xB2, 0x41,
0x9F, 0x0B, 0x84, 0xF2, 0x8B, 0x5F, 0x8E, 0xB9,
0x04, 0x1E, 0x70, 0xFD, 0xAD, 0xBD, 0x03, 0x0C,
0x50, 0x96, 0x2C, 0x80, 0x80, 0xCD, 0xA0, 0x87,
0xB0, 0xBC, 0xF0, 0xB1, 0x77, 0x30, 0xB1, 0xCA,
0xD4, 0xDA, 0xCA, 0xB6, 0xF6, 0xEB, 0xA5, 0x1E,
0x77, 0x6F, 0x2A, 0x6A, 0xA9, 0x45, 0xEF, 0x1B,
0x11, 0x2C, 0x5E, 0xEE, 0x3C, 0x53, 0xF9, 0x37,
0xDB, 0xA1, 0x42, 0x4F, 0x3B, 0x5D, 0xE0, 0xE4,
0xCE, 0x90, 0xD3, 0x90, 0x20, 0x0C, 0x19, 0x7F,
0x05, 0x7A, 0xF7, 0xBE, 0x6E, 0xE3, 0xAA, 0x64,
0x91, 0x41, 0x79, 0x48, 0xA5, 0x72, 0x42, 0xBF,
0xE2, 0x3F, 0x99, 0x8E, 0x89, 0x9B, 0x7E, 0xA9,
0x44, 0xEA, 0x99, 0x32, 0xEF, 0xC7, 0x91, 0x84,
0xEB, 0x6F, 0x48, 0xCF, 0x56, 0x62, 0x60, 0xB5,
0xFB, 0x3A, 0x40, 0x25, 0x86, 0x08, 0x4E, 0x30,
0x8B, 0xEE, 0x82, 0x61, 0x1C, 0xA3, 0x8B, 0x94,
0xBC, 0x25, 0x1E, 0x14, 0xA9, 0x7D, 0xFD, 0x03,
0x4F, 0xE6, 0xB3, 0xD5, 0x96, 0xB9, 0x3F, 0xDC,
0x50, 0x1B, 0x2B, 0x40, 0x00, 0xDD, 0xB8, 0x60,
0x8E, 0xB5, 0xBB, 0x90, 0xED, 0x93, 0x71, 0x91,
0x4A, 0x9E, 0x92, 0xB1, 0x15, 0x69, 0xC2, 0x03,
0xD6, 0xB5, 0xED, 0x95, 0xA5, 0x0B, 0x6E, 0x52,
0xFB, 0x14, 0xDE, 0x1C, 0x3F, 0x99, 0xA0, 0x58,
0x4F, 0x26, 0x8A, 0x86, 0xC9, 0xE1, 0x2A, 0x5B,
0xA5, 0x0D, 0x4A, 0x05, 0x17, 0x01, 0x88, 0xA9,
0x6D, 0x52, 0xAA, 0x7C, 0x9C, 0x22, 0x06, 0x33,
0x33, 0x3D, 0x6E, 0xD4, 0x79, 0xF8, 0x16, 0x9B,
0x0C, 0x5F, 0x37, 0xBE, 0x8B, 0x7C, 0x82, 0x3D,
0x3B, 0xC9, 0xB9, 0xDD, 0x55, 0x8D, 0xFE, 0x6F,
0x06, 0x80, 0x16, 0x88, 0x06, 0xDE, 0x55, 0xFA,
0xC9, 0xB6, 0x91, 0x3E, 0x73, 0x47, 0x6D, 0xE9,
0xD3, 0x5F, 0xEE, 0x03, 0x5F, 0x14, 0x4A, 0xF0,
0x85, 0xAA, 0xAE, 0xCB, 0x0E, 0x41, 0x72, 0xF6,
0x71, 0x20, 0x3B, 0x9C, 0x6E, 0xB4, 0xB6, 0xD8,
0x62, 0xEB, 0xC6, 0x79, 0xA6, 0xB0, 0x02, 0x84,
0x95, 0xE3, 0xA0, 0xE8, 0x33, 0xF1, 0x33, 0xAE,
0xC2, 0xC6, 0x3B, 0xE0, 0x6C, 0x80, 0xAD, 0x66,
0x47, 0x67, 0x79, 0x48, 0xB6, 0x93, 0x9F, 0xCC,
0x4C, 0xB2, 0x1B, 0x77, 0x48, 0x4C, 0xAB, 0x7D,
0xD2, 0xCB, 0xC0, 0xC0, 0xD7, 0x92, 0x4E, 0x16,
0x03, 0xA8, 0x3E, 0x69, 0xAE, 0xDC, 0x00, 0x86,
0x47, 0x0B, 0x26, 0x9B, 0x08, 0x06, 0xF8, 0x9C,
0x5A, 0xE9, 0x57, 0xAB, 0x45, 0xDA, 0xAB, 0x0D,
0x84, 0xEE, 0x07, 0x86, 0xE0, 0xB4, 0x66, 0x06,
0xB7, 0xAE, 0x55, 0x22, 0x7A, 0xEC, 0x56, 0xE9,
0xFF, 0x35, 0xA3, 0x76, 0x82, 0x9E, 0x6C, 0x92,
0xB5, 0xCF, 0x29, 0x6D, 0x5C, 0x59, 0x50, 0xD7,
0xD8, 0x37, 0xA3, 0xD1, 0x76, 0xAF, 0x59, 0xCC,
0x0F, 0xEA, 0x22, 0x89, 0xED, 0x04, 0xDD, 0xD4,
0x40, 0xD5, 0xAA, 0xC8, 0x77, 0xAE, 0xE1, 0xE8,
0x76, 0x0B, 0xE4, 0x3B, 0x22, 0x5E, 0xC1, 0xFD,
0x38, 0x29, 0x1A, 0x76, 0x57, 0x53, 0xE8, 0x97,
0x4E, 0x60, 0x96, 0x51, 0xF6, 0x5C, 0xDC, 0x81,
0xF3, 0xC3, 0x7A, 0xA8, 0xBE, 0x37, 0x83, 0xB8,
0x35, 0xCD, 0xCF, 0x3D, 0xBE, 0x76, 0xC2, 0x75,
},
P = new byte[]
{
0xCA, 0x4D, 0x00, 0x39, 0x39, 0x5E, 0x40, 0xCA,
0x7C, 0x2B, 0xDE, 0xE0, 0xDD, 0x98, 0xEB, 0xB5,
0xF5, 0x8E, 0xAD, 0x22, 0x3F, 0xC4, 0x47, 0xD4,
0x4B, 0x7D, 0xFA, 0xCA, 0x9D, 0x5A, 0xE2, 0xD4,
0x10, 0x1E, 0x7E, 0x7D, 0x04, 0xFC, 0xB9, 0x1D,
0xF4, 0x10, 0xC5, 0x8B, 0xC7, 0x43, 0xE1, 0x4E,
0x39, 0x4E, 0x23, 0x22, 0x95, 0xB0, 0x3A, 0x3B,
0xFF, 0x7C, 0xF2, 0x34, 0x2C, 0xDC, 0x76, 0xD7,
0xD4, 0xBC, 0x67, 0xE3, 0x3F, 0xEF, 0xEA, 0x6E,
0x64, 0xF1, 0x54, 0x51, 0x08, 0x21, 0x8E, 0xC3,
0x11, 0x93, 0x1B, 0x20, 0x5C, 0x07, 0x03, 0x5B,
0x60, 0x7F, 0x90, 0x34, 0x83, 0xD4, 0x0E, 0xF6,
0x05, 0xDA, 0xD9, 0xD6, 0x7A, 0x0B, 0x12, 0xDF,
0x8E, 0xF0, 0x43, 0x0F, 0xD0, 0x77, 0x57, 0x50,
0x0E, 0xE5, 0x84, 0x50, 0x28, 0xFE, 0x4F, 0x63,
0x68, 0xAE, 0x92, 0xF9, 0xD5, 0xB5, 0x83, 0xBB,
0x44, 0x44, 0x66, 0xF2, 0x36, 0xE5, 0x5A, 0x75,
0x13, 0x05, 0x8F, 0xF5, 0x79, 0x23, 0xAA, 0x8A,
0xCC, 0x31, 0x36, 0xBC, 0x35, 0x25, 0x09, 0x10,
0x03, 0xEA, 0x9B, 0x3F, 0x0B, 0x65, 0xFD, 0xA7,
0xC3, 0x69, 0xC6, 0xAA, 0x30, 0x7A, 0xAA, 0x79,
0x6D, 0x80, 0xCA, 0xF2, 0x09, 0xF6, 0xED, 0xA8,
0x83, 0xF8, 0x58, 0xA2, 0xD7, 0x46, 0x79, 0x8B,
0xC3, 0x83, 0x51, 0xC6, 0x04, 0x68, 0x12, 0x4D,
0xD9, 0x85, 0xE2, 0x80, 0x14, 0xEE, 0x2A, 0x9A,
0x06, 0xC0, 0x5A, 0x64, 0xBB, 0x88, 0x37, 0x79,
0xB0, 0x4A, 0x57, 0x17, 0x59, 0x74, 0x7E, 0x05,
0x15, 0xA6, 0x7E, 0x02, 0x60, 0xCB, 0x9B, 0x13,
0x04, 0x2F, 0x28, 0x83, 0x16, 0xEA, 0xC2, 0xBB,
0x14, 0xAF, 0x66, 0x1B, 0x52, 0x05, 0x15, 0x38,
0x34, 0xF7, 0xC3, 0xEE, 0x32, 0x41, 0x38, 0x47,
0xFC, 0xE1, 0xBB, 0x25, 0x30, 0x7E, 0xA0, 0x56,
0xB7, 0x3F, 0xB6, 0xE5, 0x76, 0xC6, 0x77, 0x46,
0xC8, 0xA9, 0x3C, 0x21, 0x2B, 0x85, 0x42, 0x3D,
0x9E, 0x76, 0x45, 0xCD, 0x69, 0x8C, 0xB1, 0xE6,
0x46, 0x8C, 0x7B, 0xEE, 0x52, 0x9F, 0x57, 0x12,
0xB2, 0xF0, 0xF4, 0x43, 0xAE, 0x7E, 0x8F, 0x22,
0xE5, 0x59, 0xBB, 0xF7, 0xCE, 0xE3, 0x99, 0xE4,
0x6F, 0x3D, 0xF4, 0xD3, 0x6E, 0xD4, 0xF0, 0xD0,
0x9F, 0x95, 0x3F, 0x7A, 0xFF, 0x24, 0x82, 0x63,
0x6C, 0xA6, 0x72, 0xCC, 0x22, 0x20, 0x79, 0xF7,
0x38, 0xEA, 0x96, 0xD1, 0xAA, 0xCD, 0xF3, 0xF6,
0x73, 0xAA, 0x69, 0x01, 0x19, 0x9C, 0x17, 0x58,
0xD2, 0x96, 0x25, 0x9D, 0xB4, 0x85, 0xCF, 0x39,
0xBA, 0xF2, 0xFF, 0xCD, 0xCA, 0xC0, 0x98, 0x3D,
0xA3, 0x69, 0x58, 0x11, 0x4A, 0xA0, 0xD9, 0x75,
0x5A, 0x50, 0x69, 0x95, 0xE6, 0xC3, 0x36, 0x51,
0x2E, 0x5B, 0x7A, 0x78, 0xB3, 0x13, 0xF1, 0xA4,
0xDA, 0x3B, 0x22, 0xCB, 0x70, 0x33, 0x59, 0x34,
0x63, 0x4E, 0x67, 0x72, 0xA4, 0xF2, 0xEA, 0x14,
0xB6, 0xC2, 0x21, 0x83, 0xE2, 0x48, 0x46, 0x90,
0xEB, 0xB0, 0x2C, 0x76, 0xB6, 0xAF, 0xEE, 0xE8,
0x9F, 0x15, 0x4F, 0x01, 0x42, 0x7C, 0xF6, 0xBD,
0xC0, 0xC3, 0x78, 0xC6, 0xF9, 0xE0, 0xB9, 0x4B,
0x26, 0x2F, 0xB0, 0x4D, 0x40, 0x5D, 0xDE, 0x0B,
0xA1, 0xB9, 0x01, 0x38, 0xB4, 0xE4, 0xB7, 0x3B,
0x8D, 0xEE, 0xC6, 0x62, 0xA7, 0x97, 0x5A, 0x50,
0x56, 0x62, 0xF9, 0xAD, 0xAD, 0x10, 0x7F, 0xB9,
0x3B, 0x7B, 0x20, 0xC1, 0xAF, 0x81, 0x11, 0x50,
0x70, 0xA7, 0xC2, 0xC4, 0x8D, 0x37, 0x9C, 0xD1,
0xB4, 0x64, 0x9B, 0xE4, 0xFE, 0x0D, 0xA3, 0xC1,
0xC4, 0x75, 0x51, 0x78, 0x23, 0x3F, 0x1B, 0xCF,
0x0E, 0x21, 0x09, 0x71, 0x3C, 0xC9, 0xBF, 0xBC,
0x0E, 0x42, 0x93, 0x01, 0x5D, 0x96, 0xF5, 0x8D,
0x9D, 0x81, 0xEE, 0x50, 0x03, 0x02, 0x83, 0xE9,
0xD4, 0xEC, 0x16, 0x09, 0x0D, 0x36, 0x0A, 0x56,
0xAE, 0xA3, 0xC7, 0x43, 0x68, 0xA7, 0x8E, 0xEA,
0x2A, 0xB5, 0x77, 0xED, 0x0A, 0xD4, 0x41, 0xE4,
0x11, 0xA6, 0xF8, 0x04, 0x9E, 0xB3, 0x2E, 0x98,
0xC3, 0x18, 0x78, 0xBD, 0xBD, 0x8E, 0x8B, 0xB6,
0x9E, 0x98, 0xB5, 0x6D, 0x0F, 0xEF, 0xDC, 0x12,
0x22, 0x1C, 0xBC, 0x4A, 0x7B, 0xFF, 0xD7, 0xC6,
0x0B, 0x67, 0xB0, 0xA3, 0xA5, 0x04, 0xF7, 0xC1,
0x85, 0xD6, 0xEB, 0x74, 0xEC, 0x8B, 0x4A, 0x03,
0x7C, 0x06, 0x27, 0x56, 0xD8, 0x45, 0xD9, 0x2E,
0x30, 0x64, 0xEE, 0x3C, 0x80, 0x38, 0xBC, 0x20,
0xC3, 0x03, 0x98, 0x1F, 0xD3, 0xDC, 0x9A, 0x94,
0x34, 0xF2, 0x87, 0x61, 0x2A, 0x38, 0x7C, 0xDC,
0x43, 0xB9, 0xA6, 0x26, 0x11, 0x54, 0x8E, 0x6B,
0x9B, 0x60, 0x5A, 0x6B, 0xB8, 0x3D, 0x68, 0x3F,
0x5C, 0x6E, 0x16, 0xE1, 0x54, 0xBA, 0x4D, 0xEE,
0x21, 0xFA, 0x71, 0xCD, 0xEC, 0x8A, 0x96, 0xCF,
0xD3, 0x50, 0x54, 0x53, 0xC4, 0xBF, 0x9D, 0x10,
0x4B, 0xD3, 0x33, 0x02, 0x3C, 0xC6, 0x3F, 0xA9,
0xC3, 0x5C, 0x04, 0x87, 0xC2, 0xA7, 0x99, 0x09,
0x72, 0x74, 0x03, 0x5B, 0xA3, 0x52, 0x5A, 0x71,
0xCB, 0x6F, 0x24, 0x8D, 0xCB, 0xCB, 0xE3, 0x17,
0x90, 0xE5, 0xEC, 0x7B, 0xBC, 0x85, 0xD5, 0x60,
0x24, 0x88, 0xB3, 0x6D, 0x0B, 0xA3, 0xBD, 0x43,
0xDA, 0x44, 0xD6, 0xED, 0xCC, 0xC0, 0x1F, 0x6C,
0x4B, 0x9C, 0x71, 0x63, 0x60, 0x0A, 0xEC, 0x73,
0xCF, 0xD1, 0x1D, 0x70, 0x9E, 0xAA, 0xBD, 0x7C,
0xFE, 0x21, 0x46, 0x47, 0xAB, 0x21, 0x46, 0x04,
0x56, 0x4E, 0x6A, 0xA5, 0xC9, 0xD0, 0x6B, 0xCB,
0xBA, 0xD4, 0xE4, 0xFC, 0x6C, 0x03, 0xA2, 0xF2,
0x22, 0x11, 0x25, 0x85, 0x6D, 0x0B, 0x52, 0xB8,
0x6F, 0x42, 0x15, 0x6E, 0x9C, 0xA2, 0x67, 0xFD,
0x16, 0x60, 0x4B, 0x6D, 0xF0, 0x2E, 0xAB, 0xBA,
0x66, 0x42, 0x45, 0x7E, 0x7C, 0x9A, 0xB6, 0xF8,
0x33, 0x3F, 0xB2, 0x5A, 0x9C, 0x75, 0x7C, 0xD4,
0xDE, 0x4A, 0xD6, 0xD6, 0x7E, 0xCA, 0x54, 0xE0,
0x5A, 0xA8, 0x57, 0x0C, 0xF9, 0x53, 0x08, 0xD1,
0x05, 0x9D, 0x92, 0xB5, 0xE3, 0x24, 0x75, 0xF9,
0x42, 0x7F, 0x2C, 0xF7, 0x2B, 0x06, 0x13, 0x44,
0x91, 0x40, 0xE2, 0x18, 0x49, 0x02, 0xA3, 0xA8,
0xFB, 0xFC, 0x05, 0x89, 0x75, 0xBF, 0x4D, 0x27,
0x43, 0x44, 0xB7, 0xD7, 0xE5, 0x13, 0x33, 0x1A,
0x6A, 0xC2, 0x20, 0x67, 0x56, 0x3F, 0x25, 0x2B,
0x8F, 0xCD, 0x74, 0xFA, 0x0F, 0x77, 0x8C, 0x81,
0x5E, 0x88, 0xA0, 0x0C, 0x33, 0x7A, 0xBA, 0xE1,
0x63, 0xB7, 0x94, 0x28, 0x29, 0xEC, 0x0D, 0xEF,
0x80, 0x3B, 0x6F, 0x9E, 0x80, 0xC0, 0xCF, 0x53,
0xDB, 0xB9, 0xB1, 0x93, 0x23, 0x1D, 0x99, 0x40,
0x3A, 0x7D, 0xB0, 0x87, 0x67, 0x93, 0x25, 0x27,
0xB1, 0x73, 0xA1, 0x44, 0x3F, 0xDC, 0x42, 0x72,
0x3C, 0x5F, 0x5C, 0x2C, 0x83, 0x50, 0xFA, 0x15,
0x5B, 0x0B, 0xFB, 0x0A, 0x41, 0xF8, 0x85, 0xC8,
0x0F, 0xF0, 0xEB, 0xBE, 0xCD, 0x84, 0xEF, 0xF2,
0x77, 0xED, 0x73, 0xAA, 0xBC, 0x77, 0x2B, 0x9D,
0x3A, 0x62, 0xC5, 0x08, 0x61, 0x4A, 0xD9, 0xDD,
0x37, 0x88, 0x33, 0xC3, 0xA4, 0xB0, 0xDC, 0xA7,
0x8B, 0xA5, 0xF5, 0x5C, 0xCF, 0xFF, 0x0C, 0x03,
0x11, 0xCF, 0xAB, 0xB4, 0x34, 0xC0, 0x28, 0xAE,
0x12, 0xAA, 0x3A, 0x42, 0x10, 0x46, 0x11, 0x2D,
0xF9, 0xA5, 0x45, 0x2C, 0x81, 0x9B, 0xDC, 0x4E,
0x57, 0xCC, 0x13, 0xB4, 0xC2, 0x1B, 0x99, 0xA1,
0xE9, 0x71, 0x45, 0x9A, 0x2E, 0x7D, 0xF2, 0x98,
0xDE, 0xDA, 0x70, 0x53, 0x63, 0xE1, 0x29, 0xBF,
},
DP = new byte[]
{
0x18, 0x12, 0xF7, 0xBE, 0xD7, 0x93, 0xDE, 0xD3,
0xF9, 0xD8, 0xE2, 0xAA, 0x11, 0xD4, 0xDB, 0xE0,
0x08, 0x7B, 0xD5, 0x20, 0xA9, 0x43, 0xFB, 0x64,
0x49, 0x23, 0x91, 0xCF, 0xC0, 0xD0, 0x0B, 0x04,
0x3F, 0x72, 0xD1, 0x8C, 0xA1, 0x26, 0x4E, 0x05,
0x41, 0x81, 0x29, 0x71, 0x0B, 0xE2, 0x89, 0x12,
0x5D, 0x01, 0x6E, 0x6E, 0xF4, 0x2F, 0x47, 0x8E,
0xD2, 0x45, 0x95, 0x31, 0x1E, 0x51, 0x92, 0x16,
0xF7, 0x2B, 0x00, 0x95, 0xEB, 0x8A, 0xEA, 0x73,
0xFE, 0xB1, 0x35, 0x5E, 0x7B, 0x40, 0x3B, 0x13,
0xFD, 0xA8, 0x6A, 0xE6, 0xFB, 0xEC, 0x9D, 0xBA,
0xA7, 0x0E, 0x27, 0x24, 0x08, 0xB8, 0x18, 0x9B,
0xB0, 0x70, 0xAD, 0xD1, 0xB7, 0x2E, 0x50, 0x2D,
0xA8, 0x7D, 0xF1, 0x0D, 0x15, 0xBA, 0xCD, 0xFA,
0x29, 0xFB, 0xA8, 0x36, 0x3D, 0xDA, 0x9D, 0xA9,
0xEF, 0xD0, 0x2E, 0x8F, 0x6A, 0x9E, 0x32, 0x31,
0xFB, 0xDA, 0xC4, 0x01, 0x79, 0x04, 0xEC, 0x31,
0xD8, 0x74, 0xA6, 0x00, 0x09, 0x4D, 0x74, 0x43,
0x16, 0x2F, 0x99, 0x1A, 0xE6, 0x9C, 0x24, 0xAA,
0xF2, 0x3C, 0x5E, 0x03, 0x2F, 0xA1, 0x10, 0x81,
0x81, 0x60, 0xBA, 0x12, 0x90, 0xB8, 0x58, 0x47,
0x20, 0xFF, 0xDD, 0xA6, 0xD6, 0x06, 0xBB, 0x9B,
0x7D, 0x30, 0xF5, 0xA3, 0x53, 0x49, 0x00, 0xB7,
0xE0, 0x29, 0x65, 0x76, 0xD2, 0x19, 0x6C, 0x6C,
0x35, 0x41, 0x98, 0x85, 0xB3, 0x77, 0xF0, 0x3B,
0xEA, 0x27, 0xC3, 0xDA, 0x0E, 0xF3, 0x13, 0xDE,
0xF8, 0x5A, 0xB0, 0x68, 0x87, 0xED, 0xB3, 0xFD,
0x78, 0xE9, 0x1A, 0x3F, 0xC0, 0x33, 0x1A, 0x9E,
0x35, 0xB6, 0x42, 0xF4, 0xEE, 0xAA, 0x3B, 0x48,
0x36, 0x1A, 0xF5, 0x64, 0xB4, 0xEB, 0x03, 0xEE,
0x6F, 0x67, 0x38, 0xBA, 0xC4, 0xE2, 0x3C, 0x07,
0x5D, 0x11, 0xA3, 0xCA, 0xB6, 0x2D, 0xAB, 0x79,
0x06, 0x4F, 0x9F, 0xBD, 0x48, 0xD8, 0x2F, 0x63,
0x8E, 0x07, 0x8D, 0xAF, 0x48, 0xD5, 0x8F, 0xDF,
0x73, 0x57, 0x11, 0xD1, 0x73, 0x09, 0x1A, 0x36,
0x94, 0x18, 0xAD, 0xBA, 0xDB, 0xBC, 0x38, 0x89,
0x72, 0x1F, 0xF8, 0x81, 0x81, 0x67, 0x70, 0x33,
0x2F, 0xE5, 0xF0, 0xD7, 0x79, 0x98, 0x5E, 0x3C,
0xEF, 0xFC, 0x08, 0x81, 0x8C, 0xC3, 0xEC, 0x70,
0x77, 0x3D, 0x34, 0x93, 0xB7, 0x7F, 0x29, 0xC1,
0x19, 0x31, 0xE9, 0xA1, 0x5F, 0x42, 0x4C, 0x21,
0x5E, 0x75, 0x94, 0x43, 0x19, 0x37, 0x6F, 0x1B,
0xDA, 0x01, 0xE2, 0x83, 0x0E, 0x00, 0x24, 0x4B,
0x1E, 0xAC, 0x5D, 0x87, 0x99, 0xEE, 0xFE, 0x8D,
0x19, 0x31, 0x47, 0xBD, 0xBE, 0xAE, 0x12, 0xAF,
0xEB, 0x1D, 0x63, 0x2C, 0x93, 0x9B, 0xF6, 0xA4,
0xDF, 0x7D, 0x88, 0x43, 0x1D, 0x76, 0x07, 0xA5,
0xBB, 0x85, 0x89, 0x5A, 0x89, 0xBD, 0x0A, 0xD9,
0x9A, 0x5A, 0xC5, 0x36, 0x3E, 0x80, 0xED, 0xD1,
0xAD, 0x2B, 0xAC, 0x65, 0xD9, 0x39, 0x4B, 0x1F,
0xF1, 0xEB, 0xC2, 0x3F, 0x46, 0x93, 0x61, 0x4A,
0x67, 0xB1, 0xCC, 0x68, 0xC8, 0x2E, 0xC1, 0x98,
0x8F, 0x2D, 0xE2, 0xFB, 0xFC, 0x64, 0x90, 0x9C,
0x5E, 0x2F, 0x24, 0xD5, 0x50, 0xF1, 0x2C, 0x3B,
0xC4, 0x2C, 0x92, 0xA7, 0x6E, 0xCC, 0x7C, 0xDB,
0x17, 0x80, 0xC3, 0xA3, 0x72, 0xEB, 0x70, 0xDE,
0xB6, 0x72, 0x3E, 0xCB, 0x88, 0xB4, 0x1B, 0x3C,
0x4A, 0x3B, 0x77, 0x08, 0xF2, 0xFA, 0x6E, 0xA8,
0xA5, 0x6A, 0x6E, 0xA8, 0x7D, 0xF1, 0x37, 0x15,
0x42, 0x82, 0xC4, 0x4B, 0xCD, 0x9E, 0x5B, 0x9C,
0x1D, 0x02, 0x88, 0x06, 0xC5, 0x30, 0xEC, 0x56,
0xE7, 0xC1, 0x2A, 0x53, 0xC8, 0xA5, 0xFE, 0xF2,
0x31, 0xF5, 0x3E, 0x81, 0x6A, 0x41, 0x7B, 0xFE,
0xAE, 0x17, 0xC0, 0x14, 0xBE, 0x85, 0x73, 0x6D,
0x49, 0xDC, 0x27, 0x77, 0x00, 0x14, 0xB1, 0x8C,
0x07, 0x19, 0x9D, 0x39, 0xB0, 0x87, 0xC8, 0xCD,
0x2D, 0xF5, 0x31, 0x86, 0x55, 0x12, 0xF3, 0x8F,
0xEC, 0x4B, 0x32, 0x1D, 0x54, 0x57, 0x94, 0x0B,
0xC7, 0x09, 0xFE, 0xA3, 0xD6, 0x1A, 0xEE, 0xA5,
0xA1, 0x39, 0xED, 0x4C, 0x6F, 0x1D, 0x62, 0x84,
0xF5, 0xF4, 0xA8, 0x4A, 0x75, 0x46, 0x0F, 0x03,
0x5D, 0x69, 0xDC, 0x02, 0x65, 0x25, 0x3A, 0x11,
0x48, 0x54, 0x2B, 0x92, 0x1D, 0xD6, 0x2C, 0x81,
0xAC, 0x22, 0xBA, 0x5C, 0x6C, 0xB5, 0xDA, 0xB5,
0xF5, 0x71, 0x6A, 0x07, 0x0C, 0xAF, 0xAB, 0x3B,
0xB2, 0xE8, 0x9F, 0xED, 0x35, 0x39, 0x0B, 0x32,
0x3E, 0xE2, 0xD3, 0x9C, 0x9E, 0x02, 0xB7, 0xA6,
0x81, 0x72, 0x87, 0x27, 0xC9, 0xF5, 0x74, 0xEE,
0x65, 0x64, 0xD7, 0x5F, 0xDA, 0x5A, 0x1C, 0xA4,
0xB3, 0x95, 0xD0, 0xCC, 0xD6, 0xDC, 0xFF, 0xE5,
0xE2, 0x62, 0xFB, 0x78, 0x0F, 0x34, 0x28, 0x87,
0xF9, 0x25, 0x2B, 0x9B, 0xDC, 0xD5, 0x55, 0x43,
0x20, 0x1B, 0x84, 0x1D, 0x7F, 0xE1, 0x69, 0x98,
0x81, 0xDD, 0x7D, 0x49, 0x7B, 0xDF, 0xFF, 0xBD,
0x7D, 0x11, 0x1B, 0x3C, 0xE8, 0xAE, 0x37, 0x29,
0x07, 0xA4, 0xC4, 0xAD, 0x88, 0x0F, 0x09, 0xD2,
0x56, 0xEA, 0x40, 0x08, 0x5B, 0xC3, 0x44, 0xA0,
0x0E, 0x4F, 0x3E, 0x48, 0x2F, 0x54, 0x21, 0xE3,
0x52, 0x15, 0xAE, 0x7C, 0x80, 0x91, 0x18, 0xB9,
0xD5, 0x64, 0xB1, 0xCB, 0x14, 0xBD, 0x9C, 0x3F,
0xAF, 0xF3, 0xCB, 0x0E, 0x8F, 0x64, 0x5D, 0x65,
0x1E, 0xCA, 0xFC, 0xDC, 0xE5, 0x14, 0xDE, 0x7D,
0xDC, 0x64, 0x2B, 0x4F, 0xE6, 0x0E, 0x8C, 0x9D,
0x81, 0x83, 0xCD, 0x6F, 0x33, 0x48, 0x09, 0x3B,
0xF2, 0x5C, 0xD9, 0x6F, 0x2C, 0x8F, 0x76, 0x39,
0xA8, 0x52, 0x30, 0x0B, 0xE3, 0xC1, 0x20, 0x33,
0xF0, 0x91, 0x85, 0xA9, 0x67, 0x1C, 0x70, 0x91,
0x8E, 0xB3, 0x20, 0xE6, 0xD1, 0x59, 0x4C, 0x78,
0x5F, 0x28, 0xED, 0xCA, 0x32, 0x9B, 0xDA, 0xC0,
0x48, 0xA1, 0x00, 0xE1, 0x85, 0x92, 0xF9, 0xAA,
0xFF, 0x55, 0x1A, 0xA1, 0xE5, 0xEE, 0xC0, 0x10,
0xFE, 0xD8, 0xDF, 0x9B, 0x1C, 0xA4, 0x83, 0xFD,
0x13, 0xD4, 0xFF, 0x9B, 0x83, 0x8F, 0x58, 0x36,
0xB4, 0x72, 0x1B, 0xF0, 0xC1, 0xFE, 0xF4, 0x16,
0x09, 0xCF, 0x15, 0xD8, 0xDB, 0xFF, 0x63, 0x68,
0x7D, 0xAC, 0x2D, 0x20, 0x81, 0x91, 0xA5, 0x65,
0xD1, 0xBC, 0x80, 0xC0, 0x41, 0x73, 0x7A, 0x76,
0x5F, 0x54, 0x00, 0xB5, 0x2B, 0x6F, 0x52, 0x46,
0x0F, 0xD3, 0xDC, 0x62, 0xD1, 0xAA, 0x61, 0x5F,
0x17, 0xD7, 0xDC, 0x6B, 0xF7, 0x48, 0x58, 0xAA,
0xEF, 0xC9, 0xED, 0xE8, 0xA5, 0xAC, 0x80, 0xB0,
0x0A, 0xAB, 0x88, 0x09, 0xED, 0xBA, 0x84, 0x31,
0xAF, 0x89, 0x36, 0x97, 0x92, 0xEB, 0x37, 0xCC,
0x8B, 0xE9, 0x5F, 0x33, 0x8D, 0xE0, 0xD5, 0xE0,
0x16, 0x5E, 0xF3, 0x47, 0x02, 0xEE, 0x7C, 0x3D,
0xC9, 0xEF, 0x73, 0x31, 0x9C, 0xE2, 0xEB, 0x0F,
0xD5, 0x88, 0xE4, 0x74, 0x01, 0x0B, 0xC9, 0x27,
0xD8, 0xB5, 0xCB, 0xE8, 0x25, 0xDE, 0xF7, 0x0A,
0xFC, 0xB8, 0x96, 0x36, 0x30, 0x3D, 0x62, 0x44,
0x50, 0xA9, 0x66, 0x57, 0x2B, 0xF4, 0xD3, 0x5E,
0x5E, 0xF8, 0x67, 0x68, 0x95, 0xD5, 0xB2, 0x3C,
0x82, 0x02, 0xDA, 0xE3, 0x13, 0xA1, 0x7F, 0x55,
0x72, 0x2E, 0x2B, 0x79, 0xC3, 0x79, 0x46, 0x9E,
0x08, 0x7C, 0x97, 0x78, 0x3B, 0x25, 0x8B, 0x6F,
0xD4, 0x30, 0x95, 0xBD, 0xC9, 0x22, 0xBA, 0x21,
0xDC, 0x92, 0xDD, 0x99, 0x7A, 0x2B, 0xFC, 0xA9,
0x66, 0xF5, 0x62, 0xDA, 0x09, 0x44, 0x55, 0xB5,
0x59, 0x77, 0xD7, 0x3C, 0x25, 0x3B, 0xAB, 0x53,
},
Q = new byte[]
{
0xC4, 0x5C, 0xFD, 0xC2, 0x75, 0xB0, 0x8E, 0x6B,
0x0B, 0x8A, 0xCE, 0xCD, 0x4B, 0x98, 0xEA, 0x40,
0x0C, 0xAB, 0xDB, 0x9A, 0xF9, 0x5F, 0x57, 0xA6,
0x5B, 0x2C, 0x0D, 0xAB, 0xC6, 0xAC, 0x6E, 0x14,
0xB9, 0x36, 0x29, 0xA3, 0x5D, 0xDA, 0x8D, 0x4E,
0x03, 0x84, 0xF2, 0xC8, 0x69, 0x45, 0x57, 0x62,
0x5C, 0xBD, 0xFC, 0xBE, 0x3A, 0x15, 0x71, 0xD9,
0x80, 0x7E, 0x9D, 0x42, 0x2C, 0xE7, 0x9F, 0xD4,
0x8D, 0x6A, 0x63, 0x0B, 0x83, 0x77, 0xAC, 0x71,
0x9B, 0x58, 0x1C, 0x94, 0x1F, 0x00, 0x39, 0x4F,
0x27, 0x93, 0xD5, 0x8A, 0x08, 0xF1, 0x94, 0x67,
0x08, 0xB1, 0xA2, 0xA8, 0xC8, 0x14, 0xE8, 0x33,
0x51, 0x07, 0xB2, 0x76, 0xA3, 0xEA, 0xCB, 0x81,
0x1D, 0x77, 0xAE, 0x24, 0xBD, 0xD1, 0xC3, 0xD3,
0x5E, 0xBE, 0x8C, 0xF3, 0x28, 0xA6, 0x0C, 0xB8,
0x44, 0xDC, 0x40, 0x83, 0x12, 0x3F, 0xB2, 0xF7,
0x0F, 0x75, 0x03, 0x42, 0x43, 0x99, 0x39, 0x47,
0x64, 0x6D, 0x33, 0xC4, 0xFE, 0xA6, 0xB7, 0xCE,
0xBF, 0xCC, 0xA2, 0x59, 0x9E, 0xFE, 0x5D, 0xEA,
0x22, 0xD8, 0x68, 0x1E, 0x99, 0xD2, 0x7E, 0x76,
0xBF, 0xEC, 0xED, 0x1A, 0x54, 0x0A, 0x98, 0x57,
0x1C, 0x63, 0xBD, 0xE0, 0xEF, 0x96, 0x71, 0x28,
0x83, 0x03, 0xDE, 0xC8, 0x8B, 0x6A, 0x39, 0xB9,
0x55, 0x35, 0x6E, 0x1A, 0x5D, 0x7C, 0x25, 0x29,
0x0D, 0x6D, 0x7B, 0xCD, 0x5C, 0x51, 0xCE, 0xE9,
0xD1, 0x89, 0xAA, 0x1A, 0xC5, 0x8B, 0x46, 0x96,
0x97, 0xB9, 0x09, 0xCD, 0x46, 0xFB, 0x2B, 0xCF,
0x0C, 0x0D, 0x9F, 0xE0, 0x10, 0x83, 0xBB, 0xF0,
0x86, 0x79, 0xCD, 0xAE, 0xCF, 0x19, 0xDF, 0x22,
0x62, 0x29, 0x70, 0xC4, 0x14, 0x83, 0x3A, 0xED,
0xF2, 0x5E, 0x19, 0x45, 0x33, 0xD4, 0x5F, 0x4D,
0x94, 0x50, 0x10, 0x1F, 0xE0, 0x46, 0x79, 0xB3,
0x0C, 0x54, 0x0E, 0x31, 0x85, 0xBF, 0xA7, 0xA0,
0xC4, 0x6A, 0xAF, 0x00, 0xBD, 0x88, 0x83, 0x67,
0x16, 0xE8, 0x4B, 0x1A, 0xAF, 0x5C, 0x19, 0xDA,
0x20, 0x43, 0xB1, 0x76, 0x9B, 0x6A, 0x63, 0x36,
0x30, 0xE7, 0x57, 0x40, 0x0C, 0xB3, 0x47, 0xCD,
0xC7, 0xB6, 0x97, 0xC8, 0x05, 0x7C, 0x0D, 0x9B,
0xD0, 0x34, 0xAA, 0x28, 0x29, 0x3F, 0xFB, 0x31,
0xBC, 0x23, 0xCA, 0x0D, 0x7F, 0x9F, 0x3E, 0xCF,
0x7E, 0x80, 0x32, 0x92, 0x29, 0xA0, 0xE7, 0xC5,
0x3B, 0xCD, 0x08, 0x80, 0x82, 0x6C, 0x01, 0x5D,
0x10, 0xC4, 0xB4, 0x7F, 0x08, 0xF5, 0x15, 0x4E,
0x03, 0x91, 0xBC, 0x7F, 0xC3, 0x1B, 0xED, 0x33,
0x3F, 0x44, 0xD6, 0x71, 0x3B, 0x1D, 0x85, 0x54,
0x8D, 0x9B, 0x9E, 0x38, 0xB7, 0x11, 0x50, 0x68,
0x64, 0xD7, 0xFB, 0x32, 0xB2, 0x64, 0x0C, 0xC8,
0x8B, 0x8D, 0x33, 0x9D, 0x9A, 0x44, 0x78, 0xE6,
0x08, 0x44, 0x0D, 0x62, 0x56, 0x85, 0x18, 0x9A,
0x48, 0x38, 0x48, 0xA3, 0x7A, 0xBE, 0xC5, 0x1A,
0xC6, 0x01, 0xE4, 0x62, 0xE7, 0x98, 0x4C, 0xB4,
0x3F, 0x73, 0xC5, 0xC8, 0x09, 0x73, 0x32, 0xFC,
0x95, 0x19, 0x41, 0x94, 0xAE, 0x0B, 0xA0, 0x52,
0x31, 0xA9, 0x3E, 0x71, 0x22, 0xB7, 0x13, 0x1D,
0x1E, 0xDA, 0xAD, 0x99, 0x46, 0x35, 0x1E, 0xC5,
0x90, 0x52, 0x82, 0x37, 0x3A, 0xA5, 0x49, 0xEF,
0xA7, 0x6E, 0x81, 0x00, 0x4B, 0x4A, 0xEB, 0x65,
0xCB, 0xFD, 0x2E, 0x4E, 0x83, 0x2C, 0xAB, 0x07,
0xD3, 0x15, 0x5B, 0xFB, 0xC4, 0x55, 0xDE, 0x93,
0x9A, 0x9E, 0xAC, 0x2F, 0x22, 0x24, 0x73, 0xE6,
0x58, 0xF0, 0x83, 0xA8, 0x78, 0x07, 0x29, 0x93,
0x17, 0x62, 0x83, 0xCB, 0x7F, 0x08, 0xD7, 0x3A,
0xA8, 0x32, 0xD9, 0xDC, 0x75, 0xB4, 0x09, 0xF0,
0x5D, 0x77, 0x42, 0x4D, 0xA1, 0xFF, 0xEF, 0x5C,
0xF1, 0x7F, 0xE4, 0x8C, 0x33, 0x1B, 0x94, 0x44,
0xB7, 0xD9, 0x87, 0x23, 0xDA, 0x6D, 0xD2, 0x0C,
0x0D, 0x93, 0x2C, 0xB9, 0x0B, 0xEB, 0x73, 0x4A,
0xDA, 0xFE, 0xF0, 0x86, 0xB4, 0x6B, 0xF8, 0x63,
0x1E, 0x83, 0x4F, 0x33, 0xE7, 0xF7, 0x25, 0x86,
0x39, 0x99, 0x73, 0x68, 0xED, 0xBB, 0x2C, 0x2E,
0x76, 0x45, 0x63, 0x89, 0x2A, 0x49, 0x29, 0x0E,
0x2A, 0xDD, 0x40, 0xB9, 0xFD, 0x58, 0x9B, 0x17,
0xA1, 0x63, 0x5F, 0xA3, 0x94, 0x04, 0x9B, 0xD2,
0x3A, 0xFC, 0x86, 0x0C, 0xBE, 0x13, 0x05, 0xA0,
0xDE, 0xD1, 0x9D, 0x4D, 0xC5, 0x09, 0x46, 0x24,
0x94, 0x37, 0x6B, 0x85, 0x1C, 0xAA, 0xE9, 0x98,
0xBD, 0xDA, 0x59, 0xC9, 0xA9, 0xF2, 0x8B, 0x23,
0x67, 0x54, 0xCA, 0x6B, 0x2D, 0x64, 0xCB, 0x69,
0x72, 0xC2, 0x61, 0x60, 0x95, 0x2C, 0x07, 0x32,
0x23, 0xA6, 0x0A, 0x18, 0x17, 0x37, 0x54, 0x18,
0xA9, 0x69, 0xB3, 0xDE, 0xF7, 0xBB, 0xAD, 0xA4,
0x23, 0x2A, 0x63, 0xAC, 0x3A, 0xC1, 0x37, 0x8A,
0xB5, 0xEE, 0x9F, 0x25, 0xD9, 0x62, 0xF2, 0x53,
0x28, 0xC8, 0xD0, 0xBC, 0x42, 0xB6, 0x3E, 0x58,
0xA0, 0x6A, 0xA4, 0x42, 0xBB, 0x71, 0x8A, 0xEF,
0x73, 0xA2, 0x37, 0xBF, 0xFF, 0x5D, 0x59, 0x3E,
0x05, 0xC0, 0x82, 0x85, 0xB6, 0x72, 0xC9, 0x60,
0xD8, 0xE8, 0x69, 0xB0, 0x18, 0xFC, 0x9A, 0xC8,
0xE0, 0x0A, 0x40, 0xD6, 0x4C, 0x64, 0x0D, 0xA3,
0xE8, 0x20, 0xFB, 0x9E, 0xEB, 0xCE, 0x49, 0xDB,
0x74, 0x3A, 0xC9, 0xCB, 0x6D, 0xD4, 0x82, 0x1F,
0x49, 0xD5, 0xB7, 0x37, 0x3B, 0x2D, 0x81, 0x23,
0x28, 0x68, 0xB9, 0xA6, 0x18, 0x25, 0xA4, 0x5D,
0xA1, 0x69, 0xA2, 0x6B, 0x2B, 0x01, 0xFE, 0x93,
0x62, 0xEA, 0x0D, 0x73, 0x02, 0x1F, 0x64, 0x5A,
0x82, 0x7A, 0x94, 0x84, 0xC1, 0xCA, 0xC5, 0x5C,
0x17, 0x0D, 0x74, 0xB9, 0x5B, 0xAB, 0x6F, 0xC4,
0xAE, 0x94, 0x4E, 0x41, 0xDE, 0x62, 0x10, 0xB8,
0x2E, 0xF1, 0x2D, 0xAC, 0x37, 0x56, 0x33, 0x08,
0x7C, 0x58, 0xC3, 0xD5, 0xFC, 0x6B, 0xDD, 0x9E,
0x6C, 0x80, 0xB1, 0xB8, 0xE8, 0x54, 0x04, 0x07,
0x54, 0x9C, 0x9A, 0x28, 0x89, 0xF9, 0xE0, 0x77,
0xF1, 0xED, 0x92, 0xE3, 0x26, 0xEA, 0x0F, 0xF2,
0xDD, 0x03, 0xCB, 0x7B, 0x42, 0x3F, 0xAD, 0x6D,
0x19, 0x18, 0x3B, 0x5E, 0x8E, 0xA5, 0x33, 0xB1,
0x69, 0x88, 0x3F, 0x5E, 0x5A, 0x3F, 0xE5, 0xA6,
0xF5, 0x9F, 0x2C, 0xE7, 0x88, 0xC3, 0xFB, 0x61,
0x53, 0xAA, 0x0A, 0xD5, 0xD1, 0xB6, 0x88, 0x3C,
0x70, 0x72, 0x01, 0x20, 0x4D, 0x37, 0x06, 0x11,
0x1F, 0x0A, 0x74, 0xC6, 0x36, 0xAF, 0xC9, 0x76,
0x38, 0x34, 0xB6, 0x32, 0x88, 0x4B, 0xC5, 0x1A,
0xD9, 0x69, 0x51, 0xBC, 0xDB, 0xA2, 0x05, 0x79,
0x17, 0x46, 0x67, 0xB1, 0xD3, 0xCE, 0xAE, 0x17,
0x4E, 0x4F, 0x36, 0xBF, 0x3F, 0x86, 0x75, 0xAC,
0x1C, 0xAE, 0x74, 0x60, 0xFF, 0x4D, 0xF0, 0xCE,
0x41, 0xA4, 0x95, 0x4E, 0x90, 0x7D, 0xAC, 0x97,
0xF7, 0x28, 0x78, 0x9E, 0x92, 0x27, 0x76, 0x98,
0x6F, 0x30, 0xF0, 0x75, 0x2D, 0x14, 0xB2, 0xD7,
0x27, 0xCF, 0x48, 0xF4, 0xC0, 0xEC, 0xF9, 0xFD,
0x57, 0xC2, 0x6A, 0xC0, 0x6A, 0xA4, 0x33, 0x7C,
0x42, 0x4E, 0xC8, 0xF4, 0x5A, 0x66, 0x08, 0xA0,
0x47, 0x55, 0x2A, 0x66, 0x25, 0x3A, 0x69, 0xA3,
0x17, 0xB4, 0x84, 0xCC, 0xEF, 0x89, 0x78, 0x68,
0xA0, 0xFF, 0xE7, 0x60, 0x52, 0x61, 0xA4, 0xAA,
0x8D, 0x71, 0xDF, 0x17, 0x47, 0x8B, 0xB8, 0xCB,
0xDF, 0xEE, 0x5D, 0xA2, 0x1F, 0xA3, 0x98, 0x3E,
0xC3, 0xA1, 0x2F, 0x33, 0xEC, 0xDD, 0xAE, 0x8A,
0x8D, 0x0C, 0x34, 0x3A, 0x44, 0x2D, 0x7F, 0x8D,
},
DQ = new byte[]
{
0x0D, 0x79, 0x58, 0x0C, 0x4C, 0xE9, 0x15, 0x8C,
0xB0, 0xD9, 0x10, 0x81, 0xB3, 0xCB, 0x45, 0x5F,
0xA9, 0xBE, 0xED, 0x2D, 0xC0, 0x28, 0xD3, 0xA9,
0xDD, 0x9D, 0xB3, 0x3E, 0x73, 0x3E, 0x87, 0xBB,
0x32, 0x4E, 0x4E, 0x23, 0x20, 0xA0, 0x8B, 0x8B,
0xAB, 0xE0, 0x26, 0x8C, 0xAB, 0xF4, 0x8F, 0x1F,
0x77, 0xBF, 0xAD, 0xA5, 0x1B, 0xF5, 0x36, 0xBF,
0xB6, 0xFA, 0x79, 0x2D, 0xFE, 0x48, 0xD2, 0x85,
0xD2, 0x42, 0x57, 0x93, 0x85, 0xAC, 0xE3, 0x8F,
0x54, 0x1A, 0x82, 0xB3, 0x83, 0x41, 0x0F, 0xAD,
0xA7, 0xC8, 0x94, 0x21, 0x89, 0xA5, 0x92, 0x0A,
0x53, 0xE5, 0x64, 0x84, 0xF2, 0x5D, 0xC4, 0xE5,
0x28, 0x8D, 0x3F, 0xA8, 0xB6, 0x6C, 0xB9, 0x14,
0x1E, 0x02, 0x85, 0x57, 0x8E, 0x12, 0xE3, 0xBE,
0x10, 0x45, 0x41, 0x04, 0xBA, 0x68, 0x52, 0x7D,
0x1E, 0x74, 0x82, 0x94, 0xBB, 0xDE, 0xD5, 0x17,
0xF0, 0xDE, 0x95, 0x9F, 0xA9, 0x65, 0xCD, 0x31,
0x61, 0xE9, 0xC0, 0x60, 0xA7, 0x1C, 0xA7, 0x86,
0x2F, 0x51, 0x0A, 0x5E, 0xDD, 0xF3, 0x14, 0x5C,
0xA9, 0x91, 0x71, 0xEB, 0x8F, 0xA0, 0x8A, 0xFE,
0xF9, 0x02, 0x77, 0xEE, 0x93, 0x8F, 0xBA, 0x8E,
0x57, 0xAB, 0x5C, 0x6F, 0x1F, 0xE1, 0x91, 0xD8,
0x36, 0xCD, 0x40, 0x2F, 0x40, 0xA9, 0xC4, 0x56,
0x3C, 0x4B, 0x93, 0x47, 0x89, 0xDC, 0xA7, 0xEC,
0x1E, 0x38, 0xC2, 0x03, 0x00, 0x6F, 0xB8, 0xA4,
0x00, 0xB5, 0xD2, 0x8F, 0x4D, 0xB8, 0xD5, 0xDA,
0x25, 0x85, 0x13, 0xF0, 0x1B, 0x0B, 0xC7, 0x20,
0xC8, 0xF1, 0xF2, 0x63, 0x7C, 0x9E, 0x9D, 0x79,
0xCE, 0xB0, 0x72, 0xF5, 0xA8, 0xCE, 0x5C, 0xAA,
0x4E, 0x54, 0x0B, 0xA1, 0xD8, 0xCA, 0x7C, 0x73,
0xB1, 0x6A, 0xD5, 0x8F, 0x13, 0x14, 0x62, 0x89,
0xBF, 0x40, 0x93, 0x2A, 0xAC, 0xC8, 0x09, 0x37,
0xC9, 0x03, 0xC7, 0x89, 0x8C, 0x64, 0xEF, 0x4A,
0xAF, 0xCF, 0xA6, 0x3C, 0x85, 0xC4, 0xE5, 0x47,
0x60, 0xA2, 0x05, 0xED, 0x49, 0xD5, 0x27, 0x0C,
0xF9, 0xA3, 0xCB, 0x7C, 0x99, 0x03, 0x7E, 0xD5,
0x4C, 0x1B, 0xC3, 0xB7, 0xE8, 0x67, 0x30, 0xE9,
0x24, 0xE8, 0x19, 0x98, 0x27, 0x10, 0x31, 0x1A,
0xDC, 0xF9, 0x90, 0x27, 0x7B, 0x55, 0x21, 0x96,
0x73, 0x13, 0x7D, 0x9C, 0xD9, 0x82, 0x02, 0xDC,
0x58, 0x10, 0xD1, 0xE7, 0x87, 0xA5, 0xBB, 0xE1,
0xA3, 0xCD, 0xD8, 0xE4, 0x80, 0x8E, 0x8A, 0xB5,
0x69, 0x1E, 0x26, 0x48, 0x85, 0x43, 0xD3, 0xF7,
0x6B, 0x75, 0x47, 0x9A, 0xF8, 0xB7, 0x64, 0xDA,
0x5C, 0x60, 0x0B, 0xDA, 0xEF, 0x34, 0x82, 0x5E,
0x9F, 0xEC, 0xEA, 0xB9, 0x77, 0x8E, 0x5F, 0x97,
0x1A, 0x3C, 0x5B, 0xC7, 0x49, 0xC8, 0x65, 0xBC,
0x29, 0x1F, 0x42, 0x48, 0x71, 0x3A, 0x7B, 0x95,
0x45, 0x41, 0xEE, 0x2D, 0x2E, 0x44, 0xA9, 0xC0,
0x84, 0x6E, 0x20, 0x45, 0xDF, 0x79, 0x51, 0xAB,
0x19, 0xA5, 0x2D, 0x97, 0xBF, 0xCE, 0x8A, 0x8C,
0xDF, 0xC1, 0xC0, 0xF3, 0x8D, 0xFA, 0x72, 0xA8,
0x34, 0x4E, 0xEC, 0x5A, 0x18, 0x6B, 0x41, 0xD0,
0x02, 0x0A, 0x5B, 0xF7, 0x85, 0x6B, 0x4C, 0x8B,
0x75, 0xFF, 0x89, 0x63, 0xF8, 0x16, 0x53, 0x0B,
0x39, 0x70, 0xFF, 0xF0, 0x6C, 0x3C, 0xC5, 0x4B,
0x05, 0x91, 0x26, 0x96, 0xEF, 0x93, 0xAF, 0x7D,
0x67, 0xB6, 0xF2, 0xC3, 0x7E, 0x6A, 0xC5, 0x3D,
0x9F, 0x35, 0x5A, 0xFF, 0x76, 0xA4, 0x71, 0xC6,
0x6D, 0x18, 0xB0, 0x35, 0xF7, 0xC0, 0xCA, 0x97,
0x26, 0xC9, 0x32, 0x2F, 0x90, 0x34, 0xE5, 0x9C,
0x6B, 0x41, 0x5E, 0x4B, 0xCB, 0x66, 0xBE, 0xE6,
0x0E, 0x7E, 0x96, 0xC6, 0x72, 0xE9, 0x2C, 0xB9,
0x6A, 0xA0, 0x71, 0x53, 0x44, 0x67, 0x7C, 0x74,
0x43, 0x3A, 0x04, 0x63, 0xBE, 0x6A, 0x09, 0x0D,
0x82, 0x14, 0x12, 0x1A, 0xDA, 0xB5, 0x28, 0x71,
0x9D, 0x48, 0xD9, 0x0B, 0xC5, 0x8E, 0x9D, 0x75,
0xA8, 0x7B, 0x4F, 0xE3, 0xDE, 0x63, 0x7E, 0x42,
0xC6, 0xE8, 0x39, 0xBA, 0x15, 0x13, 0xB7, 0x66,
0x73, 0x73, 0x5D, 0x20, 0xF9, 0x17, 0x1B, 0xDC,
0x00, 0x4F, 0x98, 0x99, 0xE3, 0xE5, 0xEB, 0x44,
0x46, 0x9A, 0xB2, 0x03, 0x51, 0x28, 0x10, 0x54,
0x59, 0xC5, 0xA8, 0xDD, 0x5F, 0x9D, 0xC5, 0x57,
0x72, 0xA6, 0xBB, 0x48, 0x0A, 0x8E, 0xE1, 0x96,
0xFD, 0x53, 0x22, 0xD9, 0x20, 0x49, 0x17, 0xA0,
0x10, 0xEF, 0x90, 0x98, 0x2C, 0xB4, 0x69, 0x9D,
0x0A, 0x81, 0xFE, 0x21, 0x41, 0x61, 0x1C, 0x3D,
0x0C, 0xAD, 0x1B, 0xCA, 0xA8, 0xED, 0xBE, 0xAB,
0x78, 0xAD, 0x6F, 0xE3, 0x21, 0xB9, 0x48, 0xB1,
0x1F, 0x13, 0x18, 0xA4, 0x38, 0x8B, 0x9A, 0x60,
0xAA, 0xD7, 0x4E, 0xF9, 0x60, 0xC4, 0x67, 0x10,
0xD9, 0x3C, 0xE2, 0x64, 0x02, 0x10, 0x1A, 0x10,
0x91, 0x95, 0x53, 0x24, 0x54, 0xBB, 0x5E, 0x67,
0x68, 0x68, 0x07, 0x32, 0xB3, 0xDD, 0x2F, 0x80,
0x03, 0x59, 0xED, 0xF5, 0x8A, 0x49, 0x2B, 0x40,
0x6D, 0x0D, 0xD7, 0x87, 0x7C, 0x2D, 0x5A, 0x9F,
0x4F, 0xE3, 0xBA, 0xD1, 0x14, 0x08, 0xE2, 0x5A,
0x9B, 0xE7, 0xAE, 0xC0, 0xDF, 0xA6, 0x0D, 0xB4,
0xF4, 0xF2, 0x9F, 0x2A, 0x55, 0x49, 0x94, 0x4A,
0x07, 0xF6, 0xA3, 0x6D, 0x6F, 0x3E, 0xD3, 0x80,
0x94, 0x84, 0x28, 0x2E, 0xA6, 0x55, 0xAB, 0xAC,
0x1B, 0xF3, 0xE7, 0x43, 0x89, 0xF3, 0x00, 0x66,
0x7A, 0x32, 0x5D, 0x72, 0xD1, 0x3B, 0x5C, 0x00,
0xF4, 0xBF, 0x7B, 0xDE, 0xA0, 0xAF, 0xDD, 0x59,
0x1D, 0xB3, 0x73, 0xC2, 0xCD, 0x85, 0x7B, 0xEC,
0x5E, 0x01, 0xAD, 0x49, 0x42, 0xC6, 0xF8, 0x2D,
0xEE, 0x83, 0x04, 0xDC, 0x67, 0x36, 0xE7, 0x4F,
0x76, 0xAF, 0x44, 0x83, 0x6E, 0x90, 0x0A, 0x17,
0xA9, 0x58, 0xF1, 0x4A, 0x5C, 0xED, 0xB4, 0x48,
0xC3, 0xC7, 0x8F, 0x80, 0x92, 0x76, 0x90, 0x59,
0x7B, 0x96, 0x85, 0x1B, 0x6C, 0x0D, 0xBF, 0xCD,
0x04, 0xF8, 0x4D, 0xF7, 0xB4, 0x28, 0x0A, 0x48,
0x10, 0xB8, 0xBD, 0x98, 0x8A, 0xA6, 0x0A, 0xFC,
0x1E, 0x40, 0x51, 0x69, 0x1E, 0xCD, 0xA1, 0xC7,
0xD7, 0xAD, 0xFA, 0xFC, 0xED, 0x0A, 0xD6, 0xF6,
0x38, 0x88, 0x99, 0xD8, 0x8E, 0x96, 0xCD, 0xDA,
0x5C, 0x06, 0x55, 0x1D, 0x7A, 0x1C, 0x00, 0x96,
0xD8, 0x17, 0xD5, 0xF0, 0x80, 0x18, 0x67, 0x56,
0xC6, 0x5C, 0x7C, 0x49, 0x4C, 0x23, 0x17, 0x6E,
0x7B, 0x53, 0xCB, 0x59, 0x82, 0x8D, 0x23, 0x64,
0xD2, 0x4C, 0x83, 0xA8, 0x0A, 0x04, 0x30, 0xFD,
0x3B, 0xA7, 0xE7, 0x6C, 0xEF, 0x21, 0x3A, 0x00,
0xEA, 0x20, 0xF1, 0xA2, 0x99, 0x27, 0x18, 0x79,
0x0E, 0xED, 0x8E, 0x93, 0x26, 0xF7, 0xC2, 0x01,
0x52, 0x62, 0x82, 0x27, 0xD9, 0xBC, 0xEE, 0x66,
0x28, 0xC8, 0xF3, 0x59, 0xD5, 0xBE, 0x59, 0xE6,
0x7F, 0x96, 0x2E, 0x58, 0xAB, 0x2C, 0xBC, 0x0D,
0x8F, 0xAB, 0xAB, 0x04, 0x4F, 0x58, 0x99, 0x40,
0xFC, 0x41, 0x53, 0xFF, 0x3F, 0x71, 0xC3, 0x61,
0xA7, 0xF0, 0xF6, 0x44, 0x47, 0xCD, 0x06, 0x9F,
0x63, 0x29, 0x66, 0xCE, 0xA5, 0x99, 0x54, 0xC4,
0x32, 0xC0, 0xDC, 0x4C, 0xF0, 0x07, 0x07, 0x12,
0xA2, 0xE0, 0xC7, 0x30, 0x0C, 0xCB, 0xC1, 0x10,
0x64, 0xE3, 0xCA, 0x6B, 0xA8, 0x9B, 0x7C, 0xA2,
0x1B, 0x5C, 0x91, 0xF3, 0x55, 0xFC, 0x77, 0x6C,
0xBD, 0xEB, 0xEC, 0x4E, 0xE0, 0x9E, 0xE8, 0x26,
0x7E, 0x64, 0x04, 0x0A, 0x2B, 0x19, 0xB7, 0x0D,
0x58, 0xCA, 0x5A, 0x97, 0x18, 0xF0, 0x8A, 0x4D,
},
InverseQ = new byte[]
{
0x9F, 0xEA, 0xE6, 0xF8, 0x95, 0x54, 0x7E, 0x51,
0x36, 0xC4, 0xBF, 0x4B, 0x07, 0xE2, 0x31, 0x52,
0x67, 0xFC, 0xE5, 0xA4, 0xAB, 0x11, 0x7B, 0x72,
0x78, 0x90, 0xD6, 0x38, 0xDB, 0x3B, 0xEA, 0x51,
0x0B, 0xDE, 0x89, 0x8D, 0xF2, 0xB2, 0xCF, 0xE0,
0x5A, 0xBF, 0xB3, 0x69, 0x15, 0x9F, 0x83, 0x6B,
0xBA, 0x86, 0xE2, 0xE2, 0x63, 0xC6, 0xDA, 0x82,
0x0D, 0xBE, 0xD5, 0x3E, 0x5D, 0xAC, 0x55, 0x21,
0xBF, 0xFD, 0xD2, 0xBA, 0xAD, 0x62, 0x68, 0xF9,
0x51, 0x07, 0xA4, 0xAD, 0xF2, 0x15, 0x8E, 0x4A,
0x2C, 0xA8, 0xF7, 0xAF, 0x6E, 0x89, 0xD7, 0x88,
0x71, 0x56, 0x1A, 0xDB, 0xD0, 0x04, 0x75, 0x65,
0xCC, 0x83, 0xF5, 0xAA, 0x87, 0x8D, 0x8A, 0x6E,
0x4F, 0xFF, 0x75, 0x27, 0x08, 0x0D, 0x3B, 0x49,
0xA2, 0xB9, 0x74, 0x5A, 0xCD, 0x49, 0x8A, 0xF4,
0xA4, 0x01, 0x42, 0xB9, 0xD1, 0x1C, 0xC1, 0xEE,
0xAC, 0x02, 0xA4, 0x84, 0xE4, 0xFA, 0x26, 0xB3,
0x08, 0xDA, 0x71, 0x17, 0x5E, 0x85, 0x70, 0x0B,
0x78, 0xF3, 0xEE, 0xC1, 0x87, 0x09, 0x5F, 0x59,
0xFF, 0x2F, 0xA0, 0x8C, 0x09, 0x4A, 0x5B, 0xD1,
0xCD, 0xBA, 0x8A, 0x5C, 0x62, 0x86, 0x28, 0x4B,
0xC0, 0x38, 0xA4, 0xBD, 0x3E, 0x79, 0xE8, 0x07,
0xC1, 0xD1, 0x01, 0x00, 0xB0, 0xD4, 0x6B, 0x34,
0xE4, 0x73, 0xBC, 0xCB, 0x59, 0x0F, 0x51, 0xB3,
0x74, 0x86, 0x84, 0x63, 0xED, 0xA6, 0x50, 0x2A,
0xC8, 0xCF, 0xF8, 0xC0, 0xCC, 0xFE, 0xEC, 0x95,
0x64, 0xC4, 0x38, 0x7A, 0x07, 0xB6, 0x02, 0x1E,
0x14, 0xD1, 0x63, 0xEC, 0x06, 0x77, 0xCE, 0xD7,
0x36, 0x19, 0xC2, 0x00, 0x9A, 0x22, 0x23, 0x48,
0xF6, 0xD7, 0x3E, 0xC6, 0x82, 0x64, 0xD2, 0x0D,
0xB5, 0x3D, 0x63, 0xBC, 0x81, 0x33, 0x45, 0x29,
0x6D, 0x72, 0x14, 0x25, 0xD5, 0xC9, 0x39, 0x04,
0xF8, 0xB4, 0x28, 0x22, 0x7C, 0x5A, 0xF6, 0xA3,
0x7D, 0x28, 0xFF, 0xB8, 0xCD, 0x9E, 0xD0, 0x8E,
0x36, 0x91, 0x52, 0x43, 0x6E, 0x79, 0x0A, 0x4C,
0x6B, 0x1B, 0x51, 0x49, 0x56, 0x9E, 0xCF, 0x93,
0x5A, 0x2A, 0xA0, 0xBD, 0x2F, 0x54, 0xA4, 0xC8,
0xDF, 0x77, 0x36, 0x6C, 0xBD, 0x88, 0x5A, 0x6C,
0xDE, 0x78, 0xFF, 0x55, 0x6A, 0x82, 0xFA, 0x55,
0x86, 0x0D, 0x7F, 0x64, 0xED, 0xCC, 0x5A, 0x40,
0xE6, 0x36, 0x1B, 0x05, 0x2F, 0x2A, 0x29, 0x9B,
0xF1, 0x47, 0xC0, 0x4D, 0xCA, 0xCA, 0x52, 0x55,
0xFB, 0x33, 0xD9, 0xF9, 0x9C, 0x13, 0x9B, 0xFA,
0x07, 0xEB, 0x7F, 0x45, 0x6E, 0xFC, 0xA4, 0xD5,
0x62, 0x17, 0x41, 0x2F, 0xF9, 0x3D, 0x56, 0x52,
0x4D, 0x24, 0x9F, 0x0E, 0x01, 0x1F, 0x2A, 0x87,
0x0E, 0x4C, 0x51, 0x17, 0xFB, 0xD5, 0x85, 0x0C,
0xA2, 0x6F, 0xAC, 0x89, 0xC0, 0x42, 0x5F, 0x98,
0x7B, 0x27, 0xDD, 0xFD, 0xD3, 0x8A, 0x2F, 0xE5,
0x4F, 0xE5, 0x81, 0x62, 0x59, 0x14, 0x22, 0x89,
0x40, 0x97, 0x26, 0xB6, 0x1F, 0xA9, 0x51, 0xC9,
0xD3, 0xF4, 0x18, 0xCB, 0xE0, 0xEA, 0xAA, 0x08,
0xA1, 0x4B, 0x26, 0x24, 0x44, 0x9B, 0x85, 0x8F,
0xED, 0x33, 0xB9, 0x4B, 0xD8, 0x9A, 0x32, 0x19,
0xAB, 0x06, 0x02, 0x79, 0xC2, 0x58, 0xED, 0xF7,
0x1E, 0x0E, 0x45, 0x05, 0x4B, 0x09, 0x11, 0x1F,
0x22, 0x4A, 0xE3, 0xBD, 0x43, 0xAF, 0x4C, 0xD5,
0xC6, 0x84, 0xB3, 0x5B, 0x43, 0x37, 0xF7, 0x9B,
0xBD, 0x27, 0x49, 0x00, 0xFB, 0x5B, 0x10, 0x22,
0x04, 0xEB, 0xA4, 0xB9, 0x55, 0x29, 0x74, 0x8A,
0xE2, 0x73, 0x58, 0x12, 0x1B, 0xA1, 0x0C, 0x3F,
0x23, 0x6B, 0x5C, 0x86, 0x5B, 0x5E, 0xD7, 0xBD,
0xD3, 0x0F, 0x97, 0x6A, 0x39, 0x44, 0x4F, 0xBD,
0xFD, 0xF6, 0xD2, 0x65, 0x73, 0x35, 0x04, 0x55,
0xE8, 0x61, 0x5D, 0xA0, 0x39, 0xA7, 0x22, 0xE9,
0xD2, 0x50, 0x72, 0x26, 0x60, 0x7A, 0x96, 0x69,
0xE8, 0x03, 0x7C, 0x31, 0x03, 0xAB, 0x12, 0x60,
0x2C, 0x27, 0x2B, 0xC4, 0xFD, 0x99, 0xCC, 0xB5,
0xAE, 0x87, 0x67, 0x79, 0xE0, 0xC0, 0xFC, 0x42,
0x6E, 0xF4, 0xF7, 0x72, 0x50, 0x74, 0xEE, 0xE5,
0x31, 0x0A, 0xC0, 0xF2, 0xFA, 0x88, 0x29, 0xC3,
0x73, 0x8B, 0xDD, 0xC2, 0x33, 0xDB, 0xD9, 0x76,
0xD5, 0x10, 0xD9, 0x69, 0xC5, 0x91, 0xF6, 0xB3,
0x08, 0x65, 0x3C, 0x40, 0x0F, 0x8D, 0x9A, 0x34,
0xDE, 0xAA, 0xE3, 0xD3, 0x27, 0x26, 0xDE, 0x0D,
0xF5, 0xC3, 0x13, 0x7F, 0xCC, 0x37, 0x3F, 0x90,
0x76, 0xAC, 0xB3, 0xB8, 0x44, 0xA6, 0x83, 0x9D,
0xA1, 0x56, 0xC0, 0x73, 0x0D, 0xD9, 0x23, 0xC1,
0xA5, 0x16, 0xD1, 0x3F, 0x58, 0x85, 0x14, 0x87,
0x9D, 0xB5, 0x6F, 0x72, 0xCE, 0x21, 0x97, 0xAB,
0xF0, 0x62, 0x50, 0x3D, 0x52, 0xE5, 0xF3, 0x65,
0x3B, 0xAA, 0xF8, 0x1A, 0x2E, 0x1B, 0x67, 0xF7,
0x48, 0x52, 0xD1, 0xF1, 0x41, 0x8D, 0x99, 0xF0,
0x0E, 0x24, 0x22, 0xC9, 0x31, 0x4C, 0xDA, 0x75,
0x8A, 0x99, 0x44, 0xE7, 0x3A, 0x6D, 0x37, 0xD8,
0xFE, 0x18, 0x90, 0x8E, 0xC6, 0x0D, 0x2A, 0xC5,
0x7B, 0x7F, 0xCA, 0xBD, 0x9C, 0xFB, 0x26, 0xF3,
0xBD, 0x8E, 0x67, 0x9A, 0x4F, 0xCE, 0x36, 0x3A,
0x61, 0xB3, 0x83, 0x27, 0x4C, 0xE3, 0x5B, 0xF0,
0xED, 0x58, 0x3A, 0x3A, 0x61, 0x50, 0x35, 0xD6,
0xEC, 0xAA, 0x5C, 0x5E, 0xCF, 0x47, 0xBB, 0xAF,
0x2B, 0xAA, 0x44, 0x81, 0x11, 0xAF, 0x8C, 0x84,
0x69, 0x83, 0xCF, 0xC3, 0x5B, 0x0D, 0x33, 0xF5,
0x43, 0x86, 0xD5, 0x80, 0x02, 0x19, 0xB4, 0x4A,
0x16, 0x76, 0x55, 0x8C, 0x10, 0x37, 0x44, 0x32,
0x28, 0x63, 0x53, 0x9E, 0x57, 0x80, 0xD4, 0x01,
0x40, 0x00, 0x9F, 0x84, 0xA9, 0xF9, 0x9C, 0x97,
0xBE, 0x48, 0x88, 0x31, 0x8E, 0x8A, 0x86, 0x65,
0xCF, 0xB5, 0xDE, 0xE6, 0x43, 0x72, 0x8C, 0x0D,
0xC9, 0x20, 0x57, 0xAF, 0xC4, 0x75, 0xCA, 0xE8,
0xEF, 0xC0, 0xDD, 0x44, 0xD8, 0xE0, 0xD7, 0xDA,
0xEA, 0x7B, 0x4F, 0xD9, 0x85, 0x0D, 0x7B, 0x2B,
0x84, 0x50, 0x64, 0x4F, 0xBF, 0xA6, 0x5B, 0x59,
0x8E, 0x1C, 0x95, 0x31, 0x34, 0x9D, 0xCB, 0xEF,
0x40, 0x7E, 0xEE, 0x27, 0xA9, 0xBD, 0x4D, 0x4D,
0x11, 0xB0, 0x4B, 0xDA, 0xD5, 0x46, 0x72, 0xE7,
0x92, 0x30, 0x67, 0x6E, 0x53, 0x15, 0xF1, 0x4D,
0xE6, 0xCD, 0x84, 0x20, 0x90, 0xC6, 0xB8, 0xC2,
0x18, 0x93, 0x4A, 0x73, 0x98, 0xC2, 0x01, 0x58,
0x0A, 0xEF, 0x44, 0xB3, 0x1D, 0x0F, 0xC7, 0x5B,
0x53, 0xC0, 0xA4, 0x0F, 0x15, 0x99, 0xAF, 0x80,
0x57, 0xD6, 0x8E, 0xA2, 0x9C, 0x37, 0xD8, 0xCD,
0x22, 0xB7, 0x59, 0x00, 0xBE, 0xEC, 0xC7, 0x2D,
0xB6, 0x53, 0x1E, 0x9F, 0x0E, 0xA8, 0x52, 0x01,
0x58, 0x48, 0x73, 0x50, 0x2C, 0x4A, 0xFD, 0xC5,
0x45, 0x2B, 0xCF, 0xB2, 0x8B, 0x1A, 0x98, 0x53,
0xDF, 0xC4, 0x93, 0x2F, 0x77, 0xEA, 0x3C, 0xF0,
0x68, 0xEE, 0xBE, 0x40, 0x04, 0xDD, 0x0B, 0xF9,
0x09, 0x8D, 0x33, 0x93, 0x28, 0x04, 0x38, 0xC8,
0x84, 0x7F, 0xAB, 0x51, 0xD6, 0xD7, 0xAB, 0x27,
0xE0, 0x3A, 0x3C, 0x02, 0xC4, 0x62, 0xF9, 0x1B,
0x5D, 0xC7, 0xB1, 0xBD, 0x51, 0x96, 0xE0, 0xBB,
0xCA, 0xC2, 0x4A, 0x1B, 0x85, 0x1F, 0x37, 0xC5,
0xF3, 0x7B, 0x87, 0xC0, 0x7B, 0x25, 0xF2, 0x48,
0x5A, 0xCC, 0xE4, 0x1E, 0xB6, 0xE6, 0xA7, 0x04,
0x6F, 0xC6, 0xC4, 0x17, 0x5A, 0x78, 0x82, 0x45,
0x99, 0x3C, 0xA6, 0x2F, 0x52, 0xCE, 0xAE, 0xEE,
0xBD, 0x98, 0x0F, 0x60, 0xC2, 0x1B, 0x85, 0x15,
},
};
public static readonly RSAParameters DiminishedDPParameters = new RSAParameters
{
Modulus = new byte[]
{
0xB7, 0x3F, 0x59, 0xF5, 0xEE, 0x8B, 0xD5, 0x5E,
0x24, 0xB7, 0xFF, 0x02, 0x9A, 0xD1, 0x6A, 0x85,
0x43, 0xC9, 0x6D, 0x25, 0x3E, 0x54, 0x31, 0x9B,
0x93, 0x53, 0x2C, 0x41, 0xC3, 0xC1, 0x47, 0x7B,
0x89, 0xDB, 0x2D, 0x2F, 0x33, 0xD7, 0xB9, 0xA8,
0x74, 0x58, 0x48, 0xE0, 0x6A, 0x8E, 0x68, 0x3B,
0x50, 0x44, 0x51, 0x1E, 0x1B, 0xCA, 0x36, 0x25,
0x27, 0xE1, 0x7C, 0xF4, 0x2B, 0x38, 0x06, 0x15,
},
Exponent = new byte[]
{
0x01, 0x00, 0x01,
},
D = new byte[]
{
0xAF, 0xE6, 0xF2, 0x36, 0x2F, 0x9C, 0xAF, 0x5E,
0xC5, 0xA4, 0x91, 0xF8, 0x30, 0x21, 0x22, 0x3D,
0x76, 0x8A, 0x9E, 0x69, 0x07, 0xE1, 0xCE, 0x14,
0xE7, 0x61, 0x09, 0xB4, 0xBF, 0x72, 0x83, 0x68,
0x22, 0x8C, 0x1A, 0xE9, 0x62, 0x46, 0xAD, 0xDD,
0xCD, 0xA7, 0x59, 0xBD, 0x04, 0x18, 0x68, 0xB9,
0x69, 0x68, 0x17, 0xC5, 0x01, 0xE8, 0x8B, 0xBC,
0xFD, 0xEF, 0xF0, 0x02, 0x0F, 0x85, 0xF7, 0x29,
},
P = new byte[]
{
0xF3, 0x72, 0x7B, 0x1E, 0x86, 0x76, 0x20, 0x55,
0x94, 0xD3, 0xC7, 0x3A, 0x02, 0x27, 0x4D, 0x4F,
0x1A, 0x98, 0x04, 0x4A, 0x29, 0x51, 0xC8, 0x5C,
0xCD, 0x12, 0xC6, 0xFC, 0x57, 0xAD, 0x19, 0x7B,
},
DP = new byte[]
{
// Note the leading 0x00 byte.
0x00, 0x08, 0x8E, 0xFD, 0xC5, 0x14, 0xF5, 0x12,
0x2D, 0xF0, 0x0D, 0x81, 0xF3, 0x88, 0x1F, 0xD9,
0x97, 0xEE, 0x57, 0x69, 0xCF, 0x31, 0xA4, 0xAE,
0x66, 0x94, 0xCF, 0x14, 0x2F, 0xCA, 0xE5, 0x4B,
},
Q = new byte[]
{
0xC0, 0xB2, 0x3A, 0xE8, 0xEA, 0x52, 0xA9, 0xFB,
0x43, 0x4E, 0xFD, 0x4A, 0x51, 0xF3, 0x5E, 0xEB,
0xE8, 0x72, 0xA2, 0x1D, 0xB7, 0x82, 0x0C, 0xD4,
0x49, 0x88, 0x96, 0xB9, 0x54, 0xF4, 0x61, 0xAF,
},
DQ = new byte[]
{
0xAC, 0x24, 0xCC, 0xF1, 0xD4, 0x9B, 0xA2, 0x95,
0x00, 0x0D, 0x69, 0xC3, 0xE2, 0x30, 0x2B, 0x85,
0x4E, 0x74, 0x52, 0x15, 0x80, 0x21, 0xA3, 0x3A,
0x66, 0xB2, 0xAA, 0x0B, 0xC9, 0x34, 0x44, 0xAB,
},
InverseQ = new byte[]
{
0xC2, 0xC9, 0x95, 0x94, 0xC6, 0x8C, 0x40, 0x76,
0x37, 0xEB, 0x04, 0x6B, 0x31, 0xF9, 0x4E, 0x81,
0x1C, 0xCD, 0x0C, 0xCA, 0xAA, 0x9E, 0xED, 0xF6,
0x3B, 0x86, 0x35, 0xB3, 0x8F, 0x86, 0x81, 0x0B,
}
};
public static readonly RSAParameters UnusualExponentParameters = new RSAParameters()
{
Modulus = new byte[]
{
0xF6, 0xBA, 0x82, 0x83, 0x26, 0x0C, 0x39, 0x91,
0x1B, 0x8B, 0x5D, 0xB1, 0x8A, 0x0F, 0xF3, 0x6A,
0x78, 0xD5, 0x59, 0xA8, 0x0D, 0x64, 0x29, 0x3D,
0xD0, 0x0C, 0x35, 0x87, 0x56, 0x00, 0x9B, 0x3C,
0xE8, 0x91, 0xE1, 0xC2, 0x08, 0xAE, 0xDB, 0x9C,
0x15, 0xAB, 0xB5, 0x24, 0x94, 0x10, 0x08, 0xF7,
0x53, 0xCE, 0xD7, 0x7C, 0xCF, 0x75, 0xCF, 0x17,
0x45, 0x3F, 0x4C, 0xD1, 0x02, 0x92, 0x11, 0xCB,
0x31, 0xDF, 0xB5, 0xED, 0x6B, 0x23, 0x8F, 0x8D,
0x96, 0x37, 0x8E, 0x1A, 0x81, 0x20, 0x71, 0x49,
0x17, 0x05, 0xE0, 0x43, 0x1D, 0xA4, 0xD7, 0x7B,
0xB9, 0x99, 0x0A, 0xA9, 0x0B, 0x2F, 0x80, 0x89,
0x9B, 0xF1, 0x79, 0xDA, 0xC9, 0x50, 0xF6, 0xD5,
0x2D, 0xBC, 0xBF, 0xAF, 0xDA, 0x2D, 0xEF, 0x2A,
0x35, 0x29, 0xC5, 0xBC, 0x88, 0x32, 0xE5, 0xAD,
0x4E, 0x5C, 0x8F, 0x5C, 0xD0, 0x1E, 0x8E, 0x93,
},
Exponent = new byte[]
{
0x01, 0xB1,
},
D = new byte[]
{
0x7D, 0x5B, 0xCE, 0x6E, 0x62, 0x8E, 0x31, 0x59,
0xB0, 0x94, 0xD9, 0xE0, 0x69, 0x9E, 0xDD, 0xD1,
0x96, 0xAB, 0x11, 0xC3, 0xF1, 0x85, 0x11, 0xFF,
0x7A, 0xD9, 0xDC, 0x86, 0xFA, 0x9F, 0xF0, 0x47,
0x26, 0x59, 0x7D, 0xEF, 0xE3, 0x4D, 0x9B, 0xEB,
0xFA, 0x74, 0xCD, 0x8C, 0xF7, 0xDD, 0x94, 0x39,
0x14, 0xB4, 0xC4, 0xFC, 0x9B, 0x11, 0xE1, 0x3C,
0xE5, 0x1A, 0xD7, 0x36, 0xC2, 0x0B, 0x8B, 0xB2,
0x82, 0x93, 0x62, 0x80, 0x02, 0x30, 0xAF, 0x15,
0x9E, 0x5A, 0x39, 0x7C, 0x6F, 0xCA, 0x09, 0xC9,
0xD8, 0xC5, 0x21, 0x88, 0x8D, 0x52, 0xEE, 0x3A,
0x50, 0x4D, 0xB3, 0xFA, 0xA0, 0x88, 0x0D, 0x67,
0xDE, 0x9D, 0x68, 0x32, 0x03, 0xC8, 0x35, 0xCE,
0x73, 0x38, 0x19, 0xED, 0x38, 0xFE, 0xD2, 0x5C,
0xD6, 0x12, 0xF0, 0x17, 0x33, 0x99, 0x0D, 0x1F,
0xFB, 0x3D, 0xA1, 0x35, 0x24, 0x03, 0x16, 0xB1,
},
P = new byte[]
{
0xFE, 0xF8, 0x94, 0xF4, 0xC5, 0x2D, 0x9A, 0xA9,
0xA5, 0x40, 0x6E, 0x27, 0xE9, 0x27, 0x46, 0xCF,
0x29, 0xB4, 0xBD, 0x93, 0xE1, 0x99, 0x29, 0xA5,
0xDA, 0x8B, 0x76, 0x28, 0xE3, 0xD1, 0x84, 0xFF,
0x00, 0x19, 0xFD, 0xD3, 0x8C, 0x41, 0xDE, 0xF9,
0x63, 0xC6, 0x7C, 0x85, 0x5A, 0x70, 0x37, 0x6F,
0x6D, 0x9C, 0x96, 0x4A, 0xD8, 0x0C, 0x37, 0x1D,
0x04, 0xB4, 0xAB, 0x34, 0x41, 0xC0, 0x72, 0x8D,
},
DP = new byte[]
{
0x74, 0x00, 0xC3, 0x79, 0x69, 0xAC, 0x1A, 0x06,
0x3C, 0x67, 0x37, 0x70, 0x29, 0xA2, 0x20, 0xCE,
0x95, 0xA2, 0xA3, 0x1C, 0x42, 0x93, 0x22, 0x51,
0xF6, 0x0D, 0xC9, 0x90, 0x88, 0xC2, 0x0E, 0xFB,
0xFF, 0x74, 0x78, 0xCD, 0x9F, 0x97, 0x2B, 0x81,
0x6D, 0x3F, 0x1B, 0xAE, 0xC7, 0x00, 0xCC, 0xF4,
0x06, 0xB5, 0xCC, 0xF3, 0x58, 0x3E, 0x50, 0xA6,
0x54, 0x52, 0x32, 0xB2, 0x15, 0xA3, 0x3B, 0xCD,
},
Q = new byte[]
{
0xF7, 0xB9, 0x69, 0x93, 0xFA, 0x16, 0x23, 0x46,
0x31, 0x27, 0x4A, 0xBB, 0x5A, 0x34, 0xD3, 0xB8,
0x4A, 0xD1, 0xCC, 0xE7, 0x21, 0x3D, 0x66, 0xEC,
0x68, 0x90, 0x92, 0xD9, 0xDB, 0x1F, 0x01, 0xBD,
0x02, 0xC9, 0x3E, 0x14, 0x82, 0x6A, 0x47, 0x8E,
0xC4, 0x47, 0xD8, 0x48, 0x79, 0x74, 0x66, 0x7F,
0x68, 0x08, 0x7E, 0x77, 0x39, 0x24, 0x80, 0xF3,
0x16, 0x83, 0x89, 0xC8, 0x1C, 0x6F, 0x4D, 0x9F,
},
DQ = new byte[]
{
0x32, 0xEA, 0xFC, 0xDE, 0x90, 0x39, 0xC2, 0xAB,
0x1A, 0x10, 0xF1, 0xCC, 0xA4, 0x92, 0xD6, 0xF8,
0xF2, 0x68, 0x9C, 0x38, 0xF7, 0x75, 0xDB, 0xCE,
0x72, 0xE7, 0xEA, 0x28, 0x0C, 0x85, 0x7C, 0x83,
0xAC, 0x07, 0x12, 0xAC, 0x1F, 0x89, 0x22, 0x37,
0xF3, 0x22, 0x47, 0x0F, 0x7C, 0xE1, 0x88, 0x5B,
0x38, 0xDB, 0x50, 0xFA, 0x5A, 0x60, 0xC7, 0x24,
0x5D, 0xE7, 0x02, 0x4E, 0x60, 0xE4, 0x9F, 0x9F,
},
InverseQ = new byte[]
{
0xB1, 0xE1, 0x44, 0xDD, 0xFB, 0x21, 0xA7, 0xF8,
0x54, 0x8E, 0x05, 0x1D, 0x11, 0x2B, 0xC3, 0xE3,
0x56, 0x29, 0x17, 0xEB, 0xD9, 0x9B, 0x3D, 0xAA,
0xBA, 0x8E, 0x55, 0x68, 0x00, 0xD8, 0x10, 0x04,
0xD6, 0x53, 0x8D, 0xE4, 0xBE, 0x81, 0xF6, 0x20,
0x73, 0xF3, 0x7C, 0xAB, 0xB4, 0x61, 0x2D, 0xD8,
0x81, 0x32, 0x0C, 0x1C, 0xFD, 0xCB, 0xB0, 0xAB,
0x22, 0x5F, 0x7B, 0x41, 0xD8, 0x32, 0x59, 0xA3,
},
};
internal static readonly RSAParameters RsaBigExponentParams = new RSAParameters
{
Modulus = (
"AF81C1CBD8203F624A539ED6608175372393A2837D4890E48A19DED369731156" +
"20968D6BE0D3DAA38AA777BE02EE0B6B93B724E8DCC12B632B4FA80BBC925BCE" +
"624F4CA7CC606306B39403E28C932D24DD546FFE4EF6A37F10770B2215EA8CBB" +
"5BF427E8C4D89B79EB338375100C5F83E55DE9B4466DDFBEEE42539AEF33EF18" +
"7B7760C3B1A1B2103C2D8144564A0C1039A09C85CF6B5974EB516FC8D6623C94" +
"AE3A5A0BB3B4C792957D432391566CF3E2A52AFB0C142B9E0681B8972671AF2B" +
"82DD390A39B939CF719568687E4990A63050CA7768DCD6B378842F18FDB1F6D9" +
"FF096BAF7BEB98DCF930D66FCFD503F58D41BFF46212E24E3AFC45EA42BD8847").HexToByteArray(),
Exponent = new byte[] { 0x02, 0x00, 0x00, 0x04, 0x41 },
D = (
"64AF9BA5262483DA92B53F13439FD0EF13012F879ABC03CB7C06F1209904F352" +
"C1F223519DC48BFAEEBB511B0D955F6167B50E034FEA2ABC590B4EA9FBF0C51F" +
"9FFEA16F7927AE681CBF7358452BCA29D58705E0CAA106013B09A6F5F5911498" +
"D2C4FD6915585488E5F3AD89836C93C8775AFAB4D13C2014266BE8EE6B8AA66C" +
"9E942D493466C8E3A370F8E6378CE95D637E03673670BE4BCACE5FCDADD238D9" +
"F32CA35DE845776AC4BF36118812328C493F91C25A9BD42672D0AFAFDE0AF7E6" +
"19078D48B485EF91933DDCFFB54587B8F512D223C81894E91784982F3C5C6587" +
"1351F4655AB023C4AD99B6B03A96F9046CE124A471E828F05F8DB3BC7CCCF2D1").HexToByteArray(),
P = (
"E43A3826A97204AE3CD8649A84DB4BBF0725C4B08F8C43840557A0CD04E313AF" +
"6D0460DDE69CDC508AD043D72514DA7A66BC918CD9624F485644B9DEEAB2BE0E" +
"112956D472CF0FD51F80FD33872D2DCC562A0588B012E8C90CE7D254B94792C6" +
"E7A02B3CCAA150E67A64377ACC49479AD5EB555493B2100CB0410956F7D73BF5").HexToByteArray(),
Q = (
"C4DD2D7ADD6CA50740D3973F40C4DEBDBAB51F7F5181ABAE726C32596A3EDD0A" +
"EE44DAADDD8A9B7A864C4FFDAE00C4CB1F10177BA01C0466F812D522610F8C45" +
"43F1C3EF579FA9E13AE8DA1A4A8DAE307861D2CEAC03560279B61B6514989883" +
"FE86C5C7420D312838FC2F70BED59B5229654201882664CEFA38B48A3723E9CB").HexToByteArray(),
DP = (
"09ECF151F5CDD2C9E6E52682364FA5B4ED094F622E4031BF46B851358A584DCC" +
"B5328B0BD9B63589183F491593D2A3ACAD14E0AACDA1F181B5C7D93C57ED26E6" +
"2C9FC26AF37E4A0644ECE82A7BA8AED88FF1D8E9C56CC66385CDB244EB3D57D1" +
"7E6AD420B19C9E2BEE18192B816265B74DA55FA3825F922D9D8E835B76BF3071").HexToByteArray(),
DQ = (
"89B33B695789174B88368C494639D4D3267224572A40B2FE61910384228E3DBD" +
"11EED9040CD03977E9E0D7FC8BFC4BF4A93283529FF1D96590B18F4EABEF0303" +
"794F293E88DC761B3E23AFECB19F29F8A4D2A9058B714CF3F4D10733F13EA72B" +
"BF1FBEC8D71E106D0CE2115F3AD2DE020325C3879A091C413CD6397F83B3CB89").HexToByteArray(),
InverseQ = (
"7C57ED74C9176FBA76C23183202515062C664D4D49FF3E037047A309DA10F159" +
"0CE01B7A1CD1A4326DC75883DFF93110AB065AAED140C9B98176A8810809ADEC" +
"75E86764A0951597EF467FA8FD509181CD2E491E43BE41084E5BE1B562EE76E9" +
"F92C9AB1E5AEAD9D291A6337E4DE85BDE67A0D72B4E55ADCF207F7A5A5225E15").HexToByteArray()
};
public static readonly RSAParameters CspTestKey = new RSAParameters
{
Modulus = ByteUtils.HexToByteArray("e06aac9ec3e98bae9ebaf921eb7898f34a58a6a4f6370a9d767cd1f0492e7969b4defdb11b1795a63fefb3359b55c392ecb22f5791e1d925ea5cf74bc5094ddc0164ebb021028423151c7641181940112b0d46e9562d3cec8364d58be8d9c84910e196fa458f633cf6431354df98b773c32c0cf6d18147222a96824b64019ae1"),
Exponent = ByteUtils.HexToByteArray("010001"),
D = ByteUtils.HexToByteArray("143d3aa534e8feaa7871475faa435d93ef7c104767572e736608bacc4f654c18def18f72a60d59f73ce3eac72663b5382e75a17465d93702c6e0ac82de59c8f627b01b1bc02b0aa98925b4a010d2c5c563544daeabf148997d8d016b63fa3ce05b3788c5ae9ba0d5ea9b990804f40ac7ebbe62f8b9b884c154a0f8628b00ac43"),
P = ByteUtils.HexToByteArray("e1aab100887245692770c5059cf3b6f2dabb83b015c61a229806e298a79bd360609d4b5894a1c231c9b47fd7b7a4f1a44b3870acf80373b484e5296e9f3ab47b"),
DP = ByteUtils.HexToByteArray("4966e0fe0063d2e9fa37370eb5579ca96fb6508644fed3df6ebdc694cae7e7a050acb9264dea33a5482b9aedcac12f0c369f5c1f16e8e088d63547fdc07332e3"),
Q = ByteUtils.HexToByteArray("fe94f7aa687940d862b0f6f44165656bf81acc5790a9d065624dd0f9d239d39e77d5c3038a317593ce7b24f31e76ce2654ca3cccf878a12088ae8d87b5111553"),
DQ = ByteUtils.HexToByteArray("6c501eeb1e95f013e03160705d5e717f3548d985abe3c3e94ea0c2f7770ce94f33b6fbc886c4323d178d671414f3011467e0bf6b898f71263160ea9041662a47"),
InverseQ = ByteUtils.HexToByteArray("97d9b81076a4b08a1427168b3deacfb3d65d2a5ce23e098671cd1150882161f3911b60e02f6ebbc9a5009d06ef50f2c51ed2da8f787c5b7d63bc7bc0fe1cf75a"),
};
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/installer/tests/HostActivation.Tests/StartupHooks.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.IO;
using System.Linq;
using Xunit;
using Microsoft.Extensions.DependencyModel;
namespace Microsoft.DotNet.CoreSetup.Test.HostActivation
{
public class StartupHooks : IClassFixture<StartupHooks.SharedTestState>
{
private SharedTestState sharedTestState;
private string startupHookVarName = "DOTNET_STARTUP_HOOKS";
private string startupHookRuntimeConfigName = "STARTUP_HOOKS";
private string startupHookSupport = "System.StartupHookProvider.IsSupported";
public StartupHooks(StartupHooks.SharedTestState fixture)
{
sharedTestState = fixture;
}
// Run the app with a startup hook
[Fact]
public void Muxer_activation_of_StartupHook_Succeeds()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var startupHookWithNonPublicMethodFixture = sharedTestState.StartupHookWithNonPublicMethodFixture.Copy();
var startupHookWithNonPublicMethodDll = startupHookWithNonPublicMethodFixture.TestProject.AppDll;
// Simple startup hook
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello World");
// Non-public Initialize method
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookWithNonPublicMethodDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook with non-public method");
// Ensure startup hook tracing works
dotnet.Exec(appDll)
.EnvironmentVariable("COREHOST_TRACE", "1")
.EnvironmentVariable(startupHookVarName, startupHookDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdErrContaining("Property STARTUP_HOOKS = " + startupHookDll)
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello World");
// Startup hook in type that has an additional overload of Initialize with a different signature
startupHookFixture = sharedTestState.StartupHookWithOverloadFixture.Copy();
startupHookDll = startupHookFixture.TestProject.AppDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook with overload! Input: 123")
.And.HaveStdOutContaining("Hello World");
}
// Run the app with multiple startup hooks
[Fact]
public void Muxer_activation_of_Multiple_StartupHooks_Succeeds()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var startupHook2Fixture = sharedTestState.StartupHookWithDependencyFixture.Copy();
var startupHook2Dll = startupHook2Fixture.TestProject.AppDll;
// Multiple startup hooks
var startupHookVar = startupHookDll + Path.PathSeparator + startupHook2Dll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello from startup hook with dependency!")
.And.HaveStdOutContaining("Hello World");
}
[Fact]
public void Muxer_activation_of_RuntimeConfig_StartupHook_Succeeds()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
RuntimeConfig.FromFile(fixture.TestProject.RuntimeConfigJson)
.WithProperty(startupHookRuntimeConfigName, startupHookDll)
.Save();
// RuntimeConfig defined startup hook
dotnet.Exec(appDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello World");
}
[Fact]
public void Muxer_activation_of_RuntimeConfig_And_Environment_StartupHooks_SucceedsInExpectedOrder()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
RuntimeConfig.FromFile(fixture.TestProject.RuntimeConfigJson)
.WithProperty(startupHookRuntimeConfigName, startupHookDll)
.Save();
var startupHook2Fixture = sharedTestState.StartupHookWithDependencyFixture.Copy();
var startupHook2Dll = startupHook2Fixture.TestProject.AppDll;
// include any char to counter output from other threads such as in #57243
const string wildcardPattern = @"[\r\n\s.]*";
// RuntimeConfig and Environment startup hooks in expected order
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHook2Dll)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutMatching("Hello from startup hook with dependency!" +
wildcardPattern +
"Hello from startup hook!" +
wildcardPattern +
"Hello World");
}
// Empty startup hook variable
[Fact]
public void Muxer_activation_of_Empty_StartupHook_Variable_Succeeds()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookVar = "";
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World");
}
// Run the app with a startup hook assembly that depends on assemblies not on the TPA list
[Fact]
public void Muxer_activation_of_StartupHook_With_Missing_Dependencies_Fails()
{
var fixture = sharedTestState.PortableAppWithExceptionFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookWithDependencyFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
// Startup hook has a dependency not on the TPA list
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining("System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json");
}
// Different variants of the startup hook variable format
[Fact]
public void Muxer_activation_of_StartupHook_VariableVariants()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var startupHook2Fixture = sharedTestState.StartupHookWithDependencyFixture.Copy();
var startupHook2Dll = startupHook2Fixture.TestProject.AppDll;
// Missing entries in the hook
var startupHookVar = startupHookDll + Path.PathSeparator + Path.PathSeparator + startupHook2Dll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello from startup hook with dependency!")
.And.HaveStdOutContaining("Hello World");
// Whitespace is invalid
startupHookVar = startupHookDll + Path.PathSeparator + " " + Path.PathSeparator + startupHook2Dll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining("System.ArgumentException: The startup hook simple assembly name ' ' is invalid.");
// Leading separator
startupHookVar = Path.PathSeparator + startupHookDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello World");
// Trailing separator
startupHookVar = startupHookDll + Path.PathSeparator + startupHook2Dll + Path.PathSeparator;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello from startup hook with dependency!")
.And.HaveStdOutContaining("Hello World");
}
[Fact]
public void Muxer_activation_of_StartupHook_With_Invalid_Simple_Name_Fails()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var relativeAssemblyPath = $".{Path.DirectorySeparatorChar}Assembly";
var expectedError = "System.ArgumentException: The startup hook simple assembly name '{0}' is invalid.";
// With directory separator
var startupHookVar = relativeAssemblyPath;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookVar))
.And.NotHaveStdErrContaining("--->");
// With alternative directory separator
startupHookVar = $".{Path.AltDirectorySeparatorChar}Assembly";
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookVar))
.And.NotHaveStdErrContaining("--->");
// With comma
startupHookVar = $"Assembly,version=1.0.0.0";
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookVar))
.And.NotHaveStdErrContaining("--->");
// With space
startupHookVar = $"Assembly version";
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookVar))
.And.NotHaveStdErrContaining("--->");
// With .dll suffix
startupHookVar = $".{Path.AltDirectorySeparatorChar}Assembly.DLl";
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookVar))
.And.NotHaveStdErrContaining("--->");
// With invalid name
startupHookVar = $"Assembly=Name";
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookVar))
.And.HaveStdErrContaining("---> System.IO.FileLoadException: The given assembly name or codebase was invalid.");
// Relative path error is caught before any hooks run
startupHookVar = startupHookDll + Path.PathSeparator + relativeAssemblyPath;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, relativeAssemblyPath))
.And.NotHaveStdOutContaining("Hello from startup hook!");
}
[Fact]
public void Muxer_activation_of_StartupHook_With_Missing_Assembly_Fails()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var expectedError = "System.ArgumentException: Startup hook assembly '{0}' failed to load.";
// With file path which doesn't exist
var startupHookVar = startupHookDll + ".missing.dll";
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookVar))
.And.HaveStdErrContaining($"---> System.IO.FileNotFoundException: Could not load file or assembly '{startupHookVar}'. The system cannot find the file specified.");
// With simple name which won't resolve
startupHookVar = "MissingAssembly";
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookVar))
.And.HaveStdErrContaining($"---> System.IO.FileNotFoundException: Could not load file or assembly '{startupHookVar}");
}
[Fact]
public void Muxer_activation_of_StartupHook_WithSimpleAssemblyName_Succeeds()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var startupHookAssemblyName = Path.GetFileNameWithoutExtension(startupHookDll);
File.Copy(startupHookDll, Path.Combine(fixture.TestProject.BuiltApp.Location, Path.GetFileName(startupHookDll)));
SharedFramework.AddReferenceToDepsJson(
fixture.TestProject.DepsJson,
$"{fixture.TestProject.AssemblyName}/1.0.0",
startupHookAssemblyName,
"1.0.0");
fixture.BuiltDotnet.Exec(fixture.TestProject.AppDll)
.EnvironmentVariable(startupHookVarName, startupHookAssemblyName)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello World");
}
// Run the app with missing startup hook assembly
[Fact]
public void Muxer_activation_of_Missing_StartupHook_Assembly_Fails()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var startupHookMissingDll = Path.Combine(Path.GetDirectoryName(startupHookDll), "StartupHookMissing.dll");
var expectedError = "System.IO.FileNotFoundException: Could not load file or assembly '{0}'.";
// Missing dll is detected with appropriate error
var startupHookVar = startupHookMissingDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, Path.GetFullPath(startupHookMissingDll)));
// Missing dll is detected after previous hooks run
startupHookVar = startupHookDll + Path.PathSeparator + startupHookMissingDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdErrContaining(string.Format(expectedError, Path.GetFullPath((startupHookMissingDll))));
}
// Run the app with an invalid startup hook assembly
[Fact]
public void Muxer_activation_of_Invalid_StartupHook_Assembly_Fails()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var startupHookInvalidAssembly = sharedTestState.StartupHookStartupHookInvalidAssemblyFixture.Copy();
var startupHookInvalidAssemblyDll = Path.Combine(Path.GetDirectoryName(startupHookInvalidAssembly.TestProject.AppDll), "StartupHookInvalidAssembly.dll");
var expectedError = "System.BadImageFormatException";
// Dll load gives meaningful error message
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookInvalidAssemblyDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(expectedError);
// Dll load error happens after previous hooks run
var startupHookVar = startupHookDll + Path.PathSeparator + startupHookInvalidAssemblyDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(expectedError);
}
// Run the app with the startup hook type missing
[Fact]
public void Muxer_activation_of_Missing_StartupHook_Type_Fails()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var startupHookMissingTypeFixture = sharedTestState.StartupHookWithoutStartupHookTypeFixture.Copy();
var startupHookMissingTypeDll = startupHookMissingTypeFixture.TestProject.AppDll;
// Missing type is detected
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookMissingTypeDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining("System.TypeLoadException: Could not load type 'StartupHook' from assembly 'StartupHook");
// Missing type is detected after previous hooks have run
var startupHookVar = startupHookDll + Path.PathSeparator + startupHookMissingTypeDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdErrContaining("System.TypeLoadException: Could not load type 'StartupHook' from assembly 'StartupHookWithoutStartupHookType");
}
// Run the app with a startup hook that doesn't have any Initialize method
[Fact]
public void Muxer_activation_of_StartupHook_With_Missing_Method_Fails()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var startupHookMissingMethodFixture = sharedTestState.StartupHookWithoutInitializeMethodFixture.Copy();
var startupHookMissingMethodDll = startupHookMissingMethodFixture.TestProject.AppDll;
var expectedError = "System.MissingMethodException: Method 'StartupHook.Initialize' not found.";
// No Initialize method
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookMissingMethodDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(expectedError);
// Missing Initialize method is caught after previous hooks have run
var startupHookVar = startupHookDll + Path.PathSeparator + startupHookMissingMethodDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdErrContaining(expectedError);
}
// Run the app with startup hook that has no static void Initialize() method
[Fact]
public void Muxer_activation_of_StartupHook_With_Incorrect_Method_Signature_Fails()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var expectedError = "System.ArgumentException: The signature of the startup hook 'StartupHook.Initialize' in assembly '{0}' was invalid. It must be 'public static void Initialize()'.";
// Initialize is an instance method
var startupHookWithInstanceMethodFixture = sharedTestState.StartupHookWithInstanceMethodFixture.Copy();
var startupHookWithInstanceMethodDll = startupHookWithInstanceMethodFixture.TestProject.AppDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookWithInstanceMethodDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookWithInstanceMethodDll));
// Initialize method takes parameters
var startupHookWithParameterFixture = sharedTestState.StartupHookWithParameterFixture.Copy();
var startupHookWithParameterDll = startupHookWithParameterFixture.TestProject.AppDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookWithParameterDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookWithParameterDll));
// Initialize method has non-void return type
var startupHookWithReturnTypeFixture = sharedTestState.StartupHookWithReturnTypeFixture.Copy();
var startupHookWithReturnTypeDll = startupHookWithReturnTypeFixture.TestProject.AppDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookWithReturnTypeDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookWithReturnTypeDll));
// Initialize method that has multiple methods with an incorrect signature
var startupHookWithMultipleIncorrectSignaturesFixture = sharedTestState.StartupHookWithMultipleIncorrectSignaturesFixture.Copy();
var startupHookWithMultipleIncorrectSignaturesDll = startupHookWithMultipleIncorrectSignaturesFixture.TestProject.AppDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookWithMultipleIncorrectSignaturesDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookWithMultipleIncorrectSignaturesDll));
// Signature problem is caught after previous hooks have run
var startupHookVar = startupHookDll + Path.PathSeparator + startupHookWithMultipleIncorrectSignaturesDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdErrContaining(string.Format(expectedError, startupHookWithMultipleIncorrectSignaturesDll));
}
private static void RemoveLibraryFromDepsJson(string depsJsonPath, string libraryName)
{
DependencyContext context;
using (FileStream fileStream = File.Open(depsJsonPath, FileMode.Open))
{
using (DependencyContextJsonReader reader = new DependencyContextJsonReader())
{
context = reader.Read(fileStream);
}
}
context = new DependencyContext(context.Target,
context.CompilationOptions,
context.CompileLibraries,
context.RuntimeLibraries.Select(lib => new RuntimeLibrary(
lib.Type,
lib.Name,
lib.Version,
lib.Hash,
lib.RuntimeAssemblyGroups.Select(assemblyGroup => new RuntimeAssetGroup(
assemblyGroup.Runtime,
assemblyGroup.RuntimeFiles.Where(f => !f.Path.EndsWith("SharedLibrary.dll")))).ToList().AsReadOnly(),
lib.NativeLibraryGroups,
lib.ResourceAssemblies,
lib.Dependencies,
lib.Serviceable,
lib.Path,
lib.HashPath,
lib.RuntimeStoreManifestName)),
context.RuntimeGraph);
using (FileStream fileStream = File.Open(depsJsonPath, FileMode.Truncate, FileAccess.Write))
{
DependencyContextWriter writer = new DependencyContextWriter();
writer.Write(context, fileStream);
}
}
// Run startup hook that adds an assembly resolver
[Fact]
public void Muxer_activation_of_StartupHook_With_Assembly_Resolver()
{
var fixture = sharedTestState.PortableAppWithMissingRefFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var appDepsJson = Path.Combine(Path.GetDirectoryName(appDll), Path.GetFileNameWithoutExtension(appDll) + ".deps.json");
RemoveLibraryFromDepsJson(appDepsJson, "SharedLibrary.dll");
var startupHookFixture = sharedTestState.StartupHookWithAssemblyResolver.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
// No startup hook results in failure due to missing app dependency
dotnet.Exec(appDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining("FileNotFoundException: Could not load file or assembly 'SharedLibrary");
// Startup hook with assembly resolver results in use of injected dependency (which has value 2)
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.ExitWith(2);
}
[Fact]
public void Muxer_activation_of_StartupHook_With_IsSupported_False()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
RuntimeConfig.FromFile(fixture.TestProject.RuntimeConfigJson)
.WithProperty(startupHookSupport, "false")
.Save();
// Startup hooks are not executed when the StartupHookSupport
// feature switch is set to false.
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.NotHaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello World");
}
public class SharedTestState : IDisposable
{
// Entry point projects
public TestProjectFixture PortableAppFixture { get; }
public TestProjectFixture PortableAppWithExceptionFixture { get; }
// Entry point with missing reference assembly
public TestProjectFixture PortableAppWithMissingRefFixture { get; }
// Correct startup hooks
public TestProjectFixture StartupHookFixture { get; }
public TestProjectFixture StartupHookWithOverloadFixture { get; }
// Missing startup hook type (no StartupHook type defined)
public TestProjectFixture StartupHookWithoutStartupHookTypeFixture { get; }
// Missing startup hook method (no Initialize method defined)
public TestProjectFixture StartupHookWithoutInitializeMethodFixture { get; }
// Invalid startup hook assembly
public TestProjectFixture StartupHookStartupHookInvalidAssemblyFixture { get; }
// Invalid startup hooks (incorrect signatures)
public TestProjectFixture StartupHookWithNonPublicMethodFixture { get; }
public TestProjectFixture StartupHookWithInstanceMethodFixture { get; }
public TestProjectFixture StartupHookWithParameterFixture { get; }
public TestProjectFixture StartupHookWithReturnTypeFixture { get; }
public TestProjectFixture StartupHookWithMultipleIncorrectSignaturesFixture { get; }
// Valid startup hooks with incorrect behavior
public TestProjectFixture StartupHookWithDependencyFixture { get; }
// Startup hook with an assembly resolver
public TestProjectFixture StartupHookWithAssemblyResolver { get; }
public RepoDirectoriesProvider RepoDirectories { get; }
public SharedTestState()
{
RepoDirectories = new RepoDirectoriesProvider();
// Entry point projects
PortableAppFixture = new TestProjectFixture("PortableApp", RepoDirectories)
.EnsureRestored()
.PublishProject();
PortableAppWithExceptionFixture = new TestProjectFixture("PortableAppWithException", RepoDirectories)
.EnsureRestored()
.PublishProject();
// Entry point with missing reference assembly
PortableAppWithMissingRefFixture = new TestProjectFixture("PortableAppWithMissingRef", RepoDirectories)
.EnsureRestored()
.PublishProject();
// Correct startup hooks
StartupHookFixture = new TestProjectFixture("StartupHook", RepoDirectories)
.EnsureRestored()
.PublishProject();
StartupHookWithOverloadFixture = new TestProjectFixture("StartupHookWithOverload", RepoDirectories)
.EnsureRestored()
.PublishProject();
// Missing startup hook type (no StartupHook type defined)
StartupHookWithoutStartupHookTypeFixture = new TestProjectFixture("StartupHookWithoutStartupHookType", RepoDirectories)
.EnsureRestored()
.PublishProject();
// Missing startup hook method (no Initialize method defined)
StartupHookWithoutInitializeMethodFixture = new TestProjectFixture("StartupHookWithoutInitializeMethod", RepoDirectories)
.EnsureRestored()
.PublishProject();
// Invalid startup hook assembly
StartupHookStartupHookInvalidAssemblyFixture = new TestProjectFixture("StartupHookFake", RepoDirectories)
.EnsureRestored()
.PublishProject();
// Invalid startup hooks (incorrect signatures)
StartupHookWithNonPublicMethodFixture = new TestProjectFixture("StartupHookWithNonPublicMethod", RepoDirectories)
.EnsureRestored()
.PublishProject();
StartupHookWithInstanceMethodFixture = new TestProjectFixture("StartupHookWithInstanceMethod", RepoDirectories)
.EnsureRestored()
.PublishProject();
StartupHookWithParameterFixture = new TestProjectFixture("StartupHookWithParameter", RepoDirectories)
.EnsureRestored()
.PublishProject();
StartupHookWithReturnTypeFixture = new TestProjectFixture("StartupHookWithReturnType", RepoDirectories)
.EnsureRestored()
.PublishProject();
StartupHookWithMultipleIncorrectSignaturesFixture = new TestProjectFixture("StartupHookWithMultipleIncorrectSignatures", RepoDirectories)
.EnsureRestored()
.PublishProject();
// Valid startup hooks with incorrect behavior
StartupHookWithDependencyFixture = new TestProjectFixture("StartupHookWithDependency", RepoDirectories)
.EnsureRestored()
.PublishProject();
// Startup hook with an assembly resolver
StartupHookWithAssemblyResolver = new TestProjectFixture("StartupHookWithAssemblyResolver", RepoDirectories)
.EnsureRestored()
.PublishProject();
}
public void Dispose()
{
// Entry point projects
PortableAppFixture.Dispose();
PortableAppWithExceptionFixture.Dispose();
// Entry point with missing reference assembly
PortableAppWithMissingRefFixture.Dispose();
// Correct startup hooks
StartupHookFixture.Dispose();
StartupHookWithOverloadFixture.Dispose();
// Missing startup hook type (no StartupHook type defined)
StartupHookWithoutStartupHookTypeFixture.Dispose();
// Missing startup hook method (no Initialize method defined)
StartupHookWithoutInitializeMethodFixture.Dispose();
// Invalid startup hook assembly
StartupHookStartupHookInvalidAssemblyFixture.Dispose();
// Invalid startup hooks (incorrect signatures)
StartupHookWithNonPublicMethodFixture.Dispose();
StartupHookWithInstanceMethodFixture.Dispose();
StartupHookWithParameterFixture.Dispose();
StartupHookWithReturnTypeFixture.Dispose();
StartupHookWithMultipleIncorrectSignaturesFixture.Dispose();
// Valid startup hooks with incorrect behavior
StartupHookWithDependencyFixture.Dispose();
// Startup hook with an assembly resolver
StartupHookWithAssemblyResolver.Dispose();
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.IO;
using System.Linq;
using Xunit;
using Microsoft.Extensions.DependencyModel;
namespace Microsoft.DotNet.CoreSetup.Test.HostActivation
{
public class StartupHooks : IClassFixture<StartupHooks.SharedTestState>
{
private SharedTestState sharedTestState;
private string startupHookVarName = "DOTNET_STARTUP_HOOKS";
private string startupHookRuntimeConfigName = "STARTUP_HOOKS";
private string startupHookSupport = "System.StartupHookProvider.IsSupported";
public StartupHooks(StartupHooks.SharedTestState fixture)
{
sharedTestState = fixture;
}
// Run the app with a startup hook
[Fact]
public void Muxer_activation_of_StartupHook_Succeeds()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var startupHookWithNonPublicMethodFixture = sharedTestState.StartupHookWithNonPublicMethodFixture.Copy();
var startupHookWithNonPublicMethodDll = startupHookWithNonPublicMethodFixture.TestProject.AppDll;
// Simple startup hook
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello World");
// Non-public Initialize method
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookWithNonPublicMethodDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook with non-public method");
// Ensure startup hook tracing works
dotnet.Exec(appDll)
.EnvironmentVariable("COREHOST_TRACE", "1")
.EnvironmentVariable(startupHookVarName, startupHookDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdErrContaining("Property STARTUP_HOOKS = " + startupHookDll)
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello World");
// Startup hook in type that has an additional overload of Initialize with a different signature
startupHookFixture = sharedTestState.StartupHookWithOverloadFixture.Copy();
startupHookDll = startupHookFixture.TestProject.AppDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook with overload! Input: 123")
.And.HaveStdOutContaining("Hello World");
}
// Run the app with multiple startup hooks
[Fact]
public void Muxer_activation_of_Multiple_StartupHooks_Succeeds()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var startupHook2Fixture = sharedTestState.StartupHookWithDependencyFixture.Copy();
var startupHook2Dll = startupHook2Fixture.TestProject.AppDll;
// Multiple startup hooks
var startupHookVar = startupHookDll + Path.PathSeparator + startupHook2Dll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello from startup hook with dependency!")
.And.HaveStdOutContaining("Hello World");
}
[Fact]
public void Muxer_activation_of_RuntimeConfig_StartupHook_Succeeds()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
RuntimeConfig.FromFile(fixture.TestProject.RuntimeConfigJson)
.WithProperty(startupHookRuntimeConfigName, startupHookDll)
.Save();
// RuntimeConfig defined startup hook
dotnet.Exec(appDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello World");
}
[Fact]
public void Muxer_activation_of_RuntimeConfig_And_Environment_StartupHooks_SucceedsInExpectedOrder()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
RuntimeConfig.FromFile(fixture.TestProject.RuntimeConfigJson)
.WithProperty(startupHookRuntimeConfigName, startupHookDll)
.Save();
var startupHook2Fixture = sharedTestState.StartupHookWithDependencyFixture.Copy();
var startupHook2Dll = startupHook2Fixture.TestProject.AppDll;
// include any char to counter output from other threads such as in #57243
const string wildcardPattern = @"[\r\n\s.]*";
// RuntimeConfig and Environment startup hooks in expected order
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHook2Dll)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutMatching("Hello from startup hook with dependency!" +
wildcardPattern +
"Hello from startup hook!" +
wildcardPattern +
"Hello World");
}
// Empty startup hook variable
[Fact]
public void Muxer_activation_of_Empty_StartupHook_Variable_Succeeds()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookVar = "";
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello World");
}
// Run the app with a startup hook assembly that depends on assemblies not on the TPA list
[Fact]
public void Muxer_activation_of_StartupHook_With_Missing_Dependencies_Fails()
{
var fixture = sharedTestState.PortableAppWithExceptionFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookWithDependencyFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
// Startup hook has a dependency not on the TPA list
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining("System.IO.FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json");
}
// Different variants of the startup hook variable format
[Fact]
public void Muxer_activation_of_StartupHook_VariableVariants()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var startupHook2Fixture = sharedTestState.StartupHookWithDependencyFixture.Copy();
var startupHook2Dll = startupHook2Fixture.TestProject.AppDll;
// Missing entries in the hook
var startupHookVar = startupHookDll + Path.PathSeparator + Path.PathSeparator + startupHook2Dll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello from startup hook with dependency!")
.And.HaveStdOutContaining("Hello World");
// Whitespace is invalid
startupHookVar = startupHookDll + Path.PathSeparator + " " + Path.PathSeparator + startupHook2Dll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining("System.ArgumentException: The startup hook simple assembly name ' ' is invalid.");
// Leading separator
startupHookVar = Path.PathSeparator + startupHookDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello World");
// Trailing separator
startupHookVar = startupHookDll + Path.PathSeparator + startupHook2Dll + Path.PathSeparator;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello from startup hook with dependency!")
.And.HaveStdOutContaining("Hello World");
}
[Fact]
public void Muxer_activation_of_StartupHook_With_Invalid_Simple_Name_Fails()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var relativeAssemblyPath = $".{Path.DirectorySeparatorChar}Assembly";
var expectedError = "System.ArgumentException: The startup hook simple assembly name '{0}' is invalid.";
// With directory separator
var startupHookVar = relativeAssemblyPath;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookVar))
.And.NotHaveStdErrContaining("--->");
// With alternative directory separator
startupHookVar = $".{Path.AltDirectorySeparatorChar}Assembly";
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookVar))
.And.NotHaveStdErrContaining("--->");
// With comma
startupHookVar = $"Assembly,version=1.0.0.0";
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookVar))
.And.NotHaveStdErrContaining("--->");
// With space
startupHookVar = $"Assembly version";
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookVar))
.And.NotHaveStdErrContaining("--->");
// With .dll suffix
startupHookVar = $".{Path.AltDirectorySeparatorChar}Assembly.DLl";
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookVar))
.And.NotHaveStdErrContaining("--->");
// With invalid name
startupHookVar = $"Assembly=Name";
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookVar))
.And.HaveStdErrContaining("---> System.IO.FileLoadException: The given assembly name or codebase was invalid.");
// Relative path error is caught before any hooks run
startupHookVar = startupHookDll + Path.PathSeparator + relativeAssemblyPath;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, relativeAssemblyPath))
.And.NotHaveStdOutContaining("Hello from startup hook!");
}
[Fact]
public void Muxer_activation_of_StartupHook_With_Missing_Assembly_Fails()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var expectedError = "System.ArgumentException: Startup hook assembly '{0}' failed to load.";
// With file path which doesn't exist
var startupHookVar = startupHookDll + ".missing.dll";
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookVar))
.And.HaveStdErrContaining($"---> System.IO.FileNotFoundException: Could not load file or assembly '{startupHookVar}'. The system cannot find the file specified.");
// With simple name which won't resolve
startupHookVar = "MissingAssembly";
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookVar))
.And.HaveStdErrContaining($"---> System.IO.FileNotFoundException: Could not load file or assembly '{startupHookVar}");
}
[Fact]
public void Muxer_activation_of_StartupHook_WithSimpleAssemblyName_Succeeds()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var startupHookAssemblyName = Path.GetFileNameWithoutExtension(startupHookDll);
File.Copy(startupHookDll, Path.Combine(fixture.TestProject.BuiltApp.Location, Path.GetFileName(startupHookDll)));
SharedFramework.AddReferenceToDepsJson(
fixture.TestProject.DepsJson,
$"{fixture.TestProject.AssemblyName}/1.0.0",
startupHookAssemblyName,
"1.0.0");
fixture.BuiltDotnet.Exec(fixture.TestProject.AppDll)
.EnvironmentVariable(startupHookVarName, startupHookAssemblyName)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello World");
}
// Run the app with missing startup hook assembly
[Fact]
public void Muxer_activation_of_Missing_StartupHook_Assembly_Fails()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var startupHookMissingDll = Path.Combine(Path.GetDirectoryName(startupHookDll), "StartupHookMissing.dll");
var expectedError = "System.IO.FileNotFoundException: Could not load file or assembly '{0}'.";
// Missing dll is detected with appropriate error
var startupHookVar = startupHookMissingDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, Path.GetFullPath(startupHookMissingDll)));
// Missing dll is detected after previous hooks run
startupHookVar = startupHookDll + Path.PathSeparator + startupHookMissingDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdErrContaining(string.Format(expectedError, Path.GetFullPath((startupHookMissingDll))));
}
// Run the app with an invalid startup hook assembly
[Fact]
public void Muxer_activation_of_Invalid_StartupHook_Assembly_Fails()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var startupHookInvalidAssembly = sharedTestState.StartupHookStartupHookInvalidAssemblyFixture.Copy();
var startupHookInvalidAssemblyDll = Path.Combine(Path.GetDirectoryName(startupHookInvalidAssembly.TestProject.AppDll), "StartupHookInvalidAssembly.dll");
var expectedError = "System.BadImageFormatException";
// Dll load gives meaningful error message
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookInvalidAssemblyDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(expectedError);
// Dll load error happens after previous hooks run
var startupHookVar = startupHookDll + Path.PathSeparator + startupHookInvalidAssemblyDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(expectedError);
}
// Run the app with the startup hook type missing
[Fact]
public void Muxer_activation_of_Missing_StartupHook_Type_Fails()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var startupHookMissingTypeFixture = sharedTestState.StartupHookWithoutStartupHookTypeFixture.Copy();
var startupHookMissingTypeDll = startupHookMissingTypeFixture.TestProject.AppDll;
// Missing type is detected
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookMissingTypeDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining("System.TypeLoadException: Could not load type 'StartupHook' from assembly 'StartupHook");
// Missing type is detected after previous hooks have run
var startupHookVar = startupHookDll + Path.PathSeparator + startupHookMissingTypeDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdErrContaining("System.TypeLoadException: Could not load type 'StartupHook' from assembly 'StartupHookWithoutStartupHookType");
}
// Run the app with a startup hook that doesn't have any Initialize method
[Fact]
public void Muxer_activation_of_StartupHook_With_Missing_Method_Fails()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var startupHookMissingMethodFixture = sharedTestState.StartupHookWithoutInitializeMethodFixture.Copy();
var startupHookMissingMethodDll = startupHookMissingMethodFixture.TestProject.AppDll;
var expectedError = "System.MissingMethodException: Method 'StartupHook.Initialize' not found.";
// No Initialize method
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookMissingMethodDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(expectedError);
// Missing Initialize method is caught after previous hooks have run
var startupHookVar = startupHookDll + Path.PathSeparator + startupHookMissingMethodDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdErrContaining(expectedError);
}
// Run the app with startup hook that has no static void Initialize() method
[Fact]
public void Muxer_activation_of_StartupHook_With_Incorrect_Method_Signature_Fails()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
var expectedError = "System.ArgumentException: The signature of the startup hook 'StartupHook.Initialize' in assembly '{0}' was invalid. It must be 'public static void Initialize()'.";
// Initialize is an instance method
var startupHookWithInstanceMethodFixture = sharedTestState.StartupHookWithInstanceMethodFixture.Copy();
var startupHookWithInstanceMethodDll = startupHookWithInstanceMethodFixture.TestProject.AppDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookWithInstanceMethodDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookWithInstanceMethodDll));
// Initialize method takes parameters
var startupHookWithParameterFixture = sharedTestState.StartupHookWithParameterFixture.Copy();
var startupHookWithParameterDll = startupHookWithParameterFixture.TestProject.AppDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookWithParameterDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookWithParameterDll));
// Initialize method has non-void return type
var startupHookWithReturnTypeFixture = sharedTestState.StartupHookWithReturnTypeFixture.Copy();
var startupHookWithReturnTypeDll = startupHookWithReturnTypeFixture.TestProject.AppDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookWithReturnTypeDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookWithReturnTypeDll));
// Initialize method that has multiple methods with an incorrect signature
var startupHookWithMultipleIncorrectSignaturesFixture = sharedTestState.StartupHookWithMultipleIncorrectSignaturesFixture.Copy();
var startupHookWithMultipleIncorrectSignaturesDll = startupHookWithMultipleIncorrectSignaturesFixture.TestProject.AppDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookWithMultipleIncorrectSignaturesDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining(string.Format(expectedError, startupHookWithMultipleIncorrectSignaturesDll));
// Signature problem is caught after previous hooks have run
var startupHookVar = startupHookDll + Path.PathSeparator + startupHookWithMultipleIncorrectSignaturesDll;
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookVar)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdOutContaining("Hello from startup hook!")
.And.HaveStdErrContaining(string.Format(expectedError, startupHookWithMultipleIncorrectSignaturesDll));
}
private static void RemoveLibraryFromDepsJson(string depsJsonPath, string libraryName)
{
DependencyContext context;
using (FileStream fileStream = File.Open(depsJsonPath, FileMode.Open))
{
using (DependencyContextJsonReader reader = new DependencyContextJsonReader())
{
context = reader.Read(fileStream);
}
}
context = new DependencyContext(context.Target,
context.CompilationOptions,
context.CompileLibraries,
context.RuntimeLibraries.Select(lib => new RuntimeLibrary(
lib.Type,
lib.Name,
lib.Version,
lib.Hash,
lib.RuntimeAssemblyGroups.Select(assemblyGroup => new RuntimeAssetGroup(
assemblyGroup.Runtime,
assemblyGroup.RuntimeFiles.Where(f => !f.Path.EndsWith("SharedLibrary.dll")))).ToList().AsReadOnly(),
lib.NativeLibraryGroups,
lib.ResourceAssemblies,
lib.Dependencies,
lib.Serviceable,
lib.Path,
lib.HashPath,
lib.RuntimeStoreManifestName)),
context.RuntimeGraph);
using (FileStream fileStream = File.Open(depsJsonPath, FileMode.Truncate, FileAccess.Write))
{
DependencyContextWriter writer = new DependencyContextWriter();
writer.Write(context, fileStream);
}
}
// Run startup hook that adds an assembly resolver
[Fact]
public void Muxer_activation_of_StartupHook_With_Assembly_Resolver()
{
var fixture = sharedTestState.PortableAppWithMissingRefFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var appDepsJson = Path.Combine(Path.GetDirectoryName(appDll), Path.GetFileNameWithoutExtension(appDll) + ".deps.json");
RemoveLibraryFromDepsJson(appDepsJson, "SharedLibrary.dll");
var startupHookFixture = sharedTestState.StartupHookWithAssemblyResolver.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
// No startup hook results in failure due to missing app dependency
dotnet.Exec(appDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.HaveStdErrContaining("FileNotFoundException: Could not load file or assembly 'SharedLibrary");
// Startup hook with assembly resolver results in use of injected dependency (which has value 2)
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute(fExpectedToFail: true)
.Should().Fail()
.And.ExitWith(2);
}
[Fact]
public void Muxer_activation_of_StartupHook_With_IsSupported_False()
{
var fixture = sharedTestState.PortableAppFixture.Copy();
var dotnet = fixture.BuiltDotnet;
var appDll = fixture.TestProject.AppDll;
var startupHookFixture = sharedTestState.StartupHookFixture.Copy();
var startupHookDll = startupHookFixture.TestProject.AppDll;
RuntimeConfig.FromFile(fixture.TestProject.RuntimeConfigJson)
.WithProperty(startupHookSupport, "false")
.Save();
// Startup hooks are not executed when the StartupHookSupport
// feature switch is set to false.
dotnet.Exec(appDll)
.EnvironmentVariable(startupHookVarName, startupHookDll)
.CaptureStdOut()
.CaptureStdErr()
.Execute()
.Should().Pass()
.And.NotHaveStdOutContaining("Hello from startup hook!")
.And.HaveStdOutContaining("Hello World");
}
public class SharedTestState : IDisposable
{
// Entry point projects
public TestProjectFixture PortableAppFixture { get; }
public TestProjectFixture PortableAppWithExceptionFixture { get; }
// Entry point with missing reference assembly
public TestProjectFixture PortableAppWithMissingRefFixture { get; }
// Correct startup hooks
public TestProjectFixture StartupHookFixture { get; }
public TestProjectFixture StartupHookWithOverloadFixture { get; }
// Missing startup hook type (no StartupHook type defined)
public TestProjectFixture StartupHookWithoutStartupHookTypeFixture { get; }
// Missing startup hook method (no Initialize method defined)
public TestProjectFixture StartupHookWithoutInitializeMethodFixture { get; }
// Invalid startup hook assembly
public TestProjectFixture StartupHookStartupHookInvalidAssemblyFixture { get; }
// Invalid startup hooks (incorrect signatures)
public TestProjectFixture StartupHookWithNonPublicMethodFixture { get; }
public TestProjectFixture StartupHookWithInstanceMethodFixture { get; }
public TestProjectFixture StartupHookWithParameterFixture { get; }
public TestProjectFixture StartupHookWithReturnTypeFixture { get; }
public TestProjectFixture StartupHookWithMultipleIncorrectSignaturesFixture { get; }
// Valid startup hooks with incorrect behavior
public TestProjectFixture StartupHookWithDependencyFixture { get; }
// Startup hook with an assembly resolver
public TestProjectFixture StartupHookWithAssemblyResolver { get; }
public RepoDirectoriesProvider RepoDirectories { get; }
public SharedTestState()
{
RepoDirectories = new RepoDirectoriesProvider();
// Entry point projects
PortableAppFixture = new TestProjectFixture("PortableApp", RepoDirectories)
.EnsureRestored()
.PublishProject();
PortableAppWithExceptionFixture = new TestProjectFixture("PortableAppWithException", RepoDirectories)
.EnsureRestored()
.PublishProject();
// Entry point with missing reference assembly
PortableAppWithMissingRefFixture = new TestProjectFixture("PortableAppWithMissingRef", RepoDirectories)
.EnsureRestored()
.PublishProject();
// Correct startup hooks
StartupHookFixture = new TestProjectFixture("StartupHook", RepoDirectories)
.EnsureRestored()
.PublishProject();
StartupHookWithOverloadFixture = new TestProjectFixture("StartupHookWithOverload", RepoDirectories)
.EnsureRestored()
.PublishProject();
// Missing startup hook type (no StartupHook type defined)
StartupHookWithoutStartupHookTypeFixture = new TestProjectFixture("StartupHookWithoutStartupHookType", RepoDirectories)
.EnsureRestored()
.PublishProject();
// Missing startup hook method (no Initialize method defined)
StartupHookWithoutInitializeMethodFixture = new TestProjectFixture("StartupHookWithoutInitializeMethod", RepoDirectories)
.EnsureRestored()
.PublishProject();
// Invalid startup hook assembly
StartupHookStartupHookInvalidAssemblyFixture = new TestProjectFixture("StartupHookFake", RepoDirectories)
.EnsureRestored()
.PublishProject();
// Invalid startup hooks (incorrect signatures)
StartupHookWithNonPublicMethodFixture = new TestProjectFixture("StartupHookWithNonPublicMethod", RepoDirectories)
.EnsureRestored()
.PublishProject();
StartupHookWithInstanceMethodFixture = new TestProjectFixture("StartupHookWithInstanceMethod", RepoDirectories)
.EnsureRestored()
.PublishProject();
StartupHookWithParameterFixture = new TestProjectFixture("StartupHookWithParameter", RepoDirectories)
.EnsureRestored()
.PublishProject();
StartupHookWithReturnTypeFixture = new TestProjectFixture("StartupHookWithReturnType", RepoDirectories)
.EnsureRestored()
.PublishProject();
StartupHookWithMultipleIncorrectSignaturesFixture = new TestProjectFixture("StartupHookWithMultipleIncorrectSignatures", RepoDirectories)
.EnsureRestored()
.PublishProject();
// Valid startup hooks with incorrect behavior
StartupHookWithDependencyFixture = new TestProjectFixture("StartupHookWithDependency", RepoDirectories)
.EnsureRestored()
.PublishProject();
// Startup hook with an assembly resolver
StartupHookWithAssemblyResolver = new TestProjectFixture("StartupHookWithAssemblyResolver", RepoDirectories)
.EnsureRestored()
.PublishProject();
}
public void Dispose()
{
// Entry point projects
PortableAppFixture.Dispose();
PortableAppWithExceptionFixture.Dispose();
// Entry point with missing reference assembly
PortableAppWithMissingRefFixture.Dispose();
// Correct startup hooks
StartupHookFixture.Dispose();
StartupHookWithOverloadFixture.Dispose();
// Missing startup hook type (no StartupHook type defined)
StartupHookWithoutStartupHookTypeFixture.Dispose();
// Missing startup hook method (no Initialize method defined)
StartupHookWithoutInitializeMethodFixture.Dispose();
// Invalid startup hook assembly
StartupHookStartupHookInvalidAssemblyFixture.Dispose();
// Invalid startup hooks (incorrect signatures)
StartupHookWithNonPublicMethodFixture.Dispose();
StartupHookWithInstanceMethodFixture.Dispose();
StartupHookWithParameterFixture.Dispose();
StartupHookWithReturnTypeFixture.Dispose();
StartupHookWithMultipleIncorrectSignaturesFixture.Dispose();
// Valid startup hooks with incorrect behavior
StartupHookWithDependencyFixture.Dispose();
// Startup hook with an assembly resolver
StartupHookWithAssemblyResolver.Dispose();
}
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Memory/tests/Span/SequenceCompareTo.char.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Xunit;
namespace System.SpanTests
{
public static partial class SpanTests
{
[Fact]
public static void ZeroLengthSequenceCompareTo_Char()
{
var a = new char[3];
var first = new Span<char>(a, 1, 0);
var second = new ReadOnlySpan<char>(a, 2, 0);
int result = first.SequenceCompareTo<char>(second);
Assert.Equal(0, result);
}
[Fact]
public static void SameSpanSequenceCompareTo_Char()
{
char[] a = { '4', '5', '6' };
var span = new Span<char>(a);
int result = span.SequenceCompareTo<char>(span);
Assert.Equal(0, result);
}
[Fact]
public static void SequenceCompareToArrayImplicit_Char()
{
char[] a = { '4', '5', '6' };
var first = new Span<char>(a, 0, 3);
int result = first.SequenceCompareTo<char>(a);
Assert.Equal(0, result);
}
[Fact]
public static void SequenceCompareToArraySegmentImplicit_Char()
{
char[] src = { '1', '2', '3' };
char[] dst = { '5', '1', '2', '3', '9' };
var segment = new ArraySegment<char>(dst, 1, 3);
var first = new Span<char>(src, 0, 3);
int result = first.SequenceCompareTo<char>(segment);
Assert.Equal(0, result);
}
[Fact]
public static void LengthMismatchSequenceCompareTo_Char()
{
char[] a = { '4', '5', '6' };
var first = new Span<char>(a, 0, 2);
var second = new Span<char>(a, 0, 3);
int result = first.SequenceCompareTo<char>(second);
Assert.True(result < 0);
result = second.SequenceCompareTo<char>(first);
Assert.True(result > 0);
// one sequence is empty
first = new Span<char>(a, 1, 0);
result = first.SequenceCompareTo<char>(second);
Assert.True(result < 0);
result = second.SequenceCompareTo<char>(first);
Assert.True(result > 0);
}
[Fact]
public static void SequenceCompareToWithSingleMismatch_Char()
{
for (int length = 1; length < 32; length++)
{
for (int mismatchIndex = 0; mismatchIndex < length; mismatchIndex++)
{
var first = new char[length];
var second = new char[length];
for (int i = 0; i < length; i++)
{
first[i] = second[i] = (char)(i + 1);
}
second[mismatchIndex] = (char)(second[mismatchIndex] + 1);
var firstSpan = new Span<char>(first);
var secondSpan = new ReadOnlySpan<char>(second);
int result = firstSpan.SequenceCompareTo<char>(secondSpan);
Assert.True(result < 0);
result = secondSpan.SequenceCompareTo<char>(firstSpan);
Assert.True(result > 0);
}
}
}
[Fact]
public static void SequenceCompareToNoMatch_Char()
{
for (int length = 1; length < 32; length++)
{
var first = new char[length];
var second = new char[length];
for (int i = 0; i < length; i++)
{
first[i] = (char)(i + 1);
second[i] = (char)(char.MaxValue - i);
}
var firstSpan = new Span<char>(first);
var secondSpan = new ReadOnlySpan<char>(second);
int result = firstSpan.SequenceCompareTo<char>(secondSpan);
Assert.True(result < 0);
result = secondSpan.SequenceCompareTo<char>(firstSpan);
Assert.True(result > 0);
}
}
[Fact]
public static void MakeSureNoSequenceCompareToChecksGoOutOfRange_Char()
{
for (int length = 0; length < 100; length++)
{
var first = new char[length + 2];
first[0] = '8';
first[length + 1] = '8';
var second = new char[length + 2];
second[0] = '9';
second[length + 1] = '9';
var span1 = new Span<char>(first, 1, length);
var span2 = new ReadOnlySpan<char>(second, 1, length);
int result = span1.SequenceCompareTo<char>(span2);
Assert.Equal(0, result);
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Xunit;
namespace System.SpanTests
{
public static partial class SpanTests
{
[Fact]
public static void ZeroLengthSequenceCompareTo_Char()
{
var a = new char[3];
var first = new Span<char>(a, 1, 0);
var second = new ReadOnlySpan<char>(a, 2, 0);
int result = first.SequenceCompareTo<char>(second);
Assert.Equal(0, result);
}
[Fact]
public static void SameSpanSequenceCompareTo_Char()
{
char[] a = { '4', '5', '6' };
var span = new Span<char>(a);
int result = span.SequenceCompareTo<char>(span);
Assert.Equal(0, result);
}
[Fact]
public static void SequenceCompareToArrayImplicit_Char()
{
char[] a = { '4', '5', '6' };
var first = new Span<char>(a, 0, 3);
int result = first.SequenceCompareTo<char>(a);
Assert.Equal(0, result);
}
[Fact]
public static void SequenceCompareToArraySegmentImplicit_Char()
{
char[] src = { '1', '2', '3' };
char[] dst = { '5', '1', '2', '3', '9' };
var segment = new ArraySegment<char>(dst, 1, 3);
var first = new Span<char>(src, 0, 3);
int result = first.SequenceCompareTo<char>(segment);
Assert.Equal(0, result);
}
[Fact]
public static void LengthMismatchSequenceCompareTo_Char()
{
char[] a = { '4', '5', '6' };
var first = new Span<char>(a, 0, 2);
var second = new Span<char>(a, 0, 3);
int result = first.SequenceCompareTo<char>(second);
Assert.True(result < 0);
result = second.SequenceCompareTo<char>(first);
Assert.True(result > 0);
// one sequence is empty
first = new Span<char>(a, 1, 0);
result = first.SequenceCompareTo<char>(second);
Assert.True(result < 0);
result = second.SequenceCompareTo<char>(first);
Assert.True(result > 0);
}
[Fact]
public static void SequenceCompareToWithSingleMismatch_Char()
{
for (int length = 1; length < 32; length++)
{
for (int mismatchIndex = 0; mismatchIndex < length; mismatchIndex++)
{
var first = new char[length];
var second = new char[length];
for (int i = 0; i < length; i++)
{
first[i] = second[i] = (char)(i + 1);
}
second[mismatchIndex] = (char)(second[mismatchIndex] + 1);
var firstSpan = new Span<char>(first);
var secondSpan = new ReadOnlySpan<char>(second);
int result = firstSpan.SequenceCompareTo<char>(secondSpan);
Assert.True(result < 0);
result = secondSpan.SequenceCompareTo<char>(firstSpan);
Assert.True(result > 0);
}
}
}
[Fact]
public static void SequenceCompareToNoMatch_Char()
{
for (int length = 1; length < 32; length++)
{
var first = new char[length];
var second = new char[length];
for (int i = 0; i < length; i++)
{
first[i] = (char)(i + 1);
second[i] = (char)(char.MaxValue - i);
}
var firstSpan = new Span<char>(first);
var secondSpan = new ReadOnlySpan<char>(second);
int result = firstSpan.SequenceCompareTo<char>(secondSpan);
Assert.True(result < 0);
result = secondSpan.SequenceCompareTo<char>(firstSpan);
Assert.True(result > 0);
}
}
[Fact]
public static void MakeSureNoSequenceCompareToChecksGoOutOfRange_Char()
{
for (int length = 0; length < 100; length++)
{
var first = new char[length + 2];
first[0] = '8';
first[length + 1] = '8';
var second = new char[length + 2];
second[0] = '9';
second[length + 1] = '9';
var span1 = new Span<char>(first, 1, length);
var span2 = new ReadOnlySpan<char>(second, 1, length);
int result = span1.SequenceCompareTo<char>(span2);
Assert.Equal(0, result);
}
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.Private.CoreLib/src/System/Text/Latin1Encoding.Sealed.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Text
{
internal partial class Latin1Encoding : Encoding
{
/// <summary>
/// A special instance of <see cref="Latin1Encoding"/> that is initialized with "don't throw on invalid sequences;
/// use best-fit substitution instead" semantics. This type allows for devirtualization of calls made directly
/// off of <see cref="Encoding.Latin1"/>.
/// </summary>
internal sealed class Latin1EncodingSealed : Latin1Encoding
{
public override object Clone()
{
// The base implementation of Encoding.Clone calls object.MemberwiseClone and marks the new object mutable.
// We don't want to do this because it violates the invariants we have set for the sealed type.
// Instead, we'll create a new instance of the base Latin1Encoding type and mark it mutable.
return new Latin1Encoding()
{
IsReadOnly = false
};
}
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Text
{
internal partial class Latin1Encoding : Encoding
{
/// <summary>
/// A special instance of <see cref="Latin1Encoding"/> that is initialized with "don't throw on invalid sequences;
/// use best-fit substitution instead" semantics. This type allows for devirtualization of calls made directly
/// off of <see cref="Encoding.Latin1"/>.
/// </summary>
internal sealed class Latin1EncodingSealed : Latin1Encoding
{
public override object Clone()
{
// The base implementation of Encoding.Clone calls object.MemberwiseClone and marks the new object mutable.
// We don't want to do this because it violates the invariants we have set for the sealed type.
// Instead, we'll create a new instance of the base Latin1Encoding type and mark it mutable.
return new Latin1Encoding()
{
IsReadOnly = false
};
}
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/tests/CoreMangLib/system/threading/interlocked/interlockeddecrement1.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Threading;
public class InterlockedDecrement1
{
private const int c_NUM_LOOPS = 100;
public static int Main()
{
InterlockedDecrement1 test = new InterlockedDecrement1();
TestLibrary.TestFramework.BeginTestCase("InterlockedDecrement1");
if (test.RunTests())
{
TestLibrary.TestFramework.EndTestCase();
TestLibrary.TestFramework.LogInformation("PASS");
return 100;
}
else
{
TestLibrary.TestFramework.EndTestCase();
TestLibrary.TestFramework.LogInformation("FAIL");
return 0;
}
}
public bool RunTests()
{
bool retVal = true;
TestLibrary.TestFramework.LogInformation("[Positive]");
retVal = PosTest1() && retVal;
retVal = PosTest2() && retVal;
return retVal;
}
public bool PosTest1()
{
bool retVal = true;
Int32 value;
Int32 nwValue;
Int32 exValue;
TestLibrary.TestFramework.BeginScenario("PosTest1: Int32 Interlocked.Decrement(Int32&)");
try
{
for (int i=0; i<c_NUM_LOOPS; i++)
{
value = TestLibrary.Generator.GetInt32(-55);
exValue = value-1;
nwValue = Interlocked.Decrement(ref value);
retVal = CheckValues(value, exValue, nwValue) && retVal;
}
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("001", "Unexpected exception: " + e);
retVal = false;
}
return retVal;
}
public bool PosTest2()
{
bool retVal = true;
Int32 value;
Int32 nwValue;
Int32 exValue;
TestLibrary.TestFramework.BeginScenario("PosTest2: Cause a negative Int32 overflow");
try
{
value = Int32.MinValue;
exValue = value-1;
nwValue = Interlocked.Decrement(ref value);
retVal = CheckValues(value, exValue, nwValue) && retVal;
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
retVal = false;
}
return retVal;
}
public bool CheckValues(Int32 value, Int32 exValue, Int32 nwValue)
{
if (exValue != nwValue)
{
TestLibrary.TestFramework.LogError("003", "Interlocked.Decrement() returned wrong value. Expected(" + exValue + ") Got(" + nwValue + ")");
return false;
}
if (exValue != value)
{
TestLibrary.TestFramework.LogError("003", "Interlocked.Decrement() did not update value. Expected(" + exValue + ") Got(" + value + ")");
return false;
}
return true;
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Threading;
public class InterlockedDecrement1
{
private const int c_NUM_LOOPS = 100;
public static int Main()
{
InterlockedDecrement1 test = new InterlockedDecrement1();
TestLibrary.TestFramework.BeginTestCase("InterlockedDecrement1");
if (test.RunTests())
{
TestLibrary.TestFramework.EndTestCase();
TestLibrary.TestFramework.LogInformation("PASS");
return 100;
}
else
{
TestLibrary.TestFramework.EndTestCase();
TestLibrary.TestFramework.LogInformation("FAIL");
return 0;
}
}
public bool RunTests()
{
bool retVal = true;
TestLibrary.TestFramework.LogInformation("[Positive]");
retVal = PosTest1() && retVal;
retVal = PosTest2() && retVal;
return retVal;
}
public bool PosTest1()
{
bool retVal = true;
Int32 value;
Int32 nwValue;
Int32 exValue;
TestLibrary.TestFramework.BeginScenario("PosTest1: Int32 Interlocked.Decrement(Int32&)");
try
{
for (int i=0; i<c_NUM_LOOPS; i++)
{
value = TestLibrary.Generator.GetInt32(-55);
exValue = value-1;
nwValue = Interlocked.Decrement(ref value);
retVal = CheckValues(value, exValue, nwValue) && retVal;
}
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("001", "Unexpected exception: " + e);
retVal = false;
}
return retVal;
}
public bool PosTest2()
{
bool retVal = true;
Int32 value;
Int32 nwValue;
Int32 exValue;
TestLibrary.TestFramework.BeginScenario("PosTest2: Cause a negative Int32 overflow");
try
{
value = Int32.MinValue;
exValue = value-1;
nwValue = Interlocked.Decrement(ref value);
retVal = CheckValues(value, exValue, nwValue) && retVal;
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
retVal = false;
}
return retVal;
}
public bool CheckValues(Int32 value, Int32 exValue, Int32 nwValue)
{
if (exValue != nwValue)
{
TestLibrary.TestFramework.LogError("003", "Interlocked.Decrement() returned wrong value. Expected(" + exValue + ") Got(" + nwValue + ")");
return false;
}
if (exValue != value)
{
TestLibrary.TestFramework.LogError("003", "Interlocked.Decrement() did not update value. Expected(" + exValue + ") Got(" + value + ")");
return false;
}
return true;
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/Microsoft.Extensions.DependencyModel/src/FileSystemWrapper.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Microsoft.Extensions.DependencyModel
{
internal sealed class FileSystemWrapper : IFileSystem
{
public static IFileSystem Default { get; } = new FileSystemWrapper();
public IFile File { get; } = new FileWrapper();
public IDirectory Directory { get; } = new DirectoryWrapper();
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace Microsoft.Extensions.DependencyModel
{
internal sealed class FileSystemWrapper : IFileSystem
{
public static IFileSystem Default { get; } = new FileSystemWrapper();
public IFile File { get; } = new FileWrapper();
public IDirectory Directory { get; } = new DirectoryWrapper();
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/tests/JIT/Directed/nullabletypes/hasvalue.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//<Title>Nullable types have the HasValue property</Title>
//<Description>
// If the nullable type has a null value, HasValue is false
//</Description>
using System;
interface BaseInter { }
interface GenInter<T> { }
struct Struct { }
struct ImplStruct : BaseInter { }
struct OpenGenImplStruct<T> : GenInter<T> { }
struct CloseGenImplStruct : GenInter<int> { }
class Foo { }
class NullableTest1
{
static int? i;
static Struct? s;
static ImplStruct? imps;
static OpenGenImplStruct<Foo>? genfoo;
static CloseGenImplStruct? genint;
public static void Run()
{
Test_nullabletypes.IsFalse(i.HasValue);
i = null;
Test_nullabletypes.IsFalse(i.HasValue);
Test_nullabletypes.IsFalse(s.HasValue);
s = null;
Test_nullabletypes.IsFalse(s.HasValue);
Test_nullabletypes.IsFalse(imps.HasValue);
imps = null;
Test_nullabletypes.IsFalse(imps.HasValue);
Test_nullabletypes.IsFalse(genfoo.HasValue);
genfoo = null;
Test_nullabletypes.IsFalse(genfoo.HasValue);
Test_nullabletypes.IsFalse(genint.HasValue);
genint = null;
Test_nullabletypes.IsFalse(genint.HasValue);
}
}
class NullableTest2
{
static int? i = 1;
static Struct? s = new Struct();
static ImplStruct? imps = new ImplStruct();
static OpenGenImplStruct<Foo>? genfoo = new OpenGenImplStruct<Foo>();
static CloseGenImplStruct? genint = new CloseGenImplStruct();
public static void Run()
{
Test_nullabletypes.Eval(i.HasValue);
Test_nullabletypes.Eval(s.HasValue);
Test_nullabletypes.Eval(imps.HasValue);
Test_nullabletypes.Eval(genfoo.HasValue);
Test_nullabletypes.Eval(genint.HasValue);
}
}
class NullableTests
{
public static void Run()
{
NullableTest1.Run();
NullableTest2.Run();
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
//<Title>Nullable types have the HasValue property</Title>
//<Description>
// If the nullable type has a null value, HasValue is false
//</Description>
using System;
interface BaseInter { }
interface GenInter<T> { }
struct Struct { }
struct ImplStruct : BaseInter { }
struct OpenGenImplStruct<T> : GenInter<T> { }
struct CloseGenImplStruct : GenInter<int> { }
class Foo { }
class NullableTest1
{
static int? i;
static Struct? s;
static ImplStruct? imps;
static OpenGenImplStruct<Foo>? genfoo;
static CloseGenImplStruct? genint;
public static void Run()
{
Test_nullabletypes.IsFalse(i.HasValue);
i = null;
Test_nullabletypes.IsFalse(i.HasValue);
Test_nullabletypes.IsFalse(s.HasValue);
s = null;
Test_nullabletypes.IsFalse(s.HasValue);
Test_nullabletypes.IsFalse(imps.HasValue);
imps = null;
Test_nullabletypes.IsFalse(imps.HasValue);
Test_nullabletypes.IsFalse(genfoo.HasValue);
genfoo = null;
Test_nullabletypes.IsFalse(genfoo.HasValue);
Test_nullabletypes.IsFalse(genint.HasValue);
genint = null;
Test_nullabletypes.IsFalse(genint.HasValue);
}
}
class NullableTest2
{
static int? i = 1;
static Struct? s = new Struct();
static ImplStruct? imps = new ImplStruct();
static OpenGenImplStruct<Foo>? genfoo = new OpenGenImplStruct<Foo>();
static CloseGenImplStruct? genint = new CloseGenImplStruct();
public static void Run()
{
Test_nullabletypes.Eval(i.HasValue);
Test_nullabletypes.Eval(s.HasValue);
Test_nullabletypes.Eval(imps.HasValue);
Test_nullabletypes.Eval(genfoo.HasValue);
Test_nullabletypes.Eval(genint.HasValue);
}
}
class NullableTests
{
public static void Run()
{
NullableTest1.Run();
NullableTest2.Run();
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/tests/baseservices/threading/generics/TimerCallback/thread15.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Threading;
interface IGen<T>
{
void Target(object p);
T Dummy(T t);
}
class GenInt : IGen<int>
{
public int Dummy(int t) { return t; }
public virtual void Target(object p)
{
if (Test_thread15.Xcounter>=Test_thread15.nThreads)
{
ManualResetEvent evt = (ManualResetEvent) p;
evt.Set();
}
else
{
Interlocked.Increment(ref Test_thread15.Xcounter);
}
}
public static void ThreadPoolTest()
{
ManualResetEvent evt = new ManualResetEvent(false);
IGen<int> obj = new GenInt();
TimerCallback tcb = new TimerCallback(obj.Target);
Timer timer = new Timer(tcb,evt,Test_thread15.delay,Test_thread15.period);
evt.WaitOne();
timer.Dispose();
Test_thread15.Eval(Test_thread15.Xcounter>=Test_thread15.nThreads);
Test_thread15.Xcounter = 0;
}
}
class GenDouble : IGen<double>
{
public double Dummy(double t) { return t; }
public virtual void Target(object p)
{
if (Test_thread15.Xcounter>=Test_thread15.nThreads)
{
ManualResetEvent evt = (ManualResetEvent) p;
evt.Set();
}
else
{
Interlocked.Increment(ref Test_thread15.Xcounter);
}
}
public static void ThreadPoolTest()
{
ManualResetEvent evt = new ManualResetEvent(false);
IGen<double> obj = new GenDouble();
TimerCallback tcb = new TimerCallback(obj.Target);
Timer timer = new Timer(tcb,evt,Test_thread15.delay,Test_thread15.period);
evt.WaitOne();
timer.Dispose();
Test_thread15.Eval(Test_thread15.Xcounter>=Test_thread15.nThreads);
Test_thread15.Xcounter = 0;
}
}
class GenString : IGen<string>
{
public string Dummy(string t) { return t; }
public virtual void Target(object p)
{
if (Test_thread15.Xcounter>=Test_thread15.nThreads)
{
ManualResetEvent evt = (ManualResetEvent) p;
evt.Set();
}
else
{
Interlocked.Increment(ref Test_thread15.Xcounter);
}
}
public static void ThreadPoolTest()
{
ManualResetEvent evt = new ManualResetEvent(false);
IGen<string> obj = new GenString();
TimerCallback tcb = new TimerCallback(obj.Target);
Timer timer = new Timer(tcb,evt,Test_thread15.delay,Test_thread15.period);
evt.WaitOne();
timer.Dispose();
Test_thread15.Eval(Test_thread15.Xcounter>=Test_thread15.nThreads);
Test_thread15.Xcounter = 0;
}
}
class GenObject : IGen<object>
{
public object Dummy(object t) { return t; }
public virtual void Target(object p)
{
if (Test_thread15.Xcounter>=Test_thread15.nThreads)
{
ManualResetEvent evt = (ManualResetEvent) p;
evt.Set();
}
else
{
Interlocked.Increment(ref Test_thread15.Xcounter);
}
}
public static void ThreadPoolTest()
{
ManualResetEvent evt = new ManualResetEvent(false);
IGen<object> obj = new GenObject();
TimerCallback tcb = new TimerCallback(obj.Target);
Timer timer = new Timer(tcb,evt,Test_thread15.delay,Test_thread15.period);
evt.WaitOne();
timer.Dispose();
Test_thread15.Eval(Test_thread15.Xcounter>=Test_thread15.nThreads);
Test_thread15.Xcounter = 0;
}
}
class GenGuid : IGen<Guid>
{
public Guid Dummy(Guid t) { return t; }
public virtual void Target(object p)
{
if (Test_thread15.Xcounter>=Test_thread15.nThreads)
{
ManualResetEvent evt = (ManualResetEvent) p;
evt.Set();
}
else
{
Interlocked.Increment(ref Test_thread15.Xcounter);
}
}
public static void ThreadPoolTest()
{
ManualResetEvent evt = new ManualResetEvent(false);
IGen<Guid> obj = new GenGuid();
TimerCallback tcb = new TimerCallback(obj.Target);
Timer timer = new Timer(tcb,evt,Test_thread15.delay,Test_thread15.period);
evt.WaitOne();
timer.Dispose();
Test_thread15.Eval(Test_thread15.Xcounter>=Test_thread15.nThreads);
Test_thread15.Xcounter = 0;
}
}
public class Test_thread15
{
public static int delay = 0;
public static int period = 2;
public static int nThreads = 5;
public static int counter = 0;
public static int Xcounter = 0;
public static bool result = true;
public static void Eval(bool exp)
{
counter++;
if (!exp)
{
result = exp;
Console.WriteLine("Test Failed at location: " + counter);
}
}
public static int Main()
{
GenInt.ThreadPoolTest();
GenDouble.ThreadPoolTest();
GenString.ThreadPoolTest();
GenObject.ThreadPoolTest();
GenGuid.ThreadPoolTest();
if (result)
{
Console.WriteLine("Test Passed");
return 100;
}
else
{
Console.WriteLine("Test Failed");
return 1;
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Threading;
interface IGen<T>
{
void Target(object p);
T Dummy(T t);
}
class GenInt : IGen<int>
{
public int Dummy(int t) { return t; }
public virtual void Target(object p)
{
if (Test_thread15.Xcounter>=Test_thread15.nThreads)
{
ManualResetEvent evt = (ManualResetEvent) p;
evt.Set();
}
else
{
Interlocked.Increment(ref Test_thread15.Xcounter);
}
}
public static void ThreadPoolTest()
{
ManualResetEvent evt = new ManualResetEvent(false);
IGen<int> obj = new GenInt();
TimerCallback tcb = new TimerCallback(obj.Target);
Timer timer = new Timer(tcb,evt,Test_thread15.delay,Test_thread15.period);
evt.WaitOne();
timer.Dispose();
Test_thread15.Eval(Test_thread15.Xcounter>=Test_thread15.nThreads);
Test_thread15.Xcounter = 0;
}
}
class GenDouble : IGen<double>
{
public double Dummy(double t) { return t; }
public virtual void Target(object p)
{
if (Test_thread15.Xcounter>=Test_thread15.nThreads)
{
ManualResetEvent evt = (ManualResetEvent) p;
evt.Set();
}
else
{
Interlocked.Increment(ref Test_thread15.Xcounter);
}
}
public static void ThreadPoolTest()
{
ManualResetEvent evt = new ManualResetEvent(false);
IGen<double> obj = new GenDouble();
TimerCallback tcb = new TimerCallback(obj.Target);
Timer timer = new Timer(tcb,evt,Test_thread15.delay,Test_thread15.period);
evt.WaitOne();
timer.Dispose();
Test_thread15.Eval(Test_thread15.Xcounter>=Test_thread15.nThreads);
Test_thread15.Xcounter = 0;
}
}
class GenString : IGen<string>
{
public string Dummy(string t) { return t; }
public virtual void Target(object p)
{
if (Test_thread15.Xcounter>=Test_thread15.nThreads)
{
ManualResetEvent evt = (ManualResetEvent) p;
evt.Set();
}
else
{
Interlocked.Increment(ref Test_thread15.Xcounter);
}
}
public static void ThreadPoolTest()
{
ManualResetEvent evt = new ManualResetEvent(false);
IGen<string> obj = new GenString();
TimerCallback tcb = new TimerCallback(obj.Target);
Timer timer = new Timer(tcb,evt,Test_thread15.delay,Test_thread15.period);
evt.WaitOne();
timer.Dispose();
Test_thread15.Eval(Test_thread15.Xcounter>=Test_thread15.nThreads);
Test_thread15.Xcounter = 0;
}
}
class GenObject : IGen<object>
{
public object Dummy(object t) { return t; }
public virtual void Target(object p)
{
if (Test_thread15.Xcounter>=Test_thread15.nThreads)
{
ManualResetEvent evt = (ManualResetEvent) p;
evt.Set();
}
else
{
Interlocked.Increment(ref Test_thread15.Xcounter);
}
}
public static void ThreadPoolTest()
{
ManualResetEvent evt = new ManualResetEvent(false);
IGen<object> obj = new GenObject();
TimerCallback tcb = new TimerCallback(obj.Target);
Timer timer = new Timer(tcb,evt,Test_thread15.delay,Test_thread15.period);
evt.WaitOne();
timer.Dispose();
Test_thread15.Eval(Test_thread15.Xcounter>=Test_thread15.nThreads);
Test_thread15.Xcounter = 0;
}
}
class GenGuid : IGen<Guid>
{
public Guid Dummy(Guid t) { return t; }
public virtual void Target(object p)
{
if (Test_thread15.Xcounter>=Test_thread15.nThreads)
{
ManualResetEvent evt = (ManualResetEvent) p;
evt.Set();
}
else
{
Interlocked.Increment(ref Test_thread15.Xcounter);
}
}
public static void ThreadPoolTest()
{
ManualResetEvent evt = new ManualResetEvent(false);
IGen<Guid> obj = new GenGuid();
TimerCallback tcb = new TimerCallback(obj.Target);
Timer timer = new Timer(tcb,evt,Test_thread15.delay,Test_thread15.period);
evt.WaitOne();
timer.Dispose();
Test_thread15.Eval(Test_thread15.Xcounter>=Test_thread15.nThreads);
Test_thread15.Xcounter = 0;
}
}
public class Test_thread15
{
public static int delay = 0;
public static int period = 2;
public static int nThreads = 5;
public static int counter = 0;
public static int Xcounter = 0;
public static bool result = true;
public static void Eval(bool exp)
{
counter++;
if (!exp)
{
result = exp;
Console.WriteLine("Test Failed at location: " + counter);
}
}
public static int Main()
{
GenInt.ThreadPoolTest();
GenDouble.ThreadPoolTest();
GenString.ThreadPoolTest();
GenObject.ThreadPoolTest();
GenGuid.ThreadPoolTest();
if (result)
{
Console.WriteLine("Test Passed");
return 100;
}
else
{
Console.WriteLine("Test Failed");
return 1;
}
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/libraries/System.ComponentModel.Primitives/src/System/ComponentModel/ComponentCollection.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections;
namespace System.ComponentModel
{
public class ComponentCollection : ReadOnlyCollectionBase
{
public ComponentCollection(IComponent[] components) => InnerList.AddRange(components);
/// <summary>
/// Gets a specific <see cref='System.ComponentModel.Component'/> in the
/// <see cref='System.ComponentModel.IContainer'/>.
/// </summary>
public virtual IComponent? this[string? name]
{
get
{
if (name != null)
{
IList list = InnerList;
foreach (IComponent? comp in list)
{
if (comp != null && comp.Site != null && comp.Site.Name != null && string.Equals(comp.Site.Name, name, StringComparison.OrdinalIgnoreCase))
{
return comp;
}
}
}
return null;
}
}
/// <summary>
/// Gets a specific <see cref='System.ComponentModel.Component'/> in the
/// <see cref='System.ComponentModel.IContainer'/>.
/// </summary>
public virtual IComponent? this[int index] => (IComponent?)InnerList[index];
public void CopyTo(IComponent[] array, int index) => InnerList.CopyTo(array, index);
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections;
namespace System.ComponentModel
{
public class ComponentCollection : ReadOnlyCollectionBase
{
public ComponentCollection(IComponent[] components) => InnerList.AddRange(components);
/// <summary>
/// Gets a specific <see cref='System.ComponentModel.Component'/> in the
/// <see cref='System.ComponentModel.IContainer'/>.
/// </summary>
public virtual IComponent? this[string? name]
{
get
{
if (name != null)
{
IList list = InnerList;
foreach (IComponent? comp in list)
{
if (comp != null && comp.Site != null && comp.Site.Name != null && string.Equals(comp.Site.Name, name, StringComparison.OrdinalIgnoreCase))
{
return comp;
}
}
}
return null;
}
}
/// <summary>
/// Gets a specific <see cref='System.ComponentModel.Component'/> in the
/// <see cref='System.ComponentModel.IContainer'/>.
/// </summary>
public virtual IComponent? this[int index] => (IComponent?)InnerList[index];
public void CopyTo(IComponent[] array, int index) => InnerList.CopyTo(array, index);
}
}
| -1 |
dotnet/runtime
| 66,422 |
Fix JsonSerializer src-gen issues with reference handler feature
|
Fixes https://github.com/dotnet/runtime/issues/64813.
|
layomia
| 2022-03-09T23:28:28Z | 2022-03-14T17:40:01Z |
9bc400f576a004b6af1c6b31d15e6bb356212dad
|
c2fa3ec056464f9f7081af56c252e481a355ec62
|
Fix JsonSerializer src-gen issues with reference handler feature. Fixes https://github.com/dotnet/runtime/issues/64813.
|
./src/tests/JIT/Performance/CodeQuality/Benchstones/BenchF/MatInv4/MatInv4.cs
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Runtime.CompilerServices;
namespace Benchstone.BenchF
{
public static class MatInv4
{
#if DEBUG
public const int Iterations = 1;
#else
public const int Iterations = 60;
#endif
private static float s_det;
private struct X
{
public float[] A;
public X(int size)
{
A = new float[size];
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static bool Bench()
{
X a = new X(Iterations * Iterations);
float[] b = new float[Iterations * Iterations];
float[] c = new float[Iterations * Iterations];
float[] d = new float[Iterations * Iterations];
float[] l1 = new float[Iterations];
float[] l2 = new float[Iterations];
int i, k, n, nsq;
n = Iterations;
nsq = n * n;
for (i = 0; i < n; ++i)
{
for (k = 0; k < n; ++k)
{
if (i == k)
{
a.A[i * n + k] = 40.0F;
}
else
{
a.A[i * n + k] = 0.0F;
}
}
}
for (i = 0; i < n; ++i)
{
for (k = i; k < nsq; k += n)
{
b[k] = a.A[k];
}
}
/*** second(&t1); ***/
MinV1(b, ref n, out s_det, l1, l2);
if (s_det == 0.0F)
{
goto L990;
}
/*** second(&tx); ***/
MProd(b, a.A, c, ref n);
for (k = 1; k <= nsq; ++k)
{
b[k - 1] = a.A[k - 1];
}
/*** second(&tx); ***/
MinV2(b, ref n, out s_det, l1, l2);
if (s_det == 0.0F)
{
goto L990;
}
/*** second(&ty); ***/
MProd(b, a.A, d, ref n);
CompM(c, d, ref n);
/*** second(&t2); ***/
return true;
L990:
{
}
return true;
}
private static void MinV1(float[] a, ref int n, out float d, float[] l, float[] m)
{
float biga, hold;
int i, j, k, ij, ik, ji, jk, nk, ki, kj, kk, iz, jp, jq, jr;
d = 1.0F;
ji = 0;
hold = 0.0F;
nk = -n;
for (k = 1; k <= n; ++k)
{
nk = nk + n;
l[k - 1] = k;
m[k - 1] = k;
kk = nk + k;
biga = a[kk - 1];
for (j = k; j <= n; ++j)
{
// j <= n, so iz <= n^2 - n
iz = n * (j - 1);
for (i = k; i <= n; ++i)
{
// iz <= n^2 - n and i <= n, so ij <= n^2
ij = iz + i;
if (System.Math.Abs(biga) >= System.Math.Abs(a[ij - 1]))
{
continue;
}
// accessing up to n^2 - 1
biga = a[ij - 1];
l[k - 1] = i;
m[k - 1] = j;
}
}
j = (int)l[k - 1];
if (j <= k)
{
goto L35;
}
// -n < ki <= 0
ki = k - n;
for (i = 1; i <= n; ++i)
{
// i <= n, ki <= n + n + ... + n (n times) i.e. k <= n * n (when ki = 0 initially)
ki = ki + n;
// Accessing upto n^2 -1
hold = -a[ki - 1];
// ji <= n^2 - n + n (for ki = 0 initially when k = n and 0 < j <= n)
// Therefore ji <= n^2
ji = ki - k + j;
a[ki - 1] = a[ji - 1];
a[ji - 1] = hold;
}
L35:
i = (int)m[k - 1];
if (i <= k)
{
goto L45;
}
// 0 <= jp <= n^2 - n
jp = n * (i - 1);
for (j = 1; j <= n; ++j)
{
// 0 < nk <= n * (n-1)
// jk <= n^2 - n + n
// jk <= n^2
jk = nk + j;
// jp <= n^2 - n
// ji <= n^2 - n + n or ji <= n^2 (since 0 < j <= n)
ji = jp + j;
hold = -a[jk - 1];
a[jk - 1] = a[ji - 1];
a[ji - 1] = hold;
}
L45:
if (biga != 0.0F)
{
goto L48;
}
d = 0.0F;
return;
L48:
for (i = 1; i <= n; ++i)
{
if (i == k)
{
break;
}
// 0 < nk <= n * (n-1)
// 0 < ik <= n^2
ik = nk + i;
a[ik - 1] = a[ik - 1] / (-biga);
}
for (i = 1; i <= n; ++i)
{
if (i == k)
{
continue;
}
// 0 < nk <= n * (n-1)
// 0 < ik <= n^2
ik = nk + i;
hold = a[ik - 1];
// -n < ij <= 0
ij = i - n;
for (j = 1; j <= n; ++j)
{
// i <= n, ij <= n + n + ... + n (n times) or ij <= n * n
ij = ij + n;
if (j == k)
{
continue;
}
// if i=1, kj = (1 + (n-1) * n) - 1 + n ==> ij = n^2
// if i=n, kj = (n * n) - n + n ==> ij = n ^2
// So j <= n^2
kj = ij - i + k;
a[ij - 1] = hold * a[kj - 1] + a[ij - 1];
}
}
kj = k - n;
for (j = 1; j <= n; ++j)
{
// k <= n, kj <= n + n + ... + n (n times) or kj <= n * n
kj = kj + n;
if (j == k)
{
continue;
}
// Accessing upto n^2 - 1
a[kj - 1] = a[kj - 1] / biga;
}
d = d * biga;
a[kk - 1] = 1.0F / biga;
}
k = n;
L100:
k = k - 1;
if (k < 1)
{
return;
}
i = (int)l[k - 1];
if (i <= k)
{
goto L120;
}
// 0 <= jq <= n^2 - n
// 0 <= jr <= n^2 - n
jq = n * (k - 1);
jr = n * (i - 1);
for (j = 1; j <= n; ++j)
{
// jk <= n^2 - n + n
// jk <= n^2
jk = jq + j;
hold = a[jk - 1];
// ji <= n^2 - n + n
// ji <= n^2
ji = jr + j;
a[jk - 1] = -a[ji - 1];
a[ji - 1] = hold;
}
L120:
j = (int)m[k - 1];
if (j <= k)
{
goto L100;
}
// 0 <= jr <= n^2 - n
ki = k - n;
for (i = 1; i <= n; ++i)
{
// ki <= n + n + ... + n (n times) or ki <= n * n
ki = ki + n;
hold = a[ki - 1];
// if i=1, ji = (1 + (n-1) * n) - 1 + n ==> ij = n^2
// if i=n, ji = (n * n) - n + n ==> ij = n ^2
// Therefore ji <= n^2
ji = ki - k + j;
a[ki - 1] = -a[ji - 1];
}
a[ji - 1] = hold;
goto L100;
}
private static void MinV2(float[] a, ref int n, out float d, float[] l, float[] m)
{
float biga, hold;
int i, j, k;
d = 1.0F;
for (k = 1; k <= n; ++k)
{
l[k - 1] = k;
m[k - 1] = k;
biga = a[(k - 1) * n + (k - 1)];
for (j = k; j <= n; ++j)
{
for (i = k; i <= n; ++i)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
if (System.Math.Abs(biga) >= System.Math.Abs(a[(i - 1) * n + (j - 1)]))
{
continue;
}
biga = a[(i - 1) * n + (j - 1)];
l[k - 1] = i;
m[k - 1] = j;
}
}
j = (int)l[k - 1];
if (l[k - 1] <= k)
{
goto L200;
}
for (i = 1; i <= n; ++i)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
hold = -a[(k - 1) * n + (i - 1)];
a[(k - 1) * n + (i - 1)] = a[(j - 1) * n + (i - 1)];
a[(j - 1) * n + (i - 1)] = hold;
}
L200:
i = (int)m[k - 1];
if (m[k - 1] <= k)
{
goto L250;
}
for (j = 1; j <= n; ++j)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
hold = -a[(j - 1) * n + (k - 1)];
a[(j - 1) * n + (k - 1)] = a[(j - 1) * n + (i - 1)];
a[(j - 1) * n + (i - 1)] = hold;
}
L250:
if (biga != 0.0F)
{
goto L300;
}
d = 0.0F;
return;
L300:
for (i = 1; i <= n; ++i)
{
if (i != k)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
a[(i - 1) * n + (k - 1)] = a[(i - 1) * n + (k - 1)] / (-biga);
}
}
for (i = 1; i <= n; ++i)
{
if (i == k)
{
continue;
}
for (j = 1; j <= n; ++j)
{
if (j != k)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
a[(i - 1) * n + (j - 1)] = a[(i - 1) * n + (k - 1)] * a[(k - 1) * n + (j - 1)] + a[(i - 1) * n + (j - 1)];
}
}
}
for (j = 1; j < n; ++j)
{
if (j != k)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
a[(k - 1) * n + (j - 1)] = a[(k - 1) * n + (j - 1)] / biga;
}
}
d = d * biga;
a[(k - 1) * n + (k - 1)] = 1.0F / biga;
}
k = n;
L400:
k = k - 1;
if (k < 1)
{
return;
}
i = (int)l[k - 1];
if (i <= k)
{
goto L450;
}
for (j = 1; j <= n; ++j)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
hold = a[(j - 1) * n + (k - 1)];
a[(j - 1) * n + (k - 1)] = -a[(j - 1) * n + (i - 1)];
a[(j - 1) * n + (i - 1)] = hold;
}
L450:
j = (int)m[k - 1];
if (j <= k)
{
goto L400;
}
for (i = 1; i <= n; ++i)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
hold = a[(k - 1) * n + (i - 1)];
a[(k - 1) * n + (i - 1)] = -a[(j - 1) * n + (i - 1)];
a[(j - 1) * n + (i - 1)] = hold;
}
goto L400;
}
private static void MProd(float[] a, float[] b, float[] c, ref int n)
{
int i, j, k;
for (i = 1; i <= n; ++i)
{
for (j = 1; j <= n; ++j)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
c[(i - 1) * n + (j - 1)] = 0.0F;
for (k = 1; k <= n; ++k)
{
c[(i - 1) * n + (j - 1)] = c[(i - 1) * n + (j - 1)] + a[(i - 1) * n + (k - 1)] * b[(k - 1) * n + (j - 1)];
}
}
}
return;
}
private static void CompM(float[] a, float[] b, ref int n)
{
int i, j;
float x, sum = 0.0F;
//(starting compare.)
for (i = 1; i <= n; ++i)
{
for (j = 1; j <= n; ++j)
{
x = 0.0F;
if (i == j)
{
x = 1.0F;
}
sum = sum + System.Math.Abs(System.Math.Abs(a[(i - 1) * n + (j - 1)]) - x);
}
}
return;
}
public static int Main()
{
bool result = Bench();
return (result ? 100 : -1);
}
}
}
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Runtime.CompilerServices;
namespace Benchstone.BenchF
{
public static class MatInv4
{
#if DEBUG
public const int Iterations = 1;
#else
public const int Iterations = 60;
#endif
private static float s_det;
private struct X
{
public float[] A;
public X(int size)
{
A = new float[size];
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static bool Bench()
{
X a = new X(Iterations * Iterations);
float[] b = new float[Iterations * Iterations];
float[] c = new float[Iterations * Iterations];
float[] d = new float[Iterations * Iterations];
float[] l1 = new float[Iterations];
float[] l2 = new float[Iterations];
int i, k, n, nsq;
n = Iterations;
nsq = n * n;
for (i = 0; i < n; ++i)
{
for (k = 0; k < n; ++k)
{
if (i == k)
{
a.A[i * n + k] = 40.0F;
}
else
{
a.A[i * n + k] = 0.0F;
}
}
}
for (i = 0; i < n; ++i)
{
for (k = i; k < nsq; k += n)
{
b[k] = a.A[k];
}
}
/*** second(&t1); ***/
MinV1(b, ref n, out s_det, l1, l2);
if (s_det == 0.0F)
{
goto L990;
}
/*** second(&tx); ***/
MProd(b, a.A, c, ref n);
for (k = 1; k <= nsq; ++k)
{
b[k - 1] = a.A[k - 1];
}
/*** second(&tx); ***/
MinV2(b, ref n, out s_det, l1, l2);
if (s_det == 0.0F)
{
goto L990;
}
/*** second(&ty); ***/
MProd(b, a.A, d, ref n);
CompM(c, d, ref n);
/*** second(&t2); ***/
return true;
L990:
{
}
return true;
}
private static void MinV1(float[] a, ref int n, out float d, float[] l, float[] m)
{
float biga, hold;
int i, j, k, ij, ik, ji, jk, nk, ki, kj, kk, iz, jp, jq, jr;
d = 1.0F;
ji = 0;
hold = 0.0F;
nk = -n;
for (k = 1; k <= n; ++k)
{
nk = nk + n;
l[k - 1] = k;
m[k - 1] = k;
kk = nk + k;
biga = a[kk - 1];
for (j = k; j <= n; ++j)
{
// j <= n, so iz <= n^2 - n
iz = n * (j - 1);
for (i = k; i <= n; ++i)
{
// iz <= n^2 - n and i <= n, so ij <= n^2
ij = iz + i;
if (System.Math.Abs(biga) >= System.Math.Abs(a[ij - 1]))
{
continue;
}
// accessing up to n^2 - 1
biga = a[ij - 1];
l[k - 1] = i;
m[k - 1] = j;
}
}
j = (int)l[k - 1];
if (j <= k)
{
goto L35;
}
// -n < ki <= 0
ki = k - n;
for (i = 1; i <= n; ++i)
{
// i <= n, ki <= n + n + ... + n (n times) i.e. k <= n * n (when ki = 0 initially)
ki = ki + n;
// Accessing upto n^2 -1
hold = -a[ki - 1];
// ji <= n^2 - n + n (for ki = 0 initially when k = n and 0 < j <= n)
// Therefore ji <= n^2
ji = ki - k + j;
a[ki - 1] = a[ji - 1];
a[ji - 1] = hold;
}
L35:
i = (int)m[k - 1];
if (i <= k)
{
goto L45;
}
// 0 <= jp <= n^2 - n
jp = n * (i - 1);
for (j = 1; j <= n; ++j)
{
// 0 < nk <= n * (n-1)
// jk <= n^2 - n + n
// jk <= n^2
jk = nk + j;
// jp <= n^2 - n
// ji <= n^2 - n + n or ji <= n^2 (since 0 < j <= n)
ji = jp + j;
hold = -a[jk - 1];
a[jk - 1] = a[ji - 1];
a[ji - 1] = hold;
}
L45:
if (biga != 0.0F)
{
goto L48;
}
d = 0.0F;
return;
L48:
for (i = 1; i <= n; ++i)
{
if (i == k)
{
break;
}
// 0 < nk <= n * (n-1)
// 0 < ik <= n^2
ik = nk + i;
a[ik - 1] = a[ik - 1] / (-biga);
}
for (i = 1; i <= n; ++i)
{
if (i == k)
{
continue;
}
// 0 < nk <= n * (n-1)
// 0 < ik <= n^2
ik = nk + i;
hold = a[ik - 1];
// -n < ij <= 0
ij = i - n;
for (j = 1; j <= n; ++j)
{
// i <= n, ij <= n + n + ... + n (n times) or ij <= n * n
ij = ij + n;
if (j == k)
{
continue;
}
// if i=1, kj = (1 + (n-1) * n) - 1 + n ==> ij = n^2
// if i=n, kj = (n * n) - n + n ==> ij = n ^2
// So j <= n^2
kj = ij - i + k;
a[ij - 1] = hold * a[kj - 1] + a[ij - 1];
}
}
kj = k - n;
for (j = 1; j <= n; ++j)
{
// k <= n, kj <= n + n + ... + n (n times) or kj <= n * n
kj = kj + n;
if (j == k)
{
continue;
}
// Accessing upto n^2 - 1
a[kj - 1] = a[kj - 1] / biga;
}
d = d * biga;
a[kk - 1] = 1.0F / biga;
}
k = n;
L100:
k = k - 1;
if (k < 1)
{
return;
}
i = (int)l[k - 1];
if (i <= k)
{
goto L120;
}
// 0 <= jq <= n^2 - n
// 0 <= jr <= n^2 - n
jq = n * (k - 1);
jr = n * (i - 1);
for (j = 1; j <= n; ++j)
{
// jk <= n^2 - n + n
// jk <= n^2
jk = jq + j;
hold = a[jk - 1];
// ji <= n^2 - n + n
// ji <= n^2
ji = jr + j;
a[jk - 1] = -a[ji - 1];
a[ji - 1] = hold;
}
L120:
j = (int)m[k - 1];
if (j <= k)
{
goto L100;
}
// 0 <= jr <= n^2 - n
ki = k - n;
for (i = 1; i <= n; ++i)
{
// ki <= n + n + ... + n (n times) or ki <= n * n
ki = ki + n;
hold = a[ki - 1];
// if i=1, ji = (1 + (n-1) * n) - 1 + n ==> ij = n^2
// if i=n, ji = (n * n) - n + n ==> ij = n ^2
// Therefore ji <= n^2
ji = ki - k + j;
a[ki - 1] = -a[ji - 1];
}
a[ji - 1] = hold;
goto L100;
}
private static void MinV2(float[] a, ref int n, out float d, float[] l, float[] m)
{
float biga, hold;
int i, j, k;
d = 1.0F;
for (k = 1; k <= n; ++k)
{
l[k - 1] = k;
m[k - 1] = k;
biga = a[(k - 1) * n + (k - 1)];
for (j = k; j <= n; ++j)
{
for (i = k; i <= n; ++i)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
if (System.Math.Abs(biga) >= System.Math.Abs(a[(i - 1) * n + (j - 1)]))
{
continue;
}
biga = a[(i - 1) * n + (j - 1)];
l[k - 1] = i;
m[k - 1] = j;
}
}
j = (int)l[k - 1];
if (l[k - 1] <= k)
{
goto L200;
}
for (i = 1; i <= n; ++i)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
hold = -a[(k - 1) * n + (i - 1)];
a[(k - 1) * n + (i - 1)] = a[(j - 1) * n + (i - 1)];
a[(j - 1) * n + (i - 1)] = hold;
}
L200:
i = (int)m[k - 1];
if (m[k - 1] <= k)
{
goto L250;
}
for (j = 1; j <= n; ++j)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
hold = -a[(j - 1) * n + (k - 1)];
a[(j - 1) * n + (k - 1)] = a[(j - 1) * n + (i - 1)];
a[(j - 1) * n + (i - 1)] = hold;
}
L250:
if (biga != 0.0F)
{
goto L300;
}
d = 0.0F;
return;
L300:
for (i = 1; i <= n; ++i)
{
if (i != k)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
a[(i - 1) * n + (k - 1)] = a[(i - 1) * n + (k - 1)] / (-biga);
}
}
for (i = 1; i <= n; ++i)
{
if (i == k)
{
continue;
}
for (j = 1; j <= n; ++j)
{
if (j != k)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
a[(i - 1) * n + (j - 1)] = a[(i - 1) * n + (k - 1)] * a[(k - 1) * n + (j - 1)] + a[(i - 1) * n + (j - 1)];
}
}
}
for (j = 1; j < n; ++j)
{
if (j != k)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
a[(k - 1) * n + (j - 1)] = a[(k - 1) * n + (j - 1)] / biga;
}
}
d = d * biga;
a[(k - 1) * n + (k - 1)] = 1.0F / biga;
}
k = n;
L400:
k = k - 1;
if (k < 1)
{
return;
}
i = (int)l[k - 1];
if (i <= k)
{
goto L450;
}
for (j = 1; j <= n; ++j)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
hold = a[(j - 1) * n + (k - 1)];
a[(j - 1) * n + (k - 1)] = -a[(j - 1) * n + (i - 1)];
a[(j - 1) * n + (i - 1)] = hold;
}
L450:
j = (int)m[k - 1];
if (j <= k)
{
goto L400;
}
for (i = 1; i <= n; ++i)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
hold = a[(k - 1) * n + (i - 1)];
a[(k - 1) * n + (i - 1)] = -a[(j - 1) * n + (i - 1)];
a[(j - 1) * n + (i - 1)] = hold;
}
goto L400;
}
private static void MProd(float[] a, float[] b, float[] c, ref int n)
{
int i, j, k;
for (i = 1; i <= n; ++i)
{
for (j = 1; j <= n; ++j)
{
// Accessing upto n^2 - n + n - 1 ==> n^2 - 1
c[(i - 1) * n + (j - 1)] = 0.0F;
for (k = 1; k <= n; ++k)
{
c[(i - 1) * n + (j - 1)] = c[(i - 1) * n + (j - 1)] + a[(i - 1) * n + (k - 1)] * b[(k - 1) * n + (j - 1)];
}
}
}
return;
}
private static void CompM(float[] a, float[] b, ref int n)
{
int i, j;
float x, sum = 0.0F;
//(starting compare.)
for (i = 1; i <= n; ++i)
{
for (j = 1; j <= n; ++j)
{
x = 0.0F;
if (i == j)
{
x = 1.0F;
}
sum = sum + System.Math.Abs(System.Math.Abs(a[(i - 1) * n + (j - 1)]) - x);
}
}
return;
}
public static int Main()
{
bool result = Bench();
return (result ? 100 : -1);
}
}
}
| -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.