9front - general discussion about 9front
 help / color / mirror / Atom feed
* netsurf native frontend
@ 2020-05-21 15:54 telephil9
  2020-05-21 16:06 ` [9front] " hiro
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: telephil9 @ 2020-05-21 15:54 UTC (permalink / raw)
  To: 9front; +Cc: telephil9

[-- Attachment #1: Type: text/plain, Size: 608 bytes --]

Hi,

I've just committed the initial release for the netsurf native frontend.
Feature-wise it is almost on par with the framebuffer frontend except for images that are not handled yet.
I tried to make it look and behave like a native application but would like to have some feedback on this.

All code is in the main repository: http://github.com/netsurf-plan9

In order not to mess with the current framebuffer frontend, I created a separate mkfile found in netsurf/mkfile.native.
To build this new frontend, just run mk as usual and then run mk -f mkfile.native in the netsurf directory.

Regards,
Philippe

[-- Attachment #2: ns9_20200521.png --]
[-- Type: image/png, Size: 22624 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9front] netsurf native frontend
  2020-05-21 15:54 netsurf native frontend telephil9
@ 2020-05-21 16:06 ` hiro
  2020-05-21 17:59 ` Romano
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 19+ messages in thread
From: hiro @ 2020-05-21 16:06 UTC (permalink / raw)
  To: 9front

now this is a real mothra killer emerging...
congrats telephil.


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9front] netsurf native frontend
  2020-05-21 15:54 netsurf native frontend telephil9
  2020-05-21 16:06 ` [9front] " hiro
@ 2020-05-21 17:59 ` Romano
  2020-07-28  7:11   ` [9front] netsurf native frontend (text_insert: illegal combination FCVTZSDW FCON NONE REG) Romano
  2020-05-21 21:16 ` [9front] netsurf native frontend Dave MacFarlane
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 19+ messages in thread
From: Romano @ 2020-05-21 17:59 UTC (permalink / raw)
  To: 9front, telephil9

Very cool, Philippe!

I'm testing a build now on 386.

Maybe it was mentioned previously and I didn't see it, but it looks like nsport is what someone needs to clone first: http://github.com/netsurf-plan9/nsport . Then cd into that dir and run 'fetch clone git', 'fetch clone ssh' or 'fetch clone http' (the instructions in README.plan9 say a simple 'fetch clone' without args would work, but it didn't work for me).

Note also that git9 changed the flag for creating a new branch: you might have to update the fetch script to use -n instead of -c.

I'll let you know how the build goes, and if I run in to any other gotchas.



On May 21, 2020 3:54:03 PM UTC, telephil9@gmail.com wrote:
>Hi,
>
>I've just committed the initial release for the netsurf native
>frontend.
>Feature-wise it is almost on par with the framebuffer frontend except
>for images that are not handled yet.
>I tried to make it look and behave like a native application but would
>like to have some feedback on this.
>
>All code is in the main repository: http://github.com/netsurf-plan9
>
>In order not to mess with the current framebuffer frontend, I created a
>separate mkfile found in netsurf/mkfile.native.
>To build this new frontend, just run mk as usual and then run mk -f
>mkfile.native in the netsurf directory.
>
>Regards,
>Philippe


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9front] netsurf native frontend
  2020-05-21 15:54 netsurf native frontend telephil9
  2020-05-21 16:06 ` [9front] " hiro
  2020-05-21 17:59 ` Romano
@ 2020-05-21 21:16 ` Dave MacFarlane
  2020-05-23 11:03   ` telephil9
  2020-05-23  4:08 ` kokamoto
  2020-05-24  2:13 ` sl
  4 siblings, 1 reply; 19+ messages in thread
From: Dave MacFarlane @ 2020-05-21 21:16 UTC (permalink / raw)
  To: 9front

Nice! A couple minor bug reports from the native version (on amd64):

1. When I first built it, the URL bar was taking up the whole window. Some
   combination of mk clean, mk 9res, mk install, and mk -f mkfile.native install seems
   to have fixed it. (Probably some dependency not reflected in the mkfile, I wouldn't
   worry about it since it works on a clean(?) install..)
2. When scrolled in a window and you try typing in a textbox, the location of where
   it tries to draw the content isn't taking the scroll into account

Not bugs, but since you're asking for feedback on how to make it feel more native
1. Middle clicking on the scroll bar doesn't scroll to that location as I'd expect from
   a native app. (Similarly, left/right clicking doesn't seem to be context sensitive
   wrt to where you clicked in the scrollbar)
2. You can't select text in the URL bar (in particular, double clicking to select all.)
   (the framebuffer version also has/had this problem)
3. Being able to select text to plumb it would be nice.



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9front] netsurf native frontend
  2020-05-21 15:54 netsurf native frontend telephil9
                   ` (2 preceding siblings ...)
  2020-05-21 21:16 ` [9front] netsurf native frontend Dave MacFarlane
@ 2020-05-23  4:08 ` kokamoto
  2020-05-23  6:13   ` Eli Cohen
  2020-05-23 20:10   ` jamos
  2020-05-24  2:13 ` sl
  4 siblings, 2 replies; 19+ messages in thread
From: kokamoto @ 2020-05-23  4:08 UTC (permalink / raw)
  To: 9front

> would like to have some feedback on this.

I don't know why you implemented this, what was your
dislike point of the framebuffer netsurf?

By the way, I can input 日本語(Japanese) into the google
search window of the opening panel, without to compile
for freetype Japanese fonts.

Kenji



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9front] netsurf native frontend
  2020-05-23  4:08 ` kokamoto
@ 2020-05-23  6:13   ` Eli Cohen
  2020-05-23  6:18     ` telephil9
  2020-05-23 20:10   ` jamos
  1 sibling, 1 reply; 19+ messages in thread
From: Eli Cohen @ 2020-05-23  6:13 UTC (permalink / raw)
  To: 9front

I'm having trouble getting this working. it gets stuck when I first
open it, at the bottom it says "loading" and never loads. I had this
problem with nsfb before I ran mk 9res, but I can't figure out what
I'm doing wrong here.

On Fri, May 22, 2020 at 9:08 PM <kokamoto@hera.eonet.ne.jp> wrote:
>
> > would like to have some feedback on this.
>
> I don't know why you implemented this, what was your
> dislike point of the framebuffer netsurf?
>
> By the way, I can input 日本語(Japanese) into the google
> search window of the opening panel, without to compile
> for freetype Japanese fonts.
>
> Kenji
>


-- 
http://echoline.org


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9front] netsurf native frontend
  2020-05-23  6:13   ` Eli Cohen
