{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/fletch/issues/49","labels_url":"https://api.github.com/repos/dart-lang/fletch/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/fletch/issues/49/comments","events_url":"https://api.github.com/repos/dart-lang/fletch/issues/49/events","html_url":"https://github.com/dart-lang/fletch/issues/49","id":86821127,"number":49,"title":"../../src/vm/object_memory.cc:105: error: expected: size >= HeapObject::kSize","user":{"login":"lukechurch","id":2978182,"avatar_url":"https://avatars.githubusercontent.com/u/2978182?v=3","gravatar_id":"","url":"https://api.github.com/users/lukechurch","html_url":"https://github.com/lukechurch","followers_url":"https://api.github.com/users/lukechurch/followers","following_url":"https://api.github.com/users/lukechurch/following{/other_user}","gists_url":"https://api.github.com/users/lukechurch/gists{/gist_id}","starred_url":"https://api.github.com/users/lukechurch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukechurch/subscriptions","organizations_url":"https://api.github.com/users/lukechurch/orgs","repos_url":"https://api.github.com/users/lukechurch/repos","events_url":"https://api.github.com/users/lukechurch/events{/privacy}","received_events_url":"https://api.github.com/users/lukechurch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-10T03:33:09Z","updated_at":"2015-06-10T09:04:32Z","closed_at":null,"body":"Considering the following rather long and very snarly code sample:\r\n\r\n```\r\nimport 'dart:math' show Random;\r\n\r\n\r\nclass Mutable {\r\n  int x;\r\n}\r\n\r\nentry(fn) => fn();\r\n\r\nbool isArgumentError(o) => o is ArgumentError;\r\n\r\nmain() {\r\n\r\n  Random r = new Random();\r\n\r\n  List dataSet = [];\r\n  for (int i = 0; i < 1000; i++) {\r\n    var pt = new ImmutablePoint(ImmutableLinkedList.fromList(\r\n      [r.nextInt(2),r.nextInt(2), r.nextInt(2)]));\r\n      dataSet.add(pt);\r\n  }\r\n\r\n  for (int i = 0; i < 1000; i++) {\r\n    var pt = new ImmutablePoint(ImmutableLinkedList.fromList(\r\n      [r.nextInt(2) + 5,r.nextInt(2) +5 , r.nextInt(2) + 5]));\r\n      dataSet.add(pt);\r\n  }\r\n\r\n  var centroidsList = ImmutableLinkedList.fromList([\r\n    new ImmutablePoint(ImmutableLinkedList.fromList([-10,0,0])),\r\n    new ImmutablePoint(ImmutableLinkedList.fromList([0,15,0])),\r\n    ]);\r\n\r\n\r\n  allocate(ImmutablePoint pt) {\r\n    int bestDistance = 2147483647;\r\n    ImmutablePoint allocation = null;\r\n\r\n    for (var centroid in centroidsList.toMutable()) {\r\n      int distance = centroid.subtract(pt).magnitudeSq;\r\n\r\n      if (distance < bestDistance) {\r\n        allocation = centroid;\r\n        bestDistance = distance;\r\n      }\r\n    }\r\n    return new ImmutableAllocation(pt, allocation);\r\n  }\r\n\r\nprint ('about to run');\r\n  print( parallel.map(allocate)(dataSet));\r\n}\r\n\r\nconst Parallel parallel = const Parallel();\r\n\r\nclass Parallel implements Function {\r\n  const Parallel();\r\n  Iterable call(Iterable values) => values;\r\n  Parallel map(fn(value)) => new _ParallelMap(this, fn);\r\n}\r\n\r\nclass _ParallelMap extends Parallel {\r\n  final Parallel _link;\r\n  final Function _fn;\r\n  const _ParallelMap(this._link, this._fn);\r\n\r\n  Iterable call(Iterable values) {\r\n    final Function fn = _fn;\r\n    List fns = _link(values).map((final e) => () => fn(e)).toList();\r\n    return Process.divide(_entry, fns);\r\n  }\r\n\r\n  static _entry(fn) => fn();\r\n}\r\n\r\n\r\nclass ImmutablePoint {\r\n  final ImmutableLinkedList coords;\r\n  const ImmutablePoint(this.coords);\r\n\r\n  ImmutableVector subtract(ImmutablePoint pt) {\r\n\r\n    List localCoords = coords.toMutable();\r\n    List ptCoords = pt.coords.toMutable();\r\n\r\n    List ret = [];\r\n    for (int i = 0; i < localCoords.length; i++){\r\n      ret.add(localCoords[i] - ptCoords[i]);\r\n    }\r\n    return new ImmutableVector(ImmutableLinkedList.fromList(ret));\r\n  }\r\n\r\n  toString() {\r\n    return coords.toMutable().toString();\r\n  }\r\n}\r\n\r\nclass ImmutableVector {\r\n  final ImmutableLinkedList args;\r\n  const ImmutableVector(this.args);\r\n\r\n  get magnitudeSq {\r\n    ImmutableLinkedList pointer = args;\r\n    int acc = 0;\r\n\r\n    while (pointer != null) {\r\n      var data = pointer.data;\r\n      acc += data * data;\r\n      pointer = pointer.next;\r\n    }\r\n    return acc;\r\n  }\r\n\r\n  String toString() {\r\n    return args.toString();\r\n  }\r\n}\r\n\r\nclass ImmutableLinkedList {\r\n  final ImmutableLinkedList next;\r\n  final int data;\r\n  const ImmutableLinkedList(this.data, this.next);\r\n\r\n  toString() {\r\n    StringBuffer sb = new StringBuffer();\r\n    ImmutableLinkedList pointer = this;\r\n    while (pointer.next != null) {\r\n      sb.write(\"${pointer.data}, \");\r\n      pointer = pointer.next;\r\n    }\r\n    sb.write(\"${pointer.data}\");\r\n    return sb.toString();\r\n  }\r\n\r\n  static ImmutableLinkedList fromList(List data) {\r\n    var reversed = data.reversed.toList();\r\n    ImmutableLinkedList node = new ImmutableLinkedList(reversed.first, null);\r\n    for (int i = 1; i < data.length; i++) {\r\n      node = new ImmutableLinkedList(reversed[i], node);\r\n    }\r\n    return node;\r\n  }\r\n\r\n  List toMutable() {\r\n    List builder = [];\r\n    ImmutableLinkedList pointer = this;\r\n    while (pointer.next != null) {\r\n      builder.add(pointer.data);\r\n      pointer = pointer.next;\r\n    }\r\n    builder.add(pointer.data);\r\n    return builder;\r\n  }\r\n}\r\n\r\n\r\nclass ImmutableAllocation {\r\n  final ImmutablePoint pt;\r\n  final ImmutablePoint centroid;\r\n\r\n  const ImmutableAllocation(this.pt, this.centroid);\r\n\r\n  toString() => \"$pt -> $centroid\";\r\n}\r\n```\r\n\r\nIf you remove the last line overriding toString, execute completes.\r\n\r\nWith the addition of this line, the result becomes:\r\n\r\n../../src/vm/object_memory.cc:105: error: expected: size >= HeapObject::kSize\r\nNon-zero exit code from '/Users/lukechurch/GitRepos/fletch-repo/fletch/out/DebugX64Clang/fletch-vm' (-6).\r\nAbort trap: 6\r\n"},"comment":{"url":"https://api.github.com/repos/dart-lang/fletch/issues/comments/110662158","html_url":"https://github.com/dart-lang/fletch/issues/49#issuecomment-110662158","issue_url":"https://api.github.com/repos/dart-lang/fletch/issues/49","id":110662158,"user":{"login":"lukechurch","id":2978182,"avatar_url":"https://avatars.githubusercontent.com/u/2978182?v=3","gravatar_id":"","url":"https://api.github.com/users/lukechurch","html_url":"https://github.com/lukechurch","followers_url":"https://api.github.com/users/lukechurch/followers","following_url":"https://api.github.com/users/lukechurch/following{/other_user}","gists_url":"https://api.github.com/users/lukechurch/gists{/gist_id}","starred_url":"https://api.github.com/users/lukechurch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukechurch/subscriptions","organizations_url":"https://api.github.com/users/lukechurch/orgs","repos_url":"https://api.github.com/users/lukechurch/repos","events_url":"https://api.github.com/users/lukechurch/events{/privacy}","received_events_url":"https://api.github.com/users/lukechurch/received_events","type":"User","site_admin":false},"created_at":"2015-06-10T09:04:32Z","updated_at":"2015-06-10T09:04:32Z","body":"@madsager Interesting, I can reproduce this on the branch associated with this CL: https://codereview.chromium.org/1177583002 but not on tip of tree. Which presumably means that its something to do with the way I'm generating the numbers that will hopefully go away when I address Anders' suggestion of a Dart only implementation. \r\n\r\nHowever, I don't see why that change would cause this issue. I'm fine with closing for now and reopening, otherwise repo steps are to pull that branch, save the contents to km.dart and run on OS X the equivalent of:\r\n\r\n~/GitRepos/fletch-repo/fletch/out/DebugX64Clang/fletch compile-and-run km.dart"}}