<commit_before>/* Copyright (c) 2008-2010, Avian Contributors

   Permission to use, copy, modify, and/or distribute this software
   for any purpose with or without fee is hereby granted, provided
   that the above copyright notice and this permission notice appear
   in all copies.

   There is NO WARRANTY for this software.  See license.txt for
   details. */

#ifndef MACHINE_H
#define MACHINE_H

#include "common.h"
#include "system.h"
#include "heap.h"
#include "finder.h"
#include "processor.h"
#include "constants.h"
#include "arch.h"

#ifdef PLATFORM_WINDOWS
#  define JNICALL __stdcall
#else
#  define JNICALL
#endif

#define PROTECT(thread, name)                                   \
  Thread::SingleProtector MAKE_NAME(protector_) (thread, &name);

#define ACQUIRE(t, x) MonitorResource MAKE_NAME(monitorResource_) (t, x)

#define ACQUIRE_OBJECT(t, x) \
  ObjectMonitorResource MAKE_NAME(monitorResource_) (t, x)

#define ACQUIRE_RAW(t, x) RawMonitorResource MAKE_NAME(monitorResource_) (t, x)

#define ENTER(t, state) StateResource MAKE_NAME(stateResource_) (t, state)

#define THREAD_RESOURCE0(t, releaseBody)                                \
  class MAKE_NAME(Resource_): public Thread::Resource {                 \
  public:                                                               \
    MAKE_NAME(Resource_)(Thread* t): Resource(t) { }                    \
    ~MAKE_NAME(Resource_)() { releaseBody; }                            \
    virtual void release()                                              \
    { this->MAKE_NAME(Resource_)::~MAKE_NAME(Resource_)(); }            \
  } MAKE_NAME(resource_)(t);

#define OBJECT_RESOURCE(t, name, releaseBody)                           \
  class MAKE_NAME(Resource_): public Thread::Resource {                 \
  public:                                                               \
    MAKE_NAME(Resource_)(Thread* t, object name):                       \
      Resource(t), name(name), protector(t, &(this->name)) { }          \
    ~MAKE_NAME(Resource_)() { releaseBody; }                            \
    virtual void release()                                              \
    { this->MAKE_NAME(Resource_)::~MAKE_NAME(Resource_)(); }            \
                                                                        \
  private:                                                              \
    object name;                                                        \
    Thread::SingleProtector protector;                                  \
  } MAKE_NAME(resource_)(t, name);

#define THREAD_RESOURCE(t, type, name, releaseBody)                     \
  class MAKE_NAME(Resource_): public Thread::Resource {                 \
  public:                                                               \
    MAKE_NAME(Resource_)(Thread* t, type name):                         \
      Resource(t), name(name) { }                                       \
    ~MAKE_NAME(Resource_)() { releaseBody; }                            \
    virtual void release()                                              \
    { this->MAKE_NAME(Resource_)::~MAKE_NAME(Resource_)(); }            \
                                                                        \
  private:                                                              \
    type name;                                                          \
  } MAKE_NAME(resource_)(t, name);

#define THREAD_RESOURCE2(t, type1, name1, type2, name2, releaseBody)    \
  class MAKE_NAME(Resource_): public Thread::Resource {                 \
  public:                                                               \
    MAKE_NAME(Resource_)(Thread* t, type1 name1, type2 name2):          \
      Resource(t), name1(name1), name2(name2) { }                       \
    ~MAKE_NAME(Resource_)() { releaseBody; }                            \
    virtual void release()                                              \
    { this->MAKE_NAME(Resource_)::~MAKE_NAME(Resource_)(); }            \
                                                                        \
  private:                                                              \
    type1 name1;                                                        \
    type2 name2;                                                        \
  } MAKE_NAME(resource_)(t, name1, name2);

