Skip to content

the OutOfMemory exception happens in an example with ~250 lines #13

@dours

Description

@dours

The example is below. It is a part of the runtime support library for the py2eo translator. By the way, it may be reasonable for you to skip checking the support library, but I don't know of any mechanism for me to explain your analyzer which files are actually the support library.

+package org.eolang
+alias goto org.eolang.goto
+alias stdout org.eolang.io.stdout
+alias sprintf org.eolang.txt.sprintf
+alias cage org.eolang.cage
+junit

[unused] > test
  100.div 0 > @
  [] > raiseNothing
    [] > x__class__
      (pyint 0) > x__id__

  [] > raiseEmpty
    [] > x__class__
      (pyint 4) > x__id__

  [val] > pybool

    memory val > value

    fakeclasses.pyBoolClass > x__class__

    [x] > neq
      pybool (x.value.neq value) > @

    [x] > eq
      pybool (x.value.eq value) > @

    [] > not
      pybool (value.not) > @

    [x] > or
      pybool (value.or (x.value)) > @

    [x] > xor
      pybool (value.xor (x.value)) > @

    [x] > and
      pybool (value.and (x.value)) > @

    [t f] > if
      value.if t f > @

    [f] > while
      value.while f > @

    [] > as-string
      value.as-string > @

    [] > force
      value.write val > @

    value > @

  [] > newUID
    memory 12 > cur
    [unused] > apply
      seq > @
        cur.write (cur.plus (1))
        (pyint cur)

  [value] > pyfloat

    fakeclasses.pyFloatClass > x__class__

    [x] > with-value
      pyfloat x > @

    [x] > eq
      fakeclasses.convert (pyfloat value) x > p
      seq > @
        if.
          (fakeclasses.has-type x (fakeclasses.pyFloatClass))
          pybool (value.eq (x.value))
          p.fst.eq (p.snd)

  [x] > mkCopy
    x' > copy
    copy.< > @

  [res] > return
    res > result
    [] > x__class__
      (pyint 3) > x__id__

  [] > xZeroDivisionError
    pyint 12 > x__id__
    [] > apply
      [stackUp] > @
        cage result > pResult
        [] > result
          xZeroDivisionError > x__class__
        stackUp.forward (return pResult) > @

  [] > fakeclasses
    [xid] > fakeclass
      newUID.apply 0 > xidnormal
      pyint xid > x__id__
      [x] > eq
        pybool (xid.eq (x.xid)) > @

    fakeclass 5 > pyBoolClass
    fakeclass 6 > pyIntClass
    fakeclass 7 > pyFloatClass
    fakeclass 8 > pyComplexClass
    fakeclass 13 > pyStringClass

    [typ1 typ2] > gt
      seq > @
        typ1.xid.gt (typ2.xid)

    [obj typ] > has-type
      obj.x__class__.eq typ > @

    [obj dst] > convert-to
      seq > @
        stdout (sprintf "%s" "convert-to\n")
        if.
          dst.eq pyIntClass
          pyint (obj.value)
          if.
            dst.eq pyFloatClass
            seq
              stdout "converting to float\n"
              obj.as-float
            seq
              stdout "Oblom\n"
              ("Oblom")

    [fst snd] > pair

    [a b] > convert
      seq > @
        stdout "convert\n"
        if.
          gt (a.x__class__) (b.x__class__)
          seq
            pair
              a
              convert-to b (a.x__class__)
          seq
            stdout "false\n"
            pair
              convert-to a (b.x__class__)
              b

  [val] > pyint
    memory val > value

    fakeclasses.pyIntClass > x__class__

    [x] > with-value
      pyint x > @

    [x] > eq
      fakeclasses.convert (pyint value) x > p
      seq > @
        if.
          (fakeclasses.has-type x (fakeclasses.pyIntClass))
          pybool (value.eq (x.value))
          p.fst.eq (p.snd)

    [x] > float-div
      fakeclasses.convert (pyint value) x > p
      seq > @
        if.
          (fakeclasses.has-type x (fakeclasses.pyIntClass))
          (x.value.eq 0).if
            seq
              stdout "division by zero\n"
              (goto (xZeroDivisionError.apply.@)).result
            (return (pyfloat (value.as-float.div (x.value.as-float))))
          p.fst.div (p.snd)

  [] > apply
    [stackUp] > @
      [id] > is-exception
        id.greater (pyint 3) > @
      [id] > is-break-continue-return
        (id.greater (pyint 0)).and (id.less (pyint 4)) > @
      [] > xbool
        [x] > apply
          [stackUp] > @
            seq > @
              stackUp.forward (return x)
              123
      cage 0 > xcurrent-exception
      cage 0 > xexcinexc
      cage FALSE > xcaught
      newUID > dummy-newUID
      fakeclasses.pyFloatClass > xfloat
      fakeclasses.pyComplexClass > xcomplex
      raiseNothing > dummy-rn
      return > dummy-return
      raiseEmpty > dummy-raiseEmpty
      mkCopy > dummy-mkCopy
      xZeroDivisionError > dummy-xZeroDivisionError
      cage 0 > tmp
      cage 0 > toReturn
      cage 0 > assertMe
      cage 0 > xtest
      seq > @
        stdout "div\n"
        write.
          xtest
          []
            [xxNotCopied] > apply
              [stackUp] > @
                cage 0 > tmp
                cage 0 > toReturn
                xxNotCopied' > xx
                cage 0 > e0
                seq > @
                  stdout "xtest\n"
                  xx.<
                  tmp.write (100.div 0)
                  (tmp.x__class__.x__id__.neq (return.x__class__.x__id__)).if (stackUp.forward tmp) 0
                  (e0).write (tmp.result)
                  ((e0).<)
                  toReturn.write ((e0))
                  stackUp.forward (return toReturn)
                  123
        tmp.write (goto ((((xtest)).apply).@))
        (tmp.x__class__.x__id__.neq (return.x__class__.x__id__)).if (stackUp.forward tmp) 0
        (assertMe).write (tmp.result)
        toReturn.write ((assertMe))
        stackUp.forward (return toReturn)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions