Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/perl
my $data = <DATA>;
chomp($data);
for my $i (0..31) {
my $width = 96 + $i * 2;
my $height = int(16384 / $width);
open(STDOUT, ">", "/tmp/out$width.pgm") or die;
@hotsphink
hotsphink / gc-embed.md
Last active June 27, 2018 19:37
Spidermonkey GC API for Embedders

Embedding Spidermonkey GC: Managing pointers into the GC heap

When you have GC pointers (pointers to JS objects, strings, etc.; anything stored directly in the GC heap), you need to handle them specially if they could ever be alive (still valid/reachable) during a collection. I'll first describe what you need to do, then how to do it, and finally why and what happens if you get it wrong.

  • tracing - strong GC references (eg a struct member containing a GC pointer) must be traced so that the GC knows what to keep alive.

  • pre-write barriers aka delete barriers - if you overwrite a GC pointer, you'll need to let the GC know.

  • post-write barriers - after storing a GC pointer somewhere, you need to inform the GC of the new value (or more specifically, the address of the new value or the address of something it knows how to scan to find the value.)

@hotsphink
hotsphink / text.txt
Created September 18, 2018 16:28
mkgist-created gist
#185249 = void js::gc::GCRuntime::gcSlice(uint32, int64)
#185241 = void js::gc::GCRuntime::collect(uint8, js::SliceBudget, uint32)
#185230 = uint32 js::gc::GCRuntime::gcCycle(uint8, js::SliceBudget*, uint32)
#185190 = uint32 js::gc::GCRuntime::incrementalCollectSlice(js::SliceBudget*, uint32, js::gc::AutoGCSession*)
#185175 = uint32 js::gc::GCRuntime::compactPhase(uint32, js::SliceBudget*, js::gc::AutoGCSession*)
#184695 = void js::gc::GCRuntime::updateZonePointersToRelocatedCells(JS::Zone*)
#184619 = void js::gc::GCRuntime::sweepZoneAfterCompacting(JS::Zone*)
#140061 = void JS::Realm::sweepSelfHostingScriptSource()
#140064 = void js::ReadBarriered<T>::set(const T&) [with T = js::ScriptSourceObject*]
#52176 = void js::ReadBarrieredBase<T>::post(const T&, const T&) [with T = js::ScriptSourceObject*]
@hotsphink
hotsphink / text.txt
Created September 18, 2018 16:39
mkgist-created gist
zoofer
@hotsphink
hotsphink / text.txt
Created September 18, 2018 16:44
mkgist-created gist
zoofer
@hotsphink
hotsphink / text.txt
Created September 18, 2018 16:45
mkgist-created gist
zoofer
@hotsphink
hotsphink / text.txt
Created September 18, 2018 16:46
mkgist-created gist
zoofer
@hotsphink
hotsphink / text.txt
Created September 18, 2018 16:47
mkgist-created gist
zoofer
@hotsphink
hotsphink / text.txt
Created September 18, 2018 16:48
mkgist-created gist
zoofer
@hotsphink
hotsphink / text.txt
Created October 2, 2018 21:40
mkgist-created gist
This file has been truncated, but you can view the full file.
1 : 509 - mozilla::LinkedList<T>::~LinkedList() [with T = mozilla::SegmentedVector<RefPtr<mozilla::WebGLSync>, $ul, mozilla::MallocAllocPolicy>::SegmentImpl<$ul>]
1 : 1 - static constexpr const _Inherited& std::_Tuple_impl<_Idx, _Head, _Tail ...>::_M_tail(const std::_Tuple_impl<_Idx, _Head, _Tail ...>&) [with long unsigned int _Idx = $ul; _Head = testing::Matcher<long long unsigned int>; _Tail = {testing::Matcher<int>, testing::Matcher<int>, testing::Matcher<long int>}; std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Inherited = std::_Tuple_impl<$ul, testing::Matcher<int>, testing::Matcher<int>, testing::Matcher<long int> >]
1 : 509 - mozilla::LinkedListElement<T>::~LinkedListElement() [with T = mozilla::SegmentedVector<RefPtr<mozilla::WebGLExtensionCompressedTexturePVRTC>, $ul, mozilla::MallocAllocPolicy>::SegmentImpl<$ul>]
1 : 509 - void mozilla::LinkedListElement<T>::setPreviousUnsafe(mozilla::LinkedListElement<T>::RawType) [with T = mozilla::SegmentedVector<RefPtr<mozilla::DOMSVGPathSegLinetoHorizontalAbs>, $u