@ 2020-05-23  6:18     ` telephil9
  2020-05-23  6:37       ` Eli Cohen
  0 siblings, 1 reply; 19+ messages in thread
From: telephil9 @ 2020-05-23  6:18 UTC (permalink / raw)
  To: 9front

Make sure you sysupdate 9front first.
There was an issue with libdraw etimer under APE that was fixed in this commit:
http://code.9front.org/hg/plan9front/rev/4be989798860


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9front] netsurf native frontend
  2020-05-23  6:18     ` telephil9
@ 2020-05-23  6:37       ` Eli Cohen
  0 siblings, 0 replies; 19+ messages in thread
From: Eli Cohen @ 2020-05-23  6:37 UTC (permalink / raw)
  To: 9front

ah, thank you, that fixed my problem. this frontend seems a lot
better, nsfb uses 100% cpu and syscall on my system. I'm a bit
disappointed irccloud.com doesn't work, but it seems to be a problem
with netsurf itself, not the 9front ports

On Fri, May 22, 2020 at 11:19 PM <telephil9@gmail.com> wrote:
>
> Make sure you sysupdate 9front first.
> There was an issue with libdraw etimer under APE that was fixed in this commit:
> http://code.9front.org/hg/plan9front/rev/4be989798860



-- 
http://echoline.org


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9front] netsurf native frontend
  2020-05-21 21:16 ` [9front] netsurf native frontend Dave MacFarlane
@ 2020-05-23 11:03   ` telephil9
  2020-05-23 15:42     ` Stanley Lieber
  2020-05-23 16:13     ` Stanley Lieber
  0 siblings, 2 replies; 19+ messages in thread
From: telephil9 @ 2020-05-23 11:03 UTC (permalink / raw)
  To: 9front

Hi,

Thanks for the feedback.

> 2. When scrolled in a window and you try typing in a textbox, the location of where
>    it tries to draw the content isn't taking the scroll into account
> 
Fixed.

> 1. Middle clicking on the scroll bar doesn't scroll to that location as I'd expect from
>    a native app. (Similarly, left/right clicking doesn't seem to be context sensitive
>    wrt to where you clicked in the scrollbar)
Fixed.

Text selection is on my todo but I did not get to it yet.
Same goes for the url entry, I just made it usable enough but it clearly lacks many features. Note that you can remove all text by pressing the escape key.

Regards,
Philippe


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9front] netsurf native frontend
  2020-05-23 11:03   ` telephil9
@ 2020-05-23 15:42     ` Stanley Lieber
  2020-05-23 16:13     ` Stanley Lieber
  1 sibling, 0 replies; 19+ messages in thread
From: Stanley Lieber @ 2020-05-23 15:42 UTC (permalink / raw)
  To: 9front

rc: /bin/git/branch:120: token EOF: syntax error


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9front] netsurf native frontend
  2020-05-23 11:03   ` telephil9
  2020-05-23 15:42     ` Stanley Lieber
@ 2020-05-23 16:13     ` Stanley Lieber
  1 sibling, 0 replies; 19+ messages in thread
From: Stanley Lieber @ 2020-05-23 16:13 UTC (permalink / raw)
  To: 9front

sorry, my git9 was out of date.

sl


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9front] netsurf native frontend
  2020-05-23  4:08 ` kokamoto
  2020-05-23  6:13   ` Eli Cohen
@ 2020-05-23 20:10   ` jamos
  2020-05-24  0:02     ` kokamoto
  1 sibling, 1 reply; 19+ messages in thread
From: jamos @ 2020-05-23 20:10 UTC (permalink / raw)
  To: 9front; +Cc: kokamoto

Kenji,

Philippe’s new native netsurf frontend is a big step forward. It uses 
the same core components and libraries as nsfb, but has a GUI using the 
plan 9 drawing primitives directly, as well as the plan 9 event and font 
handling. A native frontend has much more control over what happens, and 
it is possible to layout components in the browser as we wish, e.g. 
having plan 9 style scrollbars.

The framebuffer frontend in Netsurf has its own plotting functions that 
modifies a memory bitmap, and the plan 9 framebuffer driver (surface) 
then synchonises that bitmap with a Plan 9 window Image using 
loadimage() - for the updated area. The framebuffer frontend is foremost 
designed to run close to hardware, like embedded systems, or on a 
graphics console. It polls for events once a second, which makes the UI 
a bit unresponsive, and also consumes a bit more cpu cycles when nothing 
happens. It also has its internal event handling mechanism that doesn’t 
map 1:1 to the one in plan 9.

Netsurf’s native frontends generally have much more functionality than 
the framebuffer frontend (which is more fixed), and they are designed to 
integrate with higher-level functions exported by operating system. The 
framebuffer frontend has a lot of built-in functionality, such as basic 
font handling, which made it an easier target to start with.

The Plan 9 frontend will (if things go well) become one of the Netsurf’s 
official frontends, living in its own directory, side by side with other 
native frontends for Amiga, Atari ST, BeOS/Haiku, Unix, RiscOS, and 
Windows. Being closer to the upstream, also means that it will be easier 
to keep up with upcoming tip changes, benefitting, for example, from 
improved rendering and javascript support.

It is an advantage that we now have two frontends for plan 9, as they 
can be compared both visually and performance wise. I've already noticed 
that the native frontend is much quicker if you rcpu to another machine 
and run the browser from there.

Jonas

On 2020-05-23 07:08, kokamoto@hera.eonet.ne.jp wrote:

