Skip to content

Commit 18aa7d3

Browse files
rmacnak-googleCommit Queue
authored andcommitted
[vm] Refactor runtime entries.
- Reduce header surface area. - Remove runtime_entry_<arch>.cc, which no longer include code generation. - Fix signature of DLRT_Enter/ExitSafepoint. - Give non-leaf runtime functions C linkage, as C++ does not have a defined ABI. TEST=ci Change-Id: I21e21a50ad9e4f9b32b1204d755bfa69a2ae9b17 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430981 Commit-Queue: Ryan Macnak <[email protected]> Reviewed-by: Alexander Aprelev <[email protected]>
1 parent d2c0f0a commit 18aa7d3

21 files changed

+286
-509
lines changed

runtime/lib/concurrent.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include "include/dart_api.h"
66
#include "vm/bootstrap_natives.h"
7+
#include "vm/heap/safepoint.h"
78
#include "vm/os_thread.h"
89

910
namespace dart {

runtime/lib/double.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "vm/exceptions.h"
1515
#include "vm/native_entry.h"
1616
#include "vm/object.h"
17-
#include "vm/runtime_entry.h" // DartModulo.
1817
#include "vm/symbols.h"
1918

2019
namespace dart {

runtime/lib/object.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "vm/object.h"
1515
#include "vm/object_store.h"
1616
#include "vm/resolver.h"
17+
#include "vm/runtime_entry.h"
1718
#include "vm/stack_frame.h"
1819
#include "vm/symbols.h"
1920

runtime/vm/compiler/jit/compiler.cc

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -198,25 +198,6 @@ FlowGraph* Compiler::BuildFlowGraph(
198198
return graph;
199199
}
200200

201-
// Compile a function. Should call only if the function has not been compiled.
202-
// Arg0: function object.
203-
DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
204-
ASSERT(thread->IsDartMutatorThread());
205-
const Function& function = Function::CheckedHandle(zone, arguments.ArgAt(0));
206-
207-
{
208-
// Another isolate's mutator thread may have created [function] and
209-
// published it via an ICData, MegamorphicCache etc. Entering the lock below
210-
// is an acquire operation that pairs with the release operation when the
211-
// other isolate exited the lock, ensuring the initializing stores for
212-
// [function] are visible in the current thread.
213-
SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
214-
}
215-
216-
// Will throw if compilation failed (e.g. with compile-time error).
217-
function.EnsureHasCode();
218-
}
219-
220201
bool Compiler::CanOptimizeFunction(Thread* thread, const Function& function) {
221202
#if !defined(PRODUCT)
222203
if (thread->isolate_group()->debugger()->IsDebugging(thread, function)) {
@@ -1224,14 +1205,6 @@ void BackgroundCompiler::Disable() {
12241205

12251206
#else // DART_PRECOMPILED_RUNTIME
12261207

1227-
DEFINE_RUNTIME_ENTRY(CompileFunction, 1) {
1228-
const Function& function = Function::CheckedHandle(zone, arguments.ArgAt(0));
1229-
FATAL("Precompilation missed function %s (%s, %s)\n",
1230-
function.ToLibNamePrefixedQualifiedCString(),
1231-
function.token_pos().ToCString(),
1232-
Function::KindToCString(function.kind()));
1233-
}
1234-
12351208
bool Compiler::IsBackgroundCompilation() {
12361209
return false;
12371210
}

runtime/vm/dart_entry.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "vm/dispatch_table.h"
1111
#include "vm/heap/safepoint.h"
1212
#include "vm/interpreter.h"
13+
#include "vm/log.h"
1314
#include "vm/object_store.h"
1415
#include "vm/resolver.h"
1516
#include "vm/runtime_entry.h"

runtime/vm/heap/pointer_block.cc

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,12 @@
55
#include "vm/heap/pointer_block.h"
66

77
#include "platform/assert.h"
8+
#include "vm/isolate.h"
89
#include "vm/lockers.h"
9-
#include "vm/runtime_entry.h"
10+
#include "vm/thread.h"
1011

1112
namespace dart {
1213

13-
DEFINE_LEAF_RUNTIME_ENTRY(void, StoreBufferBlockProcess, 1, Thread* thread) {
14-
thread->StoreBufferBlockProcess(StoreBuffer::kCheckThreshold);
15-
}
16-
END_LEAF_RUNTIME_ENTRY
17-
18-
DEFINE_LEAF_RUNTIME_ENTRY(void,
19-
OldMarkingStackBlockProcess,
20-
1,
21-
Thread* thread) {
22-
thread->OldMarkingStackBlockProcess();
23-
}
24-
END_LEAF_RUNTIME_ENTRY
25-
26-
DEFINE_LEAF_RUNTIME_ENTRY(void,
27-
NewMarkingStackBlockProcess,
28-
1,
29-
Thread* thread) {
30-
thread->NewMarkingStackBlockProcess();
31-
}
32-
END_LEAF_RUNTIME_ENTRY
33-
3414
template <int BlockSize>
3515
typename BlockStack<BlockSize>::List* BlockStack<BlockSize>::global_empty_ =
3616
nullptr;

runtime/vm/native_entry.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@
66

77
#include "include/dart_api.h"
88

9+
#include "platform/memory_sanitizer.h"
910
#include "vm/bootstrap.h"
1011
#include "vm/code_patcher.h"
1112
#include "vm/dart_api_impl.h"
1213
#include "vm/dart_api_state.h"
14+
#include "vm/exceptions.h"
1315
#include "vm/heap/safepoint.h"
1416
#include "vm/native_symbol.h"
1517
#include "vm/object_store.h"
1618
#include "vm/reusable_handles.h"
19+
#include "vm/runtime_entry.h"
1720
#include "vm/stack_frame.h"
18-
#include "vm/symbols.h"
19-
#include "vm/tags.h"
2021

2122
namespace dart {
2223

runtime/vm/native_entry.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,10 @@
55
#ifndef RUNTIME_VM_NATIVE_ENTRY_H_
66
#define RUNTIME_VM_NATIVE_ENTRY_H_
77

8-
#include "platform/memory_sanitizer.h"
9-
108
#include "vm/allocation.h"
11-
#include "vm/exceptions.h"
12-
#include "vm/heap/verifier.h"
139
#include "vm/log.h"
1410
#include "vm/native_arguments.h"
1511
#include "vm/native_function.h"
16-
#include "vm/runtime_entry.h"
1712

1813
namespace dart {
1914

runtime/vm/object.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class BaseTextBuffer;
259259
OBJECT_SERVICE_SUPPORT(object) \
260260
friend class Object;
261261

262-
extern "C" void DFLRT_ExitSafepoint(NativeArguments __unusable_);
262+
extern "C" void DLRT_ExitSafepoint();
263263

264264
#define HEAP_OBJECT_IMPLEMENTATION(object, super) \
265265
OBJECT_IMPLEMENTATION(object, super); \
@@ -270,7 +270,7 @@ extern "C" void DFLRT_ExitSafepoint(NativeArguments __unusable_);
270270
SNAPSHOT_SUPPORT(object) \
271271
friend class StackFrame; \
272272
friend class Thread; \
273-
friend void DFLRT_ExitSafepoint(NativeArguments __unusable_);
273+
friend void DLRT_ExitSafepoint();
274274

275275
// This macro is used to denote types that do not have a sub-type.
276276
#define FINAL_HEAP_OBJECT_IMPLEMENTATION_HELPER(object, rettype, super) \
@@ -299,7 +299,7 @@ extern "C" void DFLRT_ExitSafepoint(NativeArguments __unusable_);
299299
friend class Object; \
300300
friend class StackFrame; \
301301
friend class Thread; \
302-
friend void DFLRT_ExitSafepoint(NativeArguments __unusable_);
302+
friend void DLRT_ExitSafepoint();
303303

304304
#define FINAL_HEAP_OBJECT_IMPLEMENTATION(object, super) \
305305
FINAL_HEAP_OBJECT_IMPLEMENTATION_HELPER(object, object, super)

runtime/vm/profiler.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "vm/compiler/compiler_state.h"
1515
#endif
1616
#include "vm/debugger.h"
17+
#include "vm/heap/safepoint.h"
1718
#include "vm/instructions.h"
1819
#include "vm/isolate.h"
1920
#include "vm/json_stream.h"

0 commit comments

Comments
 (0)