| OLD | NEW |
| 1 // Copyright (c) 2014, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Fletch project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #include "src/vm/process.h" | 5 #include "src/vm/process.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include "src/shared/bytecodes.h" | 10 #include "src/shared/bytecodes.h" |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 break; | 874 break; |
| 875 } | 875 } |
| 876 | 876 |
| 877 case PortQueue::LARGE_INTEGER: | 877 case PortQueue::LARGE_INTEGER: |
| 878 result = process->NewInteger(queue->value()); | 878 result = process->NewInteger(queue->value()); |
| 879 if (result == Failure::retry_after_gc()) return result; | 879 if (result == Failure::retry_after_gc()) return result; |
| 880 break; | 880 break; |
| 881 | 881 |
| 882 case PortQueue::FOREIGN: | 882 case PortQueue::FOREIGN: |
| 883 case PortQueue::FOREIGN_FINALIZED: { | 883 case PortQueue::FOREIGN_FINALIZED: { |
| 884 Class* foreign_class = process->program()->foreign_class(); | 884 Class* foreignmemory_class = process->program()->foreignmemory_class(); |
| 885 ASSERT(foreign_class->NumberOfInstanceFields() == 2); | 885 ASSERT(foreignmemory_class->NumberOfInstanceFields() == 2); |
| 886 Object* object = process->NewInstance(foreign_class); | 886 Object* object = process->NewInstance(foreignmemory_class); |
| 887 if (object == Failure::retry_after_gc()) return object; | 887 if (object == Failure::retry_after_gc()) return object; |
| 888 Instance* foreign = Instance::cast(object); | 888 Instance* foreign = Instance::cast(object); |
| 889 uword address = queue->address(); | 889 uword address = queue->address(); |
| 890 // TODO(ager): Two allocations in a native doesn't work with | 890 // TODO(ager): Two allocations in a native doesn't work with |
| 891 // the retry after gc strategy. We should restructure. | 891 // the retry after gc strategy. We should restructure. |
| 892 object = process->ToInteger(address); | 892 object = process->ToInteger(address); |
| 893 if (object == Failure::retry_after_gc()) return object; | 893 if (object == Failure::retry_after_gc()) return object; |
| 894 foreign->SetInstanceField(0, object); | 894 foreign->SetInstanceField(0, object); |
| 895 foreign->SetInstanceField(1, Smi::FromWord(queue->size())); | 895 foreign->SetInstanceField(1, Smi::FromWord(queue->size())); |
| 896 if (kind == PortQueue::FOREIGN_FINALIZED) { | 896 if (kind == PortQueue::FOREIGN_FINALIZED) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 926 while (queue != NULL) { | 926 while (queue != NULL) { |
| 927 Instance* channel = queue->port()->channel(); | 927 Instance* channel = queue->port()->channel(); |
| 928 if (channel != NULL) return channel; | 928 if (channel != NULL) return channel; |
| 929 process->AdvanceCurrentMessage(); | 929 process->AdvanceCurrentMessage(); |
| 930 queue = process->CurrentMessage(); | 930 queue = process->CurrentMessage(); |
| 931 } | 931 } |
| 932 return process->program()->null_object(); | 932 return process->program()->null_object(); |
| 933 } | 933 } |
| 934 | 934 |
| 935 } // namespace fletch | 935 } // namespace fletch |
| OLD | NEW |