>> would like to have some feedback on this.
> 
> I don't know why you implemented this, what was your
> dislike point of the framebuffer netsurf?
> 
> By the way, I can input 日本語(Japanese) into the google
> search window of the opening panel, without to compile
> for freetype Japanese fonts.
> 
> Kenji


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9front] netsurf native frontend
  2020-05-23 20:10   ` jamos
@ 2020-05-24  0:02     ` kokamoto
  2020-05-25  3:51       ` kokamoto
  0 siblings, 1 reply; 19+ messages in thread
From: kokamoto @ 2020-05-24  0:02 UTC (permalink / raw)
  To: 9front

Thanks Jonas!
Yes, I wanted to see this like technical background.

> It is an advantage that we now have two frontends for plan 9, as they 
> can be compared both visually and performance wise. I've already noticed 
> that the native frontend is much quicker if you rcpu to another machine 
> and run the browser from there.

Yes, it may be, however, we don't see jpg/png images yet, which make
the load page very slow...

By the way, nsgenbind() is not used, why... (This is my first time to update
nsport☺)

Kenji



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9front] netsurf native frontend
  2020-05-21 15:54 netsurf native frontend telephil9
                   ` (3 preceding siblings ...)
  2020-05-23  4:08 ` kokamoto
@ 2020-05-24  2:13 ` sl
  4 siblings, 0 replies; 19+ messages in thread
From: sl @ 2020-05-24  2:13 UTC (permalink / raw)
  To: 9front

the history button seems to have vanished.

sl


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9front] netsurf native frontend
  2020-05-24  0:02     ` kokamoto
@ 2020-05-25  3:51       ` kokamoto
  0 siblings, 0 replies; 19+ messages in thread
From: kokamoto @ 2020-05-25  3:51 UTC (permalink / raw)
  To: 9front

> By the way, nsgenbind() is not used, why... (This is my first time to update
> nsport☺)

I forgot that I had copied nsgenbind-lexer.[ch], negenbind-parser.[ch] etc from
linux port.  So, it's not so different to have genfiles/netsurf/duktape/*.

Kenji



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [9front] netsurf native frontend (text_insert: illegal combination FCVTZSDW FCON NONE REG)
  2020-05-21 17:59 ` Romano
@ 2020-07-28  7:11   ` Romano
  2020-07-29  6:08     ` arm64 fails to link when float converted to int (Was Re: [9front] netsurf native frontend (text_insert: illegal combination FCVTZSDW FCON NONE REG)) Romano
  0 siblings, 1 reply; 19+ messages in thread
From: Romano @ 2020-07-28  7:11 UTC (permalink / raw)
  To: 9front, telephil9

Philippe,

I attempted to build on a rpi4 using the arm64 kernel ( I ran a sysupdate on Saturday). The framebuffer executable builds fine, but at the very last step of building the native front-end I'm getting an error:

pcc -o 7.netsurf utils/bloom.7 utils/corestrings.7 utils/file.7 utils/filename.7 utils/filepath.7 utils/hashmap.7 utils/hashtable.7 utils/http/cache-control.7 utils/http/challenge.7 utils/http/content-disposition.7 utils/http/content-type.7 utils/http/generics.7 utils/http/parameter.7 utils/http/primitives.7 utils/http/strict-transport-security.7 utils/http/www-authenticate.7 utils/idna.7 utils/libdom.7 utils/log.7 utils/messages.7 utils/nsoption.7 utils/nsurl/nsurl.7 utils/nsurl/parse.7 utils/punycode.7 utils/ssl_certs.7 utils/talloc.7 utils/time.7 utils/url.7 utils/useragent.7 utils/utf8.7 utils/utils.7 content/content.7 content/content_factory.7 content/dirlist.7 content/fetch.7 content/fetchers/about.7 content/fetchers/data.7 content/fetchers/file.7 content/fetchers/resource.7 content/fs_backing_store.7 content/handlers/css/css.7 content/handlers/css/dump.7 content/handlers/css/hints.7 content/handlers/css/internal.7 content/handlers/css/select.7 content/handlers/css/utils.7 content/handlers/html/box.7 content/handlers/html/box_construct.7 content/handlers/html/box_normalise.7 content/handlers/html/box_textarea.7 content/handlers/html/font.7 content/handlers/html/form.7 content/handlers/html/html.7 content/handlers/html/html_css.7 content/handlers/html/html_css_fetcher.7 content/handlers/html/html_forms.7 content/handlers/html/html_object.7 content/handlers/html/html_redraw.7 content/handlers/html/html_redraw_border.7 content/handlers/html/html_script.7 content/handlers/html/imagemap.7 content/handlers/html/interaction.7 content/handlers/html/layout.7 content/handlers/html/search.7 content/handlers/html/table.7 content/handlers/image/bmp.7 content/handlers/image/gif.7 content/handlers/image/ico.7 content/handlers/image/image.7 content/handlers/image/image_cache.7 content/handlers/javascript/content.7 content/handlers/javascript/duktape/dukky.7 content/handlers/javascript/duktape/duktape.7 content/handlers/javascript/fetcher.7 content/handlers/text/textplain.7 content/hlcache.7 content/llcache.7 content/mimesniff.7 content/no_backing_store.7 content/urldb.7 content/webfs.7 desktop/browser.7 desktop/browser_history.7 desktop/browser_window.7 desktop/cookie_manager.7 desktop/cw_helper.7 desktop/download.7 desktop/font_haru.7 desktop/frames.7 desktop/global_history.7 desktop/gui_factory.7 desktop/hotlist.7 desktop/knockout.7 desktop/local_history.7 desktop/mouse.7 desktop/netsurf.7 desktop/page-info.7 desktop/plot_style.7 desktop/print.7 desktop/save_pdf.7 desktop/save_text.7 desktop/scrollbar.7 desktop/search.7 desktop/searchweb.7 desktop/selection.7 desktop/sslcert_viewer.7 desktop/system_colour.7 desktop/textarea.7 desktop/textinput.7 desktop/treeview.7 desktop/version.7 frontends/plan9/plotter.7 frontends/plan9/schedule.7 frontends/plan9/window.7 frontends/plan9/fetch.7 frontends/plan9/bitmap.7 frontends/plan9/layout.7 frontends/plan9/clipboard.7 frontends/plan9/utils.7 frontends/plan9/gui.7 frontends/plan9/drawui/data.7 frontends/plan9/drawui/window.7 frontends/plan9/drawui/button.7 frontends/plan9/drawui/entry.7 frontends/plan9/drawui/toolbar.7 frontends/plan9/drawui/scrollbar.7 ../posix/src/iconv.7 ../posix/src/preadwrite.7 ../posix/src/math9.7 content/handlers/javascript/duktape/libduktape.7.a ../libnspsl/src/libnspsl.7.a ../libdom/src/libdom.7.a ../libcss/src/libcss.7.a ../libhubbub/src/libhubbub.7.a ../libparserutils/src/libparserutils.7.a ../libwapcaplet/src/libwapcaplet.7.a ../libnsutils/src/libnsutils.7.a ../libnslog/src/libnslog.7.a ../libnsbmp/src/libnsbmp.7.a ../libnsgif/src/libnsgif.7.a ../libutf8proc/src/libutf8proc.7.a
text_insert: illegal combination FCVTZSDW FCON NONE REG
(1705)	FCVTZSDW	$1.500000e+00,R5
text_insert: illegal combination FCVTZSDW FCON NONE REG
(1705)	FCVTZSDW	$1.500000e+00,R5
pcc: 7l: 7l 101895: error
mk: pcc -o 7.netsurf ...  : exit status=rc 101892: pcc 101894: 7l: 7l 101895: error

Any ideas? Is this is a problem with the 7l linker specifically not knowing how to translate an instruction to arm64 assembly? Do you need more information?

On Thu, May 21, 2020, at 10:59 AM, Romano wrote:
> Very cool, Philippe!
> 
> I'm testing a build now on 386.
> 
> Maybe it was mentioned previously and I didn't see it, but it looks 
> like nsport is what someone needs to clone first: 
> http://github.com/netsurf-plan9/nsport . Then cd into that dir and run 
> 'fetch clone git', 'fetch clone ssh' or 'fetch clone http' (the 
> instructions in README.plan9 say a simple 'fetch clone' without args 
> would work, but it didn't work for me).
> 
> Note also that git9 changed the flag for creating a new branch: you 
> might have to update the fetch script to use -n instead of -c.
> 
> I'll let you know how the build goes, and if I run in to any other gotchas.
> 
> 
> 
> On May 21, 2020 3:54:03 PM UTC, telephil9@gmail.com wrote:
> >Hi,
> >
> >I've just committed the initial release for the netsurf native
> >frontend.
> >Feature-wise it is almost on par with the framebuffer frontend except
> >for images that are not handled yet.
> >I tried to make it look and behave like a native application but would
> >like to have some feedback on this.
> >
> >All code is in the main repository: http://github.com/netsurf-plan9
> >
> >In order not to mess with the current framebuffer frontend, I created a
> >separate mkfile found in netsurf/mkfile.native.
> >To build this new frontend, just run mk as usual and then run mk -f
> >mkfile.native in the netsurf directory.
> >
> >Regards,
> >Philippe
>


^ permalink raw reply	[flat|nested] 19+ messages in thread

* arm64 fails to link when float converted to int (Was Re: [9front] netsurf native frontend (text_insert: illegal combination FCVTZSDW FCON NONE REG))
  2020-07-28  7:11   ` [9front] netsurf native frontend (text_insert: illegal combination FCVTZSDW FCON NONE REG) Romano
