| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino 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/ffi.h" | 5 #include "src/vm/ffi.h" |
| 6 | 6 |
| 7 #include "src/shared/asan_helper.h" | 7 #include "src/shared/asan_helper.h" |
| 8 #include "src/vm/natives.h" | 8 #include "src/vm/natives.h" |
| 9 #include "src/vm/object.h" | 9 #include "src/vm/object.h" |
| 10 #include "src/vm/port.h" | 10 #include "src/vm/port.h" |
| 11 #include "src/vm/process.h" | 11 #include "src/vm/process.h" |
| 12 | 12 |
| 13 namespace fletch { | 13 namespace dartino { |
| 14 | 14 |
| 15 BEGIN_NATIVE(ForeignAllocate) { | 15 BEGIN_NATIVE(ForeignAllocate) { |
| 16 if (!arguments[0]->IsSmi() && !arguments[0]->IsLargeInteger()) { | 16 if (!arguments[0]->IsSmi() && !arguments[0]->IsLargeInteger()) { |
| 17 return Failure::wrong_argument_type(); | 17 return Failure::wrong_argument_type(); |
| 18 } | 18 } |
| 19 word size = AsForeignWord(arguments[0]); | 19 word size = AsForeignWord(arguments[0]); |
| 20 Object* result = process->NewInteger(0); | 20 Object* result = process->NewInteger(0); |
| 21 if (result->IsRetryAfterGCFailure()) return result; | 21 if (result->IsRetryAfterGCFailure()) return result; |
| 22 void* calloc_value = calloc(1, size); | 22 void* calloc_value = calloc(1, size); |
| 23 uint64 value = reinterpret_cast<uint64>(calloc_value); | 23 uint64 value = reinterpret_cast<uint64>(calloc_value); |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 *address = Double::cast(value)->value(); \ | 413 *address = Double::cast(value)->value(); \ |
| 414 return value; \ | 414 return value; \ |
| 415 } \ | 415 } \ |
| 416 END_NATIVE() | 416 END_NATIVE() |
| 417 | 417 |
| 418 DEFINE_FOREIGN_ACCESSORS_DOUBLE(Float32, float) | 418 DEFINE_FOREIGN_ACCESSORS_DOUBLE(Float32, float) |
| 419 DEFINE_FOREIGN_ACCESSORS_DOUBLE(Float64, double) | 419 DEFINE_FOREIGN_ACCESSORS_DOUBLE(Float64, double) |
| 420 | 420 |
| 421 #undef DEFINE_FOREIGN_ACCESSORS | 421 #undef DEFINE_FOREIGN_ACCESSORS |
| 422 | 422 |
| 423 } // namespace fletch | 423 } // namespace dartino |
| OLD | NEW |