<commit_before>package net.sandius.rembulan.test

import net.sandius.rembulan.compiler.ChunkClassLoader
import net.sandius.rembulan.compiler.gen.ChunkCompiler
import net.sandius.rembulan.core._
import net.sandius.rembulan.core.impl.PairCachingObjectSink
import net.sandius.rembulan.{core => lua}

object Runner {

  import Util._

  val loader = new LuaCFragmentCompiler("luac53")

  def main(args: Array[String]): Unit = {

    val program = BasicFragments.lookup("JustX").get
    val proto = loader.compile(program)

    section("LuaC version") {
      println(loader.version)
    }

    section("Program code") {
      println(program.code)
    }

    val compiler = new ChunkCompiler()
    val classLoader = new ChunkClassLoader()

    section ("Compilation") {

      val chunk = timed("Compile") {
        compiler.compile(proto, "test")
      }

      val name = classLoader.install(chunk)
      val clazz = classLoader.loadClass(name).asInstanceOf[Class[lua.Function]]

      val state = new DummyLuaState(false)
      val os = new PairCachingObjectSink

      val env = state.newTable(0, 0)
      val upEnv = state.newUpvalue(env)

      val f = clazz.getConstructor(classOf[Upvalue]).newInstance(upEnv)

      section("Call") {
        timed("Call") {
          Dispatch.call(state, os, f)
        }
      }

      section("Result") {
        println(os.toArray.mkString(", "))
      }

    }
  }

}<commit_msg>Printing result details.<commit_after>package net.sandius.rembulan.test

import net.sandius.rembulan.compiler.ChunkClassLoader
import net.sandius.rembulan.compiler.gen.ChunkCompiler
import net.sandius.rembulan.core._
import net.sandius.rembulan.core.impl.PairCachingObjectSink
import net.sandius.rembulan.{core => lua}

object Runner {

  import Util._

  val loader = new LuaCFragmentCompiler("luac53")

  def main(args: Array[String]): Unit = {

    val program = BasicFragments.lookup("JustX").get
    val proto = loader.compile(program)

    section("LuaC version") {
      println(loader.version)
    }

    section("Program code") {
      println(program.code)
    }

    val compiler = new ChunkCompiler()
    val classLoader = new ChunkClassLoader()

    section ("Compilation") {

      val chunk = timed("Compile") {
        compiler.compile(proto, "test")
      }

      val name = classLoader.install(chunk)
      val clazz = classLoader.loadClass(name).asInstanceOf[Class[lua.Function]]

      val state = new DummyLuaState(false)
      val os = new PairCachingObjectSink

      val env = state.newTable(0, 0)
      val upEnv = state.newUpvalue(env)

      val f = clazz.getConstructor(classOf[Upvalue]).newInstance(upEnv)

      section("Call") {
        timed("Call") {
          Dispatch.call(state, os, f)
        }
      }

      section("Result") {
        val result = os.toArray.toSeq
        for ((v, i) <- result.zipWithIndex) {
          println(i + ":" + "\t" + v + " (" + (if (v != null) v.getClass.getName else "null") + ")")
        }
      }

    }
  }

}
{'fraction_non_alphanumeric': 0.12479201331114809, 'fraction_numerical': 0.0026622296173044926, 'mean_word_length': 2.8637532133676094, 'pattern_counts': {'":': 1, '<': 4, '<?xml version=': 0, '>': 5, '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': '2405189', 'n_tokens_mistral': 1009, 'n_tokens_neox': 958, 'n_words': 183}