[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp server...
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp server... |
Date: |
Thu, 12 Jun 2008 12:44:59 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Benjamin Wolsey <bwy> 08/06/12 12:44:59
Modified files:
. : ChangeLog
server/vm : ASHandlers.cpp ActionExec.cpp ActionExec.h
Log message:
* server/vm/ActionExec.{h,cpp}: fix throw in register again
(prevents
infinite recursion and segfault in
misc-mtasc.all/exception.as).
Still one failure, but no crashes. Make heavy debug-logging
optional
at compile. Provide more accessors to ActionExec data.
* server/vm/ASHandlers.cpp: reduce direct access to ActionExec
data.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6911&r2=1.6912
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.244&r2=1.245
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.cpp?cvsroot=gnash&r1=1.78&r2=1.79
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.h?cvsroot=gnash&r1=1.32&r2=1.33
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6911
retrieving revision 1.6912
diff -u -b -r1.6911 -r1.6912
--- ChangeLog 12 Jun 2008 12:15:08 -0000 1.6911
+++ ChangeLog 12 Jun 2008 12:44:57 -0000 1.6912
@@ -1,3 +1,11 @@
+2008-06-12 Benjamin Wolsey <address@hidden>
+
+ * server/vm/ActionExec.{h,cpp}: fix throw in register again (prevents
+ infinite recursion and segfault in misc-mtasc.all/exception.as).
+ Still one failure, but no crashes. Make heavy debug-logging optional
+ at compile. Provide more accessors to ActionExec data.
+ * server/vm/ASHandlers.cpp: reduce direct access to ActionExec data.
+
2008-06-12 Sandro Santilli <address@hidden>
* libbase/curl_adapter.{h,cpp}: drop tu_file references.
Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.244
retrieving revision 1.245
diff -u -b -r1.244 -r1.245
--- server/vm/ASHandlers.cpp 12 Jun 2008 09:36:00 -0000 1.244
+++ server/vm/ASHandlers.cpp 12 Jun 2008 12:44:58 -0000 1.245
@@ -2133,7 +2133,7 @@
boost::int16_t offset = thread.code.read_int16(thread.getCurrentPC()+3);
- thread.next_pc += offset;
+ thread.advanceNextPC(offset);
// @@ TODO range checks
}
@@ -2553,7 +2553,7 @@
bool test = env.pop().to_bool();
if (test)
{
- next_pc += offset;
+ thread.advanceNextPC(offset);
if (next_pc > stop_pc)
{
@@ -4036,7 +4036,7 @@
func->set_length(code_size);
// Skip the function body (don't interpret it now).
- thread.next_pc += code_size;
+ thread.advanceNextPC(code_size);
// If we have a name, then save the function in this
// environment under that name.
@@ -4180,7 +4180,7 @@
with_obj_val);
);
// skip the full block
- thread.next_pc += block_length;
+ thread.advanceNextPC(block_length);
return;
}
@@ -4190,7 +4190,7 @@
if ( ! thread.pushWithEntry(with_stack_entry(with_obj, block_end)) )
{
// skip the full block
- thread.next_pc += block_length;
+ thread.advanceNextPC(block_length);
}
}
@@ -4247,7 +4247,7 @@
// next_pc is assumed to point to first action of
// the function body (one-past the current tag, whic
// is DefineFunction). We add code_size to it.
- thread.next_pc += code_size;
+ thread.advanceNextPC(code_size);
// If we have a name, then save the function in this
// environment under that name.
Index: server/vm/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -b -r1.78 -r1.79
--- server/vm/ActionExec.cpp 12 Jun 2008 09:36:00 -0000 1.78
+++ server/vm/ActionExec.cpp 12 Jun 2008 12:44:59 -0000 1.79
@@ -54,6 +54,9 @@
// Max number of stack item to dump. 0 for unlimited.
# define STACK_DUMP_LIMIT 32
+// Define to get debugging messages for try / catch
+//#define GNASH_DEBUG_TRY 1
+
#endif
@@ -238,48 +241,49 @@
// If we are in a try block, check to see if we have thrown.
tryBlock& t = _tryList.back();
- //log_debug ("PC: %d, stop pc: %d, tryState: %d", pc, stop_pc,
t._tryState);
-
if (t._tryState == tryBlock::TRY_TRY)
{
if (env.stack_size() && env.top(0).is_exception())
{
as_value ex = env.top(0);
ex.unflag_exception();
-
+#ifdef GNASH_DEBUG_TRY
log_debug("TRY block: Encountered exception (%s). Set
PC to catch.", ex);
-
+#endif
// We have an exception. Don't execute any more of the
try
// block and process exception.
pc = t._catchOffset;
- //stop_pc = t._afterTriedOffset;
t._tryState = tryBlock::TRY_CATCH;
if (!t._hasName)
{
- // What to do now? Has the exception been handled?
- // I don't know what this is for. There seems to be
- // one test for it
crash-0.5.4-13379-catch-in-register.swf
- // for swfdec, which isn't really testing that at
all.
- // This was left over from a code reorganization
that
- // fixed try / catch / finally for all normal
cases (tested
- // extensively in swfdec and actionscript.all).
+ // Used when exceptions are thrown in functions.
+ // This is tested in misc-mtasc.all/exception.as
as_value ex = env.pop();
+ ex.unflag_exception();
if (isFunction2() && t._registerIndex <
env.num_local_registers())
{
+#ifdef GNASH_DEBUG_TRY
+ log_debug("isFunction2");
+#endif
env.local_register(t._registerIndex) = ex;
}
else if (t._registerIndex < 4)
{
+#ifdef GNASH_DEBUG_TRY
+ log_debug("registerIndex < 4");
+#endif
env.global_register(t._registerIndex) = ex;
}
- continue;
+ //continue;
}
}
else
{
+#ifdef GNASH_DEBUG_TRY
log_debug("TRY block: No exception, continuing as
normal.");
+#endif
// All code up to the end of the TryBlock should be
// executed.
stop_pc = t._afterTriedOffset;
@@ -306,13 +310,16 @@
log_debug("CATCH block: top of stack is an exception
(%s)", ex);
- if (!t._name.empty())
+ if (t._hasName && !t._name.empty())
{
// If name isn't empty, it means we have a catch
block.
// We should set its argument to the exception
value.
setLocalVariable(t._name, ex);
t._lastThrow = as_value();
- log_debug("CATCH block: encountered exception
(%s). assigning to catch arg %d.", ex, t._name);
+#ifdef GNASH_DEBUG_TRY
+ log_debug("CATCH block: encountered exception
(%s). "
+ "Assigning to catch arg %d.", ex,
t._name);
+#endif
}
}
@@ -324,16 +331,21 @@
{
// FINALLY. This may or may not exist, but these actions
// are carried out anyway.
+#ifdef GNASH_DEBUG_TRY
log_debug("FINALLY: tryBlock name = %s", t._name);
-
+#endif
// If the exception is here, we have thrown in catch.
if (env.stack_size() && env.top(0).is_exception())
{
t._lastThrow = env.pop();
+#ifdef GNASH_DEBUG_TRY
as_value ex = t._lastThrow;
ex.unflag_exception();
- log_debug("FINALLY: top of stack is an exception again
(%s). Replaces any previous uncaught exceptions", ex);
+ log_debug("FINALLY: top of stack is an exception "
+ "again (%s). Replaces any previous "
+ "uncaught exceptions", ex);
+#endif
}
stop_pc = t._afterTriedOffset;
t._tryState = tryBlock::TRY_END;
@@ -348,9 +360,12 @@
{
// Check for exception handlers straight away
stop_pc = t._afterTriedOffset;
+#ifdef GNASH_DEBUG_TRY
as_value ex = env.top(0);
ex.unflag_exception();
- log_debug("END: exception thrown in finally(%s).
Leaving on the stack", ex);
+ log_debug("END: exception thrown in finally(%s). "
+ "Leaving on the stack", ex);
+#endif
_tryList.pop_back();
continue;
}
@@ -358,15 +373,21 @@
{
// Check for exception handlers straight away
stop_pc = t._afterTriedOffset;
+#ifdef GNASH_DEBUG_TRY
as_value ex = t._lastThrow;
ex.unflag_exception();
- log_debug("END: no new exceptions thrown. Pushing
uncaught one (%s) back", ex);
+ log_debug("END: no new exceptions thrown. Pushing "
+ "uncaught one (%s) back", ex);
+#endif
env.push(t._lastThrow);
_tryList.pop_back();
continue;
}
+#ifdef GNASH_DEBUG_TRY
log_debug("END: no new exceptions thrown. Continuing");
- // No uncaught exceptions left in TryBlock, execute rest
of code.
+#endif
+ // No uncaught exceptions left in TryBlock:
+ // execute rest of code.
stop_pc = t._savedEndOffset;
// Finished with this TryBlock.
Index: server/vm/ActionExec.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- server/vm/ActionExec.h 12 Jun 2008 09:36:00 -0000 1.32
+++ server/vm/ActionExec.h 12 Jun 2008 12:44:59 -0000 1.33
@@ -49,7 +49,7 @@
};
tryBlock(size_t cur_off, size_t try_size, size_t catch_size,
- size_t finally_size, std::string catchName, int stack_depth)
+ size_t finally_size, std::string catchName, int /*stack_depth*/)
:
_catchOffset(cur_off + try_size),
_finallyOffset(cur_off + try_size + catch_size),
@@ -58,12 +58,11 @@
_name(catchName),
_registerIndex(),
_tryState(tryBlock::TRY_TRY),
- _lastThrow(),
- _stackDepth(stack_depth)
+ _lastThrow()
{/**/}
tryBlock(size_t cur_off, size_t try_size, size_t catch_size,
- size_t finally_size, boost::uint8_t register_index, int
stack_depth)
+ size_t finally_size, boost::uint8_t register_index, int /*
stack_depth */)
:
_catchOffset(cur_off + try_size),
_finallyOffset(cur_off + try_size + catch_size),
@@ -72,8 +71,7 @@
_name(),
_registerIndex(register_index),
_tryState(tryBlock::TRY_TRY),
- _lastThrow(),
- _stackDepth(stack_depth)
+ _lastThrow()
{/**/}
private:
@@ -86,7 +84,6 @@
boost::uint8_t _registerIndex;
tryState _tryState;
as_value _lastThrow;
- boost::uint32_t _stackDepth;
};
/// Executor of an action_buffer
@@ -445,6 +442,8 @@
void skipRemainingBuffer() { next_pc = stop_pc; }
+ void advanceNextPC(int offset) { next_pc += offset; }
+
// This is just a temporary mess for initialization order
// while I sort out accessors.
- [Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp server..., Benjamin Wolsey, 2008/06/12
- [Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp server...,
Benjamin Wolsey <=
- [Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp server..., Benjamin Wolsey, 2008/06/13
- [Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp server..., Benjamin Wolsey, 2008/06/13
- [Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp server..., Benjamin Wolsey, 2008/06/16
- [Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp server..., Benjamin Wolsey, 2008/06/16
- [Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp server..., Benjamin Wolsey, 2008/06/17