| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Use JS_BASE_PATH env var to set base's shim directory (js_base for now)
Also minor other changes
|
|
|
|
|
|
|
|
| |
We implemented a workaround for shims that modified the dynflags
includePaths so that the JS backend would find the rts.h file during CPP
of shims. Since aebcca98 this is no longer required because we've
removed the need for rts.h completely. Thus, this commit reverts that
modification.
|
|
|
|
|
| |
Also fix the rendering of missing primops (they must be z-encoded to
avoid having a "#" in their JS name)
|
|
|
|
|
|
|
|
|
|
| |
Document and refactor renderLinker
Split collectDeps
Fix collectDeps
Fix linker stats rendering
|
|
|
|
| |
Some cleanup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GHCJS uses JS files for primitive things like the GC and RTS. We call
these JS files "shims". This sequence of commits adds shims from JS and
includes them for linking. In addition the shim directory is controlled
via an evironment variable JS_RTS_PATH...at least for now.
Linker: implement tryReadShimFile
Linker: link with shims provided via an env variable
Use JS_RTS_PATH to provide a directory into which .js and .js.pp files
will be linked into rts.js
JS.Linker: add js dir at root, fix js cpp includes
JS.gc.pp: remove variadic macro
JS.RTS: add rts JS shims files, remove shim CPP
RTS: remove the need for rts.h and add rts JS files
rts.h only contained a few constants duplicated in the codegen. Let's
use the Haskell version as the single source of truth and pass defined
values explicitly to cpp command line ("-DXYZ=abc" arguments).
Also switch from "raw" (use_cpp_and_not_cc_dash_E = True) to the
opposite: in both case we call "cc -E" (meh), but with False the
preprocessor doesn't choke one varargs in macros.
RTS: remove integer.js.pp
We use the native ghc-bignum backend, so we don't need the GMP
compatible JS code.
In addition, this code was failing to run as it requires the JSBN
(https://www.npmjs.com/package/jsbn) "Javascript big number" library,
which we don't necessarily have installed.
RTS: fix typo in field name
RTS: generate CPP macros in Haskell
RTS: share common CPP def into CAFs
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
First rebase of the JS-Backend. This rebase includes the JS backend
combined with !7442 (new backend design). Unfortunately we have to short
circuit the new backend design because the JS backend takes over after
STG and not after StgToCmm.
What's working:
- hadrian builds JS backend
- JS backend outputs .js files and "links" them
What still has to be done:
- JS backend is missing core js libraries as we add these we
discover bugs in the linker and js rts.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
- deduplicate code that was copied from old GHC
- explicitly add preloadUnits to the link
- avoid calling getShims
|
| |
|
|
|
|
|
|
|
|
|
|
| |
JS-backend: Add documentation headers
Docs: JS.Syntax done
Docs: JS.Make done
Docs: JS.Make JS.Syntax refined a bit
|
| |
|
|
|
|
| |
They will be replaced by ghc-prim, base, template-haskell, etc.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
JS.Linker.Types: Add newGhcjsEnv function
JS.UnitUtils: fix encodeModule api
JS.Linker: more removal of HscEnv
JS.Linker: hooked into GHC.Driver.Pipeline
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
JS: initialize Linker, DynamicLinking
JS.Printer: adapted to GHC Head
JS.Printer: some cleanup and init Printer
StgToJS.Printer: Compiles
JS.Linker: Add types, expose JS keywords
JS.Syntax: add Binary instance on Ident's
JS.Linker: Migrate more Types to Data.Binary
JS.Linker.Types: compiles and adapted to GHC Head
JS.Linker.Types: compiles
JS.Linker.Types: add UseBase type
JS.Linker: Comments and Cleanup
JS.Linker.Types: add TH types, Env type, DepsLoc
JS.Linker: more FIXMEs numerous Linker fixes
JS.Linker: removed Text references
JS.UnitUtils: add package related helper functions
JS.Linker: more DynFlags removal
JS.Linker: Time for semantic errors
JS.Linker: DynFlags finally removed
JS.Linker: 107 compile errors to go
JS.Linker.Utils: initialized, adapted to GHC Head
JS.Linker.Utils: initialize Utils module
JS.Linker.Utils: more utils
JS.Rts: move rtsText to Rts
JS.Linker: linkerStats implemented
JS.Compactor: compiles, adapted to GHC Head
JS.Compactor: have to retrofit compact for linker
JS.Linker.Compactor: unwinding lenses
JS.Linker.Compactor: comments over addItem
JS.Linker.Compactor: Lenses removed
JS.Linker.Compactor: SHA256 removed
JS.Linker.Compactor: only missing instances left
JS.Linker.Compactor: compiles
JS.Linker: compiles, adapted to ghc Head
JS.Linker: More progress
JS.Linker: link in memory compiles
JS.Linker: just shims left
JS.Linker.DynamicLinking compiles: adapted to head
JS.Linker.DynamicLinking: initialization
JS.Linker.DynamicLinking: compiles up to Variants
JS.Variants: initialize
JS.Linker: numerous and various fixes
JS.Linker.DynamicLinking: only small errors left
JS.Linker.Archive: compiles, adapted to GHC Head
JS.Linker: initialize Archive compat module
JS.Linker.Archive: minor fixes
JS.Linker.DynamicLinking: compiles
JS.Linker: cleanup, remove Variants, add comments
fixup: more cleanup
JS.Linker: more cleanup and comments
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
FFI: don't crash on JavaScript foreign imports
Note that they are still not desugared properly!!
But the following cmd doesn't crash anymore:
ghc -fjavascript Test.hs -fforce-recomp -ddump-tc -fno-code -ddump-ds
FFI: adapt GHCJS desugarer
FFI: support direct application
The following example:
foo :: Int# -> Int#
foo = add 50000#
foreign import javascript
"(function(x,y) { return (x + y) })"
add :: Int# -> Int# -> Int#
is compiled into an application like this:
var h$mainZCMzifoozur2_e;
h$mainZCMzifoozur2_e = (function()
{
var h$mainZCMziaddzur1;
h$mainZCMziaddzur1 = h$r1.d1;
var h$$mainZCMzietazuB0_8KXnScrCjF5;
h$$mainZCMzietazuB0_8KXnScrCjF5 = h$r2;
h$r3 = h$$mainZCMzietazuB0_8KXnScrCjF5;
h$r2 = 50000;
h$r1 = h$mainZCMziaddzur1;
return h$ap_2_2_fast();
return h$rs();
});
var h$mainZCMziaddzur1_e;
h$mainZCMziaddzur1_e = (function()
{
var h$$mainZCMzidszusAk_236l8r0P8S9;
h$$mainZCMzidszusAk_236l8r0P8S9 = h$r2;
var h$$mainZCMzids1zusAl_336l8r0P8S9;
h$$mainZCMzids1zusAl_336l8r0P8S9 = h$r3;
var h$$mainZCM_2;
var h$$mainZCMziwildzusAn_536l8r0P8S9;
try
{
h$$mainZCMziwildzusAn_536l8r0P8S9 = (function(x,y) { return (x + y) })(h$$mainZCMzidszusAk_236l8r0P8S9, h$$mainZCMzids1zusAl_336l8r0P8S9)
}
catch(except)
{
return h$throwJSException(except)
};
var h$$mainZCMzids3zusAp_736l8r0P8S9;
h$$mainZCMzids3zusAp_736l8r0P8S9 = h$$mainZCMziwildzusAn_536l8r0P8S9;
h$r1 = h$$mainZCMzids3zusAp_736l8r0P8S9;
return h$rs();
});
FFI: correctly dispatch for foreign exports too
FFI: move C FFI desugaring into its own module
FFI: avoid DynFlags in toJsName (copy of toCName)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Various degrees of cleanup adapting GHCJS to GHC. We move several
functions to CoreUtils, remove duplication between the JS.Rts.Apply and
Apply module and factor out closure related code into a Closure module
for cohesion.
Deduplicate code between Rts.Apply and Apply
Move might_be_a_function into CoreUtils
Factorize closure stuff into Closure module
Rename closureExtra into closureField
Minor renamings, comments...
|
|
|
|
|
|
|
|
|
|
|
|
| |
* add closure manipulation helpers and use them in Apply
* add cache (Array) for pre-generated PAP names
* reduce line length:
* use BlockArguments instead of parens
* remove implicit mconcat in jVar's body
Rts: more refactorings
Rts: move into StgToJS hierarchy
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
JS.Rts: compiles
reword: progress on RtsTypes
StgToJS.Config: add SDoc Context
JSRts: move ppr, workaround def type
JSRts.Types: compiles
JS.Rts: closer to compiling
JS.Rts: move jsIdIdent' to StgToJS.Monad
JS.Rts: remove unused predicates
JS: cleanup, comment sections, math funcs to Make
JS.Rts.Types: compiles
StgToJS.Expr: fix compilation errors
StgToJS.DataCon: move initClosure
JS.Rts: remove Alloc module
JS.Rts: initalize Rts module, remove redundant fs
JS: init Rts.Alloc move initClosure
JS.Apply: unwinding combinators in progress
JS: add helpers and fixmes
JS.Rts.Apply: no more e's, add closure, reg helper
StgToJS: add ToStat instance ClosureInfo
JS.Rts.Apply: closer to compiling
JS.Rts.Apply: more removal of #
JS.Rts.Apply: (#) removed
JS.Rts.Apply: compiles
JS.Rts.Rts: just pretty printing left
JS.Rts: Add Notes
JS.Rts: add file headers and notes
JS.Rts.Rts: fixing stringy issues
JS.Rts.Rts: compiles
JS.Rts.Rts: fix non-exhaustive patterns warnings
|
|
Adapt code generator of GHCJS to GHC head. Currently it is only enabled
with the hidden -fjavascript flag. It produces .o files that can't be
used yet except by GHCJS's linker.
Codegen: doc
Codegen: correctly return linkable object
Now we can build a static library (-staticlib)
Codegen: doc genLit
Codegen: use assignAll
Codegen: introduce TypedExpr
Refactor assignAll et al, add documentation
Codegen: minor changes
Doc
|