<commit_before>/*
 * @(#)$Id$
 *
 * Copyright (c) 2005 Intel Corporation. All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE file.
 * If you do not find these files, copies can be found by writing to:
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300,
 * Berkeley, CA, 94704.  Attention:  Intel License Inquiry.
 * 
 * DESCRIPTION: PEL (P2 Expression Language) virtual machine
 *
 */

#ifndef __PEL_VM_H__
#define __PEL_VM_H__

#include <stack>
#include <vector>
#include <async.h>

#include "tuple.h"
#include "pel_program.h"

class Pel_VM {

public: 
  enum Error {
    PE_SUCCESS=0,
    PE_BAD_CONSTANT,
    PE_BAD_FIELD,
    PE_STACK_UNDERFLOW,
    PE_TYPE_CONVERSION,
    PE_BAD_OPCODE,
    PE_DIVIDE_BY_ZERO,
    PE_INVALID_ERRNO,
    PE_UNKNOWN // Must be the last error
  };

private:
  // Execution state
  std::stack<TupleFieldRef> st;
  const Pel_Program	*prg;
  Error		 error;
  int		 pc;
  TuplePtr	 result;
  TuplePtr	 operand;

  static const char* err_msgs[];

#include "pel_opcode_decls.gen.h"

  uint64_t pop_unsigned();
  int64_t pop_signed();
  str pop_string();
  double pop_double();

public:
  Pel_VM();<commit_msg>ints to uints to fix warnings<commit_after>/*
 * @(#)$Id$
 *
 * Copyright (c) 2005 Intel Corporation. All rights reserved.
 *
 * This file is distributed under the terms in the attached INTEL-LICENSE file.
 * If you do not find these files, copies can be found by writing to:
 * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300,
 * Berkeley, CA, 94704.  Attention:  Intel License Inquiry.
 * 
 * DESCRIPTION: PEL (P2 Expression Language) virtual machine
 *
 */

#ifndef __PEL_VM_H__
#define __PEL_VM_H__

#include <stack>
#include <vector>
#include <async.h>

#include "tuple.h"
#include "pel_program.h"

class Pel_VM {

public: 
  enum Error {
    PE_SUCCESS=0,
    PE_BAD_CONSTANT,
    PE_BAD_FIELD,
    PE_STACK_UNDERFLOW,
    PE_TYPE_CONVERSION,
    PE_BAD_OPCODE,
    PE_DIVIDE_BY_ZERO,
    PE_INVALID_ERRNO,
    PE_UNKNOWN // Must be the last error
  };

private:
  // Execution state
  std::stack<TupleFieldRef> st;
  const Pel_Program	*prg;
  Error		 error;
  uint		 pc;
  TuplePtr	 result;
  TuplePtr	 operand;

  static const char* err_msgs[];

#include "pel_opcode_decls.gen.h"

  uint64_t pop_unsigned();
  int64_t pop_signed();
  str pop_string();
  double pop_double();

public:
  Pel_VM();
{'fraction_non_alphanumeric': 0.09796596097965961, 'fraction_numerical': 0.019095060190950603, 'mean_word_length': 3.688715953307393, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1251865', 'n_tokens_mistral': 914, 'n_tokens_neox': 870, 'n_words': 250}