<commit_before>#include "builtin/block_environment.hpp"
#include "builtin/class.hpp"
#include "builtin/compiledmethod.hpp"
#include "builtin/fixnum.hpp"
#include "builtin/lookuptable.hpp"
#include "builtin/tuple.hpp"

#include "gc_object_mark.hpp"
#include "objectmemory.hpp"

#include "vm/object_utils.hpp"

#include "builtin/contexts.hpp"
#include "builtin/nativemethodcontext.hpp"

#include <iostream>

#define SmallContextSize   16
#define LargeContextSize   56

namespace rubinius {

  void MethodContext::init(STATE) {
    GO(methctx).set(state->new_class("MethodContext", G(object)));
    G(methctx)->set_object_type(state, MethodContextType);

    GO(blokctx).set(state->new_class("BlockContext", G(methctx)));
    G(blokctx)->set_object_type(state, BlockContextType);
  }

  /* Calculate how much big of an object (in bytes) to allocate
   * for one with a body of +original+ and a stack of +stack+ */
  static inline size_t add_stack(size_t original, size_t stack) {
    return original + (sizeof(Object*) * stack);
  }

  static inline size_t round_stack(size_t original) {
    if(original <= SmallContextSize) {
      return SmallContextSize;
    } else if(original <= LargeContextSize) {
      return LargeContextSize;
    }

    return original;
  }

  /* Initialize +ctx+'s fields */
  static inline void init_context(STATE, MethodContext* ctx, size_t stack) {
    ctx->StoresBytes = 1;
    ctx->ip = 0;
    ctx->native_ip = 0;
    ctx->current_unwind = 0;
    ctx->ivars(state, Qnil);

    // Do this here because it's possible for us to pass a context
    // around and it could leak out before the real sender is set.
    ctx->sender(state, (MethodContext*)Qnil);

    // Don't initialize any fields you KNOW are always set later
    // on before the ctx is used. We just waste precious time if we do.

    ctx->stack_size = stack;
    for(size_t i = 0; i < stack; i++) {
      ctx->stk[i] = Qnil;
    }

    ctx->js.stack = ctx->stk - 1;
    ctx->js.stack_top = (ctx->stk + stack - 1);
  }

  /* Find a context to use. Either use a cache or create one in the heap. */
  template <class T>
    static inline T* allocate(STATE, Class* cls, size_t stack_size) {
      T* ctx;

      stack_size = round_stack(stack_size);
<commit_msg>Removes round_stack().<commit_after>#include "builtin/block_environment.hpp"
#include "builtin/class.hpp"
#include "builtin/compiledmethod.hpp"
#include "builtin/fixnum.hpp"
#include "builtin/lookuptable.hpp"
#include "builtin/tuple.hpp"

#include "gc_object_mark.hpp"
#include "objectmemory.hpp"

#include "vm/object_utils.hpp"

#include "builtin/contexts.hpp"
#include "builtin/nativemethodcontext.hpp"

#include <iostream>

namespace rubinius {

  void MethodContext::init(STATE) {
    GO(methctx).set(state->new_class("MethodContext", G(object)));
    G(methctx)->set_object_type(state, MethodContextType);

    GO(blokctx).set(state->new_class("BlockContext", G(methctx)));
    G(blokctx)->set_object_type(state, BlockContextType);
  }

  /* Initialize +ctx+'s fields */
  static inline void init_context(STATE, MethodContext* ctx, size_t stack) {
    ctx->StoresBytes = 1;
    ctx->ip = 0;
    ctx->native_ip = 0;
    ctx->current_unwind = 0;
    ctx->ivars(state, Qnil);

    // Do this here because it's possible for us to pass a context
    // around and it could leak out before the real sender is set.
    ctx->sender(state, (MethodContext*)Qnil);

    // Don't initialize any fields you KNOW are always set later
    // on before the ctx is used. We just waste precious time if we do.

    ctx->stack_size = stack;
    for(size_t i = 0; i < stack; i++) {
      ctx->stk[i] = Qnil;
    }

    ctx->js.stack = ctx->stk - 1;
    ctx->js.stack_top = (ctx->stk + stack - 1);
  }

  /* Find a context to use. Either use a cache or create one in the heap. */
  template <class T>
    static inline T* allocate(STATE, Class* cls, size_t stack_size) {
      T* ctx;

{'fraction_non_alphanumeric': 0.12863705972434916, 'fraction_numerical': 0.004594180704441042, 'mean_word_length': 3.572928821470245, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 39, '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': '7452179', 'n_tokens_mistral': 1328, 'n_tokens_neox': 1292, 'n_words': 363}