Commit graph

28 commits

Author SHA1 Message Date
Florian Schneider bac82e2592 VM: New calling convention for generated code.
Instead of calling code object directly, call indirectly and
pass the code object in a register. The object pool is then loaded from
the code object. This is another preparation step for making generated code
relocatable.

All non-ia32 platforms:
No entry patching.

ARM:
PC marker (now code object) moves to the same place as on x64 (below saved PP, above saved FP).
R9 is now used as PP, R10 as CODE_REG.

BUG=
R=koda@google.com, rmacnak@google.com

Committed: 1d343e5a7b

Review URL: https://codereview.chromium.org//1192103004 .
2015-09-19 13:21:09 +02:00
Florian Schneider 7af7a2db87 Revert "VM: New calling convention for generated code."
This reverts commit 1d343e5a7b.

Because of Windows test failures.

BUG=
TBR=whesse@google.com

Review URL: https://codereview.chromium.org//1343373003 .
2015-09-16 13:46:05 +02:00
Florian Schneider 1d343e5a7b VM: New calling convention for generated code.
Instead of calling code object directly, call indirectly and
pass the code object in a register. The object pool is then loaded from
the code object. This is another preparation step for making generated code
relocatable.

All non-ia32 platforms:
No entry patching.

ARM:
PC marker (now code object) moves to the same place as on x64 (below saved PP, above saved FP).
R9 is now used as PP, R10 as CODE_REG.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1192103004 .
2015-09-16 13:05:58 +02:00
Florian Schneider 63a8e5227d VM: More abstract interface for generating stub calls.
This makes the code in the code generator independent from how stubs
are actually called (i.e. directly embedding the target address, or
indirectly by loading the target address from the code object).

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1270803003 .
2015-08-05 10:18:35 +02:00
Florian Schneider 8d38a58c18 Make array allocation stub shared between isolates.
This allows to make the last explicitly named stubs shared between isolates.

When sharing code stubs, we can't do patching at their entry anymore.
Therefore, I had to remove patching support of the array allocation stub.
Is this a functionality we want to keep?

The change is mostly performance-neutral because optimized code has an inlined fast
path for array allocation and only uses the stub for the slow-case.

The only isolate-specific stubs left are object allocation stubs which are
associated with their Class are per-isolate.

Since this CL removes any isolate-specific stubs from StubCode, it becomes AllStatic.

BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org//1247783002 .
2015-07-23 12:56:16 +02:00
Florian Schneider e0621416f8 Remove unused pc descriptor types.
kClosureCall and kOptStaticCall are not needed anymore.
Closure calls are implemented as instance calls - the ClosureCall instruction
 only occurs in the synthetic FunctionImpl.call dispatcher - and does not correspond
to a source location where breakpoints can be set.

kOptStaticCall is not needed because breakpoints can only be set in unoptimized
code. kOther is used instead.

This also removes an unused PC descriptor at closure calls from unoptimized
code.

BUG=
R=vegorov@google.com

Review URL: https://codereview.chromium.org//1160063002
2015-05-28 14:27:37 +02:00
Florian Schneider 9191b76fd2 VM: Set breakpoints on x64 and arm64 without patching code.
Instead of changing the generated code, change the target of calls
by changing the corresponding entry in the constant pool. Patchable
call sites can't share constant pool entries for now.
x64 and arm64 already had support for patching call targets in the
constant pool, but the debugger used to change the code instead.

This eliminates the fixed debugger stub entries in every constant pool.

R=hausner@google.com

Review URL: https://codereview.chromium.org//1137313002
2015-05-18 15:03:02 +02:00
fschneider@google.com 7bec3edaef Remove saving/restoring of the context at function entry.
This is not needed anymore after I changed the current context
to always reside in a local variable.

Further simplifications and cleanup in the debugger.

This also fixes a bad memory retention problem with
non-capturing closures.

