<commit_before>package venus.assembler

import venus.riscv.Instruction

class Program {
    /* TODO: abstract away these variables */
    public val insts: MutableList<Instruction>
    public val labels: HashMap<String, Int>
    public val relocationTable: MutableList<Pair<String, Int>>
    public var size: Int
    init {
        insts = ArrayList<Instruction>()
        labels = HashMap<String, Int>()
        relocationTable = ArrayList<Pair<String, Int>>()
        size = 0
    }

    fun add(inst: Instruction) {
        insts.add(inst)
        size += inst.length
    }

    fun addLabel(lbl: String, offset: Int) = labels.put(lbl, offset)

    fun getLabelOffset(lbl: String): Int? {
        val loc = labels.get(lbl)
        if (loc == null) return null
        return loc - size
    }

    /* TODO: relocation table and linker */
    fun addJump(lbl: String) {
        relocationTable.add(Pair(lbl, size))
    }

    /* TODO: add dump formats */
    fun dump(): List<Instruction> = insts
}<commit_msg>Move from block to one-line expression<commit_after>package venus.assembler

import venus.riscv.Instruction

class Program {
    /* TODO: abstract away these variables */
    public val insts: MutableList<Instruction>
    public val labels: HashMap<String, Int>
    public val relocationTable: MutableList<Pair<String, Int>>
    public var size: Int
    init {
        insts = ArrayList<Instruction>()
        labels = HashMap<String, Int>()
        relocationTable = ArrayList<Pair<String, Int>>()
        size = 0
    }

    fun add(inst: Instruction) {
        insts.add(inst)
        size += inst.length
    }

    fun addLabel(lbl: String, offset: Int) = labels.put(lbl, offset)

    fun getLabelOffset(lbl: String): Int? {
        val loc = labels.get(lbl)
        if (loc == null) return null
        return loc - size
    }

    /* TODO: relocation table and linker */
    fun addJump(lbl: String) = relocationTable.add(Pair(lbl, size))
 
    /* TODO: add dump formats */
    fun dump(): List<Instruction> = insts
}
{'fraction_non_alphanumeric': 0.1111111111111111, 'fraction_numerical': 0.0009832841691248771, 'mean_word_length': 2.6535008976660683, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4609348', 'n_tokens_mistral': 608, 'n_tokens_neox': 608, 'n_words': 177}