Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Thread::copy_values(Values*)

  • Loading branch information...
commit e12d689af7849e7a0253c4b9973b829665b4f5a1 1 parent 342775e
@gnooth authored
Showing with 24 additions and 4 deletions.
  1. +3 −2 kernel/Frame.cpp
  2. +2 −0  kernel/Frame.hpp
  3. +19 −2 kernel/Thread.hpp
View
5 kernel/Frame.cpp
@@ -43,7 +43,8 @@ inline void restore_frame_context(Frame * frame, Thread * thread)
void RT_unwind_to(Frame * frame, Thread * thread)
{
// save thread's values
- Values * values = thread->copy_values();
+ Values values;
+ thread->copy_values(&values);
// run applicable cleanups
Frame * f = thread->last_control_frame();
while (f && f != frame)
@@ -70,7 +71,7 @@ void RT_unwind_to(Frame * frame, Thread * thread)
f = next;
}
// restore thread's values
- thread->set_values(values);
+ thread->set_values(&values);
restore_frame_context(frame, thread);
}
View
2  kernel/Frame.hpp
@@ -260,6 +260,8 @@ class FramePool : public gc
{
// if (_index && !(_index % 10))
// printf("get_frame _index = %d\n", _index);
+// if (_index == 0)
+// printf("get_frame pool is empty\n");
return _index > 0 ? _pool[--_index] : NULL;
}
View
21 kernel/Thread.hpp
@@ -43,6 +43,10 @@ class Values : public gc
Value _values[MULTIPLE_VALUES_LIMIT];
public:
+ Values()
+ {
+ }
+
Values(char values_length, Value * values)
: _values_length(values_length)
{
@@ -55,6 +59,16 @@ class Values : public gc
return _values_length;
}
+ void set_values_length(char values_length)
+ {
+ _values_length = values_length;
+ }
+
+ void set_nth_value(int i, Value value)
+ {
+ _values[i] = value;
+ }
+
Value * values()
{
return _values;
@@ -334,9 +348,12 @@ class Thread : public TypedObject
return NIL;
}
- Values * copy_values()
+ Values * copy_values(Values * values)
{
- return new Values(_values_length, _values);
+ for (int i = 0; i < MULTIPLE_VALUES_LIMIT; i++)
+ values->set_nth_value(i, nth_value(i));
+ values->set_values_length(values_length());
+ return values;
}
Values * copy_values(Value primary_value)
Please sign in to comment.
Something went wrong with that request. Please try again.