Index: runtime/vm/code_generator.cc |
=================================================================== |
--- runtime/vm/code_generator.cc (revision 4295) |
+++ runtime/vm/code_generator.cc (working copy) |
@@ -13,6 +13,7 @@ |
#include "vm/exceptions.h" |
#include "vm/ic_data.h" |
#include "vm/object_store.h" |
+#include "vm/message.h" |
#include "vm/resolver.h" |
#include "vm/runtime_entry.h" |
#include "vm/stack_frame.h" |
@@ -876,6 +877,20 @@ |
} |
+static RawInstance* DeserializeMessage(void* data) { |
+ // Create a snapshot object using the buffer. |
+ const Snapshot* snapshot = Snapshot::SetupFromBuffer(data); |
+ ASSERT(snapshot->IsMessageSnapshot()); |
+ |
+ // Read object back from the snapshot. |
+ SnapshotReader reader(snapshot, Isolate::Current()); |
+ Instance& instance = Instance::Handle(); |
+ instance ^= reader.ReadObject(); |
siva
2012/02/18 01:25:55
Ditto comment about any object being send in these
|
+ return instance.raw(); |
+} |
siva
2012/02/18 01:25:55
This function is there in dart_api_impl.cc as well
turnidge
2012/03/07 20:00:14
Agreed. As the next part of the ThreadPool stuff
|
+ |
+ |
+ |
DEFINE_RUNTIME_ENTRY(StackOverflow, 0) { |
ASSERT(arguments.Count() == |
kStackOverflowRuntimeEntry.argument_count()); |
@@ -894,7 +909,27 @@ |
uword interrupt_bits = isolate->GetAndClearInterrupts(); |
if (interrupt_bits & Isolate::kMessageInterrupt) { |
- // UNIMPLEMENTED(); |
+ while (true) { |
+ Message* message = |
+ isolate->message_handler()->queue()->DequeueNoWaitWithPriority( |
+ Message::kOOBPriority); |
siva
2012/02/18 01:25:55
Can one do a DNS style attack here just bombarding
turnidge
2012/03/07 20:00:14
You can only send OOB messages when you can alread
|
+ if (message == NULL) { |
+ // No more OOB messages to handle. |
+ break; |
+ } |
+ const Instance& msg = |
+ Instance::Handle(DeserializeMessage(message->data())); |
+ // For now the only OOB messages are Mirrors messages. |
+ const Object& result = Object::Handle( |
+ DartLibraryCalls::HandleMirrorsMessage( |
+ message->dest_port(), message->reply_port(), msg)); |
+ delete message; |
+ if (result.IsError()) { |
+ // TODO(turnidge): Propagating the error is probably wrong here. |
+ Exceptions::PropagateError(result); |
+ } |
+ ASSERT(result.IsNull()); |
+ } |
} |
if (interrupt_bits & Isolate::kApiInterrupt) { |
Dart_IsolateInterruptCallback callback = isolate->InterruptCallback(); |