BUG=dartbug.com/18886
TEST=tests/language/vm/closure_memory_retention_test.dart
R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41433 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-31 07:35:51 +00:00
rmacnak@google.com fbe77f8ab4 Specialize breakpoint stubs by set of live registers of the stubs they are intercepting.
Trades space in the constant pool for space at call sites.

R=fschneider@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38205 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-14 19:38:11 +00:00
srdjan@google.com 2bb77cd8d5 Iterate over PcDescriptors only via iterators, not via an index. (preparation for more compression of PcDescriptors).
R=asiva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38032 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-07 18:25:45 +00:00
fschneider@google.com 0d82ac5c05 Remove unused pc-descriptor kind kReturn.
This kind is not needed since the only place where it is used
can be just replaced with kRuntimeCall as it behaves the same.

R=hausner@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37592 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-23 10:50:50 +00:00
fschneider@google.com d6178535b2 Landing: Write protect executable pages in the VM.
Change executable pages to be read/execute but not writable by default.

All pages are made temporarily writable just before a full GC, because both
the mark and sweep phases write to the pages. When allocating in a page and
when patching code, the pages are made temporarily writable.

The order of allocation of Code and Instructions objects is changed so that
a GC will not occur after Instructions is allocated. (A full GC would
render the Instructions unwritable.) A scoped object is used to make memory
protection simpler.

Original CL: https://codereview.chromium.org/106593002/

I added a cc test that is expected to crash.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32493 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-10 12:18:06 +00:00
hausner@google.com 682855e8cc Ensure the debugger keeps a reference to code objects
Keep the code object in a breakpoint object rather than the
function object. This ensures that the GC can’t collect the
code object while there are breakpoints for the function.

R=zra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32006 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-24 23:55:11 +00:00
hausner@google.com a65c571f18 Get rid of dynamic call debug stub
This leaves only one debugger stub function. Yay.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31932 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-17 21:32:58 +00:00
hausner@google.com 06da68b5aa Eliminate another debugger stub
This change replaces https://codereview.chromium.org/135213002/

The specialized debugger stub call for static method calls is
no longer needed. It was introduced because once upon a time, the
static method call stub used to patch the call site when the target
was compiled. The VM stopped patching unoptimized static calls a
long time ago. Thus we can treat a static call like a regular runtime
call when patching it to set a breakpoint.

Bonus fix: single step runtime callback on mips was broken. The
enter/leave stub frame were missing.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31928 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-17 19:09:46 +00:00
hausner@google.com b4f0bf5998 Fix debugger stub patching on x64 architecture
Instead of patching the entry in the object pool, patch the offset
into the pool at the call site.

SIMARM and SIMMIPS will have to be fixed the same way in a later change.

R=iposva@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31812 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-14 23:27:13 +00:00
hausner@google.com c571528323 Make return statements single steppable
Replace the code smashing breakpoints at function returns with a call
to a runtime stub that checks whether the debugger is single stepping.
The call to the stub is only emitted in unoptimized code.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31435 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-02 23:31:52 +00:00
turnidge@google.com b15b2931e0 Allow the debugger to inspect local variables from optimized and
inlined frames.

------------

Most remaining deoptimization code from the code generator moves to
DeoptContext.  This allows the code to be reused by the debugger.
There is some rework of the code along the way.  The remaining code in
the code generator is simpler.

Implement the ability to deopt a frame to an Array.  Each inlined
frame accesses its locals from this array at some fixed offset.

Refactor the Debugger::CollectStackTrace code.  New code is int
Debugger::CollectStackTraceNew.  There is a flag --use_new_stacktrace
which can be used to revert back to the old version.  I intend to
remove this flag shortly, after any dust clears.

Added a unit test which makes sure that we can inspect locals from
optimized and inlined frames.  Tested this code in the dart editor
debugger as well.

