Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 62 lines (43 sloc) 1.552 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62

Third attempt at bytecode:

Goals
  Handle value consuming (see 'copy_analysis')
  Handle input & output pushing (including input searches)
  Handle multi-inputs
  Handle evaluator's special cases around loops & conditionals


Rough draft

  Every Branch will have a Bytecode object
  The object contains the list of instructions for evaluating the branch
  There is also a 'dirty' flag. Code modifications will trigger the flag,
  requiring that the bytecode is later rebuilt.

Dirty flag
  As a shortcut - enabling the dirty flag could put a dirty() op at the top
  of the instruction stream. This means that we wouldn't have to check the
  flag on every branch call.

  Because of input searching, if we dirty a branch A then we must dirty every
  minor branch inside A, recursively.

  'dirty' could mean the same thing as our in-progress status.

Outline of necessary operations

  fire_native
    - Looks in top branch, and fires the C override

  copy stack_loc_1 stack_loc_2
  swap stack_loc_1 stack_loc_2

  type_cast stack_loc type_ref
  type_check stack_loc type_ref

  finish_frame
  start_list stack_loc
    - Used for :multiple inputs
  append_to_list stack_loc_1 stack_loc_2
    - Used for :multiple inputs

  push_branch
  choose_conditional

  (stuff for loops)

  type_check

  error_not_enough_inputs
  error_too_many_inputs

  pause
    - In first iteration, pause after every call?

Implementation Notes
  Every Frame should have a reference to Bytecode?
  Bytecode is GCable?
  1-to-1 bytecode with Branch
    Yes for first impl
Something went wrong with that request. Please try again.