Files
sdk/runtime/vm/code_patcher.h
T
kmillikin@google.com 8c4e214722 Pass IC data and arguments descriptor to IC miss runtime functions.
Before, we obtained them by pattern matching backwards on the machine
instructions at the call site.  This previous approach becomes unwieldy when
we need to use to use multiple instance call patterns.

R=vegorov@google.com
BUG=

Review URL: https://codereview.chromium.org//11438017

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15737 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-05 15:35:18 +00:00

64 lines
1.9 KiB
C++

// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Class for patching compiled code.
#ifndef VM_CODE_PATCHER_H_
#define VM_CODE_PATCHER_H_
#include "vm/allocation.h"
namespace dart {
// Forward declaration.
class Array;
class Code;
class ExternalLabel;
class Function;
class ICData;
class RawArray;
class RawICData;
class String;
class CodePatcher : public AllStatic {
public:
// Dart static calls have a distinct, machine-dependent code pattern.
// Patch static call to the new target.
static void PatchStaticCallAt(uword addr, uword new_target_address);
// Patch instance call to the new target.
static void PatchInstanceCallAt(uword addr, uword new_target_address);
// Patch entry point with a jump as specified in the code's patch region.
static void PatchEntry(const Code& code);
// Restore entry point with original code (i.e., before patching).
static void RestoreEntry(const Code& code);
// Returns true if the code can be patched with a jump at beginnning (checks
// that there are no conflicts with object pointers). Used in ASSERTs.
static bool CodeIsPatchable(const Code& code);
// Returns true if the code before return_address is a static
// or dynamic Dart call.
static bool IsDartCall(uword return_address);
static uword GetStaticCallTargetAt(uword return_address);
// Get instance call information. Returns the call target and sets each
// of the output parameters ic_data and arguments_descriptor if they are
// non-NULL.
static uword GetInstanceCallAt(uword return_address,
ICData* ic_data,
Array* arguments_descriptor);
static intptr_t InstanceCallSizeInBytes();
static void InsertCallAt(uword start, uword target);
};
} // namespace dart
#endif // VM_CODE_PATCHER_H_