diff options
author | Jacek Antonelli | 2008-08-15 23:45:11 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:11 -0500 |
commit | 215f423cbe18fe9ca14a26caef918d303bad28ff (patch) | |
tree | 0743442b286216cc8e19aa487c26f4e9345ffd64 /linden/indra/lscript/lscript_execute | |
parent | Second Life viewer sources 1.18.3.5-RC (diff) | |
download | meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.zip meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.tar.gz meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.tar.bz2 meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.tar.xz |
Second Life viewer sources 1.18.4.0-RC
Diffstat (limited to 'linden/indra/lscript/lscript_execute')
5 files changed, 125 insertions, 50 deletions
diff --git a/linden/indra/lscript/lscript_execute/lscript_execute.cpp b/linden/indra/lscript/lscript_execute/lscript_execute.cpp index 9e8be15..5bbbc47 100644 --- a/linden/indra/lscript/lscript_execute/lscript_execute.cpp +++ b/linden/indra/lscript/lscript_execute/lscript_execute.cpp | |||
@@ -2,6 +2,8 @@ | |||
2 | * @file lscript_execute.cpp | 2 | * @file lscript_execute.cpp |
3 | * @brief classes to execute bytecode | 3 | * @brief classes to execute bytecode |
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
6 | * | ||
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | 7 | * Copyright (c) 2002-2007, Linden Research, Inc. |
6 | * | 8 | * |
7 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
@@ -24,6 +26,7 @@ | |||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | 26 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO |
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 27 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
26 | * COMPLETENESS OR PERFORMANCE. | 28 | * COMPLETENESS OR PERFORMANCE. |
29 | * $/LicenseInfo$ | ||
27 | */ | 30 | */ |
28 | 31 | ||
29 | #include "linden_common.h" | 32 | #include "linden_common.h" |
@@ -265,6 +268,32 @@ void LLScriptExecute::init() | |||
265 | 268 | ||
266 | } | 269 | } |
267 | 270 | ||
271 | |||
272 | // Utility routine for when there's a boundary error parsing bytecode | ||
273 | void LLScriptExecute::recordBoundaryError( const LLUUID &id ) | ||
274 | { | ||
275 | set_fault(mBuffer, LSRF_BOUND_CHECK_ERROR); | ||
276 | llwarns << "Script boundary error for ID " << id << llendl; | ||
277 | } | ||
278 | |||
279 | |||
280 | // set IP to the event handler with some error checking | ||
281 | void LLScriptExecute::setStateEventOpcoodeStartSafely( S32 state, LSCRIPTStateEventType event, const LLUUID &id ) | ||
282 | { | ||
283 | S32 opcode_start = get_state_event_opcoode_start( mBuffer, state, event ); | ||
284 | if ( opcode_start == -1 ) | ||
285 | { | ||
286 | recordBoundaryError( id ); | ||
287 | } | ||
288 | else | ||
289 | { | ||
290 | set_ip( mBuffer, opcode_start ); | ||
291 | } | ||
292 | } | ||
293 | |||
294 | |||
295 | |||
296 | |||
268 | S32 lscript_push_variable(LLScriptLibData *data, U8 *buffer); | 297 | S32 lscript_push_variable(LLScriptLibData *data, U8 *buffer); |
269 | 298 | ||
270 | U32 LLScriptExecute::run(BOOL b_print, const LLUUID &id, char **errorstr, BOOL &state_transition) | 299 | U32 LLScriptExecute::run(BOOL b_print, const LLUUID &id, char **errorstr, BOOL &state_transition) |
@@ -373,14 +402,20 @@ U32 LLScriptExecute::run(BOOL b_print, const LLUUID &id, char **errorstr, BOOL & | |||
373 | 402 | ||
374 | // now, push any additional stack space | 403 | // now, push any additional stack space |
375 | S32 additional_size = get_event_stack_size(mBuffer, current_state, LSTT_STATE_EXIT); | 404 | S32 additional_size = get_event_stack_size(mBuffer, current_state, LSTT_STATE_EXIT); |
376 | lscript_pusharge(mBuffer, additional_size); | 405 | if ( additional_size == -1 ) |
377 | 406 | { | |
378 | sp = get_register(mBuffer, LREG_SP); | 407 | recordBoundaryError( id ); |
379 | sp += additional_size; | 408 | } |
380 | set_bp(mBuffer, sp); | 409 | else |
381 | // set IP to the event handler | 410 | { |
382 | S32 opcode_start = get_state_event_opcoode_start(mBuffer, current_state, LSTT_STATE_EXIT); | 411 | lscript_pusharge(mBuffer, additional_size); |
383 | set_ip(mBuffer, opcode_start); | 412 | |
413 | sp = get_register(mBuffer, LREG_SP); | ||
414 | sp += additional_size; | ||
415 | set_bp(mBuffer, sp); | ||
416 | // set IP to the event handler | ||
417 | setStateEventOpcoodeStartSafely( current_state, LSTT_STATE_EXIT, id ); | ||
418 | } | ||
384 | return NO_DELETE_FLAG; | 419 | return NO_DELETE_FLAG; |
385 | } | 420 | } |
386 | } | 421 | } |
@@ -431,20 +466,27 @@ U32 LLScriptExecute::run(BOOL b_print, const LLUUID &id, char **errorstr, BOOL & | |||
431 | current_events &= ~LSCRIPTStateBitField[event]; | 466 | current_events &= ~LSCRIPTStateBitField[event]; |
432 | set_event_register(mBuffer, LREG_CE, current_events, major_version); | 467 | set_event_register(mBuffer, LREG_CE, current_events, major_version); |
433 | // now, push any additional stack space | 468 | // now, push any additional stack space |
434 | S32 additional_size = get_event_stack_size(mBuffer, current_state, event) - size; | 469 | S32 additional_size = get_event_stack_size(mBuffer, current_state, event); |
435 | lscript_pusharge(mBuffer, additional_size); | 470 | if ( additional_size == -1 ) |
471 | { // b_done will be set, so we'll exit the loop at the bottom | ||
472 | recordBoundaryError( id ); | ||
473 | } | ||
474 | else | ||
475 | { | ||
476 | additional_size -= size; | ||
477 | lscript_pusharge(mBuffer, additional_size); | ||
436 | 478 | ||
437 | // now set the bp correctly | 479 | // now set the bp correctly |
438 | sp = get_register(mBuffer, LREG_SP); | 480 | sp = get_register(mBuffer, LREG_SP); |
439 | sp += additional_size + size; | 481 | sp += additional_size + size; |
440 | set_bp(mBuffer, sp); | 482 | set_bp(mBuffer, sp); |
441 | // set IP to the function | 483 | // set IP to the function |
442 | S32 opcode_start = get_state_event_opcoode_start(mBuffer, current_state, event); | 484 | setStateEventOpcoodeStartSafely( current_state, event, id ); |
443 | set_ip(mBuffer, opcode_start); | 485 | } |
444 | b_done = TRUE; | 486 | b_done = TRUE; |
445 | } | 487 | } |
446 | else if ( (current_events & LSCRIPTStateBitField[LSTT_REZ]) | 488 | else if ( (current_events & LSCRIPTStateBitField[LSTT_REZ]) |
447 | &&(current_events & event_register)) | 489 | &&(current_events & event_register)) |
448 | { | 490 | { |
449 | for (eventdata = mEventData.mEventDataList.getFirstData(); eventdata; eventdata = mEventData.mEventDataList.getNextData()) | 491 | for (eventdata = mEventData.mEventDataList.getFirstData(); eventdata; eventdata = mEventData.mEventDataList.getNextData()) |
450 | { | 492 | { |
@@ -469,17 +511,24 @@ U32 LLScriptExecute::run(BOOL b_print, const LLUUID &id, char **errorstr, BOOL & | |||
469 | data++; | 511 | data++; |
470 | } | 512 | } |
471 | // now, push any additional stack space | 513 | // now, push any additional stack space |
472 | S32 additional_size = get_event_stack_size(mBuffer, current_state, event) - size; | 514 | S32 additional_size = get_event_stack_size(mBuffer, current_state, event); |
473 | lscript_pusharge(mBuffer, additional_size); | 515 | if ( additional_size == -1 ) |
474 | 516 | { // b_done will be set, so we'll exit the loop at the bottom | |
475 | // now set the bp correctly | 517 | recordBoundaryError( id ); |
476 | sp = get_register(mBuffer, LREG_SP); | 518 | } |
477 | sp += additional_size + size; | 519 | else |
478 | set_bp(mBuffer, sp); | 520 | { |
479 | // set IP to the function | 521 | additional_size -= size; |
480 | S32 opcode_start = get_state_event_opcoode_start(mBuffer, current_state, event); | 522 | lscript_pusharge(mBuffer, additional_size); |
481 | set_ip(mBuffer, opcode_start); | 523 | |
482 | mEventData.mEventDataList.deleteCurrentData(); | 524 | // now set the bp correctly |
525 | sp = get_register(mBuffer, LREG_SP); | ||
526 | sp += additional_size + size; | ||
527 | set_bp(mBuffer, sp); | ||
528 | // set IP to the function | ||
529 | setStateEventOpcoodeStartSafely( current_state, event, id ); | ||
530 | mEventData.mEventDataList.deleteCurrentData(); | ||
531 | } | ||
483 | b_done = TRUE; | 532 | b_done = TRUE; |
484 | break; | 533 | break; |
485 | } | 534 | } |
@@ -516,16 +565,23 @@ U32 LLScriptExecute::run(BOOL b_print, const LLUUID &id, char **errorstr, BOOL & | |||
516 | } | 565 | } |
517 | b_done = TRUE; | 566 | b_done = TRUE; |
518 | // now, push any additional stack space | 567 | // now, push any additional stack space |
519 | S32 additional_size = get_event_stack_size(mBuffer, current_state, event) - size; | 568 | S32 additional_size = get_event_stack_size(mBuffer, current_state, event); |
520 | lscript_pusharge(mBuffer, additional_size); | 569 | if ( additional_size == -1 ) |
521 | 570 | { // b_done was just set, so we'll exit the loop at the bottom | |
522 | // now set the bp correctly | 571 | recordBoundaryError( id ); |
523 | sp = get_register(mBuffer, LREG_SP); | 572 | } |
524 | sp += additional_size + size; | 573 | else |
525 | set_bp(mBuffer, sp); | 574 | { |
526 | // set IP to the function | 575 | additional_size -= size; |
527 | S32 opcode_start = get_state_event_opcoode_start(mBuffer, current_state, event); | 576 | lscript_pusharge(mBuffer, additional_size); |
528 | set_ip(mBuffer, opcode_start); | 577 | |
578 | // now set the bp correctly | ||
579 | sp = get_register(mBuffer, LREG_SP); | ||
580 | sp += additional_size + size; | ||
581 | set_bp(mBuffer, sp); | ||
582 | // set IP to the function | ||
583 | setStateEventOpcoodeStartSafely( current_state, event, id ); | ||
584 | } | ||
529 | } | 585 | } |
530 | else | 586 | else |
531 | { | 587 | { |
@@ -550,23 +606,30 @@ U32 LLScriptExecute::run(BOOL b_print, const LLUUID &id, char **errorstr, BOOL & | |||
550 | current_events &= ~LSCRIPTStateBitField[event]; | 606 | current_events &= ~LSCRIPTStateBitField[event]; |
551 | set_event_register(mBuffer, LREG_CE, current_events, major_version); | 607 | set_event_register(mBuffer, LREG_CE, current_events, major_version); |
552 | // now, push any additional stack space | 608 | // now, push any additional stack space |
553 | S32 additional_size = get_event_stack_size(mBuffer, current_state, event) - size; | 609 | S32 additional_size = get_event_stack_size(mBuffer, current_state, event); |
554 | lscript_pusharge(mBuffer, additional_size); | 610 | if ( additional_size == -1 ) |
555 | 611 | { // b_done will be set, so we'll exit the loop at the bottom | |
556 | // now set the bp correctly | 612 | recordBoundaryError( id ); |
557 | sp = get_register(mBuffer, LREG_SP); | 613 | } |
558 | sp += additional_size + size; | 614 | else |
559 | set_bp(mBuffer, sp); | 615 | { |
560 | // set IP to the function | 616 | additional_size -= size; |
561 | S32 opcode_start = get_state_event_opcoode_start(mBuffer, current_state, event); | 617 | lscript_pusharge(mBuffer, additional_size); |
562 | set_ip(mBuffer, opcode_start); | 618 | |
619 | // now set the bp correctly | ||
620 | sp = get_register(mBuffer, LREG_SP); | ||
621 | sp += additional_size + size; | ||
622 | set_bp(mBuffer, sp); | ||
623 | // set IP to the function | ||
624 | setStateEventOpcoodeStartSafely( current_state, event, id ); | ||
625 | } | ||
563 | } | 626 | } |
564 | b_done = TRUE; | 627 | b_done = TRUE; |
565 | } | 628 | } |
566 | } | 629 | } // while (!b_done) |
630 | } // end of else ... in state processing code | ||
567 | 631 | ||
568 | return NO_DELETE_FLAG; | 632 | return NO_DELETE_FLAG; |
569 | } | ||
570 | } | 633 | } |
571 | 634 | ||
572 | BOOL run_noop(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) | 635 | BOOL run_noop(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) |
diff --git a/linden/indra/lscript/lscript_execute/lscript_heapruntime.cpp b/linden/indra/lscript/lscript_execute/lscript_heapruntime.cpp index 073a736..057db79 100644 --- a/linden/indra/lscript/lscript_execute/lscript_heapruntime.cpp +++ b/linden/indra/lscript/lscript_execute/lscript_heapruntime.cpp | |||
@@ -2,6 +2,8 @@ | |||
2 | * @file lscript_heapruntime.cpp | 2 | * @file lscript_heapruntime.cpp |
3 | * @brief classes to manage script heap at runtime | 3 | * @brief classes to manage script heap at runtime |
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
6 | * | ||
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | 7 | * Copyright (c) 2002-2007, Linden Research, Inc. |
6 | * | 8 | * |
7 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
@@ -24,6 +26,7 @@ | |||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | 26 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO |
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 27 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
26 | * COMPLETENESS OR PERFORMANCE. | 28 | * COMPLETENESS OR PERFORMANCE. |
29 | * $/LicenseInfo$ | ||
27 | */ | 30 | */ |
28 | 31 | ||
29 | #if 0 | 32 | #if 0 |
diff --git a/linden/indra/lscript/lscript_execute/lscript_heapruntime.h b/linden/indra/lscript/lscript_execute/lscript_heapruntime.h index 8431ea5..c4ade6c 100644 --- a/linden/indra/lscript/lscript_execute/lscript_heapruntime.h +++ b/linden/indra/lscript/lscript_execute/lscript_heapruntime.h | |||
@@ -2,6 +2,8 @@ | |||
2 | * @file lscript_heapruntime.h | 2 | * @file lscript_heapruntime.h |
3 | * @brief classes to manage script heap at runtime | 3 | * @brief classes to manage script heap at runtime |
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
6 | * | ||
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | 7 | * Copyright (c) 2002-2007, Linden Research, Inc. |
6 | * | 8 | * |
7 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
@@ -24,6 +26,7 @@ | |||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | 26 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO |
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 27 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
26 | * COMPLETENESS OR PERFORMANCE. | 28 | * COMPLETENESS OR PERFORMANCE. |
29 | * $/LicenseInfo$ | ||
27 | */ | 30 | */ |
28 | 31 | ||
29 | #if 0 | 32 | #if 0 |
diff --git a/linden/indra/lscript/lscript_execute/lscript_readlso.cpp b/linden/indra/lscript/lscript_execute/lscript_readlso.cpp index f84abc5..8ecd8cd 100644 --- a/linden/indra/lscript/lscript_execute/lscript_readlso.cpp +++ b/linden/indra/lscript/lscript_execute/lscript_readlso.cpp | |||
@@ -2,6 +2,8 @@ | |||
2 | * @file lscript_readlso.cpp | 2 | * @file lscript_readlso.cpp |
3 | * @brief classes to read lso file | 3 | * @brief classes to read lso file |
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
6 | * | ||
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | 7 | * Copyright (c) 2002-2007, Linden Research, Inc. |
6 | * | 8 | * |
7 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
@@ -24,6 +26,7 @@ | |||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | 26 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO |
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 27 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
26 | * COMPLETENESS OR PERFORMANCE. | 28 | * COMPLETENESS OR PERFORMANCE. |
29 | * $/LicenseInfo$ | ||
27 | */ | 30 | */ |
28 | 31 | ||
29 | #include "linden_common.h" | 32 | #include "linden_common.h" |
diff --git a/linden/indra/lscript/lscript_execute/lscript_readlso.h b/linden/indra/lscript/lscript_execute/lscript_readlso.h index 8fa5211..92c9dfa 100644 --- a/linden/indra/lscript/lscript_execute/lscript_readlso.h +++ b/linden/indra/lscript/lscript_execute/lscript_readlso.h | |||
@@ -2,6 +2,8 @@ | |||
2 | * @file lscript_readlso.h | 2 | * @file lscript_readlso.h |
3 | * @brief classes to read lso file | 3 | * @brief classes to read lso file |
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
6 | * | ||
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | 7 | * Copyright (c) 2002-2007, Linden Research, Inc. |
6 | * | 8 | * |
7 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
@@ -24,6 +26,7 @@ | |||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | 26 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO |
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 27 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
26 | * COMPLETENESS OR PERFORMANCE. | 28 | * COMPLETENESS OR PERFORMANCE. |
29 | * $/LicenseInfo$ | ||
27 | */ | 30 | */ |
28 | 31 | ||
29 | #ifndef LL_LSCRIPT_READLSO_H | 32 | #ifndef LL_LSCRIPT_READLSO_H |