R=iposva@google.com, srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28468 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-10 18:15:53 +00:00
zra@google.com df2054dae7 Sets a register aside on x64 for use as a pool-pointer. It is loaded and restored from the code object on Frame entry and exit. All LoadObject calls that can, and many calls and jumps through ExternalLabels now use the pool-pointer. The --compiler-stats flag when running dart2js indicates that code size is reduced ~13%, and more is probably possible.
R=fschneider@google.com, srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27295 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-09 15:39:26 +00:00
hausner@google.com 80c7ad1070 Implement breakpoint for closure calls
Introduce a new PcDescriptor kind to distinguish closure calls from other runtime calls. The debugger can patch these calls to set a breakpoint. When stepping into a closure call, the debugger must fish out the closure object from the stack, find the function and set breakpoints in it.

Arm and Mips breakpoint stubs are not implemented yet. ia32 and x64 stubs tested by hand. Automated test to follow.

R=srdjan@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22596 260f80e4-7a28-3924-810f-c04153c831b5
2013-05-10 21:06:04 +00:00
regis@google.com ad6005e5c4 Support debugger API on ARM.
Support smull ARM instruction in order to detect 32-bit multiplication overflow.
Enable debugger api tests on ARM.
Enable isolate tests on ARM.
Enable code descriptors tests on ARM.
Enable snapshot tests on ARM.
Enable heap tests on ARM.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21890 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-23 16:10:22 +00:00
vegorov@google.com 2935029239 Implement ActivationFrame::GetLocalVarValue on x64.
R=iposva@google.com
BUG=3961
TEST=Debug_ExprClosureBreakpoint

Review URL: https://chromiumcodereview.appspot.com//10702068

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9334 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-03 09:31:44 +00:00
regis@google.com d1d3235013 Modify 'movq reg, reg' encoding in 64-bit code.
Use 0x89 encoding (instead of 0x8B encoding), which is expected by gdb64
older than 7.3.1-gg5 when disassembling a function's prolog (movq rbp, rsp)
for proper unwinding of Dart frames (use --generate_gdb_symbols and -O0).
Review URL: https://chromiumcodereview.appspot.com//10052013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6422 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-11 18:13:09 +00:00
hausner@google.com de3cf9e2bd Teach debugger to ignore breakpoints
Reentrant debugger calls to fetch values may execute dart code as a
side effect. Teach the debugger to ignore any breakpoints it might
hit while doing so.
Review URL: https://chromiumcodereview.appspot.com//9668036

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5274 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-10 00:43:08 +00:00
hausner@google.com e58b6e4d4c Splitting debugger breakpoints into two parts
Splitting breakpoints into SourceBreakpoint that represent
a user-defined source location of a breakpoint, and
CodeBreakpoint, which represents a code location. There can
be more than one CodeBreakpoint per SourceBreakpoint, e.g.
for functions that are also called as closures (and are thus
compiled twice.)

Functions are no longer compiled as a side effect of setting
a breakpoint. When they eventually get compiled, the previously
recorded SourceBreakpoint is found and a CodeBreakpoint is set.
Review URL: https://chromiumcodereview.appspot.com//9581013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4891 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-02 18:01:38 +00:00
hausner@google.com 6d9abc5e3b StepOver, StepInto, StepOut
Implement single stepping in the debugger.
- Add PC descriptors for function return
- functions to set temporary breakpoints on all
  locations in a function.
- patching/restoring of function return code pattern
- determine call target of instance calls
Review URL: https://chromiumcodereview.appspot.com//9484002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4639 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-27 22:00:28 +00:00
hausner@google.com 16e94a3109 Fix linux build
Picky compiler.
Review URL: http://codereview.chromium.org//9016032

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2737 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-22 00:21:41 +00:00
hausner@google.com 44376ee4a5 Retrieve value of local variables in stack frames.
Works for stack-based variables. Need more work to distinguish between
stack and context (captured) variables.
 
Review URL: http://codereview.chromium.org//9019029

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2736 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-22 00:17:15 +00:00