From 2e92dcbc799dbb36229a7e90553953db33959adf Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Fri, 25 Mar 2022 10:28:02 -0700 Subject: [PATCH] svfig-talk: more updates --- svfig-talk/svfig-talk.factor | 96 +++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 46 deletions(-) diff --git a/svfig-talk/svfig-talk.factor b/svfig-talk/svfig-talk.factor index abb7cb8..871a48f 100644 --- a/svfig-talk/svfig-talk.factor +++ b/svfig-talk/svfig-talk.factor @@ -201,38 +201,6 @@ CONSTANT: svfig-slides { $code "\"cat\ndog\nfish\" [ readln ] with-string-reader" } } - { $slide "Assembly" - "Access the Time Stamp Counter" - { $code -"HOOK: rdtsc cpu ( -- n ) - -M: x86.32 rdtsc - longlong { } cdecl [ - RDTSC - ] alien-assembly ; - -M: x86.64 rdtsc - longlong { } cdecl [ - RAX 0 MOV - RDTSC - RDX 32 SHL - RAX RDX OR - ] alien-assembly ;" } - } - - { $slide "FFI" - { $code "NAME - sqrt – square root function - -SYNOPSIS - #include - - double - sqrt(double x);" } - "Let's use it!" - { $code "FUNCTION: double sqrt ( double x )" } - } - { $slide "Destructors" "Deterministic resource disposal" "Any step can fail and we don't want to leak resources" @@ -246,17 +214,6 @@ SYNOPSIS } } - { $slide "Infix" - { "Syntax experiments with " { $vocab-link "infix" } } - "Infix word definitions:" - { $code "INFIX:: foo ( x y -- z ) sqrt(x)+y**3 ;" } - "Inline also:" - { $code "[let \"hello\" :> seq" - " [infix seq[::-1] infix]" - "]" - } - } - { $slide "Profiling" { $code ": fib ( m -- n )" @@ -359,9 +316,9 @@ SYNOPSIS "GENERIC: beats? ( obj1 obj2 -- ? )" "" "METHOD: beats? { scissors paper } 2drop t ;" - "METHOD: beats? { rock scissors } 2drop t ;" - "METHOD: beats? { paper rock } 2drop t ;" - "METHOD: beats? { object object } 2drop f ;" + "METHOD: beats? { rock scissors } 2drop t ;" + "METHOD: beats? { paper rock } 2drop t ;" + "METHOD: beats? { object object } 2drop f ;" } } @@ -408,6 +365,49 @@ SYNOPSIS "Object system is entirely implemented in Factor" } + { $slide "Assembly" + "Access the Time Stamp Counter" + { $code +"HOOK: rdtsc cpu ( -- n ) + +M: x86.32 rdtsc + longlong { } cdecl [ + RDTSC + ] alien-assembly ; + +M: x86.64 rdtsc + longlong { } cdecl [ + RAX 0 MOV + RDTSC + RDX 32 SHL + RAX RDX OR + ] alien-assembly ;" } + } + + { $slide "FFI" + { $code "NAME + sqrt – square root function + +SYNOPSIS + #include + + double + sqrt(double x);" } + "Let's use it!" + { $code "FUNCTION: double sqrt ( double x )" } + } + + { $slide "Infix" + { "Syntax experiments with " { $vocab-link "infix" } } + "Infix word definitions:" + { $code "INFIX:: foo ( x y -- z ) sqrt(x)+y**3 ;" } + "Inline also:" + { $code "[let \"hello\" :> seq" + " [infix seq[::-1] infix]" + "]" + } + } + { $slide "Implementation" "VM in C++ (12,000 lines of code)" "VM features primitives, garbage collection, etc." @@ -434,6 +434,10 @@ SYNOPSIS "Maintains stability" } + { $slide "Demo" + "Let's look at a real program!" + } + { $slide "Questions" "It is hard to cover everything in a single talk" "Factor has many cool things that I didn't talk about" -- 2.34.1