Commit Graph

13 Commits

Author SHA1 Message Date
David Anderson
a1afa23bc4 Implement a new stack and error handling model for the SourcePawn VM.
This has three major changes to SourcePawn. First, the API now supports the concept of "exceptions". The exception state is a global property of an instance of the SourcePawn VM. Exceptions can be caught or suppressed. Many places in SourceMod have been updated to check exceptions instead of errors.

The new API obsoletes major parts of the embedder API - all but one method of invoking functions is obsoleted, and the debug interface has been scrapped. Extensions using the native API will not be affected, however, ThrowNativeError has been deprecated in favor of ReportError.

Second, the SourcePawn concept of a "stack" has been unified at the API level. A stack frame iterator now iterates over all SourcePawn invocations, rather than the topmost plugin. This makes error handling more consistent and removes another dependency on context-per-plugin.

Finally, the implementation of stack frames has been changed dramatically. Rather than maintain a complicated and expensive return pointer stack, we now rely on the implicit one provided by the CPU. The stack frame iterator now walks the JIT stack directly. This removes many unnecessary bookkeeping instructions from the generated code, in particular making the CALL instruction 40% faster.

These changes required some fair surgery to the JIT. Its error paths are now slightly more complicated, as they have to throw an exception rather than return an error code. In addition, any path that can throw an exception is now responsible for creating an "exit frame", which exists to tell the stack frame iterator about transitions from the JIT to the VM.
2015-03-04 23:45:30 -08:00
David Anderson
6b714dafe3 Add transitional syntax support for Protobuf natives. 2014-11-09 14:19:16 -08:00
Nicholas Hastings
9215ddcf8a Add PbRemoveRepeatedFieldValue native (bug 6066, r=asherkin). 2014-03-21 13:23:48 -04:00
Nicholas Hastings
39c9e69d8a Remove deprecated PbReadRepeated natives. 2013-04-23 07:11:49 -04:00
Nicholas Hastings
a450361956 Added support for getting/setting protobuf enum values with Pb*Int natives (nobug, r=asherkin). 2013-04-16 11:33:36 -04:00
Nicholas Hastings
df48ad6b61 Fixed build. 2013-04-15 07:22:23 -04:00
Nicholas Hastings
70444b46b9 Fixed regression in cset 68d82718dc99 causing missing protobuf natives (bug 5712). 2013-04-15 07:12:52 -04:00
David Anderson
4191856034 Fix protobuf builds. 2013-03-29 12:35:56 -07:00
David Anderson
045ee262a8 Move scared guts of core into logic (bug 5680, r=fyren).
--HG--
rename : core/ExtensionSys.cpp => core/logic/ExtensionSys.cpp
rename : core/ExtensionSys.h => core/logic/ExtensionSys.h
rename : core/HandleSys.cpp => core/logic/HandleSys.cpp
rename : core/HandleSys.h => core/logic/HandleSys.h
rename : core/NativeInvoker.cpp => core/logic/NativeInvoker.cpp
rename : core/NativeInvoker.h => core/logic/NativeInvoker.h
rename : core/NativeOwner.cpp => core/logic/NativeOwner.cpp
rename : core/NativeOwner.h => core/logic/NativeOwner.h
rename : core/PluginSys.cpp => core/logic/PluginSys.cpp
rename : core/PluginSys.h => core/logic/PluginSys.h
rename : core/ShareSys.cpp => core/logic/ShareSys.cpp
rename : core/ShareSys.h => core/logic/ShareSys.h
rename : core/smn_fakenatives.cpp => core/logic/smn_fakenatives.cpp
rename : core/logic/AutoHandleRooter.h => public/AutoHandleRooter.h
2013-03-29 11:37:29 -07:00
Nicholas Hastings
306828480f Added repeated field handing to PbSet* natives (bug 5633, r=asherkin). 2013-03-16 13:31:56 -04:00
Nicholas Hastings
42b415952b Added repeated field handling to PbRead* natives. Deprecate PbReadRepeated* (bug 5633, r=asherkin). 2013-03-16 13:31:35 -04:00
Nicholas Hastings
ab9c1217e4 Fixed numerous instances of same "cannot pass objects of non-POD type" error in smn_protobuf.cpp. 2013-01-22 22:36:38 -05:00
Nicholas Hastings
312e26a5cf Added initial support for protobuf usermessages on CS:GO (bug 5579, r=asherkin). 2013-01-22 21:43:12 -05:00