@ 2020-07-29  6:08     ` Romano
  2020-08-01 11:43       ` cinap_lenrek
  0 siblings, 1 reply; 19+ messages in thread
From: Romano @ 2020-07-29  6:08 UTC (permalink / raw)
  To: 9front, telephil9

TLDR; netsurf/frontends/plan9/drawui/entry.c:162 multiplies d->entry by 1.5. Changing the factor to 2 (an int) resolves. Here's a test .c file that reproduces the problem:
cpu% cat arm64-int-test.c
#include <u.h>
#include <libc.h>

void
main()
{
    int size = 1;
	size*=1.5;
    exits(0);
}
cpu% 7c arm64-int-test.c
cpu% 7l arm64-int-test.7
main: illegal combination FCVTZSDW FCON NONE REG
(833)	FCVTZSDW	$1.500000e+00,R2
main: illegal combination FCVTZSDW FCON NONE REG
(833)	FCVTZSDW	$1.500000e+00,R2
cpu%

Narrative:

So I tried poking around a bit more: googling initially didn't appear all that helpful. It appears the logic is the same as Go's compiler, which refers to 7l from Plan9 (copyrights dating back to the '90s). I ran acid to show the stack trace and the registers. I don't know how to determine which archived library code this machine code is being generated for, or if that's even the place to look for this type of error. 

cpu% acid /bin/7l
/bin/7l:arm64 plan 9 executable
/sys/lib/acid/port
/sys/lib/acid/arm64
acid: progargs = "-o 7.netsurf utils/bloom.7 utils/corestrings.7 utils/file.7 utils/filename.7 utils/filepath.7 utils/hashmap.7 utils/hashtable.7 utils/http/cache-control.7 utils/http/challenge.7 utils/http/content-disposition.7 utils/http/content-type.7 utils/http/generics.7 utils/http/parameter.7 utils/http/primitives.7 utils/http/strict-transport-security.7 utils/http/www-authenticate.7 utils/idna.7 utils/libdom.7 utils/log.7 utils/messages.7 utils/nsoption.7 utils/nsurl/nsurl.7 utils/nsurl/parse.7 utils/punycode.7 utils/ssl_certs.7 utils/talloc.7 utils/time.7 utils/url.7 utils/useragent.7 utils/utf8.7 utils/utils.7 content/content.7 content/content_factory.7 content/dirlist.7 content/fetch.7 content/fetchers/about.7 content/fetchers/data.7 content/fetchers/file.7 content/fetchers/resource.7 content/fs_backing_store.7 content/handlers/css/css.7 content/handlers/css/dump.7 content/handlers/css/hints.7 content/handlers/css/internal.7 content/handlers/css/select.7 content/handlers/css/utils.7 content/handlers/html/box.7 content/handlers/html/box_construct.7 content/handlers/html/box_normalise.7 content/handlers/html/box_textarea.7 content/handlers/html/font.7 content/handlers/html/form.7 content/handlers/html/html.7 content/handlers/html/html_css.7 content/handlers/html/html_css_fetcher.7 content/handlers/html/html_forms.7 content/handlers/html/html_object.7 content/handlers/html/html_redraw.7 content/handlers/html/html_redraw_border.7 content/handlers/html/html_script.7 content/handlers/html/imagemap.7 content/handlers/html/interaction.7 content/handlers/html/layout.7 content/handlers/html/search.7 content/handlers/html/table.7 content/handlers/image/bmp.7 content/handlers/image/gif.7 content/handlers/image/ico.7 content/handlers/image/image.7 content/handlers/image/image_cache.7 content/handlers/javascript/content.7 content/handlers/javascript/duktape/dukky.7 content/handlers/javascript/duktape/duktape.7 content/handlers/javascript/fetcher.7 content/handlers/text/textplain.7 content/hlcache.7 content/llcache.7 content/mimesniff.7 content/no_backing_store.7 content/urldb.7 content/webfs.7 desktop/browser.7 desktop/browser_history.7 desktop/browser_window.7 desktop/cookie_manager.7 desktop/cw_helper.7 desktop/download.7 desktop/font_haru.7 desktop/frames.7 desktop/global_history.7 desktop/gui_factory.7 desktop/hotlist.7 desktop/knockout.7 desktop/local_history.7 desktop/mouse.7 desktop/netsurf.7 desktop/page-info.7 desktop/plot_style.7 desktop/print.7 desktop/save_pdf.7 desktop/save_text.7 desktop/scrollbar.7 desktop/search.7 desktop/searchweb.7 desktop/selection.7 desktop/sslcert_viewer.7 desktop/system_colour.7 desktop/textarea.7 desktop/textinput.7 desktop/treeview.7 desktop/version.7 frontends/plan9/plotter.7 frontends/plan9/schedule.7 frontends/plan9/window.7 frontends/plan9/fetch.7 frontends/plan9/bitmap.7 frontends/plan9/layout.7 frontends/plan9/clipboard.7 frontends/plan9/utils.7 frontends/plan9/gui.7 frontends/plan9/drawui/data.7 frontends/plan9/drawui/window.7 frontends/plan9/drawui/button.7 frontends/plan9/drawui/entry.7 frontends/plan9/drawui/toolbar.7 frontends/plan9/drawui/scrollbar.7 ../posix/src/iconv.7 ../posix/src/preadwrite.7 ../posix/src/math9.7 content/handlers/javascript/duktape/libduktape.7.a ../libnspsl/src/libnspsl.7.a ../libdom/src/libdom.7.a ../libcss/src/libcss.7.a ../libhubbub/src/libhubbub.7.a ../libparserutils/src/libparserutils.7.a ../libwapcaplet/src/libwapcaplet.7.a ../libnsutils/src/libnsutils.7.a ../libnslog/src/libnslog.7.a ../libnsbmp/src/libnsbmp.7.a ../libnsgif/src/libnsgif.7.a ../libutf8proc/src/libutf8proc.7.a /arm64/lib/ape/libap.a"
acid: new()
144283: ???	_main	MOV	R30,-160(SP)!
144283: ???	main+0x4	MOVWU	R0,104(SP)
Notes pending:
	sys: trap: BRK instruction
acid: filepc("/sys/src/cmd/7l/span.c:749")
<stdin>:4: (error) no function pcwhere
acid: filepc("/sys/src/cmd/7l/span.c:749")
acid: ma = filepc("/sys/src/cmd/7l/span.c:751")
acid: print(ma)
123496
acid: setbp(123496)
<stdin>:10: (error) no function setbp
acid: bpset(123496)
acid: cont()
text_insert: illegal combination FCVTZSDW FCON NONE REG
144283: ???	oplook+0x248	BL	prasm(SB)
Notes pending:
	sys: trap: BRK instruction
acid: lstk()
oplook(p=0x52ea258)+0x248 /sys/src/cmd/7l/span.c:751
	a1=0x1935000000012
	a3=0x1b0c969000000001
	e=0x32b70
	o=0x0
span()+0x7c /sys/src/cmd/7l/span.c:37
	bflag=0x400000000
	otxt=0x163bec00163bd0
	c=0x163bec
	p=0x52ea258
	m=0x7000000004
main(argc=0x8e,argv=0x1fffef180)+0x494 /sys/src/cmd/7l/obj.c:240
	_argc=0x6f
	_args=0x1fffef193
_main+0x28 /sys/src/libc/arm64/main9.s:17
acid: regs()
R0	0x00000000052ea258 R1	0x00000001fffee810 R2	0x0000000000028bf4
R3	0x0000000020000000 R4	0x0000000000000001 R5	0x000000000002339b
R6	0x0000000000000120 R7	0x0000000000000000 R8	0x000000004a200000
R9	0x0000000000000000 R10	0x00000001fffeea30 R11	0x0000000000000000
R12	0x0000000000000038 R13	0x0000000000000038 R14	0x0000000000000038
R15	0x0000000000000038 R16	0x97a3d7a220310c00 R17	0xffffffffc00f9f0c
R18	0x0875b486156a038a R19	0xabbd7f2d00000600 R20	0xbdfb65a508018891
R21	0xfb8eef8303a1c056 R22	0x7701204088940008 R23	0x30bd38232a00814d
R24	0x0ba2cb7a34057080 R25	0xf6faa6d3e3bed2fb R26	0xffffffffc08e20a8
R27	0xffffffffc007e000 R28	0x0000000000030000 R29	0xffffffffc0088958
R30	0x000000000001e264
acid: step()
(1705)	FCVTZSDW	$1.500000e+00,R5
text_insert: illegal combination FCVTZSDW FCON NONE REG
(1705)	FCVTZSDW	$1.500000e+00,R5
<stdin>:21: (error) msg: pid=144283 startstop: process exited
acid:

From a couple of the Go sources, it's clear that FCVTZSDW is converting 64float to 32int[1][2],so for me it's understandable that 1.5 can't be converted to an integer. The connection of 1.5e0 to 1.5 didn't dawn on me immediately, however. I ended up watching a youtube on ARM development, then reading ARM developer docs and a blog post about ARM development[3]: they all didn't seem to help me understand how to figure out the location of the problem. So after a bit of contemplation, I figured searching for 1.5 in the netsurf source might yield something. Since 7.nsfb builds fine, I wasn't quite sure it would help much, but what had I to lose, except more time?

cpu%  walk . | grep '\.c$' | xargs grep '[^0-9]1\.5'
./content/handlers/css/select.c:		FLTTOFIX(1.5000), /* x-large */
./content/handlers/html/layout.c:				size = FLTTOFIX(1.5);
./content/handlers/javascript/duktape/duktape.c:			 * (e.g. '1.5e+2').  This clause catches NULs.
./content/handlers/javascript/duktape/duktape.c:	 *  -1.5 -> floor(-1.0) -> -1  (towards +Inf)
./content/handlers/javascript/duktape/duktape.c:	 *  +1.5 -> floor(+2.0) -> 2   (towards +Inf)
./content/handlers/javascript/duktape/duktape.c:	 * Lua 5.1.5, and different hash initializer.
./content/handlers/javascript/duktape/duktape.c:	/* Number/string -> coerce string to number (e.g. "'1.5' == 1.5" -> true). */
./content/handlers/javascript/duktape/duktape.c: *    10.2.1.1.5 DeleteBinding (N)  [declarative environment record]
./content/handlers/javascript/duktape/duktape.c:	 * the double is out-of-range.  C99 Section 6.3.1.5:
./frontends/riscos/window.c:				1.5, 2.0, 3.0, 4.0, 6.0, 8.0, 12.0, 16.0};
./frontends/plan9/drawui/entry.c:		entry->size *= 1.5;

