<commit_before>/* libunwind - a platform-independent unwind library
   Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P.
        Contributed by <NAME> <<EMAIL>>

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_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),<commit_msg>dwarf: Add missing opcodes to the operands table in Gexpr.c<commit_after>/* libunwind - a platform-independent unwind library
   Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P.
        Contributed by <NAME> <<EMAIL>>

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),
{'fraction_non_alphanumeric': 0.09205298013245033, 'fraction_numerical': 0.048344370860927154, 'mean_word_length': 3.0408026755852844, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7012418', 'n_tokens_mistral': 2198, 'n_tokens_neox': 2012, 'n_words': 726}