Skip to content

Exception handling To-do  #1

@Melnytskyi

Description

@Melnytskyi

Currently in project implemented basic handling in windows platform via SEH, but there no filter, destructors and another things that do handlers like C++ or C#

And cause that implemented dumb exception handling via c++ code:
ValueItem* FuncEnviropment::initAndCall(ValueItem* arguments, uint32_t arguments_size) for cleanup and
ValueItem* FuncEnviropment::syncWrapper_catch(ValueItem* args, uint32_t arguments_size) for catching all exceptions, that slow and not flexible for any language

Then i'm think will be good if will implemented fully functional exception handling and created opcodes for handling without proxy or other stuff through native code

Opcodes:

  • Handle begin (id)
    The beginning of handlng, ids will be unique, or will be thrown InvalidFunction exception

  • Handle catch (id, ex count, ex names...)
    Where we will jump after catching specific exceptions

  • Handle catch (id, value id)
    Where we will jump after catching exception specified in value

  • Handle catch (id, value id, value meta)
    Where we will jump after catching exception specified in value(with meta info)

  • Handle finally (id)
    Where we will jump after all blocks(jump operations from handle and catch region not jump here, you will implement
    that ourselves)
    There may be multiple finally blocks

  • Handle end(id)
    Where handling end

There now unique feature:
"Handle begin" and "Handle end" not define scopes
Without "value hold" all values will be removed at end of function by id order

  • Value hold(id, value id)
    Define where we need track value

  • Value unhold(id)
    Define where we need call remove opcode, if from value hold to value unhold thrown exception, then will be called remove operation

"Value hold" need for situations when need safely with exception handling get value, but without moving values, and ability to access value after scope, like var in JavaScript

Metadata

Metadata

Assignees

Labels

LinuxLinux platform issueenhancementNew feature or requestjitJIT compiler issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions