summaryrefslogtreecommitdiff
path: root/ghc/compiler/javaGen/JavaGen.lhs
diff options
context:
space:
mode:
authorqrczak <unknown>2000-08-07 23:37:24 +0000
committerqrczak <unknown>2000-08-07 23:37:24 +0000
commit4b17269854ccf10df8b3ca1711410a5ca439ea8a (patch)
tree7b12ea50c2ef9eb5c093d4e6402c3fd8b8529d4a /ghc/compiler/javaGen/JavaGen.lhs
parent514da0a6391a928e218c82208d9aca089e6caf78 (diff)
downloadhaskell-4b17269854ccf10df8b3ca1711410a5ca439ea8a.tar.gz
[project @ 2000-08-07 23:37:19 by qrczak]
Now Char, Char#, StgChar have 31 bits (physically 32). "foo"# is still an array of bytes. CharRep represents 32 bits (on a 64-bit arch too). There is also Int8Rep, used in those places where bytes were originally meant. readCharArray, indexCharOffAddr etc. still use bytes. Storable and {I,M}Array use wide Chars. In future perhaps all sized integers should be primitive types. Then some usages of indexing primops scattered through the code could be changed to then-available Int8 ones, and then Char variants of primops could be made wide (other usages that handle text should use conversion that will be provided later). I/O and _ccall_ arguments assume ISO-8859-1. UTF-8 is internally used for string literals (only). Z-encoding is ready for Unicode identifiers. Ranges of intlike and charlike closures are more easily configurable. I've probably broken nativeGen/MachCode.lhs:chrCode for Alpha but I don't know the Alpha assembler to fix it (what is zapnot?). Generally I'm not sure if I've done the NCG changes right. This commit breaks the binary compatibility (of course). TODO: * is* and to{Lower,Upper} in Char (in progress). * Libraries for text conversion (in design / experiments), to be plugged to I/O and a higher level foreign library. * PackedString. * StringBuffer and accepting source in encodings other than ISO-8859-1.
Diffstat (limited to 'ghc/compiler/javaGen/JavaGen.lhs')
-rw-r--r--ghc/compiler/javaGen/JavaGen.lhs6
1 files changed, 6 insertions, 0 deletions
diff --git a/ghc/compiler/javaGen/JavaGen.lhs b/ghc/compiler/javaGen/JavaGen.lhs
index 6093a807ba..6278a70d8e 100644
--- a/ghc/compiler/javaGen/JavaGen.lhs
+++ b/ghc/compiler/javaGen/JavaGen.lhs
@@ -605,6 +605,7 @@ suffix _ = ""
primName :: PrimType -> String
primName PrimInt = "int"
primName PrimChar = "char"
+primName PrimByte = "byte"
primName PrimBoolean = "boolean"
primName _ = error "unsupported primitive"
@@ -803,6 +804,9 @@ inttype = PrimType PrimInt
chartype :: Type
chartype = PrimType PrimChar
+bytetype :: Type
+bytetype = PrimType PrimByte
+
-- This lets you get inside a possible "Value" type,
-- to access the internal unboxed object.
access :: Expr -> Type -> Expr
@@ -811,6 +815,7 @@ access expr other = expr
accessPrim expr PrimInt = Call expr (Name "intValue" inttype) []
accessPrim expr PrimChar = Call expr (Name "charValue" chartype) []
+accessPrim expr PrimByte = Call expr (Name "byteValue" bytetype) []
accessPrim expr other = pprPanic "accessPrim" (text (show other))
-- This is where we map from typename to types,
@@ -831,6 +836,7 @@ primRepToType ::PrimRep -> Type
primRepToType PtrRep = objectType
primRepToType IntRep = inttype
primRepToType CharRep = chartype
+primRepToType Int8Rep = bytetype
primRepToType AddrRep = objectType
primRepToType other = pprPanic "primRepToType" (ppr other)