Huh, 1.5 in plan9 drawui. Change that to 2, and the linking was successful!  I'm happy that netsurf now builds on arm64, but this raises a question of why this doesn't cause a problem for i386 (the other arch I built netsurf on back in May). I reviewed the dentry struct in entry.h in the same directory and see that entry is of type int, so maybe on other architectures it's just rounded? For instance, on p. 42 in The C Programming Language, Section 2.7 contains this section: "Expressions that might lose information , like assigning a longer integer type to a shorter, or a floating-point type to an integer, may draw a warning, but they are not illegal." The arm64 compiler could emit the warning but still apply the operation (maybe it would be something like converting the int to a float, then multiplying, then rounding to get an int again).  At any rate, the test script above can be used as a test for anyone looking to reproduce the problem, and if desired, provide a solution.

[1] https://www.golang.ir/src/cmd/compile/internal/ssa/opGen.go
[2] https://www.golang.ir/src/cmd/compile/internal/ssa/rewriteARM64.go
[3] https://modexp.wordpress.com/2018/10/30/arm64-assembly/

On Tue, Jul 28, 2020, at 12:11 AM, Romano wrote:
> Philippe,
> 
> I attempted to build on a rpi4 using the arm64 kernel ( I ran a 
> sysupdate on Saturday). The framebuffer executable builds fine, but at 
> the very last step of building the native front-end I'm getting an 
> error:
> 
> pcc -o 7.netsurf utils/bloom.7 utils/corestrings.7 utils/file.7 
> utils/filename.7 utils/filepath.7 utils/hashmap.7 utils/hashtable.7 
> utils/http/cache-control.7 utils/http/challenge.7 
> utils/http/content-disposition.7 utils/http/content-type.7 
> utils/http/generics.7 utils/http/parameter.7 utils/http/primitives.7 
> utils/http/strict-transport-security.7 utils/http/www-authenticate.7 
> utils/idna.7 utils/libdom.7 utils/log.7 utils/messages.7 
> utils/nsoption.7 utils/nsurl/nsurl.7 utils/nsurl/parse.7 
> utils/punycode.7 utils/ssl_certs.7 utils/talloc.7 utils/time.7 
> utils/url.7 utils/useragent.7 utils/utf8.7 utils/utils.7 
> content/content.7 content/content_factory.7 content/dirlist.7 
> content/fetch.7 content/fetchers/about.7 content/fetchers/data.7 
> content/fetchers/file.7 content/fetchers/resource.7 
> content/fs_backing_store.7 content/handlers/css/css.7 
> content/handlers/css/dump.7 content/handlers/css/hints.7 
> content/handlers/css/internal.7 content/handlers/css/select.7 
> content/handlers/css/utils.7 content/handlers/html/box.7 
> content/handlers/html/box_construct.7 
> content/handlers/html/box_normalise.7 
> content/handlers/html/box_textarea.7 content/handlers/html/font.7 
> content/handlers/html/form.7 content/handlers/html/html.7 
> content/handlers/html/html_css.7 
> content/handlers/html/html_css_fetcher.7 
> content/handlers/html/html_forms.7 content/handlers/html/html_object.7 
> content/handlers/html/html_redraw.7 
> content/handlers/html/html_redraw_border.7 
> content/handlers/html/html_script.7 content/handlers/html/imagemap.7 
> content/handlers/html/interaction.7 content/handlers/html/layout.7 
> content/handlers/html/search.7 content/handlers/html/table.7 
> content/handlers/image/bmp.7 content/handlers/image/gif.7 
> content/handlers/image/ico.7 content/handlers/image/image.7 
> content/handlers/image/image_cache.7 
> content/handlers/javascript/content.7 
> content/handlers/javascript/duktape/dukky.7 
> content/handlers/javascript/duktape/duktape.7 
> content/handlers/javascript/fetcher.7 content/handlers/text/textplain.7 
> content/hlcache.7 content/llcache.7 content/mimesniff.7 
> content/no_backing_store.7 content/urldb.7 content/webfs.7 
> desktop/browser.7 desktop/browser_history.7 desktop/browser_window.7 
> desktop/cookie_manager.7 desktop/cw_helper.7 desktop/download.7 
> desktop/font_haru.7 desktop/frames.7 desktop/global_history.7 
> desktop/gui_factory.7 desktop/hotlist.7 desktop/knockout.7 
> desktop/local_history.7 desktop/mouse.7 desktop/netsurf.7 
> desktop/page-info.7 desktop/plot_style.7 desktop/print.7 
> desktop/save_pdf.7 desktop/save_text.7 desktop/scrollbar.7 
> desktop/search.7 desktop/searchweb.7 desktop/selection.7 
> desktop/sslcert_viewer.7 desktop/system_colour.7 desktop/textarea.7 
> desktop/textinput.7 desktop/treeview.7 desktop/version.7 
> frontends/plan9/plotter.7 frontends/plan9/schedule.7 
> frontends/plan9/window.7 frontends/plan9/fetch.7 
> frontends/plan9/bitmap.7 frontends/plan9/layout.7 
> frontends/plan9/clipboard.7 frontends/plan9/utils.7 
> frontends/plan9/gui.7 frontends/plan9/drawui/data.7 
> frontends/plan9/drawui/window.7 frontends/plan9/drawui/button.7 
> frontends/plan9/drawui/entry.7 frontends/plan9/drawui/toolbar.7 
> frontends/plan9/drawui/scrollbar.7 ../posix/src/iconv.7 
> ../posix/src/preadwrite.7 ../posix/src/math9.7 
> content/handlers/javascript/duktape/libduktape.7.a 
> ../libnspsl/src/libnspsl.7.a ../libdom/src/libdom.7.a 
> ../libcss/src/libcss.7.a ../libhubbub/src/libhubbub.7.a 
> ../libparserutils/src/libparserutils.7.a 
> ../libwapcaplet/src/libwapcaplet.7.a ../libnsutils/src/libnsutils.7.a 
> ../libnslog/src/libnslog.7.a ../libnsbmp/src/libnsbmp.7.a 
> ../libnsgif/src/libnsgif.7.a ../libutf8proc/src/libutf8proc.7.a
> text_insert: illegal combination FCVTZSDW FCON NONE REG
> (1705)	FCVTZSDW	$1.500000e+00,R5
> text_insert: illegal combination FCVTZSDW FCON NONE REG
> (1705)	FCVTZSDW	$1.500000e+00,R5
> pcc: 7l: 7l 101895: error
> mk: pcc -o 7.netsurf ...  : exit status=rc 101892: pcc 101894: 7l: 7l 
> 101895: error
> 
> Any ideas? Is this is a problem with the 7l linker specifically not 
> knowing how to translate an instruction to arm64 assembly? Do you need 
> more information?
> 
> On Thu, May 21, 2020, at 10:59 AM, Romano wrote:
> > Very cool, Philippe!
> > 
> > I'm testing a build now on 386.
> > 
> > Maybe it was mentioned previously and I didn't see it, but it looks 
> > like nsport is what someone needs to clone first: 
> > http://github.com/netsurf-plan9/nsport . Then cd into that dir and run 
> > 'fetch clone git', 'fetch clone ssh' or 'fetch clone http' (the 
> > instructions in README.plan9 say a simple 'fetch clone' without args 
> > would work, but it didn't work for me).
> > 
> > Note also that git9 changed the flag for creating a new branch: you 
> > might have to update the fetch script to use -n instead of -c.
> > 
> > I'll let you know how the build goes, and if I run in to any other gotchas.
> > 
> > 
> > 
> > On May 21, 2020 3:54:03 PM UTC, telephil9@gmail.com wrote:
> > >Hi,
> > >
> > >I've just committed the initial release for the netsurf native
> > >frontend.
> > >Feature-wise it is almost on par with the framebuffer frontend except
> > >for images that are not handled yet.
> > >I tried to make it look and behave like a native application but would
> > >like to have some feedback on this.
> > >
> > >All code is in the main repository: http://github.com/netsurf-plan9
> > >
> > >In order not to mess with the current framebuffer frontend, I created a
> > >separate mkfile found in netsurf/mkfile.native.
> > >To build this new frontend, just run mk as usual and then run mk -f
> > >mkfile.native in the netsurf directory.
> > >
> > >Regards,
> > >Philippe
> >


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: arm64 fails to link when float converted to int (Was Re: [9front] netsurf native frontend (text_insert: illegal combination FCVTZSDW FCON NONE REG))
  2020-07-29  6:08     ` arm64 fails to link when float converted to int (Was Re: [9front] netsurf native frontend (text_insert: illegal combination FCVTZSDW FCON NONE REG)) Romano
@ 2020-08-01 11:43       ` cinap_lenrek
  2020-08-01 12:23         ` Anthony Martin
  0 siblings, 1 reply; 19+ messages in thread
From: cinap_lenrek @ 2020-08-01 11:43 UTC (permalink / raw)
  To: 9front

this is clearly a compiler bug.

lets compare with the other compilers:

term% for(i in 5c 7c 8c){echo $i; $i -o/dev/null -S a.c}
5c
	TEXT	main+0(SB),0,$8
	MOVW	$1,R1
	MOVD	$1.50000000000000000e+00,F0
	MOVWD	R1,F1 <- convert lhs to float
	MULD	F0,F1 <- do floatingpoint multiplication
	MOVDW	F1,R3 <- convert result back to integer
	MOVW	$0,R0
	BL	,exits+0(SB)
	RET	,
	END	,
7c
	TEXT	main+0(SB),0,$16
	MOVW	$1,R1
	FCVTZSDW	$1.50000000000000000e+00,R2	<- tries to convert rhs to int??
	MULW	R2,R1,R2 <- multiplication done in int? bug!
	MOV	$0,R0
	BL	,exits+0(SB)
	RETURN	,
	END	,
8c
	TEXT	main+0(SB),0,$20
	MOVL	$1,size+-4(SP)
	FMOVD	$(1.50000000000000000e+00),F0
	FMOVL	size+-4(SP),F0 <- convert lhs to float
	FMULDP	F0,F1 <- do floatingpoint multiplication

	FSTCW	,.safe+-16(SP)
	MOVW	$3967,.safe+-14(SP)
	FLDCW	.safe+-14(SP), <- hahahaha, thanks intel!
	FMOVLP	F0,.safe+-12(SP)
	FLDCW	.safe+-16(SP),
	MOVL	.safe+-12(SP),AX <- convert result back to integer

	MOVL	$0,(SP)
	CALL	,exits+0(SB)
	RET	,
	END	,

we have to do the operation using the type of the right hand side:

diff -r f8f63e944375 sys/src/cmd/7c/cgen.c
--- a/sys/src/cmd/7c/cgen.c	Fri Jul 17 16:53:20 2020 +0200
+++ b/sys/src/cmd/7c/cgen.c	Sat Aug 01 13:33:09 2020 +0200
@@ -287,10 +287,10 @@
 				reglcgen(&nod2, l, Z);
 			else
 				nod2 = *l;
-			regalloc(&nod, n, nn);
+			regalloc(&nod, r, nn);
 			cgen(r, &nod);
 		} else {
-			regalloc(&nod, n, nn);
+			regalloc(&nod, r, nn);
 			cgen(r, &nod);
 			if(l->addable < INDEXED)
 				reglcgen(&nod2, l, Z);

with that change, 7c properly does the multiplication in floating
point, and converts the result back to integer:

term% /sys/src/cmd/7c/6.out -o/dev/null -S a.c
	TEXT	main+0(SB),0,$16
	MOVW	$1,R1
	FMOVD	$1.50000000000000000e+00,F1
	SCVTFWD	R1,F4 <- convert left hand side to float
	FMULD	F1,F4,F1 <- do floatingpoint multiplication
	FCVTZSDW	F1,R1 <- convert result back to integer
	MOV	$0,R0
	BL	,exits+0(SB)
	RETURN	,
	END	,

we'll need to to do a bunch of test now to make sure this
change doesnt break anything.

feel free to test and report any errors would be appreciated.

--
cinap


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: arm64 fails to link when float converted to int (Was Re: [9front] netsurf native frontend (text_insert: illegal combination FCVTZSDW FCON NONE REG))
  2020-08-01 11:43       ` cinap_lenrek
@ 2020-08-01 12:23         ` Anthony Martin
  0 siblings, 0 replies; 19+ messages in thread
From: Anthony Martin @ 2020-08-01 12:23 UTC (permalink / raw)
  To: 9front

cinap_lenrek@felloff.net once said:
> we have to do the operation using the type of the right hand side:
> 
> diff -r f8f63e944375 sys/src/cmd/7c/cgen.c
> --- a/sys/src/cmd/7c/cgen.c	Fri Jul 17 16:53:20 2020 +0200
> +++ b/sys/src/cmd/7c/cgen.c	Sat Aug 01 13:33:09 2020 +0200
> @@ -287,10 +287,10 @@
>  				reglcgen(&nod2, l, Z);
>  			else
>  				nod2 = *l;
> -			regalloc(&nod, n, nn);
> +			regalloc(&nod, r, nn);
>  			cgen(r, &nod);
>  		} else {
> -			regalloc(&nod, n, nn);
> +			regalloc(&nod, r, nn);
>  			cgen(r, &nod);
>  			if(l->addable < INDEXED)
>  				reglcgen(&nod2, l, Z);
> 
> [...]
> 
> we'll need to to do a bunch of test now to make sure this
> change doesnt break anything.

A similar change was made here a while back:
https://bitbucket.org/64tharmybrigade/7acl/commits/7fcd631dd3

changeset:   177:7fcd631dd30f
user:        Charles Forsyth <charles.forsyth@gmail.com>
date:        Tue Jul 26 11:13:44 2016 +0100
files:       7c/cgen.c
description:
handle mixed-mode asops


diff --git a/7c/cgen.c b/7c/cgen.c
--- a/7c/cgen.c
+++ b/7c/cgen.c
@@ -287,28 +287,22 @@
 				reglcgen(&nod2, l, Z);
 			else
 				nod2 = *l;
-			regalloc(&nod, n, nn);
+			regalloc(&nod, r, nn);
 			cgen(r, &nod);
 		} else {
-			regalloc(&nod, n, nn);
+			regalloc(&nod, r, nn);
 			cgen(r, &nod);
 			if(l->addable < INDEXED)
 				reglcgen(&nod2, l, Z);
 			else
 				nod2 = *l;
 		}
-		regalloc(&nod1, n, Z);
-		gopcode(OAS, &nod2, Z, &nod1);
-		if(nod1.type->etype != nod.type->etype){
-			regalloc(&nod3, &nod, Z);
-			gmove(&nod1, &nod3);
-			regfree(&nod1);
-			nod1 = nod3;
-		}
+		regalloc(&nod1, &nod, nod1.type==nod2.type? nn: Z);
+		gmove(&nod2, &nod1);
 		gopcode(o, &nod, &nod1, &nod);
 		gmove(&nod, &nod2);
 		if(nn != Z)
-			gmove(&nod, nn);
+			gmove(&nod2, nn);
 		regfree(&nod);
 		regfree(&nod1);
 		if(l->addable < INDEXED)

  Anthony


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2020-08-01 12:23 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-21 15:54 netsurf native frontend telephil9
2020-05-21 16:06 ` [9front] " hiro
2020-05-21 17:59 ` Romano
2020-07-28  7:11   ` [9front] netsurf native frontend (text_insert: illegal combination FCVTZSDW FCON NONE REG) Romano
2020-07-29  6:08     ` arm64 fails to link when float converted to int (Was Re: [9front] netsurf native frontend (text_insert: illegal combination FCVTZSDW FCON NONE REG)) Romano
2020-08-01 11:43       ` cinap_lenrek
2020-08-01 12:23         ` Anthony Martin
2020-05-21 21:16 ` [9front] netsurf native frontend Dave MacFarlane
2020-05-23 11:03   ` telephil9
2020-05-23 15:42     ` Stanley Lieber
2020-05-23 16:13     ` Stanley Lieber
2020-05-23  4:08 ` kokamoto
2020-05-23  6:13   ` Eli Cohen
2020-05-23  6:18     ` telephil9
2020-05-23  6:37       ` Eli Cohen
2020-05-23 20:10   ` jamos
2020-05-24  0:02     ` kokamoto
2020-05-25  3:51       ` kokamoto
2020-05-24  2:13 ` sl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).