diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/lscript/lscript_execute/lscript_execute.cpp | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/lscript/lscript_execute/lscript_execute.cpp')
-rw-r--r-- | linden/indra/lscript/lscript_execute/lscript_execute.cpp | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/linden/indra/lscript/lscript_execute/lscript_execute.cpp b/linden/indra/lscript/lscript_execute/lscript_execute.cpp index d178a16..b2b54cd 100644 --- a/linden/indra/lscript/lscript_execute/lscript_execute.cpp +++ b/linden/indra/lscript/lscript_execute/lscript_execute.cpp | |||
@@ -17,7 +17,8 @@ | |||
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at |
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
21 | * | 22 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 23 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 24 | * that you have read and understood your obligations described above, |
@@ -41,6 +42,10 @@ | |||
41 | #include "lscript_heapruntime.h" | 42 | #include "lscript_heapruntime.h" |
42 | #include "lscript_alloc.h" | 43 | #include "lscript_alloc.h" |
43 | 44 | ||
45 | // Static | ||
46 | const S32 DEFAULT_SCRIPT_TIMER_CHECK_SKIP = 4; | ||
47 | S32 LLScriptExecute::sTimerCheckSkip = DEFAULT_SCRIPT_TIMER_CHECK_SKIP; | ||
48 | |||
44 | void (*binary_operations[LST_EOF][LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode); | 49 | void (*binary_operations[LST_EOF][LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode); |
45 | void (*unary_operations[LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode); | 50 | void (*unary_operations[LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode); |
46 | 51 | ||
@@ -63,6 +68,12 @@ const char* LSCRIPTRunTimeFaultStrings[LSRF_EOF] = /*Flawfinder: ignore*/ | |||
63 | void LLScriptExecuteLSL2::startRunning() {} | 68 | void LLScriptExecuteLSL2::startRunning() {} |
64 | void LLScriptExecuteLSL2::stopRunning() {} | 69 | void LLScriptExecuteLSL2::stopRunning() {} |
65 | 70 | ||
71 | const char* URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; | ||
72 | const char* URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; | ||
73 | |||
74 | // HTTP Requests to LSL scripts will time out after 25 seconds. | ||
75 | const U64 LSL_HTTP_REQUEST_TIMEOUT = 25 * USEC_PER_SEC; | ||
76 | |||
66 | LLScriptExecuteLSL2::LLScriptExecuteLSL2(LLFILE *fp) | 77 | LLScriptExecuteLSL2::LLScriptExecuteLSL2(LLFILE *fp) |
67 | { | 78 | { |
68 | U8 sizearray[4]; | 79 | U8 sizearray[4]; |
@@ -744,6 +755,11 @@ S32 LLScriptExecuteLSL2::getMajorVersion() const | |||
744 | return major_version; | 755 | return major_version; |
745 | } | 756 | } |
746 | 757 | ||
758 | U32 LLScriptExecuteLSL2::getUsedMemory() | ||
759 | { | ||
760 | return getBytecodeSize(); | ||
761 | } | ||
762 | |||
747 | LLScriptExecute::LLScriptExecute() : | 763 | LLScriptExecute::LLScriptExecute() : |
748 | mReset(FALSE) | 764 | mReset(FALSE) |
749 | { | 765 | { |
@@ -891,14 +907,13 @@ void LLScriptExecute::runInstructions(BOOL b_print, const LLUUID &id, | |||
891 | b_done = TRUE; | 907 | b_done = TRUE; |
892 | } | 908 | } |
893 | 909 | ||
894 | while (!b_done) | 910 | if (!b_done) |
895 | { | 911 | { |
896 | // Call handler for next queued event. | 912 | // Call handler for next queued event. |
897 | if(getEventCount() > 0) | 913 | if(getEventCount() > 0) |
898 | { | 914 | { |
899 | ++events_processed; | 915 | ++events_processed; |
900 | callNextQueuedEventHandler(event_register, id, quanta); | 916 | callNextQueuedEventHandler(event_register, id, quanta); |
901 | b_done = TRUE; | ||
902 | } | 917 | } |
903 | else | 918 | else |
904 | { | 919 | { |
@@ -910,8 +925,8 @@ void LLScriptExecute::runInstructions(BOOL b_print, const LLUUID &id, | |||
910 | ++events_processed; | 925 | ++events_processed; |
911 | callEventHandler(event, id, quanta); | 926 | callEventHandler(event, id, quanta); |
912 | } | 927 | } |
913 | b_done = TRUE; | ||
914 | } | 928 | } |
929 | b_done = TRUE; | ||
915 | } | 930 | } |
916 | } | 931 | } |
917 | } | 932 | } |
@@ -919,7 +934,7 @@ void LLScriptExecute::runInstructions(BOOL b_print, const LLUUID &id, | |||
919 | // Run for a single timeslice, or until a yield or state transition is due | 934 | // Run for a single timeslice, or until a yield or state transition is due |
920 | F32 LLScriptExecute::runQuanta(BOOL b_print, const LLUUID &id, const char **errorstr, F32 quanta, U32& events_processed, LLTimer& timer) | 935 | F32 LLScriptExecute::runQuanta(BOOL b_print, const LLUUID &id, const char **errorstr, F32 quanta, U32& events_processed, LLTimer& timer) |
921 | { | 936 | { |
922 | U32 timer_checks = 0; | 937 | S32 timer_checks = 0; |
923 | F32 inloop = 0; | 938 | F32 inloop = 0; |
924 | 939 | ||
925 | // Loop while not finished, yield not due and time remaining | 940 | // Loop while not finished, yield not due and time remaining |
@@ -931,12 +946,11 @@ F32 LLScriptExecute::runQuanta(BOOL b_print, const LLUUID &id, const char **erro | |||
931 | runInstructions(b_print, id, errorstr, | 946 | runInstructions(b_print, id, errorstr, |
932 | events_processed, quanta); | 947 | events_processed, quanta); |
933 | 948 | ||
934 | static const S32 lsl_timer_check_skip = 4; | ||
935 | if(isYieldDue()) | 949 | if(isYieldDue()) |
936 | { | 950 | { |
937 | break; | 951 | break; |
938 | } | 952 | } |
939 | else if(timer_checks++ == lsl_timer_check_skip) | 953 | else if(timer_checks++ >= LLScriptExecute::sTimerCheckSkip) |
940 | { | 954 | { |
941 | inloop = timer.getElapsedTimeF32(); | 955 | inloop = timer.getElapsedTimeF32(); |
942 | if(inloop > quanta) | 956 | if(inloop > quanta) |
@@ -946,9 +960,18 @@ F32 LLScriptExecute::runQuanta(BOOL b_print, const LLUUID &id, const char **erro | |||
946 | timer_checks = 0; | 960 | timer_checks = 0; |
947 | } | 961 | } |
948 | } | 962 | } |
963 | if (inloop == 0.0f) | ||
964 | { | ||
965 | inloop = timer.getElapsedTimeF32(); | ||
966 | } | ||
949 | return inloop; | 967 | return inloop; |
950 | } | 968 | } |
951 | 969 | ||
970 | F32 LLScriptExecute::runNested(BOOL b_print, const LLUUID &id, const char **errorstr, F32 quanta, U32& events_processed, LLTimer& timer) | ||
971 | { | ||
972 | return LLScriptExecute::runQuanta(b_print, id, errorstr, quanta, events_processed, timer); | ||
973 | } | ||
974 | |||
952 | BOOL run_noop(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) | 975 | BOOL run_noop(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) |
953 | { | 976 | { |
954 | if (b_print) | 977 | if (b_print) |