namespace vm {

const bool Verbose = false;
const bool DebugRun = false;
const bool DebugStack = false;
const bool DebugMonitors = false;
const bool DebugReferences = false;

const uintptr_t HashTakenMark = 1;
const uintptr_t ExtendedMark = 2;
const uintptr_t FixedMark = 3;

const unsigned ThreadHeapSizeInBytes = 64 * 1024;
const unsigned ThreadHeapSizeInWords = ThreadHeapSizeInBytes / BytesPerWord;

const unsigned ThreadBackupHeapSizeInBytes = 2 * 1024;
const unsigned ThreadBackupHeapSizeInWords
= ThreadBackupHeapSizeInBytes / BytesPerWord;

const unsigned StackSizeInBytes = 64 * 1024;
const unsigned StackSizeInWords = StackSizeInBytes / BytesPerWord;

const unsigned ThreadHeapPoolSize = 64;<commit_msg>increase default stack size to 128KB<commit_after>/* Copyright (c) 2008-2010, Avian Contributors

   Permission to use, copy, modify, and/or distribute this software
   for any purpose with or without fee is hereby granted, provided
   that the above copyright notice and this permission notice appear
   in all copies.

   There is NO WARRANTY for this software.  See license.txt for
   details. */

#ifndef MACHINE_H
#define MACHINE_H

#include "common.h"
#include "system.h"
#include "heap.h"
#include "finder.h"
#include "processor.h"
#include "constants.h"
#include "arch.h"

#ifdef PLATFORM_WINDOWS
#  define JNICALL __stdcall
#else
#  define JNICALL
#endif

#define PROTECT(thread, name)                                   \
  Thread::SingleProtector MAKE_NAME(protector_) (thread, &name);

#define ACQUIRE(t, x) MonitorResource MAKE_NAME(monitorResource_) (t, x)

#define ACQUIRE_OBJECT(t, x) \
  ObjectMonitorResource MAKE_NAME(monitorResource_) (t, x)

#define ACQUIRE_RAW(t, x) RawMonitorResource MAKE_NAME(monitorResource_) (t, x)

#define ENTER(t, state) StateResource MAKE_NAME(stateResource_) (t, state)

#define THREAD_RESOURCE0(t, releaseBody)                                \
  class MAKE_NAME(Resource_): public Thread::Resource {                 \
  public:                                                               \
    MAKE_NAME(Resource_)(Thread* t): Resource(t) { }                    \
    ~MAKE_NAME(Resource_)() { releaseBody; }                            \
    virtual void release()                                              \
    { this->MAKE_NAME(Resource_)::~MAKE_NAME(Resource_)(); }            \
  } MAKE_NAME(resource_)(t);

#define OBJECT_RESOURCE(t, name, releaseBody)                           \
  class MAKE_NAME(Resource_): public Thread::Resource {                 \
  public:                                                               \
    MAKE_NAME(Resource_)(Thread* t, object name):                       \
      Resource(t), name(name), protector(t, &(this->name)) { }          \
    ~MAKE_NAME(Resource_)() { releaseBody; }                            \
    virtual void release()                                              \
    { this->MAKE_NAME(Resource_)::~MAKE_NAME(Resource_)(); }            \
                                                                        \
  private:                                                              \
    object name;                                                        \
    Thread::SingleProtector protector;                                  \
  } MAKE_NAME(resource_)(t, name);

#define THREAD_RESOURCE(t, type, name, releaseBody)                     \
  class MAKE_NAME(Resource_): public Thread::Resource {                 \
  public:                                                               \
    MAKE_NAME(Resource_)(Thread* t, type name):                         \
      Resource(t), name(name) { }                                       \
    ~MAKE_NAME(Resource_)() { releaseBody; }                            \
    virtual void release()                                              \
    { this->MAKE_NAME(Resource_)::~MAKE_NAME(Resource_)(); }            \
                                                                        \
  private:                                                              \
    type name;                                                          \
  } MAKE_NAME(resource_)(t, name);

#define THREAD_RESOURCE2(t, type1, name1, type2, name2, releaseBody)    \
  class MAKE_NAME(Resource_): public Thread::Resource {                 \
  public:                                                               \
    MAKE_NAME(Resource_)(Thread* t, type1 name1, type2 name2):          \
      Resource(t), name1(name1), name2(name2) { }                       \
    ~MAKE_NAME(Resource_)() { releaseBody; }                            \
    virtual void release()                                              \
    { this->MAKE_NAME(Resource_)::~MAKE_NAME(Resource_)(); }            \
                                                                        \
  private:                                                              \
    type1 name1;                                                        \
    type2 name2;                                                        \
  } MAKE_NAME(resource_)(t, name1, name2);

namespace vm {

const bool Verbose = false;
const bool DebugRun = false;
const bool DebugStack = false;
const bool DebugMonitors = false;
const bool DebugReferences = false;

const uintptr_t HashTakenMark = 1;
const uintptr_t ExtendedMark = 2;
const uintptr_t FixedMark = 3;

const unsigned ThreadHeapSizeInBytes = 64 * 1024;
const unsigned ThreadHeapSizeInWords = ThreadHeapSizeInBytes / BytesPerWord;

const unsigned ThreadBackupHeapSizeInBytes = 2 * 1024;
const unsigned ThreadBackupHeapSizeInWords
= ThreadBackupHeapSizeInBytes / BytesPerWord;

const unsigned StackSizeInBytes = 128 * 1024;
const unsigned StackSizeInWords = StackSizeInBytes / BytesPerWord;

const unsigned ThreadHeapPoolSize = 64;
{'fraction_non_alphanumeric': 0.08591744025281453, 'fraction_numerical': 0.01027059055895714, 'mean_word_length': 1.308937528499772, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 82, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6385157', 'n_tokens_mistral': 2522, 'n_tokens_neox': 2374, 'n_words': 584}